Skip to content

Commit 37b20de

Browse files
authored
[PWGJE] adding ability to do jet finding over multiple cluster definitions an… (#14961)
1 parent 486ee81 commit 37b20de

File tree

5 files changed

+166
-159
lines changed

5 files changed

+166
-159
lines changed

PWGJE/Core/JetDerivedDataUtilities.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#ifndef PWGJE_CORE_JETDERIVEDDATAUTILITIES_H_
1818
#define PWGJE_CORE_JETDERIVEDDATAUTILITIES_H_
1919

20+
#include "PWGJE/DataModel/EMCALClusters.h"
2021
#include "PWGUD/Core/SGSelector.h"
2122

2223
#include "Common/CCDB/EventSelectionParams.h"
@@ -708,6 +709,25 @@ bool selectTrackDcaZ(T const& track, double dcaZmax = 99.)
708709
return std::abs(track.dcaZ()) < dcaZmax;
709710
}
710711

712+
std::vector<int> initialiseClusterDefinitions(const std::string clusterDefinitions)
713+
{
714+
std::vector<int> clusterDefinitionsVec;
715+
if (clusterDefinitions.empty()) {
716+
return clusterDefinitionsVec;
717+
}
718+
size_t start = 0;
719+
size_t end;
720+
while ((end = clusterDefinitions.find(',', start)) != std::string::npos) {
721+
clusterDefinitionsVec.push_back(static_cast<int>(o2::aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitions.substr(start, end - start))));
722+
start = end + 1;
723+
}
724+
// Process the last element (after the final comma or if no comma exists)
725+
if (start < clusterDefinitions.length()) {
726+
clusterDefinitionsVec.push_back(static_cast<int>(o2::aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitions.substr(start))));
727+
}
728+
return clusterDefinitionsVec;
729+
}
730+
711731
} // namespace jetderiveddatautilities
712732

713733
#endif // PWGJE_CORE_JETDERIVEDDATAUTILITIES_H_

PWGJE/Core/JetFindingUtilities.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,13 @@ void analyseTracksMultipleCandidates(std::vector<fastjet::PseudoJet>& inputParti
156156
* @param clusters track table to be added
157157
*/
158158
template <typename T>
159-
void analyseClusters(std::vector<fastjet::PseudoJet>& inputParticles, T const& clusters, int hadronicCorrectionType = 0)
159+
void analyseClusters(std::vector<fastjet::PseudoJet>& inputParticles, T const& clusters, int clusterDefinition, int hadronicCorrectionType)
160160
{
161-
for (auto& cluster : *clusters) {
161+
for (auto const& cluster : clusters) {
162162
// add cluster selections
163+
if (cluster.definition() != clusterDefinition) {
164+
continue;
165+
}
163166
fastjetutilities::fillClusters(cluster, inputParticles, cluster.globalIndex(), hadronicCorrectionType);
164167
}
165168
}

PWGJE/JetFinders/jetFinder.h

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ struct JetFinderTask {
7676
o2::framework::Configurable<std::string> particleSelections{"particleSelections", "PhysicalPrimary", "set particle selections"};
7777

7878
// cluster level configurables
79-
o2::framework::Configurable<std::string> clusterDefinitionS{"clusterDefinition", "kV3Default", "cluster definition to be selected, e.g. V3Default"};
79+
o2::framework::Configurable<std::string> clusterDefinitions{"clusterDefinitions", "kV3Default", "cluster definition to be selected, e.g. V3Default"};
8080
o2::framework::Configurable<float> clusterEtaMin{"clusterEtaMin", -0.71, "minimum cluster eta"}; // For ECMAL: |eta| < 0.7, phi = 1.40 - 3.26
8181
o2::framework::Configurable<float> clusterEtaMax{"clusterEtaMax", 0.71, "maximum cluster eta"}; // For ECMAL: |eta| < 0.7, phi = 1.40 - 3.26
8282
o2::framework::Configurable<float> clusterPhiMin{"clusterPhiMin", 1.39, "minimum cluster phi"};
@@ -85,7 +85,7 @@ struct JetFinderTask {
8585
o2::framework::Configurable<float> clusterTimeMin{"clusterTimeMin", -25., "minimum Cluster time (ns)"};
8686
o2::framework::Configurable<float> clusterTimeMax{"clusterTimeMax", 25., "maximum Cluster time (ns)"};
8787
o2::framework::Configurable<bool> clusterRejectExotics{"clusterRejectExotics", true, "Reject exotic clusters"};
88-
o2::framework::Configurable<int> hadronicCorrectionType{"hadronicCorrectionType", 0, "0 = no correction, 1 = CorrectedOneTrack1, 2 = CorrectedOneTrack2, 3 = CorrectedAllTracks1, 4 = CorrectedAllTracks2"};
88+
o2::framework::Configurable<std::vector<int>> hadronicCorrectionTypes{"hadronicCorrectionTypes", {0}, "0 = no correction, 1 = CorrectedOneTrack1, 2 = CorrectedOneTrack2, 3 = CorrectedAllTracks1, 4 = CorrectedAllTracks2 note :analyses should only use one"};
8989
o2::framework::Configurable<bool> doEMCALEventSelection{"doEMCALEventSelection", true, "apply the selection to the event alias_bit for full and neutral jets"};
9090
o2::framework::Configurable<bool> doEMCALEventSelectionChargedJets{"doEMCALEventSelectionChargedJets", false, "apply the selection to the event alias_bit for charged jets"};
9191

@@ -119,16 +119,18 @@ struct JetFinderTask {
119119

120120
std::vector<int> triggerMaskBits;
121121

122-
o2::aod::EMCALClusterDefinition clusterDefinition;
122+
std::vector<int> clusterDefinitionsVec;
123+
std::vector<int> hadronicCorrectionTypesVec;
123124

124125
void init(o2::framework::InitContext const&)
125126
{
127+
hadronicCorrectionTypesVec = (std::vector<int>)hadronicCorrectionTypes;
126128
eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast<std::string>(eventSelections));
127129
triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(triggerMasks);
128130
trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast<std::string>(trackSelections));
129131
particleSelection = static_cast<std::string>(particleSelections);
130132

131-
clusterDefinition = o2::aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionS.value);
133+
clusterDefinitionsVec = jetderiveddatautilities::initialiseClusterDefinitions(clusterDefinitions.value);
132134

133135
jetFinder.etaMin = trackEtaMin;
134136
jetFinder.etaMax = trackEtaMax;
@@ -185,7 +187,7 @@ struct JetFinderTask {
185187
o2::framework::expressions::Filter mcCollisionFilter = (nabs(o2::aod::jmccollision::posZ) < vertexZCut);
186188
o2::framework::expressions::Filter trackCuts = (o2::aod::jtrack::pt >= trackPtMin && o2::aod::jtrack::pt < trackPtMax && o2::aod::jtrack::eta >= trackEtaMin && o2::aod::jtrack::eta <= trackEtaMax && o2::aod::jtrack::phi >= trackPhiMin && o2::aod::jtrack::phi <= trackPhiMax); // do we need eta cut both here and in globalselection?
187189
o2::framework::expressions::Filter partCuts = (o2::aod::jmcparticle::pt >= trackPtMin && o2::aod::jmcparticle::pt < trackPtMax && o2::aod::jmcparticle::eta >= trackEtaMin && o2::aod::jmcparticle::eta <= trackEtaMax && o2::aod::jmcparticle::phi >= trackPhiMin && o2::aod::jmcparticle::phi <= trackPhiMax);
188-
o2::framework::expressions::Filter clusterFilter = (o2::aod::jcluster::definition == static_cast<int>(clusterDefinition) && o2::aod::jcluster::eta >= clusterEtaMin && o2::aod::jcluster::eta <= clusterEtaMax && o2::aod::jcluster::phi >= clusterPhiMin && o2::aod::jcluster::phi <= clusterPhiMax && o2::aod::jcluster::energy >= clusterEnergyMin && o2::aod::jcluster::time > clusterTimeMin && o2::aod::jcluster::time < clusterTimeMax && (!clusterRejectExotics || o2::aod::jcluster::isExotic != true));
190+
o2::framework::expressions::Filter clusterFilter = (o2::aod::jcluster::eta >= clusterEtaMin && o2::aod::jcluster::eta <= clusterEtaMax && o2::aod::jcluster::phi >= clusterPhiMin && o2::aod::jcluster::phi <= clusterPhiMax && o2::aod::jcluster::energy >= clusterEnergyMin && o2::aod::jcluster::time > clusterTimeMin && o2::aod::jcluster::time < clusterTimeMax && (!clusterRejectExotics || o2::aod::jcluster::isExotic != true));
189191

190192
void processChargedJets(o2::soa::Filtered<o2::aod::JetCollisions>::iterator const& collision,
191193
o2::soa::Filtered<o2::aod::JetTracks> const& tracks)
@@ -219,9 +221,13 @@ struct JetFinderTask {
219221
if ((doEMCALEventSelection && !jetderiveddatautilities::eventEMCAL(collision)) || !jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents, applyRCTSelections, "CBT_calo") || !jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) {
220222
return;
221223
}
222-
inputParticles.clear();
223-
jetfindingutilities::analyseClusters(inputParticles, &clusters);
224-
jetfindingutilities::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, fillTHnSparse ? registry.get<THn>(HIST("hJet")) : std::shared_ptr<THn>(nullptr), fillTHnSparse);
224+
for (auto const& clusterDefinition : clusterDefinitionsVec) {
225+
for (auto const& hadronicCorrectionType : hadronicCorrectionTypesVec) {
226+
inputParticles.clear();
227+
jetfindingutilities::analyseClusters(inputParticles, clusters, clusterDefinition, hadronicCorrectionType);
228+
jetfindingutilities::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, fillTHnSparse ? registry.get<THn>(HIST("hJet")) : std::shared_ptr<THn>(nullptr), fillTHnSparse);
229+
}
230+
}
225231
}
226232
PROCESS_SWITCH(JetFinderTask, processNeutralJets, "Data and reco level jet finding for neutral jets", false);
227233

@@ -232,10 +238,14 @@ struct JetFinderTask {
232238
if ((doEMCALEventSelection && !jetderiveddatautilities::eventEMCAL(collision)) || !jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents, applyRCTSelections, "CBT_calo") || !jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) {
233239
return;
234240
}
235-
inputParticles.clear();
236-
jetfindingutilities::analyseTracks<o2::soa::Filtered<o2::aod::JetTracks>, o2::soa::Filtered<o2::aod::JetTracks>::iterator>(inputParticles, tracks, trackSelection);
237-
jetfindingutilities::analyseClusters(inputParticles, &clusters, hadronicCorrectionType);
238-
jetfindingutilities::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, fillTHnSparse ? registry.get<THn>(HIST("hJet")) : std::shared_ptr<THn>(nullptr), fillTHnSparse);
241+
for (auto const& clusterDefinition : clusterDefinitionsVec) {
242+
for (auto const& hadronicCorrectionType : hadronicCorrectionTypesVec) {
243+
inputParticles.clear();
244+
jetfindingutilities::analyseTracks<o2::soa::Filtered<o2::aod::JetTracks>, o2::soa::Filtered<o2::aod::JetTracks>::iterator>(inputParticles, tracks, trackSelection);
245+
jetfindingutilities::analyseClusters(inputParticles, clusters, clusterDefinition, hadronicCorrectionType);
246+
jetfindingutilities::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, fillTHnSparse ? registry.get<THn>(HIST("hJet")) : std::shared_ptr<THn>(nullptr), fillTHnSparse);
247+
}
248+
}
239249
}
240250
PROCESS_SWITCH(JetFinderTask, processFullJets, "Data and reco level jet finding for full and neutral jets", false);
241251

PWGJE/TableProducer/derivedDataWriter.cxx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ struct JetDerivedDataWriter {
5555
Configurable<float> trackEtaSelectionMax{"trackEtaSelectionMax", 0.9, "only save tracks that have an eta smaller than this eta"};
5656
Configurable<bool> savePartonLevelInfo{"savePartonLevelInfo", true, "save parton level info at MCP level"};
5757

58-
Configurable<std::string> triggerMasks{"triggerMasks", "", "possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL"};
5958
} config;
6059

6160
struct : ProducesGroup {
@@ -79,7 +78,6 @@ struct JetDerivedDataWriter {
7978
Produces<aod::StoredJMcParticles> storedJMcParticlesTable;
8079
Produces<aod::StoredJMcParticlePIs> storedJParticlesParentIndexTable;
8180
Produces<aod::StoredJClusters> storedJClustersTable;
82-
Produces<aod::StoredJClustersCorrectedEnergies> storedJClustersCorrectedEnergiesTable;
8381
Produces<aod::StoredJClusterPIs> storedJClustersParentIndexTable;
8482
Produces<aod::StoredJClusterTracks> storedJClustersMatchedTracksTable;
8583
Produces<aod::StoredJMcClusterLbs> storedJMcClustersLabelTable;
@@ -530,15 +528,14 @@ struct JetDerivedDataWriter {
530528
}
531529
PROCESS_SWITCH(JetDerivedDataWriter, processTracks, "write out output tables for tracks", true);
532530

533-
void processClusters(soa::Join<aod::JCollisions, aod::JEMCCollisionLbs, aod::JCollisionSelections>::iterator const& collision, aod::JTracks const&, aod::JEMCTracks const& emcTracks, soa::Join<aod::JClusters, aod::JClustersCorrectedEnergies, aod::JClusterPIs, aod::JClusterTracks> const& clusters)
531+
void processClusters(soa::Join<aod::JCollisions, aod::JEMCCollisionLbs, aod::JCollisionSelections>::iterator const& collision, aod::JTracks const&, aod::JEMCTracks const& emcTracks, soa::Join<aod::JClusters, aod::JClusterPIs, aod::JClusterTracks> const& clusters)
534532
{
535533
if (collision.isCollisionSelected()) {
536534
products.storedJCollisionsEMCalLabelTable(collision.isAmbiguous(), collision.isEmcalReadout());
537535
for (const auto& cluster : clusters) {
538536
products.storedJClustersTable(collisionMapping[collision.globalIndex()], cluster.id(), cluster.energy(), cluster.coreEnergy(), cluster.rawEnergy(),
539537
cluster.eta(), cluster.phi(), cluster.m02(), cluster.m20(), cluster.nCells(), cluster.time(), cluster.isExotic(), cluster.distanceToBadChannel(),
540538
cluster.nlm(), cluster.definition(), cluster.leadingCellEnergy(), cluster.subleadingCellEnergy(), cluster.leadingCellNumber(), cluster.subleadingCellNumber());
541-
products.storedJClustersCorrectedEnergiesTable(cluster.energyCorrectedOneTrack1(), cluster.energyCorrectedOneTrack2(), cluster.energyCorrectedAllTracks1(), cluster.energyCorrectedAllTracks2());
542539
products.storedJClustersParentIndexTable(cluster.clusterId());
543540

544541
std::vector<int32_t> clusterStoredJTrackIDs;

0 commit comments

Comments
 (0)