Skip to content

Commit dfe033a

Browse files
committed
PWGHF updated by following coding develop guidelines
1 parent ba2a45f commit dfe033a

File tree

1 file changed

+75
-77
lines changed

1 file changed

+75
-77
lines changed

PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx

Lines changed: 75 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717
#include "Framework/AnalysisTask.h"
1818
#include "Framework/ASoAHelpers.h"
1919

20-
#include "Common/DataModel/EventSelection.h"
21-
#include "Common/DataModel/TrackSelectionTables.h"
22-
#include "Common/DataModel/PIDResponse.h"
23-
2420
#include "EMCALBase/Geometry.h"
2521
#include "EMCALCalib/BadChannelMap.h"
2622

2723
#include "DataFormatsEMCAL/Cell.h"
2824
#include "DataFormatsEMCAL/Constants.h"
2925
#include "DataFormatsEMCAL/AnalysisCluster.h"
3026

27+
#include "Common/DataModel/EventSelection.h"
28+
#include "Common/DataModel/TrackSelectionTables.h"
29+
#include "Common/DataModel/PIDResponse.h"
30+
3131
#include "PWGJE/DataModel/EMCALClusters.h"
3232

3333
using namespace o2;
@@ -36,14 +36,6 @@ using namespace o2::framework::expressions;
3636

3737
struct HfTaskElectronWeakBoson {
3838

39-
using SelectedClusters = o2::aod::EMCALClusters;
40-
41-
// PbPb
42-
using TrackEle = o2::soa::Join<o2::aod::Tracks, o2::aod::FullTracks, o2::aod::TracksExtra, o2::aod::TracksDCA, o2::aod::TrackSelection, o2::aod::pidTPCFullEl>;
43-
44-
// pp
45-
// 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>>;
46-
4739
// configurable parameters
4840
Configurable<int> nBinsPt{"nBinsPt", 100, "N bins in pt registry"};
4941
Configurable<float> BinPtmax{"BinPtmax", 100.0, "maximum pt registry"};
@@ -52,38 +44,43 @@ struct HfTaskElectronWeakBoson {
5244

5345
Configurable<float> vtxZ{"vtxZ", 10.f, ""};
5446

55-
Configurable<float> etalowCut{"etalowCut", -0.6f, "eta lower cut"};
56-
Configurable<float> etaupCut{"etaupCut", 0.6f, "eta upper cut"};
57-
Configurable<float> dcaxyCut{"dcaxyCut", 2.0f, "dca xy cut"};
58-
Configurable<float> itschi2Cut{"itschi2Cut", 15.0f, "its chi2 cut"};
59-
Configurable<float> mimpTCut{"mimpTCut", 3.0f, "minimum pT cut"};
60-
Configurable<float> tpcchi2Cut{"tpcchi2Cut", 4.0f, "tpc chi2 cut"};
61-
Configurable<float> itsNclCut{"itsNclCut", 2.0f, "its # of cluster cut"};
62-
Configurable<float> tpcNclCut{"tpcNclCut", 100.0f, "tpc # if cluster cut"};
63-
Configurable<float> tpcNclCrCut{"tpcNclCrCut", 100.0f, "tpc # of crossedRows cut"};
64-
Configurable<float> tpcNsiglowCut{"tpcNsiglowCut", -1.0, "tpc Nsig lower cut"};
65-
Configurable<float> tpcNsigupCut{"tpcNsigupCut", 3.0, "tpc Nsig upper cut"};
66-
67-
Configurable<float> emcaccPhimin{"emcaccPhimin", 1.39, "Maximum M20"};
68-
Configurable<float> emcaccPhimax{"emcaccPhimax", 3.36, "Maximum M20"};
69-
Configurable<int> ClusterDefinition{"ClusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"};
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"};
76-
Configurable<float> MatchRCut{"MatchRCut", 0.1, "cluster - track matching cut"};
47+
Configurable<float> etaTrLow{"etaTrLow", -0.6f, "minimun track eta"};
48+
Configurable<float> etaTrUp{"etaTrUp", 0.6f, "maximum track eta"};
49+
Configurable<float> dcaxyMax{"dcaxyMax", 2.0f, "mximum DCA xy"};
50+
Configurable<float> chi2ItsMax{"chi2ItsMax", 15.0f, "its chi2 cut"};
51+
Configurable<float> ptMin{"ptMin", 3.0f, "minimum pT cut"};
52+
Configurable<float> chi2TpcMax{"chi2TpcMax", 4.0f, "tpc chi2 cut"};
53+
Configurable<float> nclItsMin{"nclItsMin", 2.0f, "its # of cluster cut"};
54+
Configurable<float> nclTpcMin{"nclTpcMin", 100.0f, "tpc # if cluster cut"};
55+
Configurable<float> nclcrossTpcMin{"nclcrossTpcMin", 100.0f, "tpc # of crossedRows cut"};
56+
Configurable<float> nsigTpcMin{"nsigTpcMin", -1.0, "tpc Nsig lower cut"};
57+
Configurable<float> nsigTpcMax{"nsigTpcMax", 3.0, "tpc Nsig upper cut"};
58+
59+
Configurable<float> phiEmcMin{"phiEmcMin", 1.39, "EMC phi acc min"};
60+
Configurable<float> phiEmcMax{"phiEmcMax", 3.36, "EMC phi acc max"};
61+
Configurable<int> clusterDefinition{"clusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"};
62+
Configurable<float> timeEmcMin{"timeEmcMin", -25., "Minimum EMCcluster timing"};
63+
Configurable<float> timeEmcMax{"timeEmcMax", +20., "Maximum EMCcluster timing"};
64+
Configurable<float> m02Min{"m02Min", 0.1, "Minimum M02"};
65+
Configurable<float> m02Max{"m02Max", 0.9, "Maximum M02"};
66+
Configurable<float> rMatchMax{"rMatchMax", 0.1, "cluster - track matching cut"};
67+
68+
using SelectedClusters = o2::aod::EMCALClusters;
69+
// PbPb
70+
using TrackEle = o2::soa::Join<o2::aod::Tracks, o2::aod::FullTracks, o2::aod::TracksExtra, o2::aod::TracksDCA, o2::aod::TrackSelection, o2::aod::pidTPCFullEl>;
71+
72+
// pp
73+
// 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>>;
7774

7875
// Filter
7976
Filter eventFilter = (o2::aod::evsel::sel8 == true);
8077
Filter posZFilter = (nabs(o2::aod::collision::posZ) < vtxZ);
8178

82-
Filter etafilter = (aod::track::eta < etaupCut) && (aod::track::eta > etalowCut);
83-
Filter dcaxyfilter = (nabs(aod::track::dcaXY) < dcaxyCut);
79+
Filter etafilter = (aod::track::eta < etaTrUp) && (aod::track::eta > etaTrLow);
80+
Filter dcaxyfilter = (nabs(aod::track::dcaXY) < dcaxyMax);
8481
Filter filter_globalTr = requireGlobalTrackInFilter();
8582

86-
Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == ClusterDefinition) && (o2::aod::emcalcluster::time >= minTime) && (o2::aod::emcalcluster::time <= maxTime) && (o2::aod::emcalcluster::m02 > minM02) && (o2::aod::emcalcluster::m02 < maxM02);
83+
Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == clusterDefinition) && (o2::aod::emcalcluster::time >= timeEmcMin) && (o2::aod::emcalcluster::time <= timeEmcMax) && (o2::aod::emcalcluster::m02 > m02Min) && (o2::aod::emcalcluster::m02 < m02Max);
8784

8885
// Data Handling Objects
8986
Preslice<o2::aod::EMCALClusterCells> perCluster = o2::aod::emcalclustercell::emcalclusterId;
@@ -136,9 +133,10 @@ struct HfTaskElectronWeakBoson {
136133
registry.add("hEMCtime", "EMC timing", kTH1F, {axisEMCtime});
137134
}
138135

139-
// void process(soa::Filtered<aod::Collisions>::iterator const& collision, SelectedClusters const& clusters, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks)
140-
void process(soa::Filtered<aod::Collisions>::iterator const& collision, SelectedClusters const& emcClusters, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks)
141-
// void process(soa::Filtered<aod::Collisions>::iterator const& collision, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks)
136+
void process(soa::Filtered<aod::Collisions>::iterator const& collision,
137+
SelectedClusters const& emcClusters,
138+
TrackEle const& tracks,
139+
o2::aod::EMCALMatchedTracks const& matchedtracks)
142140
{
143141
registry.fill(HIST("hEventCounter"), 0.5);
144142

@@ -150,36 +148,36 @@ struct HfTaskElectronWeakBoson {
150148

151149
for (const auto& track : tracks) {
152150

153-
registry.fill(HIST("hEta"), track.eta());
154-
registry.fill(HIST("hITSchi2"), track.itsChi2NCl());
155-
registry.fill(HIST("hTPCchi2"), track.tpcChi2NCl());
156-
registry.fill(HIST("hTPCnCls"), track.tpcNClsFound());
157-
registry.fill(HIST("hITSnCls"), track.itsNCls());
158-
registry.fill(HIST("hTPCnClsCrossedRows"), track.tpcNClsCrossedRows());
159-
160-
if (std::abs(track.eta()) > etaupCut)
151+
if (std::abs(track.eta()) > etaTrUp)
161152
continue;
162-
if (track.tpcNClsCrossedRows() < tpcNclCrCut)
153+
if (track.tpcNClsCrossedRows() < nclcrossTpcMin)
163154
continue;
164-
if (std::abs(track.dcaXY()) > dcaxyCut)
155+
if (std::abs(track.dcaXY()) > dcaxyMax)
165156
continue;
166-
if (track.itsChi2NCl() > itschi2Cut)
157+
if (track.itsChi2NCl() > chi2ItsMax)
167158
continue;
168-
if (track.tpcChi2NCl() > tpcchi2Cut)
159+
if (track.tpcChi2NCl() > chi2TpcMax)
169160
continue;
170-
if (track.tpcNClsFound() < tpcNclCut)
161+
if (track.tpcNClsFound() < nclTpcMin)
171162
continue;
172-
if (track.itsNCls() < itsNclCut)
163+
if (track.itsNCls() < nclItsMin)
173164
continue;
174-
if (track.pt() < mimpTCut)
165+
if (track.pt() < ptMin)
175166
continue;
167+
168+
registry.fill(HIST("hEta"), track.eta());
169+
registry.fill(HIST("hITSchi2"), track.itsChi2NCl());
170+
registry.fill(HIST("hTPCchi2"), track.tpcChi2NCl());
171+
registry.fill(HIST("hTPCnCls"), track.tpcNClsFound());
172+
registry.fill(HIST("hITSnCls"), track.itsNCls());
173+
registry.fill(HIST("hTPCnClsCrossedRows"), track.tpcNClsCrossedRows());
176174
registry.fill(HIST("hPt"), track.pt());
177175
registry.fill(HIST("hTPCNsigma"), track.p(), track.tpcNSigmaEl());
178176

179177
// track - match
180178

181179
// continue;
182-
if (track.phi() < emcaccPhimin || track.phi() > emcaccPhimax)
180+
if (track.phi() < phiEmcMin || track.phi() > phiEmcMax)
183181
continue;
184182
auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, track.globalIndex());
185183

@@ -192,31 +190,31 @@ struct HfTaskElectronWeakBoson {
192190
if (tracksofcluster.size()) {
193191
int nmatch = 0;
194192
for (const auto& match : tracksofcluster) {
195-
if (match.emcalcluster_as<SelectedClusters>().time() < minTime || match.emcalcluster_as<SelectedClusters>().time() > maxTime)
193+
if (match.emcalcluster_as<SelectedClusters>().time() < timeEmcMin || match.emcalcluster_as<SelectedClusters>().time() > timeEmcMax)
196194
continue;
197-
if (match.emcalcluster_as<SelectedClusters>().m02() < minM02 || match.emcalcluster_as<SelectedClusters>().m02() > maxM02)
195+
if (match.emcalcluster_as<SelectedClusters>().m02() < m02Min || match.emcalcluster_as<SelectedClusters>().m02() > m02Max)
198196
continue;
199197

200-
float emc_m20 = match.emcalcluster_as<SelectedClusters>().m20();
201-
float emc_m02 = match.emcalcluster_as<SelectedClusters>().m02();
202-
float emc_energy = match.emcalcluster_as<SelectedClusters>().energy();
203-
double emc_phi = match.emcalcluster_as<SelectedClusters>().phi();
204-
double emc_eta = match.emcalcluster_as<SelectedClusters>().eta();
205-
double emc_time = match.emcalcluster_as<SelectedClusters>().time();
198+
float m20Emc = match.emcalcluster_as<SelectedClusters>().m20();
199+
float m02Emc = match.emcalcluster_as<SelectedClusters>().m02();
200+
float energyEmc = match.emcalcluster_as<SelectedClusters>().energy();
201+
double phiEmc = match.emcalcluster_as<SelectedClusters>().phi();
202+
double etaEmc = match.emcalcluster_as<SelectedClusters>().eta();
203+
double timeEmc = match.emcalcluster_as<SelectedClusters>().time();
206204
// LOG(info) << "tr phi0 = " << match.track_as<TrackEle>().phi();
207205
// LOG(info) << "tr phi1 = " << track.phi();
208-
// LOG(info) << "emc phi = " << emc_phi;
206+
// LOG(info) << "emc phi = " << phiEmc;
209207
if (nmatch == 0) {
210-
double dEta = match.track_as<TrackEle>().eta() - emc_eta;
211-
double dPhi = match.track_as<TrackEle>().phi() - emc_phi;
208+
double dEta = match.track_as<TrackEle>().eta() - etaEmc;
209+
double dPhi = match.track_as<TrackEle>().phi() - phiEmc;
212210
if (dPhi > o2::constants::math::PI) {
213211
dPhi -= 2 * o2::constants::math::PI;
214212
} else if (dPhi < -o2::constants::math::PI) {
215213
dPhi += 2 * o2::constants::math::PI;
216214
}
217215

218-
registry.fill(HIST("hMatchPhi"), emc_phi, match.track_as<TrackEle>().phi());
219-
registry.fill(HIST("hMatchEta"), emc_eta, match.track_as<TrackEle>().eta());
216+
registry.fill(HIST("hMatchPhi"), phiEmc, match.track_as<TrackEle>().phi());
217+
registry.fill(HIST("hMatchEta"), etaEmc, match.track_as<TrackEle>().eta());
220218

221219
double R = std::sqrt(std::pow(dPhi, 2) + std::pow(dEta, 2));
222220
if (R < Rmim) {
@@ -225,18 +223,18 @@ struct HfTaskElectronWeakBoson {
225223
dEta_mim = dEta;
226224
}
227225
registry.fill(HIST("hTrMatch"), dPhi, dEta);
228-
registry.fill(HIST("hEMCtime"), emc_time);
229-
registry.fill(HIST("hEnergy"), emc_energy);
226+
registry.fill(HIST("hEMCtime"), timeEmc);
227+
registry.fill(HIST("hEnergy"), energyEmc);
230228

231-
if (R < MatchRCut)
229+
if (R < rMatchMax)
232230
continue;
233231

234-
double eop = emc_energy / match.track_as<TrackEle>().p();
232+
double eop = energyEmc / match.track_as<TrackEle>().p();
235233
// LOG(info) << "E/p" << eop;
236234
registry.fill(HIST("hEopNsigTPC"), match.track_as<TrackEle>().tpcNSigmaEl(), eop);
237-
registry.fill(HIST("hM02"), match.track_as<TrackEle>().tpcNSigmaEl(), emc_m02);
238-
registry.fill(HIST("hM20"), match.track_as<TrackEle>().tpcNSigmaEl(), emc_m20);
239-
if (match.track_as<TrackEle>().tpcNSigmaEl() > tpcNsiglowCut && match.track_as<TrackEle>().tpcNSigmaEl() < tpcNsigupCut) {
235+
registry.fill(HIST("hM02"), match.track_as<TrackEle>().tpcNSigmaEl(), m02Emc);
236+
registry.fill(HIST("hM20"), match.track_as<TrackEle>().tpcNSigmaEl(), m20Emc);
237+
if (match.track_as<TrackEle>().tpcNSigmaEl() > nsigTpcMin && match.track_as<TrackEle>().tpcNSigmaEl() < nsigTpcMax) {
240238
registry.fill(HIST("hEop"), match.track_as<TrackEle>().pt(), eop);
241239
}
242240
}
@@ -245,7 +243,7 @@ struct HfTaskElectronWeakBoson {
245243
}
246244
}
247245

248-
if (Rmim < MatchRCut) {
246+
if (Rmim < rMatchMax) {
249247
// LOG(info) << "R mim = " << Rmim;
250248
registry.fill(HIST("hTrMatch_mim"), dPhi_mim, dEta_mim);
251249
}

0 commit comments

Comments
 (0)