Skip to content

Commit b550b59

Browse files
committed
PWGEM/Photon: fix abs, fabs
1 parent 7f67b50 commit b550b59

File tree

5 files changed

+43
-48
lines changed

5 files changed

+43
-48
lines changed

PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -532,10 +532,10 @@ struct Pi0EtaToGammaGamma {
532532
float openingAngle1 = std::acos(photon1.Vect().Dot(photon3.Vect()) / (photon1.P() * photon3.P()));
533533
float openingAngle2 = std::acos(photon2.Vect().Dot(photon3.Vect()) / (photon2.P() * photon3.P()));
534534

535-
if (openingAngle1 > emccuts.minOpenAngle && std::abs(mother1.Rapidity()) < maxY && iCellID_photon1 > 0) {
535+
if (openingAngle1 > emccuts.minOpenAngle && std::fabs(mother1.Rapidity()) < maxY && iCellID_photon1 > 0) {
536536
fRegistry.fill(HIST("Pair/rotation/hs"), mother1.M(), mother1.Pt(), eventWeight);
537537
}
538-
if (openingAngle2 > emccuts.minOpenAngle && std::abs(mother2.Rapidity()) < maxY && iCellID_photon2 > 0) {
538+
if (openingAngle2 > emccuts.minOpenAngle && std::fabs(mother2.Rapidity()) < maxY && iCellID_photon2 > 0) {
539539
fRegistry.fill(HIST("Pair/rotation/hs"), mother2.M(), mother2.Pt(), eventWeight);
540540
}
541541
}
@@ -635,7 +635,7 @@ struct Pi0EtaToGammaGamma {
635635
ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.);
636636
ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.);
637637
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
638-
if (std::abs(v12.Rapidity()) > maxY) {
638+
if (std::fabs(v12.Rapidity()) > maxY) {
639639
continue;
640640
}
641641

@@ -699,7 +699,7 @@ struct Pi0EtaToGammaGamma {
699699
ROOT::Math::PtEtaPhiMVector v_ele(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron);
700700
ROOT::Math::PtEtaPhiMVector v_ee = v_pos + v_ele;
701701
ROOT::Math::PtEtaPhiMVector veeg = v_gamma + v_pos + v_ele;
702-
if (std::abs(veeg.Rapidity()) > maxY) {
702+
if (std::fabs(veeg.Rapidity()) > maxY) {
703703
continue;
704704
}
705705

@@ -729,7 +729,7 @@ struct Pi0EtaToGammaGamma {
729729
ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.);
730730
ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.);
731731
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
732-
if (std::abs(v12.Rapidity()) > maxY) {
732+
if (std::fabs(v12.Rapidity()) > maxY) {
733733
continue;
734734
}
735735

@@ -779,7 +779,7 @@ struct Pi0EtaToGammaGamma {
779779
ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.);
780780
ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.);
781781
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
782-
if (std::abs(v12.Rapidity()) > maxY) {
782+
if (std::fabs(v12.Rapidity()) > maxY) {
783783
continue;
784784
}
785785

@@ -808,7 +808,7 @@ struct Pi0EtaToGammaGamma {
808808
v2.SetM(g2.mass());
809809
}
810810
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
811-
if (std::abs(v12.Rapidity()) > maxY) {
811+
if (std::fabs(v12.Rapidity()) > maxY) {
812812
continue;
813813
}
814814
fRegistry.fill(HIST("Pair/mix/hs"), v12.M(), v12.Pt(), collision.weight());
@@ -834,7 +834,7 @@ struct Pi0EtaToGammaGamma {
834834
v1.SetM(g1.mass());
835835
}
836836
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
837-
if (std::abs(v12.Rapidity()) > maxY) {
837+
if (std::fabs(v12.Rapidity()) > maxY) {
838838
continue;
839839
}
840840
fRegistry.fill(HIST("Pair/mix/hs"), v12.M(), v12.Pt(), collision.weight());

PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ struct Pi0EtaToGammaGammaMC {
244244
if (d_bz_input > -990) {
245245
d_bz = d_bz_input;
246246
o2::parameters::GRPMagField grpmag;
247-
if (fabs(d_bz) > 1e-5) {
247+
if (std::fabs(d_bz) > 1e-5) {
248248
grpmag.setL3Current(30000.f / (d_bz / 5.0f));
249249
}
250250
mRunNumber = collision.runNumber();
@@ -434,7 +434,7 @@ struct Pi0EtaToGammaGammaMC {
434434
continue;
435435
}
436436

437-
if (eventcuts.onlyKeepWeightedEvents && fabs(collision.weight() - 1.) < 1E-10) {
437+
if (eventcuts.onlyKeepWeightedEvents && std::fabs(collision.weight() - 1.) < 1E-10) {
438438
continue;
439439
}
440440

@@ -507,7 +507,7 @@ struct Pi0EtaToGammaGammaMC {
507507
ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.);
508508
ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.);
509509
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
510-
if (std::abs(v12.Rapidity()) > maxY_rec) {
510+
if (std::fabs(v12.Rapidity()) > maxY_rec) {
511511
continue;
512512
}
513513

@@ -583,7 +583,7 @@ struct Pi0EtaToGammaGammaMC {
583583
ROOT::Math::PtEtaPhiMVector v_pos(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron);
584584
ROOT::Math::PtEtaPhiMVector v_ele(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron);
585585
ROOT::Math::PtEtaPhiMVector veeg = v_gamma + v_pos + v_ele;
586-
if (std::abs(veeg.Rapidity()) > maxY_rec) {
586+
if (std::fabs(veeg.Rapidity()) > maxY_rec) {
587587
continue;
588588
}
589589
if (pi0id > 0) {
@@ -606,7 +606,7 @@ struct Pi0EtaToGammaGammaMC {
606606
ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.);
607607
ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.);
608608
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
609-
if (std::abs(v12.Rapidity()) > maxY_rec) {
609+
if (std::fabs(v12.Rapidity()) > maxY_rec) {
610610
continue;
611611
}
612612
// if (pi0id > 0) {
@@ -664,7 +664,7 @@ struct Pi0EtaToGammaGammaMC {
664664
continue; // I don't know why this is necessary in simulation.
665665
}
666666

667-
if (eventcuts.onlyKeepWeightedEvents && fabs(collision.weight() - 1.) < 1E-10) {
667+
if (eventcuts.onlyKeepWeightedEvents && std::fabs(collision.weight() - 1.) < 1E-10) {
668668
continue;
669669
}
670670

PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -58,24 +58,23 @@ struct skimmerPrimaryElectronFromDalitzEE {
5858
Configurable<int> min_ncluster_tpc{"min_ncluster_tpc", 0, "min ncluster tpc"};
5959
Configurable<int> mincrossedrows{"mincrossedrows", 70, "min. crossed rows"};
6060
Configurable<float> min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"};
61-
Configurable<int> minitsncls{"minitsncls", 4, "min. number of ITS clusters"};
61+
Configurable<float> max_frac_shared_clusters_tpc{"max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"};
62+
Configurable<int> min_ncluster_its{"min_ncluster_its", 4, "min ncluster its"};
63+
Configurable<int> min_ncluster_itsib{"min_ncluster_itsib", 1, "min ncluster itsib"};
6264
Configurable<float> maxchi2tpc{"maxchi2tpc", 5.0, "max. chi2/NclsTPC"};
6365
Configurable<float> maxchi2its{"maxchi2its", 6.0, "max. chi2/NclsITS"};
64-
Configurable<float> minpt{"minpt", 0.15, "min pt for track"};
65-
Configurable<float> maxeta{"maxeta", 0.8, "eta acceptance"};
66+
Configurable<float> minpt{"minpt", 0.1, "min pt for track"};
67+
Configurable<float> maxeta{"maxeta", 0.9, "eta acceptance"};
6668
Configurable<float> dca_xy_max{"dca_xy_max", 0.1, "max DCAxy in cm"};
6769
Configurable<float> dca_z_max{"dca_z_max", 0.1, "max DCAz in cm"};
6870
Configurable<float> minTPCNsigmaEl{"minTPCNsigmaEl", -2.5, "min. TPC n sigma for electron inclusion"};
6971
Configurable<float> maxTPCNsigmaEl{"maxTPCNsigmaEl", 3.5, "max. TPC n sigma for electron inclusion"};
70-
Configurable<float> maxTPCNsigmaPi{"maxTPCNsigmaPi", 2.5, "max. TPC n sigma for pion exclusion"};
71-
Configurable<float> minTPCNsigmaPi{"minTPCNsigmaPi", -1e+10, "min. TPC n sigma for pion exclusion"};
72-
Configurable<float> maxMee_lowPtee{"maxMee_lowPtee", 0.02, "max. mee to store dalitz ee pairs for recovery"};
73-
Configurable<float> maxMee_highPtee{"maxMee_highPtee", 0.04, "max. mee to store dalitz ee pairs for recovery"};
72+
Configurable<float> maxTPCNsigmaPi{"maxTPCNsigmaPi", 0.0, "max. TPC n sigma for pion exclusion"};
73+
Configurable<float> minTPCNsigmaPi{"minTPCNsigmaPi", 0.0, "min. TPC n sigma for pion exclusion"};
74+
Configurable<float> maxMee{"maxMee", 0.06, "max. mee to store dalitz ee pairs"};
7475

7576
HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false};
7677

77-
std::pair<int8_t, std::set<uint8_t>> itsRequirement = {1, {0, 1, 2}}; // any hits on 3 ITS ib layers.
78-
7978
int mRunNumber;
8079
float d_bz;
8180
Service<o2::ccdb::BasicCCDBManager> ccdb;
@@ -121,7 +120,7 @@ struct skimmerPrimaryElectronFromDalitzEE {
121120
if (d_bz_input > -990) {
122121
d_bz = d_bz_input;
123122
o2::parameters::GRPMagField grpmag;
124-
if (fabs(d_bz) > 1e-5) {
123+
if (std::fabs(d_bz) > 1e-5) {
125124
grpmag.setL3Current(30000.f / (d_bz / 5.0f));
126125
}
127126
o2::base::Propagator::initFieldFromGRP(&grpmag);
@@ -172,12 +171,10 @@ struct skimmerPrimaryElectronFromDalitzEE {
172171
if (!track.hasITS() || !track.hasTPC()) {
173172
return false;
174173
}
175-
if (track.itsNCls() < minitsncls) {
174+
if (track.itsNCls() < min_ncluster_its) {
176175
return false;
177176
}
178-
179-
auto hits = std::count_if(itsRequirement.second.begin(), itsRequirement.second.end(), [&](auto&& requiredLayer) { return track.itsClusterMap() & (1 << requiredLayer); });
180-
if (hits < itsRequirement.first) {
177+
if (track.itsNClsInnerBarrel() < min_ncluster_itsib) {
181178
return false;
182179
}
183180

@@ -193,11 +190,15 @@ struct skimmerPrimaryElectronFromDalitzEE {
193190
return false;
194191
}
195192

196-
if (abs(track.dcaXY()) > dca_xy_max || abs(track.dcaZ()) > dca_z_max) {
193+
if (track.tpcFractionSharedCls() > max_frac_shared_clusters_tpc) {
194+
return false;
195+
}
196+
197+
if (std::fabs(track.dcaXY()) > dca_xy_max || std::fabs(track.dcaZ()) > dca_z_max) {
197198
return false;
198199
}
199200

200-
if (track.pt() < minpt || abs(track.eta()) > maxeta) {
201+
if (track.pt() < minpt || std::fabs(track.eta()) > maxeta) {
201202
return false;
202203
}
203204

@@ -252,8 +253,8 @@ struct skimmerPrimaryElectronFromDalitzEE {
252253
template <bool isMC, typename TCollision, typename TTracks1, typename TTracks2>
253254
void fillPairInfo(TCollision const& collision, TTracks1 const& tracks1, TTracks2 const& tracks2)
254255
{
255-
for (auto& t1 : tracks1) {
256-
for (auto& t2 : tracks2) {
256+
for (const auto& t1 : tracks1) {
257+
for (const auto& t2 : tracks2) {
257258
if (!checkTrack<isMC>(collision, t1) || !checkTrack<isMC>(collision, t2)) {
258259
continue;
259260
}
@@ -265,14 +266,8 @@ struct skimmerPrimaryElectronFromDalitzEE {
265266
ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassElectron);
266267
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
267268

268-
if (v12.Pt() < 1.0) { // don't store
269-
if (v12.M() > maxMee_lowPtee) { // don't store
270-
continue;
271-
}
272-
} else {
273-
if (v12.M() > maxMee_highPtee) { // don't store
274-
continue;
275-
}
269+
if (v12.M() > maxMee) { // don't store
270+
continue;
276271
}
277272
fRegistry.fill(HIST("Pair/hMeePtee_ULS"), v12.M(), v12.Pt());
278273
fillTrackTable(collision, t1);
@@ -282,7 +277,7 @@ struct skimmerPrimaryElectronFromDalitzEE {
282277
}
283278

284279
std::vector<std::pair<int64_t, int64_t>> stored_trackIds;
285-
Filter trackFilter = o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& o2::aod::track::tpcChi2NCl < maxchi2tpc&& o2::aod::track::itsChi2NCl < maxchi2its&& ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC) == true;
280+
Filter trackFilter = o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& o2::aod::track::tpcChi2NCl < maxchi2tpc&& o2::aod::track::itsChi2NCl < maxchi2its&& ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC) == true && nabs(o2::aod::track::dcaXY) < dca_xy_max && nabs(o2::aod::track::dcaZ) < dca_z_max;
286281
Filter pidFilter = minTPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < maxTPCNsigmaEl;
287282
using MyFilteredTracks = soa::Filtered<MyTracks>;
288283
Partition<MyFilteredTracks> posTracks = o2::aod::track::signed1Pt > 0.f;
@@ -293,7 +288,7 @@ struct skimmerPrimaryElectronFromDalitzEE {
293288
{
294289
stored_trackIds.reserve(tracks.size());
295290

296-
for (auto& collision : collisions) {
291+
for (const auto& collision : collisions) {
297292
auto bc = collision.bc_as<aod::BCsWithTimestamps>();
298293
initCCDB(bc);
299294

@@ -320,7 +315,7 @@ struct skimmerPrimaryElectronFromDalitzEE {
320315
{
321316
stored_trackIds.reserve(tracks.size());
322317

323-
for (auto& collision : collisions) {
318+
for (const auto& collision : collisions) {
324319
if (!collision.has_mcCollision()) {
325320
continue;
326321
}
@@ -351,10 +346,10 @@ struct skimmerPrimaryElectronFromDalitzEE {
351346
//
352347
// void process(aod::EMPrimaryElectrons const& electrons)
353348
// {
354-
// for (auto& electron : electrons) {
349+
// for (const auto& electron : electrons) {
355350
// auto electrons_with_same_trackId = electrons.sliceBy(perTrack, electron.trackId());
356351
// ambele_self_Ids.reserve(electrons_with_same_trackId.size());
357-
// for (auto& amp_ele : electrons_with_same_trackId) {
352+
// for (const auto& amp_ele : electrons_with_same_trackId) {
358353
// if (amp_ele.globalIndex() == electron.globalIndex()) { // don't store myself.
359354
// continue;
360355
// }

PWGEM/PhotonMeson/Tasks/pcmQC.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ struct PCMQC {
277277
if (collision.sel8()) {
278278
fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 8.0);
279279
}
280-
if (abs(collision.posZ()) < 10.0) {
280+
if (std::fabs(collision.posZ()) < 10.0) {
281281
fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 9.0);
282282
}
283283
fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hZvtx"), collision.posZ());

PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ struct PCMQCMC {
335335
if (collision.sel8()) {
336336
fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 8.0);
337337
}
338-
if (std::abs(collision.posZ()) < 10.0) {
338+
if (std::fabs(collision.posZ()) < 10.0) {
339339
fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 9.0);
340340
}
341341

@@ -534,7 +534,7 @@ struct PCMQCMC {
534534

535535
auto mctracks_coll = mcparticles.sliceBy(perMcCollision, mccollision.globalIndex());
536536
for (auto& mctrack : mctracks_coll) {
537-
if (std::abs(mctrack.y()) > pcmcuts.cfg_max_eta_v0) {
537+
if (std::fabs(mctrack.y()) > pcmcuts.cfg_max_eta_v0) {
538538
continue;
539539
}
540540

0 commit comments

Comments
 (0)