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())));
209 nClus = arrClusters->GetEntries();
212 if(fClusterType == 1 || fClusterType == 3) nModules = fGeomEMCAL->GetNumberOfSuperModules();
213 else if(fClusterType == 2) nModules = fGeomPHOS->GetNModules();
220 AliError(
"Task needs AOD or ESD event, returning");
224 static AliESDtrackCuts *EsdTrackCuts = 0x0;
225 static int prevRun = -1;
227 Int_t runNumber = fInputEvent->GetRunNumber();
229 if (prevRun!=runNumber) {
236 if( (runNumber<=146860) || (runNumber>=197470 && runNumber<=197692) || (runNumber>=172440 && runNumber<=193766) ){
237 EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
239 }
else if (runNumber>=209122){
242 EsdTrackCuts =
new AliESDtrackCuts();
244 EsdTrackCuts->AliESDtrackCuts::SetMinNCrossedRowsTPC(70);
245 EsdTrackCuts->AliESDtrackCuts::SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
246 EsdTrackCuts->SetCutGeoNcrNcl(2., 130., 1.5, 0.0, 0.0);
248 EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterTPC(4);
249 EsdTrackCuts->AliESDtrackCuts::SetAcceptKinkDaughters(kFALSE);
250 EsdTrackCuts->AliESDtrackCuts::SetRequireTPCRefit(kTRUE);
252 EsdTrackCuts->AliESDtrackCuts::SetRequireITSRefit(kTRUE);
253 EsdTrackCuts->AliESDtrackCuts::SetClusterRequirementITS(AliESDtrackCuts::kSPD,
254 AliESDtrackCuts::kAny);
255 EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexXYPtDep(
"0.0105+0.0350/pt^1.1");
256 EsdTrackCuts->AliESDtrackCuts::SetMaxChi2TPCConstrainedGlobal(36);
257 EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexZ(2);
258 EsdTrackCuts->AliESDtrackCuts::SetDCAToVertex2D(kFALSE);
259 EsdTrackCuts->AliESDtrackCuts::SetRequireSigmaToVertex(kFALSE);
260 EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterITS(36);
263 EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011();
265 EsdTrackCuts->SetMaxDCAToVertexZ(2);
269 for (
Int_t itr=0;itr<
event->GetNumberOfTracks();itr++){
270 AliExternalTrackParam *trackParam = 0;
271 AliVTrack *inTrack = 0x0;
273 inTrack = esdev->GetTrack(itr);
274 if(!inTrack)
continue;
275 if(TMath::Abs(inTrack->Eta())>0.8 && (fClusterType==1 || fClusterType==3 ))
continue;
276 if(TMath::Abs(inTrack->Eta())>0.3 && fClusterType==2 )
continue;
277 if(inTrack->Pt()<0.5)
continue;
278 AliESDtrack *esdt =
dynamic_cast<AliESDtrack*
>(inTrack);
279 if(!EsdTrackCuts->AcceptTrack(esdt))
continue;
280 fHistControlMatches->Fill(0.,inTrack->Pt());
282 const AliExternalTrackParam *in = esdt->GetInnerParam();
283 if (!in){AliDebug(2,
"Could not get InnerParam of Track, continue"); fHistControlMatches->Fill(1.,inTrack->Pt());
continue;}
284 trackParam =
new AliExternalTrackParam(*in);
286 inTrack =
dynamic_cast<AliVTrack*
>(aodev->GetTrack(itr));
287 if(!inTrack)
continue;
288 if(inTrack->GetID()<0)
continue;
290 if(TMath::Abs(inTrack->Eta())>0.8 && (fClusterType==1 || fClusterType==3 ))
continue;
291 if(TMath::Abs(inTrack->Eta())>0.3 && fClusterType==2 )
continue;
292 if(inTrack->Pt()<0.5)
continue;
295 AliAODTrack *aodt =
dynamic_cast<AliAODTrack*
>(inTrack);
296 if(!aodt->IsHybridGlobalConstrainedGlobal())
continue;
297 Double_t xyz[3] = {0}, pxpypz[3] = {0}, cv[21] = {0};
298 aodt->GetPxPyPz(pxpypz);
300 aodt->GetCovarianceXYZPxPyPz(cv);
301 fHistControlMatches->Fill(0.,inTrack->Pt());
304 if (fClusterType == 1 || fClusterType == 3){
305 if( TMath::Abs(aodt->GetTrackEtaOnEMCal()) > 0.75 )
309 if( fClusterType == 1 && nModules < 13 && ( aodt->GetTrackPhiOnEMCal() < 70*TMath::DegToRad() || aodt->GetTrackPhiOnEMCal() > 190*TMath::DegToRad()))
314 if (fClusterType == 3 && ( aodt->GetTrackPhiOnEMCal() < 250*TMath::DegToRad() || aodt->GetTrackPhiOnEMCal() > 340*TMath::DegToRad()))
316 if( fClusterType == 1 && ( aodt->GetTrackPhiOnEMCal() < 70*TMath::DegToRad() || aodt->GetTrackPhiOnEMCal() > 190*TMath::DegToRad()))
320 trackParam =
new AliExternalTrackParam(xyz,pxpypz,cv,aodt->Charge());
323 if (!trackParam) {AliError(
"Could not get TrackParameters, continue"); fHistControlMatches->Fill(1.,inTrack->Pt());
continue;}
324 AliExternalTrackParam emcParam(*trackParam);
328 if(fClusterType == 1 || fClusterType == 3){
329 if (!AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(&emcParam, 440., 0.139, 20., eta, phi, pt)) {
331 fHistControlMatches->Fill(2.,inTrack->Pt());
334 if( TMath::Abs(eta) > 0.75 ) {
336 fHistControlMatches->Fill(3.,inTrack->Pt());
340 if( fClusterType == 1 && nModules < 13 && ( phi < 70*TMath::DegToRad() || phi > 190*TMath::DegToRad())){
342 fHistControlMatches->Fill(3.,inTrack->Pt());
347 if (fClusterType == 3 && ( phi < 250*TMath::DegToRad() || phi > 340*TMath::DegToRad())){
349 fHistControlMatches->Fill(3.,inTrack->Pt());
352 if( fClusterType == 1 && ( phi < 70*TMath::DegToRad() || phi > 190*TMath::DegToRad())){
354 fHistControlMatches->Fill(3.,inTrack->Pt());
358 }
else if(fClusterType == 2){
359 if( !AliTrackerBase::PropagateTrackToBxByBz(&emcParam, 460., 0.139, 20, kTRUE, 0.8, -1)){
361 fHistControlMatches->Fill(2.,inTrack->Pt());
365 if (TMath::Abs(eta) > 0.25 && (fClusterType == 2)){
367 fHistControlMatches->Fill(3.,inTrack->Pt());
373 Float_t clsPos[3] = {0.,0.,0.};
375 if (!emcParam.GetXYZ(exPos)){
376 fHistControlMatches->Fill(2.,inTrack->Pt());
384 Int_t nClusterMatchesToTrack = 0;
385 for(
Int_t iclus=0;iclus < nClus;iclus++){
386 AliVCluster* cluster = NULL;
390 cluster =
new AliESDCaloCluster(*(AliESDCaloCluster*)arrClusters->At(iclus));
393 cluster =
new AliAODCaloCluster(*(AliAODCaloCluster*)arrClusters->At(iclus));
397 cluster =
event->GetCaloCluster(iclus);
399 if(arrClusters)
delete cluster;
403 cluster->GetPosition(clsPos);
404 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));
406 if (dR > fMatchingWindow){
407 if(arrClusters)
delete cluster;
410 Double_t clusterR = TMath::Sqrt( clsPos[0]*clsPos[0] + clsPos[1]*clsPos[1] );
411 AliExternalTrackParam trackParamTmp(emcParam);
412 if(fClusterType == 1 || fClusterType == 3){
413 if (!cluster->IsEMCAL()){
414 if(arrClusters)
delete cluster;
418 fHistControlMatches->Fill(4.,inTrack->Pt());
419 if(arrClusters)
delete cluster;
422 }
else if(fClusterType == 2){
423 if (!cluster->IsPHOS()){
424 if(arrClusters)
delete cluster;
427 if(!AliTrackerBase::PropagateTrackToBxByBz(&trackParamTmp, clusterR, 0.139, 5., kTRUE, 0.8, -1)){
428 fHistControlMatches->Fill(4.,inTrack->Pt());
429 if(arrClusters)
delete cluster;
433 trackParamTmp.GetXYZ(trkPos);
434 TVector3 trkPosVec(trkPos[0],trkPos[1],trkPos[2]);
435 TVector3 clsPosVec(clsPos);
436 dPhi = clsPosVec.DeltaPhi(trkPosVec);
437 dEta = clsPosVec.Eta()-trkPosVec.Eta();
440 Float_t dR2 = dPhi*dPhi + dEta*dEta;
443 if(dR2 > fMatchingResidual){
444 if(arrClusters)
delete cluster;
447 nClusterMatchesToTrack++;
449 fMapTrackToCluster.insert(make_pair(itr,cluster->GetID()));
450 fMapClusterToTrack.insert(make_pair(cluster->GetID(),itr));
452 fMapTrackToCluster.insert(make_pair(inTrack->GetID(),cluster->GetID()));
453 fMapClusterToTrack.insert(make_pair(cluster->GetID(),inTrack->GetID()));
455 fVectorDeltaEtaDeltaPhi.push_back(make_pair(dEta,dPhi));
456 fMap_TrID_ClID_ToIndex[make_pair(inTrack->GetID(),cluster->GetID())] = fNEntries++;
457 if( (
Int_t)fVectorDeltaEtaDeltaPhi.size() != (fNEntries-1)) AliFatal(
"Fatal error in AliCaloTrackMatcher, vector and map are not in sync!");
458 if(arrClusters)
delete cluster;
461 if(nClusterMatchesToTrack == 0) fHistControlMatches->Fill(5.,inTrack->Pt());
462 else fHistControlMatches->Fill(6.,inTrack->Pt());
473 if(GetSecTrackClusterMatchingResidual(inSecTrack->GetID(),cluster->GetID(), dEta, dPhi)){
478 if(IsSecTrackClusterAlreadyTried(inSecTrack->GetID(),cluster->GetID())){
486 if(fClusterType == 1 || fClusterType == 3) nModules = fGeomEMCAL->GetNumberOfSuperModules();
487 else if(fClusterType == 2) nModules = fGeomPHOS->GetNModules();
494 AliError(
"Task needs AOD or ESD event, returning");
499 if(!cluster->IsEMCAL() && !cluster->IsPHOS()){AliError(
"Cluster is neither EMCAL nor PHOS, returning");
return kFALSE;}
501 Float_t clusterPosition[3] = {0,0,0};
502 cluster->GetPosition(clusterPosition);
503 Double_t clusterR = TMath::Sqrt( clusterPosition[0]*clusterPosition[0] + clusterPosition[1]*clusterPosition[1] );
505 if(!inSecTrack)
return kFALSE;
506 fSecHistControlMatches->Fill(0.,inSecTrack->Pt());
508 AliESDtrack *esdt =
dynamic_cast<AliESDtrack*
>(inSecTrack);
509 AliAODTrack *aodt = 0;
511 aodt =
dynamic_cast<AliAODTrack*
>(inSecTrack);
513 AliError(
"Track is neither ESD nor AOD, continue");
514 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
519 AliExternalTrackParam *trackParam = 0;
521 const AliExternalTrackParam *in = esdt->GetInnerParam();
523 AliDebug(2,
"Could not get InnerParam of Track, continue");
524 fSecHistControlMatches->Fill(1.,inSecTrack->Pt());
525 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
528 trackParam =
new AliExternalTrackParam(*in);
531 if (fClusterType == 1 || fClusterType == 3){
532 if (TMath::Abs(aodt->GetTrackEtaOnEMCal()) > 0.8)
535 if (( aodt->GetTrackPhiOnEMCal() < 60*TMath::DegToRad() || aodt->GetTrackPhiOnEMCal() > 200*TMath::DegToRad()))
537 }
else if( nModules > 12 ){
538 if (fClusterType == 3 && ( aodt->GetTrackPhiOnEMCal() < 250*TMath::DegToRad() || aodt->GetTrackPhiOnEMCal() > 340*TMath::DegToRad()))
540 if( fClusterType == 1 && ( aodt->GetTrackPhiOnEMCal() < 60*TMath::DegToRad() || aodt->GetTrackPhiOnEMCal() > 200*TMath::DegToRad()))
544 if ( aodt->Phi() < 60*TMath::DegToRad() || aodt->Phi() > 200*TMath::DegToRad())
546 if (TMath::Abs(aodt->Eta()) > 0.3 )
550 Double_t xyz[3] = {0}, pxpypz[3] = {0}, cv[21] = {0};
551 aodt->GetPxPyPz(pxpypz);
553 aodt->GetCovarianceXYZPxPyPz(cv);
554 trackParam =
new AliExternalTrackParam(xyz,pxpypz,cv,aodt->Charge());
557 AliError(
"Could not get TrackParameters, continue");
558 fSecHistControlMatches->Fill(1.,inSecTrack->Pt());
559 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
563 Bool_t propagated = kFALSE;
564 AliExternalTrackParam emcParam(*trackParam);
568 if(cluster->IsEMCAL()){
569 if (inSecTrack->Pt() < 0.3 ) {
570 fSecHistControlMatches->Fill(3.,inSecTrack->Pt());
573 propagated = AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(&emcParam, 430, 0.000510999, 20, eta, phi, pt);
575 if( TMath::Abs(eta) > 0.8 ) {
577 fSecHistControlMatches->Fill(3.,inSecTrack->Pt());
578 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
582 if( nModules < 13 && ( phi < 60*TMath::DegToRad() || phi > 200*TMath::DegToRad())){
584 fSecHistControlMatches->Fill(3.,inSecTrack->Pt());
585 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
592 fSecHistControlMatches->Fill(4.,inSecTrack->Pt());
593 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
598 fSecHistControlMatches->Fill(2.,inSecTrack->Pt());
599 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
603 }
else if(cluster->IsPHOS()){
604 propagated = AliTrackerBase::PropagateTrackToBxByBz(&emcParam, clusterR, 0.000510999, 20, kTRUE, 0.8, -1);
607 emcParam.GetXYZ(trkPos);
608 TVector3 trkPosVec(trkPos[0],trkPos[1],trkPos[2]);
609 TVector3 clsPosVec(clusterPosition);
610 dPhiTemp = clsPosVec.DeltaPhi(trkPosVec);
611 dEtaTemp = clsPosVec.Eta()-trkPosVec.Eta();
614 fSecHistControlMatches->Fill(2.,inSecTrack->Pt());
615 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
620 Float_t dR2 = dPhiTemp*dPhiTemp + dEtaTemp*dEtaTemp;
622 if(dR2 > fMatchingResidual){
623 fSecHistControlMatches->Fill(5.,inSecTrack->Pt());
624 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
634 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
635 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
636 if(currTrack->GetID() == inSecTrack->GetID()){
641 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()));
642 fSecMapTrackToCluster.insert(make_pair(TrackPos,cluster->GetID()));
643 fSecMapClusterToTrack.insert(make_pair(cluster->GetID(),TrackPos));
645 fSecMapTrackToCluster.insert(make_pair(inSecTrack->GetID(),cluster->GetID()));
646 fSecMapClusterToTrack.insert(make_pair(cluster->GetID(),inSecTrack->GetID()));
648 fSecVectorDeltaEtaDeltaPhi.push_back(make_pair(dEtaTemp,dPhiTemp));
649 fSecMap_TrID_ClID_ToIndex[make_pair(inSecTrack->GetID(),cluster->GetID())] = fSecNEntries++;
650 if( (
Int_t)fSecVectorDeltaEtaDeltaPhi.size() != (fSecNEntries-1)) AliFatal(
"Fatal error in AliCaloTrackMatcher, vector and map are not in sync!");
652 fSecHistControlMatches->Fill(6.,inSecTrack->Pt());
657 }
else AliFatal(
"Fatal error in AliCaloTrackMatcher, track is labeled as sucessfully propagated although this should be impossible!");
659 fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
670 Int_t position = fMap_TrID_ClID_ToIndex[make_pair(trackID,clusterID)];
671 if(position == 0)
return kFALSE;
673 pairFloat tempEtaPhi = fVectorDeltaEtaDeltaPhi.at(position-1);
674 dEta = tempEtaPhi.first;
675 dPhi = tempEtaPhi.second;
681 multimap<Int_t,Int_t>::iterator it;
682 for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it){
683 if(it->first == clusterID){
685 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
686 if(!tempTrack)
continue;
687 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
688 if(tempTrack->Charge()>0){
689 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) matched++;
690 }
else if(tempTrack->Charge()<0){
693 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) matched++;
705 multimap<Int_t,Int_t>::iterator it;
706 for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it){
707 if(it->first == clusterID){
709 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
710 if(!tempTrack)
continue;
711 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
712 Bool_t match_dEta = kFALSE;
713 Bool_t match_dPhi = kFALSE;
714 if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
715 else match_dEta = kFALSE;
717 if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
718 else match_dPhi = kFALSE;
720 if (match_dPhi && match_dEta )matched++;
730 multimap<Int_t,Int_t>::iterator it;
731 for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it){
732 if(it->first == clusterID){
734 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
735 if(!tempTrack)
continue;
736 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
737 if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) matched++;
748 if(event->IsA()==AliAODEvent::Class()){
749 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
750 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
751 if(currTrack->GetID() == trackID){
756 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));
757 }
else TrackPos = trackID;
760 multimap<Int_t,Int_t>::iterator it;
761 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
762 if(!tempTrack)
return matched;
763 for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it){
764 if(it->first == TrackPos){
766 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
767 if(tempTrack->Charge()>0){
768 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) matched++;
769 }
else if(tempTrack->Charge()<0){
772 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) matched++;
783 if(event->IsA()==AliAODEvent::Class()){
784 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
785 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
786 if(currTrack->GetID() == trackID){
791 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));
792 }
else TrackPos = trackID;
795 multimap<Int_t,Int_t>::iterator it;
796 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
797 if(!tempTrack)
return matched;
798 for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it){
799 if(it->first == TrackPos){
801 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
802 Bool_t match_dEta = kFALSE;
803 Bool_t match_dPhi = kFALSE;
804 if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
805 else match_dEta = kFALSE;
807 if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
808 else match_dPhi = kFALSE;
810 if (match_dPhi && match_dEta )matched++;
821 if(event->IsA()==AliAODEvent::Class()){
822 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
823 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
824 if(currTrack->GetID() == trackID){
829 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));
830 }
else TrackPos = trackID;
833 multimap<Int_t,Int_t>::iterator it;
834 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
835 if(!tempTrack)
return matched;
836 for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it){
837 if(it->first == TrackPos){
839 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
840 if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) matched++;
849 vector<Int_t> tempMatchedTracks;
850 multimap<Int_t,Int_t>::iterator it;
851 for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it){
852 if(it->first == clusterID){
854 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
855 if(!tempTrack)
continue;
856 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
857 if(tempTrack->Charge()>0){
858 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) tempMatchedTracks.push_back(it->second);
859 }
else if(tempTrack->Charge()<0){
862 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) tempMatchedTracks.push_back(it->second);
867 return tempMatchedTracks;
872 vector<Int_t> tempMatchedTracks;
873 multimap<Int_t,Int_t>::iterator it;
874 for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it){
875 if(it->first == clusterID){
877 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
878 if(!tempTrack)
continue;
879 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
880 Bool_t match_dEta = kFALSE;
881 Bool_t match_dPhi = kFALSE;
882 if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
883 else match_dEta = kFALSE;
885 if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
886 else match_dPhi = kFALSE;
888 if (match_dPhi && match_dEta )tempMatchedTracks.push_back(it->second);
893 return tempMatchedTracks;
898 vector<Int_t> tempMatchedTracks;
899 multimap<Int_t,Int_t>::iterator it;
900 for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it){
901 if(it->first == clusterID){
903 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
904 if(!tempTrack)
continue;
905 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
906 if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) tempMatchedTracks.push_back(it->second);
910 return tempMatchedTracks;
916 if(event->IsA()==AliAODEvent::Class()){
917 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
918 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
919 if(currTrack->GetID() == trackID){
924 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));
925 }
else TrackPos = trackID;
927 vector<Int_t> tempMatchedClusters;
928 multimap<Int_t,Int_t>::iterator it;
929 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
930 if(!tempTrack)
return tempMatchedClusters;
931 for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it){
932 if(it->first == TrackPos){
934 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
935 if(tempTrack->Charge()>0){
936 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) tempMatchedClusters.push_back(it->second);
937 }
else if(tempTrack->Charge()<0){
940 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) tempMatchedClusters.push_back(it->second);
946 return tempMatchedClusters;
952 if(event->IsA()==AliAODEvent::Class()){
953 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
954 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
955 if(currTrack->GetID() == trackID){
960 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));
961 }
else TrackPos = trackID;
963 vector<Int_t> tempMatchedClusters;
964 multimap<Int_t,Int_t>::iterator it;
965 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
966 if(!tempTrack)
return tempMatchedClusters;
967 for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it){
968 if(it->first == TrackPos){
970 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
971 Bool_t match_dEta = kFALSE;
972 Bool_t match_dPhi = kFALSE;
973 if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
974 else match_dEta = kFALSE;
976 if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
977 else match_dPhi = kFALSE;
979 if (match_dPhi && match_dEta )tempMatchedClusters.push_back(it->second);
983 return tempMatchedClusters;
989 if(event->IsA()==AliAODEvent::Class()){
990 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
991 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
992 if(currTrack->GetID() == trackID){
997 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));
998 }
else TrackPos = trackID;
1000 vector<Int_t> tempMatchedClusters;
1001 multimap<Int_t,Int_t>::iterator it;
1002 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
1003 if(!tempTrack)
return tempMatchedClusters;
1004 for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it){
1005 if(it->first == TrackPos){
1007 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1008 if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) tempMatchedClusters.push_back(it->second);
1012 return tempMatchedClusters;
1021 Int_t position = fSecMap_TrID_ClID_ToIndex[make_pair(trackID,clusterID)];
1022 if(position == 0)
return kFALSE;
1024 pairFloat tempEtaPhi = fSecVectorDeltaEtaDeltaPhi.at(position-1);
1025 dEta = tempEtaPhi.first;
1026 dPhi = tempEtaPhi.second;
1031 Int_t position = fSecMap_TrID_ClID_AlreadyTried[make_pair(trackID,clusterID)];
1032 if(position == 0)
return kFALSE;
1038 multimap<Int_t,Int_t>::iterator it;
1039 for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it){
1040 if(it->first == clusterID){
1042 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
1043 if(!tempTrack)
continue;
1044 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
1045 if(tempTrack->Charge()>0){
1046 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) matched++;
1047 }
else if(tempTrack->Charge()<0){
1050 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) matched++;
1062 multimap<Int_t,Int_t>::iterator it;
1063 for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it){
1064 if(it->first == clusterID){
1066 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
1067 if(!tempTrack)
continue;
1068 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
1069 Bool_t match_dEta = kFALSE;
1070 Bool_t match_dPhi = kFALSE;
1071 if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
1072 else match_dEta = kFALSE;
1074 if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
1075 else match_dPhi = kFALSE;
1077 if (match_dPhi && match_dEta )matched++;
1088 multimap<Int_t,Int_t>::iterator it;
1089 for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it){
1090 if(it->first == clusterID){
1092 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
1093 if(!tempTrack)
continue;
1094 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
1095 if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) matched++;
1105 Int_t TrackPos = -1;
1106 if(event->IsA()==AliAODEvent::Class()){
1107 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
1108 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
1109 if(currTrack->GetID() == trackID){
1114 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));
1115 }
else TrackPos = trackID;
1118 multimap<Int_t,Int_t>::iterator it;
1119 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
1120 if(!tempTrack)
return matched;
1121 for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it){
1122 if(it->first == TrackPos){
1124 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1125 if(tempTrack->Charge()>0){
1126 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) matched++;
1127 }
else if(tempTrack->Charge()<0){
1130 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) matched++;
1141 Int_t TrackPos = -1;
1142 if(event->IsA()==AliAODEvent::Class()){
1143 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
1144 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
1145 if(currTrack->GetID() == trackID){
1150 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));
1151 }
else TrackPos = trackID;
1154 multimap<Int_t,Int_t>::iterator it;
1155 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
1156 if(!tempTrack)
return matched;
1157 for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it){
1158 if(it->first == TrackPos){
1160 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1161 Bool_t match_dEta = kFALSE;
1162 Bool_t match_dPhi = kFALSE;
1163 if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
1164 else match_dEta = kFALSE;
1166 if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
1167 else match_dPhi = kFALSE;
1169 if (match_dPhi && match_dEta )matched++;
1180 Int_t TrackPos = -1;
1181 if(event->IsA()==AliAODEvent::Class()){
1182 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
1183 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
1184 if(currTrack->GetID() == trackID){
1189 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));
1190 }
else TrackPos = trackID;
1193 multimap<Int_t,Int_t>::iterator it;
1194 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
1195 if(!tempTrack)
return matched;
1196 for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it){
1197 if(it->first == TrackPos){
1199 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1200 if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) matched++;
1210 vector<Int_t> tempMatchedTracks;
1211 multimap<Int_t,Int_t>::iterator it;
1212 for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it){
1213 if(it->first == clusterID){
1215 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
1216 if(!tempTrack)
continue;
1217 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
1218 if(tempTrack->Charge()>0){
1219 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) tempMatchedTracks.push_back(it->second);
1220 }
else if(tempTrack->Charge()<0){
1223 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) tempMatchedTracks.push_back(it->second);
1229 return tempMatchedTracks;
1234 vector<Int_t> tempMatchedTracks;
1235 multimap<Int_t,Int_t>::iterator it;
1236 for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it){
1237 if(it->first == clusterID){
1239 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
1240 if(!tempTrack)
continue;
1241 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
1242 Bool_t match_dEta = kFALSE;
1243 Bool_t match_dPhi = kFALSE;
1244 if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
1245 else match_dEta = kFALSE;
1247 if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
1248 else match_dPhi = kFALSE;
1250 if (match_dPhi && match_dEta )tempMatchedTracks.push_back(it->second);
1255 return tempMatchedTracks;
1260 vector<Int_t> tempMatchedTracks;
1261 multimap<Int_t,Int_t>::iterator it;
1262 for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it){
1263 if(it->first == clusterID){
1265 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(it->second));
1266 if(!tempTrack)
continue;
1267 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
1268 if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) tempMatchedTracks.push_back(it->second);
1273 return tempMatchedTracks;
1278 Int_t TrackPos = -1;
1279 if(event->IsA()==AliAODEvent::Class()){
1280 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
1281 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
1282 if(currTrack->GetID() == trackID){
1287 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));
1288 }
else TrackPos = trackID;
1290 vector<Int_t> tempMatchedClusters;
1291 multimap<Int_t,Int_t>::iterator it;
1292 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
1293 if(!tempTrack)
return tempMatchedClusters;
1294 for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it){
1295 if(it->first == TrackPos){
1297 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1298 if(tempTrack->Charge()>0){
1299 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) tempMatchedClusters.push_back(it->second);
1300 }
else if(tempTrack->Charge()<0){
1303 if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) tempMatchedClusters.push_back(it->second);
1309 return tempMatchedClusters;
1314 Int_t TrackPos = -1;
1315 if(event->IsA()==AliAODEvent::Class()){
1316 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
1317 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
1318 if(currTrack->GetID() == trackID){
1323 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));
1324 }
else TrackPos = trackID;
1326 vector<Int_t> tempMatchedClusters;
1327 multimap<Int_t,Int_t>::iterator it;
1328 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
1329 if(!tempTrack)
return tempMatchedClusters;
1330 for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it){
1331 if(it->first == TrackPos){
1333 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1334 Bool_t match_dEta = kFALSE;
1335 Bool_t match_dPhi = kFALSE;
1336 if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
1337 else match_dEta = kFALSE;
1339 if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
1340 else match_dPhi = kFALSE;
1342 if (match_dPhi && match_dEta )tempMatchedClusters.push_back(it->second);
1347 return tempMatchedClusters;
1352 Int_t TrackPos = -1;
1353 if(event->IsA()==AliAODEvent::Class()){
1354 for (
Int_t iTrack = 0; iTrack <
event->GetNumberOfTracks(); iTrack++){
1355 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(iTrack));
1356 if(currTrack->GetID() == trackID){
1361 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));
1362 }
else TrackPos = trackID;
1364 vector<Int_t> tempMatchedClusters;
1365 multimap<Int_t,Int_t>::iterator it;
1366 AliVTrack* tempTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(TrackPos));
1367 if(!tempTrack)
return tempMatchedClusters;
1368 for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it){
1369 if(it->first == TrackPos){
1371 if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1372 if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) tempMatchedClusters.push_back(it->second);
1377 return tempMatchedClusters;
1383 vector<Int_t> labelsMatched = GetMatchedTrackIDsForCluster(event, clusterID, dR);
1384 if((
Int_t) labelsMatched.size()<1)
return sumTrackEt;
1386 TLorentzVector vecTrack;
1387 for (
UInt_t i = 0; i < labelsMatched.size(); i++){
1388 AliVTrack* currTrack =
dynamic_cast<AliVTrack*
>(
event->GetTrack(labelsMatched.at(i)));
1389 if(!currTrack)
continue;
1390 vecTrack.SetPxPyPzE(currTrack->Px(),currTrack->Py(),currTrack->Pz(),currTrack->E());
1391 sumTrackEt += vecTrack.Et();
1399 TAxis *axisafter = histoRebin->GetYaxis();
1400 Int_t bins = axisafter->GetNbins();
1401 Double_t from = axisafter->GetXmin();
1402 Double_t to = axisafter->GetXmax();
1405 Double_t factor = TMath::Power(to/from, 1./bins);
1406 for(
Int_t i=1; i<=bins; ++i) newbins[i] = factor * newbins[i-1];
1407 axisafter->Set(bins, newbins);
1414 if(fSecVectorDeltaEtaDeltaPhi.size()>0){
1415 cout <<
"******************************" << endl;
1416 cout <<
"******************************" << endl;
1417 cout <<
"NEW EVENT !" << endl;
1418 cout <<
"vector etaphi:" << endl;
1419 cout << fSecVectorDeltaEtaDeltaPhi.size() << endl;
1420 cout <<
"multimap" << endl;
1421 mapT::iterator iter = fSecMap_TrID_ClID_ToIndex.begin();
1422 for (iter = fSecMap_TrID_ClID_ToIndex.begin(); iter != fSecMap_TrID_ClID_ToIndex.end(); ++iter){
1424 if(!GetSecTrackClusterMatchingResidual(iter->first.first,iter->first.second,dEta,dPhi))
continue;
1425 cout <<
" [" << iter->first.first <<
"/" << iter->first.second <<
", " << iter->second <<
"] - (" << dEta <<
"/" << dPhi <<
")" << endl;
1427 cout <<
"mapTrackToCluster" << endl;
1429 for (
Int_t itr=0;itr<esdev->GetNumberOfTracks();itr++){
1430 AliVTrack *inTrack = esdev->GetTrack(itr);
1431 if(!inTrack)
continue;
1433 if(inTrack->Charge()>0) tCharge =
"+";
1434 else if(inTrack->Charge()<0) tCharge =
"-";
1435 cout << itr <<
" (" << tCharge <<
") - " << GetNMatchedClusterIDsForSecTrack(fInputEvent,inTrack->GetID(),5,-5,0.2,-0.4) <<
"\t\t";
1438 multimap<Int_t,Int_t>::iterator it;
1439 for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it) cout << it->first <<
" => " << it->second <<
'\n';
1440 cout <<
"mapClusterToTrack" << endl;
1441 Int_t tempClus = it->second;
1442 for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it) cout << it->first <<
" => " << it->second <<
'\n';
1443 vector<Int_t> tempTracks = GetMatchedSecTrackIDsForCluster(fInputEvent,tempClus, 5, -5, 0.2, -0.4);
1444 for(
UInt_t iJ=0; iJ<tempTracks.size();iJ++){
1445 cout << tempClus <<
" - " << tempTracks.at(iJ) << endl;
1453 if(fVectorDeltaEtaDeltaPhi.size()>0){
1454 cout <<
"******************************" << endl;
1455 cout <<
"******************************" << endl;
1456 cout <<
"NEW EVENT !" << endl;
1457 cout <<
"vector etaphi:" << endl;
1458 cout << fVectorDeltaEtaDeltaPhi.size() << endl;
1459 cout <<
"multimap" << endl;
1460 mapT::iterator iter = fMap_TrID_ClID_ToIndex.begin();
1461 for (iter = fMap_TrID_ClID_ToIndex.begin(); iter != fMap_TrID_ClID_ToIndex.end(); ++iter){
1463 if(!GetTrackClusterMatchingResidual(iter->first.first,iter->first.second,dEta,dPhi))
continue;
1464 cout <<
" [" << iter->first.first <<
"/" << iter->first.second <<
", " << iter->second <<
"] - (" << dEta <<
"/" << dPhi <<
")" << endl;
1466 cout <<
"mapTrackToCluster" << endl;
1468 for (
Int_t itr=0;itr<esdev->GetNumberOfTracks();itr++){
1469 AliVTrack *inTrack = esdev->GetTrack(itr);
1470 if(!inTrack)
continue;
1472 if(inTrack->Charge()>0) tCharge =
"+";
1473 else if(inTrack->Charge()<0) tCharge =
"-";
1474 cout << itr <<
" (" << tCharge <<
") - " << GetNMatchedClusterIDsForTrack(fInputEvent,inTrack->GetID(),5,-5,0.2,-0.4) <<
"\t\t";
1477 multimap<Int_t,Int_t>::iterator it;
1478 for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it) cout << it->first <<
" => " << it->second <<
'\n';
1479 cout <<
"mapClusterToTrack" << endl;
1480 Int_t tempClus = it->second;
1481 for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it) cout << it->first <<
" => " << it->second <<
'\n';
1482 vector<Int_t> tempTracks = GetMatchedTrackIDsForCluster(fInputEvent,tempClus, 5, -5, 0.2, -0.4);
1483 for(
UInt_t iJ=0; iJ<tempTracks.size();iJ++){
1484 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)