]>
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 (AODs) in order to do prompt gamma | |
591cc579 | 19 | // or other particle identification and correlations. |
1e68a3f4 | 20 | // This part is commented: Mixing analysis can be done, input AOD with events |
591cc579 | 21 | // is opened in the AliCaloTrackReader::Init() |
1c5acb87 | 22 | // |
23 | // | |
24 | //*-- Author: Gustavo Conesa (LNF-INFN) | |
25 | ////////////////////////////////////////////////////////////////////////////// | |
26 | ||
1c5acb87 | 27 | //---- ANALYSIS system ---- |
28 | #include "AliCaloTrackAODReader.h" | |
8a587055 | 29 | #include "AliAODInputHandler.h" |
c8fe2783 | 30 | #include "AliMultiEventInputHandler.h" |
8a587055 | 31 | #include "AliAnalysisManager.h" |
c8fe2783 | 32 | #include "AliMixedEvent.h" |
f3138ecf | 33 | #include "AliAODEvent.h" |
1c5acb87 | 34 | |
35 | ClassImp(AliCaloTrackAODReader) | |
36 | ||
37 | //____________________________________________________________________________ | |
38 | AliCaloTrackAODReader::AliCaloTrackAODReader() : | |
72ccdf15 | 39 | AliCaloTrackReader(), fOrgInputEvent(0x0), |
40 | fSelectHybridTracks(0), fSelectPrimaryTracks(0), | |
41 | fTrackFilterMask(0), fTrackFilterMaskComplementary(0), | |
42 | fSelectFractionTPCSharedClusters(0), fCutTPCSharedClustersFraction(0) | |
1c5acb87 | 43 | { |
44 | //Default Ctor | |
45 | ||
46 | //Initialize parameters | |
72ccdf15 | 47 | fDataType = kAOD; |
48 | ||
591cc579 | 49 | fReadStack = kTRUE; |
50 | fReadAODMCParticles = kFALSE; | |
0ae57829 | 51 | |
72ccdf15 | 52 | fTrackFilterMask = 128; |
53 | fTrackFilterMaskComplementary = 0; // in case of hybrid tracks, without using the standard method | |
54 | ||
55 | fSelectFractionTPCSharedClusters = kTRUE; | |
56 | fCutTPCSharedClustersFraction = 0.4; | |
57 | ||
1c5acb87 | 58 | } |
1c5acb87 | 59 | |
4e66a438 | 60 | //_________________________________________________________ |
61 | Bool_t AliCaloTrackAODReader::CheckForPrimaryVertex() const | |
62 | { | |
63 | //Check if the vertex was well reconstructed, copy of conversion group | |
64 | ||
65 | AliAODEvent * aodevent = dynamic_cast<AliAODEvent*>(fInputEvent); | |
66 | if(!aodevent) return kFALSE; | |
67 | ||
68 | if (aodevent->GetPrimaryVertex() != NULL) | |
69 | { | |
70 | if(aodevent->GetPrimaryVertex()->GetNContributors() > 0) | |
71 | { | |
72 | return kTRUE; | |
73 | } | |
74 | } | |
75 | ||
76 | if(aodevent->GetPrimaryVertexSPD() != NULL) | |
77 | { | |
78 | if(aodevent->GetPrimaryVertexSPD()->GetNContributors() > 0) | |
79 | { | |
80 | return kTRUE; | |
81 | } | |
82 | else | |
83 | { | |
84 | AliWarning(Form("Number of contributors from bad vertex type:: %s", | |
85 | aodevent->GetPrimaryVertex()->GetName())); | |
86 | return kFALSE; | |
87 | } | |
88 | } | |
89 | ||
90 | return kFALSE; | |
91 | ||
92 | } | |
93 | ||
7321d326 | 94 | //____________________________________________________________ |
95 | TClonesArray* AliCaloTrackAODReader::GetAODMCParticles() const | |
96 | { | |
97 | //Return list of particles in AOD. Do it for the corresponding input event. | |
98 | ||
99 | TClonesArray * particles = NULL ; | |
100 | ||
101 | AliAODEvent * aod = dynamic_cast<AliAODEvent*> (fInputEvent) ; | |
102 | if(aod) particles = (TClonesArray*) aod->FindListObject("mcparticles"); | |
103 | ||
104 | return particles ; | |
105 | } | |
106 | ||
107 | //___________________________________________________________ | |
108 | AliAODMCHeader* AliCaloTrackAODReader::GetAODMCHeader() const | |
109 | { | |
110 | //Return MC header in AOD. Do it for the corresponding input event. | |
111 | ||
112 | AliAODMCHeader *mch = NULL; | |
113 | ||
114 | AliAODEvent * aod = dynamic_cast<AliAODEvent*> (fInputEvent); | |
115 | if(aod) mch = dynamic_cast<AliAODMCHeader*>(aod->FindListObject("mcHeader")); | |
116 | ||
117 | return mch; | |
118 | } | |
119 | ||
120 | ||
72ccdf15 | 121 | //_____________________________________________________________________________ |
122 | Bool_t AliCaloTrackAODReader::SelectTrack(AliVTrack* track, Double_t pTrack[3]) | |
123 | { | |
124 | // Select AOD track using the AOD filter bits | |
125 | ||
126 | AliAODTrack *aodtrack = dynamic_cast <AliAODTrack*>(track); | |
127 | ||
128 | if(!aodtrack) return kFALSE; | |
129 | ||
130 | ||
131 | if(fDebug > 2 ) printf("AliCaloTrackAODReader::FillInputCTS():AOD track type: %d (primary %d), hybrid? %d \n", | |
132 | aodtrack->GetType(),AliAODTrack::kPrimary, | |
133 | aodtrack->IsHybridGlobalConstrainedGlobal()); | |
134 | ||
135 | // Hybrid? | |
136 | if (fSelectHybridTracks && fTrackFilterMaskComplementary == 0) | |
137 | { | |
138 | if (!aodtrack->IsHybridGlobalConstrainedGlobal()) return kFALSE ; | |
139 | } | |
140 | else // Filter Bit? | |
141 | { | |
142 | Bool_t accept = aodtrack->TestFilterBit(fTrackFilterMask); | |
143 | ||
144 | if(!fSelectHybridTracks && !accept) return kFALSE ; | |
145 | ||
146 | if(fSelectHybridTracks) // Second filter bit for hybrids? | |
147 | { | |
148 | Bool_t acceptcomplement = aodtrack->TestFilterBit(fTrackFilterMaskComplementary); | |
149 | if (!accept && !acceptcomplement) return kFALSE ; | |
150 | } | |
151 | } | |
152 | ||
153 | // | |
154 | if(fSelectSPDHitTracks) | |
155 | { // Not much sense to use with TPC only or Hybrid tracks | |
156 | if(!aodtrack->HasPointOnITSLayer(0) && !aodtrack->HasPointOnITSLayer(1)) return kFALSE ; | |
157 | } | |
158 | ||
159 | // | |
160 | if ( fSelectFractionTPCSharedClusters ) | |
161 | { | |
162 | Double_t frac = Double_t(aodtrack->GetTPCnclsS()) / Double_t(aodtrack->GetTPCncls()); | |
163 | if (frac > fCutTPCSharedClustersFraction) | |
164 | { | |
165 | if (fDebug > 2 )printf("\t Reject track, shared cluster fraction %f > %f\n",frac, fCutTPCSharedClustersFraction); | |
166 | return kFALSE ; | |
167 | } | |
168 | } | |
169 | ||
170 | // | |
171 | if ( fSelectPrimaryTracks ) | |
172 | { | |
173 | if ( aodtrack->GetType()!= AliAODTrack::kPrimary ) | |
174 | { | |
175 | if (fDebug > 2 ) printf("\t Remove not primary track\n"); | |
176 | return kFALSE ; | |
177 | } | |
178 | } | |
179 | ||
180 | if (fDebug > 2 ) printf("\t accepted track! \n"); | |
181 | ||
182 | track->GetPxPyPz(pTrack) ; | |
183 | ||
184 | return kTRUE; | |
185 | ||
186 | } | |
187 | ||
188 | ||
43074325 | 189 | //_________________________________________________________________ |
72ccdf15 | 190 | void AliCaloTrackAODReader::SetInputOutputMCEvent(AliVEvent* input, |
191 | AliAODEvent* aod, | |
192 | AliMCEvent* mc) | |
43074325 | 193 | { |
1c5acb87 | 194 | // Connect the data pointers |
477d6cee | 195 | // If input is AOD, do analysis with input, if not, do analysis with the output aod. |
43074325 | 196 | |
898c9d44 | 197 | //printf("AODInputHandler %p, MergeEvents %d \n",aodIH, aodIH->GetMergeEvents()); |
43074325 | 198 | |
c8fe2783 | 199 | Bool_t tesd = kFALSE ; |
200 | Bool_t taod = kTRUE ; | |
0de1814a | 201 | if ( strcmp(input->GetName(), "AliMixedEvent") == 0 ) |
202 | { | |
c8fe2783 | 203 | AliMultiEventInputHandler* multiEH = dynamic_cast<AliMultiEventInputHandler*>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler()); |
898c9d44 | 204 | if(multiEH){ |
0de1814a | 205 | if (multiEH->GetFormat() == 0 ) |
206 | { | |
898c9d44 | 207 | tesd = kTRUE ; |
0de1814a | 208 | } else if (multiEH->GetFormat() == 1) |
209 | { | |
898c9d44 | 210 | taod = kTRUE ; |
211 | } | |
212 | } | |
0de1814a | 213 | else |
214 | { | |
898c9d44 | 215 | printf("AliCaloTrackAODReader::SetInputOutputMCEvent() - MultiEventHandler is NULL"); |
216 | abort(); | |
c8fe2783 | 217 | } |
218 | } | |
0de1814a | 219 | if (strcmp(input->GetName(),"AliESDEvent") == 0) |
220 | { | |
c8fe2783 | 221 | tesd = kTRUE ; |
0de1814a | 222 | } else if (strcmp(input->GetName(),"AliAODEvent") == 0) |
223 | { | |
c8fe2783 | 224 | taod = kTRUE ; |
225 | } | |
226 | ||
43074325 | 227 | |
0de1814a | 228 | if(tesd) |
229 | { | |
477d6cee | 230 | SetInputEvent(aod); |
231 | SetOutputEvent(aod); | |
6060ed91 | 232 | fOrgInputEvent = input; |
477d6cee | 233 | } |
0de1814a | 234 | else if(taod) |
235 | { | |
c8fe2783 | 236 | AliAODInputHandler* aodIH = dynamic_cast<AliAODInputHandler*>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler()); |
0de1814a | 237 | |
238 | if (aodIH && aodIH->GetMergeEvents()) | |
239 | { | |
8a587055 | 240 | //Merged events, use output AOD. |
241 | SetInputEvent(aod); | |
242 | SetOutputEvent(aod); | |
6060ed91 | 243 | fOrgInputEvent = input; |
8a587055 | 244 | } |
0de1814a | 245 | else |
246 | { | |
8a587055 | 247 | SetInputEvent(input); |
248 | SetOutputEvent(aod); | |
249 | } | |
477d6cee | 250 | } |
0de1814a | 251 | else |
252 | { | |
c8fe2783 | 253 | AliFatal(Form("AliCaloTrackAODReader::SetInputOutputMCEvent() - STOP : Wrong data format: %s\n",input->GetName())); |
477d6cee | 254 | } |
255 | ||
256 | SetMC(mc); | |
1c5acb87 | 257 | |
1c5acb87 | 258 | } |
08a064bc | 259 |