Skip to content

Commit eaa985f

Browse files
committed
Add optional trigger selection
1 parent 0bb9378 commit eaa985f

1 file changed

Lines changed: 45 additions & 54 deletions

File tree

PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx

Lines changed: 45 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ struct decay3bodyBuilder {
256256
// for KFParticle reconstruction
257257
struct : ConfigurableGroup {
258258
Configurable<bool> cfgSkimmedProcessing{"kfparticleConfigurations.cfgSkimmedProcessing", false, "Flag for skimmed dataset processing"};
259+
Configurable<std::string> triggerList{"kfparticleConfigurations.triggerList", "fH3L3Body", "List of triggers used to select events"};
260+
Configurable<bool> cfgOnlyKeepInterestedTrigger{"kfparticleConfigurations.cfgOnlyKeepInterestedTrigger", false, "Flag to keep only interested trigger"};
259261
Configurable<bool> fillCandidateFullTable{"kfparticleConfigurations.fillCandidateFullTable", false, "Switch to fill full table with candidate properties"};
260262
Configurable<bool> doSel8selection{"kfparticleConfigurations.doSel8selection", true, "flag for sel8 event selection"};
261263
Configurable<bool> doPosZselection{"kfparticleConfigurations.doPosZselection", true, "flag for posZ event selection"};
@@ -302,8 +304,7 @@ struct decay3bodyBuilder {
302304
ConfigurableAxis binsVtxZ{"kfparticleConfigurations.binsVtxZ", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"};
303305
ConfigurableAxis binsMultiplicity{"kfparticleConfigurations.binsMultiplicity", {VARIABLE_WIDTH, 0.0f, 1.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 110.0f}, "Mixing bins - multiplicity"};
304306
// 3body mixing
305-
Configurable<bool> mixDeuteron{"kfparticleConfigurations.mixDeuteron", true, "Mix V0 from one event with bachelor from another"};
306-
Configurable<bool> mixProton{"kfparticleConfigurations.mixProton", false, "Mix pion and bachelor from one event with proton from another"};
307+
Configurable<int> mixingType{"kfparticleConfigurations.mixingType", 0, "0: mix V0 from one event with bachelor from another, 1: mix pion and bachelor from one event with proton from another "};
307308
Configurable<bool> applySVertexerV0Cuts{"kfparticleConfigurations.applySVertexerV0Cuts", false, "Apply virtual V0 cuts applied in SVertexer in case of proton mixing"};
308309
ConfigurableAxis bins3BodyRadius{"kfparticleConfigurations.bins3BodyRadius", {VARIABLE_WIDTH, 0.0f, 0.5f, 1.0f, 1.5f, 2.0f, 3.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f, 20.0f, 30.0f, 1000.0}, "Mixing bins - 3body radius"};
309310
// ConfigurableAxis bins3BodyPhi{"kfparticleConfigurations.bins3BodyPhi", {VARIABLE_WIDTH, -180.0f*TMath::Pi()/180, -170.0f*TMath::Pi()/180, -160.0f*TMath::Pi()/180, -150.0f*TMath::Pi()/180, -140.0f*TMath::Pi()/180, -130.0f*TMath::Pi()/180, -120.0f*TMath::Pi()/180, -110.0f*TMath::Pi()/180, -100.0f*TMath::Pi()/180, -90.0f*TMath::Pi()/180, -80.0f*TMath::Pi()/180, -70.0f*TMath::Pi()/180, -60.0f*TMath::Pi()/180, -50.0f*TMath::Pi()/180, -40.0f*TMath::Pi()/180, -30.0f*TMath::Pi()/180, -20.0f*TMath::Pi()/180, -10.0f*TMath::Pi()/180, 0.0f, 10.0f*TMath::Pi()/180, 20.0f*TMath::Pi()/180, 30.0f*TMath::Pi()/180, 40.0f*TMath::Pi()/180, 50.0f*TMath::Pi()/180, 60.0f*TMath::Pi()/180, 70.0f*TMath::Pi()/180, 80.0f*TMath::Pi()/180, 90.0f*TMath::Pi()/180, 100.0f*TMath::Pi()/180, 110.0f*TMath::Pi()/180, 120.0f*TMath::Pi()/180, 130.0f*TMath::Pi()/180, 140.0f*TMath::Pi()/180, 150.0f*TMath::Pi()/180, 160.0f*TMath::Pi()/180, 170.0f*TMath::Pi()/180, 180.0f*TMath::Pi()/180}, "Mixing bins - 3body phi"};
@@ -581,9 +582,9 @@ struct decay3bodyBuilder {
581582
if (doprocessRun3withKFParticleReduced3bodyMixing == true) {
582583
auto h3bodyCombinationCounter = registry.add<TH1>("QA/EM/h3bodyCombinationCounter", "h3bodyCombinationCounter", HistType::kTH1D, {{4, 0.0f, 4.0f}});
583584
h3bodyCombinationCounter->GetXaxis()->SetBinLabel(1, "total");
584-
h3bodyCombinationCounter->GetXaxis()->SetBinLabel(2, "bach sign/ID");
585-
h3bodyCombinationCounter->GetXaxis()->SetBinLabel(3, "not same collision");
586-
h3bodyCombinationCounter->GetXaxis()->SetBinLabel(4, "collision VtxZ");
585+
h3bodyCombinationCounter->GetXaxis()->SetBinLabel(2, "not same collision");
586+
h3bodyCombinationCounter->GetXaxis()->SetBinLabel(3, "collision VtxZ");
587+
h3bodyCombinationCounter->GetXaxis()->SetBinLabel(4, "bach sign/ID");
587588
h3bodyCombinationCounter->LabelsOption("v");
588589
// registry.add("QA/EM/h3bodyBinCounts", "h3bodyBinCounts", HistType::kTH3D, {{16, 0, 16, "bins radius"}, {36, 0, 36, "bins phi"}, {12, 0, 12, "bins pos Z"}});
589590
registry.add("QA/EM/h3bodyBinCounts", "h3bodyBinCounts", HistType::kTH2D, {{16, 0, 16, "bins radius"}, {18, 0, 18, "bins phi"}});
@@ -604,7 +605,7 @@ struct decay3bodyBuilder {
604605
return;
605606
}
606607
if (kfparticleConfigurations.cfgSkimmedProcessing) {
607-
zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), "Counter");
608+
zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), kfparticleConfigurations.triggerList);
608609
zorro.populateHistRegistry(registry, bc.runNumber());
609610
}
610611

@@ -750,9 +751,9 @@ struct decay3bodyBuilder {
750751
grpMagCache[runNumber] = grpmag;
751752
}
752753

753-
// Set magnetic field for KF vertexing
754+
// Set magnetic field for KF vertexing
754755
#ifdef HomogeneousField
755-
KFParticle::SetField(d_bz);
756+
KFParticle::SetField(d_bz);
756757
#endif
757758
// Set field for DCAfitter
758759
fitterV0.setBz(d_bz);
@@ -761,14 +762,13 @@ struct decay3bodyBuilder {
761762
mV0Hyps[0].set(o2::track::PID::Lambda, o2::track::PID::Proton, o2::track::PID::Pion, pidCutsLambda, d_bz);
762763
mV0Hyps[1].set(o2::track::PID::Lambda, o2::track::PID::Pion, o2::track::PID::Proton, pidCutsLambda, d_bz);
763764

764-
if (useMatCorrType == 2) {
765-
// setMatLUT only after magfield has been initalized
766-
o2::base::Propagator::Instance()->setMatLUT(lut);
767-
}
768-
769-
// cache magnetic field info
770-
ccdbCache[runNumber] = d_bz;
765+
if (useMatCorrType == 2) {
766+
// setMatLUT only after magfield has been initalized
767+
o2::base::Propagator::Instance()->setMatLUT(lut);
771768
}
769+
770+
// cache magnetic field info
771+
ccdbCache[runNumber] = d_bz;
772772
}
773773

774774
//------------------------------------------------------------------
@@ -1495,7 +1495,7 @@ struct decay3bodyBuilder {
14951495
registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxV0MassConst);
14961496

14971497
// apply virtual V0 cuts used in SVertexer in case of 3body mixing with proton track
1498-
if (kfparticleConfigurations.mixProton && kfparticleConfigurations.applySVertexerV0Cuts) {
1498+
if (kfparticleConfigurations.mixingType == 1 && kfparticleConfigurations.applySVertexerV0Cuts) {
14991499
// V0 radius
15001500
if (std::sqrt(KFV0.GetX()*KFV0.GetX() + KFV0.GetY()*KFV0.GetY()) <= 0.5) {
15011501
return;
@@ -1939,6 +1939,10 @@ struct decay3bodyBuilder {
19391939
isZorroSelected = zorro.isSelected(collision.template bc_as<aod::BCsWithTimestamps>().globalBC());
19401940
if (isZorroSelected) {
19411941
registry.fill(HIST("Counters/hEventCounterZorro"), 0.);
1942+
} else {
1943+
if (kfparticleConfigurations.cfgOnlyKeepInterestedTrigger) {
1944+
continue;
1945+
}
19421946
}
19431947
}
19441948

@@ -2189,16 +2193,15 @@ struct decay3bodyBuilder {
21892193
} // end process
21902194
PROCESS_SWITCH(decay3bodyBuilder, processRun3withKFParticleReducedEM, "Produce KFParticle event mixing decay3body tables from derived decay3body data", false);
21912195

2192-
void processRun3withKFParticleReduced3bodyMixing(ReducedCollisionsMults const& collisions, aod::RedIUTracks const&, soa::Join<aod::RedDecay3Bodys, aod::Red3BodyInfo> const& decay3bodys)
2196+
void processRun3withKFParticleReduced3bodyMixing(ReducedCollisionsMults const&, aod::RedIUTracks const&, soa::Join<aod::RedDecay3Bodys, aod::Red3BodyInfo> const& decay3bodys)
21932197
{
2194-
for (const auto& collision : collisions) {
2195-
initCCDBfromRunNumber(collision.runNumber());
2196-
}
2197-
2198-
// Define a 3D array to count 3bodies per bin (radius, phi, posZ)
2199-
// std::vector<std::vector<std::vector<int>>> bin3bodyCounts(16, std::vector<std::vector<int>>(36, std::vector<int>(12, 0)));
2198+
// Define a 2D array to count 3bodies per bin (radius, phi, posZ)
22002199
std::vector<std::vector<int>> bin3bodyCounts(16, std::vector<int>(36, 0));
22012200

2201+
// initialise magnetic field values
2202+
float bz_c1 = 0.;
2203+
float bz_c2 = 0.;
2204+
22022205
// Function to find bin index (returns -1 if out of range)
22032206
auto findBin = [](float value, const std::vector<float>& binEdges) -> int {
22042207
for (size_t i = 0; i < binEdges.size() - 1; ++i) {
@@ -2226,31 +2229,12 @@ struct decay3bodyBuilder {
22262229
// Determine bin indices
22272230
int radiusBin = findBin(radius, {0.0f, 0.5f, 1.0f, 1.5f, 2.0f, 3.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f, 20.0f, 30.0f, 1000.0});
22282231
int phiBin = findBin(phi, {-180.0f*TMath::Pi()/180, -160.0f*TMath::Pi()/180, -140.0f*TMath::Pi()/180, -120.0f*TMath::Pi()/180, -100.0f*TMath::Pi()/180, -80.0f*TMath::Pi()/180, -60.0f*TMath::Pi()/180, -40.0f*TMath::Pi()/180, -20.0f*TMath::Pi()/180, 0.0f, 20.0f*TMath::Pi()/180, 40.0f*TMath::Pi()/180, 60.0f*TMath::Pi()/180, 80.0f*TMath::Pi()/180, 100.0f*TMath::Pi()/180, 120.0f*TMath::Pi()/180, 140.0f*TMath::Pi()/180, 160.0f*TMath::Pi()/180, 180.0f*TMath::Pi()/180});
2229-
// int phiBin = findBin(phi, {-180.0f*TMath::Pi()/180, -170.0f*TMath::Pi()/180, -160.0f*TMath::Pi()/180, -150.0f*TMath::Pi()/180, -140.0f*TMath::Pi()/180, -130.0f*TMath::Pi()/180, -120.0f*TMath::Pi()/180, -110.0f*TMath::Pi()/180, -100.0f*TMath::Pi()/180, -90.0f*TMath::Pi()/180, -80.0f*TMath::Pi()/180, -70.0f*TMath::Pi()/180, -60.0f*TMath::Pi()/180, -50.0f*TMath::Pi()/180, -40.0f*TMath::Pi()/180, -30.0f*TMath::Pi()/180, -20.0f*TMath::Pi()/180, -10.0f*TMath::Pi()/180, 0.0f, 10.0f*TMath::Pi()/180, 20.0f*TMath::Pi()/180, 30.0f*TMath::Pi()/180, 40.0f*TMath::Pi()/180, 50.0f*TMath::Pi()/180, 60.0f*TMath::Pi()/180, 70.0f*TMath::Pi()/180, 80.0f*TMath::Pi()/180, 90.0f*TMath::Pi()/180, 100.0f*TMath::Pi()/180, 110.0f*TMath::Pi()/180, 120.0f*TMath::Pi()/180, 130.0f*TMath::Pi()/180, 140.0f*TMath::Pi()/180, 150.0f*TMath::Pi()/180, 160.0f*TMath::Pi()/180, 170.0f*TMath::Pi()/180, 180.0f*TMath::Pi()/180});
2230-
// int posZBin = findBin(posZ, {-300.0f, -42.0f, -13.0f, -6.0f, -4.0f, -2.0f, 0.0f, 2.0f, 4.0f, 6.0f, 13.0f, 42.0f, 300.0f});
22312232
if (radiusBin >= 0 && phiBin >= 0) { // && posZBin >= 0) {
22322233
bin3bodyCounts[radiusBin][phiBin]++; //[posZBin]++;
22332234
}
22342235
}
22352236
LOG(info) << "3body counter: " << counter;
2236-
// // Print out the number of 3-body decays per bin
2237-
// LOG(info) << "3body count per bin (radius, phi, posZ):";
2238-
// for (size_t i = 0; i < bin3bodyCounts.size(); ++i) {
2239-
// for (size_t j = 0; j < bin3bodyCounts[i].size(); ++j) {
2240-
// for (size_t k = 0; k < bin3bodyCounts[i][j].size(); ++k) {
2241-
// LOG(info) << "Bin (" << i << ", " << j << ", " << k << "): " << bin3bodyCounts[i][j][k] << " 3bodies";
2242-
// }
2243-
// }
2244-
// }
2245-
// // Fill 3D histogram with numbers per bin
2246-
// for (size_t i = 0; i < bin3bodyCounts.size(); ++i) {
2247-
// for (size_t j = 0; j < bin3bodyCounts[i].size(); ++j) {
2248-
// for (size_t k = 0; k < bin3bodyCounts[i][j].size(); ++k) {
2249-
// registry.fill(HIST("QA/EM/h3bodyBinCounts"), i, j, k, bin3bodyCounts[i][j][k]);
2250-
// }
2251-
// }
2252-
// }
2253-
// LOG(info) << "Integral of h3bodyBinCounts: " << registry.get<TH3>(HIST("QA/EM/h3bodyBinCounts"))->Integral();
2237+
22542238
// Print out the number of 3-body decays per bin
22552239
LOG(info) << "3body count per bin (radius, phi, posZ):";
22562240
for (size_t i = 0; i < bin3bodyCounts.size(); ++i) {
@@ -2266,7 +2250,6 @@ struct decay3bodyBuilder {
22662250
}
22672251
LOG(info) << "Integral of h3bodyBinCounts: " << registry.get<TH2>(HIST("QA/EM/h3bodyBinCounts"))->Integral();
22682252

2269-
// Binning3Body binningOnRadPhiPosZ{{kfparticleConfigurations.bins3BodyRadius, kfparticleConfigurations.bins3BodyPhi, kfparticleConfigurations.bins3BodyPosZ}, true};
22702253
Binning3Body binningOnRadPhi{{kfparticleConfigurations.bins3BodyRadius, kfparticleConfigurations.bins3BodyPhi}, true};
22712254

22722255
// Strictly upper index policy for decay3body objects binned by radius, phi and z position
@@ -2280,36 +2263,44 @@ struct decay3bodyBuilder {
22802263

22812264
registry.fill(HIST("QA/EM/h3bodyCombinationCounter"), 0.5);
22822265

2283-
// ---------- selections ----------
2284-
if ((trackBach1.sign() > 0 && !(trackBach2.sign() > 0)) || (trackBach1.sign() < 0 && !(trackBach2.sign() < 0)) || trackBach1.globalIndex() == trackBach2.globalIndex()) { // only combine if trackBach2 has correct sign and is not same as trackBach1
2266+
// collision vertex selections
2267+
auto collision1 = decay3body1.template collision_as<ReducedCollisionsMults>();
2268+
auto collision2 = decay3body2.template collision_as<ReducedCollisionsMults>();
2269+
initCCDBfromRunNumber(collision2.runNumber());
2270+
bz_c2 = d_bz;
2271+
initCCDBfromRunNumber(collision1.runNumber());
2272+
bz_c1 = d_bz;
2273+
2274+
if (decay3body1.collisionId() == decay3body2.collisionId()) { // only combine if from different event
22852275
continue;
22862276
}
22872277
registry.fill(HIST("QA/EM/h3bodyCombinationCounter"), 1.5);
2288-
2289-
if (decay3body1.collisionId() == decay3body2.collisionId()) { // only combine if from different event
2278+
if (kfparticleConfigurations.selectVtxZ3bodyMixing && std::abs(collision1.posZ() - collision2.posZ()) > kfparticleConfigurations.VtxZBin3bodyMixing) { // only combine if collision similar in VtxZ
22902279
continue;
22912280
}
22922281
registry.fill(HIST("QA/EM/h3bodyCombinationCounter"), 2.5);
22932282

2294-
auto collision1 = decay3body1.template collision_as<ReducedCollisionsMults>();
2295-
auto collision2 = decay3body2.template collision_as<ReducedCollisionsMults>();
2296-
if (kfparticleConfigurations.selectVtxZ3bodyMixing && std::abs(collision1.posZ() - collision2.posZ()) > kfparticleConfigurations.VtxZBin3bodyMixing) { // only combine if collision similar in VtxZ
2283+
// ---------- selections ----------
2284+
if ((trackBach1.sign() > 0 && !(trackBach2.sign() > 0)) || (trackBach1.sign() < 0 && !(trackBach2.sign() < 0)) || trackBach1.globalIndex() == trackBach2.globalIndex()) { // only combine if trackBach2 has correct sign and is not same as trackBach1
22972285
continue;
22982286
}
22992287
registry.fill(HIST("QA/EM/h3bodyCombinationCounter"), 3.5);
2300-
2288+
23012289
// ---------- do candidate analysis ----------
23022290
bool isMatter1 = false;
23032291
if (trackBach1.sign() > 0) {
23042292
isMatter1 = true;
23052293
}
2306-
if (kfparticleConfigurations.mixDeuteron == true) {
2294+
if (kfparticleConfigurations.mixingType == 0) { // mix deuteron
23072295
buildVtx3BodyDataTableKFParticle(collision1, trackPos1, trackNeg1, trackBach2, -1 /*vtx3bodyID*/, bachelorcharge, trackBach2.tofNSigmaDe());
2308-
} else if (kfparticleConfigurations.mixProton == true) {
2296+
buildVtx3BodyDataTableKFParticle(collision2, trackPos2, trackNeg2, trackBach1, -1 /*vtx3bodyID*/, bachelorcharge, trackBach1.tofNSigmaDe());
2297+
} else if (kfparticleConfigurations.mixingType == 1) { // mix proton
23092298
if (isMatter1 == true) {
23102299
buildVtx3BodyDataTableKFParticle(collision1, trackPos2, trackNeg1, trackBach1, -1 /*vtx3bodyID*/, bachelorcharge, trackBach1.tofNSigmaDe());
2300+
buildVtx3BodyDataTableKFParticle(collision2, trackPos1, trackNeg2, trackBach2, -1 /*vtx3bodyID*/, bachelorcharge, trackBach2.tofNSigmaDe());
23112301
} else if (isMatter1 == false) {
23122302
buildVtx3BodyDataTableKFParticle(collision1, trackPos1, trackNeg2, trackBach1, -1 /*vtx3bodyID*/, bachelorcharge, trackBach1.tofNSigmaDe());
2303+
buildVtx3BodyDataTableKFParticle(collision2, trackPos2, trackNeg1, trackBach2, -1 /*vtx3bodyID*/, bachelorcharge, trackBach2.tofNSigmaDe());
23132304
}
23142305
}
23152306
} // end decay3body combinations loop

0 commit comments

Comments
 (0)