]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/GammaConv/AliAnalysisTaskGammaConversion.cxx
changes from gsi. Using mult if no centrality. testfilterbit 128
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliAnalysisTaskGammaConversion.cxx
CommitLineData
d7d7e825 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2eedd4ed 3 * *
4 * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt *
5 * Version 1.1 *
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. *
d7d7e825 14 **************************************************************************/
15
16////////////////////////////////////////////////
17//---------------------------------------------
18// Class used to do analysis on conversion pairs
19//---------------------------------------------
2eedd4ed 20///////////////////////////////////////////////
d7d7e825 21
22// root
23#include <TChain.h>
24
25// analysis
26#include "AliAnalysisTaskGammaConversion.h"
27#include "AliStack.h"
28#include "AliLog.h"
3b77b2d1 29#include "TTree.h"
d7d7e825 30#include "AliESDtrackCuts.h"
31#include "TNtuple.h"
2eedd4ed 32//#include "AliCFManager.h" // for CF
33//#include "AliCFContainer.h" // for CF
9c1cb6f7 34#include "AliESDInputHandler.h"
35#include "AliAnalysisManager.h"
6441e967 36#include "AliAODPWG4Particle.h"
37#include "AliAODPWG4ParticleCorrelation.h"
2eedd4ed 38#include "AliAODConversionPhoton.h"
5e55d806 39#include "AliGammaConversionBGHandler.h"
6272370b 40#include "AliESDCaloCluster.h" // for combining PHOS and GammaConv
9c1cb6f7 41#include "AliKFVertex.h"
3c45d101 42#include "AliGenPythiaEventHeader.h"
3b77b2d1 43#include "AliGenDPMjetEventHeader.h"
3c45d101 44#include "AliGenEventHeader.h"
e60f3265 45#include <AliMCEventHandler.h>
77ac6f3e 46#include "TRandom3.h"
18a1e325 47#include "AliTriggerAnalysis.h"
b6dd6ad2 48#include "AliCentrality.h"
cc5a88a2 49#include "AliMultiplicity.h"
f0f3d4a1 50#include "AliAODHandler.h"
2eedd4ed 51#include "AliKFConversionPhoton.h"
52#include "AliKFConversionMother.h"
3b77b2d1 53#include "AliESDVertex.h"
54#include "AliESDTZERO.h"
77ac6f3e 55
d707e3cf 56class AliESDTrackCuts;
4a6157dc 57class AliCFContainer;
58class AliCFManager;
d7d7e825 59class AliKFVertex;
60class AliAODHandler;
61class AliAODEvent;
62class ALiESDEvent;
63class AliMCEvent;
64class AliMCEventHandler;
65class AliESDInputHandler;
66class AliAnalysisManager;
67class Riostream;
68class TFile;
69class TInterpreter;
70class TSystem;
71class TROOT;
72
73ClassImp(AliAnalysisTaskGammaConversion)
74
75
76AliAnalysisTaskGammaConversion::AliAnalysisTaskGammaConversion():
77AliAnalysisTaskSE(),
3b77b2d1 78 fpcstream(0x0),
2eedd4ed 79 fV0Reader(NULL),
80 fStack(NULL),
81 fMCTruth(NULL), // for CF
82 fGCMCEvent(NULL), // for CF
83 fESDEvent(NULL),
84 fOutputContainer(NULL),
85 fCFManager(0x0), // for CF
86 fHistograms(NULL),
87 fTriggerCINT1B(kFALSE),
88 fDoMCTruth(kFALSE),
89 fDoNeutralMeson(kFALSE),
90 fDoOmegaMeson(kFALSE),
91 fDoJet(kFALSE),
92 fDoChic(kFALSE),
3b77b2d1 93 fDoHadInt(kFALSE),
c2ce474e 94 fRecalculateV0ForGamma(kFALSE),
2eedd4ed 95 fKFReconstructedGammasTClone(NULL),
96 fKFReconstructedPi0sTClone(NULL),
c2ce474e 97 fKFRecalculatedGammasTClone(NULL),
2eedd4ed 98 fCurrentEventPosElectronTClone(NULL),
99 fCurrentEventNegElectronTClone(NULL),
100 fKFReconstructedGammasCutTClone(NULL),
101 fPreviousEventTLVNegElectronTClone(NULL),
102 fPreviousEventTLVPosElectronTClone(NULL),
103 // fElectronRecalculatedv1(),
104 // fElectronRecalculatedv2(),
105 fElectronMass(-1),
106 fGammaMass(-1),
107 fPi0Mass(-1),
108 fEtaMass(-1),
109 fGammaWidth(-1),
110 fPi0Width(-1),
111 fEtaWidth(-1),
112 fMinOpeningAngleGhostCut(0.),
113 fEsdTrackCuts(NULL),
114 fCalculateBackground(kFALSE),
115 fWriteNtuple(kFALSE),
116 fGammaNtuple(NULL),
117 fNeutralMesonNtuple(NULL),
118 fTotalNumberOfAddedNtupleEntries(0),
119 fChargedParticles(NULL),
120 fChargedParticlesId(),
121 fGammaPtHighest(0.),
122 fMinPtForGammaJet(1.),
123 fMinIsoConeSize(0.2),
124 fMinPtIsoCone(0.7),
125 fMinPtGamChargedCorr(0.5),
126 fMinPtJetCone(0.5),
127 fLeadingChargedIndex(-1),
128 fLowPtMapping(1.),
129 fHighPtMapping(3.),
130 fDoCF(kFALSE),
131 fAODGamma(NULL),
132 //fAODPi0(NULL),
133 //fAODOmega(NULL),
134 fAODBranchName("GammaConv"),
135 fKFCreateAOD(kTRUE),
3b77b2d1 136 fKFExchangeAOD(kFALSE),
2eedd4ed 137 fKFForceAOD(kFALSE),
138 fKFDeltaAODFileName(""),
139 fDoNeutralMesonV0MCCheck(kFALSE),
140 fUseTrackMultiplicityForBG(kTRUE),
141 fMoveParticleAccordingToVertex(kFALSE),
142 fApplyChi2Cut(kFALSE),
143 fNRandomEventsForBG(15),
144 fNDegreesPMBackground(15),
145 fDoRotation(kTRUE),
146 fCheckBGProbability(kTRUE),
147 fRemovePileUp(kFALSE),
148 fSelectV0AND(kFALSE),
149 fTriggerAnalysis(NULL),
150 fMultiplicity(0),
151 fUseMultiplicity(0),
152 fUseMultiplicityBin(0),
153 fUseHBTMultiplicity(0),
154 fUseHBTMultiplicityBin(0),
155 fUseCentrality(0),
156 fUseCentralityBin(0),
3b77b2d1 157 fRandom(0),
158 fMaxChi2HadInt(100.),
159 fMaxErr2DHadInt(10.),
160 fPtMinHadInt(0.3)
d7d7e825 161{
2eedd4ed 162 // Default constructor
5a34881d 163
2eedd4ed 164 /* Kenneth: the default constructor should not have any define input/output or the call to SetESDtrackCuts
165 // Common I/O in slot 0
166 DefineInput (0, TChain::Class());
167 DefineOutput(0, TTree::Class());
d7d7e825 168
2eedd4ed 169 // Your private output
170 DefineOutput(1, TList::Class());
a0b94e5c 171
2eedd4ed 172 // Define standard ESD track cuts for Gamma-hadron correlation
173 SetESDtrackCuts();
174 */
d7d7e825 175}
176
177AliAnalysisTaskGammaConversion::AliAnalysisTaskGammaConversion(const char* name):
2eedd4ed 178 AliAnalysisTaskSE(name),
3b77b2d1 179 fpcstream(0x0),
2eedd4ed 180 fV0Reader(NULL),
181 fStack(NULL),
182 fMCTruth(NULL), // for CF
183 fGCMCEvent(NULL), // for CF
184 fESDEvent(NULL),
185 fOutputContainer(0x0),
186 fCFManager(0x0), // for CF
187 fHistograms(NULL),
188 fTriggerCINT1B(kFALSE),
189 fDoMCTruth(kFALSE),
190 fDoNeutralMeson(kFALSE),
191 fDoOmegaMeson(kFALSE),
192 fDoJet(kFALSE),
193 fDoChic(kFALSE),
3b77b2d1 194 fDoHadInt(kFALSE),
c2ce474e 195 fRecalculateV0ForGamma(kFALSE),
2eedd4ed 196 fKFReconstructedGammasTClone(NULL),
197 fKFReconstructedPi0sTClone(NULL),
c2ce474e 198 fKFRecalculatedGammasTClone(NULL),
2eedd4ed 199 fCurrentEventPosElectronTClone(NULL),
200 fCurrentEventNegElectronTClone(NULL),
201 fKFReconstructedGammasCutTClone(NULL),
202 fPreviousEventTLVNegElectronTClone(NULL),
203 fPreviousEventTLVPosElectronTClone(NULL),
204 // fElectronRecalculatedv1(),
205 // fElectronRecalculatedv2(),
206 fElectronMass(-1),
207 fGammaMass(-1),
208 fPi0Mass(-1),
209 fEtaMass(-1),
210 fGammaWidth(-1),
211 fPi0Width(-1),
212 fEtaWidth(-1),
213 fMinOpeningAngleGhostCut(0.),
214 fEsdTrackCuts(NULL),
215 fCalculateBackground(kFALSE),
216 fWriteNtuple(kFALSE),
217 fGammaNtuple(NULL),
218 fNeutralMesonNtuple(NULL),
219 fTotalNumberOfAddedNtupleEntries(0),
220 fChargedParticles(NULL),
221 fChargedParticlesId(),
222 fGammaPtHighest(0.),
223 fMinPtForGammaJet(1.),
224 fMinIsoConeSize(0.2),
225 fMinPtIsoCone(0.7),
226 fMinPtGamChargedCorr(0.5),
227 fMinPtJetCone(0.5),
228 fLeadingChargedIndex(-1),
229 fLowPtMapping(1.),
230 fHighPtMapping(3.),
231 fDoCF(kFALSE),
232 fAODGamma(NULL),
233 //fAODPi0(NULL),
234 //fAODOmega(NULL),
235 fAODBranchName("GammaConv"),
236 fKFCreateAOD(kTRUE),
3b77b2d1 237 fKFExchangeAOD(kFALSE),
2eedd4ed 238 fKFForceAOD(kFALSE),
239 fKFDeltaAODFileName(""),
240 fDoNeutralMesonV0MCCheck(kFALSE),
241 fUseTrackMultiplicityForBG(kTRUE),
242 fMoveParticleAccordingToVertex(kFALSE),
243 fApplyChi2Cut(kFALSE),
244 fNRandomEventsForBG(15),
245 fNDegreesPMBackground(15),
246 fDoRotation(kTRUE),
247 fCheckBGProbability(kTRUE),
248 fRemovePileUp(kFALSE),
249 fSelectV0AND(kFALSE),
250 fTriggerAnalysis(NULL),
251 fMultiplicity(0),
252 fUseMultiplicity(0),
253 fUseMultiplicityBin(0),
254 fUseHBTMultiplicity(0),
255 fUseHBTMultiplicityBin(0),
256 fUseCentrality(0),
257 fUseCentralityBin(0),
3b77b2d1 258 fRandom(0),
259 fMaxChi2HadInt(100.),
260 fMaxErr2DHadInt(10.),
261 fPtMinHadInt(0.3)
d7d7e825 262{
2eedd4ed 263 // Common I/O in slot 0, don't define when inheriting from AnalysisTaskSE
264 // DefineInput (0, TChain::Class());
265 // DefineOutput(0, TTree::Class());
d7d7e825 266
2eedd4ed 267 // Your private output
268 DefineOutput(1, TList::Class());
269 DefineOutput(2, AliCFContainer::Class()); // for CF
3b77b2d1 270 DefineOutput(3, TClonesArray::Class());
a0b94e5c 271
2eedd4ed 272 // Define standard ESD track cuts for Gamma-hadron correlation
273 SetESDtrackCuts();
9c1cb6f7 274
d7d7e825 275}
276
277AliAnalysisTaskGammaConversion::~AliAnalysisTaskGammaConversion()
278{
2eedd4ed 279 // Remove all pointers
280
281 if(fOutputContainer){
282 fOutputContainer->Clear() ;
283 delete fOutputContainer ;
284 }
285 if(fHistograms){
286 delete fHistograms;
287 }
288 if(fV0Reader){
289 delete fV0Reader;
290 }
291
292 // for CF
293 if(fCFManager){
294 delete fCFManager;
295 }
296
297 if(fEsdTrackCuts){
298 delete fEsdTrackCuts;
299 }
300
301 //Delete AODs
302 if (fAODGamma) {
47ccbb03 303 fAODGamma->Delete();
2eedd4ed 304 delete fAODGamma;
305 }
306 fAODGamma = NULL;
307
308 /*if (fAODPi0) {
309 fAODPi0->Clear();
310 delete fAODPi0;
311 }
312 fAODPi0 = NULL;
313
314 if (fAODOmega) {
315 fAODOmega->Clear();
316 delete fAODOmega;
317 }
318 fAODOmega = NULL;
319 */
320 if(fTriggerAnalysis) {
321 delete fTriggerAnalysis;
322 }
3b77b2d1 323 if (fpcstream)
324 delete fpcstream;
325 fpcstream = NULL;
04bf4381 326}
d7d7e825 327
12464034 328
d7d7e825 329void AliAnalysisTaskGammaConversion::Init()
330{
2eedd4ed 331 // Initialization
332 // AliLog::SetGlobalLogLevel(AliLog::kError);
d7d7e825 333}
334void AliAnalysisTaskGammaConversion::SetESDtrackCuts()
335{
2eedd4ed 336 // SetESDtrackCuts
337 if (fEsdTrackCuts!=NULL){
338 delete fEsdTrackCuts;
339 }
340 fEsdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
341 //standard cuts from:
342 //http://aliceinfo.cern.ch/alicvs/viewvc/PWG0/dNdEta/CreateCuts.C?revision=1.4&view=markup
343
344 // Cuts used up to 3rd of March
345
346 // fEsdTrackCuts->SetMinNClustersTPC(50);
347 // fEsdTrackCuts->SetMaxChi2PerClusterTPC(3.5);
348 // fEsdTrackCuts->SetRequireTPCRefit(kTRUE);
349 // fEsdTrackCuts->SetRequireITSRefit(kTRUE);
350 // fEsdTrackCuts->SetMaxNsigmaToVertex(3);
351 // fEsdTrackCuts->SetRequireSigmaToVertex(kTRUE);
352
353 //------- To be tested-----------
354 // Cuts used up to 26th of Agost
355 // Int_t minNClustersTPC = 70;
356 // Double_t maxChi2PerClusterTPC = 4.0;
357 // Double_t maxDCAtoVertexXY = 2.4; // cm
358 // Double_t maxDCAtoVertexZ = 3.2; // cm
359 // fEsdTrackCuts->SetRequireSigmaToVertex(kFALSE);
360 // fEsdTrackCuts->SetRequireTPCRefit(kTRUE);
361 // fEsdTrackCuts->SetRequireITSRefit(kTRUE);
362 // // fEsdTrackCuts->SetRequireTPCStandAlone(kTRUE);
363 // fEsdTrackCuts->SetAcceptKinkDaughters(kFALSE);
364 // fEsdTrackCuts->SetMinNClustersTPC(minNClustersTPC);
365 // fEsdTrackCuts->SetMaxChi2PerClusterTPC(maxChi2PerClusterTPC);
366 // fEsdTrackCuts->SetMaxDCAToVertexXY(maxDCAtoVertexXY);
367 // fEsdTrackCuts->SetMaxDCAToVertexZ(maxDCAtoVertexZ);
368 // fEsdTrackCuts->SetDCAToVertex2D(kTRUE);
369 // fEsdTrackCuts->SetEtaRange(-0.8, 0.8);
370 // fEsdTrackCuts->SetPtRange(0.15);
371
372 // fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
373
374
375 // Using standard function for setting Cuts
376 Bool_t selectPrimaries=kTRUE;
377 fEsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
378 fEsdTrackCuts->SetMaxDCAToVertexZ(2);
379 fEsdTrackCuts->SetEtaRange(-0.8, 0.8);
380 fEsdTrackCuts->SetPtRange(0.15);
381
382 //----- From Jacek 10.03.03 ------------------/
383 // minNClustersTPC = 70;
384 // maxChi2PerClusterTPC = 4.0;
385 // maxDCAtoVertexXY = 2.4; // cm
386 // maxDCAtoVertexZ = 3.2; // cm
387
388 // esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
389 // esdTrackCuts->SetRequireTPCRefit(kFALSE);
390 // esdTrackCuts->SetRequireTPCStandAlone(kTRUE);
391 // esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
392 // esdTrackCuts->SetMinNClustersTPC(minNClustersTPC);
393 // esdTrackCuts->SetMaxChi2PerClusterTPC(maxChi2PerClusterTPC);
394 // esdTrackCuts->SetMaxDCAToVertexXY(maxDCAtoVertexXY);
395 // esdTrackCuts->SetMaxDCAToVertexZ(maxDCAtoVertexZ);
396 // esdTrackCuts->SetDCAToVertex2D(kTRUE);
397
398
399
400 // fEsdTrackCuts->SetAcceptKinkDaughters(kFALSE);
401 // fV0Reader->SetESDtrackCuts(fEsdTrackCuts);
d7d7e825 402}
403
c00009fb 404void AliAnalysisTaskGammaConversion::UserExec(Option_t */*option*/)
d7d7e825 405{
2eedd4ed 406 // Execute analysis for current event
407
408 // Load the esdpid from the esdhandler if exists (tender was applied) otherwise set the Bethe Bloch parameters
2eedd4ed 409
410 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
411 AliESDInputHandler *esdHandler=0x0;
412 if ( (esdHandler=dynamic_cast<AliESDInputHandler*>(man->GetInputEventHandler())) && esdHandler->GetESDpid() ){
413 AliV0Reader::SetESDpid(esdHandler->GetESDpid());
414 } else {
415 //load esd pid bethe bloch parameters depending on the existance of the MC handler
416 // yes: MC parameters
417 // no: data parameters
418 if (!AliV0Reader::GetESDpid()){
419 if (fMCEvent ) {
420 AliV0Reader::InitESDpid();
421 } else {
422 AliV0Reader::InitESDpid(1);
423 }
424 }
425 }
9c1cb6f7 426
47ccbb03 427 if(fAODGamma) fAODGamma->Delete();
3b77b2d1 428
48682642 429
7033a2a4 430 ///Make sure MC event is complete if present
2eedd4ed 431 if (fMCEvent ) {
7033a2a4 432 if( !CheckMCEvent() ) {
433 PostAODEvent();
434 return;
435 }
2eedd4ed 436 }
3b77b2d1 437
18a1e325 438
2eedd4ed 439 fV0Reader->SetInputAndMCEvent(InputEvent(), MCEvent());
5e55d806 440
3b77b2d1 441 //Process hadronic interactions
442 if(fDoHadInt == kTRUE){
443 ProcessHadronicInteraction(fESDEvent);
444 }
445
2eedd4ed 446 fV0Reader->Initialize();
447 fDoMCTruth = fV0Reader->GetDoMCTruth();
6272370b 448
2eedd4ed 449
450 if(fKFReconstructedGammasTClone == NULL){
451 fKFReconstructedGammasTClone = new TClonesArray("AliKFConversionPhoton",0);
452 }
453 if(fCurrentEventPosElectronTClone == NULL){
454 fCurrentEventPosElectronTClone = new TClonesArray("AliESDtrack",0);
455 }
456 if(fCurrentEventNegElectronTClone == NULL){
457 fCurrentEventNegElectronTClone = new TClonesArray("AliESDtrack",0);
458 }
459 if(fKFReconstructedGammasCutTClone == NULL){
460 fKFReconstructedGammasCutTClone = new TClonesArray("AliKFConversionPhoton",0);
461 }
462 if(fPreviousEventTLVNegElectronTClone == NULL){
463 fPreviousEventTLVNegElectronTClone = new TClonesArray("TLorentzVector",0);
464 }
465 if(fPreviousEventTLVPosElectronTClone == NULL){
466 fPreviousEventTLVPosElectronTClone = new TClonesArray("TLorentzVector",0);
467 }
468 if(fChargedParticles == NULL){
469 fChargedParticles = new TClonesArray("AliESDtrack",0);
470 }
6272370b 471
2eedd4ed 472 if(fKFReconstructedPi0sTClone == NULL){
473 fKFReconstructedPi0sTClone = new TClonesArray("AliKFConversionMother",0);
474 }
475
476/* if(fKFRecalculatedGammasTClone == NULL){
477 fKFRecalculatedGammasTClone = new TClonesArray("AliKFParticle",0);
478 }
479 */
480 if(fTriggerAnalysis== NULL){
481 fTriggerAnalysis = new AliTriggerAnalysis;
482 }
9c1cb6f7 483
2eedd4ed 484 //clear TClones
485 fKFReconstructedGammasTClone->Delete();
486 fCurrentEventPosElectronTClone->Delete();
487 fCurrentEventNegElectronTClone->Delete();
488 fKFReconstructedGammasCutTClone->Delete();
489 fPreviousEventTLVNegElectronTClone->Delete();
490 fPreviousEventTLVPosElectronTClone->Delete();
491 fKFReconstructedPi0sTClone->Delete();
492 // fKFRecalculatedGammasTClone->Delete();
5e55d806 493
2eedd4ed 494 //clear vectors
037dc2db 495
2eedd4ed 496 fChargedParticles->Delete();
cc5a88a2 497
2eedd4ed 498 fChargedParticlesId.clear();
b5832f95 499
22182c37 500
2eedd4ed 501 //Clear the data in the v0Reader
502 // fV0Reader->UpdateEventByEventData();
10e3319b 503
3b77b2d1 504
505 // Process the MC information
506 if(fDoMCTruth){
507 ProcessMCData();
508 }
509
510
511 if(!DoEventSelection()) {
512 PostAODEvent();
513 return;
514 }
515
516
517 //Process the v0 information with no cuts
518 ProcessV0sNoCut();
519
520 // Process the v0 information
521 ProcessV0s();
522
523
524 //Fill Gamma AOD
525 if(fKFCreateAOD) {
526 FillAODWithConversionGammas() ;
527 }
528
529
530 // Process reconstructed gammas
531 if(fDoNeutralMeson == kTRUE){
532 ProcessGammasForNeutralMesonAnalysis();
533
534 }
535
536 if(fDoMCTruth == kTRUE){
537 CheckV0Efficiency();
538 }
539 //Process reconstructed gammas electrons for Chi_c Analysis
540 if(fDoChic == kTRUE){
541 ProcessGammaElectronsForChicAnalysis();
542 }
543 // Process reconstructed gammas for gamma Jet/hadron correlations
544 if(fDoJet == kTRUE){
545 ProcessGammasForGammaJetAnalysis();
546 }
547
548 //calculate background if flag is set
549 if(fCalculateBackground){
550 CalculateBackground();
551 }
552
553 if(fDoNeutralMeson == kTRUE){
554 // ProcessConvPHOSGammasForNeutralMesonAnalysis();
555 if(fDoOmegaMeson == kTRUE){
556 ProcessGammasForOmegaMesonAnalysis();
557 }
558 }
559
560
561 //Must set fForceAOD to true for the AOD to get filled. (Unless called by other task)
562 if(fKFForceAOD) {
563 if (!AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()) {
564 AliFatal("Cannot run ESD filter without an output event handler");
565
566 } else {
567 if(fAODGamma && fAODGamma->GetEntriesFast() > 0) {
568 AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kTRUE);
569 AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillExtension(kTRUE);
570 }
571 }
572
573 }
574
575 ///Make sure delta aod is filled if standard aod is filled (for synchronization when reading aod with standard aod)
576 if(fKFCreateAOD && !fKFExchangeAOD) {
577 AliAODHandler * aodhandler = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
578 if (aodhandler && aodhandler->GetFillAOD()) {
579 AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillExtension(kTRUE);
580 }
581 }
582
583
584 //Clear the data in the v0Reader
585 fV0Reader->UpdateEventByEventData();
586 //if(fRecalculateV0ForGamma==kTRUE){
587 // RecalculateV0ForGamma();
588 // }
589 PostAODEvent();
590 PostData(1, fOutputContainer);
591 PostData(2, fCFManager->GetParticleContainer()); // for CF
592}
593
7033a2a4 594Bool_t AliAnalysisTaskGammaConversion::CheckMCEvent() {
595 // To avoid crashes due to unzip errors. Sometimes the trees are not there.
596
597 Int_t eventQuality=-1;
598 AliMCEventHandler* mcHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
599 if (!mcHandler){
600 AliError("Could not retrive MC event handler!");
601 eventQuality=0;
602 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
603 return kFALSE;
604 }
605
606 if (!mcHandler->InitOk() ){
607 eventQuality=0;
608 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
609 return kFALSE;
610 }
611
612 if (!mcHandler->TreeK() ){
613 eventQuality=0;
614 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
615 return kFALSE;
616 }
617
618 if (!mcHandler->TreeTR() ) {
619 eventQuality=0;
620 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
621 return kFALSE;
622 }
623
624 return kTRUE;
625}
3b77b2d1 626
627Bool_t AliAnalysisTaskGammaConversion::DoEventSelection() {
628
629
630 Int_t eventQuality = -1;
631
2eedd4ed 632 //Take Only events with proper trigger
633 /*
634 if(fTriggerCINT1B){
635 if(!fV0Reader->GetESDEvent()->IsTriggerClassFired("CINT1B-ABCE-NOPF-ALL")) return;
636 }
637 */
638 Bool_t v0A = fTriggerAnalysis->IsOfflineTriggerFired(fV0Reader->GetESDEvent(), AliTriggerAnalysis::kV0A);
639 Bool_t v0C = fTriggerAnalysis->IsOfflineTriggerFired(fV0Reader->GetESDEvent(), AliTriggerAnalysis::kV0C);
640 Bool_t v0AND = v0A && v0C;
641
642 if(fSelectV0AND && !v0AND){
643 eventQuality=5;
644 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
645 if(fDoMCTruth){
646 if(!fV0Reader->GetIsHeavyIon()){
cc5a88a2 647 CheckMesonProcessTypeEventQuality(eventQuality);
2eedd4ed 648 }
649 }
c8206114 650
3b77b2d1 651 return kFALSE;
2eedd4ed 652 }
c8206114 653
2eedd4ed 654 if(fV0Reader->CheckForPrimaryVertex() == kFALSE){
655 // cout<< "Event not taken"<< endl;
656 eventQuality=1;
657 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
658 if(fDoMCTruth){
659 if(!fV0Reader->GetIsHeavyIon()){
660 CheckMesonProcessTypeEventQuality(eventQuality);
661 }
662 }
3b77b2d1 663 return kFALSE; // aborts if the primary vertex does not have contributors.
2eedd4ed 664 }
665
666
2f426a53 667
2eedd4ed 668 if(!fV0Reader->CheckForPrimaryVertexZ() ){
669 eventQuality=2;
670 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
671 if(fDoMCTruth){
672 if(!fV0Reader->GetIsHeavyIon()){
673 CheckMesonProcessTypeEventQuality(eventQuality);
674 }
675 }
3b77b2d1 676 return kFALSE;
2eedd4ed 677 }
cc5a88a2 678
ada7a878 679
2eedd4ed 680 if(fV0Reader->GetESDEvent()->GetPrimaryVertexTracks()->GetNContributors()>0) {
681 fHistograms->FillHistogram("ESD_GlobalPrimaryVtxZ",fV0Reader->GetESDEvent()->GetPrimaryVertex()->GetZ());
682 }else{
683 if(fV0Reader->GetESDEvent()->GetPrimaryVertexSPD()->GetNContributors()>0) {
684 fHistograms->FillHistogram("ESD_SPDPrimaryVtxZ",fV0Reader->GetESDEvent()->GetPrimaryVertex()->GetZ());
685 }
686 }
687
688 if(fRemovePileUp && fV0Reader->GetESDEvent()->IsPileupFromSPD()) {
689 eventQuality=4;
690 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 691 return kFALSE;
2eedd4ed 692 }
693
694
695 Int_t tTracklet=0, tITSTPC=0, tITSPure=0;
696 fV0Reader->GetESDEvent()->EstimateMultiplicity(tTracklet, tITSTPC, tITSPure, 0.8);
697 Int_t fMultiplicityITS = tITSPure;
cc5a88a2 698
2eedd4ed 699 fMultiplicity = fEsdTrackCuts->CountAcceptedTracks(fV0Reader->GetESDEvent());
700 Int_t fMultiplicityStandard = fMultiplicity;
cc5a88a2 701
2eedd4ed 702 if( fUseHBTMultiplicity==1) {
703 fMultiplicity = fMultiplicityITS;
cc5a88a2 704
2eedd4ed 705 }
cc5a88a2 706
18a1e325 707
2eedd4ed 708 fHistograms->FillHistogram("ESD_MultiplicityDeviation",fMultiplicityStandard,fMultiplicityITS);
6746e1e1 709
2eedd4ed 710
cc5a88a2 711
2eedd4ed 712 if(fUseMultiplicity!=0 && CalculateMultiplicityBin()!=fUseMultiplicityBin ){
713 eventQuality=6;
714 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 715 return kFALSE;
2eedd4ed 716 }
18a1e325 717
2eedd4ed 718
719 if(fUseHBTMultiplicity!=0 && CalculateMultiplicityBin()!=fUseHBTMultiplicityBin ){
720 eventQuality=6;
721 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 722 return kFALSE;
2eedd4ed 723 }
cc5a88a2 724
725
2eedd4ed 726 if(fV0Reader->GetIsHeavyIon()){
727 if(fUseCentrality>0){
728 AliCentrality *esdCentrality = fV0Reader->GetESDEvent()->GetCentrality();
729 Int_t centralityC = -1;
64f4118c 730
2eedd4ed 731 if(fUseCentrality==1){
64f4118c 732 centralityC = esdCentrality->GetCentralityClass10("V0M");
733 if( centralityC != fUseCentralityBin ){
2eedd4ed 734 eventQuality=7;
735 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 736 return kFALSE;
64f4118c 737 }
2eedd4ed 738 }
64f4118c 739
2eedd4ed 740 if(fUseCentrality==2){
64f4118c 741 centralityC = esdCentrality->GetCentralityClass10("CL1");
742 if( centralityC != fUseCentralityBin ){
2eedd4ed 743 eventQuality=7;
744 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 745 return kFALSE;
64f4118c 746 }
2eedd4ed 747 }
14d7f2f9 748
2eedd4ed 749 ////////////////////////////////////// RRnew start /////////////////////////////////////////////////////
750 if(fUseCentrality==3){
14d7f2f9 751 centralityC = esdCentrality->GetCentralityClass10("V0M");
752 if( (fUseCentralityBin == 0) && (centralityC!=0) ){ // 0-10%
2eedd4ed 753 eventQuality=7;
754 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 755 return kFALSE;
14d7f2f9 756 }
757 if( (fUseCentralityBin == 1) && (centralityC!=1) ){ // 10-20%
2eedd4ed 758 eventQuality=7;
759 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 760 return kFALSE;
14d7f2f9 761 }
762 if( (fUseCentralityBin == 2) && (centralityC!=2) && (centralityC!=3) ){ // 20-40%
2eedd4ed 763 eventQuality=7;
764 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 765 return kFALSE;
2eedd4ed 766 }
767 if( (fUseCentralityBin == 3) && (centralityC!=0) && (centralityC!=1) ){ // 0-20%
768 eventQuality=7;
769 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 770 return kFALSE;
14d7f2f9 771 }
772 if( (fUseCentralityBin == 4) && (centralityC!=4) && (centralityC!=5) ){ // 40-60%
2eedd4ed 773 eventQuality=7;
774 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 775 return kFALSE;
14d7f2f9 776 }
777 if( (fUseCentralityBin == 6) && (centralityC!=6) && (centralityC!=7) && (centralityC!=8) ){ // 60-90%
2eedd4ed 778 eventQuality=7;
779 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 780 return kFALSE;
14d7f2f9 781 }
cc5a88a2 782 if( (fUseCentralityBin == 7) && (centralityC!=6) && (centralityC!=7) ){ // 60-80%
2eedd4ed 783 eventQuality=7;
784 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 785 return kFALSE;
cc5a88a2 786 }
787 if( (fUseCentralityBin == 8) && (centralityC>=8) ){ // 0-80%
2eedd4ed 788 eventQuality=7;
789 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 790 return kFALSE;
cc5a88a2 791 }
792 if( (fUseCentralityBin == 9) && (centralityC>=9) ){ // 0-90%
2eedd4ed 793 eventQuality=7;
794 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 795 return kFALSE;
cc5a88a2 796 }
2eedd4ed 797 }
14d7f2f9 798
2eedd4ed 799 if(fUseCentrality==4){
14d7f2f9 800 centralityC = esdCentrality->GetCentralityClass10("CL1");
801 if( (fUseCentralityBin == 0) && (centralityC!=0) ){ // 0-10%
2eedd4ed 802 eventQuality=7;
803 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 804 return kFALSE;
14d7f2f9 805 }
806 if( (fUseCentralityBin == 1) && (centralityC!=1) ){ // 10-20%
2eedd4ed 807 eventQuality=7;
808 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 809 return kFALSE;
14d7f2f9 810 }
811 if( (fUseCentralityBin == 2) && (centralityC!=2) && (centralityC!=3) ){ // 20-40%
2eedd4ed 812 eventQuality=7;
813 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 814 return kFALSE;
14d7f2f9 815 }
816 if( (fUseCentralityBin == 4) && (centralityC!=4) && (centralityC!=5) ){ // 40-60%
2eedd4ed 817 eventQuality=7;
818 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 819 return kFALSE;
14d7f2f9 820 }
821 if( (fUseCentralityBin == 6) && (centralityC!=6) && (centralityC!=7) && (centralityC!=8) ){ // 60-90%
2eedd4ed 822 eventQuality=7;
823 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
3b77b2d1 824 return kFALSE;
2eedd4ed 825 }
826 }
827 ////////////////////////////////////// RRnew end ///////////////////////////////////////////////////////
3b77b2d1 828
2eedd4ed 829 }
14d7f2f9 830 }
14d7f2f9 831
cc5a88a2 832
2eedd4ed 833 eventQuality=3;
cc5a88a2 834
2eedd4ed 835 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
cc5a88a2 836
885114d1 837
6746e1e1 838
2eedd4ed 839 fHistograms->FillHistogram("ESD_NumberOfGoodESDTracks",fMultiplicity);
840 if (fV0Reader->GetNumberOfContributorsVtx()>=1){
841 fHistograms->FillHistogram("ESD_NumberOfGoodESDTracksVtx",fMultiplicity);
842 }
6746e1e1 843
6746e1e1 844
77880bd8 845
3b77b2d1 846 return kTRUE;
48682642 847
3b77b2d1 848}
f0f3d4a1 849
f0f3d4a1 850
3b77b2d1 851///_______________________________________________________________
852void AliAnalysisTaskGammaConversion::PostAODEvent() {
853 ///Post AOD array to correct output slot
854 if(fKFCreateAOD) {
855 if(!fKFExchangeAOD) {
856 PostData(0, fAODGamma);
857 } else {
858 PostData(3, fAODGamma);
2eedd4ed 859 }
3b77b2d1 860 }
d7d7e825 861}
862
48682642 863// void AliAnalysisTaskGammaConversion::ConnectInputData(Option_t *option){
2eedd4ed 864// // see header file for documentation
865// // printf(" ConnectInputData %s\n", GetName());
8a685cf3 866
2eedd4ed 867// AliAnalysisTaskSE::ConnectInputData(option);
8a685cf3 868
2eedd4ed 869// if(fV0Reader == NULL){
870// // Write warning here cuts and so on are default if this ever happens
871// }
872// fV0Reader->Initialize();
873// fDoMCTruth = fV0Reader->GetDoMCTruth();
48682642 874// }
d7d7e825 875
3c45d101 876void AliAnalysisTaskGammaConversion::CheckMesonProcessTypeEventQuality(Int_t evtQ){
2eedd4ed 877 // Check meson process type event quality
878 fStack= MCEvent()->Stack();
879 fGCMCEvent=MCEvent();
cc5a88a2 880
2eedd4ed 881
cc5a88a2 882
2eedd4ed 883 for (Int_t iTracks = 0; iTracks < fStack->GetNprimary(); iTracks++) {
884 TParticle* particle = (TParticle *)fStack->Particle(iTracks);
885 if (!particle) {
886 //print warning here
887 continue;
888 }
889 // if(particle->GetPdgCode()!=111 || particle->GetPdgCode()!=221){
890 // continue;
891 // }
892
893 Double_t rapidity;
894 if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
895 rapidity=8.;
896 }
897 else{
898 rapidity = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())));
899 }
900
cc5a88a2 901
2eedd4ed 902 if( particle->GetPdgCode()==111){
903 fHistograms->FillHistogram("MC_Test_AllPi0_Pt", particle->Pt());
904 if(particle->GetNDaughters()==2){
905 fHistograms->FillHistogram("MC_Test_2DaughPi0_Pt", particle->Pt());
906 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
907 fHistograms->FillHistogram("MC_Test_2DaughPi0_Rap_Pt", particle->Pt());
908 }
909 }
910 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
911 fHistograms->FillHistogram("MC_Test_Pi0_Rap_Pt", particle->Pt());
912 }
913 }
914
915
916 if(particle->GetPdgCode()==221){
917 fHistograms->FillHistogram("MC_Test_AllEta_Pt", particle->Pt());
918 if(particle->GetNDaughters()==2){
919 fHistograms->FillHistogram("MC_Test_2DaughEta_Pt", particle->Pt());
920 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
921 fHistograms->FillHistogram("MC_Test_2DaughEta_Rap_Pt", particle->Pt());
922 }
923 }
924 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
925 fHistograms->FillHistogram("MC_Test_Eta_Rap_Pt", particle->Pt());
926 }
927
928 }
62ae0124 929
d7d7e825 930
2eedd4ed 931 if(particle->GetPdgCode()!=111){ //Pi0
932 continue;
933 }
62ae0124 934
d7d7e825 935
2eedd4ed 936 if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ) continue;
937 if(fV0Reader->GetIsHeavyIon()) continue;
938
939 if(evtQ==1){
940 switch(GetProcessType(fGCMCEvent)){
941 case kProcSD:
942 fHistograms->FillHistogram("MC_SD_EvtQ1_Pi0_Pt", particle->Pt());
943 break;
944 case kProcDD:
945 fHistograms->FillHistogram("MC_DD_EvtQ1_Pi0_Pt", particle->Pt());
946 break;
947 case kProcND:
948 fHistograms->FillHistogram("MC_ND_EvtQ1_Pi0_Pt", particle->Pt());
949 break;
950 default:
951 AliError("Unknown Process");
952 }
953 }
954 if(evtQ==2){
955 switch(GetProcessType(fGCMCEvent)){
956 case kProcSD:
957 fHistograms->FillHistogram("MC_SD_EvtQ2_Pi0_Pt", particle->Pt());
958 break;
959 case kProcDD:
960 fHistograms->FillHistogram("MC_DD_EvtQ2_Pi0_Pt", particle->Pt());
961 break;
962 case kProcND:
963 fHistograms->FillHistogram("MC_ND_EvtQ2_Pi0_Pt", particle->Pt());
964 break;
965 default:
966 AliError("Unknown Process");
967 }
968 }
3c45d101 969
2eedd4ed 970 if(evtQ==4){
971 switch(GetProcessType(fGCMCEvent)){
972 case kProcSD:
973 fHistograms->FillHistogram("MC_SD_EvtQ4_Pi0_Pt", particle->Pt());
974 break;
975 case kProcDD:
976 fHistograms->FillHistogram("MC_DD_EvtQ4_Pi0_Pt", particle->Pt());
977 break;
978 case kProcND:
979 fHistograms->FillHistogram("MC_ND_EvtQ4_Pi0_Pt", particle->Pt());
980 break;
981 default:
982 AliError("Unknown Process");
983 }
984 }
3c45d101 985
2eedd4ed 986 if(evtQ==5){
987 switch(GetProcessType(fGCMCEvent)){
988 case kProcSD:
989 fHistograms->FillHistogram("MC_SD_EvtQ5_Pi0_Pt", particle->Pt());
990 break;
991 case kProcDD:
992 fHistograms->FillHistogram("MC_DD_EvtQ5_Pi0_Pt", particle->Pt());
993 break;
994 case kProcND:
995 fHistograms->FillHistogram("MC_ND_EvtQ5_Pi0_Pt", particle->Pt());
996 break;
997 default:
998 AliError("Unknown Process");
999 }
1000 }
bd6d9fa3 1001
2eedd4ed 1002 }
111d75df 1003
2eedd4ed 1004}
bd6d9fa3 1005
2eedd4ed 1006void AliAnalysisTaskGammaConversion::ProcessMCData(){
1007 // see header file for documentation
1008 //InputEvent(), MCEvent());
1009 /* TestAnaMarin
1010 fStack = fV0Reader->GetMCStack();
1011 fMCTruth = fV0Reader->GetMCTruth(); // for CF
1012 fGCMCEvent = fV0Reader->GetMCEvent(); // for CF
1013 */
1014 fStack= MCEvent()->Stack();
1015 fGCMCEvent=MCEvent();
d7d7e825 1016
2eedd4ed 1017 // for CF
1018 Double_t containerInput[3];
1019 if(fDoCF){
1020 if(!fGCMCEvent) cout << "NO MC INFO FOUND" << endl;
1021 fCFManager->SetEventInfo(fGCMCEvent);
1022 }
1023 // end for CF
f8017b04 1024
2eedd4ed 1025 if(fV0Reader->CheckForPrimaryVertex() == kFALSE){
1026 return; // aborts if the primary vertex does not have contributors.
1e7846f4 1027 }
2eedd4ed 1028
1029 Int_t nCharged = 0;
1030 Int_t nCharged150MeV = 0;
9640a3d1 1031
2eedd4ed 1032 for (Int_t iTracks = 0; iTracks < fStack->GetNprimary(); iTracks++) {
1033 // for (Int_t iTracks = 0; iTracks < fStack->GetNtrack(); iTracks++) {
1034 TParticle* particle = (TParticle *)fStack->Particle(iTracks);
9c1cb6f7 1035
d008165e 1036 if (!particle) {
1037 //print warning here
1038 continue;
1039 }
9c1cb6f7 1040
64f4118c 1041
d008165e 1042 if(fV0Reader->GetExcludeBackgroundEventForGammaCorrection()){
1043 Bool_t isFromBGEvent = kFALSE;
1044 isFromBGEvent = fV0Reader->IsParticleFromBGEvent(iTracks);
1045 if(isFromBGEvent) continue;
1046 }
1047
9c1cb6f7 1048
2eedd4ed 1049
1050 ///////////////////////Begin Chic Analysis/////////////////////////////
1051 if(fDoChic) {
1052 if(particle->GetPdgCode() == 443){//Is JPsi
1053 if(particle->GetNDaughters()==2){
1054 if(TMath::Abs(fStack->Particle(particle->GetFirstDaughter())->GetPdgCode()) == 11 &&
1055 TMath::Abs(fStack->Particle(particle->GetLastDaughter())->GetPdgCode()) == 11){
1056
1057 TParticle* daug0 = fStack->Particle(particle->GetFirstDaughter());
1058 TParticle* daug1 = fStack->Particle(particle->GetLastDaughter());
1059 if(TMath::Abs(daug0->Eta()) < 0.9 && TMath::Abs(daug1->Eta()) < 0.9)
1060 fHistograms->FillTable("Table_Electrons",3);//e+ e- from J/Psi inside acceptance
1061
1062 if( TMath::Abs(daug0->Eta()) < 0.9){
1063 if(daug0->GetPdgCode() == -11)
1064 fHistograms->FillTable("Table_Electrons",1);//e+ from J/Psi inside acceptance
1065 else
1066 fHistograms->FillTable("Table_Electrons",2);//e- from J/Psi inside acceptance
1067
1068 }
1069 if(TMath::Abs(daug1->Eta()) < 0.9){
1070 if(daug1->GetPdgCode() == -11)
1071 fHistograms->FillTable("Table_Electrons",1);//e+ from J/Psi inside acceptance
1072 else
1073 fHistograms->FillTable("Table_Electrons",2);//e- from J/Psi inside acceptance
1074 }
1075 }
1076 }
1077 }
1078 // const int CHI_C0 = 10441;
1079 // const int CHI_C1 = 20443;
1080 // const int CHI_C2 = 445
1081 if(particle->GetPdgCode() == 22){//gamma from JPsi
1082 if(particle->GetMother(0) > -1){
1083 if(fStack->Particle(particle->GetMother(0))->GetPdgCode() == 10441 ||
1084 fStack->Particle(particle->GetMother(0))->GetPdgCode() == 20443 ||
1085 fStack->Particle(particle->GetMother(0))->GetPdgCode() == 445){
1086 if(TMath::Abs(particle->Eta()) < 1.2)
1087 fHistograms->FillTable("Table_Electrons",17);// gamma from chic inside accptance
1088 }
1089 }
1090 }
1091 if(particle->GetPdgCode() == 10441 || particle->GetPdgCode() == 20443 || particle->GetPdgCode() == 445){
1092 if( particle->GetNDaughters() == 2){
1093 TParticle* daug0 = fStack->Particle(particle->GetFirstDaughter());
1094 TParticle* daug1 = fStack->Particle(particle->GetLastDaughter());
1095
1096 if( (daug0->GetPdgCode() == 443 || daug0->GetPdgCode() == 22) && (daug1->GetPdgCode() == 443 || daug1->GetPdgCode() == 22) ){
1097 if( daug0->GetPdgCode() == 443){
1098 TParticle* daugE0 = fStack->Particle(daug0->GetFirstDaughter());
1099 TParticle* daugE1 = fStack->Particle(daug0->GetLastDaughter());
1100 if( TMath::Abs(daug1->Eta()) < 1.2 && TMath::Abs(daugE0->Eta()) < 0.9 && TMath::Abs(daugE1->Eta()) < 0.9 )
1101 fHistograms->FillTable("Table_Electrons",18);
1102
1103 } else if (daug1->GetPdgCode() == 443){
1104 TParticle* daugE0 = fStack->Particle(daug1->GetFirstDaughter());
1105 TParticle* daugE1 = fStack->Particle(daug1->GetLastDaughter());
1106 if( TMath::Abs(daug0->Eta()) < 1.2 && TMath::Abs(daugE0->Eta()) < 0.9 && TMath::Abs(daugE1->Eta()) < 0.9 )
1107 fHistograms->FillTable("Table_Electrons",18);
1108 }//else if
1109 }//gamma o Jpsi
1110 }//GetNDaughters
1111 }
1112 }
1113
1114 /////////////////////End Chic Analysis////////////////////////////
1115
1116 // if(TMath::Abs(particle->Eta())> fV0Reader->GetEtaCut() ) continue;
9c1cb6f7 1117
9c1cb6f7 1118
9640a3d1 1119
9640a3d1 1120
2eedd4ed 1121 if(particle->Eta() <0.8 && particle->Eta() > (-0.8) && particle->GetPDG()->Charge() != 0) {
1122 nCharged++;
1123 if(particle->Pt()>0.150){
1124 nCharged150MeV++;}
a0b94e5c 1125 }
d7d7e825 1126
d7d7e825 1127
2eedd4ed 1128
1129 if(particle->R()>fV0Reader->GetMaxRCut()) continue; // cuts on distance from collision point
1130
1131 Double_t tmpPhi=particle->Phi();
1132
1133 if(particle->Phi()> TMath::Pi()){
1134 tmpPhi = particle->Phi()-(2*TMath::Pi());
1135 }
1136
1137 Double_t rapidity;
1138 if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
1139 rapidity=8.;
1140 } else{
1141 rapidity = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())));
1142 }
1143
1144 if( particle->GetPdgCode()==111){
dc2883e4 1145
2eedd4ed 1146 //AM move here, otherwise for evt we consider only pi0 to 2 g
1147 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1148 if(!fV0Reader->GetIsHeavyIon()) {
1149
1150 switch(GetProcessType(fGCMCEvent)){
1151 case kProcSD:
1152 fHistograms->FillHistogram("MC_SD_EvtQ3_Pi0_Pt", particle->Pt());
1153 break;
1154 case kProcDD:
1155 fHistograms->FillHistogram("MC_DD_EvtQ3_Pi0_Pt", particle->Pt());
1156 break;
1157 case kProcND:
1158 fHistograms->FillHistogram("MC_ND_EvtQ3_Pi0_Pt", particle->Pt());
1159 break;
1160 default:
1161 AliError("Unknown Process");
1162 }
1163 }
1164 }
1165 fHistograms->FillHistogram("MC_Test_AllPi0_Pt", particle->Pt());
1166 if(particle->GetNDaughters()==2){
1167 fHistograms->FillHistogram("MC_Test_2DaughPi0_Pt", particle->Pt());
1168 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1169 fHistograms->FillHistogram("MC_Test_2DaughPi0_Rap_Pt", particle->Pt());
1170 }
1171 }
1172 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1173 fHistograms->FillHistogram("MC_Test_Pi0_Rap_Pt", particle->Pt());
1174 }
d7d7e825 1175 }
d7d7e825 1176
1177
2eedd4ed 1178 if(particle->GetPdgCode()==221){
1179 fHistograms->FillHistogram("MC_Test_AllEta_Pt", particle->Pt());
1180 if(particle->GetNDaughters()==2){
1181 fHistograms->FillHistogram("MC_Test_2DaughEta_Pt", particle->Pt());
1182 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1183 fHistograms->FillHistogram("MC_Test_2DaughEta_Rap_Pt", particle->Pt());
1184 }
1185 }
1186 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1187 fHistograms->FillHistogram("MC_Test_Eta_Rap_Pt", particle->Pt());
1188 }
d7d7e825 1189 }
2eedd4ed 1190
69b05e50 1191 if( particle->GetPdgCode()==310 ){
1192 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1193 fHistograms->FillHistogram("MC_K0S_Pt", particle->Pt());
1194 }
1195 }
2eedd4ed 1196
1197 if(iTracks<=fStack->GetNprimary() ){
1198 if ( particle->GetPdgCode()== -211 || particle->GetPdgCode()== 211 ||
1199 particle->GetPdgCode()== 2212 || particle->GetPdgCode()==-2212 ||
1200 particle->GetPdgCode()== 321 || particle->GetPdgCode()==-321 ){
1201 if(TMath::Abs(particle->Eta())> 0.8 ) continue; // Eta cut used in charged particle spectrum
1202 //if( !particle->IsPhysicalPrimary() ){
1203 // cout<<"not Physical primary"<< particle->IsPhysicalPrimary()<<endl;
1204 //}
1205 if(particle->GetMother(0)>-1){
1206 // cout<<"Mother ::"<<fStack->Particle(particle->GetMother(0))->GetPdgCode()<<endl;
1207 if (fStack->Particle(particle->GetMother(0))->GetPdgCode()== -211 ||fStack->Particle(particle->GetMother(0))->GetPdgCode()== -3122 ){
69b05e50 1208 // cout<<"Mother K0, lambda::"<<fStack->Particle(particle->GetMother(0))->GetPdgCode()<<endl;
2eedd4ed 1209 continue;
1210 }
1211 }
1212
1213 fHistograms->FillHistogram("MC_PhysicalPrimaryCharged_Pt", particle->Pt());
69b05e50 1214
2eedd4ed 1215 if (particle->GetPdgCode() == 211 ) fHistograms->FillHistogram("MC_PiPlus_Pt", particle->Pt());
1216 if (particle->GetPdgCode() == 321 ) fHistograms->FillHistogram("MC_KaonPlus_Pt", particle->Pt());
1217 if (particle->GetPdgCode() == 2212 ) fHistograms->FillHistogram("MC_Proton_Pt", particle->Pt());
1218 if (particle->GetPdgCode() == -211 ) fHistograms->FillHistogram("MC_PiMinus_Pt", particle->Pt());
1219 if (particle->GetPdgCode() == -321 ) fHistograms->FillHistogram("MC_KaonMinus_Pt", particle->Pt());
1220 if (particle->GetPdgCode() == -2212 ) fHistograms->FillHistogram("MC_AntiProton_Pt", particle->Pt());
1221 }
69b05e50 1222 if(TMath::Abs(particle->Eta())<=0.8 ){
1223 if (particle->GetPdgCode() == 111 ) fHistograms->FillHistogram("MC_Pi0_Test_Pt", particle->Pt());
1224 }
d7d7e825 1225 }
2eedd4ed 1226
1227
1228 //process the gammas
1229 if (particle->GetPdgCode() == 22){
1230 if(TMath::Abs(particle->Eta())> fV0Reader->GetEtaCut() || TMath::Abs(particle->Eta())< fV0Reader->GetEtaCutMin()) continue;
1231
1232 if(particle->GetMother(0) >-1 && fStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
1233 continue; // no photon as mothers!
1234 }
d7d7e825 1235
2eedd4ed 1236 if(particle->GetMother(0) >= fStack->GetNprimary()){
1237 continue; // the gamma has a mother, and it is not a primary particle
1238 }
1239
1240 if(particle->GetMother(0) >-1){
1241 fHistograms->FillHistogram("MC_DecayAllGamma_Pt", particle->Pt()); // All
1242 switch(fStack->Particle(particle->GetMother(0))->GetPdgCode()){
1243 case 111: // Pi0
d008165e 1244 fHistograms->FillHistogram("MC_DecayPi0Gamma_Pt", particle->Pt());
2eedd4ed 1245 break;
1246 case 113: // Rho0
1247 fHistograms->FillHistogram("MC_DecayRho0Gamma_Pt", particle->Pt());
1248 break;
1249 case 221: // Eta
1250 fHistograms->FillHistogram("MC_DecayEtaGamma_Pt", particle->Pt());
1251 break;
1252 case 223: // Omega
1253 fHistograms->FillHistogram("MC_DecayOmegaGamma_Pt", particle->Pt());
1254 break;
1255 case 310: // K_s0
1256 fHistograms->FillHistogram("MC_DecayK0sGamma_Pt", particle->Pt());
1257 break;
1258 case 331: // Eta'
1259 fHistograms->FillHistogram("MC_DecayEtapGamma_Pt", particle->Pt());
1260 break;
1261 case 333: // Phi
1262 fHistograms->FillHistogram("MC_DecayPhiGamma_Pt", particle->Pt());
1263 break;
1264 }
1265 }
a0b94e5c 1266
2eedd4ed 1267 fHistograms->FillHistogram("MC_allGamma_Energy", particle->Energy());
d008165e 1268 fHistograms->FillHistogram("MC_allGamma_Pt", particle->Pt());
1269 fHistograms->FillHistogram("MC_allGamma_Eta", particle->Eta());
2eedd4ed 1270 fHistograms->FillHistogram("MC_allGamma_Phi", tmpPhi);
1271 fHistograms->FillHistogram("MC_allGamma_Rapid", rapidity);
d7d7e825 1272
2eedd4ed 1273 // for CF
1274 if(fDoCF){
1275 containerInput[0] = particle->Pt();
1276 containerInput[1] = particle->Eta();
1277 if(particle->GetMother(0) >=0){
1278 containerInput[2] = fStack->Particle(particle->GetMother(0))->GetMass();
1279 } else{
1280 containerInput[2]=-1;
1281 }
1282 fCFManager->GetParticleContainer()->Fill(containerInput,kStepGenerated); // generated gamma
1283 }
d7d7e825 1284
2eedd4ed 1285 if(particle->GetMother(0) < 0 || //Phojet p+p -> Direct Photons have no mother
1286 ((particle->GetMother(0) > -1) &&
1287 ((TMath::Abs(fStack->Particle(particle->GetMother(0))->GetPdgCode()) < 10)||
1288 (TMath::Abs(fStack->Particle(particle->GetMother(0))->GetPdgCode()) ==21) )) //Pythia p+p -> Direct Photons have quarksor gluons as mother
1289 ){ // direct gamma
1290 fHistograms->FillHistogram("MC_allDirectGamma_Energy",particle->Energy());
1291 fHistograms->FillHistogram("MC_allDirectGamma_Pt", particle->Pt());
1292 fHistograms->FillHistogram("MC_allDirectGamma_Eta", particle->Eta());
1293 fHistograms->FillHistogram("MC_allDirectGamma_Phi", tmpPhi);
1294 fHistograms->FillHistogram("MC_allDirectGamma_Rapid", rapidity);
1295 }
d7d7e825 1296
2eedd4ed 1297 // looking for conversion (electron + positron from pairbuilding (= 5) )
1298 TParticle* ePos = NULL;
1299 TParticle* eNeg = NULL;
a0b94e5c 1300
2eedd4ed 1301 if(particle->GetNDaughters() >= 2){
1302 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
1303 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
1304 if(tmpDaughter->GetUniqueID() == 5){
1305 if(tmpDaughter->GetPdgCode() == 11){
1306 eNeg = tmpDaughter;
1307 } else if(tmpDaughter->GetPdgCode() == -11){
1308 ePos = tmpDaughter;
1309 }
1310 }
1311 }
1312 }
1313
1314 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
1315 continue;
1316 }
1317
1318
1319 Double_t ePosPhi = ePos->Phi();
1320 if(ePos->Phi()> TMath::Pi()) ePosPhi = ePos->Phi()-(2*TMath::Pi());
1321
1322 Double_t eNegPhi = eNeg->Phi();
1323 if(eNeg->Phi()> TMath::Pi()) eNegPhi = eNeg->Phi()-(2*TMath::Pi());
1324
69b05e50 1325 if(ePos->Pt()<fV0Reader->GetSinglePtCut() || eNeg->Pt()<fV0Reader->GetSinglePtCut()){
2eedd4ed 1326 continue; // no reconstruction below the Pt cut
1327 }
1328
1329 if( TMath::Abs(ePos->Eta())> fV0Reader->GetEtaCut() || TMath::Abs(ePos->Eta())< fV0Reader->GetEtaCutMin() ||
1330 TMath::Abs(eNeg->Eta())> fV0Reader->GetEtaCut() || TMath::Abs(eNeg->Eta())< fV0Reader->GetEtaCutMin() ) {
1331 continue;
1332 }
1333
1334 if(ePos->R()>fV0Reader->GetMaxRCut()){
1335 continue; // cuts on distance from collision point
1336 }
1337
1338 if(TMath::Abs(ePos->Vz()) > fV0Reader->GetMaxZCut()){
1339 continue; // outside material
1340 }
1341 if(TMath::Abs(eNeg->Vz()) > fV0Reader->GetMaxZCut()){
1342 continue; // outside material
1343 }
1344
1345 if( ePos->R() <= ((TMath::Abs(ePos->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue())){
1346 continue; // line cut to exclude regions where we do not reconstruct
1347 } else if ( fV0Reader->GetEtaCutMin() != -0.1 && ePos->R() >= ((TMath::Abs(ePos->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin()) ){
1348 continue;
1349 }
1350
1351 if( eNeg->R() <= ((TMath::Abs(eNeg->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue())){
1352 continue; // line cut to exclude regions where we do not reconstruct
1353 } else if ( fV0Reader->GetEtaCutMin() != -0.1 && eNeg->R() >= ((TMath::Abs(eNeg->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin()) ){
1354 continue;
1355 }
1356
1357 // for CF
1358 if(fDoCF){
1359 fCFManager->GetParticleContainer()->Fill(containerInput,kStepReconstructable); // reconstructable gamma
1360 }
1361 fHistograms->FillHistogram("MC_ConvGamma_Energy", particle->Energy());
d008165e 1362 fHistograms->FillHistogram("MC_ConvGamma_Pt", particle->Pt());
1363 // Move down, in the if that mother exists
2eedd4ed 1364 // if(fStack->Particle(particle->GetMother(0))->GetPdgCode() == 221)
1365 // fHistograms->FillHistogram("MC_ConvEtaGamma_Pt", particle->Pt());
1366 fHistograms->FillHistogram("MC_ConvGamma_Eta", particle->Eta());
1367 fHistograms->FillHistogram("MC_ConvGamma_Phi", tmpPhi);
1368 fHistograms->FillHistogram("MC_ConvGamma_Rapid", rapidity);
1369 fHistograms->FillHistogram("MC_ConvGamma_Pt_Eta", particle->Pt(),particle->Eta());
1370
1371 fHistograms->FillHistogram("MC_E_Energy", eNeg->Energy());
1372 fHistograms->FillHistogram("MC_E_Pt", eNeg->Pt());
1373 fHistograms->FillHistogram("MC_E_Eta", eNeg->Eta());
1374 fHistograms->FillHistogram("MC_E_Phi", eNegPhi);
1375
1376 fHistograms->FillHistogram("MC_P_Energy", ePos->Energy());
1377 fHistograms->FillHistogram("MC_P_Pt", ePos->Pt());
1378 fHistograms->FillHistogram("MC_P_Eta", ePos->Eta());
1379 fHistograms->FillHistogram("MC_P_Phi", ePosPhi);
1380
1381 if(!fV0Reader->GetIsHeavyIon()){
1382
1383 // begin Mapping
1384 Int_t rBin = fHistograms->GetRBin(ePos->R());
1385 Int_t zBin = fHistograms->GetZBin(ePos->Vz());
1386 Int_t phiBin = fHistograms->GetPhiBin(particle->Phi());
1387 Double_t rFMD=30;
3b77b2d1 1388 Double_t rITSTPCMin=40;
1389 Double_t rITSTPCInt=55;
1390 Double_t rITSTPCMax=72.5;
2eedd4ed 1391
1392 TVector3 vtxPos(ePos->Vx(),ePos->Vy(),ePos->Vz());
1393
1394 TString nameMCMappingPhiR="";
1395 nameMCMappingPhiR.Form("MC_Conversion_Mapping_Phi%02d_R%02d",phiBin,rBin);
1396 // fHistograms->FillHistogram(nameMCMappingPhiR, ePos->Vz(), particle->Eta());
1397
1398 TString nameMCMappingPhi="";
1399 nameMCMappingPhi.Form("MC_Conversion_Mapping_Phi%02d",phiBin);
1400 // fHistograms->FillHistogram(nameMCMappingPhi, particle->Eta());
1401 //fHistograms->FillHistogram(nameMCMappingPhi, ePos->Vz(), particle->Eta());
1402
1403 TString nameMCMappingR="";
1404 nameMCMappingR.Form("MC_Conversion_Mapping_R%02d",rBin);
1405 // fHistograms->FillHistogram(nameMCMappingR, particle->Eta());
1406 //fHistograms->FillHistogram(nameMCMappingR,ePos->Vz(), particle->Eta());
1407
1408 TString nameMCMappingPhiInR="";
1409 nameMCMappingPhiInR.Form("MC_Conversion_Mapping_Phi_in_R_%02d",rBin);
1410 // fHistograms->FillHistogram(nameMCMappingPhiInR, tmpPhi);
1411 fHistograms->FillHistogram(nameMCMappingPhiInR, vtxPos.Phi());
1412
1413 TString nameMCMappingZInR="";
1414 nameMCMappingZInR.Form("MC_Conversion_Mapping_Z_in_R_%02d",rBin);
1415 fHistograms->FillHistogram(nameMCMappingZInR,ePos->Vz() );
1416
1417
1418 TString nameMCMappingPhiInZ="";
1419 nameMCMappingPhiInZ.Form("MC_Conversion_Mapping_Phi_in_Z_%02d",zBin);
1420 // fHistograms->FillHistogram(nameMCMappingPhiInR, tmpPhi);
1421 fHistograms->FillHistogram(nameMCMappingPhiInZ, vtxPos.Phi());
1422
1423
1424 if(ePos->R()<rFMD){
1425 TString nameMCMappingFMDPhiInZ="";
1426 nameMCMappingFMDPhiInZ.Form("MC_Conversion_Mapping_FMD_Phi_in_Z_%02d",zBin);
1427 fHistograms->FillHistogram(nameMCMappingFMDPhiInZ, vtxPos.Phi());
1428 }
1429
3b77b2d1 1430 if(ePos->R()>rITSTPCMin && ePos->R()<rITSTPCInt){
2eedd4ed 1431 TString nameMCMappingITSTPCPhiInZ="";
1432 nameMCMappingITSTPCPhiInZ.Form("MC_Conversion_Mapping_ITSTPC_Phi_in_Z_%02d",zBin);
1433 fHistograms->FillHistogram(nameMCMappingITSTPCPhiInZ, vtxPos.Phi());
1434 }
1435
3b77b2d1 1436 if(ePos->R()>rITSTPCInt && ePos->R()<rITSTPCMax){
1437 TString nameMCMappingITSTPC2PhiInZ="";
1438 nameMCMappingITSTPC2PhiInZ.Form("MC_Conversion_Mapping_ITSTPC2_Phi_in_Z_%02d",zBin);
1439 fHistograms->FillHistogram(nameMCMappingITSTPC2PhiInZ, vtxPos.Phi());
1440 }
1441
2eedd4ed 1442 TString nameMCMappingRInZ="";
1443 nameMCMappingRInZ.Form("MC_Conversion_Mapping_R_in_Z_%02d",zBin);
1444 fHistograms->FillHistogram(nameMCMappingRInZ,ePos->R() );
1445
1446 if(particle->Pt() > fLowPtMapping && particle->Pt()< fHighPtMapping){
1447 TString nameMCMappingMidPtPhiInR="";
1448 nameMCMappingMidPtPhiInR.Form("MC_Conversion_Mapping_MidPt_Phi_in_R_%02d",rBin);
1449 fHistograms->FillHistogram(nameMCMappingMidPtPhiInR, vtxPos.Phi());
1450
1451 TString nameMCMappingMidPtZInR="";
1452 nameMCMappingMidPtZInR.Form("MC_Conversion_Mapping_MidPt_Z_in_R_%02d",rBin);
1453 fHistograms->FillHistogram(nameMCMappingMidPtZInR,ePos->Vz() );
1454
1455
1456 TString nameMCMappingMidPtPhiInZ="";
1457 nameMCMappingMidPtPhiInZ.Form("MC_Conversion_Mapping_MidPt_Phi_in_Z_%02d",zBin);
1458 fHistograms->FillHistogram(nameMCMappingMidPtPhiInZ, vtxPos.Phi());
1459
1460
1461 if(ePos->R()<rFMD){
1462 TString nameMCMappingMidPtFMDPhiInZ="";
1463 nameMCMappingMidPtFMDPhiInZ.Form("MC_Conversion_Mapping_MidPt_FMD_Phi_in_Z_%02d",zBin);
1464 fHistograms->FillHistogram(nameMCMappingMidPtFMDPhiInZ, vtxPos.Phi());
1465 }
1466
1467 TString nameMCMappingMidPtRInZ="";
1468 nameMCMappingMidPtRInZ.Form("MC_Conversion_Mapping_MidPt_R_in_Z_%02d",zBin);
1469 fHistograms->FillHistogram(nameMCMappingMidPtRInZ,ePos->R() );
1470
1471 }
1472 }
1473
1474 //end mapping
1475
1476 fHistograms->FillHistogram("MC_Conversion_R",ePos->R());
1477 fHistograms->FillHistogram("MC_Conversion_ZR",ePos->Vz(),ePos->R());
1478 fHistograms->FillHistogram("MC_Conversion_XY",ePos->Vx(),ePos->Vy());
1479 fHistograms->FillHistogram("MC_Conversion_OpeningAngle",GetMCOpeningAngle(ePos, eNeg));
1480 fHistograms->FillHistogram("MC_ConvGamma_E_AsymmetryP",particle->P(),eNeg->P()/particle->P());
1481 fHistograms->FillHistogram("MC_ConvGamma_P_AsymmetryP",particle->P(),ePos->P()/particle->P());
1482
1483
1484 if(particle->GetMother(0) < 0 || //Phojet p+p -> Direct Photons have no mother
1485 ((particle->GetMother(0) > -1) &&
1486 ((TMath::Abs(fStack->Particle(particle->GetMother(0))->GetPdgCode()) < 10)||
1487 (TMath::Abs(fStack->Particle(particle->GetMother(0))->GetPdgCode()) ==21) )) //Pythia p+p -> Direct Photons have quarksor gluons as mother
1488 ){ // direct gamma, still inside converted
1489 fHistograms->FillHistogram("MC_ConvDirectGamma_Energy",particle->Energy());
1490 fHistograms->FillHistogram("MC_ConvDirectGamma_Pt", particle->Pt());
1491 fHistograms->FillHistogram("MC_ConvDirectGamma_Eta", particle->Eta());
1492 fHistograms->FillHistogram("MC_ConvDirectGamma_Phi", tmpPhi);
1493 fHistograms->FillHistogram("MC_ConvDirectGamma_Rapid", rapidity);
1494
1495 } else{ // mother exits
1496 if(fStack->Particle(particle->GetMother(0))->GetPdgCode() == 221)
1497 fHistograms->FillHistogram("MC_ConvEtaGamma_Pt", particle->Pt());
1498 /* if( fStack->Particle(particle->GetMother(0))->GetPdgCode()==10441 ||//chic0
1499 fStack->Particle(particle->GetMother(0))->GetPdgCode()==20443 ||//psi2S
1500 fStack->Particle(particle->GetMother(0))->GetPdgCode()==445 //chic2
1501 ){
1502 fMCGammaChic.push_back(particle);
1503 }
1504 */
1505 } // end if mother exits
1506 } // end if particle is a photon
1507
1508
1509
1510 // process motherparticles (2 gammas as daughters)
1511 // the motherparticle had already to pass the R and the eta cut, but no line cut.
1512 // the line cut is just valid for the conversions!
1513
1514 // RR primary Pi0 debug ////////////////////////////////////////////////////////////////////////////////////////////
1515 if (particle->GetPdgCode()==111){
1516 if( TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1517 fHistograms->FillHistogram("MC_Pi0_Pt_vs_Rapid_allDaughters", particle->Pt(),rapidity);
1518 }
1519 }
1520 // end RR primary Pi0 debug ////////////////////////////////////////////////////////////////////////////////////////
1521
1522 if(particle->GetNDaughters() == 2){
1523
1524 TParticle* daughter0 = (TParticle*)fStack->Particle(particle->GetFirstDaughter());
1525 TParticle* daughter1 = (TParticle*)fStack->Particle(particle->GetLastDaughter());
1526
1527 if(daughter0->GetPdgCode() != 22 || daughter1->GetPdgCode() != 22) continue; //check for gamma gamma daughters
1528
1529 if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ) continue;
1530
1531 // Check the acceptance for both gammas
1532 Bool_t gammaEtaCut = kTRUE;
1533 if(TMath::Abs(daughter0->Eta()) > fV0Reader->GetEtaCut() || TMath::Abs(daughter0->Eta()) < fV0Reader->GetEtaCutMin() ||
1534 TMath::Abs(daughter1->Eta()) > fV0Reader->GetEtaCut() || TMath::Abs(daughter1->Eta()) < fV0Reader->GetEtaCutMin() ) gammaEtaCut = kFALSE;
1535
1536 Bool_t gammaRCut = kTRUE;
1537 if(daughter0->R() > fV0Reader->GetMaxRCut() || daughter1->R() > fV0Reader->GetMaxRCut() ) gammaRCut = kFALSE;
1538
1539 // check for conversions now -> have to pass eta, R and line cut!
1540 Bool_t daughter0Electron = kFALSE;
1541 Bool_t daughter0Positron = kFALSE;
1542 Bool_t daughter1Electron = kFALSE;
1543 Bool_t daughter1Positron = kFALSE;
1544
1545 if(daughter0->GetNDaughters() >= 2){ // first gamma
1546 for(Int_t TrackIndex=daughter0->GetFirstDaughter();TrackIndex<=daughter0->GetLastDaughter();TrackIndex++){
1547 TParticle *tmpDaughter = fStack->Particle(TrackIndex);
1548 if(tmpDaughter->GetUniqueID() == 5){
1549 if(tmpDaughter->GetPdgCode() == 11){
1550 if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
1551 if( tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
1552 if ( (fV0Reader->GetEtaCutMin() != -0.1 && tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1 ){
1553 if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
1554 daughter0Electron = kTRUE;
1555 }
1556 }
1557 }
1558 }
1559 } else if(tmpDaughter->GetPdgCode() == -11){
1560 if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
1561 if( tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
1562 if ( (fV0Reader->GetEtaCutMin() != -0.1 && tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1 ){
1563 if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
1564 daughter0Positron = kTRUE;
1565 }
1566 }
1567 }
1568 }
1569 }
1570 }
1571 }
1572 }
1573
1574 if(daughter1->GetNDaughters() >= 2){ // second gamma
1575 for(Int_t TrackIndex=daughter1->GetFirstDaughter();TrackIndex<=daughter1->GetLastDaughter();TrackIndex++){
1576 TParticle *tmpDaughter = fStack->Particle(TrackIndex);
1577 if(tmpDaughter->GetUniqueID() == 5){
1578 if(tmpDaughter->GetPdgCode() == 11){
1579 if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
1580 if( tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
1581 if ( (fV0Reader->GetEtaCutMin() != -0.1 && tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1 ){
1582 if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
1583 daughter1Electron = kTRUE;
1584 }
1585 }
1586 }
1587 }
1588 } else if(tmpDaughter->GetPdgCode() == -11){
1589 if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
1590 if( tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
1591 if ( (fV0Reader->GetEtaCutMin() != -0.1 && tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1 ){
1592 if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
1593 daughter1Positron = kTRUE;
1594 }
1595 }
1596 }
1597 }
1598 }
1599 }
1600 }
1601 }
1602 if(particle->GetPdgCode()==111){ //Pi0
1603 if( iTracks >= fStack->GetNprimary()){
1604 fHistograms->FillHistogram("MC_Pi0_Secondaries_Eta", particle->Eta());
1605 fHistograms->FillHistogram("MC_Pi0_Secondaries_Rapid", rapidity);
1606 fHistograms->FillHistogram("MC_Pi0_Secondaries_Phi", tmpPhi);
1607 fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt", particle->Pt());
1608 fHistograms->FillHistogram("MC_Pi0_Secondaries_Energy", particle->Energy());
1609 fHistograms->FillHistogram("MC_Pi0_Secondaries_R", particle->R());
1610 fHistograms->FillHistogram("MC_Pi0_Secondaries_ZR", particle->Vz(),particle->R());
1611 fHistograms->FillHistogram("MC_Pi0_Secondaries_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));
1612 fHistograms->FillHistogram("MC_Pi0_Secondaries_XY", particle->Vx(),particle->Vy());//only fill from one daughter to avoid multiple filling
1613
1614 if(gammaEtaCut && gammaRCut){
1615 //if(TMath::Abs(daughter0->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(daughter1->Eta()) <= fV0Reader->GetEtaCut() ){
1616 fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt_Eta_withinAcceptance", particle->Pt(),particle->Eta());
1617 fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt_Rapid_withinAcceptance", particle->Pt(),rapidity);
1618 if(daughter0Electron && daughter0Positron && daughter1Electron && daughter1Positron){
1619 fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt_Eta_ConvGamma_withinAcceptance", particle->Pt(),particle->Eta());
1620 fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt_Rapid_ConvGamma_withinAcceptance", particle->Pt(),rapidity);
1621 }
69b05e50 1622 if(particle->GetMother(0) > -1){
1623 Int_t pdgPionMother=fStack->Particle(particle->GetMother(0))->GetPdgCode();
1624 if(pdgPionMother ==310 ){
1625 fHistograms->FillHistogram("MC_K0S_Pt_FromPi0", fStack->Particle(particle->GetMother(0))->Pt());
1626 }
1627 }
2eedd4ed 1628 }
1629 } else{
1630
1631 fHistograms->FillHistogram("MC_Pi0_Eta", particle->Eta());
1632 fHistograms->FillHistogram("MC_Pi0_Rapid", rapidity);
1633 fHistograms->FillHistogram("MC_Pi0_Phi", tmpPhi);
1634 fHistograms->FillHistogram("MC_Pi0_Pt", particle->Pt());
1635 //if(fGCMCEvent->IsFromBGEvent(iTracks)) fHistograms->FillHistogram("MC_Pi0_Pt_under", particle->Pt());
1636 fHistograms->FillHistogram("MC_Pi0_Pt_vs_Rapid", particle->Pt(),rapidity);
1637 fHistograms->FillHistogram("MC_Pi0_Energy", particle->Energy());
1638 fHistograms->FillHistogram("MC_Pi0_R", particle->R());
1639 fHistograms->FillHistogram("MC_Pi0_ZR", particle->Vz(),particle->R());
1640 fHistograms->FillHistogram("MC_Pi0_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));
1641 fHistograms->FillHistogram("MC_Pi0_XY", particle->Vx(), particle->Vy());//only fill from one daughter to avoid multiple filling
1642 if(TMath::Abs(particle->Eta())<0.9)fHistograms->FillHistogram("MC_Pi0_Pt_Fiducial", particle->Pt());
1643 if(particle->GetMother(0) > -1){
1644 Int_t pdgPionMother=fStack->Particle(particle->GetMother(0))->GetPdgCode();
1645 if(pdgPionMother ==221 ){
1646 fHistograms->FillHistogram("MC_Pi0_Pt_FromEta", particle->Pt());
1647 }else if( pdgPionMother==223 ){
1648 fHistograms->FillHistogram("MC_Pi0_Pt_FromOmega", particle->Pt());
1649 }else if(TMath::Abs(pdgPionMother) ==213 ){
1650 fHistograms->FillHistogram("MC_Pi0_Pt_FromRhoPlusMinus", particle->Pt());
1651 }else{
1652 fHistograms->FillHistogram("MC_Pi0_Pt_FromOthers", particle->Pt());
1653 }
1654 }else{
1655 fHistograms->FillHistogram("MC_Pi0_Pt_Direct", particle->Pt());
1656 }
1657
1658 if(gammaEtaCut && gammaRCut){
1659 // if(TMath::Abs(daughter0->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(daughter1->Eta()) <= fV0Reader->GetEtaCut() ){
1660 fHistograms->FillHistogram("MC_Pi0_Pt_Eta_withinAcceptance", particle->Pt(),particle->Eta());
1661 fHistograms->FillHistogram("MC_Pi0_Pt_Rapid_withinAcceptance", particle->Pt(),rapidity);
1662 if(TMath::Abs(particle->Eta())<0.9)fHistograms->FillHistogram("MC_Pi0_Pt_withinAcceptance_Fiducial", particle->Pt());
1663 if(daughter0Electron && daughter0Positron && daughter1Electron && daughter1Positron){
1664 fHistograms->FillHistogram("MC_Pi0_Pt_Eta_ConvGamma_withinAcceptance", particle->Pt(),particle->Eta());
1665 fHistograms->FillHistogram("MC_Pi0_Pt_Rapid_ConvGamma_withinAcceptance", particle->Pt(),rapidity);
1666 fHistograms->FillHistogram("MC_Pi0_ZR_ConvGamma_withinAcceptance", particle->Vz(),particle->R());
1667 fHistograms->FillHistogram("MC_Pi0_ConvGamma_OpeningAngle_Pt", particle->Pt(),GetMCOpeningAngle(daughter0,daughter1));
1668 fHistograms->FillHistogram("MC_Pi0_ConvGamma_PtGamma_Pt", particle->Pt(),daughter0->Pt());
1669 fHistograms->FillHistogram("MC_Pi0_ConvGamma_PtGamma_Pt", particle->Pt(),daughter1->Pt());
1670
1671 Double_t alfa=0.;
1672 if((daughter0->Energy()+daughter1->Energy()) > 0.){
1673 alfa= TMath::Abs((daughter0->Energy()-daughter1->Energy())/(daughter0->Energy()+daughter1->Energy()));
1674 }
1675 fHistograms->FillHistogram("MC_Pi0_alpha",alfa);
1676 if(TMath::Abs(particle->Eta())<0.9)fHistograms->FillHistogram("MC_Pi0_Pt_ConvGamma_withinAcceptance_Fiducial", particle->Pt());
1677 }
1678 }
1679 }
1680 }
1681
1682 if(particle->GetPdgCode()==221){ //Eta
1683 fHistograms->FillHistogram("MC_Eta_Eta", particle->Eta());
1684 fHistograms->FillHistogram("MC_Eta_Rapid", rapidity);
1685 fHistograms->FillHistogram("MC_Eta_Phi",tmpPhi);
1686 fHistograms->FillHistogram("MC_Eta_Pt", particle->Pt());
1687 fHistograms->FillHistogram("MC_Eta_Pt_vs_Rapid", particle->Pt(),rapidity);
1688 fHistograms->FillHistogram("MC_Eta_Energy", particle->Energy());
1689 fHistograms->FillHistogram("MC_Eta_R", particle->R());
1690 fHistograms->FillHistogram("MC_Eta_ZR", particle->Vz(),particle->R());
1691 fHistograms->FillHistogram("MC_Eta_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));
1692 fHistograms->FillHistogram("MC_Eta_XY", particle->Vx(), particle->Vy());//only fill from one daughter to avoid multiple filling
1693
1694 if(gammaEtaCut && gammaRCut){
1695 // if(TMath::Abs(daughter0->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(daughter1->Eta()) <= fV0Reader->GetEtaCut() ){
1696 fHistograms->FillHistogram("MC_Eta_Pt_Eta_withinAcceptance", particle->Pt(),particle->Eta());
1697 fHistograms->FillHistogram("MC_Eta_Pt_Rapid_withinAcceptance", particle->Pt(),rapidity);
1698 if(daughter0Electron && daughter0Positron && daughter1Electron && daughter1Positron){
1699 fHistograms->FillHistogram("MC_Eta_Pt_Eta_ConvGamma_withinAcceptance", particle->Pt(),particle->Eta());
1700 fHistograms->FillHistogram("MC_Eta_Pt_Rapid_ConvGamma_withinAcceptance", particle->Pt(),rapidity);
1701 fHistograms->FillHistogram("MC_Eta_ZR_ConvGamma_withinAcceptance", particle->Vz(),particle->R());
1702 fHistograms->FillHistogram("MC_Eta_ConvGamma_OpeningAngle_Pt", particle->Pt(),GetMCOpeningAngle(daughter0,daughter1));
1703 fHistograms->FillHistogram("MC_Eta_ConvGamma_PtGamma_Pt", particle->Pt(),daughter0->Pt());
1704 fHistograms->FillHistogram("MC_Eta_ConvGamma_PtGamma_Pt", particle->Pt(),daughter1->Pt());
1705
1706 Double_t alfa=0.;
1707 if((daughter0->Energy()+daughter1->Energy()) > 0.){
1708 alfa= TMath::Abs((daughter0->Energy()-daughter1->Energy())/(daughter0->Energy()+daughter1->Energy()));
1709 }
1710 fHistograms->FillHistogram("MC_Eta_alpha",alfa);
1711 }
1712 }
1713 }
1714
1715 // all motherparticles with 2 gammas as daughters
1716 fHistograms->FillHistogram("MC_Mother_R", particle->R());
1717 fHistograms->FillHistogram("MC_Mother_ZR", particle->Vz(),particle->R());
1718 fHistograms->FillHistogram("MC_Mother_XY", particle->Vx(),particle->Vy());
1719 fHistograms->FillHistogram("MC_Mother_Mass", particle->GetCalcMass());
1720 fHistograms->FillHistogram("MC_Mother_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));
1721 fHistograms->FillHistogram("MC_Mother_Energy", particle->Energy());
1722 fHistograms->FillHistogram("MC_Mother_Pt", particle->Pt());
1723 fHistograms->FillHistogram("MC_Mother_Eta", particle->Eta());
1724 fHistograms->FillHistogram("MC_Mother_Rapid", rapidity);
1725 fHistograms->FillHistogram("MC_Mother_Phi",tmpPhi);
1726 fHistograms->FillHistogram("MC_Mother_InvMass_vs_Pt",particle->GetMass(),particle->Pt());
1727
1728 if(gammaEtaCut && gammaRCut){
1729 // if(TMath::Abs(daughter0->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(daughter1->Eta()) <= fV0Reader->GetEtaCut() ){
1730 fHistograms->FillHistogram("MC_Mother_Pt_Eta_withinAcceptance", particle->Pt(),particle->Eta());
1731 fHistograms->FillHistogram("MC_Mother_Pt_Rapid_withinAcceptance", particle->Pt(),rapidity);
1732 fHistograms->FillHistogram("MC_Mother_InvMass_vs_Pt_withinAcceptance",particle->GetMass(),particle->Pt());
1733 if(daughter0Electron && daughter0Positron && daughter1Electron && daughter1Positron){
1734 fHistograms->FillHistogram("MC_Mother_Pt_Eta_ConvGamma_withinAcceptance", particle->Pt(),particle->Eta());
1735 fHistograms->FillHistogram("MC_Mother_Pt_Rapid_ConvGamma_withinAcceptance", particle->Pt(),rapidity);
1736 fHistograms->FillHistogram("MC_Mother_InvMass_vs_Pt_ConvGamma_withinAcceptance",particle->GetMass(),particle->Pt());
1737 }
1738 } // end passed R and eta cut
1739 } // end if(particle->GetNDaughters() == 2)
1740 }// end for (Int_t iTracks = 0; iTracks < fStack->GetNtrack(); iTracks++)
1741
1742 fHistograms->FillHistogram("ESD_TrueMult_vs_MeasMult", nCharged,fMultiplicity);
1743 fHistograms->FillHistogram("ESD_TrueMult_vs_MeasMult_pt150MeV", nCharged150MeV,fMultiplicity);
1744 //cout << "True " << nCharged << " Meas. " << fMultiplicity << endl;
1745
1746} // end ProcessMCData
1747
1748
d7d7e825 1749
1750void AliAnalysisTaskGammaConversion::FillNtuple(){
2eedd4ed 1751 //Fills the ntuple with the different values
1752
1753 if(fGammaNtuple == NULL){
1754 return;
1755 }
1756 Int_t numberOfV0s = fV0Reader->GetNumberOfV0s();
1757 for(Int_t i=0;i<numberOfV0s;i++){
1758 Float_t values[27] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
1759 AliESDv0 * cV0 = fV0Reader->GetV0(i);
1760 Double_t negPID=0;
1761 Double_t posPID=0;
1762 fV0Reader->GetPIDProbability(negPID,posPID);
1763 values[0]=cV0->GetOnFlyStatus();
1764 values[1]=fV0Reader->CheckForPrimaryVertex();
1765 values[2]=negPID;
1766 values[3]=posPID;
1767 values[4]=fV0Reader->GetX();
1768 values[5]=fV0Reader->GetY();
1769 values[6]=fV0Reader->GetZ();
1770 values[7]=fV0Reader->GetXYRadius();
1771 values[8]=fV0Reader->GetMotherCandidateNDF();
1772 values[9]=fV0Reader->GetMotherCandidateChi2();
1773 values[10]=fV0Reader->GetMotherCandidateEnergy();
1774 values[11]=fV0Reader->GetMotherCandidateEta();
1775 values[12]=fV0Reader->GetMotherCandidatePt();
1776 values[13]=fV0Reader->GetMotherCandidateMass();
1777 values[14]=fV0Reader->GetMotherCandidateWidth();
1778 // values[15]=fV0Reader->GetMotherMCParticle()->Pt(); MOVED TO THE END, HAS TO BE CALLED AFTER HasSameMother NB: still has the same entry in the array
1779 values[16]=fV0Reader->GetOpeningAngle();
1780 values[17]=fV0Reader->GetNegativeTrackEnergy();
1781 values[18]=fV0Reader->GetNegativeTrackPt();
1782 values[19]=fV0Reader->GetNegativeTrackEta();
1783 values[20]=fV0Reader->GetNegativeTrackPhi();
1784 values[21]=fV0Reader->GetPositiveTrackEnergy();
1785 values[22]=fV0Reader->GetPositiveTrackPt();
1786 values[23]=fV0Reader->GetPositiveTrackEta();
1787 values[24]=fV0Reader->GetPositiveTrackPhi();
1788 values[25]=fV0Reader->HasSameMCMother();
1789 if(values[25] != 0){
1790 values[26]=fV0Reader->GetMotherMCParticlePDGCode();
1791 values[15]=fV0Reader->GetMotherMCParticle()->Pt();
1792 }
1793 fTotalNumberOfAddedNtupleEntries++;
1794 fGammaNtuple->Fill(values);
1795 }
1796 fV0Reader->ResetV0IndexNumber();
d7d7e825 1797
1798}
1799
1800void AliAnalysisTaskGammaConversion::ProcessV0sNoCut(){
2eedd4ed 1801 // Process all the V0's without applying any cuts to it
a0b94e5c 1802
2eedd4ed 1803 Int_t numberOfV0s = fV0Reader->GetNumberOfV0s();
1804 for(Int_t i=0;i<numberOfV0s;i++){
1805 /*AliESDv0 * cV0 = */fV0Reader->GetV0(i);
a0b94e5c 1806
2eedd4ed 1807 if(fV0Reader->CheckForPrimaryVertex() == kFALSE){
1808 continue;
1809 }
9640a3d1 1810
2eedd4ed 1811 // if( !fV0Reader->GetV0(i)->GetOnFlyStatus()){
3b77b2d1 1812 if( !fV0Reader->CheckV0FinderStatus(fV0Reader->GetV0(i))){
2eedd4ed 1813 continue;
1814 }
9640a3d1 1815
cb90a330 1816
2eedd4ed 1817 if( !((fV0Reader->GetNegativeESDTrack())->GetStatus() & AliESDtrack::kTPCrefit) ||
1818 !((fV0Reader->GetPositiveESDTrack())->GetStatus() & AliESDtrack::kTPCrefit) ){
1819 continue;
1820 }
cb90a330 1821
2eedd4ed 1822 if( fV0Reader->GetNegativeESDTrack()->GetSign()== fV0Reader->GetPositiveESDTrack()->GetSign()){
1823 continue;
1824 }
ebcfaa7e 1825
2eedd4ed 1826 if( fV0Reader->GetNegativeESDTrack()->GetKinkIndex(0) > 0 ||
1827 fV0Reader->GetPositiveESDTrack()->GetKinkIndex(0) > 0) {
1828 continue;
1829 }
1830 if(TMath::Abs(fV0Reader->GetMotherCandidateEta())> fV0Reader->GetEtaCut() || TMath::Abs(fV0Reader->GetMotherCandidateEta())< fV0Reader->GetEtaCutMin()){
1831 continue;
1832 }
1833 if(TMath::Abs(fV0Reader->GetPositiveTrackEta())> fV0Reader->GetEtaCut() || TMath::Abs(fV0Reader->GetPositiveTrackEta())< fV0Reader->GetEtaCutMin()){
1834 continue;
1835 }
1836 if(TMath::Abs(fV0Reader->GetNegativeTrackEta())> fV0Reader->GetEtaCut() || TMath::Abs(fV0Reader->GetNegativeTrackEta())< fV0Reader->GetEtaCutMin()){
1837 continue;
1838 }
1839 if( fV0Reader->GetXYRadius() <= ((TMath::Abs(fV0Reader->GetZ())*fV0Reader->GetLineCutZRSlope())-fV0Reader->GetLineCutZValue()) ){ // cuts out regions where we do not reconstruct
1840 continue;
1841 } else if ( fV0Reader->GetEtaCutMin() != -0.1 && fV0Reader->GetXYRadius() > ((TMath::Abs(fV0Reader->GetZ())*fV0Reader->GetLineCutZRSlopeMin())-fV0Reader->GetLineCutZValueMin()) ) {
1842 continue;
1843 }
f3026589 1844
2eedd4ed 1845 fHistograms->FillHistogram("ESD_NoCutAllV0_Pt", fV0Reader->GetMotherCandidatePt());
e0155998 1846
2eedd4ed 1847 // RRnewTOF start ///////////////////////////////////////////////
1848 UInt_t statusPos = fV0Reader->GetPositiveESDTrack()->GetStatus();
1849 UInt_t statusNeg = fV0Reader->GetNegativeESDTrack()->GetStatus();
e0155998 1850
2eedd4ed 1851 Double_t t0pos = fV0Reader->GetESDpid()->GetTOFResponse().GetStartTime(fV0Reader->GetPositiveTrackP());
1852 Double_t t0neg = fV0Reader->GetESDpid()->GetTOFResponse().GetStartTime(fV0Reader->GetNegativeTrackP());
e0155998 1853
2eedd4ed 1854 Double_t timesPos[5];
1855 fV0Reader->GetPositiveESDTrack()->GetIntegratedTimes(timesPos);
1856 Double_t timesNeg[5];
1857 fV0Reader->GetNegativeESDTrack()->GetIntegratedTimes(timesNeg);
e0155998 1858
2eedd4ed 1859 Double_t TOFsignalPos = fV0Reader->GetPositiveTrackTOFsignal();
1860 Double_t TOFsignalNeg = fV0Reader->GetNegativeTrackTOFsignal();
e0155998 1861
2eedd4ed 1862 Double_t dTpos = TOFsignalPos - t0pos - timesPos[0];
1863 Double_t dTneg = TOFsignalNeg - t0neg - timesNeg[0];
e0155998 1864
69b05e50 1865 if( (statusPos & AliESDtrack::kTOFpid) && !(statusPos & AliESDtrack::kTOFmismatch) ) fHistograms->FillHistogram("ESD_WOCutConvGamma_EandP_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);
1866 if( (statusNeg & AliESDtrack::kTOFpid) && !(statusNeg & AliESDtrack::kTOFmismatch) ) fHistograms->FillHistogram("ESD_WOCutConvGamma_EandP_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);
2eedd4ed 1867 // RRnewTOF end /////////////////////////////////////////////////
1868
1869 if(fDoMCTruth){
a0b94e5c 1870
2eedd4ed 1871 if(fV0Reader->HasSameMCMother() == kFALSE){
1872 continue;
1873 }
a0b94e5c 1874
2eedd4ed 1875 TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
1876 TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
a0b94e5c 1877
2eedd4ed 1878 if(TMath::Abs(negativeMC->GetPdgCode())!=11 || TMath::Abs(positiveMC->GetPdgCode())!=11){
1879 continue;
1880 }
1881 if(negativeMC->GetPdgCode() == positiveMC->GetPdgCode()){
1882 continue;
1883 }
1884
1885 if(negativeMC->GetUniqueID() != 5 || positiveMC->GetUniqueID() !=5){ // id 5 is conversion
1886 continue;
1887 }
d008165e 1888
2eedd4ed 1889 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
1890 fHistograms->FillHistogram("ESD_NoCutConvGamma_Pt", fV0Reader->GetMotherCandidatePt());
3b77b2d1 1891 if(negativeMC->GetMother(0) <= fStack->GetNprimary()){
1892 fHistograms->FillHistogram("ESD_NoCutConvPrimaryGamma_Pt", fV0Reader->GetMotherCandidatePt());
1893 }
2eedd4ed 1894 fHistograms->FillHistogram("ESD_NoCutConvGamma_Energy", fV0Reader->GetMotherCandidateEnergy());
1895 fHistograms->FillHistogram("ESD_NoCutConvGamma_Eta", fV0Reader->GetMotherCandidateEta());
1896 fHistograms->FillHistogram("ESD_NoCutConvGamma_Phi", fV0Reader->GetMotherCandidatePhi());
1897 fHistograms->FillHistogram("ESD_NoCutConvGamma_Mass", fV0Reader->GetMotherCandidateMass());
1898 fHistograms->FillHistogram("ESD_NoCutConvGamma_Width", fV0Reader->GetMotherCandidateWidth());
1899 fHistograms->FillHistogram("ESD_NoCutConvGamma_Chi2", fV0Reader->GetMotherCandidateChi2());
1900 fHistograms->FillHistogram("ESD_NoCutConvGamma_NDF", fV0Reader->GetMotherCandidateNDF());
1901 fHistograms->FillHistogram("ESD_NoCutConvGamma_Rapid", fV0Reader->GetMotherCandidateRapidity());
1902 fHistograms->FillHistogram("ESD_NoCutConvGamma_Pt_Eta", fV0Reader->GetMotherCandidatePt(),fV0Reader->GetMotherCandidateEta());
1903
1904 fHistograms->FillHistogram("ESD_NoCutConvGamma_Pt_Chi2", fV0Reader->GetMotherCandidatePt(), fV0Reader->GetMotherCandidateChi2());
1905 fHistograms->FillHistogram("ESD_NoCutConvGamma_Eta_Chi2", fV0Reader->GetMotherCandidateEta(), fV0Reader->GetMotherCandidateChi2());
1906
1907 fHistograms->FillHistogram("ESD_NoCutConversion_XY", fV0Reader->GetX(),fV0Reader->GetY());
1908 fHistograms->FillHistogram("ESD_NoCutConversion_R", fV0Reader->GetXYRadius());
3b77b2d1 1909 fHistograms->FillHistogram("ESD_NoCutConversion_MCR",fV0Reader->GetNegativeMCParticle()->R());
2eedd4ed 1910 fHistograms->FillHistogram("ESD_NoCutConversion_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
1911 fHistograms->FillHistogram("ESD_NoCutConversion_OpeningAngle", fV0Reader->GetOpeningAngle());
1912 fHistograms->FillHistogram("ESD_NoCutConvGamma_CosPointingAngle", fV0Reader->GetCosPointingAngle());
1913 fHistograms->FillHistogram("ESD_NoCutConvGamma_DcaDaughters", fV0Reader->GetDcaDaughters());
1914 fHistograms->FillHistogram("ESD_NoCutConvGamma_NormDcaDistDaughters", fV0Reader->GetNormDcaDistDaughters());
1915 fHistograms->FillHistogram("ESD_NoCutConvGamma_LikelihoodAP", fV0Reader->GetLikelihoodAP());
1916
1917 fHistograms->FillHistogram("ESD_NoCutConvGamma_E_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetNegativeTrackP()/fV0Reader->GetMotherCandidateP());
1918 fHistograms->FillHistogram("ESD_NoCutConvGamma_P_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetPositiveTrackP()/fV0Reader->GetMotherCandidateP());
1919 fHistograms->FillHistogram("ESD_NoCutConvGamma_E_dEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetNegativeTrackTPCdEdx());
1920 fHistograms->FillHistogram("ESD_NoCutConvGamma_P_dEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetPositiveTrackTPCdEdx());
1921
1922 //store MCTruth properties
1923 fHistograms->FillHistogram("ESD_NoCutConvGamma_MC_Pt_Eta", fV0Reader->GetMotherMCParticle()->Pt(),fV0Reader->GetMotherMCParticle()->Eta());
1924 fHistograms->FillHistogram("ESD_NoCutConversion_MC_ZR", negativeMC->Vz(),negativeMC->R());
1925 fHistograms->FillHistogram("ESD_NoCutConversion_MC_XY", negativeMC->Vx(),negativeMC->Vy());
1926 }
1927 }
1928 }
1929 fV0Reader->ResetV0IndexNumber();
d7d7e825 1930}
1931
1932void AliAnalysisTaskGammaConversion::ProcessV0s(){
2eedd4ed 1933 // see header file for documentation
037dc2db 1934
1935
2eedd4ed 1936 if(fWriteNtuple == kTRUE){
1937 FillNtuple();
1938 }
d7d7e825 1939
2eedd4ed 1940 Int_t nSurvivingV0s=0;
1941 fV0Reader->ResetNGoodV0s();
1942 while(fV0Reader->NextV0()){
1943 nSurvivingV0s++;
d7d7e825 1944
e60f3265 1945
2eedd4ed 1946 TVector3 vtxConv(fV0Reader->GetX(),fV0Reader->GetY(), fV0Reader->GetZ());
e60f3265 1947
2eedd4ed 1948 //-------------------------- filling v0 information -------------------------------------
1949 fHistograms->FillHistogram("ESD_Conversion_R", fV0Reader->GetXYRadius());
1950 fHistograms->FillHistogram("ESD_Conversion_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
1951 fHistograms->FillHistogram("ESD_Conversion_XY", fV0Reader->GetX(),fV0Reader->GetY());
1952 fHistograms->FillHistogram("ESD_Conversion_OpeningAngle", fV0Reader->GetOpeningAngle());
1953 fHistograms->FillHistogram("ESD_ConversionMapping_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
1954 fHistograms->FillHistogram("ESD_ConversionMapping_ZPhi", fV0Reader->GetZ(),vtxConv.Phi());
1955 fHistograms->FillHistogram("ESD_ConversionMapping_RPhi", fV0Reader->GetXYRadius(),vtxConv.Phi());
1956
1957 if ( fV0Reader->GetMotherCandidatePt() >= 2.){
1958 fHistograms->FillHistogram("ESD_Conversion_minPt_R", fV0Reader->GetXYRadius());
1959 fHistograms->FillHistogram("ESD_Conversion_minPt_Z", fV0Reader->GetZ());
1960 }
e60f3265 1961
2eedd4ed 1962 // Specific histograms for beam pipe studies
1963 if( TMath::Abs(fV0Reader->GetZ()) < fV0Reader->GetLineCutZValue() && TMath::Abs(fV0Reader->GetZ()) > fV0Reader->GetLineCutZValueMin()){
1964 fHistograms->FillHistogram("ESD_Conversion_XY_BeamPipe", fV0Reader->GetX(),fV0Reader->GetY());
1965 fHistograms->FillHistogram("ESD_Conversion_RPhi_BeamPipe", vtxConv.Phi(),fV0Reader->GetXYRadius());
1966 }
e60f3265 1967
1968
2eedd4ed 1969 fHistograms->FillHistogram("ESD_E_Energy", fV0Reader->GetNegativeTrackEnergy());
1970 fHistograms->FillHistogram("ESD_E_Pt", fV0Reader->GetNegativeTrackPt());
1971 fHistograms->FillHistogram("ESD_E_Eta", fV0Reader->GetNegativeTrackEta());
1972 fHistograms->FillHistogram("ESD_E_Phi", fV0Reader->GetNegativeTrackPhi());
1973 fHistograms->FillHistogram("ESD_E_nTPCClusters", fV0Reader->GetNegativeTracknTPCClusters());
1974 fHistograms->FillHistogram("ESD_E_nITSClusters", fV0Reader->GetNegativeTracknITSClusters());
1975 if ( fV0Reader->GetNegativeTrackPt()> 0.150){
1976 fHistograms->FillHistogram("ESD_E_minPt_nTPCClusters", fV0Reader->GetNegativeTracknTPCClusters());
1977 }
1978 if ( fV0Reader->GetNegativeTracknITSClusters()==0){
1979 fHistograms->FillHistogram("ESD_E_onlyTPC_nTPCClusters", fV0Reader->GetNegativeTracknTPCClusters());
1980 }
5ce758b0 1981
2eedd4ed 1982 Double_t eClsToF= 0;
1983 if(!fV0Reader->GetUseCorrectedTPCClsInfo()){
1984 if(fV0Reader->GetNegativeTracknTPCFClusters()!=0 ){
1985 eClsToF=(Double_t)fV0Reader->GetNegativeTracknTPCClusters()/(Double_t)fV0Reader->GetNegativeTracknTPCFClusters();
1986 }
1987 } else {
1988 eClsToF= fV0Reader->GetNegativeESDTrack()->GetTPCClusterInfo(2,0,fV0Reader->GetFirstTPCRow(fV0Reader->GetXYRadius()));
1989 }
1990 fHistograms->FillHistogram("ESD_E_nTPCClustersToFP", fV0Reader->GetNegativeTrackP(),eClsToF );
1991 fHistograms->FillHistogram("ESD_E_nTPCClustersToFR", fV0Reader->GetXYRadius(),eClsToF );
5ce758b0 1992
2eedd4ed 1993 if(fV0Reader->GetNegativeTracknTPCClusters()!=0 ){
1994 fHistograms->FillHistogram("ESD_E_TPCchi2", fV0Reader->GetNegativeTrackTPCchi2()/(Double_t)fV0Reader->GetNegativeTracknTPCClusters());
1995 }
5ce758b0 1996
40051a3e 1997
40051a3e 1998
2eedd4ed 1999 fHistograms->FillHistogram("ESD_P_Energy", fV0Reader->GetPositiveTrackEnergy());
2000 fHistograms->FillHistogram("ESD_P_Pt", fV0Reader->GetPositiveTrackPt());
2001 fHistograms->FillHistogram("ESD_P_Eta", fV0Reader->GetPositiveTrackEta());
2002 fHistograms->FillHistogram("ESD_P_Phi", fV0Reader->GetPositiveTrackPhi());
2003 fHistograms->FillHistogram("ESD_P_nTPCClusters", fV0Reader->GetPositiveTracknTPCClusters());
2004 fHistograms->FillHistogram("ESD_P_nITSClusters", fV0Reader->GetPositiveTracknITSClusters());
2005 if ( fV0Reader->GetPositiveTrackPt()> 0.150){
2006 fHistograms->FillHistogram("ESD_P_minPt_nTPCClusters", fV0Reader->GetPositiveTracknTPCClusters());
2007 }
2008 if (fV0Reader->GetPositiveTracknITSClusters()==0){
2009 fHistograms->FillHistogram("ESD_P_onlyTPC_nTPCClusters", fV0Reader->GetPositiveTracknTPCClusters());
2010 }
5ce758b0 2011
2eedd4ed 2012 Double_t pClsToF= 0;
2013 if(!fV0Reader->GetUseCorrectedTPCClsInfo()){
2014 if(fV0Reader->GetPositiveTracknTPCFClusters()!=0){
2015 pClsToF = (Double_t)fV0Reader->GetPositiveTracknTPCClusters()/(Double_t)fV0Reader->GetPositiveTracknTPCFClusters();
2016 }
2017 } else {
2018 pClsToF= fV0Reader->GetPositiveESDTrack()->GetTPCClusterInfo(2,0,fV0Reader->GetFirstTPCRow(fV0Reader->GetXYRadius()));
2019 }
5ce758b0 2020
2eedd4ed 2021 fHistograms->FillHistogram("ESD_P_nTPCClustersToFP",fV0Reader->GetPositiveTrackP(), pClsToF);
2022 fHistograms->FillHistogram("ESD_P_nTPCClustersToFR",fV0Reader->GetXYRadius(), pClsToF);
40051a3e 2023
2eedd4ed 2024 if(fV0Reader->GetPositiveTracknTPCClusters()!=0){
2025 fHistograms->FillHistogram("ESD_P_TPCchi2", fV0Reader->GetPositiveTrackTPCchi2()/(Double_t)fV0Reader->GetPositiveTracknTPCClusters());
2026 }
037dc2db 2027
e60f3265 2028
9640a3d1 2029
2eedd4ed 2030 fHistograms->FillHistogram("ESD_ConvGamma_Energy", fV0Reader->GetMotherCandidateEnergy());
2031 fHistograms->FillHistogram("ESD_ConvGamma_Pt", fV0Reader->GetMotherCandidatePt());
2032 fHistograms->FillHistogram("ESD_ConvGamma_Eta", fV0Reader->GetMotherCandidateEta());
2033 fHistograms->FillHistogram("ESD_ConvGamma_Phi", fV0Reader->GetMotherCandidatePhi());
2034 fHistograms->FillHistogram("ESD_ConvGamma_Mass", fV0Reader->GetMotherCandidateMass());
2035 fHistograms->FillHistogram("ESD_ConvGamma_Width", fV0Reader->GetMotherCandidateWidth());
2036 fHistograms->FillHistogram("ESD_ConvGamma_Chi2", fV0Reader->GetMotherCandidateChi2());
2037 fHistograms->FillHistogram("ESD_ConvGamma_NDF", fV0Reader->GetMotherCandidateNDF());
2038 fHistograms->FillHistogram("ESD_ConvGamma_Rapid", fV0Reader->GetMotherCandidateRapidity());
2039 fHistograms->FillHistogram("ESD_ConvGamma_Pt_Eta", fV0Reader->GetMotherCandidatePt(),fV0Reader->GetMotherCandidateEta());
d7d7e825 2040
2eedd4ed 2041 fHistograms->FillHistogram("ESD_ConvGamma_Pt_Chi2", fV0Reader->GetMotherCandidatePt(), fV0Reader->GetMotherCandidateChi2());
2042 fHistograms->FillHistogram("ESD_ConvGamma_Eta_Chi2", fV0Reader->GetMotherCandidateEta(), fV0Reader->GetMotherCandidateChi2());
d7d7e825 2043
2eedd4ed 2044 fHistograms->FillHistogram("ESD_ConvGamma_CosPointingAngle", fV0Reader->GetCosPointingAngle());
3b77b2d1 2045 fHistograms->FillHistogram("ESD_ConvGamma_CosPoint_RecCosPoint",fV0Reader->GetCosPointingAngle(),fV0Reader->GetV0CosineOfPointingAngle(fV0Reader->GetX(),fV0Reader->GetY(),fV0Reader->GetZ()));
2046 fHistograms->FillHistogram("ESD_ConvGamma_PsiPair", fV0Reader->GetPsiPair(fV0Reader->GetCurrentV0()));
2047
2eedd4ed 2048 fHistograms->FillHistogram("ESD_ConvGamma_DcaDaughters", fV0Reader->GetDcaDaughters());
2049 fHistograms->FillHistogram("ESD_ConvGamma_NormDcaDistDaughters", fV0Reader->GetNormDcaDistDaughters());
2050 fHistograms->FillHistogram("ESD_ConvGamma_LikelihoodAP", fV0Reader->GetLikelihoodAP());
d7d7e825 2051
2eedd4ed 2052 fHistograms->FillHistogram("ESD_ConvGamma_E_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetNegativeTrackP()/fV0Reader->GetMotherCandidateP());
2053 fHistograms->FillHistogram("ESD_ConvGamma_P_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetPositiveTrackP()/fV0Reader->GetMotherCandidateP());
2054 fHistograms->FillHistogram("ESD_ConvGamma_E_dEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetNegativeTrackTPCdEdx());
2055 fHistograms->FillHistogram("ESD_ConvGamma_P_dEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetPositiveTrackTPCdEdx());
2056 fHistograms->FillHistogram("ESD_ConvGamma_E_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kElectron));
2057 fHistograms->FillHistogram("ESD_ConvGamma_P_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kElectron));
2058 fHistograms->FillHistogram("ESD_ConvGamma_PiPl_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kPion));
2059 fHistograms->FillHistogram("ESD_ConvGamma_PiMi_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kPion));
2060 fHistograms->FillHistogram("ESD_ConvGamma_KPl_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kKaon));
2061 fHistograms->FillHistogram("ESD_ConvGamma_KMi_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kKaon));
2062 fHistograms->FillHistogram("ESD_ConvGamma_PPl_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kProton));
2063 fHistograms->FillHistogram("ESD_ConvGamma_PMi_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kProton));
2064 fHistograms->FillHistogram("ESD_ConvGamma_MuPl_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kMuon));
2065 fHistograms->FillHistogram("ESD_ConvGamma_MuMi_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kMuon));
d7d7e825 2066
9640a3d1 2067
2eedd4ed 2068 UInt_t statusPos = fV0Reader->GetPositiveESDTrack()->GetStatus(); //moved up here from below RRnewTOF
2069 UInt_t statusNeg = fV0Reader->GetNegativeESDTrack()->GetStatus();
2070 // RRnewTOF start ///////////////////////////////////////////////
2071 Double_t t0pos = fV0Reader->GetESDpid()->GetTOFResponse().GetStartTime(fV0Reader->GetPositiveTrackP());
2072 Double_t t0neg = fV0Reader->GetESDpid()->GetTOFResponse().GetStartTime(fV0Reader->GetNegativeTrackP());
2073
2074 Double_t timesPos[5];
2075 fV0Reader->GetPositiveESDTrack()->GetIntegratedTimes(timesPos);
2076 Double_t timesNeg[5];
2077 fV0Reader->GetNegativeESDTrack()->GetIntegratedTimes(timesNeg);
2078
2079 Double_t TOFsignalPos = fV0Reader->GetPositiveTrackTOFsignal();
2080 Double_t TOFsignalNeg = fV0Reader->GetNegativeTrackTOFsignal();
2081
2082 Double_t dTpos = TOFsignalPos - t0pos - timesPos[0];
2083 Double_t dTneg = TOFsignalNeg - t0neg - timesNeg[0];
2084
2085 if( (statusPos & AliESDtrack::kTOFpid) && !(statusPos & AliESDtrack::kTOFmismatch) ) fHistograms->FillHistogram("ESD_ConvGamma_EandP_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);
2086 if( (statusNeg & AliESDtrack::kTOFpid) && !(statusNeg & AliESDtrack::kTOFmismatch) ) fHistograms->FillHistogram("ESD_ConvGamma_EandP_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);
2087 // RRnewTOF end /////////////////////////////////////////////////
2088
2089 Double_t negPID=0;
2090 Double_t posPID=0;
2091 fV0Reader->GetPIDProbability(negPID,posPID);
2092 fHistograms->FillHistogram("ESD_ConvGamma_E_EProbP",fV0Reader->GetNegativeTrackP(),negPID);
2093 fHistograms->FillHistogram("ESD_ConvGamma_P_EProbP",fV0Reader->GetPositiveTrackP(),posPID);
2094
2095 Double_t negPIDmupi=0;
2096 Double_t posPIDmupi=0;
2097 fV0Reader->GetPIDProbabilityMuonPion(negPIDmupi,posPIDmupi);
2098 fHistograms->FillHistogram("ESD_ConvGamma_E_mupiProbP",fV0Reader->GetNegativeTrackP(),negPIDmupi);
2099 fHistograms->FillHistogram("ESD_ConvGamma_P_mupiProbP",fV0Reader->GetPositiveTrackP(),posPIDmupi);
2100
3b77b2d1 2101 Double_t armenterosQtAlpha[2] = {0,0};
2102 if(fV0Reader->GetUseESDQtCut() == 0){
2103 fV0Reader->GetArmenterosQtAlpha(fV0Reader->GetNegativeKFParticle(),
2104 fV0Reader->GetPositiveKFParticle(),
2105 fV0Reader->GetMotherCandidateKFCombination(),
2106 armenterosQtAlpha);
2107 }
2108 else if(fV0Reader->GetUseESDQtCut() == 1){
2109 fV0Reader->GetArmenterosQtAlpha(fV0Reader->GetCurrentV0(), armenterosQtAlpha);
2110 }
2111 else if(fV0Reader->GetUseESDQtCut() == 2 || fV0Reader->GetUseESDQtCut() == 3){
2112 fV0Reader->GetArmenterosQtAlpha(fV0Reader->GetNegativeKFParticle(),
2113 fV0Reader->GetPositiveKFParticle(),
2114 armenterosQtAlpha,
2115 fV0Reader->GetUseESDQtCut());
2116 }
2117
2118 fHistograms->FillHistogram("ESD_ConvGamma_alfa_qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
2119 fHistograms->FillHistogram("ESD_ConvGamma_Pt_Qt",fV0Reader->GetMotherCandidatePt(),armenterosQtAlpha[0]);
2eedd4ed 2120
2121 if(!fV0Reader->GetIsHeavyIon()){
2122 fHistograms->FillHistogram("3DPlots_Conversion_XYZ", fV0Reader->GetX(),fV0Reader->GetY(),fV0Reader->GetZ());
2123 //fHistograms->FillHistogram("3DPlots_Conversion_ZRPhi", fV0Reader->GetZ(),fV0Reader->GetXYRadius(), vtxConv.Phi());
2124
2125 // begin mapping
2126 Int_t rBin = fHistograms->GetRBin(fV0Reader->GetXYRadius());
2127 Int_t zBin = fHistograms->GetZBin(fV0Reader->GetZ());
2128 Int_t phiBin = fHistograms->GetPhiBin(fV0Reader->GetNegativeTrackPhi());
2129 Double_t rFMD=25;
3b77b2d1 2130 Double_t rITSTPCMin=40;
2131 Double_t rITSTPCInt=55;
2132 Double_t rITSTPCMax=72.5;
a0b94e5c 2133
2eedd4ed 2134 // Double_t motherCandidateEta= fV0Reader->GetMotherCandidateEta();
2135
2136 TString nameESDMappingPhiR="";
2137 nameESDMappingPhiR.Form("ESD_Conversion_Mapping_Phi%02d_R%02d",phiBin,rBin);
2138 //fHistograms->FillHistogram(nameESDMappingPhiR, fV0Reader->GetZ(), motherCandidateEta);
2139
2140 TString nameESDMappingPhi="";
2141 nameESDMappingPhi.Form("ESD_Conversion_Mapping_Phi%02d",phiBin);
2142 //fHistograms->FillHistogram(nameESDMappingPhi, fV0Reader->GetZ(), motherCandidateEta);
2143
2144 TString nameESDMappingR="";
2145 nameESDMappingR.Form("ESD_Conversion_Mapping_R%02d",rBin);
2146 //fHistograms->FillHistogram(nameESDMappingR, fV0Reader->GetZ(), motherCandidateEta);
2147
2148 TString nameESDMappingPhiInR="";
2149 nameESDMappingPhiInR.Form("ESD_Conversion_Mapping_Phi_in_R_%02d",rBin);
2150 // fHistograms->FillHistogram(nameESDMappingPhiInR, fV0Reader->GetMotherCandidatePhi());
2151 fHistograms->FillHistogram(nameESDMappingPhiInR, vtxConv.Phi());
2152
2153 TString nameESDMappingZInR="";
2154 nameESDMappingZInR.Form("ESD_Conversion_Mapping_Z_in_R_%02d",rBin);
2155 fHistograms->FillHistogram(nameESDMappingZInR, fV0Reader->GetZ());
2156
2157 TString nameESDMappingPhiInZ="";
2158 nameESDMappingPhiInZ.Form("ESD_Conversion_Mapping_Phi_in_Z_%02d",zBin);
2159 // fHistograms->FillHistogram(nameESDMappingPhiInR, fV0Reader->GetMotherCandidatePhi());
2160 fHistograms->FillHistogram(nameESDMappingPhiInZ, vtxConv.Phi());
2161
2162 if(fV0Reader->GetXYRadius()<rFMD){
2163 TString nameESDMappingFMDPhiInZ="";
2164 nameESDMappingFMDPhiInZ.Form("ESD_Conversion_Mapping_FMD_Phi_in_Z_%02d",zBin);
2165 fHistograms->FillHistogram(nameESDMappingFMDPhiInZ, vtxConv.Phi());
2166 fHistograms->FillHistogram("ESD_ConversionMapping_FMD_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2167 }
2168 if(fV0Reader->GetXYRadius()>rFMD && fV0Reader->GetXYRadius()<rITSTPCMin){
2169 fHistograms->FillHistogram("ESD_ConversionMapping_FMD2_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2170 }
2171
3b77b2d1 2172 if(fV0Reader->GetXYRadius()>rITSTPCMin && fV0Reader->GetXYRadius()<rITSTPCInt){
2eedd4ed 2173 TString nameESDMappingITSTPCPhiInZ="";
2174 nameESDMappingITSTPCPhiInZ.Form("ESD_Conversion_Mapping_ITSTPC_Phi_in_Z_%02d",zBin);
2175 fHistograms->FillHistogram(nameESDMappingITSTPCPhiInZ, vtxConv.Phi());
2176 fHistograms->FillHistogram("ESD_ConversionMapping_ITSTPC_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2177 }
2178
3b77b2d1 2179 if(fV0Reader->GetXYRadius()>rITSTPCInt && fV0Reader->GetXYRadius()<rITSTPCMax){
2180 TString nameESDMappingITSTPC2PhiInZ="";
2181 nameESDMappingITSTPC2PhiInZ.Form("ESD_Conversion_Mapping_ITSTPC2_Phi_in_Z_%02d",zBin);
2182 fHistograms->FillHistogram(nameESDMappingITSTPC2PhiInZ, vtxConv.Phi());
2183 fHistograms->FillHistogram("ESD_ConversionMapping_ITSTPC2_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2184 }
2185
2eedd4ed 2186 TString nameESDMappingRInZ="";
2187 nameESDMappingRInZ.Form("ESD_Conversion_Mapping_R_in_Z_%02d",zBin);
2188 fHistograms->FillHistogram(nameESDMappingRInZ, fV0Reader->GetXYRadius());
2189
2190 if(fV0Reader->GetMotherCandidatePt() > fLowPtMapping && fV0Reader->GetMotherCandidatePt()< fHighPtMapping){
2191 TString nameESDMappingMidPtPhiInR="";
2192 nameESDMappingMidPtPhiInR.Form("ESD_Conversion_Mapping_MidPt_Phi_in_R_%02d",rBin);
2193 fHistograms->FillHistogram(nameESDMappingMidPtPhiInR, vtxConv.Phi());
a0b94e5c 2194
2eedd4ed 2195 TString nameESDMappingMidPtZInR="";
2196 nameESDMappingMidPtZInR.Form("ESD_Conversion_Mapping_MidPt_Z_in_R_%02d",rBin);
2197 fHistograms->FillHistogram(nameESDMappingMidPtZInR, fV0Reader->GetZ());
a0b94e5c 2198
2eedd4ed 2199 TString nameESDMappingMidPtPhiInZ="";
2200 nameESDMappingMidPtPhiInZ.Form("ESD_Conversion_Mapping_MidPt_Phi_in_Z_%02d",zBin);
2201 fHistograms->FillHistogram(nameESDMappingMidPtPhiInZ, vtxConv.Phi());
2202 if(fV0Reader->GetXYRadius()<rFMD){
2203 TString nameESDMappingMidPtFMDPhiInZ="";
2204 nameESDMappingMidPtFMDPhiInZ.Form("ESD_Conversion_Mapping_MidPt_FMD_Phi_in_Z_%02d",zBin);
2205 fHistograms->FillHistogram(nameESDMappingMidPtFMDPhiInZ, vtxConv.Phi());
2206 }
2207 TString nameESDMappingMidPtRInZ="";
2208 nameESDMappingMidPtRInZ.Form("ESD_Conversion_Mapping_MidPt_R_in_Z_%02d",zBin);
2209 fHistograms->FillHistogram(nameESDMappingMidPtRInZ, fV0Reader->GetXYRadius());
2210 }
2211 }
9640a3d1 2212
2eedd4ed 2213 // end mapping
2214
2215
2216 new((*fKFReconstructedGammasTClone)[fKFReconstructedGammasTClone->GetEntriesFast()]) AliKFConversionPhoton(fV0Reader);
2217
2218
2219 //----------------------------------- checking for "real" conversions (MC match) --------------------------------------
2220 if(fDoMCTruth){
2221 TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
2222 TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
2223 Double_t rFMD=25;
3b77b2d1 2224 Double_t rITSTPCMin=40;
2225 Double_t rITSTPCInt=55;
2226 Double_t rITSTPCMax=72.5;
2eedd4ed 2227
2228 if(fV0Reader->HasSameMCMother() == kFALSE){
2229 fHistograms->FillHistogram("ESD_TrueConvCombinatorial_R", fV0Reader->GetXYRadius());
2230 fHistograms->FillHistogram("ESD_TrueConvCombinatorial_Z", fV0Reader->GetZ());
3b77b2d1 2231 fHistograms->FillHistogram("ESD_TrueConvCombSelected_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
2eedd4ed 2232 if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
2233 fHistograms->FillHistogram("ESD_TrueConvCombinatorialMinPt_R", fV0Reader->GetXYRadius());
2234 fHistograms->FillHistogram("ESD_TrueConvCombinatorialMinPt_Z", fV0Reader->GetZ());
2235 }
2236 fHistograms->FillHistogram("ESD_TrueConvCombinatorial_Pt", fV0Reader->GetMotherCandidatePt());
2237 fHistograms->FillHistogram("ESD_TrueConvCombinatorialDaughter_Pt", negativeMC->Pt(),positiveMC->Pt());
2238 if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){
2239 fHistograms->FillHistogram("ESD_TrueConvCombinatorialElec_R", fV0Reader->GetXYRadius());
2240 fHistograms->FillHistogram("ESD_TrueConvCombinatorialElec_Pt", fV0Reader->GetMotherCandidatePt());
2241 }
2242 if(TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==211){
2243 fHistograms->FillHistogram("ESD_TrueConvCombinatorialPi_R", fV0Reader->GetXYRadius());
2244 fHistograms->FillHistogram("ESD_TrueConvCombinatorialPi_Pt", fV0Reader->GetMotherCandidatePt());
2245 fHistograms->FillHistogram("ESD_TrueConvCombinatorialPiDaughter_Pt", negativeMC->Pt(),positiveMC->Pt());
2246 }
2247 if((TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==2211) ||
2248 (TMath::Abs(negativeMC->GetPdgCode())==2212 && TMath::Abs(positiveMC->GetPdgCode())==211)){
2249 fHistograms->FillHistogram("ESD_TrueConvCombinatorialPiP_R", fV0Reader->GetXYRadius());
2250 fHistograms->FillHistogram("ESD_TrueConvCombinatorialPiP_Pt", fV0Reader->GetMotherCandidatePt());
2251 fHistograms->FillHistogram("ESD_TrueConvCombinatorialPiPDaughter_Pt", negativeMC->Pt(),positiveMC->Pt());
2252 }
2253 if((TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==211) ||
2254 (TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==11)){
2255 fHistograms->FillHistogram("ESD_TrueConvCombinatorialElecPi_R", fV0Reader->GetXYRadius());
2256 fHistograms->FillHistogram("ESD_TrueConvCombinatorialElecPi_Pt", fV0Reader->GetMotherCandidatePt());
2257 }
2258 if( (statusPos & AliESDtrack::kTOFpid) && ( TMath::Abs(positiveMC->GetPdgCode()) != 11 ) && !(statusPos & AliESDtrack::kTOFmismatch) )
2259 fHistograms->FillHistogram("ESD_TrueConvCombinatorial_DaughtersNotElec_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);//RRnewTOF
2260 if( (statusNeg & AliESDtrack::kTOFpid) && ( TMath::Abs(negativeMC->GetPdgCode()) != 11 ) && !(statusNeg & AliESDtrack::kTOFmismatch) )
2261 fHistograms->FillHistogram("ESD_TrueConvCombinatorial_DaughtersNotElec_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);//RRnewTOF
2262 continue;
2263 }
2264
2265 // Moved up to check true electron background
2266 // TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
2267 // TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
2268
2269 if(TMath::Abs(negativeMC->GetPdgCode())!=11 || TMath::Abs(positiveMC->GetPdgCode())!=11){
2270 fHistograms->FillHistogram("ESD_TrueConvHadronicBck_R", fV0Reader->GetXYRadius());
2271 fHistograms->FillHistogram("ESD_TrueConvHadronicBck_Z", fV0Reader->GetZ());
2272 if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
2273 fHistograms->FillHistogram("ESD_TrueConvHadronicBckMinPt_R", fV0Reader->GetXYRadius());
2274 fHistograms->FillHistogram("ESD_TrueConvHadronicBckMinPt_Z", fV0Reader->GetZ());
2275 }
2276 fHistograms->FillHistogram("ESD_TrueConvHadronicBck_Pt", fV0Reader->GetMotherCandidatePt());
2277 fHistograms->FillHistogram("ESD_TrueConvHadronicBckDaughter_Pt", negativeMC->Pt(),positiveMC->Pt());
2278 if( (statusPos & AliESDtrack::kTOFpid) && !(statusPos & AliESDtrack::kTOFmismatch) )
2279 fHistograms->FillHistogram("ESD_TrueConvHadronicBck_Daughters_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);//RRnewTOF
2280 if( (statusNeg & AliESDtrack::kTOFpid) && !(statusNeg & AliESDtrack::kTOFmismatch) )
2281 fHistograms->FillHistogram("ESD_TrueConvHadronicBck_Daughters_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);//RRnewTOF
2282 if((TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==2211) ||
2283 (TMath::Abs(negativeMC->GetPdgCode())==2212 && TMath::Abs(positiveMC->GetPdgCode())==211)){
2284 fHistograms->FillHistogram("ESD_TrueConvLambda_R", fV0Reader->GetXYRadius());
2285 fHistograms->FillHistogram("ESD_TrueConvLambda_Pt", fV0Reader->GetMotherCandidatePt());
2286 }
2287 if(TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==211){
2288 fHistograms->FillHistogram("ESD_TrueConvMeson_R", fV0Reader->GetXYRadius());
2289 fHistograms->FillHistogram("ESD_TrueConvMeson_Pt", fV0Reader->GetMotherCandidatePt());
2290 }
2291 continue;
2292 }
2293
2294
2295 if(negativeMC->GetPdgCode()==positiveMC->GetPdgCode()){
2296 continue;
2297 }
2298
2299 //UInt_t statusPos = fV0Reader->GetPositiveESDTrack()->GetStatus(); moved higher
2300 //UInt_t statusNeg = fV0Reader->GetNegativeESDTrack()->GetStatus();
2301 UChar_t itsPixelPos = fV0Reader->GetPositiveESDTrack()->GetITSClusterMap();
2302 UChar_t itsPixelNeg = fV0Reader->GetNegativeESDTrack()->GetITSClusterMap();
2303
2304 // Using the UniqueID Phojet does not get the Dalitz right
2305 // if( (negativeMC->GetUniqueID() == 4 && positiveMC->GetUniqueID() ==4) ||
2306 // (negativeMC->GetUniqueID() == 0 && positiveMC->GetUniqueID() ==0) ){// fill r distribution for Dalitz decays
2307 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 111){ //pi0
2308 fHistograms->FillHistogram("ESD_TrueDalitzContamination_R", fV0Reader->GetXYRadius());
2309 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_R", fV0Reader->GetXYRadius());
2310 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_Z", fV0Reader->GetZ());
2311 if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
2312 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0MinPt_R", fV0Reader->GetXYRadius());
2313 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0MinPt_Z", fV0Reader->GetZ());
2314 }
2315
2316 //--------Histos for HFE
2317
2318 if(statusPos & AliESDtrack::kTOFpid){
2319 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_SinglePos_R", fV0Reader->GetXYRadius());
2320 if( TESTBIT(itsPixelPos, 0) ){
2321 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_SinglePos_kFirst_R", fV0Reader->GetXYRadius());
2322 }
2323 }
2324 if(statusNeg & AliESDtrack::kTOFpid){
2325 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_SingleNeg_R", fV0Reader->GetXYRadius());
2326 if( TESTBIT(itsPixelNeg, 0) ){
2327 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_SingleNeg_kFirst_R", fV0Reader->GetXYRadius());
2328 }
2329 }
2330 //--------------------------------------------------------
2331
2332 }
2333 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 221){ //eta
2334 fHistograms->FillHistogram("ESD_TrueConvDalitzEta_R", fV0Reader->GetXYRadius());
2335 fHistograms->FillHistogram("ESD_TrueConvDalitzEta_Z", fV0Reader->GetZ());
2336 if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
2337 fHistograms->FillHistogram("ESD_TrueConvDalitzEtaMinPt_R", fV0Reader->GetXYRadius());
2338 fHistograms->FillHistogram("ESD_TrueConvDalitzEtaMinPt_Z", fV0Reader->GetZ());
2339 }
2340 }
2341
2342 //}
2343
2344 if(negativeMC->GetUniqueID() != 5 || positiveMC->GetUniqueID() !=5){// check if the daughters come from a conversion
2345 continue;
2346 }
2347
2348 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
2349 if(fDoCF){
2350 Double_t containerInput[3];
2351 containerInput[0] = fV0Reader->GetMotherCandidatePt();
2352 containerInput[1] = fV0Reader->GetMotherCandidateEta();
2353 containerInput[2] = fV0Reader->GetMotherCandidateMass();
2354 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTrueGamma); // for CF
2355 }
2356
2357 // RRnewTOF start ///////////////////////////////////////////////
2358 if( (statusPos & AliESDtrack::kTOFpid) && !(statusPos & AliESDtrack::kTOFmismatch) ) {
2359 fHistograms->FillHistogram("ESD_TrueConvGamma_EandP_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);
2360 }
2361 if( (statusNeg & AliESDtrack::kTOFpid) && !(statusNeg & AliESDtrack::kTOFmismatch) ) {
2362 fHistograms->FillHistogram("ESD_TrueConvGamma_EandP_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);
2363 }
2364 // RRnewTOF end /////////////////////////////////////////////////
2365 if (fV0Reader->HasSameMCMother() == kTRUE){
3b77b2d1 2366 fHistograms->FillHistogram("ESD_TrueConvGammaSelected_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
2367 fHistograms->FillHistogram("ESD_TrueConvGammaSelected_Pt_Qt",fV0Reader->GetMotherCandidatePt(),armenterosQtAlpha[0]);
2eedd4ed 2368 }
2369 // RRnewTOF end /////////////////////////////////////////////////
2370
2371 fHistograms->FillHistogram("ESD_TrueConvGamma_Pt", fV0Reader->GetMotherCandidatePt());
3b77b2d1 2372 fHistograms->FillHistogram("ESD_TrueConvGamma_CosPoint_RecCosPoint",fV0Reader->GetCosPointingAngle(),fV0Reader->GetV0CosineOfPointingAngle(fV0Reader->GetX(),fV0Reader->GetY(),fV0Reader->GetZ()));
2373 fHistograms->FillHistogram("ESD_TrueConvGamma_PsiPair", fV0Reader->GetPsiPair(fV0Reader->GetCurrentV0()));
2eedd4ed 2374 if(negativeMC->GetMother(0) <= fStack->GetNprimary()){ // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
2375 fHistograms->FillHistogram("ESD_TrueConvPrimaryGamma_Pt", fV0Reader->GetMotherCandidatePt());
2376 fHistograms->FillHistogram("ESD_TrueConvPrimaryGamma_R", fV0Reader->GetXYRadius());
2377 fHistograms->FillHistogram("ESD_TrueConvPrimaryGamma_Z", fV0Reader->GetZ());
2378 if( fV0Reader->GetMotherCandidatePt() > 2. ) {
2379 fHistograms->FillHistogram("ESD_TrueConvPrimaryGammaMinPt_R", fV0Reader->GetXYRadius());
2380 fHistograms->FillHistogram("ESD_TrueConvPrimaryGammaMinPt_Z", fV0Reader->GetZ());
2381 }
2382 }
3b77b2d1 2383 else{
2384 fHistograms->FillHistogram("ESD_TrueConvSecondaryGamma_Pt", fV0Reader->GetMotherCandidatePt());
2385 if(fV0Reader->GetMotherMCParticle()->GetMother(0) > -1){
2386 if(fStack->Particle(fV0Reader->GetMotherMCParticle()->GetMother(0))->GetPdgCode() == 310){
2387 fHistograms->FillHistogram("ESD_TrueConvSecondaryGammaFromK0s_Pt", fV0Reader->GetMotherCandidatePt());
2388 }
2389 if(fStack->Particle(fV0Reader->GetMotherMCParticle()->GetMother(0))->GetMother(0) > -1 &&
2390 fStack->Particle(fStack->Particle(fV0Reader->GetMotherMCParticle()->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
2391 fHistograms->FillHistogram("ESD_TrueConvSecondaryGammaFromXFromK0s_Pt", fV0Reader->GetMotherCandidatePt());
2392 }
2393 }
2394 }
2eedd4ed 2395 if(fV0Reader->GetMotherMCParticle()->GetMother(0) > -1){
2396 if(fStack->Particle(fV0Reader->GetMotherMCParticle()->GetMother(0))->GetPdgCode() == 221){ // Use just gamma from eta for ratio esdtruegamma / mcconvgamma
2397 fHistograms->FillHistogram("ESD_TrueConvEtaGamma_Pt", fV0Reader->GetMotherCandidatePt());
2398 }
2399 }
2400 fHistograms->FillHistogram("ESD_TrueConvGamma_Energy", fV0Reader->GetMotherCandidateEnergy());
2401 fHistograms->FillHistogram("ESD_TrueConvGamma_Eta", fV0Reader->GetMotherCandidateEta());
2402 fHistograms->FillHistogram("ESD_TrueConvGamma_Phi", fV0Reader->GetMotherCandidatePhi());
2403 fHistograms->FillHistogram("ESD_TrueConvGamma_Mass", fV0Reader->GetMotherCandidateMass());
2404 fHistograms->FillHistogram("ESD_TrueConvGamma_Width", fV0Reader->GetMotherCandidateWidth());
2405 fHistograms->FillHistogram("ESD_TrueConvGamma_Chi2", fV0Reader->GetMotherCandidateChi2());
2406 fHistograms->FillHistogram("ESD_TrueConvGamma_NDF", fV0Reader->GetMotherCandidateNDF());
2407 fHistograms->FillHistogram("ESD_TrueConvGamma_Pt_Eta", fV0Reader->GetMotherCandidatePt(),fV0Reader->GetMotherCandidateEta());
2408 fHistograms->FillHistogram("ESD_TrueConvGamma_Rapid", fV0Reader->GetMotherCandidateRapidity());
2409 fHistograms->FillHistogram("ESD_TrueConvGamma_TrackLength",fV0Reader->GetNegativeNTPCClusters());
2410 fHistograms->FillHistogram("ESD_TrueConvGamma_TrackLength",fV0Reader->GetPositiveNTPCClusters());
2411 fHistograms->FillHistogram("ESD_TrueConvGamma_TrackLengthVSInvMass",fV0Reader->GetNegativeNTPCClusters(),fV0Reader->GetMotherCandidateMass());
2412 fHistograms->FillHistogram("ESD_TrueConvGamma_TrackLengthVSInvMass",fV0Reader->GetPositiveNTPCClusters(),fV0Reader->GetMotherCandidateMass());
2413
2414 fHistograms->FillHistogram("ESD_TrueConvGamma_Pt_Chi2", fV0Reader->GetMotherCandidatePt(), fV0Reader->GetMotherCandidateChi2());
2415 fHistograms->FillHistogram("ESD_TrueConvGamma_Eta_Chi2", fV0Reader->GetMotherCandidateEta(), fV0Reader->GetMotherCandidateChi2());
2416 if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
2417 fHistograms->FillHistogram("ESD_TrueConversionMinPt_R", fV0Reader->GetXYRadius());
2418 fHistograms->FillHistogram("ESD_TrueConversionMinPt_Z", fV0Reader->GetZ());
2419 }
2420
2421 fHistograms->FillHistogram("ESD_TrueConversion_E_nTPCClustersToFR", fV0Reader->GetXYRadius(),eClsToF );
2422 fHistograms->FillHistogram("ESD_TrueConversion_P_nTPCClustersToFR",fV0Reader->GetXYRadius(), pClsToF);
2423
2424 fHistograms->FillHistogram("ESD_TrueConversion_XY", fV0Reader->GetX(),fV0Reader->GetY());
2425 fHistograms->FillHistogram("ESD_TrueConversion_R", fV0Reader->GetXYRadius());
2426 fHistograms->FillHistogram("ESD_TrueConversion_Z", fV0Reader->GetZ());
2427 fHistograms->FillHistogram("ESD_TrueConversion_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
2428 fHistograms->FillHistogram("ESD_TrueConversionMapping_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
2429 fHistograms->FillHistogram("ESD_TrueConversionMapping_ZPhi", fV0Reader->GetZ(),vtxConv.Phi());
2430 fHistograms->FillHistogram("ESD_TrueConversionMapping_RPhi", fV0Reader->GetXYRadius(),vtxConv.Phi());
2431 if(fV0Reader->GetXYRadius()<rFMD){
2432 fHistograms->FillHistogram("ESD_TrueConversionMapping_FMD_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2433 }
2434 if(fV0Reader->GetXYRadius()>rFMD && fV0Reader->GetXYRadius()<rITSTPCMin){
2435 fHistograms->FillHistogram("ESD_TrueConversionMapping_FMD2_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2436 }
3b77b2d1 2437 if(fV0Reader->GetXYRadius()>rITSTPCMin && fV0Reader->GetXYRadius()<rITSTPCInt){
2eedd4ed 2438 fHistograms->FillHistogram("ESD_TrueConversionMapping_ITSTPC_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2439 }
3b77b2d1 2440 if(fV0Reader->GetXYRadius()>rITSTPCInt && fV0Reader->GetXYRadius()<rITSTPCMax){
2441 fHistograms->FillHistogram("ESD_TrueConversionMapping_ITSTPC2_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2442 }
2443
2eedd4ed 2444 fHistograms->FillHistogram("ESD_TrueConversion_OpeningAngle", fV0Reader->GetOpeningAngle());
2445
2446 //----Histos for HFE--------------------------------------
2447
2448 if(statusPos & AliESDtrack::kTOFpid){
2449 fHistograms->FillHistogram("ESD_TrueConversion_SinglePos_R", positiveMC->R(),fV0Reader->GetPositiveMCParticle()->Pt());
2450 if( TESTBIT(itsPixelPos, 0) ){
2451 fHistograms->FillHistogram("ESD_TrueConversion_SinglePos_kFirst_R", positiveMC->R(),fV0Reader->GetPositiveMCParticle()->Pt());
2452 }
2453 }
2454 if(statusNeg & AliESDtrack::kTOFpid){
2455 fHistograms->FillHistogram("ESD_TrueConversion_SingleNeg_R", negativeMC->R(),fV0Reader->GetNegativeMCParticle()->Pt());
2456 if( TESTBIT(itsPixelNeg, 0) ){
2457 fHistograms->FillHistogram("ESD_TrueConversion_SingleNeg_kFirst_R", negativeMC->R(),fV0Reader->GetNegativeMCParticle()->Pt());
2458 }
2459 }
2460 //--------------------------------------------------------
2461
2462 fHistograms->FillHistogram("ESD_TrueConvGamma_CosPointingAngle", fV0Reader->GetCosPointingAngle());
2463 fHistograms->FillHistogram("ESD_TrueConvGamma_DcaDaughters", fV0Reader->GetDcaDaughters());
2464 fHistograms->FillHistogram("ESD_TrueConvGamma_NormDcaDistDaughters", fV0Reader->GetNormDcaDistDaughters());
2465 fHistograms->FillHistogram("ESD_TrueConvGamma_LikelihoodAP", fV0Reader->GetLikelihoodAP());
2466 if (fV0Reader->GetMotherCandidateP() != 0) {
2467 fHistograms->FillHistogram("ESD_TrueConvGamma_E_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetNegativeTrackP()/fV0Reader->GetMotherCandidateP());
2468 fHistograms->FillHistogram("ESD_TrueConvGamma_P_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetPositiveTrackP()/fV0Reader->GetMotherCandidateP());
2469 } else {
2470 cout << "Error::fV0Reader->GetNegativeTrackP() == 0 !!!" << endl;
2471 }
a0b94e5c 2472
2eedd4ed 2473 fHistograms->FillHistogram("ESD_TrueConvGamma_E_dEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetNegativeTrackTPCdEdx());
2474 fHistograms->FillHistogram("ESD_TrueConvGamma_P_dEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetPositiveTrackTPCdEdx());
2475
2476 //store MCTruth properties
2477 fHistograms->FillHistogram("ESD_TrueConvGamma_MC_Pt_Eta", fV0Reader->GetMotherMCParticle()->Pt(),fV0Reader->GetMotherMCParticle()->Eta());
2478 fHistograms->FillHistogram("ESD_TrueConversion_MC_ZR", negativeMC->Vz(),negativeMC->R());
2479 fHistograms->FillHistogram("ESD_TrueConversion_MC_XY", negativeMC->Vx(),negativeMC->Vy());
d7d7e825 2480
3b77b2d1 2481
2482 //___________________________________________Resolution______________________________________________________
2483 // Different Ways of Producing a Gamma
2484 // Standard V0 Information
2485 Double_t mcPt = fV0Reader->GetMotherMCParticle()->Pt();
2486 Double_t mcR = fV0Reader->GetNegativeMCParticle()->R();
2487 Double_t mcZ = fV0Reader->GetNegativeMCParticle()->Vz();
2488 Double_t resPt = 0.;
2489 Double_t resR = 0;
2490 Double_t resZ = 0;
2491
2492 AliKFParticle AliKFPosParticle(*(fV0Reader->GetExternalTrackParamP(fV0Reader->GetCurrentV0())),-11);
2493 AliKFParticle AliKFNegParticle(*(fV0Reader->GetExternalTrackParamN(fV0Reader->GetCurrentV0())),11);
2494
2495 // Resolution Normal V0 unchanged from the On-fly/Offline
2496 Double_t xyz[3] = {0,0,0};
2497 fV0Reader->GetCurrentV0()->GetXYZ(xyz[0],xyz[1],xyz[2]);
2498 resPt = mcPt-fV0Reader->GetCurrentV0()->Pt();
2499 resR = mcR-TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
2500 resZ = mcZ-xyz[2];
2501 fHistograms->FillHistogram("Resolution_Gamma_AbsdPt_Pt", mcPt, resPt);
2502 fHistograms->FillHistogram("Resolution_Gamma_AbsdR_R", mcR,resR);
2503 fHistograms->FillHistogram("Resolution_Gamma_AbsdZ_Z", mcZ,resZ);
2504
2505 // Resolution Recalculated V0
2506 resR = mcR-fV0Reader->GetXYRadius();
2507 resZ = mcZ-fV0Reader->GetZ();
2508 // No pt, because we not recalculate v0 pt
2509 fHistograms->FillHistogram("Resolution_GammaRecalcPos_AbsdR_R", mcR,resR);
2510 fHistograms->FillHistogram("Resolution_GammaRecalcPos_AbsdZ_Z", mcZ,resZ);
2511
2512 // Resolution ConstructGamma
2513 AliKFParticle constructGammaKF;
2514 constructGammaKF.ConstructGamma(AliKFNegParticle,AliKFPosParticle);
2515 resPt = mcPt-constructGammaKF.GetPt();
2516 resR = mcR-constructGammaKF.GetR();
2517 resZ = mcZ-constructGammaKF.GetZ();
2518 fHistograms->FillHistogram("Resolution_GammaConstr_AbsdPt_Pt", mcPt, resPt);
2519 fHistograms->FillHistogram("Resolution_GammaConstr_AbsdR_R", mcR,resR);
2520 fHistograms->FillHistogram("Resolution_GammaConstr_AbsdZ_Z", mcZ,resZ);
2521 if(constructGammaKF.GetNDF() !=0)
2522 fHistograms->FillHistogram("Resolution_GammaConstr_Chi2NDF", constructGammaKF.GetChi2()/constructGammaKF.GetNDF());
2523
2524
2525 // Construct Gamma + Mass Constrained
2526 constructGammaKF.SetMassConstraint(0,0.0001);
2527 resPt = mcPt-constructGammaKF.GetPt();
2528 resR = mcR-constructGammaKF.GetR();
2529 resZ = mcZ-constructGammaKF.GetZ();
2530 fHistograms->FillHistogram("Resolution_GammaConstrMass_AbsdPt_Pt", mcPt, resPt);
2531 fHistograms->FillHistogram("Resolution_GammaConstrMass_AbsdR_R", mcR,resR);
2532 fHistograms->FillHistogram("Resolution_GammaConstrMass_AbsdZ_Z", mcZ,resZ);
2533 if(constructGammaKF.GetNDF() !=0)
2534 fHistograms->FillHistogram("Resolution_GammaConstrMass_Chi2NDF", constructGammaKF.GetChi2()/constructGammaKF.GetNDF());
2535
2536 // Construct Gamma + ProductionVertex
2537 constructGammaKF.ConstructGamma(AliKFNegParticle,AliKFPosParticle);
2538 AliKFVertex primaryVertexImprovedConstruct(*(fV0Reader->GetESDEvent()->GetPrimaryVertex()));
2539 primaryVertexImprovedConstruct+=constructGammaKF;
2540 constructGammaKF.SetProductionVertex(primaryVertexImprovedConstruct);
2541 resPt = mcPt-constructGammaKF.GetPt();
2542 resR = mcR-constructGammaKF.GetR();
2543 resZ = mcZ-constructGammaKF.GetZ();
2544 fHistograms->FillHistogram("Resolution_GammaConstrVtx_AbsdPt_Pt", mcPt, resPt);
2545 fHistograms->FillHistogram("Resolution_GammaConstrVtx_AbsdR_R", mcR,resR);
2546 fHistograms->FillHistogram("Resolution_GammaConstrVtx_AbsdZ_Z", mcZ,resZ);
2547 if(constructGammaKF.GetNDF() !=0)
2548 fHistograms->FillHistogram("Resolution_GammaConstrVtx_Chi2NDF", constructGammaKF.GetChi2()/constructGammaKF.GetNDF());
2549
2550 // Construct Gamma + Mass Constrained + Production Vtx
2551 constructGammaKF.ConstructGamma(AliKFNegParticle,AliKFPosParticle);
2552 constructGammaKF.SetMassConstraint(0,0.0001);
2553 AliKFVertex primaryVertexImprovedConstructC(*(fV0Reader->GetESDEvent()->GetPrimaryVertex()));
2554 primaryVertexImprovedConstructC+=constructGammaKF;
2555 constructGammaKF.SetProductionVertex(primaryVertexImprovedConstructC);
2556 resPt = mcPt-constructGammaKF.GetPt();
2557 resR = mcR-constructGammaKF.GetR();
2558 resZ = mcZ-constructGammaKF.GetZ();
2559 fHistograms->FillHistogram("Resolution_GammaConstrMassVtx_AbsdPt_Pt", mcPt, resPt);
2560 fHistograms->FillHistogram("Resolution_GammaConstrMassVtx_AbsdR_R", mcR,resR);
2561 fHistograms->FillHistogram("Resolution_GammaConstrMassVtx_AbsdZ_Z", mcZ,resZ);
2562 if(constructGammaKF.GetNDF() !=0)
2563 fHistograms->FillHistogram("Resolution_GammaConstrMassVtx_Chi2NDF", constructGammaKF.GetChi2()/constructGammaKF.GetNDF());
2564
2565 // Resolution Normal Gamma
2566 AliKFParticle normalGammaKF(AliKFNegParticle,AliKFPosParticle);
2567 resPt = mcPt-normalGammaKF.GetPt();
2568 resR = mcR-normalGammaKF.GetR();
2569 resZ = mcZ-normalGammaKF.GetZ();
2570 fHistograms->FillHistogram("Resolution_GammaNormal_AbsdPt_Pt", mcPt, resPt);
2571 fHistograms->FillHistogram("Resolution_GammaNormal_AbsdR_R", mcR,resR);
2572 fHistograms->FillHistogram("Resolution_GammaNormal_AbsdZ_Z", mcZ,resZ);
2573 if(normalGammaKF.GetNDF() !=0)
2574 fHistograms->FillHistogram("Resolution_GammaNormal_Chi2NDF", normalGammaKF.GetChi2()/normalGammaKF.GetNDF());
2575
2576 // Normal Gamma + Mass Constrained
2577 normalGammaKF.SetMassConstraint(0,0.0001);
2578 resPt = mcPt-normalGammaKF.GetPt();
2579 resR = mcR-normalGammaKF.GetR();
2580 resZ = mcZ-normalGammaKF.GetZ();
2581 fHistograms->FillHistogram("Resolution_GammaNormalMass_AbsdPt_Pt", mcPt, resPt);
2582 fHistograms->FillHistogram("Resolution_GammaNormalMass_AbsdR_R", mcR,resR);
2583 fHistograms->FillHistogram("Resolution_GammaNormalMass_AbsdZ_Z", mcZ,resZ);
2584 if(normalGammaKF.GetNDF() !=0)
2585 fHistograms->FillHistogram("Resolution_GammaNormalMass_Chi2NDF", normalGammaKF.GetChi2()/normalGammaKF.GetNDF());
2586
2587 // Normal Gamma + ProductionVertex
2588 AliKFParticle normalGammaKFVtx(AliKFNegParticle,AliKFPosParticle);
2589 AliKFVertex primaryVertexImprovedNormal(*(fV0Reader->GetESDEvent()->GetPrimaryVertex()));
2590 primaryVertexImprovedNormal+=normalGammaKFVtx;
2591 normalGammaKFVtx.SetProductionVertex(primaryVertexImprovedNormal);
2592 resPt = mcPt-normalGammaKFVtx.GetPt();
2593 resR = mcR-normalGammaKFVtx.GetR();
2594 resZ = mcZ-normalGammaKFVtx.GetZ();
2595 fHistograms->FillHistogram("Resolution_GammaNormalVtx_AbsdPt_Pt", mcPt, resPt);
2596 fHistograms->FillHistogram("Resolution_GammaNormalVtx_AbsdR_R", mcR,resR);
2597 fHistograms->FillHistogram("Resolution_GammaNormalVtx_AbsdZ_Z", mcZ,resZ);
2598 if(normalGammaKFVtx.GetNDF() !=0)
2599 fHistograms->FillHistogram("Resolution_GammaNormalVtx_Chi2NDF", normalGammaKFVtx.GetChi2()/normalGammaKFVtx.GetNDF());
2600
2601 // Normal Gamma + Mass Constrained + Production Vtx
2602 AliKFParticle normalGammaKFMassVtx(AliKFNegParticle,AliKFPosParticle);
2603 normalGammaKFMassVtx.SetMassConstraint(0,0.0001);
2604 AliKFVertex primaryVertexImprovedNormalMassVtx(*(fV0Reader->GetESDEvent()->GetPrimaryVertex()));
2605 primaryVertexImprovedNormalMassVtx+=normalGammaKFMassVtx;
2606 normalGammaKFMassVtx.SetProductionVertex(primaryVertexImprovedNormalMassVtx);
2607 resPt = mcPt-normalGammaKFMassVtx.GetPt();
2608 resR = mcR-normalGammaKFMassVtx.GetR();
2609 resZ = mcZ-normalGammaKFMassVtx.GetZ();
2610 fHistograms->FillHistogram("Resolution_GammaNormalMassVtx_AbsdPt_Pt", mcPt, resPt);
2611 fHistograms->FillHistogram("Resolution_GammaNormalMassVtx_AbsdR_R", mcR,resR);
2612 fHistograms->FillHistogram("Resolution_GammaNormalMassVtx_AbsdZ_Z", mcZ,resZ);
2613 if(normalGammaKFMassVtx.GetNDF() !=0)
2614 fHistograms->FillHistogram("Resolution_GammaNormalMassVtx_Chi2NDF", normalGammaKFMassVtx.GetChi2()/normalGammaKFMassVtx.GetNDF());
2615
2616
2617 // ---------- End new Resolution ------------------
2eedd4ed 2618 Double_t mcpt = fV0Reader->GetMotherMCParticle()->Pt();
2619 Double_t esdpt = fV0Reader->GetMotherCandidatePt();
2620 Double_t resdPt = 0.;
2621 if(mcpt > 0){
2622 resdPt = ((esdpt - mcpt)/mcpt)*100.;
2623 } else if(mcpt < 0){
2624 cout<<"Pt of MC particle is negative, this will cause wrong calculation of resPt"<<endl;
2625 }
3b77b2d1 2626
2627 TVector3 vtxConvRes(fV0Reader->GetX(),fV0Reader->GetY(), fV0Reader->GetZ());
2628
2eedd4ed 2629 fHistograms->FillHistogram("Resolution_Gamma_dPt_Pt", mcpt, resdPt);
2630 fHistograms->FillHistogram("Resolution_MCPt_ESDPt", mcpt,esdpt);
3b77b2d1 2631 fHistograms->FillHistogram("Resolution_Gamma_dPt_Phi", vtxConvRes.Phi(), resdPt);
2eedd4ed 2632 if (esdpt> 0.150){
3b77b2d1 2633 fHistograms->FillHistogram("Resolution_Gamma_minPt_dPt_Phi", vtxConvRes.Phi(), resdPt);
2eedd4ed 2634 }
2635
2636 Double_t resdZ = 0.;
2637 if(fV0Reader->GetNegativeMCParticle()->Vz() != 0){
2638 resdZ = ((fV0Reader->GetZ() -fV0Reader->GetNegativeMCParticle()->Vz())/fV0Reader->GetNegativeMCParticle()->Vz())*100.;
2639 }
2640 Double_t resdZAbs = 0.;
2641 resdZAbs = (fV0Reader->GetZ() -fV0Reader->GetNegativeMCParticle()->Vz());
2642
2643 fHistograms->FillHistogram("Resolution_dZAbs_VS_R", fV0Reader->GetNegativeMCParticle()->R(), resdZAbs);
2644 fHistograms->FillHistogram("Resolution_dZAbs_VS_Z", fV0Reader->GetNegativeMCParticle()->Vz(), resdZAbs);
3b77b2d1 2645 fHistograms->FillHistogram("Resolution_dZAbs_VS_Phi", vtxConvRes.Phi(), resdZAbs);
2eedd4ed 2646 fHistograms->FillHistogram("Resolution_dZ", fV0Reader->GetNegativeMCParticle()->Vz(), resdZ);
2647 fHistograms->FillHistogram("Resolution_MCZ_ESDZ", fV0Reader->GetNegativeMCParticle()->Vz(),fV0Reader->GetZ());
2648
2649 // new for dPt_Pt-histograms for Electron and Positron
2650 Double_t mcEpt;
2651 Double_t resEdPt=0;
2652 UInt_t kTRDoutN, statusN;
2653 Int_t nITSclsE;
2654 // new for dPt_Pt-histograms for Electron and Positron
2655 if (fV0Reader->GetNegativeMCParticle()->GetPdgCode() == 11) {
2656 mcEpt = fV0Reader->GetNegativeMCParticle()->Pt();
2657 } else {
2658 mcEpt = fV0Reader->GetPositiveMCParticle()->Pt();
2659 }
2660 if (mcEpt > 0){
2661 resEdPt = ((fV0Reader->GetNegativeTrackPt()-mcEpt)/mcEpt)*100.;
2662 }
2663 statusN = fV0Reader->GetNegativeESDTrack()->GetStatus();
2664 kTRDoutN = (statusN & AliESDtrack::kTRDout);
2665 nITSclsE= fV0Reader->GetNegativeTracknITSClusters();
2666
2667 // filling Resolution_Pt_dPt with respect to the Number of ITS clusters for Positrons
2668 switch(nITSclsE){
2669 case 0: // 0 ITS clusters
2670 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS0", mcEpt, resEdPt);
2671 break;
2672 case 1: // 1 ITS cluster
2673 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS1", mcEpt, resEdPt);
2674 break;
2675 case 2: // 2 ITS clusters
2676 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS2", mcEpt, resEdPt);
2677 break;
2678 case 3: // 3 ITS clusters
2679 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS3", mcEpt, resEdPt);
2680 break;
2681 case 4: // 4 ITS clusters
2682 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS4", mcEpt, resEdPt);
2683 break;
2684 case 5: // 5 ITS clusters
2685 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS5", mcEpt, resEdPt);
2686 break;
2687 case 6: // 6 ITS clusters
2688 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS6", mcEpt, resEdPt);
2689 break;
2690 }
2691 //Filling histograms with respect to Electron resolution
2692 fHistograms->FillHistogram("Resolution_E_dPt_Pt", mcEpt, resEdPt);
3b77b2d1 2693 fHistograms->FillHistogram("Resolution_E_dPt_Phi", vtxConvRes.Phi(), resEdPt);
2eedd4ed 2694 if (fV0Reader->GetNegativeTrackPt()> 0.150){
3b77b2d1 2695 fHistograms->FillHistogram("Resolution_E_minPt_dPt_Phi", vtxConvRes.Phi(), resEdPt);
2eedd4ed 2696 }
2697
2698 if(kTRDoutN){
2699 fHistograms->FillHistogram("Resolution_E_nTRDtracklets_ESDPt", fV0Reader->GetNegativeTrackPt(), fV0Reader->GetNegativeESDTrack()->GetTRDntracklets());
2700 fHistograms->FillHistogram("Resolution_E_nTRDtracklets_MCPt", mcEpt, fV0Reader->GetNegativeESDTrack()->GetTRDntracklets());
2701 fHistograms->FillHistogram("Resolution_E_nTRDclusters_ESDPt",fV0Reader->GetNegativeTrackPt(), fV0Reader->GetNegativeESDTrack()->GetTRDncls());
2702 fHistograms->FillHistogram("Resolution_E_nTRDclusters_MCPt",mcEpt, fV0Reader->GetNegativeESDTrack()->GetTRDncls());
2703 fHistograms->FillHistogram("Resolution_E_TRDsignal_ESDPt", fV0Reader->GetNegativeTrackPt(), fV0Reader->GetNegativeESDTrack()->GetTRDsignal());
2704 }
2705
2706 Double_t mcPpt;
2707 if (fV0Reader->GetPositiveMCParticle()->GetPdgCode() == -11) {
2708 mcPpt = fV0Reader->GetPositiveMCParticle()->Pt();
2709 } else {
2710 mcPpt = fV0Reader->GetNegativeMCParticle()->Pt();
2711 }
2712
2713 Double_t resPdPt = 0;
2714 if (mcPpt > 0){
2715 resPdPt = ((fV0Reader->GetPositiveTrackPt()-mcPpt)/mcPpt)*100.;
2716 }
2717
2718 UInt_t statusP = fV0Reader->GetPositiveESDTrack()->GetStatus();
2719 // AliESDtrack * posTr= fV0Reader->GetPositiveESDTrack();
2720 UInt_t kTRDoutP = (statusP & AliESDtrack::kTRDout);
d7d7e825 2721
2eedd4ed 2722 Int_t nITSclsP = fV0Reader->GetPositiveTracknITSClusters();
2723 // filling Resolution_Pt_dPt with respect to the Number of ITS clusters for Positrons
2724 switch(nITSclsP){
2725 case 0: // 0 ITS clusters
2726 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS0", mcPpt, resPdPt);
2727 break;
2728 case 1: // 1 ITS cluster
2729 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS1", mcPpt, resPdPt);
2730 break;
2731 case 2: // 2 ITS clusters
2732 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS2", mcPpt, resPdPt);
2733 break;
2734 case 3: // 3 ITS clusters
2735 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS3", mcPpt, resPdPt);
2736 break;
2737 case 4: // 4 ITS clusters
2738 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS4", mcPpt, resPdPt);
2739 break;
2740 case 5: // 5 ITS clusters
2741 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS5", mcPpt, resPdPt);
2742 break;
2743 case 6: // 6 ITS clusters
2744 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS6", mcPpt, resPdPt);
2745 break;
2746 }
2747 //Filling histograms with respect to Positron resolution
2748 fHistograms->FillHistogram("Resolution_P_dPt_Pt", mcPpt, resPdPt);
3b77b2d1 2749 fHistograms->FillHistogram("Resolution_P_dPt_Phi", vtxConvRes.Phi(), resPdPt);
2eedd4ed 2750 if (fV0Reader->GetPositiveTrackPt()> 0.150){
3b77b2d1 2751 fHistograms->FillHistogram("Resolution_P_minPt_dPt_Phi", vtxConvRes.Phi(), resPdPt);
2eedd4ed 2752 }
2753
2754 if(kTRDoutP){
2755 fHistograms->FillHistogram("Resolution_P_nTRDtracklets_ESDPt", fV0Reader->GetPositiveTrackPt(), fV0Reader->GetPositiveESDTrack()->GetTRDntracklets());
2756 fHistograms->FillHistogram("Resolution_P_nTRDtracklets_MCPt", mcPpt, fV0Reader->GetPositiveESDTrack()->GetTRDntracklets());
2757 fHistograms->FillHistogram("Resolution_P_nTRDclusters_ESDPt",fV0Reader->GetPositiveTrackPt(), fV0Reader->GetPositiveESDTrack()->GetTRDncls());
2758 fHistograms->FillHistogram("Resolution_P_nTRDclusters_MCPt",mcPpt, fV0Reader->GetPositiveESDTrack()->GetTRDncls());
2759 fHistograms->FillHistogram("Resolution_P_TRDsignal_ESDPt", fV0Reader->GetPositiveTrackPt(), fV0Reader->GetPositiveESDTrack()->GetTRDsignal());
2760 }
037dc2db 2761
2eedd4ed 2762
2763 Double_t resdR = 0.;
2764 if(fV0Reader->GetNegativeMCParticle()->R() != 0){
2765 resdR = ((fV0Reader->GetXYRadius() - fV0Reader->GetNegativeMCParticle()->R())/fV0Reader->GetNegativeMCParticle()->R())*100.;
2766 }
2767 Double_t resdRAbs = 0.;
2768 resdRAbs = (fV0Reader->GetXYRadius() - fV0Reader->GetNegativeMCParticle()->R());
2769
2770 fHistograms->FillHistogram("Resolution_dRAbs_VS_R", fV0Reader->GetNegativeMCParticle()->R(), resdRAbs);
3b77b2d1 2771 fHistograms->FillHistogram("Resolution_dRAbs_VS_Z", fV0Reader->GetNegativeMCParticle()->Vz(), resdRAbs);
2772 fHistograms->FillHistogram("Resolution_dRAbs_VS_Phi", vtxConvRes.Phi(), resdRAbs);
2eedd4ed 2773 fHistograms->FillHistogram("Resolution_dR", fV0Reader->GetNegativeMCParticle()->R(), resdR);
2774 fHistograms->FillHistogram("Resolution_MCR_ESDR", fV0Reader->GetNegativeMCParticle()->R(),fV0Reader->GetXYRadius());
2775 fHistograms->FillHistogram("Resolution_R_dPt", fV0Reader->GetNegativeMCParticle()->R(), resdPt);
2776 if (esdpt> 0.150){
2777 fHistograms->FillHistogram("Resolution_minPt_R_dPt", fV0Reader->GetNegativeMCParticle()->R(), resdPt);
2778 }
2779
2780 Double_t resdPhiAbs=0.;
2781 resdPhiAbs=0.;
3b77b2d1 2782 resdPhiAbs= (vtxConvRes.Phi()-fV0Reader->GetNegativeMCParticle()->Phi());
2783 fHistograms->FillHistogram("Resolution_MCPhi_ESDPhi", fV0Reader->GetNegativeMCParticle()->Phi(),vtxConvRes.Phi());
2eedd4ed 2784 fHistograms->FillHistogram("Resolution_dPhiAbs_VS_R", fV0Reader->GetNegativeMCParticle()->R(), resdPhiAbs);
3b77b2d1 2785 fHistograms->FillHistogram("Resolution_dPhiAbs_VS_Z", fV0Reader->GetNegativeMCParticle()->Vz(), resdPhiAbs);
2786 fHistograms->FillHistogram("Resolution_dPhiAbs_VS_Phi", vtxConvRes.Phi(), resdPhiAbs);
2eedd4ed 2787 }//if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22)
2788 }//if(fDoMCTruth)
2789 }//while(fV0Reader->NextV0)
2790 fHistograms->FillHistogram("ESD_NumberOfSurvivingV0s", nSurvivingV0s);
2791 fHistograms->FillHistogram("ESD_NumberOfV0s", fV0Reader->GetNumberOfV0s());
2792 fHistograms->FillHistogram("ESD_NumberOfContributorsVtx", fV0Reader->GetNumberOfContributorsVtx());
2793 fV0Reader->ResetV0IndexNumber();
d7d7e825 2794}
2795
81900183 2796
6441e967 2797
2eedd4ed 2798//_____________________________________________________________________________________
6272370b 2799void AliAnalysisTaskGammaConversion::ProcessGammasForOmegaMesonAnalysis(){
2eedd4ed 2800 // omega meson analysis pi0+gamma decay
2801 for(Int_t firstPi0Index=0;firstPi0Index<fKFReconstructedPi0sTClone->GetEntriesFast();firstPi0Index++){
2802 AliKFConversionMother * omegaCandidatePi0Daughter = (AliKFConversionMother *)fKFReconstructedPi0sTClone->At(firstPi0Index);
2803 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
2804
2805 AliKFConversionPhoton * omegaCandidateGammaDaughter = (AliKFConversionPhoton *)fKFReconstructedGammasTClone->At(firstGammaIndex);
2806 if(omegaCandidatePi0Daughter->GetGammaLabel(0)==firstGammaIndex || omegaCandidatePi0Daughter->GetGammaLabel(1)==firstGammaIndex){
2807 continue;
2808 }
2809
2810 AliKFParticle omegaCandidate(*omegaCandidatePi0Daughter,*omegaCandidateGammaDaughter);
2811 Double_t massOmegaCandidate = 0.;
2812 Double_t widthOmegaCandidate = 0.;
2813
2814 omegaCandidate.GetMass(massOmegaCandidate,widthOmegaCandidate);
2815
2816 if ( massOmegaCandidate > 733 && massOmegaCandidate < 833 ) {
2817 //AddOmegaToAOD(&omegaCandidate, massOmegaCandidate, firstPi0Index, firstGammaIndex);
2818 }
2819
2820 fHistograms->FillHistogram("ESD_Omega_InvMass_vs_Pt",massOmegaCandidate ,omegaCandidate.GetPt());
2821 fHistograms->FillHistogram("ESD_Omega_InvMass",massOmegaCandidate);
48682642 2822
2eedd4ed 2823 //delete omegaCandidate;
5ce758b0 2824
2eedd4ed 2825 }// end of omega reconstruction in pi0+gamma channel
5ce758b0 2826
2eedd4ed 2827 if(fDoJet == kTRUE){
2828 AliKFParticle* negPiKF=NULL;
2829 AliKFParticle* posPiKF=NULL;
2830 Int_t piPlusMotherLabel=-1;
2831 Int_t piMinusMotherLabel=-1;
2832
2833 // look at the pi+pi+pi0 channel
2834 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
2835 AliESDtrack* posTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
2836 if (posTrack->GetSign()<0) continue;
2837 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(posTrack,AliPID::kPion))>2.) continue;
2838 if (posPiKF) delete posPiKF; posPiKF=NULL;
2839 posPiKF = new AliKFParticle( *(posTrack) ,211);
2840 if(fDoMCTruth){
2841 TParticle * positiveMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[iCh])->GetLabel()));
2842 if(positiveMCParticle->GetMother(0)>-1){
2843 piPlusMotherLabel = positiveMCParticle->GetMother(0);
2844 }
2845 }
2846
2847 for(Int_t jCh=0;jCh<fChargedParticles->GetEntriesFast();jCh++){
2848 AliESDtrack* negTrack = (AliESDtrack*)(fChargedParticles->At(jCh));
2849 if( negTrack->GetSign()>0) continue;
2850 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(negTrack,AliPID::kPion))>2.) continue;
2851 if (negPiKF) delete negPiKF; negPiKF=NULL;
2852 negPiKF = new AliKFParticle( *(negTrack) ,-211);
2853 AliKFParticle omegaCandidatePipPinPi0(*omegaCandidatePi0Daughter,*posPiKF,*negPiKF);
2854 Double_t massOmegaCandidatePipPinPi0 = 0.;
2855 Double_t widthOmegaCandidatePipPinPi0 = 0.;
2856
2857 omegaCandidatePipPinPi0.GetMass(massOmegaCandidatePipPinPi0,widthOmegaCandidatePipPinPi0);
2858
2859 if ( massOmegaCandidatePipPinPi0 > 733 && massOmegaCandidatePipPinPi0 < 833 ) {
2860 // AddOmegaToAOD(&omegaCandidatePipPinPi0, massOmegaCandidatePipPinPi0, -1, -1);
2861 }
2862
2863 fHistograms->FillHistogram("ESD_OmegaPipPinPi0_InvMass_vs_Pt",massOmegaCandidatePipPinPi0 ,omegaCandidatePipPinPi0.GetPt());
2864 fHistograms->FillHistogram("ESD_OmegaPipPinPi0_InvMass",massOmegaCandidatePipPinPi0);
ef2e2748 2865
2866
2eedd4ed 2867 if(fDoMCTruth){
2868 TParticle * negativeMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[jCh])->GetLabel()));
2869 if(negativeMCParticle->GetMother(0)>-1){
2870 piMinusMotherLabel = negativeMCParticle->GetMother(0);
2871 if( piMinusMotherLabel == piPlusMotherLabel){
2872 Int_t geantCode=fStack->Particle(TMath::Abs(piPlusMotherLabel))->GetPdgCode();
2873 if(geantCode == 221 || geantCode == 223){
2874 fHistograms->FillHistogram("ESD_TrueOmegaPipPinPi0_InvMass_vs_Pt",massOmegaCandidatePipPinPi0 ,omegaCandidatePipPinPi0.GetPt());
2875 }
2876 }
2877
2878 }
2879
2880 }
2881
2882 // delete omegaCandidatePipPinPi0;
2883 }
2884 }
2885
2886 if (posPiKF) delete posPiKF; posPiKF=NULL; if (negPiKF) delete negPiKF; negPiKF=NULL;
2887
2888 } // checking ig gammajet because in that case the chargedparticle list is created
48682642 2889
48682642 2890 }
2eedd4ed 2891 ////////////////////////
2892
2893 // gamma+ pi+
2894 if(fDoJet == kTRUE){
2895 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
2896 AliKFConversionPhoton * rhoCandidateGammaDaughter = (AliKFConversionPhoton *)fKFReconstructedGammasTClone->At(firstGammaIndex);
2897 Int_t gamma1MotherLabel=-1;
2898 if(fDoMCTruth){
2899 Int_t indexKF1 = rhoCandidateGammaDaughter->GetV0Index();
2900 if(indexKF1<fV0Reader->GetNumberOfV0s()){
2901 fV0Reader->GetV0(indexKF1);//updates to the correct v0
2902
2903 if(fV0Reader->HasSameMCMother() == kTRUE){
2904 //cout<<"This v0 is a real v0!!!!"<<endl;
2905 TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
2906 TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
2907 if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){
2908 if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){
2909 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
2910 gamma1MotherLabel=fV0Reader->GetMotherMCParticle()->GetFirstMother();
2911 }
2912 }
2913 }
2914 }
2915 }
2916 }
2917
2918 AliKFParticle* posPiKF=NULL;
2919 AliKFParticle* negPiKF=NULL;
2920 Int_t piPlusMotherLabel=-1;
2921 Int_t piMinusMotherLabel=-1;
2922
2923 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
2924 AliESDtrack* posTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
2925 if (posTrack->GetSign()<0) continue;
2926 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(posTrack,AliPID::kPion))>2.) continue;
2927 if (posPiKF) delete posPiKF; posPiKF=NULL;
2928 posPiKF = new AliKFParticle( *(posTrack) ,211);
2929 AliKFParticle rhoPlusCandidate(*posPiKF,*rhoCandidateGammaDaughter);
2930 Double_t massRhoPlusCandidate = 0.;
2931 Double_t widthRhoPlusCandidate = 0.;
2932
2933 rhoPlusCandidate.GetMass(massRhoPlusCandidate,widthRhoPlusCandidate);
2934 fHistograms->FillHistogram("ESD_RhoPlus_InvMass_vs_Pt",massRhoPlusCandidate ,rhoPlusCandidate.GetPt());
2935 fHistograms->FillHistogram("ESD_RhoPlus_InvMass",massRhoPlusCandidate);
2936
2937
2938 if(fDoMCTruth){
2939 TParticle * positiveMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[iCh])->GetLabel()));
2940 if(positiveMCParticle->GetMother(0)>-1){
2941 piPlusMotherLabel = positiveMCParticle->GetMother(0);
2942 if(piPlusMotherLabel == gamma1MotherLabel){
2943 //Int_t geantCode=fStack->Particle(TMath::Abs(pionMotherLabel))->GetPdgCode();
2944 //cout<<"RhoPlus::" << geantCode<< endl;
2945 fHistograms->FillHistogram("ESD_TrueRhoPlus_InvMass_vs_Pt",massRhoPlusCandidate ,rhoPlusCandidate.GetPt());
2946 }
2947 }
2948 }
2949 for(Int_t jCh=0;jCh<fChargedParticles->GetEntriesFast();jCh++){
2950 AliESDtrack* negTrack = (AliESDtrack*)(fChargedParticles->At(jCh));
2951 if (negTrack->GetSign()>0) continue;
2952 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(negTrack,AliPID::kPion))>2.) continue;
2953 if (negPiKF) delete negPiKF; negPiKF=NULL;
2954 negPiKF = new AliKFParticle( *(negTrack) ,-211);
2955 AliKFParticle rho0Candidate(*posPiKF,*negPiKF,*rhoCandidateGammaDaughter);
2956 Double_t massRho0Candidate = 0.;
2957 Double_t widthRho0Candidate = 0.;
2958
2959 rho0Candidate.GetMass(massRho0Candidate,widthRho0Candidate);
2960 fHistograms->FillHistogram("ESD_Rho0_InvMass_vs_Pt",massRho0Candidate ,rho0Candidate.GetPt());
2961 fHistograms->FillHistogram("ESD_Rho0_InvMass",massRho0Candidate);
2962
2963 if(fDoMCTruth){
2964 TParticle * negativeMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[jCh])->GetLabel()));
2965 if(negativeMCParticle->GetMother(0)>-1){
2966 piMinusMotherLabel = negativeMCParticle->GetMother(0);
2967 if( piMinusMotherLabel == piPlusMotherLabel && piMinusMotherLabel==gamma1MotherLabel ){
2968 Int_t geantCode=fStack->Particle(TMath::Abs(piPlusMotherLabel))->GetPdgCode();
2969 if(geantCode == 221 || geantCode == 113){
2970 fHistograms->FillHistogram("ESD_TrueRho0_InvMass_vs_Pt",massRho0Candidate ,rho0Candidate.GetPt());
2971 }
2972 }
2973 }
2974 }
2975 }
2976
2977 }
2978
2979 if (posPiKF) delete posPiKF; posPiKF=NULL; if (negPiKF) delete negPiKF; negPiKF=NULL;
2980
2981
2982 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
2983 AliESDtrack* negTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
2984 if (negTrack->GetSign()>0) continue;
2985 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(negTrack,AliPID::kPion))>2.) continue;
2986 if (negPiKF) delete negPiKF; negPiKF=NULL;
2987 negPiKF = new AliKFParticle( *(negTrack) ,-211);
2988 AliKFParticle rhoMinusCandidate(*negPiKF,*rhoCandidateGammaDaughter);
2989 Double_t massRhoMinusCandidate = 0.;
2990 Double_t widthRhoMinusCandidate = 0.;
2991
2992 rhoMinusCandidate.GetMass(massRhoMinusCandidate,widthRhoMinusCandidate);
2993 fHistograms->FillHistogram("ESD_RhoMinus_InvMass_vs_Pt",massRhoMinusCandidate ,rhoMinusCandidate.GetPt());
2994 fHistograms->FillHistogram("ESD_RhoMinus_InvMass",massRhoMinusCandidate);
2995
2996 if(fDoMCTruth){
2997 TParticle * negativeMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[iCh])->GetLabel()));
2998 Int_t pionMotherLabel=-1;
2999
3000 if(negativeMCParticle->GetMother(0)>-1){
3001 pionMotherLabel = negativeMCParticle->GetMother(0);
3002 if(pionMotherLabel == gamma1MotherLabel){
3003 //Int_t geantCode=fStack->Particle(TMath::Abs(pionMotherLabel))->GetPdgCode();
3004 //cout<<"RhoMinus::" << geantCode<< endl;
3005 fHistograms->FillHistogram("ESD_TrueRhoMinus_InvMass_vs_Pt",massRhoMinusCandidate ,rhoMinusCandidate.GetPt());
3006 }
3007 }
3008 }
3009 }
3010 if (posPiKF) delete posPiKF; posPiKF=NULL; if (negPiKF) delete negPiKF; negPiKF=NULL;
3011
3012 AliKFParticle* posProtKF=NULL;
d7d7e825 3013
2eedd4ed 3014
3015 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
3016 AliESDtrack* posTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
3017 if (posTrack->GetSign()<0) continue;
3018 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(posTrack,AliPID::kProton))>2.) continue;
3019 if (posProtKF) delete posProtKF; posProtKF=NULL;
3020 posProtKF = new AliKFParticle( *(posTrack) ,2212);
3021 AliKFParticle deltaPlusCandidate(*posProtKF,*rhoCandidateGammaDaughter);
3022 Double_t massDeltaPlusCandidate = 0.;
3023 Double_t widthDeltaPlusCandidate = 0.;
3024
3025 deltaPlusCandidate.GetMass(massDeltaPlusCandidate,widthDeltaPlusCandidate);
3026 fHistograms->FillHistogram("ESD_DeltaPlus_InvMass_vs_Pt",massDeltaPlusCandidate ,deltaPlusCandidate.GetPt());
3027 fHistograms->FillHistogram("ESD_DeltaPlus_InvMass",massDeltaPlusCandidate);
3028
3029 if(fDoMCTruth){
3030 TParticle * positiveMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[iCh])->GetLabel()));
3031 Int_t protonMotherLabel=-1;
3032
3033 if(positiveMCParticle->GetMother(0)>-1){
3034 protonMotherLabel = positiveMCParticle->GetMother(0);
3035 if(protonMotherLabel == gamma1MotherLabel){
3036 //Int_t geantCode=fStack->Particle(TMath::Abs(pionMotherLabel))->GetPdgCode();
3037 //cout<<"RhoPlus::" << geantCode<< endl;
3038 fHistograms->FillHistogram("ESD_TrueDeltaPlus_InvMass_vs_Pt",massDeltaPlusCandidate ,deltaPlusCandidate.GetPt());
3039 }
3040 }
3041 }
3042
3043 }
3044 if (posPiKF) delete posPiKF; posPiKF=NULL; if (negPiKF) delete negPiKF; negPiKF=NULL; if (posProtKF) delete posProtKF; posProtKF=NULL;
3045 }
3046 }
3047
3048 if(fCalculateBackground){
3049
3050 AliGammaConversionBGHandler * bgHandler = fV0Reader->GetBGHandler();
3051
3052 Int_t zbin= bgHandler->GetZBinIndex(fV0Reader->GetVertexZ());
3053 Int_t mbin = 0;
3054 if(fUseTrackMultiplicityForBG == kTRUE){
3055 mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
3056 } else {
3057 mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->GetNGoodV0s());
3058 }
3059
3060 AliGammaConversionBGHandler::GammaConversionVertex *bgEventVertex = NULL;
3061
3062 // Background calculation for the omega
3063 for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
3064 AliGammaConversionKFVector * previousEventV0s = bgHandler->GetBGGoodV0s(zbin,mbin,nEventsInBG);
3065
3066 if(fMoveParticleAccordingToVertex == kTRUE){
3067 bgEventVertex = bgHandler->GetBGEventVertex(zbin,mbin,nEventsInBG);
3068 }
3069 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
3070 AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
3071
3072 if(fMoveParticleAccordingToVertex == kTRUE){
3073 MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
3074 }
3075
3076 for(Int_t firstPi0Index=0;firstPi0Index<fKFReconstructedPi0sTClone->GetEntriesFast();firstPi0Index++){
3077 AliKFParticle * omegaCandidatePi0Daughter = (AliKFParticle *)fKFReconstructedPi0sTClone->At(firstPi0Index);
3078 AliKFParticle * omegaBckCandidate = new AliKFParticle(*omegaCandidatePi0Daughter,previousGoodV0);
3079 Double_t massOmegaBckCandidate = 0.;
3080 Double_t widthOmegaBckCandidate = 0.;
3081
3082 omegaBckCandidate->GetMass(massOmegaBckCandidate,widthOmegaBckCandidate);
3083
3084
3085 fHistograms->FillHistogram("ESD_Omega_Bck_InvMass_vs_Pt",massOmegaBckCandidate ,omegaBckCandidate->GetPt());
3086 fHistograms->FillHistogram("ESD_Omega_Bck_InvMass",massOmegaBckCandidate);
3087
3088 delete omegaBckCandidate;
3089 }
3090
3091 // Bck for gamma pi+ pi-
3092
3093 AliKFParticle* posPiKF=NULL;
3094 AliKFParticle* negPiKF=NULL;
3095
3096 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
3097 AliESDtrack* posTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
3098 if (posTrack->GetSign()<0) continue;
3099 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(posTrack,AliPID::kPion))>2.) continue;
3100 if (posPiKF) delete posPiKF; posPiKF=NULL;
3101 posPiKF = new AliKFParticle( *(posTrack) ,211);
3102
3103 for(Int_t jCh=0;jCh<fChargedParticles->GetEntriesFast();jCh++){
3104 AliESDtrack* negTrack = (AliESDtrack*)(fChargedParticles->At(jCh));
3105 if (negTrack->GetSign()>0) continue;
3106 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(negTrack,AliPID::kPion))>2.) continue;
3107 if (negPiKF) delete negPiKF; negPiKF=NULL;
3108 negPiKF = new AliKFParticle( *(negTrack) ,-211);
3109 AliKFParticle rho0BckCandidate(*posPiKF,*negPiKF,previousGoodV0);
3110 Double_t massRho0BckCandidate = 0.;
3111 Double_t widthRho0BckCandidate = 0.;
3112
3113 rho0BckCandidate.GetMass(massRho0BckCandidate,widthRho0BckCandidate);
3114 fHistograms->FillHistogram("ESD_Rho0Bck_InvMass_vs_Pt",massRho0BckCandidate ,rho0BckCandidate.GetPt());
3115 fHistograms->FillHistogram("ESD_Rho0Bck_InvMass",massRho0BckCandidate);
3116 }
3117
3118 }
3119
3120 if (posPiKF) delete posPiKF; posPiKF=NULL; if (negPiKF) delete negPiKF; negPiKF=NULL;
04bf4381 3121
04bf4381 3122
2eedd4ed 3123 }
3124 }
3125 } // end of checking if background calculation is available
3126}
04bf4381 3127
3128
d7d7e825 3129void AliAnalysisTaskGammaConversion::ProcessGammasForNeutralMesonAnalysis(){
2eedd4ed 3130 // see header file for documentation
d7d7e825 3131
2eedd4ed 3132 // for(UInt_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammas.size();firstGammaIndex++){
3133 // for(UInt_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fKFReconstructedGammas.size();secondGammaIndex++){
037dc2db 3134
2eedd4ed 3135 fESDEvent = fV0Reader->GetESDEvent();
5ce758b0 3136
2eedd4ed 3137 if(fKFReconstructedGammasTClone->GetEntriesFast()>fV0Reader->GetNumberOfV0s()){
3138 cout<<"Warning, number of entries in the tclone is bigger than number of v0s"<<endl;
3139 }
037dc2db 3140
2eedd4ed 3141 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
3142 for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();secondGammaIndex++){
a0b94e5c 3143
2eedd4ed 3144 // AliKFParticle * twoGammaDecayCandidateDaughter0 = &fKFReconstructedGammas[firstGammaIndex];
3145 // AliKFParticle * twoGammaDecayCandidateDaughter1 = &fKFReconstructedGammas[secondGammaIndex];
a0b94e5c 3146
2eedd4ed 3147 AliKFConversionPhoton * twoGammaDecayCandidateDaughter0 = (AliKFConversionPhoton *)fKFReconstructedGammasTClone->At(firstGammaIndex);
3148 AliKFConversionPhoton * twoGammaDecayCandidateDaughter1 = (AliKFConversionPhoton *)fKFReconstructedGammasTClone->At(secondGammaIndex);
3149
3150 if(twoGammaDecayCandidateDaughter0->GetTrackLabelPositive()==twoGammaDecayCandidateDaughter1->GetTrackLabelPositive()||
3151 twoGammaDecayCandidateDaughter0->GetTrackLabelPositive()==twoGammaDecayCandidateDaughter1->GetTrackLabelNegative()||
3152 twoGammaDecayCandidateDaughter0->GetTrackLabelNegative()==twoGammaDecayCandidateDaughter1->GetTrackLabelPositive()||
3153 twoGammaDecayCandidateDaughter0->GetTrackLabelNegative()==twoGammaDecayCandidateDaughter1->GetTrackLabelNegative())continue;
d7d7e825 3154
2eedd4ed 3155 AliKFConversionMother *twoGammaCandidate = new AliKFConversionMother(*twoGammaDecayCandidateDaughter0,*twoGammaDecayCandidateDaughter1);
3156 twoGammaCandidate->SetGammaLabels(firstGammaIndex,secondGammaIndex);
3157
3158 Double_t massTwoGammaCandidate = 0.;
3159 Double_t widthTwoGammaCandidate = 0.;
3160 Double_t chi2TwoGammaCandidate =10000.;
3161 twoGammaCandidate->GetMass(massTwoGammaCandidate,widthTwoGammaCandidate);
3162 // if(twoGammaCandidate->GetNDF()>0){
3163 // chi2TwoGammaCandidate = twoGammaCandidate->GetChi2()/twoGammaCandidate->GetNDF();
3164 chi2TwoGammaCandidate = twoGammaCandidate->GetChi2();
d7d7e825 3165
2eedd4ed 3166 fHistograms->FillHistogram("ESD_Mother_Chi2",chi2TwoGammaCandidate);
3167 if((chi2TwoGammaCandidate>0 && chi2TwoGammaCandidate<fV0Reader->GetChi2CutMeson()) || fApplyChi2Cut == kFALSE){
d7d7e825 3168
2eedd4ed 3169 TVector3 momentumVectorTwoGammaCandidate(twoGammaCandidate->GetPx(),twoGammaCandidate->GetPy(),twoGammaCandidate->GetPz());
3170 TVector3 spaceVectorTwoGammaCandidate(twoGammaCandidate->GetX(),twoGammaCandidate->GetY(),twoGammaCandidate->GetZ());
3171
3172 Double_t openingAngleTwoGammaCandidate = twoGammaCandidate->GetOpeningAngle();
dc2883e4 3173
2eedd4ed 3174 Double_t rapidity=twoGammaCandidate->GetRapidity();
3175
3176 if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut()){
3177 delete twoGammaCandidate;
3178 continue; // rapidity cut
3179 }
dc2883e4 3180
2eedd4ed 3181 Double_t alfa=twoGammaCandidate->GetAlpha();
dc2883e4 3182
2eedd4ed 3183
3184 if(openingAngleTwoGammaCandidate < fMinOpeningAngleGhostCut){
3185 delete twoGammaCandidate;
3186 continue; // minimum opening angle to avoid using ghosttracks
3187 }
1e7846f4 3188
2eedd4ed 3189 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
3190 fHistograms->FillHistogram("ESD_Mother_GammaDaughter_OpeningAngle", openingAngleTwoGammaCandidate);
3191 fHistograms->FillHistogram("ESD_Mother_Energy", twoGammaCandidate->GetE());
3192 fHistograms->FillHistogram("ESD_Mother_Pt", momentumVectorTwoGammaCandidate.Pt());
3193 fHistograms->FillHistogram("ESD_Mother_Eta", momentumVectorTwoGammaCandidate.Eta());
3194 fHistograms->FillHistogram("ESD_Mother_Rapid", rapidity);
3195 fHistograms->FillHistogram("ESD_Mother_Phi", spaceVectorTwoGammaCandidate.Phi());
3196 fHistograms->FillHistogram("ESD_Mother_Mass", massTwoGammaCandidate);
3197 fHistograms->FillHistogram("ESD_Mother_alfa", alfa);
3198 if( (massTwoGammaCandidate > 0.1) && (massTwoGammaCandidate < 0.15) ){
3199 fHistograms->FillHistogram("ESD_Mother_alfa_Pi0", alfa);
3200 fHistograms->FillHistogram("ESD_Mother_Pt_alpha_Pi0", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3201 }
3202 if( (massTwoGammaCandidate > 0.5) && (massTwoGammaCandidate < 0.57) ){
3203 fHistograms->FillHistogram("ESD_Mother_alfa_Eta", alfa);
3204 fHistograms->FillHistogram("ESD_Mother_Pt_alpha_Eta", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3205 }
3206
3207 fHistograms->FillHistogram("ESD_Mother_R", spaceVectorTwoGammaCandidate.Pt()); // Pt in Space == R!!!
3208 fHistograms->FillHistogram("ESD_Mother_ZR", twoGammaCandidate->GetZ(), spaceVectorTwoGammaCandidate.Pt());
3209 fHistograms->FillHistogram("ESD_Mother_XY", twoGammaCandidate->GetX(), twoGammaCandidate->GetY());
3210 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3211 fHistograms->FillHistogram("ESD_Mother_InvMass",massTwoGammaCandidate);
3212 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_alpha",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3213 }
3214 if(alfa<0.1){
3215 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_E_alpha",massTwoGammaCandidate ,twoGammaCandidate->GetE());
3216 }
3217
3218 if(fCalculateBackground){
3219 /* Kenneth, just for testing*/
3220 AliGammaConversionBGHandler * bgHandlerTest = fV0Reader->GetBGHandler();
3221
3222 Int_t zbin= bgHandlerTest->GetZBinIndex(fV0Reader->GetVertexZ());
3223 Int_t mbin=0;
3224 Int_t multKAA=0;
3225 if(fUseTrackMultiplicityForBG == kTRUE){
3226 multKAA=fV0Reader->CountESDTracks();
3227 mbin = bgHandlerTest->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
3228 }
3229 else{// means we use #v0s for multiplicity
3230 multKAA=fV0Reader->GetNGoodV0s();
3231 mbin = bgHandlerTest->GetMultiplicityBinIndex(fV0Reader->GetNGoodV0s());
3232 }
3233 // cout<<"Filling bin number "<<zbin<<" and "<<mbin<<endl;
3234 // cout<<"Corresponding to z = "<<fV0Reader->GetVertexZ()<<" and m = "<<multKAA<<endl;
3235 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
3236 fHistograms->FillHistogram(Form("%d%dESD_Mother_InvMass",zbin,mbin),massTwoGammaCandidate);
3237 fHistograms->FillHistogram(Form("%d%dESD_Mother_InvMass_vs_Pt",zbin,mbin),massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3238 /* end Kenneth, just for testing*/
3239 fHistograms->FillHistogram(Form("%dESD_Mother_InvMass_vs_Pt",mbin),massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3240 }
3241 }
3242 /* if(fCalculateBackground){
3243 AliGammaConversionBGHandler * bgHandler = fV0Reader->GetBGHandler();
3244 Int_t mbin= bgHandler->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
3245 fHistograms->FillHistogram(Form("%dESD_Mother_InvMass_vs_Pt",mbin),massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3246 }*/
3247 // if(fDoNeutralMesonV0MCCheck){
3248 if(fDoMCTruth){
3249 //Kenneth: Checking the eta of the gamma to check the difference between 0.9 and 1.2
3250 Int_t indexKF1 = twoGammaDecayCandidateDaughter0->GetV0Index();
3251 if(indexKF1<fV0Reader->GetNumberOfV0s()){
3252 fV0Reader->GetV0(indexKF1);//updates to the correct v0
3253 Double_t eta1 = fV0Reader->GetMotherCandidateEta();
3254 Bool_t isRealPi0=kFALSE;
3255 Bool_t isRealEta=kFALSE;
3256 Int_t gamma1MotherLabel=-1;
3257 if(fV0Reader->HasSameMCMother() == kTRUE){
3258 //cout<<"This v0 is a real v0!!!!"<<endl;
3259 TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
3260 TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
3261 if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){
3262 if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){
3263 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
3264 gamma1MotherLabel=fV0Reader->GetMotherMCParticle()->GetFirstMother();
3265 }
3266 }
3267 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() ==111){
3268 gamma1MotherLabel=-111;
3269 }
3270 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() ==221){
3271 gamma1MotherLabel=-221;
3272 }
3273 }
3274 }
3275 Int_t indexKF2 = twoGammaDecayCandidateDaughter1->GetV0Index();
3276 if(indexKF1 == indexKF2){
3277 cout<<"index of the two KF particles are the same.... should not happen"<<endl;
3278 }
3279 if(indexKF2<fV0Reader->GetNumberOfV0s()){
3280 fV0Reader->GetV0(indexKF2);
3281 Double_t eta2 = fV0Reader->GetMotherCandidateEta();
3282 Int_t gamma2MotherLabel=-1;
3283 if(fV0Reader->HasSameMCMother() == kTRUE){
3284 TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
3285 TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
3286 if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){
3287 if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){
3288 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
3289 gamma2MotherLabel=fV0Reader->GetMotherMCParticle()->GetFirstMother();
3290 }
3291 }
3292 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() ==111){
3293 gamma2MotherLabel=-111;
3294 }
3295 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() ==221){
3296 gamma2MotherLabel=-221;
3297 }
3298
3299 }
3300 }
3301 if(gamma1MotherLabel>=0 && gamma1MotherLabel==gamma2MotherLabel){
3302 if(fV0Reader->CheckIfPi0IsMother(gamma1MotherLabel)){
3303 isRealPi0=kTRUE;
3304 }
3305 if(fV0Reader->CheckIfEtaIsMother(gamma1MotherLabel)){
3306 isRealEta=kTRUE;
3307 }
3308 }
3309
3310 //cout << "alpha " << alfa << endl;
3311 if(isRealPi0)fHistograms->FillHistogram("ESD_TruePi0_alpha",alfa);
3312 if(isRealEta)fHistograms->FillHistogram("ESD_TrueEta_alpha",alfa);
3313
3314 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
3315 if(TMath::Abs(eta1)>0.9 && TMath::Abs(eta2)>0.9){
3316 // fHistograms->FillHistogram("ESD_Mother_InvMass_1212",massTwoGammaCandidate);
3317 // fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt1212",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3318 if(isRealPi0 || isRealEta){
3319 fHistograms->FillHistogram("ESD_TruePi0_InvMass_1212",massTwoGammaCandidate);
3320 fHistograms->FillHistogram("ESD_TruePi0_OpeningAngle_1212",openingAngleTwoGammaCandidate);
3321 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt1212",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3322 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3323 fHistograms->FillHistogram("ESD_TruePi0_InvMass",massTwoGammaCandidate);
3324 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt_alpha",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3325 if( (isRealPi0) && (massTwoGammaCandidate > 0.1) && (massTwoGammaCandidate < 0.15) )
3326 fHistograms->FillHistogram("ESD_TruePi0_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3327 if( (isRealEta) && (massTwoGammaCandidate > 0.5) && (massTwoGammaCandidate < 0.57) )
3328 fHistograms->FillHistogram("ESD_TrueEta_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3329
3330 }
3331
3332 if(!isRealPi0 && !isRealEta){
3333 if(gamma1MotherLabel>-1 && gamma2MotherLabel>-1){
3334 fHistograms->FillHistogram("ESD_TrueBckGG_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3335 } else {
3336 fHistograms->FillHistogram("ESD_TrueBckCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3337 }
3338 if(gamma1MotherLabel==-111 || gamma2MotherLabel==-111 || gamma1MotherLabel==-221 || gamma2MotherLabel==-221){
3339 fHistograms->FillHistogram("ESD_TruePi0DalitzCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3340 }
3341 }
3342 } else if(TMath::Abs(eta1)>0.9 || TMath::Abs(eta2)>0.9){
3343 // fHistograms->FillHistogram("ESD_Mother_InvMass_0912",massTwoGammaCandidate);
3344 // fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt0912",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3345
3346 if(isRealPi0 || isRealEta){
3347 fHistograms->FillHistogram("ESD_TruePi0_InvMass_0912",massTwoGammaCandidate);
3348 fHistograms->FillHistogram("ESD_TruePi0_OpeningAngle_0912",openingAngleTwoGammaCandidate);
3349 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt0912",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3350 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3351 fHistograms->FillHistogram("ESD_TruePi0_InvMass",massTwoGammaCandidate);
3352 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt_alpha",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3353 if( (isRealPi0) && (massTwoGammaCandidate > 0.1) && (massTwoGammaCandidate < 0.15) )
3354 fHistograms->FillHistogram("ESD_TruePi0_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3355 if( (isRealEta) && (massTwoGammaCandidate > 0.5) && (massTwoGammaCandidate < 0.57) )
3356 fHistograms->FillHistogram("ESD_TrueEta_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3357 }
3358 if(!isRealPi0 && !isRealEta){
3359 if(gamma1MotherLabel>-1 && gamma2MotherLabel>-1){
3360 fHistograms->FillHistogram("ESD_TrueBckGG_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3361 }else{
3362 fHistograms->FillHistogram("ESD_TrueBckCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3363 }
3364 if(gamma1MotherLabel==-111 || gamma2MotherLabel==-111 || gamma1MotherLabel==-221 || gamma2MotherLabel==-221){
3365 fHistograms->FillHistogram("ESD_TruePi0DalitzCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3366 }
3367 }
3368 } else {
3369 // fHistograms->FillHistogram("ESD_Mother_InvMass_0909",massTwoGammaCandidate);
3370 // fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt0909",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3371 if(isRealPi0 || isRealEta){
3372 fHistograms->FillHistogram("ESD_TruePi0_InvMass_0909",massTwoGammaCandidate);
3373 fHistograms->FillHistogram("ESD_TruePi0_OpeningAngle_0909",openingAngleTwoGammaCandidate);
3374 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt0909",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3375 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3376 fHistograms->FillHistogram("ESD_TruePi0_InvMass",massTwoGammaCandidate);
3377 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt_alpha",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3378 if( (isRealPi0) && (massTwoGammaCandidate > 0.1) && (massTwoGammaCandidate < 0.15) )
3379 fHistograms->FillHistogram("ESD_TruePi0_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3380 if( (isRealEta) && (massTwoGammaCandidate > 0.5) && (massTwoGammaCandidate < 0.57) )
3381 fHistograms->FillHistogram("ESD_TrueEta_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3382 if(gamma1MotherLabel > fV0Reader->GetMCStack()->GetNprimary()){
3383 fHistograms->FillHistogram("ESD_TruePi0Sec_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3384 TParticle * secPi0MC = (TParticle*)fStack->Particle(fV0Reader->GetMotherMCParticle()->GetFirstMother());
3385 if (secPi0MC->GetMother(0) >-1){
3386 if(fStack->Particle(secPi0MC->GetMother(0))->GetPdgCode()==kK0Short){
3387 fHistograms->FillHistogram("ESD_TruePi0SecFromK0S_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
69b05e50 3388 if(massTwoGammaCandidate>0.09 && massTwoGammaCandidate<0.145){
3389 fHistograms->FillHistogram("ESD_K0SFromSecPi0_Pt",fStack->Particle(secPi0MC->GetMother(0))->Pt());
3390 }
2eedd4ed 3391 }
3392 }
3393 }
3394 }
3395 if(!isRealPi0 && !isRealEta){
3396 if(gamma1MotherLabel>-1 && gamma2MotherLabel>-1){
3397 fHistograms->FillHistogram("ESD_TrueBckGG_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3398 }else{
3399 fHistograms->FillHistogram("ESD_TrueBckCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3400 }
3401 if(gamma1MotherLabel==-111 || gamma2MotherLabel==-111 || gamma1MotherLabel==-221 || gamma2MotherLabel==-221 ){
3402 fHistograms->FillHistogram("ESD_TruePi0DalitzCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3403 }
3404 }
3405 }
3406 }
3407 }
3408 }
3409 }
3410 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
3411 if ( TMath::Abs(twoGammaDecayCandidateDaughter0->GetEta())<0.9 && TMath::Abs(twoGammaDecayCandidateDaughter1->GetEta())<0.9 ){
3412 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_Fiducial",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3413 fHistograms->FillHistogram("ESD_Mother_InvMass_Fiducial",massTwoGammaCandidate);
3414 }
3415
3416 if(TMath::Abs(twoGammaDecayCandidateDaughter0->GetEta())>0.9 && TMath::Abs(twoGammaDecayCandidateDaughter1->GetEta())>0.9){
3417 fHistograms->FillHistogram("ESD_Mother_InvMass_1212",massTwoGammaCandidate);
3418 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt1212",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3419 }
3420 else if(TMath::Abs(twoGammaDecayCandidateDaughter0->GetEta())>0.9 || TMath::Abs(twoGammaDecayCandidateDaughter1->GetEta())>0.9){
3421 fHistograms->FillHistogram("ESD_Mother_InvMass_0912",massTwoGammaCandidate);
3422 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt0912",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3423 }
3424 else{
3425 fHistograms->FillHistogram("ESD_Mother_InvMass_0909",massTwoGammaCandidate);
3426 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt0909",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3427 }
3428
3429 Double_t lowMassPi0=0.1;
3430 Double_t highMassPi0=0.15;
3431 if ( ( massTwoGammaCandidate > lowMassPi0) && (massTwoGammaCandidate < highMassPi0) ){
3432 new((*fKFReconstructedPi0sTClone)[fKFReconstructedPi0sTClone->GetEntriesFast()]) AliKFConversionMother(*twoGammaCandidate);
3433 }
3434
3435 if( fKFCreateAOD ) {
3436 lowMassPi0=0.08;
3437 highMassPi0=0.2;
3438 Double_t lowMassEta=0.4;
3439 Double_t highMassEta=0.7;
3440
3441 if ( ( massTwoGammaCandidate > lowMassPi0) && (massTwoGammaCandidate < highMassPi0) ){
3442
3443 TagDaughter(twoGammaCandidate->GetGammaLabel(0));
3444 TagDaughter(twoGammaCandidate->GetGammaLabel(1));
3445 // AddPionToAOD(twoGammaCandidate);
3446 } else if ( ( massTwoGammaCandidate > lowMassEta) && (massTwoGammaCandidate < highMassEta) ){
3447 TagDaughter(twoGammaCandidate->GetGammaLabel(0));
3448 TagDaughter(twoGammaCandidate->GetGammaLabel(1));
3449 // AddPionToAOD(twoGammaCandidate);
3450 }
3451 } // if create aod
3452
3453 }
3454 }
3455 delete twoGammaCandidate;
3456 }
cc5a88a2 3457 }
2eedd4ed 3458}
cc5a88a2 3459
2eedd4ed 3460///__________________________________________________________________________________
3461void AliAnalysisTaskGammaConversion::AddGammaToAOD(AliKFConversionPhoton * kfParticle) {
9640a3d1 3462
2eedd4ed 3463 //Fill AOD with particles
3464 TClonesArray *branch=fAODGamma;
3465 if(branch){
fd420a4f 3466 new((*branch)[branch->GetEntriesFast()]) AliAODConversionPhoton(kfParticle);
3b77b2d1 3467 static_cast<AliAODConversionPhoton*>(branch->Last())->SetMass(kfParticle->M());
3468 }
3469 else {
fd420a4f 3470 return;
d7d7e825 3471 }
d7d7e825 3472}
3473
2eedd4ed 3474/*///__________________________________________________________________________________
3475void AliAnalysisTaskGammaConversion::AddPionToAOD(AliKFConversionMother * kfParticle) {
3476
3477 //Add pions to AOD
3478 TClonesArray *branch=fAODPi0;
3479
3480 if(branch){
3481 new((*branch)[branch->GetEntriesFast()]) AliAODConversionMother(kfParticle);
18922343 3482 }
2eedd4ed 3483
3484 TagDaughter(kfParticle->GetGammaLabel(0));
3485 TagDaughter(kfParticle->GetGammaLabel(1));
81900183 3486}
3487
3488///__________________________________________________________________________________
2eedd4ed 3489void AliAnalysisTaskGammaConversion::AddOmegaToAOD(AliKFParticle * kfParticle, Int_t daughter1, Int_t daughter2) {
81900183 3490
2eedd4ed 3491 //Add omegas to AOD
81900183 3492
2eedd4ed 3493 TClonesArray *branch=fAODOmega;
3494 // Get Daughters
3495 // AliAODConversionPhoton * fdaughter1 = dynamic_cast<AliAODConversionPhoton*>(fAODGamma->At(daughter1));
3496 // AliAODConversionPhoton * fdaughter2 = dynamic_cast<AliAODConversionPhoton*>(fAODGamma->At(daughter2));
81900183 3497
2eedd4ed 3498 if(branch){
3499 // new((*branch)[branch->GetEntriesFast()]) AliAODConversionMother(kfParticle);
3500 }
3501
3502 TagDaughter(daughter1);
3503 TagDaughter(daughter2);
3504
3505
3506}
3507*/
81900183 3508///__________________________________________________________________________________
3509void AliAnalysisTaskGammaConversion::TagDaughter(Int_t gammaIndex) {
2eedd4ed 3510 //Set conversion tag on pion daughters
3511 AliAODConversionPhoton * daughter = dynamic_cast<AliAODConversionPhoton*>(fAODGamma->At(gammaIndex));
3512 if(daughter) {
3513 daughter->SetTag(kTRUE);
3514 } else {
3515 AliError("Daughter not in gamma tree!!");
3516 }
81900183 3517}
3518
3519///___________________________________________________________________________________
3520void AliAnalysisTaskGammaConversion::FillAODWithConversionGammas(){
2eedd4ed 3521 // Fill AOD with reconstructed Gamma
3522 for(Int_t gammaIndex=0;gammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();gammaIndex++){
3523 AliKFConversionPhoton * gammakf = dynamic_cast<AliKFConversionPhoton*>(fKFReconstructedGammasTClone->At(gammaIndex));
3524 if(gammakf) {
3525 AddGammaToAOD(gammakf);
3526 }
3527 }
04bf4381 3528}
3529
48682642 3530/*
2eedd4ed 3531 void AliAnalysisTaskGammaConversion::ProcessConvPHOSGammasForNeutralMesonAnalysis(){
3532
3533 // see header file for documentation
3534 // Analyse Pi0 with one photon from Phos and 1 photon from conversions
3535
3536
3537
3538 Double_t vtx[3];
3539 vtx[0] = fV0Reader->GetPrimaryVertex()->GetX();
3540 vtx[1] = fV0Reader->GetPrimaryVertex()->GetY();
3541 vtx[2] = fV0Reader->GetPrimaryVertex()->GetZ();
3542
3543
3544 // Loop over all CaloClusters and consider only the PHOS ones:
3545 AliESDCaloCluster *clu;
3546 TLorentzVector pPHOS;
3547 TLorentzVector gammaPHOS;
3548 TLorentzVector gammaGammaConv;
3549 TLorentzVector pi0GammaConvPHOS;
3550 TLorentzVector gammaGammaConvBck;
3551 TLorentzVector pi0GammaConvPHOSBck;
3552
3553
3554 for (Int_t i=0; i<fV0Reader->GetESDEvent()->GetNumberOfCaloClusters(); i++) {
3555 clu = fV0Reader->GetESDEvent()->GetCaloCluster(i);
3556 if ( !clu->IsPHOS() || clu->E()<0.1 ) continue;
3557 clu ->GetMomentum(pPHOS ,vtx);
3558 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
3559 AliKFParticle * twoGammaDecayCandidateDaughter0 = (AliKFParticle *)fKFReconstructedGammasTClone->At(firstGammaIndex);
3560 gammaGammaConv.SetXYZM(twoGammaDecayCandidateDaughter0->Px(),twoGammaDecayCandidateDaughter0->Py(),twoGammaDecayCandidateDaughter0->Pz(),0.);
3561 gammaPHOS.SetXYZM(pPHOS.Px(),pPHOS.Py(),pPHOS.Pz(),0.);
3562 pi0GammaConvPHOS=gammaGammaConv+gammaPHOS;
3563 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvPHOS",pi0GammaConvPHOS.M());
3564 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_GammaConvPHOS",pi0GammaConvPHOS.M(),pi0GammaConvPHOS.Pt());
3565
3566 TVector3 v3D0(twoGammaDecayCandidateDaughter0->Px(),twoGammaDecayCandidateDaughter0->Py(),twoGammaDecayCandidateDaughter0->Pz());
3567 TVector3 v3D1(gammaPHOS.Px(),gammaPHOS.Py(),gammaPHOS.Pz());
3568 Double_t opanConvPHOS= v3D0.Angle(v3D1);
3569 if ( opanConvPHOS < 0.35){
3570 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvPHOS_OpanLow",pi0GammaConvPHOS.M());
3571 }else{
3572 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvPHOS_OpanHigh",pi0GammaConvPHOS.M());
3573 }
3574
3575 }
3576
3577 // Now the LorentVector pPHOS is obtained and can be paired with the converted proton
3578 }
3579 //==== End of the PHOS cluster selection ============
3580 TLorentzVector pEMCAL;
3581 TLorentzVector gammaEMCAL;
3582 TLorentzVector pi0GammaConvEMCAL;
3583 TLorentzVector pi0GammaConvEMCALBck;
3584
3585 for (Int_t i=0; i<fV0Reader->GetESDEvent()->GetNumberOfCaloClusters(); i++) {
3586 clu = fV0Reader->GetESDEvent()->GetCaloCluster(i);
3587 if ( !clu->IsEMCAL() || clu->E()<0.1 ) continue;
3588 if (clu->GetNCells() <= 1) continue;
3589 if ( clu->GetTOF()*1e9 < 550 || clu->GetTOF()*1e9 > 750) continue;
3590
3591 clu ->GetMomentum(pEMCAL ,vtx);
3592 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
3593 AliKFParticle * twoGammaDecayCandidateDaughter0 = (AliKFParticle *)fKFReconstructedGammasTClone->At(firstGammaIndex);
3594 gammaGammaConv.SetXYZM(twoGammaDecayCandidateDaughter0->Px(),
3595 twoGammaDecayCandidateDaughter0->Py(),
3596 twoGammaDecayCandidateDaughter0->Pz(),0.);
3597 gammaEMCAL.SetXYZM(pEMCAL.Px(),pEMCAL.Py(),pEMCAL.Pz(),0.);
3598 pi0GammaConvEMCAL=gammaGammaConv+gammaEMCAL;
3599 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvEMCAL",pi0GammaConvEMCAL.M());
3600 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_GammaConvEMCAL",pi0GammaConvEMCAL.M(),pi0GammaConvEMCAL.Pt());
3601 TVector3 v3D0(twoGammaDecayCandidateDaughter0->Px(),
3602 twoGammaDecayCandidateDaughter0->Py(),
3603 twoGammaDecayCandidateDaughter0->Pz());
3604 TVector3 v3D1(gammaEMCAL.Px(),gammaEMCAL.Py(),gammaEMCAL.Pz());
3605
3606
3607 Double_t opanConvEMCAL= v3D0.Angle(v3D1);
3608 if ( opanConvEMCAL < 0.35){
3609 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvEMCAL_OpanLow",pi0GammaConvEMCAL.M());
3610 }else{
3611 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvEMCAL_OpanHigh",pi0GammaConvEMCAL.M());
3612 }
3613
3614 }
3615 if(fCalculateBackground){
3616 for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
3617 AliGammaConversionKFVector * previousEventV0s = fV0Reader->GetBGGoodV0s(nEventsInBG);
3618 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
3619 AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
3620 gammaGammaConvBck.SetXYZM(previousGoodV0.Px(),
3621 previousGoodV0.Py(),
3622 previousGoodV0.Pz(),0.);
3623 pi0GammaConvEMCALBck=gammaGammaConvBck+gammaEMCAL;
3624 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvEMCAL_Bck",pi0GammaConvEMCALBck.M());
3625 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_GammaConvEMCAL_Bck",pi0GammaConvEMCALBck.M(),
3626 pi0GammaConvEMCALBck.Pt());
3627 }
3628 }
3629
3630 // Now the LorentVector pEMCAL is obtained and can be paired with the converted proton
3631 } // end of checking if background photons are available
3632 }
3633 //==== End of the PHOS cluster selection ============
3634
3635 }
48682642 3636*/
6272370b 3637
77ac6f3e 3638void AliAnalysisTaskGammaConversion::MoveParticleAccordingToVertex(AliKFParticle * particle,const AliGammaConversionBGHandler::GammaConversionVertex *vertex){
2eedd4ed 3639 //see header file for documentation
3640
3641 Double_t dx = vertex->fX - fESDEvent->GetPrimaryVertex()->GetX();
3642 Double_t dy = vertex->fY - fESDEvent->GetPrimaryVertex()->GetY();
3643 Double_t dz = vertex->fZ - fESDEvent->GetPrimaryVertex()->GetZ();
3644
3645 // cout<<"dx, dy, dz: ["<<dx<<","<<dy<<","<<dz<<"]"<<endl;
3646 particle->X() = particle->GetX() - dx;
3647 particle->Y() = particle->GetY() - dy;
3648 particle->Z() = particle->GetZ() - dz;
5ce758b0 3649}
3650
111d75df 3651void AliAnalysisTaskGammaConversion::RotateKFParticle(AliKFParticle * kfParticle,Double_t angle){
2eedd4ed 3652 // Before rotate needs to be moved to position 0,0,0, ; move back after rotation
3653 Double_t dx = fESDEvent->GetPrimaryVertex()->GetX()-0.;
3654 Double_t dy = fESDEvent->GetPrimaryVertex()->GetY()-0.;
3655 Double_t dz = fESDEvent->GetPrimaryVertex()->GetZ()-0.;
3656
3657 kfParticle->X() = kfParticle->GetX() - dx;
3658 kfParticle->Y() = kfParticle->GetY() - dy;
3659 kfParticle->Z() = kfParticle->GetZ() - dz;
3660
3661
3662 // Rotate the kf particle
3663 Double_t c = cos(angle);
3664 Double_t s = sin(angle);
3665
3666 Double_t mA[8][ 8];
3667 for( Int_t i=0; i<8; i++ ){
3668 for( Int_t j=0; j<8; j++){
3669 mA[i][j] = 0;
3670 }
3671 }
3672 for( int i=0; i<8; i++ ){
3673 mA[i][i] = 1;
3674 }
3675 mA[0][0] = c; mA[0][1] = s;
3676 mA[1][0] = -s; mA[1][1] = c;
3677 mA[3][3] = c; mA[3][4] = s;
3678 mA[4][3] = -s; mA[4][4] = c;
3679
3680 Double_t mAC[8][8];
3681 Double_t mAp[8];
3682 for( Int_t i=0; i<8; i++ ){
3683 mAp[i] = 0;
3684 for( Int_t k=0; k<8; k++){
3685 mAp[i]+=mA[i][k] * kfParticle->GetParameter(k);
3686 }
3687 }
3688
3689 for( Int_t i=0; i<8; i++){
3690 kfParticle->Parameter(i) = mAp[i];
3691 }
3692
3693 for( Int_t i=0; i<8; i++ ){
3694 for( Int_t j=0; j<8; j++ ){
3695 mAC[i][j] = 0;
3696 for( Int_t k=0; k<8; k++ ){
77ac6f3e 3697 mAC[i][j]+= mA[i][k] * kfParticle->GetCovariance(k,j);
2eedd4ed 3698 }
3699 }
3700 }
111d75df 3701
2eedd4ed 3702 for( Int_t i=0; i<8; i++ ){
3703 for( Int_t j=0; j<=i; j++ ){
3704 Double_t xx = 0;
3705 for( Int_t k=0; k<8; k++){
77ac6f3e 3706 xx+= mAC[i][k]*mA[j][k];
2eedd4ed 3707 }
3708 kfParticle->Covariance(i,j) = xx;
3709 }
3710 }
5510ebe1 3711
2eedd4ed 3712 Double_t dx1 = 0.-fESDEvent->GetPrimaryVertex()->GetX();
3713 Double_t dy1 = 0.-fESDEvent->GetPrimaryVertex()->GetY();
3714 Double_t dz1 = 0.-fESDEvent->GetPrimaryVertex()->GetZ();
3715
3716 kfParticle->X() = kfParticle->GetX() - dx1;
3717 kfParticle->Y() = kfParticle->GetY() - dy1;
3718 kfParticle->Z() = kfParticle->GetZ() - dz1;
5510ebe1 3719
111d75df 3720}
3721
3722
d7d7e825 3723void AliAnalysisTaskGammaConversion::CalculateBackground(){
2eedd4ed 3724 // see header file for documentation
5e55d806 3725
3726
2eedd4ed 3727 TClonesArray * currentEventV0s = fV0Reader->GetCurrentEventGoodV0s();
5e55d806 3728
2eedd4ed 3729 AliGammaConversionBGHandler * bgHandler = fV0Reader->GetBGHandler();
3730
3731 Int_t zbin= bgHandler->GetZBinIndex(fV0Reader->GetVertexZ());
3732 Int_t mbin = 0;
3733 if(fUseTrackMultiplicityForBG == kTRUE){
3734 mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
3735 }
3736 else{
3737 mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->GetNGoodV0s());
3738 }
5ce758b0 3739
2eedd4ed 3740 if(fDoRotation == kTRUE){
5510ebe1 3741
2eedd4ed 3742 for(Int_t iCurrent=0;iCurrent<currentEventV0s->GetEntriesFast();iCurrent++){
3743 AliKFParticle currentEventGoodV0 = *(AliKFParticle *)(currentEventV0s->At(iCurrent));
3744 for(Int_t iCurrent2=iCurrent+1;iCurrent2<currentEventV0s->GetEntriesFast();iCurrent2++){
77ac6f3e 3745 for(Int_t nRandom=0;nRandom<fNRandomEventsForBG;nRandom++){
111d75df 3746
2eedd4ed 3747 AliKFParticle currentEventGoodV02 = *(AliKFParticle *)(currentEventV0s->At(iCurrent2));
3bfbe89a 3748
2eedd4ed 3749 if(fCheckBGProbability == kTRUE){
3750 Double_t massBGprob =0.;
3751 Double_t widthBGprob = 0.;
3752 AliKFParticle *backgroundCandidateProb = new AliKFParticle(currentEventGoodV0,currentEventGoodV02);
3753 backgroundCandidateProb->GetMass(massBGprob,widthBGprob);
3754 if(massBGprob>0.1 && massBGprob<0.14){
3755 if(fRandom.Rndm()>bgHandler->GetBGProb(zbin,mbin)){
3bfbe89a 3756 delete backgroundCandidateProb;
3757 continue;
2eedd4ed 3758 }
3759 }
3760 delete backgroundCandidateProb;
3761 }
3762
3763 Double_t nRadiansPM = fNDegreesPMBackground*TMath::Pi()/180;
3764
3765 Double_t rotationValue = fRandom.Rndm()*2*nRadiansPM + TMath::Pi()-nRadiansPM;
3766
3767 RotateKFParticle(&currentEventGoodV02,rotationValue);
3768
3769 AliKFParticle *backgroundCandidate = new AliKFParticle(currentEventGoodV0,currentEventGoodV02);
3770
3771 Double_t massBG =0.;
3772 Double_t widthBG = 0.;
3773 Double_t chi2BG =10000.;
3774 backgroundCandidate->GetMass(massBG,widthBG);
3775 // if(backgroundCandidate->GetNDF()>0){
3776 chi2BG = backgroundCandidate->GetChi2();
3777 if((chi2BG>0 && chi2BG<fV0Reader->GetChi2CutMeson()) || fApplyChi2Cut == kFALSE){
3778
3779 TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
3780 TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
3781
3782 Double_t openingAngleBG = currentEventGoodV0.GetAngle(currentEventGoodV02);
3783
3784 Double_t rapidity;
3785 if(backgroundCandidate->GetE() - backgroundCandidate->GetPz() == 0 || backgroundCandidate->GetE() + backgroundCandidate->GetPz() == 0) {
3786 rapidity=8.;
3787 } else{
3788 rapidity = 0.5*(TMath::Log((backgroundCandidate->GetE() +backgroundCandidate->GetPz()) / (backgroundCandidate->GetE()-backgroundCandidate->GetPz())));
3789 }
3790 if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ){
3791 delete backgroundCandidate;
3792 continue; // rapidity cut
3793 }
dc2883e4 3794
2eedd4ed 3795
3796 Double_t alfa=0.0;
3797 if( (currentEventGoodV0.GetE()+currentEventGoodV02.GetE()) != 0){
3798 alfa=TMath::Abs((currentEventGoodV0.GetE()-currentEventGoodV02.GetE())
3799 /(currentEventGoodV0.GetE()+currentEventGoodV02.GetE()));
3800 }
3801
3802
3803 if(openingAngleBG < fMinOpeningAngleGhostCut ){
3804 delete backgroundCandidate;
3805 continue; // minimum opening angle to avoid using ghosttracks
3806 }
3807
3808 // original
3809 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
3810 fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle", openingAngleBG);
3811 fHistograms->FillHistogram("ESD_Background_Energy", backgroundCandidate->GetE());
3812 fHistograms->FillHistogram("ESD_Background_Pt", momentumVectorbackgroundCandidate.Pt());
3813 fHistograms->FillHistogram("ESD_Background_Eta", momentumVectorbackgroundCandidate.Eta());
3814 fHistograms->FillHistogram("ESD_Background_Rapidity", rapidity);
3815 fHistograms->FillHistogram("ESD_Background_Phi", spaceVectorbackgroundCandidate.Phi());
3816 fHistograms->FillHistogram("ESD_Background_Mass", massBG);
3817 fHistograms->FillHistogram("ESD_Background_R", spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!!
3818 fHistograms->FillHistogram("ESD_Background_ZR", backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
3819 fHistograms->FillHistogram("ESD_Background_XY", backgroundCandidate->GetX(), backgroundCandidate->GetY());
3820 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt",massBG,momentumVectorbackgroundCandidate.Pt());
3821 fHistograms->FillHistogram("ESD_Background_InvMass",massBG);
3822 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_alpha",massBG,momentumVectorbackgroundCandidate.Pt());
3823
3824 if(massBG>0.1 && massBG<0.15){
dcdc851f 3825 fHistograms->FillHistogram("ESD_Background_alfa_Pi0", alfa);
2eedd4ed 3826 fHistograms->FillHistogram("ESD_Background_Pt_alpha_Pi0", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
3827 }
3828 if(massBG>0.5 && massBG<0.57){
dcdc851f 3829 fHistograms->FillHistogram("ESD_Background_alfa_Eta", alfa);
2eedd4ed 3830 fHistograms->FillHistogram("ESD_Background_Pt_alpha_Eta", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
3831 }
6de3471d 3832
2eedd4ed 3833 if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(currentEventGoodV02.GetEta())<0.9 ){
6de3471d 3834 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_Fiducial",massBG,momentumVectorbackgroundCandidate.Pt());
3835 fHistograms->FillHistogram("ESD_Background_InvMass_Fiducial",massBG);
2eedd4ed 3836 }
3837
3838 fHistograms->FillHistogram(Form("%d%dESD_Background_GammaDaughter_OpeningAngle",zbin,mbin), openingAngleBG);
3839 fHistograms->FillHistogram(Form("%d%dESD_Background_Energy",zbin,mbin), backgroundCandidate->GetE());
3840 fHistograms->FillHistogram(Form("%d%dESD_Background_Pt",zbin,mbin), momentumVectorbackgroundCandidate.Pt());
3841 fHistograms->FillHistogram(Form("%d%dESD_Background_Eta",zbin,mbin), momentumVectorbackgroundCandidate.Eta());
3842 fHistograms->FillHistogram(Form("%d%dESD_Background_Rapidity",zbin,mbin), rapidity);
3843 fHistograms->FillHistogram(Form("%d%dESD_Background_Phi",zbin,mbin), spaceVectorbackgroundCandidate.Phi());
3844 fHistograms->FillHistogram(Form("%d%dESD_Background_Mass",zbin,mbin), massBG);
3845 fHistograms->FillHistogram(Form("%d%dESD_Background_R",zbin,mbin), spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!!
3846 fHistograms->FillHistogram(Form("%d%dESD_Background_ZR",zbin,mbin), backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
3847 fHistograms->FillHistogram(Form("%d%dESD_Background_XY",zbin,mbin), backgroundCandidate->GetX(), backgroundCandidate->GetY());
3848 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
3849 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass",zbin,mbin),massBG);
3850
3851 if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(currentEventGoodV02.GetEta())<0.9 ){
6de3471d 3852 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt_Fiducial",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
3853 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_Fiducial",zbin,mbin),massBG);
2eedd4ed 3854 }
3855 }
3856 if(alfa<0.1){
3857 fHistograms->FillHistogram("ESD_Background_InvMass_vs_E_alpha",massBG ,backgroundCandidate->GetE());
3858 }
3c45d101 3859
2eedd4ed 3860 }
3861 //}
3862 delete backgroundCandidate;
5ce758b0 3863 }
2eedd4ed 3864 }
3865 }
3866 }
3867 else{ // means no rotation
3868 AliGammaConversionBGHandler::GammaConversionVertex *bgEventVertex = NULL;
3869
3870 if(fUseTrackMultiplicityForBG){
3871 // cout<<"Using charged track multiplicity for background calculation"<<endl;
3872 for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
5ce758b0 3873
111d75df 3874 AliGammaConversionKFVector * previousEventV0s = bgHandler->GetBGGoodV0s(zbin,mbin,nEventsInBG);//fV0Reader->GetBGGoodV0s(nEventsInBG);
2eedd4ed 3875
5ce758b0 3876 if(fMoveParticleAccordingToVertex == kTRUE){
2eedd4ed 3877 bgEventVertex = bgHandler->GetBGEventVertex(zbin,mbin,nEventsInBG);
5ce758b0 3878 }
3879
3880 for(Int_t iCurrent=0;iCurrent<currentEventV0s->GetEntriesFast();iCurrent++){
2eedd4ed 3881 AliKFParticle currentEventGoodV0 = *(AliKFParticle *)(currentEventV0s->At(iCurrent));
3882 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
3883 AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
3884 AliKFParticle previousGoodV0test = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
3885
3886 //cout<<"Primary Vertex event: ["<<fESDEvent->GetPrimaryVertex()->GetX()<<","<<fESDEvent->GetPrimaryVertex()->GetY()<<","<<fESDEvent->GetPrimaryVertex()->GetZ()<<"]"<<endl;
3887 //cout<<"BG prim Vertex event: ["<<bgEventVertex->fX<<","<<bgEventVertex->fY<<","<<bgEventVertex->fZ<<"]"<<endl;
3888
3889 //cout<<"XYZ of particle before transport: ["<<previousGoodV0.X()<<","<<previousGoodV0.Y()<<","<<previousGoodV0.Z()<<"]"<<endl;
3890 if(fMoveParticleAccordingToVertex == kTRUE){
3891 MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
3892 }
3893 //cout<<"XYZ of particle after transport: ["<<previousGoodV0.X()<<","<<previousGoodV0.Y()<<","<<previousGoodV0.Z()<<"]"<<endl;
3894
3895 AliKFParticle *backgroundCandidate = new AliKFParticle(currentEventGoodV0,previousGoodV0);
3896
3897 Double_t massBG =0.;
3898 Double_t widthBG = 0.;
3899 Double_t chi2BG =10000.;
3900 backgroundCandidate->GetMass(massBG,widthBG);
3901
3902 // if(backgroundCandidate->GetNDF()>0){
3903 // chi2BG = backgroundCandidate->GetChi2()/backgroundCandidate->GetNDF();
3904 chi2BG = backgroundCandidate->GetChi2();
3905 if((chi2BG>0 && chi2BG<fV0Reader->GetChi2CutMeson()) || fApplyChi2Cut == kFALSE){
111d75df 3906
2eedd4ed 3907 TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
3908 TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
111d75df 3909
2eedd4ed 3910 Double_t openingAngleBG = currentEventGoodV0.GetAngle(previousGoodV0);
111d75df 3911
2eedd4ed 3912 Double_t rapidity;
3913
3914 if(backgroundCandidate->GetE() - backgroundCandidate->GetPz() <= 0 || backgroundCandidate->GetE() + backgroundCandidate->GetPz() <= 0){
111d75df 3915 cout << "Error: |Pz| > E !!!! " << endl;
cc5a88a2 3916 rapidity=8.;
2eedd4ed 3917 } else {
111d75df 3918 rapidity = 0.5*(TMath::Log((backgroundCandidate->GetE() +backgroundCandidate->GetPz()) / (backgroundCandidate->GetE()-backgroundCandidate->GetPz())));
2eedd4ed 3919 }
3920 if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ){
3921 delete backgroundCandidate;
3922 continue; // rapidity cut
3923 }
dc2883e4 3924
3925
2eedd4ed 3926 Double_t alfa=0.0;
3927 if( (currentEventGoodV0.GetE()+previousGoodV0.GetE()) != 0){
111d75df 3928 alfa=TMath::Abs((currentEventGoodV0.GetE()-previousGoodV0.GetE())
3929 /(currentEventGoodV0.GetE()+previousGoodV0.GetE()));
2eedd4ed 3930 }
111d75df 3931
3932
2eedd4ed 3933 if(openingAngleBG < fMinOpeningAngleGhostCut ){
3934 delete backgroundCandidate;
3935 continue; // minimum opening angle to avoid using ghosttracks
3936 }
111d75df 3937
2eedd4ed 3938 // original
3939 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
6de3471d 3940 fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle", openingAngleBG);
3941 fHistograms->FillHistogram("ESD_Background_Energy", backgroundCandidate->GetE());
2eedd4ed 3942 fHistograms->FillHistogram("ESD_Background_Pt", momentumVectorbackgroundCandidate.Pt());
6de3471d 3943 fHistograms->FillHistogram("ESD_Background_Eta", momentumVectorbackgroundCandidate.Eta());
3944 fHistograms->FillHistogram("ESD_Background_Rapidity", rapidity);
3945 fHistograms->FillHistogram("ESD_Background_Phi", spaceVectorbackgroundCandidate.Phi());
3946 fHistograms->FillHistogram("ESD_Background_Mass", massBG);
2eedd4ed 3947 fHistograms->FillHistogram("ESD_Background_R", spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!!
6de3471d 3948 fHistograms->FillHistogram("ESD_Background_ZR", backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
3949 fHistograms->FillHistogram("ESD_Background_XY", backgroundCandidate->GetX(), backgroundCandidate->GetY());
3950 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt",massBG,momentumVectorbackgroundCandidate.Pt());
3951 fHistograms->FillHistogram("ESD_Background_InvMass",massBG);
111d75df 3952 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_alpha",massBG,momentumVectorbackgroundCandidate.Pt());
6de3471d 3953
dcdc851f 3954 if(massBG>0.1 && massBG<0.15){
2eedd4ed 3955 fHistograms->FillHistogram("ESD_Background_alfa_Pi0", alfa);
3956 fHistograms->FillHistogram("ESD_Background_Pt_alpha_Pi0", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
dcdc851f 3957 }
3958 if(massBG>0.5 && massBG<0.57){
2eedd4ed 3959 fHistograms->FillHistogram("ESD_Background_alfa_Eta", alfa);
3960 fHistograms->FillHistogram("ESD_Background_Pt_alpha_Eta", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
dcdc851f 3961 }
6de3471d 3962
2eedd4ed 3963 if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(previousGoodV0.GetEta())<0.9 ){
3964 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_Fiducial",massBG,momentumVectorbackgroundCandidate.Pt());
3965 fHistograms->FillHistogram("ESD_Background_InvMass_Fiducial",massBG);
6de3471d 3966 }
3967
3968 // test
3969 fHistograms->FillHistogram(Form("%d%dESD_Background_GammaDaughter_OpeningAngle",zbin,mbin), openingAngleBG);
3970 fHistograms->FillHistogram(Form("%d%dESD_Background_Energy",zbin,mbin), backgroundCandidate->GetE());
2eedd4ed 3971 fHistograms->FillHistogram(Form("%d%dESD_Background_Pt",zbin,mbin), momentumVectorbackgroundCandidate.Pt());
6de3471d 3972 fHistograms->FillHistogram(Form("%d%dESD_Background_Eta",zbin,mbin), momentumVectorbackgroundCandidate.Eta());
3973 fHistograms->FillHistogram(Form("%d%dESD_Background_Rapidity",zbin,mbin), rapidity);
3974 fHistograms->FillHistogram(Form("%d%dESD_Background_Phi",zbin,mbin), spaceVectorbackgroundCandidate.Phi());
3975 fHistograms->FillHistogram(Form("%d%dESD_Background_Mass",zbin,mbin), massBG);
2eedd4ed 3976 fHistograms->FillHistogram(Form("%d%dESD_Background_R",zbin,mbin), spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!!
6de3471d 3977 fHistograms->FillHistogram(Form("%d%dESD_Background_ZR",zbin,mbin), backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
3978 fHistograms->FillHistogram(Form("%d%dESD_Background_XY",zbin,mbin), backgroundCandidate->GetX(), backgroundCandidate->GetY());
3979 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
3980 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass",zbin,mbin),massBG);
3981
2eedd4ed 3982 if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(previousGoodV0.GetEta())<0.9 ){
3983 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt_Fiducial",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
3984 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_Fiducial",zbin,mbin),massBG);
6de3471d 3985 }
2eedd4ed 3986 // }
3987 }
3988 if(alfa<0.1){
3c45d101 3989 fHistograms->FillHistogram("ESD_Background_InvMass_vs_E_alpha",massBG ,backgroundCandidate->GetE());
2eedd4ed 3990 }
3c45d101 3991
2eedd4ed 3992 }
3993 delete backgroundCandidate;
3994 }
111d75df 3995 }
2eedd4ed 3996 }
3997 }
3998 else{ // means using #V0s for multiplicity
111d75df 3999
2eedd4ed 4000 // cout<<"Using the v0 multiplicity to calculate background"<<endl;
4001
4002 fHistograms->FillHistogram("ESD_Background_z_m",zbin,mbin);
4003 fHistograms->FillHistogram("ESD_Mother_multpilicityVSv0s",fV0Reader->CountESDTracks(),fV0Reader->GetNumberOfV0s());
111d75df 4004
2eedd4ed 4005 for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
111d75df 4006 AliGammaConversionKFVector * previousEventV0s = bgHandler->GetBGGoodV0s(zbin,mbin,nEventsInBG);// fV0Reader->GetBGGoodV0s(nEventsInBG);
4007 if(previousEventV0s){
4008
2eedd4ed 4009 if(fMoveParticleAccordingToVertex == kTRUE){
4010 bgEventVertex = bgHandler->GetBGEventVertex(zbin,mbin,nEventsInBG);
4011 }
111d75df 4012
2eedd4ed 4013 for(Int_t iCurrent=0;iCurrent<currentEventV0s->GetEntriesFast();iCurrent++){
4014 AliKFParticle currentEventGoodV0 = *(AliKFParticle *)(currentEventV0s->At(iCurrent));
4015 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
4016 AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
111d75df 4017
2eedd4ed 4018 if(fMoveParticleAccordingToVertex == kTRUE){
111d75df 4019 MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
2eedd4ed 4020 }
4021
4022 AliKFParticle *backgroundCandidate = new AliKFParticle(currentEventGoodV0,previousGoodV0);
4023 Double_t massBG =0.;
4024 Double_t widthBG = 0.;
4025 Double_t chi2BG =10000.;
4026 backgroundCandidate->GetMass(massBG,widthBG);
4027
4028 /* if(backgroundCandidate->GetNDF()>0){
4029 chi2BG = backgroundCandidate->GetChi2()/backgroundCandidate->GetNDF();
4030 {//remember to remove
4031 TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
4032 TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
4033
4034 Double_t openingAngleBG = currentEventGoodV0.GetAngle(previousGoodV0);
4035 fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle_nochi2", openingAngleBG);
4036 }
4037 */
4038 chi2BG = backgroundCandidate->GetChi2();
4039 if((chi2BG>0 && chi2BG<fV0Reader->GetChi2CutMeson()) || fApplyChi2Cut == kFALSE){
5ce758b0 4040 TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
4041 TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
4042
4043 Double_t openingAngleBG = currentEventGoodV0.GetAngle(previousGoodV0);
4044
4045 Double_t rapidity;
cc5a88a2 4046 if(backgroundCandidate->GetE() - backgroundCandidate->GetPz() == 0 || backgroundCandidate->GetE() + backgroundCandidate->GetPz() == 0){
2eedd4ed 4047 rapidity=8.;
cc5a88a2 4048 }else{
2eedd4ed 4049 rapidity = 0.5*(TMath::Log((backgroundCandidate->GetE() +backgroundCandidate->GetPz()) / (backgroundCandidate->GetE()-backgroundCandidate->GetPz())));
cc5a88a2 4050 }
dc2883e4 4051 if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ){
2eedd4ed 4052 delete backgroundCandidate;
4053 continue; // rapidity cut
dc2883e4 4054 }
4055
4056
5ce758b0 4057 Double_t alfa=0.0;
4058 if( (currentEventGoodV0.GetE()+previousGoodV0.GetE()) != 0){
2eedd4ed 4059 alfa=TMath::Abs((currentEventGoodV0.GetE()-previousGoodV0.GetE())
4060 /(currentEventGoodV0.GetE()+previousGoodV0.GetE()));
5ce758b0 4061 }
4062
4063
4064 if(openingAngleBG < fMinOpeningAngleGhostCut ){
2eedd4ed 4065 delete backgroundCandidate;
4066 continue; // minimum opening angle to avoid using ghosttracks
5ce758b0 4067 }
4068
2eedd4ed 4069 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
4070 fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle", openingAngleBG);
4071 fHistograms->FillHistogram("ESD_Background_Energy", backgroundCandidate->GetE());
4072 fHistograms->FillHistogram("ESD_Background_Pt", momentumVectorbackgroundCandidate.Pt());
4073 fHistograms->FillHistogram("ESD_Background_Eta", momentumVectorbackgroundCandidate.Eta());
4074 fHistograms->FillHistogram("ESD_Background_Rapidity", rapidity);
4075 fHistograms->FillHistogram("ESD_Background_Phi", spaceVectorbackgroundCandidate.Phi());
4076 fHistograms->FillHistogram("ESD_Background_Mass", massBG);
4077 fHistograms->FillHistogram("ESD_Background_R", spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!!
4078 fHistograms->FillHistogram("ESD_Background_ZR", backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
4079 fHistograms->FillHistogram("ESD_Background_XY", backgroundCandidate->GetX(), backgroundCandidate->GetY());
4080 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt",massBG,momentumVectorbackgroundCandidate.Pt());
4081 fHistograms->FillHistogram("ESD_Background_InvMass",massBG);
4082
4083
4084 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_alpha",massBG,momentumVectorbackgroundCandidate.Pt());
4085
4086 if(massBG>0.1 && massBG<0.15){
4087 fHistograms->FillHistogram("ESD_Background_alfa_Pi0", alfa);
4088 fHistograms->FillHistogram("ESD_Background_Pt_alpha_Pi0", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
4089 }
4090 if(massBG>0.5 && massBG<0.57){
4091 fHistograms->FillHistogram("ESD_Background_alfa_Eta", alfa);
4092 fHistograms->FillHistogram("ESD_Background_Pt_alpha_Eta", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
4093 }
4094
4095 if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(previousGoodV0.GetEta())<0.9 ){
4096 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_Fiducial",massBG,momentumVectorbackgroundCandidate.Pt());
4097 fHistograms->FillHistogram("ESD_Background_InvMass_Fiducial",massBG);
4098 }
4099
4100 if(massBG>0.5 && massBG<0.6){
4101 fHistograms->FillHistogram("ESD_Background_alfa_pt0506",momentumVectorbackgroundCandidate.Pt(),alfa);
4102 }
4103 if(massBG>0.3 && massBG<0.4){
4104 fHistograms->FillHistogram("ESD_Background_alfa_pt0304",momentumVectorbackgroundCandidate.Pt(),alfa);
4105 }
4106
4107 // test
4108 fHistograms->FillHistogram(Form("%d%dESD_Background_GammaDaughter_OpeningAngle",zbin,mbin), openingAngleBG);
4109 fHistograms->FillHistogram(Form("%d%dESD_Background_Energy",zbin,mbin), backgroundCandidate->GetE());
4110 fHistograms->FillHistogram(Form("%d%dESD_Background_Pt",zbin,mbin), momentumVectorbackgroundCandidate.Pt());
4111 fHistograms->FillHistogram(Form("%d%dESD_Background_Eta",zbin,mbin), momentumVectorbackgroundCandidate.Eta());
4112 fHistograms->FillHistogram(Form("%d%dESD_Background_Rapidity",zbin,mbin), rapidity);
4113 fHistograms->FillHistogram(Form("%d%dESD_Background_Phi",zbin,mbin), spaceVectorbackgroundCandidate.Phi());
4114 fHistograms->FillHistogram(Form("%d%dESD_Background_Mass",zbin,mbin), massBG);
4115 fHistograms->FillHistogram(Form("%d%dESD_Background_R",zbin,mbin), spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!!
4116 fHistograms->FillHistogram(Form("%d%dESD_Background_ZR",zbin,mbin), backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
4117 fHistograms->FillHistogram(Form("%d%dESD_Background_XY",zbin,mbin), backgroundCandidate->GetX(), backgroundCandidate->GetY());
4118 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
4119 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass",zbin,mbin),massBG);
4120
4121 if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(previousGoodV0.GetEta())<0.9 ){
4122 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt_Fiducial",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
4123 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_Fiducial",zbin,mbin),massBG);
4124 }
5ce758b0 4125 }
5ce758b0 4126
6de3471d 4127 if(alfa<0.1){
2eedd4ed 4128 fHistograms->FillHistogram("ESD_Background_InvMass_vs_E_alpha",massBG ,backgroundCandidate->GetE());
4129 }
4130 // }
4131 }
4132 delete backgroundCandidate;
4133 }
5ce758b0 4134 }
5ce758b0 4135 }
2eedd4ed 4136 }
4137 } // end else (means use #v0s as multiplicity)
4138 } // end no rotation
d7d7e825 4139}
4140
4141
d7d7e825 4142void AliAnalysisTaskGammaConversion::ProcessGammasForGammaJetAnalysis(){
2eedd4ed 4143 //ProcessGammasForGammaJetAnalysis
a0b94e5c 4144
2eedd4ed 4145 Double_t distIsoMin;
a0b94e5c 4146
2eedd4ed 4147 CreateListOfChargedParticles();
a0b94e5c 4148
4149
2eedd4ed 4150 // for(UInt_t gammaIndex=0;gammaIndex<fKFReconstructedGammas.size();gammaIndex++){
4151 for(Int_t gammaIndex=0;gammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();gammaIndex++){
4152 AliKFParticle * currentGamma = (AliKFParticle*)fKFReconstructedGammasTClone->At(gammaIndex);
4153 TVector3 momentumVectorCurrentGamma(currentGamma->GetPx(),currentGamma->GetPy(),currentGamma->GetPz());
4154 if( momentumVectorCurrentGamma.Pt()> fMinPtForGammaJet){
4155 distIsoMin=GetMinimumDistanceToCharge(gammaIndex);
4156 if (distIsoMin > fMinIsoConeSize && fLeadingChargedIndex>=0){
4157 CalculateJetCone(gammaIndex);
4158 }
4159 }
4160 }
d7d7e825 4161}
4162
6272370b 4163//____________________________________________________________________
77ac6f3e 4164Bool_t AliAnalysisTaskGammaConversion::IsGoodImpPar(const AliESDtrack *const track)
6272370b 4165{
2eedd4ed 4166 //
4167 // check whether particle has good DCAr(Pt) impact
4168 // parameter. Only for TPC+ITS tracks (7*sigma cut)
4169 // Origin: Andrea Dainese
4170 //
4171
4172 Float_t d0z0[2],covd0z0[3];
4173 track->GetImpactParameters(d0z0,covd0z0);
4174 Float_t sigma= 0.0050+0.0060/TMath::Power(track->Pt(),0.9);
4175 Float_t d0max = 7.*sigma;
4176 if(TMath::Abs(d0z0[0]) < d0max) return kTRUE;
4177
4178 return kFALSE;
6272370b 4179}
4180
4181
d7d7e825 4182void AliAnalysisTaskGammaConversion::CreateListOfChargedParticles(){
2eedd4ed 4183 // CreateListOfChargedParticles
a0b94e5c 4184
2eedd4ed 4185 fESDEvent = fV0Reader->GetESDEvent();
4186 Int_t numberOfESDTracks=0;
4187 for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){
4188 AliESDtrack* curTrack = fESDEvent->GetTrack(iTracks);
a0b94e5c 4189
2eedd4ed 4190 if(!curTrack){
4191 continue;
4192 }
4193 // Not needed if Standard function used.
4194 // if(!IsGoodImpPar(curTrack)){
4195 // continue;
4196 // }
a0b94e5c 4197
2eedd4ed 4198 if(fEsdTrackCuts->AcceptTrack(curTrack) ){
4199 new((*fChargedParticles)[fChargedParticles->GetEntriesFast()]) AliESDtrack(*curTrack);
4200 // fChargedParticles.push_back(curTrack);
4201 fChargedParticlesId.push_back(iTracks);
4202 numberOfESDTracks++;
4203 }
4204 }
4205 // Moved to UserExec using CountAcceptedTracks function. runjet is not needed by default
4206 // fHistograms->FillHistogram("ESD_NumberOfGoodESDTracks",numberOfESDTracks);
4207 // cout<<"esdtracks::"<< numberOfESDTracks<<endl;
4208 // if (fV0Reader->GetNumberOfContributorsVtx()>=1){
4209 // fHistograms->FillHistogram("ESD_NumberOfGoodESDTracksVtx",numberOfESDTracks);
4210 // }
d7d7e825 4211}
2eedd4ed 4212
01b7fdcc 4213void AliAnalysisTaskGammaConversion::CalculateJetCone(Int_t gammaIndex){
2eedd4ed 4214 // CaculateJetCone
a0b94e5c 4215
2eedd4ed 4216 Double_t cone;
4217 Double_t coneSize=0.3;
4218 Double_t ptJet=0;
a0b94e5c 4219
2eedd4ed 4220 // AliKFParticle * currentGamma = &fKFReconstructedGammas[gammaIndex];
4221 AliKFParticle * currentGamma = (AliKFParticle*)fKFReconstructedGammasTClone->At(gammaIndex);
98778c17 4222
2eedd4ed 4223 TVector3 momentumVectorCurrentGamma(currentGamma->GetPx(),currentGamma->GetPy(),currentGamma->GetPz());
a0b94e5c 4224
2eedd4ed 4225 AliESDtrack* leadingCharged = (AliESDtrack*)(fChargedParticles->At(fLeadingChargedIndex));
98778c17 4226
2eedd4ed 4227 Double_t momLeadingCharged[3];
4228 leadingCharged->GetConstrainedPxPyPz(momLeadingCharged);
a0b94e5c 4229
2eedd4ed 4230 TVector3 momentumVectorLeadingCharged(momLeadingCharged[0],momLeadingCharged[1],momLeadingCharged[2]);
a0b94e5c 4231
2eedd4ed 4232 Double_t phi1=momentumVectorLeadingCharged.Phi();
4233 Double_t eta1=momentumVectorLeadingCharged.Eta();
4234 Double_t phi3=momentumVectorCurrentGamma.Phi();
a0b94e5c 4235
2eedd4ed 4236 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
4237 AliESDtrack* curTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
4238 Int_t chId = fChargedParticlesId[iCh];
4239 if(fLeadingChargedIndex==chId || fLeadingChargedIndex==chId) continue;
4240 Double_t mom[3];
4241 curTrack->GetConstrainedPxPyPz(mom);
4242 TVector3 momentumVectorChargedParticle(mom[0],mom[1],mom[2]);
4243 Double_t phi2=momentumVectorChargedParticle.Phi();
4244 Double_t eta2=momentumVectorChargedParticle.Eta();
a0b94e5c 4245
4246
2eedd4ed 4247 cone=100.;
4248 if( TMath::Abs(phi2 - phi1) <= ( TMath::TwoPi()-coneSize) ){
4249 cone = TMath::Sqrt( TMath::Power((eta2-eta1),2)+ TMath::Power((phi2-phi1),2) );
4250 }else{
4251 if( (phi2 - phi1)> TMath::TwoPi()-coneSize ){
4252 cone = TMath::Sqrt( TMath::Power((eta2-eta1),2)+ TMath::Power((phi2-TMath::TwoPi()-phi1),2) );
4253 }
4254 if( (phi2 - phi1)< -(TMath::TwoPi()-coneSize) ){
4255 cone = TMath::Sqrt( TMath::Power((eta2-eta1),2)+ TMath::Power((phi2+TMath::TwoPi()-phi1),2) );
4256 }
4257 }
a0b94e5c 4258
2eedd4ed 4259 if(cone <coneSize&& momentumVectorChargedParticle.Pt()>fMinPtJetCone ){
4260 ptJet+= momentumVectorChargedParticle.Pt();
4261 Double_t ffzHdrGam = momentumVectorChargedParticle.Pt()/momentumVectorCurrentGamma.Pt();
4262 Double_t imbalanceHdrGam=-momentumVectorChargedParticle.Dot(momentumVectorCurrentGamma)/momentumVectorCurrentGamma.Mag2();
4263 fHistograms->FillHistogram("ESD_FFzHdrGam",ffzHdrGam);
4264 fHistograms->FillHistogram("ESD_ImbalanceHdrGam",imbalanceHdrGam);
a0b94e5c 4265
2eedd4ed 4266 }
a0b94e5c 4267
2eedd4ed 4268 Double_t dphiHdrGam=phi3-phi2;
4269 if ( dphiHdrGam < (-TMath::PiOver2())){
4270 dphiHdrGam+=(TMath::TwoPi());
4271 }
a0b94e5c 4272
2eedd4ed 4273 if ( dphiHdrGam > (3.*TMath::PiOver2()) ){
4274 dphiHdrGam-=(TMath::TwoPi());
4275 }
a0b94e5c 4276
2eedd4ed 4277 if (momentumVectorChargedParticle.Pt()>fMinPtGamChargedCorr){
4278 fHistograms->FillHistogram("ESD_dphiHdrGamIsolated",dphiHdrGam);
4279 }
4280 }//track loop
a0b94e5c 4281
4282
2eedd4ed 4283 }
4284
4285
d7d7e825 4286
4287Double_t AliAnalysisTaskGammaConversion::GetMinimumDistanceToCharge(Int_t indexHighestPtGamma){
2eedd4ed 4288 // GetMinimumDistanceToCharge
a0b94e5c 4289
2eedd4ed 4290 Double_t fIsoMin=100.;
4291 Double_t ptLeadingCharged=-1.;
98778c17 4292
2eedd4ed 4293 fLeadingChargedIndex=-1;
a0b94e5c 4294
2eedd4ed 4295 AliKFConversionPhoton * gammaHighestPt = (AliKFConversionPhoton*)fKFReconstructedGammasTClone->At(indexHighestPtGamma);
4296 TVector3 momentumVectorgammaHighestPt(gammaHighestPt->GetPx(),gammaHighestPt->GetPy(),gammaHighestPt->GetPz());
a0b94e5c 4297
2eedd4ed 4298 Double_t phi1=momentumVectorgammaHighestPt.Phi();
4299 Double_t eta1=momentumVectorgammaHighestPt.Eta();
a0b94e5c 4300
2eedd4ed 4301 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
4302 AliESDtrack* curTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
4303 Int_t chId = fChargedParticlesId[iCh];
4304 if(gammaHighestPt->GetTrackLabelPositive()==chId || gammaHighestPt->GetTrackLabelNegative()==chId) continue;
4305 Double_t mom[3];
4306 curTrack->GetConstrainedPxPyPz(mom);
4307 TVector3 momentumVectorChargedParticle(mom[0],mom[1],mom[2]);
4308 Double_t phi2=momentumVectorChargedParticle.Phi();
4309 Double_t eta2=momentumVectorChargedParticle.Eta();
4310 Double_t iso=pow( (pow( (eta1-eta2),2)+ pow((phi1-phi2),2)),0.5 );
a0b94e5c 4311
2eedd4ed 4312 if(momentumVectorChargedParticle.Pt()>fMinPtIsoCone ){
4313 if (iso<fIsoMin){
d7d7e825 4314 fIsoMin=iso;
2eedd4ed 4315 }
4316 }
a0b94e5c 4317
2eedd4ed 4318 Double_t dphiHdrGam=phi1-phi2;
4319 if ( dphiHdrGam < (-TMath::PiOver2())){
4320 dphiHdrGam+=(TMath::TwoPi());
4321 }
a0b94e5c 4322
2eedd4ed 4323 if ( dphiHdrGam > (3.*TMath::PiOver2()) ){
4324 dphiHdrGam-=(TMath::TwoPi());
4325 }
4326 if (momentumVectorChargedParticle.Pt()>fMinPtGamChargedCorr){
4327 fHistograms->FillHistogram("ESD_dphiHdrGam",dphiHdrGam);
4328 }
a0b94e5c 4329
2eedd4ed 4330 if (dphiHdrGam>0.9*TMath::Pi() && dphiHdrGam<1.1*TMath::Pi()){
4331 if (momentumVectorChargedParticle.Pt()> ptLeadingCharged && momentumVectorChargedParticle.Pt()>0.1*momentumVectorgammaHighestPt.Pt()){
4332 ptLeadingCharged=momentumVectorChargedParticle.Pt();
4333 fLeadingChargedIndex=iCh;
4334 }
4335 }
a0b94e5c 4336
2eedd4ed 4337 }//track loop
4338 fHistograms->FillHistogram("ESD_MinimumIsoDistance",fIsoMin);
4339 return fIsoMin;
a0b94e5c 4340
d7d7e825 4341}
4342
2eedd4ed 4343Int_t AliAnalysisTaskGammaConversion::GetIndexHighestPtGamma(){
4344 //GetIndexHighestPtGamma
a0b94e5c 4345
2eedd4ed 4346 Int_t indexHighestPtGamma=-1;
4347 //Double_t
4348 fGammaPtHighest = -100.;
a0b94e5c 4349
2eedd4ed 4350 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
4351 AliKFParticle * gammaHighestPtCandidate = (AliKFParticle*)fKFReconstructedGammasTClone->At(firstGammaIndex);
4352 TVector3 momentumVectorgammaHighestPtCandidate(gammaHighestPtCandidate->GetPx(),gammaHighestPtCandidate->GetPy(),gammaHighestPtCandidate->GetPz());
4353 if (momentumVectorgammaHighestPtCandidate.Pt() > fGammaPtHighest){
4354 fGammaPtHighest=momentumVectorgammaHighestPtCandidate.Pt();
4355 //gammaHighestPt = gammaHighestPtCandidate;
4356 indexHighestPtGamma=firstGammaIndex;
4357 }
4358 }
a0b94e5c 4359
2eedd4ed 4360 return indexHighestPtGamma;
a0b94e5c 4361
d7d7e825 4362}
4363
4364
4365void AliAnalysisTaskGammaConversion::Terminate(Option_t */*option*/)
4366{
2eedd4ed 4367 // Terminate analysis
4368 //
4369 AliDebug(1,"Do nothing in Terminate");
d7d7e825 4370}
4371
4372void AliAnalysisTaskGammaConversion::UserCreateOutputObjects()
4373{
2eedd4ed 4374
4375 if(fKFCreateAOD) {
4376
4377 //AOD
4378 if(!fAODGamma) fAODGamma = new TClonesArray("AliAODConversionPhoton", 0);
4379 else fAODGamma->Delete();
3b77b2d1 4380 fAODGamma->SetOwner(kTRUE);
2eedd4ed 4381 fAODGamma->SetName(Form("%s_gamma", fAODBranchName.Data()));
4382
2eedd4ed 4383 if(GetDeltaAODFileName().Length() > 0) {
4384 AddAODBranch("TClonesArray", &fAODGamma, GetDeltaAODFileName().Data());
2eedd4ed 4385 AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile(GetDeltaAODFileName().Data());
4386 } else {
4387 AddAODBranch("TClonesArray", &fAODGamma);
2eedd4ed 4388 }
4389 }
04bf4381 4390
2eedd4ed 4391 // Create the output container
4392 if(fOutputContainer != NULL){
4393 delete fOutputContainer;
4394 fOutputContainer = NULL;
4395 }
4396 if(fOutputContainer == NULL){
4397 fOutputContainer = new TList();
4398 fOutputContainer->SetOwner(kTRUE);
4399 }
d7d7e825 4400
2eedd4ed 4401 //Adding the histograms to the output container
4402 fHistograms->GetOutputContainer(fOutputContainer);
d7d7e825 4403
4404
2eedd4ed 4405 if(fWriteNtuple){
4406 if(fGammaNtuple == NULL){
4407 fGammaNtuple = new TNtuple("V0ntuple","V0ntuple","OnTheFly:HasVertex:NegPIDProb:PosPIDProb:X:Y:Z:R:MotherCandidateNDF:MotherCandidateChi2:MotherCandidateEnergy:MotherCandidateEta:MotherCandidatePt:MotherCandidateMass:MotherCandidateWidth:MCMotherCandidatePT:EPOpeningAngle:ElectronEnergy:ElectronPt:ElectronEta:ElectronPhi:PositronEnergy:PositronPt:PositronEta:PositronPhi:HasSameMCMother:MotherMCParticlePIDCode",50000);
4408 }
4409 if(fNeutralMesonNtuple == NULL){
4410 fNeutralMesonNtuple = new TNtuple("NeutralMesonNtuple","NeutralMesonNtuple","test");
4411 }
4412 TList * ntupleTList = new TList();
4413 ntupleTList->SetOwner(kTRUE);
4414 ntupleTList->SetName("Ntuple");
4415 ntupleTList->Add((TNtuple*)fGammaNtuple);
4416 fOutputContainer->Add(ntupleTList);
4417 }
d7d7e825 4418
2eedd4ed 4419 fOutputContainer->SetName(GetName());
143874ce 4420
3b77b2d1 4421 PostData(0, fAODGamma);
2eedd4ed 4422 PostData(1, fOutputContainer);
4423 PostData(2, fCFManager->GetParticleContainer()); // for CF
3b77b2d1 4424 PostData(3, fAODGamma);
d7d7e825 4425}
4426
77ac6f3e 4427Double_t AliAnalysisTaskGammaConversion::GetMCOpeningAngle(const TParticle* const daughter0, const TParticle* const daughter1) const{
2eedd4ed 4428 //helper function
4429 TVector3 v3D0(daughter0->Px(),daughter0->Py(),daughter0->Pz());
4430 TVector3 v3D1(daughter1->Px(),daughter1->Py(),daughter1->Pz());
4431 return v3D0.Angle(v3D1);
d7d7e825 4432}
4433
4434void AliAnalysisTaskGammaConversion::CheckV0Efficiency(){
2eedd4ed 4435 // see header file for documentation
4436
4437 vector<Int_t> indexOfGammaParticle;
4438
4439 fStack = fV0Reader->GetMCStack();
a0b94e5c 4440
2eedd4ed 4441 if(fV0Reader->CheckForPrimaryVertex() == kFALSE){
4442 return; // aborts if the primary vertex does not have contributors.
4443 }
4444
4445 for (Int_t iTracks = 0; iTracks < fStack->GetNprimary(); iTracks++) {
4446 TParticle* particle = (TParticle *)fStack->Particle(iTracks);
4447 if(particle->GetPdgCode()==22){ //Gamma
4448 if(particle->GetNDaughters() >= 2){
4449 TParticle* electron=NULL;
4450 TParticle* positron=NULL;
4451 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
4452 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
4453 if(tmpDaughter->GetUniqueID() == 5){
4454 if(tmpDaughter->GetPdgCode() == 11){
4455 electron = tmpDaughter;
4456 }
4457 else if(tmpDaughter->GetPdgCode() == -11){
4458 positron = tmpDaughter;
4459 }
4460 }
4461 }
4462 if(electron!=NULL && positron!=0){
4463 if(electron->R()<160){
4464 indexOfGammaParticle.push_back(iTracks);
4465 }
4466 }
4467 }
4468 }
4469 }
a0b94e5c 4470
2eedd4ed 4471 Int_t nFoundGammas=0;
4472 Int_t nNotFoundGammas=0;
4473
4474 Int_t numberOfV0s = fV0Reader->GetNumberOfV0s();
4475 for(Int_t i=0;i<numberOfV0s;i++){
4476 fV0Reader->GetV0(i);
a0b94e5c 4477
2eedd4ed 4478 if(fV0Reader->HasSameMCMother() == kFALSE){
4479 continue;
4480 }
a0b94e5c 4481
2eedd4ed 4482 TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
4483 TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
a0b94e5c 4484
2eedd4ed 4485 if(TMath::Abs(negativeMC->GetPdgCode())!=11 || TMath::Abs(positiveMC->GetPdgCode())!=11){
4486 continue;
4487 }
4488 if(negativeMC->GetPdgCode()==positiveMC->GetPdgCode()){
4489 continue;
4490 }
a0b94e5c 4491
2eedd4ed 4492 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
4493 //TParticle * v0Gamma = fV0Reader->GetMotherMCParticle();
4494 for(UInt_t mcIndex=0;mcIndex<indexOfGammaParticle.size();mcIndex++){
4495 if(negativeMC->GetFirstMother()==indexOfGammaParticle[mcIndex]){
4496 nFoundGammas++;
4497 }
4498 else{
4499 nNotFoundGammas++;
4500 }
4501 }
4502 }
d7d7e825 4503 }
d7d7e825 4504}
4505
3b77b2d1 4506//_____________________________________________________________________
4507void AliAnalysisTaskGammaConversion::ProcessHadronicInteraction(AliESDEvent *event){
4508 //
4509 // Process pairs of tracks to get a material budget map
4510 //
4511 //
4512 if (!event) return;
4513 if (event) AliKFParticle::SetField(event->GetMagneticField()); // set mean magnetic field for KF particles
4514// TTreeSRedirector *fpcstream = new TTreeSRedirector("eventInfoHadInt.root");
4515 // 1. Calculate total dEdx for all TPC tracks
4516 //
4517 const Int_t kMinCl=50;
4518 const Double_t kEpsilon=0.000001;
4519 const Float_t kMinRatio=0.7;
4520 const Float_t kMinDist=1.5;
4521 const Float_t kMinDistChi2=8.; //
4522 const Float_t kMaxDistZ=300.; // max distanceZ
4523 const Float_t kMaxDistR=250.; // max distanceR
4524 const Double_t kMaxChi2 =36.; // maximal chi2 to define the vertex
4525 const Double_t kMaxDistVertexSec=2.; // maximal distance to secondary vertex
4526 const Double_t kMinPtHadTrack = fPtMinHadInt;
4527 Float_t arrayRBins[6] = {5.75,9.5,21.,35.,42.,55.};
4528
4529 Double_t szz=1.; // number to be taken from the OCDB - now it can be hack
4530 Double_t stt = 0.006667; //
4531
4532 if (!event) return;
4533 AliESDVertex *vertexSPD = (AliESDVertex *)event->GetPrimaryVertexSPD();
4534// AliESDVertex * spdVertex = (AliESDVertex *)event->GetPrimaryVertexSPD();
4535// AliESDVertex * trackVertex = (AliESDVertex *)event->GetPrimaryVertexTracks();
4536// AliESDVertex * tpcVertex = (AliESDVertex *)event->GetPrimaryVertexTPC();
4537// AliESDTZERO * tzero = (AliESDTZERO *)event->GetESDTZERO() ;
4538 //
4539 Double_t tpcSignalTotPrim=0;
4540 Double_t tpcSignalTotSec=0;
4541 Int_t ntracksTPC=0;
4542 Int_t nTPCPrim=0;
4543 Int_t nTPCSec=0;
4544 Int_t ntracks=event->GetNumberOfTracks();
4545 if ( ntracks<=2 ) return;
4546
4547 //
4548 Float_t dca[2]={0};
4549 Float_t cov[3]={0};
4550 Float_t dca0[2]={0};
4551 Float_t dca1[2]={0};
4552 //
4553 //1. Calculate total dEdx for primary and secondary tracks
4554 // and count primaries and secondaries
4555 Int_t *rejectTrack = new Int_t[ntracks];
7e858fdb 4556 Float_t trackUsedInVtx[ntracks];
3b77b2d1 4557
4558 for (Int_t ii=0; ii<ntracks; ii++){
4559 trackUsedInVtx[ii] = 0.;
4560 }
4561 Int_t nTracksCont = 0;
4562
4563 for (Int_t itrack=0; itrack<ntracks; itrack++){
4564 AliESDtrack *track=event->GetTrack(itrack);
4565 rejectTrack[itrack]=0;
4566 if (!track) continue;
4567 if ((track->Pt())<kMinPtHadTrack){ rejectTrack[itrack]+=32; continue;}
4568 if (track->GetTPCNcls()<=kMinCl) {rejectTrack[itrack]+=64; continue;} // skip short tracks
4569 ntracksTPC++;
4570 if ((1.+track->GetTPCNcls())/(1.+track->GetTPCNclsF())<=kMinRatio){rejectTrack[itrack]+=128; continue;}
4571 if (!track->GetInnerParam()) continue; // skip not TPC tracks
4572 if (track->GetKinkIndex(0)!=0) {rejectTrack[itrack]+=16;continue;} // skip kinks
4573 track->GetImpactParameters(dca,cov);
4574 if (TMath::Abs(dca[0])>kMaxDistR && TMath::Abs(dca[1])>kMaxDistZ){rejectTrack[itrack]+=256; continue;}
4575 // remove too dip secondaries
4576 if (TMath::Abs(dca[0])<kMinDist && TMath::Abs(dca[1])<kMinDist){
4577 tpcSignalTotPrim+=track->GetTPCsignal();
4578 nTPCPrim++;
4579 rejectTrack[itrack]+=256;
4580 }else{
4581 tpcSignalTotSec+=track->GetTPCsignal();
4582 nTPCSec++;
4583 };
4584 if (cov[0]>kEpsilon &&TMath::Abs(dca[0])>kEpsilon &&TMath::Sqrt(dca[0]*dca[0]/(TMath::Abs(cov[0])))<kMinDistChi2) rejectTrack[itrack]+=1; // primary
4585 if (cov[0]>kEpsilon &&TMath::Abs(dca[0])>kEpsilon &&TMath::Abs(dca[0])<kMinDist) rejectTrack[itrack]+=1; // primary
4586 if (track->GetTPCsignal()<40) rejectTrack[itrack]+=16;
4587 //
4588 if (CheckLooper(itrack, event)) rejectTrack[itrack]+=2; // looper
4589 if (CheckV0(itrack,event)) rejectTrack[itrack]+=4; //indentified V0 rejection (K0s, Lambda, gamma conv)
4590
4591// UInt_t status = track->GetStatus();
4592 if (!track->IsOn(AliVTrack::kITSrefit) && !fDoMCTruth){
4593
4594 Double_t *covar = (Double_t*)track->GetInnerParam()->GetCovariance();
4595 //
4596 //remove -systematic error estimate
4597 //
4598 Double_t sigmazz = covar[track->GetIndex(1,1)];
4599 Double_t dr = TMath::Abs(TMath::Sqrt((track->GetX()*track->GetX()+track->GetY()*track->GetY())) - TMath::Sqrt((track->GetInnerParam()->GetX()*track->GetInnerParam()->GetX()+track->GetInnerParam()->GetY()*track->GetInnerParam()->GetY()))) ;
4600
4601 Double_t sigmazz0 = sigmazz -szz*szz - stt*stt*dr*dr;
4602// cout << "old sigma z: "<<sigmazz << " new sigma z: " << sigmazz0 << endl;
4603 if (sigmazz0<0) sigmazz0=0.1; // should not happen - the code should be protected
4604 covar[track->GetIndex(1,1)]=sigmazz0;
4605 //
4606 // + rescale the correlation terms
4607 //
4608 Double_t ratio = TMath::Sqrt(sigmazz0/sigmazz);
4609 for (Int_t index=0; index<5; index++){
4610 Int_t jindex = track->GetIndex(index,1);
4611 covar[jindex]*=ratio;
4612 }
4613 }
4614 }
4615
4616
4617 //
4618 // 2. Find secondary vertices - double loop
4619 //
4620
4621 AliKFVertex vertexStored[15];
4622 Int_t kVertexArr[15][7];
4623 for (Int_t ii = 0; ii < 15; ii++){
4624 for (Int_t bb = 0; bb < 7; bb++){
4625 kVertexArr[ii][bb] = 0;
4626 }
4627 }
4628 Int_t kTrackArr[500][7];
4629 for (Int_t ii = 0; ii < 500; ii++){
4630 for (Int_t bb = 0; bb < 7; bb++){
4631 kTrackArr[ii][bb] = 0;
4632 }
4633 }
4634
4635 Int_t nVertices = 0;
4636 Int_t nVerticesPassed = 0;
4637
4638 for (Int_t itrack0=0; itrack0<ntracks; itrack0++){
4639 if (rejectTrack[itrack0]) continue; // skip
4640 AliESDtrack *track0=event->GetTrack(itrack0);
4641 if (!track0) continue;
4642
4643 track0->GetImpactParameters(dca[0],dca[1]);
4644 track0->GetImpactParameters(dca0[0],dca0[1]);
4645
4646 AliKFParticle part0;
4647 if (!track0->IsOn(AliVTrack::kITSrefit)){
4648 part0=AliKFParticle(*track0->GetInnerParam(),211); //assuming pion mass
4649 } else {
4650 part0=AliKFParticle(*track0,211); //assuming pion mass
4651 }
4652 if (track0->Charge()*part0.Q()<0) part0.Q()*=-1; // change sign if opposite
4653 //
4654 for (Int_t itrack1=itrack0+1; itrack1<ntracks; itrack1++){
4655 if (rejectTrack[itrack1]) continue; // skip
4656 AliESDtrack *track1=event->GetTrack(itrack1);
4657 if (!track1) continue;
4658 track1->GetImpactParameters(dca1[0],dca1[1]);
4659 track1->GetImpactParameters(dca[0],dca[1]);
4660 AliKFParticle part1; // assuming pion mass
4661 if (!track1->IsOn(AliVTrack::kITSrefit)){
4662 part1=AliKFParticle(*track1->GetInnerParam(),211); //assuming pion mass
4663 } else {
4664 part1=AliKFParticle(*track1,211); //assuming pion mass
4665 }
4666 if (track1->Charge()*part1.Q()<0) part1.Q()*=-1; // change sign if opposite
4667
4668 //
4669 //
4670 AliKFVertex vertex;
4671 vertex+=part0;
4672 vertex+=part1;
4673 if ((vertex.GetChi2()/vertex.GetNDF())> kMaxChi2) continue;
4674 if (TMath::Abs(vertex.GetX())>kMaxDistR) continue;
4675 if (TMath::Abs(vertex.GetY())>kMaxDistR) continue;
4676 if (TMath::Abs(vertex.GetZ())>kMaxDistZ) continue;
4677 Double_t errX2=vertex.GetErrX();
4678 Double_t errY2=vertex.GetErrY();
4679 Double_t errZ2=vertex.GetErrZ();
4680 //
4681 Double_t err3D=TMath::Sqrt(errX2*errX2+errY2*errY2+errZ2*errZ2/10.);
4682 if (err3D>kMaxDistVertexSec) continue;
4683 if (err3D*TMath::Sqrt(vertex.GetChi2()+0.00001)>kMaxDistVertexSec) continue;
4684
4685 Double_t dvertex=0;
4686 dvertex += (vertexSPD->GetX()-vertex.GetX())*(vertexSPD->GetX()-vertex.GetX());
4687 dvertex += (vertexSPD->GetY()-vertex.GetY())*(vertexSPD->GetY()-vertex.GetY());
4688 dvertex += (vertexSPD->GetZ()-vertex.GetZ())*(vertexSPD->GetZ()-vertex.GetZ());
4689 dvertex=TMath::Sqrt(dvertex+0.00000001);
4690 if (err3D>0.2*dvertex) continue;
4691 if (err3D*TMath::Sqrt(vertex.GetChi2()+0.000001)>0.1*dvertex) continue;
4692 Double_t radius = TMath::Sqrt((vertex.GetX()*vertex.GetX()+vertex.GetY()*vertex.GetY()));
4693
4694 for (Int_t bb= 0; bb < 6; bb++){
4695 if (radius > arrayRBins[bb]) {
4696 if (track0->HasPointOnITSLayer(bb) || track1->HasPointOnITSLayer(bb) ) continue;
4697 }
4698 }
4699 AliKFVertex vertex2;
4700 vertex2+=part0;
4701 vertex2+=part1;
4702 //
4703
4704// if(fDoMCTruth){
4705//
4706// }
4707
4708 trackUsedInVtx[itrack0] +=1.;
4709 trackUsedInVtx[itrack1] +=1.;
4710
4711 nTracksCont= 2;
4712 kTrackArr[itrack0][0]+= 1;
4713 kTrackArr[itrack1][0]+= 1;
4714 kVertexArr[nVertices][0] = 2;
4715 kVertexArr[nVertices][1] = 1;
4716 kVertexArr[nVertices][2] = itrack0;
4717 kVertexArr[nVertices][3] = itrack1;
4718
4719 for (Int_t itrack2=0; itrack2<ntracks; itrack2++){
4720 if (rejectTrack[itrack2]) continue; // skip
4721 if (itrack2==itrack0) continue;
4722 if (itrack2==itrack1) continue;
4723 AliESDtrack *track2=event->GetTrack(itrack2);
4724 if (!track2) continue;
4725 track2->GetImpactParameters(dca[0],dca[1]);
4726 if (TMath::Abs(track2->GetD(vertex.GetX(), vertex.GetY(),event->GetMagneticField()))>kMaxDistVertexSec) continue;
4727 Double_t vtxx[3]={vertex2.GetX(),vertex2.GetY(),vertex2.GetZ()};
4728 Double_t svtxx[3]={vertex.GetErrX(),vertex.GetErrY(),vertex.GetErrZ()};
4729 AliESDVertex vtx(vtxx,svtxx);
4730
4731 AliExternalTrackParam param;
4732 if (!track2->IsOn(AliVTrack::kITSrefit)){
4733 param= *track2->GetInnerParam(); //assuming pion mass
4734 } else {
4735 param=*track2;
4736 }
4737 Double_t delta[2]={0,0};
4738 if (!param.PropagateToDCA(&vtx,event->GetMagneticField(),kMaxDistVertexSec,delta)) continue;
4739 if (TMath::Abs(delta[0])>kMaxDistVertexSec) continue;
4740 if (TMath::Abs(delta[1])>kMaxDistVertexSec) continue;
4741 if (TMath::Abs(delta[0])>6.*TMath::Sqrt(param.GetSigmaY2()+vertex2.GetErrY()*vertex2.GetErrY())+0.1) continue;
4742 if (TMath::Abs(delta[1])>6.*TMath::Sqrt(param.GetSigmaZ2()+vertex2.GetErrZ()*vertex2.GetErrZ())+0.5) continue;
4743 //
4744 AliKFParticle part2(param,211); // assuming pion mass
4745 if (track2->Charge()*part2.Q()<0) part2.Q()*=-1; // change sign if opposite
4746
4747 for (Int_t cc= 0; cc < 6; cc++){
4748 if (radius > arrayRBins[cc]){
4749 if (track2->HasPointOnITSLayer(cc) ) continue;
4750 }
4751 }
4752
4753
4754 vertex2+=part2;
4755// rejectTrack[itrack0]+=10; // do noit reuse the track
4756// rejectTrack[itrack1]+=10; // do not reuse the track
4757// rejectTrack[itrack2]+=10;
4758 trackUsedInVtx[itrack2] +=1.;
4759// cout << "track number " << itrack2 << " used times " << trackUsedInVtx[itrack2] << endl;
4760 nTracksCont++ ;
4761 kTrackArr[itrack2][0]+= 1;
4762 kVertexArr[nVertices][0] = nTracksCont;
4763 kVertexArr[nVertices][1] = 1;
4764 kVertexArr[nVertices][nTracksCont+1] = itrack2;
4765
4766 }
4767// if (nVertices == 0){
4768// cout << "new Event" << endl;
4769// }
4770// cout << "Vertex " << nVertices << " nTracks " << kVertexArr[nVertices][0] << endl;
4771// for (Int_t ii = 2 ; ii < kVertexArr[nVertices][0]+2; ii++){
4772// cout << "\t Track " << kVertexArr[nVertices][ii] << endl;
4773// }
4774 vertexStored[nVertices]= vertex2;
4775 nVertices++;
4776// Double_t errX=vertex2.GetErrX();
4777// Double_t errY=vertex2.GetErrY();
4778// Double_t errZ=vertex2.GetErrZ();
4779// Double_t vx = vertex2.GetX();
4780// Double_t vy = vertex2.GetY();
4781// Double_t vz = vertex2.GetZ();
4782// Double_t vr = sqrt((Double_t)(vx*vx + vy*vy));
4783// Double_t vphi = vertex2.GetPhi();
4784// Double_t vphi2 = TMath::ATan2(vy, vx);
4785// cout << "\t Quality \t errX: " <<errX << "\t errY: " << errY << "\t errZ: " << errZ << "\t Chi2/ndf: " << vertex2.GetChi2()/vertex2.GetNDF() << endl;
4786// cout << "\t Position \t x: " << vx << "\t y: " << vy << "\t z: " << vz <<"\t r: " << vr << "\t phi: " << vphi << "\t phi dir calc: " << vphi2 << endl;
4787// Double_t vNDCA = vertex2.GetDcaV0Daughters()/vertex2.GetDistSigma()
4788// if (fpcstream){
4789// (*fpcstream)<<"ntracks="<<ntracks<<
4790// "ntracksTPC="<<ntracksTPC<<
4791// "nPrim="<<nTPCPrim<< // number of primaries
4792// "nSec="<<nTPCSec<< // number of secondaries
4793// "sigPrim="<<tpcSignalTotPrim<< // total dEdx in primaries
4794// "sigSec="<<tpcSignalTotSec<< // total dEdx in secondaries
4795// "v.="<<&vertex<< // KF vertex
4796// "v2.="<<&vertex2<< // KF vertex all tracks
4797// "z0="<<dca0[1]<<
4798// "z1="<<dca1[1]<<
4799// "rphi0="<<dca0[0]<<
4800// "rphi1="<<dca1[0]<<
4801// "radius="<<radius<<
4802// "vx="<<vx<<
4803// "vy="<<vy<<
4804// "vz="<<vz<<
4805// "errX="<<errX<<
4806// "errY="<<errY<<
4807// "errZ="<<errZ<<
4808// "err2D="<<err2D<<
4809// "err3D="<<err3D<<
4810// "dvertex="<<dvertex<<
4811// "\n";
4812// }
4813//
4814 fHistograms->FillHistogram("ESD_HadIntQual_nTracks", ntracks);
4815 fHistograms->FillHistogram("ESD_HadIntQual_ntracksTPC", ntracksTPC);
4816 }
4817 }
4818
4819 Int_t verticesRejectedInLoop = 0;
4820 for (Int_t ll = 0; ll < nVertices; ll++){
4821 if (kVertexArr[ll][1] == 0) continue;
4822 for (Int_t kk = 0; kk < nVertices; kk++){
4823 Int_t trackUsedTwice = 0;
4824 Int_t numberOfTracksUsedTwice = 0;
4825 Int_t trackNumberTrackUsedTwice[10];
4826 if (ll == kk) continue;
4827 if (kVertexArr[kk][1] == 0 || kVertexArr[ll][1] == 0 ) continue;
4828// cout << "Vertex " << ll << " nTracks " << kVertexArr[ll][0] << endl;
4829 for (Int_t ii = 2 ; ii < kVertexArr[ll][0]+2; ii++){
4830// cout << "\t Track " << kVertexArr[ll][ii] << endl;
4831// cout << "\t Vertex " << kk << " nTracks " << kVertexArr[kk][0] << endl;
4832 for (Int_t jj = 2 ; jj < kVertexArr[kk][0]+2; jj++){
4833// cout << "\t\t Track " << kVertexArr[kk][jj] << endl;
4834 if (kVertexArr[ll][ii] == kVertexArr[kk][jj]){
4835// cout << "\t\t track used twice" << endl;
4836 trackUsedTwice = 1;
4837 trackNumberTrackUsedTwice[numberOfTracksUsedTwice] = kVertexArr[kk][jj];
4838 numberOfTracksUsedTwice++;
4839
4840 }
4841 }
4842 }
4843 if (trackUsedTwice){
4844 if (vertexStored[ll].GetChi2()/vertexStored[ll].GetNDF() < vertexStored[kk].GetChi2()/vertexStored[kk].GetNDF()){
4845// cout << "\t Vertex " << kk <<"\t track used twice: " << numberOfTracksUsedTwice << "\t tracks left for vertex: " << kVertexArr[kk][0]-numberOfTracksUsedTwice << endl;
4846 if ( kVertexArr[kk][0]-numberOfTracksUsedTwice < 2){
4847 kVertexArr[kk][1] = 0;
4848 } else {
4849 for (Int_t count = 0; count < numberOfTracksUsedTwice; count++){
4850 for (Int_t hh = 2; hh < kVertexArr[kk][0]+2; hh++){
4851 if (kVertexArr[kk][hh] == trackNumberTrackUsedTwice[count]){
4852// cout << "\t track to be removed " << trackNumberTrackUsedTwice[count] << " from position "<< hh <<endl;
4853 for (Int_t ii = kVertexArr[kk][0]+2-hh; ii > 1; ii--){
4854 Int_t pos = kVertexArr[kk][0]+2-ii;
4855 kVertexArr[kk][pos] = kVertexArr[kk][pos+1];
4856 }
4857 kVertexArr[kk][0] -=1;
4858 }
4859 }
4860
4861 AliESDtrack *track0=event->GetTrack(kVertexArr[kk][2]);
4862 AliKFParticle part0;
4863 if (!track0->IsOn(AliVTrack::kITSrefit)){
4864 part0=AliKFParticle(*track0->GetInnerParam(),211); //assuming pion mass
4865 } else {
4866 part0=AliKFParticle(*track0,211); //assuming pion mass
4867 }
4868
4869 if (track0->Charge()*part0.Q()<0) part0.Q()*=-1; // change sign if opposite
4870
4871 AliKFVertex vertex;
4872 vertex+=part0;
4873
4874// cout << "\t Vertex " << kk << " nTracks " << kVertexArr[kk][0] << endl;
4875 for (Int_t ii = 2 ; ii < kVertexArr[kk][0]+2; ii++){
4876// cout << "\t \t Track " << kVertexArr[kk][ii] << endl;
4877 if (ii > 2){
4878 AliESDtrack *track1=event->GetTrack(kVertexArr[kk][ii]);
4879 AliKFParticle part1;
4880 if (!track1->IsOn(AliVTrack::kITSrefit)){
4881 part1=AliKFParticle(*track1->GetInnerParam(),211); //assuming pion mass
4882 } else {
4883 part1=AliKFParticle(*track1,211); //assuming pion mass
4884 }
4885
4886 if (track1->Charge()*part1.Q()<0) part1.Q()*=-1; // change sign if opposite
4887 vertex+=part1;
4888 }
4889 }
4890 vertexStored[kk]=vertex;
4891// cout << "\t removing tracks from vtx " << kk << "new chi2/ndf: " << vertexStored[kk].GetChi2()/vertexStored[kk].GetNDF() <<endl;
4892// cout << "Vertex " << kk << " nTracks " << kVertexArr[kk][0] << endl;
4893// for (Int_t ii = 2 ; ii < kVertexArr[kk][0]+2; ii++){
4894// cout << "\t Track " << kVertexArr[kk][ii] << endl;
4895// }
4896// Double_t errX=vertex.GetErrX();
4897// Double_t errY=vertex.GetErrY();
4898// Double_t errZ=vertex.GetErrZ();
4899// Double_t vx = vertex.GetX();
4900// Double_t vy = vertex.GetY();
4901// Double_t vz = vertex.GetZ();
4902// Double_t vr = sqrt((Double_t)(vx*vx + vy*vy));
4903// Double_t vphi = TMath::ATan2(vy, vx);
4904// cout << "\t Quality \t errX: " <<errX << "\t errY: " << errY << "\t errZ: " << errZ << "\t Chi2/ndf: " << vertex.GetChi2()/vertex.GetNDF() << endl;
4905// cout << "\t Position \t x: " << vx << "\t y: " << vy << "\t z: " << vz <<"\t r: " << vr << "\t phi: " << vphi << endl;
4906 }
4907 kVertexArr[kk][1] = 1;
4908 verticesRejectedInLoop--;
4909 }
4910
4911// cout << "\t rejected vertex " << kk << endl;
4912 } else {
4913 kVertexArr[ll][1] = 0;
4914// cout << "\t Vertex " << ll << "\t track used twice: " << numberOfTracksUsedTwice << "\t tracks left for vertex: " << kVertexArr[ll][0]-numberOfTracksUsedTwice << endl;
4915 if ( kVertexArr[ll][0]-numberOfTracksUsedTwice < 2){
4916 kVertexArr[ll][1] = 0;
4917 } else {
4918 for (Int_t count = 0; count < numberOfTracksUsedTwice; count++){
4919 for (Int_t hh = 2; hh < kVertexArr[ll][0]+2; hh++){
4920 if (kVertexArr[ll][hh] == trackNumberTrackUsedTwice[count]){
4921// cout << "\t track to be removed " << trackNumberTrackUsedTwice[count] << " from position "<< hh <<endl;
4922 for (Int_t ii = kVertexArr[ll][0]+2-hh; ii > 1; ii--){
4923 Int_t pos = kVertexArr[ll][0]+2-ii;
4924 kVertexArr[ll][pos] = kVertexArr[ll][pos+1];
4925 }
4926 kVertexArr[ll][0] -=1;
4927 }
4928 }
4929 AliESDtrack *track0=event->GetTrack(kVertexArr[ll][2]);
4930 AliKFParticle part0(*track0,211); //assuming pion mass
4931 if (track0->Charge()*part0.Q()<0) part0.Q()*=-1; // change sign if opposite
4932
4933 AliKFVertex vertex;
4934 vertex+=part0;
4935
4936// cout << "\t Vertex " << ll << " nTracks " << kVertexArr[ll][0] << endl;
4937 for (Int_t ii = 2 ; ii < kVertexArr[ll][0]+2; ii++){
4938// cout << "\t \t Track " << kVertexArr[ll][ii] << endl;
4939 if (ii > 2){
4940 AliESDtrack *track1=event->GetTrack(kVertexArr[ll][ii]);
4941 AliKFParticle part1(*track1,211); // assuming pion mass
4942 if (track1->Charge()*part1.Q()<0) part1.Q()*=-1; // change sign if opposite
4943 vertex+=part1;
4944 }
4945 }
4946 vertexStored[ll]=vertex;
4947// cout << "\t removing tracks from vtx " << ll << "new chi2/ndf: " << vertexStored[ll].GetChi2()/vertexStored[ll].GetNDF() <<endl;
4948// cout << "Vertex " << ll << " nTracks " << kVertexArr[ll][0] << endl;
4949// for (Int_t ii = 2 ; ii < kVertexArr[ll][0]+2; ii++){
4950// cout << "\t Track " << kVertexArr[ll][ii] << endl;
4951// }
4952// Double_t errX=vertex.GetErrX();
4953// Double_t errY=vertex.GetErrY();
4954// Double_t errZ=vertex.GetErrZ();
4955// Double_t vx = vertex.GetX();
4956// Double_t vy = vertex.GetY();
4957// Double_t vz = vertex.GetZ();
4958// Double_t vr = sqrt((Double_t)(vx*vx + vy*vy));
4959// Double_t vphi = TMath::ATan2(vy, vx);
4960// cout << "\t Quality \t errX: " <<errX << "\t errY: " << errY << "\t errZ: " << errZ << "\t Chi2/ndf: " << vertex.GetChi2()/vertex.GetNDF() << endl;
4961// cout << "\t Position \t x: " << vx << "\t y: " << vy << "\t z: " << vz <<"\t r: " << vr << "\t phi: " << vphi << endl;
4962 }
4963 kVertexArr[ll][1] = 1;
4964 verticesRejectedInLoop--;
4965 }
4966 }
4967 verticesRejectedInLoop++;
4968 }
4969 }
4970 }
4971// if (nVertices > 0){
4972// cout << "Selected Vertices___________________________________" << endl;
4973// }
4974 for (Int_t fin = 0; fin < nVertices; fin++){
4975 if (kVertexArr[fin][1] == 0) continue;
4976 Double_t errX=vertexStored[fin].GetErrX();
4977 Double_t errY=vertexStored[fin].GetErrY();
4978 Double_t errZ=vertexStored[fin].GetErrZ();
4979 Double_t err3D=TMath::Sqrt(errX*errX+errY*errY+errZ*errZ/10.);
4980 Double_t err2D=TMath::Sqrt(errX*errX+errY*errY);
4981 Double_t vx = vertexStored[fin].GetX();
4982 Double_t vy = vertexStored[fin].GetY();
4983 Double_t vz = vertexStored[fin].GetZ();
4984 Double_t vr = sqrt((Double_t)(vx*vx + vy*vy));
4985 Double_t vphi = TMath::ATan2(vy, vx);
4986// cout << "Vertex " << fin << " nTracks " << kVertexArr[fin][0] << endl;
4987 for (Int_t ii = 2 ; ii < kVertexArr[fin][0]+2; ii++){
4988// cout << "\t Track " << kVertexArr[fin][ii] << endl;
4989 }
4990// cout << "\t Quality \t errX: " <<errX << "\t errY: " << errY << "\t errZ: " << errZ << "\t Chi2/ndf: " << vertexStored[fin].GetChi2()/vertexStored[fin].GetNDF() << endl;
4991// cout << "\t Position \t x: " << vx << "\t y: " << vy << "\t z: " << vz <<"\t r: " << vr << "\t phi:" << vphi << endl;
4992
4993 fHistograms->FillHistogram("ESD_HadIntQual_nTracksSecVtx", kVertexArr[fin][0]);
4994 fHistograms->FillHistogram("ESD_HadIntQual_ErrX", errX);
4995// fHistograms->FillHistogram("ESD_HadIntQual_NormDCA", vNDCA);
4996 fHistograms->FillHistogram("ESD_HadIntQual_ErrY", errY);
4997 fHistograms->FillHistogram("ESD_HadIntQual_ErrZ", errZ);
4998 fHistograms->FillHistogram("ESD_HadIntQual_Err2D", err2D);
4999 fHistograms->FillHistogram("ESD_HadIntQual_Err3D", err3D);
5000 fHistograms->FillHistogram("ESD_HadIntQual_Chi2PerDOF", vertexStored[fin].GetChi2()/vertexStored[fin].GetNDF());
5001 Double_t chi2PerDOF = vertexStored[fin].GetChi2()/vertexStored[fin].GetNDF();
5002 if ( chi2PerDOF< fMaxChi2HadInt && err2D < fMaxErr2DHadInt ){
5003 fHistograms->FillHistogram("ESD_HadIntMap_ZR", vz,vr);
5004 fHistograms->FillHistogram("ESD_HadIntMap_XY", vx,vy);
5005
5006 fHistograms->FillHistogram("ESD_HadIntMap_ZPhi", vz,vphi);
5007 fHistograms->FillHistogram("ESD_HadIntMap_RPhi", vr,vphi);
5008 Double_t rFMD=25;
5009 Double_t rITSTPCMin=45;
5010 Double_t rITSTPCMax=80;
5011
5012 if(vr<rFMD){
5013 fHistograms->FillHistogram("ESD_HadIntMap_FMD_ZPhi", vz,vphi);
5014 }
5015 if(vr>rFMD && vr<rITSTPCMin){
5016 fHistograms->FillHistogram("ESD_HadIntMap_FMD2_ZPhi", vz,vphi);
5017 }
5018
5019 if(vr>rITSTPCMin && vr<rITSTPCMax){
5020 fHistograms->FillHistogram("ESD_HadIntMap_ITSTPC_ZPhi", vz,vphi);
5021 }
5022 Double_t rHotZoneMin = 5.7;
5023 Double_t rHotZoneMax = 50.;
5024 Double_t zHotZoneMin = 45.;
5025 Double_t zHotZoneMax = 75.;
5026
5027 if (vr>rHotZoneMin && vr < rHotZoneMax){
5028 fHistograms->FillHistogram("ESD_HadIntMap_HotZone_ZPhi", vz,vphi);
5029 if (vz < zHotZoneMax && vz > zHotZoneMin){
5030 fHistograms->FillHistogram("ESD_HadIntMap_HotZone_XY", vx,vy);
5031 }
5032 }
5033
5034 Double_t zBeamPipeInner = 30.;
5035 Double_t zOuterParts = 90.;
5036 if (vz < zBeamPipeInner && vz > - zBeamPipeInner) {
5037 fHistograms->FillHistogram("ESD_HadIntMapInnerBeampipe_XY", vx,vy);
5038 fHistograms->FillHistogram("ESD_HadIntMapInnerParts_XY", vx,vy);
5039 if (vr < rFMD ){
5040 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallR_ErrX", errX);
5041 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallR_ErrY", errY);
5042 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallR_ErrZ", errZ);
5043 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallR_Err2D", err2D);
5044 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallR_Err3D", err3D);
5045 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallR_Chi2PerDOF", vertexStored[fin].GetChi2()/vertexStored[fin].GetNDF());
5046 }
5047 }
5048
5049 if (vz > zOuterParts ) fHistograms->FillHistogram("ESD_HadIntMapPosZOuterParts_XY", vx,vy);
5050 if (vz > zBeamPipeInner && vz < zOuterParts ) {
5051 fHistograms->FillHistogram("ESD_HadIntMapPosZFMD_XY", vx,vy);
5052 if (vr < rFMD ){
5053 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallROut_ErrX", errX);
5054 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallROut_ErrY", errY);
5055 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallROut_ErrZ", errZ);
5056 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallROut_Err2D", err2D);
5057 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallROut_Err3D", err3D);
5058 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallROut_Chi2PerDOF", vertexStored[fin].GetChi2()/vertexStored[fin].GetNDF());
5059 }
5060 }
5061 if (vz < -zBeamPipeInner && vz > -zOuterParts ) fHistograms->FillHistogram("ESD_HadIntMapNegZFMD_XY", vx,vy);
5062
5063 fHistograms->FillHistogram("ESD_HadIntQualAftCuts_ErrX", errX);
5064 fHistograms->FillHistogram("ESD_HadIntQualAftCuts_ErrY", errY);
5065 fHistograms->FillHistogram("ESD_HadIntQualAftCuts_ErrZ", errZ);
5066 fHistograms->FillHistogram("ESD_HadIntQualAftCuts_Err2D", err2D);
5067 fHistograms->FillHistogram("ESD_HadIntQualAftCuts_Err3D", err3D);
5068 fHistograms->FillHistogram("ESD_HadIntQualAftCuts_Chi2PerDOF", vertexStored[fin].GetChi2()/vertexStored[fin].GetNDF());
5069
5070 if (kVertexArr[fin][0]>2 ){
5071 fHistograms->FillHistogram("ESD_HadIntMap3_ZR", vz,vr);
5072 fHistograms->FillHistogram("ESD_HadIntMap3_XY", vx,vy);
5073
5074 fHistograms->FillHistogram("ESD_HadIntMap3_ZPhi", vz,vphi);
5075 fHistograms->FillHistogram("ESD_HadIntMap3_RPhi", vr,vphi);
5076
5077 if(vr<rFMD){
5078 fHistograms->FillHistogram("ESD_HadIntMap3_FMD_ZPhi", vz,vphi);
5079 }
5080 if(vr>rFMD && vr<rITSTPCMin){
5081 fHistograms->FillHistogram("ESD_HadIntMap3_FMD2_ZPhi", vz,vphi);
5082 }
5083
5084 if (vr>rITSTPCMin && vr<rITSTPCMax){
5085 fHistograms->FillHistogram("ESD_HadIntMap3_ITSTPC_ZPhi", vz,vphi);
5086 }
5087 if (vz < zBeamPipeInner && vz > - zBeamPipeInner) {
5088 fHistograms->FillHistogram("ESD_HadIntMap3InnerBeampipe_XY", vx,vy);
5089 fHistograms->FillHistogram("ESD_HadIntMap3InnerParts_XY", vx,vy);
5090 }
5091 if (vz > zOuterParts ) fHistograms->FillHistogram("ESD_HadIntMap3PosZOuterParts_XY", vx,vy);
5092 if (vz > zBeamPipeInner && vz < zOuterParts ) {
5093 fHistograms->FillHistogram("ESD_HadIntMap3PosZFMD_XY", vx,vy);
5094 }
5095 if (vz < -zBeamPipeInner && vz > -zOuterParts ) fHistograms->FillHistogram("ESD_HadIntMap3NegZFMD_XY", vx,vy);
5096
5097 if (vr>rHotZoneMin && vr < rHotZoneMax){
5098 fHistograms->FillHistogram("ESD_HadIntMap3_HotZone_ZPhi", vz,vphi);
5099 if (vz < zHotZoneMax && vz > zHotZoneMin){
5100 fHistograms->FillHistogram("ESD_HadIntMap3_HotZone_XY", vx,vy);
5101 }
5102 }
5103 fHistograms->FillHistogram("ESD_HadIntQual3AftCuts_ErrX", errX);
5104 fHistograms->FillHistogram("ESD_HadIntQual3AftCuts_ErrY", errY);
5105 fHistograms->FillHistogram("ESD_HadIntQual3AftCuts_ErrZ", errZ);
5106 fHistograms->FillHistogram("ESD_HadIntQual3AftCuts_Err2D", err2D);
5107 fHistograms->FillHistogram("ESD_HadIntQual3AftCuts_Err3D", err3D);
5108 fHistograms->FillHistogram("ESD_HadIntQual3AftCuts_Chi2PerDOF", vertexStored[fin].GetChi2()/vertexStored[fin].GetNDF());
5109 }
5110 nVerticesPassed++;
5111 }
5112 }
5113
5114// if (nVertices > 0){
5115// cout << "number of total vertices: "<< nVertices << endl;
5116// cout << "number of total vertices passing selection: "<< nVerticesPassed << endl;
5117// cout << "vertices rejected in loop: " << verticesRejectedInLoop << endl;
5118// }
5119 delete [] rejectTrack;
5120}
5121
5122
5123Bool_t AliAnalysisTaskGammaConversion::CheckLooper(Int_t index, AliESDEvent *event){
5124 //
5125 // check if given track is looper candidate
5126 // if looper return kTRUE
5127 //
5128 Int_t ntracks=event->GetNumberOfTracks();
5129 Int_t index1=-1;
5130 const Double_t ktglCut=0.03;
5131 const Double_t kalphaCut=0.4;
5132 //
5133 AliESDtrack * track0 = event->GetTrack(index);
5134 AliESDtrack * track1P = 0;
5135 for (Int_t itrack1=0; itrack1<ntracks; itrack1++){
5136 if (itrack1==index) continue;
5137 AliESDtrack *track1=event->GetTrack(itrack1);
5138 if (!track1) continue;
5139 if (TMath::Abs(TMath::Abs(track1->GetTgl())-TMath::Abs(track0->GetTgl()))>ktglCut) continue;
5140 if (TMath::Abs(TMath::Abs(track1->GetAlpha())-TMath::Abs(track0->GetAlpha()))>kalphaCut) continue;
5141 index1=index;
5142 track1P=track1;
5143 }
5144 if (index1>=0){
5145 return kTRUE;
5146 }
5147 return kFALSE;
5148}
5149
5150Bool_t AliAnalysisTaskGammaConversion::CheckV0(Int_t index, AliESDEvent *event){
5151 //
5152 // check if given track is V0 candidata
5153 // if looper return kTRUE
5154 //
7033a2a4 5155 if(index || event)
5156 return kFALSE;
5157 else
3b77b2d1 5158 return kFALSE;
3b77b2d1 5159
7033a2a4 5160 // Int_t ntracks=event->GetNumberOfTracks();
5161 // Int_t index1=-1;
5162 // const Double_t kSigmaMass=0.001;
5163 // const Int_t kChi2Cut=10;
5164 // //
5165 // AliESDtrack * track0 = event->GetTrack(index);
5166 // AliExternalTrackParam pL(*track0);
5167 // AliKFParticle part0El(*track0, 11); //assuming mass e
5168 // AliKFParticle part0Pi(*track0, 211); //assuming mass pion
5169 // AliKFParticle part0P(*track0, 2212); //assuming mass proton
5170 // if (track0->Charge()*part0El.Q()<0) {
5171 // part0El.Q()*=-1; // change sign if opposite
5172 // part0Pi.Q()*=-1; // change sign if opposite
5173 // part0P.Q()*=-1; // change sign if opposite
5174 // }
5175 // Bool_t isGamma=0;
5176 // Bool_t isK0=0;
5177 // Bool_t isLambda=0;
5178 // Bool_t isLambdaBar=0;
5179
5180 // for (Int_t itrack1=0; itrack1<ntracks; itrack1++){
5181 // if (itrack1==index) continue;
5182 // AliESDtrack *track1=event->GetTrack(itrack1);
5183 // if (!track1) continue;
5184 // if (track1->Charge()*track0->Charge()>0) continue;
5185 // AliKFParticle part1El(*track1, 11); //assuming mass e
5186 // AliKFParticle part1Pi(*track1, 211); //assuming mass pion
5187 // AliKFParticle part1P(*track1, 2212); //assuming mass proton
5188 // if (track1->Charge()*part1El.Q()<0) {
5189 // part1El.Q()*=-1; // change sign if opposite
5190 // part1Pi.Q()*=-1; // change sign if opposite
5191 // part1P.Q()*=-1; // change sign if opposite
5192 // }
5193 // //
5194 // AliKFVertex vertexG; // gamma conversion candidate
5195 // vertexG+=part0El;
5196 // vertexG+=part1El;
5197 // AliKFVertex vertexGC; // gamma conversion candidate
5198 // vertexGC+=part0El;
5199 // vertexGC+=part1El;
5200 // vertexGC.SetMassConstraint(0,kSigmaMass);
5201 // AliKFVertex vertexK0; // K0s candidate
5202 // vertexK0+=part0Pi;
5203 // vertexK0+=part1Pi;
5204 // AliKFVertex vertexK0C; // K0s candidate
5205 // vertexK0C+=part0Pi;
5206 // vertexK0C+=part1Pi;
5207 // vertexK0C.SetMassConstraint(0.497614,kSigmaMass);
5208 // AliKFVertex vertexLambda; // Lambda candidate
5209 // vertexLambda+=part0Pi;
5210 // vertexLambda+=part1P;
5211 // AliKFVertex vertexLambdaC; // Lambda candidate
5212 // vertexLambdaC+=part0Pi;
5213 // vertexLambdaC+=part1Pi;
5214 // vertexLambdaC.SetMassConstraint(1.115683,kSigmaMass);
5215 // AliKFVertex vertexLambdaB; // Lambda candidate
5216 // vertexLambdaB+=part0Pi;
5217 // vertexLambdaB+=part1P;
5218 // AliKFVertex vertexLambdaBC; // LambdaBar candidate
5219 // vertexLambdaBC+=part0Pi;
5220 // vertexLambdaBC+=part1Pi;
5221 // vertexLambdaBC.SetMassConstraint(1.115683,kSigmaMass);
3b77b2d1 5222
7033a2a4 5223 // if (vertexGC.GetChi2()<kChi2Cut && vertexG.GetMass()<0.06) isGamma=kTRUE;
5224 // if (vertexK0C.GetChi2()<kChi2Cut&&TMath::Abs(vertexK0.GetMass()-0.5)<0.06) isK0=kTRUE;
5225 // if (vertexLambdaC.GetChi2()<kChi2Cut&&TMath::Abs(vertexLambda.GetMass()-1.1)<0.06) isLambda=kTRUE;
5226 // if (vertexLambdaBC.GetChi2()<kChi2Cut&&TMath::Abs(vertexLambdaB.GetMass()-1.1)<0.06) isLambdaBar=kTRUE;
5227 // if (isGamma||isK0||isLambda||isLambdaBar) {
5228 // index1=index;
5229 // break;
5230 // }
5231 // }
5232 // if (index1>0) return kTRUE;
5233 // return kFALSE;
3b77b2d1 5234}
5235
d7d7e825 5236
5237void AliAnalysisTaskGammaConversion::ProcessGammaElectronsForChicAnalysis(){
2eedd4ed 5238 // see header file for documantation
a0b94e5c 5239
2eedd4ed 5240 fESDEvent = fV0Reader->GetESDEvent();
a0b94e5c 5241
5242
2eedd4ed 5243 TClonesArray * vESDeNegTemp = new TClonesArray("AliESDtrack",0);
5244 TClonesArray * vESDePosTemp = new TClonesArray("AliESDtrack",0);
5245 TClonesArray * vESDxNegTemp = new TClonesArray("AliESDtrack",0);
5246 TClonesArray * vESDxPosTemp = new TClonesArray("AliESDtrack",0);
5247 TClonesArray * vESDeNegNoJPsi = new TClonesArray("AliESDtrack",0);
5248 TClonesArray * vESDePosNoJPsi = new TClonesArray("AliESDtrack",0);
a0b94e5c 5249
2eedd4ed 5250 /*
5251 vector <AliESDtrack*> vESDeNegTemp(0);
5252 vector <AliESDtrack*> vESDePosTemp(0);
5253 vector <AliESDtrack*> vESDxNegTemp(0);
5254 vector <AliESDtrack*> vESDxPosTemp(0);
5255 vector <AliESDtrack*> vESDeNegNoJPsi(0);
5256 vector <AliESDtrack*> vESDePosNoJPsi(0);
5257 */
a0b94e5c 5258
5259
2eedd4ed 5260 fHistograms->FillTable("Table_Electrons",0);//Count number of Events
a0b94e5c 5261
2eedd4ed 5262 for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){
5263 AliESDtrack* curTrack = fESDEvent->GetTrack(iTracks);
a0b94e5c 5264
2eedd4ed 5265 if(!curTrack){
5266 //print warning here
5267 continue;
5268 }
a0b94e5c 5269
2eedd4ed 5270 double p[3];if(!curTrack->GetConstrainedPxPyPz(p))continue;
5271 double r[3];curTrack->GetConstrainedXYZ(r);
a0b94e5c 5272
2eedd4ed 5273 TVector3 rXYZ(r);
a0b94e5c 5274
2eedd4ed 5275 fHistograms->FillTable("Table_Electrons",4);//Count number of ESD tracks
a0b94e5c 5276
2eedd4ed 5277 Bool_t flagKink = kTRUE;
5278 Bool_t flagTPCrefit = kTRUE;
5279 Bool_t flagTRDrefit = kTRUE;
5280 Bool_t flagITSrefit = kTRUE;
5281 Bool_t flagTRDout = kTRUE;
5282 Bool_t flagVertex = kTRUE;
a0b94e5c 5283
5284
2eedd4ed 5285 //Cuts ---------------------------------------------------------------
a0b94e5c 5286
2eedd4ed 5287 if(curTrack->GetKinkIndex(0) > 0){
5288 fHistograms->FillHistogram("Table_Electrons",5);//Count kink
5289 flagKink = kFALSE;
5290 }
a0b94e5c 5291
2eedd4ed 5292 ULong_t trkStatus = curTrack->GetStatus();
a0b94e5c 5293
2eedd4ed 5294 ULong_t tpcRefit = (trkStatus & AliESDtrack::kTPCrefit);
a0b94e5c 5295
2eedd4ed 5296 if(!tpcRefit){
5297 fHistograms->FillHistogram("Table_Electrons",9);//Count not TPCrefit
5298 flagTPCrefit = kFALSE;
5299 }
a0b94e5c 5300
2eedd4ed 5301 ULong_t itsRefit = (trkStatus & AliESDtrack::kITSrefit);
5302 if(!itsRefit){
5303 fHistograms->FillHistogram("Table_Electrons",10);//Count not ITSrefit
5304 flagITSrefit = kFALSE;
5305 }
a0b94e5c 5306
2eedd4ed 5307 ULong_t trdRefit = (trkStatus & AliESDtrack::kTRDrefit);
a0b94e5c 5308
2eedd4ed 5309 if(!trdRefit){
5310 fHistograms->FillHistogram("Table_Electrons",8); //Count not TRDrefit
5311 flagTRDrefit = kFALSE;
5312 }
a0b94e5c 5313
2eedd4ed 5314 ULong_t trdOut = (trkStatus & AliESDtrack::kTRDout);
a0b94e5c 5315
2eedd4ed 5316 if(!trdOut) {
5317 fHistograms->FillHistogram("Table_Electrons",7); //Count not TRDout
5318 flagTRDout = kFALSE;
5319 }
a0b94e5c 5320
2eedd4ed 5321 double nsigmaToVxt = GetSigmaToVertex(curTrack);
a0b94e5c 5322
2eedd4ed 5323 if(nsigmaToVxt > 3){
5324 fHistograms->FillHistogram("Table_Electrons",6); //Count Tracks with number of sigmas > 3
5325 flagVertex = kFALSE;
5326 }
a0b94e5c 5327
2eedd4ed 5328 if(! (flagKink && flagTPCrefit && flagITSrefit && flagTRDrefit && flagTRDout && flagVertex ) ) continue;
5329 fHistograms->FillHistogram("Table_Electrons",11);//Count Tracks passed Cuts
a0b94e5c 5330
5331
2eedd4ed 5332 Stat_t pid, weight;
5333 GetPID(curTrack, pid, weight);
a0b94e5c 5334
2eedd4ed 5335 if(pid!=0){
5336 fHistograms->FillHistogram("Table_Electrons",12); //Count Tracks with pid != 0
5337 }
a0b94e5c 5338
2eedd4ed 5339 if(pid == 0){
5340 fHistograms->FillHistogram("Table_Electrons",13); //Count Tracks with pid != 0
5341 }
a0b94e5c 5342
5343
5344
5345
a0b94e5c 5346
5347
2eedd4ed 5348 TLorentzVector curElec;
5349 curElec.SetXYZM(p[0],p[1],p[2],fElectronMass);
a0b94e5c 5350
5351
2eedd4ed 5352 if(fDoMCTruth){
5353 Int_t labelMC = TMath::Abs(curTrack->GetLabel());
5354 TParticle* curParticle = fStack->Particle(labelMC);
5355 if(curTrack->GetSign() > 0){
5356 if( pid == 0){
5357 fHistograms->FillHistogram("MC_ElectronPosNegPt",curParticle->Pt());
5358 fHistograms->FillHistogram("MC_ElectronPosNegEta",curParticle->Eta());
5359 } else {
5360 fHistograms->FillHistogram("MC_ElectronPosNegPt",curParticle->Pt());
5361 fHistograms->FillHistogram("MC_ElectronPosNegEta",curParticle->Eta());
5362 }
5363 }
5364 }
a0b94e5c 5365
5366
2eedd4ed 5367 if(curTrack->GetSign() > 0){
a0b94e5c 5368
2eedd4ed 5369 // vESDxPosTemp.push_back(curTrack);
5370 new((*vESDxPosTemp)[vESDxPosTemp->GetEntriesFast()]) AliESDtrack(*curTrack);
a0b94e5c 5371
2eedd4ed 5372 if( pid == 0){
5373 fHistograms->FillHistogram("ESD_ElectronPosNegPt",curElec.Pt());
5374 fHistograms->FillHistogram("ESD_ElectronPosPt",curElec.Pt());
5375 // fHistograms->FillHistogram("MC_ElectronPosNegPt",curParticle->Pt());
5376 fHistograms->FillHistogram("ESD_ElectronPosNegEta",curElec.Eta());
5377 // fHistograms->FillHistogram("MC_ElectronPosNegEta",curParticle->Eta());
5378 // vESDePosTemp.push_back(curTrack);
5379 new((*vESDePosTemp)[vESDePosTemp->GetEntriesFast()]) AliESDtrack(*curTrack);
5380 }
a0b94e5c 5381
2eedd4ed 5382 } else {
5e55d806 5383
2eedd4ed 5384 new((*vESDxNegTemp)[vESDxNegTemp->GetEntriesFast()]) AliESDtrack(*curTrack);
a0b94e5c 5385
2eedd4ed 5386 if( pid == 0){
5387
5388 fHistograms->FillHistogram("ESD_ElectronPosNegPt",curElec.Pt());
5389 fHistograms->FillHistogram("ESD_ElectronNegPt",curElec.Pt());
5390 fHistograms->FillHistogram("ESD_ElectronPosNegEta",curElec.Eta());
5391 new((*vESDeNegTemp)[vESDeNegTemp->GetEntriesFast()]) AliESDtrack(*curTrack);
5392
5393 }
a0b94e5c 5394
2eedd4ed 5395 }
a0b94e5c 5396
2eedd4ed 5397 }
a0b94e5c 5398
d7d7e825 5399
2eedd4ed 5400 Bool_t ePosJPsi = kFALSE;
5401 Bool_t eNegJPsi = kFALSE;
5402 Bool_t ePosPi0 = kFALSE;
5403 Bool_t eNegPi0 = kFALSE;
5404
5405 UInt_t iePosJPsi=0,ieNegJPsi=0,iePosPi0=0,ieNegPi0=0;
5406
5407 for(Int_t iNeg=0; iNeg < vESDeNegTemp->GetEntriesFast(); iNeg++){
5408 if(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(iNeg)))->GetLabel()))->GetPdgCode() == 11)
5409 if(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(iNeg)))->GetLabel()))->GetMother(0) > -1){
5410 Int_t labelMother = fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(iNeg)))->GetLabel()))->GetMother(0);
5411 TParticle* partMother = fStack ->Particle(labelMother);
5412 if (partMother->GetPdgCode() == 111){
5413 ieNegPi0 = iNeg;
5414 eNegPi0 = kTRUE;
5415 }
5416 if(partMother->GetPdgCode() == 443){ //Mother JPsi
5417 fHistograms->FillTable("Table_Electrons",14);
5418 ieNegJPsi = iNeg;
5419 eNegJPsi = kTRUE;
5420 } else {
5421 // vESDeNegNoJPsi.push_back(vESDeNegTemp[iNeg]);
5422 new((*vESDeNegNoJPsi)[vESDeNegNoJPsi->GetEntriesFast()]) AliESDtrack(*(AliESDtrack*)(vESDeNegTemp->At(iNeg)));
5423 // cout<<"ESD No Positivo JPsi "<<endl;
5424 }
5425 }
5426 }
a0b94e5c 5427
2eedd4ed 5428 for(Int_t iPos=0; iPos < vESDePosTemp->GetEntriesFast(); iPos++){
5429 if(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iPos)))->GetLabel()))->GetPdgCode() == -11)
5430 if(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iPos)))->GetLabel()))->GetMother(0) > -1){
5431 Int_t labelMother = fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iPos)))->GetLabel()))->GetMother(0);
5432 TParticle* partMother = fStack ->Particle(labelMother);
5433 if (partMother->GetPdgCode() == 111){
5434 iePosPi0 = iPos;
5435 ePosPi0 = kTRUE;
5436 }
5437 if(partMother->GetPdgCode() == 443){ //Mother JPsi
5438 fHistograms->FillTable("Table_Electrons",15);
5439 iePosJPsi = iPos;
5440 ePosJPsi = kTRUE;
5441 }
5442 else{
5443 // vESDePosNoJPsi.push_back(vESDePosTemp[iPos]);
5444 new((*vESDePosNoJPsi)[vESDePosNoJPsi->GetEntriesFast()]) AliESDtrack(*(AliESDtrack*)(vESDePosTemp->At(iPos)));
5445 // cout<<"ESD No Negativo JPsi "<<endl;
5446 }
5447 }
d7d7e825 5448 }
d7d7e825 5449
2eedd4ed 5450 if( eNegJPsi && ePosJPsi ){
5451 TVector3 tempeNegV,tempePosV;
5452 tempeNegV.SetXYZ(((AliESDtrack*)(vESDeNegTemp->At(ieNegJPsi)))->Px(),((AliESDtrack*)(vESDeNegTemp->At(ieNegJPsi)))->Py(),((AliESDtrack*)(vESDeNegTemp->At(ieNegJPsi)))->Pz());
5453 tempePosV.SetXYZ(((AliESDtrack*)(vESDePosTemp->At(iePosJPsi)))->Px(),((AliESDtrack*)(vESDePosTemp->At(iePosJPsi)))->Py(),((AliESDtrack*)(vESDePosTemp->At(iePosJPsi)))->Pz());
5454 fHistograms->FillTable("Table_Electrons",16);
5455 fHistograms->FillHistogram("ESD_ElectronPosNegJPsiAngle",tempeNegV.Angle(tempePosV));
5456 fHistograms->FillHistogram("MC_ElectronPosNegJPsiAngle",GetMCOpeningAngle(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(ieNegJPsi)))->GetLabel())),
5457 fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iePosJPsi)))->GetLabel()))));
5458 }
d7d7e825 5459
2eedd4ed 5460 if( eNegPi0 && ePosPi0 ){
5461 TVector3 tempeNegV,tempePosV;
5462 tempeNegV.SetXYZ(((AliESDtrack*)(vESDeNegTemp->At(ieNegPi0)))->Px(),((AliESDtrack*)(vESDeNegTemp->At(ieNegPi0)))->Py(),((AliESDtrack*)(vESDeNegTemp->At(ieNegPi0)))->Pz());
5463 tempePosV.SetXYZ(((AliESDtrack*)(vESDePosTemp->At(iePosPi0)))->Px(),((AliESDtrack*)(vESDePosTemp->At(iePosPi0)))->Py(),((AliESDtrack*)(vESDePosTemp->At(iePosPi0)))->Pz());
5464 fHistograms->FillHistogram("ESD_ElectronPosNegPi0Angle",tempeNegV.Angle(tempePosV));
5465 fHistograms->FillHistogram("MC_ElectronPosNegPi0Angle",GetMCOpeningAngle(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(ieNegPi0)))->GetLabel())),
5466 fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iePosPi0)))->GetLabel()))));
5467 }
a0b94e5c 5468
5469
2eedd4ed 5470 FillAngle("ESD_eNegePosAngleBeforeCut",GetTLorentzVector(vESDeNegTemp),GetTLorentzVector(vESDePosTemp));
a0b94e5c 5471
2eedd4ed 5472 CleanWithAngleCuts(*vESDeNegTemp,*vESDePosTemp,*fKFReconstructedGammasTClone);
d7d7e825 5473
2eedd4ed 5474 // vector <TLorentzVector> vCurrentTLVeNeg = GetTLorentzVector(fCurrentEventNegElectron);
5475 // vector <TLorentzVector> vCurrentTLVePos = GetTLorentzVector(fCurrentEventPosElectron);
a0b94e5c 5476
2eedd4ed 5477 TClonesArray vCurrentTLVeNeg = GetTLorentzVector(fCurrentEventNegElectronTClone);
5478 TClonesArray vCurrentTLVePos = GetTLorentzVector(fCurrentEventPosElectronTClone);
a0b94e5c 5479
5480
2eedd4ed 5481 FillAngle("ESD_eNegePosAngleAfterCut",vCurrentTLVeNeg,vCurrentTLVePos);
a0b94e5c 5482
5483
5484
5485
2eedd4ed 5486 //FillAngle("ESD_eNegePosAngleAfterCut",CurrentTLVeNeg,CurrentTLVePos);
a0b94e5c 5487
5488
2eedd4ed 5489 FillElectronInvMass("ESD_InvMass_ePluseMinus",vCurrentTLVeNeg,vCurrentTLVePos);
5490 FillElectronInvMass("ESD_InvMass_xPlusxMinus",GetTLorentzVector(vESDxNegTemp),GetTLorentzVector(vESDxPosTemp));
a0b94e5c 5491
5492
5493
2eedd4ed 5494 FillGammaElectronInvMass("ESD_InvMass_GammaePluseMinusChiC","ESD_InvMass_GammaePluseMinusChiCDiff",*fKFReconstructedGammasCutTClone,vCurrentTLVeNeg,vCurrentTLVePos);
a0b94e5c 5495
2eedd4ed 5496 FillGammaElectronInvMass("ESD_InvMass_GammaePluseMinusPi0","ESD_InvMass_GammaePluseMinusPi0Diff",
5497 *fKFReconstructedGammasCutTClone,vCurrentTLVeNeg,vCurrentTLVePos);
a0b94e5c 5498
2eedd4ed 5499 //BackGround
a0b94e5c 5500
2eedd4ed 5501 //Like Sign e+e-
5502 ElectronBackground("ESD_ENegBackground",vCurrentTLVeNeg);
5503 ElectronBackground("ESD_EPosBackground",vCurrentTLVePos);
5504 ElectronBackground("ESD_EPosENegBackground",vCurrentTLVeNeg);
5505 ElectronBackground("ESD_EPosENegBackground",vCurrentTLVePos);
a0b94e5c 5506
2eedd4ed 5507 // Like Sign e+e- no JPsi
5508 ElectronBackground("ESD_EPosENegNoJPsiBG",GetTLorentzVector(vESDeNegNoJPsi));
5509 ElectronBackground("ESD_EPosENegNoJPsiBG",GetTLorentzVector(vESDePosNoJPsi));
a0b94e5c 5510
2eedd4ed 5511 //Mixed Event
a0b94e5c 5512
2eedd4ed 5513 if( fCurrentEventPosElectronTClone->GetEntriesFast() > 0 && fCurrentEventNegElectronTClone->GetEntriesFast() > 0 && fKFReconstructedGammasCutTClone->GetEntriesFast() > 0 ){
5514 FillGammaElectronInvMass("ESD_EPosENegGammaBackgroundMX","ESD_EPosENegGammaBackgroundMXDiff",
5515 *fKFReconstructedGammasCutTClone,*fPreviousEventTLVNegElectronTClone,*fPreviousEventTLVPosElectronTClone);
5516 *fPreviousEventTLVNegElectronTClone = vCurrentTLVeNeg;
5517 *fPreviousEventTLVPosElectronTClone = vCurrentTLVePos;
a0b94e5c 5518
2eedd4ed 5519 }
a0b94e5c 5520
2eedd4ed 5521 /*
5522 //Photons P
5523 Double_t vtx[3];
5524 vtx[0]=0;vtx[1]=0;vtx[2]=0;
5525 for(UInt_t i=0;i<fKFReconstructedGammasChic.size();i++){
a0b94e5c 5526
2eedd4ed 5527 // if(fMCGammaChicTempCut[i]->GetMother(0) < 0) continue;
a0b94e5c 5528
5529
5530
2eedd4ed 5531 Int_t tempLabel = fStack->Particle(fMCGammaChicTempCut[i]->GetMother(0))->GetPdgCode();
5532 // cout<<" Label Pedro Gonzalez " <<tempLabel <<endl;
a0b94e5c 5533
2eedd4ed 5534 // cout<<" Label Distance"<<fKFReconstructedGammasChic[i].GetDistanceFromVertex(vtx)<<endl;
a0b94e5c 5535
2eedd4ed 5536 if( tempLabel == 10441 || tempLabel == 20443 || tempLabel == 445 )
a0b94e5c 5537
2eedd4ed 5538 fHistograms->FillHistogram("ESD_PhotonsMomentum",fKFReconstructedGammasChic[i].GetMomentum());
a0b94e5c 5539
5540
2eedd4ed 5541 }
a0b94e5c 5542
5543
2eedd4ed 5544 */
1e7846f4 5545
5546
2eedd4ed 5547 vESDeNegTemp->Delete();
5548 vESDePosTemp->Delete();
5549 vESDxNegTemp->Delete();
5550 vESDxPosTemp->Delete();
5551 vESDeNegNoJPsi->Delete();
5552 vESDePosNoJPsi->Delete();
1e7846f4 5553
2eedd4ed 5554 delete vESDeNegTemp;
5555 delete vESDePosTemp;
5556 delete vESDxNegTemp;
5557 delete vESDxPosTemp;
5558 delete vESDeNegNoJPsi;
5559 delete vESDePosNoJPsi;
d7d7e825 5560}
5561
6c84d371 5562/*
2eedd4ed 5563 void AliAnalysisTaskGammaConversion::FillAngle(TString histoName,vector <TLorentzVector> tlVeNeg, vector <TLorentzVector> tlVePos){
5564 //see header file for documentation
5565 for( UInt_t iNeg=0; iNeg < tlVeNeg.size(); iNeg++){
5566 for (UInt_t iPos=0; iPos < tlVePos.size(); iPos++){
5567 fHistograms->FillHistogram(histoName.Data(),tlVeNeg[iNeg].Vect().Angle(tlVePos[iPos].Vect()));
5568 }
5569 }
5570 }
6c84d371 5571*/
5572void AliAnalysisTaskGammaConversion::FillAngle(TString histoName,TClonesArray const tlVeNeg, TClonesArray const tlVePos){
2eedd4ed 5573 //see header file for documentation
5574 for( Int_t iNeg=0; iNeg < tlVeNeg.GetEntriesFast(); iNeg++){
5575 for (Int_t iPos=0; iPos < tlVePos.GetEntriesFast(); iPos++){
5576 fHistograms->FillHistogram(histoName.Data(),((TLorentzVector*)(tlVeNeg.At(iNeg)))->Vect().Angle(((TLorentzVector*)(tlVePos.At(iPos)))->Vect()));
5577 }
5578 }
d7d7e825 5579}
2eedd4ed 5580
6c84d371 5581void AliAnalysisTaskGammaConversion::FillElectronInvMass(TString histoName, TClonesArray const eNeg, TClonesArray const ePos){
2eedd4ed 5582 //see header file for documentation
5583 for( Int_t n=0; n < eNeg.GetEntriesFast(); n++){
5584 TLorentzVector en = (*(TLorentzVector*)(eNeg.At(n)));
5585 for (Int_t p=0; p < ePos.GetEntriesFast(); p++){
5586 TLorentzVector ep = (*(TLorentzVector*)(ePos.At(p)));
5587 TLorentzVector np = ep + en;
5588 fHistograms->FillHistogram(histoName.Data(),np.M());
5589 }
5590 }
d7d7e825 5591}
5592
6c84d371 5593void AliAnalysisTaskGammaConversion::FillGammaElectronInvMass(TString histoMass,TString histoDiff,TClonesArray const fKFGammas,
2eedd4ed 5594 TClonesArray const tlVeNeg,TClonesArray const tlVePos)
d7d7e825 5595{
2eedd4ed 5596 //see header file for documentation
a0b94e5c 5597
2eedd4ed 5598 for( Int_t iNeg=0; iNeg < tlVeNeg.GetEntriesFast(); iNeg++ ){
a0b94e5c 5599
2eedd4ed 5600 for (Int_t iPos=0; iPos < tlVePos.GetEntriesFast(); iPos++){
a0b94e5c 5601
2eedd4ed 5602 TLorentzVector xy = *((TLorentzVector *)(tlVePos.At(iPos))) + *((TLorentzVector *)(tlVeNeg.At(iNeg)));
a0b94e5c 5603
2eedd4ed 5604 for (Int_t iGam=0; iGam < fKFGammas.GetEntriesFast(); iGam++){
a0b94e5c 5605
6c84d371 5606 // AliKFParticle * gammaCandidate = &fKFGammas[iGam];
5607 AliKFParticle * gammaCandidate = (AliKFParticle *)(fKFGammas.At(iGam));
d7d7e825 5608 TLorentzVector g;
a0b94e5c 5609
d7d7e825 5610 g.SetXYZM(gammaCandidate->GetPx(),gammaCandidate->GetPy(),gammaCandidate->GetPz(),fGammaMass);
5611 TLorentzVector xyg = xy + g;
5612 fHistograms->FillHistogram(histoMass.Data(),xyg.M());
5613 fHistograms->FillHistogram(histoDiff.Data(),(xyg.M()-xy.M()));
2eedd4ed 5614 }
5615 }
5616 }
a0b94e5c 5617
d7d7e825 5618}
6c84d371 5619void AliAnalysisTaskGammaConversion::ElectronBackground(TString hBg, TClonesArray e)
d7d7e825 5620{
2eedd4ed 5621 // see header file for documentation
5622 for(Int_t i=0; i < e.GetEntriesFast(); i++) {
5623 for (Int_t j=i+1; j < e.GetEntriesFast(); j++) {
5624 TLorentzVector ee = (*(TLorentzVector*)(e.At(i))) + (*(TLorentzVector*)(e.At(j)));
5625 fHistograms->FillHistogram(hBg.Data(),ee.M());
5626 }
d7d7e825 5627 }
d7d7e825 5628}
5629
5630
6c84d371 5631void AliAnalysisTaskGammaConversion::CleanWithAngleCuts(TClonesArray const negativeElectrons,
5632 TClonesArray const positiveElectrons,
5633 TClonesArray const gammas){
2eedd4ed 5634 // see header file for documentation
a0b94e5c 5635
2eedd4ed 5636 UInt_t sizeN = negativeElectrons.GetEntriesFast();
5637 UInt_t sizeP = positiveElectrons.GetEntriesFast();
5638 UInt_t sizeG = gammas.GetEntriesFast();
a0b94e5c 5639
5640
5641
2eedd4ed 5642 vector <Bool_t> xNegBand(sizeN);
5643 vector <Bool_t> xPosBand(sizeP);
5644 vector <Bool_t> gammaBand(sizeG);
a0b94e5c 5645
5646
2eedd4ed 5647 for(UInt_t iNeg=0; iNeg < sizeN; iNeg++) xNegBand[iNeg]=kTRUE;
5648 for(UInt_t iPos=0; iPos < sizeP; iPos++) xPosBand[iPos]=kTRUE;
5649 for(UInt_t iGam=0; iGam < sizeG; iGam++) gammaBand[iGam]=kTRUE;
d7d7e825 5650
a0b94e5c 5651
2eedd4ed 5652 for(UInt_t iPos=0; iPos < sizeP; iPos++){
a0b94e5c 5653
2eedd4ed 5654 Double_t aP[3];
5655 ((AliESDtrack*)(positiveElectrons.At(iPos)))->GetConstrainedPxPyPz(aP);
a0b94e5c 5656
2eedd4ed 5657 TVector3 ePosV(aP[0],aP[1],aP[2]);
a0b94e5c 5658
2eedd4ed 5659 for(UInt_t iNeg=0; iNeg < sizeN; iNeg++){
a0b94e5c 5660
2eedd4ed 5661 Double_t aN[3];
5662 ((AliESDtrack*)(negativeElectrons.At(iNeg)))->GetConstrainedPxPyPz(aN);
5663 TVector3 eNegV(aN[0],aN[1],aN[2]);
a0b94e5c 5664
2eedd4ed 5665 if(ePosV.Angle(eNegV) < 0.05){ //e+e- from gamma
5666 xPosBand[iPos]=kFALSE;
5667 xNegBand[iNeg]=kFALSE;
5668 }
a0b94e5c 5669
2eedd4ed 5670 for(UInt_t iGam=0; iGam < sizeG; iGam++){
5671 AliKFParticle* gammaCandidate = (AliKFParticle*)gammas.At(iGam);
5672 TVector3 gammaCandidateVector(gammaCandidate->Px(),gammaCandidate->Py(),gammaCandidate->Pz());
5673 if(ePosV.Angle(gammaCandidateVector) < 0.05 || eNegV.Angle(gammaCandidateVector) < 0.05)
5674 gammaBand[iGam]=kFALSE;
5675 }
5676 }
5677 }
a0b94e5c 5678
2eedd4ed 5679 for(UInt_t iPos=0; iPos < sizeP; iPos++){
5680 if(xPosBand[iPos]){
5681 new((*fCurrentEventPosElectronTClone)[fCurrentEventPosElectronTClone->GetEntriesFast()]) AliESDtrack((*(AliESDtrack*)(positiveElectrons.At(iPos))));
5682 // fCurrentEventPosElectron.push_back(positiveElectrons[iPos]);
5683 }
5684 }
5685 for(UInt_t iNeg=0;iNeg < sizeN; iNeg++){
5686 if(xNegBand[iNeg]){
5687 new((*fCurrentEventNegElectronTClone)[fCurrentEventNegElectronTClone->GetEntriesFast()]) AliESDtrack((*(AliESDtrack*)(negativeElectrons.At(iNeg))));
5688 // fCurrentEventNegElectron.push_back(negativeElectrons[iNeg]);
5689 }
5690 }
5691 for(UInt_t iGam=0; iGam < sizeG; iGam++){
5692 if(gammaBand[iGam]){
5693 new((*fKFReconstructedGammasCutTClone)[fKFReconstructedGammasCutTClone->GetEntriesFast()]) AliKFParticle((*(AliKFParticle*)(gammas.At(iGam))));
5694 //fKFReconstructedGammasCut.push_back(*(AliKFParticle*)gammas->At(iGam));
5695 }
5696 }
d7d7e825 5697}
5698
5699
2eedd4ed 5700void AliAnalysisTaskGammaConversion::GetPID(const AliESDtrack *track, Stat_t &pid, Stat_t &weight)
d7d7e825 5701{
2eedd4ed 5702 // see header file for documentation
5703 pid = -1;
5704 weight = -1;
a0b94e5c 5705
2eedd4ed 5706 double wpart[5];
5707 double wpartbayes[5];
a0b94e5c 5708
2eedd4ed 5709 //get probability of the diffenrent particle types
5710 track->GetESDpid(wpart);
a0b94e5c 5711
2eedd4ed 5712 // Tentative particle type "concentrations"
5713 double c[5]={0.01, 0.01, 0.85, 0.10, 0.05};
a0b94e5c 5714
2eedd4ed 5715 //Bayes' formula
5716 double rcc = 0.;
5717 for (int i = 0; i < 5; i++){
5718 rcc+=(c[i] * wpart[i]);
5719 }
a0b94e5c 5720
a0b94e5c 5721
5722
2eedd4ed 5723 for (int i=0; i<5; i++) {
5724 if( rcc>0 || rcc<0){//Kenneth: not sure if the rcc<0 should be there, this is from fixing a coding violation where we are not allowed to say: rcc!=0 (RC19)
5725 wpartbayes[i] = c[i] * wpart[i] / rcc;
5726 }
5727 }
a0b94e5c 5728
2eedd4ed 5729 Float_t max=0.;
5730 int ipid=-1;
5731 //find most probable particle in ESD pid
5732 //0:Electron - 1:Muon - 2:Pion - 3:Kaon - 4:Proton
5733 for (int i = 0; i < 5; i++){
5734 if (wpartbayes[i] > max){
5735 ipid = i;
5736 max = wpartbayes[i];
5737 }
5738 }
a0b94e5c 5739
2eedd4ed 5740 pid = ipid;
5741 weight = max;
d7d7e825 5742}
2eedd4ed 5743
77ac6f3e 5744double AliAnalysisTaskGammaConversion::GetSigmaToVertex(const AliESDtrack* t)
d7d7e825 5745{
2eedd4ed 5746 // Calculates the number of sigma to the vertex.
5747
5748 Float_t b[2];
5749 Float_t bRes[2];
5750 Float_t bCov[3];
5751 t->GetImpactParameters(b,bCov);
5752 if (bCov[0]<=0 || bCov[2]<=0) {
5753 AliDebug(1, "Estimated b resolution lower or equal zero!");
5754 bCov[0]=0; bCov[2]=0;
5755 }
5756 bRes[0] = TMath::Sqrt(bCov[0]);
5757 bRes[1] = TMath::Sqrt(bCov[2]);
5758
5759 // -----------------------------------
5760 // How to get to a n-sigma cut?
5761 //
5762 // The accumulated statistics from 0 to d is
5763 //
5764 // -> Erf(d/Sqrt(2)) for a 1-dim gauss (d = n_sigma)
5765 // -> 1 - Exp(-d**2) for a 2-dim gauss (d*d = dx*dx + dy*dy != n_sigma)
5766 //
5767 // It means that for a 2-dim gauss: n_sigma(d) = Sqrt(2)*ErfInv(1 - Exp((-x**2)/2)
5768 // Can this be expressed in a different way?
5769
5770 if (bRes[0] == 0 || bRes[1] ==0)
5771 return -1;
5772
5773 double d = TMath::Sqrt(TMath::Power(b[0]/bRes[0],2) + TMath::Power(b[1]/bRes[1],2));
5774
5775 // stupid rounding problem screws up everything:
5776 // if d is too big, TMath::Exp(...) gets 0, and TMath::ErfInverse(1) that should be infinite, gets 0 :(
5777 if (TMath::Exp(-d * d / 2) < 1e-10)
5778 return 1000;
5779
5780
5781 d = TMath::ErfInverse(1 - TMath::Exp(-d * d / 2)) * TMath::Sqrt(2);
5782 return d;
d7d7e825 5783}
6c84d371 5784
5785//vector <TLorentzVector> AliAnalysisTaskGammaConversion::GetTLorentzVector(vector <AliESDtrack*> esdTrack){
5786TClonesArray AliAnalysisTaskGammaConversion::GetTLorentzVector(TClonesArray *const esdTrack){
2eedd4ed 5787 //Return TLoresntz vector of track?
5788 // vector <TLorentzVector> tlVtrack(0);
5789 TClonesArray array("TLorentzVector",0);
5790
5791 for(Int_t itrack=0; itrack < esdTrack->GetEntriesFast(); itrack++){
5792 double p[3];
5793 //esdTrack[itrack]->GetConstrainedPxPyPz(p);
5794 ((AliESDtrack*)(esdTrack->At(itrack)))->GetConstrainedPxPyPz(p);
5795 TLorentzVector currentTrack;
5796 currentTrack.SetXYZM(p[0],p[1],p[2],fElectronMass);
5797 new((array)[array.GetEntriesFast()]) TLorentzVector(currentTrack);
5798 // tlVtrack.push_back(currentTrack);
5799 }
5800
5801 return array;
5802
5803 // return tlVtrack;
d7d7e825 5804}
77ac6f3e 5805Int_t AliAnalysisTaskGammaConversion::GetProcessType(const AliMCEvent * mcEvt) {
3c45d101 5806
2eedd4ed 5807 // Determine if the event was generated with pythia or phojet and return the process type
5808
5809 // Check if mcEvt is fine
5810 if (!mcEvt) { // coverty does not allow this, the check is done elsewhere
5811 AliFatal("NULL mc event");
5812 return -1;
5813 }
5814
5815 // Determine if it was a pythia or phojet header, and return the correct process type
5816 AliGenPythiaEventHeader * headPy = 0;
5817 AliGenDPMjetEventHeader * headPho = 0;
5818 AliGenEventHeader * htmp = mcEvt->GenEventHeader();
5819 if(!htmp) {
5820 AliFatal("Cannot Get MC Header!!");
5821 return -1;
5822 }
5823 if( TString(htmp->IsA()->GetName()) == "AliGenPythiaEventHeader") {
5824 headPy = (AliGenPythiaEventHeader*) htmp;
5825 } else if (TString(htmp->IsA()->GetName()) == "AliGenDPMjetEventHeader") {
5826 headPho = (AliGenDPMjetEventHeader*) htmp;
5827 } else {
5828 AliError("Unknown header");
5829 }
6746e1e1 5830
2eedd4ed 5831 // Determine process type
5832 if(headPy) {
5833 if(headPy->ProcessType() == 92 || headPy->ProcessType() == 93) {
5834 // single difractive
5835 return kProcSD;
5836 } else if (headPy->ProcessType() == 94) {
5837 // double diffractive
5838 return kProcDD;
5839 }
5840 else if(headPy->ProcessType() != 92 && headPy->ProcessType() != 93 && headPy->ProcessType() != 94) {
5841 // non difractive
5842 return kProcND;
5843 }
5844 } else if (headPho) {
5845 if(headPho->ProcessType() == 5 || headPho->ProcessType() == 6 ) {
5846 // single difractive
5847 return kProcSD;
5848 } else if (headPho->ProcessType() == 7) {
5849 // double diffractive
5850 return kProcDD;
5851 } else if(headPho->ProcessType() != 5 && headPho->ProcessType() != 6 && headPho->ProcessType() != 7 ) {
5852 // non difractive
5853 return kProcND;
5854 }
5855 }
5856
6746e1e1 5857
2eedd4ed 5858 // no process type found?
5859 AliError(Form("Unknown header: %s", htmp->IsA()->GetName()));
5860 return kProcUnknown;
5861}
6746e1e1 5862
6746e1e1 5863
2eedd4ed 5864Int_t AliAnalysisTaskGammaConversion::CalculateMultiplicityBin(){
5865 // Get Centrality bin
6746e1e1 5866
2eedd4ed 5867 Int_t multiplicity = 0;
6746e1e1 5868
2eedd4ed 5869 if ( fUseMultiplicity == 1 ) {
cc5a88a2 5870
2eedd4ed 5871 if (fMultiplicity>= 0 && fMultiplicity<= 5) multiplicity=1;
5872 if (fMultiplicity>= 6 && fMultiplicity<= 9) multiplicity=2;
5873 if (fMultiplicity>=10 && fMultiplicity<=14) multiplicity=3;
5874 if (fMultiplicity>=15 && fMultiplicity<=22) multiplicity=4;
5875 if (fMultiplicity>=23 ) multiplicity=5;
cc5a88a2 5876
2eedd4ed 5877 }
cc5a88a2 5878
2eedd4ed 5879 if ( fUseHBTMultiplicity == 1 ) {
5880
5881 if (fMultiplicity>= 0 && fMultiplicity<=11) multiplicity=1;
5882 if (fMultiplicity>=12 && fMultiplicity<=16) multiplicity=2;
5883 if (fMultiplicity>=17 && fMultiplicity<=22) multiplicity=3;
5884 if (fMultiplicity>=23 && fMultiplicity<=29) multiplicity=4;
5885 if (fMultiplicity>=30 && fMultiplicity<=36) multiplicity=5;
5886 if (fMultiplicity>=37 && fMultiplicity<=44) multiplicity=6;
5887 if (fMultiplicity>=45 && fMultiplicity<=57) multiplicity=7;
5888 if (fMultiplicity>=58 && fMultiplicity<=149) multiplicity=8;
5889
5890 /*
5891 if (fMultiplicity>= 0 && fMultiplicity<=5) multiplicity=1;
5892 if (fMultiplicity>=6 && fMultiplicity<=11) multiplicity=2;
5893 if (fMultiplicity>=12 && fMultiplicity<=16) multiplicity=3;
5894 if (fMultiplicity>=17 && fMultiplicity<=22) multiplicity=4;
5895 if (fMultiplicity>=23 ) multiplicity=5;
5896 */
cc5a88a2 5897
2eedd4ed 5898 }
cc5a88a2 5899
2eedd4ed 5900 return multiplicity;
6746e1e1 5901}