Skip to content

Commit 85e8cac

Browse files
[PWGDQ] Apply zorro selections for DQ analyses (#7056)
* Adding code to use zorro selections for DQ analyses * Fix for table-maker-with-association --------- Co-authored-by: Lucamicheletti93 <luca.mike93@gmail.com>
1 parent fa79185 commit 85e8cac

3 files changed

Lines changed: 39 additions & 52 deletions

File tree

PWGDQ/TableProducer/tableMaker.cxx

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,7 @@ using namespace o2::framework;
6565
using namespace o2::framework::expressions;
6666
using namespace o2::aod;
6767

68-
// DQ triggers
69-
enum DQTriggers {
70-
kSingleE = 1 << 0, // 0000001
71-
kLMeeIMR = 1 << 1, // 0000010
72-
kLMeeHMR = 1 << 2, // 0000100
73-
kDiElectron = 1 << 3, // 0001000
74-
kSingleMuLow = 1 << 4, // 0010000
75-
kSingleMuHigh = 1 << 5, // 0100000
76-
kDiMuon = 1 << 6, // 1000000
77-
kNTriggersDQ
78-
};
79-
8068
Zorro zorro;
81-
std::string zorroTriggerMask[7] = {"fSingleE", "fLMeeIMR", "fLMeeHMR", "fDiElectron", "fSingleMuLow", "fSingleMuHigh", "fDiMuon"};
8269

8370
using MyBarrelTracks = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection,
8471
aod::pidTPCFullEl, aod::pidTPCFullMu, aod::pidTPCFullPi,
@@ -186,6 +173,7 @@ struct TableMaker {
186173
Configurable<bool> fIsRun2{"cfgIsRun2", false, "Whether we analyze Run-2 or Run-3 data"};
187174
Configurable<bool> fIsAmbiguous{"cfgIsAmbiguous", false, "Whether we enable QA plots for ambiguous tracks"};
188175
Configurable<bool> fConfigRunZorro{"cfgRunZorro", false, "Enable event selection with zorro [WARNING: under debug, do not enable!]"};
176+
Configurable<string> fConfigZorroTrigMask{"cfgZorroTriggerMask", "fDiMuon", "DQ Trigger masks: fSingleE,fLMeeIMR,fLMeeHMR,fDiElectron,fSingleMuLow,fSingleMuHigh,fDiMuon"};
189177
Configurable<string> fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
190178
Configurable<string> fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"};
191179
Configurable<string> fConfigCcdbPathZorro{"ccdb-path-zorro", "Users/r/rlietava/EventFiltering/OTS/", "base path to the ccdb object for zorro"};
@@ -398,7 +386,9 @@ struct TableMaker {
398386
}
399387
// Put the 8 first bits of the event filter in the last 8 bits of the tag
400388
if constexpr ((TEventFillMap & VarManager::ObjTypes::EventFilter) > 0) {
401-
tag |= (collision.eventFilter() << 56);
389+
if (!fConfigRunZorro) {
390+
tag |= (collision.eventFilter() << 56);
391+
}
402392
}
403393

404394
VarManager::ResetValues(0, VarManager::kNEventWiseVariables);
@@ -423,12 +413,10 @@ struct TableMaker {
423413
(reinterpret_cast<TH2F*>(fStatsList->At(0)))->Fill(2.0, static_cast<float>(kNaliases));
424414

425415
if (fConfigRunZorro) {
426-
for (int i = 0; i < kNTriggersDQ; ++i) {
427-
zorro.setBaseCCDBPath(fConfigCcdbPathZorro.value);
428-
zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), zorroTriggerMask[i]);
429-
if (!zorro.isSelected(bc.globalBC())) {
430-
tag |= static_cast<uint64_t>(1 << i);
431-
}
416+
zorro.setBaseCCDBPath(fConfigCcdbPathZorro.value);
417+
zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), fConfigZorroTrigMask.value);
418+
if (zorro.isSelected(bc.globalBC())) {
419+
tag |= (static_cast<uint64_t>(true) << 56); // the same bit is used for this zorro selections from ccdb
432420
}
433421
} else {
434422
if (!fEventCut->IsSelected(VarManager::fgValues)) {
@@ -848,7 +836,9 @@ struct TableMaker {
848836
}
849837
// Put the 8 first bits of the event filter in the last 8 bits of the tag
850838
if constexpr ((TEventFillMap & VarManager::ObjTypes::EventFilter) > 0) {
851-
tag |= (collision.eventFilter() << 56);
839+
if (!fConfigRunZorro) {
840+
tag |= (collision.eventFilter() << 56);
841+
}
852842
}
853843

854844
VarManager::ResetValues(0, VarManager::kNEventWiseVariables);
@@ -872,12 +862,10 @@ struct TableMaker {
872862
(reinterpret_cast<TH2F*>(fStatsList->At(0)))->Fill(2.0, static_cast<float>(kNaliases));
873863

874864
if (fConfigRunZorro) {
875-
for (int i = 0; i < kNTriggersDQ; ++i) {
876-
zorro.setBaseCCDBPath(fConfigCcdbPathZorro.value);
877-
zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), zorroTriggerMask[i]);
878-
if (!zorro.isSelected(bc.globalBC())) {
879-
tag |= static_cast<uint64_t>(1 << i);
880-
}
865+
zorro.setBaseCCDBPath(fConfigCcdbPathZorro.value);
866+
zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), fConfigZorroTrigMask.value);
867+
if (zorro.isSelected(bc.globalBC())) {
868+
tag |= (static_cast<uint64_t>(true) << 56); // the same bit is used for this zorro selections from ccdb
881869
}
882870
} else {
883871
if (!fEventCut->IsSelected(VarManager::fgValues)) {

PWGDQ/TableProducer/tableMaker_withAssoc.cxx

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,7 @@ using namespace o2::framework;
6161
using namespace o2::framework::expressions;
6262
using namespace o2::aod;
6363

64-
// DQ triggers
65-
enum DQTriggers {
66-
kSingleE = 1 << 0, // 0000001
67-
kLMeeIMR = 1 << 1, // 0000010
68-
kLMeeHMR = 1 << 2, // 0000100
69-
kDiElectron = 1 << 3, // 0001000
70-
kSingleMuLow = 1 << 4, // 0010000
71-
kSingleMuHigh = 1 << 5, // 0100000
72-
kDiMuon = 1 << 6, // 1000000
73-
kNTriggersDQ
74-
};
75-
7664
Zorro zorro;
77-
std::string zorroTriggerMask[7] = {"fSingleE", "fLMeeIMR", "fLMeeHMR", "fDiElectron", "fSingleMuLow", "fSingleMuHigh", "fDiMuon"};
7865

7966
// TODO: Since DCA depends on which collision the track is associated to, we should remove writing and subscribing to DCA tables, to optimize on CPU / memory
8067
using MyBarrelTracks = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA,
@@ -176,6 +163,7 @@ struct TableMaker {
176163
Configurable<std::string> fConfigTrackCuts{"cfgBarrelTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"};
177164
Configurable<std::string> fConfigMuonCuts{"cfgMuonCuts", "muonQualityCuts", "Comma separated list of muon cuts"};
178165
Configurable<bool> fConfigRunZorro{"cfgRunZorro", false, "Enable event selection with zorro [WARNING: under debug, do not enable!]"};
166+
Configurable<string> fConfigZorroTrigMask{"cfgZorroTriggerMask", "fDiMuon", "DQ Trigger masks: fSingleE,fLMeeIMR,fLMeeHMR,fDiElectron,fSingleMuLow,fSingleMuHigh,fDiMuon"};
179167

180168
// Steer QA output
181169
Configurable<bool> fConfigQA{"cfgQA", false, "If true, fill QA histograms"};
@@ -520,16 +508,14 @@ struct TableMaker {
520508
(reinterpret_cast<TH2D*>(fStatsList->At(0)))->Fill(2.0, static_cast<float>(o2::aod::evsel::kNsel));
521509

522510
if (fConfigRunZorro) {
523-
for (int i = 0; i < kNTriggersDQ; ++i) {
524-
zorro.setBaseCCDBPath(fConfigCcdbPathZorro.value);
525-
zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), zorroTriggerMask[i]);
526-
if (!zorro.isSelected(bc.globalBC())) {
527-
tag |= static_cast<uint64_t>(1 << i);
528-
}
511+
zorro.setBaseCCDBPath(fConfigCcdbPathZorro.value);
512+
zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), fConfigZorroTrigMask.value);
513+
if (zorro.isSelected(bc.globalBC())) {
514+
tag |= (static_cast<uint64_t>(true) << 56); // the same bit is used for this zorro selections from ccdb
529515
}
530516
} else {
531517
if (!fEventCut->IsSelected(VarManager::fgValues)) {
532-
continue;
518+
return;
533519
}
534520
}
535521

PWGDQ/Tasks/tableReader.cxx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ struct AnalysisEventSelection {
168168
Configurable<string> fConfigMixingVariables{"cfgMixingVars", "", "Mixing configs separated by a comma, default no mixing"};
169169
Configurable<string> fConfigEventCuts{"cfgEventCuts", "eventStandard", "Event selection"};
170170
Configurable<bool> fConfigQA{"cfgQA", false, "If true, fill QA histograms"};
171+
Configurable<bool> fConfigRunZorro{"cfgRunZorro", false, "Enable event selection with zorro [WARNING: under debug, do not enable!]"};
171172
Configurable<int> fConfigITSROFrameStartBorderMargin{"ITSROFrameStartBorderMargin", -1, "Number of bcs at the start of ITS RO Frame border. Take from CCDB if -1"};
172173
Configurable<int> fConfigITSROFrameEndBorderMargin{"ITSROFrameEndBorderMargin", -1, "Number of bcs at the end of ITS RO Frame border. Take from CCDB if -1"};
173174
Configurable<std::string> fConfigAddEventHistogram{"cfgAddEventHistogram", "", "Comma separated list of histograms"};
@@ -237,13 +238,25 @@ struct AnalysisEventSelection {
237238
if (fConfigQA) {
238239
fHistMan->FillHistClass("Event_BeforeCuts", VarManager::fgValues); // automatically fill all the histograms in the class Event
239240
}
240-
if (fEventCut->IsSelected(VarManager::fgValues)) {
241-
if (fConfigQA) {
242-
fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues);
241+
242+
if (!fConfigRunZorro) {
243+
if (fEventCut->IsSelected(VarManager::fgValues)) {
244+
if (fConfigQA) {
245+
fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues);
246+
}
247+
eventSel(1);
248+
} else {
249+
eventSel(0);
243250
}
244-
eventSel(1);
245251
} else {
246-
eventSel(0);
252+
if (fEventCut->IsSelected(VarManager::fgValues) && event.tag_bit(56)) { // This is the bit used for the software trigger event selections [TO BE DONE: find a more clear way to use it]
253+
if (fConfigQA) {
254+
fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues);
255+
}
256+
eventSel(1);
257+
} else {
258+
eventSel(0);
259+
}
247260
}
248261

249262
if (fMixHandler != nullptr) {

0 commit comments

Comments
 (0)