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"
51 AliESDpid* AliV0Reader::fgESDpid = 0x0;
53 AliV0Reader::AliV0Reader() :
57 fMCEvent(NULL), // for CF
64 fCurrentV0IndexNumber(0),
66 fCurrentNegativeKFParticle(NULL),
67 fCurrentPositiveKFParticle(NULL),
68 fCurrentMotherKFCandidate(NULL),
69 fCurrentNegativeESDTrack(NULL),
70 fCurrentPositiveESDTrack(NULL),
71 fNegativeTrackLorentzVector(NULL),
72 fPositiveTrackLorentzVector(NULL),
73 fMotherCandidateLorentzVector(NULL),
79 fNegativeMCParticle(NULL),
80 fPositiveMCParticle(NULL),
81 fMotherMCParticle(NULL),
82 fMotherCandidateKFMass(0),
83 fMotherCandidateKFWidth(0),
84 fUseKFParticle(kTRUE),
87 fMaxVertexZ(100.),// 100 cm(from the 0)
88 fMaxR(10000),// 100 meter(outside of ALICE)
89 fMinR(0),// 100 meter(outside of ALICE)
92 fRapidityMesonCut(0.),
100 fLineCutZRSlopeMin(0.),
101 fLineCutZValueMin(0.),
102 fChi2CutConversion(0.),
105 fAlphaMinCutMeson(0.),
106 fPIDProbabilityCutNegativeParticle(0),
107 fPIDProbabilityCutPositiveParticle(0),
108 fDodEdxSigmaCut(kFALSE),
109 fDoTOFsigmaCut(kFALSE), // RRnewTOF
110 fPIDnSigmaAboveElectronLine(100),
111 fPIDnSigmaBelowElectronLine(-100),
112 fTofPIDnSigmaAboveElectronLine(100), // RRnewTOF
113 fTofPIDnSigmaBelowElectronLine(-100), // RRnewTOF
114 fPIDnSigmaAbovePionLine(-100),
115 fPIDnSigmaAbovePionLineHighPt(-100),
116 fPIDMinPnSigmaAbovePionLine(100),
117 fPIDMaxPnSigmaAbovePionLine(100),
118 fDoKaonRejectionLowP(kFALSE),
119 fDoProtonRejectionLowP(kFALSE),
120 fDoPionRejectionLowP(kFALSE),
121 fPIDnSigmaAtLowPAroundKaonLine(0),
122 fPIDnSigmaAtLowPAroundProtonLine(0),
123 fPIDnSigmaAtLowPAroundPionLine(0),
124 fPIDMinPKaonRejectionLowP(0),
125 fPIDMinPProtonRejectionLowP(0),
126 fPIDMinPPionRejectionLowP(0),
127 fDoQtGammaSelection(kFALSE),
128 fDoHighPtQtGammaSelection(kFALSE), // RRnew
130 fHighPtQtMax(100.), // RRnew
131 fPtBorderForQt(100.), // RRnew
136 fUseImprovedVertex(kFALSE),
137 fUseOwnXYZCalculation(kFALSE),
138 fUseConstructGamma(kFALSE),
140 fUseEtaMinCut(kFALSE),
141 fUseOnFlyV0Finder(kTRUE),
142 fUpdateV0AlreadyCalled(kFALSE),
143 fCurrentEventGoodV0s(NULL),
146 // fPreviousEventGoodV0s(),
147 fCalculateBackground(kFALSE),
148 fBGEventHandler(NULL),
149 fBGEventInitialized(kFALSE),
151 fNumberOfESDTracks(0),
152 fNEventsForBGCalculation(20),
153 fUseChargedTrackMultiplicityForBG(kTRUE),
156 fUseCorrectedTPCClsInfo(kFALSE),
157 fUseMCPSmearing(kTRUE),
160 fPSigSmearingCte(0.),
163 fDoPhotonAsymmetryCut(0),
164 fMinPPhotonAsymmetryCut(100.),
165 fMinPhotonAsymmetry(0.)
167 //fESDpid = new AliESDpid;
171 AliV0Reader::AliV0Reader(const AliV0Reader & original) :
173 fMCStack(original.fMCStack),
174 // fMCTruth(original.fMCTruth),
175 fMCEvent(original.fMCEvent), // for CF
176 fChain(original.fChain),
177 // fESDHandler(original.fESDHandler),
178 fESDEvent(original.fESDEvent),
179 fCFManager(original.fCFManager),
180 // fESDpid(original.fESDpid),
181 fHistograms(original.fHistograms),
182 fCurrentV0IndexNumber(original.fCurrentV0IndexNumber),
183 fCurrentV0(original.fCurrentV0),
184 fCurrentNegativeKFParticle(original.fCurrentNegativeKFParticle),
185 fCurrentPositiveKFParticle(original.fCurrentPositiveKFParticle),
186 fCurrentMotherKFCandidate(original.fCurrentMotherKFCandidate),
187 fCurrentNegativeESDTrack(original.fCurrentNegativeESDTrack),
188 fCurrentPositiveESDTrack(original.fCurrentPositiveESDTrack),
189 fNegativeTrackLorentzVector(original.fNegativeTrackLorentzVector),
190 fPositiveTrackLorentzVector(original.fPositiveTrackLorentzVector),
191 fMotherCandidateLorentzVector(original.fMotherCandidateLorentzVector),
192 fCurrentXValue(original.fCurrentXValue),
193 fCurrentYValue(original.fCurrentYValue),
194 fCurrentZValue(original.fCurrentZValue),
195 fPositiveTrackPID(original.fPositiveTrackPID),
196 fNegativeTrackPID(original.fNegativeTrackPID),
197 fNegativeMCParticle(original.fNegativeMCParticle),
198 fPositiveMCParticle(original.fPositiveMCParticle),
199 fMotherMCParticle(original.fMotherMCParticle),
200 fMotherCandidateKFMass(original.fMotherCandidateKFMass),
201 fMotherCandidateKFWidth(original.fMotherCandidateKFWidth),
202 fUseKFParticle(kTRUE),
203 fUseESDTrack(kFALSE),
205 fMaxVertexZ(original.fMaxVertexZ),
206 fMaxR(original.fMaxR),
207 fMinR(original.fMinR),
208 fEtaCut(original.fEtaCut),
209 fEtaCutMin(original.fEtaCutMin),
210 fRapidityMesonCut(original.fRapidityMesonCut),
211 fPtCut(original.fPtCut),
212 fSinglePtCut(original.fSinglePtCut),
213 fMaxZ(original.fMaxZ),
214 fMinClsTPC(original.fMinClsTPC),
215 fMinClsTPCToF(original.fMinClsTPCToF),
216 fLineCutZRSlope(original.fLineCutZRSlope),
217 fLineCutZValue(original.fLineCutZValue),
218 fLineCutZRSlopeMin(original.fLineCutZRSlopeMin),
219 fLineCutZValueMin(original.fLineCutZValueMin),
220 fChi2CutConversion(original.fChi2CutConversion),
221 fChi2CutMeson(original.fChi2CutMeson),
222 fAlphaCutMeson(original.fAlphaCutMeson),
223 fAlphaMinCutMeson(original.fAlphaMinCutMeson),
224 fPIDProbabilityCutNegativeParticle(original.fPIDProbabilityCutNegativeParticle),
225 fPIDProbabilityCutPositiveParticle(original.fPIDProbabilityCutPositiveParticle),
226 fDodEdxSigmaCut(original.fDodEdxSigmaCut),
227 fDoTOFsigmaCut(original.fDoTOFsigmaCut), // RRnewTOF
228 fPIDnSigmaAboveElectronLine(original.fPIDnSigmaAboveElectronLine),
229 fPIDnSigmaBelowElectronLine(original.fPIDnSigmaBelowElectronLine),
230 fTofPIDnSigmaAboveElectronLine(original.fTofPIDnSigmaAboveElectronLine), // RRnewTOF
231 fTofPIDnSigmaBelowElectronLine(original.fTofPIDnSigmaBelowElectronLine), // RRnewTOF
232 fPIDnSigmaAbovePionLine(original.fPIDnSigmaAbovePionLine),
233 fPIDnSigmaAbovePionLineHighPt(original.fPIDnSigmaAbovePionLineHighPt),
234 fPIDMinPnSigmaAbovePionLine(original.fPIDMinPnSigmaAbovePionLine),
235 fPIDMaxPnSigmaAbovePionLine(original.fPIDMaxPnSigmaAbovePionLine),
236 fDoKaonRejectionLowP(original.fDoKaonRejectionLowP),
237 fDoProtonRejectionLowP(original.fDoProtonRejectionLowP),
238 fDoPionRejectionLowP(original.fDoPionRejectionLowP),
239 fPIDnSigmaAtLowPAroundKaonLine(original.fPIDnSigmaAtLowPAroundKaonLine),
240 fPIDnSigmaAtLowPAroundProtonLine(original.fPIDnSigmaAtLowPAroundProtonLine),
241 fPIDnSigmaAtLowPAroundPionLine(original.fPIDnSigmaAtLowPAroundPionLine),
242 fPIDMinPKaonRejectionLowP(original.fPIDMinPKaonRejectionLowP),
243 fPIDMinPProtonRejectionLowP(original.fPIDMinPProtonRejectionLowP),
244 fPIDMinPPionRejectionLowP(original.fPIDMinPPionRejectionLowP),
245 fDoQtGammaSelection(original.fDoQtGammaSelection),
246 fDoHighPtQtGammaSelection(original.fDoHighPtQtGammaSelection), // RRnew
247 fQtMax(original.fQtMax),
248 fHighPtQtMax(original.fHighPtQtMax), // RRnew
249 fPtBorderForQt(original.fPtBorderForQt), // RRnew
250 fXVertexCut(original.fXVertexCut),
251 fYVertexCut(original.fYVertexCut),
252 fZVertexCut(original.fZVertexCut),
253 fNSigmaMass(original.fNSigmaMass),
254 fUseImprovedVertex(original.fUseImprovedVertex),
255 fUseOwnXYZCalculation(original.fUseOwnXYZCalculation),
256 fUseConstructGamma(original.fUseConstructGamma),
257 fDoCF(original.fDoCF),
258 fUseEtaMinCut(original.fUseEtaMinCut),
259 fUseOnFlyV0Finder(original.fUseOnFlyV0Finder),
260 fUpdateV0AlreadyCalled(original.fUpdateV0AlreadyCalled),
261 fCurrentEventGoodV0s(original.fCurrentEventGoodV0s),
262 fV0Pindex(original.fV0Pindex),
263 fV0Nindex(original.fV0Nindex),
264 // fPreviousEventGoodV0s(original.fPreviousEventGoodV0s),
265 fCalculateBackground(original.fCalculateBackground),
266 fBGEventHandler(original.fBGEventHandler),
267 fBGEventInitialized(original.fBGEventInitialized),
268 fEsdTrackCuts(original.fEsdTrackCuts),
269 fNumberOfESDTracks(original.fNumberOfESDTracks),
270 fNEventsForBGCalculation(original.fNEventsForBGCalculation),
271 fUseChargedTrackMultiplicityForBG(original.fUseChargedTrackMultiplicityForBG),
272 fNumberOfGoodV0s(original.fNumberOfGoodV0s),
273 fIsHeavyIon(original.fIsHeavyIon),
274 fUseCorrectedTPCClsInfo(original.fUseCorrectedTPCClsInfo),
275 fUseMCPSmearing(original.fUseMCPSmearing),
276 fPBremSmearing(original.fPBremSmearing),
277 fPSigSmearing(original.fPSigSmearing),
278 fPSigSmearingCte(original.fPSigSmearingCte),
279 fRandom(original.fRandom),
280 fBrem(original.fBrem),
281 fDoPhotonAsymmetryCut(original.fDoPhotonAsymmetryCut),
282 fMinPPhotonAsymmetryCut(original.fMinPPhotonAsymmetryCut),
283 fMinPhotonAsymmetry(original.fMinPhotonAsymmetry)
289 AliV0Reader & AliV0Reader::operator = (const AliV0Reader & /*source*/)
291 // assignment operator
294 AliV0Reader::~AliV0Reader()
301 //____________________________________________________________________________
302 void AliV0Reader::SetInputAndMCEvent(AliVEvent* esd, AliMCEvent* mc) {
303 // Connect the data pointers
311 void AliV0Reader::Initialize(){
312 //see header file for documentation
314 fUpdateV0AlreadyCalled = kFALSE;
317 // Get the input handler from the manager
318 fESDHandler = (AliESDInputHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
319 if(fESDHandler == NULL){
323 // Get pointer to esd event from input handler
324 fESDEvent = fESDHandler->GetEvent();
325 if(fESDEvent == NULL){
329 //Get pointer to MCTruth
330 fMCTruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
335 // fMCTruth = mcH->MCEvent();
336 // fMC = mcH->MCEvent();
337 // stack = fMC->Stack();
340 //if(fMCTruth == NULL){
345 if(fMCEvent == NULL){
349 //Get pointer to the mc stack
352 fMCStack = fMCEvent->Stack();
353 if(fMCStack == NULL){
356 // Better parameters for MonteCarlo from A. Kalweit 2010/01/8
357 // fESDpid->GetTPCResponse().SetBetheBlochParameters( 2.15898e+00/50.,
364 // Better parameters for data from A. Kalweit 2010/01/8
365 // fESDpid->GetTPCResponse().SetBetheBlochParameters(0.0283086,
373 //Get pointer to the mc event
375 //fMCEvent = fMCTruth->MCEvent();
376 if(fMCEvent == NULL){
382 fUseEtaMinCut = kFALSE;
383 if ( fEtaCutMin != -0.1) {
384 fUseEtaMinCut = kTRUE;
388 AliKFParticle::SetField(fESDEvent->GetMagneticField());
390 // fCurrentEventGoodV0s = new TClonesArray("TClonesArray", 0);
391 if(fCurrentEventGoodV0s == NULL){
392 fCurrentEventGoodV0s = new TClonesArray("AliKFParticle", 0);
400 gRandom= new TRandom3(0);
405 fBrem = new TF1("fBrem","pow(-log(x),[0]/log(2.0)-1.0)/TMath::Gamma([0]/log(2.0))",0.00001,0.999999999);
406 // tests done with 1.0e-14
407 fBrem->SetParameter(0,fPBremSmearing);
408 fBrem->SetNpx(100000);
411 if(fCalculateBackground == kTRUE){
412 if(fBGEventInitialized == kFALSE){
415 Double_t *zBinLimitsArray = new Double_t[9];
416 zBinLimitsArray[0] = -50.00;
417 zBinLimitsArray[1] = -3.375;
418 zBinLimitsArray[2] = -1.605;
419 zBinLimitsArray[3] = -0.225;
420 zBinLimitsArray[4] = 1.065;
421 zBinLimitsArray[5] = 2.445;
422 zBinLimitsArray[6] = 4.245;
423 zBinLimitsArray[7] = 50.00;
424 zBinLimitsArray[8] = 1000.00;
426 Double_t *multiplicityBinLimitsArray= new Double_t[6];
427 if(fUseChargedTrackMultiplicityForBG == kTRUE){
428 multiplicityBinLimitsArray[0] = 0;
429 multiplicityBinLimitsArray[1] = 8.5;
430 multiplicityBinLimitsArray[2] = 16.5;
431 multiplicityBinLimitsArray[3] = 27.5;
432 multiplicityBinLimitsArray[4] = 41.5;
433 multiplicityBinLimitsArray[5] = 100.;
435 multiplicityBinLimitsArray[0] = 0;
436 multiplicityBinLimitsArray[1] = 200.;
437 multiplicityBinLimitsArray[2] = 500.;
438 multiplicityBinLimitsArray[3] = 1000.;
439 multiplicityBinLimitsArray[4] = 1500.;
440 multiplicityBinLimitsArray[5] = 3000.;
442 fBGEventHandler = new AliGammaConversionBGHandler(9,6,fNEventsForBGCalculation);
444 multiplicityBinLimitsArray[0] = 2;
445 multiplicityBinLimitsArray[1] = 3;
446 multiplicityBinLimitsArray[2] = 4;
447 multiplicityBinLimitsArray[3] = 5;
448 multiplicityBinLimitsArray[4] = 9999;
450 multiplicityBinLimitsArray[0] = 2;
451 multiplicityBinLimitsArray[1] = 10;
452 multiplicityBinLimitsArray[2] = 30;
453 multiplicityBinLimitsArray[3] = 50;
454 multiplicityBinLimitsArray[4] = 9999;
457 fBGEventHandler = new AliGammaConversionBGHandler(9,5,fNEventsForBGCalculation);
463 // ---------------------------------
464 Double_t *zBinLimitsArray = new Double_t[1];
465 zBinLimitsArray[0] = 999999.00;
467 Double_t *multiplicityBinLimitsArray= new Double_t[1];
468 multiplicityBinLimitsArray[0] = 99999999.00;
469 fBGEventHandler = new AliGammaConversionBGHandler(1,1,10);
470 // ---------------------------------
472 fBGEventHandler->Initialize(zBinLimitsArray, multiplicityBinLimitsArray);
473 fBGEventInitialized = kTRUE;
478 AliESDv0* AliV0Reader::GetV0(Int_t index){
479 //see header file for documentation
480 fCurrentV0 = fESDEvent->GetV0(index);
481 UpdateV0Information();
485 Int_t AliV0Reader::GetNumberOfContributorsVtx(){
486 // returns number of contributors to the vertex
487 if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()>0) {
488 return fESDEvent->GetPrimaryVertexTracks()->GetNContributors();
491 if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()<1) {
493 //-AM test pi0s without SPD only vertex
494 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
495 return fESDEvent->GetPrimaryVertexSPD()->GetNContributors();
498 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()<1) {
499 cout<<"number of contributors from bad vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
506 Bool_t AliV0Reader::CheckForPrimaryVertex(){
507 //see headerfile for documentation
508 if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()>0) {
511 if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()<1) {
513 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
515 //-AM test pi0s without SPD only vertex
516 //cout<<"spd vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
519 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()<1) {
520 // cout<<"bad vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
525 // return fESDEvent->GetPrimaryVertex()->GetNContributors()>0;
528 Bool_t AliV0Reader::CheckForPrimaryVertexZ(){
529 //see headerfile for documentation
530 if(TMath::Abs(fESDEvent->GetPrimaryVertex()->GetZ())<GetMaxVertexZ()){
538 Bool_t AliV0Reader::CheckV0FinderStatus(Int_t index){
539 // see headerfile for documentation
540 if(fUseOnFlyV0Finder){
541 if(!GetV0(index)->GetOnFlyStatus()){
545 if(!fUseOnFlyV0Finder){
546 if(GetV0(index)->GetOnFlyStatus()){
555 Bool_t AliV0Reader::NextV0(){
556 //see header file for documentation
557 Bool_t iResult=kFALSE;
558 while(fCurrentV0IndexNumber<fESDEvent->GetNumberOfV0s()){
559 fCurrentV0 = fESDEvent->GetV0(fCurrentV0IndexNumber);
561 fUpdateV0AlreadyCalled=kFALSE;
563 if(fHistograms != NULL){
564 fHistograms->FillHistogram("ESD_AllV0s_InvMass",GetMotherCandidateMass());
567 // moved it up here so that the correction framework can access pt and eta information
568 if(UpdateV0Information() == kFALSE){
569 fCurrentV0IndexNumber++;
573 Double_t containerInput[3];
575 containerInput[0] = GetMotherCandidatePt();
576 containerInput[1] = GetMotherCandidateEta();
577 containerInput[2] = GetMotherCandidateMass();
581 containerInput[0] = GetMotherCandidatePt();
582 containerInput[1] = GetMotherCandidateEta();
583 containerInput[2] = GetMotherCandidateMass();
585 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF
586 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF
587 fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF
591 //checks if on the fly mode is set
592 if ( !CheckV0FinderStatus(fCurrentV0IndexNumber) ){
593 if(fHistograms != NULL){
594 fHistograms->FillHistogram("ESD_CutGetOnFly_InvMass",GetMotherCandidateMass());
596 fCurrentV0IndexNumber++;
600 fCFManager->GetParticleContainer()->Fill(containerInput,kStepGetOnFly); // for CF
603 if(fHistograms != NULL){
604 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_InvMass",GetMotherCandidateMass());
607 Double_t armenterosQtAlfa[2];
608 Double_t armenterosQtAlphaESDMC[2];
609 Double_t armenterosQtAlphaMC[2];
610 GetArmenterosQtAlfa(GetNegativeKFParticle(),
611 GetPositiveKFParticle(),
612 GetMotherCandidateKFCombination(),
615 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_alfa_qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
618 if(fCurrentNegativeESDTrack->Charge() == fCurrentPositiveESDTrack->Charge()){ // avoid like sign
620 if(fHistograms != NULL ){
621 fHistograms->FillHistogram("ESD_CutLikeSign_InvMass",GetMotherCandidateMass());
622 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
623 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
624 // fUpdateV0AlreadyCalled = kTRUE;
626 fCurrentV0IndexNumber++;
630 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF
633 if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ||
634 !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ){
635 // if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kITSrefit) ||
636 // !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kITSrefit) ){
638 if(fHistograms != NULL){
639 fHistograms->FillHistogram("ESD_CutRefit_InvMass",GetMotherCandidateMass());
640 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
641 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
642 //fUpdateV0AlreadyCalled = kTRUE;
644 fCurrentV0IndexNumber++;
648 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF
653 if( fCurrentNegativeESDTrack->GetKinkIndex(0) > 0 ||
654 fCurrentPositiveESDTrack->GetKinkIndex(0) > 0) {
656 if(fHistograms != NULL ){
657 fHistograms->FillHistogram("ESD_CutKink_InvMass",GetMotherCandidateMass());
658 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
659 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
660 //fUpdateV0AlreadyCalled = kTRUE;
662 fCurrentV0IndexNumber++;
667 fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF
670 if(GetXYRadius()>fMaxR){ // cuts on distance from collision point
671 if(fHistograms != NULL){
672 fHistograms->FillHistogram("ESD_CutR_InvMass",GetMotherCandidateMass());
674 fCurrentV0IndexNumber++;
678 fCFManager->GetParticleContainer()->Fill(containerInput,kStepR); // for CF
680 if(GetXYRadius()<fMinR){ // cuts on distance from collision point
681 if(fHistograms != NULL){
682 fHistograms->FillHistogram("ESD_CutMinR_InvMass",GetMotherCandidateMass());
684 fCurrentV0IndexNumber++;
688 //if((TMath::Abs(fCurrentZValue)*fLineCutZRSlope)-fLineCutZValue > GetXYRadius() ) { // cuts out regions where we do not reconstruct
689 if( GetXYRadius() <= ((TMath::Abs(fCurrentZValue)*fLineCutZRSlope)-fLineCutZValue)){
690 if(fHistograms != NULL){
691 fHistograms->FillHistogram("ESD_CutLine_InvMass",GetMotherCandidateMass());
693 fCurrentV0IndexNumber++;
695 } else if (fUseEtaMinCut && GetXYRadius() >= ((TMath::Abs(fCurrentZValue)*fLineCutZRSlopeMin)-fLineCutZValueMin )){
696 if(fHistograms != NULL){
697 fHistograms->FillHistogram("ESD_CutLine_InvMass",GetMotherCandidateMass());
699 fCurrentV0IndexNumber++;
704 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLine); // for CF
707 if(TMath::Abs(fCurrentZValue) > fMaxZ ){ // cuts out regions where we do not reconstruct
708 if(fHistograms != NULL){
709 fHistograms->FillHistogram("ESD_CutZ_InvMass",GetMotherCandidateMass());
711 fCurrentV0IndexNumber++;
715 fCFManager->GetParticleContainer()->Fill(containerInput,kStepZ); // for CF
719 if(TMath::Abs(fMotherCandidateLorentzVector->Eta())> fEtaCut || TMath::Abs(fMotherCandidateLorentzVector->Eta())< fEtaCutMin){
720 if(fHistograms != NULL){
721 fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
723 fCurrentV0IndexNumber++;
727 if(TMath::Abs(fCurrentNegativeKFParticle->GetEta())> fEtaCut || TMath::Abs(fCurrentNegativeKFParticle->GetEta())< fEtaCutMin){
728 if(fHistograms != NULL){
729 fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
731 fCurrentV0IndexNumber++;
735 if(TMath::Abs(fCurrentPositiveKFParticle->GetEta())> fEtaCut || TMath::Abs(fCurrentPositiveKFParticle->GetEta())< fEtaCutMin){
736 if(fHistograms != NULL){
737 fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
739 fCurrentV0IndexNumber++;
744 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_Pt_Qt",GetMotherCandidatePt(),armenterosQtAlfa[0]);
747 if ( HasSameMCMother() == kTRUE){
748 GetArmenterosQtAlfa(fNegativeMCParticle,
751 armenterosQtAlphaMC);
753 GetArmenterosQtAlfa(fNegativeMCParticle,
755 GetMotherCandidateKFCombination(),
756 armenterosQtAlphaESDMC );
758 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_goodtracks_alfa_qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
759 if( fCurrentNegativeKFParticle->GetPt()> 0.150 && fCurrentPositiveKFParticle->GetPt()> 0.150){
760 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_minPt_GT_Alpha_Qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
763 fHistograms->FillHistogram("ESD_TrueConvAllV0s_ESDMother_Alpha_Qt",armenterosQtAlphaESDMC[1],armenterosQtAlphaESDMC[0]);
764 if ( HasSameMCMother() == kTRUE){
765 fHistograms->FillHistogram("ESD_TrueConvSameMother_ESDMother_Alpha_Qt",armenterosQtAlphaESDMC[1],armenterosQtAlphaESDMC[0]);
766 fHistograms->FillHistogram("ESD_TrueConvSameMother_MCMother_Alpha_Qt",armenterosQtAlphaMC[1],armenterosQtAlphaMC[0]);
767 if (fMotherMCParticle->GetPdgCode() == 22 ){
768 fHistograms->FillHistogram("ESD_TrueConvGamma_Alpha_Qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
769 fHistograms->FillHistogram("ESD_TrueConvGamma_Pt_Qt",GetMotherCandidatePt(),armenterosQtAlfa[0]);
770 } else if ( fMotherMCParticle->GetPdgCode() == 310 ){
771 fHistograms->FillHistogram("ESD_TrueConvK0s_Alpha_Qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
772 } else if ( fMotherMCParticle->GetPdgCode() == 113 ){
773 fHistograms->FillHistogram("ESD_TrueConvRho0_Alpha_Qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
774 } else if ( fMotherMCParticle->GetPdgCode() == 333 ){
775 fHistograms->FillHistogram("ESD_TrueConvPhi_Alpha_Qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
776 } else if ( (fMotherMCParticle->GetPdgCode() == 3122 || fMotherMCParticle->GetPdgCode() == -3122) ){
777 fHistograms->FillHistogram("ESD_TrueConvLambda_Alpha_Qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
778 } else if ( (fMotherMCParticle->GetPdgCode() == 2114 || fMotherMCParticle->GetPdgCode() == -2114) ){
779 fHistograms->FillHistogram("ESD_TrueConvDelta_Alpha_Qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
780 } else if ( (fMotherMCParticle->GetPdgCode() == 313 ||
781 fMotherMCParticle->GetPdgCode() == 323 ||
782 fMotherMCParticle->GetPdgCode() == -323 ) ){
783 fHistograms->FillHistogram("ESD_TrueConvKStar_Alpha_Qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
785 fHistograms->FillHistogram("ESD_TrueConvUnknown_Alpha_Qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
786 fHistograms->FillHistogram("ESD_TrueConvUnknown_Qt_PDG",fMotherMCParticle->GetPdgCode());
787 // cout << "unidentfied mother: pdg-C mother " << fMotherMCParticle->GetPdgCode() << " daughters " << fNegativeMCParticle->GetPdgCode() << "\t" << fPositiveMCParticle->GetPdgCode() << endl;
790 fHistograms->FillHistogram("ESD_TrueConvComb_Alpha_Qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
794 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_E_dEdxP",fCurrentNegativeESDTrack->P(),fCurrentNegativeESDTrack->GetTPCsignal());
795 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_P_dEdxP",fCurrentPositiveESDTrack->P(),fCurrentPositiveESDTrack->GetTPCsignal());
796 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_E_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron));
797 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_P_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron));
798 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_PiPl_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion));
799 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_PiMi_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion));
800 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_KPl_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kKaon));
801 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_KMi_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kKaon));
802 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_PPl_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kProton));
803 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_PMi_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kProton));
804 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_MuPl_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kMuon));
805 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_MuMi_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kMuon));
807 if(fDodEdxSigmaCut == kTRUE){
808 if( fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
809 fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ||
810 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
811 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ){
813 if(fHistograms != NULL ){
814 fHistograms->FillHistogram("ESD_CutdEdxSigmaElectronLine_InvMass",GetMotherCandidateMass());
815 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
816 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
817 //fUpdateV0AlreadyCalled = kTRUE;
819 fCurrentV0IndexNumber++;
823 fCFManager->GetParticleContainer()->Fill(containerInput,kStepdEdxElectronselection); // for CF
826 fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_PiPl_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion));
827 fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_PiMi_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion));
828 fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_MuPl_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kMuon));
829 fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_MuMi_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kMuon));
832 if( fCurrentPositiveESDTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentPositiveESDTrack->P()<fPIDMaxPnSigmaAbovePionLine ){
833 if(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
834 fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
835 fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
837 if(fHistograms != NULL){
838 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
839 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
840 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
841 //fUpdateV0AlreadyCalled = kTRUE;
843 fCurrentV0IndexNumber++;
848 if( fCurrentNegativeESDTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentNegativeESDTrack->P()<fPIDMaxPnSigmaAbovePionLine){
849 if(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
850 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
851 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
853 if(fHistograms != NULL){
854 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
855 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
856 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
857 //fUpdateV0AlreadyCalled = kTRUE;
859 fCurrentV0IndexNumber++;
865 if( fCurrentPositiveESDTrack->P()>fPIDMaxPnSigmaAbovePionLine ){
866 if(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
867 fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
868 fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineHighPt){
870 if(fHistograms != NULL){
871 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
872 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
873 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
874 //fUpdateV0AlreadyCalled = kTRUE;
876 fCurrentV0IndexNumber++;
881 if( fCurrentNegativeESDTrack->P()>fPIDMaxPnSigmaAbovePionLine){
882 if(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
883 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
884 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineHighPt){
886 if(fHistograms != NULL){
887 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
888 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
889 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
890 //fUpdateV0AlreadyCalled = kTRUE;
892 fCurrentV0IndexNumber++;
899 fCFManager->GetParticleContainer()->Fill(containerInput,kStepdEdxPionrejection); // for CF
904 fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_KPl_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kKaon));
905 fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_KMi_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kKaon));
907 if(fDoKaonRejectionLowP == kTRUE){
908 if( fCurrentNegativeESDTrack->P()<fPIDMinPKaonRejectionLowP ){
909 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
910 if(fHistograms != NULL){
911 fHistograms->FillHistogram("ESD_CutKaonRejectionLowP_InvMass",GetMotherCandidateMass());
912 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
913 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
914 //fUpdateV0AlreadyCalled = kTRUE;
916 fCurrentV0IndexNumber++;
920 if( fCurrentPositiveESDTrack->P()<fPIDMinPKaonRejectionLowP ){
921 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
922 if(fHistograms != NULL){
923 fHistograms->FillHistogram("ESD_CutKaonRejectionLowP_InvMass",GetMotherCandidateMass());
924 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
925 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
926 //fUpdateV0AlreadyCalled = kTRUE;
928 fCurrentV0IndexNumber++;
934 fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_PPl_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kProton));
935 fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_PMi_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kKaon));
937 if(fDoProtonRejectionLowP == kTRUE){
938 if( fCurrentNegativeESDTrack->P()<fPIDMinPProtonRejectionLowP){
939 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
940 if(fHistograms != NULL){
941 fHistograms->FillHistogram("ESD_CutProtonRejectionLowP_InvMass",GetMotherCandidateMass());
942 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
943 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
944 //fUpdateV0AlreadyCalled = kTRUE;
946 fCurrentV0IndexNumber++;
950 if( fCurrentPositiveESDTrack->P()<fPIDMinPProtonRejectionLowP ){
951 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
952 if(fHistograms != NULL){
953 fHistograms->FillHistogram("ESD_CutProtonRejectionLowP_InvMass",GetMotherCandidateMass());
954 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
955 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
956 //fUpdateV0AlreadyCalled = kTRUE;
958 fCurrentV0IndexNumber++;
964 if(fDoPionRejectionLowP == kTRUE){
965 if( fCurrentNegativeESDTrack->P()<fPIDMinPPionRejectionLowP ){
966 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
967 if(fHistograms != NULL){
968 fHistograms->FillHistogram("ESD_CutPionRejectionLowP_InvMass",GetMotherCandidateMass());
969 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
970 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
971 //fUpdateV0AlreadyCalled = kTRUE;
973 fCurrentV0IndexNumber++;
977 if( fCurrentPositiveESDTrack->P()<fPIDMinPPionRejectionLowP ){
978 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
979 if(fHistograms != NULL){
980 fHistograms->FillHistogram("ESD_CutPionRejectionLowP_InvMass",GetMotherCandidateMass());
981 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
982 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
983 //fUpdateV0AlreadyCalled = kTRUE;
985 fCurrentV0IndexNumber++;
992 if( fDoTOFsigmaCut == kTRUE ){ // RRnewTOF start /////////////////////////////////////////////////////////////////////////////
993 Bool_t PosTrackNotTOFelec = kFALSE;
994 Bool_t NegTrackNotTOFelec = kFALSE;
995 if( (fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTOFpid) && !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTOFmismatch) ){
996 Double_t t0pos = fgESDpid->GetTOFResponse().GetStartTime(fCurrentPositiveESDTrack->P());
997 Double_t fnSigmaPos = fgESDpid->NumberOfSigmasTOF(fCurrentPositiveESDTrack, AliPID::kElectron, t0pos);
998 if( (fnSigmaPos>fTofPIDnSigmaAboveElectronLine) || (fnSigmaPos<fTofPIDnSigmaBelowElectronLine) ) PosTrackNotTOFelec = kTRUE;
1000 if( (fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTOFpid) && !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTOFmismatch) ){
1001 Double_t t0neg = fgESDpid->GetTOFResponse().GetStartTime(fCurrentNegativeESDTrack->P());
1002 Double_t fnSigmaNeg = fgESDpid->NumberOfSigmasTOF(fCurrentNegativeESDTrack, AliPID::kElectron, t0neg);
1003 if( (fnSigmaNeg>fTofPIDnSigmaAboveElectronLine) || (fnSigmaNeg<fTofPIDnSigmaBelowElectronLine) ) NegTrackNotTOFelec = kTRUE;
1005 if( (PosTrackNotTOFelec==kTRUE) || (NegTrackNotTOFelec==kTRUE) ){
1006 if(fHistograms != NULL){
1007 fHistograms->FillHistogram("ESD_CutTOFsigmaElec_InvMass",GetMotherCandidateMass());
1009 fCurrentV0IndexNumber++;
1012 } /////////////////////////////// RRnewTOF end ///////////////////////////////////////////////////////////////////////////////
1015 // Gamma selection based on QT from Armenteros
1016 if(fDoQtGammaSelection == kTRUE){ // RRnew start : apply different qT-cut above/below
1017 if(fDoHighPtQtGammaSelection){
1018 if(GetMotherCandidatePt() < fPtBorderForQt){
1019 if(armenterosQtAlfa[0]>fQtMax){
1020 if(fHistograms != NULL){
1021 fHistograms->FillHistogram("ESD_CutQt_InvMass",GetMotherCandidateMass());
1023 fCurrentV0IndexNumber++;
1027 if(armenterosQtAlfa[0]>fHighPtQtMax) {
1028 if(fHistograms != NULL){
1029 fHistograms->FillHistogram("ESD_CutQt_InvMass",GetMotherCandidateMass());
1031 fCurrentV0IndexNumber++;
1036 if(armenterosQtAlfa[0]>fQtMax){
1037 if(fHistograms != NULL){
1038 fHistograms->FillHistogram("ESD_CutQt_InvMass",GetMotherCandidateMass());
1040 fCurrentV0IndexNumber++;
1046 if(fDoPhotonAsymmetryCut == kTRUE){
1047 if( fNegativeTrackLorentzVector->P()>fMinPPhotonAsymmetryCut ){
1048 Double_t trackNegAsy=0;
1049 if (fCurrentMotherKFCandidate->GetP()!=0.){
1050 trackNegAsy= fNegativeTrackLorentzVector->P()/fMotherCandidateLorentzVector->P();
1052 if( trackNegAsy<fMinPhotonAsymmetry ||trackNegAsy>(1.- fMinPhotonAsymmetry)){
1053 if(fHistograms != NULL){
1054 fHistograms->FillHistogram("ESD_CutPhotonAsymmetry_InvMass",GetMotherCandidateMass());
1055 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1056 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1057 //fUpdateV0AlreadyCalled = kTRUE;
1059 fCurrentV0IndexNumber++;
1064 if( fPositiveTrackLorentzVector->P()>fMinPPhotonAsymmetryCut ){
1065 Double_t trackPosAsy=0;
1066 if (fCurrentMotherKFCandidate->GetP()!=0.){
1067 trackPosAsy= fPositiveTrackLorentzVector->P()/fMotherCandidateLorentzVector->P();
1069 if( trackPosAsy<fMinPhotonAsymmetry ||trackPosAsy>(1.- fMinPhotonAsymmetry)){
1070 if(fHistograms != NULL){
1071 fHistograms->FillHistogram("ESD_CutPhotonAsymmetry_InvMass",GetMotherCandidateMass());
1072 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1073 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1074 //fUpdateV0AlreadyCalled = kTRUE;
1076 fCurrentV0IndexNumber++;
1081 //checks if we have a prim vertex
1082 //if(fESDEvent->GetPrimaryVertex()->GetNContributors()<=0) {
1083 if(GetNumberOfContributorsVtx()<=0) {
1084 if(fHistograms != NULL){
1085 fHistograms->FillHistogram("ESD_CutNContributors_InvMass",GetMotherCandidateMass());
1087 fCurrentV0IndexNumber++;
1091 fCFManager->GetParticleContainer()->Fill(containerInput,kStepNContributors); // for CF
1094 //Check the pid probability
1095 if(CheckPIDProbability(fPIDProbabilityCutNegativeParticle,fPIDProbabilityCutPositiveParticle)==kFALSE){
1096 if(fHistograms != NULL){
1097 fHistograms->FillHistogram("ESD_CutPIDProb_InvMass",GetMotherCandidateMass());
1099 fCurrentV0IndexNumber++;
1103 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCPID); // for CF
1107 /* Moved further up so corr framework can work
1108 if(UpdateV0Information() == kFALSE){
1109 fCurrentV0IndexNumber++;
1113 if(fCurrentNegativeESDTrack->GetNcls(1) < fMinClsTPC || fCurrentPositiveESDTrack->GetNcls(1) < fMinClsTPC ){
1114 if(fHistograms != NULL){
1115 fHistograms->FillHistogram("ESD_CutMinNClsTPC_InvMass",GetMotherCandidateMass());
1117 fCurrentV0IndexNumber++;
1121 fCFManager->GetParticleContainer()->Fill(containerInput,kStepMinClsTPC); // for CF
1123 Double_t negclsToF = 0.;
1124 if (!fUseCorrectedTPCClsInfo ){
1125 if(fCurrentNegativeESDTrack->GetTPCNclsF()!=0 ){
1126 negclsToF = (Double_t)fCurrentNegativeESDTrack->GetNcls(1)/(Double_t)fCurrentNegativeESDTrack->GetTPCNclsF();
1129 negclsToF = fCurrentNegativeESDTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(GetXYRadius()));
1132 Double_t posclsToF = 0.;
1133 if (!fUseCorrectedTPCClsInfo ){
1134 if(fCurrentPositiveESDTrack->GetTPCNclsF()!=0 ){
1135 posclsToF = (Double_t)fCurrentPositiveESDTrack->GetNcls(1)/(Double_t)fCurrentPositiveESDTrack->GetTPCNclsF();
1138 posclsToF = fCurrentPositiveESDTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(GetXYRadius()));
1141 if( negclsToF < fMinClsTPCToF || posclsToF < fMinClsTPCToF ){
1142 if(fHistograms != NULL){
1143 fHistograms->FillHistogram("ESD_CutMinNClsTPCToF_InvMass",GetMotherCandidateMass());
1145 fCurrentV0IndexNumber++;
1155 if( fCurrentNegativeKFParticle->GetPt()< fSinglePtCut || fCurrentPositiveKFParticle->GetPt()< fSinglePtCut){
1156 if(fHistograms != NULL){
1157 fHistograms->FillHistogram("ESD_CutSinglePt_InvMass",GetMotherCandidateMass());
1159 fCurrentV0IndexNumber++;
1163 fCFManager->GetParticleContainer()->Fill(containerInput,kStepSinglePt); // for CF
1167 if(fCurrentMotherKFCandidate->GetNDF()<=0){
1168 if(fHistograms != NULL){
1169 fHistograms->FillHistogram("ESD_CutNDF_InvMass",GetMotherCandidateMass());
1171 fCurrentV0IndexNumber++;
1175 fCFManager->GetParticleContainer()->Fill(containerInput,kStepNDF); // for CF
1178 Double_t chi2V0 = fCurrentMotherKFCandidate->GetChi2()/fCurrentMotherKFCandidate->GetNDF();
1179 if(chi2V0 > fChi2CutConversion || chi2V0 <=0){
1180 if(fHistograms != NULL){
1181 fHistograms->FillHistogram("ESD_CutChi2_InvMass",GetMotherCandidateMass());
1183 fCurrentV0IndexNumber++;
1187 fCFManager->GetParticleContainer()->Fill(containerInput,kStepChi2); // for CF
1191 fCFManager->GetParticleContainer()->Fill(containerInput,kStepEta); // for CF
1194 if(fMotherCandidateLorentzVector->Pt()<fPtCut){
1195 if(fHistograms != NULL){
1196 fHistograms->FillHistogram("ESD_CutPt_InvMass",GetMotherCandidateMass());
1198 fCurrentV0IndexNumber++;
1202 fCFManager->GetParticleContainer()->Fill(containerInput,kStepPt); // for CF
1206 else if(fUseESDTrack){
1210 if(fHistograms != NULL){
1211 fHistograms->FillHistogram("ESD_GoodV0s_InvMass",GetMotherCandidateMass());
1214 // fCurrentEventGoodV0s.push_back(*fCurrentMotherKFCandidate);
1216 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
1217 fCurrentMotherKFCandidate->E()=fCurrentMotherKFCandidate->GetP();
1220 if(fDoMC&& fUseMCPSmearing>0){
1221 SmearKFParticle(fCurrentMotherKFCandidate);
1225 new((*fCurrentEventGoodV0s)[fCurrentEventGoodV0s->GetEntriesFast()]) AliKFParticle(*fCurrentMotherKFCandidate);
1226 fV0Pindex.push_back(fCurrentV0->GetPindex());
1227 fV0Nindex.push_back(fCurrentV0->GetNindex());
1229 iResult=kTRUE;//means we have a v0 who survived all the cuts applied
1233 fCurrentV0IndexNumber++;
1240 Bool_t AliV0Reader::UpdateV0Information(){
1241 //see header file for documentation
1243 Bool_t iResult=kTRUE; // for taking out not refitted, kinks and like sign tracks
1245 Bool_t switchTracks = kFALSE;
1247 fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
1248 fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
1251 if(fCurrentPositiveESDTrack->GetSign() == -1 && fCurrentNegativeESDTrack->GetSign() == 1){ // switch wrong signed tracks
1252 fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
1253 fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
1254 switchTracks = kTRUE;
1258 if(fCurrentNegativeKFParticle != NULL){
1259 delete fCurrentNegativeKFParticle;
1261 if(switchTracks == kFALSE){
1262 fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fNegativeTrackPID);
1265 fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fNegativeTrackPID);
1268 if(fCurrentPositiveKFParticle != NULL){
1269 delete fCurrentPositiveKFParticle;
1271 if(switchTracks == kFALSE){
1272 fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fPositiveTrackPID);
1275 fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fPositiveTrackPID);
1278 if(fCurrentMotherKFCandidate != NULL){
1279 delete fCurrentMotherKFCandidate;
1282 if(fUseConstructGamma==kTRUE){
1283 fCurrentMotherKFCandidate = new AliKFParticle;//(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
1284 fCurrentMotherKFCandidate->ConstructGamma(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
1286 fCurrentMotherKFCandidate = new AliKFParticle(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
1287 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
1288 fCurrentMotherKFCandidate->SetMassConstraint(0,fNSigmaMass);
1291 if(fUseImprovedVertex == kTRUE){
1292 AliKFVertex primaryVertexImproved(*GetPrimaryVertex());
1293 primaryVertexImproved+=*fCurrentMotherKFCandidate;
1294 fCurrentMotherKFCandidate->SetProductionVertex(primaryVertexImproved);
1297 fCurrentMotherKFCandidate->GetMass(fMotherCandidateKFMass,fMotherCandidateKFWidth);
1299 if(fNegativeTrackLorentzVector != NULL){
1300 delete fNegativeTrackLorentzVector;
1303 fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeKFParticle->Px(),fCurrentNegativeKFParticle->Py(),fCurrentNegativeKFParticle->Pz());
1305 else { //if(fUseESDTrack){
1306 fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeESDTrack->Px(),fCurrentNegativeESDTrack->Py(),fCurrentNegativeESDTrack->Pz());
1309 if(fPositiveTrackLorentzVector != NULL){
1310 delete fPositiveTrackLorentzVector;
1313 fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveKFParticle->Px(),fCurrentPositiveKFParticle->Py(),fCurrentPositiveKFParticle->Pz());
1315 else { // if(fUseESDTrack){ fPositiveTrackLorentzVector must be reinitialized, so assuming use ESD if not kfparticle Svein.
1316 fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveESDTrack->Px(),fCurrentPositiveESDTrack->Py(),fCurrentPositiveESDTrack->Pz());
1319 if(fMotherCandidateLorentzVector != NULL){
1320 delete fMotherCandidateLorentzVector;
1323 fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);
1325 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
1326 fMotherCandidateLorentzVector->SetXYZM(fMotherCandidateLorentzVector->Px() ,fMotherCandidateLorentzVector->Py(),fMotherCandidateLorentzVector->Pz(),0.);
1331 fMotherMCParticle= NULL;
1332 if(switchTracks == kFALSE){
1333 fNegativeMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel()));
1334 fPositiveMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel()));
1336 fNegativeMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel()));
1337 fPositiveMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel()));
1340 if(fPositiveMCParticle->GetMother(0)>-1){
1341 fMotherMCParticle = fMCStack->Particle(fPositiveMCParticle->GetMother(0));
1350 // Double_t containerInput[3];
1352 // containerInput[0] = GetMotherCandidatePt();
1353 // containerInput[1] = GetMotherCandidateEta();
1354 // containerInput[2] = GetMotherCandidateMass();
1356 // fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF
1357 // fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF
1358 // fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF
1362 if(fUseOwnXYZCalculation == kFALSE){
1363 if(fUseConstructGamma == kFALSE){
1364 fCurrentV0->GetXYZ(fCurrentXValue,fCurrentYValue,fCurrentZValue);
1366 fCurrentXValue=GetMotherCandidateKFCombination()->GetX();
1367 fCurrentYValue=GetMotherCandidateKFCombination()->GetY();
1368 fCurrentZValue=GetMotherCandidateKFCombination()->GetZ();
1372 Double_t convpos[2]; //Double_t convpos[3];
1377 GetConvPosXY(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField(),convpos);
1379 /*if(switchTracks == kFALSE){
1380 GetConversionPoint((fCurrentV0->GetParamP()),(fCurrentV0->GetParamN()),convpos);
1382 GetConversionPoint((fCurrentV0->GetParamN()),(fCurrentV0->GetParamP()),convpos);
1385 fCurrentXValue = convpos[0];
1386 fCurrentYValue = convpos[1];
1387 // fCurrentZValue = convpos[2];
1388 fCurrentZValue = GetConvPosZ(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField());
1391 if(fCurrentNegativeESDTrack->GetSign() == fCurrentPositiveESDTrack->GetSign()){ // avoid like sign
1393 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE){
1394 fHistograms->FillHistogram("ESD_CutLikeSign_InvMass",GetMotherCandidateMass());
1395 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1396 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1397 fUpdateV0AlreadyCalled = kTRUE;
1401 if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ||
1402 !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ){
1403 // if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kITSrefit) ||
1404 // !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kITSrefit) ){
1406 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE){
1407 fHistograms->FillHistogram("ESD_CutRefit_InvMass",GetMotherCandidateMass());
1408 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1409 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1410 fUpdateV0AlreadyCalled = kTRUE;
1414 if( fCurrentNegativeESDTrack->GetKinkIndex(0) > 0 ||
1415 fCurrentPositiveESDTrack->GetKinkIndex(0) > 0) {
1418 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE ){
1419 fHistograms->FillHistogram("ESD_CutKink_InvMass",GetMotherCandidateMass());
1420 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1421 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1422 fUpdateV0AlreadyCalled = kTRUE;
1426 if(fDodEdxSigmaCut == kTRUE){
1428 if( fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
1429 fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ||
1430 fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
1431 fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ){
1433 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE){
1434 fHistograms->FillHistogram("ESD_CutdEdxSigmaElectronLine_InvMass",GetMotherCandidateMass());
1435 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1436 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1437 fUpdateV0AlreadyCalled = kTRUE;
1440 if( fCurrentPositiveESDTrack->P()>fPIDMinPnSigmaAbovePionLine){
1441 if(fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1442 fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
1443 fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
1445 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE){
1446 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
1447 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1448 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1449 fUpdateV0AlreadyCalled = kTRUE;
1454 if( fCurrentNegativeESDTrack->P()>fPIDMinPnSigmaAbovePionLine){
1455 if(fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1456 fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
1457 fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
1459 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE ){
1460 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
1461 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1462 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1463 fUpdateV0AlreadyCalled = kTRUE;
1469 fUpdateV0AlreadyCalled = kTRUE;
1476 Bool_t AliV0Reader::HasSameMCMother(){
1477 //see header file for documentation
1479 Bool_t iResult = kFALSE;
1481 if(fNegativeMCParticle != NULL && fPositiveMCParticle != NULL){
1482 if(fNegativeMCParticle->GetMother(0) == fPositiveMCParticle->GetMother(0))
1483 if(fMotherMCParticle){
1491 Bool_t AliV0Reader::CheckPIDProbability(Double_t negProbCut, Double_t posProbCut){
1492 //see header file for documentation
1494 Bool_t iResult=kFALSE;
1496 // Double_t *posProbArray = new Double_t[10];
1497 // Double_t *negProbArray = new Double_t[10];
1498 //-AM The TPCpid method expects an array of length kSPECIES that is 5 not 10
1500 Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1501 Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1503 AliESDtrack* negTrack = GetNegativeESDTrack();
1504 AliESDtrack* posTrack = GetPositiveESDTrack();
1505 //fESDEvent->GetTrack(fCurrentV0->GetNindex());
1506 //fESDEvent->GetTrack(fCurrentV0->GetPindex());
1507 //-AM for switchtracks==true the above is a bug
1509 if(negProbArray && posProbArray){
1511 negTrack->GetTPCpid(negProbArray);
1512 posTrack->GetTPCpid(posProbArray);
1514 // if(negProbArray != NULL && posProbArray != NULL){ // this is not allowed anymore for some reason(RC19)
1515 if(negProbArray[GetSpeciesIndex(-1)]>=negProbCut && posProbArray[GetSpeciesIndex(1)]>=posProbCut){
1519 delete [] posProbArray;
1520 delete [] negProbArray;
1524 void AliV0Reader::GetPIDProbability(Double_t &negPIDProb,Double_t & posPIDProb){
1525 // see header file for documentation
1527 //Double_t *posProbArray = new Double_t[10];
1528 // Double_t *negProbArray = new Double_t[10];
1529 //-AM The TPCpid method expects an array of length kSPECIES that is 5 not 10
1530 Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1531 Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1533 // AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
1534 // AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
1535 //-AM for switchtracks the above is a bug
1536 AliESDtrack* negTrack = GetNegativeESDTrack();
1537 AliESDtrack* posTrack = GetPositiveESDTrack();
1539 if(negProbArray && posProbArray){
1540 negTrack->GetTPCpid(negProbArray);
1541 posTrack->GetTPCpid(posProbArray);
1543 // if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19)
1544 negPIDProb = negProbArray[GetSpeciesIndex(-1)];
1545 posPIDProb = posProbArray[GetSpeciesIndex(1)];
1547 delete [] posProbArray;
1548 delete [] negProbArray;
1551 void AliV0Reader::GetPIDProbabilityMuonPion(Double_t &negPIDProb,Double_t & posPIDProb){
1552 // see header file for documentation
1555 Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1556 Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1558 // AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
1559 // AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
1560 //-AM for switchtracks the above is a bug
1562 AliESDtrack* negTrack = GetNegativeESDTrack();
1563 AliESDtrack* posTrack = GetPositiveESDTrack();
1565 if(negProbArray && posProbArray){
1566 negTrack->GetTPCpid(negProbArray);
1567 posTrack->GetTPCpid(posProbArray);
1569 // if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19)
1571 negPIDProb = negProbArray[1]+negProbArray[2];
1572 posPIDProb = posProbArray[1]+posProbArray[2];
1574 delete [] posProbArray;
1575 delete [] negProbArray;
1578 void AliV0Reader::UpdateEventByEventData(){
1579 //see header file for documentation
1580 if(fCurrentEventGoodV0s->GetEntriesFast() >0 ){
1581 if(fCalculateBackground){
1582 if(fUseChargedTrackMultiplicityForBG == kTRUE){
1583 fBGEventHandler->AddEvent(fCurrentEventGoodV0s,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
1584 //filling z and multiplicity histograms
1585 fHistograms->FillHistogram("ESD_Z_distribution",fESDEvent->GetPrimaryVertex()->GetZ());
1586 fHistograms->FillHistogram("ESD_multiplicity_distribution",CountESDTracks());
1587 fHistograms->FillHistogram("ESD_ZvsMultiplicity",fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
1589 else{ // means we use #V0s for multiplicity
1590 fBGEventHandler->AddEvent(fCurrentEventGoodV0s,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s);
1591 //filling z and multiplicity histograms
1592 fHistograms->FillHistogram("ESD_Z_distribution",fESDEvent->GetPrimaryVertex()->GetZ());
1593 fHistograms->FillHistogram("ESD_multiplicity_distribution",fNumberOfGoodV0s);
1594 fHistograms->FillHistogram("ESD_ZvsMultiplicity",fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s);
1598 fCurrentEventGoodV0s->Delete();
1599 fCurrentV0IndexNumber=0;
1600 fNumberOfESDTracks=0;
1607 // fBGEventHandler->PrintBGArray(); // for debugging
1611 Double_t AliV0Reader::GetNegativeTrackPhi() const{
1612 //see header file for documentation
1615 if(fNegativeTrackLorentzVector->Phi()> TMath::Pi()){
1616 offset = -2*TMath::Pi();
1618 return fNegativeTrackLorentzVector->Phi()+offset;
1621 Double_t AliV0Reader::GetPositiveTrackPhi() const{
1622 //see header file for documentation
1625 if(fPositiveTrackLorentzVector->Phi()> TMath::Pi()){
1626 offset = -2*TMath::Pi();
1628 return fPositiveTrackLorentzVector->Phi()+offset;
1631 Double_t AliV0Reader::GetMotherCandidatePhi() const{
1632 //see header file for documentation
1635 if(fMotherCandidateLorentzVector->Phi()> TMath::Pi()){
1636 offset = -2*TMath::Pi();
1638 return fMotherCandidateLorentzVector->Phi()+offset;
1642 Double_t AliV0Reader::GetMotherCandidateRapidity() const{
1643 //see header file for documentation
1645 Double_t rapidity=0;
1646 if(fMotherCandidateLorentzVector->Energy() - fMotherCandidateLorentzVector->Pz() == 0 || fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz() == 0) rapidity=0;
1647 else rapidity = 0.5*(TMath::Log((fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz()) / (fMotherCandidateLorentzVector->Energy()-fMotherCandidateLorentzVector->Pz())));
1656 Int_t AliV0Reader::GetSpeciesIndex(Int_t chargeOfTrack){
1657 //see header file for documentation
1659 Int_t iResult = 10; // Unknown particle
1661 if(chargeOfTrack==-1){ //negative track
1662 switch(abs(fNegativeTrackPID)){
1684 case 2112: //neutron
1691 //Put in here for kSPECIES::kEleCon ????
1694 else if(chargeOfTrack==1){ //positive track
1695 switch(abs(fPositiveTrackPID)){
1717 case 2112: //neutron
1724 //Put in here for kSPECIES::kEleCon ????
1728 //Wrong parameter.. Print warning
1733 Bool_t AliV0Reader::GetHelixCenter(AliESDtrack* track, Double_t b,Int_t charge, Double_t center[2]){
1734 // Bool_t AliV0Reader::GetHelixCenter(const AliExternalTrackParam *track, Double_t b,Int_t charge, Double_t center[2]){
1735 // see header file for documentation
1737 Double_t pi = 3.14159265358979323846;
1740 track->GetHelixParameters(helix,b);
1742 Double_t xpos = helix[5];
1743 Double_t ypos = helix[0];
1744 Double_t radius = TMath::Abs(1./helix[4]);
1745 Double_t phi = helix[2];
1752 Double_t xpoint = radius * TMath::Cos(phi);
1753 Double_t ypoint = radius * TMath::Sin(phi);
1768 center[0] = xpos + xpoint;
1769 center[1] = ypos + ypoint;
1774 /*void AliV0Reader::GetConversionPoint(const AliExternalTrackParam *pparam,const AliExternalTrackParam *nparam,Double_t convpos[3]){
1776 Double_t helixcenterpos[2];
1777 GetHelixCenter(pparam,GetMagneticField(),pparam->Charge(),helixcenterpos);
1779 Double_t helixcenterneg[2];
1780 GetHelixCenter(nparam,GetMagneticField(),nparam->Charge(),helixcenterneg);
1782 Double_t helixpos[6];
1783 pparam->GetHelixParameters(helixpos,GetMagneticField());
1784 Double_t posradius = TMath::Abs(1./helixpos[4]);
1786 Double_t helixneg[6];
1787 nparam->GetHelixParameters(helixneg,GetMagneticField());
1788 Double_t negradius = TMath::Abs(1./helixneg[4]);
1790 // Calculate xy-position
1792 Double_t xpos = helixcenterpos[0];
1793 Double_t ypos = helixcenterpos[1];
1794 Double_t xneg = helixcenterneg[0];
1795 Double_t yneg = helixcenterneg[1];
1797 convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
1798 convpos[1] = (ypos*negradius + yneg*posradius)/(negradius+posradius);
1801 // Calculate z-position
1803 Double_t deltaXPos = convpos[0] - xpos;
1804 Double_t deltaYPos = convpos[1] - ypos;
1806 Double_t deltaXNeg = convpos[0] - xneg;
1807 Double_t deltaYNeg = convpos[1] - yneg;
1809 Double_t alphaPos = TMath::Pi() + TMath::ATan2(-deltaYPos,-deltaXPos);
1810 Double_t alphaNeg = TMath::Pi() + TMath::ATan2(-deltaYNeg,-deltaXNeg);
1811 Double_t vertexXNeg = xneg + TMath::Abs(negradius)*TMath::Cos(alphaNeg);
1812 Double_t vertexYNeg = yneg + TMath::Abs(negradius)*TMath::Sin(alphaNeg);
1814 Double_t vertexXPos = xpos + TMath::Abs(posradius)*TMath::Cos(alphaPos);
1815 Double_t vertexYPos = ypos + TMath::Abs(posradius)*TMath::Sin(alphaPos);
1817 Double_t x0neg = helixneg[5];
1818 Double_t y0neg = helixneg[0];
1820 Double_t x0pos = helixpos[5];
1821 Double_t y0pos = helixpos[0];
1823 Double_t dNeg = TMath::Sqrt((vertexXNeg - x0neg)*(vertexXNeg - x0neg)+(vertexYNeg - y0neg)*(vertexYNeg - y0neg));
1825 Double_t dPos = TMath::Sqrt((vertexXPos - x0pos)*(vertexXPos - x0pos)+(vertexYPos - y0pos)*(vertexYPos - y0pos));
1827 Double_t rNeg = TMath::Sqrt(negradius*negradius - dNeg*dNeg/4.);
1829 Double_t rPos = TMath::Sqrt(posradius*posradius - dPos*dPos/4.);
1831 Double_t deltabetaNeg = 2*(TMath::Pi() + TMath::ATan2(-dNeg/2.,-rNeg));
1832 Double_t deltabetaPos = 2*(TMath::Pi() + TMath::ATan2(-dPos/2.,-rPos));
1834 Double_t deltaUNeg = negradius*deltabetaNeg;
1835 Double_t deltaUPos = posradius*deltabetaPos;
1837 Double_t zphaseNeg = nparam->GetZ() + deltaUNeg * nparam->GetTgl();
1838 Double_t zphasePos = pparam->GetZ() + deltaUPos * pparam->GetTgl();
1840 convpos[2] = (zphasePos*negradius+zphaseNeg*posradius)/(negradius+posradius);
1846 Bool_t AliV0Reader::GetConvPosXY(AliESDtrack* ptrack, AliESDtrack* ntrack, Double_t b, Double_t convpos[2]){
1847 //see header file for documentation
1849 Double_t helixcenterpos[2];
1850 GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
1852 Double_t helixcenterneg[2];
1853 GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
1855 Double_t poshelix[6];
1856 ptrack->GetHelixParameters(poshelix,b);
1857 Double_t posradius = TMath::Abs(1./poshelix[4]);
1859 Double_t neghelix[6];
1860 ntrack->GetHelixParameters(neghelix,b);
1861 Double_t negradius = TMath::Abs(1./neghelix[4]);
1863 Double_t xpos = helixcenterpos[0];
1864 Double_t ypos = helixcenterpos[1];
1865 Double_t xneg = helixcenterneg[0];
1866 Double_t yneg = helixcenterneg[1];
1868 convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
1869 convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius);
1876 Double_t AliV0Reader::GetConvPosZ(AliESDtrack* ptrack,AliESDtrack* ntrack, Double_t b){
1877 //see header file for documentation
1879 Double_t helixpos[6];
1880 ptrack->GetHelixParameters(helixpos,b);
1882 Double_t helixneg[6];
1883 ntrack->GetHelixParameters(helixneg,b);
1885 Double_t negtrackradius = TMath::Abs(1./helixneg[4]);
1886 Double_t postrackradius = TMath::Abs(1./helixpos[4]);
1888 Double_t pi = 3.14159265358979323846;
1890 Double_t convpos[2];
1891 GetConvPosXY(ptrack,ntrack,b,convpos);
1893 Double_t convposx = convpos[0];
1894 Double_t convposy = convpos[1];
1896 Double_t helixcenterpos[2];
1897 GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
1899 Double_t helixcenterneg[2];
1900 GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
1902 Double_t xpos = helixcenterpos[0];
1903 Double_t ypos = helixcenterpos[1];
1904 Double_t xneg = helixcenterneg[0];
1905 Double_t yneg = helixcenterneg[1];
1907 Double_t deltaXPos = convposx - xpos;
1908 Double_t deltaYPos = convposy - ypos;
1910 Double_t deltaXNeg = convposx - xneg;
1911 Double_t deltaYNeg = convposy - yneg;
1913 Double_t alphaPos = pi + TMath::ATan2(-deltaYPos,-deltaXPos);
1914 Double_t alphaNeg = pi + TMath::ATan2(-deltaYNeg,-deltaXNeg);
1916 Double_t vertexXNeg = xneg + TMath::Abs(negtrackradius)*
1917 TMath::Cos(alphaNeg);
1918 Double_t vertexYNeg = yneg + TMath::Abs(negtrackradius)*
1919 TMath::Sin(alphaNeg);
1921 Double_t vertexXPos = xpos + TMath::Abs(postrackradius)*
1922 TMath::Cos(alphaPos);
1923 Double_t vertexYPos = ypos + TMath::Abs(postrackradius)*
1924 TMath::Sin(alphaPos);
1926 Double_t x0neg = helixneg[5];
1927 Double_t y0neg = helixneg[0];
1929 Double_t x0pos = helixpos[5];
1930 Double_t y0pos = helixpos[0];
1932 Double_t dNeg = TMath::Sqrt((vertexXNeg - x0neg)*(vertexXNeg - x0neg)
1933 +(vertexYNeg - y0neg)*(vertexYNeg - y0neg));
1935 Double_t dPos = TMath::Sqrt((vertexXPos - x0pos)*(vertexXPos - x0pos)
1936 +(vertexYPos - y0pos)*(vertexYPos - y0pos));
1938 Double_t rNeg = TMath::Sqrt(negtrackradius*negtrackradius -
1941 Double_t rPos = TMath::Sqrt(postrackradius*postrackradius -
1944 Double_t deltabetaNeg = 2*(pi + TMath::ATan2(-dNeg/2.,-rNeg));
1945 Double_t deltabetaPos = 2*(pi + TMath::ATan2(-dPos/2.,-rPos));
1947 Double_t deltaUNeg = negtrackradius*deltabetaNeg;
1948 Double_t deltaUPos = postrackradius*deltabetaPos;
1950 Double_t zphaseNeg = ntrack->GetZ() + deltaUNeg * ntrack->GetTgl();
1951 Double_t zphasePos = ptrack->GetZ() + deltaUPos * ptrack->GetTgl();
1953 Double_t convposz = (zphasePos*negtrackradius+zphaseNeg*postrackradius)/(negtrackradius+postrackradius);
1958 AliGammaConversionKFVector* AliV0Reader::GetBGGoodV0s(Int_t /*event*/) const{
1960 if(fUseChargedTrackMultiplicityForBG == kTRUE){
1961 return fBGEventHandler->GetBGGoodV0s(event,fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
1963 else{ // means we use #v0s as multiplicity
1964 return fBGEventHandler->GetBGGoodV0s(event,fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s);
1970 Int_t AliV0Reader::CountESDTracks(){
1971 // see header file for documentation
1972 if(fNumberOfESDTracks == 0){ // count the good esd tracks
1973 for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){
1974 AliESDtrack* curTrack = fESDEvent->GetTrack(iTracks);
1978 if(fEsdTrackCuts->AcceptTrack(curTrack) ){
1979 fNumberOfESDTracks++;
1984 return fNumberOfESDTracks;
1987 Bool_t AliV0Reader::CheckIfPi0IsMother(Int_t label){
1988 // see headerfile for documentation
1989 Bool_t iResult=kFALSE;
1990 // cout<<"Checking particle label, particle is: "<<fMCStack->Particle(TMath::Abs(label))->GetName()<<endl;
1991 if(fMCStack->Particle(TMath::Abs(label))->GetPdgCode() == 111){
1997 Bool_t AliV0Reader::CheckIfEtaIsMother(Int_t label){
1998 // see headerfile for documentation
1999 Bool_t iResult=kFALSE;
2000 // cout<<"Checking particle label, particle is: "<<fMCStack->Particle(TMath::Abs(label))->GetName()<<endl;
2001 if(fMCStack->Particle(TMath::Abs(label))->GetPdgCode() == 221){
2008 Bool_t AliV0Reader::GetArmenterosQtAlfa(const AliKFParticle* negativeKFParticle, const AliKFParticle * positiveKFParticle, const AliKFParticle * gammaKFCandidate, Double_t armenterosQtAlfa[2] ){
2009 //see header file for documentation
2011 TVector3 momentumVectorPositiveKF(positiveKFParticle->GetPx(),positiveKFParticle->GetPy(),positiveKFParticle->GetPz());
2012 TVector3 momentumVectorNegativeKF(negativeKFParticle->GetPx(),negativeKFParticle->GetPy(),negativeKFParticle->GetPz());
2013 TVector3 vecV0(gammaKFCandidate->GetPx(),gammaKFCandidate->GetPy(),gammaKFCandidate->GetPz());
2015 Float_t thetaV0pos=TMath::ACos(( momentumVectorPositiveKF* vecV0)/(momentumVectorPositiveKF.Mag() * vecV0.Mag()));
2016 Float_t thetaV0neg=TMath::ACos(( momentumVectorNegativeKF* vecV0)/(momentumVectorNegativeKF.Mag() * vecV0.Mag()));
2018 Float_t alfa =((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)-(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg))/
2019 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
2022 Float_t qt = momentumVectorPositiveKF.Mag()*TMath::Sin(thetaV0pos);
2024 armenterosQtAlfa[0]=qt;
2025 armenterosQtAlfa[1]=alfa;
2031 Bool_t AliV0Reader::GetArmenterosQtAlfa(const TParticle* negativeParticle, const TParticle * positiveParticle, const AliKFParticle * gammaKFCandidate, Double_t armenterosQtAlfa[2] ){
2032 //see header file for documentation
2034 TVector3 momentumVectorPositiveKF(positiveParticle->Px(),positiveParticle->Py(),positiveParticle->Pz());
2035 TVector3 momentumVectorNegativeKF(negativeParticle->Px(),negativeParticle->Py(),negativeParticle->Pz());
2036 TVector3 vecV0(gammaKFCandidate->GetPx(),gammaKFCandidate->GetPy(),gammaKFCandidate->GetPz());
2038 Float_t thetaV0pos=TMath::ACos(( momentumVectorPositiveKF* vecV0)/(momentumVectorPositiveKF.Mag() * vecV0.Mag()));
2039 Float_t thetaV0neg=TMath::ACos(( momentumVectorNegativeKF* vecV0)/(momentumVectorNegativeKF.Mag() * vecV0.Mag()));
2043 if ( positiveParticle->GetPdgCode() == 11 || positiveParticle->GetPdgCode() == 13 || positiveParticle->GetPdgCode() == 15){
2044 alfa =((momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)-(momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos))/
2045 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
2046 qt = momentumVectorNegativeKF.Mag()*TMath::Sin(thetaV0neg);
2047 } else if ( negativeParticle->GetPdgCode() == -11 || negativeParticle->GetPdgCode() == -13 || negativeParticle->GetPdgCode() == -15){
2048 alfa =((momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)-(momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos))/
2049 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
2050 qt = momentumVectorNegativeKF.Mag()*TMath::Sin(thetaV0neg);
2051 } else if (positiveParticle->GetPdgCode() < 0 && positiveParticle->GetPdgCode() != -11 && positiveParticle->GetPdgCode() != -13 && positiveParticle->GetPdgCode() != -15 ){
2052 alfa =((momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)-(momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos))/
2053 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
2054 qt = momentumVectorNegativeKF.Mag()*TMath::Sin(thetaV0neg);
2056 alfa =((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)-(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg))/
2057 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
2058 qt = momentumVectorPositiveKF.Mag()*TMath::Sin(thetaV0pos);
2061 armenterosQtAlfa[0]=qt;
2062 armenterosQtAlfa[1]=alfa;
2067 Bool_t AliV0Reader::GetArmenterosQtAlfa(const TParticle* negativeParticle, const TParticle * positiveParticle, const TParticle * gammaCandidate, Double_t armenterosQtAlfa[2] ){
2068 //see header file for documentation
2070 TVector3 momentumVectorPositiveKF(positiveParticle->Px(),positiveParticle->Py(),positiveParticle->Pz());
2071 TVector3 momentumVectorNegativeKF(negativeParticle->Px(),negativeParticle->Py(),negativeParticle->Pz());
2072 TVector3 vecV0(gammaCandidate->Px(),gammaCandidate->Py(),gammaCandidate->Pz());
2074 Float_t thetaV0pos=TMath::ACos(( momentumVectorPositiveKF* vecV0)/(momentumVectorPositiveKF.Mag() * vecV0.Mag()));
2075 Float_t thetaV0neg=TMath::ACos(( momentumVectorNegativeKF* vecV0)/(momentumVectorNegativeKF.Mag() * vecV0.Mag()));
2079 if ( positiveParticle->GetPdgCode() == 11 || positiveParticle->GetPdgCode() == 13 || positiveParticle->GetPdgCode() == 15){
2080 alfa =((momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)-(momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos))/
2081 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
2082 qt = momentumVectorNegativeKF.Mag()*TMath::Sin(thetaV0neg);
2083 } else if ( negativeParticle->GetPdgCode() == -11 || negativeParticle->GetPdgCode() == -13 || negativeParticle->GetPdgCode() == -15){
2084 alfa =((momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)-(momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos))/
2085 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
2086 qt = momentumVectorNegativeKF.Mag()*TMath::Sin(thetaV0neg);
2087 } else if (positiveParticle->GetPdgCode() < 0 && positiveParticle->GetPdgCode() != -11 && positiveParticle->GetPdgCode() != -13 && positiveParticle->GetPdgCode() != -15 ){
2088 alfa =((momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)-(momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos))/
2089 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
2090 qt = momentumVectorNegativeKF.Mag()*TMath::Sin(thetaV0neg);
2092 alfa =((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)-(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg))/
2093 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
2094 qt = momentumVectorPositiveKF.Mag()*TMath::Sin(thetaV0pos);
2097 armenterosQtAlfa[0]=qt;
2098 armenterosQtAlfa[1]=alfa;
2104 Int_t AliV0Reader::GetFirstTPCRow(Double_t radius){
2107 Int_t firstTPCRow=0;
2108 Double_t radiusI = 84.8;
2109 Double_t radiusO = 134.6;
2110 Double_t radiusOB = 198.;
2111 Double_t rSizeI = 0.75;
2112 Double_t rSizeO = 1.;
2113 Double_t rSizeOB = 1.5;
2117 if(radius <= radiusI){
2120 if(radius>radiusI && radius<=radiusO){
2121 firstTPCRow = (Int_t)((radius-radiusI)/rSizeI);
2123 if(radius>radiusO && radius<=radiusOB){
2124 firstTPCRow = (Int_t)(nClsI+(radius-radiusO)/rSizeO);
2127 if(radius>radiusOB){
2128 firstTPCRow =(Int_t)(nClsIO+(radius-radiusOB)/rSizeOB);
2134 void AliV0Reader::SmearKFParticle(AliKFParticle * kfParticle)
2136 Double_t facPBrem = 1.;
2137 Double_t facPSig = 0.;
2143 P=kfParticle->GetP();
2144 phi=kfParticle->GetPhi();
2145 if( kfParticle->GetP()!=0){
2146 theta=acos( kfParticle->Pz()/ kfParticle->GetP());
2149 if( fPSigSmearing != 0. || fPSigSmearingCte!=0. ){
2150 facPSig = TMath::Sqrt(fPSigSmearingCte*fPSigSmearingCte+fPSigSmearing*fPSigSmearing*P*P)*fRandom.Gaus(0.,1.);
2153 if( fPBremSmearing != 1.){
2155 facPBrem = fBrem->GetRandom();
2159 kfParticle->Px() = facPBrem* (1+facPSig)* P*sin(theta)*cos(phi) ;
2160 kfParticle->Py() = facPBrem* (1+facPSig)* P*sin(theta)*sin(phi) ;
2161 kfParticle->Pz() = facPBrem* (1+facPSig)* P*cos(theta) ;
2162 kfParticle->E() = kfParticle->GetP();