Skip to content

Commit 70435ee

Browse files
committed
adding emcal eta phi on surface to tree
1 parent d3b0f2d commit 70435ee

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

PWGJE/Tasks/gammajettreeproducer.cxx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12+
// C++ system headers first
13+
#include <string>
14+
#include <unordered_map>
15+
#include <vector>
16+
17+
// Framework and other headers after
1218
#include "Framework/ASoA.h"
1319
#include "Framework/AnalysisDataModel.h"
1420
#include "Framework/AnalysisTask.h"
@@ -44,9 +50,10 @@
4450
/// \since 02.08.2024
4551
///
4652
using namespace o2;
53+
using namespace o2::aod;
4754
using namespace o2::framework;
4855
using namespace o2::framework::expressions;
49-
using selectedClusters = o2::soa::Filtered<o2::soa::Join<o2::aod::JClusters,o2::aod::JClusterTracks>>;
56+
using selectedClusters = o2::soa::Filtered<o2::soa::Join<o2::aod::JClusters, o2::aod::JClusterTracks>>;
5057

5158
#include "Framework/runDataProcessing.h"
5259

@@ -220,8 +227,10 @@ struct GammaJetTreeProducer {
220227
// sadly passing of the string at runtime is not possible for technical region so cluster definition is
221228
// an integer instead
222229
Filter clusterDefinitionSelection = (o2::aod::jcluster::definition == mClusterDefinition);
230+
PresliceUnsorted<aod::JEMCTracks> EMCTrackPerTrack = aod::jemctrack::trackId;
231+
223232
// Process clusters
224-
void processClusters(soa::Join<JetCollisions, aod::BkgChargedRhos, aod::JCollisionBCs>::iterator const& collision, selectedClusters const& clusters, JetTracks const& tracks)
233+
void processClusters(soa::Join<JetCollisions, aod::BkgChargedRhos, aod::JCollisionBCs>::iterator const& collision, selectedClusters const& clusters, JetTracks const& tracks, aod::JEMCTracks const& emctracks)
225234
{
226235
if (!isEventAccepted(collision)) {
227236
return;
@@ -248,20 +257,20 @@ struct GammaJetTreeProducer {
248257
// double dRMin = 100;
249258
double p = -1;
250259

251-
// do track matching
260+
// do track matching
252261
auto tracksofcluster = cluster.matchedTracks_as<JetTracks>();
253-
254262
for (auto track : tracksofcluster) {
255263
if (!isTrackSelected(track)) {
256264
continue;
257265
}
266+
auto emcTracksPerTrack = emctracks.sliceBy(EMCTrackPerTrack, track.globalIndex());
267+
auto emcTrack = emcTracksPerTrack.iteratorAt(0);
258268
// find closest track that still has E/p < trackMatchingEoverP
259269
if (cluster.energy()/track.p() > trackMatchingEoverP) {
260270
continue;
261271
} else {
262-
// TODO make it eta on emcal surface and phi on emcal surface
263-
dEta = cluster.eta() - track.eta();
264-
dPhi = RecoDecay::constrainAngle(RecoDecay::constrainAngle(track.phi(), -M_PI) - RecoDecay::constrainAngle(cluster.phi(), -M_PI), -M_PI);
272+
dEta = cluster.eta() - emcTrack.etaEmcal();
273+
dPhi = RecoDecay::constrainAngle(RecoDecay::constrainAngle(emcTrack.phiEmcal(), -M_PI) - RecoDecay::constrainAngle(cluster.phi(), -M_PI), -M_PI);
265274
p = track.p();
266275
break;
267276
}
@@ -308,7 +317,7 @@ struct GammaJetTreeProducer {
308317
// calculate perp cone rho
309318
double perpconerho = ch_perp_cone_rho(jet, tracks, perpConeJetR);
310319
mHistograms.fill(HIST("chjetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi());
311-
chargedJetsTable(storedColIndex, jet.pt(), jet.eta(), jet.phi(), jet.r(), jet.energy(), jet.mass(), jet.area(), leadingTrackPt, perpconerho,nconst);
320+
chargedJetsTable(storedColIndex, jet.pt(), jet.eta(), jet.phi(), jet.r(), jet.energy(), jet.mass(), jet.area(), leadingTrackPt, perpconerho, nconst);
312321
// fill histograms
313322
mHistograms.fill(HIST("chjetPt"), jet.pt());
314323
}

0 commit comments

Comments
 (0)