Skip to content

Commit fb91ce8

Browse files
authored
[PWGDQ] Add and fix configurable tag options for optimize memory issue (#17272)
1 parent c869cd3 commit fb91ce8

2 files changed

Lines changed: 86 additions & 44 deletions

File tree

PWGDQ/Core/HistogramsLibrary.cxx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,15 +1257,25 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h
12571257
hm->AddHistogram(histClass, "Coschi", "", false, 25, coschiBins.data(), VarManager::kMCCosChi, 0, nullptr, -1, 0, nullptr, -1, "", "", "", -1, VarManager::kMCWeight);
12581258
}
12591259

1260-
if (groupStr.CompareTo("polarization-pseudoproper-gen") == 0) {
1260+
if (groupStr.CompareTo("polarization-pseudoproper-midy-he-gen") == 0) {
12611261
std::array<int, 4> varspTHE = {VarManager::kMCMass, VarManager::kMCPt, VarManager::kMCCosThetaHE, VarManager::kMCVertexingTauxyProjected};
1262-
std::array<int, 4> varspTCS = {VarManager::kMCMass, VarManager::kMCPt, VarManager::kMCCosThetaCS, VarManager::kMCVertexingTauxyProjected};
1263-
std::array<int, 4> varspTRM = {VarManager::kMCMass, VarManager::kMCPt, VarManager::kMCCosThetaRM, VarManager::kMCVertexingTauxyProjected};
12641262
std::array<int, 4> bins = {50, 20, 20, 1000};
12651263
std::array<double, 4> xmin = {2., 0., -1., -0.5};
12661264
std::array<double, 4> xmax = {4., 20., 1., 0.5};
12671265
hm->AddHistogram(histClass, "Mass_Pt_cosThetaHE_Tauxy", "", 4, varspTHE.data(), bins.data(), xmin.data(), xmax.data(), nullptr, -1, kFALSE);
1266+
}
1267+
if (groupStr.CompareTo("polarization-pseudoproper-midy-cs-gen") == 0) {
1268+
std::array<int, 4> varspTCS = {VarManager::kMCMass, VarManager::kMCPt, VarManager::kMCCosThetaCS, VarManager::kMCVertexingTauxyProjected};
1269+
std::array<int, 4> bins = {50, 20, 20, 1000};
1270+
std::array<double, 4> xmin = {2., 0., -1., -0.5};
1271+
std::array<double, 4> xmax = {4., 20., 1., 0.5};
12681272
hm->AddHistogram(histClass, "Mass_Pt_cosThetaCS_Tauxy", "", 4, varspTCS.data(), bins.data(), xmin.data(), xmax.data(), nullptr, -1, kFALSE);
1273+
}
1274+
if (groupStr.CompareTo("polarization-pseudoproper-midy-rand-gen") == 0) {
1275+
std::array<int, 4> varspTRM = {VarManager::kMCMass, VarManager::kMCPt, VarManager::kMCCosThetaRM, VarManager::kMCVertexingTauxyProjected};
1276+
std::array<int, 4> bins = {50, 20, 20, 1000};
1277+
std::array<double, 4> xmin = {2., 0., -1., -0.5};
1278+
std::array<double, 4> xmax = {4., 20., 1., 0.5};
12691279
hm->AddHistogram(histClass, "Mass_Pt_cosThetaRM_Tauxy", "", 4, varspTRM.data(), bins.data(), xmin.data(), xmax.data(), nullptr, -1, kFALSE);
12701280
}
12711281
if (groupStr.CompareTo("polarization-dielectron-pbpb-midy-he-gen") == 0) {

PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx

Lines changed: 73 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,14 @@ struct AnalysisEventSelection {
331331

332332
HistogramManager* fHistMan = nullptr;
333333

334-
AnalysisCompositeCut* fEventCut;
334+
AnalysisCompositeCut* fEventCut = nullptr;
335335

336336
Service<o2::ccdb::BasicCCDBManager> fCCDB;
337337
o2::ccdb::CcdbApi fCCDBApi;
338338

339339
std::map<int64_t, bool> fSelMap; // key: reduced event global index, value: event selection decision
340340
std::map<uint64_t, std::vector<int64_t>> fBCCollMap; // key: global BC, value: vector of reduced event global indices
341-
int fCurrentRun;
341+
int fCurrentRun = 0;
342342

343343
void init(o2::framework::InitContext& context)
344344
{
@@ -595,13 +595,13 @@ struct AnalysisTrackSelection {
595595
Service<o2::ccdb::BasicCCDBManager> fCCDB;
596596
Service<o2::pid::tof::TOFResponse> fTofResponse;
597597

598-
HistogramManager* fHistMan;
598+
HistogramManager* fHistMan = nullptr;
599599
std::vector<AnalysisCompositeCut*> fTrackCuts;
600600
std::vector<MCSignal*> fMCSignals; // list of signals to be checked
601601
std::vector<TString> fHistNamesReco;
602602
std::vector<TString> fHistNamesMCMatched;
603603

604-
int fCurrentRun; // current run (needed to detect run changes for loading CCDB parameters)
604+
int fCurrentRun = 0; // current run (needed to detect run changes for loading CCDB parameters)
605605

606606
std::map<int64_t, std::vector<int64_t>> fNAssocsInBunch; // key: track global index, value: vector of global index for events associated in-bunch (events that have in-bunch pileup or splitting)
607607
std::map<int64_t, std::vector<int64_t>> fNAssocsOutOfBunch; // key: track global index, value: vector of global index for events associated out-of-bunch (events that have no in-bunch pileup)
@@ -938,9 +938,9 @@ struct AnalysisPrefilterSelection {
938938
Configurable<bool> fPropTrack{"cfgPropTrack", false, "Propagate tracks to associated collision to recalculate DCA and momentum vector"};
939939

940940
std::map<uint32_t, uint32_t> fPrefilterMap;
941-
AnalysisCompositeCut* fPairCut;
942-
uint32_t fPrefilterMask;
943-
int fPrefilterCutBit;
941+
AnalysisCompositeCut* fPairCut = nullptr;
942+
uint32_t fPrefilterMask = 0;
943+
int fPrefilterCutBit = 0;
944944

945945
Preslice<aod::TrackAssoc> trackAssocsPerCollision = aod::track_association::collisionId;
946946

@@ -1141,7 +1141,9 @@ struct AnalysisSameEventPairing {
11411141
Configurable<std::string> pair{"cfgPairCuts", "", "Comma separated list of pair cuts, !!! Use only if you know what you are doing, otherwise leave empty"};
11421142
Configurable<bool> fConfigQA{"cfgQA", false, "If true, fill QA histograms"};
11431143
Configurable<bool> fConfigMCtruthQA{"cfgMCtruthQA", false, "If true, fill QA histograms with default"};
1144-
Configurable<bool> fConfigPseudoQA{"cfgPseudoQA", false, "If true, fill QA histograms with pseudo-proper decay length analysis with polarization"};
1144+
Configurable<bool> fConfigPseudoHEQA{"cfgPseudoHEQA", false, "If true, fill QA histograms with pseudo-proper decay length analysis with polarization HE"};
1145+
Configurable<bool> fConfigPseudoCSQA{"cfgPseudoCSQA", false, "If true, fill QA histograms with pseudo-proper decay length analysis with polarization CS"};
1146+
Configurable<bool> fConfigPseudoRMQA{"cfgPseudoRMQA", false, "If true, fill QA histograms with pseudo-proper decay length analysis with polarization RM"};
11451147
Configurable<bool> fConfigTruthPbPbMIDYHE{"cfgTruthPbPbmidyHE", false, "If true, fill QA histograms with dielectron pairs in helicity frame"};
11461148
Configurable<bool> fConfigTruthPbPbMIDYCS{"cfgTruthPbPbmidyCS", false, "If true, fill QA histograms with dielectron pairs in collion-soper frame"};
11471149
Configurable<std::string> fConfigAddSEPHistogram{"cfgAddSEPHistogram", "", "Comma separated list of histograms"};
@@ -1204,14 +1206,14 @@ struct AnalysisSameEventPairing {
12041206
std::vector<AnalysisCut*> fMCGenAccCuts;
12051207
bool fUseMCGenAccCut = false;
12061208

1207-
uint32_t fTrackFilterMask; // mask for the track cuts required in this task to be applied on the barrel cuts produced upstream
1208-
uint32_t fMuonFilterMask; // mask for the muon cuts required in this task to be applied on the muon cuts produced upstream
1209-
int fNCutsBarrel;
1210-
int fNCutsMuon;
1211-
int fNPairCuts;
1209+
uint32_t fTrackFilterMask = 0; // mask for the track cuts required in this task to be applied on the barrel cuts produced upstream
1210+
uint32_t fMuonFilterMask = 0; // mask for the muon cuts required in this task to be applied on the muon cuts produced upstream
1211+
int fNCutsBarrel = 0;
1212+
int fNCutsMuon = 0;
1213+
int fNPairCuts = 0;
12121214
bool fHasTwoProngGenMCsignals = false;
12131215

1214-
bool fEnableBarrelHistos;
1216+
bool fEnableBarrelHistos = false;
12151217
// bool fEnableMuonHistos;
12161218

12171219
Preslice<soa::Join<aod::TrackAssoc, aod::BarrelTrackCuts, aod::Prefilter>> trackAssocsPerCollision = aod::track_association::collisionId;
@@ -1506,14 +1508,20 @@ struct AnalysisSameEventPairing {
15061508
if (fConfigOptions.fConfigMCtruthQA.value) {
15071509
histNames += Form("MCTruthGenPairSel_%s;", sig->GetName()); // after event selection
15081510
}
1509-
if (fConfigOptions.fConfigPseudoQA.value) {
1510-
histNames += Form("MCTruthGenPseudoPolPairSel_%s;", sig->GetName());
1511+
if (fConfigOptions.fConfigPseudoHEQA.value) {
1512+
histNames += Form("MCTruthGenPseudoPolPairHESel_%s;", sig->GetName());
1513+
}
1514+
if (fConfigOptions.fConfigPseudoCSQA.value) {
1515+
histNames += Form("MCTruthGenPseudoPolPairCSSel_%s;", sig->GetName());
1516+
}
1517+
if (fConfigOptions.fConfigPseudoRMQA.value) {
1518+
histNames += Form("MCTruthGenPseudoPolPairRMSel_%s;", sig->GetName());
15111519
}
15121520
if (fConfigOptions.fConfigTruthPbPbMIDYHE.value) {
1513-
histNames += Form("MCTruthGenPseudoPolPairSel_%s;", sig->GetName());
1521+
histNames += Form("MCTruthGenPoldielectronPbPbPairHESel_%s;", sig->GetName());
15141522
}
15151523
if (fConfigOptions.fConfigTruthPbPbMIDYCS.value) {
1516-
histNames += Form("MCTruthGenPseudoPolPairSel_%s;", sig->GetName());
1524+
histNames += Form("MCTruthGenPoldielectronPbPbPairCSSel_%s;", sig->GetName());
15171525
}
15181526
fHasTwoProngGenMCsignals = true;
15191527
}
@@ -1523,14 +1531,20 @@ struct AnalysisSameEventPairing {
15231531
if (fConfigOptions.fConfigMCtruthQA.value) {
15241532
histNames += Form("MCTruthGenPairSel_%s_%s;", sig->GetName(), cut->GetName()); // after event selection and MCgenAcc cut
15251533
}
1526-
if (fConfigOptions.fConfigPseudoQA.value) {
1527-
histNames += Form("MCTruthGenPseudoPolPairSel_%s_%s;", sig->GetName(), cut->GetName());
1534+
if (fConfigOptions.fConfigPseudoHEQA.value) {
1535+
histNames += Form("MCTruthGenPseudoPolPairHESel_%s_%s;", sig->GetName(), cut->GetName());
1536+
}
1537+
if (fConfigOptions.fConfigPseudoCSQA.value) {
1538+
histNames += Form("MCTruthGenPseudoPolPairCSSel_%s_%s;", sig->GetName(), cut->GetName());
1539+
}
1540+
if (fConfigOptions.fConfigPseudoRMQA.value) {
1541+
histNames += Form("MCTruthGenPseudoPolPairRMSel_%s_%s;", sig->GetName(), cut->GetName());
15281542
}
15291543
if (fConfigOptions.fConfigTruthPbPbMIDYHE.value) {
15301544
histNames += Form("MCTruthGenPoldielectronPbPbPairHESel_%s_%s;", sig->GetName(), cut->GetName());
15311545
}
15321546
if (fConfigOptions.fConfigTruthPbPbMIDYCS.value) {
1533-
histNames += Form("MCTruthGenPseudoPolPairCSSel_%s_%s;", sig->GetName(), cut->GetName());
1547+
histNames += Form("MCTruthGenPoldielectronPbPbPairCSSel_%s_%s;", sig->GetName(), cut->GetName());
15341548
}
15351549
}
15361550
}
@@ -2189,8 +2203,14 @@ struct AnalysisSameEventPairing {
21892203
if (fConfigOptions.fConfigMCtruthQA.value) {
21902204
fHistMan->FillHistClass(Form("MCTruthGenPairSel_%s", sig->GetName()), VarManager::fgValues);
21912205
}
2192-
if (fConfigOptions.fConfigPseudoQA.value) {
2193-
fHistMan->FillHistClass(Form("MCTruthGenPseudoPolPairSel_%s", sig->GetName()), VarManager::fgValues);
2206+
if (fConfigOptions.fConfigPseudoHEQA.value) {
2207+
fHistMan->FillHistClass(Form("MCTruthGenPseudoPolPairHESel_%s", sig->GetName()), VarManager::fgValues);
2208+
}
2209+
if (fConfigOptions.fConfigPseudoCSQA.value) {
2210+
fHistMan->FillHistClass(Form("MCTruthGenPseudoPolPairCSSel_%s", sig->GetName()), VarManager::fgValues);
2211+
}
2212+
if (fConfigOptions.fConfigPseudoRMQA.value) {
2213+
fHistMan->FillHistClass(Form("MCTruthGenPseudoPolPairRMSel_%s", sig->GetName()), VarManager::fgValues);
21942214
}
21952215
if (fConfigOptions.fConfigTruthPbPbMIDYHE.value) {
21962216
fHistMan->FillHistClass(Form("MCTruthGenPoldielectronPbPbPairHESel_%s", sig->GetName()), VarManager::fgValues);
@@ -2205,8 +2225,14 @@ struct AnalysisSameEventPairing {
22052225
if (fConfigOptions.fConfigMCtruthQA.value) {
22062226
fHistMan->FillHistClass(Form("MCTruthGenPairSel_%s_%s", sig->GetName(), cut->GetName()), VarManager::fgValues);
22072227
}
2208-
if (fConfigOptions.fConfigPseudoQA.value) {
2209-
fHistMan->FillHistClass(Form("MCTruthGenPseudoPolPairSel_%s_%s", sig->GetName(), cut->GetName()), VarManager::fgValues);
2228+
if (fConfigOptions.fConfigPseudoHEQA.value) {
2229+
fHistMan->FillHistClass(Form("MCTruthGenPseudoPolPairHESel_%s_%s", sig->GetName(), cut->GetName()), VarManager::fgValues);
2230+
}
2231+
if (fConfigOptions.fConfigPseudoCSQA.value) {
2232+
fHistMan->FillHistClass(Form("MCTruthGenPseudoPolPairCSSel_%s_%s", sig->GetName(), cut->GetName()), VarManager::fgValues);
2233+
}
2234+
if (fConfigOptions.fConfigPseudoRMQA.value) {
2235+
fHistMan->FillHistClass(Form("MCTruthGenPseudoPolPairRMSel_%s_%s", sig->GetName(), cut->GetName()), VarManager::fgValues);
22102236
}
22112237

22122238
if (fConfigOptions.fConfigTruthPbPbMIDYHE.value) {
@@ -2311,13 +2337,13 @@ struct AnalysisDileptonTrack {
23112337
Configurable<std::string> fConfigMCGenSignalHadronJSON{"cfgMCGenSignalHadronJSON", "", "generator level hadron signal (JSON format), used for MC level combinatorics"};
23122338
} fConfigMCOptions;
23132339

2314-
int fCurrentRun; // needed to detect if the run changed and trigger update of calibrations etc.
2315-
int fNCuts;
2316-
int fNLegCuts;
2317-
int fNPairCuts;
2318-
int fNCommonTrackCuts;
2340+
int fCurrentRun = 0; // needed to detect if the run changed and trigger update of calibrations etc.
2341+
int fNCuts = 0;
2342+
int fNLegCuts = 0;
2343+
int fNPairCuts = 0;
2344+
int fNCommonTrackCuts = 0;
23192345
std::map<int, int> fCommonTrackCutMap;
2320-
uint32_t fTrackCutBitMap; // track cut bit mask to be used in the selection of tracks associated with dileptons
2346+
uint32_t fTrackCutBitMap = 0; // track cut bit mask to be used in the selection of tracks associated with dileptons
23212347
// vector for single-lepton and track cut names for easy access when calling FillHistogramList()
23222348
std::vector<TString> fTrackCutNames;
23232349
std::vector<TString> fLegCutNames;
@@ -2334,14 +2360,14 @@ struct AnalysisDileptonTrack {
23342360
// Filter filterMuon = aod::dqanalysisflags::isMuonSelected > static_cast<uint32_t>(0);
23352361

23362362
// use two values array to avoid mixing up the quantities
2337-
float* fValuesDilepton;
2338-
float* fValuesHadron;
2339-
HistogramManager* fHistMan;
2363+
float* fValuesDilepton = nullptr;
2364+
float* fValuesHadron = nullptr;
2365+
HistogramManager* fHistMan = nullptr;
23402366

23412367
std::vector<MCSignal*> fRecMCSignals;
23422368
std::vector<MCSignal*> fGenMCSignals;
2343-
MCSignal* fDileptonLegSignal;
2344-
MCSignal* fHadronSignal;
2369+
MCSignal* fDileptonLegSignal = nullptr;
2370+
MCSignal* fHadronSignal = nullptr;
23452371

23462372
void init(o2::framework::InitContext& context)
23472373
{
@@ -2353,7 +2379,7 @@ struct AnalysisDileptonTrack {
23532379
bool isDummy = context.mOptions.get<bool>("processDummy");
23542380

23552381
if (isDummy) {
2356-
if (isBarrel || isMCGen /*|| isBarrelAsymmetric*/ /*|| isMuon*/) {
2382+
if (isBarrel || isMCGen) {
23572383
LOG(fatal) << "Dummy function is enabled even if there are normal process functions running! Fix your config!" << endl;
23582384
} else {
23592385
LOG(info) << "Dummy function is enabled. Skipping the rest of the init function" << endl;
@@ -2576,13 +2602,13 @@ struct AnalysisDileptonTrack {
25762602
fNLegCuts = fNCuts;
25772603

25782604
// loop over single lepton cuts
2579-
if (isBarrel /*|| isBarrelAsymmetric*/ /* || isMuon*/) {
2605+
if (isBarrel) {
25802606
for (int icut = 0; icut < fNLegCuts; ++icut) {
25812607

25822608
TString pairLegCutName;
25832609

25842610
// here we check that this cut is one of those used for building the dileptons
2585-
if (isBarrel /*|| isMuon*/) {
2611+
if (isBarrel) {
25862612
if (!cfgPairing_objArrayTrackCuts->FindObject(fTrackCutNames[icut].Data())) {
25872613
continue;
25882614
}
@@ -3215,8 +3241,14 @@ void DefineHistograms(HistogramManager* histMan, TString histClasses, const char
32153241
if (classStr.Contains("MCTruthGenPair")) {
32163242
dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "mctruth_pair", histName);
32173243
}
3218-
if (classStr.Contains("MCTruthGenPseudoPolPair")) {
3219-
dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "polarization-pseudoproper-gen", histName);
3244+
if (classStr.Contains("MCTruthGenPseudoPolPairHE")) {
3245+
dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "polarization-pseudoproper-midy-he-gen", histName);
3246+
}
3247+
if (classStr.Contains("MCTruthGenPseudoPolPairCS")) {
3248+
dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "polarization-pseudoproper-midy-cs-gen", histName);
3249+
}
3250+
if (classStr.Contains("MCTruthGenPseudoPolPairRM")) {
3251+
dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "polarization-pseudoproper-midy-rand-gen", histName);
32203252
}
32213253
if (classStr.Contains("MCTruthGenPoldielectronPbPbPairHE")) {
32223254
dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "polarization-dielectron-pbpb-midy-he-gen", histName);

0 commit comments

Comments
 (0)