Skip to content

Commit 887dfeb

Browse files
meiALICEYuanjun Mei
andauthored
[PWGCF] Add TProfiles to record on and off for cut switches (#18255)
Co-authored-by: Yuanjun Mei <yuanjun.mei@cern.ch>
1 parent 07582ee commit 887dfeb

1 file changed

Lines changed: 110 additions & 78 deletions

File tree

‎PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx‎

Lines changed: 110 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,25 @@ using TracksSim = aod::McParticles;
7070
using TrackSim = aod::McParticles::iterator;
7171

7272
// *) Define enums:
73+
enum ERecSim {
74+
eRec = 0,
75+
eSim,
76+
eRecAndSim,
77+
eRecSim_N
78+
};
79+
80+
enum EProcess {
81+
eProcessRec = 0,
82+
eProcessRecSim,
83+
eProcessSim,
84+
eProcess_N
85+
};
86+
87+
enum ERealMC {
88+
eReal = 0,
89+
eMC
90+
};
91+
7392
enum ECentralityEstimator {
7493
eFT0C = 0,
7594
eFT0M,
@@ -87,13 +106,6 @@ enum EMultiplicityTables {
87106
eMultiplicityTables_N
88107
};
89108

90-
enum ERecSim {
91-
eRec = 0,
92-
eSim,
93-
eRecAndSim,
94-
eRecSim_N
95-
};
96-
97109
enum ETechnicalCuts {
98110
eNoCollInTimeRangeStandard = 0,
99111
eNoCollInRofStandard,
@@ -105,22 +117,25 @@ enum ETechnicalCuts {
105117
ETechnicalCuts_N
106118
};
107119

108-
enum ECuts {
109-
eBefore = 0,
110-
eAfter,
111-
eCuts_N
120+
enum EEventCuts {
121+
eSel8Cut = 0,
122+
eCentCut,
123+
eVertexZCut,
124+
eNContribCut,
125+
EEventCuts_N
112126
};
113127

114-
enum ERealMC {
115-
eReal = 0,
116-
eMC
128+
enum EParticleCuts {
129+
ePtCut = 0,
130+
eEtaCut,
131+
eChargeCut,
132+
EParticleCuts_N
117133
};
118134

119-
enum EProcess {
120-
eProcessRec = 0,
121-
eProcessRecSim,
122-
eProcessSim,
123-
eProcess_N
135+
enum ECuts {
136+
eBefore = 0,
137+
eAfter,
138+
eCuts_N
124139
};
125140

126141
enum EParticleHistograms {
@@ -142,45 +157,37 @@ enum EEventHistograms {
142157
eEventHistograms_N
143158
};
144159

145-
enum EMiscHistograms {
146-
eRunNumber = 0,
147-
eMiscHistograms_N
148-
};
149-
150160
enum EWeightsHistograms {
151161
ePhiRec = 0,
152162
ePhiSim,
153163
ePt,
154164
eWeightsHistograms_N
155165
};
156166

167+
enum EMiscHistograms {
168+
eRunNumber = 0,
169+
eMiscHistograms_N
170+
};
171+
157172
enum EObservables {
158173
eProfTwo = 0,
159174
eObservablesHist_N
160175
};
161176

162177
// *) Lists of names:
163-
static constexpr std::array<const char*, eCentralityEstimator_N> CentralityEstimatorNames = {
164-
"FT0C",
165-
"FT0M",
166-
"FV0A",
167-
"NTPV"};
168-
169-
static constexpr std::array<const char*, eMultiplicityTables_N> MultiplicityTablesNames = {
170-
"multTPC",
171-
"multFV0M",
172-
"multFT0C",
173-
"multFT0M",
174-
"multNTracksPV"};
175-
176-
static constexpr std::array<const char*, eWeightsHistograms_N> WeightsNames = {
177-
"ePhiRec",
178-
"ePhiSim",
179-
"ePt"};
180-
181-
static constexpr std::array<const char*, eCuts_N> CutsNames = {
182-
"eBefore",
183-
"eAfter"};
178+
static constexpr std::array<const char*, eCentralityEstimator_N> CentralityEstimatorNames = {"FT0C", "FT0M", "FV0A", "NTPV"};
179+
180+
static constexpr std::array<const char*, eMultiplicityTables_N> MultiplicityTablesNames = {"multTPC", "multFV0M", "multFT0C", "multFT0M", "multNTracksPV"};
181+
182+
static constexpr std::array<const char*, eWeightsHistograms_N> WeightsNames = {"ePhiRec", "ePhiSim", "ePt"};
183+
184+
static constexpr std::array<const char*, eCuts_N> CutsNames = {"eBefore", "eAfter"};
185+
186+
static constexpr std::array<const char*, ETechnicalCuts_N> TechnicalCutsNames = {"NoCollInTimeRangeStandard", "eNoCollInRofStandard", "eNoSameBunchPileUp", "eIsVertexITSTPC", "eIsGoodITSLayersAll", "eIsGoodZvtxFT0vsPV", "eNoHighMultCollInPrevRof"};
187+
188+
static constexpr std::array<const char*, EEventCuts_N> EventCutsNames = {"Sel8Cut", "CentCut", "VertexZCut", "NContribCut"};
189+
190+
static constexpr std::array<const char*, EParticleCuts_N> ParticleCutsNames = {"PtCut", "EtaCut", "ChargeCut"};
184191

185192
// *) Main task:
186193
struct MultiparticleCorrelationsMei // this name is used in lower-case format to name the TDirectoryFile in AnalysisResults.root
@@ -223,17 +230,17 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
223230
Configurable<std::vector<std::string>> cfTechnicalCutSwitch{"cfTechnicalCutSwitch", {"1NoCollInTimeRangeStandard", "1NoCollInRofStandard", "1NoSameBunchPileUp", "1IsVertexITSTPC", "1IsGoodITSLayersAll", "1IsGoodZvtxFT0vsPV", "1NoHighMultCollInPrevRof"}, "technical cuts switch, on and off by the first number before name"};
224231

225232
// event level cuts
226-
Configurable<bool> cfSel8CutSwitch{"cfSel8CutSwitch", true, "switch to apply Sel8 cut"};
233+
Configurable<bool> cfSel8CutSwitch{"cfSel8CutSwitch", true, "switch to apply Sel8 (event selection decision based on TVX) cut"};
227234
Configurable<bool> cfVertexZCutSwitch{"cfVertexZCutSwitch", true, "switch to apply VertexZ cut"};
228235
Configurable<std::vector<float>> cfVertexZCutRange{"cfVertexZCutRange", {-10., 10.}, "vertex z position range: {min, max}[cm], with convention: min <= Vz <= max"};
229236
Configurable<bool> cfCentCutSwitch{"cfCentCutSwitch", true, "switch to apply centrality cut"};
230-
Configurable<std::vector<float>> cfCentCutRange{"cfCentCutRange", {0., 80.}, "centrality range: {min, max}[cm], with convention: min <= cent <= max"};
237+
Configurable<std::vector<float>> cfCentCutRange{"cfCentCutRange", {0., 80.}, "centrality range: {min, max}, with convention: min <= cent <= max"};
231238
Configurable<bool> cfNContribCutSwitch{"cfNContribCutSwitch", true, "switch to apply NContrib cut"};
232239
Configurable<int> cfNContribCutInf{"cfNContribCutInf", 2, "Cuts on number of tracks used for the vertex, only numContrib > cfNContribCutInf survives"};
233240

234241
// particle level cuts
235242
Configurable<bool> cfPtCutSwitch{"cfPtCutSwitch", true, "switch to apply pt cut"};
236-
Configurable<std::vector<float>> cfPtCutRange{"cfPtCutRange", {0.2, 5.}, "pt cut range: {min, max}, with convention: min <= pt <= max"};
243+
Configurable<std::vector<float>> cfPtCutRange{"cfPtCutRange", {0.2, 5.}, "pt cut range: {min, max}[GeV/c], with convention: min <= pt <= max"};
237244
Configurable<bool> cfEtaCutSwitch{"cfEtaCutSwitch", true, "switch to apply pt cut"};
238245
Configurable<std::vector<float>> cfEtaCutRange{"cfEtaCutRange", {-0.8, 0.8}, "eta cut range: {min, max}, with convention: min <= eta <= max"};
239246
Configurable<bool> cfChargeCutSwitch{"cfChargeCutSwitch", true, "switch to apply charge cut (cut neutral particle out)"};
@@ -249,9 +256,10 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
249256
double fSigmaInel = 7.71;
250257

251258
std::vector<std::string> fTechnicalCutSwitch = {"1NoCollInTimeRangeStandard", "1NoCollInRofStandard", "1NoSameBunchPileUp", "1IsVertexITSTPC", "1IsGoodITSLayersAll", "1IsGoodZvtxFT0vsPV", "1NoHighMultCollInPrevRof"};
252-
259+
std::vector<bool> fEventCutSwitch = std::vector<bool>(EEventCuts_N, true);
253260
std::vector<float> fVertexZCutRange = {-10., 10.};
254261
std::vector<float> fCentCutRange = {0., 80.};
262+
std::vector<bool> fParticleCutSwitch = std::vector<bool>(EParticleCuts_N, true);
255263
std::vector<float> fPtCutRange = {0.2, 5.};
256264
std::vector<float> fEtaCutRange = {-0.8, 0.8};
257265

@@ -264,15 +272,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
264272
bool fDryRun = false; // book all histos and run without filling and calculating anything
265273
bool fExternalFileSwitch = false;
266274
bool fALICECentBinSwitch = true;
267-
268275
bool fMasterCutSwitch = true;
269-
bool fSel8CutSwitch = true;
270-
bool fVertexZCutSwitch = true;
271-
bool fCentCutSwitch = true;
272-
bool fNContribCutSwitch = true;
273-
bool fPtCutSwitch = true;
274-
bool fEtaCutSwitch = true;
275-
bool fChargeCutSwitch = true;
276276
bool fQualityAssuranceSwitch = false;
277277
bool fRunMessageSwitch = false;
278278

@@ -289,11 +289,6 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
289289
std::array<std::array<std::array<TH1F*, eCuts_N>, 2>, eEventHistograms_N> fEventHist{}; //! [ type - see enum EEventHistograms ][reco,sim][before, after event cuts]
290290
} ec;
291291

292-
struct MiscHistograms {
293-
TList* fMiscHistList = nullptr;
294-
TH1D* fMiscHistRunNumber = nullptr;
295-
} misc;
296-
297292
struct ExternalHistograms {
298293
TList* fExternalHistogramsList = nullptr;
299294
std::array<TH1F*, eWeightsHistograms_N> fWeights{};
@@ -310,6 +305,14 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
310305
std::array<TH2F*, eCuts_N> fHistMultNContrib{};
311306
} qa;
312307

308+
struct MiscHistograms {
309+
TList* fMiscHistList = nullptr;
310+
TProfile* fMiscHistRunNumber = nullptr;
311+
TProfile* fMiscEventCuts = nullptr;
312+
TProfile* fMiscParticleCuts = nullptr;
313+
TProfile* fMiscTechnicalCuts = nullptr;
314+
} misc;
315+
313316
// *) functions and templates
314317
std::vector<std::vector<TComplex>> initQVectorsTable(int maxCorrelator, const std::vector<int>& harmonic)
315318
{
@@ -612,18 +615,18 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
612615
}
613616
}
614617
if constexpr (rs == eRec || rs == eRecAndSim) {
615-
if (tc.fSel8CutSwitch && !collision.sel8()) { // sel8 cut
618+
if (tc.fEventCutSwitch[eSel8Cut] && !collision.sel8()) { // sel8 cut
616619
return false;
617620
}
618621
if constexpr (rm == eReal) {
619-
if (tc.fVertexZCutSwitch && (collision.posZ() > tc.fVertexZCutRange[1] || collision.posZ() < tc.fVertexZCutRange[0])) { // vertex z cut
622+
if (tc.fEventCutSwitch[eVertexZCut] && (collision.posZ() > tc.fVertexZCutRange[1] || collision.posZ() < tc.fVertexZCutRange[0])) { // vertex z cut
620623
return false;
621624
}
622625
auto thisCent = chooseCent(collision, tc.fCentralityEstimator);
623-
if (tc.fCentCutSwitch && (thisCent > tc.fCentCutRange[1] || thisCent < tc.fCentCutRange[0])) { // centrality cut
626+
if (tc.fEventCutSwitch[eCentCut] && (thisCent > tc.fCentCutRange[1] || thisCent < tc.fCentCutRange[0])) { // centrality cut
624627
return false;
625628
}
626-
if (tc.fNContribCutSwitch && (collision.numContrib() < tc.fNContribCutInf)) { // number of contribution cuts
629+
if (tc.fEventCutSwitch[eNContribCut] && (collision.numContrib() < tc.fNContribCutInf)) { // number of contribution cuts
627630
return false;
628631
}
629632
}
@@ -708,7 +711,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
708711
}
709712
}
710713
if constexpr (rs == eRec || rs == eRecAndSim) {
711-
if (tc.fPtCutSwitch) { // pt cuts for Rec
714+
if (tc.fParticleCutSwitch[ePtCut]) { // pt cuts for Rec
712715
if constexpr (rm == eReal) {
713716
if (track.pt() < tc.fPtCutRange[0] || track.pt() > tc.fPtCutRange[1]) {
714717
return false;
@@ -721,7 +724,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
721724
}
722725
}
723726
}
724-
if (tc.fEtaCutSwitch) {
727+
if (tc.fParticleCutSwitch[eEtaCut]) {
725728
if constexpr (rm == eReal) { // eta cuts for Rec
726729
if (track.eta() < tc.fEtaCutRange[0] || track.eta() > tc.fEtaCutRange[1]) {
727730
return false;
@@ -734,7 +737,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
734737
}
735738
}
736739
}
737-
if (tc.fChargeCutSwitch) {
740+
if (tc.fParticleCutSwitch[eChargeCut]) {
738741
if constexpr (rm == eReal) { // charge cuts for Rec
739742
if (track.sign() != 1 && track.sign() != -1) {
740743
return false;
@@ -753,7 +756,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
753756
return false;
754757
}
755758
} // end of if constexpr (rs == eRecAndSim && rm == eMC) // charge cuts for Sim
756-
} // end of if (tc.fChargeCutSwitch) // charge cuts for Rec
759+
} // end of if (tc.fParticleCutSwitch[eChargeCut]) // charge cuts for Rec
757760
} // end of if constexpr (rs == eRec || rs == eRecAndSim) {
758761

759762
return true;
@@ -859,6 +862,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
859862
if (isFirstCollision) {
860863
thisRunNumber = collision.bc().runNumber();
861864
misc.fMiscHistRunNumber->SetTitle(Form("%d", thisRunNumber)); // Get run number
865+
misc.fMiscHistRunNumber->Fill(0.5, thisRunNumber);
862866
if (tc.fExternalFileSwitch) {
863867
getHistogramWithWeights(tc.fFileWithWeights.c_str(), Form("%d", thisRunNumber));
864868
}
@@ -995,19 +999,19 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
995999
tc.fMasterCutSwitch = cfMasterCutSwitch;
9961000
tc.fTechnicalCutSwitch = cfTechnicalCutSwitch.value;
9971001

998-
tc.fSel8CutSwitch = cfSel8CutSwitch;
999-
tc.fVertexZCutSwitch = cfVertexZCutSwitch;
1000-
tc.fCentCutSwitch = cfCentCutSwitch;
1001-
tc.fNContribCutSwitch = cfNContribCutSwitch;
1002+
tc.fEventCutSwitch[eSel8Cut] = cfSel8CutSwitch;
1003+
tc.fEventCutSwitch[eVertexZCut] = cfVertexZCutSwitch;
10021004
tc.fVertexZCutRange = cfVertexZCutRange.value;
1005+
tc.fEventCutSwitch[eCentCut] = cfCentCutSwitch;
10031006
tc.fCentCutRange = cfCentCutRange.value;
1007+
tc.fEventCutSwitch[eNContribCut] = cfNContribCutSwitch;
10041008
tc.fNContribCutInf = cfNContribCutInf;
10051009

1006-
tc.fPtCutSwitch = cfPtCutSwitch;
1010+
tc.fParticleCutSwitch[ePtCut] = cfPtCutSwitch;
10071011
tc.fPtCutRange = cfPtCutRange.value;
1008-
tc.fEtaCutSwitch = cfEtaCutSwitch;
1012+
tc.fParticleCutSwitch[eEtaCut] = cfEtaCutSwitch;
10091013
tc.fEtaCutRange = cfEtaCutRange.value;
1010-
tc.fChargeCutSwitch = cfChargeCutSwitch;
1014+
tc.fParticleCutSwitch[eChargeCut] = cfChargeCutSwitch;
10111015

10121016
tc.fSigmaInel = cfSigmaInel;
10131017
tc.fQualityAssuranceSwitch = cfQualityAssuranceSwitch;
@@ -1033,9 +1037,37 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to
10331037
misc.fMiscHistList->SetOwner(true);
10341038
fBaseList->Add(misc.fMiscHistList);
10351039

1036-
misc.fMiscHistRunNumber = new TH1D("eRunNumber", "to be set", 1, 0, 1);
1040+
misc.fMiscHistRunNumber = new TProfile("[eRunNumber]", "to be set", 1, 0, 1);
1041+
misc.fMiscHistRunNumber->GetXaxis()->SetBinLabel(1, "RunNumber");
10371042
misc.fMiscHistList->Add(misc.fMiscHistRunNumber);
10381043

1044+
misc.fMiscTechnicalCuts = new TProfile("[eTechnicalCuts]", "Technical Cuts", ETechnicalCuts_N, 0, ETechnicalCuts_N);
1045+
for (int i = 1; i <= ETechnicalCuts_N; ++i) {
1046+
misc.fMiscTechnicalCuts->GetXaxis()->SetBinLabel(i, TechnicalCutsNames[i - 1]);
1047+
if (tc.fTechnicalCutSwitch[i - 1].starts_with("1")) {
1048+
misc.fMiscTechnicalCuts->Fill(i - 0.5, 1);
1049+
}
1050+
}
1051+
misc.fMiscHistList->Add(misc.fMiscTechnicalCuts);
1052+
1053+
misc.fMiscEventCuts = new TProfile("[eEventCuts]", "Event Level Cuts", EEventCuts_N, 0, EEventCuts_N);
1054+
for (int i = 1; i <= EEventCuts_N; ++i) {
1055+
misc.fMiscEventCuts->GetXaxis()->SetBinLabel(i, EventCutsNames[i - 1]);
1056+
if (tc.fEventCutSwitch[i - 1]) {
1057+
misc.fMiscEventCuts->Fill(i - 0.5, 1);
1058+
}
1059+
}
1060+
misc.fMiscHistList->Add(misc.fMiscEventCuts);
1061+
1062+
misc.fMiscParticleCuts = new TProfile("[eParticleCuts]", "Particle Level Cuts", EParticleCuts_N, 0, EParticleCuts_N);
1063+
for (int i = 1; i <= EParticleCuts_N; ++i) {
1064+
misc.fMiscParticleCuts->GetXaxis()->SetBinLabel(i, ParticleCutsNames[i - 1]);
1065+
if (tc.fParticleCutSwitch[i - 1]) {
1066+
misc.fMiscParticleCuts->Fill(i - 0.5, 1);
1067+
}
1068+
}
1069+
misc.fMiscHistList->Add(misc.fMiscParticleCuts);
1070+
10391071
// *) Book particle TLists:
10401072
pc.fParticleHistList = new TList();
10411073
pc.fParticleHistList->SetName("ParticleHistograms");

0 commit comments

Comments
 (0)