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"
33 #include "AliKFParticle.h"
35 #include "AliMCEventHandler.h"
36 #include "AliESDpid.h"
37 #include "AliGammaConversionBGHandler.h"
38 #include "AliESDtrackCuts.h"
40 #include "AliGenCocktailEventHeader.h"
53 AliESDpid* AliV0Reader::fgESDpid = 0x0;
55 AliV0Reader::AliV0Reader() :
59 fMCEvent(NULL), // for CF
66 fCurrentV0IndexNumber(0),
68 fCurrentNegativeKFParticle(NULL),
69 fCurrentPositiveKFParticle(NULL),
70 fCurrentMotherKFCandidate(NULL),
71 fCurrentNegativeESDTrack(NULL),
72 fCurrentPositiveESDTrack(NULL),
73 fNegativeTrackLorentzVector(NULL),
74 fPositiveTrackLorentzVector(NULL),
75 fMotherCandidateLorentzVector(NULL),
81 fNegativeMCParticle(NULL),
82 fPositiveMCParticle(NULL),
83 fMotherMCParticle(NULL),
84 fMotherCandidateKFMass(0),
85 fMotherCandidateKFWidth(0),
86 fUseKFParticle(kTRUE),
89 fMaxVertexZ(100.),// 100 cm(from the 0)
90 fMaxR(10000),// 100 meter(outside of ALICE)
91 fMinR(0),// 100 meter(outside of ALICE)
94 fRapidityMesonCut(0.),
102 fLineCutZRSlopeMin(0.),
103 fLineCutZValueMin(0.),
104 fChi2CutConversion(0.),
107 fAlphaMinCutMeson(0.),
108 fPIDProbabilityCutNegativeParticle(0),
109 fPIDProbabilityCutPositiveParticle(0),
110 fDodEdxSigmaCut(kFALSE),
111 fDoTOFsigmaCut(kFALSE), // RRnewTOF
112 fPIDnSigmaAboveElectronLine(100),
113 fPIDnSigmaBelowElectronLine(-100),
114 fTofPIDnSigmaAboveElectronLine(100), // RRnewTOF
115 fTofPIDnSigmaBelowElectronLine(-100), // RRnewTOF
116 fPIDnSigmaAbovePionLine(-100),
117 fPIDnSigmaAbovePionLineHighPt(-100),
118 fPIDMinPnSigmaAbovePionLine(100),
119 fPIDMaxPnSigmaAbovePionLine(100),
120 fDoKaonRejectionLowP(kFALSE),
121 fDoProtonRejectionLowP(kFALSE),
122 fDoPionRejectionLowP(kFALSE),
123 fPIDnSigmaAtLowPAroundKaonLine(0),
124 fPIDnSigmaAtLowPAroundProtonLine(0),
125 fPIDnSigmaAtLowPAroundPionLine(0),
126 fPIDMinPKaonRejectionLowP(0),
127 fPIDMinPProtonRejectionLowP(0),
128 fPIDMinPPionRejectionLowP(0),
129 fDoQtGammaSelection(kFALSE),
130 fDoHighPtQtGammaSelection(kFALSE), // RRnew
132 fHighPtQtMax(100.), // RRnew
133 fPtBorderForQt(100.), // RRnew
140 fUseImprovedVertex(kFALSE),
141 fUseOwnXYZCalculation(kFALSE),
142 fUseConstructGamma(kFALSE),
144 fUseEtaMinCut(kFALSE),
145 fUseOnFlyV0Finder(kTRUE),
146 fUpdateV0AlreadyCalled(kFALSE),
147 fCurrentEventGoodV0s(NULL),
150 // fPreviousEventGoodV0s(),
151 fCalculateBackground(kFALSE),
152 fBGEventHandler(NULL),
153 fBGEventInitialized(kFALSE),
155 fNumberOfESDTracks(0),
156 fNEventsForBGCalculation(20),
157 fUseChargedTrackMultiplicityForBG(kTRUE),
160 fUseCorrectedTPCClsInfo(kFALSE),
161 fUseMCPSmearing(kTRUE),
164 fPSigSmearingCte(0.),
167 fDoPhotonAsymmetryCut(0),
169 fMinPPhotonAsymmetryCut(100.),
170 fMinPhotonAsymmetry(0.),
171 fExcludeBackgroundEventForGammaCorrection(0.),
172 fNumberOfPrimerisFromHijingAndPythia(0)
174 //fESDpid = new AliESDpid;
178 AliV0Reader::AliV0Reader(const AliV0Reader & original) :
180 fMCStack(original.fMCStack),
181 // fMCTruth(original.fMCTruth),
182 fMCEvent(original.fMCEvent), // for CF
183 fChain(original.fChain),
184 // fESDHandler(original.fESDHandler),
185 fESDEvent(original.fESDEvent),
186 fCFManager(original.fCFManager),
187 // fESDpid(original.fESDpid),
188 fHistograms(original.fHistograms),
189 fCurrentV0IndexNumber(original.fCurrentV0IndexNumber),
190 fCurrentV0(original.fCurrentV0),
191 fCurrentNegativeKFParticle(original.fCurrentNegativeKFParticle),
192 fCurrentPositiveKFParticle(original.fCurrentPositiveKFParticle),
193 fCurrentMotherKFCandidate(original.fCurrentMotherKFCandidate),
194 fCurrentNegativeESDTrack(original.fCurrentNegativeESDTrack),
195 fCurrentPositiveESDTrack(original.fCurrentPositiveESDTrack),
196 fNegativeTrackLorentzVector(original.fNegativeTrackLorentzVector),
197 fPositiveTrackLorentzVector(original.fPositiveTrackLorentzVector),
198 fMotherCandidateLorentzVector(original.fMotherCandidateLorentzVector),
199 fCurrentXValue(original.fCurrentXValue),
200 fCurrentYValue(original.fCurrentYValue),
201 fCurrentZValue(original.fCurrentZValue),
202 fPositiveTrackPID(original.fPositiveTrackPID),
203 fNegativeTrackPID(original.fNegativeTrackPID),
204 fNegativeMCParticle(original.fNegativeMCParticle),
205 fPositiveMCParticle(original.fPositiveMCParticle),
206 fMotherMCParticle(original.fMotherMCParticle),
207 fMotherCandidateKFMass(original.fMotherCandidateKFMass),
208 fMotherCandidateKFWidth(original.fMotherCandidateKFWidth),
209 fUseKFParticle(kTRUE),
210 fUseESDTrack(kFALSE),
212 fMaxVertexZ(original.fMaxVertexZ),
213 fMaxR(original.fMaxR),
214 fMinR(original.fMinR),
215 fEtaCut(original.fEtaCut),
216 fEtaCutMin(original.fEtaCutMin),
217 fRapidityMesonCut(original.fRapidityMesonCut),
218 fPtCut(original.fPtCut),
219 fSinglePtCut(original.fSinglePtCut),
220 fMaxZ(original.fMaxZ),
221 fMinClsTPC(original.fMinClsTPC),
222 fMinClsTPCToF(original.fMinClsTPCToF),
223 fLineCutZRSlope(original.fLineCutZRSlope),
224 fLineCutZValue(original.fLineCutZValue),
225 fLineCutZRSlopeMin(original.fLineCutZRSlopeMin),
226 fLineCutZValueMin(original.fLineCutZValueMin),
227 fChi2CutConversion(original.fChi2CutConversion),
228 fChi2CutMeson(original.fChi2CutMeson),
229 fAlphaCutMeson(original.fAlphaCutMeson),
230 fAlphaMinCutMeson(original.fAlphaMinCutMeson),
231 fPIDProbabilityCutNegativeParticle(original.fPIDProbabilityCutNegativeParticle),
232 fPIDProbabilityCutPositiveParticle(original.fPIDProbabilityCutPositiveParticle),
233 fDodEdxSigmaCut(original.fDodEdxSigmaCut),
234 fDoTOFsigmaCut(original.fDoTOFsigmaCut), // RRnewTOF
235 fPIDnSigmaAboveElectronLine(original.fPIDnSigmaAboveElectronLine),
236 fPIDnSigmaBelowElectronLine(original.fPIDnSigmaBelowElectronLine),
237 fTofPIDnSigmaAboveElectronLine(original.fTofPIDnSigmaAboveElectronLine), // RRnewTOF
238 fTofPIDnSigmaBelowElectronLine(original.fTofPIDnSigmaBelowElectronLine), // RRnewTOF
239 fPIDnSigmaAbovePionLine(original.fPIDnSigmaAbovePionLine),
240 fPIDnSigmaAbovePionLineHighPt(original.fPIDnSigmaAbovePionLineHighPt),
241 fPIDMinPnSigmaAbovePionLine(original.fPIDMinPnSigmaAbovePionLine),
242 fPIDMaxPnSigmaAbovePionLine(original.fPIDMaxPnSigmaAbovePionLine),
243 fDoKaonRejectionLowP(original.fDoKaonRejectionLowP),
244 fDoProtonRejectionLowP(original.fDoProtonRejectionLowP),
245 fDoPionRejectionLowP(original.fDoPionRejectionLowP),
246 fPIDnSigmaAtLowPAroundKaonLine(original.fPIDnSigmaAtLowPAroundKaonLine),
247 fPIDnSigmaAtLowPAroundProtonLine(original.fPIDnSigmaAtLowPAroundProtonLine),
248 fPIDnSigmaAtLowPAroundPionLine(original.fPIDnSigmaAtLowPAroundPionLine),
249 fPIDMinPKaonRejectionLowP(original.fPIDMinPKaonRejectionLowP),
250 fPIDMinPProtonRejectionLowP(original.fPIDMinPProtonRejectionLowP),
251 fPIDMinPPionRejectionLowP(original.fPIDMinPPionRejectionLowP),
252 fDoQtGammaSelection(original.fDoQtGammaSelection),
253 fDoHighPtQtGammaSelection(original.fDoHighPtQtGammaSelection), // RRnew
254 fQtMax(original.fQtMax),
255 fHighPtQtMax(original.fHighPtQtMax), // RRnew
256 fPtBorderForQt(original.fPtBorderForQt), // RRnew
257 fXVertexCut(original.fXVertexCut),
258 fYVertexCut(original.fYVertexCut),
259 fZVertexCut(original.fZVertexCut),
260 fPsiPairCut(original.fPsiPairCut),
261 fCosinePointCut(original.fCosinePointCut),
262 fNSigmaMass(original.fNSigmaMass),
263 fUseImprovedVertex(original.fUseImprovedVertex),
264 fUseOwnXYZCalculation(original.fUseOwnXYZCalculation),
265 fUseConstructGamma(original.fUseConstructGamma),
266 fDoCF(original.fDoCF),
267 fUseEtaMinCut(original.fUseEtaMinCut),
268 fUseOnFlyV0Finder(original.fUseOnFlyV0Finder),
269 fUpdateV0AlreadyCalled(original.fUpdateV0AlreadyCalled),
270 fCurrentEventGoodV0s(original.fCurrentEventGoodV0s),
271 fV0Pindex(original.fV0Pindex),
272 fV0Nindex(original.fV0Nindex),
273 // fPreviousEventGoodV0s(original.fPreviousEventGoodV0s),
274 fCalculateBackground(original.fCalculateBackground),
275 fBGEventHandler(original.fBGEventHandler),
276 fBGEventInitialized(original.fBGEventInitialized),
277 fEsdTrackCuts(original.fEsdTrackCuts),
278 fNumberOfESDTracks(original.fNumberOfESDTracks),
279 fNEventsForBGCalculation(original.fNEventsForBGCalculation),
280 fUseChargedTrackMultiplicityForBG(original.fUseChargedTrackMultiplicityForBG),
281 fNumberOfGoodV0s(original.fNumberOfGoodV0s),
282 fIsHeavyIon(original.fIsHeavyIon),
283 fUseCorrectedTPCClsInfo(original.fUseCorrectedTPCClsInfo),
284 fUseMCPSmearing(original.fUseMCPSmearing),
285 fPBremSmearing(original.fPBremSmearing),
286 fPSigSmearing(original.fPSigSmearing),
287 fPSigSmearingCte(original.fPSigSmearingCte),
288 fRandom(original.fRandom),
289 fBrem(original.fBrem),
290 fDoPhotonAsymmetryCut(original.fDoPhotonAsymmetryCut),
291 fdoESDQtCut(original.fdoESDQtCut),
292 fMinPPhotonAsymmetryCut(original.fMinPPhotonAsymmetryCut),
293 fMinPhotonAsymmetry(original.fMinPhotonAsymmetry),
294 fExcludeBackgroundEventForGammaCorrection(original.fExcludeBackgroundEventForGammaCorrection),
295 fNumberOfPrimerisFromHijingAndPythia(original.fNumberOfPrimerisFromHijingAndPythia)
301 AliV0Reader & AliV0Reader::operator = (const AliV0Reader & /*source*/)
303 // assignment operator
306 AliV0Reader::~AliV0Reader()
313 //____________________________________________________________________________
314 void AliV0Reader::SetInputAndMCEvent(AliVEvent* esd, AliMCEvent* mc) {
315 // Connect the data pointers
323 void AliV0Reader::Initialize(){
324 //see header file for documentation
326 fUpdateV0AlreadyCalled = kFALSE;
329 // Get the input handler from the manager
330 fESDHandler = (AliESDInputHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
331 if(fESDHandler == NULL){
335 // Get pointer to esd event from input handler
336 fESDEvent = fESDHandler->GetEvent();
337 if(fESDEvent == NULL){
341 //Get pointer to MCTruth
342 fMCTruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
347 // fMCTruth = mcH->MCEvent();
348 // fMC = mcH->MCEvent();
349 // stack = fMC->Stack();
352 //if(fMCTruth == NULL){
357 if(fMCEvent == NULL){
361 //Get pointer to the mc stack
364 fMCStack = fMCEvent->Stack();
365 if(fMCStack == NULL){
368 // Better parameters for MonteCarlo from A. Kalweit 2010/01/8
369 // fESDpid->GetTPCResponse().SetBetheBlochParameters( 2.15898e+00/50.,
376 // Better parameters for data from A. Kalweit 2010/01/8
377 // fESDpid->GetTPCResponse().SetBetheBlochParameters(0.0283086,
385 //Get pointer to the mc event
387 //fMCEvent = fMCTruth->MCEvent();
388 if(fMCEvent == NULL){
394 fUseEtaMinCut = kFALSE;
395 if ( fEtaCutMin != -0.1) {
396 fUseEtaMinCut = kTRUE;
400 AliKFParticle::SetField(fESDEvent->GetMagneticField());
402 // fCurrentEventGoodV0s = new TClonesArray("TClonesArray", 0);
403 if(fCurrentEventGoodV0s == NULL){
404 fCurrentEventGoodV0s = new TClonesArray("AliKFParticle", 0);
412 gRandom= new TRandom3(0);
417 fBrem = new TF1("fBrem","pow(-log(x),[0]/log(2.0)-1.0)/TMath::Gamma([0]/log(2.0))",0.00001,0.999999999);
418 // tests done with 1.0e-14
419 fBrem->SetParameter(0,fPBremSmearing);
420 fBrem->SetNpx(100000);
423 if(fCalculateBackground == kTRUE){
424 if(fBGEventInitialized == kFALSE){
426 Double_t zBinLimitsArray[9];
427 zBinLimitsArray[0] = -50.00;
428 zBinLimitsArray[1] = -3.375;
429 zBinLimitsArray[2] = -1.605;
430 zBinLimitsArray[3] = -0.225;
431 zBinLimitsArray[4] = 1.065;
432 zBinLimitsArray[5] = 2.445;
433 zBinLimitsArray[6] = 4.245;
434 zBinLimitsArray[7] = 50.00;
435 zBinLimitsArray[8] = 1000.00;
437 Double_t multiplicityBinLimitsArray[6];
438 if(fUseChargedTrackMultiplicityForBG == kTRUE){
439 multiplicityBinLimitsArray[0] = 0;
440 multiplicityBinLimitsArray[1] = 8.5;
441 multiplicityBinLimitsArray[2] = 16.5;
442 multiplicityBinLimitsArray[3] = 27.5;
443 multiplicityBinLimitsArray[4] = 41.5;
444 multiplicityBinLimitsArray[5] = 100.;
446 multiplicityBinLimitsArray[0] = 0;
447 multiplicityBinLimitsArray[1] = 200.;
448 multiplicityBinLimitsArray[2] = 500.;
449 multiplicityBinLimitsArray[3] = 1000.;
450 multiplicityBinLimitsArray[4] = 1500.;
451 multiplicityBinLimitsArray[5] = 3000.;
453 fBGEventHandler = new AliGammaConversionBGHandler(9,6,fNEventsForBGCalculation);
455 multiplicityBinLimitsArray[0] = 2;
456 multiplicityBinLimitsArray[1] = 3;
457 multiplicityBinLimitsArray[2] = 4;
458 multiplicityBinLimitsArray[3] = 5;
459 multiplicityBinLimitsArray[4] = 9999;
461 multiplicityBinLimitsArray[0] = 2;
462 multiplicityBinLimitsArray[1] = 10;
463 multiplicityBinLimitsArray[2] = 30;
464 multiplicityBinLimitsArray[3] = 50;
465 multiplicityBinLimitsArray[4] = 9999;
468 fBGEventHandler = new AliGammaConversionBGHandler(9,5,fNEventsForBGCalculation);
474 // ---------------------------------
475 Double_t *zBinLimitsArray = new Double_t[1];
476 zBinLimitsArray[0] = 999999.00;
478 Double_t *multiplicityBinLimitsArray= new Double_t[1];
479 multiplicityBinLimitsArray[0] = 99999999.00;
480 fBGEventHandler = new AliGammaConversionBGHandler(1,1,10);
481 // ---------------------------------
483 fBGEventHandler->Initialize(zBinLimitsArray, multiplicityBinLimitsArray);
484 fBGEventInitialized = kTRUE;
488 if(fDoMC && fExcludeBackgroundEventForGammaCorrection){
489 fNumberOfPrimerisFromHijingAndPythia = GetNumberOfHijingPlusPythiaPrimeries();
493 AliESDv0* AliV0Reader::GetV0(Int_t index){
494 //see header file for documentation
495 fCurrentV0 = fESDEvent->GetV0(index);
496 UpdateV0Information();
500 Int_t AliV0Reader::GetNumberOfContributorsVtx(){
501 // returns number of contributors to the vertex
502 if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()>0) {
503 return fESDEvent->GetPrimaryVertexTracks()->GetNContributors();
506 if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()<1) {
508 //-AM test pi0s without SPD only vertex
509 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
510 return fESDEvent->GetPrimaryVertexSPD()->GetNContributors();
513 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()<1) {
514 cout<<"number of contributors from bad vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
521 Bool_t AliV0Reader::CheckForPrimaryVertex(){
522 //see headerfile for documentation
523 if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()>0) {
526 if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()<1) {
528 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
530 //-AM test pi0s without SPD only vertex
531 //cout<<"spd vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
534 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()<1) {
535 // cout<<"bad vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
540 // return fESDEvent->GetPrimaryVertex()->GetNContributors()>0;
543 Bool_t AliV0Reader::CheckForPrimaryVertexZ(){
544 //see headerfile for documentation
545 if(TMath::Abs(fESDEvent->GetPrimaryVertex()->GetZ())<GetMaxVertexZ()){
554 Bool_t AliV0Reader::CheckV0FinderStatus(AliESDv0 *v0){
555 // see headerfile for documentation
556 if(fUseOnFlyV0Finder){
557 if(!v0->GetOnFlyStatus()){
561 if(!fUseOnFlyV0Finder){
562 if(v0->GetOnFlyStatus()){
572 Bool_t AliV0Reader::NextV0(){
573 //see header file for documentation
574 Bool_t iResult=kFALSE;
575 while(fCurrentV0IndexNumber<fESDEvent->GetNumberOfV0s()){
576 fCurrentV0 = fESDEvent->GetV0(fCurrentV0IndexNumber);
578 fUpdateV0AlreadyCalled=kFALSE;
580 if(fHistograms != NULL){
581 fHistograms->FillHistogram("ESD_AllV0s_InvMass",GetMotherCandidateMass());
582 fHistograms->FillHistogram("ESD_AllV0s_Pt",GetMotherCandidatePt());
585 // moved it up here so that the correction framework can access pt and eta information
586 if(UpdateV0Information() == kFALSE){
587 fCurrentV0IndexNumber++;
592 if(fDoMC && fExcludeBackgroundEventForGammaCorrection){ // Remove all V0s from BGEvent
593 Bool_t isFromBGEvent = kFALSE;
594 isFromBGEvent = IsParticleFromBGEvent(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel()));
596 fHistograms->FillHistogram("ESD_CutMCBgEvent_InvMass",GetMotherCandidateMass());
597 fHistograms->FillHistogram("ESD_CutMCBgEvent_Pt",GetMotherCandidatePt());
598 fCurrentV0IndexNumber++;
601 isFromBGEvent = IsParticleFromBGEvent(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel()));
603 fHistograms->FillHistogram("ESD_CutMCBgEvent_InvMass",GetMotherCandidateMass());
604 fHistograms->FillHistogram("ESD_CutMCBgEvent_Pt",GetMotherCandidatePt());
605 fCurrentV0IndexNumber++;
612 Double_t containerInput[3];
614 containerInput[0] = GetMotherCandidatePt();
615 containerInput[1] = GetMotherCandidateEta();
616 containerInput[2] = GetMotherCandidateMass();
620 containerInput[0] = GetMotherCandidatePt();
621 containerInput[1] = GetMotherCandidateEta();
622 containerInput[2] = GetMotherCandidateMass();
624 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF
625 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF
626 fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF
630 //checks if on the fly mode is set
631 if ( !CheckV0FinderStatus(fCurrentV0) ){
633 if(fHistograms != NULL){
634 fHistograms->FillHistogram("ESD_CutGetOnFly_InvMass",GetMotherCandidateMass());
635 fHistograms->FillHistogram("ESD_CutGetOnFly_Pt",GetMotherCandidatePt());
637 fCurrentV0IndexNumber++;
641 fCFManager->GetParticleContainer()->Fill(containerInput,kStepGetOnFly); // for CF
644 if(fHistograms != NULL){
645 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_InvMass",GetMotherCandidateMass());
646 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_Pt",GetMotherCandidatePt());
649 Double_t armenterosQtAlpha[2] = {0,0};
650 Double_t armenterosQtAlphaKF[2] = {0,0};
651 Double_t armenterosQtAlphaESD[2] = {0,0};
652 Double_t armenterosQtAlphaKFNew[2] = {0,0};
653 Double_t armenterosQtAlphaESDMC[2] = {0,0};
654 Double_t armenterosQtAlphaMC[2] = {0,0};
656 GetArmenterosQtAlpha(GetNegativeKFParticle(), // old KF way calculating Qt Alpha
657 GetPositiveKFParticle(),
658 GetMotherCandidateKFCombination(),
659 armenterosQtAlphaKF);
660 GetArmenterosQtAlpha(fCurrentV0,armenterosQtAlphaESD); // ESD way calculating Qt Alpha
661 GetArmenterosQtAlpha(GetNegativeKFParticle(), // new KF way calculating Qt Alpha
662 GetPositiveKFParticle(),
663 armenterosQtAlphaKFNew,fdoESDQtCut);
665 fHistograms->FillHistogram("ESD_AllV0sCurrentFinderKF_alfa_qt",armenterosQtAlphaKF[1],armenterosQtAlphaKF[0]);
666 fHistograms->FillHistogram("ESD_AllV0sCurrentFinderESD_alfa_qt",armenterosQtAlphaESD[1],armenterosQtAlphaESD[0]);
667 fHistograms->FillHistogram("ESD_AllV0sCurrentFinderKFNew_alfa_qt",armenterosQtAlphaKFNew[1],armenterosQtAlphaKFNew[0]);
669 if(fdoESDQtCut == 0){
670 armenterosQtAlpha[0] = armenterosQtAlphaKF[0];
671 armenterosQtAlpha[1] = armenterosQtAlphaKF[1];
673 else if(fdoESDQtCut == 1){
674 armenterosQtAlpha[0] = armenterosQtAlphaESD[0];
675 armenterosQtAlpha[1] = armenterosQtAlphaESD[1];
678 else if(fdoESDQtCut == 2 || fdoESDQtCut == 3){
679 armenterosQtAlpha[0] = armenterosQtAlphaKFNew[0];
680 armenterosQtAlpha[1] = armenterosQtAlphaKFNew[1];
683 if(fCurrentNegativeESDTrack->Charge() == fCurrentPositiveESDTrack->Charge()){ // avoid like sign
685 if(fHistograms != NULL ){
686 fHistograms->FillHistogram("ESD_CutLikeSign_InvMass",GetMotherCandidateMass());
687 fHistograms->FillHistogram("ESD_CutLikeSign_Pt",GetMotherCandidatePt());
688 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
689 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
690 // fUpdateV0AlreadyCalled = kTRUE;
692 fCurrentV0IndexNumber++;
696 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF
699 if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ||
700 !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ){
701 // if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kITSrefit) ||
702 // !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kITSrefit) ){
704 if(fHistograms != NULL){
705 fHistograms->FillHistogram("ESD_CutRefit_InvMass",GetMotherCandidateMass());
706 fHistograms->FillHistogram("ESD_CutRefit_Pt",GetMotherCandidatePt());
707 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
708 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
709 //fUpdateV0AlreadyCalled = kTRUE;
711 fCurrentV0IndexNumber++;
715 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF
720 if( fCurrentNegativeESDTrack->GetKinkIndex(0) > 0 ||
721 fCurrentPositiveESDTrack->GetKinkIndex(0) > 0) {
723 if(fHistograms != NULL ){
724 fHistograms->FillHistogram("ESD_CutKink_InvMass",GetMotherCandidateMass());
725 fHistograms->FillHistogram("ESD_CutKink_Pt",GetMotherCandidatePt());
726 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
727 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
728 //fUpdateV0AlreadyCalled = kTRUE;
730 fCurrentV0IndexNumber++;
735 fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF
738 if(GetXYRadius()>fMaxR){ // cuts on distance from collision point
739 if(fHistograms != NULL){
740 fHistograms->FillHistogram("ESD_CutR_InvMass",GetMotherCandidateMass());
741 fHistograms->FillHistogram("ESD_CutR_Pt",GetMotherCandidatePt());
743 fCurrentV0IndexNumber++;
747 fCFManager->GetParticleContainer()->Fill(containerInput,kStepR); // for CF
749 if(GetXYRadius()<fMinR){ // cuts on distance from collision point
750 if(fHistograms != NULL){
751 fHistograms->FillHistogram("ESD_CutMinR_InvMass",GetMotherCandidateMass());
752 fHistograms->FillHistogram("ESD_CutMinR_Pt",GetMotherCandidatePt());
754 fCurrentV0IndexNumber++;
758 //if((TMath::Abs(fCurrentZValue)*fLineCutZRSlope)-fLineCutZValue > GetXYRadius() ) { // cuts out regions where we do not reconstruct
759 if( GetXYRadius() <= ((TMath::Abs(fCurrentZValue)*fLineCutZRSlope)-fLineCutZValue)){
760 if(fHistograms != NULL){
761 fHistograms->FillHistogram("ESD_CutLine_InvMass",GetMotherCandidateMass());
762 fHistograms->FillHistogram("ESD_CutLine_Pt",GetMotherCandidatePt());
764 fCurrentV0IndexNumber++;
766 } else if (fUseEtaMinCut && GetXYRadius() >= ((TMath::Abs(fCurrentZValue)*fLineCutZRSlopeMin)-fLineCutZValueMin )){
767 if(fHistograms != NULL){
768 fHistograms->FillHistogram("ESD_CutLine_InvMass",GetMotherCandidateMass());
769 fHistograms->FillHistogram("ESD_CutLine_Pt",GetMotherCandidatePt());
771 fCurrentV0IndexNumber++;
776 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLine); // for CF
779 if(TMath::Abs(fCurrentZValue) > fMaxZ ){ // cuts out regions where we do not reconstruct
780 if(fHistograms != NULL){
781 fHistograms->FillHistogram("ESD_CutZ_InvMass",GetMotherCandidateMass());
782 fHistograms->FillHistogram("ESD_CutZ_Pt",GetMotherCandidatePt());
784 fCurrentV0IndexNumber++;
788 fCFManager->GetParticleContainer()->Fill(containerInput,kStepZ); // for CF
792 if(TMath::Abs(fMotherCandidateLorentzVector->Eta())> fEtaCut || TMath::Abs(fMotherCandidateLorentzVector->Eta())< fEtaCutMin){
793 if(fHistograms != NULL){
794 fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
795 fHistograms->FillHistogram("ESD_CutEta_Pt",GetMotherCandidatePt());
797 fCurrentV0IndexNumber++;
801 if(TMath::Abs(fCurrentNegativeKFParticle->GetEta())> fEtaCut || TMath::Abs(fCurrentNegativeKFParticle->GetEta())< fEtaCutMin){
802 if(fHistograms != NULL){
803 fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
804 fHistograms->FillHistogram("ESD_CutEta_Pt",GetMotherCandidatePt());
806 fCurrentV0IndexNumber++;
810 if(TMath::Abs(fCurrentPositiveKFParticle->GetEta())> fEtaCut || TMath::Abs(fCurrentPositiveKFParticle->GetEta())< fEtaCutMin){
811 if(fHistograms != NULL){
812 fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
813 fHistograms->FillHistogram("ESD_CutEta_Pt",GetMotherCandidatePt());
815 fCurrentV0IndexNumber++;
820 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_Pt_Qt",GetMotherCandidatePt(),armenterosQtAlpha[0]);
823 if ( HasSameMCMother() == kTRUE){
824 GetArmenterosQtAlpha(fNegativeMCParticle,
827 armenterosQtAlphaMC);
829 GetArmenterosQtAlpha(fNegativeMCParticle,
831 GetMotherCandidateKFCombination(),
832 armenterosQtAlphaESDMC );
835 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_goodtracks_alfa_qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
836 if( fCurrentNegativeKFParticle->GetPt()> 0.150 && fCurrentPositiveKFParticle->GetPt()> 0.150){
837 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_minPt_GT_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
840 fHistograms->FillHistogram("ESD_TrueConvAllV0s_ESDMother_Alpha_Qt",armenterosQtAlphaESDMC[1],armenterosQtAlphaESDMC[0]);
841 if ( HasSameMCMother() == kTRUE){
842 fHistograms->FillHistogram("ESD_TrueConvSameMother_ESDMother_Alpha_Qt",armenterosQtAlphaESDMC[1],armenterosQtAlphaESDMC[0]);
843 fHistograms->FillHistogram("ESD_TrueConvSameMother_MCMother_Alpha_Qt",armenterosQtAlphaMC[1],armenterosQtAlphaMC[0]);
844 if (fMotherMCParticle->GetPdgCode() == 22 ){
845 fHistograms->FillHistogram("ESD_TrueConvGamma_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
846 fHistograms->FillHistogram("ESD_TrueConvGamma_Pt_Qt",GetMotherCandidatePt(),armenterosQtAlpha[0]);
847 } else if ( fMotherMCParticle->GetPdgCode() == 310 ){
848 fHistograms->FillHistogram("ESD_TrueConvK0s_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
849 } else if ( fMotherMCParticle->GetPdgCode() == 113 ){
850 fHistograms->FillHistogram("ESD_TrueConvRho0_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
851 } else if ( fMotherMCParticle->GetPdgCode() == 333 ){
852 fHistograms->FillHistogram("ESD_TrueConvPhi_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
853 } else if ( (fMotherMCParticle->GetPdgCode() == 3122 || fMotherMCParticle->GetPdgCode() == -3122) ){
854 fHistograms->FillHistogram("ESD_TrueConvLambda_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
855 } else if ( (fMotherMCParticle->GetPdgCode() == 2114 || fMotherMCParticle->GetPdgCode() == -2114) ){
856 fHistograms->FillHistogram("ESD_TrueConvDelta_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
857 } else if ( (fMotherMCParticle->GetPdgCode() == 313 ||
858 fMotherMCParticle->GetPdgCode() == 323 ||
859 fMotherMCParticle->GetPdgCode() == -323 ) ){
860 fHistograms->FillHistogram("ESD_TrueConvKStar_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
862 fHistograms->FillHistogram("ESD_TrueConvUnknown_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
863 fHistograms->FillHistogram("ESD_TrueConvUnknown_Qt_PDG",fMotherMCParticle->GetPdgCode());
864 // cout << "unidentfied mother: pdg-C mother " << fMotherMCParticle->GetPdgCode() << " daughters " << fNegativeMCParticle->GetPdgCode() << "\t" << fPositiveMCParticle->GetPdgCode() << endl;
867 fHistograms->FillHistogram("ESD_TrueConvComb_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
871 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_E_dEdxP",fCurrentNegativeESDTrack->P(),fCurrentNegativeESDTrack->GetTPCsignal());
872 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_P_dEdxP",fCurrentPositiveESDTrack->P(),fCurrentPositiveESDTrack->GetTPCsignal());
873 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_E_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron));
874 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_P_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron));
875 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_PiPl_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion));
876 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_PiMi_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion));
877 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_KPl_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kKaon));
878 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_KMi_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kKaon));
879 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_PPl_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kProton));
880 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_PMi_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kProton));
881 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_MuPl_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kMuon));
882 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_MuMi_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kMuon));
884 if(fDodEdxSigmaCut == kTRUE){
885 if( fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
886 fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ||
887 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
888 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ){
890 if(fHistograms != NULL ){
891 fHistograms->FillHistogram("ESD_CutdEdxSigmaElectronLine_InvMass",GetMotherCandidateMass());
892 fHistograms->FillHistogram("ESD_CutdEdxSigmaElectronLine_Pt",GetMotherCandidatePt());
893 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
894 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
895 //fUpdateV0AlreadyCalled = kTRUE;
897 fCurrentV0IndexNumber++;
901 fCFManager->GetParticleContainer()->Fill(containerInput,kStepdEdxElectronselection); // for CF
904 fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_PiPl_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion));
905 fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_PiMi_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion));
906 fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_MuPl_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kMuon));
907 fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_MuMi_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kMuon));
910 if( fCurrentPositiveESDTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentPositiveESDTrack->P()<fPIDMaxPnSigmaAbovePionLine ){
911 if(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
912 fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
913 fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
915 if(fHistograms != NULL){
916 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
917 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_Pt",GetMotherCandidatePt());
918 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
919 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
920 //fUpdateV0AlreadyCalled = kTRUE;
922 fCurrentV0IndexNumber++;
927 if( fCurrentNegativeESDTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentNegativeESDTrack->P()<fPIDMaxPnSigmaAbovePionLine){
928 if(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
929 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
930 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
932 if(fHistograms != NULL){
933 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
934 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_Pt",GetMotherCandidatePt());
935 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
936 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
937 //fUpdateV0AlreadyCalled = kTRUE;
939 fCurrentV0IndexNumber++;
945 if( fCurrentPositiveESDTrack->P()>fPIDMaxPnSigmaAbovePionLine ){
946 if(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
947 fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
948 fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineHighPt){
950 if(fHistograms != NULL){
951 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
952 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_Pt",GetMotherCandidatePt());
953 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
954 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
955 //fUpdateV0AlreadyCalled = kTRUE;
957 fCurrentV0IndexNumber++;
962 if( fCurrentNegativeESDTrack->P()>fPIDMaxPnSigmaAbovePionLine){
963 if(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
964 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
965 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineHighPt){
967 if(fHistograms != NULL){
968 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
969 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_Pt",GetMotherCandidatePt());
970 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
971 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
972 //fUpdateV0AlreadyCalled = kTRUE;
974 fCurrentV0IndexNumber++;
981 fCFManager->GetParticleContainer()->Fill(containerInput,kStepdEdxPionrejection); // for CF
986 fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_KPl_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kKaon));
987 fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_KMi_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kKaon));
989 if(fDoKaonRejectionLowP == kTRUE){
990 if( fCurrentNegativeESDTrack->P()<fPIDMinPKaonRejectionLowP ){
991 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
992 if(fHistograms != NULL){
993 fHistograms->FillHistogram("ESD_CutKaonRejectionLowP_InvMass",GetMotherCandidateMass());
994 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
995 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
996 //fUpdateV0AlreadyCalled = kTRUE;
998 fCurrentV0IndexNumber++;
1002 if( fCurrentPositiveESDTrack->P()<fPIDMinPKaonRejectionLowP ){
1003 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
1004 if(fHistograms != NULL){
1005 fHistograms->FillHistogram("ESD_CutKaonRejectionLowP_InvMass",GetMotherCandidateMass());
1006 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1007 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1008 //fUpdateV0AlreadyCalled = kTRUE;
1010 fCurrentV0IndexNumber++;
1016 fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_PPl_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kProton));
1017 fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_PMi_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kKaon));
1019 if(fDoProtonRejectionLowP == kTRUE){
1020 if( fCurrentNegativeESDTrack->P()<fPIDMinPProtonRejectionLowP){
1021 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
1022 if(fHistograms != NULL){
1023 fHistograms->FillHistogram("ESD_CutProtonRejectionLowP_InvMass",GetMotherCandidateMass());
1024 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1025 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1026 //fUpdateV0AlreadyCalled = kTRUE;
1028 fCurrentV0IndexNumber++;
1032 if( fCurrentPositiveESDTrack->P()<fPIDMinPProtonRejectionLowP ){
1033 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
1034 if(fHistograms != NULL){
1035 fHistograms->FillHistogram("ESD_CutProtonRejectionLowP_InvMass",GetMotherCandidateMass());
1036 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1037 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1038 //fUpdateV0AlreadyCalled = kTRUE;
1040 fCurrentV0IndexNumber++;
1046 if(fDoPionRejectionLowP == kTRUE){
1047 if( fCurrentNegativeESDTrack->P()<fPIDMinPPionRejectionLowP ){
1048 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
1049 if(fHistograms != NULL){
1050 fHistograms->FillHistogram("ESD_CutPionRejectionLowP_InvMass",GetMotherCandidateMass());
1051 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1052 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1053 //fUpdateV0AlreadyCalled = kTRUE;
1055 fCurrentV0IndexNumber++;
1059 if( fCurrentPositiveESDTrack->P()<fPIDMinPPionRejectionLowP ){
1060 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
1061 if(fHistograms != NULL){
1062 fHistograms->FillHistogram("ESD_CutPionRejectionLowP_InvMass",GetMotherCandidateMass());
1063 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1064 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1065 //fUpdateV0AlreadyCalled = kTRUE;
1067 fCurrentV0IndexNumber++;
1074 Double_t psiPair = -1;
1075 psiPair = GetPsiPair(fCurrentV0);
1077 if(psiPair > fPsiPairCut){
1078 if(fHistograms != NULL ){
1079 fHistograms->FillHistogram("ESD_CutPsiPair_InvMass",GetMotherCandidateMass());
1080 fHistograms->FillHistogram("ESD_CutPsiPair_Pt",GetMotherCandidatePt());
1081 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1082 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1083 // fUpdateV0AlreadyCalled = kTRUE;
1086 fCurrentV0IndexNumber++;
1091 Double_t cosineOfPointingAngle = -1;
1092 cosineOfPointingAngle = GetV0CosineOfPointingAngle(fCurrentXValue,fCurrentYValue,fCurrentZValue);
1093 if(cosineOfPointingAngle < fCosinePointCut){
1094 if(fHistograms != NULL ){
1095 fHistograms->FillHistogram("ESD_CutCosinePoint_InvMass",GetMotherCandidateMass());
1096 fHistograms->FillHistogram("ESD_CutCosinePoint_Pt",GetMotherCandidatePt());
1097 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1098 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1099 // fUpdateV0AlreadyCalled = kTRUE;
1101 fCurrentV0IndexNumber++;
1106 if( fDoTOFsigmaCut == kTRUE ){ // RRnewTOF start /////////////////////////////////////////////////////////////////////////////
1107 Bool_t PosTrackNotTOFelec = kFALSE;
1108 Bool_t NegTrackNotTOFelec = kFALSE;
1109 if( (fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTOFpid) && !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTOFmismatch) ){
1110 Double_t t0pos = fgESDpid->GetTOFResponse().GetStartTime(fCurrentPositiveESDTrack->P());
1111 Double_t fnSigmaPos = fgESDpid->NumberOfSigmasTOF(fCurrentPositiveESDTrack, AliPID::kElectron, t0pos);
1112 if( (fnSigmaPos>fTofPIDnSigmaAboveElectronLine) || (fnSigmaPos<fTofPIDnSigmaBelowElectronLine) ) PosTrackNotTOFelec = kTRUE;
1114 if( (fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTOFpid) && !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTOFmismatch) ){
1115 Double_t t0neg = fgESDpid->GetTOFResponse().GetStartTime(fCurrentNegativeESDTrack->P());
1116 Double_t fnSigmaNeg = fgESDpid->NumberOfSigmasTOF(fCurrentNegativeESDTrack, AliPID::kElectron, t0neg);
1117 if( (fnSigmaNeg>fTofPIDnSigmaAboveElectronLine) || (fnSigmaNeg<fTofPIDnSigmaBelowElectronLine) ) NegTrackNotTOFelec = kTRUE;
1119 if( (PosTrackNotTOFelec==kTRUE) || (NegTrackNotTOFelec==kTRUE) ){
1120 if(fHistograms != NULL){
1121 fHistograms->FillHistogram("ESD_CutTOFsigmaElec_InvMass",GetMotherCandidateMass());
1122 fHistograms->FillHistogram("ESD_CutTOFsigmaElec_Pt",GetMotherCandidatePt());
1124 fCurrentV0IndexNumber++;
1127 } /////////////////////////////// RRnewTOF end ///////////////////////////////////////////////////////////////////////////////
1130 // Gamma selection based on QT from Armenteros
1131 if(fDoQtGammaSelection == kTRUE){ // RRnew start : apply different qT-cut above/below
1132 if(fDoHighPtQtGammaSelection){
1133 if(GetMotherCandidatePt() < fPtBorderForQt){
1134 if(armenterosQtAlpha[0]>fQtMax){
1135 if(fHistograms != NULL){
1136 fHistograms->FillHistogram("ESD_CutQt_InvMass",GetMotherCandidateMass());
1137 fHistograms->FillHistogram("ESD_CutQt_Pt",GetMotherCandidatePt());
1139 fCurrentV0IndexNumber++;
1143 if(armenterosQtAlpha[0]>fHighPtQtMax) {
1144 if(fHistograms != NULL){
1145 fHistograms->FillHistogram("ESD_CutQt_InvMass",GetMotherCandidateMass());
1146 fHistograms->FillHistogram("ESD_CutQt_Pt",GetMotherCandidatePt());
1148 fCurrentV0IndexNumber++;
1153 if(armenterosQtAlpha[0]>fQtMax){
1154 if(fHistograms != NULL){
1155 fHistograms->FillHistogram("ESD_CutQt_InvMass",GetMotherCandidateMass());
1156 fHistograms->FillHistogram("ESD_CutQt_Pt",GetMotherCandidatePt());
1158 fCurrentV0IndexNumber++;
1164 if(fDoPhotonAsymmetryCut == kTRUE){
1165 if( fNegativeTrackLorentzVector->P()>fMinPPhotonAsymmetryCut ){
1166 Double_t trackNegAsy=0;
1167 if (fCurrentMotherKFCandidate->GetP()!=0.){
1168 trackNegAsy= fNegativeTrackLorentzVector->P()/fMotherCandidateLorentzVector->P();
1170 if( trackNegAsy<fMinPhotonAsymmetry ||trackNegAsy>(1.- fMinPhotonAsymmetry)){
1171 if(fHistograms != NULL){
1172 fHistograms->FillHistogram("ESD_CutPhotonAsymmetry_InvMass",GetMotherCandidateMass());
1173 fHistograms->FillHistogram("ESD_CutPhotonAsymmetry_Pt",GetMotherCandidatePt());
1174 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1175 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1176 //fUpdateV0AlreadyCalled = kTRUE;
1178 fCurrentV0IndexNumber++;
1183 if( fPositiveTrackLorentzVector->P()>fMinPPhotonAsymmetryCut ){
1184 Double_t trackPosAsy=0;
1185 if (fCurrentMotherKFCandidate->GetP()!=0.){
1186 trackPosAsy= fPositiveTrackLorentzVector->P()/fMotherCandidateLorentzVector->P();
1188 if( trackPosAsy<fMinPhotonAsymmetry ||trackPosAsy>(1.- fMinPhotonAsymmetry)){
1189 if(fHistograms != NULL){
1190 fHistograms->FillHistogram("ESD_CutPhotonAsymmetry_InvMass",GetMotherCandidateMass());
1191 fHistograms->FillHistogram("ESD_CutPhotonAsymmetry_Pt",GetMotherCandidatePt());
1192 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1193 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1194 //fUpdateV0AlreadyCalled = kTRUE;
1196 fCurrentV0IndexNumber++;
1201 //checks if we have a prim vertex
1202 //if(fESDEvent->GetPrimaryVertex()->GetNContributors()<=0) {
1203 if(GetNumberOfContributorsVtx()<=0) {
1204 if(fHistograms != NULL){
1205 fHistograms->FillHistogram("ESD_CutNContributors_InvMass",GetMotherCandidateMass());
1206 fHistograms->FillHistogram("ESD_CutNContributors_Pt",GetMotherCandidatePt());
1208 fCurrentV0IndexNumber++;
1212 fCFManager->GetParticleContainer()->Fill(containerInput,kStepNContributors); // for CF
1215 //Check the pid probability
1216 if(CheckPIDProbability(fPIDProbabilityCutNegativeParticle,fPIDProbabilityCutPositiveParticle)==kFALSE){
1217 if(fHistograms != NULL){
1218 fHistograms->FillHistogram("ESD_CutPIDProb_InvMass",GetMotherCandidateMass());
1219 fHistograms->FillHistogram("ESD_CutPIDProb_Pt",GetMotherCandidatePt());
1221 fCurrentV0IndexNumber++;
1225 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCPID); // for CF
1229 /* Moved further up so corr framework can work
1230 if(UpdateV0Information() == kFALSE){
1231 fCurrentV0IndexNumber++;
1235 if(fCurrentNegativeESDTrack->GetNcls(1) < fMinClsTPC || fCurrentPositiveESDTrack->GetNcls(1) < fMinClsTPC ){
1236 if(fHistograms != NULL){
1237 fHistograms->FillHistogram("ESD_CutMinNClsTPC_InvMass",GetMotherCandidateMass());
1238 fHistograms->FillHistogram("ESD_CutMinNClsTPC_Pt",GetMotherCandidatePt());
1240 fCurrentV0IndexNumber++;
1244 fCFManager->GetParticleContainer()->Fill(containerInput,kStepMinClsTPC); // for CF
1246 Double_t negclsToF = 0.;
1247 if (!fUseCorrectedTPCClsInfo ){
1248 if(fCurrentNegativeESDTrack->GetTPCNclsF()!=0 ){
1249 negclsToF = (Double_t)fCurrentNegativeESDTrack->GetNcls(1)/(Double_t)fCurrentNegativeESDTrack->GetTPCNclsF();
1252 negclsToF = fCurrentNegativeESDTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(GetXYRadius()));
1255 Double_t posclsToF = 0.;
1256 if (!fUseCorrectedTPCClsInfo ){
1257 if(fCurrentPositiveESDTrack->GetTPCNclsF()!=0 ){
1258 posclsToF = (Double_t)fCurrentPositiveESDTrack->GetNcls(1)/(Double_t)fCurrentPositiveESDTrack->GetTPCNclsF();
1261 posclsToF = fCurrentPositiveESDTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(GetXYRadius()));
1264 if( negclsToF < fMinClsTPCToF || posclsToF < fMinClsTPCToF ){
1265 if(fHistograms != NULL){
1266 fHistograms->FillHistogram("ESD_CutMinNClsTPCToF_InvMass",GetMotherCandidateMass());
1267 fHistograms->FillHistogram("ESD_CutMinNClsTPCToF_Pt",GetMotherCandidatePt());
1269 fCurrentV0IndexNumber++;
1279 if( fCurrentNegativeKFParticle->GetPt()< fSinglePtCut || fCurrentPositiveKFParticle->GetPt()< fSinglePtCut){
1280 if(fHistograms != NULL){
1281 fHistograms->FillHistogram("ESD_CutSinglePt_InvMass",GetMotherCandidateMass());
1282 fHistograms->FillHistogram("ESD_CutSinglePt_Pt",GetMotherCandidatePt());
1284 fCurrentV0IndexNumber++;
1288 fCFManager->GetParticleContainer()->Fill(containerInput,kStepSinglePt); // for CF
1292 if(fCurrentMotherKFCandidate->GetNDF()<=0){
1293 if(fHistograms != NULL){
1294 fHistograms->FillHistogram("ESD_CutNDF_InvMass",GetMotherCandidateMass());
1295 fHistograms->FillHistogram("ESD_CutNDF_Pt",GetMotherCandidatePt());
1297 fCurrentV0IndexNumber++;
1301 fCFManager->GetParticleContainer()->Fill(containerInput,kStepNDF); // for CF
1304 Double_t chi2V0 = fCurrentMotherKFCandidate->GetChi2()/fCurrentMotherKFCandidate->GetNDF();
1305 if(chi2V0 > fChi2CutConversion || chi2V0 <=0){
1306 if(fHistograms != NULL){
1307 fHistograms->FillHistogram("ESD_CutChi2_InvMass",GetMotherCandidateMass());
1308 fHistograms->FillHistogram("ESD_CutChi2_Pt",GetMotherCandidatePt());
1310 fCurrentV0IndexNumber++;
1314 fCFManager->GetParticleContainer()->Fill(containerInput,kStepChi2); // for CF
1318 fCFManager->GetParticleContainer()->Fill(containerInput,kStepEta); // for CF
1321 if(fMotherCandidateLorentzVector->Pt()<fPtCut){
1322 if(fHistograms != NULL){
1323 fHistograms->FillHistogram("ESD_CutPt_InvMass",GetMotherCandidateMass());
1324 fHistograms->FillHistogram("ESD_CutPt_Pt",GetMotherCandidatePt());
1326 fCurrentV0IndexNumber++;
1330 fCFManager->GetParticleContainer()->Fill(containerInput,kStepPt); // for CF
1334 else if(fUseESDTrack){
1338 if(fHistograms != NULL){
1339 fHistograms->FillHistogram("ESD_GoodV0s_InvMass",GetMotherCandidateMass());
1342 // fCurrentEventGoodV0s.push_back(*fCurrentMotherKFCandidate);
1344 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
1345 fCurrentMotherKFCandidate->E()=fCurrentMotherKFCandidate->GetP();
1348 if(fDoMC&& fUseMCPSmearing>0){
1349 SmearKFParticle(fCurrentMotherKFCandidate);
1353 new((*fCurrentEventGoodV0s)[fCurrentEventGoodV0s->GetEntriesFast()]) AliKFParticle(*fCurrentMotherKFCandidate);
1354 fV0Pindex.push_back(fCurrentV0->GetPindex());
1355 fV0Nindex.push_back(fCurrentV0->GetNindex());
1357 iResult=kTRUE;//means we have a v0 who survived all the cuts applied
1361 fCurrentV0IndexNumber++;
1368 Bool_t AliV0Reader::UpdateV0Information(){
1369 //see header file for documentation
1371 const AliExternalTrackParam *fCurrentExternalTrackParamPositive=GetExternalTrackParamP(fCurrentV0);
1372 const AliExternalTrackParam *fCurrentExternalTrackParamNegative=GetExternalTrackParamN(fCurrentV0);
1374 Bool_t iResult=kTRUE; // for taking out not refitted, kinks and like sign tracks
1376 Bool_t switchTracks = kFALSE;
1378 fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
1379 fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
1382 if(fCurrentPositiveESDTrack->GetSign() == -1 && fCurrentNegativeESDTrack->GetSign() == 1){ // switch wrong signed tracks
1383 fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
1384 fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
1385 switchTracks = kTRUE;
1389 if(fCurrentNegativeKFParticle != NULL){
1390 delete fCurrentNegativeKFParticle;
1392 if(switchTracks == kFALSE){
1393 fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fNegativeTrackPID);
1396 fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fNegativeTrackPID);
1399 if(fCurrentPositiveKFParticle != NULL){
1400 delete fCurrentPositiveKFParticle;
1402 if(switchTracks == kFALSE){
1403 fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fPositiveTrackPID);
1406 fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fPositiveTrackPID);
1409 if(fCurrentMotherKFCandidate != NULL){
1410 delete fCurrentMotherKFCandidate;
1413 if(fUseConstructGamma==kTRUE){
1414 fCurrentMotherKFCandidate = new AliKFParticle;//(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
1415 fCurrentMotherKFCandidate->ConstructGamma(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
1417 fCurrentMotherKFCandidate = new AliKFParticle(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
1418 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
1419 fCurrentMotherKFCandidate->SetMassConstraint(0,fNSigmaMass);
1422 if(fUseImprovedVertex == kTRUE){
1423 AliKFVertex primaryVertexImproved(*GetPrimaryVertex());
1424 primaryVertexImproved+=*fCurrentMotherKFCandidate;
1425 fCurrentMotherKFCandidate->SetProductionVertex(primaryVertexImproved);
1428 fCurrentMotherKFCandidate->GetMass(fMotherCandidateKFMass,fMotherCandidateKFWidth);
1430 if(fNegativeTrackLorentzVector != NULL){
1431 delete fNegativeTrackLorentzVector;
1434 fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeKFParticle->Px(),fCurrentNegativeKFParticle->Py(),fCurrentNegativeKFParticle->Pz());
1436 else { //if(fUseESDTrack){
1437 fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeESDTrack->Px(),fCurrentNegativeESDTrack->Py(),fCurrentNegativeESDTrack->Pz());
1440 if(fPositiveTrackLorentzVector != NULL){
1441 delete fPositiveTrackLorentzVector;
1444 fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveKFParticle->Px(),fCurrentPositiveKFParticle->Py(),fCurrentPositiveKFParticle->Pz());
1446 else { // if(fUseESDTrack){ fPositiveTrackLorentzVector must be reinitialized, so assuming use ESD if not kfparticle Svein.
1447 fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveESDTrack->Px(),fCurrentPositiveESDTrack->Py(),fCurrentPositiveESDTrack->Pz());
1450 if(fMotherCandidateLorentzVector != NULL){
1451 delete fMotherCandidateLorentzVector;
1454 fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);
1456 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
1457 fMotherCandidateLorentzVector->SetXYZM(fMotherCandidateLorentzVector->Px() ,fMotherCandidateLorentzVector->Py(),fMotherCandidateLorentzVector->Pz(),0.);
1462 fMotherMCParticle= NULL;
1463 if(switchTracks == kFALSE){
1464 fNegativeMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel()));
1465 fPositiveMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel()));
1467 fNegativeMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel()));
1468 fPositiveMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel()));
1471 if(fPositiveMCParticle->GetMother(0)>-1){
1472 fMotherMCParticle = fMCStack->Particle(fPositiveMCParticle->GetMother(0));
1481 // Double_t containerInput[3];
1483 // containerInput[0] = GetMotherCandidatePt();
1484 // containerInput[1] = GetMotherCandidateEta();
1485 // containerInput[2] = GetMotherCandidateMass();
1487 // fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF
1488 // fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF
1489 // fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF
1493 if(fUseOwnXYZCalculation == kFALSE){
1494 if(fUseConstructGamma == kFALSE){
1495 fCurrentV0->GetXYZ(fCurrentXValue,fCurrentYValue,fCurrentZValue);
1497 fCurrentXValue=GetMotherCandidateKFCombination()->GetX();
1498 fCurrentYValue=GetMotherCandidateKFCombination()->GetY();
1499 fCurrentZValue=GetMotherCandidateKFCombination()->GetZ();
1503 Double_t convpos[3]={0,0,0};
1504 GetConversionPoint(fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative,convpos);
1505 // fCurrentMotherKF->SetConversionPoint(convpos);
1507 // Double_t convpos[2];
1511 // GetConvPosXY(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField(),convpos);
1513 fCurrentXValue = convpos[0];
1514 fCurrentYValue = convpos[1];
1515 fCurrentZValue = convpos[2];
1517 fUpdateV0AlreadyCalled = kTRUE;
1524 Bool_t AliV0Reader::HasSameMCMother(){
1525 //see header file for documentation
1527 Bool_t iResult = kFALSE;
1529 if(fNegativeMCParticle != NULL && fPositiveMCParticle != NULL){
1530 if(fNegativeMCParticle->GetMother(0) == fPositiveMCParticle->GetMother(0))
1531 if(fMotherMCParticle){
1539 Bool_t AliV0Reader::CheckPIDProbability(Double_t negProbCut, Double_t posProbCut){
1540 //see header file for documentation
1542 Bool_t iResult=kFALSE;
1544 // Double_t *posProbArray = new Double_t[10];
1545 // Double_t *negProbArray = new Double_t[10];
1546 //-AM The TPCpid method expects an array of length kSPECIES that is 5 not 10
1548 Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1549 Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1551 AliESDtrack* negTrack = GetNegativeESDTrack();
1552 AliESDtrack* posTrack = GetPositiveESDTrack();
1553 //fESDEvent->GetTrack(fCurrentV0->GetNindex());
1554 //fESDEvent->GetTrack(fCurrentV0->GetPindex());
1555 //-AM for switchtracks==true the above is a bug
1557 if(negProbArray && posProbArray){
1559 negTrack->GetTPCpid(negProbArray);
1560 posTrack->GetTPCpid(posProbArray);
1562 // if(negProbArray != NULL && posProbArray != NULL){ // this is not allowed anymore for some reason(RC19)
1563 if(negProbArray[GetSpeciesIndex(-1)]>=negProbCut && posProbArray[GetSpeciesIndex(1)]>=posProbCut){
1567 delete [] posProbArray;
1568 delete [] negProbArray;
1572 void AliV0Reader::GetPIDProbability(Double_t &negPIDProb,Double_t & posPIDProb){
1573 // see header file for documentation
1575 //Double_t *posProbArray = new Double_t[10];
1576 // Double_t *negProbArray = new Double_t[10];
1577 //-AM The TPCpid method expects an array of length kSPECIES that is 5 not 10
1578 Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1579 Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1581 // AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
1582 // AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
1583 //-AM for switchtracks the above is a bug
1584 AliESDtrack* negTrack = GetNegativeESDTrack();
1585 AliESDtrack* posTrack = GetPositiveESDTrack();
1587 if(negProbArray && posProbArray){
1588 negTrack->GetTPCpid(negProbArray);
1589 posTrack->GetTPCpid(posProbArray);
1591 // if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19)
1592 negPIDProb = negProbArray[GetSpeciesIndex(-1)];
1593 posPIDProb = posProbArray[GetSpeciesIndex(1)];
1595 delete [] posProbArray;
1596 delete [] negProbArray;
1599 void AliV0Reader::GetPIDProbabilityMuonPion(Double_t &negPIDProb,Double_t & posPIDProb){
1600 // see header file for documentation
1603 Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1604 Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1606 // AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
1607 // AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
1608 //-AM for switchtracks the above is a bug
1610 AliESDtrack* negTrack = GetNegativeESDTrack();
1611 AliESDtrack* posTrack = GetPositiveESDTrack();
1613 if(negProbArray && posProbArray){
1614 negTrack->GetTPCpid(negProbArray);
1615 posTrack->GetTPCpid(posProbArray);
1617 // if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19)
1619 negPIDProb = negProbArray[1]+negProbArray[2];
1620 posPIDProb = posProbArray[1]+posProbArray[2];
1622 delete [] posProbArray;
1623 delete [] negProbArray;
1626 void AliV0Reader::UpdateEventByEventData(){
1627 //see header file for documentation
1628 if(fCurrentEventGoodV0s->GetEntriesFast() >0 ){
1629 if(fCalculateBackground){
1630 if(fUseChargedTrackMultiplicityForBG == kTRUE){
1631 fBGEventHandler->AddEvent(fCurrentEventGoodV0s,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
1632 //filling z and multiplicity histograms
1633 fHistograms->FillHistogram("ESD_Z_distribution",fESDEvent->GetPrimaryVertex()->GetZ());
1634 fHistograms->FillHistogram("ESD_multiplicity_distribution",CountESDTracks());
1635 fHistograms->FillHistogram("ESD_ZvsMultiplicity",fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
1637 else{ // means we use #V0s for multiplicity
1638 fBGEventHandler->AddEvent(fCurrentEventGoodV0s,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s);
1639 //filling z and multiplicity histograms
1640 fHistograms->FillHistogram("ESD_Z_distribution",fESDEvent->GetPrimaryVertex()->GetZ());
1641 fHistograms->FillHistogram("ESD_multiplicity_distribution",fNumberOfGoodV0s);
1642 fHistograms->FillHistogram("ESD_ZvsMultiplicity",fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s);
1646 fCurrentEventGoodV0s->Delete();
1647 fCurrentV0IndexNumber=0;
1648 fNumberOfESDTracks=0;
1655 // fBGEventHandler->PrintBGArray(); // for debugging
1659 Double_t AliV0Reader::GetNegativeTrackPhi() const{
1660 //see header file for documentation
1663 if(fNegativeTrackLorentzVector->Phi()> TMath::Pi()){
1664 offset = -2*TMath::Pi();
1666 return fNegativeTrackLorentzVector->Phi()+offset;
1669 Double_t AliV0Reader::GetPositiveTrackPhi() const{
1670 //see header file for documentation
1673 if(fPositiveTrackLorentzVector->Phi()> TMath::Pi()){
1674 offset = -2*TMath::Pi();
1676 return fPositiveTrackLorentzVector->Phi()+offset;
1679 Double_t AliV0Reader::GetMotherCandidatePhi() const{
1680 //see header file for documentation
1683 if(fMotherCandidateLorentzVector->Phi()> TMath::Pi()){
1684 offset = -2*TMath::Pi();
1686 return fMotherCandidateLorentzVector->Phi()+offset;
1690 Double_t AliV0Reader::GetMotherCandidateRapidity() const{
1691 //see header file for documentation
1693 Double_t rapidity=0;
1694 if(fMotherCandidateLorentzVector->Energy() - fMotherCandidateLorentzVector->Pz() == 0 || fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz() == 0) rapidity=0;
1695 else rapidity = 0.5*(TMath::Log((fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz()) / (fMotherCandidateLorentzVector->Energy()-fMotherCandidateLorentzVector->Pz())));
1704 Int_t AliV0Reader::GetSpeciesIndex(Int_t chargeOfTrack){
1705 //see header file for documentation
1707 Int_t iResult = 10; // Unknown particle
1709 if(chargeOfTrack==-1){ //negative track
1710 switch(abs(fNegativeTrackPID)){
1732 case 2112: //neutron
1739 //Put in here for kSPECIES::kEleCon ????
1742 else if(chargeOfTrack==1){ //positive track
1743 switch(abs(fPositiveTrackPID)){
1765 case 2112: //neutron
1772 //Put in here for kSPECIES::kEleCon ????
1776 //Wrong parameter.. Print warning
1781 //_____________________________________________________________________________________________________________________
1782 Bool_t AliV0Reader::GetHelixCenter(const AliExternalTrackParam *track, Double_t b,Int_t charge, Double_t center[2]){
1783 // see header file for documentation
1786 track->GetHelixParameters(helix,b);
1788 Double_t xpos = helix[5];
1789 Double_t ypos = helix[0];
1790 Double_t radius = TMath::Abs(1./helix[4]);
1791 Double_t phi = helix[2];
1794 phi = phi + 2*TMath::Pi();
1797 phi -= TMath::Pi()/2.;
1798 Double_t xpoint = radius * TMath::Cos(phi);
1799 Double_t ypoint = radius * TMath::Sin(phi);
1823 center[0] = xpos + xpoint;
1824 center[1] = ypos + ypoint;
1829 //_________________________________________________________________________________________________________
1830 // Bool_t AliV0Reader::GetHelixCenter(AliESDtrack* track, Double_t b,Int_t charge, Double_t center[2]){
1831 // // Bool_t AliV0Reader::GetHelixCenter(const AliExternalTrackParam *track, Double_t b,Int_t charge, Double_t center[2]){
1832 // // see header file for documentation
1834 // Double_t pi = 3.14159265358979323846;
1836 // Double_t helix[6];
1837 // track->GetHelixParameters(helix,b);
1839 // Double_t xpos = helix[5];
1840 // Double_t ypos = helix[0];
1841 // Double_t radius = TMath::Abs(1./helix[4]);
1842 // Double_t phi = helix[2];
1845 // phi = phi + 2*pi;
1849 // Double_t xpoint = radius * TMath::Cos(phi);
1850 // Double_t ypoint = radius * TMath::Sin(phi);
1854 // xpoint = - xpoint;
1855 // ypoint = - ypoint;
1870 // xpoint = - xpoint;
1871 // ypoint = - ypoint;
1874 // center[0] = xpos + xpoint;
1875 // center[1] = ypos + ypoint;
1880 //____________________________________________________________________________________________________________________________
1881 Bool_t AliV0Reader::GetConversionPoint(const AliExternalTrackParam *pparam,const AliExternalTrackParam *nparam,Double_t convpos[3]){
1883 if(!pparam||!nparam)return kFALSE;
1885 Double_t helixcenterpos[2];
1886 GetHelixCenter(pparam,GetMagneticField(),pparam->Charge(),helixcenterpos);
1888 Double_t helixcenterneg[2];
1889 GetHelixCenter(nparam,GetMagneticField(),nparam->Charge(),helixcenterneg);
1891 Double_t helixpos[6];
1892 pparam->GetHelixParameters(helixpos,GetMagneticField());
1893 Double_t posradius = TMath::Abs(1./helixpos[4]);
1895 Double_t helixneg[6];
1896 nparam->GetHelixParameters(helixneg,GetMagneticField());
1897 Double_t negradius = TMath::Abs(1./helixneg[4]);
1899 // Calculate xy-position
1901 Double_t xpos = helixcenterpos[0];
1902 Double_t ypos = helixcenterpos[1];
1903 Double_t xneg = helixcenterneg[0];
1904 Double_t yneg = helixcenterneg[1];
1906 convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
1907 convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius);
1910 // Calculate z-position
1912 Double_t deltaXPos = convpos[0] - xpos;
1913 Double_t deltaYPos = convpos[1] - ypos;
1915 Double_t deltaXNeg = convpos[0] - xneg;
1916 Double_t deltaYNeg = convpos[1] - yneg;
1918 Double_t alphaPos = TMath::Pi() + TMath::ATan2(-deltaYPos,-deltaXPos);
1919 Double_t alphaNeg = TMath::Pi() + TMath::ATan2(-deltaYNeg,-deltaXNeg);
1921 Double_t vertexXNeg = xneg + TMath::Abs(negradius)*TMath::Cos(alphaNeg);
1922 Double_t vertexYNeg = yneg + TMath::Abs(negradius)*TMath::Sin(alphaNeg);
1924 Double_t vertexXPos = xpos + TMath::Abs(posradius)*TMath::Cos(alphaPos);
1925 Double_t vertexYPos = ypos + TMath::Abs(posradius)*TMath::Sin(alphaPos);
1927 Double_t b = fESDEvent->GetMagneticField();
1929 AliExternalTrackParam p(*pparam);
1930 AliExternalTrackParam n(*nparam);
1932 TVector2 vertexPos(vertexXPos,vertexYPos);
1933 TVector2 vertexNeg(vertexXNeg,vertexYNeg);
1935 // Convert to local coordinate system
1936 vertexPos=vertexPos.Rotate(-p.GetAlpha());
1937 vertexNeg=vertexNeg.Rotate(-p.GetAlpha());
1939 // Propagate Track Params to Vertex
1940 p.PropagateTo(vertexPos.X(),b);
1941 n.PropagateTo(vertexNeg.X(),b);
1943 convpos[2] = (p.GetZ()*negradius+n.GetZ()*posradius)/(negradius+posradius);
1948 // //__________________________________________________________________________________________________________
1949 Bool_t AliV0Reader::GetConvPosXY(AliESDtrack* ptrack, AliESDtrack* ntrack, Double_t b, Double_t convpos[2]){
1950 //see header file for documentation
1952 Double_t helixcenterpos[2];
1953 GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
1955 Double_t helixcenterneg[2];
1956 GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
1958 Double_t poshelix[6];
1959 ptrack->GetHelixParameters(poshelix,b);
1960 Double_t posradius = TMath::Abs(1./poshelix[4]);
1962 Double_t neghelix[6];
1963 ntrack->GetHelixParameters(neghelix,b);
1964 Double_t negradius = TMath::Abs(1./neghelix[4]);
1966 Double_t xpos = helixcenterpos[0];
1967 Double_t ypos = helixcenterpos[1];
1968 Double_t xneg = helixcenterneg[0];
1969 Double_t yneg = helixcenterneg[1];
1971 convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
1972 convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius);
1979 Double_t AliV0Reader::GetConvPosZ(AliESDtrack* ptrack,AliESDtrack* ntrack, Double_t b){
1980 //see header file for documentation
1982 Double_t helixpos[6];
1983 ptrack->GetHelixParameters(helixpos,b);
1985 Double_t helixneg[6];
1986 ntrack->GetHelixParameters(helixneg,b);
1988 Double_t negtrackradius = TMath::Abs(1./helixneg[4]);
1989 Double_t postrackradius = TMath::Abs(1./helixpos[4]);
1991 Double_t pi = 3.14159265358979323846;
1993 Double_t convpos[2];
1994 GetConvPosXY(ptrack,ntrack,b,convpos);
1996 Double_t convposx = convpos[0];
1997 Double_t convposy = convpos[1];
1999 Double_t helixcenterpos[2];
2000 GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
2002 Double_t helixcenterneg[2];
2003 GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
2005 Double_t xpos = helixcenterpos[0];
2006 Double_t ypos = helixcenterpos[1];
2007 Double_t xneg = helixcenterneg[0];
2008 Double_t yneg = helixcenterneg[1];
2010 Double_t deltaXPos = convposx - xpos;
2011 Double_t deltaYPos = convposy - ypos;
2013 Double_t deltaXNeg = convposx - xneg;
2014 Double_t deltaYNeg = convposy - yneg;
2016 Double_t alphaPos = pi + TMath::ATan2(-deltaYPos,-deltaXPos);
2017 Double_t alphaNeg = pi + TMath::ATan2(-deltaYNeg,-deltaXNeg);
2019 Double_t vertexXNeg = xneg + TMath::Abs(negtrackradius)*
2020 TMath::Cos(alphaNeg);
2021 Double_t vertexYNeg = yneg + TMath::Abs(negtrackradius)*
2022 TMath::Sin(alphaNeg);
2024 Double_t vertexXPos = xpos + TMath::Abs(postrackradius)*
2025 TMath::Cos(alphaPos);
2026 Double_t vertexYPos = ypos + TMath::Abs(postrackradius)*
2027 TMath::Sin(alphaPos);
2029 Double_t x0neg = helixneg[5];
2030 Double_t y0neg = helixneg[0];
2032 Double_t x0pos = helixpos[5];
2033 Double_t y0pos = helixpos[0];
2035 Double_t dNeg = TMath::Sqrt((vertexXNeg - x0neg)*(vertexXNeg - x0neg)
2036 +(vertexYNeg - y0neg)*(vertexYNeg - y0neg));
2038 Double_t dPos = TMath::Sqrt((vertexXPos - x0pos)*(vertexXPos - x0pos)
2039 +(vertexYPos - y0pos)*(vertexYPos - y0pos));
2041 Double_t rNeg = TMath::Sqrt(negtrackradius*negtrackradius -
2044 Double_t rPos = TMath::Sqrt(postrackradius*postrackradius -
2047 Double_t deltabetaNeg = 2*(pi + TMath::ATan2(-dNeg/2.,-rNeg));
2048 Double_t deltabetaPos = 2*(pi + TMath::ATan2(-dPos/2.,-rPos));
2050 Double_t deltaUNeg = negtrackradius*deltabetaNeg;
2051 Double_t deltaUPos = postrackradius*deltabetaPos;
2053 Double_t zphaseNeg = ntrack->GetZ() + deltaUNeg * ntrack->GetTgl();
2054 Double_t zphasePos = ptrack->GetZ() + deltaUPos * ptrack->GetTgl();
2056 Double_t convposz = (zphasePos*negtrackradius+zphaseNeg*postrackradius)/(negtrackradius+postrackradius);
2061 AliGammaConversionKFVector* AliV0Reader::GetBGGoodV0s(Int_t /*event*/) const{
2063 if(fUseChargedTrackMultiplicityForBG == kTRUE){
2064 return fBGEventHandler->GetBGGoodV0s(event,fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
2066 else{ // means we use #v0s as multiplicity
2067 return fBGEventHandler->GetBGGoodV0s(event,fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s);
2073 Int_t AliV0Reader::CountESDTracks(){
2074 // see header file for documentation
2075 if(fNumberOfESDTracks == 0){ // count the good esd tracks
2076 for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){
2077 AliESDtrack* curTrack = fESDEvent->GetTrack(iTracks);
2081 if(fEsdTrackCuts->AcceptTrack(curTrack) ){
2082 fNumberOfESDTracks++;
2087 return fNumberOfESDTracks;
2090 Bool_t AliV0Reader::CheckIfPi0IsMother(Int_t label){
2091 // see headerfile for documentation
2092 Bool_t iResult=kFALSE;
2093 // cout<<"Checking particle label, particle is: "<<fMCStack->Particle(TMath::Abs(label))->GetName()<<endl;
2094 if(fMCStack->Particle(TMath::Abs(label))->GetPdgCode() == 111){
2100 Bool_t AliV0Reader::CheckIfEtaIsMother(Int_t label){
2101 // see headerfile for documentation
2102 Bool_t iResult=kFALSE;
2103 // cout<<"Checking particle label, particle is: "<<fMCStack->Particle(TMath::Abs(label))->GetName()<<endl;
2104 if(fMCStack->Particle(TMath::Abs(label))->GetPdgCode() == 221){
2113 Bool_t AliV0Reader::GetArmenterosQtAlpha(const AliKFParticle* negativeKFParticle, const AliKFParticle * positiveKFParticle, Double_t armenterosQtAlpha[2], Int_t kfProductionMethod){
2115 AliKFParticle PosParticle = *positiveKFParticle;
2116 AliKFParticle NegParticle = *negativeKFParticle;
2117 AliKFParticle Gamma;
2118 if(kfProductionMethod < 3)
2119 Gamma.ConstructGamma(PosParticle, NegParticle);
2120 else if(kfProductionMethod == 3){
2121 Gamma += PosParticle;
2122 Gamma += NegParticle;
2125 Double_t VertexGamma[3] = {Gamma.GetX(), Gamma.GetY(), Gamma.GetZ()};
2126 PosParticle.TransportToPoint(VertexGamma);
2127 NegParticle.TransportToPoint(VertexGamma);
2129 AliKFParticle::GetArmenterosPodolanski(PosParticle, NegParticle, armenterosQtAlpha);
2137 Bool_t AliV0Reader::GetArmenterosQtAlpha(const AliKFParticle* negativeKFParticle, const AliKFParticle * positiveKFParticle, const AliKFParticle * gammaKFCandidate, Double_t armenterosQtAlpha[2] ){
2138 //see header file for documentation
2140 TVector3 momentumVectorPositiveKF(positiveKFParticle->GetPx(),positiveKFParticle->GetPy(),positiveKFParticle->GetPz());
2141 TVector3 momentumVectorNegativeKF(negativeKFParticle->GetPx(),negativeKFParticle->GetPy(),negativeKFParticle->GetPz());
2142 TVector3 vecV0(gammaKFCandidate->GetPx(),gammaKFCandidate->GetPy(),gammaKFCandidate->GetPz());
2144 Float_t thetaV0pos=TMath::ACos(( momentumVectorPositiveKF* vecV0)/(momentumVectorPositiveKF.Mag() * vecV0.Mag()));
2145 Float_t thetaV0neg=TMath::ACos(( momentumVectorNegativeKF* vecV0)/(momentumVectorNegativeKF.Mag() * vecV0.Mag()));
2147 Float_t alfa =((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)-(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg))/
2148 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
2151 Float_t qt = momentumVectorPositiveKF.Mag()*TMath::Sin(thetaV0pos);
2153 armenterosQtAlpha[0]=qt;
2154 armenterosQtAlpha[1]=alfa;
2160 Bool_t AliV0Reader::GetArmenterosQtAlpha(const AliESDv0* v0, Double_t armenterosQtAlpha[2])
2161 { //see header file for documentation
2163 Double_t mn[3] = {0,0,0};
2164 Double_t mp[3] = {0,0,0};
2165 Double_t mm[3] = {0,0,0};
2168 Int_t pIndex = 0, nIndex = 0;
2169 pIndex = v0->GetPindex();
2170 nIndex = v0->GetNindex();
2173 d[0] = dynamic_cast<AliESDtrack*>(fESDEvent->GetTrack(pIndex));
2174 d[1] = dynamic_cast<AliESDtrack*>(fESDEvent->GetTrack(nIndex));
2177 sign[0] = (int)d[0]->GetSign();
2178 sign[1] = (int)d[1]->GetSign();
2180 Bool_t correct = kFALSE;
2183 if(-1 == sign[0] && 1 == sign[1]){
2192 v0->GetNPxPyPz(mn[0],mn[1],mn[2]); //reconstructed cartesian momentum components of negative daughter
2193 v0->GetPPxPyPz(mp[0],mp[1],mp[2]); //reconstructed cartesian momentum components of positive daughter
2196 v0->GetPPxPyPz(mn[0],mn[1],mn[2]); //reconstructed cartesian momentum components of negative daughter
2197 v0->GetNPxPyPz(mp[0],mp[1],mp[2]); //reconstructed cartesian momentum components of positive daughter
2199 v0->GetPxPyPz(mm[0],mm[1],mm[2]); //reconstructed cartesian momentum components of mother
2201 TVector3 vecN(mn[0],mn[1],mn[2]);
2202 TVector3 vecP(mp[0],mp[1],mp[2]);
2203 TVector3 vecM(mm[0],mm[1],mm[2]);
2205 Double_t thetaP = acos((vecP * vecM)/(vecP.Mag() * vecM.Mag()));
2206 Double_t thetaN = acos((vecN * vecM)/(vecN.Mag() * vecM.Mag()));
2208 Double_t alfa = ((vecP.Mag())*cos(thetaP)-(vecN.Mag())*cos(thetaN))/
2209 ((vecP.Mag())*cos(thetaP)+(vecN.Mag())*cos(thetaN)) ;
2210 Double_t qt = vecP.Mag()*sin(thetaP);
2212 armenterosQtAlpha[0]=qt;
2213 armenterosQtAlpha[1]=alfa;
2221 Bool_t AliV0Reader::GetArmenterosQtAlpha(const TParticle* negativeParticle, const TParticle * positiveParticle, const AliKFParticle * gammaKFCandidate, Double_t armenterosQtAlpha[2] ){
2222 //see header file for documentation
2224 TVector3 momentumVectorPositiveKF(positiveParticle->Px(),positiveParticle->Py(),positiveParticle->Pz());
2225 TVector3 momentumVectorNegativeKF(negativeParticle->Px(),negativeParticle->Py(),negativeParticle->Pz());
2226 TVector3 vecV0(gammaKFCandidate->GetPx(),gammaKFCandidate->GetPy(),gammaKFCandidate->GetPz());
2228 Float_t thetaV0pos=TMath::ACos(( momentumVectorPositiveKF* vecV0)/(momentumVectorPositiveKF.Mag() * vecV0.Mag()));
2229 Float_t thetaV0neg=TMath::ACos(( momentumVectorNegativeKF* vecV0)/(momentumVectorNegativeKF.Mag() * vecV0.Mag()));
2233 if ( positiveParticle->GetPdgCode() == 11 || positiveParticle->GetPdgCode() == 13 || positiveParticle->GetPdgCode() == 15){
2234 alfa =((momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)-(momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos))/
2235 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
2236 qt = momentumVectorNegativeKF.Mag()*TMath::Sin(thetaV0neg);
2237 } else if ( negativeParticle->GetPdgCode() == -11 || negativeParticle->GetPdgCode() == -13 || negativeParticle->GetPdgCode() == -15){
2238 alfa =((momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)-(momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos))/
2239 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
2240 qt = momentumVectorNegativeKF.Mag()*TMath::Sin(thetaV0neg);
2241 } else if (positiveParticle->GetPdgCode() < 0 && positiveParticle->GetPdgCode() != -11 && positiveParticle->GetPdgCode() != -13 && positiveParticle->GetPdgCode() != -15 ){
2242 alfa =((momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)-(momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos))/
2243 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
2244 qt = momentumVectorNegativeKF.Mag()*TMath::Sin(thetaV0neg);
2246 alfa =((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)-(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg))/
2247 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
2248 qt = momentumVectorPositiveKF.Mag()*TMath::Sin(thetaV0pos);
2251 armenterosQtAlpha[0]=qt;
2252 armenterosQtAlpha[1]=alfa;
2257 Bool_t AliV0Reader::GetArmenterosQtAlpha(const TParticle* negativeParticle, const TParticle * positiveParticle, const TParticle * gammaCandidate, Double_t armenterosQtAlpha[2] ){
2258 //see header file for documentation
2260 TVector3 momentumVectorPositiveKF(positiveParticle->Px(),positiveParticle->Py(),positiveParticle->Pz());
2261 TVector3 momentumVectorNegativeKF(negativeParticle->Px(),negativeParticle->Py(),negativeParticle->Pz());
2262 TVector3 vecV0(gammaCandidate->Px(),gammaCandidate->Py(),gammaCandidate->Pz());
2264 Float_t thetaV0pos=TMath::ACos(( momentumVectorPositiveKF* vecV0)/(momentumVectorPositiveKF.Mag() * vecV0.Mag()));
2265 Float_t thetaV0neg=TMath::ACos(( momentumVectorNegativeKF* vecV0)/(momentumVectorNegativeKF.Mag() * vecV0.Mag()));
2269 if ( positiveParticle->GetPdgCode() == 11 || positiveParticle->GetPdgCode() == 13 || positiveParticle->GetPdgCode() == 15){
2270 alfa =((momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)-(momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos))/
2271 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
2272 qt = momentumVectorNegativeKF.Mag()*TMath::Sin(thetaV0neg);
2273 } else if ( negativeParticle->GetPdgCode() == -11 || negativeParticle->GetPdgCode() == -13 || negativeParticle->GetPdgCode() == -15){
2274 alfa =((momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)-(momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos))/
2275 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
2276 qt = momentumVectorNegativeKF.Mag()*TMath::Sin(thetaV0neg);
2277 } else if (positiveParticle->GetPdgCode() < 0 && positiveParticle->GetPdgCode() != -11 && positiveParticle->GetPdgCode() != -13 && positiveParticle->GetPdgCode() != -15 ){
2278 alfa =((momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)-(momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos))/
2279 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
2280 qt = momentumVectorNegativeKF.Mag()*TMath::Sin(thetaV0neg);
2282 alfa =((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)-(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg))/
2283 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
2284 qt = momentumVectorPositiveKF.Mag()*TMath::Sin(thetaV0pos);
2287 armenterosQtAlpha[0]=qt;
2288 armenterosQtAlpha[1]=alfa;
2294 Int_t AliV0Reader::GetFirstTPCRow(Double_t radius){
2297 Int_t firstTPCRow=0;
2298 Double_t radiusI = 84.8;
2299 Double_t radiusO = 134.6;
2300 Double_t radiusOB = 198.;
2301 Double_t rSizeI = 0.75;
2302 Double_t rSizeO = 1.;
2303 Double_t rSizeOB = 1.5;
2307 if(radius <= radiusI){
2310 if(radius>radiusI && radius<=radiusO){
2311 firstTPCRow = (Int_t)((radius-radiusI)/rSizeI);
2313 if(radius>radiusO && radius<=radiusOB){
2314 firstTPCRow = (Int_t)(nClsI+(radius-radiusO)/rSizeO);
2317 if(radius>radiusOB){
2318 firstTPCRow =(Int_t)(nClsIO+(radius-radiusOB)/rSizeOB);
2324 void AliV0Reader::SmearKFParticle(AliKFParticle * kfParticle)
2326 Double_t facPBrem = 1.;
2327 Double_t facPSig = 0.;
2333 P=kfParticle->GetP();
2334 phi=kfParticle->GetPhi();
2335 if( kfParticle->GetP()!=0){
2336 theta=acos( kfParticle->Pz()/ kfParticle->GetP());
2339 if( fPSigSmearing != 0. || fPSigSmearingCte!=0. ){
2340 facPSig = TMath::Sqrt(fPSigSmearingCte*fPSigSmearingCte+fPSigSmearing*fPSigSmearing*P*P)*fRandom.Gaus(0.,1.);
2343 if( fPBremSmearing != 1.){
2345 facPBrem = fBrem->GetRandom();
2349 kfParticle->Px() = facPBrem* (1+facPSig)* P*sin(theta)*cos(phi) ;
2350 kfParticle->Py() = facPBrem* (1+facPSig)* P*sin(theta)*sin(phi) ;
2351 kfParticle->Pz() = facPBrem* (1+facPSig)* P*cos(theta) ;
2352 kfParticle->E() = kfParticle->GetP();
2355 ///________________________________________________________________________
2356 const AliExternalTrackParam *AliV0Reader::GetExternalTrackParam(AliESDv0 *v0,Int_t charge){
2358 if(!(charge==1||charge==-1)){AliError("Charge not defined");return 0x0;}
2361 if(charge>0)label=0;
2363 // Check for sign flip
2366 if(!v0->GetParamN()||!v0->GetParamP())return 0x0;
2367 if(!GetTrack(v0->GetNindex())||!fESDEvent->GetTrack(v0->GetPindex()))return 0x0;
2368 if((GetTrack(v0->GetPindex()))->Charge()==charge){
2369 // fCurrentTrackLabels[label]=v0->GetPindex();
2370 return v0->GetParamP();}
2371 if((GetTrack(v0->GetNindex()))->Charge()==charge){
2372 // fCurrentTrackLabels[label]=v0->GetNindex();
2373 return v0->GetParamN();}
2378 ///________________________________________________________________________
2379 AliVTrack *AliV0Reader::GetTrack(Int_t label){
2381 return (AliESDtrack*)fESDEvent->GetTrack(label);
2383 // if(fAODEvent)return (AliAODTrack*)GetAODTrack(label);
2387 Double_t AliV0Reader::GetV0CosineOfPointingAngle(Double_t V0PointX, Double_t V0PointY, Double_t V0PointZ){
2388 // calculates the pointing angle of the recalculated V0
2390 Double_t momV0[3]; //momentum of the V0
2391 fCurrentV0->GetPxPyPz(momV0[0],momV0[1],momV0[2]);
2393 Double_t PosV0[3]; //Recalculated V0 Position vector
2395 PosV0[0] = V0PointX - fESDEvent->GetPrimaryVertex()->GetX();
2396 PosV0[1] = V0PointY - fESDEvent->GetPrimaryVertex()->GetY();
2397 PosV0[2] = V0PointZ - fESDEvent->GetPrimaryVertex()->GetZ();
2399 Double_t momV02 = momV0[0]*momV0[0] + momV0[1]*momV0[1] + momV0[2]*momV0[2];
2400 Double_t PosV02 = PosV0[0]*PosV0[0] + PosV0[1]*PosV0[1] + PosV0[2]*PosV0[2];
2402 Double_t cosinePointingAngle = (PosV0[0]*momV0[0] + PosV0[1]*momV0[1] + PosV0[2]*momV0[2] ) / TMath::Sqrt(momV02 * PosV02);
2404 return cosinePointingAngle;
2408 Double_t AliV0Reader::GetPsiPair(AliESDv0* v0)
2411 // Angle between daughter momentum plane and plane
2413 Float_t magField = fESDEvent->GetMagneticField();
2415 Double_t xyz[3] = {0.,0.,0.};
2416 v0->GetXYZ(xyz[0],xyz[1],xyz[2]);
2418 Double_t mn[3] = {0,0,0};
2419 Double_t mp[3] = {0,0,0};
2421 v0->GetNPxPyPz(mn[0],mn[1],mn[2]);//reconstructed cartesian momentum components of negative daughter;
2422 v0->GetPPxPyPz(mp[0],mp[1],mp[2]);//reconstructed cartesian momentum components of positive daughter;
2424 Double_t deltat = 1.;
2425 deltat = TMath::ATan(mp[2]/(TMath::Sqrt(mp[0]*mp[0] + mp[1]*mp[1])+1.e-13)) - TMath::ATan(mn[2]/(TMath::Sqrt(mn[0]*mn[0] + mn[1]*mn[1])+1.e-13));//difference of angles of the two daughter tracks with z-axis
2426 Double_t radiussum = TMath::Sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1]) + 50;//radius to which tracks shall be propagated
2428 Double_t momPosProp[3] = {0,0,0};
2429 Double_t momNegProp[3] = {0,0,0};
2431 AliExternalTrackParam nt = *(v0->GetParamN());
2432 AliExternalTrackParam pt = *(v0->GetParamP());
2434 Double_t psiPair = 4.;
2435 if(nt.PropagateTo(radiussum,magField) == 0) return psiPair; //propagate tracks to the outside -> Better Purity and Efficiency
2437 if(pt.PropagateTo(radiussum,magField) == 0) return psiPair; //propagate tracks to the outside -> Better Purity and Efficiency
2439 pt.GetPxPyPz(momPosProp);//Get momentum vectors of tracks after propagation
2440 nt.GetPxPyPz(momNegProp);
2443 TMath::Sqrt(momNegProp[0]*momNegProp[0]+momNegProp[1]*momNegProp[1]+momNegProp[2]*momNegProp[2]);//absolute momentum value of negative daughter
2446 TMath::Sqrt(momPosProp[0]*momPosProp[0]+momPosProp[1]*momPosProp[1]+momPosProp[2]*momPosProp[2]);//absolute momentum value of positive daughter
2448 Double_t scalarproduct =
2449 momPosProp[0]*momNegProp[0]+momPosProp[1]*momNegProp[1]+momPosProp[2]*momNegProp[2];//scalar product of propagated positive and negative daughters' momenta
2451 Double_t chipair = TMath::ACos(scalarproduct/(pEle*pPos));//Angle between propagated daughter tracks
2453 psiPair = TMath::Abs(TMath::ASin(deltat/chipair));
2458 Int_t AliV0Reader::GetNumberOfHijingPlusPythiaPrimeries(){
2460 // Calculate NPrimaries for LHC11a10b_*
2462 Int_t nproduced = 0;
2463 AliGenCocktailEventHeader *cHeader = dynamic_cast<AliGenCocktailEventHeader*>(fMCEvent->GenEventHeader());
2465 TList *genHeaders = cHeader->GetHeaders();
2466 AliGenEventHeader* gh = 0;
2467 for(Int_t i = 0; i<genHeaders->GetEntries();i++){
2468 gh = (AliGenEventHeader*)genHeaders->At(i);
2469 TString GeneratorName = gh->GetName();
2470 // cout<<i<<" "<<GeneratorName<<" "<<gh->NProduced()<<endl;
2471 if(GeneratorName.CompareTo("Hijing") == 0){
2472 nproduced = nproduced + gh->NProduced();
2474 else if(GeneratorName.CompareTo("Pythia") == 0){
2475 nproduced = nproduced + gh->NProduced();
2480 nproduced = fMCStack->GetNprimary();
2483 // cout<<fMCStack->GetNprimary()-nproduced<<endl;
2489 Bool_t AliV0Reader::IsParticleFromBGEvent(Int_t index){
2491 Bool_t particleFromBG = kFALSE;
2493 if(index == -1) return kFALSE;
2494 if(index > fNumberOfPrimerisFromHijingAndPythia && index < fMCStack->GetNprimary()){
2495 // cout<<index<<" "<<fNumberOfPrimerisFromHijingAndPythia<<endl;
2498 // else cout<<"Passt Noch "<<index<<" "<<fNumberOfPrimerisFromHijingAndPythia<<endl;
2499 // cout<<fMCEvent->IsFromBGEvent(index)<<endl;
2500 TParticle *BGParticle = fMCStack->Particle(index);
2501 if(BGParticle->GetMother(0) > -1) return kFALSE;
2502 Int_t indexMother = fMCStack->Particle(index)->GetMother(0);
2503 particleFromBG = IsParticleFromBGEvent(indexMother);