Skip to content

Commit 335fed7

Browse files
authored
[PWGLF] fixed QAEventFlowCut (#13891)
1 parent 290fef1 commit 335fed7

File tree

1 file changed

+77
-85
lines changed

1 file changed

+77
-85
lines changed

PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx

Lines changed: 77 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -132,31 +132,33 @@ struct F0980pbpbanalysis {
132132
Configurable<std::string> cfgQvecRefBName{"cfgQvecRefBName", "TPCneg", "The name of detector for reference B"};
133133

134134
// Rotational Background Configurables
135-
Configurable<bool> cfgBkgRotSel{"cfgBkgRotSel", true, "flag to construct rotational backgrounds"};
136-
Configurable<int> cfgBkgRotNum{"cfgBkgRotNum", 10, "the number of rotational backgrounds"};
135+
Configurable<bool> cfgBkgRotSel{"cfgBkgRotSel", false, "flag to construct rotational backgrounds"};
136+
Configurable<int> cfgBkgRotNum{"cfgBkgRotNum", 5, "the number of rotational backgrounds"};
137137

138138
// Mixed Event Background Configurables
139139
SliceCache cache;
140-
Configurable<int> cfgBkgMixedNum{"cfgBkgMixedNum", 10, "Number of mixed events per event"};
140+
Configurable<int> cfgBkgMixedNum{"cfgBkgMixedNum", 5, "Number of mixed events per event"};
141141
ConfigurableAxis mixAxisVertex{"mixAxisVertex", {10, -10, 10}, "Vertex axis for mixing bin"};
142142
ConfigurableAxis mixAxisCent{"mixAxisCent", {VARIABLE_WIDTH, 0, 10, 20, 50, 100}, "multiplicity percentile for mixing bin"};
143143
// ConfigurableAxis mixingAxisMultiplicity{"mixingAxisMultiplicity", {2000, 0, 10000}, "TPC multiplicity for bin"};
144144

145145
// List Configurables
146146
Configurable<int> cfgListPID{"cfgListPID", 0, "PID selection type"};
147147
Configurable<int> cfgListPtl{"cfgListPtl", 0, "Particle selection type"};
148-
Configurable<int> cfgListPair{"cfgListPair", 2, "Pair selection type"};
149148

150149
// Histogram QA Configurables
151150
Configurable<bool> cfgQAEventCut{"cfgQAEventCut", true, "Enable Event QA Hists"};
152151
Configurable<bool> cfgQATrackCut{"cfgQATrackCut", true, "Enable Track QA Hists"};
153152
Configurable<bool> cfgQAPIDCut{"cfgQAPIDCut", true, "Enable PID QA Hists"};
154153
Configurable<bool> cfgQAEPCut{"cfgQAEPCut", true, "Enable Event Plane QA Hists"};
154+
Configurable<bool> cfgQAEventFlowCut{"cfgQAEventFlowCut", true, "Enable Event Flow QA Hists"};
155155

156156
ConfigurableAxis histAxisDCAz{"histAxisDCAz", {40, -0.2, 0.2}, "DCAz axis"};
157157
ConfigurableAxis histAxisDCAr{"histAxisDCAr", {40, -0.2, 0.2}, "DCAxy axis"};
158158
ConfigurableAxis histAxisOccupancy{"histAxisOccupancy", {100, 0.0, 20000}, "Occupancy axis"};
159159

160+
Configurable<bool> cfgAnalysisMethod{"cfgAnalysisMethod", true, "true: Two for-loop, false: Combination"};
161+
160162
// Configurable for axis
161163
ConfigurableAxis axisMass{"axisMass", {400, 0.2, 2.2}, "Invariant mass axis"};
162164
ConfigurableAxis axisPT{"axisPT", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 10.0, 13.0, 20.0}, "Transverse momentum Binning"};
@@ -217,18 +219,11 @@ struct F0980pbpbanalysis {
217219
PtlKaon = 1,
218220
};
219221

220-
enum IndexSelList {
221-
None = 0,
222-
woSame = 1,
223-
leq = 2
224-
};
225-
226222
enum QAList {
227223
QAEvent = 1,
228224
QAEP = 2,
229225
QATrack = 3,
230226
QAPID = 4,
231-
QAPIDS = 5
232227
};
233228

234229
TRandom* rn = new TRandom();
@@ -329,13 +324,6 @@ struct F0980pbpbanalysis {
329324
histos.fill(HIST("PIDQA/TPC_TOF_AC"), getTpcNSigma(obj), getTofNSigma(obj));
330325
}
331326
}
332-
if (objecttype == QAPIDS) {
333-
if (pass) {
334-
histos.fill(HIST("PIDQA/Nsigma_TPC_selected"), obj.pt(), getTpcNSigma(obj));
335-
histos.fill(HIST("PIDQA/Nsigma_TOF_selected"), obj.pt(), getTofNSigma(obj));
336-
histos.fill(HIST("PIDQA/TPC_TOF_selected"), getTpcNSigma(obj), getTofNSigma(obj));
337-
}
338-
}
339327
}
340328
}
341329

@@ -346,36 +334,50 @@ struct F0980pbpbanalysis {
346334
fillQA(false, collision, 1);
347335
if (cfgQAEPCut && QA)
348336
fillQA(false, collision, 2);
337+
// if (cfgQAEventFlowCut) histos.fill(HIST("EventQA/hnEvents"), 0);
349338
//
350-
// histos.fill(HIST("EventQA/hnEvents"), 0);
351339
if (std::abs(collision.posZ()) > cfgEventCutVertex) {
352340
return 0;
353341
}
354-
histos.fill(HIST("EventQA/hnEvents"), 1);
342+
if (cfgQAEventFlowCut && QA)
343+
histos.fill(HIST("EventQA/hnEvents"), 1);
344+
355345
if (!collision.sel8()) {
356346
return 0;
357347
}
358-
histos.fill(HIST("EventQA/hnEvents"), 2);
348+
if (cfgQAEventFlowCut && QA)
349+
histos.fill(HIST("EventQA/hnEvents"), 2);
350+
359351
if (cfgEventGoodZvtxSel && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) {
360352
return 0;
361353
}
362-
histos.fill(HIST("EventQA/hnEvents"), 3);
354+
if (cfgQAEventFlowCut && QA)
355+
histos.fill(HIST("EventQA/hnEvents"), 3);
356+
363357
if (cfgEventNSamePileupSel && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) {
364358
return 0;
365359
}
366-
histos.fill(HIST("EventQA/hnEvents"), 4);
360+
if (cfgQAEventFlowCut && QA)
361+
histos.fill(HIST("EventQA/hnEvents"), 4);
362+
367363
if (cfgEventNCollinTRSel && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) {
368364
return 0;
369365
}
370-
histos.fill(HIST("EventQA/hnEvents"), 5);
366+
if (cfgQAEventFlowCut && QA)
367+
histos.fill(HIST("EventQA/hnEvents"), 5);
368+
371369
if (cfgEventQvecSel && (collision.qvecAmp()[detId] < QvecAmpMin || collision.qvecAmp()[refAId] < QvecAmpMin || collision.qvecAmp()[refBId] < QvecAmpMin)) {
372370
return 0;
373371
}
374-
histos.fill(HIST("EventQA/hnEvents"), 6);
372+
if (cfgQAEventFlowCut && QA)
373+
histos.fill(HIST("EventQA/hnEvents"), 6);
374+
375375
if (cfgEventOccupancySel && (collision.trackOccupancyInTimeRange() > cfgEventOccupancyMax || collision.trackOccupancyInTimeRange() < cfgEventOccupancyMin)) {
376376
return 0;
377377
}
378-
histos.fill(HIST("EventQA/hnEvents"), 7);
378+
if (cfgQAEventFlowCut && QA)
379+
histos.fill(HIST("EventQA/hnEvents"), 7);
380+
379381
if (cfgEventCentMax < centrality) {
380382
return 0;
381383
}
@@ -388,12 +390,18 @@ struct F0980pbpbanalysis {
388390
return 0;
389391
}
390392
*/
391-
histos.fill(HIST("EventQA/hnEvents"), 8);
393+
if (cfgQAEventFlowCut && QA)
394+
histos.fill(HIST("EventQA/hnEvents"), 8);
395+
392396
if (cfgEventPVSel && std::abs(collision.posZ()) > cfgEventPV) {
393397
return 0;
394398
}
395-
histos.fill(HIST("EventQA/hnEvents"), 9);
396-
histos.fill(HIST("EventQA/hnEvents"), 10);
399+
if (cfgQAEventFlowCut && QA)
400+
histos.fill(HIST("EventQA/hnEvents"), 9);
401+
402+
// All passed
403+
if (cfgQAEventFlowCut && QA)
404+
histos.fill(HIST("EventQA/hnEvents"), 10);
397405
return 1;
398406
} // event selection
399407

@@ -445,7 +453,7 @@ struct F0980pbpbanalysis {
445453
template <typename TrackType>
446454
bool selectionPID(const TrackType track, const bool QA)
447455
{
448-
if (cfgQAPIDCut && QA)
456+
if (QA)
449457
fillQA(false, track, 4);
450458
//
451459
if (cfgListPID == PIDList::PIDRun3) {
@@ -499,21 +507,6 @@ struct F0980pbpbanalysis {
499507
return 1;
500508
}
501509

502-
template <typename TrackType1, typename TrackType2>
503-
bool pairIndexSelection(const TrackType1 track1, const TrackType2 track2)
504-
{
505-
if (cfgListPair == IndexSelList::woSame) {
506-
if (track2.globalIndex() == track1.globalIndex()) {
507-
return 0;
508-
}
509-
} else if (cfgListPair == IndexSelList::leq) {
510-
if (track2.globalIndex() <= track1.globalIndex()) {
511-
return 0;
512-
}
513-
}
514-
return 1;
515-
}
516-
517510
template <typename TrackType1, typename TrackType2>
518511
bool pairAngleSelection(const TrackType1 track1, const TrackType2 track2)
519512
{
@@ -569,28 +562,25 @@ struct F0980pbpbanalysis {
569562
if (!trackSelected(trk1, true)) {
570563
continue;
571564
}
572-
fillQA(true, trk1, 3);
565+
if (cfgQATrackCut)
566+
fillQA(true, trk1, 3);
573567

574568
if (!selectionPID(trk1, true)) {
575569
continue;
576570
}
577571
fillQA(true, trk1, 4);
578572

579573
for (const auto& trk2 : dTracks) {
580-
if (!trackSelected(trk2, false)) {
574+
if (trk1.globalIndex() >= trk2.globalIndex()) {
581575
continue;
582576
}
583577

584-
// PID
585-
if (!selectionPID(trk2, false)) {
578+
if (!trackSelected(trk2, false)) {
586579
continue;
587580
}
588581

589-
if (trk1.index() == trk2.index()) {
590-
fillQA(true, trk1, 5);
591-
}
592-
593-
if (!pairIndexSelection(trk1, trk2)) {
582+
// PID
583+
if (!selectionPID(trk2, false)) {
594584
continue;
595585
}
596586

@@ -690,19 +680,19 @@ struct F0980pbpbanalysis {
690680
}
691681
}
692682
}
693-
PROCESS_SWITCH(F0980pbpbanalysis, processEventMixing, "Process Event mixing", true);
683+
PROCESS_SWITCH(F0980pbpbanalysis, processEventMixing, "Process Event mixing", false);
694684

695-
void processOnce(EventCandidatesOrigin const& events)
685+
void processTotalEvent(EventCandidatesOrigin const& events)
696686
{
697-
if (cfgQAEventCut) {
687+
if (cfgQAEventFlowCut) {
698688
nTotalEvents += events.size();
699689
auto hTotalEvents = histos.get<TH1>(HIST("EventQA/hnEvents"));
700-
if (hTotalEvents)
690+
if (hTotalEvents) {
701691
hTotalEvents->SetBinContent(1, static_cast<double>(nTotalEvents));
702-
// std::cout << "Total number of events processed: " << nTotalEvents << std::endl;
692+
}
703693
}
704694
}
705-
PROCESS_SWITCH(F0980pbpbanalysis, processOnce, "fill Total nEvents once", true);
695+
PROCESS_SWITCH(F0980pbpbanalysis, processTotalEvent, "fill Total nEvents once", false);
706696

707697
void init(o2::framework::InitContext&)
708698
{
@@ -749,18 +739,17 @@ struct F0980pbpbanalysis {
749739
}
750740

751741
// PID QA
752-
if (cfgQAPIDCut) {
753-
histos.add("PIDQA/Nsigma_TPC_BC", "", {HistType::kTH2F, {qaPtAxis, qaPIDAxis}});
754-
histos.add("PIDQA/Nsigma_TOF_BC", "", {HistType::kTH2F, {qaPtAxis, qaPIDAxis}});
755-
histos.add("PIDQA/TPC_TOF_BC", "", {HistType::kTH2F, {qaPIDAxis, qaPIDAxis}});
756-
}
742+
histos.add("PIDQA/Nsigma_TPC_BC", "", {HistType::kTH2F, {qaPtAxis, qaPIDAxis}});
743+
histos.add("PIDQA/Nsigma_TOF_BC", "", {HistType::kTH2F, {qaPtAxis, qaPIDAxis}});
744+
histos.add("PIDQA/TPC_TOF_BC", "", {HistType::kTH2F, {qaPIDAxis, qaPIDAxis}});
745+
//
757746
histos.add("PIDQA/Nsigma_TPC_AC", "", {HistType::kTH2F, {qaPtAxis, qaPIDAxis}});
758747
histos.add("PIDQA/Nsigma_TOF_AC", "", {HistType::kTH2F, {qaPtAxis, qaPIDAxis}});
759748
histos.add("PIDQA/TPC_TOF_AC", "", {HistType::kTH2F, {qaPIDAxis, qaPIDAxis}});
760749
//
761-
histos.add("PIDQA/Nsigma_TPC_selected", "", {HistType::kTH2F, {qaPtAxis, qaPIDAxis}});
762-
histos.add("PIDQA/Nsigma_TOF_selected", "", {HistType::kTH2F, {qaPtAxis, qaPIDAxis}});
763-
histos.add("PIDQA/TPC_TOF_selected", "", {HistType::kTH2F, {qaPIDAxis, qaPIDAxis}});
750+
// histos.add("PIDQA/Nsigma_TPC_selected", "", {HistType::kTH2F, {qaPtAxis, qaPIDAxis}});
751+
// histos.add("PIDQA/Nsigma_TOF_selected", "", {HistType::kTH2F, {qaPtAxis, qaPIDAxis}});
752+
// histos.add("PIDQA/TPC_TOF_selected", "", {HistType::kTH2F, {qaPIDAxis, qaPIDAxis}});
764753

765754
// Event Plane QA
766755
if (cfgQAEPCut) {
@@ -775,6 +764,7 @@ struct F0980pbpbanalysis {
775764
histos.add("EventQA/EPhistAC_AC", "", {HistType::kTH2F, {qaCentAxis, epresAxis}});
776765
histos.add("EventQA/EPhistBC_AC", "", {HistType::kTH2F, {qaCentAxis, epresAxis}});
777766

767+
// Invariant Mass Histograms
778768
histos.add("hInvMass_f0980_US_EPA", "unlike invariant mass",
779769
{HistType::kTHnSparseF, {axisMass, axisPT, axisCent, axisEp}});
780770
histos.add("hInvMass_f0980_LSpp_EPA", "++ invariant mass",
@@ -791,22 +781,24 @@ struct F0980pbpbanalysis {
791781
// }
792782

793783
// Event Histograms
794-
histos.add("EventQA/hnEvents", "Event selection steps", {HistType::kTH1F, {{11, -0.5, 10.5}}});
795-
std::shared_ptr<TH1> hEventsCutFlow = histos.get<TH1>(HIST("EventQA/hnEvents"));
796-
std::vector<std::string> eventCutLabels = {
797-
"All Events",
798-
"Zvtx",
799-
"sel8",
800-
"GoodZvtxFT0vsPV",
801-
"NoSameBunchPileup",
802-
"NoCollInTimeRangeStandard",
803-
"Qvec Amplitude",
804-
"Occupancy",
805-
"Centrality",
806-
"Additional PV cut",
807-
"Passed Events"};
808-
for (size_t i = 0; i < eventCutLabels.size(); ++i) {
809-
hEventsCutFlow->GetXaxis()->SetBinLabel(i + 1, eventCutLabels[i].c_str());
784+
if (cfgQAEventFlowCut) {
785+
histos.add("EventQA/hnEvents", "Event selection steps", {HistType::kTH1F, {{11, -0.5, 10.5}}});
786+
std::shared_ptr<TH1> hEventsCutFlow = histos.get<TH1>(HIST("EventQA/hnEvents"));
787+
std::vector<std::string> eventCutLabels = {
788+
"All Events",
789+
"Zvtx",
790+
"sel8",
791+
"GoodZvtxFT0vsPV",
792+
"NoSameBunchPileup",
793+
"NoCollInTimeRangeStandard",
794+
"Qvec Amplitude",
795+
"Occupancy",
796+
"Centrality",
797+
"Additional PV cut",
798+
"Passed Events"};
799+
for (size_t i = 0; i < eventCutLabels.size(); ++i) {
800+
hEventsCutFlow->GetXaxis()->SetBinLabel(i + 1, eventCutLabels[i].c_str());
801+
}
810802
}
811803

812804
detId = getDetId(cfgQvecDetName);
@@ -853,7 +845,7 @@ struct F0980pbpbanalysis {
853845

854846
fillHistograms<false>(collision, tracks);
855847
};
856-
PROCESS_SWITCH(F0980pbpbanalysis, processData, "Process Event for data", true);
848+
PROCESS_SWITCH(F0980pbpbanalysis, processData, "Process Event for data", false);
857849
};
858850

859851
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)