]>
Commit | Line | Data |
---|---|---|
1c5acb87 | 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 | **************************************************************************/ | |
1c5acb87 | 16 | |
17 | //_________________________________________________________________________ | |
18 | // Class for reading data (ESDs) in order to do prompt gamma | |
19 | // or other particle identification and correlations | |
20 | // | |
0ae57829 | 21 | // |
591cc579 | 22 | // |
23 | // | |
1c5acb87 | 24 | //*-- Author: Gustavo Conesa (LNF-INFN) |
25 | ////////////////////////////////////////////////////////////////////////////// | |
26 | ||
27 | ||
1c5acb87 | 28 | //---- ANALYSIS system ---- |
29 | #include "AliCaloTrackESDReader.h" | |
1c5acb87 | 30 | #include "AliAODEvent.h" |
c8fe2783 | 31 | #include "AliMultiEventInputHandler.h" |
32 | #include "AliAnalysisManager.h" | |
c8fe2783 | 33 | #include "AliMixedEvent.h" |
f3138ecf | 34 | #include "AliESDEvent.h" |
72ccdf15 | 35 | #include "AliESDtrackCuts.h" |
1c5acb87 | 36 | |
37 | ClassImp(AliCaloTrackESDReader) | |
38 | ||
43074325 | 39 | //______________________________________________ |
1c5acb87 | 40 | AliCaloTrackESDReader::AliCaloTrackESDReader() : |
72ccdf15 | 41 | AliCaloTrackReader(), fConstrainTrack(0), |
42 | fESDtrackCuts(0), fESDtrackComplementaryCuts(0) | |
1c5acb87 | 43 | { |
78219bac | 44 | //Default Ctor |
45 | ||
46 | //Initialize parameters | |
72ccdf15 | 47 | fDataType = kESD; |
78219bac | 48 | fReadStack = kTRUE; |
49 | fReadAODMCParticles = kFALSE; | |
72ccdf15 | 50 | fConstrainTrack = kFALSE ; // constrain tracks to vertex |
1c5acb87 | 51 | |
0ae57829 | 52 | } |
1c5acb87 | 53 | |
72ccdf15 | 54 | //_____________________________________________ |
55 | AliCaloTrackESDReader::~AliCaloTrackESDReader() | |
56 | { | |
57 | //Dtor | |
58 | ||
7321d326 | 59 | //AliCaloTrackReader::~AliCaloTrackReader(); |
60 | AliCaloTrackReader::DeletePointers(); | |
72ccdf15 | 61 | |
62 | delete fESDtrackCuts; | |
63 | delete fESDtrackComplementaryCuts; | |
64 | } | |
65 | ||
4e66a438 | 66 | //_________________________________________________________ |
67 | Bool_t AliCaloTrackESDReader::CheckForPrimaryVertex() const | |
68 | { | |
69 | //Check if the vertex was well reconstructed, copy of conversion group | |
70 | ||
71 | AliESDEvent * esdevent = dynamic_cast<AliESDEvent*> (fInputEvent); | |
72 | if(!esdevent) return kFALSE; | |
73 | ||
74 | if(esdevent->GetPrimaryVertex()->GetNContributors() > 0) | |
75 | { | |
76 | return kTRUE; | |
77 | } | |
78 | ||
79 | if(esdevent->GetPrimaryVertex()->GetNContributors() < 1) | |
80 | { | |
81 | // SPD vertex | |
82 | if(esdevent->GetPrimaryVertexSPD()->GetNContributors() > 0) | |
83 | { | |
84 | return kTRUE; | |
85 | ||
86 | } | |
87 | if(esdevent->GetPrimaryVertexSPD()->GetNContributors() < 1) | |
88 | { | |
89 | return kFALSE; | |
90 | } | |
91 | } | |
92 | ||
93 | return kFALSE; | |
94 | ||
95 | } | |
96 | ||
72ccdf15 | 97 | //________________________________ |
98 | void AliCaloTrackESDReader::Init() | |
99 | { | |
100 | //Init reader. Method to be called in AliAnaCaloTrackCorrMaker | |
101 | ||
102 | AliCaloTrackReader::Init(); | |
103 | ||
104 | if(!fESDtrackCuts) | |
105 | fESDtrackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); //initialize with TPC only tracks | |
106 | } | |
107 | ||
4e66a438 | 108 | //______________________________________________________________________________ |
72ccdf15 | 109 | Bool_t AliCaloTrackESDReader::SelectTrack(AliVTrack* track, Double_t pTrack[3]) |
110 | { | |
111 | // Select ESD track using the cuts declared in fESDtrackCuts | |
112 | // in case of hybrid tracks, 2 different sets of cuts defined. | |
113 | ||
114 | AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (track); | |
115 | ||
116 | if(!esdTrack) return kFALSE; | |
117 | ||
118 | const AliExternalTrackParam* constrainParam = esdTrack->GetConstrainedParam(); | |
119 | ||
120 | if(fESDtrackCuts->AcceptTrack(esdTrack)) | |
121 | { | |
122 | track->GetPxPyPz(pTrack) ; | |
123 | ||
124 | if(fConstrainTrack) | |
125 | { | |
126 | if( !constrainParam ) return kFALSE; | |
127 | ||
128 | esdTrack->Set(constrainParam->GetX(),constrainParam->GetAlpha(),constrainParam->GetParameter(),constrainParam->GetCovariance()); | |
129 | esdTrack->GetConstrainedPxPyPz(pTrack); | |
130 | ||
131 | } // use constrained tracks | |
132 | ||
133 | if(fSelectSPDHitTracks && !esdTrack->HasPointOnITSLayer(0) && !esdTrack->HasPointOnITSLayer(1)) | |
134 | return kFALSE ; // Not much sense to use with TPC only or Hybrid tracks | |
135 | } | |
136 | ||
137 | // Complementary track to global : Hybrids (make sure that the previous selection is for Global) | |
138 | else if(fESDtrackComplementaryCuts && fESDtrackComplementaryCuts->AcceptTrack(esdTrack)) | |
139 | { | |
140 | // constrain the track | |
141 | if( !constrainParam ) return kFALSE; | |
142 | ||
143 | esdTrack->Set(constrainParam->GetX(),constrainParam->GetAlpha(),constrainParam->GetParameter(),constrainParam->GetCovariance()); | |
144 | esdTrack->GetConstrainedPxPyPz(pTrack); | |
145 | ||
146 | } | |
147 | else return kFALSE; | |
148 | ||
149 | return kTRUE; | |
150 | } | |
151 | ||
152 | //_______________________________________________________________ | |
153 | void AliCaloTrackESDReader::SetTrackCuts(AliESDtrackCuts * cuts) | |
154 | { | |
155 | // Set Track cuts | |
156 | ||
157 | if(fESDtrackCuts) delete fESDtrackCuts ; | |
158 | ||
159 | fESDtrackCuts = cuts ; | |
160 | ||
161 | } | |
162 | ||
163 | //____________________________________________________________________________ | |
164 | void AliCaloTrackESDReader::SetTrackComplementaryCuts(AliESDtrackCuts * cuts) | |
165 | { | |
166 | // Set Track cuts for complementary tracks (hybrids) | |
167 | ||
168 | if(fESDtrackComplementaryCuts) delete fESDtrackComplementaryCuts ; | |
169 | ||
170 | fESDtrackComplementaryCuts = cuts ; | |
171 | ||
172 | } | |
173 | ||
43074325 | 174 | //_________________________________________________________________ |
72ccdf15 | 175 | void AliCaloTrackESDReader::SetInputOutputMCEvent(AliVEvent* esd, |
176 | AliAODEvent* aod, | |
43074325 | 177 | AliMCEvent* mc) |
178 | { | |
477d6cee | 179 | // Connect the data pointers |
180 | ||
c8fe2783 | 181 | Bool_t tesd = kFALSE ; |
43074325 | 182 | |
0de1814a | 183 | if ( strcmp(esd->GetName(), "AliMixedEvent") == 0 ) |
184 | { | |
c8fe2783 | 185 | AliMultiEventInputHandler* multiEH = dynamic_cast<AliMultiEventInputHandler*>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler()); |
0de1814a | 186 | if(multiEH) |
187 | { | |
188 | if (multiEH->GetFormat() == 0 ) | |
189 | { | |
898c9d44 | 190 | tesd = kTRUE ; |
191 | } | |
192 | } | |
0de1814a | 193 | else |
194 | { | |
898c9d44 | 195 | printf("AliCaloTrackESDReader::SetInputOutputMCEvent() - MultiEventHandler is NULL"); |
196 | abort(); | |
c8fe2783 | 197 | } |
198 | } | |
0de1814a | 199 | if (strcmp(esd->GetName(),"AliESDEvent") == 0) |
200 | { | |
c8fe2783 | 201 | tesd = kTRUE ; |
202 | } | |
203 | ||
0de1814a | 204 | if(!tesd) |
205 | { | |
c8fe2783 | 206 | AliFatal(Form("AliCaloTrackESDReader::SetInputOutputMCEvent() - STOP ::Wrong reader, here only ESDs. Input name: %s != AliESDEvent \n",esd->GetName())); |
477d6cee | 207 | } |
208 | ||
209 | SetInputEvent(esd); | |
210 | SetOutputEvent(aod); | |
211 | SetMC(mc); | |
212 | ||
1c5acb87 | 213 | } |
43074325 | 214 | |
215 | ||
216 |