Skip to content

Commit f0f939a

Browse files
committed
PWGEM/Dilepton: fix trigger counters
1 parent a455cf5 commit f0f939a

File tree

7 files changed

+59
-38
lines changed

7 files changed

+59
-38
lines changed

PWGEM/Dilepton/Core/Dilepton.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,7 @@ struct Dilepton {
15451545
PROCESS_SWITCH(Dilepton, processAnalysis, "run dilepton analysis", true);
15461546

15471547
using FilteredMyCollisionsWithSWT = soa::Filtered<MyCollisionsWithSWT>;
1548-
void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerCounters const& counters, Types const&... args)
1548+
void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerATCounters const& countersAT, aod::EMSWTriggerTOICounters const& countersTOI, Types const&... args)
15491549
{
15501550
if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) {
15511551
auto electrons = std::get<0>(std::tie(args...));
@@ -1565,10 +1565,12 @@ struct Dilepton {
15651565

15661566
// for nomalization
15671567
int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(cfg_swt_name.value);
1568-
for (const auto& counter : counters) {
1568+
for (const auto& counter : countersAT) {
15691569
if (counter.isAnalyzed_bit(emswtId)) {
15701570
fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 0);
15711571
}
1572+
}
1573+
for (const auto& counter : countersTOI) {
15721574
if (counter.isAnalyzedToI_bit(emswtId)) {
15731575
fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 1);
15741576
}

PWGEM/Dilepton/Core/DileptonHadronMPC.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,7 +1442,7 @@ struct DileptonHadronMPC {
14421442
PROCESS_SWITCH(DileptonHadronMPC, processAnalysis, "run dilepton analysis", true);
14431443

14441444
using FilteredMyCollisionsWithSWT = soa::Filtered<MyCollisionsWithSWT>;
1445-
void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, FilteredRefTracks const& refTracks, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerCounters const& counters, Types const&... args)
1445+
void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, FilteredRefTracks const& refTracks, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerATCounters const& countersAT, aod::EMSWTriggerTOICounters const& countersTOI, Types const&... args)
14461446
{
14471447
if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) {
14481448
auto electrons = std::get<0>(std::tie(args...));
@@ -1462,10 +1462,12 @@ struct DileptonHadronMPC {
14621462

14631463
// for nomalization
14641464
int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(cfg_swt_name.value);
1465-
for (const auto& counter : counters) {
1465+
for (const auto& counter : countersAT) {
14661466
if (counter.isAnalyzed_bit(emswtId)) {
14671467
fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 0);
14681468
}
1469+
}
1470+
for (const auto& counter : countersTOI) {
14691471
if (counter.isAnalyzedToI_bit(emswtId)) {
14701472
fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 1);
14711473
}

PWGEM/Dilepton/Core/PhotonHBT.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,7 +1459,7 @@ struct PhotonHBT {
14591459
PROCESS_SWITCH(PhotonHBT, processAnalysis, "pairing for analysis", false);
14601460

14611461
using FilteredMyCollisionsWithSWT = soa::Filtered<MyCollisionsWithSWT>;
1462-
void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerCounters const& counters, Types const&... args)
1462+
void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerATCounters const& countersAT, aod::EMSWTriggerTOICounters const& countersTOI, Types const&... args)
14631463
{
14641464
if constexpr (pairtype == ggHBTPairType::kPCMPCM) {
14651465
auto v0photons = std::get<0>(std::tie(args...));
@@ -1484,10 +1484,12 @@ struct PhotonHBT {
14841484

14851485
// for nomalization
14861486
int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(cfg_swt_name.value);
1487-
for (const auto& counter : counters) {
1487+
for (const auto& counter : countersAT) {
14881488
if (counter.isAnalyzed_bit(emswtId)) {
14891489
fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 0);
14901490
}
1491+
}
1492+
for (const auto& counter : countersTOI) {
14911493
if (counter.isAnalyzedToI_bit(emswtId)) {
14921494
fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 1);
14931495
}

PWGEM/Dilepton/Core/SingleTrackQC.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ struct SingleTrackQC {
829829
PROCESS_SWITCH(SingleTrackQC, processQC, "run single track QC", true);
830830

831831
using FilteredMyCollisionsWithSWT = soa::Filtered<MyCollisionsWithSWT>;
832-
void processQC_TriggeredData(FilteredMyCollisionsWithSWT const& collisions, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerCounters const& counters, Types const&... args)
832+
void processQC_TriggeredData(FilteredMyCollisionsWithSWT const& collisions, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerATCounters const& countersAT, aod::EMSWTriggerTOICounters const& countersTOI, Types const&... args)
833833
{
834834
if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) {
835835
auto electrons = std::get<0>(std::tie(args...));
@@ -848,10 +848,12 @@ struct SingleTrackQC {
848848

849849
// for nomalization
850850
int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(cfg_swt_name.value);
851-
for (const auto& counter : counters) {
851+
for (const auto& counter : countersAT) {
852852
if (counter.isAnalyzed_bit(emswtId)) {
853853
fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 0);
854854
}
855+
}
856+
for (const auto& counter : countersTOI) {
855857
if (counter.isAnalyzedToI_bit(emswtId)) {
856858
fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 1);
857859
}

PWGEM/Dilepton/DataModel/dileptonTables.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,17 +214,23 @@ using EMSWTriggerBit = EMSWTriggerBits::iterator;
214214
DECLARE_SOA_TABLE(EMSWTriggerInfos, "AOD", "EMSWTINFO", bc::RunNumber, emevent::NInspectedTVX, emevent::NScalars, emevent::NSelections, o2::soa::Marker<1>); //! independent table. Don't join anything.
215215
using EMSWTriggerInfo = EMSWTriggerInfos::iterator;
216216

217-
DECLARE_SOA_TABLE(EMSWTriggerCounters, "AOD", "EMSWTCOUNTER", emevent::IsAnalyzed, emevent::IsAnalyzedToI, o2::soa::Marker<1>); //! independent table. Don't join anything.
218-
using EMSWTriggerCounter = EMSWTriggerCounters::iterator;
217+
DECLARE_SOA_TABLE(EMSWTriggerATCounters, "AOD", "EMSWTAT", emevent::IsAnalyzed, o2::soa::Marker<1>); //! independent table. Don't join anything.
218+
using EMSWTriggerATCounter = EMSWTriggerATCounters::iterator;
219+
220+
DECLARE_SOA_TABLE(EMSWTriggerTOICounters, "AOD", "EMSWTTOI", emevent::IsAnalyzedToI, o2::soa::Marker<1>); //! independent table. Don't join anything.
221+
using EMSWTriggerTOICounter = EMSWTriggerTOICounters::iterator;
219222

220223
DECLARE_SOA_TABLE(EMSWTriggerBitsTMP, "AOD", "EMSWTBITTMP", emevent::SWTAliasTmp, o2::soa::Marker<2>); //! joinable to aod::Collisions
221224
using EMSWTriggerBitTMP = EMSWTriggerBitsTMP::iterator;
222225

223226
DECLARE_SOA_TABLE(EMSWTriggerInfosTMP, "AOD", "EMSWTINFOTMP", bc::RunNumber, emevent::NInspectedTVX, emevent::NScalars, emevent::NSelections, o2::soa::Marker<2>);
224227
using EMSWTriggerInfoTMP = EMSWTriggerInfosTMP::iterator;
225228

226-
DECLARE_SOA_TABLE(EMSWTriggerCountersTMP, "AOD", "EMSWTCOUNTERTMP", emevent::IsAnalyzed, emevent::IsAnalyzedToI, o2::soa::Marker<2>); //! independent table. Don't join anything.
227-
using EMSWTriggerCounterTMP = EMSWTriggerCountersTMP::iterator;
229+
DECLARE_SOA_TABLE(EMSWTriggerATCountersTMP, "AOD", "EMSWTATTMP", emevent::IsAnalyzed, o2::soa::Marker<2>); //! independent table. Don't join anything.
230+
using EMSWTriggerATCounterTMP = EMSWTriggerATCountersTMP::iterator;
231+
232+
DECLARE_SOA_TABLE(EMSWTriggerTOICountersTMP, "AOD", "EMSWTTOITMP", emevent::IsAnalyzedToI, o2::soa::Marker<2>); //! independent table. Don't join anything.
233+
using EMSWTriggerTOICounterTMP = EMSWTriggerTOICountersTMP::iterator;
228234

229235
DECLARE_SOA_TABLE(EMEventsProperty, "AOD", "EMEVENTPROP", //! joinable to EMEvents
230236
emevent::SpherocityPtWeighted, emevent::SpherocityPtUnWeighted, emevent::NtrackSpherocity);

PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ struct CreateEMEventDilepton {
6464
Produces<o2::aod::EMEventsQvec> event_qvec;
6565
Produces<o2::aod::EMSWTriggerBits> emswtbit;
6666
Produces<o2::aod::EMSWTriggerInfos> emswtinfo;
67-
Produces<o2::aod::EMSWTriggerCounters> emswtcounter;
67+
Produces<o2::aod::EMSWTriggerATCounters> emswtATcounter;
68+
Produces<o2::aod::EMSWTriggerTOICounters> emswtTOIcounter;
6869
Produces<o2::aod::EMEventNormInfos> event_norm_info;
6970

7071
enum class EMEventType : int {
@@ -211,7 +212,7 @@ struct CreateEMEventDilepton {
211212

212213
//---------- for data with swt ----------
213214

214-
void processEvent_SWT(MyCollisionsWithSWT const& collisions, MyBCs const& bcs, aod::EMSWTriggerInfosTMP const& emswtinfostmp, aod::EMSWTriggerCountersTMP const& emswtcounterstmp)
215+
void processEvent_SWT(MyCollisionsWithSWT const& collisions, MyBCs const& bcs, aod::EMSWTriggerInfosTMP const& emswtinfostmp, aod::EMSWTriggerATCountersTMP const& emswtATcounterstmp, aod::EMSWTriggerTOICountersTMP const& emswtTOIcounterstmp)
215216
{
216217
skimEvent<false, true, EMEventType::kEvent>(collisions, bcs);
217218

@@ -225,13 +226,16 @@ struct CreateEMEventDilepton {
225226
mRunNumber = info.runNumber();
226227
}
227228
}
228-
for (const auto& counter : emswtcounterstmp) {
229-
emswtcounter(counter.isAnalyzed_raw(), counter.isAnalyzedToI_raw());
229+
for (const auto& counter : emswtATcounterstmp) {
230+
emswtATcounter(counter.isAnalyzed_raw());
231+
}
232+
for (const auto& counter : emswtTOIcounterstmp) {
233+
emswtTOIcounter(counter.isAnalyzedToI_raw());
230234
}
231235
}
232236
PROCESS_SWITCH(CreateEMEventDilepton, processEvent_SWT, "process event info", false);
233237

234-
void processEvent_SWT_Cent(MyCollisionsWithSWT_Cent const& collisions, MyBCs const& bcs, aod::EMSWTriggerInfosTMP const& emswtinfostmp, aod::EMSWTriggerCountersTMP const& emswtcounterstmp)
238+
void processEvent_SWT_Cent(MyCollisionsWithSWT_Cent const& collisions, MyBCs const& bcs, aod::EMSWTriggerInfosTMP const& emswtinfostmp, aod::EMSWTriggerATCountersTMP const& emswtATcounterstmp, aod::EMSWTriggerTOICountersTMP const& emswtTOIcounterstmp)
235239
{
236240
skimEvent<false, true, EMEventType::kEvent_Cent>(collisions, bcs);
237241

@@ -245,13 +249,16 @@ struct CreateEMEventDilepton {
245249
mRunNumber = info.runNumber();
246250
}
247251
}
248-
for (const auto& counter : emswtcounterstmp) {
249-
emswtcounter(counter.isAnalyzed_raw(), counter.isAnalyzedToI_raw());
252+
for (const auto& counter : emswtATcounterstmp) {
253+
emswtATcounter(counter.isAnalyzed_raw());
254+
}
255+
for (const auto& counter : emswtTOIcounterstmp) {
256+
emswtTOIcounter(counter.isAnalyzedToI_raw());
250257
}
251258
}
252259
PROCESS_SWITCH(CreateEMEventDilepton, processEvent_SWT_Cent, "process event info", false);
253260

254-
void processEvent_SWT_Cent_Qvec(MyCollisionsWithSWT_Cent_Qvec const& collisions, MyBCs const& bcs, aod::EMSWTriggerInfosTMP const& emswtinfostmp, aod::EMSWTriggerCountersTMP const& emswtcounterstmp)
261+
void processEvent_SWT_Cent_Qvec(MyCollisionsWithSWT_Cent_Qvec const& collisions, MyBCs const& bcs, aod::EMSWTriggerInfosTMP const& emswtinfostmp, aod::EMSWTriggerATCountersTMP const& emswtATcounterstmp, aod::EMSWTriggerTOICountersTMP const& emswtTOIcounterstmp)
255262
{
256263
skimEvent<false, true, EMEventType::kEvent_Cent_Qvec>(collisions, bcs);
257264

@@ -265,8 +272,11 @@ struct CreateEMEventDilepton {
265272
mRunNumber = info.runNumber();
266273
}
267274
}
268-
for (const auto& counter : emswtcounterstmp) {
269-
emswtcounter(counter.isAnalyzed_raw(), counter.isAnalyzedToI_raw());
275+
for (const auto& counter : emswtATcounterstmp) {
276+
emswtATcounter(counter.isAnalyzed_raw());
277+
}
278+
for (const auto& counter : emswtTOIcounterstmp) {
279+
emswtTOIcounter(counter.isAnalyzedToI_raw());
270280
}
271281
}
272282
PROCESS_SWITCH(CreateEMEventDilepton, processEvent_SWT_Cent_Qvec, "process event info", false);

PWGEM/Dilepton/TableProducer/skimmerOTS.cxx

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ using namespace o2::soa;
3636
struct skimmerOTS {
3737
Produces<o2::aod::EMSWTriggerInfosTMP> swtinfo_tmp; // Join aod::Collision later.
3838
Produces<o2::aod::EMSWTriggerBitsTMP> swtbit_tmp;
39-
Produces<o2::aod::EMSWTriggerCountersTMP> swtcounter_tmp;
39+
Produces<o2::aod::EMSWTriggerATCountersTMP> swtcounterAT_tmp;
40+
Produces<o2::aod::EMSWTriggerTOICountersTMP> swtcounterTOI_tmp;
4041

4142
// CCDB options
4243
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
43-
Configurable<std::string> cfg_swt_names{"cfg_swt_names", "fHighTrackMult,fHighFt0Mult", "comma-separated software trigger names"}; // !trigger names have to be pre-registered in dileptonTable.h for bit operation!
44+
Configurable<std::string> cfg_swt_names{"cfg_swt_names", "fLMeeIMR,fLMeeHMR", "comma-separated software trigger names"}; // !trigger names have to be pre-registered in dileptonTable.h for bit operation!
4445
o2::framework::Configurable<std::string> ccdbPathSoftwareTrigger{"ccdbPathSoftwareTrigger", "EventFiltering/Zorro/", "ccdb path for ZORRO objects"};
4546
Configurable<uint64_t> bcMarginForSoftwareTrigger{"bcMarginForSoftwareTrigger", 100, "Number of BCs of margin for software triggers"};
4647

@@ -56,6 +57,7 @@ struct skimmerOTS {
5657
std::vector<int> mATCounters;
5758

5859
HistogramRegistry registry{"registry"};
60+
5961
void init(o2::framework::InitContext&)
6062
{
6163
ccdb->setURL(ccdburl);
@@ -130,14 +132,13 @@ struct skimmerOTS {
130132

131133
void process(aod::Collisions const& collisions, aod::BCsWithTimestamps const&)
132134
{
133-
134135
for (const auto& collision : collisions) {
135136
auto bc = collision.template bc_as<aod::BCsWithTimestamps>(); // don't use foundBC.
136137
initCCDB(bc);
137138

138139
uint16_t trigger_bitmap = 0;
139-
uint16_t analyzed_bitmap = 0;
140-
uint16_t analyzedToI_bitmap = 0;
140+
// uint16_t analyzed_bitmap = 0;
141+
// uint16_t analyzedToI_bitmap = 0;
141142
registry.fill(HIST("hCollisionCounter"), 1); // all
142143

143144
if (zorro.isSelected(bc.globalBC(), bcMarginForSoftwareTrigger)) { // triggered event
@@ -154,28 +155,24 @@ struct skimmerOTS {
154155
// LOGF(info, "swtname = %s is fired. swt index in original swt table = %d, swt index for EM table = %d", swtname.data(), mTOIidx[idx], o2::aod::pwgem::dilepton::swt::aliasLabels.at(swtname));
155156
registry.fill(HIST("hCollisionCounter"), idx + 2); // fired trigger
156157

157-
if (ATcounters[mTOIidx[idx]] > mATCounters[emswtId]) {
158-
analyzed_bitmap |= BIT(emswtId);
158+
// LOGF(info, "ATcounters[mTOIidx[idx]] = %d, TOIcounters[idx] = %d", ATcounters[mTOIidx[idx]], TOIcounters[idx]);
159+
160+
while (ATcounters[mTOIidx[idx]] > mATCounters[emswtId]) {
159161
mATCounters[emswtId]++;
160-
// mATCounters[emswtId] = ATcounters[mTOIidx[idx]]; // Dont' use this line. NOT always incremented by 1 in zorro!!
162+
swtcounterAT_tmp(BIT(emswtId));
161163
}
162164

163-
if (TOIcounters[idx] > mTOICounters[emswtId]) {
164-
analyzedToI_bitmap |= BIT(emswtId);
165-
mTOICounters[emswtId] = TOIcounters[idx]; // always incremented by 1 in zorro!!
165+
while (TOIcounters[idx] > mTOICounters[emswtId]) {
166+
mTOICounters[emswtId]++; // always incremented by 1 in zorro!!
167+
swtcounterTOI_tmp(BIT(emswtId));
166168
}
167169

168170
// LOGF(info, "collision.globalIndex() = %d, bc.globalBC() = %llu, mTOICounters[%d] = %d, mATcounters[%d] = %d", collision.globalIndex(), bc.globalBC(), emswtId, mTOICounters[emswtId], emswtId, mATCounters[emswtId]);
169171
}
170172
} // end of TOI loop
171173
}
172174
swtbit_tmp(trigger_bitmap);
173-
if (analyzed_bitmap > 0 || analyzedToI_bitmap > 0) { // storing 0 is useless.
174-
swtcounter_tmp(analyzed_bitmap, analyzedToI_bitmap);
175-
}
176-
177175
} // end of collision loop
178-
179176
} // end of process
180177
};
181178
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)