Skip to content

Commit 712ed23

Browse files
[PWGJE] adding trigger capabilities and cluster definition to gammaisotree (#8728)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent ab0e9de commit 712ed23

File tree

5 files changed

+68
-33
lines changed

5 files changed

+68
-33
lines changed

PWGJE/DataModel/EMCALClusterDefinition.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ struct EMCALClusterDefinition {
4242
double timeMax = 10000; // maximum time (ns)
4343
bool doGradientCut = true; // apply gradient cut if true
4444
double gradientCut = -1; // gradient cut
45+
bool recalcShowerShape5x5 = false; // recalculate shower shape using 5x5 cells
4546

4647
// default constructor
4748
EMCALClusterDefinition() = default;
4849
// constructor
49-
EMCALClusterDefinition(ClusterAlgorithm_t pAlgorithm, int pStorageID, int pSelectedCellType, std::string pName, double pSeedEnergy, double pMinCellEnergy, double pTimeMin, double pTimeMax, bool pDoGradientCut, double pGradientCut)
50+
EMCALClusterDefinition(ClusterAlgorithm_t pAlgorithm, int pStorageID, int pSelectedCellType, std::string pName, double pSeedEnergy, double pMinCellEnergy, double pTimeMin, double pTimeMax, bool pDoGradientCut, double pGradientCut, bool precalcShowerShape5x5)
5051
{
5152
algorithm = pAlgorithm;
5253
storageID = pStorageID;
@@ -58,12 +59,13 @@ struct EMCALClusterDefinition {
5859
timeMax = pTimeMax;
5960
doGradientCut = pDoGradientCut;
6061
gradientCut = pGradientCut;
62+
recalcShowerShape5x5 = precalcShowerShape5x5;
6163
}
6264

6365
// implement comparison operators for int std::string and ClusterAlgorithm_t
6466
bool operator==(const EMCALClusterDefinition& rhs) const
6567
{
66-
return (algorithm == rhs.algorithm && storageID == rhs.storageID && name == rhs.name && seedEnergy == rhs.seedEnergy && minCellEnergy == rhs.minCellEnergy && timeMin == rhs.timeMin && timeMax == rhs.timeMax && gradientCut == rhs.gradientCut && doGradientCut == rhs.doGradientCut);
68+
return (algorithm == rhs.algorithm && storageID == rhs.storageID && name == rhs.name && seedEnergy == rhs.seedEnergy && minCellEnergy == rhs.minCellEnergy && timeMin == rhs.timeMin && timeMax == rhs.timeMax && gradientCut == rhs.gradientCut && doGradientCut == rhs.doGradientCut && recalcShowerShape5x5 == rhs.recalcShowerShape5x5);
6769
}
6870
bool operator!=(const EMCALClusterDefinition& rhs) const
6971
{

PWGJE/DataModel/EMCALClusters.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,17 @@ namespace emcalcluster
2828

2929
// define global cluster definitions
3030
// New definitions should be added here!
31-
const EMCALClusterDefinition kV3NoSplit(ClusterAlgorithm_t::kV3, 0, 1, "kV3NoSplit", 0.5, 0.1, -10000, 10000, false, 0.);
32-
const EMCALClusterDefinition kV3NoSplitLowSeed(ClusterAlgorithm_t::kV3, 1, 1, "kV3NoSplitLowSeed", 0.3, 0.1, -10000, 10000, false, 0.);
33-
const EMCALClusterDefinition kV3NoSplitLowerSeed(ClusterAlgorithm_t::kV3, 2, 1, "kV3NoSplitLowerSeed", 0.2, 0.1, -10000, 10000, false, 0.);
34-
const EMCALClusterDefinition kV3Default(ClusterAlgorithm_t::kV3, 10, 1, "kV3Default", 0.5, 0.1, -10000, 10000, true, 0.03);
35-
const EMCALClusterDefinition kV3MostSplit(ClusterAlgorithm_t::kV3, 11, 1, "kV3MostSplit", 0.5, 0.1, -10000, 10000, true, 0.);
36-
const EMCALClusterDefinition kV3LowSeed(ClusterAlgorithm_t::kV3, 12, 1, "kV3LowSeed", 0.3, 0.1, -10000, 10000, true, 0.03);
37-
const EMCALClusterDefinition kV3MostSplitLowSeed(ClusterAlgorithm_t::kV3, 13, 1, "kV3MostSplitLowSeed", 0.3, 0.1, -10000, 10000, true, 0.);
38-
const EMCALClusterDefinition kV3StrictTime(ClusterAlgorithm_t::kV3, 20, 1, "kV3StrictTime", 0.5, 0.1, -500, 500, true, 0.03);
39-
const EMCALClusterDefinition kV3StricterTime(ClusterAlgorithm_t::kV3, 21, 1, "kV3StricterTime", 0.5, 0.1, -100, 100, true, 0.03);
40-
const EMCALClusterDefinition kV3MostStrictTime(ClusterAlgorithm_t::kV3, 22, 1, "kV3MostStrictTime", 0.5, 0.1, -50, 50, true, 0.03);
31+
const EMCALClusterDefinition kV3NoSplit(ClusterAlgorithm_t::kV3, 0, 1, "kV3NoSplit", 0.5, 0.1, -10000, 10000, false, 0., false);
32+
const EMCALClusterDefinition kV3NoSplitLowSeed(ClusterAlgorithm_t::kV3, 1, 1, "kV3NoSplitLowSeed", 0.3, 0.1, -10000, 10000, false, 0., false);
33+
const EMCALClusterDefinition kV3NoSplitLowerSeed(ClusterAlgorithm_t::kV3, 2, 1, "kV3NoSplitLowerSeed", 0.2, 0.1, -10000, 10000, false, 0., false);
34+
const EMCALClusterDefinition kV3Default(ClusterAlgorithm_t::kV3, 10, 1, "kV3Default", 0.5, 0.1, -10000, 10000, true, 0.03, false);
35+
const EMCALClusterDefinition kV3MostSplit(ClusterAlgorithm_t::kV3, 11, 1, "kV3MostSplit", 0.5, 0.1, -10000, 10000, true, 0., false);
36+
const EMCALClusterDefinition kV3LowSeed(ClusterAlgorithm_t::kV3, 12, 1, "kV3LowSeed", 0.3, 0.1, -10000, 10000, true, 0.03, false);
37+
const EMCALClusterDefinition kV3MostSplitLowSeed(ClusterAlgorithm_t::kV3, 13, 1, "kV3MostSplitLowSeed", 0.3, 0.1, -10000, 10000, true, 0., false);
38+
const EMCALClusterDefinition kV3StrictTime(ClusterAlgorithm_t::kV3, 20, 1, "kV3StrictTime", 0.5, 0.1, -500, 500, true, 0.03, false);
39+
const EMCALClusterDefinition kV3StricterTime(ClusterAlgorithm_t::kV3, 21, 1, "kV3StricterTime", 0.5, 0.1, -100, 100, true, 0.03, false);
40+
const EMCALClusterDefinition kV3MostStrictTime(ClusterAlgorithm_t::kV3, 22, 1, "kV3MostStrictTime", 0.5, 0.1, -50, 50, true, 0.03, false);
41+
const EMCALClusterDefinition kV3Default5x5(ClusterAlgorithm_t::kV3, 30, 1, "kV3Default5x5", 0.5, 0.1, -10000, 10000, true, 0.03, true);
4142

4243
/// \brief function returns EMCALClusterDefinition for the given name
4344
/// \param name name of the cluster definition
@@ -64,6 +65,8 @@ const EMCALClusterDefinition getClusterDefinitionFromString(const std::string& c
6465
return kV3StricterTime;
6566
} else if (clusterDefinitionName == "kV3MostStrictTime") {
6667
return kV3MostStrictTime;
68+
} else if (clusterDefinitionName == "kV3Default5x5") {
69+
return kV3Default5x5;
6770
} else {
6871
throw std::invalid_argument("Cluster definition name not recognized");
6972
}

PWGJE/DataModel/GammaJetAnalysisTree.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ namespace gjgamma
4242
{
4343
DECLARE_SOA_INDEX_COLUMN(GjEvent, gjevent); //! event index
4444
DECLARE_SOA_COLUMN(Energy, energy, float); //! cluster energy (GeV)
45+
DECLARE_SOA_COLUMN(Definition, definition, int); //! cluster definition, see EMCALClusterDefinition.h
4546
DECLARE_SOA_COLUMN(Eta, eta, float); //! cluster pseudorapidity (calculated using vertex)
4647
DECLARE_SOA_COLUMN(Phi, phi, float); //! cluster azimuthal angle (calculated using vertex)
4748
DECLARE_SOA_COLUMN(M02, m02, float); //! shower shape long axis
@@ -58,7 +59,7 @@ DECLARE_SOA_COLUMN(TMdeltaEta, tmdeltaeta, float); //! delta
5859
DECLARE_SOA_COLUMN(TMtrackP, tmtrackp, float); //! track momentum of closest match, -1 if no match found
5960
} // namespace gjgamma
6061
DECLARE_SOA_TABLE(GjGammas, "AOD", "GJGAMMA",
61-
gjgamma::GjEventId, gjgamma::Energy, gjgamma::Eta, gjgamma::Phi, gjgamma::M02, gjgamma::M20, gjgamma::NCells, gjgamma::Time, gjgamma::IsExotic, gjgamma::DistanceToBadChannel, gjgamma::NLM, gjgamma::IsoRaw, gjgamma::PerpConeRho, gjgamma::TMdeltaPhi, gjgamma::TMdeltaEta, gjgamma::TMtrackP)
62+
gjgamma::GjEventId, gjgamma::Energy, gjgamma::Definition, gjgamma::Eta, gjgamma::Phi, gjgamma::M02, gjgamma::M20, gjgamma::NCells, gjgamma::Time, gjgamma::IsExotic, gjgamma::DistanceToBadChannel, gjgamma::NLM, gjgamma::IsoRaw, gjgamma::PerpConeRho, gjgamma::TMdeltaPhi, gjgamma::TMdeltaEta, gjgamma::TMtrackP)
6263
namespace gjchjet
6364
{
6465
DECLARE_SOA_INDEX_COLUMN(GjEvent, gjevent);

PWGJE/TableProducer/emcalCorrectionTask.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,8 @@ struct EmcalCorrectionTask {
567567
mAnalysisClusters.clear();
568568
mClusterLabels.clear();
569569
mClusterFactories.reset();
570+
// in preparation for future O2 changes
571+
// mClusterFactories.setClusterizerSettings(mClusterDefinitions.at(iClusterizer).minCellEnergy, mClusterDefinitions.at(iClusterizer).timeMin, mClusterDefinitions.at(iClusterizer).timeMax, mClusterDefinitions.at(iClusterizer).recalcShowerShape5x5);
570572
if (cellLabels) {
571573
mClusterFactories.setContainer(*emcalClusters, cellsBC, *emcalClustersInputIndices, cellLabels);
572574
} else {

PWGJE/Tasks/gammaJetTreeProducer.cxx

Lines changed: 47 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ using namespace o2;
5353
using namespace o2::aod;
5454
using namespace o2::framework;
5555
using namespace o2::framework::expressions;
56-
using selectedClusters = o2::soa::Filtered<o2::soa::Join<o2::aod::JClusters, o2::aod::JClusterTracks>>;
56+
using emcClusters = o2::soa::Join<o2::aod::JClusters, o2::aod::JClusterTracks>;
5757

5858
#include "Framework/runDataProcessing.h"
5959

@@ -82,8 +82,7 @@ struct GammaJetTreeProducer {
8282
Configurable<float> isoR{"isoR", 0.4, "isolation cone radius"};
8383
Configurable<float> perpConeJetR{"perpConeJetR", 0.4, "perpendicular cone radius used to calculate perp cone rho for jet"};
8484
Configurable<float> trackMatchingEoverP{"trackMatchingEoverP", 2.0, "closest track is required to have E/p < value"};
85-
// cluster cuts
86-
Configurable<int> mClusterDefinition{"clusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"};
85+
Configurable<float> minClusterETrigger{"minClusterETrigger", 0.0, "minimum cluster energy to trigger"};
8786

8887
int mRunNumber = 0;
8988
int eventSelection = -1;
@@ -136,7 +135,16 @@ struct GammaJetTreeProducer {
136135
return true;
137136
}
138137

139-
bool isEventAccepted(const auto& collision)
138+
int getStoredColIndex(const auto& collision)
139+
{
140+
int32_t storedColIndex = -1;
141+
if (auto foundCol = collisionMapping.find(collision.globalIndex()); foundCol != collisionMapping.end()) {
142+
storedColIndex = foundCol->second;
143+
}
144+
return storedColIndex;
145+
}
146+
147+
bool isEventAccepted(const auto& collision, const auto& clusters)
140148
{
141149

142150
if (collision.posZ() > mVertexCut) {
@@ -151,7 +159,14 @@ struct GammaJetTreeProducer {
151159
if (!jetderiveddatautilities::eventEMCAL(collision)) {
152160
return false;
153161
}
154-
return true;
162+
163+
// Check if event contains a cluster with energy > minClusterETrigger
164+
for (auto cluster : clusters) {
165+
if (cluster.energy() > minClusterETrigger) {
166+
return true;
167+
}
168+
}
169+
return false;
155170
}
156171

157172
double ch_iso_in_cone(const auto& cluster, aod::JetTracks const& tracks, float radius = 0.4)
@@ -217,27 +232,43 @@ struct GammaJetTreeProducer {
217232
// ---------------------
218233
// Processing functions
219234
// ---------------------
235+
// WARNING: This function always has to run first in the processing chain
220236
void processClearMaps(aod::JetCollisions const&)
221237
{
222238
collisionMapping.clear();
223239
}
224240
PROCESS_SWITCH(GammaJetTreeProducer, processClearMaps, "process function that clears all the maps in each dataframe", true);
225241

242+
// WARNING: This function always has to run second in the processing chain
243+
void processEvent(soa::Join<aod::JetCollisions, aod::BkgChargedRhos, aod::JCollisionBCs>::iterator const& collision, emcClusters const& clusters)
244+
{
245+
if (!isEventAccepted(collision, clusters)) {
246+
return;
247+
}
248+
249+
eventsTable(collision.multiplicity(), collision.centrality(), collision.rho(), collision.eventSel(), collision.trackOccupancyInTimeRange(), collision.alias_raw());
250+
collisionMapping[collision.globalIndex()] = eventsTable.lastIndex();
251+
}
252+
PROCESS_SWITCH(GammaJetTreeProducer, processEvent, "Process event", true);
253+
254+
// ---------------------
255+
// Processing functions can be safely added below this line
256+
// ---------------------
257+
226258
// define cluster filter. It selects only those clusters which are of the type
227259
// sadly passing of the string at runtime is not possible for technical region so cluster definition is
228260
// an integer instead
229-
Filter clusterDefinitionSelection = (o2::aod::jcluster::definition == mClusterDefinition);
230261
PresliceUnsorted<aod::JEMCTracks> EMCTrackPerTrack = aod::jemctrack::trackId;
231-
232262
// Process clusters
233-
void processClusters(soa::Join<aod::JetCollisions, aod::BkgChargedRhos, aod::JCollisionBCs>::iterator const& collision, selectedClusters const& clusters, aod::JetTracks const& tracks, aod::JEMCTracks const& emctracks)
263+
void processClusters(soa::Join<aod::JetCollisions, aod::BkgChargedRhos, aod::JCollisionBCs>::iterator const& collision, emcClusters const& clusters, aod::JetTracks const& tracks, aod::JEMCTracks const& emctracks)
234264
{
235-
if (!isEventAccepted(collision)) {
265+
// event selection
266+
int32_t storedColIndex = getStoredColIndex(collision);
267+
if (storedColIndex == -1)
236268
return;
237-
}
238269

239-
eventsTable(collision.multiplicity(), collision.centrality(), collision.rho(), collision.eventSel(), collision.trackOccupancyInTimeRange(), collision.alias_raw());
240-
collisionMapping[collision.globalIndex()] = eventsTable.lastIndex();
270+
// eventsTable(collision.multiplicity(), collision.centrality(), collision.rho(), collision.eventSel(), collision.trackOccupancyInTimeRange(), collision.alias_raw());
271+
// collisionMapping[collision.globalIndex()] = eventsTable.lastIndex();
241272

242273
// loop over tracks one time for QA
243274
runTrackQA(collision, tracks);
@@ -275,8 +306,7 @@ struct GammaJetTreeProducer {
275306
break;
276307
}
277308
}
278-
279-
gammasTable(eventsTable.lastIndex(), cluster.energy(), cluster.eta(), cluster.phi(), cluster.m02(), cluster.m20(), cluster.nCells(), cluster.time(), cluster.isExotic(), cluster.distanceToBadChannel(), cluster.nlm(), isoraw, perpconerho, dPhi, dEta, p);
309+
gammasTable(storedColIndex, cluster.energy(), cluster.definition(), cluster.eta(), cluster.phi(), cluster.m02(), cluster.m20(), cluster.nCells(), cluster.time(), cluster.isExotic(), cluster.distanceToBadChannel(), cluster.nlm(), isoraw, perpconerho, dPhi, dEta, p);
280310
}
281311

282312
// dummy loop over tracks
@@ -291,9 +321,9 @@ struct GammaJetTreeProducer {
291321
void processChargedJets(soa::Join<aod::JetCollisions, aod::BkgChargedRhos, aod::JCollisionBCs>::iterator const& collision, soa::Filtered<soa::Join<aod::ChargedJets, aod::ChargedJetConstituents>> const& chargedJets, aod::JetTracks const& tracks)
292322
{
293323
// event selection
294-
if (!isEventAccepted(collision)) {
324+
int32_t storedColIndex = getStoredColIndex(collision);
325+
if (storedColIndex == -1)
295326
return;
296-
}
297327
float leadingTrackPt = 0;
298328
ushort nconst = 0;
299329
// loop over charged jets
@@ -310,10 +340,7 @@ struct GammaJetTreeProducer {
310340
leadingTrackPt = constituent.pt();
311341
}
312342
}
313-
int32_t storedColIndex = -1;
314-
if (auto foundCol = collisionMapping.find(collision.globalIndex()); foundCol != collisionMapping.end()) {
315-
storedColIndex = foundCol->second;
316-
}
343+
317344
// calculate perp cone rho
318345
double perpconerho = ch_perp_cone_rho(jet, tracks, perpConeJetR);
319346
mHistograms.fill(HIST("chjetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi());

0 commit comments

Comments
 (0)