Skip to content

Commit c6147c9

Browse files
committed
[EMCAL] first implementation of zorro in emc correction task
1 parent 14b08ec commit c6147c9

File tree

1 file changed

+62
-1
lines changed

1 file changed

+62
-1
lines changed

PWGJE/TableProducer/emcalCorrectionTask.cxx

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" // for EM V0 legs
2424

2525
#include "Common/Core/RecoDecay.h"
26+
#include "Common/Core/Zorro.h"
27+
#include "Common/Core/ZorroSummary.h"
2628
#include "Common/DataModel/EventSelection.h"
2729
#include "Common/DataModel/TrackSelectionTables.h"
2830

@@ -137,7 +139,8 @@ struct EmcalCorrectionTask {
137139
Configurable<float> mcCellEnergyShift{"mcCellEnergyShift", 1., "Relative shift of the MC cell energy. 1.1 for 10% shift to higher mass, etc. Only applied to MC."};
138140
Configurable<float> mcCellEnergyResolutionBroadening{"mcCellEnergyResolutionBroadening", 0., "Relative widening of the MC cell energy resolution. 0 for no widening, 0.1 for 10% widening, etc. Only applied to MC."};
139141
Configurable<bool> applyGainCalibShift{"applyGainCalibShift", false, "Apply shift for cell gain calibration to use values before cell format change (Sept. 2023)"};
140-
142+
Configurable<bool> applySoftwareTriggerSelection{"applySoftwareTriggerSelection", false, "Apply software trigger selection"};
143+
Configurable<std::string> softwareTriggerSelection{"softwareTriggerSelection", "fGammaHighPtEMCAL,fGammaHighPtDCAL", "Default: fGammaHighPtEMCAL,fGammaHighPtDCAL"};
141144
// cross talk emulation configs
142145
EmcCrossTalkConf emcCrossTalkConf;
143146

@@ -150,6 +153,11 @@ struct EmcalCorrectionTask {
150153
// CDB service (for geometry)
151154
Service<o2::ccdb::BasicCCDBManager> mCcdbManager;
152155

156+
// Zorro for optional software trigger selection
157+
// this allows to save computation time
158+
Zorro zorro;
159+
OutputObj<ZorroSummary> zorroSummary{"zorroSummary"};
160+
153161
// Clusterizer and related
154162
// Apparently streaming these objects really doesn't work, and causes problems for setting up the workflow.
155163
// So we use unique_ptr and define them below.
@@ -224,6 +232,10 @@ struct EmcalCorrectionTask {
224232
initializeGainCalibShift();
225233
}
226234

235+
if (applySoftwareTriggerSelection) {
236+
zorroSummary.setObject(zorro.getZorroSummary());
237+
}
238+
227239
// read all the cluster definitions specified in the options
228240
if (clusterDefinitions->length()) {
229241
std::stringstream parser(clusterDefinitions.value);
@@ -370,6 +382,15 @@ struct EmcalCorrectionTask {
370382
mExtraTimeShiftRunRanges.emplace_back(559544, 559856); // PbPb 2024
371383
}
372384

385+
template <typename BCType>
386+
void initZorroCCDB(const BCType& bc)
387+
{
388+
if (applySoftwareTriggerSelection) {
389+
zorro.initCCDB(mCcdbManager.service, bc.runNumber(), bc.timestamp(), softwareTriggerSelection.value);
390+
zorro.populateHistRegistry(mHistManager, bc.runNumber());
391+
}
392+
}
393+
373394
// void process(aod::Collision const& collision, soa::Filtered<aod::Tracks> const& fullTracks, aod::Calos const& cells)
374395
// void process(aod::Collision const& collision, aod::Tracks const& tracks, aod::Calos const& cells)
375396
// void process(aod::BCs const& bcs, aod::Collision const& collision, aod::Calos const& cells)
@@ -387,6 +408,14 @@ struct EmcalCorrectionTask {
387408
for (const auto& bc : bcs) {
388409
LOG(debug) << "Next BC";
389410

411+
initZorroCCDB(bc);
412+
413+
if (applySoftwareTriggerSelection) {
414+
if (!zorro.isSelected(bc.globalBC())) {
415+
continue;
416+
}
417+
}
418+
390419
// get run number
391420
runNumber = bc.runNumber();
392421

@@ -528,6 +557,14 @@ struct EmcalCorrectionTask {
528557
for (const auto& bc : bcs) {
529558
LOG(debug) << "Next BC";
530559

560+
initZorroCCDB(bc);
561+
562+
if (applySoftwareTriggerSelection) {
563+
if (!zorro.isSelected(bc.globalBC())) {
564+
continue;
565+
}
566+
}
567+
531568
// get run number
532569
runNumber = bc.runNumber();
533570

@@ -675,6 +712,14 @@ struct EmcalCorrectionTask {
675712
// Convert aod::Calo to o2::emcal::Cell which can be used with the clusterizer.
676713
// In particular, we need to filter only EMCAL cells.
677714

715+
initZorroCCDB(bc);
716+
717+
if (applySoftwareTriggerSelection) {
718+
if (!zorro.isSelected(bc.globalBC())) {
719+
continue;
720+
}
721+
}
722+
678723
// get run number
679724
runNumber = bc.runNumber();
680725

@@ -848,6 +893,14 @@ struct EmcalCorrectionTask {
848893
// Convert aod::Calo to o2::emcal::Cell which can be used with the clusterizer.
849894
// In particular, we need to filter only EMCAL cells.
850895

896+
initZorroCCDB(bc);
897+
898+
if (applySoftwareTriggerSelection) {
899+
if (!zorro.isSelected(bc.globalBC())) {
900+
continue;
901+
}
902+
}
903+
851904
// get run number
852905
runNumber = bc.runNumber();
853906

@@ -1026,6 +1079,14 @@ struct EmcalCorrectionTask {
10261079
// Get the collisions matched to the BC using global bc index of the collision
10271080
// since we do not have event selection available here!
10281081

1082+
initZorroCCDB(bc);
1083+
1084+
if (applySoftwareTriggerSelection) {
1085+
if (!zorro.isSelected(bc.globalBC())) {
1086+
continue;
1087+
}
1088+
}
1089+
10291090
// get run number
10301091
runNumber = bc.runNumber();
10311092

0 commit comments

Comments
 (0)