Skip to content

Commit bc0f1da

Browse files
committed
added software trigger
1 parent 9c426e1 commit bc0f1da

File tree

2 files changed

+77
-1
lines changed

2 files changed

+77
-1
lines changed

PWGHF/HFL/Tasks/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
o2physics_add_dpl_workflow(task-electron-weak-boson
1313
SOURCES taskElectronWeakBoson.cxx
14-
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
14+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils
1515
COMPONENT_NAME Analysis)
1616

1717
o2physics_add_dpl_workflow(task-muon-charm-beauty-separation

PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
#include "PWGJE/DataModel/EMCALClusters.h"
3434
#include "PWGHF/Core/HfHelper.h"
3535

36+
// include Zorro
37+
#include "EventFiltering/Zorro.h"
38+
#include "CCDB/BasicCCDBManager.h"
39+
3640
using namespace o2;
3741
using namespace o2::framework;
3842
using namespace o2::framework::expressions;
@@ -76,6 +80,18 @@ struct HfTaskElectronWeakBoson {
7680
Configurable<float> energyIsolationMax{"energyIsolationMax", 0.1, "isolation cut on energy"};
7781
Configurable<int> trackIsolationMax{"trackIsolationMax", 3, "Maximum number of tracks in isolation cone"};
7882

83+
// Skimmed dataset processing configurations
84+
Configurable<bool> cfgSkimmedProcessing{"cfgSkimmedProcessing", true, "Enables processing of skimmed datasets"};
85+
Configurable<std::string> cfgTriggerName{"cfgTriggerName", "fGammaHighPtEMCAL", "Trigger of interest (comma separated for multiple)"};
86+
87+
// Zorro objects for skimmed data processing
88+
Zorro zorro;
89+
OutputObj<ZorroSummary> zorroSummary{"zorroSummary"};
90+
91+
// CCDB service object
92+
Configurable<std::string> cfgCCDBPath{"cfgCCDBPath", "Users/m/mpuccio/EventFiltering/OTS/", "Path to CCDB for trigger data"};
93+
Service<o2::ccdb::BasicCCDBManager> ccdb;
94+
7995
struct HfElectronCandidate {
8096
float pt, eta, phi, energy;
8197
int charge;
@@ -114,6 +130,17 @@ struct HfTaskElectronWeakBoson {
114130

115131
void init(InitContext const&)
116132
{
133+
// Configure CCDB
134+
ccdb->setURL("http://alice-ccdb.cern.ch");
135+
ccdb->setCaching(true);
136+
ccdb->setLocalObjectValidityChecking();
137+
// CCDB path for debug
138+
LOGF(info, "CCDB path for Zorro: %s", cfgCCDBPath.value.c_str());
139+
140+
// Setup Zorro Summary
141+
if (cfgSkimmedProcessing) {
142+
zorroSummary.setObject(zorro.getZorroSummary());
143+
}
117144

118145
// define axes you want to use
119146
const AxisSpec axisZvtx{400, -20, 20, "Zvtx"};
@@ -135,9 +162,11 @@ struct HfTaskElectronWeakBoson {
135162
const AxisSpec axisIsoTrack{20, -0.5, 19.5, "Isolation Track"};
136163
const AxisSpec axisInvMassZ{200, 0, 200, "M_{ee} (GeV/c^{2})"};
137164
const AxisSpec axisInvMassDy{200, 0, 2, "M_{ee} (GeV/c^{2})"};
165+
const AxisSpec axisTrigger{3, 0, 2, "Trigger status of zorro"};
138166

139167
// create registrygrams
140168
registry.add("hZvtx", "Z vertex", kTH1F, {axisZvtx});
169+
registry.add("hEventCounterInit", "hEventCounterInit", kTH1F, {axisCounter});
141170
registry.add("hEventCounter", "hEventCounter", kTH1F, {axisCounter});
142171
registry.add("hITSchi2", "ITS #chi^{2}", kTH1F, {axisChi2});
143172
registry.add("hTPCchi2", "TPC #chi^{2}", kTH1F, {axisChi2});
@@ -163,6 +192,9 @@ struct HfTaskElectronWeakBoson {
163192
registry.add("hIsolationTrack", "Isolation Track", kTH2F, {{axisE}, {axisIsoTrack}});
164193
registry.add("hInvMassZeeLs", "invariant mass for Z LS pair", kTH2F, {{axisPt}, {axisInvMassZ}});
165194
registry.add("hInvMassZeeUls", "invariant mass for Z ULS pair", kTH2F, {{axisPt}, {axisInvMassZ}});
195+
196+
// hisotgram for EMCal trigger
197+
registry.add("hEMCalTrigger", "EMCal trigger", kTH1F, {axisTrigger});
166198
}
167199
bool isIsolatedCluster(const o2::aod::EMCALCluster& cluster,
168200
const SelectedClusters& clusters)
@@ -226,10 +258,54 @@ struct HfTaskElectronWeakBoson {
226258
}
227259

228260
void process(soa::Filtered<aod::Collisions>::iterator const& collision,
261+
aod::BCsWithTimestamps const&,
229262
SelectedClusters const& emcClusters,
230263
TrackEle const& tracks,
231264
o2::aod::EMCALMatchedTracks const& matchedtracks)
232265
{
266+
registry.fill(HIST("hEventCounterInit"), 0.5);
267+
268+
// Get BC for this collision
269+
auto bc = collision.bc_as<aod::BCsWithTimestamps>();
270+
uint64_t globalBC = bc.globalBC();
271+
int runNumber = bc.runNumber();
272+
273+
// Initialize Zorro for the first event (once per run)
274+
static bool isFirstEvent = true;
275+
static int lastRunNumber = -1;
276+
277+
if ((isFirstEvent || runNumber != lastRunNumber) && cfgSkimmedProcessing) {
278+
LOGF(info, "Initializing Zorro for run %d", runNumber);
279+
uint64_t currentTimestamp = bc.timestamp();
280+
281+
// add configurable for CCDB path
282+
zorro.setBaseCCDBPath(cfgCCDBPath.value);
283+
284+
// debug for timestamp
285+
LOGF(info, "Using CCDB path: %s, timestamp: %llu", cfgCCDBPath.value.c_str(), currentTimestamp);
286+
287+
// initialize Zorro
288+
zorro.initCCDB(ccdb.service, runNumber, currentTimestamp, cfgTriggerName);
289+
isFirstEvent = false;
290+
lastRunNumber = runNumber;
291+
}
292+
293+
// Check if this is a triggered event using Zorro
294+
bool isTriggered = true;
295+
if (cfgSkimmedProcessing) {
296+
isTriggered = zorro.isSelected(globalBC);
297+
registry.fill(HIST("hEMCalTrigger"), isTriggered ? 1 : 0);
298+
299+
// Skip event if not triggered and we're processing skimmed data
300+
if (!isTriggered && cfgSkimmedProcessing) {
301+
return;
302+
}
303+
}
304+
305+
// initialze for inclusive-electron
306+
selectedElectronsIso.clear();
307+
selectedElectronsAss.clear();
308+
233309
registry.fill(HIST("hEventCounter"), 0.5);
234310

235311
// LOGF(info, "Collision index : %d", collision.index());

0 commit comments

Comments
 (0)