Skip to content

Commit 47aeff1

Browse files
committed
PWGHF modified task by comments
1 parent 2e7045f commit 47aeff1

File tree

1 file changed

+96
-82
lines changed

1 file changed

+96
-82
lines changed

PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx

Lines changed: 96 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
// In applying this license CERN does not waive the privileges and immunities
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
11-
/// \file taskElectronWeakNoson.cxx
12-
/// \briff task for WeakBoson (W/Z) based on electron in mid-rapidity
11+
12+
/// \file taskElectronWeakBoson.cxx
13+
/// \brief task for WeakBoson (W/Z) based on electron in mid-rapidity
1314
/// \author S. Sakai & S. Ito (Univ. of Tsukuba)
1415

1516
#include "Framework/runDataProcessing.h"
@@ -43,47 +44,54 @@ struct HfTaskElectronWeakBoson {
4344
// pp
4445
// using TrackEle = o2::soa::Filtered<o2::soa::Join<o2::aod::Tracks, o2::aod::FullTracks, o2::aod::TracksDCA, o2::aod::TrackSelection, o2::aod::pidTPCEl, o2::aod::pidTOFEl>>;
4546

46-
Preslice<o2::aod::EMCALClusterCells> perCluster = o2::aod::emcalclustercell::emcalclusterId;
47-
Preslice<o2::aod::EMCALAmbiguousClusterCells> perClusterAmb = o2::aod::emcalclustercell::emcalambiguousclusterId;
48-
PresliceUnsorted<o2::aod::EMCALMatchedTracks> perClusterMatchedTracks = o2::aod::emcalmatchedtrack::trackId;
47+
// configurable parameters
48+
Configurable<int> nBinsPt{"nBinsPt", 100, "N bins in pt registry"};
49+
Configurable<float> BinPtmax{"BinPtmax", 100.0, "maximum pt registry"};
50+
Configurable<int> nBinsE{"nBinsE", 100, "N bins in E registry"};
51+
Configurable<float> BinEmax{"BinEmax", 100.0, "maximum E registry"};
4952

50-
Configurable<int> nBinsPt{"nBinsPt", 100, "N bins in pt histo"};
51-
Configurable<int> nBinsE{"nBinsE", 100, "N bins in E histo"};
52-
53-
// event filter
54-
Filter eventFilter = (o2::aod::evsel::sel8 == true);
5553
Configurable<float> vtxZ{"vtxZ", 10.f, ""};
56-
Filter posZFilter = (nabs(o2::aod::collision::posZ) < vtxZ);
5754

58-
// track cuts
59-
Configurable<float> etalow{"etalow", -0.6f, ""};
60-
Configurable<float> etaup{"etaup", 0.6f, ""};
61-
Configurable<float> dcaxy_cut{"dcaxy_cut", 2.0f, ""};
62-
Configurable<float> mimpT_cut{"mimpT_cut", 3.0f, "minimum pT cut"};
55+
Configurable<float> etalow_cut{"etalow_cut", -0.6f, "eta lower cut"};
56+
Configurable<float> etaup_cut{"etaup_cut", 0.6f, "eta upper cut"};
57+
Configurable<float> dcaxy_cut{"dcaxy_cut", 2.0f, "dca xy cut"};
6358
Configurable<float> itschi2_cut{"itschi2_cut", 15.0f, "its chi2 cut"};
59+
Configurable<float> mimpT_cut{"mimpT_cut", 3.0f, "minimum pT cut"};
6460
Configurable<float> tpcchi2_cut{"tpcchi2_cut", 4.0f, "tpc chi2 cut"};
6561
Configurable<float> itsNcl_cut{"itsNcl_cut", 2.0f, "its # of cluster cut"};
6662
Configurable<float> tpcNcl_cut{"tpcNcl_cut", 100.0f, "tpc # if cluster cut"};
6763
Configurable<float> tpcNclCr_cut{"tpcNclCr_cut", 100.0f, "tpc # of crossedRows cut"};
64+
Configurable<float> tpcNsiglow_cut{"tpcNsiglow_cut", -1.0, "tpc Nsig lower cut"};
65+
Configurable<float> tpcNsigup_cut{"tpcNsigup_cut", 3.0, "tpc Nsig upper cut"};
6866

69-
Filter filter_globalTr = requireGlobalTrackInFilter();
70-
Filter etafilter = (aod::track::eta < etaup) && (aod::track::eta > etalow);
71-
Filter dcaxyfilter = (nabs(aod::track::dcaXY) < dcaxy_cut);
72-
73-
// cluster cut
67+
Configurable<float> emcacc_phimin{"emcacc_phimin", 1.39, "Maximum M20"};
68+
Configurable<float> emcacc_phimax{"emcacc_phimax", 3.36, "Maximum M20"};
7469
Configurable<int> mClusterDefinition{"mClusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"};
75-
Configurable<float> minTime{"minTime", -25., "Minimum cluster time for time cut"};
76-
Configurable<float> maxTime{"maxTime", +20., "Maximum cluster time for time cut"};
77-
Configurable<float> minM02{"minM02", 0.1, "Minimum M02 for M02 cut"};
78-
Configurable<float> maxM02{"maxM02", 0.9, "Maximum M02 for M02 cut"};
79-
Configurable<float> minM20{"minM20", 0.1, "Minimum M20 for M20 cut"};
80-
Configurable<float> maxM20{"maxM20", 0.6, "Maximum M20 for M20 cut"};
70+
Configurable<float> minTime{"minTime", -25., "Minimum cluster time"};
71+
Configurable<float> maxTime{"maxTime", +20., "Maximum cluster time"};
72+
Configurable<float> minM02{"minM02", 0.1, "Minimum M02"};
73+
Configurable<float> maxM02{"maxM02", 0.9, "Maximum M02"};
74+
Configurable<float> minM20{"minM20", 0.1, "Minimum M20"};
75+
Configurable<float> maxM20{"maxM20", 0.6, "Maximum M20"};
8176
Configurable<float> MatchR_cut{"MatchR_cut", 0.1, "cluster - track matching cut"};
8277

78+
// Filter
79+
Filter eventFilter = (o2::aod::evsel::sel8 == true);
80+
Filter posZFilter = (nabs(o2::aod::collision::posZ) < vtxZ);
81+
82+
Filter etafilter = (aod::track::eta < etaup_cut) && (aod::track::eta > etalow_cut);
83+
Filter dcaxyfilter = (nabs(aod::track::dcaXY) < dcaxy_cut);
84+
Filter filter_globalTr = requireGlobalTrackInFilter();
85+
8386
Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == mClusterDefinition) && (o2::aod::emcalcluster::time >= minTime) && (o2::aod::emcalcluster::time <= maxTime) && (o2::aod::emcalcluster::m02 > minM02) && (o2::aod::emcalcluster::m02 < maxM02);
8487

85-
// Histogram registry: an object to hold your histograms
86-
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
88+
// Data Handling Objects
89+
Preslice<o2::aod::EMCALClusterCells> perCluster = o2::aod::emcalclustercell::emcalclusterId;
90+
Preslice<o2::aod::EMCALAmbiguousClusterCells> perClusterAmb = o2::aod::emcalclustercell::emcalambiguousclusterId;
91+
PresliceUnsorted<o2::aod::EMCALMatchedTracks> perClusterMatchedTracks = o2::aod::emcalmatchedtrack::trackId;
92+
93+
// Histogram registry: an object to hold your registrygrams
94+
HistogramRegistry registry{"registry"};
8795

8896
void init(InitContext const&)
8997
{
@@ -92,9 +100,9 @@ struct HfTaskElectronWeakBoson {
92100
const AxisSpec axisZvtx{400, -20, 20, "Zvtx"};
93101
const AxisSpec axisCounter{1, 0, 1, "events"};
94102
const AxisSpec axisEta{200, -1.0, 1.0, "#eta"};
95-
const AxisSpec axisPt{nBinsPt, 0, 10, "p_{T}"};
103+
const AxisSpec axisPt{nBinsPt, 0, BinPtmax, "p_{T}"};
96104
const AxisSpec axisNsigma{100, -5, 5, "N#sigma"};
97-
const AxisSpec axisE{nBinsE, 0, 10, "Energy"};
105+
const AxisSpec axisE{nBinsE, 0, BinEmax, "Energy"};
98106
const AxisSpec axisM02{100, 0, 1, "M02"};
99107
const AxisSpec axisdPhi{200, -1, 1, "dPhi"};
100108
const AxisSpec axisdEta{200, -1, 1, "dEta"};
@@ -105,51 +113,51 @@ struct HfTaskElectronWeakBoson {
105113
const AxisSpec axisITSNCls{20, 0.0, 20, "counts"};
106114
const AxisSpec axisEMCtime{200, -100.0, 100, "EMC time"};
107115

108-
// create histograms
109-
histos.add("ZvtxHistogram", "ZvtxHistogram", kTH1F, {axisZvtx});
110-
histos.add("hEventCounter", "hEventCounter", kTH1F, {axisCounter});
111-
histos.add("ITS_Chi2_Hist", "ITS #chi^{2} Hist", kTH1F, {axisChi2});
112-
histos.add("TPC_Chi2_Hist", "TPC #chi^{2} Hist", kTH1F, {axisChi2});
113-
histos.add("TPC_NCls_Hist", "TPC_NCls_Hist", kTH1F, {axisCluster});
114-
histos.add("ITS_NCls_Hist", "ITS_NCls_Hist", kTH1F, {axisITSNCls});
115-
histos.add("TPC_NClsCrossedRows_Hist", "TPC_NClsCrossedRows_Hist", kTH1F, {axisCluster});
116-
histos.add("etaHistogram", "etaHistogram", kTH1F, {axisEta});
117-
histos.add("ptHistogram", "ptHistogram", kTH1F, {axisPt});
118-
histos.add("TPCElHistogram", "TPCElHistogram", kTH2F, {{axisPt}, {axisNsigma}});
119-
histos.add("EnergyHistogram", "EnergyHistogram", kTH1F, {axisE});
120-
histos.add("M02Histogram", "M02Histogram", kTH2F, {{axisNsigma}, {axisM02}});
121-
histos.add("M20Histogram", "M20Histogram", kTH2F, {{axisNsigma}, {axisM02}});
122-
histos.add("TrMatchHistogram", "TrMatchHistogram", kTH2F, {{axisdPhi}, {axisdEta}});
123-
histos.add("TrMatchHistogram_mim", "TrMatchHistogram_mim", kTH2F, {{axisdPhi}, {axisdEta}});
124-
histos.add("MatchPhiHistogram", "MatchPhiHistogram", kTH2F, {{axisPhi}, {axisPhi}});
125-
histos.add("MatchEtaHistogram", "MatchEtaHistogram", kTH2F, {{axisEta}, {axisEta}});
126-
histos.add("EopHistogram", "EopHistogram", kTH2F, {{axisPt}, {axisEop}});
127-
histos.add("EopNsigTPCHistogram", "EopNsigTPCHistogram", kTH2F, {{axisNsigma}, {axisEop}});
128-
histos.add("EMCtimeHistogram", "EMCtimeHistogram", kTH1F, {axisEMCtime});
116+
// create registrygrams
117+
registry.add("hZvtx", "Z vertex", kTH1F, {axisZvtx});
118+
registry.add("hEventCounter", "hEventCounter", kTH1F, {axisCounter});
119+
registry.add("hITS_Chi2", "ITS #chi^{2}", kTH1F, {axisChi2});
120+
registry.add("hTPC_Chi2", "TPC #chi^{2}", kTH1F, {axisChi2});
121+
registry.add("hTPC_NCls", "TPC NCls", kTH1F, {axisCluster});
122+
registry.add("hITS_NCls", "ITS NCls", kTH1F, {axisITSNCls});
123+
registry.add("hTPC_NClsCrossedRows", "TPC NClsCrossedRows", kTH1F, {axisCluster});
124+
registry.add("hEta", "track eta", kTH1F, {axisEta});
125+
registry.add("hPt", "track pt", kTH1F, {axisPt});
126+
registry.add("hTPCNsigma", "TPC electron Nsigma", kTH2F, {{axisPt}, {axisNsigma}});
127+
registry.add("hEnergy", "EMC cluster energy", kTH1F, {axisE});
128+
registry.add("hM02", "EMC M02", kTH2F, {{axisNsigma}, {axisM02}});
129+
registry.add("hM20", "EMC M20", kTH2F, {{axisNsigma}, {axisM02}});
130+
registry.add("hTrMatch", "Track EMC Match", kTH2F, {{axisdPhi}, {axisdEta}});
131+
registry.add("hTrMatch_mim", "Track EMC Match minimu minimumm", kTH2F, {{axisdPhi}, {axisdEta}});
132+
registry.add("hMatchPhi", "Match in Phi", kTH2F, {{axisPhi}, {axisPhi}});
133+
registry.add("hMatchEta", "Match in Eta", kTH2F, {{axisEta}, {axisEta}});
134+
registry.add("hEop", "energy momentum match", kTH2F, {{axisPt}, {axisEop}});
135+
registry.add("hEopNsigTPC", "Eop vs. Nsigma", kTH2F, {{axisNsigma}, {axisEop}});
136+
registry.add("hEMCtime", "EMC timing", kTH1F, {axisEMCtime});
129137
}
130138

131139
// void process(soa::Filtered<aod::Collisions>::iterator const& collision, SelectedClusters const& clusters, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks)
132140
void process(soa::Filtered<aod::Collisions>::iterator const& collision, SelectedClusters const& emcClusters, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks)
133141
{
134-
histos.fill(HIST("hEventCounter"), 0.5);
142+
registry.fill(HIST("hEventCounter"), 0.5);
135143

136144
// LOGF(info, "Collision index : %d", collision.index());
137145
// LOGF(info, "Number of tracks: %d", tracks.size());
138146
// LOGF(info, "Number of clusters: %d", clusters.size());
139147
// LOGF(info, "Number of clusters: %d", emcClusters.size());
140148

141-
histos.fill(HIST("ZvtxHistogram"), collision.posZ());
149+
registry.fill(HIST("hZvtx"), collision.posZ());
142150

143151
for (const auto& track : tracks) {
144152

145-
histos.fill(HIST("etaHistogram"), track.eta());
146-
histos.fill(HIST("ITS_Chi2_Hist"), track.itsChi2NCl());
147-
histos.fill(HIST("TPC_Chi2_Hist"), track.tpcChi2NCl());
148-
histos.fill(HIST("TPC_NCls_Hist"), track.tpcNClsFound());
149-
histos.fill(HIST("ITS_NCls_Hist"), track.itsNCls());
150-
histos.fill(HIST("TPC_NClsCrossedRows_Hist"), track.tpcNClsCrossedRows());
153+
registry.fill(HIST("hEta"), track.eta());
154+
registry.fill(HIST("hITS_Chi2"), track.itsChi2NCl());
155+
registry.fill(HIST("hTPC_Chi2"), track.tpcChi2NCl());
156+
registry.fill(HIST("hTPC_NCls"), track.tpcNClsFound());
157+
registry.fill(HIST("hITS_NCls"), track.itsNCls());
158+
registry.fill(HIST("hTPC_NClsCrossedRows"), track.tpcNClsCrossedRows());
151159

152-
if (std::abs(track.eta()) > etaup)
160+
if (std::abs(track.eta()) > etaup_cut)
153161
continue;
154162
if (track.tpcNClsCrossedRows() < tpcNclCr_cut)
155163
continue;
@@ -165,14 +173,14 @@ struct HfTaskElectronWeakBoson {
165173
continue;
166174
if (track.pt() < mimpT_cut)
167175
continue;
168-
histos.fill(HIST("ptHistogram"), track.pt());
169-
histos.fill(HIST("TPCElHistogram"), track.p(), track.tpcNSigmaEl());
176+
registry.fill(HIST("hPt"), track.pt());
177+
registry.fill(HIST("hTPCNsigma"), track.p(), track.tpcNSigmaEl());
170178

171179
// track - match
172180

173-
if (emcClusters.size() < 1)
181+
if (!emcClusters.size())
174182
continue;
175-
if (track.phi() < 1.39 || track.phi() > 3.15)
183+
if (track.phi() < emcacc_phimin || track.phi() > emcacc_phimax)
176184
continue;
177185
auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, track.globalIndex());
178186

@@ -182,59 +190,65 @@ struct HfTaskElectronWeakBoson {
182190
double dPhi_mim = 999.9;
183191
double dEta_mim = 999.9;
184192

185-
if (tracksofcluster.size() > 0) {
193+
if (tracksofcluster.size()) {
186194
int nmatch = 0;
187195
for (const auto& match : tracksofcluster) {
188196
if (match.emcalcluster_as<SelectedClusters>().time() < minTime || match.emcalcluster_as<SelectedClusters>().time() > maxTime)
189197
continue;
190198
if (match.emcalcluster_as<SelectedClusters>().m02() < minM02 || match.emcalcluster_as<SelectedClusters>().m02() > maxM02)
191199
continue;
192200

193-
double emc_m20 = match.emcalcluster_as<SelectedClusters>().m20();
194-
double emc_m02 = match.emcalcluster_as<SelectedClusters>().m02();
195-
double emc_energy = match.emcalcluster_as<SelectedClusters>().energy();
201+
float emc_m20 = match.emcalcluster_as<SelectedClusters>().m20();
202+
float emc_m02 = match.emcalcluster_as<SelectedClusters>().m02();
203+
float emc_energy = match.emcalcluster_as<SelectedClusters>().energy();
196204
double emc_phi = match.emcalcluster_as<SelectedClusters>().phi();
197205
double emc_eta = match.emcalcluster_as<SelectedClusters>().eta();
198206
double emc_time = match.emcalcluster_as<SelectedClusters>().time();
199207
// LOG(info) << "tr phi0 = " << match.track_as<TrackEle>().phi();
200208
// LOG(info) << "tr phi1 = " << track.phi();
201209
// LOG(info) << "emc phi = " << emc_phi;
202210
if (nmatch == 0) {
203-
double dPhi = match.track_as<TrackEle>().phi() - emc_phi;
204211
double dEta = match.track_as<TrackEle>().eta() - emc_eta;
212+
double dPhi = match.track_as<TrackEle>().phi() - emc_phi;
213+
if (dPhi > o2::constants::math::PI) {
214+
dPhi -= 2 * o2::constants::math::PI;
215+
} else if (dPhi < -o2::constants::math::PI) {
216+
dPhi += 2 * o2::constants::math::PI;
217+
}
205218

206-
histos.fill(HIST("MatchPhiHistogram"), emc_phi, match.track_as<TrackEle>().phi());
207-
histos.fill(HIST("MatchEtaHistogram"), emc_eta, match.track_as<TrackEle>().eta());
219+
registry.fill(HIST("hMatchPhi"), emc_phi, match.track_as<TrackEle>().phi());
220+
registry.fill(HIST("hMatchEta"), emc_eta, match.track_as<TrackEle>().eta());
208221

209-
double R = sqrt(pow(dPhi, 2) + pow(dEta, 2));
222+
double R = std::sqrt(std::pow(dPhi, 2) + std::pow(dEta, 2));
210223
if (R < Rmim) {
211224
Rmim = R;
212225
dPhi_mim = dPhi;
213226
dEta_mim = dEta;
214227
}
215-
histos.fill(HIST("TrMatchHistogram"), dPhi, dEta);
216-
histos.fill(HIST("EMCtimeHistogram"), emc_time);
228+
registry.fill(HIST("hTrMatch"), dPhi, dEta);
229+
registry.fill(HIST("hEMCtime"), emc_time);
230+
registry.fill(HIST("hEnergy"), emc_energy);
217231

218232
if (R < MatchR_cut)
219233
continue;
220234

221235
double eop = emc_energy / match.track_as<TrackEle>().p();
222236
// LOG(info) << "E/p" << eop;
223-
histos.fill(HIST("EopNsigTPCHistogram"), match.track_as<TrackEle>().tpcNSigmaEl(), eop);
224-
histos.fill(HIST("M02Histogram"), match.track_as<TrackEle>().tpcNSigmaEl(), emc_m02);
225-
histos.fill(HIST("M20Histogram"), match.track_as<TrackEle>().tpcNSigmaEl(), emc_m20);
226-
if (match.track_as<TrackEle>().tpcNSigmaEl() > -1.0 && match.track_as<TrackEle>().tpcNSigmaEl() < 3) {
227-
histos.fill(HIST("EopHistogram"), match.track_as<TrackEle>().pt(), eop);
237+
registry.fill(HIST("hEopNsigTPC"), match.track_as<TrackEle>().tpcNSigmaEl(), eop);
238+
registry.fill(HIST("hM02"), match.track_as<TrackEle>().tpcNSigmaEl(), emc_m02);
239+
registry.fill(HIST("hM20"), match.track_as<TrackEle>().tpcNSigmaEl(), emc_m20);
240+
if (match.track_as<TrackEle>().tpcNSigmaEl() > tpcNsiglow_cut && match.track_as<TrackEle>().tpcNSigmaEl() < tpcNsigup_cut) {
241+
registry.fill(HIST("hEop"), match.track_as<TrackEle>().pt(), eop);
228242
}
229243
}
230244

231245
nmatch++;
232246
}
233247
}
234248

235-
if (Rmim < 10.0) {
249+
if (Rmim < MatchR_cut) {
236250
// LOG(info) << "R mim = " << Rmim;
237-
histos.fill(HIST("TrMatchHistogram_mim"), dPhi_mim, dEta_mim);
251+
registry.fill(HIST("hTrMatch_mim"), dPhi_mim, dEta_mim);
238252
}
239253

240254
} // end of track loop

0 commit comments

Comments
 (0)