Skip to content

Commit 5a9b237

Browse files
committed
PWGHF implemented comments by Vit
1 parent dfe033a commit 5a9b237

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "DataFormatsEMCAL/Constants.h"
2525
#include "DataFormatsEMCAL/AnalysisCluster.h"
2626

27+
#include "Common/Core/RecoDecay.h"
2728
#include "Common/DataModel/EventSelection.h"
2829
#include "Common/DataModel/TrackSelectionTables.h"
2930
#include "Common/DataModel/PIDResponse.h"
@@ -183,12 +184,12 @@ struct HfTaskElectronWeakBoson {
183184

184185
// LOGF(info, "Number of matched track: %d", tracksofcluster.size());
185186

186-
double Rmim = 999.9;
187-
double dPhi_mim = 999.9;
188-
double dEta_mim = 999.9;
187+
double rMin = 999.9;
188+
double dPhiMin = 999.9;
189+
double dEtaMin = 999.9;
189190

190191
if (tracksofcluster.size()) {
191-
int nmatch = 0;
192+
int nMatch = 0;
192193
for (const auto& match : tracksofcluster) {
193194
if (match.emcalcluster_as<SelectedClusters>().time() < timeEmcMin || match.emcalcluster_as<SelectedClusters>().time() > timeEmcMax)
194195
continue;
@@ -204,29 +205,25 @@ struct HfTaskElectronWeakBoson {
204205
// LOG(info) << "tr phi0 = " << match.track_as<TrackEle>().phi();
205206
// LOG(info) << "tr phi1 = " << track.phi();
206207
// LOG(info) << "emc phi = " << phiEmc;
207-
if (nmatch == 0) {
208+
if (nMatch == 0) {
208209
double dEta = match.track_as<TrackEle>().eta() - etaEmc;
209210
double dPhi = match.track_as<TrackEle>().phi() - phiEmc;
210-
if (dPhi > o2::constants::math::PI) {
211-
dPhi -= 2 * o2::constants::math::PI;
212-
} else if (dPhi < -o2::constants::math::PI) {
213-
dPhi += 2 * o2::constants::math::PI;
214-
}
211+
dPhi = RecoDecay::constrainAngle(dPhi, -o2::constants::math::PI);
215212

216213
registry.fill(HIST("hMatchPhi"), phiEmc, match.track_as<TrackEle>().phi());
217214
registry.fill(HIST("hMatchEta"), etaEmc, match.track_as<TrackEle>().eta());
218215

219-
double R = std::sqrt(std::pow(dPhi, 2) + std::pow(dEta, 2));
220-
if (R < Rmim) {
221-
Rmim = R;
222-
dPhi_mim = dPhi;
223-
dEta_mim = dEta;
216+
double r = RecoDecay::sqrtSumOfSquares(dPhi, dEta);
217+
if (r < rMin) {
218+
rMin = r;
219+
dPhiMin = dPhi;
220+
dEtaMin = dEta;
224221
}
225222
registry.fill(HIST("hTrMatch"), dPhi, dEta);
226223
registry.fill(HIST("hEMCtime"), timeEmc);
227224
registry.fill(HIST("hEnergy"), energyEmc);
228225

229-
if (R < rMatchMax)
226+
if (r < rMatchMax)
230227
continue;
231228

232229
double eop = energyEmc / match.track_as<TrackEle>().p();
@@ -239,13 +236,13 @@ struct HfTaskElectronWeakBoson {
239236
}
240237
}
241238

242-
nmatch++;
239+
nMatch++;
243240
}
244241
}
245242

246-
if (Rmim < rMatchMax) {
247-
// LOG(info) << "R mim = " << Rmim;
248-
registry.fill(HIST("hTrMatch_mim"), dPhi_mim, dEta_mim);
243+
if (rMin < rMatchMax) {
244+
// LOG(info) << "R mim = " << rMin;
245+
registry.fill(HIST("hTrMatch_mim"), dPhiMin, dEtaMin);
249246
}
250247

251248
} // end of track loop
@@ -254,6 +251,5 @@ struct HfTaskElectronWeakBoson {
254251

255252
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
256253
{
257-
return WorkflowSpec{
258-
adaptAnalysisTask<HfTaskElectronWeakBoson>(cfgc)};
254+
return WorkflowSpec{adaptAnalysisTask<HfTaskElectronWeakBoson>(cfgc)};
259255
}

0 commit comments

Comments
 (0)