1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 ////////////////////////////////////////////////
17 //---------------------------------------------
18 // Class used to do analysis on conversion pairs
19 //---------------------------------------------
20 ////////////////////////////////////////////////
22 // --- ROOT system ---
25 //---- ANALYSIS system ----
26 #include "AliV0Reader.h"
27 #include "AliAnalysisManager.h"
28 #include "AliESDInputHandler.h"
30 #include "AliESDtrack.h"
31 #include "AliMCEvent.h"
32 #include "AliKFVertex.h"
35 #include "AliMCEventHandler.h"
36 #include "AliESDpid.h"
37 #include "AliGammaConversionBGHandler.h"
38 #include "AliESDtrackCuts.h"
50 AliESDpid* AliV0Reader::fgESDpid = 0x0;
52 AliV0Reader::AliV0Reader() :
56 fMCEvent(NULL), // for CF
63 fCurrentV0IndexNumber(0),
65 fCurrentNegativeKFParticle(NULL),
66 fCurrentPositiveKFParticle(NULL),
67 fCurrentMotherKFCandidate(NULL),
68 fCurrentNegativeESDTrack(NULL),
69 fCurrentPositiveESDTrack(NULL),
70 fNegativeTrackLorentzVector(NULL),
71 fPositiveTrackLorentzVector(NULL),
72 fMotherCandidateLorentzVector(NULL),
78 fNegativeMCParticle(NULL),
79 fPositiveMCParticle(NULL),
80 fMotherMCParticle(NULL),
81 fMotherCandidateKFMass(0),
82 fMotherCandidateKFWidth(0),
83 fUseKFParticle(kTRUE),
86 fMaxVertexZ(100.),// 100 cm(from the 0)
87 fMaxR(10000),// 100 meter(outside of ALICE)
88 fMinR(0),// 100 meter(outside of ALICE)
90 fRapidityMesonCut(0.),
98 fChi2CutConversion(0.),
101 fAlphaMinCutMeson(0.),
102 fPIDProbabilityCutNegativeParticle(0),
103 fPIDProbabilityCutPositiveParticle(0),
104 fDodEdxSigmaCut(kFALSE),
105 fPIDnSigmaAboveElectronLine(100),
106 fPIDnSigmaBelowElectronLine(-100),
107 fPIDnSigmaAbovePionLine(-100),
108 fPIDMinPnSigmaAbovePionLine(100),
109 fPIDMaxPnSigmaAbovePionLine(100),
110 fDoKaonRejectionLowP(kFALSE),
111 fDoProtonRejectionLowP(kFALSE),
112 fDoPionRejectionLowP(kFALSE),
113 fPIDnSigmaAtLowPAroundKaonLine(0),
114 fPIDnSigmaAtLowPAroundProtonLine(0),
115 fPIDnSigmaAtLowPAroundPionLine(0),
116 fPIDMinPKaonRejectionLowP(0),
117 fPIDMinPProtonRejectionLowP(0),
118 fPIDMinPPionRejectionLowP(0),
119 fDoQtGammaSelection(kFALSE),
125 fUseImprovedVertex(kFALSE),
126 fUseOwnXYZCalculation(kFALSE),
127 fUseConstructGamma(kFALSE),
129 fUseOnFlyV0Finder(kTRUE),
130 fUpdateV0AlreadyCalled(kFALSE),
131 fCurrentEventGoodV0s(NULL),
134 // fPreviousEventGoodV0s(),
135 fCalculateBackground(kFALSE),
136 fBGEventHandler(NULL),
137 fBGEventInitialized(kFALSE),
139 fNumberOfESDTracks(0),
140 nEventsForBGCalculation(20),
141 fUseChargedTrackMultiplicityForBG(kTRUE),
144 //fESDpid = new AliESDpid;
148 AliV0Reader::AliV0Reader(const AliV0Reader & original) :
150 fMCStack(original.fMCStack),
151 // fMCTruth(original.fMCTruth),
152 fMCEvent(original.fMCEvent), // for CF
153 fChain(original.fChain),
154 // fESDHandler(original.fESDHandler),
155 fESDEvent(original.fESDEvent),
156 fCFManager(original.fCFManager),
157 // fESDpid(original.fESDpid),
158 fHistograms(original.fHistograms),
159 fCurrentV0IndexNumber(original.fCurrentV0IndexNumber),
160 fCurrentV0(original.fCurrentV0),
161 fCurrentNegativeKFParticle(original.fCurrentNegativeKFParticle),
162 fCurrentPositiveKFParticle(original.fCurrentPositiveKFParticle),
163 fCurrentMotherKFCandidate(original.fCurrentMotherKFCandidate),
164 fCurrentNegativeESDTrack(original.fCurrentNegativeESDTrack),
165 fCurrentPositiveESDTrack(original.fCurrentPositiveESDTrack),
166 fNegativeTrackLorentzVector(original.fNegativeTrackLorentzVector),
167 fPositiveTrackLorentzVector(original.fPositiveTrackLorentzVector),
168 fMotherCandidateLorentzVector(original.fMotherCandidateLorentzVector),
169 fCurrentXValue(original.fCurrentXValue),
170 fCurrentYValue(original.fCurrentYValue),
171 fCurrentZValue(original.fCurrentZValue),
172 fPositiveTrackPID(original.fPositiveTrackPID),
173 fNegativeTrackPID(original.fNegativeTrackPID),
174 fNegativeMCParticle(original.fNegativeMCParticle),
175 fPositiveMCParticle(original.fPositiveMCParticle),
176 fMotherMCParticle(original.fMotherMCParticle),
177 fMotherCandidateKFMass(original.fMotherCandidateKFMass),
178 fMotherCandidateKFWidth(original.fMotherCandidateKFWidth),
179 fUseKFParticle(kTRUE),
180 fUseESDTrack(kFALSE),
182 fMaxVertexZ(original.fMaxVertexZ),
183 fMaxR(original.fMaxR),
184 fMinR(original.fMinR),
185 fEtaCut(original.fEtaCut),
186 fRapidityMesonCut(original.fRapidityMesonCut),
187 fPtCut(original.fPtCut),
188 fSinglePtCut(original.fSinglePtCut),
189 fMaxZ(original.fMaxZ),
190 fMinClsTPC(original.fMinClsTPC),
191 fMinClsTPCToF(original.fMinClsTPCToF),
192 fLineCutZRSlope(original.fLineCutZRSlope),
193 fLineCutZValue(original.fLineCutZValue),
194 fChi2CutConversion(original.fChi2CutConversion),
195 fChi2CutMeson(original.fChi2CutMeson),
196 fAlphaCutMeson(original.fAlphaCutMeson),
197 fAlphaMinCutMeson(original.fAlphaMinCutMeson),
198 fPIDProbabilityCutNegativeParticle(original.fPIDProbabilityCutNegativeParticle),
199 fPIDProbabilityCutPositiveParticle(original.fPIDProbabilityCutPositiveParticle),
200 fDodEdxSigmaCut(original.fDodEdxSigmaCut),
201 fPIDnSigmaAboveElectronLine(original.fPIDnSigmaAboveElectronLine),
202 fPIDnSigmaBelowElectronLine(original.fPIDnSigmaBelowElectronLine),
203 fPIDnSigmaAbovePionLine(original.fPIDnSigmaAbovePionLine),
204 fPIDMinPnSigmaAbovePionLine(original.fPIDMinPnSigmaAbovePionLine),
205 fPIDMaxPnSigmaAbovePionLine(original.fPIDMaxPnSigmaAbovePionLine),
206 fDoKaonRejectionLowP(original.fDoKaonRejectionLowP),
207 fDoProtonRejectionLowP(original.fDoProtonRejectionLowP),
208 fDoPionRejectionLowP(original.fDoPionRejectionLowP),
209 fPIDnSigmaAtLowPAroundKaonLine(original.fPIDnSigmaAtLowPAroundKaonLine),
210 fPIDnSigmaAtLowPAroundProtonLine(original.fPIDnSigmaAtLowPAroundProtonLine),
211 fPIDnSigmaAtLowPAroundPionLine(original.fPIDnSigmaAtLowPAroundPionLine),
212 fPIDMinPKaonRejectionLowP(original.fPIDMinPKaonRejectionLowP),
213 fPIDMinPProtonRejectionLowP(original.fPIDMinPProtonRejectionLowP),
214 fPIDMinPPionRejectionLowP(original.fPIDMinPPionRejectionLowP),
215 fDoQtGammaSelection(original.fDoQtGammaSelection),
216 fQtMax(original.fQtMax),
217 fXVertexCut(original.fXVertexCut),
218 fYVertexCut(original.fYVertexCut),
219 fZVertexCut(original.fZVertexCut),
220 fNSigmaMass(original.fNSigmaMass),
221 fUseImprovedVertex(original.fUseImprovedVertex),
222 fUseOwnXYZCalculation(original.fUseOwnXYZCalculation),
223 fUseConstructGamma(original.fUseConstructGamma),
224 fDoCF(original.fDoCF),
225 fUseOnFlyV0Finder(original.fUseOnFlyV0Finder),
226 fUpdateV0AlreadyCalled(original.fUpdateV0AlreadyCalled),
227 fCurrentEventGoodV0s(original.fCurrentEventGoodV0s),
228 fV0Pindex(original.fV0Pindex),
229 fV0Nindex(original.fV0Nindex),
230 // fPreviousEventGoodV0s(original.fPreviousEventGoodV0s),
231 fCalculateBackground(original.fCalculateBackground),
232 fBGEventHandler(original.fBGEventHandler),
233 fBGEventInitialized(original.fBGEventInitialized),
234 fEsdTrackCuts(original.fEsdTrackCuts),
235 fNumberOfESDTracks(original.fNumberOfESDTracks),
236 nEventsForBGCalculation(original.nEventsForBGCalculation),
237 fUseChargedTrackMultiplicityForBG(original.fUseChargedTrackMultiplicityForBG),
238 fNumberOfGoodV0s(original.fNumberOfGoodV0s)
244 AliV0Reader & AliV0Reader::operator = (const AliV0Reader & /*source*/)
246 // assignment operator
249 AliV0Reader::~AliV0Reader()
256 //____________________________________________________________________________
257 void AliV0Reader::SetInputAndMCEvent(AliVEvent* esd, AliMCEvent* mc) {
258 // Connect the data pointers
266 void AliV0Reader::Initialize(){
267 //see header file for documentation
269 fUpdateV0AlreadyCalled = kFALSE;
272 // Get the input handler from the manager
273 fESDHandler = (AliESDInputHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
274 if(fESDHandler == NULL){
278 // Get pointer to esd event from input handler
279 fESDEvent = fESDHandler->GetEvent();
280 if(fESDEvent == NULL){
284 //Get pointer to MCTruth
285 fMCTruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
290 // fMCTruth = mcH->MCEvent();
291 // fMC = mcH->MCEvent();
292 // stack = fMC->Stack();
295 //if(fMCTruth == NULL){
300 if(fMCEvent == NULL){
304 //Get pointer to the mc stack
307 fMCStack = fMCEvent->Stack();
308 if(fMCStack == NULL){
311 // Better parameters for MonteCarlo from A. Kalweit 2010/01/8
312 // fESDpid->GetTPCResponse().SetBetheBlochParameters( 2.15898e+00/50.,
319 // Better parameters for data from A. Kalweit 2010/01/8
320 // fESDpid->GetTPCResponse().SetBetheBlochParameters(0.0283086,
328 //Get pointer to the mc event
330 //fMCEvent = fMCTruth->MCEvent();
331 if(fMCEvent == NULL){
337 AliKFParticle::SetField(fESDEvent->GetMagneticField());
339 // fCurrentEventGoodV0s = new TClonesArray("TClonesArray", 0);
340 if(fCurrentEventGoodV0s == NULL){
341 fCurrentEventGoodV0s = new TClonesArray("AliKFParticle", 0);
347 if(fCalculateBackground == kTRUE){
348 if(fBGEventInitialized == kFALSE){
351 Double_t *zBinLimitsArray = new Double_t[9];
352 zBinLimitsArray[0] = -50.00;
353 zBinLimitsArray[1] = -3.375;
354 zBinLimitsArray[2] = -1.605;
355 zBinLimitsArray[3] = -0.225;
356 zBinLimitsArray[4] = 1.065;
357 zBinLimitsArray[5] = 2.445;
358 zBinLimitsArray[6] = 4.245;
359 zBinLimitsArray[7] = 50.00;
360 zBinLimitsArray[8] = 1000.00;
362 Double_t *multiplicityBinLimitsArray= new Double_t[6];
363 if(fUseChargedTrackMultiplicityForBG == kTRUE){
364 multiplicityBinLimitsArray[0] = 0;
365 multiplicityBinLimitsArray[1] = 8.5;
366 multiplicityBinLimitsArray[2] = 16.5;
367 multiplicityBinLimitsArray[3] = 27.5;
368 multiplicityBinLimitsArray[4] = 41.5;
369 multiplicityBinLimitsArray[5] = 100.;
371 fBGEventHandler = new AliGammaConversionBGHandler(9,6,nEventsForBGCalculation);
374 multiplicityBinLimitsArray[0] = 2;
375 multiplicityBinLimitsArray[1] = 3;
376 multiplicityBinLimitsArray[2] = 4;
377 multiplicityBinLimitsArray[3] = 5;
378 multiplicityBinLimitsArray[4] = 9999;
380 fBGEventHandler = new AliGammaConversionBGHandler(9,5,nEventsForBGCalculation);
386 // ---------------------------------
387 Double_t *zBinLimitsArray = new Double_t[1];
388 zBinLimitsArray[0] = 999999.00;
390 Double_t *multiplicityBinLimitsArray= new Double_t[1];
391 multiplicityBinLimitsArray[0] = 99999999.00;
392 fBGEventHandler = new AliGammaConversionBGHandler(1,1,10);
393 // ---------------------------------
395 fBGEventHandler->Initialize(zBinLimitsArray, multiplicityBinLimitsArray);
396 fBGEventInitialized = kTRUE;
401 AliESDv0* AliV0Reader::GetV0(Int_t index){
402 //see header file for documentation
403 fCurrentV0 = fESDEvent->GetV0(index);
404 UpdateV0Information();
408 Int_t AliV0Reader::GetNumberOfContributorsVtx(){
409 if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()>0) {
410 return fESDEvent->GetPrimaryVertexTracks()->GetNContributors();
413 if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()<1) {
414 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
415 return fESDEvent->GetPrimaryVertexSPD()->GetNContributors();
418 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()<1) {
419 cout<<"number of contributors from bad vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
425 Bool_t AliV0Reader::CheckForPrimaryVertex(){
426 //see headerfile for documentation
428 if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()>0) {
432 if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()<1) {
434 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
435 //cout<<"spd vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
439 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()<1) {
440 // cout<<"bad vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
445 // return fESDEvent->GetPrimaryVertex()->GetNContributors()>0;
448 Bool_t AliV0Reader::CheckForPrimaryVertexZ(){
449 //see headerfile for documentation
451 if(TMath::Abs(fESDEvent->GetPrimaryVertex()->GetZ())<GetMaxVertexZ()){
459 Bool_t AliV0Reader::CheckV0FinderStatus(Int_t index){
460 // see headerfile for documentation
461 if(fUseOnFlyV0Finder){
462 if(!GetV0(index)->GetOnFlyStatus()){
466 if(!fUseOnFlyV0Finder){
467 if(GetV0(index)->GetOnFlyStatus()){
476 Bool_t AliV0Reader::NextV0(){
477 //see header file for documentation
479 Bool_t iResult=kFALSE;
480 while(fCurrentV0IndexNumber<fESDEvent->GetNumberOfV0s()){
481 fCurrentV0 = fESDEvent->GetV0(fCurrentV0IndexNumber);
483 fUpdateV0AlreadyCalled=kFALSE;
485 if(fHistograms != NULL){
486 fHistograms->FillHistogram("ESD_AllV0s_InvMass",GetMotherCandidateMass());
489 // moved it up here so that the correction framework can access pt and eta information
490 if(UpdateV0Information() == kFALSE){
491 fCurrentV0IndexNumber++;
495 Double_t containerInput[3];
497 containerInput[0] = GetMotherCandidatePt();
498 containerInput[1] = GetMotherCandidateEta();
499 containerInput[2] = GetMotherCandidateMass();
503 containerInput[0] = GetMotherCandidatePt();
504 containerInput[1] = GetMotherCandidateEta();
505 containerInput[2] = GetMotherCandidateMass();
507 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF
508 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF
509 fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF
513 //checks if on the fly mode is set
514 if ( !CheckV0FinderStatus(fCurrentV0IndexNumber) ){
515 if(fHistograms != NULL){
516 fHistograms->FillHistogram("ESD_CutGetOnFly_InvMass",GetMotherCandidateMass());
518 fCurrentV0IndexNumber++;
522 fCFManager->GetParticleContainer()->Fill(containerInput,kStepGetOnFly); // for CF
525 if(fHistograms != NULL){
526 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_InvMass",GetMotherCandidateMass());
529 Double_t armenterosQtAlfa[2];
530 GetArmenterosQtAlfa(GetNegativeKFParticle(),
531 GetPositiveKFParticle(),
532 GetMotherCandidateKFCombination(),
535 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_alfa_qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
538 if(fCurrentNegativeESDTrack->GetSign() == fCurrentPositiveESDTrack->GetSign()){ // avoid like sign
540 if(fHistograms != NULL ){
541 fHistograms->FillHistogram("ESD_CutLikeSign_InvMass",GetMotherCandidateMass());
542 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
543 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
544 // fUpdateV0AlreadyCalled = kTRUE;
546 fCurrentV0IndexNumber++;
550 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF
554 if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ||
555 !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ){
556 // if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kITSrefit) ||
557 // !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kITSrefit) ){
559 if(fHistograms != NULL){
560 fHistograms->FillHistogram("ESD_CutRefit_InvMass",GetMotherCandidateMass());
561 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
562 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
563 //fUpdateV0AlreadyCalled = kTRUE;
565 fCurrentV0IndexNumber++;
569 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF
574 if( fCurrentNegativeESDTrack->GetKinkIndex(0) > 0 ||
575 fCurrentPositiveESDTrack->GetKinkIndex(0) > 0) {
577 if(fHistograms != NULL ){
578 fHistograms->FillHistogram("ESD_CutKink_InvMass",GetMotherCandidateMass());
579 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
580 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
581 //fUpdateV0AlreadyCalled = kTRUE;
583 fCurrentV0IndexNumber++;
588 fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF
591 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_goodtracks_alfa_qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
593 if(fDodEdxSigmaCut == kTRUE){
594 if( fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
595 fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ||
596 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
597 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ){
599 if(fHistograms != NULL ){
600 fHistograms->FillHistogram("ESD_CutdEdxSigmaElectronLine_InvMass",GetMotherCandidateMass());
601 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
602 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
603 //fUpdateV0AlreadyCalled = kTRUE;
605 fCurrentV0IndexNumber++;
609 fCFManager->GetParticleContainer()->Fill(containerInput,kStepdEdx_electronselection); // for CF
612 if( fCurrentPositiveESDTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentPositiveESDTrack->P()<fPIDMaxPnSigmaAbovePionLine ){
613 if(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
614 fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
615 fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
617 if(fHistograms != NULL){
618 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
619 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
620 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
621 //fUpdateV0AlreadyCalled = kTRUE;
623 fCurrentV0IndexNumber++;
628 if( fCurrentNegativeESDTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentNegativeESDTrack->P()<fPIDMaxPnSigmaAbovePionLine){
629 if(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
630 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
631 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
633 if(fHistograms != NULL){
634 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
635 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
636 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
637 //fUpdateV0AlreadyCalled = kTRUE;
639 fCurrentV0IndexNumber++;
644 fCFManager->GetParticleContainer()->Fill(containerInput,kStepdEdx_pionrejection); // for CF
649 if(fDoKaonRejectionLowP == kTRUE){
650 if( fCurrentNegativeESDTrack->P()<fPIDMinPKaonRejectionLowP ){
651 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
652 if(fHistograms != NULL){
653 fHistograms->FillHistogram("ESD_CutKaonRejectionLowP_InvMass",GetMotherCandidateMass());
654 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
655 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
656 //fUpdateV0AlreadyCalled = kTRUE;
658 fCurrentV0IndexNumber++;
662 if( fCurrentPositiveESDTrack->P()<fPIDMinPKaonRejectionLowP ){
663 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
664 if(fHistograms != NULL){
665 fHistograms->FillHistogram("ESD_CutKaonRejectionLowP_InvMass",GetMotherCandidateMass());
666 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
667 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
668 //fUpdateV0AlreadyCalled = kTRUE;
670 fCurrentV0IndexNumber++;
676 if(fDoProtonRejectionLowP == kTRUE){
677 if( fCurrentNegativeESDTrack->P()<fPIDMinPProtonRejectionLowP){
678 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
679 if(fHistograms != NULL){
680 fHistograms->FillHistogram("ESD_CutProtonRejectionLowP_InvMass",GetMotherCandidateMass());
681 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
682 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
683 //fUpdateV0AlreadyCalled = kTRUE;
685 fCurrentV0IndexNumber++;
689 if( fCurrentPositiveESDTrack->P()<fPIDMinPProtonRejectionLowP ){
690 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
691 if(fHistograms != NULL){
692 fHistograms->FillHistogram("ESD_CutProtonRejectionLowP_InvMass",GetMotherCandidateMass());
693 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
694 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
695 //fUpdateV0AlreadyCalled = kTRUE;
697 fCurrentV0IndexNumber++;
704 if(fDoPionRejectionLowP == kTRUE){
705 if( fCurrentNegativeESDTrack->P()<fPIDMinPPionRejectionLowP ){
706 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
707 if(fHistograms != NULL){
708 fHistograms->FillHistogram("ESD_CutPionRejectionLowP_InvMass",GetMotherCandidateMass());
709 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
710 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
711 //fUpdateV0AlreadyCalled = kTRUE;
713 fCurrentV0IndexNumber++;
717 if( fCurrentPositiveESDTrack->P()<fPIDMinPPionRejectionLowP ){
718 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
719 if(fHistograms != NULL){
720 fHistograms->FillHistogram("ESD_CutPionRejectionLowP_InvMass",GetMotherCandidateMass());
721 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
722 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
723 //fUpdateV0AlreadyCalled = kTRUE;
725 fCurrentV0IndexNumber++;
732 // Gamma selection based on QT from Armenteros
733 if(fDoQtGammaSelection == kTRUE){
734 if(armenterosQtAlfa[0]>fQtMax){
735 if(fHistograms != NULL){
736 fHistograms->FillHistogram("ESD_CutQt_InvMass",GetMotherCandidateMass());
738 fCurrentV0IndexNumber++;
743 //checks if we have a prim vertex
744 //if(fESDEvent->GetPrimaryVertex()->GetNContributors()<=0) {
745 if(GetNumberOfContributorsVtx()<=0) {
746 if(fHistograms != NULL){
747 fHistograms->FillHistogram("ESD_CutNContributors_InvMass",GetMotherCandidateMass());
749 fCurrentV0IndexNumber++;
753 fCFManager->GetParticleContainer()->Fill(containerInput,kStepNContributors); // for CF
756 //Check the pid probability
757 if(CheckPIDProbability(fPIDProbabilityCutNegativeParticle,fPIDProbabilityCutPositiveParticle)==kFALSE){
758 if(fHistograms != NULL){
759 fHistograms->FillHistogram("ESD_CutPIDProb_InvMass",GetMotherCandidateMass());
761 fCurrentV0IndexNumber++;
765 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCPID); // for CF
768 if(GetXYRadius()>fMaxR){ // cuts on distance from collision point
769 if(fHistograms != NULL){
770 fHistograms->FillHistogram("ESD_CutR_InvMass",GetMotherCandidateMass());
772 fCurrentV0IndexNumber++;
776 fCFManager->GetParticleContainer()->Fill(containerInput,kStepR); // for CF
778 if(GetXYRadius()<fMinR){ // cuts on distance from collision point
779 if(fHistograms != NULL){
780 fHistograms->FillHistogram("ESD_CutMinR_InvMass",GetMotherCandidateMass());
782 fCurrentV0IndexNumber++;
788 if((TMath::Abs(fCurrentZValue)*fLineCutZRSlope)-fLineCutZValue > GetXYRadius() ){ // cuts out regions where we do not reconstruct
789 if(fHistograms != NULL){
790 fHistograms->FillHistogram("ESD_CutLine_InvMass",GetMotherCandidateMass());
792 fCurrentV0IndexNumber++;
796 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLine); // for CF
799 if(TMath::Abs(fCurrentZValue) > fMaxZ ){ // cuts out regions where we do not reconstruct
800 if(fHistograms != NULL){
801 fHistograms->FillHistogram("ESD_CutZ_InvMass",GetMotherCandidateMass());
803 fCurrentV0IndexNumber++;
807 fCFManager->GetParticleContainer()->Fill(containerInput,kStepZ); // for CF
810 /* Moved further up so corr framework can work
811 if(UpdateV0Information() == kFALSE){
812 fCurrentV0IndexNumber++;
816 if(fCurrentNegativeESDTrack->GetNcls(1) < fMinClsTPC || fCurrentPositiveESDTrack->GetNcls(1) < fMinClsTPC ){
817 if(fHistograms != NULL){
818 fHistograms->FillHistogram("ESD_CutMinNClsTPC_InvMass",GetMotherCandidateMass());
820 fCurrentV0IndexNumber++;
824 fCFManager->GetParticleContainer()->Fill(containerInput,kStepMinClsTPC); // for CF
826 Double_t NegclsToF = 0.;
827 if(fCurrentNegativeESDTrack->GetTPCNclsF()!=0 ){
828 NegclsToF = (Double_t)fCurrentNegativeESDTrack->GetNcls(1)/(Double_t)fCurrentNegativeESDTrack->GetTPCNclsF();
831 Double_t PosclsToF = 0.;
832 if(fCurrentPositiveESDTrack->GetTPCNclsF()!=0 ){
833 PosclsToF = (Double_t)fCurrentPositiveESDTrack->GetNcls(1)/(Double_t)fCurrentPositiveESDTrack->GetTPCNclsF();
836 if( NegclsToF < fMinClsTPCToF || PosclsToF < fMinClsTPCToF ){
837 if(fHistograms != NULL){
838 fHistograms->FillHistogram("ESD_CutMinNClsTPCToF_InvMass",GetMotherCandidateMass());
840 fCurrentV0IndexNumber++;
850 if( fCurrentNegativeKFParticle->GetPt()< fSinglePtCut || fCurrentPositiveKFParticle->GetPt()< fSinglePtCut){
851 if(fHistograms != NULL){
852 fHistograms->FillHistogram("ESD_CutSinglePt_InvMass",GetMotherCandidateMass());
854 fCurrentV0IndexNumber++;
858 fCFManager->GetParticleContainer()->Fill(containerInput,kStepSinglePt); // for CF
862 if(fCurrentMotherKFCandidate->GetNDF()<=0){
863 if(fHistograms != NULL){
864 fHistograms->FillHistogram("ESD_CutNDF_InvMass",GetMotherCandidateMass());
866 fCurrentV0IndexNumber++;
870 fCFManager->GetParticleContainer()->Fill(containerInput,kStepNDF); // for CF
873 Double_t chi2V0 = fCurrentMotherKFCandidate->GetChi2()/fCurrentMotherKFCandidate->GetNDF();
874 if(chi2V0 > fChi2CutConversion || chi2V0 <=0){
875 if(fHistograms != NULL){
876 fHistograms->FillHistogram("ESD_CutChi2_InvMass",GetMotherCandidateMass());
878 fCurrentV0IndexNumber++;
882 fCFManager->GetParticleContainer()->Fill(containerInput,kStepChi2); // for CF
885 if(TMath::Abs(fMotherCandidateLorentzVector->Eta())> fEtaCut){
886 if(fHistograms != NULL){
887 fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
889 fCurrentV0IndexNumber++;
893 if(TMath::Abs(fCurrentNegativeKFParticle->GetEta())> fEtaCut){
894 if(fHistograms != NULL){
895 fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
897 fCurrentV0IndexNumber++;
901 if(TMath::Abs(fCurrentPositiveKFParticle->GetEta())> fEtaCut){
902 if(fHistograms != NULL){
903 fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
905 fCurrentV0IndexNumber++;
910 fCFManager->GetParticleContainer()->Fill(containerInput,kStepEta); // for CF
913 if(fMotherCandidateLorentzVector->Pt()<fPtCut){
914 if(fHistograms != NULL){
915 fHistograms->FillHistogram("ESD_CutPt_InvMass",GetMotherCandidateMass());
917 fCurrentV0IndexNumber++;
921 fCFManager->GetParticleContainer()->Fill(containerInput,kStepPt); // for CF
925 else if(fUseESDTrack){
929 if(fHistograms != NULL){
930 fHistograms->FillHistogram("ESD_GoodV0s_InvMass",GetMotherCandidateMass());
933 // fCurrentEventGoodV0s.push_back(*fCurrentMotherKFCandidate);
935 new((*fCurrentEventGoodV0s)[fCurrentEventGoodV0s->GetEntriesFast()]) AliKFParticle(*fCurrentMotherKFCandidate);
936 fV0Pindex.push_back(fCurrentV0->GetPindex());
937 fV0Nindex.push_back(fCurrentV0->GetNindex());
939 iResult=kTRUE;//means we have a v0 who survived all the cuts applied
943 fCurrentV0IndexNumber++;
950 Bool_t AliV0Reader::UpdateV0Information(){
951 //see header file for documentation
953 Bool_t iResult=kTRUE; // for taking out not refitted, kinks and like sign tracks
955 Bool_t switchTracks = kFALSE;
957 fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
958 fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
960 if(fCurrentPositiveESDTrack->GetSign() == -1 && fCurrentNegativeESDTrack->GetSign() == 1){ // switch wrong signed tracks
961 fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
962 fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
963 switchTracks = kTRUE;
966 if(fCurrentNegativeKFParticle != NULL){
967 delete fCurrentNegativeKFParticle;
969 if(switchTracks == kFALSE){
970 fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fNegativeTrackPID);
973 fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fNegativeTrackPID);
976 if(fCurrentPositiveKFParticle != NULL){
977 delete fCurrentPositiveKFParticle;
979 if(switchTracks == kFALSE){
980 fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fPositiveTrackPID);
983 fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fPositiveTrackPID);
986 if(fCurrentMotherKFCandidate != NULL){
987 delete fCurrentMotherKFCandidate;
990 if(fUseConstructGamma==kTRUE){
991 fCurrentMotherKFCandidate = new AliKFParticle;//(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
992 fCurrentMotherKFCandidate->ConstructGamma(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
994 fCurrentMotherKFCandidate = new AliKFParticle(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
995 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
996 fCurrentMotherKFCandidate->SetMassConstraint(0,fNSigmaMass);
999 if(fUseImprovedVertex == kTRUE){
1000 AliKFVertex primaryVertexImproved(*GetPrimaryVertex());
1001 primaryVertexImproved+=*fCurrentMotherKFCandidate;
1002 fCurrentMotherKFCandidate->SetProductionVertex(primaryVertexImproved);
1005 fCurrentMotherKFCandidate->GetMass(fMotherCandidateKFMass,fMotherCandidateKFWidth);
1007 if(fNegativeTrackLorentzVector != NULL){
1008 delete fNegativeTrackLorentzVector;
1011 fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeKFParticle->Px(),fCurrentNegativeKFParticle->Py(),fCurrentNegativeKFParticle->Pz());
1013 else if(fUseESDTrack){
1014 fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeESDTrack->Px(),fCurrentNegativeESDTrack->Py(),fCurrentNegativeESDTrack->Pz());
1017 if(fPositiveTrackLorentzVector != NULL){
1018 delete fPositiveTrackLorentzVector;
1021 fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveKFParticle->Px(),fCurrentPositiveKFParticle->Py(),fCurrentPositiveKFParticle->Pz());
1023 else if(fUseESDTrack){
1024 fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveESDTrack->Px(),fCurrentPositiveESDTrack->Py(),fCurrentPositiveESDTrack->Pz());
1027 if(fMotherCandidateLorentzVector != NULL){
1028 delete fMotherCandidateLorentzVector;
1031 fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);
1033 else if(fUseESDTrack){
1034 fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);
1037 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
1038 fMotherCandidateLorentzVector->SetXYZM(fMotherCandidateLorentzVector->Px() ,fMotherCandidateLorentzVector->Py(),fMotherCandidateLorentzVector->Pz(),0.);
1043 fMotherMCParticle= NULL;
1044 fNegativeMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel()));
1045 fPositiveMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel()));
1046 if(fPositiveMCParticle->GetMother(0)>-1){
1047 fMotherMCParticle = fMCStack->Particle(fPositiveMCParticle->GetMother(0));
1053 // Double_t containerInput[3];
1055 // containerInput[0] = GetMotherCandidatePt();
1056 // containerInput[1] = GetMotherCandidateEta();
1057 // containerInput[2] = GetMotherCandidateMass();
1059 // fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF
1060 // fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF
1061 // fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF
1065 if(fUseOwnXYZCalculation == kFALSE){
1066 if(fUseConstructGamma == kFALSE){
1067 fCurrentV0->GetXYZ(fCurrentXValue,fCurrentYValue,fCurrentZValue);
1069 fCurrentXValue=GetMotherCandidateKFCombination()->GetX();
1070 fCurrentYValue=GetMotherCandidateKFCombination()->GetY();
1071 fCurrentZValue=GetMotherCandidateKFCombination()->GetZ();
1075 Double_t convpos[2];
1079 GetConvPosXY(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField(),convpos);
1080 fCurrentXValue = convpos[0];
1081 fCurrentYValue = convpos[1];
1082 fCurrentZValue = GetConvPosZ(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField());
1085 if(fCurrentNegativeESDTrack->GetSign() == fCurrentPositiveESDTrack->GetSign()){ // avoid like sign
1087 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE){
1088 fHistograms->FillHistogram("ESD_CutLikeSign_InvMass",GetMotherCandidateMass());
1089 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1090 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1091 fUpdateV0AlreadyCalled = kTRUE;
1095 if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ||
1096 !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ){
1097 // if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kITSrefit) ||
1098 // !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kITSrefit) ){
1100 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE){
1101 fHistograms->FillHistogram("ESD_CutRefit_InvMass",GetMotherCandidateMass());
1102 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1103 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1104 fUpdateV0AlreadyCalled = kTRUE;
1108 if( fCurrentNegativeESDTrack->GetKinkIndex(0) > 0 ||
1109 fCurrentPositiveESDTrack->GetKinkIndex(0) > 0) {
1112 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE ){
1113 fHistograms->FillHistogram("ESD_CutKink_InvMass",GetMotherCandidateMass());
1114 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1115 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1116 fUpdateV0AlreadyCalled = kTRUE;
1120 if(fDodEdxSigmaCut == kTRUE){
1122 if( fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
1123 fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ||
1124 fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
1125 fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ){
1127 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE){
1128 fHistograms->FillHistogram("ESD_CutdEdxSigmaElectronLine_InvMass",GetMotherCandidateMass());
1129 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1130 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1131 fUpdateV0AlreadyCalled = kTRUE;
1134 if( fCurrentPositiveESDTrack->P()>fPIDMinPnSigmaAbovePionLine){
1135 if(fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1136 fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
1137 fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
1139 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE){
1140 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
1141 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1142 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1143 fUpdateV0AlreadyCalled = kTRUE;
1148 if( fCurrentNegativeESDTrack->P()>fPIDMinPnSigmaAbovePionLine){
1149 if(fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1150 fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
1151 fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
1153 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE ){
1154 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
1155 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1156 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1157 fUpdateV0AlreadyCalled = kTRUE;
1163 fUpdateV0AlreadyCalled = kTRUE;
1170 Bool_t AliV0Reader::HasSameMCMother(){
1171 //see header file for documentation
1173 Bool_t iResult = kFALSE;
1175 if(fNegativeMCParticle != NULL && fPositiveMCParticle != NULL){
1176 if(fNegativeMCParticle->GetMother(0) == fPositiveMCParticle->GetMother(0))
1177 if(fMotherMCParticle){
1185 Bool_t AliV0Reader::CheckPIDProbability(Double_t negProbCut, Double_t posProbCut){
1186 //see header file for documentation
1188 Bool_t iResult=kFALSE;
1190 // Double_t *posProbArray = new Double_t[10];
1191 // Double_t *negProbArray = new Double_t[10];
1192 //-AM The TPCpid method expects an array of length kSPECIES that is 5 not 10
1194 Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1195 Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1197 AliESDtrack* negTrack = GetNegativeESDTrack();
1198 AliESDtrack* posTrack = GetPositiveESDTrack();
1199 //fESDEvent->GetTrack(fCurrentV0->GetNindex());
1200 //fESDEvent->GetTrack(fCurrentV0->GetPindex());
1201 //-AM for switchtracks==true the above is a bug
1203 negTrack->GetTPCpid(negProbArray);
1204 posTrack->GetTPCpid(posProbArray);
1206 // if(negProbArray != NULL && posProbArray != NULL){ // this is not allowed anymore for some reason(RC19)
1207 if(negProbArray && posProbArray){
1208 if(negProbArray[GetSpeciesIndex(-1)]>=negProbCut && posProbArray[GetSpeciesIndex(1)]>=posProbCut){
1212 delete [] posProbArray;
1213 delete [] negProbArray;
1217 void AliV0Reader::GetPIDProbability(Double_t &negPIDProb,Double_t & posPIDProb){
1218 // see header file for documentation
1220 //Double_t *posProbArray = new Double_t[10];
1221 // Double_t *negProbArray = new Double_t[10];
1222 //-AM The TPCpid method expects an array of length kSPECIES that is 5 not 10
1223 Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1224 Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1226 // AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
1227 // AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
1228 //-AM for switchtracks the above is a bug
1229 AliESDtrack* negTrack = GetNegativeESDTrack();
1230 AliESDtrack* posTrack = GetPositiveESDTrack();
1233 negTrack->GetTPCpid(negProbArray);
1234 posTrack->GetTPCpid(posProbArray);
1236 // if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19)
1237 if(negProbArray && posProbArray){
1238 negPIDProb = negProbArray[GetSpeciesIndex(-1)];
1239 posPIDProb = posProbArray[GetSpeciesIndex(1)];
1241 delete [] posProbArray;
1242 delete [] negProbArray;
1244 void AliV0Reader::GetPIDProbabilityMuonPion(Double_t &negPIDProb,Double_t & posPIDProb){
1245 // see header file for documentation
1248 Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1249 Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1251 // AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
1252 // AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
1253 //-AM for switchtracks the above is a bug
1255 AliESDtrack* negTrack = GetNegativeESDTrack();
1256 AliESDtrack* posTrack = GetPositiveESDTrack();
1258 negTrack->GetTPCpid(negProbArray);
1259 posTrack->GetTPCpid(posProbArray);
1261 // if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19)
1262 if(negProbArray && posProbArray){
1263 negPIDProb = negProbArray[1]+negProbArray[2];
1264 posPIDProb = posProbArray[1]+posProbArray[2];
1266 delete [] posProbArray;
1267 delete [] negProbArray;
1270 void AliV0Reader::UpdateEventByEventData(){
1271 //see header file for documentation
1272 if(fCurrentEventGoodV0s->GetEntriesFast() >0 ){
1273 if(fCalculateBackground){
1274 if(fUseChargedTrackMultiplicityForBG == kTRUE){
1275 fBGEventHandler->AddEvent(fCurrentEventGoodV0s,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
1276 //filling z and multiplicity histograms
1277 fHistograms->FillHistogram("ESD_Z_distribution",fESDEvent->GetPrimaryVertex()->GetZ());
1278 fHistograms->FillHistogram("ESD_multiplicity_distribution",CountESDTracks());
1279 fHistograms->FillHistogram("ESD_ZvsMultiplicity",fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
1281 else{ // means we use #V0s for multiplicity
1282 fBGEventHandler->AddEvent(fCurrentEventGoodV0s,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s);
1283 //filling z and multiplicity histograms
1284 fHistograms->FillHistogram("ESD_Z_distribution",fESDEvent->GetPrimaryVertex()->GetZ());
1285 fHistograms->FillHistogram("ESD_multiplicity_distribution",fNumberOfGoodV0s);
1286 fHistograms->FillHistogram("ESD_ZvsMultiplicity",fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s);
1290 fCurrentEventGoodV0s->Delete();
1291 fCurrentV0IndexNumber=0;
1292 fNumberOfESDTracks=0;
1299 // fBGEventHandler->PrintBGArray(); // for debugging
1303 Double_t AliV0Reader::GetNegativeTrackPhi() const{
1304 //see header file for documentation
1307 if(fNegativeTrackLorentzVector->Phi()> TMath::Pi()){
1308 offset = -2*TMath::Pi();
1310 return fNegativeTrackLorentzVector->Phi()+offset;
1313 Double_t AliV0Reader::GetPositiveTrackPhi() const{
1314 //see header file for documentation
1317 if(fPositiveTrackLorentzVector->Phi()> TMath::Pi()){
1318 offset = -2*TMath::Pi();
1320 return fPositiveTrackLorentzVector->Phi()+offset;
1323 Double_t AliV0Reader::GetMotherCandidatePhi() const{
1324 //see header file for documentation
1327 if(fMotherCandidateLorentzVector->Phi()> TMath::Pi()){
1328 offset = -2*TMath::Pi();
1330 return fMotherCandidateLorentzVector->Phi()+offset;
1334 Double_t AliV0Reader::GetMotherCandidateRapidity() const{
1335 //see header file for documentation
1337 Double_t rapidity=0;
1338 if(fMotherCandidateLorentzVector->Energy() - fMotherCandidateLorentzVector->Pz() == 0 || fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz() == 0) rapidity=0;
1339 else rapidity = 0.5*(TMath::Log((fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz()) / (fMotherCandidateLorentzVector->Energy()-fMotherCandidateLorentzVector->Pz())));
1348 Int_t AliV0Reader::GetSpeciesIndex(Int_t chargeOfTrack){
1349 //see header file for documentation
1351 Int_t iResult = 10; // Unknown particle
1353 if(chargeOfTrack==-1){ //negative track
1354 switch(abs(fNegativeTrackPID)){
1376 case 2112: //neutron
1383 //Put in here for kSPECIES::kEleCon ????
1386 else if(chargeOfTrack==1){ //positive track
1387 switch(abs(fPositiveTrackPID)){
1409 case 2112: //neutron
1416 //Put in here for kSPECIES::kEleCon ????
1420 //Wrong parameter.. Print warning
1425 Bool_t AliV0Reader::GetHelixCenter(AliESDtrack* track, Double_t b,Int_t charge, Double_t center[2]){
1426 // see header file for documentation
1428 Double_t pi = 3.14159265358979323846;
1431 track->GetHelixParameters(helix,b);
1433 Double_t xpos = helix[5];
1434 Double_t ypos = helix[0];
1435 Double_t radius = TMath::Abs(1./helix[4]);
1436 Double_t phi = helix[2];
1443 Double_t xpoint = radius * TMath::Cos(phi);
1444 Double_t ypoint = radius * TMath::Sin(phi);
1468 center[0] = xpos + xpoint;
1469 center[1] = ypos + ypoint;
1474 Bool_t AliV0Reader::GetConvPosXY(AliESDtrack* ptrack, AliESDtrack* ntrack, Double_t b, Double_t convpos[2]){
1475 //see header file for documentation
1477 Double_t helixcenterpos[2];
1478 GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
1480 Double_t helixcenterneg[2];
1481 GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
1483 Double_t poshelix[6];
1484 ptrack->GetHelixParameters(poshelix,b);
1485 Double_t posradius = TMath::Abs(1./poshelix[4]);
1487 Double_t neghelix[6];
1488 ntrack->GetHelixParameters(neghelix,b);
1489 Double_t negradius = TMath::Abs(1./neghelix[4]);
1491 Double_t xpos = helixcenterpos[0];
1492 Double_t ypos = helixcenterpos[1];
1493 Double_t xneg = helixcenterneg[0];
1494 Double_t yneg = helixcenterneg[1];
1496 convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
1497 convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius);
1504 Double_t AliV0Reader::GetConvPosZ(AliESDtrack* ptrack,AliESDtrack* ntrack, Double_t b){
1505 //see header file for documentation
1507 Double_t helixpos[6];
1508 ptrack->GetHelixParameters(helixpos,b);
1510 Double_t helixneg[6];
1511 ntrack->GetHelixParameters(helixneg,b);
1513 Double_t negtrackradius = TMath::Abs(1./helixneg[4]);
1514 Double_t postrackradius = TMath::Abs(1./helixpos[4]);
1516 Double_t pi = 3.14159265358979323846;
1518 Double_t convpos[2];
1519 GetConvPosXY(ptrack,ntrack,b,convpos);
1521 Double_t convposx = convpos[0];
1522 Double_t convposy = convpos[1];
1524 Double_t helixcenterpos[2];
1525 GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
1527 Double_t helixcenterneg[2];
1528 GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
1530 Double_t xpos = helixcenterpos[0];
1531 Double_t ypos = helixcenterpos[1];
1532 Double_t xneg = helixcenterneg[0];
1533 Double_t yneg = helixcenterneg[1];
1535 Double_t deltaXPos = convposx - xpos;
1536 Double_t deltaYPos = convposy - ypos;
1538 Double_t deltaXNeg = convposx - xneg;
1539 Double_t deltaYNeg = convposy - yneg;
1541 Double_t alphaPos = pi + TMath::ATan2(-deltaYPos,-deltaXPos);
1542 Double_t alphaNeg = pi + TMath::ATan2(-deltaYNeg,-deltaXNeg);
1544 Double_t vertexXNeg = xneg + TMath::Abs(negtrackradius)*
1545 TMath::Cos(alphaNeg);
1546 Double_t vertexYNeg = yneg + TMath::Abs(negtrackradius)*
1547 TMath::Sin(alphaNeg);
1549 Double_t vertexXPos = xpos + TMath::Abs(postrackradius)*
1550 TMath::Cos(alphaPos);
1551 Double_t vertexYPos = ypos + TMath::Abs(postrackradius)*
1552 TMath::Sin(alphaPos);
1554 Double_t x0neg = helixneg[5];
1555 Double_t y0neg = helixneg[0];
1557 Double_t x0pos = helixpos[5];
1558 Double_t y0pos = helixpos[0];
1560 Double_t dNeg = TMath::Sqrt((vertexXNeg - x0neg)*(vertexXNeg - x0neg)
1561 +(vertexYNeg - y0neg)*(vertexYNeg - y0neg));
1563 Double_t dPos = TMath::Sqrt((vertexXPos - x0pos)*(vertexXPos - x0pos)
1564 +(vertexYPos - y0pos)*(vertexYPos - y0pos));
1566 Double_t rNeg = TMath::Sqrt(negtrackradius*negtrackradius -
1569 Double_t rPos = TMath::Sqrt(postrackradius*postrackradius -
1572 Double_t deltabetaNeg = 2*(pi + TMath::ATan2(-dNeg/2.,-rNeg));
1573 Double_t deltabetaPos = 2*(pi + TMath::ATan2(-dPos/2.,-rPos));
1575 Double_t deltaUNeg = negtrackradius*deltabetaNeg;
1576 Double_t deltaUPos = postrackradius*deltabetaPos;
1578 Double_t zphaseNeg = ntrack->GetZ() + deltaUNeg * ntrack->GetTgl();
1579 Double_t zphasePos = ptrack->GetZ() + deltaUPos * ptrack->GetTgl();
1581 Double_t convposz = (zphasePos*negtrackradius+zphaseNeg*postrackradius)/(negtrackradius+postrackradius);
1586 AliGammaConversionKFVector* AliV0Reader::GetBGGoodV0s(Int_t /*event*/){
1588 if(fUseChargedTrackMultiplicityForBG == kTRUE){
1589 return fBGEventHandler->GetBGGoodV0s(event,fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
1591 else{ // means we use #v0s as multiplicity
1592 return fBGEventHandler->GetBGGoodV0s(event,fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s);
1598 Int_t AliV0Reader::CountESDTracks(){
1599 // see header file for documentation
1600 if(fNumberOfESDTracks == 0){ // count the good esd tracks
1601 for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){
1602 AliESDtrack* curTrack = fESDEvent->GetTrack(iTracks);
1606 if(fEsdTrackCuts->AcceptTrack(curTrack) ){
1607 fNumberOfESDTracks++;
1612 return fNumberOfESDTracks;
1615 Bool_t AliV0Reader::CheckIfPi0IsMother(Int_t label){
1616 // see headerfile for documentation
1617 Bool_t iResult=kFALSE;
1618 // cout<<"Checking particle label, particle is: "<<fMCStack->Particle(TMath::Abs(label))->GetName()<<endl;
1619 if(fMCStack->Particle(TMath::Abs(label))->GetPdgCode() == 111){
1625 Bool_t AliV0Reader::CheckIfEtaIsMother(Int_t label){
1626 // see headerfile for documentation
1627 Bool_t iResult=kFALSE;
1628 // cout<<"Checking particle label, particle is: "<<fMCStack->Particle(TMath::Abs(label))->GetName()<<endl;
1629 if(fMCStack->Particle(TMath::Abs(label))->GetPdgCode() == 221){
1636 Bool_t AliV0Reader::GetArmenterosQtAlfa(AliKFParticle* positiveKFParticle, AliKFParticle * negativeKFParticle, AliKFParticle * gammaKFCandidate, Double_t armenterosQtAlfa[2] ){
1637 //see header file for documentation
1639 TVector3 momentumVectorPositiveKF(positiveKFParticle->GetPx(),positiveKFParticle->GetPy(),positiveKFParticle->GetPz());
1640 TVector3 momentumVectorNegativeKF(negativeKFParticle->GetPx(),negativeKFParticle->GetPy(),negativeKFParticle->GetPz());
1641 TVector3 vecV0(gammaKFCandidate->GetPx(),gammaKFCandidate->GetPy(),gammaKFCandidate->GetPz());
1643 Float_t thetaV0pos=TMath::ACos(( momentumVectorPositiveKF* vecV0)/(momentumVectorPositiveKF.Mag() * vecV0.Mag()));
1644 Float_t thetaV0neg=TMath::ACos(( momentumVectorNegativeKF* vecV0)/(momentumVectorNegativeKF.Mag() * vecV0.Mag()));
1646 Float_t alfa =((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)-(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg))/
1647 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
1650 Float_t qt = momentumVectorPositiveKF.Mag()*TMath::Sin(thetaV0pos);
1652 armenterosQtAlfa[0]=qt;
1653 armenterosQtAlfa[1]=alfa;