1111//
1212// / \file jetCorrelationD0.cxx
1313// / \brief Task for analysing D0 triggered jet events.
14- // / \author Matthew Ockleton < matthew.ockleton@cern.ch> , University of Liverpool
14+ // / \author Matthew Ockleton matthew.ockleton@cern.ch, University of Liverpool
1515
1616#include " PWGHF/Core/DecayChannels.h"
1717#include " PWGHF/DataModel/AliasTables.h"
@@ -41,13 +41,24 @@ using namespace o2::framework::expressions;
4141
4242namespace o2 ::aod
4343{
44- DECLARE_SOA_TABLE (CollisionTables, " AOD" , " COLLISIONINFOTABLE" ,
44+
45+ namespace d0collisionInfo
46+ {
47+ DECLARE_SOA_COLUMN (PosZ, posZ, float );
48+ } // namespace d0collisionInfo
49+
50+ DECLARE_SOA_TABLE (CollisionTables, " AOD" , " COLLINFOTABLE" ,
4551 o2::soa::Index<>,
46- collision::PosZ);
52+ d0collisionInfo::PosZ);
53+
54+ DECLARE_SOA_TABLE (McCollisionTables, " AOD" , " MCCOLLINFOTABLE" ,
55+ o2::soa::Index<>,
56+ d0collisionInfo::PosZ);
4757
4858namespace collisionInfo
4959{
5060DECLARE_SOA_INDEX_COLUMN (CollisionTable, collisionTable);
61+ DECLARE_SOA_INDEX_COLUMN (McCollisionTable, mcCollisionTable);
5162} // namespace collisionInfo
5263namespace d0Info
5364{
@@ -59,6 +70,7 @@ DECLARE_SOA_COLUMN(D0M, d0M, float);
5970DECLARE_SOA_COLUMN (D0Pt, d0Pt, float );
6071DECLARE_SOA_COLUMN (D0Eta, d0Eta, float );
6172DECLARE_SOA_COLUMN (D0Phi, d0Phi, float );
73+ DECLARE_SOA_COLUMN (D0Y, d0Y, float );
6274DECLARE_SOA_COLUMN (D0McOrigin, d0McOrigin, float );
6375DECLARE_SOA_COLUMN (D0MD, d0MD, float );
6476DECLARE_SOA_COLUMN (D0PtD, d0PtD, float );
@@ -76,15 +88,17 @@ DECLARE_SOA_TABLE(D0DataTables, "AOD", "D0DATATABLE",
7688 d0Info::D0M,
7789 d0Info::D0Pt,
7890 d0Info::D0Eta,
79- d0Info::D0Phi);
91+ d0Info::D0Phi,
92+ d0Info::D0Y);
8093
8194DECLARE_SOA_TABLE (D0McPTables, " AOD" , " D0MCPARTICLELEVELTABLE" ,
8295 o2::soa::Index<>,
83- collisionInfo::CollisionTableId ,
96+ collisionInfo::McCollisionTableId ,
8497 d0Info::D0McOrigin,
8598 d0Info::D0Pt,
8699 d0Info::D0Eta,
87- d0Info::D0Phi);
100+ d0Info::D0Phi,
101+ d0Info::D0Y);
88102
89103namespace jetInfo
90104{
@@ -108,9 +122,9 @@ DECLARE_SOA_TABLE_STAGED(JetDataTables, "JETDATATABLE",
108122 jetInfo::JetPhi,
109123 jetInfo::D0JetDeltaPhi);
110124
111- DECLARE_SOA_TABLE_STAGED (JetMCPTables, " JETMCPARTICLELEVELTABLE " ,
125+ DECLARE_SOA_TABLE_STAGED (JetMCPTables, " JETMCPTABLE " ,
112126 o2::soa::Index<>,
113- collisionInfo::CollisionTableId ,
127+ collisionInfo::McCollisionTableId ,
114128 jetInfo::D0McPTableId,
115129 jetInfo::JetPt,
116130 jetInfo::JetEta,
@@ -122,20 +136,20 @@ DECLARE_SOA_TABLE_STAGED(JetMCPTables, "JETMCPARTICLELEVELTABLE",
122136struct JetCorrelationD0 {
123137 // Define new table
124138 Produces<aod::CollisionTables> tableCollision;
139+ Produces<aod::McCollisionTables> tableMcCollision;
125140 Produces<aod::D0DataTables> tableD0;
126141 Produces<aod::D0McPTables> tableD0MCParticle;
127142 Produces<aod::JetDataTables> tableJet;
128143 Produces<aod::JetMCPTables> tableJetMCParticle;
129144
130- using TracksSelQuality = soa::Join<aod::TracksExtra, aod::TracksWMc>;
131-
132145 // Configurables
133146 Configurable<std::string> eventSelections{" eventSelections" , " sel8" , " choose event selection" };
147+ Configurable<bool > skipMBGapEvents{" skipMBGapEvents" , false , " decide to run over MB gap events or not" };
148+ Configurable<bool > applyRCTSelections{" applyRCTSelections" , true , " decide to apply RCT selections" };
134149 // Configurable<std::string> triggerMasks{"triggerMasks", "", "possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL"};
135150 Configurable<float > jetPtCutMin{" jetPtCutMin" , 5.0 , " minimum value of jet pt" };
136- Configurable<float > d0PtCutMin{" d0PtCutMin" , 3.0 , " minimum value of d0 pt" };
137- Configurable<bool > doSumw{" doSumw" , false , " enable sumw2 for weighted histograms" };
138- Configurable<float > vertexZCut{" vertexZCut" , 10 .0f , " Accepted z-vertex range" };
151+ Configurable<float > d0PtCutMin{" d0PtCutMin" , 1.0 , " minimum value of d0 pt" };
152+ Configurable<float > vertexZCut{" vertexZCut" , 10.0 , " Accepted z-vertex range" };
139153 Configurable<float > pTHatExponent{" pTHatExponent" , 6.0 , " exponent of the event weight for the calculation of pTHat" };
140154 Configurable<float > pTHatMaxMCD{" pTHatMaxMCD" , 999.0 , " maximum fraction of hard scattering for jet acceptance in detector MC" };
141155 Configurable<float > pTHatMaxMCP{" pTHatMaxMCP" , 999.0 , " maximum fraction of hard scattering for jet acceptance in particle MC" };
@@ -169,15 +183,16 @@ struct JetCorrelationD0 {
169183 registry.fill (HIST (" h_Jet_pT_D0_Jet_dPhi" ), jet.pt (), dphi);
170184 }
171185
172- template <typename T, typename U >
173- void applyCollisionSelections (T const & collision, U const & eventSelectionBits )
186+ template <typename T>
187+ bool applyCollisionSelections (T const & collision)
174188 {
175189 registry.fill (HIST (" hCollisions" ), 0.5 ); // All collisions
176- if (!jetderiveddatautilities::selectCollision (collision, eventSelectionBits)) {
177- return ;
190+ if (!jetderiveddatautilities::selectCollision (collision, eventSelectionBits, skipMBGapEvents, applyRCTSelections )) {
191+ return false ;
178192 }
179193 registry.fill (HIST (" hCollisions" ), 1.5 ); // Selected collisions
180194 registry.fill (HIST (" hZvtxSelected" ), collision.posZ ());
195+ return true ;
181196 }
182197
183198 template <typename T, typename U>
@@ -199,11 +214,9 @@ struct JetCorrelationD0 {
199214 }
200215 }
201216 }
202-
203217 void init (InitContext const &)
204218 {
205219 eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits (static_cast <std::string>(eventSelections));
206-
207220 // General Axes
208221 AxisSpec axisEta = {100 , -1.0 , 1.0 , " #eta" };
209222 AxisSpec axisPhi = {100 , 0.0 , o2::constants::math::TwoPI, " #phi" };
@@ -231,27 +244,27 @@ struct JetCorrelationD0 {
231244 registry.add (" h_Jet_pT_D0_Jet_dPhi" , " p_{T, jet} vs #Delta #phi _{D^{0}, jet}" , kTH2F , {{100 , 0 , 100 }, {100 , 0 , o2::constants::math::TwoPI}});
232245
233246 // Matching histograms
234- registry.add (" hPtMatched" , " p_{T} matching;p_{T,det};p_{T,part}" , {HistType::kTH2F , {{500 , -100 , 400 }, {400 , 0 , 400 }}}, doSumw );
235- registry.add (" hPtMatched1d" , " p_{T} matching 1d;p_{T,part}" , {HistType::kTH1F , {{400 , 0 , 400 }}}, doSumw );
236- registry.add (" hPhiMatched" , " #phi matching;#phi_{det};#phi_{part}" , {HistType::kTH2F , {{100 , 0.0 , o2::constants::math::TwoPI}, {100 , 0.0 , o2::constants::math::TwoPI}}}, doSumw );
237- registry.add (" hEtaMatched" , " #eta matching;#eta_{det};#eta_{part}" , {HistType::kTH2F , {{100 , -1 , 1 }, {100 , -1 , 1 }}}, doSumw );
238- registry.add (" hPtResolution" , " p_{T} resolution;p_{T,part};Relative Resolution" , {HistType::kTH2F , {{400 , 0 , 400 }, {1000 , -5.0 , 5.0 }}}, doSumw );
239- registry.add (" hPhiResolution" , " #phi resolution;#p_{T,part};Resolution" , {HistType::kTH2F , {{400 , 0 , 400 }, {1000 , -7.0 , 7.0 }}}, doSumw );
240- registry.add (" hEtaResolution" , " #eta resolution;#p_{T,part};Resolution" , {HistType::kTH2F , {{400 , 0 , 400 }, {1000 , -1.0 , 1.0 }}}, doSumw );
247+ registry.add (" hPtMatched" , " p_{T} matching;p_{T,det};p_{T,part}" , {HistType::kTH2F , {{500 , -100 , 400 }, {400 , 0 , 400 }}});
248+ registry.add (" hPtMatched1d" , " p_{T} matching 1d;p_{T,part}" , {HistType::kTH1F , {{400 , 0 , 400 }}});
249+ registry.add (" hPhiMatched" , " #phi matching;#phi_{det};#phi_{part}" , {HistType::kTH2F , {{100 , 0.0 , o2::constants::math::TwoPI}, {100 , 0.0 , o2::constants::math::TwoPI}}});
250+ registry.add (" hEtaMatched" , " #eta matching;#eta_{det};#eta_{part}" , {HistType::kTH2F , {{100 , -1 , 1 }, {100 , -1 , 1 }}});
251+ registry.add (" hPtResolution" , " p_{T} resolution;p_{T,part};Relative Resolution" , {HistType::kTH2F , {{400 , 0 , 400 }, {1000 , -5.0 , 5.0 }}});
252+ registry.add (" hPhiResolution" , " #phi resolution;#p_{T,part};Resolution" , {HistType::kTH2F , {{400 , 0 , 400 }, {1000 , -7.0 , 7.0 }}});
253+ registry.add (" hEtaResolution" , " #eta resolution;#p_{T,part};Resolution" , {HistType::kTH2F , {{400 , 0 , 400 }, {1000 , -1.0 , 1.0 }}});
241254 }
242-
243255 void processData (soa::Filtered<aod::JetCollisions>::iterator const & collision,
244256 aod::CandidatesD0Data const & d0Candidates,
245257 soa::Join<aod::ChargedJets, aod::ChargedJetConstituents> const & jets)
246258 {
247- applyCollisionSelections (collision, eventSelectionBits);
259+ if (!applyCollisionSelections (collision)){
260+ return ;
261+ }
248262 tableCollision (collision.posZ ());
249-
250263 for (const auto & d0Candidate : d0Candidates) {
251- const auto scores = d0Candidate.mlScores ();
252- if (d0Candidate.pt () < d0PtCutMin) {
264+ if (d0Candidate.pt () < d0PtCutMin) { // once settled on a mlcut, then add the lower bound of the systematics as a cut here
253265 continue ;
254266 }
267+ const auto scores = d0Candidate.mlScores ();
255268 fillD0Histograms (d0Candidate, scores);
256269 tableD0 (tableCollision.lastIndex (),
257270 scores[2 ],
@@ -260,13 +273,14 @@ struct JetCorrelationD0 {
260273 d0Candidate.m (),
261274 d0Candidate.pt (),
262275 d0Candidate.eta (),
263- d0Candidate.phi ());
276+ d0Candidate.phi (),
277+ d0Candidate.y ());
264278 for (const auto & jet : jets) {
265279 if (jet.pt () < jetPtCutMin) {
266280 continue ;
267281 }
268282 float dphi = RecoDecay::constrainAngle (jet.phi () - d0Candidate.phi ());
269- if (abs (dphi - M_PI) > (M_PI / 2 )) {
283+ if (abs (dphi - M_PI) > (M_PI / 2 )) { // this is quite loose instead of pi/2 could do 0.6
270284 continue ;
271285 }
272286 fillJetHistograms (jet, dphi);
@@ -281,14 +295,57 @@ struct JetCorrelationD0 {
281295 }
282296 PROCESS_SWITCH (JetCorrelationD0, processData, " charged particle level jet analysis" , true );
283297
298+ void processMCDetector (soa::Filtered<aod::JetCollisions>::iterator const & collision,
299+ aod::CandidatesD0MCD const & d0Candidates,
300+ soa::Join<aod::ChargedMCDetectorLevelJets, aod::ChargedMCDetectorLevelJetConstituents> const & jets)
301+ {
302+ if (!applyCollisionSelections (collision)){
303+ return ;
304+ }
305+ tableCollision (collision.posZ ());
306+ for (const auto & d0Candidate : d0Candidates) {
307+ if (d0Candidate.pt () < d0PtCutMin) { // once settled on a mlcut, then add the lower biund of the systematics as a cut here
308+ continue ;
309+ }
310+ const auto scores = d0Candidate.mlScores ();
311+ fillD0Histograms (d0Candidate, scores);
312+ tableD0 (tableCollision.lastIndex (), // might want to add some more detector level D0 quantities like prompt or non prompt info
313+ scores[2 ],
314+ scores[1 ],
315+ scores[0 ],
316+ d0Candidate.m (),
317+ d0Candidate.pt (),
318+ d0Candidate.eta (),
319+ d0Candidate.phi (),
320+ d0Candidate.y ());
321+ for (const auto & jet : jets) {
322+ if (jet.pt () < jetPtCutMin) {
323+ continue ;
324+ }
325+ float dphi = RecoDecay::constrainAngle (jet.phi () - d0Candidate.phi ());
326+ if (abs (dphi - M_PI) > (M_PI / 2 )) { // this is quite loose instead of pi/2 could do 0.6
327+ continue ;
328+ }
329+ fillJetHistograms (jet, dphi);
330+ tableJet (tableCollision.lastIndex (),
331+ tableD0.lastIndex (),
332+ jet.pt (),
333+ jet.eta (),
334+ jet.phi (),
335+ dphi);
336+ }
337+ }
338+ }
339+ PROCESS_SWITCH (JetCorrelationD0, processMCDetector, " charged particle level jet analysis" , false );
340+
284341 void processMCParticle (aod::JetMcCollision const & collision,
285342 aod::CandidatesD0MCP const & d0MCPCandidates,
286343 soa::Filtered<soa::Join<aod::ChargedMCParticleLevelJets, aod::ChargedMCParticleLevelJetConstituents>> const & jets)
287344 {
288- // applyCollisionSelections( collision, eventSelectionBits);
289- // Need to select on pz
290- tableCollision (collision. posZ ());
291-
345+ if (! jetderiveddatautilities::selectCollision ( collision, eventSelectionBits, skipMBGapEvents, applyRCTSelections)) { // build without this
346+ return ;
347+ }
348+ tableMcCollision (collision. posZ ());
292349 for (const auto & d0MCPCandidate : d0MCPCandidates) {
293350 if (d0MCPCandidate.pt () < d0PtCutMin) {
294351 continue ;
@@ -297,7 +354,8 @@ struct JetCorrelationD0 {
297354 d0MCPCandidate.originMcGen (),
298355 d0MCPCandidate.pt (),
299356 d0MCPCandidate.eta (),
300- d0MCPCandidate.phi ());
357+ d0MCPCandidate.phi (),
358+ d0MCPCandidate.y ());
301359
302360 for (const auto & jet : jets) {
303361 if (jet.pt () < jetPtCutMin) {
@@ -324,4 +382,4 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
324382{
325383 return WorkflowSpec{
326384 adaptAnalysisTask<JetCorrelationD0>(cfgc)};
327- }
385+ }
0 commit comments