10 #include "AliMCEvent.h"
11 #include "AliMCParticle.h"
12 #include "AliESDtrackCuts.h"
13 #include "AliESDInputHandler.h"
14 #include "AliESDpid.h"
15 #include "AliAODInputHandler.h"
16 #include "AliAODEvent.h"
17 #include "AliAODMCParticle.h"
18 #include "AliCentrality.h"
19 #include "AliTracker.h"
21 #include "AliAnalysisNetParticleHelper.h"
25 // Task for NetParticle checks
26 // Author: Jochen Thaeder <jochen@thaeder.de>
28 ClassImp(AliAnalysisNetParticleHelper)
31 * ---------------------------------------------------------------------------------
33 * ---------------------------------------------------------------------------------
36 // MW make fgk ... static const
38 const Char_t* aPartNames[AliPID::kSPECIES][2] = {
46 const Char_t* aPartTitles[AliPID::kSPECIES][2] = {
47 {"Electron", "Positron"},
48 {"Anti-Muon", "Muon"},
49 {"Anti-Pion", "Proton"},
50 {"Anti-Kaon", "Kaon"},
51 {"Anti-Proton", "Proton"}
54 const Char_t* aPartTitlesLatex[AliPID::kSPECIES][2] = {
56 {"#mu^{-}", "#mu^{+}" },
57 {"#pi^{-}", "#pi^{+}" },
62 const Char_t* aControlPartNames[2] = {"lambdabar", "lambda"};
63 const Char_t* aControlPartTitles[2] = {"Anti-Lambda", "Lambda"};
66 * ---------------------------------------------------------------------------------
67 * Constructor / Destructor
68 * ---------------------------------------------------------------------------------
71 //________________________________________________________________________
72 AliAnalysisNetParticleHelper::AliAnalysisNetParticleHelper() :
75 fInputEventHandler(NULL),
83 fCentralityPercentile(-1.),
88 fMinTrackLengthMC(70.),
92 fParticleSpecies(AliPID::kProton),
93 fControlParticleCode(3122),
94 fControlParticleIsNeutral(kTRUE),
95 fControlParticleName("Lambda"),
100 fMinPtForTOFRequired(0.8),
109 fHCentralityStat(NULL),
110 fNCentralityBins(10),
118 AliLog::SetClassDebugLevel("AliAnalysisNetParticleHelper",10);
121 //________________________________________________________________________
122 AliAnalysisNetParticleHelper::~AliAnalysisNetParticleHelper() {
125 if (fModeDistCreation == 1) {
126 for (Int_t jj = 0; jj < 2; ++jj) {
127 if (fCorr0[jj]) delete[] fCorr0[jj];
128 if (fParticleSpecies == AliPID::kProton) {
129 if (fCorr1[jj]) delete[] fCorr1[jj];
130 if (fCorr2[jj]) delete[] fCorr2[jj];
133 if (fCorr0) delete[] fCorr0;
134 if (fParticleSpecies == AliPID::kProton) {
135 if (fCorr1) delete[] fCorr1;
136 if (fCorr2) delete[] fCorr2;
144 * ---------------------------------------------------------------------------------
146 * ---------------------------------------------------------------------------------
149 //________________________________________________________________________
150 void AliAnalysisNetParticleHelper::SetParticleSpecies(AliPID::EParticleType pid) {
151 // -- Set particle species (ID, Name, Title, Title LATEX)
153 if ( Int_t(pid) < 0 || Int_t(pid) >= AliPID::kSPECIES) {
154 AliWarning("Particle ID not in AliPID::kSPECIES --> Set to protons");
155 pid = AliPID::kProton;
158 fParticleSpecies = pid;
160 for (Int_t idxPart = 0; idxPart < 2; ++idxPart) {
161 fPartName[idxPart] = aPartNames[fParticleSpecies][idxPart];
162 fPartTitle[idxPart] = aPartTitles[fParticleSpecies][idxPart];
163 fPartTitleLatex[idxPart] = aPartTitlesLatex[fParticleSpecies][idxPart];
166 //________________________________________________________________________
167 void AliAnalysisNetParticleHelper::SetUsePID(Bool_t usePID) {
168 // -- Set usage of PID
169 // > if turn off, set charge types (ID, Name, Title, Title LATEX)
174 fParticleSpecies = AliPID::kUnknown;
176 fPartName[0] = "neg";
177 fPartName[1] = "pos";
178 fPartTitle[0] = "Negative";
179 fPartTitle[1] = "Positive";
180 fPartTitleLatex[0] = "Negative";
181 fPartTitleLatex[1] = "Positive";
186 * ---------------------------------------------------------------------------------
188 * ---------------------------------------------------------------------------------
191 //________________________________________________________________________
192 TString AliAnalysisNetParticleHelper::GetParticleName(Int_t idxPart) {
193 // -- Get particle Name
195 if( idxPart != 0 && idxPart != 1){
196 AliWarning("Particle type not known --> Set to antiparticles");
200 return fPartName[idxPart];
203 //________________________________________________________________________
204 TString AliAnalysisNetParticleHelper::GetParticleTitle(Int_t idxPart) {
205 // -- Get particle Title
207 if( idxPart != 0 && idxPart != 1){
208 AliWarning("Particle type not known --> Set to antiparticles");
212 return fPartTitle[idxPart];
215 //________________________________________________________________________
216 TString AliAnalysisNetParticleHelper::GetParticleTitleLatex(Int_t idxPart) {
217 // -- Get particle Title LATEX
219 if( idxPart != 0 && idxPart != 1){
220 AliWarning("Particle type not known --> Set to antiparticles");
224 return fPartTitleLatex[idxPart];
227 //________________________________________________________________________
228 TString AliAnalysisNetParticleHelper::GetControlParticleName(Int_t idxPart) {
229 // -- Get particle Title LATEX
231 if( idxPart != 0 && idxPart != 1){
232 AliWarning("Particle type not known --> Set to antiparticles");
236 return aControlPartNames[idxPart];
239 //________________________________________________________________________
240 TString AliAnalysisNetParticleHelper::GetControlParticleTitle(Int_t idxPart) {
241 // -- Get particle Title LATEX
243 if( idxPart != 0 && idxPart != 1){
244 AliWarning("Particle type not known --> Set to antiparticles");
248 return aControlPartTitles[idxPart];
252 * ---------------------------------------------------------------------------------
254 * ---------------------------------------------------------------------------------
257 //________________________________________________________________________
258 Int_t AliAnalysisNetParticleHelper::Initialize(Bool_t isMC, Int_t modeDistCreation) {
259 // -- Initialize helper
262 fModeDistCreation = modeDistCreation;
264 // -- Setup event cut statistics
265 InitializeEventStats();
267 // -- Setup trigger statistics
268 InitializeTriggerStats();
270 // -- Setup centrality statistics
271 InitializeCentralityStats();
273 // -- Load Eta correction function
274 iResult = InitializeEtaCorrection(isMC);
276 // -- Load track by track correction function
277 iResult = InitializeTrackbyTrackCorrection();
282 //________________________________________________________________________
283 Int_t AliAnalysisNetParticleHelper::SetupEvent(AliESDInputHandler *esdHandler, AliAODInputHandler *aodHandler, AliMCEvent *mcEvent) {
286 // -- Get ESD objects
288 fInputEventHandler = static_cast<AliInputEventHandler*>(esdHandler);
289 fESD = dynamic_cast<AliESDEvent*>(fInputEventHandler->GetEvent());
291 AliError("ESD event handler not available");
296 // -- Get AOD objects
298 fInputEventHandler = static_cast<AliInputEventHandler*>(aodHandler);
299 fAOD = dynamic_cast<AliAODEvent*>(fInputEventHandler->GetEvent());
301 AliError("AOD event handler not available");
306 // -- Get Common objects
307 fPIDResponse = fInputEventHandler->GetPIDResponse();
312 fStack = fMCEvent->Stack();
314 // -- Get event centrality
315 // > 0-5|5-10|10-20|20-30|30-40|40-50|50-60|60-70|70-80|80-90 --> 10 bins
316 // > 0 1 2 3 4 5 6 7 8 9
318 AliCentrality *centrality = NULL;
321 centrality = fESD->GetCentrality();
323 centrality = fAOD->GetHeader()->GetCentralityP();
326 AliError("Centrality not available");
330 Int_t centBin = centrality->GetCentralityClass10("V0M");
332 fCentralityBin = centrality->GetCentralityClass5("V0M");
333 else if (centBin == 10 || centBin == -1.)
335 else if (centBin > 0 && centBin < fNCentralityBins)
336 fCentralityBin = centBin + 1;
340 // -- Stay within the max centrality bin
341 if (fCentralityBin >= fCentralityBinMax)
344 fCentralityPercentile = centrality->GetCentralityPercentile("V0M");
346 // -- Update TPC pid with eta correction (only for ESDs!!)
348 UpdateEtaCorrectedTPCPid();
354 * ---------------------------------------------------------------------------------
355 * Event / Trigger Statistics
356 * ---------------------------------------------------------------------------------
359 //________________________________________________________________________
360 Bool_t AliAnalysisNetParticleHelper::IsEventTriggered() {
361 // -- Check if Event is triggered and fill Trigger Histogram
363 Bool_t *aTriggerFired = new Bool_t[fNTriggers];
364 for (Int_t ii = 0; ii < fNTriggers; ++ii)
365 aTriggerFired[ii] = kFALSE;
367 if ((fInputEventHandler->IsEventSelected() & AliVEvent::kMB)) aTriggerFired[0] = kTRUE;
368 if ((fInputEventHandler->IsEventSelected() & AliVEvent::kCentral)) aTriggerFired[1] = kTRUE;
369 if ((fInputEventHandler->IsEventSelected() & AliVEvent::kSemiCentral)) aTriggerFired[2] = kTRUE;
370 if ((fInputEventHandler->IsEventSelected() & AliVEvent::kEMCEJE)) aTriggerFired[3] = kTRUE;
371 if ((fInputEventHandler->IsEventSelected() & AliVEvent::kEMCEGA)) aTriggerFired[4] = kTRUE;
373 Bool_t isTriggered = kFALSE;
375 for (Int_t ii=0; ii<fNTriggers; ++ii) {
376 if(aTriggerFired[ii]) {
378 fHTriggerStat->Fill(ii);
382 delete[] aTriggerFired;
387 //________________________________________________________________________
388 Bool_t AliAnalysisNetParticleHelper::IsEventRejected() {
389 // -- Evaluate event statistics histograms
391 Int_t *aEventCuts = new Int_t[fHEventStatMax];
392 // set aEventCuts[ii] to 1 in case of reject
394 for (Int_t ii=0;ii<fHEventStatMax; ++ii)
399 // -- 0 - Before Physics Selection
400 aEventCuts[iCut] = 0;
402 // -- 1 - No Trigger fired
404 if (!IsEventTriggered())
405 aEventCuts[iCut] = 1;
409 const AliESDVertex* vtxESD = NULL;
410 const AliAODVertex* vtxAOD = NULL;
412 vtxESD = fESD->GetPrimaryVertexTracks();
414 aEventCuts[iCut] = 1;
417 vtxAOD = fAOD->GetPrimaryVertex();
419 aEventCuts[iCut] = 1;
422 // -- 3 - Vertex z outside cut window
425 if(TMath::Abs(vtxESD->GetZv()) > fVertexZMax)
426 aEventCuts[iCut] = 1;
429 if(TMath::Abs(vtxAOD->GetZ()) > fVertexZMax)
430 aEventCuts[iCut] = 1;
433 aEventCuts[iCut] = 1;
435 // -- 4 - Centrality = -1 (no centrality or not hadronic)
437 if(fCentralityBin == -1.)
438 aEventCuts[iCut] = 1;
440 // -- 5 - Centrality < fCentralityMax
442 if(fCentralityBin == -2.)
443 aEventCuts[iCut] = 1;
445 // -- Fill statistics / reject event
446 Bool_t isRejected = FillEventStats(aEventCuts);
455 * ---------------------------------------------------------------------------------
456 * Accept Particle Methods - private
457 * ---------------------------------------------------------------------------------
460 //________________________________________________________________________
461 Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedBasicCharged(TParticle *particle, Int_t idxMC) {
462 // -- Check if MC particle is accepted for basic parameters
467 // -- check if PDF code exists
468 if (!particle->GetPDG())
471 // -- check if charged
472 if (particle->GetPDG()->Charge() == 0.0)
475 // -- check if physical primary
476 if(!fStack->IsPhysicalPrimary(idxMC))
482 //________________________________________________________________________
483 Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedBasicCharged(AliAODMCParticle *particle) {
484 // -- Check if MC particle is accepted for basic parameters
489 // -- check if charged
490 if (particle->Charge() == 0.0)
493 // -- check if physical primary
494 if(!particle->IsPhysicalPrimary())
500 //________________________________________________________________________
501 Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedBasicNeutral(TParticle *particle, Int_t idxMC) {
502 // -- Check if MC particle is accepted for basic parameters
507 // -- check if PDF code exists
508 if (!particle->GetPDG())
511 // -- check if neutral
512 if (particle->GetPDG()->Charge() != 0.0)
515 // -- check if physical primary
516 if(!fStack->IsPhysicalPrimary(idxMC))
521 //________________________________________________________________________
522 Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedBasicNeutral(AliAODMCParticle *particle) {
523 // -- Check if MC particle is accepted for basic parameters
528 // -- check if charged
529 if (particle->Charge() != 0.0)
532 // -- check if physical primary
533 if(!particle->IsPhysicalPrimary())
539 //________________________________________________________________________
540 Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedRapidity(TParticle *particle, Double_t &yP) {
541 // -- Check if particle is accepted
544 // > use yP as input for the pseudo-rapdity_MAX to be checked
545 // > return 0 if not accepted
548 Bool_t isAccepted = kFALSE;
549 if (TMath::Abs(particle->Eta()) < yP)
551 yP = particle->Eta();
555 Double_t mP = AliPID::ParticleMass(fParticleSpecies);
557 // -- Calculate rapidities and kinematics
558 Double_t p = particle->P();
559 Double_t pz = particle->Pz();
561 Double_t eP = TMath::Sqrt(p*p + mP*mP);
562 yP = 0.5 * TMath::Log((eP + pz) / (eP - pz));
564 // -- Check Rapidity window
565 if (TMath::Abs(yP) > fRapidityMax)
571 //________________________________________________________________________
572 Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedRapidity(AliAODMCParticle *particle, Double_t &yP) {
573 // -- Check if AOD particle is accepted
576 // > use yP as input for the pseudo-rapdity_MAX to be checked
577 // > return 0 if not accepted
580 Bool_t isAccepted = kFALSE;
581 if (TMath::Abs(particle->Eta()) < yP)
583 yP = particle->Eta();
587 Double_t mP = AliPID::ParticleMass(fParticleSpecies);
589 // -- Calculate rapidities and kinematics
590 Double_t p = particle->P();
591 Double_t pz = particle->Pz();
593 Double_t eP = TMath::Sqrt(p*p + mP*mP);
594 yP = 0.5 * TMath::Log((eP + pz) / (eP - pz));
596 // -- Check Rapidity window
597 if (TMath::Abs(yP) > fRapidityMax)
603 //_____________________________________________________________________________
604 Bool_t AliAnalysisNetParticleHelper::IsParticleFindable(Int_t label) {
605 // -- Check if MC particle is findable tracks
607 AliMCParticle *mcParticle = static_cast<AliMCParticle*>(fMCEvent->GetTrack(label));
612 Float_t tpcTrackLength = mcParticle->GetTPCTrackLength(AliTracker::GetBz(), 0.05, counter, 3.0);
614 return (tpcTrackLength > fMinTrackLengthMC);
618 * ---------------------------------------------------------------------------------
619 * Accept Track Methods - public
620 * ---------------------------------------------------------------------------------
623 //________________________________________________________________________
624 Bool_t AliAnalysisNetParticleHelper::IsTrackAcceptedBasicCharged(AliVTrack* track) {
625 // -- Check if track is accepted
626 // > for basic parameters
631 if (track->Charge() == 0)
637 //________________________________________________________________________
638 Bool_t AliAnalysisNetParticleHelper::IsTrackAcceptedRapidity(AliVTrack *track, Double_t &yP) {
639 // -- Check if track is accepted
641 // > return 0 if not accepted
648 Double_t mP = AliPID::ParticleMass(fParticleSpecies);
650 // -- Calculate rapidities and kinematics
652 track->GetPxPyPz(pvec);
654 Double_t p = track->P();
655 Double_t eP = TMath::Sqrt(p*p + mP*mP);
656 yP = 0.5 * TMath::Log((eP + pvec[2]) / (eP - pvec[2]));
658 // -- Check Rapidity window
659 if (TMath::Abs(yP) > fRapidityMax)
665 //________________________________________________________________________
666 Bool_t AliAnalysisNetParticleHelper::IsTrackAcceptedDCA(AliVTrack *vTrack) {
667 // -- Check if track is accepted - ONLY FOR ESDs so far
668 // > for DCA, if both SPD layers have hits
669 // > For now only Implemented for ESDs
671 Bool_t isAccepted = kTRUE;
676 AliESDtrack* track = dynamic_cast<AliESDtrack*>(vTrack);
681 if (track->HasPointOnITSLayer(0) && track->HasPointOnITSLayer(1)) {
683 // -- Get DCA nSigmas
684 Float_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
685 track->GetImpactParameters(dca,cov);
687 Float_t nSigmaCdd = (cov[0] != 0.) ? dca[0]/TMath::Sqrt(cov[0]) : -9.99;
688 Float_t nSigmaCzz = (cov[2] != 0.) ? dca[1]/TMath::Sqrt(cov[2]) : -9.99;
690 if (fNSigmaMaxCdd != 0.) {
691 if (TMath::Abs(nSigmaCdd) > fNSigmaMaxCdd)
695 if (fNSigmaMaxCzz != 0.) {
696 if (TMath::Abs(nSigmaCzz) > fNSigmaMaxCzz)
704 //________________________________________________________________________
705 Bool_t AliAnalysisNetParticleHelper::IsTrackAcceptedPID(AliVTrack *track, Double_t* pid) {
706 // -- Check if track is accepted
707 // > provides TPC and TOF nSigmas to the argument
709 Bool_t isAcceptedTPC = kFALSE;
710 Bool_t isAcceptedTOF = kTRUE;
712 // -- In case not PID is used
720 pid[0] = fPIDResponse->NumberOfSigmasTPC(track, fParticleSpecies);
721 pid[1] = fPIDResponse->NumberOfSigmasTOF(track, fParticleSpecies);
723 // -- Check PID with TPC
724 if (TMath::Abs(pid[0]) < fNSigmaMaxTPC)
725 isAcceptedTPC = kTRUE;
727 // -- Check PID with TOF
730 // Has TOF PID availible
731 if (track->GetStatus() & AliVTrack::kTOFpid) {
732 if (TMath::Abs(pid[1]) < fNSigmaMaxTOF)
733 isAcceptedTOF = kTRUE;
735 isAcceptedTOF = kFALSE;
738 // Has no TOF PID availible
740 if (track->Pt() > fMinPtForTOFRequired)
741 isAcceptedTOF = kFALSE;
743 isAcceptedTOF = kTRUE;
745 } // if (isAcceptedTPC) {
747 return (isAcceptedTPC && isAcceptedTOF);
751 * ---------------------------------------------------------------------------------
753 * ---------------------------------------------------------------------------------
756 //________________________________________________________________________
757 void AliAnalysisNetParticleHelper::UpdateEtaCorrectedTPCPid() {
758 // -- Update eta corrected TPC pid
763 for (Int_t idxTrack = 0; idxTrack < fESD->GetNumberOfTracks(); ++idxTrack) {
764 AliESDtrack *track = fESD->GetTrack(idxTrack);
766 // -- Check if charged track is accepted for basic parameters
767 if (!IsTrackAcceptedBasicCharged(track))
770 Double_t newTPCSignal = track->GetTPCsignal() / fEtaCorrFunc->Eval(track->Eta());
771 track->SetTPCsignal(newTPCSignal, track->GetTPCsignalSigma(), track->GetTPCsignalN());
775 //________________________________________________________________________
776 Double_t AliAnalysisNetParticleHelper::GetTrackbyTrackCorrectionFactor(Double_t *aTrack, Int_t flag) {
777 // -- Get efficiency correctionf of particle dependent on (eta, phi, pt, centrality)
779 Int_t idxPart = (aTrack[2] < 0) ? 0 : 1;
780 THnF* corrMatrix = NULL;
782 corrMatrix = fCorr0[idxPart][fCentralityBin];
784 corrMatrix = fCorr1[idxPart][fCentralityBin];
786 corrMatrix = fCorr2[idxPart][fCentralityBin];
788 Double_t dimBin[3] = {aTrack[3], aTrack[4], aTrack[1]}; // eta, phi, pt
790 Double_t corr = corrMatrix->GetBinContent(corrMatrix->GetBin(dimBin));
792 AliError(Form("Should not happen : bin content = 0. >> eta: %.2f | phi : %.2f | pt : %.2f | cent %d",
793 aTrack[3], aTrack[4], aTrack[1], fCentralityBin));
800 //________________________________________________________________________
801 void AliAnalysisNetParticleHelper::BinLogAxis(const THnBase *h, Int_t axisNumber) {
802 // -- Method for the correct logarithmic binning of histograms
804 TAxis *axis = h->GetAxis(axisNumber);
805 Int_t bins = axis->GetNbins();
807 Double_t from = axis->GetXmin();
808 Double_t to = axis->GetXmax();
809 Double_t *newBins = new Double_t[bins + 1];
812 Double_t factor = pow(to/from, 1./bins);
814 for (int i = 1; i <= bins; i++)
815 newBins[i] = factor * newBins[i-1];
817 axis->Set(bins, newBins);
822 ///////////////////////////////////////////////////////////////////////////////////
825 * ---------------------------------------------------------------------------------
826 * Initialize - Private
827 * ---------------------------------------------------------------------------------
830 //________________________________________________________________________
831 void AliAnalysisNetParticleHelper::InitializeEventStats() {
832 // -- Initialize event statistics histograms
834 const Char_t* aEventNames[] = {"All", "IsTriggered", "HasVertex", "Vz<Vz_{Max}", "Centrality [0,90]%"};
835 const Char_t* aCentralityMaxNames[] = {"5", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100"};
837 fHEventStat0 = new TH1F("fHEventStat0","Event cut statistics 0;Event Cuts;Events", fHEventStatMax,-0.5,fHEventStatMax-0.5);
838 fHEventStat1 = new TH1F("fHEventStat1","Event cut statistics 1;Event Cuts;Events", fHEventStatMax,-0.5,fHEventStatMax-0.5);
840 for ( Int_t ii=0; ii < fHEventStatMax-1; ii++ ) {
841 fHEventStat0->GetXaxis()->SetBinLabel(ii+1, aEventNames[ii]);
842 fHEventStat1->GetXaxis()->SetBinLabel(ii+1, aEventNames[ii]);
844 fHEventStat0->GetXaxis()->SetBinLabel(fHEventStatMax, Form("Centrality [0-%s]%%", aCentralityMaxNames[fCentralityBinMax-1]));
845 fHEventStat1->GetXaxis()->SetBinLabel(fHEventStatMax, Form("Centrality [0-%s]%%", aCentralityMaxNames[fCentralityBinMax-1]));
848 //________________________________________________________________________
849 void AliAnalysisNetParticleHelper::InitializeTriggerStats() {
850 // -- Initialize trigger statistics histograms
852 const Char_t* aTriggerNames[] = { "kMB", "kCentral", "kSemiCentral", "kEMCEJE", "kEMCEGA" };
854 fHTriggerStat = new TH1F("fHTriggerStat","Trigger statistics;Trigger;Events", fNTriggers,-0.5,fNTriggers-0.5);
856 for ( Int_t ii=0; ii < fNTriggers; ii++ )
857 fHTriggerStat->GetXaxis()->SetBinLabel(ii+1, aTriggerNames[ii]);
860 //________________________________________________________________________
861 void AliAnalysisNetParticleHelper::InitializeCentralityStats() {
862 // -- Initialize trigger statistics histograms
864 const Char_t* aCentralityNames[] = {"0-5%", "5-10%", "10-20%", "20-30%", "30-40%", "40-50%",
865 "50-60%", "60-70%", "70-80%", "80-90%", "90-100%"};
867 fHCentralityStat = new TH1F("fHCentralityStat","Centrality statistics;Centrality Bins;Events",
868 fNCentralityBins,-0.5,fNCentralityBins-0.5);
870 for ( Int_t ii=0; ii < fNCentralityBins; ii++ )
871 fHCentralityStat->GetXaxis()->SetBinLabel(ii+1, aCentralityNames[ii]);
874 //________________________________________________________________________
875 Int_t AliAnalysisNetParticleHelper::InitializeEtaCorrection(Bool_t isMC) {
876 // -- Initialize eta correction maps for TPC pid
878 TFile fileEtaCorrMaps("${ALICE_ROOT}/PWGDQ/dielectron/files/EtaCorrMaps.root");
879 if (!fileEtaCorrMaps.IsOpen())
882 TList *keyList = fileEtaCorrMaps.GetListOfKeys();
885 sList = (isMC) ? "LHC11a10" : "LHC10h.pass2";
887 for (Int_t idx = 0; idx < keyList->GetEntries(); ++idx) {
888 TString keyName = keyList->At(idx)->GetName();
889 TPRegexp reg(keyName);
890 if (reg.MatchB(sList)){
891 AliInfo(Form("Using Eta Correction Function: %s",keyName.Data()));
892 fEtaCorrFunc = static_cast<TF1*>(fileEtaCorrMaps.Get(keyName.Data()));
900 //________________________________________________________________________
901 Int_t AliAnalysisNetParticleHelper::InitializeTrackbyTrackCorrection() {
902 // -- Initialize track by track correction matrices
904 if (fModeDistCreation != 1)
907 TFile* corrFile = TFile::Open("/hera/alice/jthaeder/train/trunk/jthaeder_trigger/netParticle/eff/effectiveCorrection.root");
908 // JMT In future --> !!!!!!!!!!!!!!!!!!!!!!!
909 // JMT TFile* corrFile = TFile::Open("${ALICE_ROOT}/PWGCF/EBYE/NetParticle/eff/effectiveCorrection.root");
912 AliError("Track-by-track correction file can not be opened!");
916 // -- Correction - not cross section corrected
917 fCorr0 = new THnF**[2];
918 fCorr0[0] = new THnF*[fCentralityBinMax];
919 fCorr0[1] = new THnF*[fCentralityBinMax];
921 for (Int_t idxCent = 0; idxCent < fCentralityBinMax; ++idxCent) {
922 THnF *sp0 = static_cast<THnF*>(corrFile->Get(Form("hn_%s_Corr0_Cent_%d", fPartName[0].Data(), idxCent)));
923 THnF *sp1 = static_cast<THnF*>(corrFile->Get(Form("hn_%s_Corr0_Cent_%d", fPartName[1].Data(), idxCent)));
926 AliError(Form("Effective correction objects 0 - idxCent %d can not be retrieved!", idxCent));
930 fCorr0[0][idxCent] = static_cast<THnF*>(sp0->Clone());
931 fCorr0[1][idxCent] = static_cast<THnF*>(sp1->Clone());
934 // -- From now only for protons
935 if (fParticleSpecies != AliPID::kProton)
938 // -- Correction - cross section corrected
939 fCorr1 = new THnF**[2];
940 fCorr1[0] = new THnF*[fCentralityBinMax];
941 fCorr1[1] = new THnF*[fCentralityBinMax];
943 for (Int_t idxCent = 0; idxCent < fCentralityBinMax; ++idxCent) {
944 THnF *sp0 = static_cast<THnF*>(corrFile->Get(Form("hn_%s_Corr1_Cent_%d", fPartName[0].Data(), idxCent)));
945 THnF *sp1 = static_cast<THnF*>(corrFile->Get(Form("hn_%s_Corr1_Cent_%d", fPartName[1].Data(), idxCent)));
948 AliError(Form("Effective correction objects 1 - idxCent %d can not be retrieved!", idxCent));
952 fCorr1[0][idxCent] = static_cast<THnF*>(sp0->Clone());
953 fCorr1[1][idxCent] = static_cast<THnF*>(sp1->Clone());
956 // -- Correction - cross section correction only
957 fCorr2 = new THnF**[2];
958 fCorr2[0] = new THnF*[fCentralityBinMax];
959 fCorr2[1] = new THnF*[fCentralityBinMax];
961 for (Int_t idxCent = 0; idxCent < fCentralityBinMax; ++idxCent) {
962 THnF *sp0 = static_cast<THnF*>(corrFile->Get(Form("hn_%s_Corr2_Cent_%d", fPartName[0].Data(), idxCent)));
963 THnF *sp1 = static_cast<THnF*>(corrFile->Get(Form("hn_%s_Corr2_Cent_%d", fPartName[1].Data(), idxCent)));
966 AliError(Form("Effective correction objects 2 - idxCent %d can not be retrieved!", idxCent));
970 fCorr2[0][idxCent] = static_cast<THnF*>(sp0->Clone());
971 fCorr2[1][idxCent] = static_cast<THnF*>(sp1->Clone());
978 * ---------------------------------------------------------------------------------
979 * Event / Trigger Statistics - private
980 * ---------------------------------------------------------------------------------
983 //________________________________________________________________________
984 Bool_t AliAnalysisNetParticleHelper::FillEventStats(Int_t *aEventCuts) {
985 // -- Fill event / centrality statistics
987 Bool_t isRejected = kFALSE;
989 // -- Fill event statistics
990 for (Int_t idx = 0; idx < fHEventStatMax ; ++idx) {
995 fHEventStat0->Fill(idx);
998 for (Int_t idx = 0; idx < fHEventStatMax; ++idx) {
1001 fHEventStat1->Fill(idx);
1004 // -- Fill centrality statistics of accepted events
1006 fHCentralityStat->Fill(fCentralityBin);