23 #include "AliAnalysisManager.h" 24 #include "AliAODEvent.h" 27 #include "AliESDEvent.h" 28 #include "AliESDtrack.h" 29 #include "AliESDtrackCuts.h" 30 #include "AliInputEventHandler.h" 31 #include "AliTrackerBase.h" 52 fClusterType(clusterType),
55 fAnalysisTrainMode("Grid"),
57 fMatchingResidual(0.2),
64 fVectorDeltaEtaDeltaPhi(0),
65 fMap_TrID_ClID_ToIndex(),
66 fSecMapTrackToCluster(),
67 fSecMapClusterToTrack(),
69 fSecVectorDeltaEtaDeltaPhi(0),
70 fSecMap_TrID_ClID_ToIndex(),
71 fSecMap_TrID_ClID_AlreadyTried(),
73 fHistControlMatches(NULL),
74 fSecHistControlMatches(NULL)
77 DefineInput(0, TChain::Class());
83 fMapTrackToCluster.clear();
84 fMapClusterToTrack.clear();
85 fVectorDeltaEtaDeltaPhi.clear();
86 fMap_TrID_ClID_ToIndex.clear();
88 fSecMapTrackToCluster.clear();
89 fSecMapClusterToTrack.clear();
90 fSecVectorDeltaEtaDeltaPhi.clear();
91 fSecMap_TrID_ClID_ToIndex.clear();
92 fSecMap_TrID_ClID_AlreadyTried.clear();
94 if(fHistControlMatches)
delete fHistControlMatches;
95 if(fSecHistControlMatches)
delete fSecHistControlMatches;
96 if(fAnalysisTrainMode.EqualTo(
"Grid")){
97 if(fListHistos != NULL){
105 fMapTrackToCluster.clear();
106 fMapClusterToTrack.clear();
107 fVectorDeltaEtaDeltaPhi.clear();
108 fMap_TrID_ClID_ToIndex.clear();
110 fSecMapTrackToCluster.clear();
111 fSecMapClusterToTrack.clear();
112 fSecVectorDeltaEtaDeltaPhi.clear();
113 fSecMap_TrID_ClID_ToIndex.clear();
114 fSecMap_TrID_ClID_AlreadyTried.clear();
119 if(fListHistos != NULL){
123 if(fListHistos == NULL){
124 fListHistos =
new TList();
125 fListHistos->SetOwner(kTRUE);
126 fListHistos->SetName(Form(
"CaloTrackMatcher_%i",fClusterType));
130 fHistControlMatches =
new TH2F(Form(
"ControlMatches_%i",fClusterType),Form(
"ControlMatches_%i",fClusterType),7,-0.5,6.5,50,0.15,200);
131 SetLogBinningYTH2(fHistControlMatches);
132 fHistControlMatches->GetYaxis()->SetTitle(
"track pT (GeV/c)");
133 fHistControlMatches->GetXaxis()->SetBinLabel(1,
"nTr in");
134 fHistControlMatches->GetXaxis()->SetBinLabel(2,
"no inner Tr params || track not in right direction");
135 fHistControlMatches->GetXaxis()->SetBinLabel(3,
"failed 1st pro-step");
136 fHistControlMatches->GetXaxis()->SetBinLabel(4,
"Tr not in EMCal acc");
137 fHistControlMatches->GetXaxis()->SetBinLabel(5,
"failed 2nd pro-step");
138 fHistControlMatches->GetXaxis()->SetBinLabel(6,
"w/o match to cluster");
139 fHistControlMatches->GetXaxis()->SetBinLabel(7,
"nTr out, w/ match");
140 fListHistos->Add(fHistControlMatches);
142 fSecHistControlMatches =
new TH2F(Form(
"ControlSecMatches_%i",fClusterType),Form(
"ControlSecMatches_%i",fClusterType),7,-0.5,6.5,50,0.15,200);
143 SetLogBinningYTH2(fSecHistControlMatches);
144 fSecHistControlMatches->GetYaxis()->SetTitle(
"track pT (GeV/c)");
145 fSecHistControlMatches->GetXaxis()->SetBinLabel(1,
"nTr in");
146 fSecHistControlMatches->GetXaxis()->SetBinLabel(2,
"no inner Tr params");
147 fSecHistControlMatches->GetXaxis()->SetBinLabel(3,
"failed 1st pro-step");
148 fSecHistControlMatches->GetXaxis()->SetBinLabel(4,
"Tr not in EMCal acc");
149 fSecHistControlMatches->GetXaxis()->SetBinLabel(5,
"failed 2nd pro-step");
150 fSecHistControlMatches->GetXaxis()->SetBinLabel(6,
"w/o match to cluster");
151 fSecHistControlMatches->GetXaxis()->SetBinLabel(7,
"nTr out, w/ match");
152 fListHistos->Add(fSecHistControlMatches);
158 fMapTrackToCluster.clear();
159 fMapClusterToTrack.clear();
161 fVectorDeltaEtaDeltaPhi.clear();
162 fMap_TrID_ClID_ToIndex.clear();
164 fSecMapTrackToCluster.clear();
165 fSecMapClusterToTrack.clear();
167 fSecVectorDeltaEtaDeltaPhi.clear();
168 fSecMap_TrID_ClID_ToIndex.clear();
169 fSecMap_TrID_ClID_AlreadyTried.clear();
171 if(fRunNumber == -1 || fRunNumber != runNumber){
172 if(fClusterType == 1 || fClusterType == 3){
173 fGeomEMCAL = AliEMCALGeometry::GetInstanceFromRunNumber(runNumber);
174 if(!fGeomEMCAL){ AliFatal(
"EMCal geometry not initialized!");}
175 }
else if(fClusterType == 2){
176 fGeomPHOS = AliPHOSGeometry::GetInstance();
177 if(!fGeomPHOS) AliFatal(
"PHOS geometry not initialized!");
179 fRunNumber = runNumber;
191 if(fClusterType == 1 || fClusterType == 2 || fClusterType == 3){
192 Initialize(fInputEvent->GetRunNumber());
193 ProcessEvent(fInputEvent);
204 TClonesArray * arrClusters = NULL;
205 if(!fCorrTaskSetting.CompareTo(
"")){
206 nClus =
event->GetNumberOfCaloClusters();
208 arrClusters =
dynamic_cast<TClonesArray*
>(
event->FindListObject(Form(
"%sClustersBranch",fCorrTaskSetting.Data())));
210 nClus = arrClusters->GetEntries();
212 AliError(Form(
"Could not find %sClustersBranch despite correction framework being used!",fCorrTaskSetting.Data()));
217 if(fClusterType == 1 || fClusterType == 3) nModules = fGeomEMCAL->GetNumberOfSuperModules();
218 else if(fClusterType == 2) nModules = fGeomPHOS->GetNModules();
225 AliError(
"Task needs AOD or ESD event, returning");
229 static AliESDtrackCuts *EsdTrackCuts = 0x0;
230 static int prevRun = -1;
232 Int_t runNumber = fInputEvent->GetRunNumber();
234 if (prevRun!=runNumber) {
241 if( (runNumber<=146860) || (runNumber>=197470 && runNumber<=197692) || (runNumber>=172440 && runNumber<=193766) ){
242 EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
244 }
else if (runNumber>=209122){
247 EsdTrackCuts =
new AliESDtrackCuts();
249 EsdTrackCuts->AliESDtrackCuts::SetMinNCrossedRowsTPC(70);
250 EsdTrackCuts->AliESDtrackCuts::SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
251 EsdTrackCuts->SetCutGeoNcrNcl(2., 130., 1.5, 0.0, 0.0);
253 EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterTPC(4);
254 EsdTrackCuts->AliESDtrackCuts::SetAcceptKinkDaughters(kFALSE);
255 EsdTrackCuts->AliESDtrackCuts::SetRequireTPCRefit(kTRUE);
257 EsdTrackCuts->AliESDtrackCuts::SetRequireITSRefit(kTRUE);
258 EsdTrackCuts->AliESDtrackCuts::SetClusterRequirementITS(AliESDtrackCuts::kSPD,
259 AliESDtrackCuts::kAny);
260 EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexXYPtDep(
"0.0105+0.0350/pt^1.1");
261 EsdTrackCuts->AliESDtrackCuts::SetMaxChi2TPCConstrainedGlobal(36);
262 EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexZ(2);
263 EsdTrackCuts->AliESDtrackCuts::SetDCAToVertex2D(kFALSE);
264 EsdTrackCuts->AliESDtrackCuts::SetRequireSigmaToVertex(kFALSE);
265 EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterITS(36);
268 EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011();
270 EsdTrackCuts->SetMaxDCAToVertexZ(2);
274 for (
Int_t itr=0;itr<
event->GetNumberOfTracks();itr++){
275 AliExternalTrackParam *trackParam = 0;
276 AliVTrack *inTrack = 0x0;
278 inTrack = esdev->GetTrack(itr);
279 if(!inTrack)
continue;
280 if(TMath::Abs(inTrack->Eta())>0.8 && (fClusterType==1 || fClusterType==3 ))
continue;
281 if(TMath::Abs(inTrack->Eta())>0.3 && fClusterType==2 )
continue;
282 if(inTrack->Pt()<0.5)
continue;
283 AliESDtrack *esdt =
dynamic_cast<AliESDtrack*
>(inTrack);
284 if(!EsdTrackCuts->AcceptTrack(esdt))
continue;
285 fHistControlMatches->Fill(0.,inTrack->Pt());
287 const AliExternalTrackParam *in = esdt->GetInnerParam();
288 if (!in){AliDebug(2,
"Could not get InnerParam of Track, continue"); fHistControlMatches->Fill(1.,inTrack->Pt());
continue;}
289 trackParam =
new AliExternalTrackParam(*in);
291 inTrack =
dynamic_cast<AliVTrack*
>(aodev->GetTrack(itr));
292 if(!inTrack)
continue;
293 if(inTrack->GetID()<0)
continue;
295 if(TMath::Abs(inTrack->Eta())>0.8 && (fClusterType==1 || fClusterType==3 ))
continue;
296 if(TMath::Abs(inTrack->Eta())>0.3 && fClusterType==2 )
continue;
297 if(inTrack->Pt()<0.5)
continue;
300 AliAODTrack *aodt =
dynamic_cast<AliAODTrack*
>(inTrack);
301 if(!aodt->IsHybridGlobalConstrainedGlobal())
continue;
302 Double_t xyz[3] = {0}, pxpypz[3] = {0}, cv[21] = {0};
303 aodt->GetPxPyPz(pxpypz);
305 aodt->GetCovarianceXYZPxPyPz(cv);
306 fHistControlMatches->Fill(0.,inTrack->Pt());
309 if (fClusterType == 1 || fClusterType == 3){
310 if( TMath::Abs(aodt->GetTrackEtaOnEMCal()) > 0.75 )
314 if( fClusterType == 1 && nModules < 13 && ( aodt->GetTrackPhiOnEMCal() < 70*TMath::DegToRad() || aodt->GetTrackPhiOnEMCal() > 190*TMath::DegToRad()))
319 if (fClusterType == 3 && ( aodt->GetTrackPhiOnEMCal() < 250*TMath::DegToRad() || aodt->GetTrackPhiOnEMCal() > 340*TMath::DegToRad()))
321 if( fClusterType == 1 && ( aodt->GetTrackPhiOnEMCal() < 70*TMath::DegToRad() || aodt->GetTrackPhiOnEMCal() > 190*TMath::DegToRad()))
325 trackParam =
new AliExternalTrackParam(xyz,pxpypz,cv,aodt->Charge());
328 if (!trackParam) {AliError(
"Could not get TrackParameters, continue"); fHistControlMatches->Fill(1.,inTrack->Pt());
continue;}
329 AliExternalTrackParam emcParam(*trackParam);
333 if(fClusterType == 1 || fClusterType == 3){
334 if (!AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(&emcParam, 440., 0.139, 20., eta, phi, pt)) {
336 fHistControlMatches->Fill(2.,inTrack->Pt());
339 if( TMath::Abs(eta) > 0.75 ) {
341 fHistControlMatches->Fill(3.,inTrack->Pt());
345 if( fClusterType == 1 && nModules < 13 && ( phi < 70*TMath::DegToRad() || phi > 190*TMath::DegToRad())){
347 fHistControlMatches->Fill(3.,inTrack->Pt());
352 if (fClusterType == 3 && ( phi < 250*TMath::DegToRad() || phi > 340*TMath::DegToRad())){
354 fHistControlMatches->Fill(3.,inTrack->Pt());
357 if( fClusterType == 1 && ( phi < 70*TMath::DegToRad() || phi > 190*TMath::DegToRad())){
359 fHistControlMatches->Fill(3.,inTrack->Pt());
363 }
else if(fClusterType == 2){
364 if( !AliTrackerBase::PropagateTrackToBxByBz(&emcParam, 460., 0.139, 20, kTRUE, 0.8, -1)){
366 fHistControlMatches->Fill(2.,inTrack->Pt());
370 if (TMath::Abs(eta) > 0.25 && (fClusterType == 2)){
372 fHistControlMatches->Fill(3.,inTrack->Pt());
378 Float_t clsPos[3] = {0.,0.,0.};
380 if (!emcParam.GetXYZ(exPos)){
381 fHistControlMatches->Fill(2.,inTrack->Pt());
389 Int_t nClusterMatchesToTrack = 0;
390 for(
Int_t iclus=0;iclus < nClus;iclus++){
391 AliVCluster* cluster = NULL;
395 cluster =
new AliESDCaloCluster(*(AliESDCaloCluster*)arrClusters->At(iclus));
398 cluster =
new AliAODCaloCluster(*(AliAODCaloCluster*)arrClusters->At(iclus));
402 cluster =
event->GetCaloCluster(iclus);
404 if(arrClusters)
delete cluster;
408 cluster->GetPosition(clsPos);
409 Double_t dR = TMath::Sqrt(TMath::Power(exPos[0]-clsPos[0],2)+TMath::Power(exPos[1]-clsPos[1],2)+TMath::Power(exPos[2]-clsPos[2],2));
411 if (dR > fMatchingWindow){
412 if(arrClusters)
delete cluster;
415 Double_t clusterR = TMath::Sqrt( clsPos[0]*clsPos[0] + clsPos[1]*clsPos[1] );
416 AliExternalTrackParam trackParamTmp(emcParam);
417 if(fClusterType == 1 || fClusterType == 3){
418 if (!cluster->IsEMCAL()){
419 if(arrClusters)
delete cluster;
423 fHistControlMatches->Fill(4.,inTrack->Pt());
424 if(arrClusters)
delete cluster;
427 }
else if(fClusterType == 2){
428 if (!cluster->IsPHOS()){
429 if(arrClusters)
delete cluster;
432 if(!AliTrackerBase::PropagateTrackToBxByBz(&trackParamTmp, clusterR, 0.139, 5., kTRUE, 0.8, -1)){
433 fHistControlMatches->Fill(4.,inTrack->Pt());
434 if(arrClusters)
delete cluster;
438 trackParamTmp.GetXYZ(trkPos);
439 TVector3 trkPosVec(trkPos[0],trkPos[1],trkPos[2]);
440 TVector3 clsPosVec(clsPos);
441 dPhi = clsPosVec.DeltaPhi(trkPosVec);
442 dEta = clsPosVec.Eta()-trkPosVec.Eta();
445 Float_t dR2 = dPhi*dPhi + dEta*dEta;
448 if(dR2 > fMatchingResidual){
449 if(arrClusters)
delete cluster;
452 nClusterMatchesToTrack++;
454 fMapTrackToCluster.insert(make_pair(itr,cluster->GetID()));
455 fMapClusterToTrack.insert(make_pair(cluster->GetID(),itr));
457 fMapTrackToCluster.insert(make_pair(inTrack->GetID(),cluster->GetID()));
458 fMapClusterToTrack.insert(make_pair(cluster->GetID(),inTrack->GetID()));
460 fVectorDeltaEtaDeltaPhi.push_back(make_pair(dEta,dPhi));
461 fMap_TrID_ClID_ToIndex[make_pair(inTrack->GetID(),cluster->GetID())] = fNEntries++;
462 if( (
Int_t)fVectorDeltaEtaDeltaPhi.size() != (fNEntries-1)) AliFatal(
"Fatal error in AliCaloTrackMatcher, vector and map are not in sync!");
463 if(arrClusters)
delete cluster;
466 if(nClusterMatchesToTrack == 0) fHistControlMatches->Fill(5.,inTrack->Pt());
467 else fHistControlMatches->Fill(6.,inTrack->Pt());
478 if(GetSecTrackClusterMatchingResidual(inSecTrack->GetID(),cluster->GetID(), dEta, dPhi)){
483 if(IsSecTrackClusterAlreadyTried(inSecTrack->GetID(),cluster->GetID())){
491 if(fClusterType == 1 || fClusterType == 3) nModules = fGeomEMCAL->GetNumberOfSuperModules();
492 else if(fClusterType == 2) nModules = fGeomPHOS->GetNModules();
499 AliError(
"Task needs AOD or ESD event, returning");
504 if(!cluster->IsEMCAL() && !cluster->IsPHOS()){AliError(
"Cluster is neither EMCAL nor PHOS, returning");
return kFALSE;}
506 Float_t clusterPosition[3] = {0,0,0};
507 cluster->GetPosition(clusterPosition);
508 Double_t clusterR = TMath::Sqrt( clusterPosition[0]*clusterPosition[0] + clusterPosition[1]*clusterPosition[1] );
510 if(!inSecTrack)
return kFALSE;
511 fSecHistControlMatches->Fill(0.,inSecTrack->Pt());
513 AliESDtrack *esdt =
dynamic_cast<AliESDtrack*
>(inSecTrack);
514 AliAODTrack *aodt = 0;
516 aodt =
dynamic_cast<AliAODTrack*
>(inSecTrack);
518 AliError(
"Track is neither ESD nor AOD, continue");
519 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
524 AliExternalTrackParam *trackParam = 0;
526 const AliExternalTrackParam *in = esdt->GetInnerParam();
528 AliDebug(2,
"Could not get InnerParam of Track, continue");
529 fSecHistControlMatches->Fill(1.,inSecTrack->Pt());
530 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
533 trackParam =
new AliExternalTrackParam(*in);
536 if (fClusterType == 1 || fClusterType == 3){
537 if (TMath::Abs(aodt->GetTrackEtaOnEMCal()) > 0.8)
540 if (( aodt->GetTrackPhiOnEMCal() < 60*TMath::DegToRad() || aodt->GetTrackPhiOnEMCal() > 200*TMath::DegToRad()))
542 }
else if( nModules > 12 ){
543 if (fClusterType == 3 && ( aodt->GetTrackPhiOnEMCal() < 250*TMath::DegToRad() || aodt->GetTrackPhiOnEMCal() > 340*TMath::DegToRad()))
545 if( fClusterType == 1 && ( aodt->GetTrackPhiOnEMCal() < 60*TMath::DegToRad() || aodt->GetTrackPhiOnEMCal() > 200*TMath::DegToRad()))
549 if ( aodt->Phi() < 60*TMath::DegToRad() || aodt->Phi() > 200*TMath::DegToRad())
551 if (TMath::Abs(aodt->Eta()) > 0.3 )
555 Double_t xyz[3] = {0}, pxpypz[3] = {0}, cv[21] = {0};
556 aodt->GetPxPyPz(pxpypz);
558 aodt->GetCovarianceXYZPxPyPz(cv);
559 trackParam =
new AliExternalTrackParam(xyz,pxpypz,cv,aodt->Charge());
562 AliError(
"Could not get TrackParameters, continue");
563 fSecHistControlMatches->Fill(1.,inSecTrack->Pt());
564 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
568 Bool_t propagated = kFALSE;
569 AliExternalTrackParam emcParam(*trackParam);
573 if(cluster->IsEMCAL()){
574 if (inSecTrack->Pt() < 0.3 ) {
575 fSecHistControlMatches->Fill(3.,inSecTrack->Pt());
578 propagated = AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(&emcParam, 430, 0.000510999, 20, eta, phi, pt);
580 if( TMath::Abs(eta) > 0.8 ) {
582 fSecHistControlMatches->Fill(3.,inSecTrack->Pt());
583 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
587 if( nModules < 13 && ( phi < 60*TMath::DegToRad() || phi > 200*TMath::DegToRad())){
589 fSecHistControlMatches->Fill(3.,inSecTrack->Pt());
590 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
597 fSecHistControlMatches->Fill(4.,inSecTrack->Pt());
598 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
603 fSecHistControlMatches->Fill(2.,inSecTrack->Pt());
604 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
608 }
else if(cluster->IsPHOS()){
609 propagated = AliTrackerBase::PropagateTrackToBxByBz(&emcParam, clusterR, 0.000510999, 20, kTRUE, 0.8, -1);
612 emcParam.GetXYZ(trkPos);
613 TVector3 trkPosVec(trkPos[0],trkPos[1],trkPos[2]);
614 TVector3 clsPosVec(clusterPosition);
615 dPhiTemp = clsPosVec.DeltaPhi(trkPosVec);
616 dEtaTemp = clsPosVec.Eta()-trkPosVec.Eta();
619 fSecHistControlMatches->Fill(2.,inSecTrack->Pt());
620 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
625 Float_t dR2 = dPhiTemp*dPhiTemp + dEtaTemp*dEtaTemp;
627 if(dR2 > fMatchingResidual){
628 fSecHistControlMatches->Fill(5.,inSecTrack->Pt());
629 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
639 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
640 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
641 if(currTrack->GetID() == inSecTrack->GetID()){
646 if(TrackPos == -1) AliFatal(Form(
"AliCaloTrackMatcher: PropagateV0TrackToClusterAndGetMatchingResidual - track (ID: '%i') cannot be retrieved from event, should be impossible as it has been used in maim task before!",inSecTrack->GetID()));
647 fSecMapTrackToCluster.insert(make_pair(TrackPos,cluster->GetID()));
648 fSecMapClusterToTrack.insert(make_pair(cluster->GetID(),TrackPos));
650 fSecMapTrackToCluster.insert(make_pair(inSecTrack->GetID(),cluster->GetID()));
651 fSecMapClusterToTrack.insert(make_pair(cluster->GetID(),inSecTrack->GetID()));
653 fSecVectorDeltaEtaDeltaPhi.push_back(make_pair(dEtaTemp,dPhiTemp));
654 fSecMap_TrID_ClID_ToIndex[make_pair(inSecTrack->GetID(),cluster->GetID())] = fSecNEntries++;
655 if( (
Int_t)fSecVectorDeltaEtaDeltaPhi.size() != (fSecNEntries-1)) AliFatal(
"Fatal error in AliCaloTrackMatcher, vector and map are not in sync!");
657 fSecHistControlMatches->Fill(6.,inSecTrack->Pt());
662 }
else AliFatal(
"Fatal error in AliCaloTrackMatcher, track is labeled as sucessfully propagated although this should be impossible!");
664 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
675 Int_t position = fMap_TrID_ClID_ToIndex[make_pair(trackID,clusterID)];
676 if(position == 0)
return kFALSE;
678 pairFloat tempEtaPhi = fVectorDeltaEtaDeltaPhi.at(position-1);
679 dEta = tempEtaPhi.first;
680 dPhi = tempEtaPhi.second;
686 multimap<Int_t,Int_t>::iterator it;
687 for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it){
688 if(it->first == clusterID){
690 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
691 if(!tempTrack)
continue;
692 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
693 if(tempTrack->Charge()>0){
694 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) matched++;
695 }
else if(tempTrack->Charge()<0){
698 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) matched++;
710 multimap<Int_t,Int_t>::iterator it;
711 for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it){
712 if(it->first == clusterID){
714 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
715 if(!tempTrack)
continue;
716 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
717 Bool_t match_dEta = kFALSE;
718 Bool_t match_dPhi = kFALSE;
719 if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
720 else match_dEta = kFALSE;
722 if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
723 else match_dPhi = kFALSE;
725 if (match_dPhi && match_dEta )matched++;
735 multimap<Int_t,Int_t>::iterator it;
736 for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it){
737 if(it->first == clusterID){
739 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
740 if(!tempTrack)
continue;
741 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
742 if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) matched++;
753 if(event->IsA()==AliAODEvent::Class()){
754 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
755 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
756 if(currTrack->GetID() == trackID){
761 if(TrackPos == -1) AliFatal(Form(
"AliCaloTrackMatcher: GetNMatchedClusterIDsForTrack - track (ID: '%i') cannot be retrieved from event, should be impossible as it has been used in maim task before!",trackID));
762 }
else TrackPos = trackID;
765 multimap<Int_t,Int_t>::iterator it;
766 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
767 if(!tempTrack)
return matched;
768 for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it){
769 if(it->first == TrackPos){
771 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
772 if(tempTrack->Charge()>0){
773 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) matched++;
774 }
else if(tempTrack->Charge()<0){
777 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) matched++;
788 if(event->IsA()==AliAODEvent::Class()){
789 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
790 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
791 if(currTrack->GetID() == trackID){
796 if(TrackPos == -1) AliFatal(Form(
"AliCaloTrackMatcher: GetNMatchedClusterIDsForTrack - track (ID: '%i') cannot be retrieved from event, should be impossible as it has been used in maim task before!",trackID));
797 }
else TrackPos = trackID;
800 multimap<Int_t,Int_t>::iterator it;
801 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
802 if(!tempTrack)
return matched;
803 for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it){
804 if(it->first == TrackPos){
806 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
807 Bool_t match_dEta = kFALSE;
808 Bool_t match_dPhi = kFALSE;
809 if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
810 else match_dEta = kFALSE;
812 if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
813 else match_dPhi = kFALSE;
815 if (match_dPhi && match_dEta )matched++;
826 if(event->IsA()==AliAODEvent::Class()){
827 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
828 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
829 if(currTrack->GetID() == trackID){
834 if(TrackPos == -1) AliFatal(Form(
"AliCaloTrackMatcher: GetNMatchedClusterIDsForTrack - track (ID: '%i') cannot be retrieved from event, should be impossible as it has been used in maim task before!",trackID));
835 }
else TrackPos = trackID;
838 multimap<Int_t,Int_t>::iterator it;
839 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
840 if(!tempTrack)
return matched;
841 for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it){
842 if(it->first == TrackPos){
844 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
845 if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) matched++;
854 vector<Int_t> tempMatchedTracks;
855 multimap<Int_t,Int_t>::iterator it;
856 for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it){
857 if(it->first == clusterID){
859 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
860 if(!tempTrack)
continue;
861 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
862 if(tempTrack->Charge()>0){
863 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) tempMatchedTracks.push_back(it->second);
864 }
else if(tempTrack->Charge()<0){
867 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) tempMatchedTracks.push_back(it->second);
872 return tempMatchedTracks;
877 vector<Int_t> tempMatchedTracks;
878 multimap<Int_t,Int_t>::iterator it;
879 for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it){
880 if(it->first == clusterID){
882 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
883 if(!tempTrack)
continue;
884 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
885 Bool_t match_dEta = kFALSE;
886 Bool_t match_dPhi = kFALSE;
887 if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
888 else match_dEta = kFALSE;
890 if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
891 else match_dPhi = kFALSE;
893 if (match_dPhi && match_dEta )tempMatchedTracks.push_back(it->second);
898 return tempMatchedTracks;
903 vector<Int_t> tempMatchedTracks;
904 multimap<Int_t,Int_t>::iterator it;
905 for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it){
906 if(it->first == clusterID){
908 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
909 if(!tempTrack)
continue;
910 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
911 if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) tempMatchedTracks.push_back(it->second);
915 return tempMatchedTracks;
921 if(event->IsA()==AliAODEvent::Class()){
922 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
923 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
924 if(currTrack->GetID() == trackID){
929 if(TrackPos == -1) AliFatal(Form(
"AliCaloTrackMatcher: GetNMatchedClusterIDsForTrack - track (ID: '%i') cannot be retrieved from event, should be impossible as it has been used in maim task before!",trackID));
930 }
else TrackPos = trackID;
932 vector<Int_t> tempMatchedClusters;
933 multimap<Int_t,Int_t>::iterator it;
934 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
935 if(!tempTrack)
return tempMatchedClusters;
936 for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it){
937 if(it->first == TrackPos){
939 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
940 if(tempTrack->Charge()>0){
941 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) tempMatchedClusters.push_back(it->second);
942 }
else if(tempTrack->Charge()<0){
945 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) tempMatchedClusters.push_back(it->second);
951 return tempMatchedClusters;
957 if(event->IsA()==AliAODEvent::Class()){
958 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
959 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
960 if(currTrack->GetID() == trackID){
965 if(TrackPos == -1) AliFatal(Form(
"AliCaloTrackMatcher: GetNMatchedClusterIDsForTrack - track (ID: '%i') cannot be retrieved from event, should be impossible as it has been used in maim task before!",trackID));
966 }
else TrackPos = trackID;
968 vector<Int_t> tempMatchedClusters;
969 multimap<Int_t,Int_t>::iterator it;
970 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
971 if(!tempTrack)
return tempMatchedClusters;
972 for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it){
973 if(it->first == TrackPos){
975 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
976 Bool_t match_dEta = kFALSE;
977 Bool_t match_dPhi = kFALSE;
978 if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
979 else match_dEta = kFALSE;
981 if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
982 else match_dPhi = kFALSE;
984 if (match_dPhi && match_dEta )tempMatchedClusters.push_back(it->second);
988 return tempMatchedClusters;
994 if(event->IsA()==AliAODEvent::Class()){
995 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
996 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
997 if(currTrack->GetID() == trackID){
1002 if(TrackPos == -1) AliFatal(Form(
"AliCaloTrackMatcher: GetNMatchedClusterIDsForTrack - track (ID: '%i') cannot be retrieved from event, should be impossible as it has been used in maim task before!",trackID));
1003 }
else TrackPos = trackID;
1005 vector<Int_t> tempMatchedClusters;
1006 multimap<Int_t,Int_t>::iterator it;
1007 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
1008 if(!tempTrack)
return tempMatchedClusters;
1009 for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it){
1010 if(it->first == TrackPos){
1012 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1013 if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) tempMatchedClusters.push_back(it->second);
1017 return tempMatchedClusters;
1026 Int_t position = fSecMap_TrID_ClID_ToIndex[make_pair(trackID,clusterID)];
1027 if(position == 0)
return kFALSE;
1029 pairFloat tempEtaPhi = fSecVectorDeltaEtaDeltaPhi.at(position-1);
1030 dEta = tempEtaPhi.first;
1031 dPhi = tempEtaPhi.second;
1036 Int_t position = fSecMap_TrID_ClID_AlreadyTried[make_pair(trackID,clusterID)];
1037 if(position == 0)
return kFALSE;
1043 multimap<Int_t,Int_t>::iterator it;
1044 for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it){
1045 if(it->first == clusterID){
1047 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
1048 if(!tempTrack)
continue;
1049 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
1050 if(tempTrack->Charge()>0){
1051 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) matched++;
1052 }
else if(tempTrack->Charge()<0){
1055 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) matched++;
1067 multimap<Int_t,Int_t>::iterator it;
1068 for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it){
1069 if(it->first == clusterID){
1071 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
1072 if(!tempTrack)
continue;
1073 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
1074 Bool_t match_dEta = kFALSE;
1075 Bool_t match_dPhi = kFALSE;
1076 if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
1077 else match_dEta = kFALSE;
1079 if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
1080 else match_dPhi = kFALSE;
1082 if (match_dPhi && match_dEta )matched++;
1093 multimap<Int_t,Int_t>::iterator it;
1094 for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it){
1095 if(it->first == clusterID){
1097 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
1098 if(!tempTrack)
continue;
1099 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
1100 if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) matched++;
1110 Int_t TrackPos = -1;
1111 if(event->IsA()==AliAODEvent::Class()){
1112 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
1113 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
1114 if(currTrack->GetID() == trackID){
1119 if(TrackPos == -1) AliFatal(Form(
"AliCaloTrackMatcher: GetNMatchedClusterIDsForTrack - track (ID: '%i') cannot be retrieved from event, should be impossible as it has been used in maim task before!",trackID));
1120 }
else TrackPos = trackID;
1123 multimap<Int_t,Int_t>::iterator it;
1124 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
1125 if(!tempTrack)
return matched;
1126 for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it){
1127 if(it->first == TrackPos){
1129 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1130 if(tempTrack->Charge()>0){
1131 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) matched++;
1132 }
else if(tempTrack->Charge()<0){
1135 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) matched++;
1146 Int_t TrackPos = -1;
1147 if(event->IsA()==AliAODEvent::Class()){
1148 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
1149 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
1150 if(currTrack->GetID() == trackID){
1155 if(TrackPos == -1) AliFatal(Form(
"AliCaloTrackMatcher: GetNMatchedClusterIDsForTrack - track (ID: '%i') cannot be retrieved from event, should be impossible as it has been used in maim task before!",trackID));
1156 }
else TrackPos = trackID;
1159 multimap<Int_t,Int_t>::iterator it;
1160 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
1161 if(!tempTrack)
return matched;
1162 for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it){
1163 if(it->first == TrackPos){
1165 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1166 Bool_t match_dEta = kFALSE;
1167 Bool_t match_dPhi = kFALSE;
1168 if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
1169 else match_dEta = kFALSE;
1171 if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
1172 else match_dPhi = kFALSE;
1174 if (match_dPhi && match_dEta )matched++;
1185 Int_t TrackPos = -1;
1186 if(event->IsA()==AliAODEvent::Class()){
1187 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
1188 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
1189 if(currTrack->GetID() == trackID){
1194 if(TrackPos == -1) AliFatal(Form(
"AliCaloTrackMatcher: GetNMatchedClusterIDsForTrack - track (ID: '%i') cannot be retrieved from event, should be impossible as it has been used in maim task before!",trackID));
1195 }
else TrackPos = trackID;
1198 multimap<Int_t,Int_t>::iterator it;
1199 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
1200 if(!tempTrack)
return matched;
1201 for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it){
1202 if(it->first == TrackPos){
1204 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1205 if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) matched++;
1215 vector<Int_t> tempMatchedTracks;
1216 multimap<Int_t,Int_t>::iterator it;
1217 for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it){
1218 if(it->first == clusterID){
1220 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
1221 if(!tempTrack)
continue;
1222 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
1223 if(tempTrack->Charge()>0){
1224 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) tempMatchedTracks.push_back(it->second);
1225 }
else if(tempTrack->Charge()<0){
1228 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) tempMatchedTracks.push_back(it->second);
1234 return tempMatchedTracks;
1239 vector<Int_t> tempMatchedTracks;
1240 multimap<Int_t,Int_t>::iterator it;
1241 for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it){
1242 if(it->first == clusterID){
1244 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
1245 if(!tempTrack)
continue;
1246 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
1247 Bool_t match_dEta = kFALSE;
1248 Bool_t match_dPhi = kFALSE;
1249 if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
1250 else match_dEta = kFALSE;
1252 if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
1253 else match_dPhi = kFALSE;
1255 if (match_dPhi && match_dEta )tempMatchedTracks.push_back(it->second);
1260 return tempMatchedTracks;
1265 vector<Int_t> tempMatchedTracks;
1266 multimap<Int_t,Int_t>::iterator it;
1267 for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it){
1268 if(it->first == clusterID){
1270 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
1271 if(!tempTrack)
continue;
1272 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
1273 if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) tempMatchedTracks.push_back(it->second);
1278 return tempMatchedTracks;
1283 Int_t TrackPos = -1;
1284 if(event->IsA()==AliAODEvent::Class()){
1285 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
1286 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
1287 if(currTrack->GetID() == trackID){
1292 if(TrackPos == -1) AliFatal(Form(
"AliCaloTrackMatcher: GetNMatchedClusterIDsForTrack - track (ID: '%i') cannot be retrieved from event, should be impossible as it has been used in maim task before!",trackID));
1293 }
else TrackPos = trackID;
1295 vector<Int_t> tempMatchedClusters;
1296 multimap<Int_t,Int_t>::iterator it;
1297 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
1298 if(!tempTrack)
return tempMatchedClusters;
1299 for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it){
1300 if(it->first == TrackPos){
1302 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1303 if(tempTrack->Charge()>0){
1304 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) tempMatchedClusters.push_back(it->second);
1305 }
else if(tempTrack->Charge()<0){
1308 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) tempMatchedClusters.push_back(it->second);
1314 return tempMatchedClusters;
1319 Int_t TrackPos = -1;
1320 if(event->IsA()==AliAODEvent::Class()){
1321 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
1322 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
1323 if(currTrack->GetID() == trackID){
1328 if(TrackPos == -1) AliFatal(Form(
"AliCaloTrackMatcher: GetNMatchedClusterIDsForTrack - track (ID: '%i') cannot be retrieved from event, should be impossible as it has been used in maim task before!",trackID));
1329 }
else TrackPos = trackID;
1331 vector<Int_t> tempMatchedClusters;
1332 multimap<Int_t,Int_t>::iterator it;
1333 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
1334 if(!tempTrack)
return tempMatchedClusters;
1335 for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it){
1336 if(it->first == TrackPos){
1338 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1339 Bool_t match_dEta = kFALSE;
1340 Bool_t match_dPhi = kFALSE;
1341 if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
1342 else match_dEta = kFALSE;
1344 if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
1345 else match_dPhi = kFALSE;
1347 if (match_dPhi && match_dEta )tempMatchedClusters.push_back(it->second);
1352 return tempMatchedClusters;
1357 Int_t TrackPos = -1;
1358 if(event->IsA()==AliAODEvent::Class()){
1359 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
1360 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
1361 if(currTrack->GetID() == trackID){
1366 if(TrackPos == -1) AliFatal(Form(
"AliCaloTrackMatcher: GetNMatchedClusterIDsForTrack - track (ID: '%i') cannot be retrieved from event, should be impossible as it has been used in maim task before!",trackID));
1367 }
else TrackPos = trackID;
1369 vector<Int_t> tempMatchedClusters;
1370 multimap<Int_t,Int_t>::iterator it;
1371 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
1372 if(!tempTrack)
return tempMatchedClusters;
1373 for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it){
1374 if(it->first == TrackPos){
1376 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1377 if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) tempMatchedClusters.push_back(it->second);
1382 return tempMatchedClusters;
1388 vector<Int_t> labelsMatched = GetMatchedTrackIDsForCluster(event, clusterID, dR);
1389 if((
Int_t) labelsMatched.size()<1)
return sumTrackEt;
1391 TLorentzVector vecTrack;
1392 for (
UInt_t i = 0; i < labelsMatched.size(); i++){
1393 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(labelsMatched.at(i)));
1394 if(!currTrack)
continue;
1395 vecTrack.SetPxPyPzE(currTrack->Px(),currTrack->Py(),currTrack->Pz(),currTrack->E());
1396 sumTrackEt += vecTrack.Et();
1404 TAxis *axisafter = histoRebin->GetYaxis();
1405 Int_t bins = axisafter->GetNbins();
1406 Double_t from = axisafter->GetXmin();
1407 Double_t to = axisafter->GetXmax();
1410 Double_t factor = TMath::Power(to/from, 1./bins);
1411 for(
Int_t i=1; i<=bins; ++i) newbins[i] = factor * newbins[i-1];
1412 axisafter->Set(bins, newbins);
1419 if(fSecVectorDeltaEtaDeltaPhi.size()>0){
1420 cout <<
"******************************" << endl;
1421 cout <<
"******************************" << endl;
1422 cout <<
"NEW EVENT !" << endl;
1423 cout <<
"vector etaphi:" << endl;
1424 cout << fSecVectorDeltaEtaDeltaPhi.size() << endl;
1425 cout <<
"multimap" << endl;
1426 mapT::iterator iter = fSecMap_TrID_ClID_ToIndex.begin();
1427 for (iter = fSecMap_TrID_ClID_ToIndex.begin(); iter != fSecMap_TrID_ClID_ToIndex.end(); ++iter){
1429 if(!GetSecTrackClusterMatchingResidual(iter->first.first,iter->first.second,dEta,dPhi))
continue;
1430 cout <<
" [" << iter->first.first <<
"/" << iter->first.second <<
", " << iter->second <<
"] - (" << dEta <<
"/" << dPhi <<
")" << endl;
1432 cout <<
"mapTrackToCluster" << endl;
1434 for (
Int_t itr=0;itr<esdev->GetNumberOfTracks();itr++){
1435 AliVTrack *inTrack = esdev->GetTrack(itr);
1436 if(!inTrack)
continue;
1438 if(inTrack->Charge()>0) tCharge =
"+";
1439 else if(inTrack->Charge()<0) tCharge =
"-";
1440 cout << itr <<
" (" << tCharge <<
") - " << GetNMatchedClusterIDsForSecTrack(fInputEvent,inTrack->GetID(),5,-5,0.2,-0.4) <<
"\t\t";
1443 multimap<Int_t,Int_t>::iterator it;
1444 for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it) cout << it->first <<
" => " << it->second <<
'\n';
1445 cout <<
"mapClusterToTrack" << endl;
1446 Int_t tempClus = it->second;
1447 for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it) cout << it->first <<
" => " << it->second <<
'\n';
1448 vector<Int_t> tempTracks = GetMatchedSecTrackIDsForCluster(fInputEvent,tempClus, 5, -5, 0.2, -0.4);
1449 for(
UInt_t iJ=0; iJ<tempTracks.size();iJ++){
1450 cout << tempClus <<
" - " << tempTracks.at(iJ) << endl;
1458 if(fVectorDeltaEtaDeltaPhi.size()>0){
1459 cout <<
"******************************" << endl;
1460 cout <<
"******************************" << endl;
1461 cout <<
"NEW EVENT !" << endl;
1462 cout <<
"vector etaphi:" << endl;
1463 cout << fVectorDeltaEtaDeltaPhi.size() << endl;
1464 cout <<
"multimap" << endl;
1465 mapT::iterator iter = fMap_TrID_ClID_ToIndex.begin();
1466 for (iter = fMap_TrID_ClID_ToIndex.begin(); iter != fMap_TrID_ClID_ToIndex.end(); ++iter){
1468 if(!GetTrackClusterMatchingResidual(iter->first.first,iter->first.second,dEta,dPhi))
continue;
1469 cout <<
" [" << iter->first.first <<
"/" << iter->first.second <<
", " << iter->second <<
"] - (" << dEta <<
"/" << dPhi <<
")" << endl;
1471 cout <<
"mapTrackToCluster" << endl;
1473 for (
Int_t itr=0;itr<esdev->GetNumberOfTracks();itr++){
1474 AliVTrack *inTrack = esdev->GetTrack(itr);
1475 if(!inTrack)
continue;
1477 if(inTrack->Charge()>0) tCharge =
"+";
1478 else if(inTrack->Charge()<0) tCharge =
"-";
1479 cout << itr <<
" (" << tCharge <<
") - " << GetNMatchedClusterIDsForTrack(fInputEvent,inTrack->GetID(),5,-5,0.2,-0.4) <<
"\t\t";
1482 multimap<Int_t,Int_t>::iterator it;
1483 for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it) cout << it->first <<
" => " << it->second <<
'\n';
1484 cout <<
"mapClusterToTrack" << endl;
1485 Int_t tempClus = it->second;
1486 for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it) cout << it->first <<
" => " << it->second <<
'\n';
1487 vector<Int_t> tempTracks = GetMatchedTrackIDsForCluster(fInputEvent,tempClus, 5, -5, 0.2, -0.4);
1488 for(
UInt_t iJ=0; iJ<tempTracks.size();iJ++){
1489 cout << tempClus <<
" - " << tempTracks.at(iJ) << endl;
Int_t GetNMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t clusterID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin)
void ProcessEvent(AliVEvent *event)
Bool_t GetTrackClusterMatchingResidual(Int_t trackID, Int_t clusterID, Float_t &dEta, Float_t &dPhi)
void Initialize(Int_t runNumber)
vector< Int_t > GetMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t trackID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin)
Int_t GetNMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin)
virtual ~AliCaloTrackMatcher()
virtual void Terminate(Option_t *)
Bool_t GetSecTrackClusterMatchingResidual(Int_t trackID, Int_t clusterID, Float_t &dEta, Float_t &dPhi)
Float_t SumTrackEtAroundCluster(AliVEvent *event, Int_t clusterID, Float_t dR)
Int_t GetNMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin)
vector< Int_t > GetMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin)
virtual void UserExec(Option_t *option)
static Bool_t ExtrapolateTrackToCluster(AliExternalTrackParam *trkParam, const AliVCluster *cluster, Double_t mass, Double_t step, Float_t &tmpEta, Float_t &tmpPhi)
Int_t GetNMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t trackID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin)
Bool_t PropagateV0TrackToClusterAndGetMatchingResidual(AliVTrack *inSecTrack, AliVCluster *cluster, AliVEvent *event, Float_t &dEta, Float_t &dPhi)
pair< Float_t, Float_t > pairFloat
Bool_t IsSecTrackClusterAlreadyTried(Int_t trackID, Int_t clusterID)
void UserCreateOutputObjects()
vector< Int_t > GetMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, TF1 *fFuncPtDepEta, TF1 *fFuncPtDepPhi)
vector< Int_t > GetMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin)
void SetLogBinningYTH2(TH2 *histoRebin)