AliPhysics  d497547 (d497547)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliCaloTrackMatcher.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: Daniel Mühlheim *
5  * Version 1.0 *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
17 //---------------------------------------------
18 // Basic Track Matching Class
19 //---------------------------------------------
21 
22 
23 #include "AliAnalysisManager.h"
24 #include "AliAODEvent.h"
25 #include "AliCaloTrackMatcher.h"
26 #include "AliEMCALRecoUtils.h"
27 #include "AliESDEvent.h"
28 #include "AliESDtrack.h"
29 #include "AliESDtrackCuts.h"
30 #include "AliInputEventHandler.h"
31 #include "AliTrackerBase.h"
32 #include "AliV0ReaderV1.h"
33 
34 #include "TAxis.h"
35 #include "TChain.h"
36 #include "TH1F.h"
37 #include "TF1.h"
38 
39 #include <vector>
40 #include <map>
41 #include <utility>
42 
43 class iostream;
44 
45 using namespace std;
46 
47 
48 ClassImp(AliCaloTrackMatcher)
49 
50 //________________________________________________________________________
51 AliCaloTrackMatcher::AliCaloTrackMatcher(const char *name, Int_t clusterType) : AliAnalysisTaskSE(name),
52  fClusterType(clusterType),
53  fV0ReaderName(""),
54  fAnalysisTrainMode("Grid"),
55  fMatchingWindow(200),
56  fMatchingResidual(0.2),
57  fRunNumber(-1),
58  fGeomEMCAL(NULL),
59  fGeomPHOS(NULL),
60  fMapTrackToCluster(),
61  fMapClusterToTrack(),
62  fNEntries(1),
63  fVectorDeltaEtaDeltaPhi(0),
64  fMap_TrID_ClID_ToIndex(),
65  fSecMapTrackToCluster(),
66  fSecMapClusterToTrack(),
67  fSecNEntries(1),
68  fSecVectorDeltaEtaDeltaPhi(0),
69  fSecMap_TrID_ClID_ToIndex(),
70  fSecMap_TrID_ClID_AlreadyTried(),
71  fListHistos(NULL),
72  fHistControlMatches(NULL),
73  fSecHistControlMatches(NULL)
74 {
75  // Default constructor
76  DefineInput(0, TChain::Class());
77 }
78 
79 //________________________________________________________________________
81  // default deconstructor
82  fMapTrackToCluster.clear();
83  fMapClusterToTrack.clear();
84  fVectorDeltaEtaDeltaPhi.clear();
85  fMap_TrID_ClID_ToIndex.clear();
86 
87  fSecMapTrackToCluster.clear();
88  fSecMapClusterToTrack.clear();
89  fSecVectorDeltaEtaDeltaPhi.clear();
90  fSecMap_TrID_ClID_ToIndex.clear();
91  fSecMap_TrID_ClID_AlreadyTried.clear();
92 
93  if(fHistControlMatches) delete fHistControlMatches;
94  if(fSecHistControlMatches) delete fSecHistControlMatches;
95  if(fAnalysisTrainMode.EqualTo("Grid")){
96  if(fListHistos != NULL){
97  delete fListHistos;
98  }
99  }
100 }
101 
102 //________________________________________________________________________
104  fMapTrackToCluster.clear();
105  fMapClusterToTrack.clear();
106  fVectorDeltaEtaDeltaPhi.clear();
107  fMap_TrID_ClID_ToIndex.clear();
108 
109  fSecMapTrackToCluster.clear();
110  fSecMapClusterToTrack.clear();
111  fSecVectorDeltaEtaDeltaPhi.clear();
112  fSecMap_TrID_ClID_ToIndex.clear();
113  fSecMap_TrID_ClID_AlreadyTried.clear();
114 }
115 
116 //________________________________________________________________________
118  if(fListHistos != NULL){
119  delete fListHistos;
120  fListHistos = NULL;
121  }
122  if(fListHistos == NULL){
123  fListHistos = new TList();
124  fListHistos->SetOwner(kTRUE);
125  fListHistos->SetName(Form("CaloTrackMatcher_%i",fClusterType));
126  }
127 
128  // Create User Output Objects
129  fHistControlMatches = new TH2F(Form("ControlMatches_%i",fClusterType),Form("ControlMatches_%i",fClusterType),7,-0.5,6.5,50,0.15,200);
130  SetLogBinningYTH2(fHistControlMatches);
131  fHistControlMatches->GetYaxis()->SetTitle("track pT (GeV/c)");
132  fHistControlMatches->GetXaxis()->SetBinLabel(1,"nTr in");
133  fHistControlMatches->GetXaxis()->SetBinLabel(2,"no inner Tr params");
134  fHistControlMatches->GetXaxis()->SetBinLabel(3,"failed 1st pro-step");
135  fHistControlMatches->GetXaxis()->SetBinLabel(4,"Tr not in EMCal acc");
136  fHistControlMatches->GetXaxis()->SetBinLabel(5,"failed 2nd pro-step");
137  fHistControlMatches->GetXaxis()->SetBinLabel(6,"w/o match to cluster");
138  fHistControlMatches->GetXaxis()->SetBinLabel(7,"nTr out, w/ match");
139  fListHistos->Add(fHistControlMatches);
140 
141  fSecHistControlMatches = new TH2F(Form("ControlSecMatches_%i",fClusterType),Form("ControlSecMatches_%i",fClusterType),7,-0.5,6.5,50,0.15,200);
142  SetLogBinningYTH2(fSecHistControlMatches);
143  fSecHistControlMatches->GetYaxis()->SetTitle("track pT (GeV/c)");
144  fSecHistControlMatches->GetXaxis()->SetBinLabel(1,"nTr in");
145  fSecHistControlMatches->GetXaxis()->SetBinLabel(2,"no inner Tr params");
146  fSecHistControlMatches->GetXaxis()->SetBinLabel(3,"failed 1st pro-step");
147  fSecHistControlMatches->GetXaxis()->SetBinLabel(4,"Tr not in EMCal acc");
148  fSecHistControlMatches->GetXaxis()->SetBinLabel(5,"failed 2nd pro-step");
149  fSecHistControlMatches->GetXaxis()->SetBinLabel(6,"w/o match to cluster");
150  fSecHistControlMatches->GetXaxis()->SetBinLabel(7,"nTr out, w/ match");
151  fListHistos->Add(fSecHistControlMatches);
152 }
153 
154 //________________________________________________________________________
156  // Initialize function to be called once before analysis
157  fMapTrackToCluster.clear();
158  fMapClusterToTrack.clear();
159  fNEntries = 1;
160  fVectorDeltaEtaDeltaPhi.clear();
161  fMap_TrID_ClID_ToIndex.clear();
162 
163  fSecMapTrackToCluster.clear();
164  fSecMapClusterToTrack.clear();
165  fSecNEntries = 1;
166  fSecVectorDeltaEtaDeltaPhi.clear();
167  fSecMap_TrID_ClID_ToIndex.clear();
168  fSecMap_TrID_ClID_AlreadyTried.clear();
169 
170  if(fRunNumber == -1 || fRunNumber != runNumber){
171  if(fClusterType == 1 || fClusterType == 3){
172  fGeomEMCAL = AliEMCALGeometry::GetInstanceFromRunNumber(runNumber);
173  if(!fGeomEMCAL){ AliFatal("EMCal geometry not initialized!");}
174  }else if(fClusterType == 2){
175  fGeomPHOS = AliPHOSGeometry::GetInstance();
176  if(!fGeomPHOS) AliFatal("PHOS geometry not initialized!");
177  }
178  fRunNumber = runNumber;
179  }
180 }
181 
182 //________________________________________________________________________
184 
185  // main method of AliCaloTrackMatcher, first initialize and then process event
186 
187  //DebugV0Matching();
188 
189  // do processing only for EMCal (1), DCal (3) or PHOS (2) clusters, otherwise do nothing
190  if(fClusterType == 1 || fClusterType == 2 || fClusterType == 3){
191  Initialize(fInputEvent->GetRunNumber());
192  ProcessEvent(fInputEvent);
193  }
194 
195  //DebugMatching();
196 
197  return;
198 }
199 
200 //________________________________________________________________________
201 void AliCaloTrackMatcher::ProcessEvent(AliVEvent *event){
202  Int_t nClus = event->GetNumberOfCaloClusters();
203  Int_t nModules = 0;
204  if(fClusterType == 1 || fClusterType == 3) nModules = fGeomEMCAL->GetNumberOfSuperModules();
205  else if(fClusterType == 2) nModules = fGeomPHOS->GetNModules();
206 
207  AliESDEvent *esdev = dynamic_cast<AliESDEvent*>(event);
208  AliAODEvent *aodev = 0;
209  if (!esdev) {
210  aodev = dynamic_cast<AliAODEvent*>(event);
211  if (!aodev) {
212  AliError("Task needs AOD or ESD event, returning");
213  return;
214  }
215  }
216 
217  for (Int_t itr=0;itr<event->GetNumberOfTracks();itr++){
218  AliExternalTrackParam *trackParam = 0;
219  AliVTrack *inTrack = 0x0;
220  if(esdev){
221  inTrack = esdev->GetTrack(itr);
222  if(!inTrack) continue;
223  fHistControlMatches->Fill(0.,inTrack->Pt());
224  AliESDtrack *esdt = dynamic_cast<AliESDtrack*>(inTrack);
225 
226  const AliExternalTrackParam *in = esdt->GetInnerParam();
227  if (!in){AliDebug(2, "Could not get InnerParam of Track, continue"); fHistControlMatches->Fill(1.,inTrack->Pt()); continue;}
228  trackParam = new AliExternalTrackParam(*in);
229  } else if(aodev) {
230  inTrack = dynamic_cast<AliVTrack*>(aodev->GetTrack(itr));
231  if(!inTrack) continue;
232  fHistControlMatches->Fill(0.,inTrack->Pt());
233  AliAODTrack *aodt = dynamic_cast<AliAODTrack*>(inTrack);
234 
235  Double_t xyz[3] = {0}, pxpypz[3] = {0}, cv[21] = {0};
236  aodt->GetPxPyPz(pxpypz);
237  aodt->GetXYZ(xyz);
238  aodt->GetCovarianceXYZPxPyPz(cv);
239  trackParam = new AliExternalTrackParam(xyz,pxpypz,cv,aodt->Charge());
240  }
241 
242  if (!trackParam) {AliError("Could not get TrackParameters, continue"); fHistControlMatches->Fill(1.,inTrack->Pt()); continue;}
243  AliExternalTrackParam emcParam(*trackParam);
244  Float_t eta, phi, pt;
245 
246  //propagate tracks to emc surfaces
247  if(fClusterType == 1 || fClusterType == 3){
248  if (!AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(&emcParam, 440., 0.139, 20., eta, phi, pt)) {
249  delete trackParam;
250  fHistControlMatches->Fill(2.,inTrack->Pt());
251  continue;
252  }
253 
254  if( TMath::Abs(eta) > 0.75 ) {
255  delete trackParam;
256  fHistControlMatches->Fill(3.,inTrack->Pt());
257  continue;
258  }
259  // Save some time and memory in case of no DCal present
260  if( fClusterType == 1 && nModules < 13 && ( phi < 70*TMath::DegToRad() || phi > 190*TMath::DegToRad())){
261  delete trackParam;
262  fHistControlMatches->Fill(3.,inTrack->Pt());
263  continue;
264  }
265  // Save some time and memory in case of run2
266  if( nModules > 12 ){
267  if (fClusterType == 3 && ( phi < 250*TMath::DegToRad() || phi > 340*TMath::DegToRad())){
268  delete trackParam;
269  fHistControlMatches->Fill(3.,inTrack->Pt());
270  continue;
271  }
272  if( fClusterType == 1 && ( phi < 70*TMath::DegToRad() || phi > 190*TMath::DegToRad())){
273  delete trackParam;
274  fHistControlMatches->Fill(3.,inTrack->Pt());
275  continue;
276  }
277  }
278 
279  }else if(fClusterType == 2){
280  if( !AliTrackerBase::PropagateTrackToBxByBz(&emcParam, 460., 0.139, 20, kTRUE, 0.8, -1)){
281  delete trackParam;
282  fHistControlMatches->Fill(3.,inTrack->Pt());
283  continue;
284  }
285 //to do: implement of distance checks
286  }
287 
288  Float_t dEta=-999, dPhi=-999;
289  Float_t clsPos[3] = {0.,0.,0.};
290  Double_t exPos[3] = {0.,0.,0.};
291  if (!emcParam.GetXYZ(exPos)){ fHistControlMatches->Fill(2.,inTrack->Pt()); continue;}
292 
293 //cout << inTrack->GetID() << " - " << trackParam << endl;
294 //cout << "eta/phi: " << eta << ", " << phi << endl;
295 //cout << "nClus: " << nClus << endl;
296  Int_t nClusterMatchesToTrack = 0;
297  for(Int_t iclus=0;iclus < nClus;iclus++){
298  AliVCluster* cluster = event->GetCaloCluster(iclus);
299  if (!cluster) continue;
300 //cout << "-------------------------LOOPING: " << iclus << ", " << cluster->GetID() << endl;
301  cluster->GetPosition(clsPos);
302  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));
303 //cout << "dR: " << dR << endl;
304  if (dR > fMatchingWindow) continue;
305  Double_t clusterR = TMath::Sqrt( clsPos[0]*clsPos[0] + clsPos[1]*clsPos[1] );
306 
307  AliExternalTrackParam trackParamTmp(emcParam);//Retrieve the starting point every time before the extrapolation
308  if(fClusterType == 1 || fClusterType == 3){
309  if (!cluster->IsEMCAL()) continue;
310  if(!AliEMCALRecoUtils::ExtrapolateTrackToCluster(&trackParamTmp, cluster, 0.139, 5., dEta, dPhi)){fHistControlMatches->Fill(4.,inTrack->Pt()); continue;}
311  }else if(fClusterType == 2){
312  if (!cluster->IsPHOS()) continue;
313  if(!AliTrackerBase::PropagateTrackToBxByBz(&trackParamTmp, clusterR, 0.139, 5., kTRUE, 0.8, -1)){fHistControlMatches->Fill(4.,inTrack->Pt()); continue;}
314  Double_t trkPos[3] = {0,0,0};
315  trackParamTmp.GetXYZ(trkPos);
316  TVector3 trkPosVec(trkPos[0],trkPos[1],trkPos[2]);
317  TVector3 clsPosVec(clsPos);
318  dPhi = clsPosVec.DeltaPhi(trkPosVec);
319  dEta = clsPosVec.Eta()-trkPosVec.Eta();
320  }
321 
322 
323  Float_t dR2 = dPhi*dPhi + dEta*dEta;
324 //cout << dEta << " - " << dPhi << " - " << dR2 << endl;
325  if(dR2 > fMatchingResidual) continue;
326 //cout << "MATCHED!!!!!!!" << endl;
327  nClusterMatchesToTrack++;
328  if(aodev){
329  fMapTrackToCluster.insert(make_pair(itr,cluster->GetID()));
330  fMapClusterToTrack.insert(make_pair(cluster->GetID(),itr));
331  }else{
332  fMapTrackToCluster.insert(make_pair(inTrack->GetID(),cluster->GetID()));
333  fMapClusterToTrack.insert(make_pair(cluster->GetID(),inTrack->GetID()));
334  }
335  fVectorDeltaEtaDeltaPhi.push_back(make_pair(dEta,dPhi));
336  fMap_TrID_ClID_ToIndex[make_pair(inTrack->GetID(),cluster->GetID())] = fNEntries++;
337  if( (Int_t)fVectorDeltaEtaDeltaPhi.size() != (fNEntries-1)) AliFatal("Fatal error in AliCaloTrackMatcher, vector and map are not in sync!");
338  }
339  if(nClusterMatchesToTrack == 0) fHistControlMatches->Fill(5.,inTrack->Pt());
340  else fHistControlMatches->Fill(6.,inTrack->Pt());
341  delete trackParam;
342  }
343 
344  return;
345 }
346 
347 //________________________________________________________________________
348 Bool_t AliCaloTrackMatcher::PropagateV0TrackToClusterAndGetMatchingResidual(AliVTrack* inSecTrack, AliVCluster* cluster, AliVEvent* event, Float_t &dEta, Float_t &dPhi){
349 
350  //if V0-track to cluster match is already available return stored residuals
351  if(GetSecTrackClusterMatchingResidual(inSecTrack->GetID(),cluster->GetID(), dEta, dPhi)){
352 //cout << "RESIDUAL ALREADY AVAILABLE! - " << dEta << "/" << dPhi << endl;
353  return kTRUE;
354  }
355 
356  if(IsSecTrackClusterAlreadyTried(inSecTrack->GetID(),cluster->GetID())){
357 //cout << "PROPAGATION ALREADY FAILED! - " << inSecTrack->GetID() << "/" << cluster->GetID() << endl;
358  return kFALSE;
359  }
360 
361 //cout << "running matching! - " << inSecTrack->GetID() << "/" << cluster->GetID() << endl;
362  //if match has not yet been computed, go on:
363  Int_t nModules = 0;
364  if(fClusterType == 1 || fClusterType == 3) nModules = fGeomEMCAL->GetNumberOfSuperModules();
365  else if(fClusterType == 2) nModules = fGeomPHOS->GetNModules();
366 
367  AliESDEvent *esdev = dynamic_cast<AliESDEvent*>(event);
368  AliAODEvent *aodev = 0;
369  if (!esdev) {
370  aodev = dynamic_cast<AliAODEvent*>(event);
371  if (!aodev) {
372  AliError("Task needs AOD or ESD event, returning");
373  return kFALSE;
374  }
375  }
376 
377  if(!cluster->IsEMCAL() && !cluster->IsPHOS()){AliError("Cluster is neither EMCAL nor PHOS, returning");return kFALSE;}
378 
379  Float_t clusterPosition[3] = {0,0,0};
380  cluster->GetPosition(clusterPosition);
381  Double_t clusterR = TMath::Sqrt( clusterPosition[0]*clusterPosition[0] + clusterPosition[1]*clusterPosition[1] );
382 
383  if(!inSecTrack) return kFALSE;
384  fSecHistControlMatches->Fill(0.,inSecTrack->Pt());
385 
386  AliESDtrack *esdt = dynamic_cast<AliESDtrack*>(inSecTrack);
387  AliAODTrack *aodt = 0;
388  if (!esdt) {
389  aodt = dynamic_cast<AliAODTrack*>(inSecTrack);
390  if (!aodt){
391  AliError("Track is neither ESD nor AOD, continue");
392  fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
393  return kFALSE;
394  }
395  }
396 
397  AliExternalTrackParam *trackParam = 0;
398  if (esdt) {
399  const AliExternalTrackParam *in = esdt->GetInnerParam();
400  if (!in){
401  AliDebug(2, "Could not get InnerParam of Track, continue");
402  fSecHistControlMatches->Fill(1.,inSecTrack->Pt());
403  fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
404  return kFALSE;
405  }
406  trackParam = new AliExternalTrackParam(*in);
407  } else {
408  Double_t xyz[3] = {0}, pxpypz[3] = {0}, cv[21] = {0};
409  aodt->GetPxPyPz(pxpypz);
410  aodt->GetXYZ(xyz);
411  aodt->GetCovarianceXYZPxPyPz(cv);
412  trackParam = new AliExternalTrackParam(xyz,pxpypz,cv,aodt->Charge());
413  }
414  if(!trackParam){
415  AliError("Could not get TrackParameters, continue");
416  fSecHistControlMatches->Fill(1.,inSecTrack->Pt());
417  fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
418  return kFALSE;
419  }
420 
421  Bool_t propagated = kFALSE;
422  AliExternalTrackParam emcParam(*trackParam);
423  Float_t dPhiTemp = 0;
424  Float_t dEtaTemp = 0;
425 
426  if(cluster->IsEMCAL()){
427  Float_t eta = 0;Float_t phi = 0;Float_t pt = 0;
428  propagated = AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(&emcParam, 430, 0.000510999, 20, eta, phi, pt);
429  if(propagated){
430  if( TMath::Abs(eta) > 0.8 ) {
431  delete trackParam;
432  fSecHistControlMatches->Fill(3.,inSecTrack->Pt());
433  fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
434  return kFALSE;
435  }
436  // Save some time and memory in case of no DCal present
437  if( nModules < 13 && ( phi < 60*TMath::DegToRad() || phi > 200*TMath::DegToRad())){
438  delete trackParam;
439  fSecHistControlMatches->Fill(3.,inSecTrack->Pt());
440  fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
441  return kFALSE;
442  }
443 
444  propagated = AliEMCALRecoUtils::ExtrapolateTrackToCluster(&emcParam, cluster, 0.000510999, 5, dEtaTemp, dPhiTemp);
445  if(!propagated){
446  delete trackParam;
447  fSecHistControlMatches->Fill(4.,inSecTrack->Pt());
448  fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
449  return kFALSE;
450  }
451  }else{
452  delete trackParam;
453  fSecHistControlMatches->Fill(2.,inSecTrack->Pt());
454  fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
455  return kFALSE;
456  }
457 
458  }else if(cluster->IsPHOS()){
459  propagated = AliTrackerBase::PropagateTrackToBxByBz(&emcParam, clusterR, 0.000510999, 20, kTRUE, 0.8, -1);
460  if (propagated){
461  Double_t trkPos[3] = {0,0,0};
462  emcParam.GetXYZ(trkPos);
463  TVector3 trkPosVec(trkPos[0],trkPos[1],trkPos[2]);
464  TVector3 clsPosVec(clusterPosition);
465  dPhiTemp = clsPosVec.DeltaPhi(trkPosVec);
466  dEtaTemp = clsPosVec.Eta()-trkPosVec.Eta();
467  }else{
468  delete trackParam;
469  fSecHistControlMatches->Fill(2.,inSecTrack->Pt());
470  fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
471  return kFALSE;}
472  }
473 
474  if (propagated){
475  Float_t dR2 = dPhiTemp*dPhiTemp + dEtaTemp*dEtaTemp;
476 //cout << dEtaTemp << " - " << dPhiTemp << " - " << dR2 << endl;
477  if(dR2 > fMatchingResidual){
478  fSecHistControlMatches->Fill(5.,inSecTrack->Pt());
479  fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
480 //cout << "NO MATCH! - " << inSecTrack->GetID() << "/" << cluster->GetID() << endl;
481  delete trackParam;
482  return kFALSE;
483  }
484 //cout << "MATCHED!!!!!!!" << endl;
485 
486  if(aodev){
487  //need to search for position in case of AOD
488  Int_t TrackPos = -1;
489  for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++){
490  AliVTrack* currTrack = dynamic_cast<AliVTrack*>(event->GetTrack(iTrack));
491  if(currTrack->GetID() == inSecTrack->GetID()){
492  TrackPos = iTrack;
493  break;
494  }
495  }
496  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()));
497  fSecMapTrackToCluster.insert(make_pair(TrackPos,cluster->GetID()));
498  fSecMapClusterToTrack.insert(make_pair(cluster->GetID(),TrackPos));
499  }else{
500  fSecMapTrackToCluster.insert(make_pair(inSecTrack->GetID(),cluster->GetID()));
501  fSecMapClusterToTrack.insert(make_pair(cluster->GetID(),inSecTrack->GetID()));
502  }
503  fSecVectorDeltaEtaDeltaPhi.push_back(make_pair(dEtaTemp,dPhiTemp));
504  fSecMap_TrID_ClID_ToIndex[make_pair(inSecTrack->GetID(),cluster->GetID())] = fSecNEntries++;
505  if( (Int_t)fSecVectorDeltaEtaDeltaPhi.size() != (fSecNEntries-1)) AliFatal("Fatal error in AliCaloTrackMatcher, vector and map are not in sync!");
506 
507  fSecHistControlMatches->Fill(6.,inSecTrack->Pt());
508  dEta = dEtaTemp;
509  dPhi = dPhiTemp;
510  delete trackParam;
511  return kTRUE;
512  }else AliFatal("Fatal error in AliCaloTrackMatcher, track is labeled as sucessfully propagated although this should be impossible!");
513 
514  fSecMap_TrID_ClID_AlreadyTried[make_pair(inSecTrack->GetID(),cluster->GetID())] = 1.;
515  delete trackParam;
516  return kFALSE;
517 }
518 
519 //________________________________________________________________________
520 //________________________________________________________________________
521 //________________________________________________________________________
522 //________________________________________________________________________
523 //________________________________________________________________________
525  Int_t position = fMap_TrID_ClID_ToIndex[make_pair(trackID,clusterID)];
526  if(position == 0) return kFALSE;
527 
528  pairFloat tempEtaPhi = fVectorDeltaEtaDeltaPhi.at(position-1);
529  dEta = tempEtaPhi.first;
530  dPhi = tempEtaPhi.second;
531  return kTRUE;
532 }
533 //________________________________________________________________________
534 Int_t AliCaloTrackMatcher::GetNMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin){
535  Int_t matched = 0;
536  multimap<Int_t,Int_t>::iterator it;
537  for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it){
538  if(it->first == clusterID){
539  Float_t tempDEta, tempDPhi;
540  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(it->second));
541  if(!tempTrack) continue;
542  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
543  if(tempTrack->Charge()>0){
544  if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) matched++;
545  }else if(tempTrack->Charge()<0){
546  dPhiMin*=-1;
547  dPhiMax*=-1;
548  if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) matched++;
549  }
550  }
551  }
552  }
553 
554  return matched;
555 }
556 
557 //________________________________________________________________________
558 Int_t AliCaloTrackMatcher::GetNMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi){
559  Int_t matched = 0;
560  multimap<Int_t,Int_t>::iterator it;
561  for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it){
562  if(it->first == clusterID){
563  Float_t tempDEta, tempDPhi;
564  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(it->second));
565  if(!tempTrack) continue;
566  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
567  Bool_t match_dEta = kFALSE;
568  Bool_t match_dPhi = kFALSE;
569  if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
570  else match_dEta = kFALSE;
571 
572  if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
573  else match_dPhi = kFALSE;
574 
575  if (match_dPhi && match_dEta )matched++;
576  }
577  }
578  }
579  return matched;
580 }
581 
582 //________________________________________________________________________
584  Int_t matched = 0;
585  multimap<Int_t,Int_t>::iterator it;
586  for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it){
587  if(it->first == clusterID){
588  Float_t tempDEta, tempDPhi;
589  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(it->second));
590  if(!tempTrack) continue;
591  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
592  if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) matched++;
593  }
594  }
595  }
596  return matched;
597 }
598 
599 //________________________________________________________________________
600 Int_t AliCaloTrackMatcher::GetNMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin){
601 
602  Int_t TrackPos = -1;
603  if(event->IsA()==AliAODEvent::Class()){ // for AOD, we have to look for position of track in the event
604  for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++){
605  AliVTrack* currTrack = dynamic_cast<AliVTrack*>(event->GetTrack(iTrack));
606  if(currTrack->GetID() == trackID){
607  TrackPos = iTrack;
608  break;
609  }
610  }
611  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));
612  }else TrackPos = trackID; // for ESD just take trackID
613 
614  Int_t matched = 0;
615  multimap<Int_t,Int_t>::iterator it;
616  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(TrackPos));
617  if(!tempTrack) return matched;
618  for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it){
619  if(it->first == TrackPos){
620  Float_t tempDEta, tempDPhi;
621  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
622  if(tempTrack->Charge()>0){
623  if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) matched++;
624  }else if(tempTrack->Charge()<0){
625  dPhiMin*=-1;
626  dPhiMax*=-1;
627  if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) matched++;
628  }
629  }
630  }
631  }
632  return matched;
633 }
634 
635 //________________________________________________________________________
636 Int_t AliCaloTrackMatcher::GetNMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi){
637  Int_t TrackPos = -1;
638  if(event->IsA()==AliAODEvent::Class()){ // for AOD, we have to look for position of track in the event
639  for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++){
640  AliVTrack* currTrack = dynamic_cast<AliVTrack*>(event->GetTrack(iTrack));
641  if(currTrack->GetID() == trackID){
642  TrackPos = iTrack;
643  break;
644  }
645  }
646  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));
647  }else TrackPos = trackID; // for ESD just take trackID
648 
649  Int_t matched = 0;
650  multimap<Int_t,Int_t>::iterator it;
651  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(TrackPos));
652  if(!tempTrack) return matched;
653  for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it){
654  if(it->first == TrackPos){
655  Float_t tempDEta, tempDPhi;
656  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
657  Bool_t match_dEta = kFALSE;
658  Bool_t match_dPhi = kFALSE;
659  if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
660  else match_dEta = kFALSE;
661 
662  if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
663  else match_dPhi = kFALSE;
664 
665  if (match_dPhi && match_dEta )matched++;
666 
667  }
668  }
669  }
670  return matched;
671 }
672 
673 //________________________________________________________________________
675  Int_t TrackPos = -1;
676  if(event->IsA()==AliAODEvent::Class()){ // for AOD, we have to look for position of track in the event
677  for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++){
678  AliVTrack* currTrack = dynamic_cast<AliVTrack*>(event->GetTrack(iTrack));
679  if(currTrack->GetID() == trackID){
680  TrackPos = iTrack;
681  break;
682  }
683  }
684  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));
685  }else TrackPos = trackID; // for ESD just take trackID
686 
687  Int_t matched = 0;
688  multimap<Int_t,Int_t>::iterator it;
689  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(TrackPos));
690  if(!tempTrack) return matched;
691  for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it){
692  if(it->first == TrackPos){
693  Float_t tempDEta, tempDPhi;
694  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
695  if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) matched++;
696  }
697  }
698  }
699  return matched;
700 }
701 
702 //________________________________________________________________________
703 vector<Int_t> AliCaloTrackMatcher::GetMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin){
704  vector<Int_t> tempMatchedTracks;
705  multimap<Int_t,Int_t>::iterator it;
706  for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it){
707  if(it->first == clusterID){
708  Float_t tempDEta, tempDPhi;
709  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(it->second));
710  if(!tempTrack) continue;
711  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
712  if(tempTrack->Charge()>0){
713  if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) tempMatchedTracks.push_back(it->second);
714  }else if(tempTrack->Charge()<0){
715  dPhiMin*=-1;
716  dPhiMax*=-1;
717  if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) tempMatchedTracks.push_back(it->second);
718  }
719  }
720  }
721  }
722  return tempMatchedTracks;
723 }
724 
725 //________________________________________________________________________
726 vector<Int_t> AliCaloTrackMatcher::GetMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi){
727  vector<Int_t> tempMatchedTracks;
728  multimap<Int_t,Int_t>::iterator it;
729  for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it){
730  if(it->first == clusterID){
731  Float_t tempDEta, tempDPhi;
732  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(it->second));
733  if(!tempTrack) continue;
734  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
735  Bool_t match_dEta = kFALSE;
736  Bool_t match_dPhi = kFALSE;
737  if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
738  else match_dEta = kFALSE;
739 
740  if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
741  else match_dPhi = kFALSE;
742 
743  if (match_dPhi && match_dEta )tempMatchedTracks.push_back(it->second);
744 
745  }
746  }
747  }
748  return tempMatchedTracks;
749 }
750 
751 //________________________________________________________________________
752 vector<Int_t> AliCaloTrackMatcher::GetMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dR){
753  vector<Int_t> tempMatchedTracks;
754  multimap<Int_t,Int_t>::iterator it;
755  for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it){
756  if(it->first == clusterID){
757  Float_t tempDEta, tempDPhi;
758  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(it->second));
759  if(!tempTrack) continue;
760  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
761  if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) tempMatchedTracks.push_back(it->second);
762  }
763  }
764  }
765  return tempMatchedTracks;
766 }
767 
768 //________________________________________________________________________
769 vector<Int_t> AliCaloTrackMatcher::GetMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin){
770  Int_t TrackPos = -1;
771  if(event->IsA()==AliAODEvent::Class()){ // for AOD, we have to look for position of track in the event
772  for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++){
773  AliVTrack* currTrack = dynamic_cast<AliVTrack*>(event->GetTrack(iTrack));
774  if(currTrack->GetID() == trackID){
775  TrackPos = iTrack;
776  break;
777  }
778  }
779  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));
780  }else TrackPos = trackID; // for ESD just take trackID
781 
782  vector<Int_t> tempMatchedClusters;
783  multimap<Int_t,Int_t>::iterator it;
784  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(TrackPos));
785  if(!tempTrack) return tempMatchedClusters;
786  for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it){
787  if(it->first == TrackPos){
788  Float_t tempDEta, tempDPhi;
789  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
790  if(tempTrack->Charge()>0){
791  if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) tempMatchedClusters.push_back(it->second);
792  }else if(tempTrack->Charge()<0){
793  dPhiMin*=-1;
794  dPhiMax*=-1;
795  if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) tempMatchedClusters.push_back(it->second);
796  }
797  }
798  }
799  }
800 
801  return tempMatchedClusters;
802 }
803 
804 //________________________________________________________________________
805 vector<Int_t> AliCaloTrackMatcher::GetMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi){
806  Int_t TrackPos = -1;
807  if(event->IsA()==AliAODEvent::Class()){ // for AOD, we have to look for position of track in the event
808  for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++){
809  AliVTrack* currTrack = dynamic_cast<AliVTrack*>(event->GetTrack(iTrack));
810  if(currTrack->GetID() == trackID){
811  TrackPos = iTrack;
812  break;
813  }
814  }
815  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));
816  }else TrackPos = trackID; // for ESD just take trackID
817 
818  vector<Int_t> tempMatchedClusters;
819  multimap<Int_t,Int_t>::iterator it;
820  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(TrackPos));
821  if(!tempTrack) return tempMatchedClusters;
822  for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it){
823  if(it->first == TrackPos){
824  Float_t tempDEta, tempDPhi;
825  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
826  Bool_t match_dEta = kFALSE;
827  Bool_t match_dPhi = kFALSE;
828  if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
829  else match_dEta = kFALSE;
830 
831  if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
832  else match_dPhi = kFALSE;
833 
834  if (match_dPhi && match_dEta )tempMatchedClusters.push_back(it->second);
835  }
836  }
837  }
838  return tempMatchedClusters;
839 }
840 
841 //________________________________________________________________________
842 vector<Int_t> AliCaloTrackMatcher::GetMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, Float_t dR){
843  Int_t TrackPos = -1;
844  if(event->IsA()==AliAODEvent::Class()){ // for AOD, we have to look for position of track in the event
845  for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++){
846  AliVTrack* currTrack = dynamic_cast<AliVTrack*>(event->GetTrack(iTrack));
847  if(currTrack->GetID() == trackID){
848  TrackPos = iTrack;
849  break;
850  }
851  }
852  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));
853  }else TrackPos = trackID; // for ESD just take trackID
854 
855  vector<Int_t> tempMatchedClusters;
856  multimap<Int_t,Int_t>::iterator it;
857  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(TrackPos));
858  if(!tempTrack) return tempMatchedClusters;
859  for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it){
860  if(it->first == TrackPos){
861  Float_t tempDEta, tempDPhi;
862  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
863  if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) tempMatchedClusters.push_back(it->second);
864  }
865  }
866  }
867  return tempMatchedClusters;
868 }
869 
870 //________________________________________________________________________
871 //________________________________________________________________________
872 //________________________________________________________________________
873 //________________________________________________________________________
874 //________________________________________________________________________
876  Int_t position = fSecMap_TrID_ClID_ToIndex[make_pair(trackID,clusterID)];
877  if(position == 0) return kFALSE;
878 
879  pairFloat tempEtaPhi = fSecVectorDeltaEtaDeltaPhi.at(position-1);
880  dEta = tempEtaPhi.first;
881  dPhi = tempEtaPhi.second;
882  return kTRUE;
883 }
884 //________________________________________________________________________
886  Int_t position = fSecMap_TrID_ClID_AlreadyTried[make_pair(trackID,clusterID)];
887  if(position == 0) return kFALSE;
888  else return kTRUE;
889 }
890 //________________________________________________________________________
891 Int_t AliCaloTrackMatcher::GetNMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin){
892  Int_t matched = 0;
893  multimap<Int_t,Int_t>::iterator it;
894  for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it){
895  if(it->first == clusterID){
896  Float_t tempDEta, tempDPhi;
897  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(it->second));
898  if(!tempTrack) continue;
899  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
900  if(tempTrack->Charge()>0){
901  if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) matched++;
902  }else if(tempTrack->Charge()<0){
903  dPhiMin*=-1;
904  dPhiMax*=-1;
905  if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) matched++;
906  }
907  }
908  }
909  }
910 
911  return matched;
912 }
913 
914 //________________________________________________________________________
915 Int_t AliCaloTrackMatcher::GetNMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t clusterID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi){
916  Int_t matched = 0;
917  multimap<Int_t,Int_t>::iterator it;
918  for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it){
919  if(it->first == clusterID){
920  Float_t tempDEta, tempDPhi;
921  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(it->second));
922  if(!tempTrack) continue;
923  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
924  Bool_t match_dEta = kFALSE;
925  Bool_t match_dPhi = kFALSE;
926  if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
927  else match_dEta = kFALSE;
928 
929  if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
930  else match_dPhi = kFALSE;
931 
932  if (match_dPhi && match_dEta )matched++;
933  }
934  }
935  }
936 
937  return matched;
938 }
939 
940 //________________________________________________________________________
942  Int_t matched = 0;
943  multimap<Int_t,Int_t>::iterator it;
944  for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it){
945  if(it->first == clusterID){
946  Float_t tempDEta, tempDPhi;
947  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(it->second));
948  if(!tempTrack) continue;
949  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
950  if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) matched++;
951  }
952  }
953  }
954 
955  return matched;
956 }
957 
958 //________________________________________________________________________
959 Int_t AliCaloTrackMatcher::GetNMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t trackID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin){
960  Int_t TrackPos = -1;
961  if(event->IsA()==AliAODEvent::Class()){ // for AOD, we have to look for position of track in the event
962  for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++){
963  AliVTrack* currTrack = dynamic_cast<AliVTrack*>(event->GetTrack(iTrack));
964  if(currTrack->GetID() == trackID){
965  TrackPos = iTrack;
966  break;
967  }
968  }
969  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));
970  }else TrackPos = trackID; // for ESD just take trackID
971 
972  Int_t matched = 0;
973  multimap<Int_t,Int_t>::iterator it;
974  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(TrackPos));
975  if(!tempTrack) return matched;
976  for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it){
977  if(it->first == TrackPos){
978  Float_t tempDEta, tempDPhi;
979  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
980  if(tempTrack->Charge()>0){
981  if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) matched++;
982  }else if(tempTrack->Charge()<0){
983  dPhiMin*=-1;
984  dPhiMax*=-1;
985  if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) matched++;
986  }
987  }
988  }
989  }
990 
991  return matched;
992 }
993 
994 //________________________________________________________________________
995 Int_t AliCaloTrackMatcher::GetNMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t trackID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi){
996  Int_t TrackPos = -1;
997  if(event->IsA()==AliAODEvent::Class()){ // for AOD, we have to look for position of track in the event
998  for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++){
999  AliVTrack* currTrack = dynamic_cast<AliVTrack*>(event->GetTrack(iTrack));
1000  if(currTrack->GetID() == trackID){
1001  TrackPos = iTrack;
1002  break;
1003  }
1004  }
1005  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));
1006  }else TrackPos = trackID; // for ESD just take trackID
1007 
1008  Int_t matched = 0;
1009  multimap<Int_t,Int_t>::iterator it;
1010  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(TrackPos));
1011  if(!tempTrack) return matched;
1012  for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it){
1013  if(it->first == TrackPos){
1014  Float_t tempDEta, tempDPhi;
1015  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1016  Bool_t match_dEta = kFALSE;
1017  Bool_t match_dPhi = kFALSE;
1018  if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
1019  else match_dEta = kFALSE;
1020 
1021  if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
1022  else match_dPhi = kFALSE;
1023 
1024  if (match_dPhi && match_dEta )matched++;
1025 
1026  }
1027  }
1028  }
1029 
1030  return matched;
1031 }
1032 
1033 //________________________________________________________________________
1035  Int_t TrackPos = -1;
1036  if(event->IsA()==AliAODEvent::Class()){ // for AOD, we have to look for position of track in the event
1037  for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++){
1038  AliVTrack* currTrack = dynamic_cast<AliVTrack*>(event->GetTrack(iTrack));
1039  if(currTrack->GetID() == trackID){
1040  TrackPos = iTrack;
1041  break;
1042  }
1043  }
1044  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));
1045  }else TrackPos = trackID; // for ESD just take trackID
1046 
1047  Int_t matched = 0;
1048  multimap<Int_t,Int_t>::iterator it;
1049  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(TrackPos));
1050  if(!tempTrack) return matched;
1051  for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it){
1052  if(it->first == TrackPos){
1053  Float_t tempDEta, tempDPhi;
1054  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1055  if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) matched++;
1056  }
1057  }
1058  }
1059 
1060  return matched;
1061 }
1062 
1063 //________________________________________________________________________
1064 vector<Int_t> AliCaloTrackMatcher::GetMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin){
1065  vector<Int_t> tempMatchedTracks;
1066  multimap<Int_t,Int_t>::iterator it;
1067  for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it){
1068  if(it->first == clusterID){
1069  Float_t tempDEta, tempDPhi;
1070  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(it->second));
1071  if(!tempTrack) continue;
1072  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
1073  if(tempTrack->Charge()>0){
1074  if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) tempMatchedTracks.push_back(it->second);
1075  }else if(tempTrack->Charge()<0){
1076  dPhiMin*=-1;
1077  dPhiMax*=-1;
1078  if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) tempMatchedTracks.push_back(it->second);
1079  }
1080  }
1081  }
1082  }
1083 
1084  return tempMatchedTracks;
1085 }
1086 
1087 //________________________________________________________________________
1088 vector<Int_t> AliCaloTrackMatcher::GetMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t clusterID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi){
1089  vector<Int_t> tempMatchedTracks;
1090  multimap<Int_t,Int_t>::iterator it;
1091  for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it){
1092  if(it->first == clusterID){
1093  Float_t tempDEta, tempDPhi;
1094  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(it->second));
1095  if(!tempTrack) continue;
1096  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
1097  Bool_t match_dEta = kFALSE;
1098  Bool_t match_dPhi = kFALSE;
1099  if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
1100  else match_dEta = kFALSE;
1101 
1102  if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
1103  else match_dPhi = kFALSE;
1104 
1105  if (match_dPhi && match_dEta )tempMatchedTracks.push_back(it->second);
1106  }
1107  }
1108  }
1109 
1110  return tempMatchedTracks;
1111 }
1112 
1113 //________________________________________________________________________
1114 vector<Int_t> AliCaloTrackMatcher::GetMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dR){
1115  vector<Int_t> tempMatchedTracks;
1116  multimap<Int_t,Int_t>::iterator it;
1117  for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it){
1118  if(it->first == clusterID){
1119  Float_t tempDEta, tempDPhi;
1120  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(it->second));
1121  if(!tempTrack) continue;
1122  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->first,tempDEta,tempDPhi)){
1123  if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) tempMatchedTracks.push_back(it->second);
1124  }
1125  }
1126  }
1127 
1128  return tempMatchedTracks;
1129 }
1130 
1131 //________________________________________________________________________
1132 vector<Int_t> AliCaloTrackMatcher::GetMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t trackID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin){
1133  Int_t TrackPos = -1;
1134  if(event->IsA()==AliAODEvent::Class()){ // for AOD, we have to look for position of track in the event
1135  for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++){
1136  AliVTrack* currTrack = dynamic_cast<AliVTrack*>(event->GetTrack(iTrack));
1137  if(currTrack->GetID() == trackID){
1138  TrackPos = iTrack;
1139  break;
1140  }
1141  }
1142  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));
1143  }else TrackPos = trackID; // for ESD just take trackID
1144 
1145  vector<Int_t> tempMatchedClusters;
1146  multimap<Int_t,Int_t>::iterator it;
1147  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(TrackPos));
1148  if(!tempTrack) return tempMatchedClusters;
1149  for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it){
1150  if(it->first == TrackPos){
1151  Float_t tempDEta, tempDPhi;
1152  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1153  if(tempTrack->Charge()>0){
1154  if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin < tempDPhi) && (tempDPhi < dPhiMax) ) tempMatchedClusters.push_back(it->second);
1155  }else if(tempTrack->Charge()<0){
1156  dPhiMin*=-1;
1157  dPhiMax*=-1;
1158  if( (dEtaMin < tempDEta) && (tempDEta < dEtaMax) && (dPhiMin > tempDPhi) && (tempDPhi > dPhiMax) ) tempMatchedClusters.push_back(it->second);
1159  }
1160  }
1161  }
1162  }
1163 
1164  return tempMatchedClusters;
1165 }
1166 
1167 //________________________________________________________________________
1168 vector<Int_t> AliCaloTrackMatcher::GetMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t trackID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi){
1169  Int_t TrackPos = -1;
1170  if(event->IsA()==AliAODEvent::Class()){ // for AOD, we have to look for position of track in the event
1171  for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++){
1172  AliVTrack* currTrack = dynamic_cast<AliVTrack*>(event->GetTrack(iTrack));
1173  if(currTrack->GetID() == trackID){
1174  TrackPos = iTrack;
1175  break;
1176  }
1177  }
1178  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));
1179  }else TrackPos = trackID; // for ESD just take trackID
1180 
1181  vector<Int_t> tempMatchedClusters;
1182  multimap<Int_t,Int_t>::iterator it;
1183  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(TrackPos));
1184  if(!tempTrack) return tempMatchedClusters;
1185  for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it){
1186  if(it->first == TrackPos){
1187  Float_t tempDEta, tempDPhi;
1188  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1189  Bool_t match_dEta = kFALSE;
1190  Bool_t match_dPhi = kFALSE;
1191  if( TMath::Abs(tempDEta) < fFuncPtDepEta->Eval(tempTrack->Pt())) match_dEta = kTRUE;
1192  else match_dEta = kFALSE;
1193 
1194  if( TMath::Abs(tempDPhi) < fFuncPtDepPhi->Eval(tempTrack->Pt())) match_dPhi = kTRUE;
1195  else match_dPhi = kFALSE;
1196 
1197  if (match_dPhi && match_dEta )tempMatchedClusters.push_back(it->second);
1198  }
1199  }
1200  }
1201 
1202  return tempMatchedClusters;
1203 }
1204 
1205 //________________________________________________________________________
1206 vector<Int_t> AliCaloTrackMatcher::GetMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t trackID, Float_t dR){
1207  Int_t TrackPos = -1;
1208  if(event->IsA()==AliAODEvent::Class()){ // for AOD, we have to look for position of track in the event
1209  for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++){
1210  AliVTrack* currTrack = dynamic_cast<AliVTrack*>(event->GetTrack(iTrack));
1211  if(currTrack->GetID() == trackID){
1212  TrackPos = iTrack;
1213  break;
1214  }
1215  }
1216  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));
1217  }else TrackPos = trackID; // for ESD just take trackID
1218 
1219  vector<Int_t> tempMatchedClusters;
1220  multimap<Int_t,Int_t>::iterator it;
1221  AliVTrack* tempTrack = dynamic_cast<AliVTrack*>(event->GetTrack(TrackPos));
1222  if(!tempTrack) return tempMatchedClusters;
1223  for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it){
1224  if(it->first == TrackPos){
1225  Float_t tempDEta, tempDPhi;
1226  if(GetTrackClusterMatchingResidual(tempTrack->GetID(),it->second,tempDEta,tempDPhi)){
1227  if (TMath::Sqrt(tempDEta*tempDEta + tempDPhi*tempDPhi) < dR ) tempMatchedClusters.push_back(it->second);
1228  }
1229  }
1230  }
1231 
1232  return tempMatchedClusters;
1233 }
1234 
1235 //________________________________________________________________________
1237  Float_t sumTrackEt = 0.;
1238  vector<Int_t> labelsMatched = GetMatchedTrackIDsForCluster(event, clusterID, dR);
1239  if((Int_t) labelsMatched.size()<1) return sumTrackEt;
1240 
1241  TLorentzVector vecTrack;
1242  for (Int_t i = 0; i < (Int_t)labelsMatched.size(); i++){
1243  AliVTrack* currTrack = dynamic_cast<AliVTrack*>(event->GetTrack(labelsMatched.at(i)));
1244  if(!currTrack) continue;
1245  vecTrack.SetPxPyPzE(currTrack->Px(),currTrack->Py(),currTrack->Pz(),currTrack->E());
1246  sumTrackEt += vecTrack.Et();
1247  }
1248 
1249  return sumTrackEt;
1250 }
1251 
1252 //________________________________________________________________________
1254  TAxis *axisafter = histoRebin->GetYaxis();
1255  Int_t bins = axisafter->GetNbins();
1256  Double_t from = axisafter->GetXmin();
1257  Double_t to = axisafter->GetXmax();
1258  Double_t *newbins = new Double_t[bins+1];
1259  newbins[0] = from;
1260  Double_t factor = TMath::Power(to/from, 1./bins);
1261  for(Int_t i=1; i<=bins; ++i) newbins[i] = factor * newbins[i-1];
1262  axisafter->Set(bins, newbins);
1263  delete [] newbins;
1264  return;
1265 }
1266 
1267 //________________________________________________________________________
1269  if(fSecVectorDeltaEtaDeltaPhi.size()>0){
1270  cout << "******************************" << endl;
1271  cout << "******************************" << endl;
1272  cout << "NEW EVENT !" << endl;
1273  cout << "vector etaphi:" << endl;
1274  cout << fSecVectorDeltaEtaDeltaPhi.size() << endl;
1275  cout << "multimap" << endl;
1276  mapT::iterator iter = fSecMap_TrID_ClID_ToIndex.begin();
1277  for (iter = fSecMap_TrID_ClID_ToIndex.begin(); iter != fSecMap_TrID_ClID_ToIndex.end(); ++iter){
1278  Float_t dEta, dPhi = 0;
1279  if(!GetSecTrackClusterMatchingResidual(iter->first.first,iter->first.second,dEta,dPhi)) continue;
1280  cout << " [" << iter->first.first << "/" << iter->first.second << ", " << iter->second << "] - (" << dEta << "/" << dPhi << ")" << endl;
1281  }
1282  cout << "mapTrackToCluster" << endl;
1283  AliESDEvent *esdev = dynamic_cast<AliESDEvent*>(fInputEvent);
1284  for (Int_t itr=0;itr<esdev->GetNumberOfTracks();itr++){
1285  AliVTrack *inTrack = esdev->GetTrack(itr);
1286  if(!inTrack) continue;
1287  TString tCharge;
1288  if(inTrack->Charge()>0) tCharge = "+";
1289  else if(inTrack->Charge()<0) tCharge = "-";
1290  cout << itr << " (" << tCharge << ") - " << GetNMatchedClusterIDsForSecTrack(fInputEvent,inTrack->GetID(),5,-5,0.2,-0.4) << "\t\t";
1291  }
1292  cout << endl;
1293  multimap<Int_t,Int_t>::iterator it;
1294  for (it=fSecMapTrackToCluster.begin(); it!=fSecMapTrackToCluster.end(); ++it) cout << it->first << " => " << it->second << '\n';
1295  cout << "mapClusterToTrack" << endl;
1296  Int_t tempClus = it->second;
1297  for (it=fSecMapClusterToTrack.begin(); it!=fSecMapClusterToTrack.end(); ++it) cout << it->first << " => " << it->second << '\n';
1298  vector<Int_t> tempTracks = GetMatchedSecTrackIDsForCluster(fInputEvent,tempClus, 5, -5, 0.2, -0.4);
1299  for(Int_t iJ=0; iJ<tempTracks.size();iJ++){
1300  cout << tempClus << " - " << tempTracks.at(iJ) << endl;
1301  }
1302  }
1303  return;
1304 }
1305 
1306 //________________________________________________________________________
1308  if(fVectorDeltaEtaDeltaPhi.size()>0){
1309  cout << "******************************" << endl;
1310  cout << "******************************" << endl;
1311  cout << "NEW EVENT !" << endl;
1312  cout << "vector etaphi:" << endl;
1313  cout << fVectorDeltaEtaDeltaPhi.size() << endl;
1314  cout << "multimap" << endl;
1315  mapT::iterator iter = fMap_TrID_ClID_ToIndex.begin();
1316  for (iter = fMap_TrID_ClID_ToIndex.begin(); iter != fMap_TrID_ClID_ToIndex.end(); ++iter){
1317  Float_t dEta, dPhi = 0;
1318  if(!GetTrackClusterMatchingResidual(iter->first.first,iter->first.second,dEta,dPhi)) continue;
1319  cout << " [" << iter->first.first << "/" << iter->first.second << ", " << iter->second << "] - (" << dEta << "/" << dPhi << ")" << endl;
1320  }
1321  cout << "mapTrackToCluster" << endl;
1322  AliESDEvent *esdev = dynamic_cast<AliESDEvent*>(fInputEvent);
1323  for (Int_t itr=0;itr<esdev->GetNumberOfTracks();itr++){
1324  AliVTrack *inTrack = esdev->GetTrack(itr);
1325  if(!inTrack) continue;
1326  TString tCharge;
1327  if(inTrack->Charge()>0) tCharge = "+";
1328  else if(inTrack->Charge()<0) tCharge = "-";
1329  cout << itr << " (" << tCharge << ") - " << GetNMatchedClusterIDsForTrack(fInputEvent,inTrack->GetID(),5,-5,0.2,-0.4) << "\t\t";
1330  }
1331  cout << endl;
1332  multimap<Int_t,Int_t>::iterator it;
1333  for (it=fMapTrackToCluster.begin(); it!=fMapTrackToCluster.end(); ++it) cout << it->first << " => " << it->second << '\n';
1334  cout << "mapClusterToTrack" << endl;
1335  Int_t tempClus = it->second;
1336  for (it=fMapClusterToTrack.begin(); it!=fMapClusterToTrack.end(); ++it) cout << it->first << " => " << it->second << '\n';
1337  vector<Int_t> tempTracks = GetMatchedTrackIDsForCluster(fInputEvent,tempClus, 5, -5, 0.2, -0.4);
1338  for(Int_t iJ=0; iJ<tempTracks.size();iJ++){
1339  cout << tempClus << " - " << tempTracks.at(iJ) << endl;
1340  }
1341  }
1342  return;
1343 }
double Double_t
Definition: External.C:58
Definition: External.C:236
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)
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
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)
Definition: External.C:220
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)
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
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)