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
12 changes: 6 additions & 6 deletions PWGJE/DataModel/EMCALClusters.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ namespace emcalcluster
// define global cluster definitions
// the V1 algorithm is not yet implemented, but the V3 algorithm is
// New definitions should be added here!
const EMCALClusterDefinition kV1Default(ClusterAlgorithm_t::kV1, 0, 1, "kV1Default", 0.1, 0.5, -10000, 10000, 0.03);
const EMCALClusterDefinition kV1Variation1(ClusterAlgorithm_t::kV3, 1, 1, "kV1Variation1", 0.1, 0.3, -10000, 10000, 0.03);
const EMCALClusterDefinition kV1Variation2(ClusterAlgorithm_t::kV3, 2, 1, "kV1Variation2", 0.1, 0.2, -10000, 10000, 0.03);
const EMCALClusterDefinition kV3Default(ClusterAlgorithm_t::kV3, 10, 1, "kV3Default", 0.1, 0.5, -10000, 10000, 0.03);
const EMCALClusterDefinition kV3Variation1(ClusterAlgorithm_t::kV3, 11, 1, "kV3Variation1", 0.1, 0.3, -10000, 10000, 0.03);
const EMCALClusterDefinition kV3Variation2(ClusterAlgorithm_t::kV3, 12, 1, "kV3Variation2", 0.1, 0.2, -10000, 10000, 0.03);
const EMCALClusterDefinition kV1Default(ClusterAlgorithm_t::kV1, 0, 1, "kV1Default", 0.5, 0.1, -10000, 10000, 0.03);
const EMCALClusterDefinition kV1Variation1(ClusterAlgorithm_t::kV3, 1, 1, "kV1Variation1", 0.3, 0.1, -10000, 10000, 0.03);
const EMCALClusterDefinition kV1Variation2(ClusterAlgorithm_t::kV3, 2, 1, "kV1Variation2", 0.2, 0.1, -10000, 10000, 0.03);
const EMCALClusterDefinition kV3Default(ClusterAlgorithm_t::kV3, 10, 1, "kV3Default", 0.5, 0.1, -10000, 10000, 0.03);
const EMCALClusterDefinition kV3Variation1(ClusterAlgorithm_t::kV3, 11, 1, "kV3Variation1", 0.3, 0.1, -10000, 10000, 0.03);
const EMCALClusterDefinition kV3Variation2(ClusterAlgorithm_t::kV3, 12, 1, "kV3Variation2", 0.2, 0.1, -10000, 10000, 0.03);

/// \brief function returns EMCALClusterDefinition for the given name
/// \param name name of the cluster definition
Expand Down
8 changes: 6 additions & 2 deletions PWGJE/TableProducer/emcalCorrectionTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ struct EmcalCorrectionTask {
mClusterizers.emplace_back(std::make_unique<o2::emcal::Clusterizer<o2::emcal::Cell>>(1, clusterDefinition.timeMin, clusterDefinition.timeMax, clusterDefinition.gradientCut, true, clusterDefinition.seedEnergy, clusterDefinition.minCellEnergy));
mClusterFactories.emplace_back(std::make_unique<o2::emcal::ClusterFactory<o2::emcal::Cell>>());
LOG(info) << "Cluster definition initialized: " << clusterDefinition.toString();
LOG(info) << "timeMin: " << clusterDefinition.timeMin;
LOG(info) << "timeMax: " << clusterDefinition.timeMax;
LOG(info) << "gradientCut: " << clusterDefinition.gradientCut;
LOG(info) << "seedEnergy: " << clusterDefinition.seedEnergy;
LOG(info) << "minCellEnergy: " << clusterDefinition.minCellEnergy;
}
for (auto& clusterizer : mClusterizers) {
clusterizer->setGeometry(geometry);
Expand Down Expand Up @@ -142,7 +147,6 @@ struct EmcalCorrectionTask {
}
// LOG(debug) << "Cell E: " << cell.getEnergy();
// LOG(debug) << "Cell E: " << cell;

mEmcalCells.emplace_back(o2::emcal::Cell(
cell.cellNumber(),
cell.amplitude(),
Expand Down Expand Up @@ -187,8 +191,8 @@ struct EmcalCorrectionTask {
mClusterFactories.at(i)->setClustersContainer(*emcalClusters);
mClusterFactories.at(i)->setCellsContainer(mEmcalCells);
mClusterFactories.at(i)->setCellsIndicesContainer(*emcalClustersInputIndices);
LOG(debug) << "Cluster factory set up.";

LOG(debug) << "Cluster factory set up.";
// Convert to analysis clusters.
for (int icl = 0; icl < mClusterFactories.at(i)->getNumberOfClusters(); icl++) {
auto analysisCluster = mClusterFactories.at(i)->buildCluster(icl);
Expand Down
68 changes: 47 additions & 21 deletions PWGJE/Tasks/emcclustermonitor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ using namespace o2::framework;
using namespace o2::framework::expressions;
using collisionEvSelIt = o2::soa::Join<o2::aod::Collisions, o2::aod::EvSels>::iterator;
using selectedClusters = o2::soa::Filtered<o2::aod::EMCALClusters>;
using selectedAmbiguousClusters = o2::soa::Filtered<o2::aod::EMCALAmbiguousClusters>;
struct ClusterMonitor {
HistogramRegistry mHistManager{"ClusterMonitorHistograms"};
o2::emcal::Geometry* mGeometry = nullptr;
Expand Down Expand Up @@ -102,7 +103,7 @@ struct ClusterMonitor {
mHistManager.add("eventVertexZAll", "z-vertex of event (all events)", o2HistType::kTH1F, {{200, -20, 20}});
mHistManager.add("eventVertexZSelected", "z-vertex of event (selected events)", o2HistType::kTH1F, {{200, -20, 20}});

// cluster properties
// cluster properties (matched clusters)
mHistManager.add("clusterE", "Energy of cluster", o2HistType::kTH1F, {energyAxis});
mHistManager.add("clusterE_SimpleBinning", "Energy of cluster", o2HistType::kTH1F, {{400, 0, 100}});
mHistManager.add("clusterEtaPhi", "Eta and phi of cluster", o2HistType::kTH2F, {{100, -1, 1}, {100, 0, 2 * TMath::Pi()}});
Expand Down Expand Up @@ -135,7 +136,7 @@ struct ClusterMonitor {
}
}
/// \brief Process EMCAL clusters that are matched to a collisions
void process(collisionEvSelIt const& theCollision, selectedClusters const& clusters, o2::aod::BCs const& bcs)
void processCollisions(collisionEvSelIt const& theCollision, selectedClusters const& clusters, o2::aod::BCs const& bcs)
{
mHistManager.fill(HIST("eventsAll"), 1);

Expand All @@ -151,26 +152,14 @@ struct ClusterMonitor {
LOG(debug) << "Event not selected because of z-vertex cut z= " << theCollision.posZ() << " > " << mVertexCut << " cm, skipping";
return;
}
mHistManager.fill(HIST("eventVertexZAll"), theCollision.posZ());
if (mVertexCut > 0 && TMath::Abs(theCollision.posZ()) > mVertexCut) {
LOG(debug) << "Event not selected because of z-vertex cut z= " << theCollision.posZ() << " > " << mVertexCut << " cm, skipping";
return;
}
mHistManager.fill(HIST("eventsSelected"), 1);
mHistManager.fill(HIST("eventVertexZSelected"), theCollision.posZ());

// loop over bc , if requested (mVetoBCID >= 0), reject everything from a certain BC
// this can be used as alternative to event selection (e.g. for pilot beam data)
// TODO: remove this loop and put it in separate process function that only takes care of ambiguous clusters
for (const auto& bc : bcs) {
o2::InteractionRecord eventIR;
eventIR.setFromLong(bc.globalBC());
mHistManager.fill(HIST("eventBCAll"), eventIR.bc);
if (std::find(mVetoBCIDs.begin(), mVetoBCIDs.end(), eventIR.bc) != mVetoBCIDs.end()) {
LOG(info) << "Event rejected because of veto BCID " << eventIR.bc;
continue;
}
if (mSelectBCIDs.size() && (std::find(mSelectBCIDs.begin(), mSelectBCIDs.end(), eventIR.bc) == mSelectBCIDs.end())) {
continue;
}
mHistManager.fill(HIST("eventBCSelected"), eventIR.bc);
}

// loop over all clusters from accepted collision
// auto eventClusters = clusters.select(o2::aod::emcalcluster::bcId == theCollision.bc().globalBC());
for (const auto& cluster : clusters) {
Expand All @@ -193,6 +182,41 @@ struct ClusterMonitor {
mHistManager.fill(HIST("clusterDistanceToBadChannel"), cluster.distanceToBadChannel());
}
}
PROCESS_SWITCH(ClusterMonitor, processCollisions, "Process clusters from collision", false);

/// \brief Process EMCAL clusters that are not matched to a collision
/// This is not needed for most users

void processAmbiguous(o2::aod::BC const bc, selectedAmbiguousClusters const& clusters)
{
// loop over bc , if requested (mVetoBCID >= 0), reject everything from a certain BC
// this can be used as alternative to event selection (e.g. for pilot beam data)
// TODO: remove this loop and put it in separate process function that only takes care of ambiguous clusters
o2::InteractionRecord eventIR;
eventIR.setFromLong(bc.globalBC());
mHistManager.fill(HIST("eventBCAll"), eventIR.bc);
if (std::find(mVetoBCIDs.begin(), mVetoBCIDs.end(), eventIR.bc) != mVetoBCIDs.end()) {
LOG(info) << "Event rejected because of veto BCID " << eventIR.bc;
return;
}
if (mSelectBCIDs.size() && (std::find(mSelectBCIDs.begin(), mSelectBCIDs.end(), eventIR.bc) == mSelectBCIDs.end())) {
return;
}
mHistManager.fill(HIST("eventBCSelected"), eventIR.bc);
// loop over ambiguous clusters
for (const auto& cluster : clusters) {
mHistManager.fill(HIST("clusterE"), cluster.energy());
mHistManager.fill(HIST("clusterE_SimpleBinning"), cluster.energy());
mHistManager.fill(HIST("clusterEtaPhi"), cluster.eta(), cluster.phi());
mHistManager.fill(HIST("clusterM02"), cluster.m02());
mHistManager.fill(HIST("clusterM20"), cluster.m20());
mHistManager.fill(HIST("clusterTimeVsE"), cluster.time(), cluster.energy());
mHistManager.fill(HIST("clusterNLM"), cluster.nlm());
mHistManager.fill(HIST("clusterNCells"), cluster.nCells());
mHistManager.fill(HIST("clusterDistanceToBadChannel"), cluster.distanceToBadChannel());
}
}
PROCESS_SWITCH(ClusterMonitor, processAmbiguous, "Process Ambiguous clusters", false);

/// \brief Create binning for cluster energy axis (variable bin size)
/// \return vector with bin limits
Expand Down Expand Up @@ -250,6 +274,8 @@ struct ClusterMonitor {

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<ClusterMonitor>(cfgc)};
WorkflowSpec workflow{
adaptAnalysisTask<ClusterMonitor>(cfgc, TaskName{"EMCClusterMonitorTask"}, SetDefaultProcesses{{{"processCollisions", true}, {"processAmbiguous", false}}}),
adaptAnalysisTask<ClusterMonitor>(cfgc, TaskName{"EMCClusterMonitorTaskAmbiguous"}, SetDefaultProcesses{{{"processCollisions", false}, {"processAmbiguous", true}}})};
return workflow;
}