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
40 changes: 33 additions & 7 deletions PWGEM/Dilepton/Core/Dilepton.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@
#include <utility>
#include <vector>

using namespace o2;

Check failure on line 64 in PWGEM/Dilepton/Core/Dilepton.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.
using namespace o2::aod;

Check failure on line 65 in PWGEM/Dilepton/Core/Dilepton.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.
using namespace o2::framework;

Check failure on line 66 in PWGEM/Dilepton/Core/Dilepton.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.
using namespace o2::framework::expressions;

Check failure on line 67 in PWGEM/Dilepton/Core/Dilepton.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.
using namespace o2::soa;

Check failure on line 68 in PWGEM/Dilepton/Core/Dilepton.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.
using namespace o2::aod::pwgem::dilepton::utils;

Check failure on line 69 in PWGEM/Dilepton/Core/Dilepton.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.
using namespace o2::aod::pwgem::dilepton::utils::emtrackutil;

Check failure on line 70 in PWGEM/Dilepton/Core/Dilepton.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.
using namespace o2::aod::pwgem::dilepton::utils::pairutil;

Check failure on line 71 in PWGEM/Dilepton/Core/Dilepton.h

View workflow job for this annotation

GitHub Actions / O2 linter

[using-directive]

Do not put using directives at global scope in headers.

using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsQvec>;
using MyCollision = MyCollisions::iterator;
Expand Down Expand Up @@ -298,10 +298,14 @@
Configurable<uint64_t> bcMarginForSoftwareTrigger{"bcMarginForSoftwareTrigger", 100, "Number of BCs of margin for software triggers"};
} zorroGroup;

Zorro zorro;
int mToIidx = 0;
int mTOICounter = 0;
int mATCounter = 0;

o2::aod::rctsel::RCTFlagsChecker rctChecker;
// o2::ccdb::CcdbApi ccdbApi;
Service<o2::ccdb::BasicCCDBManager> ccdb;
Zorro zorro;
int mRunNumber;
float d_bz;

Expand Down Expand Up @@ -331,6 +335,9 @@
{
mRunNumber = 0;
d_bz = 0;
mToIidx = 0;
mTOICounter = 0;
mATCounter = 0;

ccdb->setURL(ccdburl);
ccdb->setCaching(true);
Expand Down Expand Up @@ -426,9 +433,11 @@

if (doprocessTriggerAnalysis) {
LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", zorroGroup.cfg_swt_name.value.data());
fRegistry.add("Event/trigger/hInspectedTVX", "inspected TVX;run number;N_{TVX}", kTProfile, {{100000, 500000.5, 600000.5}}, true); // extend X range in Run 4/5
fRegistry.add("Event/trigger/hScalers", "trigger counter before DS;run number;counter", kTProfile, {{100000, 500000.5, 600000.5}}, true); // extend X range in Run 4/5
fRegistry.add("Event/trigger/hSelections", "trigger counter after DS;run number;counter", kTProfile, {{100000, 500000.5, 600000.5}}, true); // extend X range in Run 4/5
fRegistry.add("Event/trigger/hInspectedTVX", "inspected TVX;run number;N_{TVX}", kTProfile, {{100000, 500000.5, 600000.5}}, true); // extend X range in Run 4/5
fRegistry.add("Event/trigger/hScaler", "trigger counter before DS;run number;counter", kTProfile, {{100000, 500000.5, 600000.5}}, true); // extend X range in Run 4/5
fRegistry.add("Event/trigger/hSelection", "trigger counter after DS;run number;counter", kTProfile, {{100000, 500000.5, 600000.5}}, true); // extend X range in Run 4/5
fRegistry.add("Event/trigger/hAnalysedTrigger", Form("analysed trigger %s;run number;counter", zorroGroup.cfg_swt_name.value.data()), kTH1D, {{100000, 500000.5, 600000.5}}, true); // extend X range in Run 4/5
fRegistry.add("Event/trigger/hAnalysedToI", Form("analysed ToI %s;run number;counter", zorroGroup.cfg_swt_name.value.data()), kTH1D, {{100000, 500000.5, 600000.5}}, true); // extend X range in Run 4/5
}

if (doprocessNorm) {
Expand All @@ -454,10 +463,10 @@
}

// In case override, don't proceed, please - no CCDB access required
if (d_bz_input > -990) {

Check failure on line 466 in PWGEM/Dilepton/Core/Dilepton.h

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.
d_bz = d_bz_input;
o2::parameters::GRPMagField grpmag;
if (std::fabs(d_bz) > 1e-5) {

Check failure on line 469 in PWGEM/Dilepton/Core/Dilepton.h

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.
grpmag.setL3Current(30000.f / (d_bz / 5.0f));
}
o2::base::Propagator::initFieldFromGRP(&grpmag);
Expand Down Expand Up @@ -490,7 +499,7 @@
if constexpr (isTriggerAnalysis) {
zorro.setCCDBpath(zorroGroup.ccdbPathSoftwareTrigger);
zorro.setBCtolerance(zorroGroup.bcMarginForSoftwareTrigger); // this does nothing.
zorro.initCCDB(ccdb.service, collision.runNumber(), collision.timestamp(), zorroGroup.cfg_swt_name.value);
mToIidx = zorro.initCCDB(ccdb.service, collision.runNumber(), collision.timestamp(), zorroGroup.cfg_swt_name.value)[0];
zorro.populateHistRegistry(fRegistry, collision.runNumber());

uint64_t nInspectedTVX = zorro.getInspectedTVX()->GetBinContent(1);
Expand All @@ -499,8 +508,8 @@
LOGF(info, "run number %d: total inspected TVX events = %llu, scalers = %llu, selections = %llu", collision.runNumber(), nInspectedTVX, nScalers, nSelections);

fRegistry.fill(HIST("Event/trigger/hInspectedTVX"), collision.runNumber(), nInspectedTVX);
fRegistry.fill(HIST("Event/trigger/hScalers"), collision.runNumber(), nScalers);
fRegistry.fill(HIST("Event/trigger/hSelections"), collision.runNumber(), nSelections);
fRegistry.fill(HIST("Event/trigger/hScaler"), collision.runNumber(), nScalers);
fRegistry.fill(HIST("Event/trigger/hSelection"), collision.runNumber(), nSelections);
}

mRunNumber = collision.runNumber();
Expand Down Expand Up @@ -1234,6 +1243,23 @@
if (!zorro.isSelected(collision.globalBC(), zorroGroup.bcMarginForSoftwareTrigger)) { // triggered event
continue;
}

auto swt_bitset = zorro.getLastResult(); // this has to be called after zorro::isSelected
auto TOIcounter = zorro.getTOIcounters()[0]; // this has to be called after zorro::isSelected
auto ATcounter = zorro.getATcounters()[mToIidx]; // this has to be called after zorro::isSelected

if (swt_bitset.test(mToIidx)) {
while (ATcounter > mATCounter) {
mATCounter++;
fRegistry.fill(HIST("Event/trigger/hAnalysedTrigger"), collision.runNumber());
}

while (TOIcounter > mTOICounter) {
fRegistry.fill(HIST("Event/trigger/hAnalysedToI"), collision.runNumber());
mTOICounter++; // always incremented by 1 in zorro!!
}
// LOGF(info, "collision.globalIndex() = %d, collision.globalBC() = %llu, mTOICounter = %d, mATcounter = %d", collision.globalIndex(), collision.globalBC(), mTOICounter, mATCounter);
}
}

if (nmod == 2) {
Expand Down
46 changes: 36 additions & 10 deletions PWGEM/Dilepton/Core/SingleTrackQC.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,16 @@ struct SingleTrackQC {
Configurable<uint64_t> bcMarginForSoftwareTrigger{"bcMarginForSoftwareTrigger", 100, "Number of BCs of margin for software triggers"};
} zorroGroup;

Zorro zorro;
int mToIidx = 0;
int mTOICounter = 0;
int mATCounter = 0;

o2::aod::rctsel::RCTFlagsChecker rctChecker;
o2::ccdb::CcdbApi ccdbApi;
// o2::ccdb::CcdbApi ccdbApi;
Service<o2::ccdb::BasicCCDBManager> ccdb;
Zorro zorro;
int mRunNumber = 0;
float d_bz = 0;

HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; // 1 HistogramRegistry can keep up to 512 histograms
static constexpr std::string_view event_cut_types[2] = {"before/", "after/"};
Expand Down Expand Up @@ -318,8 +324,6 @@ struct SingleTrackQC {
}
}

int mRunNumber;
float d_bz;
void init(InitContext&)
{
ccdb->setURL(ccdburl);
Expand All @@ -334,12 +338,17 @@ struct SingleTrackQC {
addhistograms();
mRunNumber = 0;
d_bz = 0;
mToIidx = 0;
mTOICounter = 0;
mATCounter = 0;

if (doprocessQC_TriggeredData) {
LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", zorroGroup.cfg_swt_name.value.data());
fRegistry.add("Event/trigger/hInspectedTVX", "inspected TVX;run number;N_{TVX}", kTProfile, {{100000, 500000.5, 600000.5}}, true); // extend X range in Run 4/5
fRegistry.add("Event/trigger/hScalers", "trigger counter before DS;run number;counter", kTProfile, {{100000, 500000.5, 600000.5}}, true); // extend X range in Run 4/5
fRegistry.add("Event/trigger/hSelections", "trigger counter after DS;run number;counter", kTProfile, {{100000, 500000.5, 600000.5}}, true); // extend X range in Run 4/5
fRegistry.add("Event/trigger/hInspectedTVX", "inspected TVX;run number;N_{TVX}", kTProfile, {{100000, 500000.5, 600000.5}}, true); // extend X range in Run 4/5
fRegistry.add("Event/trigger/hScaler", "trigger counter before DS;run number;counter", kTProfile, {{100000, 500000.5, 600000.5}}, true); // extend X range in Run 4/5
fRegistry.add("Event/trigger/hSelection", "trigger counter after DS;run number;counter", kTProfile, {{100000, 500000.5, 600000.5}}, true); // extend X range in Run 4/5
fRegistry.add("Event/trigger/hAnalysedTrigger", Form("analysed trigger %s;run number;counter", zorroGroup.cfg_swt_name.value.data()), kTH1D, {{100000, 500000.5, 600000.5}}, true); // extend X range in Run 4/5
fRegistry.add("Event/trigger/hAnalysedToI", Form("analysed ToI %s;run number;counter", zorroGroup.cfg_swt_name.value.data()), kTH1D, {{100000, 500000.5, 600000.5}}, true); // extend X range in Run 4/5
}

if (doprocessNorm) {
Expand Down Expand Up @@ -401,7 +410,7 @@ struct SingleTrackQC {
if constexpr (isTriggerAnalysis) {
zorro.setCCDBpath(zorroGroup.ccdbPathSoftwareTrigger);
zorro.setBCtolerance(zorroGroup.bcMarginForSoftwareTrigger); // this does nothing.
zorro.initCCDB(ccdb.service, collision.runNumber(), collision.timestamp(), zorroGroup.cfg_swt_name.value);
mToIidx = zorro.initCCDB(ccdb.service, collision.runNumber(), collision.timestamp(), zorroGroup.cfg_swt_name.value)[0];
zorro.populateHistRegistry(fRegistry, collision.runNumber());

uint64_t nInspectedTVX = zorro.getInspectedTVX()->GetBinContent(1);
Expand All @@ -410,8 +419,8 @@ struct SingleTrackQC {
LOGF(info, "run number %d: total inspected TVX events = %llu, scalers = %llu, selections = %llu", collision.runNumber(), nInspectedTVX, nScalers, nSelections);

fRegistry.fill(HIST("Event/trigger/hInspectedTVX"), collision.runNumber(), nInspectedTVX);
fRegistry.fill(HIST("Event/trigger/hScalers"), collision.runNumber(), nScalers);
fRegistry.fill(HIST("Event/trigger/hSelections"), collision.runNumber(), nSelections);
fRegistry.fill(HIST("Event/trigger/hScaler"), collision.runNumber(), nScalers);
fRegistry.fill(HIST("Event/trigger/hSelection"), collision.runNumber(), nSelections);
}
}

Expand Down Expand Up @@ -714,6 +723,23 @@ struct SingleTrackQC {
if (!zorro.isSelected(collision.globalBC(), zorroGroup.bcMarginForSoftwareTrigger)) { // triggered event
continue;
}

auto swt_bitset = zorro.getLastResult(); // this has to be called after zorro::isSelected
auto TOIcounter = zorro.getTOIcounters()[0]; // this has to be called after zorro::isSelected
auto ATcounter = zorro.getATcounters()[mToIidx]; // this has to be called after zorro::isSelected

if (swt_bitset.test(mToIidx)) {
while (ATcounter > mATCounter) {
mATCounter++;
fRegistry.fill(HIST("Event/trigger/hAnalysedTrigger"), collision.runNumber());
}

while (TOIcounter > mTOICounter) {
fRegistry.fill(HIST("Event/trigger/hAnalysedToI"), collision.runNumber());
mTOICounter++; // always incremented by 1 in zorro!!
}
// LOGF(info, "collision.globalIndex() = %d, collision.globalBC() = %llu, mTOICounter = %d, mATcounter = %d", collision.globalIndex(), collision.globalBC(), mTOICounter, mATCounter);
}
}

o2::aod::pwgem::dilepton::utils::eventhistogram::fillEventInfo<1, -1>(&fRegistry, collision);
Expand Down
Loading