Skip to content

Commit b9593e9

Browse files
authored
Add Tof information Correlation without Emcal
Added TOF information to the correlation without requiring EMCAL. In addition, a downscale factor has been implemented in order to reduce memory usage during the analysis.
1 parent 5024759 commit b9593e9

File tree

1 file changed

+66
-15
lines changed

1 file changed

+66
-15
lines changed

PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx

Lines changed: 66 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
#include <Framework/InitContext.h>
3737
#include <Framework/runDataProcessing.h>
3838

39+
#include <TRandom3.h>
40+
3941
#include <cstdint>
4042
#include <vector>
4143

@@ -45,6 +47,7 @@ using namespace o2::framework::expressions;
4547
using namespace o2::soa;
4648
using namespace o2::aod::hf_sel_electron;
4749

50+
TRandom3* rnd = new TRandom3(0);
4851
std::vector<double> zBins{VARIABLE_WIDTH, -10.0, -2.5, 2.5, 10.0};
4952
std::vector<double> multBins{VARIABLE_WIDTH, 0., 200., 500.0, 5000.};
5053
std::vector<double> multBinsMcGen{VARIABLE_WIDTH, 0., 20., 50.0, 500.}; // In MCGen multiplicity is defined by counting primaries
@@ -69,10 +72,18 @@ struct HfCorrelatorHfeHadrons {
6972
Configurable<float> etaTrackMin{"etaTrackMin", -0.8f, "Eta range for associated hadron tracks"};
7073
Configurable<float> dcaXYTrackMax{"dcaXYTrackMax", 0.5f, "DCA XY cut"};
7174
Configurable<float> dcaZTrackMax{"dcaZTrackMax", 1.0f, "DCA Z cut"};
75+
Configurable<bool> requireEmcal{"requireEmcal", true, "Require electron to be in EMCal"};
76+
77+
// Sigma cut for non-EMCal electrons
78+
Configurable<float> tofNSigmaEl{"tofNSigmaEl", 3.0, "Sigma cut for electrons not in EMCal"};
79+
Configurable<float> tpcNsigmaElectronMin{"tpcNsigmaElectronMin", -0.5f, "min Electron TPCnsigma"};
80+
Configurable<float> tpcNsigmaElectronMax{"tpcNsigmaElectronMax", 3.0f, "max Electron TPCnsigma"};
7281

7382
// Electron hadron correlation condition
7483
Configurable<bool> ptCondition{"ptCondition", true, "Electron pT should be greater than associate particle pT"};
7584

85+
Configurable<float> eventFractionToAnalyze{"eventFractionToAnalyze", -1, "Fraction of events to analyze (use only for ME offline on very large samples)"};
86+
7687
SliceCache cache;
7788
using TableCollisions = o2::soa::Filtered<o2::soa::Join<aod::Collisions, aod::Mults, aod::EvSels>>;
7889
using TableCollision = TableCollisions::iterator;
@@ -87,25 +98,33 @@ struct HfCorrelatorHfeHadrons {
8798
Preslice<aod::Tracks> perCol = aod::track::collisionId;
8899
Preslice<aod::HfSelEl> perCollision = aod::hf_sel_electron::collisionId;
89100

101+
ConfigurableAxis binsPosZ{"binsPosZ", {100, -10., 10.}, "primary vertex z coordinate"};
90102
ConfigurableAxis binsDeltaEta{"binsDeltaEta", {30, -1.8, 1.8}, "#it{#Delta#eta}"};
91103
ConfigurableAxis binsDeltaPhi{"binsDeltaPhi", {32, -o2::constants::math::PIHalf, 3. * o2::constants::math::PIHalf}, "#it{#Delta#varphi}"};
92104
ConfigurableAxis binsPt{"binsPt", {50, 0.0, 50}, "#it{p_{T}}(GeV/#it{c})"};
93105
ConfigurableAxis binsPoolBin{"binsPoolBin", {9, 0., 9.}, "PoolBin"};
94-
106+
ConfigurableAxis binsnSigma{"binsnSigma", {30, -15., 15.}, "#it{#sigma_{TPC}}"};
95107
HistogramRegistry registry{
96108
"registry",
97109
{}};
98110

99111
void init(InitContext&)
100112
{
113+
AxisSpec axisPosZ = {binsPosZ, "Pos Z"};
101114
AxisSpec axisDeltaEta = {binsDeltaEta, "#Delta #eta = #eta_{Electron}- #eta_{Hadron}"};
102115
AxisSpec axisDeltaPhi = {binsDeltaPhi, "#Delta #varphi = #varphi_{Electron}- #varphi_{Hadron}"};
103116
AxisSpec axisPt = {binsPt, "#it{p_{T}}(GeV/#it{c})"};
104117
AxisSpec axisPoolBin = {binsPoolBin, "PoolBin"};
118+
AxisSpec axisnSigma = {binsnSigma, "it{#sigma_{TPC}}"};
105119

120+
registry.add("hZvertex", "z vertex", {HistType::kTH1D, {axisPosZ}});
121+
registry.add("hNevents", "No of events", {HistType::kTH1D, {{3, 1, 4}}});
106122
registry.add("hInclusiveEHCorrel", "Sparse for Delta phi and Delta eta Inclusive Electron with Hadron;p_{T}^{e} (GeV#it{/c});p_{T}^{h} (GeV#it{/c});#Delta#varphi;#Delta#eta;", {HistType::kTHnSparseF, {{axisPt}, {axisPt}, {axisDeltaPhi}, {axisDeltaEta}}});
107123
registry.add("hLSEHCorrel", "Sparse for Delta phi and Delta eta Like sign Electron pair with Hadron;p_{T}^{e} (GeV#it{/c});p_{T}^{h} (GeV#it{/c});#Delta#varphi;#Delta#eta;", {HistType::kTHnSparseF, {{axisPt}, {axisPt}, {axisDeltaPhi}, {axisDeltaEta}}});
108124
registry.add("hULSEHCorrel", "Sparse for Delta phi and Delta eta UnLike sign Electron pair with Hadron;p_{T}^{e} (GeV#it{/c});p_{T}^{h} (GeV#it{/c});#Delta#varphi;#Delta#eta;", {HistType::kTHnSparseF, {{axisPt}, {axisPt}, {axisDeltaPhi}, {axisDeltaEta}}});
125+
registry.add("hTofnSigmaVsP", " Tof nSigma info vs P; n#sigma;#it{p} (GeV#it{/c});passEMcal;", {HistType::kTH2F, {{axisnSigma}, {axisPt}}});
126+
registry.add("hTpcnSigmaVsP", " TPC nSigma info vs P; n#sigma;#it{p} (GeV#it{/c});passEMcal;", {HistType::kTH2F, {{axisnSigma}, {axisPt}}});
127+
109128
registry.add("hMCgenNonHfEHCorrel", "Sparse for Delta phi and Delta eta for McGen Non Hf Electron with Hadron;p_{T}^{e} (GeV#it{/c});p_{T}^{h} (GeV#it{/c});#Delta#varphi;#Delta#eta;", {HistType::kTHnSparseF, {{axisPt}, {axisPt}, {axisDeltaPhi}, {axisDeltaEta}}});
110129
registry.add("hMCgenInclusiveEHCorrl", "Sparse for Delta phi and Delta eta for McGen Electron pair with Hadron;p_{T}^{e} (GeV#it{/c});p_{T}^{h} (GeV#it{/c});#Delta#varphi;#Delta#eta;", {HistType::kTHnSparseF, {{axisPt}, {axisPt}, {axisDeltaPhi}, {axisDeltaEta}}});
111130
registry.add("hptElectron", "hptElectron", {HistType::kTH1D, {axisPt}});
@@ -155,14 +174,25 @@ struct HfCorrelatorHfeHadrons {
155174
int gCollisionId = collision.globalIndex();
156175
int64_t timeStamp = bc.timestamp();
157176

177+
bool skipEventTableFilling = false;
178+
if (eventFractionToAnalyze > 0) {
179+
if (rnd->Uniform(0, 1) > eventFractionToAnalyze) {
180+
skipEventTableFilling = true;
181+
}
182+
}
183+
184+
registry.fill(HIST("hNevents"), 1);
158185
// Add hadron Table For Mix Event Electron Hadron correlation
159-
for (const auto& hTrack : tracks) {
160-
if (!selAssoHadron(hTrack)) {
161-
continue;
186+
if (!skipEventTableFilling) {
187+
registry.fill(HIST("hZvertex"), collision.posZ());
188+
for (const auto& hTrack : tracks) {
189+
if (!selAssoHadron(hTrack)) {
190+
continue;
191+
}
192+
registry.fill(HIST("hTracksBin"), poolBin);
193+
registry.fill(HIST("hptHadron"), hTrack.pt());
194+
entryHadron(hTrack.phi(), hTrack.eta(), hTrack.pt(), poolBin, gCollisionId, timeStamp);
162195
}
163-
registry.fill(HIST("hTracksBin"), poolBin);
164-
registry.fill(HIST("hptHadron"), hTrack.pt());
165-
entryHadron(hTrack.phi(), hTrack.eta(), hTrack.pt(), poolBin, gCollisionId, timeStamp);
166196
}
167197

168198
// Construct Deta Phi between electrons and hadrons
@@ -175,16 +205,35 @@ struct HfCorrelatorHfeHadrons {
175205
ptElectron = eTrack.ptTrack();
176206
phiElectron = eTrack.phiTrack();
177207
etaElectron = eTrack.etaTrack();
208+
bool acceptElectron = false;
178209

179210
double deltaPhi = -999;
180211
double deltaEta = -999;
181212
double ptHadron = -999;
182213
double etaHadron = -999;
183214
double phiHadron = -999;
184-
185-
if (!eTrack.isEmcal()) {
186-
continue;
215+
if (eTrack.isEmcal()) {
216+
// EMCal electron
217+
if (requireEmcal) {
218+
acceptElectron = true;
219+
}
220+
} else {
221+
// Non-EMCal electron
222+
if (!requireEmcal) {
223+
// Apply sigma cut
224+
if (std::abs(eTrack.tofNSigmaElTrack()) < tofNSigmaEl) {
225+
if (eTrack.tpcNSigmaElTrack() > tpcNsigmaElectronMin && eTrack.tpcNSigmaElTrack() < tpcNsigmaElectronMax) {
226+
registry.fill(HIST("hTofnSigmaVsP"), eTrack.tofNSigmaElTrack(), eTrack.ptTrack());
227+
registry.fill(HIST("hTpcnSigmaVsP"), eTrack.tpcNSigmaElTrack(), eTrack.ptTrack());
228+
acceptElectron = true;
229+
}
230+
}
231+
}
187232
}
233+
234+
if (!acceptElectron)
235+
continue; // skip electron if not passing criteria
236+
188237
registry.fill(HIST("hptElectron"), ptElectron);
189238
int nElectronLS = 0;
190239
int nElectronUS = 0;
@@ -203,8 +252,10 @@ struct HfCorrelatorHfeHadrons {
203252
}
204253
}
205254

206-
registry.fill(HIST("hElectronBin"), poolBin);
207-
entryElectron(phiElectron, etaElectron, ptElectron, nElectronLS, nElectronUS, poolBin, gCollisionId, timeStamp);
255+
if (!skipEventTableFilling) {
256+
registry.fill(HIST("hElectronBin"), poolBin);
257+
entryElectron(phiElectron, etaElectron, ptElectron, nElectronLS, nElectronUS, poolBin, gCollisionId, timeStamp);
258+
}
208259

209260
for (const auto& hTrack : tracks) {
210261
// Apply Hadron cut
@@ -317,7 +368,7 @@ struct HfCorrelatorHfeHadrons {
317368
fillCorrelation(collision, electron, tracks, bc);
318369
}
319370

320-
PROCESS_SWITCH(HfCorrelatorHfeHadrons, processData, "Process for Data", false);
371+
PROCESS_SWITCH(HfCorrelatorHfeHadrons, processData, "Process for Data", true);
321372

322373
// ======= Process starts for McRec, Same event ============
323374

@@ -402,7 +453,7 @@ struct HfCorrelatorHfeHadrons {
402453
}
403454
}
404455
}
405-
PROCESS_SWITCH(HfCorrelatorHfeHadrons, processMcGen, "Process MC Gen mode", true);
456+
PROCESS_SWITCH(HfCorrelatorHfeHadrons, processMcGen, "Process MC Gen mode", false);
406457
// ====================== Implement Event mixing on Data ===============================
407458

408459
// ====================== Implement Event mixing on Data ===================================
@@ -485,7 +536,7 @@ struct HfCorrelatorHfeHadrons {
485536
}
486537
}
487538
}
488-
PROCESS_SWITCH(HfCorrelatorHfeHadrons, processMcGenMixedEvent, "Process Mixed Event MC Gen mode", true);
539+
PROCESS_SWITCH(HfCorrelatorHfeHadrons, processMcGenMixedEvent, "Process Mixed Event MC Gen mode", false);
489540
};
490541
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
491542
{

0 commit comments

Comments
 (0)