AliPhysics  a4b41ad (a4b41ad)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliCaloTrackESDReader.cxx
Go to the documentation of this file.
1 
2 /**************************************************************************
3  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * *
5  * Author: The ALICE Off-line Project. *
6  * Contributors are mentioned in the code where appropriate. *
7  * *
8  * Permission to use, copy, modify and distribute this software and its *
9  * documentation strictly for non-commercial purposes is hereby granted *
10  * without fee, provided that the above copyright notice appears in all *
11  * copies and that both the copyright notice and this permission notice *
12  * appear in the supporting documentation. The authors make no claims *
13  * about the suitability of this software for any purpose. It is *
14  * provided "as is" without express or implied warranty. *
15  **************************************************************************/
16 
17 //---- ANALYSIS system ----
18 #include "AliCaloTrackESDReader.h"
19 #include "AliAODEvent.h"
20 #include "AliMultiEventInputHandler.h"
21 #include "AliAnalysisManager.h"
22 #include "AliMixedEvent.h"
23 #include "AliESDEvent.h"
24 #include "AliESDtrackCuts.h"
25 #include "AliLog.h"
26 
30 
31 //______________________________________________
33 //______________________________________________
35 AliCaloTrackReader(), fConstrainTrack(0),
36 fESDtrackCuts(0), fESDtrackComplementaryCuts(0)
37 {
38  fDataType = kESD;
39  fReadStack = kTRUE;
40  fReadAODMCParticles = kFALSE;
41  fConstrainTrack = kFALSE ; // constrain tracks to vertex
42 }
43 
44 //_____________________________________________
46 //_____________________________________________
48 {
50 
51  delete fESDtrackCuts;
53 }
54 
55 //_________________________________________________________
58 //_________________________________________________________
60 {
61  AliESDEvent * esdevent = dynamic_cast<AliESDEvent*> (fInputEvent);
62  if(!esdevent) return kFALSE;
63 
64  if(esdevent->GetPrimaryVertex()->GetNContributors() > 0)
65  {
66  return kTRUE;
67  }
68 
69  if(esdevent->GetPrimaryVertex()->GetNContributors() < 1)
70  {
71  // SPD vertex
72  if(esdevent->GetPrimaryVertexSPD()->GetNContributors() > 0)
73  {
74  return kTRUE;
75 
76  }
77  if(esdevent->GetPrimaryVertexSPD()->GetNContributors() < 1)
78  {
79  return kFALSE;
80  }
81  }
82 
83  return kFALSE;
84 }
85 
86 //________________________________
88 //________________________________
90 {
92 
93  if(!fESDtrackCuts)
94  fESDtrackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); //initialize with TPC only tracks
95 }
96 
97 //______________________________________________________________________________
100 //______________________________________________________________________________
102 {
103  AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (track);
104 
105  if(!esdTrack) return kFALSE;
106 
107  const AliExternalTrackParam* constrainParam = esdTrack->GetConstrainedParam();
108 
109  if(fESDtrackCuts->AcceptTrack(esdTrack))
110  {
111  track->GetPxPyPz(pTrack) ;
112 
113  if(fConstrainTrack)
114  {
115  if( !constrainParam ) return kFALSE;
116 
117  esdTrack->Set(constrainParam->GetX(),constrainParam->GetAlpha(),constrainParam->GetParameter(),constrainParam->GetCovariance());
118  esdTrack->GetConstrainedPxPyPz(pTrack);
119 
120  } // use constrained tracks
121 
122  if(fSelectSPDHitTracks && !esdTrack->HasPointOnITSLayer(0) && !esdTrack->HasPointOnITSLayer(1))
123  return kFALSE ; // Not much sense to use with TPC only or Hybrid tracks
124  }
125 
126  // Complementary track to global : Hybrids (make sure that the previous selection is for Global)
127  else if(fESDtrackComplementaryCuts && fESDtrackComplementaryCuts->AcceptTrack(esdTrack))
128  {
129  // constrain the track
130  if( !constrainParam ) return kFALSE;
131 
132  esdTrack->Set(constrainParam->GetX(),constrainParam->GetAlpha(),constrainParam->GetParameter(),constrainParam->GetCovariance());
133  esdTrack->GetConstrainedPxPyPz(pTrack);
134 
135  }
136  else return kFALSE;
137 
138  return kTRUE;
139 }
140 
141 //_______________________________________________________________
143 //_______________________________________________________________
144 void AliCaloTrackESDReader::SetTrackCuts(AliESDtrackCuts * cuts)
145 {
146  if(fESDtrackCuts) delete fESDtrackCuts ;
147 
148  fESDtrackCuts = cuts ;
149 }
150 
151 //____________________________________________________________________________
153 //____________________________________________________________________________
155 {
157 
159 }
160 
161 //_________________________________________________________________
163 //_________________________________________________________________
165  AliAODEvent* aod,
166  AliMCEvent* mc)
167 {
168  Bool_t tesd = kFALSE ;
169 
170  if ( strcmp(esd->GetName(), "AliMixedEvent") == 0 )
171  {
172  AliMultiEventInputHandler* multiEH = dynamic_cast<AliMultiEventInputHandler*>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
173  if(multiEH)
174  {
175  if (multiEH->GetFormat() == 0 )
176  {
177  tesd = kTRUE ;
178  }
179  }
180  else
181  {
182  AliFatal("MultiEventHandler is NULL");
183  return;
184  }
185  }
186  if (strcmp(esd->GetName(),"AliESDEvent") == 0)
187  {
188  tesd = kTRUE ;
189  }
190 
191  if(!tesd)
192  {
193  AliFatal(Form("STOP ::Wrong reader, here only ESDs. Input name: %s != AliESDEvent",esd->GetName()));
194  }
195 
196  SetInputEvent(esd);
197  SetOutputEvent(aod);
198  SetMC(mc);
199 }
200 
201 
202 
AliESDtrackCuts * fESDtrackCuts
Track cut machinery.
Bool_t fConstrainTrack
Constrain Track to vertex.
Bool_t fReadAODMCParticles
Access kine information from filtered AOD MC particles.
double Double_t
Definition: External.C:58
virtual void SetMC(AliMCEvent *const mc)
AliVEvent * fInputEvent
! pointer to esd or aod input.
virtual void SetInputEvent(AliVEvent *input)
void SetTrackCuts(AliESDtrackCuts *cuts)
Set Track cuts.
void SetInputOutputMCEvent(AliVEvent *esd, AliAODEvent *aod, AliMCEvent *mc)
Connect the data pointers.
Bool_t fSelectSPDHitTracks
Ensure that track hits SPD layers.
void SetTrackComplementaryCuts(AliESDtrackCuts *cuts)
Set Track cuts for complementary tracks (hybrids).
virtual void SetOutputEvent(AliAODEvent *aod)
Base class for event, clusters and tracks filtering and preparation for the analysis.
Class for event, clusters and tracks filtering and preparation for the ESD analysis.
void Init()
Init reader. Method to be called in AliAnaCaloTrackCorrMaker.
Bool_t SelectTrack(AliVTrack *track, Double_t *pTrack)
virtual ~AliCaloTrackESDReader()
Default destructor.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
AliCaloTrackESDReader()
Default constructor. Initialize parameters.
Bool_t fReadStack
Access kine information from stack.
AliESDtrackCuts * fESDtrackComplementaryCuts
Track cut machinery for complementary cuts for hybrids.
bool Bool_t
Definition: External.C:53
Int_t fDataType
Select MC: Kinematics, Data: ESD/AOD, MCData: Both.
Bool_t CheckForPrimaryVertex() const