Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions PWGJE/DataModel/EMCALClusterDefinition.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ struct EMCALClusterDefinition {
double timeMax = 10000; // maximum time (ns)
bool doGradientCut = true; // apply gradient cut if true
double gradientCut = -1; // gradient cut
bool recalcShowerShape5x5 = false; // recalculate shower shape using 5x5 cells

// default constructor
EMCALClusterDefinition() = default;
// constructor
EMCALClusterDefinition(ClusterAlgorithm_t pAlgorithm, int pStorageID, int pSelectedCellType, std::string pName, double pSeedEnergy, double pMinCellEnergy, double pTimeMin, double pTimeMax, bool pDoGradientCut, double pGradientCut)
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)
{
algorithm = pAlgorithm;
storageID = pStorageID;
Expand All @@ -58,12 +59,13 @@ struct EMCALClusterDefinition {
timeMax = pTimeMax;
doGradientCut = pDoGradientCut;
gradientCut = pGradientCut;
recalcShowerShape5x5 = precalcShowerShape5x5;
}

// implement comparison operators for int std::string and ClusterAlgorithm_t
bool operator==(const EMCALClusterDefinition& rhs) const
{
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);
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);
}
bool operator!=(const EMCALClusterDefinition& rhs) const
{
Expand Down
23 changes: 13 additions & 10 deletions PWGJE/DataModel/EMCALClusters.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@ namespace emcalcluster

// define global cluster definitions
// New definitions should be added here!
const EMCALClusterDefinition kV3NoSplit(ClusterAlgorithm_t::kV3, 0, 1, "kV3NoSplit", 0.5, 0.1, -10000, 10000, false, 0.);
const EMCALClusterDefinition kV3NoSplitLowSeed(ClusterAlgorithm_t::kV3, 1, 1, "kV3NoSplitLowSeed", 0.3, 0.1, -10000, 10000, false, 0.);
const EMCALClusterDefinition kV3NoSplitLowerSeed(ClusterAlgorithm_t::kV3, 2, 1, "kV3NoSplitLowerSeed", 0.2, 0.1, -10000, 10000, false, 0.);
const EMCALClusterDefinition kV3Default(ClusterAlgorithm_t::kV3, 10, 1, "kV3Default", 0.5, 0.1, -10000, 10000, true, 0.03);
const EMCALClusterDefinition kV3MostSplit(ClusterAlgorithm_t::kV3, 11, 1, "kV3MostSplit", 0.5, 0.1, -10000, 10000, true, 0.);
const EMCALClusterDefinition kV3LowSeed(ClusterAlgorithm_t::kV3, 12, 1, "kV3LowSeed", 0.3, 0.1, -10000, 10000, true, 0.03);
const EMCALClusterDefinition kV3MostSplitLowSeed(ClusterAlgorithm_t::kV3, 13, 1, "kV3MostSplitLowSeed", 0.3, 0.1, -10000, 10000, true, 0.);
const EMCALClusterDefinition kV3StrictTime(ClusterAlgorithm_t::kV3, 20, 1, "kV3StrictTime", 0.5, 0.1, -500, 500, true, 0.03);
const EMCALClusterDefinition kV3StricterTime(ClusterAlgorithm_t::kV3, 21, 1, "kV3StricterTime", 0.5, 0.1, -100, 100, true, 0.03);
const EMCALClusterDefinition kV3MostStrictTime(ClusterAlgorithm_t::kV3, 22, 1, "kV3MostStrictTime", 0.5, 0.1, -50, 50, true, 0.03);
const EMCALClusterDefinition kV3NoSplit(ClusterAlgorithm_t::kV3, 0, 1, "kV3NoSplit", 0.5, 0.1, -10000, 10000, false, 0., false);
const EMCALClusterDefinition kV3NoSplitLowSeed(ClusterAlgorithm_t::kV3, 1, 1, "kV3NoSplitLowSeed", 0.3, 0.1, -10000, 10000, false, 0., false);
const EMCALClusterDefinition kV3NoSplitLowerSeed(ClusterAlgorithm_t::kV3, 2, 1, "kV3NoSplitLowerSeed", 0.2, 0.1, -10000, 10000, false, 0., false);
const EMCALClusterDefinition kV3Default(ClusterAlgorithm_t::kV3, 10, 1, "kV3Default", 0.5, 0.1, -10000, 10000, true, 0.03, false);
const EMCALClusterDefinition kV3MostSplit(ClusterAlgorithm_t::kV3, 11, 1, "kV3MostSplit", 0.5, 0.1, -10000, 10000, true, 0., false);
const EMCALClusterDefinition kV3LowSeed(ClusterAlgorithm_t::kV3, 12, 1, "kV3LowSeed", 0.3, 0.1, -10000, 10000, true, 0.03, false);
const EMCALClusterDefinition kV3MostSplitLowSeed(ClusterAlgorithm_t::kV3, 13, 1, "kV3MostSplitLowSeed", 0.3, 0.1, -10000, 10000, true, 0., false);
const EMCALClusterDefinition kV3StrictTime(ClusterAlgorithm_t::kV3, 20, 1, "kV3StrictTime", 0.5, 0.1, -500, 500, true, 0.03, false);
const EMCALClusterDefinition kV3StricterTime(ClusterAlgorithm_t::kV3, 21, 1, "kV3StricterTime", 0.5, 0.1, -100, 100, true, 0.03, false);
const EMCALClusterDefinition kV3MostStrictTime(ClusterAlgorithm_t::kV3, 22, 1, "kV3MostStrictTime", 0.5, 0.1, -50, 50, true, 0.03, false);
const EMCALClusterDefinition kV3Default5x5(ClusterAlgorithm_t::kV3, 30, 1, "kV3Default5x5", 0.5, 0.1, -10000, 10000, true, 0.03, true);

/// \brief function returns EMCALClusterDefinition for the given name
/// \param name name of the cluster definition
Expand All @@ -64,6 +65,8 @@ const EMCALClusterDefinition getClusterDefinitionFromString(const std::string& c
return kV3StricterTime;
} else if (clusterDefinitionName == "kV3MostStrictTime") {
return kV3MostStrictTime;
} else if (clusterDefinitionName == "kV3Default5x5") {
return kV3Default5x5;
} else {
throw std::invalid_argument("Cluster definition name not recognized");
}
Expand Down
3 changes: 2 additions & 1 deletion PWGJE/DataModel/GammaJetAnalysisTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace gjgamma
{
DECLARE_SOA_INDEX_COLUMN(GjEvent, gjevent); //! event index
DECLARE_SOA_COLUMN(Energy, energy, float); //! cluster energy (GeV)
DECLARE_SOA_COLUMN(Definition, definition, int); //! cluster definition, see EMCALClusterDefinition.h
DECLARE_SOA_COLUMN(Eta, eta, float); //! cluster pseudorapidity (calculated using vertex)
DECLARE_SOA_COLUMN(Phi, phi, float); //! cluster azimuthal angle (calculated using vertex)
DECLARE_SOA_COLUMN(M02, m02, float); //! shower shape long axis
Expand All @@ -58,7 +59,7 @@ DECLARE_SOA_COLUMN(TMdeltaEta, tmdeltaeta, float); //! delta
DECLARE_SOA_COLUMN(TMtrackP, tmtrackp, float); //! track momentum of closest match, -1 if no match found
} // namespace gjgamma
DECLARE_SOA_TABLE(GjGammas, "AOD", "GJGAMMA",
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)
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)
namespace gjchjet
{
DECLARE_SOA_INDEX_COLUMN(GjEvent, gjevent);
Expand Down
2 changes: 2 additions & 0 deletions PWGJE/TableProducer/emcalCorrectionTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,8 @@ struct EmcalCorrectionTask {
mAnalysisClusters.clear();
mClusterLabels.clear();
mClusterFactories.reset();
// in preparation for future O2 changes
// mClusterFactories.setClusterizerSettings(mClusterDefinitions.at(iClusterizer).minCellEnergy, mClusterDefinitions.at(iClusterizer).timeMin, mClusterDefinitions.at(iClusterizer).timeMax, mClusterDefinitions.at(iClusterizer).recalcShowerShape5x5);
if (cellLabels) {
mClusterFactories.setContainer(*emcalClusters, cellsBC, *emcalClustersInputIndices, cellLabels);
} else {
Expand Down
67 changes: 47 additions & 20 deletions PWGJE/Tasks/gammaJetTreeProducer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ using namespace o2;
using namespace o2::aod;
using namespace o2::framework;
using namespace o2::framework::expressions;
using selectedClusters = o2::soa::Filtered<o2::soa::Join<o2::aod::JClusters, o2::aod::JClusterTracks>>;
using emcClusters = o2::soa::Join<o2::aod::JClusters, o2::aod::JClusterTracks>;

#include "Framework/runDataProcessing.h"

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

int mRunNumber = 0;
int eventSelection = -1;
Expand Down Expand Up @@ -136,7 +135,16 @@ struct GammaJetTreeProducer {
return true;
}

bool isEventAccepted(const auto& collision)
int getStoredColIndex(const auto& collision)
{
int32_t storedColIndex = -1;
if (auto foundCol = collisionMapping.find(collision.globalIndex()); foundCol != collisionMapping.end()) {
storedColIndex = foundCol->second;
}
return storedColIndex;
}

bool isEventAccepted(const auto& collision, const auto& clusters)
{

if (collision.posZ() > mVertexCut) {
Expand All @@ -151,7 +159,14 @@ struct GammaJetTreeProducer {
if (!jetderiveddatautilities::eventEMCAL(collision)) {
return false;
}
return true;

// Check if event contains a cluster with energy > minClusterETrigger
for (auto cluster : clusters) {
if (cluster.energy() > minClusterETrigger) {
return true;
}
}
return false;
}

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

// WARNING: This function always has to run second in the processing chain
void processEvent(soa::Join<aod::JetCollisions, aod::BkgChargedRhos, aod::JCollisionBCs>::iterator const& collision, emcClusters const& clusters)
{
if (!isEventAccepted(collision, clusters)) {
return;
}

eventsTable(collision.multiplicity(), collision.centrality(), collision.rho(), collision.eventSel(), collision.trackOccupancyInTimeRange(), collision.alias_raw());
collisionMapping[collision.globalIndex()] = eventsTable.lastIndex();
}
PROCESS_SWITCH(GammaJetTreeProducer, processEvent, "Process event", true);

// ---------------------
// Processing functions can be safely added below this line
// ---------------------

// define cluster filter. It selects only those clusters which are of the type
// sadly passing of the string at runtime is not possible for technical region so cluster definition is
// an integer instead
Filter clusterDefinitionSelection = (o2::aod::jcluster::definition == mClusterDefinition);
PresliceUnsorted<aod::JEMCTracks> EMCTrackPerTrack = aod::jemctrack::trackId;

// Process clusters
void processClusters(soa::Join<aod::JetCollisions, aod::BkgChargedRhos, aod::JCollisionBCs>::iterator const& collision, selectedClusters const& clusters, aod::JetTracks const& tracks, aod::JEMCTracks const& emctracks)
void processClusters(soa::Join<aod::JetCollisions, aod::BkgChargedRhos, aod::JCollisionBCs>::iterator const& collision, emcClusters const& clusters, aod::JetTracks const& tracks, aod::JEMCTracks const& emctracks)
{
if (!isEventAccepted(collision)) {
// event selection
int32_t storedColIndex = getStoredColIndex(collision);
if (storedColIndex == -1)
return;
}

eventsTable(collision.multiplicity(), collision.centrality(), collision.rho(), collision.eventSel(), collision.trackOccupancyInTimeRange(), collision.alias_raw());
collisionMapping[collision.globalIndex()] = eventsTable.lastIndex();
// eventsTable(collision.multiplicity(), collision.centrality(), collision.rho(), collision.eventSel(), collision.trackOccupancyInTimeRange(), collision.alias_raw());
// collisionMapping[collision.globalIndex()] = eventsTable.lastIndex();

// loop over tracks one time for QA
runTrackQA(collision, tracks);
Expand Down Expand Up @@ -275,8 +306,7 @@ struct GammaJetTreeProducer {
break;
}
}

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);
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);
}

// dummy loop over tracks
Expand All @@ -291,9 +321,9 @@ struct GammaJetTreeProducer {
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)
{
// event selection
if (!isEventAccepted(collision)) {
int32_t storedColIndex = getStoredColIndex(collision);
if (storedColIndex == -1)
return;
}
float leadingTrackPt = 0;
ushort nconst = 0;
// loop over charged jets
Expand All @@ -310,10 +340,7 @@ struct GammaJetTreeProducer {
leadingTrackPt = constituent.pt();
}
}
int32_t storedColIndex = -1;
if (auto foundCol = collisionMapping.find(collision.globalIndex()); foundCol != collisionMapping.end()) {
storedColIndex = foundCol->second;
}

// calculate perp cone rho
double perpconerho = ch_perp_cone_rho(jet, tracks, perpConeJetR);
mHistograms.fill(HIST("chjetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi());
Expand Down