Skip to content

Commit ea6582d

Browse files
[PWGDQ] Add centrality + pt + eta + phi info in MID efficiency task (#8083)
1 parent 1000d18 commit ea6582d

1 file changed

Lines changed: 170 additions & 40 deletions

File tree

PWGDQ/Tasks/MIDefficiency.cxx

Lines changed: 170 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
/// Struct for writing the table and convert the data
1717
/// to MID tracks needed to compute the efficiency of the MID RPCs
1818
///
19-
/// \author Luca Quaglia <luca.quaglia@cern.ch>
20-
///
19+
/// \author Luca Quaglia <luca.quaglia@cern.ch
2120

2221
#include "Framework/AnalysisTask.h"
2322
#include "Framework/HistogramRegistry.h"
2423
#include "Framework/runDataProcessing.h"
2524
#include "Framework/CallbackService.h"
2625
#include "Framework/ASoAHelpers.h"
26+
#include <iostream>
2727

2828
// O2 physics classes
2929
#include "PWGDQ/DataModel/ReducedInfoTables.h"
@@ -42,6 +42,7 @@ using namespace o2;
4242
using namespace o2::aod;
4343
using namespace o2::framework;
4444
using namespace o2::framework::expressions;
45+
using MyEvents = soa::Join<aod::ReducedEvents, aod::ReducedEventsExtended>;
4546
using MyMuonTracks = soa::Join<aod::ReducedMuons, aod::ReducedMuonsExtra>;
4647

4748
struct midEfficiency {
@@ -50,20 +51,33 @@ struct midEfficiency {
5051
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
5152

5253
// Configurables for histogram axes
53-
Configurable<int> nBinsLocal{"nBinsLocal", 936, "N bins in local board counts histo"};
54-
Configurable<int> nBinsRPC{"nBinsRPC", 72, "N bins in RPC counts histo"};
55-
Configurable<int> nBinsPlane{"nBinsPlane", 4, "N bins in plane counts histo"};
56-
Configurable<int> nBinsTrackType{"nBinsTrackType", 5, "N bins in track type debug histo"};
57-
Configurable<bool> createRootFile{"createRootFile", false, "if true it creates the mid-reco.root file for debug purposes"};
58-
59-
// Vector of MID tracks to pass to the efficiency calculator
60-
std::vector<o2::mid::Track> dummyTrack;
54+
// Centrality
55+
Configurable<int> nBinsCentrality{"nBinsCentrality", 9, "N bins for centrality histo in PbPb"};
56+
Configurable<float> minCentrality{"minCentrality", 0., "minimum of axis in centrality histo in PbPb"};
57+
Configurable<float> maxCentrality{"maxCentrality", 90., "maximum of axis in centrality histo in PbPb"};
58+
Configurable<bool> isPbPb{"isPbPb", false, "If true, the task will be used to run on PbPb data and will enable the filling of THnSparse for centrality studies"};
59+
60+
// pt
61+
Configurable<int> nBinsPt{"nBinsPt", 2000, "N bins for pt histo"};
62+
Configurable<float> minPt{"minPt", 0., "minimum of pt axis"}; // GeV/c
63+
Configurable<float> maxPt{"maxPt", 20., "maximum of pt axis"};
64+
65+
// eta
66+
Configurable<int> nBinsEta{"nBinsEta", 500, "N bins for eta histo"};
67+
Configurable<float> minEta{"minEta", -5., "minimum of eta axis"}; //
68+
Configurable<float> maxEta{"maxEta", 5., "maximum of eta axis"};
69+
70+
// phi
71+
Configurable<int> nBinsPhi{"nBinsPhi", 500, "N bins for phi histo"};
72+
Configurable<float> minPhi{"minPhi", -2. * TMath::Pi(), "minimum of phi axis"}; //
73+
Configurable<float> maxPhi{"maxPhi", 2 * TMath::Pi(), "maximum of phi axis"};
74+
6175
// MID track placeholder for processing
6276
o2::mid::Track trk;
6377
// MID mapping for LB calculation
6478
o2::mid::Mapping mapping;
6579

66-
// Filter only for MCH-MID tracks
80+
// Filter only for MCH-MID matched tracks
6781
Filter muonTrackType = aod::fwdtrack::trackType == uint8_t(3);
6882

6983
void init(o2::framework::InitContext const& /*ic*/)
@@ -72,14 +86,18 @@ struct midEfficiency {
7286
LOGF(debug, "Initialization starting");
7387

7488
// Axes definition
75-
const AxisSpec axisLocalBoards{nBinsLocal, 0.5, 936.5, "Local board"};
76-
const AxisSpec axisRPCs{nBinsRPC, -0.5, 71.5, "RPC"};
77-
const AxisSpec axisPlanes{nBinsPlane, -0.5, 3.5, "Plane"};
78-
const AxisSpec axisTrackType{nBinsTrackType, -0.5, 4.5, "Muon track type"};
89+
const AxisSpec axisLocalBoards{936, 0.5, 936.5, "Local board"}; // These are not defined as configurable since they are fixed
90+
const AxisSpec axisRPCs{72, -0.5, 71.5, "RPC"}; // These are not defined as configurable since they are fixed
91+
const AxisSpec axisPlanes{4, -0.5, 3.5, "Plane"}; // These are not defined as configurable since they are fixed
92+
const AxisSpec axisTrackType{5, -0.5, 4.5, "Muon track type"}; // These are not defined as configurable since they are fixed
93+
94+
const AxisSpec axisCent{nBinsCentrality, minCentrality, maxCentrality, "Centrality"};
95+
const AxisSpec axisPt{nBinsPt, minPt, maxPt, "track p_{t} [GeV/c]"};
96+
const AxisSpec axisEta{nBinsEta, minEta, maxEta, "track #eta"};
97+
const AxisSpec axisPhi{nBinsPhi, minPhi, maxPhi, "track #phi"};
7998

8099
LOGF(debug, "Creating histograms");
81100

82-
// Same names as O2 task
83101
// Local boards
84102
histos.add("nFiredBPperBoard", "nFiredBPperBoard", kTH1F, {axisLocalBoards});
85103
histos.add("nFiredNBPperBoard", "nFiredNBPperBoard", kTH1F, {axisLocalBoards});
@@ -95,16 +113,62 @@ struct midEfficiency {
95113
histos.add("nFiredNBPperPlane", "nFiredNBPperPlane", kTH1F, {axisPlanes});
96114
histos.add("nFiredBothperPlane", "nFiredBothperPlane", kTH1F, {axisPlanes});
97115
histos.add("nTotperPlane", "nTotperPlane", kTH1F, {axisPlanes});
98-
// Track type for debug only
116+
// Centrality test
117+
histos.add("hCentr", "hCentr", kTH1F, {axisCent});
118+
119+
// Track type
99120
histos.add("hTrackType", "hTrackType", kTH1F, {axisTrackType});
100121

122+
// If this is true -> PbPb data, add THnSparse with centrality
123+
if (isPbPb) {
124+
// Local boards
125+
histos.add("hSparseCentFiredBPperBoard", "THn for centrality studies", HistType::kTHnSparseF, {axisLocalBoards, axisCent, axisPt, axisEta, axisPhi});
126+
histos.add("hSparseCentFiredNBPperBoard", "THn for centrality studies", HistType::kTHnSparseF, {axisLocalBoards, axisCent, axisPt, axisEta, axisPhi});
127+
histos.add("hSparseCentFiredBothperBoard", "THn for centrality studies", HistType::kTHnSparseF, {axisLocalBoards, axisCent, axisPt, axisEta, axisPhi});
128+
histos.add("hSparseCentFiredTotperBoard", "THn for centrality studies", HistType::kTHnSparseF, {axisLocalBoards, axisCent, axisPt, axisEta, axisPhi});
129+
130+
// RPCs
131+
histos.add("hSparseCentFiredBPperRPC", "THn for centrality studies", HistType::kTHnSparseF, {axisRPCs, axisCent, axisPt, axisEta, axisPhi});
132+
histos.add("hSparseCentFiredNBPperRPC", "THn for centrality studies", HistType::kTHnSparseF, {axisRPCs, axisCent, axisPt, axisEta, axisPhi});
133+
histos.add("hSparseCentFiredBothperRPC", "THn for centrality studies", HistType::kTHnSparseF, {axisRPCs, axisCent, axisPt, axisEta, axisPhi});
134+
histos.add("hSparseCentFiredTotperRPC", "THn for centrality studies", HistType::kTHnSparseF, {axisRPCs, axisCent, axisPt, axisEta, axisPhi});
135+
136+
// Planes
137+
histos.add("hSparseCentFiredBPperPlane", "THn for centrality studies", HistType::kTHnSparseF, {axisPlanes, axisCent, axisPt, axisEta, axisPhi});
138+
histos.add("hSparseCentFiredNBPperPlane", "THn for centrality studies", HistType::kTHnSparseF, {axisPlanes, axisCent, axisPt, axisEta, axisPhi});
139+
histos.add("hSparseCentFiredBothperPlane", "THn for centrality studies", HistType::kTHnSparseF, {axisPlanes, axisCent, axisPt, axisEta, axisPhi});
140+
histos.add("hSparseCentFiredTotperPlane", "THn for centrality studies", HistType::kTHnSparseF, {axisPlanes, axisCent, axisPt, axisEta, axisPhi});
141+
} else { // THnSparse without centrality in pp
142+
// Local boards
143+
histos.add("hSparseCentFiredBPperBoard", "THn for centrality studies", HistType::kTHnSparseF, {axisLocalBoards, axisPt, axisEta, axisPhi});
144+
histos.add("hSparseCentFiredNBPperBoard", "THn for centrality studies", HistType::kTHnSparseF, {axisLocalBoards, axisPt, axisEta, axisPhi});
145+
histos.add("hSparseCentFiredBothperBoard", "THn for centrality studies", HistType::kTHnSparseF, {axisLocalBoards, axisPt, axisEta, axisPhi});
146+
histos.add("hSparseCentFiredTotperBoard", "THn for centrality studies", HistType::kTHnSparseF, {axisLocalBoards, axisPt, axisEta, axisPhi});
147+
148+
// RPCs
149+
histos.add("hSparseCentFiredBPperRPC", "THn for centrality studies", HistType::kTHnSparseF, {axisRPCs, axisPt, axisEta, axisPhi});
150+
histos.add("hSparseCentFiredNBPperRPC", "THn for centrality studies", HistType::kTHnSparseF, {axisRPCs, axisPt, axisEta, axisPhi});
151+
histos.add("hSparseCentFiredBothperRPC", "THn for centrality studies", HistType::kTHnSparseF, {axisRPCs, axisPt, axisEta, axisPhi});
152+
histos.add("hSparseCentFiredTotperRPC", "THn for centrality studies", HistType::kTHnSparseF, {axisRPCs, axisPt, axisEta, axisPhi});
153+
154+
// Planes
155+
histos.add("hSparseCentFiredBPperPlane", "THn for centrality studies", HistType::kTHnSparseF, {axisPlanes, axisPt, axisEta, axisPhi});
156+
histos.add("hSparseCentFiredNBPperPlane", "THn for centrality studies", HistType::kTHnSparseF, {axisPlanes, axisPt, axisEta, axisPhi});
157+
histos.add("hSparseCentFiredBothperPlane", "THn for centrality studies", HistType::kTHnSparseF, {axisPlanes, axisPt, axisEta, axisPhi});
158+
histos.add("hSparseCentFiredTotperPlane", "THn for centrality studies", HistType::kTHnSparseF, {axisPlanes, axisPt, axisEta, axisPhi});
159+
}
101160
} // end of init
102161

103162
template <typename TEvent, typename Muons>
104-
void runMidEffCounters(TEvent const& /*event*/, Muons const& muons)
163+
void runMidEffCounters(TEvent const& event, Muons const& muons)
105164
{
106165
LOGF(debug, "Calling process function");
107166

167+
float cent = event.centFT0C();
168+
169+
if (isPbPb)
170+
histos.fill(HIST("hCentr"), cent); // Fill centrality histo
171+
108172
// Loop over all forward tracks
109173
for (auto& track : muons) {
110174

@@ -119,24 +183,49 @@ struct midEfficiency {
119183
auto rpcLine = o2::mid::detparams::getRPCLine(deIdMT11);
120184
auto effFlag = trk.getEfficiencyFlag();
121185

186+
float pt = track.pt();
187+
float eta = track.eta();
188+
float phi = track.phi();
189+
122190
if (effFlag < 0) {
123191
continue;
124192
}
125193

126194
// Loop on the four planes and fill histograms accordingly
127195
for (int ich = 0; ich < 4; ++ich) {
128196

197+
// Check if BP/NBP has been fired by the track
129198
bool isFiredBP = trk.isFiredChamber(ich, 0);
130199
bool isFiredNBP = trk.isFiredChamber(ich, 1);
200+
131201
// Plane
132-
// Fill all counts - plane
133-
histos.fill(HIST("nTotperPlane"), ich);
134-
if (isFiredBP)
202+
histos.fill(HIST("nTotperPlane"), ich); // All counts - plane
203+
if (isPbPb)
204+
histos.fill(HIST("hSparseCentFiredTotperPlane"), ich, cent, pt, eta, phi);
205+
else
206+
histos.fill(HIST("hSparseCentFiredTotperPlane"), ich, pt, eta, phi);
207+
208+
if (isFiredBP) {
135209
histos.fill(HIST("nFiredBPperPlane"), ich); // BP - Plane
136-
if (isFiredNBP)
210+
if (isPbPb)
211+
histos.fill(HIST("hSparseCentFiredBPperPlane"), ich, cent, pt, eta, phi);
212+
else
213+
histos.fill(HIST("hSparseCentFiredBPperPlane"), ich, pt, eta, phi);
214+
}
215+
if (isFiredNBP) {
137216
histos.fill(HIST("nFiredNBPperPlane"), ich); // NBP - Plane
138-
if (isFiredBP && isFiredNBP)
217+
if (isPbPb)
218+
histos.fill(HIST("hSparseCentFiredNBPperPlane"), ich, cent, pt, eta, phi);
219+
else
220+
histos.fill(HIST("hSparseCentFiredNBPperPlane"), ich, pt, eta, phi);
221+
}
222+
if (isFiredBP && isFiredNBP) {
139223
histos.fill(HIST("nFiredBothperPlane"), ich); // Both planes - plane
224+
if (isPbPb)
225+
histos.fill(HIST("hSparseCentFiredBothperPlane"), ich, cent, pt, eta, phi);
226+
else
227+
histos.fill(HIST("hSparseCentFiredBothperPlane"), ich, pt, eta, phi);
228+
}
140229

141230
if (effFlag < 2) {
142231
continue;
@@ -145,39 +234,80 @@ struct midEfficiency {
145234
// Get RPC id
146235
auto deId = o2::mid::detparams::getDEId(isRight, ich, rpcLine);
147236

148-
// Fill all counts - RPC
149-
histos.fill(HIST("nTotperRPC"), deId);
150-
if (isFiredBP)
237+
// RPC
238+
histos.fill(HIST("nTotperRPC"), deId); // All counts - RPC
239+
if (isPbPb)
240+
histos.fill(HIST("hSparseCentFiredTotperRPC"), deId, cent, pt, eta, phi);
241+
else
242+
histos.fill(HIST("hSparseCentFiredTotperRPC"), deId, pt, eta, phi);
243+
244+
if (isFiredBP) {
151245
histos.fill(HIST("nFiredBPperRPC"), deId); // BP - RPC
152-
if (isFiredNBP)
246+
if (isPbPb)
247+
histos.fill(HIST("hSparseCentFiredBPperRPC"), deId, cent, pt, eta, phi);
248+
else
249+
histos.fill(HIST("hSparseCentFiredBPperRPC"), deId, pt, eta, phi);
250+
}
251+
if (isFiredNBP) {
153252
histos.fill(HIST("nFiredNBPperRPC"), deId); // NBP - RPC
154-
if (isFiredBP && isFiredNBP)
253+
if (isPbPb)
254+
histos.fill(HIST("hSparseCentFiredNBPperRPC"), deId, cent, pt, eta, phi);
255+
else
256+
histos.fill(HIST("hSparseCentFiredNBPperRPC"), deId, pt, eta, phi);
257+
}
258+
if (isFiredBP && isFiredNBP) {
155259
histos.fill(HIST("nFiredBothperRPC"), deId); // Both planes - RPC
260+
if (isPbPb)
261+
histos.fill(HIST("hSparseCentFiredBothperRPC"), deId, cent, pt, eta, phi);
262+
else
263+
histos.fill(HIST("hSparseCentFiredNBPperRPC"), deId, pt, eta, phi);
264+
}
156265

157266
if (effFlag < 3) {
158267
continue;
159268
}
160269

270+
// Get fired column and line -> needed for LB calculation
271+
auto firedColumn = trk.getFiredColumnId();
272+
auto firedLine = trk.getFiredLineId();
161273
// Get LB ID
162-
auto firedColumn = trk.getFiredColumnId(); // Get fired column - needed for LB calculation
163-
auto firedLine = trk.getFiredLineId(); // Get fired line - needed for LB calculation
164-
165274
auto LB = ich * o2::mid::detparams::NLocalBoards + mapping.getBoardId(firedLine, firedColumn, deId);
166275

167-
histos.fill(HIST("nTotperBoard"), LB);
168-
169-
if (isFiredBP)
170-
histos.fill(HIST("nFiredBPperBoard"), LB);
171-
if (isFiredNBP)
172-
histos.fill(HIST("nFiredNBPperBoard"), LB);
173-
if (isFiredBP && isFiredNBP)
174-
histos.fill(HIST("nFiredBothperBoard"), LB);
276+
// LB
277+
histos.fill(HIST("nTotperBoard"), LB); // All counts - LB
278+
if (isPbPb)
279+
histos.fill(HIST("hSparseCentFiredTotperBoard"), LB, cent, pt, eta, phi);
280+
else
281+
histos.fill(HIST("hSparseCentFiredTotperBoard"), LB, pt, eta, phi);
282+
283+
if (isFiredBP) {
284+
histos.fill(HIST("nFiredBPperBoard"), LB); // BP - LB
285+
if (isPbPb)
286+
histos.fill(HIST("hSparseCentFiredBPperBoard"), LB, cent, pt, eta, phi);
287+
else
288+
histos.fill(HIST("hSparseCentFiredBPperBoard"), LB, pt, eta, phi);
289+
}
290+
if (isFiredNBP) {
291+
histos.fill(HIST("nFiredNBPperBoard"), LB); // NBP - LB
292+
if (isPbPb)
293+
histos.fill(HIST("hSparseCentFiredNBPperBoard"), LB, cent, pt, eta, phi);
294+
else
295+
histos.fill(HIST("hSparseCentFiredNBPperBoard"), LB, pt, eta, phi);
296+
}
297+
if (isFiredBP && isFiredNBP) {
298+
histos.fill(HIST("nFiredBothperBoard"), LB); // Both Planes - LB
299+
if (isPbPb)
300+
histos.fill(HIST("hSparseCentFiredBothperBoard"), LB, cent, pt, eta, phi);
301+
else
302+
histos.fill(HIST("hSparseCentFiredBothperBoard"), LB, pt, eta, phi);
303+
}
175304
}
176305
}
177306

178307
} // end of runMidEffCounters
179308

180-
void processMidEffCounter(aod::ReducedEvents::iterator const& event, soa::Filtered<MyMuonTracks> const& muons)
309+
// void processMidEffCounter(aod::ReducedEvents::iterator const& event, soa::Filtered<MyMuonTracks> const& muons)
310+
void processMidEffCounter(MyEvents::iterator const& event, soa::Filtered<MyMuonTracks> const& muons)
181311
{
182312
runMidEffCounters(event, muons); // call efficiency calculator function
183313
}

0 commit comments

Comments
 (0)