42 #include <TGeoGlobalMagField.h>
45 #include "AliKFParticle.h"
48 #include "AliAODEvent.h"
49 #include "AliESDEvent.h"
51 #include "AliMCEvent.h"
52 #include "AliMCEventHandler.h"
53 #include "AliESDpid.h"
54 #include "AliESDtrackCuts.h"
56 #include "AliGenCocktailEventHeader.h"
62 #include "AliKFVertex.h"
63 #include "AliAODTrack.h"
64 #include "AliESDtrack.h"
65 #include "AliAnalysisManager.h"
66 #include "AliInputEventHandler.h"
67 #include "AliAODHandler.h"
68 #include "AliPIDResponse.h"
72 #include "TObjArray.h"
82 kAddv0sInESDFilter(kFALSE),
84 fConversionCuts(NULL),
86 fConversionGammas(NULL),
87 fUseImprovedVertex(kTRUE),
88 fUseOwnXYZCalculation(kTRUE),
89 fUseConstructGamma(kFALSE),
90 kUseAODConversionPhoton(kTRUE),
92 fDeltaAODBranchName("GammaConv"),
93 fDeltaAODFilename("AliAODGammaConversion.root"),
95 fPreviousV0ReaderPerformsAODRelabeling(0),
96 fEventIsSelected(kFALSE),
97 fNumberOfPrimaryTracks(0),
98 fNumberOfTPCoutTracks(0),
101 fUseMassToZero(kTRUE),
102 fProduceV0findingEffi(kFALSE),
103 fProduceImpactParamHistograms(kFALSE),
104 fCurrentInvMassPair(0),
107 fImpactParamHistograms(NULL),
108 fHistoMCGammaPtvsR(NULL),
109 fHistoMCGammaPtvsPhi(NULL),
110 fHistoMCGammaPtvsEta(NULL),
111 fHistoMCGammaRvsPhi(NULL),
112 fHistoMCGammaRvsEta(NULL),
113 fHistoMCGammaPhivsEta(NULL),
114 fHistoRecMCGammaPtvsR(NULL),
115 fHistoRecMCGammaPtvsPhi(NULL),
116 fHistoRecMCGammaPtvsEta(NULL),
117 fHistoRecMCGammaRvsPhi(NULL),
118 fHistoRecMCGammaRvsEta(NULL),
119 fHistoRecMCGammaPhivsEta(NULL),
120 fHistoRecMCGammaMultiPt(NULL),
121 fHistoRecMCGammaMultiPtvsEta(NULL),
122 fHistoRecMCGammaMultiR(NULL),
123 fHistoRecMCGammaMultiPhi(NULL),
124 fHistoPosTrackImpactParamZ(NULL),
125 fHistoPosTrackImpactParamY(NULL),
126 fHistoPosTrackImpactParamX(NULL),
127 fHistoPosTrackImpactParamZvsPt(NULL),
128 fHistoPosTrackImpactParamYvsPt(NULL),
129 fHistoPosTrackImpactParamXvsPt(NULL),
130 fHistoNegTrackImpactParamZ(NULL),
131 fHistoNegTrackImpactParamY(NULL),
132 fHistoNegTrackImpactParamX(NULL),
133 fHistoNegTrackImpactParamZvsPt(NULL),
134 fHistoNegTrackImpactParamYvsPt(NULL),
135 fHistoNegTrackImpactParamXvsPt(NULL),
136 fHistoImpactParamZvsR(NULL),
137 fHistoImpactParamZvsR2(NULL),
140 fHistoDCAzPhoton(NULL),
141 fHistoDCAzPhoton2(NULL),
144 fHistoRviaAlpha(NULL),
145 fHistoRviaAlphaRecalc(NULL),
147 fHistoImpactParameterStudy(NULL),
148 fImpactParamTree(NULL),
149 fVectorFoundGammas(0),
150 fCurrentFileName(""),
151 fMCFileChecked(kFALSE)
155 DefineInput(0, TChain::Class());
156 DefineOutput(1,TBits::Class());
164 if(fConversionGammas){
165 fConversionGammas->Delete();
166 delete fConversionGammas;
167 fConversionGammas=0x0;
180 if(fConversionGammas && (index < fConversionGammas->GetEntriesFast())) {
181 TObject *tmp = fConversionGammas->At(index);
182 if(tmp->IsA() == AliAODConversionPhoton::Class()){
238 if(fConversionCuts==NULL){
239 if(fConversionCuts==NULL)AliError(
"No Conversion Cut Selection initialized");
241 if(fEventCuts==NULL){
242 if(fEventCuts==NULL)AliError(
"No Event Cut Selection initialized");
245 if(fCreateAOD){kUseAODConversionPhoton=kTRUE;}
247 if(fConversionGammas != NULL){
248 delete fConversionGammas;
249 fConversionGammas=NULL;
252 if(fConversionGammas == NULL){
253 if(kUseAODConversionPhoton){
254 fConversionGammas =
new TClonesArray(
"AliAODConversionPhoton",100);}
256 fConversionGammas =
new TClonesArray(
"AliKFConversionPhoton",100);}
258 fConversionGammas->Delete();
267 fPCMv0BitField =
new TBits();
270 fDeltaAODBranchName.Append(
"_");
271 fDeltaAODBranchName.Append(fEventCuts->GetCutNumber());
274 fDeltaAODBranchName.Append(
"_");
275 fDeltaAODBranchName.Append(fConversionCuts->GetCutNumber());
276 fDeltaAODBranchName.Append(
"_gamma");
278 fConversionGammas->SetName(fDeltaAODBranchName.Data());
280 AddAODBranch(
"TClonesArray", &fConversionGammas, fDeltaAODFilename.Data());
281 AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile(fDeltaAODFilename.Data());
284 if(fProduceImpactParamHistograms){
285 if(fImpactParamHistograms != NULL){
286 delete fImpactParamHistograms;
287 fImpactParamHistograms = NULL;
289 if(fImpactParamHistograms==NULL){
290 fImpactParamHistograms =
new TList();
291 fImpactParamHistograms->SetOwner(kTRUE);
292 fImpactParamHistograms->SetName(Form(
"ImpactParamHistograms_%s_%s",fEventCuts->GetCutNumber().Data(),fConversionCuts->GetCutNumber().Data()));
294 fHistoPosTrackImpactParamZ =
new TH1F(
"fHistoPosTrackImpactParamZ",
"",480,-80,80);
295 fHistoPosTrackImpactParamZ->SetXTitle(
"Z (cm)");
296 fImpactParamHistograms->Add(fHistoPosTrackImpactParamZ);
298 fHistoPosTrackImpactParamY =
new TH1F(
"fHistoPosTrackImpactParamY",
"",720,-120,120);
299 fHistoPosTrackImpactParamY->SetXTitle(
"Y (cm)");
300 fImpactParamHistograms->Add(fHistoPosTrackImpactParamY);
302 fHistoPosTrackImpactParamX =
new TH1F(
"fHistoPosTrackImpactParamX",
"",30,-3,3);
303 fHistoPosTrackImpactParamX->SetXTitle(
"X (cm)");
304 fImpactParamHistograms->Add(fHistoPosTrackImpactParamX);
306 fHistoNegTrackImpactParamZ =
new TH1F(
"fHistoNegTrackImpactParamZ",
"",480,-80,80);
307 fHistoNegTrackImpactParamZ->SetXTitle(
"Z (cm)");
308 fImpactParamHistograms->Add(fHistoNegTrackImpactParamZ);
310 fHistoNegTrackImpactParamY =
new TH1F(
"fHistoNegTrackImpactParamY",
"",720,-120,120);
311 fHistoNegTrackImpactParamY->SetXTitle(
"Y (cm)");
312 fImpactParamHistograms->Add(fHistoNegTrackImpactParamY);
314 fHistoNegTrackImpactParamX =
new TH1F(
"fHistoNegTrackImpactParamX",
"",30,-3,3);
315 fHistoNegTrackImpactParamX->SetXTitle(
"X (cm)");
316 fImpactParamHistograms->Add(fHistoNegTrackImpactParamX);
318 fHistoPosTrackImpactParamZvsPt =
new TH2F(
"fHistoPosTrackImpactParamZvsPt",
"",100,0,10,480,-80,80);
319 fHistoPosTrackImpactParamZvsPt->SetYTitle(
"Z (cm)");
320 fHistoPosTrackImpactParamZvsPt->SetXTitle(
"Pt (GeV)");
321 fImpactParamHistograms->Add(fHistoPosTrackImpactParamZvsPt);
323 fHistoPosTrackImpactParamYvsPt =
new TH2F(
"fHistoPosTrackImpactParamYvsPt",
"",100,0,10,720,-120,120);
324 fHistoPosTrackImpactParamYvsPt->SetYTitle(
"Y (cm)");
325 fHistoPosTrackImpactParamYvsPt->SetXTitle(
"Pt (GeV)");
326 fImpactParamHistograms->Add(fHistoPosTrackImpactParamYvsPt);
328 fHistoPosTrackImpactParamXvsPt =
new TH2F(
"fHistoPosTrackImpactParamXvsPt",
"",100,0,10,30,-3,5);
329 fHistoPosTrackImpactParamXvsPt->SetYTitle(
"X (cm)");
330 fHistoPosTrackImpactParamXvsPt->SetXTitle(
"Pt (GeV)");
331 fImpactParamHistograms->Add(fHistoPosTrackImpactParamXvsPt);
333 fHistoNegTrackImpactParamZvsPt =
new TH2F(
"fHistoNegTrackImpactParamZvsPt",
"",100,0,10,480,-80,80);
334 fHistoNegTrackImpactParamZvsPt->SetYTitle(
"Z (cm)");
335 fHistoNegTrackImpactParamZvsPt->SetXTitle(
"Pt (GeV)");
336 fImpactParamHistograms->Add(fHistoNegTrackImpactParamZvsPt);
338 fHistoNegTrackImpactParamYvsPt =
new TH2F(
"fHistoNegTrackImpactParamYvsPt",
"",100,0,10,720,-120,120);
339 fHistoNegTrackImpactParamYvsPt->SetYTitle(
"Y (cm)");
340 fHistoNegTrackImpactParamYvsPt->SetXTitle(
"Pt (GeV)");
341 fImpactParamHistograms->Add(fHistoNegTrackImpactParamYvsPt);
343 fHistoNegTrackImpactParamXvsPt =
new TH2F(
"fHistoNegTrackImpactParamXvsPt",
"",100,0,10,30,-3,3);
344 fHistoNegTrackImpactParamXvsPt->SetYTitle(
"X (cm)");
345 fHistoNegTrackImpactParamXvsPt->SetXTitle(
"Pt (GeV)");
346 fImpactParamHistograms->Add(fHistoNegTrackImpactParamXvsPt);
348 fHistoImpactParamZvsR =
new TH2F(
"fHistoImpactParamZvsR",
"Before cuts",300,-150,150,200,0,200);
349 fHistoImpactParamZvsR->SetXTitle(
"Z (cm)");
350 fHistoImpactParamZvsR->SetYTitle(
"R (cm)");
351 fImpactParamHistograms->Add(fHistoImpactParamZvsR);
353 fHistoImpactParamZvsR2 =
new TH2F(
"fHistoImpactParamZvsR2",
"After cuts",300,-150,150,200,0,200);
354 fHistoImpactParamZvsR2->SetXTitle(
"Z (cm)");
355 fHistoImpactParamZvsR2->SetYTitle(
"R (cm)");
356 fImpactParamHistograms->Add(fHistoImpactParamZvsR2);
358 fHistoPt =
new TH1F(
"fHistoPt",
"Before all cuts",100,0,10);
359 fHistoPt->SetXTitle(
"Pt (GeV)");
360 fImpactParamHistograms->Add(fHistoPt);
362 fHistoPt2 =
new TH1F(
"fHistoPt2",
"After all cuts",100,0,10);
363 fHistoPt2->SetXTitle(
"Pt (GeV)");
364 fImpactParamHistograms->Add(fHistoPt2);
366 fHistoDCAzPhoton =
new TH1F(
"fHistoDCAzPhoton",
"Before cuts",20,-2,2);
367 fHistoDCAzPhoton->SetXTitle(
"DCAz photon (cm)");
368 fImpactParamHistograms->Add(fHistoDCAzPhoton);
370 fHistoDCAzPhoton2 =
new TH1F(
"fHistoDCAzPhoton2",
"After cuts",20,-2,2);
371 fHistoDCAzPhoton2->SetXTitle(
"DCAz photon (cm)");
372 fImpactParamHistograms->Add(fHistoDCAzPhoton2);
374 fHistoR =
new TH1F(
"fHistoR",
"",200,0,200);
375 fHistoR->SetXTitle(
"Conversion radius (cm)");
376 fImpactParamHistograms->Add(fHistoR);
378 fHistoRrecalc =
new TH1F(
"fHistoRrecalc",
"",200,0,200);
379 fHistoRrecalc->SetXTitle(
"conversion radius (cm)");
380 fImpactParamHistograms->Add(fHistoRrecalc);
382 fHistoRviaAlpha =
new TH1F(
"fHistoRviaAlpha",
"",200,0,200);
383 fHistoRviaAlpha->SetXTitle(
"Conversion radius (cm)");
384 fImpactParamHistograms->Add(fHistoRviaAlpha);
386 fHistoRviaAlphaRecalc =
new TH1F(
"fHistoRviaAlphaRecalc",
"",200,0,200);
387 fHistoRviaAlphaRecalc->SetXTitle(
"conversion radius (cm)");
388 fImpactParamHistograms->Add(fHistoRviaAlphaRecalc);
390 fHistoRdiff =
new TH1F(
"fHistoRdiff",
"",200,0,200);
391 fHistoRdiff->SetXTitle(
"R_conv - R_cluster conflict (cm)");
392 fImpactParamHistograms->Add(fHistoRdiff);
394 fHistoImpactParameterStudy =
new TH1F(
"fHistoImpactParameterStudy",
"",7,-0.5,6.5);
395 fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(1,
"# V0s");
396 fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(2,
"two TPC-only tracks");
397 fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(3,
"Z cut not passed");
398 fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(4,
"Y cut not passed");
399 fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(5,
"R>80cm");
400 fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(6,
"causality cut not p.");
401 fHistoImpactParameterStudy->GetXaxis()->SetBinLabel(7,
"# removed V0s");
402 fImpactParamHistograms->Add(fHistoImpactParameterStudy);
404 fImpactParamTree =
new TTree(
"fImpactParamTree",
"");
405 fImpactParamHistograms->Add(fImpactParamTree);
408 if (fProduceV0findingEffi){
409 TH1::AddDirectory(kFALSE);
410 if(fHistograms != NULL){
414 if(fHistograms==NULL){
415 fHistograms =
new TList();
416 fHistograms->SetOwner(kTRUE);
417 fHistograms->SetName(Form(
"V0FindingEfficiencyInput_%s_%s",fEventCuts->GetCutNumber().Data(),fConversionCuts->GetCutNumber().Data()));
420 fHistoMCGammaPtvsR =
new TH2F(
"MCconvGamma_Pt_R",
"MC converted gamma Pt vs R (|eta| < 0.9)",250,0.0,25,400,0,200);
421 fHistoMCGammaPtvsR->SetXTitle(
"p_{MC,T} (GeV/c)");
422 fHistoMCGammaPtvsR->SetYTitle(
"R_{MC,conv} (cm)");
423 fHistograms->Add(fHistoMCGammaPtvsR);
425 fHistoMCGammaPtvsEta =
new TH2F(
"MCconvGamma_Pt_Eta",
"MC converted gamma Pt vs Eta ",250,0.0,25,280,-1.4,1.4);
426 fHistoMCGammaPtvsEta->SetXTitle(
"p_{MC,T} (GeV/c)");
427 fHistoMCGammaPtvsEta->SetYTitle(
"#eta_{MC}");
428 fHistograms->Add(fHistoMCGammaPtvsEta);
430 fHistoMCGammaPtvsPhi =
new TH2F(
"MCconvGamma_Pt_Phi",
"MC converted gamma Pt vs Phi (|eta| < 0.9) ",250,0.0,25,400,0,2*TMath::Pi());
431 fHistoMCGammaPtvsPhi->SetXTitle(
"p_{MC,T} (GeV/c)");
432 fHistoMCGammaPtvsPhi->SetYTitle(
"#varphi_{MC} (rad)");
433 fHistograms->Add(fHistoMCGammaPtvsPhi);
435 fHistoMCGammaRvsPhi =
new TH2F(
"MCconvGamma_R_Phi",
"MC converted gamma R vs Phi (|eta| < 0.9) ",400,0,200,400,0,2*TMath::Pi());
436 fHistoMCGammaRvsPhi->SetXTitle(
"R_{MC,conv} (cm)");
437 fHistoMCGammaRvsPhi->SetYTitle(
"#varphi_{MC} (rad)");
438 fHistograms->Add(fHistoMCGammaRvsPhi);
440 fHistoMCGammaRvsEta =
new TH2F(
"MCconvGamma_R_Eta",
"MC converted gamma R vs Eta ",400,0,200,280,-1.4,1.4);
441 fHistoMCGammaRvsEta->SetXTitle(
"R_{MC,conv} (cm)");
442 fHistoMCGammaRvsEta->SetYTitle(
"#eta_{MC}");
443 fHistograms->Add(fHistoMCGammaRvsEta);
445 fHistoMCGammaPhivsEta =
new TH2F(
"MCconvGamma_Phi_Eta",
"MC converted gamma Phi vs Eta ",400,0,2*TMath::Pi(),280,-1.4,1.4);
446 fHistoMCGammaPhivsEta->SetXTitle(
"#phi_{MC} (rad)");
447 fHistoMCGammaPhivsEta->SetYTitle(
"#eta_{MC}");
448 fHistograms->Add(fHistoMCGammaPhivsEta);
450 fHistoRecMCGammaPtvsR =
new TH2F(
"RecMCconvGamma_Pt_R",
"rec MC converted gamma Pt vs R (|eta| < 0.9)",250,0.0,25,400,0,200);
451 fHistoRecMCGammaPtvsR->SetXTitle(
"p_{MC,T} (GeV/c)");
452 fHistoRecMCGammaPtvsR->SetYTitle(
"R_{MC,conv} (cm)");
453 fHistograms->Add(fHistoRecMCGammaPtvsR);
455 fHistoRecMCGammaPtvsEta =
new TH2F(
"RecMCconvGamma_Pt_Eta",
"rec MC converted gamma Pt vs Eta ",250,0.0,25,280,-1.4,1.4);
456 fHistoRecMCGammaPtvsEta->SetXTitle(
"p_{MC,T} (GeV/c)");
457 fHistoRecMCGammaPtvsEta->SetYTitle(
"#eta_{MC}");
458 fHistograms->Add(fHistoRecMCGammaPtvsEta);
460 fHistoRecMCGammaPtvsPhi =
new TH2F(
"RecMCconvGamma_Pt_Phi",
"rec MC converted gamma Pt vs Phi (|eta| < 0.9) ",250,0.0,25,400,0,2*TMath::Pi());
461 fHistoRecMCGammaPtvsPhi->SetXTitle(
"p_{MC,T} (GeV/c)");
462 fHistoRecMCGammaPtvsPhi->SetYTitle(
"#varphi_{MC} (rad)");
463 fHistograms->Add(fHistoRecMCGammaPtvsPhi);
465 fHistoRecMCGammaRvsPhi =
new TH2F(
"RecMCconvGamma_R_Phi",
"rec MC converted gamma R vs Phi (|eta| < 0.9) ",400,0,200,400,0,2*TMath::Pi());
466 fHistoRecMCGammaRvsPhi->SetXTitle(
"R_{MC,conv} (cm)");
467 fHistoRecMCGammaRvsPhi->SetYTitle(
"#varphi_{MC} (rad)");
468 fHistograms->Add(fHistoRecMCGammaRvsPhi);
470 fHistoRecMCGammaRvsEta =
new TH2F(
"RecMCconvGamma_R_Eta",
"rec MC converted gamma R vs Eta ",400,0,200,280,-1.4,1.4);
471 fHistoRecMCGammaRvsEta->SetXTitle(
"R_{MC,conv} (cm)");
472 fHistoRecMCGammaRvsEta->SetYTitle(
"#eta_{MC}");
473 fHistograms->Add(fHistoRecMCGammaRvsEta);
475 fHistoRecMCGammaPhivsEta =
new TH2F(
"RecMCconvGamma_Phi_Eta",
"rec MC converted gamma Phi vs Eta ",400,0,2*TMath::Pi(),280,-1.4,1.4);
476 fHistoRecMCGammaPhivsEta->SetXTitle(
"#phi_{MC} (rad)");
477 fHistoRecMCGammaPhivsEta->SetYTitle(
"#eta_{MC}");
478 fHistograms->Add(fHistoRecMCGammaPhivsEta);
480 fHistoRecMCGammaMultiPtvsEta =
new TH2F(
"RecMCconvGammaMulti_Pt_Eta",
"rec MC converted gamma (at least double counted) Pt vs Eta ",250,0.0,25,280,-1.4,1.4);
481 fHistoRecMCGammaMultiPtvsEta->SetXTitle(
"p_{MC,T} (GeV/c)");
482 fHistoRecMCGammaMultiPtvsEta->SetYTitle(
"#eta_{MC}");
483 fHistograms->Add(fHistoRecMCGammaMultiPtvsEta);
485 fHistoRecMCGammaMultiPt =
new TH1F(
"RecMCconvGammaMulti_Pt",
"rec MC converted gamma (at least double counted) Pt (|eta| < 0.9)",250,0.0,25);
486 fHistoRecMCGammaMultiPt->SetXTitle(
"p_{MC,T} (GeV/c)");
487 fHistograms->Add(fHistoRecMCGammaMultiPt);
489 fHistoRecMCGammaMultiR =
new TH1F(
"RecMCconvGammaMulti_R",
"rec MC converted gamma (at least double counted) R (|eta| < 0.9)",400,0,200);
490 fHistoRecMCGammaMultiR->SetXTitle(
"R_{MC,conv} (cm)");
491 fHistograms->Add(fHistoRecMCGammaMultiR);
493 fHistoRecMCGammaMultiPhi =
new TH1F(
"RecMCconvGammaMulti_Phi",
"rec MC converted gamma (at least double counted) Phi (|eta| < 0.9)",400,0,2*TMath::Pi());
494 fHistoRecMCGammaMultiPhi->SetXTitle(
"#phi_{MC} (rad)");
495 fHistograms->Add(fHistoRecMCGammaMultiPhi);
497 fVectorFoundGammas.clear();
505 fCurrentFileName =
"";
506 fMCFileChecked = kFALSE;
511 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
513 TTree* tree = (
TTree*) inputHandler->GetTree();
514 TFile*
file = (TFile*) tree->GetCurrentFile();
515 fCurrentFileName = file->GetName();
520 if (fPeriodName.CompareTo(
"") == 0){
521 TObjArray *arr = fCurrentFileName.Tokenize(
"/");
523 for (
Int_t i = 0; i < arr->GetEntriesFast();i++ ){
524 TObjString* testObjString = (TObjString*)arr->At(i);
525 if (testObjString->GetString().BeginsWith(
"LHC")){
526 fPeriodName = testObjString->GetString();
527 i = arr->GetEntriesFast();
530 if (fPeriodName.CompareTo(
"")==0){
531 TObjArray *arr2 = fCurrentFileName.Tokenize(
"__");
532 for (
Int_t i = 0; i < arr->GetEntriesFast();i++ ){
533 TObjString* testObjString = (TObjString*)arr2->At(i);
534 if (testObjString->GetString().BeginsWith(
"LHC")){
535 fPeriodName = testObjString->GetString();
536 i = arr2->GetEntriesFast();
541 fEventCuts->SetPeriodEnum (fPeriodName);
545 fEventCuts->SetPeriodEnum (fPeriodName);
555 TObjArray *arr = fCurrentFileName.Tokenize(
"/");
557 for (
Int_t i = 0; i < arr->GetEntriesFast();i++ ){
558 TObjString* testObjString = (TObjString*)arr->At(i);
559 if (testObjString->GetString().BeginsWith(
"LHC")){
560 TObjString* testObjString2 = (TObjString*)arr->At(i+1);
561 fPtHardBin = testObjString2->GetString().Atoi();
562 i = arr->GetEntriesFast();
567 if(!fEventCuts->GetDoEtaShift())
return kTRUE;
568 if(fEventCuts->GetEtaShift() == 0.0){
569 fEventCuts->GetCorrectEtaShiftFromPeriod();
570 fEventCuts->DoEtaShift(kFALSE);
573 printf(
" Gamma Conversion Reader %s_%s :: Eta Shift Manually Set to %f \n\n",
574 (fEventCuts->GetCutNumber()).
Data(),(fConversionCuts->GetCutNumber()).
Data(),fEventCuts->GetEtaShift());
575 fEventCuts->DoEtaShift(kFALSE);
585 if (!TGeoGlobalMagField::Instance()->GetField()) esdEvent->InitMagneticField();
589 if(!fConversionGammas)Init();
592 fEventIsSelected=ProcessEvent(fInputEvent,fMCEvent);
604 fConversionGammas->Delete();
607 if (kAddv0sInESDFilter){fPCMv0BitField->Clear();}
609 fInputEvent = inputEvent;
613 AliError(
"No Input event");
616 if(!fEventCuts){AliError(
"No EventCuts");
return kFALSE;}
617 if(!fConversionCuts){AliError(
"No ConversionCuts");
return kFALSE;}
628 if(!fEventCuts->EventIsSelected(fInputEvent,fMCEvent)){
629 if (fEventCuts->GetEventQuality() == 2 && !fMCFileChecked ){
630 cout <<
"ERROR with MC reading for: "<< fCurrentFileName.Data() << endl;
631 fMCFileChecked = kTRUE;
636 AliKFParticle::SetField(fInputEvent->GetMagneticField());
638 if(fInputEvent->IsA()==AliAODEvent::Class() && fProduceV0findingEffi){
639 fProduceV0findingEffi = kFALSE;
640 AliWarning(
"V0finding effi cannot be run on AODs ");
643 if(fProduceV0findingEffi){
644 CreatePureMCHistosForV0FinderEffiESD();
645 fVectorFoundGammas.clear();
648 if(fInputEvent->IsA()==AliESDEvent::Class()){
651 if(fInputEvent->IsA()==AliAODEvent::Class()){
652 GetAODConversionGammas();
662 if(fInputEvent->IsA()==AliESDEvent::Class()){
665 PostData(1, fPCMv0BitField);
666 AliAODHandler * aodhandler =
dynamic_cast<AliAODHandler*
>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
667 if (aodhandler && aodhandler->GetFillAOD()) {
668 AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillExtension(kTRUE);
681 if(!(charge==1||charge==-1)){AliError(
"Charge not defined");
return 0x0;}
683 if(fConversionCuts->GetV0FinderSameSign()==1){
685 if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))->Charge()!=(fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex()))->Charge())
return 0x0;
686 if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))->Charge()==(fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex()))->Charge()){
688 tracklabel=fCurrentV0->GetPindex();
689 return fCurrentV0->GetParamP();
691 tracklabel=fCurrentV0->GetNindex();
692 return fCurrentV0->GetParamN();
696 }
else if(fConversionCuts->GetV0FinderSameSign()==2){
699 tracklabel=fCurrentV0->GetPindex();
700 return fCurrentV0->GetParamP();
702 tracklabel=fCurrentV0->GetNindex();
703 return fCurrentV0->GetParamN();
709 if(!fCurrentV0->GetParamN()||!fCurrentV0->GetParamP())
return 0x0;
710 if(!fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex())||!fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))
return 0x0;
711 if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))->Charge()==
charge){
712 tracklabel=fCurrentV0->GetPindex();
713 return fCurrentV0->GetParamP();}
714 if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex()))->Charge()==
charge){
715 tracklabel=fCurrentV0->GetNindex();
716 return fCurrentV0->GetParamN();}
732 for(
Int_t currentV0Index=0;currentV0Index<fESDEvent->GetNumberOfV0s();currentV0Index++){
733 AliESDv0 *fCurrentV0=(AliESDv0*)(fESDEvent->GetV0(currentV0Index));
735 printf(
"Requested V0 does not exist");
739 fCurrentMotherKFCandidate=ReconstructV0(fCurrentV0,currentV0Index);
741 if(fCurrentMotherKFCandidate){
744 if(kUseAODConversionPhoton){
745 new((*fConversionGammas)[fConversionGammas->GetEntriesFast()])
AliAODConversionPhoton(fCurrentMotherKFCandidate);
747 currentConversionPhoton->
SetMass(fCurrentMotherKFCandidate->
M());
748 if (fUseMassToZero) currentConversionPhoton->
SetMassToZero();
750 if(kAddv0sInESDFilter){fPCMv0BitField->SetBitNumber(currentV0Index, kTRUE);}
752 new((*fConversionGammas)[fConversionGammas->GetEntriesFast()])
AliKFConversionPhoton(*fCurrentMotherKFCandidate);
755 delete fCurrentMotherKFCandidate;
756 fCurrentMotherKFCandidate=NULL;
759 if(kAddv0sInESDFilter){fPCMv0BitField->Compact();}
772 if(!fConversionCuts->SelectV0Finder(fCurrentV0->GetOnFlyStatus())){
777 if (fMCEvent && fProduceV0findingEffi ) FillRecMCHistosForV0FinderEffiESD(fCurrentV0);
780 Int_t currentTrackLabels[2]={-1,-1};
784 const AliExternalTrackParam *fCurrentExternalTrackParamPositive=GetExternalTrackParamP(fCurrentV0,currentTrackLabels[0]);
786 const AliExternalTrackParam *fCurrentExternalTrackParamNegative=GetExternalTrackParamN(fCurrentV0,currentTrackLabels[1]);
788 if(!fCurrentExternalTrackParamPositive||!fCurrentExternalTrackParamNegative)
return 0x0;
792 AliVTrack * posTrack = fConversionCuts->GetTrack(fInputEvent,currentTrackLabels[0]);
793 AliVTrack * negTrack = fConversionCuts->GetTrack(fInputEvent,currentTrackLabels[1]);
794 if(!negTrack || !posTrack) {
799 if(!fConversionCuts->TracksAreSelected(negTrack, posTrack)){
804 fConversionCuts->FillV0EtaBeforedEdxCuts(fCurrentV0->Eta());
805 if (!fConversionCuts->dEdxCuts(posTrack)) {
810 if(!fConversionCuts->dEdxCuts(negTrack)) {
814 fConversionCuts->FillV0EtaAfterdEdxCuts(fCurrentV0->Eta());
819 AliKFParticle fCurrentNegativeKFParticle(*(fCurrentExternalTrackParamNegative),11);
821 AliKFParticle fCurrentPositiveKFParticle(*(fCurrentExternalTrackParamPositive),-11);
827 if(fUseConstructGamma){
829 fCurrentMotherKF->
ConstructGamma(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle);
832 fCurrentMotherKF->SetMassConstraint(0,0.0001);
837 fCurrentMotherKF->
SetTrackLabels(currentTrackLabels[0],currentTrackLabels[1]);
853 TParticle *fNegativeMCParticle = 0x0;
854 if(labeln>-1) fNegativeMCParticle = fMCEvent->Particle(labeln);
855 TParticle *fPositiveMCParticle = 0x0;
856 if(labelp>-1) fPositiveMCParticle = fMCEvent->Particle(labelp);
858 if(fPositiveMCParticle&&fNegativeMCParticle){
866 if(fUseImprovedVertex == kTRUE){
867 AliKFVertex primaryVertexImproved(*fInputEvent->GetPrimaryVertex());
869 primaryVertexImproved+=*fCurrentMotherKF;
870 fCurrentMotherKF->SetProductionVertex(primaryVertexImproved);
874 if (fImprovedPsiPair == 0){
875 Double_t PsiPair=GetPsiPair(fCurrentV0,fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative, convpos);
881 if(fUseOwnXYZCalculation){
883 if(!GetConversionPoint(fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative,convpos,dca)){
885 delete fCurrentMotherKF;
886 fCurrentMotherKF=NULL;
895 if (fImprovedPsiPair >= 1){
897 Double_t PsiPair=GetPsiPair(fCurrentV0,fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative,convpos);
902 if(fCurrentMotherKF->GetNDF() > 0.)
903 fCurrentMotherKF->
SetChi2perNDF(fCurrentMotherKF->GetChi2()/fCurrentMotherKF->GetNDF());
907 fCurrentMotherKF->
SetMass(fCurrentMotherKF->
M());
910 Double_t mass=-99.0, mass_width=-99.0, Pt=-99.0, Pt_width=-99.0;
911 AliKFParticle fCurrentMotherKFForMass(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle);
912 fCurrentMotherKFForMass.GetMass(mass,mass_width);
913 fCurrentMotherKFForMass.GetPt(Pt,Pt_width);
914 fCurrentInvMassPair=
mass;
917 if (!fConversionCuts->KappaCuts(fCurrentMotherKF,fInputEvent)){
919 delete fCurrentMotherKF;
920 fCurrentMotherKF=NULL;
925 if(!fConversionCuts->PhotonCuts(fCurrentMotherKF,fInputEvent)){
927 delete fCurrentMotherKF;
928 fCurrentMotherKF=NULL;
934 if(fProduceImpactParamHistograms) FillImpactParamHistograms(posTrack, negTrack, fCurrentV0, fCurrentMotherKF);
937 return fCurrentMotherKF;
946 AliExternalTrackParam nt(*negativeparam);
947 AliExternalTrackParam pt(*positiveparam);
949 Float_t magField = fInputEvent->GetMagneticField();
952 if (fImprovedPsiPair==0 ) {
953 v0->GetXYZ(xyz[0],xyz[1],xyz[2]);
954 }
else if (fImprovedPsiPair>=1 ) {
1021 v0->GetNPxPyPz(mn[0],mn[1],mn[2]);
1022 v0->GetPPxPyPz(mp[0],mp[1],mp[2]);
1025 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));
1026 Double_t radiussum = TMath::Sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1]) + 50;
1037 if (fImprovedPsiPair==1 || fImprovedPsiPair==0 ){
1038 if(nt.PropagateTo(radiussum,magField) == 0)
return psiPair;
1039 if(pt.PropagateTo(radiussum,magField) == 0)
return psiPair;
1041 pt.GetPxPyPz(momPosProp);
1042 nt.GetPxPyPz(momNegProp);
1043 }
else if (fImprovedPsiPair>=2) {
1044 momPosProp[0] = pt.GetParameterAtRadius(radiussum,magField,3);
1045 momPosProp[1] = pt.GetParameterAtRadius(radiussum,magField,4);
1046 momPosProp[2] = pt.GetParameterAtRadius(radiussum,magField,5);
1048 momNegProp[0] = nt.GetParameterAtRadius(radiussum,magField,3);
1049 momNegProp[1] = nt.GetParameterAtRadius(radiussum,magField,4);
1050 momNegProp[2] = nt.GetParameterAtRadius(radiussum,magField,5);
1051 pEle = TMath::Sqrt(momNegProp[0]*momNegProp[0]+momNegProp[1]*momNegProp[1]+momNegProp[2]*momNegProp[2]);
1053 pPos = TMath::Sqrt(momPosProp[0]*momPosProp[0]+momPosProp[1]*momPosProp[1]+momPosProp[2]*momPosProp[2]);
1055 if ( (pEle==0 || pPos==0) && fImprovedPsiPair==3) {
1056 radiussum = TMath::Sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1]) + 30;
1057 momPosProp[0] = pt.GetParameterAtRadius(radiussum,magField,3);
1058 momPosProp[1] = pt.GetParameterAtRadius(radiussum,magField,4);
1059 momPosProp[2] = pt.GetParameterAtRadius(radiussum,magField,5);
1061 momNegProp[0] = nt.GetParameterAtRadius(radiussum,magField,3);
1062 momNegProp[1] = nt.GetParameterAtRadius(radiussum,magField,4);
1063 momNegProp[2] = nt.GetParameterAtRadius(radiussum,magField,5);
1068 pEle = TMath::Sqrt(momNegProp[0]*momNegProp[0]+momNegProp[1]*momNegProp[1]+momNegProp[2]*momNegProp[2]);
1069 pPos = TMath::Sqrt(momPosProp[0]*momPosProp[0]+momPosProp[1]*momPosProp[1]+momPosProp[2]*momPosProp[2]);
1072 momPosProp[0]*momNegProp[0]+momPosProp[1]*momNegProp[1]+momPosProp[2]*momNegProp[2];
1074 if (pEle==0 || pPos==0)
return psiPair;
1077 Double_t chipair = TMath::ACos(scalarproduct/(pEle*pPos));
1080 psiPair = TMath::ASin(deltat/chipair);
1090 Double_t b=fInputEvent->GetMagneticField();
1093 track->GetHelixParameters(helix,b);
1097 Double_t radius = TMath::Abs(1./helix[4]);
1101 phi = phi + 2*TMath::Pi();
1104 phi -= TMath::Pi()/2.;
1105 Double_t xpoint = radius * TMath::Cos(phi);
1106 Double_t ypoint = radius * TMath::Sin(phi);
1120 center[0] = xpos + xpoint;
1121 center[1] = ypos + ypoint;
1130 if(!pparam||!nparam)
return kFALSE;
1133 GetHelixCenter(pparam,helixcenterpos);
1136 GetHelixCenter(nparam,helixcenterneg);
1139 pparam->GetHelixParameters(helixpos,fInputEvent->GetMagneticField());
1140 Double_t posradius = TMath::Abs(1./helixpos[4]);
1143 nparam->GetHelixParameters(helixneg,fInputEvent->GetMagneticField());
1144 Double_t negradius = TMath::Abs(1./helixneg[4]);
1153 convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
1154 convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius);
1159 Double_t deltaXPos = convpos[0] - xpos;
1160 Double_t deltaYPos = convpos[1] - ypos;
1162 Double_t deltaXNeg = convpos[0] - xneg;
1163 Double_t deltaYNeg = convpos[1] - yneg;
1165 Double_t alphaPos = TMath::Pi() + TMath::ATan2(-deltaYPos,-deltaXPos);
1166 Double_t alphaNeg = TMath::Pi() + TMath::ATan2(-deltaYNeg,-deltaXNeg);
1168 Double_t vertexXNeg = xneg + TMath::Abs(negradius)*TMath::Cos(alphaNeg);
1169 Double_t vertexYNeg = yneg + TMath::Abs(negradius)*TMath::Sin(alphaNeg);
1171 Double_t vertexXPos = xpos + TMath::Abs(posradius)*TMath::Cos(alphaPos);
1172 Double_t vertexYPos = ypos + TMath::Abs(posradius)*TMath::Sin(alphaPos);
1174 AliExternalTrackParam p(*pparam);
1175 AliExternalTrackParam n(*nparam);
1177 TVector2 vertexPos(vertexXPos,vertexYPos);
1178 TVector2 vertexNeg(vertexXNeg,vertexYNeg);
1181 TVector2 vertexPosRot=vertexPos.Rotate(-p.GetAlpha());
1182 TVector2 vertexNegRot=vertexNeg.Rotate(-n.GetAlpha());
1186 if(!p.PropagateTo(vertexPosRot.X(),fInputEvent->GetMagneticField()))
return kFALSE;
1187 if(!n.PropagateTo(vertexNegRot.X(),fInputEvent->GetMagneticField()))
return kFALSE;
1191 if(TMath::Abs(vertexPos.Mod()-TMath::Sqrt(p.GetX()*p.GetX()+p.GetY()*p.GetY()))>0.01)
return kFALSE;
1192 if(TMath::Abs(vertexNeg.Mod()-TMath::Sqrt(n.GetX()*n.GetX()+n.GetY()*n.GetY()))>0.01)
return kFALSE;
1196 convpos[2] = (p.GetZ()*negradius+n.GetZ()*posradius)/(negradius+posradius);
1199 TVector2 vdca=vertexPos-vertexNeg;
1201 dca[1]=TMath::Abs(n.GetZ()-p.GetZ());
1215 if(fConversionGammas == NULL){
1216 fConversionGammas =
new TClonesArray(
"AliAODConversionPhoton",100);
1218 fConversionGammas->Delete();
1224 TClonesArray *fInputGammas=
dynamic_cast<TClonesArray*
>(fAODEvent->FindListObject(fDeltaAODBranchName.Data()));
1227 FindDeltaAODBranchName();
1228 fInputGammas=
dynamic_cast<TClonesArray*
>(fAODEvent->FindListObject(fDeltaAODBranchName.Data()));}
1229 if(!fInputGammas){AliError(
"No Gamma Satellites found");
return kFALSE;}
1232 for(
Int_t i=0;i<fInputGammas->GetEntriesFast();i++){
1235 if(fRelabelAODs)RelabelAODPhotonCandidates(gamma);
1236 if(fConversionCuts->PhotonIsSelected(gamma,fInputEvent)){
1243 if(fConversionGammas->GetEntries()){
return kTRUE;}
1254 for(
Int_t ii=0;ii<list->GetEntries();ii++){
1255 TString name((list->At(ii))->GetName());
1256 if(name.BeginsWith(fDeltaAODBranchName)&&name.EndsWith(
"gamma")){
1257 fDeltaAODBranchName=name;
1258 AliInfo(Form(
"Set DeltaAOD BranchName to: %s",fDeltaAODBranchName.Data()));
1267 if(fPreviousV0ReaderPerformsAODRelabeling == 2)
return;
1268 else if(fPreviousV0ReaderPerformsAODRelabeling == 0){
1269 printf(
"Running AODs! Determine if V0Reader '%s' should perform relabeling\n",this->GetName());
1271 Int_t iPosition = obj->IndexOf(
this);
1272 Bool_t prevV0ReaderRunningButNotRelabeling = kFALSE;
1273 for(
Int_t i=iPosition-1; i>=0; i--){
1274 if( (obj->At(i))->IsA() == AliV0ReaderV1::Class()){
1277 fPreviousV0ReaderPerformsAODRelabeling = 2;
1278 prevV0ReaderRunningButNotRelabeling = kFALSE;
1279 printf(
"V0Reader '%s' is running before this V0Reader '%s': do _NOT_ relabel AODs by current reader!\n",tempReader->GetName(),this->GetName());
1281 }
else prevV0ReaderRunningButNotRelabeling = kTRUE;
1284 if(prevV0ReaderRunningButNotRelabeling) AliFatal(Form(
"There are V0Readers before '%s', but none of them is relabeling!",this->GetName()));
1286 if(fPreviousV0ReaderPerformsAODRelabeling == 2)
return;
1288 printf(
"This V0Reader '%s' is first to be processed: do relabel AODs by current reader!\n",this->GetName());
1289 fPreviousV0ReaderPerformsAODRelabeling = 1;
1293 if(fPreviousV0ReaderPerformsAODRelabeling != 1) AliFatal(Form(
"In %s: fPreviousV0ReaderPerformsAODRelabeling = '%i' - while it should be impossible it is something different than '1'!",this->GetName(),fPreviousV0ReaderPerformsAODRelabeling));
1298 Bool_t AODLabelPos = kFALSE;
1299 Bool_t AODLabelNeg = kFALSE;
1301 for(
Int_t i = 0; i<fInputEvent->GetNumberOfTracks();i++){
1302 AliAODTrack *tempDaughter =
static_cast<AliAODTrack*
>(fInputEvent->GetTrack(i));
1307 AODLabelPos = kTRUE;
1314 AODLabelNeg = kTRUE;
1317 if(AODLabelNeg && AODLabelPos){
1321 if(!AODLabelPos || !AODLabelNeg){
1354 if(fInputEvent->IsA()==AliESDEvent::Class()){
1355 static AliESDtrackCuts *EsdTrackCuts = 0x0;
1356 static int prevRun = -1;
1358 Int_t runNumber = fInputEvent->GetRunNumber();
1360 if (prevRun!=runNumber) {
1361 delete EsdTrackCuts;
1363 prevRun = runNumber;
1365 if (!EsdTrackCuts) {
1367 if( (runNumber<=146860) || (runNumber>=197470 && runNumber<=197692) || (runNumber>=172440 && runNumber<=193766) ){
1368 EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
1370 }
else if (runNumber>=209122){
1373 EsdTrackCuts =
new AliESDtrackCuts();
1375 EsdTrackCuts->AliESDtrackCuts::SetMinNCrossedRowsTPC(70);
1376 EsdTrackCuts->AliESDtrackCuts::SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
1377 EsdTrackCuts->SetCutGeoNcrNcl(2., 130., 1.5, 0.0, 0.0);
1379 EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterTPC(4);
1380 EsdTrackCuts->AliESDtrackCuts::SetAcceptKinkDaughters(kFALSE);
1381 EsdTrackCuts->AliESDtrackCuts::SetRequireTPCRefit(kTRUE);
1383 EsdTrackCuts->AliESDtrackCuts::SetRequireITSRefit(kTRUE);
1384 EsdTrackCuts->AliESDtrackCuts::SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1385 AliESDtrackCuts::kAny);
1386 EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexXYPtDep(
"0.0105+0.0350/pt^1.1");
1387 EsdTrackCuts->AliESDtrackCuts::SetMaxChi2TPCConstrainedGlobal(36);
1388 EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexZ(2);
1389 EsdTrackCuts->AliESDtrackCuts::SetDCAToVertex2D(kFALSE);
1390 EsdTrackCuts->AliESDtrackCuts::SetRequireSigmaToVertex(kFALSE);
1391 EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterITS(36);
1394 EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011();
1396 EsdTrackCuts->SetMaxDCAToVertexZ(2);
1397 EsdTrackCuts->SetEtaRange(-0.8, 0.8);
1398 EsdTrackCuts->SetPtRange(0.15);
1400 fNumberOfPrimaryTracks = 0;
1401 for(
Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
1402 AliESDtrack* curTrack = (AliESDtrack*) fInputEvent->GetTrack(iTracks);
1403 if(!curTrack)
continue;
1404 if(!EsdTrackCuts->AcceptTrack(curTrack))
continue;
1406 fNumberOfPrimaryTracks++;
1409 else if(fInputEvent->IsA()==AliAODEvent::Class()){
1410 fNumberOfPrimaryTracks = 0;
1411 for(
Int_t iTracks = 0; iTracks<fInputEvent->GetNumberOfTracks(); iTracks++){
1412 AliAODTrack* curTrack = (AliAODTrack*) fInputEvent->GetTrack(iTracks);
1413 if(curTrack->GetID()<0)
continue;
1414 if(!curTrack->IsHybridGlobalConstrainedGlobal())
continue;
1415 if(TMath::Abs(curTrack->Eta())>0.8)
continue;
1416 if(curTrack->Pt()<0.15)
continue;
1419 fNumberOfPrimaryTracks++;
1428 fNumberOfTPCoutTracks = 0;
1430 for (
Int_t itrk = 0; itrk < fInputEvent->GetNumberOfTracks(); itrk++) {
1431 AliVTrack *trk =
dynamic_cast<AliVTrack*
>(fInputEvent->GetTrack(itrk));
1435 if (!(trk->Pt() < 0.15) && (TMath::Abs(trk->Eta()) < 0.8)) {
1436 if ((trk->GetStatus() & AliVTrack::kTPCout) == AliVTrack::kTPCout) {
1437 fNumberOfTPCoutTracks++;
1450 if(!mcEvent)
return kFALSE;
1452 if (particle->GetPdgCode() == 22){
1454 if( TMath::Abs(particle->Eta()) > etaMax )
return kFALSE;
1456 if(particle->GetMother(0) >-1 && mcEvent->Particle(particle->GetMother(0))->GetPdgCode() == 22){
1460 TParticle* ePos = NULL;
1461 TParticle* eNeg = NULL;
1462 if(particle->GetNDaughters() >= 2){
1463 for(
Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
1464 if(daughterIndex<0)
continue;
1465 TParticle *tmpDaughter = mcEvent->Particle(daughterIndex);
1466 if(tmpDaughter->GetUniqueID() == 5){
1467 if(tmpDaughter->GetPdgCode() == 11){
1469 }
else if(tmpDaughter->GetPdgCode() == -11){
1475 if(ePos == NULL || eNeg == NULL){
1479 if( TMath::Abs(ePos->Eta()) > etaMax ||
1480 TMath::Abs(eNeg->Eta()) > etaMax )
1484 if(ePos->R() > rMax){
1487 if(TMath::Abs(ePos->Vz()) > zMax){
1490 if(TMath::Abs(eNeg->Vz()) > zMax){
1495 Double_t lineCutZRSlope = tan(2*atan(exp(-etaMax)));
1497 if( ePos->R() <= ((TMath::Abs(ePos->Vz()) * lineCutZRSlope) - lineCutZValue)){
1500 if( eNeg->R() <= ((TMath::Abs(eNeg->Vz()) * lineCutZRSlope) - lineCutZValue)){
1503 if (ePos->Pt() < 0.05 || eNeg->Pt() < 0.05){
1514 const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
1515 Double_t mcProdVtxX = primVtxMC->GetX();
1516 Double_t mcProdVtxY = primVtxMC->GetY();
1517 Double_t mcProdVtxZ = primVtxMC->GetZ();
1521 for(Long_t i = 0; i < fMCEvent->GetNumberOfTracks(); i++) {
1522 if (fEventCuts->IsConversionPrimaryESD( fMCEvent, i, mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
1524 TParticle* particle = (TParticle *)fMCEvent->Particle(i);
1525 if (!particle)
continue;
1526 if (ParticleIsConvertedPhoton(fMCEvent, particle, 0.9, 180.,250. )){
1527 if(particle->GetFirstDaughter()<0)
continue;
1528 TParticle *tmpDaughter = fMCEvent->Particle(particle->GetFirstDaughter());
1529 if (!tmpDaughter)
continue;
1530 fHistoMCGammaPtvsR->Fill(particle->Pt(),tmpDaughter->R());
1531 fHistoMCGammaPtvsPhi->Fill(particle->Pt(),particle->Phi());
1532 fHistoMCGammaRvsPhi->Fill(tmpDaughter->R(),particle->Phi());
1534 if (ParticleIsConvertedPhoton(fMCEvent, particle, 1.4, 180.,250. )){
1535 if(particle->GetFirstDaughter()<0)
continue;
1536 TParticle *tmpDaughter = fMCEvent->Particle(particle->GetFirstDaughter());
1537 if (!tmpDaughter)
continue;
1538 fHistoMCGammaPtvsEta->Fill(particle->Pt(),particle->Eta());
1539 fHistoMCGammaRvsEta->Fill(tmpDaughter->R(),particle->Eta());
1540 fHistoMCGammaPhivsEta->Fill(particle->Phi(),particle->Eta());
1549 const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
1550 Double_t mcProdVtxX = primVtxMC->GetX();
1551 Double_t mcProdVtxY = primVtxMC->GetY();
1552 Double_t mcProdVtxZ = primVtxMC->GetZ();
1555 Int_t tracklabelPos=currentV0->GetPindex();
1556 Int_t tracklabelNeg=currentV0->GetNindex();
1558 Int_t labelp=TMath::Abs(fConversionCuts->GetTrack(fInputEvent,tracklabelPos)->GetLabel());
1559 Int_t labeln=TMath::Abs(fConversionCuts->GetTrack(fInputEvent,tracklabelNeg)->GetLabel());
1561 TParticle* negPart = 0x0;
1562 if(labeln>-1) negPart = (TParticle *)fMCEvent->Particle(labeln);
1563 TParticle* posPart = 0x0;
1564 if(labelp>-1) posPart = (TParticle *)fMCEvent->Particle(labelp);
1566 if ( negPart == NULL || posPart == NULL )
return;
1569 Long_t motherlabelNeg = negPart->GetFirstMother();
1570 Long_t motherlabelPos = posPart->GetFirstMother();
1573 if (motherlabelNeg>-1 && motherlabelNeg == motherlabelPos && negPart->GetFirstMother() != -1){
1574 if (fEventCuts->IsConversionPrimaryESD( fMCEvent, negPart->GetFirstMother(), mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
1576 TParticle* mother = (TParticle *)fMCEvent->Particle(motherlabelNeg);
1577 if (mother->GetPdgCode() == 22 ){
1578 if (!CheckVectorForDoubleCount(fVectorFoundGammas,motherlabelNeg ) ){
1579 if (ParticleIsConvertedPhoton(fMCEvent, mother, 0.9, 180.,250. )){
1580 fHistoRecMCGammaPtvsR->Fill(mother->Pt(),negPart->R());
1581 fHistoRecMCGammaPtvsPhi->Fill(mother->Pt(),mother->Phi());
1582 fHistoRecMCGammaRvsPhi->Fill(negPart->R(),mother->Phi());
1584 if (ParticleIsConvertedPhoton(fMCEvent, mother, 1.4, 180.,250. )){
1585 fHistoRecMCGammaPtvsEta->Fill(mother->Pt(),mother->Eta());
1586 fHistoRecMCGammaRvsEta->Fill(negPart->R(),mother->Eta());
1587 fHistoRecMCGammaPhivsEta->Fill(mother->Phi(),mother->Eta());
1591 if (ParticleIsConvertedPhoton(fMCEvent, mother, 0.9, 180.,250. )){
1592 fHistoRecMCGammaMultiPt->Fill(mother->Pt());
1593 fHistoRecMCGammaMultiPhi->Fill(mother->Phi());
1594 fHistoRecMCGammaMultiR->Fill(negPart->R());
1596 if (ParticleIsConvertedPhoton(fMCEvent, mother, 1.4, 180.,250. )){
1597 fHistoRecMCGammaMultiPtvsEta->Fill(mother->Pt(),mother->Eta());
1615 Int_t kMaxTPCV0Conflicts = 1;
1619 fCurrentV0->GetXYZ(convX,convY,convZ);
1620 Double_t convR = TMath::Sqrt(convX*convX+convY*convY);
1628 fHistoImpactParameterStudy->Fill(0);
1631 AliESDtrack* positiveTrack = (AliESDtrack*) pTrack;
1632 AliESDtrack* negativeTrack = (AliESDtrack*) nTrack;
1634 if (!positiveTrack->IsOn(AliESDtrack::kITSin) && !negativeTrack->IsOn(AliESDtrack::kITSin)){
1635 fHistoImpactParameterStudy->Fill(1);
1639 Bool_t RemovedByZcut = kFALSE;
1640 Bool_t RemovedByYcut = kFALSE;
1645 if(((TMath::Abs(positiveTrack->GetZ()))>fZmax) || ((TMath::Abs(negativeTrack->GetZ()))>fZmax)){
1646 fHistoImpactParameterStudy->Fill(2);
1647 RemovedByZcut=kTRUE;
1651 if(((TMath::Abs(positiveTrack->GetY()))>fYmax) || ((TMath::Abs(negativeTrack->GetY()))>fYmax)){
1652 fHistoImpactParameterStudy->Fill(3);
1653 RemovedByYcut=kTRUE;
1658 Bool_t RemovedByCausality=kFALSE;
1661 85.225, 85.975, 86.725, 87.475, 88.225, 88.975, 89.725, 90.475, 91.225, 91.975, 92.725, 93.475, 94.225, 94.975, 95.725,
1662 96.475, 97.225, 97.975, 98.725, 99.475,100.225,100.975,101.725,102.475,103.225,103.975,104.725,105.475,106.225,106.975,
1663 107.725,108.475,109.225,109.975,110.725,111.475,112.225,112.975,113.725,114.475,115.225,115.975,116.725,117.475,118.225,
1664 118.975,119.725,120.475,121.225,121.975,122.725,123.475,124.225,124.975,125.725,126.475,127.225,127.975,128.725,129.475,
1665 130.225,130.975,131.725,135.100,136.100,137.100,138.100,139.100,140.100,141.100,142.100,143.100,144.100,145.100,146.100,
1666 147.100,148.100,149.100,150.100,151.100,152.100,153.100,154.100,155.100,156.100,157.100,158.100,159.100,160.100,161.100,
1667 162.100,163.100,164.100,165.100,166.100,167.100,168.100,169.100,170.100,171.100,172.100,173.100,174.100,175.100,176.100,
1668 177.100,178.100,179.100,180.100,181.100,182.100,183.100,184.100,185.100,186.100,187.100,188.100,189.100,190.100,191.100,
1669 192.100,193.100,194.100,195.100,196.100,197.100,198.100,199.350,200.850,202.350,203.850,205.350,206.850,208.350,209.850,
1670 211.350,212.850,214.350,215.850,217.350,218.850,220.350,221.850,223.350,224.850,226.350,227.850,229.350,230.850,232.350,
1671 233.850,235.350,236.850,238.350,239.850,241.350,242.850,244.350,245.850};
1674 fHistoR->Fill(convR);
1675 fHistoRrecalc->Fill(convRrecalc);
1676 Double_t alpha = TMath::ATan2(convY,convX);
1677 if (alpha<0) alpha += TMath::Pi()*2;
1678 Int_t sec = alpha/(TMath::Pi()/9);
1679 alpha = (10.+sec*20.)*TMath::DegToRad();
1682 Double_t xsV0 = convX*cs - convY*sn;
1683 fHistoRviaAlpha->Fill(xsV0);
1684 Double_t alpha_r = TMath::ATan2(convYrecalc,convXrecalc);
1685 if (alpha_r<0) alpha_r += TMath::Pi()*2;
1686 Int_t sec_r = alpha_r/(TMath::Pi()/9);
1687 alpha_r = (10.+sec_r*20.)*TMath::DegToRad();
1688 Double_t cs_r = TMath::Cos(alpha_r);
1689 Double_t sn_r = TMath::Sin(alpha_r);
1690 Double_t xsV0_r = convXrecalc*cs_r - convYrecalc*sn_r;
1691 fHistoRviaAlphaRecalc->Fill(xsV0_r);
1694 fHistoImpactParameterStudy->Fill(4);
1696 for (
Int_t it=2;it--;) {
1697 Int_t trId = fCurrentV0->GetIndex(it);
1698 AliESDtrack* tr = fESDEvent->GetTrack(trId);
1699 const TBits& bits = tr->GetTPCClusterMap();
1700 Int_t nConflict = 0;
1701 for (
Int_t ic=0;ic<159;ic++) {
1702 if (rTPC[ic]>(xsV0-kTPCMargin))
break;
1703 if (bits.TestBitNumber(ic)){
1705 fHistoRdiff->Fill(xsV0-rTPC[ic]);
1707 if (nConflict>kMaxTPCV0Conflicts) {
1708 fHistoImpactParameterStudy->Fill(5);
1709 RemovedByCausality=kTRUE;
1717 Bool_t RemovedByAnyCut=kFALSE;
1718 if(RemovedByZcut||RemovedByYcut||RemovedByCausality){
1719 fHistoImpactParameterStudy->Fill(6);
1720 RemovedByAnyCut=kTRUE;
1733 fImpactParamTree->Branch(
"posPt",&posPt,
"posPt/F");
1734 fImpactParamTree->Branch(
"posY",&posY,
"posY/F");
1735 fImpactParamTree->Branch(
"R",&R,
"R/F");
1736 posZ = positiveTrack->GetZ();
1737 posY = positiveTrack->GetY();
1738 posX = positiveTrack->GetX();
1739 posPt = positiveTrack->Pt();
1740 negZ = negativeTrack->GetZ();
1741 negY = negativeTrack->GetY();
1742 negX = negativeTrack->GetX();
1743 negPt = negativeTrack->Pt();
1745 fImpactParamTree->Fill();
1748 fHistoPosTrackImpactParamZ->Fill(posZ);
1749 fHistoPosTrackImpactParamY->Fill(posY);
1750 fHistoPosTrackImpactParamX->Fill(posX);
1751 fHistoPosTrackImpactParamZvsPt->Fill(posPt, posZ);
1752 fHistoPosTrackImpactParamYvsPt->Fill(posPt, posY);
1753 fHistoPosTrackImpactParamXvsPt->Fill(posPt, posX);
1754 fHistoNegTrackImpactParamZ->Fill(negZ);
1755 fHistoNegTrackImpactParamY->Fill(negY);
1756 fHistoNegTrackImpactParamX->Fill(negX);
1757 fHistoNegTrackImpactParamZvsPt->Fill(negPt, negZ);
1758 fHistoNegTrackImpactParamYvsPt->Fill(negPt, negY);
1759 fHistoNegTrackImpactParamXvsPt->Fill(negPt, negX);
1762 fHistoPt->Fill(positiveTrack->Pt());
1763 fHistoImpactParamZvsR->Fill(convZrecalc,convRrecalc);
1771 fHistoDCAzPhoton->Fill(DCAzPhoton);
1772 if(!RemovedByAnyCut) {
1773 fHistoPt2->Fill(positiveTrack->Pt());
1774 fHistoImpactParamZvsR2->Fill(convZrecalc,convRrecalc);
1775 fHistoDCAzPhoton2->Fill(DCAzPhoton);
1784 if(tobechecked > -1)
1786 vector<Int_t>::iterator it;
1787 it = find (vec.begin(), vec.end(), tobechecked);
1788 if (it != vec.end())
return true;
1797 if(tobechecked > -1)
1799 vector<Int_t>::iterator it;
1800 it = find (vec.begin(), vec.end(), tobechecked);
1801 if (it != vec.end())
return true;
1803 vec.push_back(tobechecked);
1819 fCurrentIndex(position),
1826 fkData(other.fkData),
1827 fCurrentIndex(other.fCurrentIndex),
1828 fDirection(other.fDirection)
1842 if(fkData != other.
fkData)
return true;
1877 return (*fkData)[fCurrentIndex];
Int_t IsReaderPerformingRelabeling()
Direction_t fDirection
Iterator in forward direction.
Bool_t ParticleIsConvertedPhoton(AliMCEvent *mcEvent, TParticle *particle, Double_t etaMax, Double_t rMax, Double_t zMax)
anchored LHC13[d-e] pass 2 - JJ
void FindDeltaAODBranchName()
void SetConversionPoint(Double_t convpoint[3])
Bool_t CheckVectorForDoubleCount(vector< Int_t > &vec, Int_t tobechecked)
void SetMCLabelNegative(Int_t label)
Bool_t AreAODsRelabeled()
const AliV0ReaderV1 * fkData
V0 reader used to iterate over.
void CreatePureMCHistosForV0FinderEffiESD()
TList * list
TDirectory file where lists per trigger are stored in train ouput.
AliConversionPhotonBase * operator*()
Double_t GetConversionZ() const
Float_t GetDCAzToPrimVtx() const
Double_t GetPsiPair(const AliESDv0 *v0, const AliExternalTrackParam *positiveparam, const AliExternalTrackParam *negativeparam, const Double_t convpos[3]) const
void FillRecMCHistosForV0FinderEffiESD(AliESDv0 *currentV0)
Bool_t CheckVectorOnly(vector< Int_t > &vec, Int_t tobechecked)
anchored LHC13g pass 1 - JJ
anchored LHC13g pass 1 - JJ
int fCurrentIndex
Index of the current element.
Bool_t ProcessEvent(AliVEvent *inputEvent, AliMCEvent *mcEvent=NULL)
void SetMCLabelPositive(Int_t label)
Int_t GetTrackLabelNegative() const
void ConstructGamma(const AliKFParticle &fCurrentNegativeKFParticle, const AliKFParticle &fCurrentPositiveKFParticle)
Int_t GetTrackLabelPositive() const
void SetV0Index(Int_t index)
void SetInvMassPair(Float_t mass)
iterator(const AliV0ReaderV1 *reader, Direction_t dir, int position)
Bool_t GetHelixCenter(const AliExternalTrackParam *track, Double_t center[2])
void RelabelAODPhotonCandidates(AliAODConversionPhoton *PhotonCandidate)
anchored LHC12[a-h] pass 2 - JJ
void SetChi2perNDF(Float_t chi2)
anchored LHC13[d-e] pass 2 - GJ
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
iterator & operator=(const iterator &other)
void SetMass(Float_t mass)
Double_t GetConversionY() const
anchored LHC13[d-e] pass 2 - JJ
void SetTrackLabels(Int_t label1, Int_t label2)
anchored LHC11a pass 4 - JJ
virtual void Terminate(Option_t *)
const AliExternalTrackParam * GetExternalTrackParam(AliESDv0 *fCurrentV0, Int_t &tracklabel, Int_t charge)
anchored LHC13g pass 1 - JJ
AliKFConversionPhoton * ReconstructV0(AliESDv0 *fCurrentV0, Int_t currentV0Index)
void SetLabelPositive(Int_t label)
Track labels.
void SetLabelNegative(Int_t label)
bool operator!=(iterator &other) const
TFile * file
TList with histograms for a given trigger.
anchored LHC12[a-h] pass 2 - JJ - additional stat
void SetPsiPair(Float_t PsiPair)
void FillImpactParamHistograms(AliVTrack *ptrack, AliVTrack *ntrack, AliESDv0 *fCurrentV0, AliKFConversionPhoton *fCurrentMotherKF)
AliConversionPhotonBase * operator[](int index) const
Array index operator.
anchored LHC11a pass 4 - JJ
Bool_t GetConversionPoint(const AliExternalTrackParam *pparam, const AliExternalTrackParam *nparam, Double_t convpos[3], Double_t dca[2])
Bool_t GetAODConversionGammas()
void UserCreateOutputObjects()
virtual void UserExec(Option_t *option)
Double_t GetConversionRadius() const
Double_t GetConversionX() const