Skip to content

Commit 5138633

Browse files
committed
PWGEM/Dilepton, Trigger: update trigger analysis in LMEE
1 parent 0291c81 commit 5138633

17 files changed

+294
-147
lines changed

EventFiltering/Zorro.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ std::vector<int> Zorro::initCCDB(o2::ccdb::BasicCCDBManager* ccdb, int runNumber
202202
mTOIidx.push_back(bin);
203203
}
204204
mTOIcounts.resize(mTOIs.size(), 0);
205+
mATcounts.resize(mTOIs.size(), 0);
205206
LOGF(info, "Zorro initialized for run %d, triggers of interest:", runNumber);
206207
for (size_t i{0}; i < mTOIs.size(); ++i) {
207208
LOGF(info, ">>> %s : %i", mTOIs[i].data(), mTOIidx[i]);
@@ -266,6 +267,7 @@ bool Zorro::isSelected(uint64_t bcGlobalId, uint64_t tolerance, TH2* ToiHisto)
266267
int binY = ToiHisto->GetYaxis()->FindBin(Form("%s AnalysedTriggers", mTOIs[i].data()));
267268
ToiHisto->SetBinContent(binX, binY, mAnalysedTriggers->GetBinContent(mAnalysedTriggers->GetXaxis()->FindBin(mTOIs[i].data())));
268269
}
270+
mATcounts[i] += (mAnalysedTriggers->GetBinContent(mAnalysedTriggers->GetXaxis()->FindBin(mTOIs[i].data())) > mATcounts[i]);
269271
mTOIcounts[i] += (lastSelectedIdx != mLastSelectedIdx); /// Avoid double counting
270272
if (mAnalysedTriggersOfInterest && lastSelectedIdx != mLastSelectedIdx) {
271273
mAnalysedTriggersOfInterest->Fill(i);

EventFiltering/Zorro.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class Zorro
5959
TH1D* getInspectedTVX() const { return mInspectedTVX; }
6060
std::bitset<128> getLastResult() const { return mLastResult; }
6161
std::vector<int> getTOIcounters() const { return mTOIcounts; }
62+
std::vector<int> getATcounters() const { return mATcounts; }
6263
std::vector<bool> getTriggerOfInterestResults(uint64_t bcGlobalId, uint64_t tolerance = 100);
6364
std::vector<bool> getTriggerOfInterestResults() const;
6465
int getNTOIs() const { return mTOIs.size(); }
@@ -98,6 +99,7 @@ class Zorro
9899
std::vector<std::string> mTOIs;
99100
std::vector<int> mTOIidx;
100101
std::vector<int> mTOIcounts;
102+
std::vector<int> mATcounts;
101103
o2::ccdb::BasicCCDBManager* mCCDB = nullptr;
102104
};
103105

PWGEM/Dilepton/Core/Dilepton.h

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ using namespace o2::aod::pwgem::dilepton::utils::pairutil;
7272
using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsQvec>;
7373
using MyCollision = MyCollisions::iterator;
7474

75-
using MyCollisionsWithSWT = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsQvec, aod::EMSWTriggerInfos>;
75+
using MyCollisionsWithSWT = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsQvec, aod::EMSWTriggerBits>;
7676
using MyCollisionWithSWT = MyCollisionsWithSWT::iterator;
7777

7878
using MyElectrons = soa::Join<aod::EMPrimaryElectrons, aod::EMPrimaryElectronEMEventIds, aod::EMAmbiguousElectronSelfIds, aod::EMPrimaryElectronsPrefilterBit, aod::EMPrimaryElectronsPrefilterBitDerived>;
@@ -427,7 +427,13 @@ struct Dilepton {
427427
fRegistry.addClone("Event/before/hCollisionCounter", "Event/norm/hCollisionCounter");
428428
}
429429
if (doprocessTriggerAnalysis) {
430-
fRegistry.add("Event/hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true);
430+
LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value);
431+
fRegistry.add("NormTrigger/hInspectedTVX", "inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true);
432+
fRegistry.add("NormTrigger/hScalers", "trigger counter before DS;run number;counter", kTProfile, {{80000, 520000.5, 600000.5}}, true);
433+
fRegistry.add("NormTrigger/hSelections", "trigger counter after DS;run number;counter", kTProfile, {{80000, 520000.5, 600000.5}}, true);
434+
auto hTriggerCounter = fRegistry.add<TH2>("NormTrigger/hTriggerCounter", Form("trigger counter of %s;run number;", cfg_swt_name.value.data()), kTH2D, {{80000, 520000.5, 600000.5}, {2, -0.5, 1.5}}, false);
435+
hTriggerCounter->GetYaxis()->SetBinLabel(1, "Analyzed Trigger");
436+
hTriggerCounter->GetYaxis()->SetBinLabel(2, "Analyzed TOI");
431437
}
432438
if (doprocessBC) {
433439
auto hTVXCounter = fRegistry.add<TH1>("BC/hTVXCounter", "TVX counter", kTH1D, {{6, -0.5f, 5.5f}});
@@ -440,7 +446,7 @@ struct Dilepton {
440446
}
441447
}
442448

443-
template <bool isTriggerAnalysis, typename TCollision>
449+
template <typename TCollision>
444450
void initCCDB(TCollision const& collision)
445451
{
446452
if (mRunNumber == collision.runNumber()) {
@@ -494,12 +500,6 @@ struct Dilepton {
494500
beamP2 = std::sqrt(std::pow(beamE2, 2) - std::pow(beamM2, 2));
495501
LOGF(info, "beamZ1 = %d, beamZ2 = %d, beamA1 = %d, beamA2 = %d, beamE1 = %f (GeV), beamE2 = %f (GeV), beamM1 = %f (GeV), beamM2 = %f (GeV), beamP1 = %f (GeV), beamP2 = %f (GeV)", beamZ1, beamZ2, beamA1, beamA2, beamE1, beamE2, beamM1, beamM2, beamP1, beamP2);
496502

497-
if constexpr (isTriggerAnalysis) {
498-
LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value);
499-
LOGF(info, "total inspected TVX events = %d in run number %d", collision.nInspectedTVX(), collision.runNumber());
500-
fRegistry.fill(HIST("Event/hNInspectedTVX"), collision.runNumber(), collision.nInspectedTVX());
501-
}
502-
503503
if (cfgApplySPresolution) {
504504
auto list = ccdb->getForTimeStamp<TList>(spresoPath, collision.timestamp());
505505
h2sp_resolution = reinterpret_cast<TH2D*>(list->FindObject(spresoHistName.value.data()));
@@ -1164,7 +1164,7 @@ struct Dilepton {
11641164
void runPairing(TCollisions const& collisions, TLeptons const& posTracks, TLeptons const& negTracks, TPresilce const& perCollision, TCut const& cut, TAllTracks const& tracks)
11651165
{
11661166
for (const auto& collision : collisions) {
1167-
initCCDB<isTriggerAnalysis>(collision);
1167+
initCCDB(collision);
11681168
const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()};
11691169
float centrality = centralities[cfgCentEstimator];
11701170
if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) {
@@ -1412,7 +1412,7 @@ struct Dilepton {
14121412
passed_pairIds.reserve(posTracks.size() * negTracks.size());
14131413

14141414
for (const auto& collision : collisions) {
1415-
initCCDB<isTriggerAnalysis>(collision);
1415+
initCCDB(collision);
14161416
const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()};
14171417
if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) {
14181418
continue;
@@ -1531,8 +1531,8 @@ struct Dilepton {
15311531
}
15321532
PROCESS_SWITCH(Dilepton, processAnalysis, "run dilepton analysis", true);
15331533

1534-
// using FilteredMyCollisionsWithSWT = soa::Filtered<MyCollisionsWithSWT>;
1535-
void processTriggerAnalysis(MyCollisionsWithSWT const& collisions, Types const&... args)
1534+
using FilteredMyCollisionsWithSWT = soa::Filtered<MyCollisionsWithSWT>;
1535+
void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerCounters const& counters, Types const&... args)
15361536
{
15371537
if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) {
15381538
auto electrons = std::get<0>(std::tie(args...));
@@ -1549,6 +1549,23 @@ struct Dilepton {
15491549
}
15501550
map_weight.clear();
15511551
ndf++;
1552+
1553+
// for nomalization
1554+
int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(cfg_swt_name.value);
1555+
for (const auto& counter : counters) {
1556+
if (counter.isAnalyzed_bit(emswtId)) {
1557+
fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 0);
1558+
}
1559+
if (counter.isAnalyzedToI_bit(emswtId)) {
1560+
fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 1);
1561+
}
1562+
}
1563+
1564+
for (const auto& info : cefpinfos) {
1565+
fRegistry.fill(HIST("NormTrigger/hInspectedTVX"), info.runNumber(), info.nInspectedTVX());
1566+
fRegistry.fill(HIST("NormTrigger/hScalers"), info.runNumber(), info.nScalers()[emswtId]);
1567+
fRegistry.fill(HIST("NormTrigger/hSelections"), info.runNumber(), info.nSelections()[emswtId]);
1568+
}
15521569
}
15531570
PROCESS_SWITCH(Dilepton, processTriggerAnalysis, "run dilepton analysis on triggered data", false);
15541571

PWGEM/Dilepton/Core/DileptonHadronMPC.h

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ using namespace o2::aod::pwgem::dilepton::utils::pairutil;
7474
using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent>;
7575
using MyCollision = MyCollisions::iterator;
7676

77-
using MyCollisionsWithSWT = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMSWTriggerInfos>;
77+
using MyCollisionsWithSWT = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMSWTriggerBits>;
7878
using MyCollisionWithSWT = MyCollisionsWithSWT::iterator;
7979

8080
using MyElectrons = soa::Join<aod::EMPrimaryElectrons, aod::EMPrimaryElectronEMEventIds, aod::EMAmbiguousElectronSelfIds, aod::EMPrimaryElectronsPrefilterBit, aod::EMPrimaryElectronsPrefilterBitDerived>;
@@ -390,7 +390,13 @@ struct DileptonHadronMPC {
390390
}
391391

392392
if (doprocessTriggerAnalysis) {
393-
fRegistry.add("Event/hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true);
393+
LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value);
394+
fRegistry.add("NormTrigger/hInspectedTVX", "inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true);
395+
fRegistry.add("NormTrigger/hScalers", "trigger counter before DS;run number;counter", kTProfile, {{80000, 520000.5, 600000.5}}, true);
396+
fRegistry.add("NormTrigger/hSelections", "trigger counter after DS;run number;counter", kTProfile, {{80000, 520000.5, 600000.5}}, true);
397+
auto hTriggerCounter = fRegistry.add<TH2>("NormTrigger/hTriggerCounter", Form("trigger counter of %s;run number;", cfg_swt_name.value.data()), kTH2D, {{80000, 520000.5, 600000.5}, {2, -0.5, 1.5}}, false);
398+
hTriggerCounter->GetYaxis()->SetBinLabel(1, "Analyzed Trigger");
399+
hTriggerCounter->GetYaxis()->SetBinLabel(2, "Analyzed TOI");
394400
}
395401
}
396402

@@ -437,8 +443,8 @@ struct DileptonHadronMPC {
437443

438444
if constexpr (isTriggerAnalysis) {
439445
LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value);
440-
LOGF(info, "total inspected TVX events = %d in run number %d", collision.nInspectedTVX(), collision.runNumber());
441-
fRegistry.fill(HIST("Event/hNInspectedTVX"), collision.runNumber(), collision.nInspectedTVX());
446+
// LOGF(info, "total inspected TVX events = %d in run number %d", collision.nInspectedTVX(), collision.runNumber());
447+
// fRegistry.fill(HIST("Event/hNInspectedTVX"), collision.runNumber(), collision.nInspectedTVX());
442448
}
443449
}
444450

@@ -1431,8 +1437,8 @@ struct DileptonHadronMPC {
14311437
}
14321438
PROCESS_SWITCH(DileptonHadronMPC, processAnalysis, "run dilepton analysis", true);
14331439

1434-
// using FilteredMyCollisionsWithSWT = soa::Filtered<MyCollisionsWithSWT>;
1435-
void processTriggerAnalysis(MyCollisionsWithSWT const& collisions, FilteredRefTracks const& refTracks, Types const&... args)
1440+
using FilteredMyCollisionsWithSWT = soa::Filtered<MyCollisionsWithSWT>;
1441+
void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, FilteredRefTracks const& refTracks, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerCounters const& counters, Types const&... args)
14361442
{
14371443
if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) {
14381444
auto electrons = std::get<0>(std::tie(args...));
@@ -1449,6 +1455,23 @@ struct DileptonHadronMPC {
14491455
}
14501456
map_weight.clear();
14511457
ndf++;
1458+
1459+
// for nomalization
1460+
int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(cfg_swt_name.value);
1461+
for (const auto& counter : counters) {
1462+
if (counter.isAnalyzed_bit(emswtId)) {
1463+
fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 0);
1464+
}
1465+
if (counter.isAnalyzedToI_bit(emswtId)) {
1466+
fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 1);
1467+
}
1468+
}
1469+
1470+
for (const auto& info : cefpinfos) {
1471+
fRegistry.fill(HIST("NormTrigger/hInspectedTVX"), info.runNumber(), info.nInspectedTVX());
1472+
fRegistry.fill(HIST("NormTrigger/hScalers"), info.runNumber(), info.nScalers()[emswtId]);
1473+
fRegistry.fill(HIST("NormTrigger/hSelections"), info.runNumber(), info.nSelections()[emswtId]);
1474+
}
14521475
}
14531476
PROCESS_SWITCH(DileptonHadronMPC, processTriggerAnalysis, "run dilepton analysis on triggered data", false);
14541477

PWGEM/Dilepton/Core/PhotonHBT.h

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ using namespace o2::aod::pwgem::dilepton::core::photonhbt;
7474
using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsQvec>;
7575
using MyCollision = MyCollisions::iterator;
7676

77-
using MyCollisionsWithSWT = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsQvec, aod::EMSWTriggerInfos>;
77+
using MyCollisionsWithSWT = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsQvec, aod::EMSWTriggerBits>;
7878
using MyCollisionWithSWT = MyCollisionsWithSWT::iterator;
7979

8080
using MyV0Photons = soa::Join<aod::V0PhotonsKF, aod::V0KFEMEventIds>;
@@ -390,7 +390,13 @@ struct PhotonHBT {
390390

391391
fRegistry.add("Pair/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{10001, -0.5, 10000.5}}, true);
392392
if (doprocessTriggerAnalysis) {
393-
fRegistry.add("Event/hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true);
393+
LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value);
394+
fRegistry.add("NormTrigger/hInspectedTVX", "inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true);
395+
fRegistry.add("NormTrigger/hScalers", "trigger counter before DS;run number;counter", kTProfile, {{80000, 520000.5, 600000.5}}, true);
396+
fRegistry.add("NormTrigger/hSelections", "trigger counter after DS;run number;counter", kTProfile, {{80000, 520000.5, 600000.5}}, true);
397+
auto hTriggerCounter = fRegistry.add<TH2>("NormTrigger/hTriggerCounter", Form("trigger counter of %s;run number;", cfg_swt_name.value.data()), kTH2D, {{80000, 520000.5, 600000.5}, {2, -0.5, 1.5}}, false);
398+
hTriggerCounter->GetYaxis()->SetBinLabel(1, "Analyzed Trigger");
399+
hTriggerCounter->GetYaxis()->SetBinLabel(2, "Analyzed TOI");
394400
}
395401
}
396402

@@ -434,8 +440,8 @@ struct PhotonHBT {
434440

435441
if constexpr (isTriggerAnalysis) {
436442
LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value);
437-
LOGF(info, "total inspected TVX events = %d in run number %d", collision.nInspectedTVX(), collision.runNumber());
438-
fRegistry.fill(HIST("Event/hNInspectedTVX"), collision.runNumber(), collision.nInspectedTVX());
443+
// LOGF(info, "total inspected TVX events = %d in run number %d", collision.nInspectedTVX(), collision.runNumber());
444+
// fRegistry.fill(HIST("Event/hNInspectedTVX"), collision.runNumber(), collision.nInspectedTVX());
439445
}
440446
}
441447

@@ -1454,7 +1460,7 @@ struct PhotonHBT {
14541460
PROCESS_SWITCH(PhotonHBT, processAnalysis, "pairing for analysis", false);
14551461

14561462
using FilteredMyCollisionsWithSWT = soa::Filtered<MyCollisionsWithSWT>;
1457-
void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, Types const&... args)
1463+
void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerCounters const& counters, Types const&... args)
14581464
{
14591465
if constexpr (pairtype == ggHBTPairType::kPCMPCM) {
14601466
auto v0photons = std::get<0>(std::tie(args...));
@@ -1476,6 +1482,23 @@ struct PhotonHBT {
14761482
runPairing<true>(collisions, nullptr, nullptr, emprimaryelectrons, emprimaryelectrons, perCollision_electron, perCollision_electron, fDielectronCut, fDielectronCut);
14771483
}
14781484
ndf++;
1485+
1486+
// for nomalization
1487+
int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(cfg_swt_name.value);
1488+
for (const auto& counter : counters) {
1489+
if (counter.isAnalyzed_bit(emswtId)) {
1490+
fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 0);
1491+
}
1492+
if (counter.isAnalyzedToI_bit(emswtId)) {
1493+
fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 1);
1494+
}
1495+
}
1496+
1497+
for (const auto& info : cefpinfos) {
1498+
fRegistry.fill(HIST("NormTrigger/hInspectedTVX"), info.runNumber(), info.nInspectedTVX());
1499+
fRegistry.fill(HIST("NormTrigger/hScalers"), info.runNumber(), info.nScalers()[emswtId]);
1500+
fRegistry.fill(HIST("NormTrigger/hSelections"), info.runNumber(), info.nSelections()[emswtId]);
1501+
}
14791502
}
14801503
PROCESS_SWITCH(PhotonHBT, processTriggerAnalysis, "pairing analysis on trigger data", false);
14811504

0 commit comments

Comments
 (0)