]>
Commit | Line | Data |
---|---|---|
1528f6d1 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Authors: Svein Lindal, Daniel Lohner * | |
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 | ||
16 | //////////////////////////////////////////////// | |
17 | //--------------------------------------------- | |
18 | // Class reconstructing conversion photons from V0s | |
19 | //--------------------------------------------- | |
20 | //////////////////////////////////////////////// | |
21 | ||
22 | #include "AliV0ReaderV1.h" | |
23 | #include "AliKFParticle.h" | |
24 | #include "AliAODv0.h" | |
25 | #include "AliESDv0.h" | |
26 | #include "AliAODEvent.h" | |
27 | #include "AliESDEvent.h" | |
28 | #include "AliKFParticle.h" | |
29 | #include "AliKFConversionPhoton.h" | |
30 | #include "AliAODConversionPhoton.h" | |
31 | #include "AliConversionPhotonBase.h" | |
32 | #include "TVector.h" | |
33 | #include "AliKFVertex.h" | |
34 | #include "AliAODTrack.h" | |
35 | #include "AliESDtrack.h" | |
36 | #include "AliAnalysisManager.h" | |
37 | #include "AliInputEventHandler.h" | |
38 | #include "AliAODHandler.h" | |
39 | #include "AliPIDResponse.h" | |
40 | #include "TChain.h" | |
41 | #include "AliStack.h" | |
42 | ||
43 | class iostream; | |
44 | ||
45 | ||
46 | using namespace std; | |
47 | ||
48 | ClassImp(AliV0ReaderV1) | |
49 | ||
50 | //________________________________________________________________________ | |
51 | AliV0ReaderV1::AliV0ReaderV1(const char *name) : AliAnalysisTaskSE(name), | |
52 | fConversionCuts(NULL), | |
53 | fConversionGammas(NULL), | |
54 | fUseImprovedVertex(kTRUE), | |
55 | fUseOwnXYZCalculation(kTRUE), | |
56 | fUseConstructGamma(kFALSE), | |
57 | kUseAODConversionPhoton(kTRUE), | |
58 | fCreateAOD(kFALSE), | |
59 | fDeltaAODBranchName("GammaConv"), | |
60 | fDeltaAODFilename("AliAODGammaConversion.root"), | |
61 | fEventIsSelected(kFALSE) | |
62 | { | |
63 | // Default constructor | |
64 | ||
65 | DefineInput(0, TChain::Class()); | |
66 | } | |
67 | ||
68 | //________________________________________________________________________ | |
69 | AliV0ReaderV1::~AliV0ReaderV1() | |
70 | { | |
71 | // default deconstructor | |
72 | ||
73 | if(fConversionGammas){ | |
74 | fConversionGammas->Delete();// Clear Objects | |
75 | delete fConversionGammas; | |
76 | fConversionGammas=0x0; | |
77 | } | |
78 | } | |
2bdd97ae | 79 | /* |
80 | //________________________________________________________________________ | |
81 | AliV0ReaderV1::AliV0ReaderV1(AliV0ReaderV1 &original) : AliAnalysisTaskSE(original), | |
82 | fConversionCuts(NULL), | |
83 | fConversionGammas(NULL), | |
84 | fUseImprovedVertex(original.fUseImprovedVertex), | |
85 | fUseOwnXYZCalculation(original.fUseOwnXYZCalculation), | |
86 | fUseConstructGamma(original.fUseConstructGamma), | |
87 | kUseAODConversionPhoton(original.kUseAODConversionPhoton), | |
88 | fCreateAOD(original.fCreateAOD), | |
89 | fDeltaAODBranchName(original.fDeltaAODBranchName), | |
90 | fDeltaAODFilename(original.fDeltaAODFilename), | |
91 | fEventIsSelected(original.fEventIsSelected) | |
92 | { | |
93 | // Default constructor | |
94 | ||
95 | DefineInput(0, TChain::Class()); | |
96 | } | |
97 | ||
98 | //____________________________________________________________ | |
99 | AliV0ReaderV1 &AliV0ReaderV1::operator=(const AliV0ReaderV1 &ref){ | |
100 | // | |
101 | // Assignment operator | |
102 | // Only copies pointers, object is not the owner of the references | |
103 | // | |
104 | if(this != &ref){ | |
105 | AliAnalysisTaskSE::operator=(ref); | |
106 | fUseImprovedVertex=ref.fUseImprovedVertex; | |
107 | fUseOwnXYZCalculation=ref.fUseOwnXYZCalculation; | |
108 | fUseConstructGamma=ref.fUseConstructGamma; | |
109 | kUseAODConversionPhoton=ref.kUseAODConversionPhoton; | |
110 | fCreateAOD=ref.fCreateAOD; | |
111 | fDeltaAODBranchName=ref.fDeltaAODBranchName; | |
112 | fDeltaAODFilename=ref.fDeltaAODFilename; | |
113 | fEventIsSelected=ref.fEventIsSelected; | |
114 | } | |
115 | return *this; | |
116 | } | |
117 | */ | |
1528f6d1 | 118 | //________________________________________________________________________ |
119 | void AliV0ReaderV1::Init() | |
120 | { | |
121 | // Initialize function to be called once before analysis | |
122 | ||
123 | if(fConversionCuts==NULL){ | |
124 | if(fConversionCuts==NULL)AliError("No Cut Selection initialized"); | |
125 | } | |
126 | ||
127 | if(fCreateAOD){kUseAODConversionPhoton=kTRUE;} | |
128 | ||
129 | if(fConversionGammas != NULL){ | |
130 | delete fConversionGammas; | |
131 | fConversionGammas=NULL; | |
132 | } | |
133 | ||
134 | if(fConversionGammas == NULL){ | |
135 | if(kUseAODConversionPhoton){ | |
136 | fConversionGammas = new TClonesArray("AliAODConversionPhoton",100);} | |
137 | else{ | |
138 | fConversionGammas = new TClonesArray("AliKFConversionPhoton",100);} | |
139 | } | |
140 | fConversionGammas->Delete();//Reset the TClonesArray | |
141 | ||
142 | // Create AODs | |
143 | ||
144 | if(fCreateAOD){ | |
145 | if(fConversionCuts){ | |
146 | fDeltaAODBranchName.Append("_"); | |
147 | fDeltaAODBranchName.Append(fConversionCuts->GetCutNumber()); | |
148 | fDeltaAODBranchName.Append("_gamma"); | |
149 | } | |
150 | fConversionGammas->SetName(fDeltaAODBranchName.Data()); | |
151 | ||
152 | AddAODBranch("TClonesArray", &fConversionGammas, fDeltaAODFilename.Data()); | |
153 | AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile(fDeltaAODFilename.Data()); | |
154 | } | |
155 | } | |
156 | ||
157 | //________________________________________________________________________ | |
158 | void AliV0ReaderV1::UserCreateOutputObjects() | |
159 | { | |
160 | // Create User Output Objects | |
161 | } | |
162 | ||
163 | //________________________________________________________________________ | |
164 | void AliV0ReaderV1::UserExec(Option_t *){ | |
165 | ||
166 | // User Exec | |
167 | fEventIsSelected=ProcessEvent(fInputEvent,fMCEvent); | |
168 | } | |
169 | ||
170 | //________________________________________________________________________ | |
171 | Bool_t AliV0ReaderV1::ProcessEvent(AliVEvent *inputEvent,AliMCEvent *mcEvent) | |
172 | { | |
173 | //Reset the TClonesArray | |
174 | fConversionGammas->Delete(); | |
175 | ||
176 | fInputEvent=inputEvent; | |
177 | fMCEvent=mcEvent; | |
178 | ||
179 | if(!fInputEvent){ | |
180 | AliError("No Input event"); | |
181 | return kFALSE; | |
182 | } | |
183 | ||
184 | if(!fConversionCuts){AliError("No ConversionCuts");return kFALSE;} | |
185 | ||
186 | // Event Cuts | |
187 | if(!fConversionCuts->EventIsSelected(fInputEvent,fMCEvent))return kFALSE; | |
188 | ||
189 | // Set Magnetic Field | |
190 | AliKFParticle::SetField(fInputEvent->GetMagneticField()); | |
191 | ||
192 | if(fInputEvent->IsA()==AliESDEvent::Class()){ | |
193 | ProcessESDV0s(); | |
194 | } | |
195 | if(fInputEvent->IsA()==AliAODEvent::Class()){ | |
196 | GetAODConversionGammas(); | |
197 | } | |
198 | ||
199 | // AOD Output | |
200 | FillAODOutput(); | |
201 | ||
202 | return kTRUE; | |
203 | } | |
204 | ///________________________________________________________________________ | |
205 | void AliV0ReaderV1::FillAODOutput() | |
206 | { | |
207 | // Fill AOD Output with reconstructed Photons | |
208 | ||
209 | if(fInputEvent->IsA()==AliESDEvent::Class()){ | |
210 | ///Make sure delta aod is filled if standard aod is filled (for synchronization when reading aod with standard aod) | |
211 | if(fCreateAOD) { | |
212 | AliAODHandler * aodhandler = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()); | |
213 | if (aodhandler && aodhandler->GetFillAOD()) { | |
214 | AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillExtension(kTRUE); | |
215 | PostData(0, fConversionGammas); | |
216 | ||
217 | } | |
218 | } | |
219 | } | |
220 | } | |
221 | ||
222 | ///________________________________________________________________________ | |
223 | const AliExternalTrackParam *AliV0ReaderV1::GetExternalTrackParam(AliESDv0 *fCurrentV0,Int_t &tracklabel,Int_t charge){ | |
224 | ||
225 | // Get External Track Parameter with given charge | |
226 | ||
227 | if(!(charge==1||charge==-1)){AliError("Charge not defined");return 0x0;} | |
228 | ||
229 | // Check for sign flip | |
230 | if(fCurrentV0){ | |
231 | if(!fCurrentV0->GetParamN()||!fCurrentV0->GetParamP())return 0x0; | |
232 | if(!fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex())||!fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))return 0x0; | |
233 | if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))->Charge()==charge){ | |
234 | tracklabel=fCurrentV0->GetPindex(); | |
235 | return fCurrentV0->GetParamP();} | |
236 | if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex()))->Charge()==charge){ | |
237 | tracklabel=fCurrentV0->GetNindex(); | |
238 | return fCurrentV0->GetParamN();} | |
239 | } | |
240 | return 0x0; | |
241 | } | |
242 | ||
243 | ///________________________________________________________________________ | |
244 | Bool_t AliV0ReaderV1::ProcessESDV0s() | |
245 | { | |
246 | // Process ESD V0s for conversion photon reconstruction | |
247 | ||
248 | AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(fInputEvent); | |
249 | ||
250 | AliKFConversionPhoton *fCurrentMotherKFCandidate=NULL; | |
251 | ||
252 | if(fESDEvent){ | |
253 | ||
254 | for(Int_t currentV0Index=0;currentV0Index<fESDEvent->GetNumberOfV0s();currentV0Index++){ | |
255 | AliESDv0 *fCurrentV0=(AliESDv0*)(fESDEvent->GetV0(currentV0Index)); | |
256 | if(!fCurrentV0){ | |
257 | printf("Requested V0 does not exist"); | |
258 | continue;} | |
259 | ||
260 | fCurrentMotherKFCandidate=ReconstructV0(fCurrentV0,currentV0Index); | |
261 | ||
262 | if(fCurrentMotherKFCandidate){ | |
263 | ||
264 | // Add Gamma to the TClonesArray | |
265 | ||
266 | if(kUseAODConversionPhoton){ | |
267 | new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliAODConversionPhoton(fCurrentMotherKFCandidate); | |
268 | } | |
269 | else{ | |
270 | new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliKFConversionPhoton(*fCurrentMotherKFCandidate); | |
271 | } | |
272 | ||
273 | delete fCurrentMotherKFCandidate; | |
274 | fCurrentMotherKFCandidate=NULL; | |
275 | } | |
276 | } | |
277 | } | |
278 | return kTRUE; | |
279 | } | |
280 | ||
281 | ///________________________________________________________________________ | |
282 | AliKFConversionPhoton *AliV0ReaderV1::ReconstructV0(AliESDv0 *fCurrentV0,Int_t currentV0Index) | |
283 | { | |
284 | // Reconstruct conversion photon from ESD v0 | |
285 | fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kPhotonIn); | |
286 | ||
287 | //checks if on the fly mode is set | |
288 | if(!fConversionCuts->SelectV0Finder(fCurrentV0->GetOnFlyStatus())){ | |
289 | fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kOnFly); | |
290 | return 0x0; | |
291 | } | |
292 | ||
293 | // TrackLabels | |
294 | Int_t currentTrackLabels[2]={-1,-1}; | |
295 | ||
296 | // Get Daughter KF Particles | |
297 | ||
298 | const AliExternalTrackParam *fCurrentExternalTrackParamPositive=GetExternalTrackParamP(fCurrentV0,currentTrackLabels[0]); | |
299 | const AliExternalTrackParam *fCurrentExternalTrackParamNegative=GetExternalTrackParamN(fCurrentV0,currentTrackLabels[1]); | |
300 | ||
301 | if(!fCurrentExternalTrackParamPositive||!fCurrentExternalTrackParamNegative)return 0x0; | |
302 | ||
303 | // Apply some Cuts before Reconstruction | |
304 | ||
305 | AliVTrack * posTrack = fConversionCuts->GetTrack(fInputEvent,currentTrackLabels[0]); | |
306 | AliVTrack * negTrack = fConversionCuts->GetTrack(fInputEvent,currentTrackLabels[1]); | |
307 | ||
308 | if(!negTrack || !posTrack) { | |
309 | fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kNoTracks); | |
310 | return 0x0; | |
311 | } | |
312 | ||
313 | // Track Cuts | |
314 | if(!fConversionCuts->TracksAreSelected(negTrack, posTrack)){ | |
315 | fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kTrackCuts); | |
316 | return 0x0; | |
317 | } | |
318 | ||
319 | // PID Cuts | |
320 | if(!fConversionCuts->dEdxCuts(negTrack) || !fConversionCuts->dEdxCuts(posTrack)) { | |
321 | fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kdEdxCuts); | |
322 | return 0x0; | |
323 | } | |
324 | ||
325 | // Reconstruct Photon | |
326 | ||
327 | AliKFConversionPhoton *fCurrentMotherKF=NULL; | |
328 | ||
329 | AliKFParticle fCurrentNegativeKFParticle(*(fCurrentExternalTrackParamNegative),11); | |
330 | AliKFParticle fCurrentPositiveKFParticle(*(fCurrentExternalTrackParamPositive),-11); | |
331 | ||
332 | // Reconstruct Gamma | |
333 | ||
334 | if(fUseConstructGamma){ | |
335 | ||
336 | fCurrentMotherKF = new AliKFConversionPhoton(); | |
337 | fCurrentMotherKF->ConstructGamma(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle); | |
338 | }else{ | |
339 | fCurrentMotherKF = new AliKFConversionPhoton(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle); | |
340 | fCurrentMotherKF->SetMassConstraint(0,0); | |
341 | } | |
342 | ||
343 | // Set Track Labels | |
344 | ||
345 | fCurrentMotherKF->SetTrackLabels(currentTrackLabels[0],currentTrackLabels[1]); | |
346 | ||
347 | // Set V0 index | |
348 | ||
349 | fCurrentMotherKF->SetV0Index(currentV0Index); | |
350 | ||
351 | //Set MC Label | |
352 | ||
353 | if(fMCEvent){ | |
354 | ||
355 | AliStack *fMCStack= fMCEvent->Stack(); | |
356 | ||
357 | Int_t labeln=TMath::Abs(fConversionCuts->GetTrack(fInputEvent,fCurrentMotherKF->GetTrackLabelPositive())->GetLabel()); | |
358 | Int_t labelp=TMath::Abs(fConversionCuts->GetTrack(fInputEvent,fCurrentMotherKF->GetTrackLabelNegative())->GetLabel()); | |
359 | ||
360 | TParticle *fNegativeMCParticle = fMCStack->Particle(labeln); | |
361 | TParticle *fPositiveMCParticle = fMCStack->Particle(labelp); | |
362 | ||
363 | if(fPositiveMCParticle&&fNegativeMCParticle){ | |
364 | fCurrentMotherKF->SetMCLabelPositive(labelp); | |
365 | fCurrentMotherKF->SetMCLabelNegative(labeln); | |
366 | } | |
367 | } | |
368 | ||
369 | // Update Vertex (moved for same eta compared to old) | |
370 | if(fUseImprovedVertex == kTRUE){ | |
371 | AliKFVertex primaryVertexImproved(*fInputEvent->GetPrimaryVertex()); | |
372 | primaryVertexImproved+=*fCurrentMotherKF; | |
373 | fCurrentMotherKF->SetProductionVertex(primaryVertexImproved); | |
374 | } | |
375 | ||
376 | // SetPsiPair | |
377 | ||
378 | Double_t PsiPair=GetPsiPair(fCurrentV0,fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative); | |
379 | fCurrentMotherKF->SetPsiPair(PsiPair); | |
380 | ||
381 | ||
382 | // Recalculate ConversionPoint | |
383 | Double_t dca[2]={0,0}; | |
384 | if(fUseOwnXYZCalculation){ | |
385 | Double_t convpos[3]={0,0,0}; | |
386 | if(!GetConversionPoint(fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative,convpos,dca)){ | |
387 | fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kConvPointFail); | |
388 | delete fCurrentMotherKF; | |
389 | fCurrentMotherKF=NULL; | |
390 | return 0x0; | |
391 | } | |
392 | ||
393 | fCurrentMotherKF->SetConversionPoint(convpos); | |
394 | } | |
395 | ||
396 | if(fCurrentMotherKF->GetNDF() > 0.) | |
397 | fCurrentMotherKF->SetChi2perNDF(fCurrentMotherKF->GetChi2()/fCurrentMotherKF->GetNDF()); //->Photon is created before all chi2 relevant changes are performed, set it "by hand" | |
398 | ||
399 | // Apply Photon Cuts | |
400 | ||
401 | if(!fConversionCuts->PhotonCuts(fCurrentMotherKF,fInputEvent)){ | |
402 | fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kPhotonCuts); | |
403 | delete fCurrentMotherKF; | |
404 | fCurrentMotherKF=NULL; | |
405 | return 0x0; | |
406 | } | |
407 | ||
408 | // Set Dilepton Mass (moved down for same eta compared to old) | |
409 | fCurrentMotherKF->SetMass(fCurrentMotherKF->M()); | |
410 | ||
411 | ||
412 | fConversionCuts->FillPhotonCutIndex(AliConversionCuts::kPhotonOut); | |
413 | return fCurrentMotherKF; | |
414 | } | |
415 | ||
416 | ///________________________________________________________________________ | |
417 | Double_t AliV0ReaderV1::GetPsiPair(const AliESDv0* v0, const AliExternalTrackParam *positiveparam,const AliExternalTrackParam *negativeparam) const { | |
418 | // | |
419 | // Angle between daughter momentum plane and plane | |
420 | // | |
421 | ||
422 | AliExternalTrackParam nt(*negativeparam); | |
423 | AliExternalTrackParam pt(*positiveparam); | |
424 | ||
425 | Float_t magField = fInputEvent->GetMagneticField(); | |
426 | ||
427 | Double_t xyz[3] = {0.,0.,0.}; | |
428 | v0->GetXYZ(xyz[0],xyz[1],xyz[2]); | |
429 | ||
430 | Double_t mn[3] = {0,0,0}; | |
431 | Double_t mp[3] = {0,0,0}; | |
432 | ||
433 | v0->GetNPxPyPz(mn[0],mn[1],mn[2]);//reconstructed cartesian momentum components of negative daughter; | |
434 | v0->GetPPxPyPz(mp[0],mp[1],mp[2]);//reconstructed cartesian momentum components of positive daughter; | |
435 | ||
436 | Double_t deltat = 1.; | |
437 | deltat = TMath::ATan(mp[2]/(TMath::Sqrt(mp[0]*mp[0] + mp[1]*mp[1])+1.e-13)) - TMath::ATan(mn[2]/(TMath::Sqrt(mn[0]*mn[0] + mn[1]*mn[1])+1.e-13));//difference of angles of the two daughter tracks with z-axis | |
438 | Double_t radiussum = TMath::Sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1]) + 50;//radius to which tracks shall be propagated | |
439 | ||
440 | Double_t momPosProp[3] = {0,0,0}; | |
441 | Double_t momNegProp[3] = {0,0,0}; | |
442 | ||
443 | Double_t psiPair = 4.; | |
444 | if(nt.PropagateTo(radiussum,magField) == 0) return psiPair; //propagate tracks to the outside -> Better Purity and Efficiency | |
445 | ||
446 | if(pt.PropagateTo(radiussum,magField) == 0) return psiPair; //propagate tracks to the outside -> Better Purity and Efficiency | |
447 | ||
448 | pt.GetPxPyPz(momPosProp);//Get momentum vectors of tracks after propagation | |
449 | nt.GetPxPyPz(momNegProp); | |
450 | ||
451 | Double_t pEle = | |
452 | TMath::Sqrt(momNegProp[0]*momNegProp[0]+momNegProp[1]*momNegProp[1]+momNegProp[2]*momNegProp[2]);//absolute momentum value of negative daughter | |
453 | ||
454 | Double_t pPos = | |
455 | TMath::Sqrt(momPosProp[0]*momPosProp[0]+momPosProp[1]*momPosProp[1]+momPosProp[2]*momPosProp[2]);//absolute momentum value of positive daughter | |
456 | ||
457 | Double_t scalarproduct = | |
458 | momPosProp[0]*momNegProp[0]+momPosProp[1]*momNegProp[1]+momPosProp[2]*momNegProp[2];//scalar product of propagated positive and negative daughters' momenta | |
459 | ||
460 | Double_t chipair = TMath::ACos(scalarproduct/(pEle*pPos));//Angle between propagated daughter tracks | |
461 | ||
462 | psiPair = TMath::Abs(TMath::ASin(deltat/chipair)); | |
463 | ||
464 | return psiPair; | |
465 | } | |
466 | ||
467 | ///________________________________________________________________________ | |
468 | Bool_t AliV0ReaderV1::GetHelixCenter(const AliExternalTrackParam *track,Double_t center[2]){ | |
469 | ||
470 | // Get Center of the helix track parametrization | |
471 | ||
472 | Int_t charge=track->Charge(); | |
473 | Double_t b=fInputEvent->GetMagneticField(); | |
474 | ||
475 | Double_t helix[6]; | |
476 | track->GetHelixParameters(helix,b); | |
477 | ||
478 | Double_t xpos = helix[5]; | |
479 | Double_t ypos = helix[0]; | |
480 | Double_t radius = TMath::Abs(1./helix[4]); | |
481 | Double_t phi = helix[2]; | |
482 | ||
483 | if(phi < 0){ | |
484 | phi = phi + 2*TMath::Pi(); | |
485 | } | |
486 | ||
487 | phi -= TMath::Pi()/2.; | |
488 | Double_t xpoint = radius * TMath::Cos(phi); | |
489 | Double_t ypoint = radius * TMath::Sin(phi); | |
490 | ||
491 | if(b<0){ | |
492 | if(charge > 0){ | |
493 | xpoint = - xpoint; | |
494 | ypoint = - ypoint; | |
495 | } | |
496 | ||
497 | if(charge < 0){ | |
498 | xpoint = xpoint; | |
499 | ypoint = ypoint; | |
500 | } | |
501 | } | |
502 | if(b>0){ | |
503 | if(charge > 0){ | |
504 | xpoint = xpoint; | |
505 | ypoint = ypoint; | |
506 | } | |
507 | ||
508 | if(charge < 0){ | |
509 | xpoint = - xpoint; | |
510 | ypoint = - ypoint; | |
511 | } | |
512 | } | |
513 | center[0] = xpos + xpoint; | |
514 | center[1] = ypos + ypoint; | |
515 | ||
516 | return 1; | |
517 | } | |
518 | ///________________________________________________________________________ | |
519 | Bool_t AliV0ReaderV1::GetConversionPoint(const AliExternalTrackParam *pparam,const AliExternalTrackParam *nparam,Double_t convpos[3],Double_t dca[2]){ | |
520 | ||
521 | // Recalculate Conversion Point | |
522 | ||
523 | if(!pparam||!nparam)return kFALSE; | |
524 | ||
525 | Double_t helixcenterpos[2]; | |
526 | GetHelixCenter(pparam,helixcenterpos); | |
527 | ||
528 | Double_t helixcenterneg[2]; | |
529 | GetHelixCenter(nparam,helixcenterneg); | |
530 | ||
531 | Double_t helixpos[6]; | |
532 | pparam->GetHelixParameters(helixpos,fInputEvent->GetMagneticField()); | |
533 | Double_t posradius = TMath::Abs(1./helixpos[4]); | |
534 | ||
535 | Double_t helixneg[6]; | |
536 | nparam->GetHelixParameters(helixneg,fInputEvent->GetMagneticField()); | |
537 | Double_t negradius = TMath::Abs(1./helixneg[4]); | |
538 | ||
539 | // Calculate xy-position | |
540 | ||
541 | Double_t xpos = helixcenterpos[0]; | |
542 | Double_t ypos = helixcenterpos[1]; | |
543 | Double_t xneg = helixcenterneg[0]; | |
544 | Double_t yneg = helixcenterneg[1]; | |
545 | ||
546 | convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius); | |
547 | convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius); | |
548 | ||
549 | ||
550 | // Calculate Track XY vertex position | |
551 | ||
552 | Double_t deltaXPos = convpos[0] - xpos; | |
553 | Double_t deltaYPos = convpos[1] - ypos; | |
554 | ||
555 | Double_t deltaXNeg = convpos[0] - xneg; | |
556 | Double_t deltaYNeg = convpos[1] - yneg; | |
557 | ||
558 | Double_t alphaPos = TMath::Pi() + TMath::ATan2(-deltaYPos,-deltaXPos); | |
559 | Double_t alphaNeg = TMath::Pi() + TMath::ATan2(-deltaYNeg,-deltaXNeg); | |
560 | ||
561 | Double_t vertexXNeg = xneg + TMath::Abs(negradius)*TMath::Cos(alphaNeg); | |
562 | Double_t vertexYNeg = yneg + TMath::Abs(negradius)*TMath::Sin(alphaNeg); | |
563 | ||
564 | Double_t vertexXPos = xpos + TMath::Abs(posradius)*TMath::Cos(alphaPos); | |
565 | Double_t vertexYPos = ypos + TMath::Abs(posradius)*TMath::Sin(alphaPos); | |
566 | ||
567 | AliExternalTrackParam p(*pparam); | |
568 | AliExternalTrackParam n(*nparam); | |
569 | ||
570 | TVector2 vertexPos(vertexXPos,vertexYPos); | |
571 | TVector2 vertexNeg(vertexXNeg,vertexYNeg); | |
572 | ||
573 | // Convert to local coordinate system | |
574 | TVector2 vertexPosRot=vertexPos.Rotate(-p.GetAlpha()); | |
575 | TVector2 vertexNegRot=vertexNeg.Rotate(-n.GetAlpha()); | |
576 | ||
577 | // Propagate Track Params to Vertex | |
578 | ||
579 | if(!p.PropagateTo(vertexPosRot.X(),fInputEvent->GetMagneticField()))return kFALSE; | |
580 | if(!n.PropagateTo(vertexNegRot.X(),fInputEvent->GetMagneticField()))return kFALSE; | |
581 | ||
582 | // Check whether propagation was sucessful | |
583 | ||
584 | if(TMath::Abs(vertexPos.Mod()-TMath::Sqrt(p.GetX()*p.GetX()+p.GetY()*p.GetY()))>0.01)return kFALSE; | |
585 | if(TMath::Abs(vertexNeg.Mod()-TMath::Sqrt(n.GetX()*n.GetX()+n.GetY()*n.GetY()))>0.01)return kFALSE; | |
586 | ||
587 | // Calculate z position | |
588 | ||
589 | convpos[2] = (p.GetZ()*negradius+n.GetZ()*posradius)/(negradius+posradius); | |
590 | ||
591 | // Calculate DCA | |
592 | TVector2 vdca=vertexPos-vertexNeg; | |
593 | dca[0]=vdca.Mod(); | |
594 | dca[1]=TMath::Abs(n.GetZ()-p.GetZ()); | |
595 | ||
596 | return kTRUE; | |
597 | } | |
598 | //________________________________________________________________________ | |
599 | Bool_t AliV0ReaderV1::GetAODConversionGammas(){ | |
600 | ||
601 | // Get reconstructed conversion photons from satellite AOD file | |
602 | ||
603 | AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(fInputEvent); | |
604 | ||
605 | if(fAODEvent){ | |
606 | ||
607 | if(fConversionGammas == NULL){ | |
608 | fConversionGammas = new TClonesArray("AliAODConversionPhoton",100); | |
609 | } | |
610 | fConversionGammas->Delete();//Reset the TClonesArray | |
611 | ||
612 | //Get Gammas from satellite AOD gamma branch | |
613 | ||
614 | AliAODConversionPhoton *gamma=0x0; | |
615 | ||
616 | TClonesArray *fInputGammas=dynamic_cast<TClonesArray*>(fAODEvent->FindListObject(fDeltaAODBranchName.Data())); | |
617 | if(!fInputGammas){ | |
618 | FindDeltaAODBranchName(); | |
619 | fInputGammas=dynamic_cast<TClonesArray*>(fAODEvent->FindListObject(fDeltaAODBranchName.Data()));} | |
620 | if(!fInputGammas){AliError("No Gamma Satellites found");return kFALSE;} | |
621 | // Apply Selection Cuts to Gammas and create local working copy | |
622 | if(fInputGammas){ | |
623 | for(Int_t i=0;i<fInputGammas->GetEntriesFast();i++){ | |
624 | gamma=dynamic_cast<AliAODConversionPhoton*>(fInputGammas->At(i)); | |
625 | if(gamma){ | |
626 | if(fConversionCuts->PhotonIsSelected(gamma,fInputEvent)){ | |
627 | new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliAODConversionPhoton(*gamma);} | |
628 | } | |
629 | } | |
630 | } | |
631 | } | |
632 | ||
633 | if(fConversionGammas->GetEntries()){return kTRUE;} | |
634 | ||
635 | return kFALSE; | |
636 | } | |
637 | ||
638 | //________________________________________________________________________ | |
639 | void AliV0ReaderV1::FindDeltaAODBranchName(){ | |
640 | ||
641 | // Find delta AOD branchname containing reconstructed photons | |
642 | ||
643 | TList *list=fInputEvent->GetList(); | |
644 | for(Int_t ii=0;ii<list->GetEntries();ii++){ | |
645 | TString name((list->At(ii))->GetName()); | |
646 | if(name.BeginsWith(fDeltaAODBranchName)&&name.EndsWith("gamma")){ | |
647 | fDeltaAODBranchName=name; | |
648 | AliInfo(Form("Set DeltaAOD BranchName to: %s",fDeltaAODBranchName.Data())); | |
649 | return; | |
650 | } | |
651 | } | |
652 | } | |
653 | ||
654 | ||
655 | //________________________________________________________________________ | |
656 | void AliV0ReaderV1::Terminate(Option_t *) | |
657 | { | |
658 | ||
659 | } |