Skip to content

Commit 3e2dba1

Browse files
authored
[EMCAL-734] fixed cluster definition and added ambiguous clusters (AliceO2Group#817)
[EMCAL-734] merge conflicts [EMCAL-734] merge conflicts 2 [EMCAL-734] fixed conflicts part 3
1 parent 141bc48 commit 3e2dba1

3 files changed

Lines changed: 59 additions & 29 deletions

File tree

PWGJE/DataModel/EMCALClusters.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ namespace emcalcluster
2727
// define global cluster definitions
2828
// the V1 algorithm is not yet implemented, but the V3 algorithm is
2929
// New definitions should be added here!
30-
const EMCALClusterDefinition kV1Default(ClusterAlgorithm_t::kV1, 0, 1, "kV1Default", 0.1, 0.5, -10000, 10000, 0.03);
31-
const EMCALClusterDefinition kV1Variation1(ClusterAlgorithm_t::kV3, 1, 1, "kV1Variation1", 0.1, 0.3, -10000, 10000, 0.03);
32-
const EMCALClusterDefinition kV1Variation2(ClusterAlgorithm_t::kV3, 2, 1, "kV1Variation2", 0.1, 0.2, -10000, 10000, 0.03);
33-
const EMCALClusterDefinition kV3Default(ClusterAlgorithm_t::kV3, 10, 1, "kV3Default", 0.1, 0.5, -10000, 10000, 0.03);
34-
const EMCALClusterDefinition kV3Variation1(ClusterAlgorithm_t::kV3, 11, 1, "kV3Variation1", 0.1, 0.3, -10000, 10000, 0.03);
35-
const EMCALClusterDefinition kV3Variation2(ClusterAlgorithm_t::kV3, 12, 1, "kV3Variation2", 0.1, 0.2, -10000, 10000, 0.03);
30+
const EMCALClusterDefinition kV1Default(ClusterAlgorithm_t::kV1, 0, 1, "kV1Default", 0.5, 0.1, -10000, 10000, 0.03);
31+
const EMCALClusterDefinition kV1Variation1(ClusterAlgorithm_t::kV3, 1, 1, "kV1Variation1", 0.3, 0.1, -10000, 10000, 0.03);
32+
const EMCALClusterDefinition kV1Variation2(ClusterAlgorithm_t::kV3, 2, 1, "kV1Variation2", 0.2, 0.1, -10000, 10000, 0.03);
33+
const EMCALClusterDefinition kV3Default(ClusterAlgorithm_t::kV3, 10, 1, "kV3Default", 0.5, 0.1, -10000, 10000, 0.03);
34+
const EMCALClusterDefinition kV3Variation1(ClusterAlgorithm_t::kV3, 11, 1, "kV3Variation1", 0.3, 0.1, -10000, 10000, 0.03);
35+
const EMCALClusterDefinition kV3Variation2(ClusterAlgorithm_t::kV3, 12, 1, "kV3Variation2", 0.2, 0.1, -10000, 10000, 0.03);
3636

3737
/// \brief function returns EMCALClusterDefinition for the given name
3838
/// \param name name of the cluster definition

PWGJE/TableProducer/emcalCorrectionTask.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ struct EmcalCorrectionTask {
103103
mClusterizers.emplace_back(std::make_unique<o2::emcal::Clusterizer<o2::emcal::Cell>>(1, clusterDefinition.timeMin, clusterDefinition.timeMax, clusterDefinition.gradientCut, true, clusterDefinition.seedEnergy, clusterDefinition.minCellEnergy));
104104
mClusterFactories.emplace_back(std::make_unique<o2::emcal::ClusterFactory<o2::emcal::Cell>>());
105105
LOG(info) << "Cluster definition initialized: " << clusterDefinition.toString();
106+
LOG(info) << "timeMin: " << clusterDefinition.timeMin;
107+
LOG(info) << "timeMax: " << clusterDefinition.timeMax;
108+
LOG(info) << "gradientCut: " << clusterDefinition.gradientCut;
109+
LOG(info) << "seedEnergy: " << clusterDefinition.seedEnergy;
110+
LOG(info) << "minCellEnergy: " << clusterDefinition.minCellEnergy;
106111
}
107112
for (auto& clusterizer : mClusterizers) {
108113
clusterizer->setGeometry(geometry);
@@ -142,7 +147,6 @@ struct EmcalCorrectionTask {
142147
}
143148
// LOG(debug) << "Cell E: " << cell.getEnergy();
144149
// LOG(debug) << "Cell E: " << cell;
145-
146150
mEmcalCells.emplace_back(o2::emcal::Cell(
147151
cell.cellNumber(),
148152
cell.amplitude(),
@@ -187,8 +191,8 @@ struct EmcalCorrectionTask {
187191
mClusterFactories.at(i)->setClustersContainer(*emcalClusters);
188192
mClusterFactories.at(i)->setCellsContainer(mEmcalCells);
189193
mClusterFactories.at(i)->setCellsIndicesContainer(*emcalClustersInputIndices);
190-
LOG(debug) << "Cluster factory set up.";
191194

195+
LOG(debug) << "Cluster factory set up.";
192196
// Convert to analysis clusters.
193197
for (int icl = 0; icl < mClusterFactories.at(i)->getNumberOfClusters(); icl++) {
194198
auto analysisCluster = mClusterFactories.at(i)->buildCluster(icl);

PWGJE/Tasks/emcclustermonitor.cxx

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ using namespace o2::framework;
5454
using namespace o2::framework::expressions;
5555
using collisionEvSelIt = o2::soa::Join<o2::aod::Collisions, o2::aod::EvSels>::iterator;
5656
using selectedClusters = o2::soa::Filtered<o2::aod::EMCALClusters>;
57+
using selectedAmbiguousClusters = o2::soa::Filtered<o2::aod::EMCALAmbiguousClusters>;
5758
struct ClusterMonitor {
5859
HistogramRegistry mHistManager{"ClusterMonitorHistograms"};
5960
o2::emcal::Geometry* mGeometry = nullptr;
@@ -102,7 +103,7 @@ struct ClusterMonitor {
102103
mHistManager.add("eventVertexZAll", "z-vertex of event (all events)", o2HistType::kTH1F, {{200, -20, 20}});
103104
mHistManager.add("eventVertexZSelected", "z-vertex of event (selected events)", o2HistType::kTH1F, {{200, -20, 20}});
104105

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

@@ -151,26 +152,14 @@ struct ClusterMonitor {
151152
LOG(debug) << "Event not selected because of z-vertex cut z= " << theCollision.posZ() << " > " << mVertexCut << " cm, skipping";
152153
return;
153154
}
155+
mHistManager.fill(HIST("eventVertexZAll"), theCollision.posZ());
156+
if (mVertexCut > 0 && TMath::Abs(theCollision.posZ()) > mVertexCut) {
157+
LOG(debug) << "Event not selected because of z-vertex cut z= " << theCollision.posZ() << " > " << mVertexCut << " cm, skipping";
158+
return;
159+
}
154160
mHistManager.fill(HIST("eventsSelected"), 1);
155161
mHistManager.fill(HIST("eventVertexZSelected"), theCollision.posZ());
156162

157-
// loop over bc , if requested (mVetoBCID >= 0), reject everything from a certain BC
158-
// this can be used as alternative to event selection (e.g. for pilot beam data)
159-
// TODO: remove this loop and put it in separate process function that only takes care of ambiguous clusters
160-
for (const auto& bc : bcs) {
161-
o2::InteractionRecord eventIR;
162-
eventIR.setFromLong(bc.globalBC());
163-
mHistManager.fill(HIST("eventBCAll"), eventIR.bc);
164-
if (std::find(mVetoBCIDs.begin(), mVetoBCIDs.end(), eventIR.bc) != mVetoBCIDs.end()) {
165-
LOG(info) << "Event rejected because of veto BCID " << eventIR.bc;
166-
continue;
167-
}
168-
if (mSelectBCIDs.size() && (std::find(mSelectBCIDs.begin(), mSelectBCIDs.end(), eventIR.bc) == mSelectBCIDs.end())) {
169-
continue;
170-
}
171-
mHistManager.fill(HIST("eventBCSelected"), eventIR.bc);
172-
}
173-
174163
// loop over all clusters from accepted collision
175164
// auto eventClusters = clusters.select(o2::aod::emcalcluster::bcId == theCollision.bc().globalBC());
176165
for (const auto& cluster : clusters) {
@@ -193,6 +182,41 @@ struct ClusterMonitor {
193182
mHistManager.fill(HIST("clusterDistanceToBadChannel"), cluster.distanceToBadChannel());
194183
}
195184
}
185+
PROCESS_SWITCH(ClusterMonitor, processCollisions, "Process clusters from collision", false);
186+
187+
/// \brief Process EMCAL clusters that are not matched to a collision
188+
/// This is not needed for most users
189+
190+
void processAmbiguous(o2::aod::BC const bc, selectedAmbiguousClusters const& clusters)
191+
{
192+
// loop over bc , if requested (mVetoBCID >= 0), reject everything from a certain BC
193+
// this can be used as alternative to event selection (e.g. for pilot beam data)
194+
// TODO: remove this loop and put it in separate process function that only takes care of ambiguous clusters
195+
o2::InteractionRecord eventIR;
196+
eventIR.setFromLong(bc.globalBC());
197+
mHistManager.fill(HIST("eventBCAll"), eventIR.bc);
198+
if (std::find(mVetoBCIDs.begin(), mVetoBCIDs.end(), eventIR.bc) != mVetoBCIDs.end()) {
199+
LOG(info) << "Event rejected because of veto BCID " << eventIR.bc;
200+
return;
201+
}
202+
if (mSelectBCIDs.size() && (std::find(mSelectBCIDs.begin(), mSelectBCIDs.end(), eventIR.bc) == mSelectBCIDs.end())) {
203+
return;
204+
}
205+
mHistManager.fill(HIST("eventBCSelected"), eventIR.bc);
206+
// loop over ambiguous clusters
207+
for (const auto& cluster : clusters) {
208+
mHistManager.fill(HIST("clusterE"), cluster.energy());
209+
mHistManager.fill(HIST("clusterE_SimpleBinning"), cluster.energy());
210+
mHistManager.fill(HIST("clusterEtaPhi"), cluster.eta(), cluster.phi());
211+
mHistManager.fill(HIST("clusterM02"), cluster.m02());
212+
mHistManager.fill(HIST("clusterM20"), cluster.m20());
213+
mHistManager.fill(HIST("clusterTimeVsE"), cluster.time(), cluster.energy());
214+
mHistManager.fill(HIST("clusterNLM"), cluster.nlm());
215+
mHistManager.fill(HIST("clusterNCells"), cluster.nCells());
216+
mHistManager.fill(HIST("clusterDistanceToBadChannel"), cluster.distanceToBadChannel());
217+
}
218+
}
219+
PROCESS_SWITCH(ClusterMonitor, processAmbiguous, "Process Ambiguous clusters", false);
196220

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

251275
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
252276
{
253-
return WorkflowSpec{
254-
adaptAnalysisTask<ClusterMonitor>(cfgc)};
277+
WorkflowSpec workflow{
278+
adaptAnalysisTask<ClusterMonitor>(cfgc, TaskName{"EMCClusterMonitorTask"}, SetDefaultProcesses{{{"processCollisions", true}, {"processAmbiguous", false}}}),
279+
adaptAnalysisTask<ClusterMonitor>(cfgc, TaskName{"EMCClusterMonitorTaskAmbiguous"}, SetDefaultProcesses{{{"processCollisions", false}, {"processAmbiguous", true}}})};
280+
return workflow;
255281
}

0 commit comments

Comments
 (0)