Skip to content

Commit 88f01fd

Browse files
authored
[PWGCF] Updated Nch calculation used in tracks counter (#16475)
1 parent 5bfda02 commit 88f01fd

1 file changed

Lines changed: 126 additions & 33 deletions

File tree

PWGCF/TwoParticleCorrelations/Tasks/corrFit.cxx

Lines changed: 126 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ struct CorrFit {
7171
O2_DEFINE_CONFIGURABLE(cfgUseTransverseMomentum, bool, false, "Use transverse momentum for correlation container")
7272
O2_DEFINE_CONFIGURABLE(cfgQaCheck, bool, true, "Enable QA histograms for event selection")
7373
O2_DEFINE_CONFIGURABLE(cfgStrictTrackCounter, bool, false, "Strict track counter for multiplicity correlation cut, counts only tracks that pass all cuts and are used in the correlation")
74+
O2_DEFINE_CONFIGURABLE(cfgRefpTt, bool, false, "Apply upper pT cut on reference tracks")
75+
O2_DEFINE_CONFIGURABLE(cfgRefpTMax, float, 3.0f, "maximum pT for reference tracks if cfgRefpTt is true")
76+
O2_DEFINE_CONFIGURABLE(cfgMinMultForCorrelations, int, 0, "minimum multiplicity for correlations")
77+
O2_DEFINE_CONFIGURABLE(cfgMaxMultForCorrelations, int, 20, "maximum multiplicity for correlations")
78+
O2_DEFINE_CONFIGURABLE(cfgRefMultiplicity, bool, false, "Use multiplicity of reference tracks for multiplicity correlation cut instead of Nch")
79+
7480
struct : ConfigurableGroup{
7581
O2_DEFINE_CONFIGURABLE(cfgPtCutMin, float, 0.2f, "minimum accepted track pT")
7682
O2_DEFINE_CONFIGURABLE(cfgPtCutMax, float, 10.0f, "maximum accepted track pT")
@@ -116,8 +122,10 @@ struct CorrFit {
116122
O2_DEFINE_CONFIGURABLE(cfgRadiusHigh, float, 2.5, "High radius for merging cut")
117123
O2_DEFINE_CONFIGURABLE(cfgSampleSize, double, 10, "Sample size for mixed event")
118124
O2_DEFINE_CONFIGURABLE(cfgEfficiency, std::string, "", "CCDB path to efficiency object")
125+
O2_DEFINE_CONFIGURABLE(cfgEfficiencyNch, std::string, "", "CCDB path to multiplicity dependent efficiency object")
119126
O2_DEFINE_CONFIGURABLE(cfgCentralityWeight, std::string, "", "CCDB path to centrality weight object")
120127
O2_DEFINE_CONFIGURABLE(cfgLocalEfficiency, bool, false, "Use local efficiency object")
128+
O2_DEFINE_CONFIGURABLE(cfgLocalEfficiencyNch, bool, false, "Use local multiplicity dependent efficiency object");
121129
O2_DEFINE_CONFIGURABLE(cfgUseEventWeights, bool, false, "Use event weights for mixed event")
122130

123131
struct : ConfigurableGroup {
@@ -167,7 +175,7 @@ struct CorrFit {
167175
ConfigurableAxis axisDeltaEtaTpcFt0a{"axisDeltaEtaTpcFt0a", {32, -5.8, -2.6}, "delta eta axis, -5.8~-2.6 for TPC-FT0A,"};
168176
ConfigurableAxis axisDeltaEtaTpcFt0c{"axisDeltaEtaTpcFt0c", {32, 1.2, 4.2}, "delta eta axis, 1.2~4.2 for TPC-FT0C"};
169177
ConfigurableAxis axisDeltaEtaFt0aFt0c{"axisDeltaEtaFt0aFt0c", {32, -1.5, 3.0}, "delta eta axis"};
170-
ConfigurableAxis axisDeltaEtaTpcTpc{"axisDeltaEtaTpcTpc", {32, -0.8, 0.8}, "delta eta axis for TPC-TPC"};
178+
ConfigurableAxis axisDeltaEtaTpcTpc{"axisDeltaEtaTpcTpc", {32, -1.6, 1.6}, "delta eta axis for TPC-TPC"};
171179
ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.2, 0.5, 1, 1.5, 2, 3, 4, 6, 10}, "pt trigger axis for histograms"};
172180
ConfigurableAxis axisPtAssoc{"axisPtAssoc", {VARIABLE_WIDTH, 0.2, 0.5, 1, 1.5, 2, 3, 4, 6, 10}, "pt associated axis for histograms"};
173181
ConfigurableAxis axisVtxMix{"axisVtxMix", {VARIABLE_WIDTH, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, "vertex axis for mixed event histograms"};
@@ -200,6 +208,7 @@ struct CorrFit {
200208

201209
// Corrections
202210
TH3D* mEfficiency = nullptr;
211+
TH1D* mEfficiencyNch = nullptr;
203212
TH1D* mCentralityWeight = nullptr;
204213
bool correctionsLoaded = false;
205214

@@ -288,6 +297,9 @@ struct CorrFit {
288297
registry.add("FT0Amp", "", {HistType::kTH2F, {axisChID, axisFit}});
289298
registry.add("FT0AmpCorrect", "", {HistType::kTH2F, {axisChID, axisFit}});
290299
}
300+
if (cfgQaCheck) {
301+
registry.add("Nch_corrected", "N_{ch} corrected", {HistType::kTH1D, {axisMult}});
302+
}
291303
}
292304

293305
if (doprocessSameTpcFt0a) {
@@ -353,7 +365,7 @@ struct CorrFit {
353365
{axisPtTrigger, "p_{T} (GeV/c)"},
354366
{axisMult, "N_{ch}"},
355367
{axisDeltaPhi, "#Delta#varphi (rad)"},
356-
{axisDeltaEtaTpcFt0a, "#Delta#eta"}}; // use the same delta eta axis for TPC-TPC correlation
368+
{axisDeltaEtaTpcTpc, "#Delta#eta"}}; // use the same delta eta axis for TPC-TPC correlation
357369

358370
if (doprocessSameTpcFt0a) {
359371
sameTpcFt0a.setObject(new CorrelationContainer("sameEvent_TPC_FT0A", "sameEvent_TPC_FT0A", corrAxisTpcFt0a, effAxis, userAxis));
@@ -673,9 +685,10 @@ struct CorrFit {
673685
return;
674686
}
675687
if (cfgEfficiency.value.empty() == false) {
676-
if (cfgLocalEfficiency > 0) {
688+
if (cfgLocalEfficiency) {
677689
TFile* fEfficiencyTrigger = TFile::Open(cfgEfficiency.value.c_str(), "READ");
678690
mEfficiency = reinterpret_cast<TH3D*>(fEfficiencyTrigger->Get("ccdb_object"));
691+
679692
} else {
680693
mEfficiency = ccdb->getForTimeStamp<TH3D>(cfgEfficiency, timestamp);
681694
}
@@ -684,6 +697,19 @@ struct CorrFit {
684697
}
685698
LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiency.value.c_str(), (void*)mEfficiency);
686699
}
700+
if (cfgEfficiencyNch.value.empty() == false) {
701+
if (cfgLocalEfficiencyNch) {
702+
TFile* fEfficiencyTrigger = TFile::Open(cfgEfficiencyNch.value.c_str(), "READ");
703+
mEfficiencyNch = reinterpret_cast<TH1D*>(fEfficiencyTrigger->Get("ccdb_object"));
704+
705+
} else {
706+
mEfficiencyNch = ccdb->getForTimeStamp<TH1D>(cfgEfficiencyNch, timestamp);
707+
}
708+
if (!mEfficiencyNch) {
709+
LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", cfgEfficiencyNch.value.c_str());
710+
}
711+
LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiencyNch.value.c_str(), (void*)mEfficiencyNch);
712+
}
687713
if (cfgCentralityWeight.value.empty() == false) {
688714
mCentralityWeight = ccdb->getForTimeStamp<TH1D>(cfgCentralityWeight, timestamp);
689715
if (mCentralityWeight == nullptr) {
@@ -694,20 +720,39 @@ struct CorrFit {
694720
correctionsLoaded = true;
695721
}
696722

697-
bool getEfficiencyCorrection(float& weight_nue, float eta, float pt, float posZ)
723+
bool getEfficiencyCorrection_Nch(float& weight_Nch, float pt)
724+
{
725+
float eff_Nch = 1.;
726+
if (mEfficiencyNch) {
727+
728+
int ptBin = mEfficiencyNch->FindBin(pt);
729+
eff_Nch = mEfficiencyNch->GetBinContent(ptBin);
730+
731+
} else {
732+
eff_Nch = 1.0;
733+
}
734+
if (eff_Nch == 0)
735+
return false;
736+
weight_Nch = 1. / eff_Nch;
737+
return true;
738+
}
739+
740+
bool getEfficiencyCorrection(float& weight, float pt, float eta, float vertex)
698741
{
699742
float eff = 1.;
700743
if (mEfficiency) {
701-
int etaBin = mEfficiency->GetXaxis()->FindBin(eta);
744+
745+
int etaBin = mEfficiency->GetXaxis()->FindBin(eta); // use the eta bin corresponding to eta=0 for the trigger particle efficiency
702746
int ptBin = mEfficiency->GetYaxis()->FindBin(pt);
703-
int zBin = mEfficiency->GetZaxis()->FindBin(posZ);
704-
eff = mEfficiency->GetBinContent(etaBin, ptBin, zBin);
747+
int vertexBin = mEfficiency->GetZaxis()->FindBin(vertex); // use the vertex bin corresponding to z=0 for the trigger particle efficiency
748+
eff = mEfficiency->GetBinContent(etaBin, ptBin, vertexBin);
749+
705750
} else {
706751
eff = 1.0;
707752
}
708753
if (eff == 0)
709754
return false;
710-
weight_nue = 1. / eff;
755+
weight = 1. / eff;
711756
return true;
712757
}
713758

@@ -727,16 +772,24 @@ struct CorrFit {
727772
}
728773

729774
template <typename TTracks>
730-
void trackCounter(TTracks tracks, int& multiplicity) // function to count the number of tracks in the event and fill the histogram
775+
void trackCounter(TTracks tracks, double& multiplicity) // function to count the number of tracks in the event and fill the histogram
731776
{
732-
int mult = 0;
777+
double nTracksCorrected = 0;
778+
float weight_Nch = 1.0f;
733779
for (auto const& track : tracks) {
734780

735-
if (!trackSelected(track))
781+
if (cfgRefMultiplicity) {
782+
if (track.pt() > cfgRefpTMax)
783+
continue;
784+
}
785+
786+
if (!getEfficiencyCorrection_Nch(weight_Nch, track.pt())) {
736787
continue;
737-
mult++;
788+
}
789+
790+
nTracksCorrected += weight_Nch;
738791
}
739-
multiplicity = mult;
792+
multiplicity = nTracksCorrected;
740793
}
741794

742795
template <CorrelationContainer::CFStep step, typename TTracks, typename TFT0s>
@@ -757,7 +810,7 @@ struct CorrFit {
757810
continue;
758811
}
759812

760-
if (!getEfficiencyCorrection(triggerWeight, track1.eta(), track1.pt(), posZ))
813+
if (!getEfficiencyCorrection(triggerWeight, track1.pt(), track1.eta(), posZ))
761814
continue;
762815

763816
if (system == SameEvent) {
@@ -828,13 +881,15 @@ struct CorrFit {
828881

829882
float weff1 = 1.0;
830883
float zvtx = collision.posZ();
884+
registry.fill(HIST("zVtx"), zvtx);
885+
registry.fill(HIST("Nch"), tracks.size());
831886

832887
for (auto const& track1 : tracks) {
833888

834889
if (!trackSelected(track1)) {
835890
continue;
836891
}
837-
if (!getEfficiencyCorrection(weff1, track1.eta(), track1.pt(), zvtx)) {
892+
if (!getEfficiencyCorrection_Nch(weff1, track1.pt())) {
838893
continue;
839894
}
840895

@@ -903,18 +958,15 @@ struct CorrFit {
903958

904959
float triggerWeight = 1.0f;
905960

961+
float associateWeight = 1.0f;
962+
906963
// loop over all tracks
907964
for (auto const& track1 : tracks1) {
908965

909966
if (!trackSelected(track1))
910967
continue;
911968

912-
if (cfgSystematics.cfgSystematicsVariation) {
913-
if (!trackSelectedSystematics(track1))
914-
continue;
915-
}
916-
917-
if (!getEfficiencyCorrection(triggerWeight, track1.eta(), track1.pt(), posZ))
969+
if (!getEfficiencyCorrection_Nch(triggerWeight, track1.pt()))
918970
continue;
919971

920972
if (system == SameEvent) {
@@ -926,6 +978,14 @@ struct CorrFit {
926978
if (!trackSelected(track2))
927979
continue;
928980

981+
if (!getEfficiencyCorrection_Nch(associateWeight, track2.pt()))
982+
continue;
983+
984+
if (cfgRefpTt) {
985+
if (track2.pt() > cfgRefpTMax) {
986+
continue;
987+
}
988+
}
929989
if (track1.pt() <= track2.pt())
930990
continue; // skip if the trigger pt is less than the associate pt
931991

@@ -957,16 +1017,16 @@ struct CorrFit {
9571017
// fill the right sparse and histograms
9581018
if (system == SameEvent) {
9591019

960-
sameTPC->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), multiplicity, deltaPhi, deltaEta);
1020+
sameTPC->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), multiplicity, deltaPhi, deltaEta, triggerWeight * associateWeight);
9611021
if (cfgQaCheck) {
962-
registry.fill(HIST("deltaEta_deltaPhi_same_TPC"), deltaPhi, deltaEta);
1022+
registry.fill(HIST("deltaEta_deltaPhi_same_TPC"), deltaPhi, deltaEta, triggerWeight * associateWeight);
9631023
}
9641024
} else if (system == MixedEvent) {
9651025

966-
mixedTPC->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), multiplicity, deltaPhi, deltaEta);
1026+
mixedTPC->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), multiplicity, deltaPhi, deltaEta, triggerWeight * associateWeight);
9671027

9681028
if (cfgQaCheck) {
969-
registry.fill(HIST("deltaEta_deltaPhi_mixed_TPC"), deltaPhi, deltaEta);
1029+
registry.fill(HIST("deltaEta_deltaPhi_mixed_TPC"), deltaPhi, deltaEta, triggerWeight * associateWeight);
9701030
}
9711031
}
9721032
}
@@ -1004,12 +1064,20 @@ struct CorrFit {
10041064

10051065
fillYield(collision, tracks);
10061066

1007-
int multiplicity = tracks.size();
1067+
double multiplicity = tracks.size();
10081068

10091069
if (cfgStrictTrackCounter) {
10101070
trackCounter(tracks, multiplicity);
10111071
}
10121072

1073+
if (cfgQaCheck) {
1074+
registry.fill(HIST("Nch_corrected"), multiplicity);
1075+
}
1076+
1077+
if (multiplicity > cfgMaxMultForCorrelations || multiplicity < cfgMinMultForCorrelations) {
1078+
return;
1079+
}
1080+
10131081
const auto& ft0 = collision.foundFT0();
10141082
fillCorrelationsTPCFT0<CorrelationContainer::kCFStepReconstructed>(tracks, ft0, collision.posZ(), SameEvent, multiplicity, kFT0A, eventWeight);
10151083
}
@@ -1054,12 +1122,16 @@ struct CorrFit {
10541122
loadCorrection(bc.timestamp());
10551123
float eventWeight = 1.0f;
10561124

1057-
int multiplicity = tracks1.size();
1125+
double multiplicity = tracks1.size();
10581126

10591127
if (cfgStrictTrackCounter) {
10601128
trackCounter(tracks1, multiplicity);
10611129
}
10621130

1131+
if (cfgQaCheck) {
1132+
registry.fill(HIST("Nch_corrected"), multiplicity);
1133+
}
1134+
10631135
const auto& ft0 = collision2.foundFT0();
10641136
fillCorrelationsTPCFT0<CorrelationContainer::kCFStepReconstructed>(tracks1, ft0, collision1.posZ(), MixedEvent, multiplicity, kFT0A, eventWeight);
10651137
}
@@ -1095,12 +1167,16 @@ struct CorrFit {
10951167

10961168
const auto& ft0 = collision.foundFT0();
10971169

1098-
int multiplicity = tracks.size();
1170+
double multiplicity = tracks.size();
10991171

11001172
if (cfgStrictTrackCounter) {
11011173
trackCounter(tracks, multiplicity);
11021174
}
11031175

1176+
if (cfgQaCheck) {
1177+
registry.fill(HIST("Nch_corrected"), multiplicity);
1178+
}
1179+
11041180
fillCorrelationsTPCFT0<CorrelationContainer::kCFStepReconstructed>(tracks, ft0, collision.posZ(), SameEvent, multiplicity, kFT0C, 1.0f);
11051181
}
11061182
PROCESS_SWITCH(CorrFit, processSameTpcFt0c, "Process same event for TPC-FT0C correlation", false);
@@ -1144,12 +1220,16 @@ struct CorrFit {
11441220
float eventWeight = 1.0f;
11451221

11461222
const auto& ft0 = collision2.foundFT0();
1147-
int multiplicity = tracks1.size();
1223+
double multiplicity = tracks1.size();
11481224

11491225
if (cfgStrictTrackCounter) {
11501226
trackCounter(tracks, multiplicity);
11511227
}
11521228

1229+
if (cfgQaCheck) {
1230+
registry.fill(HIST("Nch_corrected"), multiplicity);
1231+
}
1232+
11531233
fillCorrelationsTPCFT0<CorrelationContainer::kCFStepReconstructed>(tracks1, ft0, collision1.posZ(), MixedEvent, multiplicity, kFT0C, eventWeight);
11541234
}
11551235
}
@@ -1187,12 +1267,16 @@ struct CorrFit {
11871267

11881268
registry.fill(HIST("eventcount"), SameEvent); // because its same event i put it in the 1 bin
11891269

1190-
int multiplicity = tracks.size();
1270+
double multiplicity = tracks.size();
11911271

11921272
if (cfgStrictTrackCounter) {
11931273
trackCounter(tracks, multiplicity);
11941274
}
11951275

1276+
if (cfgQaCheck) {
1277+
registry.fill(HIST("Nch_corrected"), multiplicity);
1278+
}
1279+
11961280
fillCorrelationsFT0AFT0C<CorrelationContainer::kCFStepReconstructed>(ft0, ft0, collision.posZ(), SameEvent, multiplicity, eventWeight);
11971281
}
11981282
PROCESS_SWITCH(CorrFit, processSameFt0aFt0c, "Process same event for FT0A-FT0C correlation", true);
@@ -1238,12 +1322,15 @@ struct CorrFit {
12381322
const auto& ft0Col1 = collision1.foundFT0();
12391323
const auto& ft0Col2 = collision2.foundFT0();
12401324

1241-
int multiplicity = tracks1.size();
1325+
double multiplicity = tracks1.size();
12421326

12431327
if (cfgStrictTrackCounter) {
12441328
trackCounter(tracks1, multiplicity);
12451329
}
12461330

1331+
if (cfgQaCheck) {
1332+
registry.fill(HIST("Nch_corrected"), multiplicity);
1333+
}
12471334
registry.fill(HIST("eventcount"), MixedEvent); // fill the mixed event in the 3 bin
12481335

12491336
fillCorrelationsFT0AFT0C<CorrelationContainer::kCFStepReconstructed>(ft0Col1, ft0Col2, collision1.posZ(), MixedEvent, multiplicity, eventWeight);
@@ -1269,15 +1356,20 @@ struct CorrFit {
12691356
return;
12701357

12711358
registry.fill(HIST("eventcount"), SameEvent); // because its same event i put it in the 1 bin
1359+
loadCorrection(bc.timestamp());
12721360

12731361
fillYield(collision, tracks);
12741362

1275-
int multiplicity = tracks.size();
1363+
double multiplicity = tracks.size();
12761364

12771365
if (cfgStrictTrackCounter) {
12781366
trackCounter(tracks, multiplicity);
12791367
}
12801368

1369+
if (cfgQaCheck) {
1370+
registry.fill(HIST("Nch_corrected"), multiplicity);
1371+
}
1372+
12811373
fillCorrelations<CorrelationContainer::kCFStepReconstructed>(tracks, tracks, collision.posZ(), SameEvent, multiplicity, getMagneticField(bc.timestamp()));
12821374
}
12831375
PROCESS_SWITCH(CorrFit, processSameTPC, "Process same event for TPC-TPC correlation", false);
@@ -1312,8 +1404,9 @@ struct CorrFit {
13121404
continue;
13131405

13141406
registry.fill(HIST("eventcount"), MixedEvent); // fill the mixed event in the 3 bin
1407+
loadCorrection(collision1.bc_as<aod::BCsWithTimestamps>().timestamp());
13151408

1316-
int multiplicity = tracks1.size();
1409+
double multiplicity = tracks1.size();
13171410

13181411
if (cfgStrictTrackCounter) {
13191412
trackCounter(tracks1, multiplicity);

0 commit comments

Comments
 (0)