Skip to content

Commit 40c7ef7

Browse files
iarseneIonut-Cristian Arsene
andauthored
[PWGDQ] Add process function for event mixing in the Dilepton-Hadron analysis task (#3137)
* Squashed commit of the following: commit 933a08181af352ff1424bcba9cd51f844000bcd4 Author: Ionut-Cristian Arsene <iarsene@cern.ch> Date: Thu Jun 29 11:45:44 2023 +0200 clang fixes commit e8a93bf04cd9f974f57d9eb47ff365664c02e64d Author: Ionut-Cristian Arsene <iarsene@cern.ch> Date: Thu Jun 29 11:41:35 2023 +0200 Fix of the variadic template in MCSignal, implementing fixes in all tasks using MCSignal::CheckSignal() commit f36e641 Merge: 3eed175 87e1d52 Author: Ionut Cristian Arsene <Ionut.Cristian.Arsene@cern.ch> Date: Mon Jun 26 12:33:30 2023 +0200 Merge pull request #2 from aalkin/mc-signal-test fix iterator handling for decay chain traversal commit 87e1d52 Author: Anton Alkin <anton.alkin@cern.ch> Date: Mon Jun 26 11:26:52 2023 +0200 format commit 08f44c2 Author: Anton Alkin <anton.alkin@cern.ch> Date: Mon Jun 26 11:25:04 2023 +0200 fix iterator handling for decay chain traversal commit 3eed175 Author: Ionut-Cristian Arsene <iarsene@cern.ch> Date: Sun Jun 25 13:32:42 2023 +0200 Remove the stack from MCSignal::CheckSignal * fix check sources parameter * Adding mixed event for the dilepton-hadron task * Add process function for event mixing in the Dilepton-hadron analysis task * fix merging issues * fix clang --------- Co-authored-by: Ionut-Cristian Arsene <iarsene@cern.ch>
1 parent 636d1ba commit 40c7ef7

File tree

2 files changed

+50
-5
lines changed

2 files changed

+50
-5
lines changed

PWGDQ/Core/MCSignal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ bool MCSignal::CheckProng(int i, bool checkSources, const T& track)
252252
std::vector<int> pdgInHistory;
253253

254254
// while find mothers, check if the provided PDG codes are included or excluded in the particle decay history
255-
int nIncludedPDG = 0;
256-
for (int k = 0; k < fProngs[i].fPDGInHistory.size(); k++) {
255+
unsigned int nIncludedPDG = 0;
256+
for (unsigned int k = 0; k < fProngs[i].fPDGInHistory.size(); k++) {
257257
currentMCParticle = track;
258258
if (!fProngs[i].fExcludePDGInHistory[k])
259259
nIncludedPDG++;

PWGDQ/Tasks/tableReader.cxx

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,9 +1151,13 @@ struct AnalysisDileptonHadron {
11511151
Configurable<string> fConfigTrackCuts{"cfgLeptonCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"};
11521152
// comment: add list of subgroups (must define subgroups under )
11531153
Configurable<std::string> fConfigAddDileptonHadHistogram{"cfgAddDileptonHadHistogram", "", "Comma separated list of histograms"};
1154+
Configurable<int> fConfigMixingDepth{"cfgMixingDepth", 5, "Event mixing pool depth"};
1155+
Configurable<float> fConfigDileptonLowMass{"cfgDileptonLowMass", 2.8, "Low mass cut for the dileptons used in analysis"};
1156+
Configurable<float> fConfigDileptonHighMass{"cfgDileptonHighMass", 3.2, "High mass cut for the dileptons used in analysis"};
11541157

11551158
Filter eventFilter = aod::dqanalysisflags::isEventSelected == 1;
1156-
Filter dileptonFilter = aod::reducedpair::mass > 2.92f && aod::reducedpair::mass < 3.16f && aod::reducedpair::sign == 0;
1159+
Filter dileptonFilter = aod::reducedpair::mass > fConfigDileptonLowMass.value&& aod::reducedpair::mass < fConfigDileptonHighMass.value&& aod::reducedpair::sign == 0;
1160+
Filter filterBarrelTrackSelected = aod::dqanalysisflags::isBarrelSelected > 0;
11571161

11581162
constexpr static uint32_t fgDileptonFillMap = VarManager::ObjTypes::ReducedTrack | VarManager::ObjTypes::Pair; // fill map
11591163

@@ -1167,6 +1171,8 @@ struct AnalysisDileptonHadron {
11671171
// The current condition should be replaced when bitwise operators will become available in Filter expressions
11681172
int fNHadronCutBit;
11691173

1174+
NoBinningPolicy<aod::dqanalysisflags::MixingHash> hashBin;
1175+
11701176
void init(o2::framework::InitContext& context)
11711177
{
11721178
fValuesDilepton = new float[VarManager::kNVars];
@@ -1180,9 +1186,13 @@ struct AnalysisDileptonHadron {
11801186
// TODO: Implement possibly multiple selections for the associated track ?
11811187
if (context.mOptions.get<bool>("processSkimmed")) {
11821188
DefineHistograms(fHistMan, "DileptonsSelected;DileptonHadronInvMass;DileptonHadronCorrelation", fConfigAddDileptonHadHistogram); // define all histograms
1183-
VarManager::SetUseVars(fHistMan->GetUsedVars());
1184-
fOutputList.setObject(fHistMan->GetMainHistogramList());
11851189
}
1190+
if (context.mOptions.get<bool>("processMixedEvent")) {
1191+
DefineHistograms(fHistMan, "DileptonHadronInvMassME", fConfigAddDileptonHadHistogram); // define all histograms
1192+
}
1193+
1194+
VarManager::SetUseVars(fHistMan->GetUsedVars());
1195+
fOutputList.setObject(fHistMan->GetMainHistogramList());
11861196

11871197
TString configCutNamesStr = fConfigTrackCuts.value;
11881198
if (!configCutNamesStr.IsNull()) {
@@ -1256,12 +1266,47 @@ struct AnalysisDileptonHadron {
12561266
{
12571267
runDileptonHadron<VarManager::kBtoJpsiEEK, gkEventFillMapWithCov, gkTrackFillMapWithCov>(event, tracks, dileptons);
12581268
}
1269+
1270+
Preslice<soa::Filtered<MyPairCandidatesSelected>> perEventPairs = aod::reducedpair::reducedeventId;
1271+
Preslice<soa::Filtered<MyBarrelTracksSelected>> perEventTracks = aod::reducedtrack::reducedeventId;
1272+
1273+
void processMixedEvent(soa::Filtered<MyEventsHashSelected>& events, soa::Filtered<MyPairCandidatesSelected> const& dileptons, soa::Filtered<MyBarrelTracksSelected> const& tracks)
1274+
{
1275+
events.bindExternalIndices(&dileptons);
1276+
events.bindExternalIndices(&tracks);
1277+
1278+
for (auto& [event1, event2] : selfCombinations(hashBin, fConfigMixingDepth.value, -1, events, events)) {
1279+
VarManager::ResetValues(0, VarManager::kNVars);
1280+
VarManager::FillEvent<gkEventFillMap>(event1, VarManager::fgValues);
1281+
1282+
auto evDileptons = dileptons.sliceBy(perEventPairs, event1.globalIndex());
1283+
evDileptons.bindExternalIndices(&events);
1284+
1285+
auto evTracks = tracks.sliceBy(perEventTracks, event2.globalIndex());
1286+
evTracks.bindExternalIndices(&events);
1287+
1288+
for (auto dilepton : evDileptons) {
1289+
for (auto& track : evTracks) {
1290+
1291+
if (!(uint32_t(track.isBarrelSelected()) & (uint32_t(1) << fNHadronCutBit))) {
1292+
continue;
1293+
}
1294+
1295+
VarManager::FillDileptonHadron(dilepton, track, VarManager::fgValues);
1296+
fHistMan->FillHistClass("DileptonHadronInvMassME", VarManager::fgValues);
1297+
} // end for (track)
1298+
} // end for (dilepton)
1299+
1300+
} // end event loop
1301+
}
1302+
12591303
void processDummy(MyEvents&)
12601304
{
12611305
// do nothing
12621306
}
12631307

12641308
PROCESS_SWITCH(AnalysisDileptonHadron, processSkimmed, "Run dilepton-hadron pairing, using skimmed data", false);
1309+
PROCESS_SWITCH(AnalysisDileptonHadron, processMixedEvent, "Run dilepton-hadron mixed event pairing", false);
12651310
PROCESS_SWITCH(AnalysisDileptonHadron, processDummy, "Dummy function", false);
12661311
};
12671312

0 commit comments

Comments
 (0)