@@ -54,6 +54,7 @@ using namespace o2::framework;
5454using namespace o2 ::framework::expressions;
5555using collisionEvSelIt = o2::soa::Join<o2::aod::Collisions, o2::aod::EvSels>::iterator;
5656using selectedClusters = o2::soa::Filtered<o2::aod::EMCALClusters>;
57+ using selectedAmbiguousClusters = o2::soa::Filtered<o2::aod::EMCALAmbiguousClusters>;
5758struct 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
251275WorkflowSpec 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