1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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, proviyaded 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 purapose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 ///////////////////////////////////////////////////////////////////////////
19 // Analysis for identified charged hadron spectra. //
22 ///////////////////////////////////////////////////////////////////////////
24 #include "Riostream.h"
33 #include "TObjArray.h"
37 #include "AliAnalysisTaskSE.h"
38 #include "AliAnalysisManager.h"
40 #include "AliHeader.h"
41 #include "AliGenPythiaEventHeader.h"
42 #include "AliGenCocktailEventHeader.h"
45 #include "AliESDtrackCuts.h"
46 #include "AliESDVertex.h"
47 #include "AliESDEvent.h"
48 #include "AliESDInputHandler.h"
49 #include "AliESDtrack.h"
50 #include "AliESDpid.h"
51 #include "AliCentrality.h"
52 #include "AliESDUtils.h"
53 #include "AliMultiplicity.h"
55 #include "AliMCEventHandler.h"
56 #include "AliMCEvent.h"
61 #include "AliAnalysisDeuteronpA.h"
63 #include "AliAnalysisUtils.h"
66 ClassImp(AliAnalysisDeuteronpA)
68 //________________________________________________________________________
69 AliAnalysisDeuteronpA::AliAnalysisDeuteronpA()
70 : AliAnalysisTaskSE("TaskChargedHadron"), fESD(0), fListHist(0), fESDtrackCuts(0),fESDTrackCutsMult(0),fESDpid(0),
85 fHistVertexResTracks(0)
87 // default Constructor
88 /* fast compilation test
89 gSystem->Load("libANALYSIS");
90 gSystem->Load("libANALYSISalice");
91 .L AliAnalysisDeuteronpA.cxx++
96 //________________________________________________________________________
97 AliAnalysisDeuteronpA::AliAnalysisDeuteronpA(const char *name)
98 : AliAnalysisTaskSE(name), fESD(0), fListHist(0), fESDtrackCuts(0),fESDTrackCutsMult(0),fESDpid(0),
113 fHistVertexResTracks(0)
116 // standard constructur which should be used
118 Printf("*** CONSTRUCTOR CALLED ****");
123 fAlephParameters[0] = 0.0283086;
124 fAlephParameters[1] = 2.63394e+01;
125 fAlephParameters[2] = 5.04114e-11;
126 fAlephParameters[3] = 2.12543e+00;
127 fAlephParameters[4] = 4.88663e+00;
129 // initialize PID object
131 //fESDpid = new AliESDpid();
135 fESDtrackCuts = new AliESDtrackCuts("AliESDtrackCuts","AliESDtrackCuts");
138 // Output slot #0 writes into a TList container
139 DefineOutput(1, TList::Class());
144 //________________________________________________________________________
145 void AliAnalysisDeuteronpA::Initialize()
148 // updating parameters in case of changes
152 fESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE,kTRUE);
153 fESDtrackCuts->SetMaxDCAToVertexXY(3);
154 fESDtrackCuts->SetMaxDCAToVertexZ(2);
155 fESDtrackCuts->SetEtaRange(-0.9,0.9);
162 //________________________________________________________________________
163 void AliAnalysisDeuteronpA::UserCreateOutputObjects()
166 //Create analysis utils for event selection and pileup rejection
167 fUtils = new AliAnalysisUtils();
168 fUtils->SetCutOnZVertexSPD(kFALSE);
173 fListHist = new TList();
174 fListHist->SetOwner(kTRUE);
176 const Int_t kPtBins = 28;
177 const Int_t kMultBins = 11;
178 const Int_t kDcaBins = 38;
182 Double_t binsPt[kPtBins+1] = {0., 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6};
184 // provide a reasonable dca/binning
186 Double_t binsDca[kDcaBins+1];
187 for(Int_t i = 0; i< kDcaBins+1; i++) {
188 binsDca[i] = 1.5*(1./TMath::Exp(-TMath::Abs((i - kDcaBins/2.))/(kDcaBins/2)) -1);
189 if ((i - kDcaBins/2.) < 0) binsDca[i] *= -1;
190 //cout << binsDca[i] << endl;
193 // create the histograms with all necessary information --> it is filled 4x for each particle assumption
195 // (0.) assumed particle: 0. deuteron, 1. triton, 2. He-3
196 // (1.) multiplicity or centrality -- number of accepted ESD tracks per events (deprecated), but now classes from 1 to 10, 0: Min. Bias
199 // (4.) rapidity --> filled 4x
200 // (5.) pull TPC dEx --> filled 4x
201 // (6.) has valid TOF pid signal
202 // (7.) nsigma TOF --> filled 4x XXXXXXXXX no mass*mass
204 // (9.) CODE -- only MC 0-generated, 1-true rec. primaries, 2-misident prim, 3-second weak, 4-second material, 5-misident sec
206 // 0, 1, 2, 3, 4, 5, 6, 7, 8
207 Int_t binsHistReal[9] = { 3, kMultBins, kPtBins, 2, 12, 50, 2, 100, kDcaBins};
208 Double_t xminHistReal[9] = {-0.5, -0.5, 0, -2, -0.6, -5,- 0.5, -2.5, -3};
209 Double_t xmaxHistReal[9] = { 2.5, 10.5, 3, 2, 0.6, 5, 1.5, 2.5, 3};
210 fHistRealTracks = new THnSparseF("fHistRealTracks","real tracks",9,binsHistReal,xminHistReal,xmaxHistReal);
212 fHistRealTracks->GetAxis(2)->Set(kPtBins, binsPt);
213 fHistRealTracks->GetAxis(8)->Set(kDcaBins, binsDca);
214 fListHist->Add(fHistRealTracks);
217 fHistPidQA = new TH3F("fHistPidQA","PID QA",500,0.1,10,1000,0,1000,2,-2,2);
218 BinLogAxis(fHistPidQA);
219 fListHist->Add(fHistPidQA);
221 fHistTofQA = new TH2F("fHistTofQA","TOF-QA",200,-4.,4.,400,0,1.1);
222 fListHist->Add(fHistTofQA);
223 // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
224 Int_t binsHistMC[10] = { 3, kMultBins, kPtBins, 2, 12, 50, 2, 100, kDcaBins, 6};
225 Double_t xminHistMC[10] = {-0.5, -0.5, 0, -2, -0.6, -5,- 0.5, -2.5, -3, -0.5};
226 Double_t xmaxHistMC[10] = { 2.5, 10.5, 3, 2, 0.6, 5, 1.5, 2.5, 3, 5.5};
228 // different binning for CODE axis, if we want to save motherPDG
230 fHistMCparticles = new THnSparseF("fHistMCparticles","MC histogram",10,binsHistMC,xminHistMC,xmaxHistMC);
231 fHistMCparticles->GetAxis(2)->Set(kPtBins, binsPt);
232 fHistMCparticles->GetAxis(8)->Set(kDcaBins, binsDca);
233 fListHist->Add(fHistMCparticles);
235 fHistMult = new TH2F("fHistMult", "control histogram to count number of events", 502, -2.5, 499.5,4,-0.5,3.5);
236 fHistCentrality = new TH1F("fHistCentrality", "control histogram to count number of events", 22, -1.5, 20.5);
237 fListHist->Add(fHistMult);
238 fListHist->Add(fHistCentrality);
240 fHistMomCorr = new TH2F("fHistMomCorr","momentum correction; pT_{MCtrue}; rel. difference",200,0,3,200,-0.2,0.2);
241 fListHist->Add(fHistMomCorr);
243 fHistEtaPtGen = new TH3F("fHistPtEtaGen","rapidity correction; p_{T} (GeV/c); rapidity y; pid",200,0,12, 200,-1.2,1.2, 3,-0.5,2.5);
244 fListHist->Add(fHistEtaPtGen);
246 fHistVertex = new TH2F("fHistVertex","vertex position; V_{XY} (cm); V_{Z}",2000,-1.,1.,400,-20.,20.);
247 fListHist->Add(fHistVertex);
249 fHistVertexRes = new TH1F("fHistVertexRes","vertex position difference MC truth and rec; V_{Z,rec} - V_{Z,truth} (cm)",2000,-0.5,0.5);
250 fListHist->Add(fHistVertexRes);
252 fHistVertexResTracks = new TH2F("fHistVertexResTracks","vertex res vs no of tracks; no. of ch. primaries |#eta| < 0.9; V_{Z,rec} - V_{Z,truth} (cm)",50,-0.5,499.5,200,-0.05,0.05);
253 fListHist->Add(fHistVertexResTracks);
255 PostData(1, fListHist);
259 //________________________________________________________________________
260 void AliAnalysisDeuteronpA::UserExec(Option_t *)
265 if (!fESDpid) fESDpid = ((AliESDInputHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->GetESDpid();
267 fESDpid = new AliESDpid(); // HACK FOR MC PBPB --> PLEASE REMOVE AS SOON AS POSSIBLE
268 fESDpid->GetTPCResponse().SetBetheBlochParameters(1.28778e+00/50., 3.13539e+01, TMath::Exp(-3.16327e+01), 1.87901e+00, 6.41583e+00);
270 //AliLog::SetGlobalLogLevel(AliLog::kError);
272 // Check Monte Carlo information and other access first:
274 AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
276 //Printf("ERROR: Could not retrieve MC event handler");
280 AliMCEvent* mcEvent = 0x0;
281 AliStack* stack = 0x0;
282 if (eventHandler) mcEvent = eventHandler->MCEvent();
284 //Printf("ERROR: Could not retrieve MC event");
288 stack = mcEvent->Stack();
292 fESD = dynamic_cast<AliESDEvent*>( InputEvent() );
294 //Printf("ERROR: fESD not available");
298 //check with analysis utils
299 //first event in chunck --> continue
300 if(fUtils->IsFirstEventInChunk(fESD)) {
301 PostData(1, fListHist);
305 if (fUtils->IsPileUpEvent(fESD)){
306 PostData(1, fListHist);
310 Bool_t isVtxOk = kTRUE;
311 if(!fUtils->IsVertexSelected2013pA(fESD)) isVtxOk = kFALSE;
312 //NEED TO PUT THIS IN ACTION SOMEWHERE
315 if (!fESDtrackCuts) {
316 Printf("ERROR: fESDtrackCuts not available");
320 // check if event is selected by physics selection class
323 // monitor vertex position
325 const AliESDVertex *vertex = fESD->GetPrimaryVertexTracks();
326 if(vertex->GetNContributors()<1) {
328 vertex = fESD->GetPrimaryVertexSPD();
329 if(vertex->GetNContributors()<1) vertex = 0x0;
332 // fill histogram to monitor vertex position
333 if (vertex && isVtxOk) fHistVertex->Fill(TMath::Sqrt(vertex->GetXv()*vertex->GetXv() + vertex->GetYv()*vertex->GetYv()),vertex->GetZv());
335 Float_t vertexRes = -100;
336 Int_t nPrimaries = 0;
339 if (fMCtrue && vertex && isVtxOk) {
342 for(Int_t i = 0; i < stack->GetNtrack(); i++) {
343 TParticle * trackMC = stack->Particle(i);
345 if (!trackMC->IsPrimary()) continue;
347 //Double_t xv = trackMC->Vx();
348 //Double_t yv = trackMC->Vy();
349 Double_t zv = trackMC->Vz();
351 vertexRes = vertex->GetZv() - zv;
352 fHistVertexRes->Fill(vertex->GetZv() - zv);
357 for(Int_t i = 0; i < stack->GetNtrack(); i++) {
358 TParticle * trackMC = stack->Particle(i);
360 // if (trackMC->IsPrimary()) {
361 if (stack->IsPhysicalPrimary(i)) {
362 if (trackMC->Eta() > -0.9 && trackMC->Eta() < 0.9 && trackMC->GetPDG()->Charge() != 0){
364 //cout << nPrimaries << endl;
370 fHistVertexResTracks->Fill(nPrimaries, vertexRes);
376 Float_t centrality = -1;
379 Int_t rootS = fESD->GetBeamEnergy() < 1000 ? 0 : 1;
380 if (fESD->GetEventSpecie() == 4) { // PbPb
382 AliCentrality *esdCentrality = fESD->GetCentrality();
383 centrality = esdCentrality->GetCentralityClass10("V0M") + 1; // centrality percentile determined with V0
384 if (TMath::Abs(centrality - 1) < 1e-5) {
385 centrality = esdCentrality->GetCentralityClass5("V0M");
389 AliCentrality *esdCentrality = fESD->GetCentrality();
390 centrality = esdCentrality->GetCentralityClass10("V0A") + 1; // centrality percentile determined with V0A
391 if (TMath::Abs(centrality - 1) < 1e-5) {
392 centrality = esdCentrality->GetCentralityClass5("V0A");
397 Int_t processCode = 0;
399 // important change: fill generated only after vertex cut in case of heavy-ions
401 if ( fESD->GetEventSpecie() == 4) {
402 if (!vertex || !isVtxOk) {
403 fHistMult->Fill(-1, processCode);
404 PostData(1, fListHist);
407 if (TMath::Abs(vertex->GetZv()) > 10) {
408 fHistMult->Fill(-1, processCode);
409 PostData(1, fListHist);
418 for(Int_t i = 0; i < stack->GetNtrack(); i++) {
419 TParticle * trackMC = stack->Particle(i);
420 Int_t pdg = trackMC->GetPdgCode();
422 Double_t xv = trackMC->Vx();
423 Double_t yv = trackMC->Vy();
424 Double_t zv = trackMC->Vz();
426 dxy = TMath::Sqrt(xv*xv + yv*yv); // so stupid to avoid warnings
428 //dz = TMath::Abs(zv); // so stupid to avoid warnings
430 // vertex cut - selection of primaries
432 //if (dxy > 3 || dz > 10) continue; // fixed cut at 3cm in r
434 if (!stack->IsPhysicalPrimary(i)) continue;
436 // fill MC histograms here...
438 Double_t rap = trackMC->Y();
439 if (fRapCMSpA) rap = rap + 0.465;
440 Double_t pT = trackMC->Pt();
441 Int_t sign = pdg < 0 ? -1 : 1; // only works for charged pi,K,p !!
442 // Double_t transMass = TMath::Sqrt(trackMC->Pt()*trackMC->Pt() + trackMC->GetMass()*trackMC->GetMass()) - trackMC->GetMass();
445 if (TMath::Abs(pdg) == 1000010020) iPart = 0; // select d+/d- only
446 if (TMath::Abs(pdg) == 1000010030) iPart = 1; // select t+/t- only
447 if (TMath::Abs(pdg) == 1000020030) iPart = 2; // select He+/He- only
448 if (iPart == -1) continue;
450 Double_t vecHistMC[10] = {iPart, centrality, pT, sign, rap, 0, 1, 0, dxy, 0};
451 fHistMCparticles->Fill(vecHistMC);
453 if (iPart == 0) fHistEtaPtGen->Fill(pT, trackMC->Y(), 0.);
454 if (iPart == 1) fHistEtaPtGen->Fill(pT, trackMC->Y(), 1.);
455 if (iPart == 2) fHistEtaPtGen->Fill(pT, trackMC->Y(), 2.);
462 fHistMult->Fill(-1, processCode);
463 PostData(1, fListHist);
466 if (TMath::Abs(vertex->GetZv()) > 10) {
467 fHistMult->Fill(-1, processCode);
468 PostData(1, fListHist);
473 // count events after physics selection and after vertex selection
475 fHistMult->Fill(fESDtrackCuts->CountAcceptedTracks(fESD), 0);
476 fHistMult->Fill(fESD->GetNumberOfTracks(), 1);
477 fHistCentrality->Fill(centrality);
479 //***************************************************
481 //***************************************************
482 //const Float_t kNsigmaCut = 3;
483 //const Float_t k2sigmaCorr = 1/(0.5*(TMath::Erf(kNsigmaCut/sqrt(2))-TMath::Erf(-kNsigmaCut/sqrt(2))))/*1/0.9545*/;
485 Float_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z for the vertex cut
487 for (Int_t i=0;i<fESD->GetNumberOfTracks();++i) {
489 AliESDtrack *track =fESD->GetTrack(i);
490 if (!track->GetInnerParam()) continue;
492 Double_t ptot = track->GetInnerParam()->GetP(); // momentum for dEdx determination
494 // momentum correction for different mass assumption in tracking
496 Double_t pT = track->Pt()/(1 - 0.333303/TMath::Power(track->Pt() + 0.651111, 5.27268));
497 // -[0]/TMath::Power(x - [1],[2])
499 track->GetImpactParameters(dca, cov);
501 // cut for dead regions in the detector
502 // if (track->Eta() > 0.1 && (track->Eta() < 0.2 && track->Phi() > 0.1 && track->Phi() < 0.1) continue;
504 // 2.a) apply some standard track cuts according to general recommendations
506 if (!fESDtrackCuts->AcceptTrack(track)) continue;
508 UInt_t status = track->GetStatus();
510 Bool_t hasTOFout = status&AliESDtrack::kTOFout;
511 Bool_t hasTOFtime = status&AliESDtrack::kTIME;
512 Bool_t hasTOF = kFALSE;
513 if (hasTOFout) hasTOF = kTRUE;
514 Float_t length = track->GetIntegratedLength();
515 if (length < 350.) hasTOF = kFALSE;
517 // calculate rapidities and kinematics
521 track->GetPxPyPz(pvec);
522 Double_t energyDeuteron = TMath::Sqrt(pT*pT + pvec[2]*pvec[2] +
523 AliPID::ParticleMass(AliPID::kDeuteron)*AliPID::ParticleMass(AliPID::kDeuteron));
524 Double_t energyTriton = TMath::Sqrt(track->GetP()*track->GetP() +
525 AliPID::ParticleMass(AliPID::kTriton)*AliPID::ParticleMass(AliPID::kTriton));
526 Double_t energyHe3 = TMath::Sqrt(track->GetP()*2*track->GetP()*2 +
527 AliPID::ParticleMass(AliPID::kHe3)*AliPID::ParticleMass(AliPID::kHe3));
529 Double_t rapDeuteron = 0.5*TMath::Log((energyDeuteron + pvec[2])/(energyDeuteron - pvec[2]));
530 Double_t rapTriton = 0.5*TMath::Log((energyTriton + pvec[2])/(energyTriton - pvec[2]));
531 Double_t rapHe3 = 0.5*TMath::Log((energyHe3 + pvec[2]*2)/(energyHe3 - pvec[2]*2));
534 rapDeuteron = rapDeuteron + 0.465;
535 rapTriton = rapTriton + 0.465;
536 rapHe3 = rapHe3 + 0.465;
542 Double_t sign = track->GetSign();
543 Double_t tpcSignal = track->GetTPCsignal();
546 // 3.a. calculate expected signals in nsigma
549 // (0.) assumed particle: 0. pion, 1. kaon, 2. proton, 3. deuteron
550 // (1.) multiplicity or centrality -- number of accepted ESD tracks per events (deprecated), but now classes from 1 to 10, 0: Min. Bias
553 // (4.) rapidity --> filled 4x
554 // (5.) pull TPC dEx --> filled 4x
555 // (6.) has valid TOF pid signal
556 // (7.) nsigma TOF --> filled 4x
558 // (9.) CODE -- only MC 0-generated, 1-true rec. primaries, 2-misident, 3-second weak, 4-second material
561 Float_t deutExp = AliExternalTrackParam::BetheBlochAleph(ptot/(0.938*2),1.45802,27.4992,4.00313e-15,2.48485,8.31768);
562 Float_t tritExp = AliExternalTrackParam::BetheBlochAleph(ptot/(0.938*3),1.45802,27.4992,4.00313e-15,2.48485,8.31768);
563 Float_t hel3Exp = 4*AliExternalTrackParam::BetheBlochAleph(2*ptot/(0.938*3),1.74962,27.4992,4.00313e-15,2.42485,8.31768);
564 if (fMCtrue && ptot > 0.3) {
565 //Double_t parMC[5] = {1.17329, 27.4992, 4.00313e-15, 2.35563, 9.47569}; // OLD FOR LHC11b9_1 !!
566 //Double_t parMC[5] = {1.17329, 27.4992, 4.00313e-15, 2.1204316, 4.1373729}; // NEW!!! PbPb
567 Double_t parMC[5] = {20.1533, 2.58127, 0.00114169, 2.0373, 0.502123}; //for LHC13b2efix enhanced
568 deutExp = AliExternalTrackParam::BetheBlochAleph(ptot/(0.938*2),parMC[0],parMC[1],parMC[2],parMC[3],parMC[4]);
569 tritExp = AliExternalTrackParam::BetheBlochAleph(ptot/(0.938*3),parMC[0],parMC[1],parMC[2],parMC[3],parMC[4]);
570 hel3Exp = 4*AliExternalTrackParam::BetheBlochAleph(2*ptot/(0.938*3),parMC[0],parMC[1],parMC[2],parMC[3],parMC[4]);
574 Double_t rap[4] = {rapDeuteron, rapTriton, rapHe3,0};
575 Double_t pullsTPC[4] = {(tpcSignal - deutExp)/(0.07*deutExp),
576 (tpcSignal - tritExp)/(0.07*tritExp),
577 (tpcSignal - hel3Exp)/(0.07*hel3Exp),
580 // Process TOF information
582 //Float_t time0 = fESDpid->GetTOFResponse().GetTimeZero();
583 Float_t time0 = fESDpid->GetTOFResponse().GetStartTime(track->P());//fESDpid->GetTOFResponse().GetTimeZero();
589 time = track->GetTOFsignal() - time0;
591 beta = length / (2.99792457999999984e-02 * time);
592 Float_t gamma = 1/TMath::Sqrt(1 - beta*beta);
593 mass = ptot/TMath::Sqrt(gamma*gamma - 1); // using inner TPC mom. as approx.
598 Double_t timeDeuteron = (length/2.99792457999999984e-02) * TMath::Sqrt(1 + 1.876*1.876/(ptot*ptot));
599 Double_t timeTriton = (length/2.99792457999999984e-02) * TMath::Sqrt(1 + 2.809*2.809/(ptot*ptot));
600 Double_t timeHe3 = (length/2.99792457999999984e-02) * TMath::Sqrt(1 + 2.809*2.809/(2*ptot*2*ptot));
603 Double_t pullsTOF[4] ={0.,0.,0.,0.};
604 pullsTOF[0] = mass*mass - 1.876*1.876; // assuming 130.ps time resolution
605 pullsTOF[1] = mass*mass - 2.809*2.809;
606 pullsTOF[2] = mass*mass - 2.809*2.809;
610 if (hasTOFout && hasTOFtime && TMath::Abs(pullsTPC[1]) < 3) fHistTofQA->Fill(ptot*sign, beta);
613 for(Int_t iPart = 0; iPart < 3; iPart++) { // loop over assumed particle type
615 // temporary measure to reduce memory: fill only deuterons
617 if (iPart != 0) continue;
618 // 0, 1, 2, 3, 4, 5, 6, 7, 8
619 Double_t vecHistReal[9] = {iPart, centrality, pT, sign, rap[iPart], pullsTPC[iPart], hasTOF, pullsTOF[iPart], dca[0]};
620 fHistRealTracks->Fill(vecHistReal);
621 if (TMath::Abs(rap[1]) < 0.5) fHistPidQA->Fill(ptot,tpcSignal,sign); // has to be used for the very difficult deuterons.
623 // using MC truth for precise efficiencies...
626 Int_t code = 9; // code: 0-generated, 1-true rec. primaries, 2-misident, 3-second weak, 4-second material
627 Int_t assumedPdg = 0;//2212(proton); 321(Kaon); 211(pion);
629 if (iPart == 0) assumedPdg = 1000010020;
630 if (iPart == 1) assumedPdg = 1000010030;
631 if (iPart == 2) assumedPdg = 1000020030;
634 TParticle *trackMC = stack->Particle(TMath::Abs(track->GetLabel()));
635 Int_t pdg = TMath::Abs(trackMC->GetPdgCode());
637 if (pdg != assumedPdg && stack->IsPhysicalPrimary(TMath::Abs(track->GetLabel()))) code = 2;
638 if (pdg != assumedPdg && stack->IsSecondaryFromWeakDecay(TMath::Abs(track->GetLabel()))) code = 5;
639 if (pdg == assumedPdg && stack->IsPhysicalPrimary(TMath::Abs(track->GetLabel()))) code = 1;
640 if (pdg == assumedPdg && stack->IsSecondaryFromWeakDecay(TMath::Abs(track->GetLabel()))) {
643 if (pdg == assumedPdg && stack->IsSecondaryFromMaterial(TMath::Abs(track->GetLabel()))) code = 4;
645 // fill momentum correction histogram
647 if (code == 1) fHistMomCorr->Fill(trackMC->Pt(), (pT - trackMC->Pt())/trackMC->Pt());
649 //here cout rap[ipart] and trackMC->Y() and pT
650 //if (trackMC->Pt()>1.5 && TMath::Abs(rap[iPart] - trackMC->Y()) > 0.1) {
651 // printf("Y_rec: %4.3f Y_MC: %4.3f p_T: %5.3f \n", rap[iPart], trackMC->Y(), trackMC->Pt());
654 // check TOF mismatch on MC basis with TOF label
656 Int_t tofLabel[3] = {0,0,0};
657 track->GetTOFLabel(tofLabel);
660 if (TMath::Abs(track->GetLabel()) != TMath::Abs(tofLabel[0]) || tofLabel[1] > 0) {
662 if (TMath::Abs(trackMC->GetFirstMother()) == TMath::Abs(tofLabel[0])) hasTOF = kTRUE;
665 // IMPORTANT BIG PROBLEM HERE THE PROBABLILITY TO HAVE A PID SIGNAL MUST BE IN !!!!!!!!!!!!
667 // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
668 Double_t vectorHistMC[10] = {iPart, centrality, pT, sign, rap[iPart], pullsTPC[iPart], hasTOF, pullsTOF[iPart], dca[0], code};
669 fHistMCparticles->Fill(vectorHistMC);
674 } // end loop over assumed particle type
677 } // end of track loop
680 PostData(1, fListHist);
685 //________________________________________________________________________
686 void AliAnalysisDeuteronpA::Terminate(Option_t *)
688 // Draw result to the screen
689 // Called once at the end of the query
690 Printf("*** CONSTRUCTOR CALLED ****");
695 //________________________________________________________________________
696 void AliAnalysisDeuteronpA::BinLogAxis(const TH1 *h) {
698 // Method for the correct logarithmic binning of histograms
700 TAxis *axis = h->GetXaxis();
701 int bins = axis->GetNbins();
703 Double_t from = axis->GetXmin();
704 Double_t to = axis->GetXmax();
705 Double_t *newBins = new Double_t[bins + 1];
708 Double_t factor = pow(to/from, 1./bins);
710 for (int i = 1; i <= bins; i++) {
711 newBins[i] = factor * newBins[i-1];
713 axis->Set(bins, newBins);