Skip to content

Commit 2166c75

Browse files
author
MaximVirta
committed
[PWGCF] normalisation by hadrons added
1 parent 47b9cf1 commit 2166c75

File tree

1 file changed

+71
-69
lines changed

1 file changed

+71
-69
lines changed

PWGCF/GenericFramework/Tasks/flowGfwV02.cxx

Lines changed: 71 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ struct FlowGfwV02 {
105105
O2_DEFINE_CONFIGURABLE(cfgUseItsPID, bool, true, "Use ITS PID for particle identification")
106106
O2_DEFINE_CONFIGURABLE(cfgGetNsigmaQA, bool, true, "Get QA histograms for selection of pions, kaons, and protons")
107107
O2_DEFINE_CONFIGURABLE(cfgUseMultiplicityFlowWeights, bool, true, "Enable or disable the use of multiplicity-based event weighting");
108+
O2_DEFINE_CONFIGURABLE(cfgNormalizeByCharged, bool, true, "Enable or disable the normalization by charged particles");
108109
O2_DEFINE_CONFIGURABLE(cfgConsistentEventFlag, int, 15, "Flag for consistent event selection");
109110

110111
Configurable<GFWBinningCuts> cfgGFWBinning{"cfgGFWBinning", {40, 16, 72, 300, 0, 3000, 0.2, 10.0, 0.2, 5.0, {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4, 4.5, 5}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90}}, "Configuration for binning"};
@@ -174,18 +175,18 @@ struct FlowGfwV02 {
174175
using GFWTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, aod::TracksDCA, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, aod::pidTOFbeta, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr>>;
175176

176177
enum PIDIndex {
177-
kCharged = 0,
178-
kPions,
179-
kKaons,
180-
kProtons
178+
PidCharged = 0,
179+
PidPions,
180+
PidKaons,
181+
PidProtons
181182
};
182183
enum PiKpArrayIndex {
183-
iPionUp = 0,
184-
iKaonUp,
185-
iProtonUp,
186-
iPionLow,
187-
iKaonLow,
188-
iProtonLow
184+
IndPionUp = 0,
185+
IndKaonUp,
186+
IndProtonUp,
187+
IndPionLow,
188+
IndKaonLow,
189+
IndProtonLow
189190
};
190191
enum DetectorType {
191192
kTPC = 0,
@@ -196,26 +197,26 @@ struct FlowGfwV02 {
196197
void init(InitContext const&)
197198
{
198199

199-
pidStates.tpcNsigmaCut[iPionUp] = nSigmas->getData()[iPionUp][kTPC];
200-
pidStates.tpcNsigmaCut[iKaonUp] = nSigmas->getData()[iKaonUp][kTPC];
201-
pidStates.tpcNsigmaCut[iProtonUp] = nSigmas->getData()[iProtonUp][kTPC];
202-
pidStates.tpcNsigmaCut[iPionLow] = nSigmas->getData()[iPionLow][kTPC];
203-
pidStates.tpcNsigmaCut[iKaonLow] = nSigmas->getData()[iKaonLow][kTPC];
204-
pidStates.tpcNsigmaCut[iProtonLow] = nSigmas->getData()[iProtonLow][kTPC];
205-
206-
pidStates.tofNsigmaCut[iPionUp] = nSigmas->getData()[iPionUp][kTOF];
207-
pidStates.tofNsigmaCut[iKaonUp] = nSigmas->getData()[iKaonUp][kTOF];
208-
pidStates.tofNsigmaCut[iProtonUp] = nSigmas->getData()[iProtonUp][kTOF];
209-
pidStates.tofNsigmaCut[iPionLow] = nSigmas->getData()[iPionLow][kTOF];
210-
pidStates.tofNsigmaCut[iKaonLow] = nSigmas->getData()[iKaonLow][kTOF];
211-
pidStates.tofNsigmaCut[iProtonLow] = nSigmas->getData()[iProtonLow][kTOF];
212-
213-
pidStates.itsNsigmaCut[iPionUp] = nSigmas->getData()[iPionUp][kITS];
214-
pidStates.itsNsigmaCut[iKaonUp] = nSigmas->getData()[iKaonUp][kITS];
215-
pidStates.itsNsigmaCut[iProtonUp] = nSigmas->getData()[iProtonUp][kITS];
216-
pidStates.itsNsigmaCut[iPionLow] = nSigmas->getData()[iPionLow][kITS];
217-
pidStates.itsNsigmaCut[iKaonLow] = nSigmas->getData()[iKaonLow][kITS];
218-
pidStates.itsNsigmaCut[iProtonLow] = nSigmas->getData()[iProtonLow][kITS];
200+
pidStates.tpcNsigmaCut[IndPionUp] = nSigmas->getData()[IndPionUp][kTPC];
201+
pidStates.tpcNsigmaCut[IndKaonUp] = nSigmas->getData()[IndKaonUp][kTPC];
202+
pidStates.tpcNsigmaCut[IndProtonUp] = nSigmas->getData()[IndProtonUp][kTPC];
203+
pidStates.tpcNsigmaCut[IndPionLow] = nSigmas->getData()[IndPionLow][kTPC];
204+
pidStates.tpcNsigmaCut[IndKaonLow] = nSigmas->getData()[IndKaonLow][kTPC];
205+
pidStates.tpcNsigmaCut[IndProtonLow] = nSigmas->getData()[IndProtonLow][kTPC];
206+
207+
pidStates.tofNsigmaCut[IndPionUp] = nSigmas->getData()[IndPionUp][kTOF];
208+
pidStates.tofNsigmaCut[IndKaonUp] = nSigmas->getData()[IndKaonUp][kTOF];
209+
pidStates.tofNsigmaCut[IndProtonUp] = nSigmas->getData()[IndProtonUp][kTOF];
210+
pidStates.tofNsigmaCut[IndPionLow] = nSigmas->getData()[IndPionLow][kTOF];
211+
pidStates.tofNsigmaCut[IndKaonLow] = nSigmas->getData()[IndKaonLow][kTOF];
212+
pidStates.tofNsigmaCut[IndProtonLow] = nSigmas->getData()[IndProtonLow][kTOF];
213+
214+
pidStates.itsNsigmaCut[IndPionUp] = nSigmas->getData()[IndPionUp][kITS];
215+
pidStates.itsNsigmaCut[IndKaonUp] = nSigmas->getData()[IndKaonUp][kITS];
216+
pidStates.itsNsigmaCut[IndProtonUp] = nSigmas->getData()[IndProtonUp][kITS];
217+
pidStates.itsNsigmaCut[IndPionLow] = nSigmas->getData()[IndPionLow][kITS];
218+
pidStates.itsNsigmaCut[IndKaonLow] = nSigmas->getData()[IndKaonLow][kITS];
219+
pidStates.itsNsigmaCut[IndProtonLow] = nSigmas->getData()[IndProtonLow][kITS];
219220

220221
if (cfgGetNsigmaQA) {
221222
if (!cfgUseItsPID) {
@@ -261,14 +262,14 @@ struct FlowGfwV02 {
261262
cfgGFWBinning->Print();
262263

263264
// Initialise pt spectra histograms for different particles
264-
pidStates.hPtMid[kCharged] = new TH1D("hPtMid_charged", "hPtMid_charged", o2::analysis::gfw::ptbinning.size() - 1, &o2::analysis::gfw::ptbinning[0]);
265-
pidStates.hPtMid[kPions] = new TH1D("hPtMid_pions", "hPtMid_pions", o2::analysis::gfw::ptbinning.size() - 1, &o2::analysis::gfw::ptbinning[0]);
266-
pidStates.hPtMid[kKaons] = new TH1D("hPtMid_kaons", "hPtMid_kaons", o2::analysis::gfw::ptbinning.size() - 1, &o2::analysis::gfw::ptbinning[0]);
267-
pidStates.hPtMid[kProtons] = new TH1D("hPtMid_protons", "hPtMid_protons", o2::analysis::gfw::ptbinning.size() - 1, &o2::analysis::gfw::ptbinning[0]);
268-
pidStates.hPtMid[kCharged]->SetDirectory(nullptr);
269-
pidStates.hPtMid[kPions]->SetDirectory(nullptr);
270-
pidStates.hPtMid[kKaons]->SetDirectory(nullptr);
271-
pidStates.hPtMid[kProtons]->SetDirectory(nullptr);
265+
pidStates.hPtMid[PidCharged] = new TH1D("hPtMid_charged", "hPtMid_charged", o2::analysis::gfw::ptbinning.size() - 1, &o2::analysis::gfw::ptbinning[0]);
266+
pidStates.hPtMid[PidPions] = new TH1D("hPtMid_pions", "hPtMid_pions", o2::analysis::gfw::ptbinning.size() - 1, &o2::analysis::gfw::ptbinning[0]);
267+
pidStates.hPtMid[PidKaons] = new TH1D("hPtMid_kaons", "hPtMid_kaons", o2::analysis::gfw::ptbinning.size() - 1, &o2::analysis::gfw::ptbinning[0]);
268+
pidStates.hPtMid[PidProtons] = new TH1D("hPtMid_protons", "hPtMid_protons", o2::analysis::gfw::ptbinning.size() - 1, &o2::analysis::gfw::ptbinning[0]);
269+
pidStates.hPtMid[PidCharged]->SetDirectory(nullptr);
270+
pidStates.hPtMid[PidPions]->SetDirectory(nullptr);
271+
pidStates.hPtMid[PidKaons]->SetDirectory(nullptr);
272+
pidStates.hPtMid[PidProtons]->SetDirectory(nullptr);
272273

273274
AxisSpec phiAxis = {o2::analysis::gfw::phibins, o2::analysis::gfw::philow, o2::analysis::gfw::phiup, "#phi"};
274275
AxisSpec etaAxis = {o2::analysis::gfw::etabins, -cfgTrackCuts.cfgEtaMax, cfgTrackCuts.cfgEtaMax, "#eta"};
@@ -389,13 +390,13 @@ struct FlowGfwV02 {
389390
std::array<float, 6> detectorNsigmaCut = cfgUseItsPID ? pidStates.itsNsigmaCut : pidStates.tpcNsigmaCut; // Choose which nSigma to use: TPC or ITS
390391

391392
bool isPion, isKaon, isProton;
392-
bool isDetectedPion = nSigmaToUse[iPionUp] < detectorNsigmaCut[iPionUp] && nSigmaToUse[iPionUp] > detectorNsigmaCut[iPionLow];
393-
bool isDetectedKaon = nSigmaToUse[iKaonUp] < detectorNsigmaCut[iKaonUp] && nSigmaToUse[iKaonUp] > detectorNsigmaCut[iKaonLow];
394-
bool isDetectedProton = nSigmaToUse[iProtonUp] < detectorNsigmaCut[iProtonUp] && nSigmaToUse[iProtonUp] > detectorNsigmaCut[iProtonLow];
393+
bool isDetectedPion = nSigmaToUse[IndPionUp] < detectorNsigmaCut[IndPionUp] && nSigmaToUse[IndPionUp] > detectorNsigmaCut[IndPionLow];
394+
bool isDetectedKaon = nSigmaToUse[IndKaonUp] < detectorNsigmaCut[IndKaonUp] && nSigmaToUse[IndKaonUp] > detectorNsigmaCut[IndKaonLow];
395+
bool isDetectedProton = nSigmaToUse[IndProtonUp] < detectorNsigmaCut[IndProtonUp] && nSigmaToUse[IndProtonUp] > detectorNsigmaCut[IndProtonLow];
395396

396-
bool isTofPion = nSigmaTOF[iPionUp] < pidStates.tofNsigmaCut[iPionUp] && nSigmaTOF[iPionUp] > pidStates.tofNsigmaCut[iPionLow];
397-
bool isTofKaon = nSigmaTOF[iKaonUp] < pidStates.tofNsigmaCut[iKaonUp] && nSigmaTOF[iKaonUp] > pidStates.tofNsigmaCut[iKaonLow];
398-
bool isTofProton = nSigmaTOF[iProtonUp] < pidStates.tofNsigmaCut[iProtonUp] && nSigmaTOF[iProtonUp] > pidStates.tofNsigmaCut[iProtonLow];
397+
bool isTofPion = nSigmaTOF[IndPionUp] < pidStates.tofNsigmaCut[IndPionUp] && nSigmaTOF[IndPionUp] > pidStates.tofNsigmaCut[IndPionLow];
398+
bool isTofKaon = nSigmaTOF[IndKaonUp] < pidStates.tofNsigmaCut[IndKaonUp] && nSigmaTOF[IndKaonUp] > pidStates.tofNsigmaCut[IndKaonLow];
399+
bool isTofProton = nSigmaTOF[IndProtonUp] < pidStates.tofNsigmaCut[IndProtonUp] && nSigmaTOF[IndProtonUp] > pidStates.tofNsigmaCut[IndProtonLow];
399400

400401
if (track.pt() > cfgTofPtCut && !track.hasTOF()) {
401402
return -1;
@@ -414,11 +415,11 @@ struct FlowGfwV02 {
414415
}
415416

416417
if (isPion) {
417-
pid = kPions;
418+
pid = PidPions;
418419
} else if (isKaon) {
419-
pid = kKaons;
420+
pid = PidKaons;
420421
} else if (isProton) {
421-
pid = kProtons;
422+
pid = PidProtons;
422423
} else {
423424
return -1; // no particle satisfies the criteria
424425
}
@@ -484,21 +485,21 @@ struct FlowGfwV02 {
484485
int getPIDIndex(const std::string& corrconfig)
485486
{
486487
if (boost::ifind_first(corrconfig, "pi"))
487-
return kPions;
488+
return PidPions;
488489
if (boost::ifind_first(corrconfig, "ka"))
489-
return kKaons;
490+
return PidKaons;
490491
if (boost::ifind_first(corrconfig, "pr"))
491-
return kProtons;
492-
return kCharged;
492+
return PidProtons;
493+
return PidCharged;
493494
}
494495

495496
GFW::CorrConfig getRelevantCorrName(const int& pidInd)
496497
{
497-
if (pidInd == kPions)
498+
if (pidInd == PidPions)
498499
return fGFW->GetCorrelatorConfig("piP {2} refN {-2}", "PiGap22", kFALSE);
499-
if (pidInd == kKaons)
500+
if (pidInd == PidKaons)
500501
return fGFW->GetCorrelatorConfig("kaP {2} refN {-2}", "KaGap22", kFALSE);
501-
if (pidInd == kProtons)
502+
if (pidInd == PidProtons)
502503
return fGFW->GetCorrelatorConfig("prP {2} refN {-2}", "PrGap22", kFALSE);
503504
return fGFW->GetCorrelatorConfig("refP {2} refN {-2}", "ChGap22", kFALSE);
504505
}
@@ -533,8 +534,9 @@ struct FlowGfwV02 {
533534
if (corrconfigs.at(l_ind).Head.find("nch") != std::string::npos)
534535
val = 1.0;
535536
double ptFraction = 0;
536-
if (pidStates.hPtMid[pidInd]->Integral() > 0) {
537-
ptFraction = pidStates.hPtMid[pidInd]->GetBinContent(i) / pidStates.hPtMid[pidInd]->Integral();
537+
int normIndex = (cfgNormalizeByCharged) ? PidCharged : pidInd; // Configured to normalize by charged particles or the selected particle
538+
if (pidStates.hPtMid[normIndex]->Integral() > 0) {
539+
ptFraction = pidStates.hPtMid[pidInd]->GetBinContent(i) / pidStates.hPtMid[normIndex]->Integral();
538540
if (std::abs(val) < 1.01)
539541
fFC->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val * ptFraction, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm);
540542
}
@@ -548,8 +550,8 @@ struct FlowGfwV02 {
548550
auto val = fGFW->Calculate(corrconfigs.at(0), 0, kFALSE).real() / dnx;
549551
for (int i = 1; i <= fSecondAxis->GetNbins(); i++) {
550552
double ptFraction = 0;
551-
if (pidStates.hPtMid[kCharged]->Integral() > 0) {
552-
ptFraction = pidStates.hPtMid[kCharged]->GetBinContent(i) / pidStates.hPtMid[kCharged]->Integral();
553+
if (pidStates.hPtMid[PidCharged]->Integral() > 0) {
554+
ptFraction = pidStates.hPtMid[PidCharged]->GetBinContent(i) / pidStates.hPtMid[PidCharged]->Integral();
553555
if (std::abs(val) < 1)
554556
registry.fill(HIST("v02pt"), fSecondAxis->GetBinCenter(i), centmult, val * ptFraction, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0);
555557
// printf("bincenter hPtMid: %f, fsecondaxis: %f\n", hPtMid->GetBinCenter(i), fSecondAxis->GetBinCenter(i));
@@ -583,18 +585,18 @@ struct FlowGfwV02 {
583585
if (xaxis.multiplicity < cfgFixedMultMin || xaxis.multiplicity > cfgFixedMultMax)
584586
return;
585587
fGFW->Clear();
586-
pidStates.hPtMid[kCharged]->Reset();
587-
pidStates.hPtMid[kPions]->Reset();
588-
pidStates.hPtMid[kKaons]->Reset();
589-
pidStates.hPtMid[kProtons]->Reset();
588+
pidStates.hPtMid[PidCharged]->Reset();
589+
pidStates.hPtMid[PidPions]->Reset();
590+
pidStates.hPtMid[PidKaons]->Reset();
591+
pidStates.hPtMid[PidProtons]->Reset();
590592

591593
float lRandom = fRndm->Rndm();
592594

593595
// Loop over tracks and check if they are accepted
594596
AcceptedTracks acceptedTracks{0, 0, 0, 0};
595597
for (const auto& track : tracks) {
596598
processTrack(track, vtxz, xaxis.multiplicity, run, acceptedTracks);
597-
pidStates.hPtMid[kCharged]->Fill(track.pt(), getEfficiency(track));
599+
pidStates.hPtMid[PidCharged]->Fill(track.pt(), getEfficiency(track));
598600
// If PID is identified, fill pt spectrum for the corresponding particle
599601
int pidInd = getNsigmaPID(track);
600602
if (pidInd != -1 && track.eta() > -0.4 && track.eta() < 0.4) {
@@ -663,12 +665,12 @@ struct FlowGfwV02 {
663665
// ***Need to add proper weights for each particle!***
664666
if (withinPtRef)
665667
fGFW->Fill(track.eta(), fSecondAxis->FindBin(track.pt()) - 1, track.phi(), weff * wacc, 0);
666-
if (withinPtPOI && pidInd == kPions)
667-
fGFW->Fill(track.eta(), fSecondAxis->FindBin(track.pt()) - 1, track.phi(), weff * wacc, kPions);
668-
if (withinPtPOI && pidInd == kKaons)
669-
fGFW->Fill(track.eta(), fSecondAxis->FindBin(track.pt()) - 1, track.phi(), weff * wacc, kKaons);
670-
if (withinPtPOI && pidInd == kProtons)
671-
fGFW->Fill(track.eta(), fSecondAxis->FindBin(track.pt()) - 1, track.phi(), weff * wacc, kProtons);
668+
if (withinPtPOI && pidInd == PidPions)
669+
fGFW->Fill(track.eta(), fSecondAxis->FindBin(track.pt()) - 1, track.phi(), weff * wacc, PidPions);
670+
if (withinPtPOI && pidInd == PidKaons)
671+
fGFW->Fill(track.eta(), fSecondAxis->FindBin(track.pt()) - 1, track.phi(), weff * wacc, PidKaons);
672+
if (withinPtPOI && pidInd == PidProtons)
673+
fGFW->Fill(track.eta(), fSecondAxis->FindBin(track.pt()) - 1, track.phi(), weff * wacc, PidProtons);
672674
return;
673675
}
674676

0 commit comments

Comments
 (0)