Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 50 additions & 31 deletions PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/workflow-file]

Name of a workflow file must match the name of the main struct in it (without the PWG prefix). (Class implementation files should be in "Core" directories.)
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand Down Expand Up @@ -121,8 +121,7 @@
Configurable<int> useMatCorrType{"useMatCorrType", 0, "0: none, 1: TGeo, 2: LUT"};
Configurable<bool> doTrackQA{"doTrackQA", false, "Flag to fill QA histograms for daughter tracks of (selected) decay3body candidates."};
Configurable<bool> doVertexQA{"doVertexQA", false, "Flag to fill QA histograms for PV of (selected) events."};
Configurable<bool> doSel8selection{"doSel8selection", true, "flag for sel8 event selection"};
Configurable<bool> doPosZselection{"doPosZselection", true, "flag for posZ event selection"};
Configurable<bool> disableITSROFCut{"disableITSROFCut", false, "Disable ITS ROF border cut"};

// data processing options
Configurable<bool> doSkimmedProcessing{"doSkimmedProcessing", false, "Apply Zoroo counting in case of skimmed data input"};
Expand All @@ -133,7 +132,7 @@
// CCDB options
struct : ConfigurableGroup {
std::string prefix = "ccdb";
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};

Check failure on line 135 in PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
Configurable<std::string> grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"};
Configurable<std::string> grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
Configurable<std::string> lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"};
Expand Down Expand Up @@ -188,8 +187,8 @@
std::string prefix = "mixingOpts";
Configurable<int> n3bodyMixing{"n3bodyMixing", 0, "Number of decay3bodys to mix: 0 - value set to maximum bin entry in hDecay3BodyRadiusPhi, > 0 - manual setting"};
Configurable<int> mixingType{"mixingType", 0, "0: mix V0 from one event with bachelor from another, 1: mix pion and bachelor from one event with proton from another, 1: mix proton and bachelor from one event with pion from another "};
ConfigurableAxis bins3BodyRadius{"mixingOpts.bins3BodyRadius", {VARIABLE_WIDTH, 0.0f, 2.0f, 4.0f, 7.0f, 10.0f, 14.0f, 18.0f, 22.0f, 30.0f, 40.0f}, "Mixing bins - 3body radius"};

Check failure on line 190 in PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
ConfigurableAxis bins3BodyPhi{"mixingOpts.bins3BodyPhi", {VARIABLE_WIDTH, -180 * o2::constants::math::Deg2Rad, -120 * o2::constants::math::Deg2Rad, -60 * o2::constants::math::Deg2Rad, 0, 60 * o2::constants::math::Deg2Rad, 120 * o2::constants::math::Deg2Rad, 180 * o2::constants::math::Deg2Rad}, "Mixing bins - 3body phi (rad)"};

Check failure on line 191 in PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
ConfigurableAxis bins3BodyPhiDegree{"mixingOpts.bins3BodyPhiDegree", {VARIABLE_WIDTH, -180, -120, -60, 0, 60, 120, 180}, "Mixing bins - 3body phi (degree)"};
ConfigurableAxis bins3BodyPosZ{"mixingOpts.bins3BodyPosZ", {VARIABLE_WIDTH, -500.0f, -200.0f, -100.0f, -70.0f, -60.0f, -50.0f, -40.0f, -35.0f, -30.0f, -25.0f, -20.0f, -15.0f, -13.0f, -10.0f, -8.0f, -6.0f, -4.0f, -2.0f, 0.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 13.0f, 15.0f, 20.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f, 60.0f, 70.0f, 100.0f, 200.0f, 500.0f}, "3body SV z position"};
Configurable<bool> selectPVPosZ3bodyMixing{"selectPVPosZ3bodyMixing", true, "Select same pvPosZ events in case of 3body mixing"};
Expand Down Expand Up @@ -299,7 +298,7 @@
}
matCorr = o2::base::Propagator::MatCorrType::USEMatCorrTGeo;
}
if (useMatCorrType == 2) {

Check failure on line 301 in PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
LOGF(info, "LUT correction requested, loading LUT");
lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get<o2::base::MatLayerCylSet>(ccdbConfigurations.lutPath));
matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT;
Expand Down Expand Up @@ -433,13 +432,19 @@

// Add histograms separately for different process functions
if (doprocessRealData == true || doprocessMonteCarlo == true) {
auto hEventCounter = registry.add<TH1>("Counters/hEventCounter", "hEventCounter", HistType::kTH1D, {{3, 0.0f, 3.0f}});
hEventCounter->GetXaxis()->SetBinLabel(1, "total");
hEventCounter->GetXaxis()->SetBinLabel(2, "sel8");
hEventCounter->GetXaxis()->SetBinLabel(3, "vertexZ");
auto hEventCounter = registry.add<TH1>("Counters/hEventCounter", "hEventCounter", HistType::kTH1D, {{2, 0.0f, 2.0f}});
hEventCounter->GetXaxis()->SetBinLabel(1, "all");
hEventCounter->GetXaxis()->SetBinLabel(2, "selected");
hEventCounter->LabelsOption("v");
}

if (doprocessMonteCarlo == true) {
auto hMcEventCounter = registry.add<TH1>("Counters/hMcEventCounter", "hMcEventCounter", HistType::kTH1D, {{2, 0.0f, 2.0f}});
hMcEventCounter->GetXaxis()->SetBinLabel(1, "all");
hMcEventCounter->GetXaxis()->SetBinLabel(2, "reconstructed");
hMcEventCounter->LabelsOption("v");
}

if (doprocessRealData == true || doprocessRealDataReduced == true || doprocessMonteCarlo == true) {
if (doTrackQA) { // histograms for all daughter tracks of (selected) 3body candidates
registry.add("QA/Tracks/hTrackProtonTPCNcls", "hTrackProtonTPCNcls", HistType::kTH1F, {{152, 0, 152, "# TPC clusters"}});
Expand Down Expand Up @@ -520,7 +525,7 @@
KFParticle::SetField(d_bz);
#endif

if (useMatCorrType == 2) {

Check failure on line 528 in PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
// setMatLUT only after magfield has been initalized
// (setMatLUT has implicit and problematic init field call if not)
LOG(info) << "Loading material look-up table for timestamp: " << timestamp;
Expand Down Expand Up @@ -580,7 +585,7 @@
helper.fitterV0.setBz(magField);
helper.fitter3body.setBz(magField);

if (useMatCorrType == 2) {

Check failure on line 588 in PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
// setMatLUT only after magfield has been initalized (setMatLUT has implicit and problematic init field call if not)
o2::base::Propagator::Instance()->setMatLUT(lut);
}
Expand Down Expand Up @@ -618,26 +623,31 @@
// Loop over collisions for vertex QA
for (const auto& collision : collisions) {
if constexpr (soa::is_table<TBCs>) { // only do if NOT running over reduced data (already done in reducedCreator)

// all events
registry.fill(HIST("Counters/hEventCounter"), 0.5);

// ITS ROF boarder cut if not disabled
if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && !disableITSROFCut) {
continue;
}

// Zorro event counting
bool isZorroSelected = false;
if (doSkimmedProcessing) {
isZorroSelected = zorro.isSelected(collision.template bc_as<TBCs>().globalBC());
if (!isZorroSelected && onlyKeepInterestedTrigger) {
continue;
if (isZorroSelected) {
isTriggeredCollision[collision.globalIndex()] = true;
}
}

isTriggeredCollision[collision.globalIndex()] = true;
// event counting
registry.fill(HIST("Counters/hEventCounter"), 0.5);
if (doSel8selection && !collision.sel8()) {
// event selection
if (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) {

Check failure on line 645 in PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
continue;
}

// selected events
registry.fill(HIST("Counters/hEventCounter"), 1.5);
if (doPosZselection && (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) {
continue;
}
registry.fill(HIST("Counters/hEventCounter"), 2.5);
}

// vertex QA and counting
Expand All @@ -656,7 +666,7 @@

// In case of MC: reco collision survived event selection filter --> fill value for MC collision if collision is "true" MC collision
if constexpr (soa::is_table<TMCParticles>) {
if (collision.mcCollisionId() >= 0) {
if (collision.has_mcCollision()) {
isGoodCollision[collision.mcCollisionId()] = true;
}
}
Expand All @@ -680,6 +690,20 @@
// aquire collision
auto const& collision = collisions.rawIteratorAt(decay3body.collisionId());

// event selection
if constexpr (soa::is_table<TBCs>) { // only when NOT running over reduced data
if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && !disableITSROFCut) { // ITS ROF boarder cut if not disabled
continue;
}
if (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) {

Check failure on line 698 in PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
continue;
}
// Zorro
if (doSkimmedProcessing && onlyKeepInterestedTrigger && !isTriggeredCollision[collision.globalIndex()]) {
continue;
}
}

// initialise CCDB from run number saved in reduced collisions table when running over reduced data
if constexpr (!soa::is_table<TBCs>) { // only do if running over reduced data (otherwise CCDB is initialised in process function)
if (collision.runNumber() != lastRunNumber) {
Expand All @@ -689,19 +713,6 @@
}
}

// event selection
if constexpr (soa::is_table<TBCs>) { // only when NOT running over reduced data
if (doSel8selection && !collision.sel8()) {
continue;
}
if (onlyKeepInterestedTrigger && !isTriggeredCollision[collision.globalIndex()]) {
continue;
}
}
if (doPosZselection && (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) {
continue;
}

// aquire tracks
auto trackPos = decay3body.template track0_as<TTracksTo>();
auto trackNeg = decay3body.template track1_as<TTracksTo>();
Expand Down Expand Up @@ -775,7 +786,7 @@
this3BodyMCInfo.isReco = true;

// set flag if selected reco collision has matched gen collision
if (collision.mcCollisionId() >= 0) { // reco collision is matched to gen collision
if (collision.has_mcCollision()) { // reco collision is matched to gen collision
this3BodyMCInfo.survivedEventSel = isGoodCollision[collision.mcCollisionId()];
} else {
this3BodyMCInfo.survivedEventSel = false; // false if reco collision not matched to gen collision
Expand Down Expand Up @@ -1031,7 +1042,7 @@
doMixing(collision1, trackProton0, trackPion1, trackDeuteron1, magFieldCol1);
}
// mix pion
if (mixingOpts.mixingType == 2) {

Check failure on line 1045 in PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
doMixing(collision0, trackProton0, trackPion1, trackDeuteron0, magFieldCol0);
doMixing(collision1, trackProton1, trackPion0, trackDeuteron1, magFieldCol1);
}
Expand Down Expand Up @@ -1327,6 +1338,14 @@
fTrackedClSizeVector[tvtx3body.decay3BodyId()] = tvtx3body.itsClsSize();
}

// MC collision counting for event loss
registry.fill(HIST("Counters/hMcEventCounter"), 0.5, mcCollisions.size());
for (const auto& collision : collisions) {
if (collision.has_mcCollision()) {
registry.fill(HIST("Counters/hMcEventCounter"), 1.5);
}
}

// do candidate analysis with MC processing
buildCandidates<TracksExtPIDIUwithEvTimesLabeled>(bcs, // bc table
collisions, // collision table
Expand Down
44 changes: 23 additions & 21 deletions PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ struct reduced3bodyCreator {
o2::vertexing::DCAFitterN<3> fitter3body;
o2::aod::pidtofgeneric::TofPidNewCollision<TrackExtPIDIUwithEvTimes::iterator> bachelorTOFPID;

Configurable<bool> doSel8selection{"doSel8selection", true, "flag for sel8 event selection"};
Configurable<bool> doPosZselection{"doPosZselection", true, "flag for posZ event selection"};
Configurable<bool> disableITSROFCut{"disableITSROFCut", false, "Disable ITS ROF border cut"};
// CCDB options
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Configurable<std::string> grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"};
Expand Down Expand Up @@ -152,11 +151,10 @@ struct reduced3bodyCreator {

registry.add("hAllSelEventsVtxZ", "hAllSelEventsVtxZ", HistType::kTH1F, {{500, -15.0f, 15.0f, "PV Z (cm)"}});

auto hEventCounter = registry.add<TH1>("hEventCounter", "hEventCounter", HistType::kTH1D, {{4, 0.0f, 4.0f}});
hEventCounter->GetXaxis()->SetBinLabel(1, "total");
hEventCounter->GetXaxis()->SetBinLabel(2, "sel8");
hEventCounter->GetXaxis()->SetBinLabel(3, "vertexZ");
hEventCounter->GetXaxis()->SetBinLabel(4, "reduced");
auto hEventCounter = registry.add<TH1>("hEventCounter", "hEventCounter", HistType::kTH1D, {{3, 0.0f, 3.0f}});
hEventCounter->GetXaxis()->SetBinLabel(1, "all");
hEventCounter->GetXaxis()->SetBinLabel(2, "selected");
hEventCounter->GetXaxis()->SetBinLabel(3, "reduced");
hEventCounter->LabelsOption("v");

auto hEventCounterZorro = registry.add<TH1>("hEventCounterZorro", "hEventCounterZorro", HistType::kTH1D, {{2, 0, 2}});
Expand Down Expand Up @@ -259,6 +257,14 @@ struct reduced3bodyCreator {
lastRunNumber = bc.runNumber(); // Update the last run number
}

// all events
registry.fill(HIST("hEventCounter"), 0.5);

// ITS ROF boarder cut if not disabled
if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && !disableITSROFCut) {
continue;
}

// Zorro event counting
bool isZorroSelected = false;
if (cfgSkimmedProcessing) {
Expand All @@ -269,16 +275,13 @@ struct reduced3bodyCreator {
}
}

// Event selection
registry.fill(HIST("hEventCounter"), 0.5);
if (doSel8selection && !collision.sel8()) {
// event selection
if (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) {
continue;
}

// selected events
registry.fill(HIST("hEventCounter"), 1.5);
if (doPosZselection && (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) { // 10cm
continue;
}
registry.fill(HIST("hEventCounter"), 2.5);
registry.fill(HIST("hAllSelEventsVtxZ"), collision.posZ());

if (cfgSkimmedProcessing && isZorroSelected) {
Expand All @@ -300,19 +303,18 @@ struct reduced3bodyCreator {

auto collision = d3body.template collision_as<ColwithEvTimesMultsCents>();

if (doSel8selection && !collision.sel8()) {
// event selection
if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && !disableITSROFCut) { // ITS ROF boarder cut if not disabled
continue;
}
if (doPosZselection && (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) { // 10cm
if (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) {
continue;
}

auto bc = collision.bc_as<aod::BCsWithTimestamps>();
initCCDB(bc);
if (cfgSkimmedProcessing && cfgOnlyKeepInterestedTrigger) {
if (isTriggeredCollision[collision.globalIndex()] == false) {
continue;
}
if (cfgSkimmedProcessing && cfgOnlyKeepInterestedTrigger && !isTriggeredCollision[collision.globalIndex()]) {
continue;
}

// Save the collision
Expand Down Expand Up @@ -411,7 +413,7 @@ struct reduced3bodyCreator {
reduced3BodyInfo(radius, phi, posZ, rVtx, phiVtx, zVtx, fTrackedClSizeVector[d3body.globalIndex()]);
} // end decay3body loop

registry.fill(HIST("hEventCounter"), 3.5, reducedCollisions.lastIndex() + 1);
registry.fill(HIST("hEventCounter"), 2.5, reducedCollisions.lastIndex() + 1);
}
};

Expand Down
Loading