Skip to content

Commit 4ab0332

Browse files
committed
[PWGEM/Dilepton]: update taskV1
1 parent 4442132 commit 4ab0332

1 file changed

Lines changed: 32 additions & 21 deletions

File tree

PWGEM/Dilepton/Tasks/dimuonV1.cxx

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949

5050
#include <Math/Vector4D.h> // IWYU pragma: keep (do not replace with Math/Vector4Dfwd.h)
5151
#include <Math/Vector4Dfwd.h>
52-
#include <TH1.h>
53-
#include <TH2.h>
5452
#include <TString.h>
5553

5654
#include <sys/types.h>
@@ -66,7 +64,6 @@
6664
#include <string>
6765
#include <string_view>
6866
#include <tuple>
69-
#include <unordered_map>
7067
#include <utility>
7168
#include <vector>
7269

@@ -92,6 +89,10 @@ struct dimuonV1 {
9289
o2::framework::ConfigurableAxis ConfPtllBins{"ConfPtllBins", {10, 0, 10}, "pTll bins for output histograms"};
9390
o2::framework::ConfigurableAxis ConfYllBins{"ConfYllBins", {3, -4.0, -2.5}, "yll bins for output histograms"};
9491
o2::framework::ConfigurableAxis ConfUQBins{"ConfUQBins", {200, -1, 1}, "uQ bins for output histograms"};
92+
o2::framework::Configurable<int> cfgNrotation{"cfgNrotation", 1, "number of rotation bkg"};
93+
o2::framework::Configurable<int> cfgRandomSeed{"cfgRandomSeed", 1, "randam seed for rotation bkg"};
94+
o2::framework::Configurable<float> cfgRotationMin{"cfgRotationMin", -M_PI / 4, "min. rotation angle for rotation bkg"};
95+
o2::framework::Configurable<float> cfgRotationMax{"cfgRotationMax", +M_PI / 4, "max. rotation angle for rotation bkg"};
9596

9697
EMEventCut fEMEventCut;
9798
struct : o2::framework::ConfigurableGroup {
@@ -175,6 +176,8 @@ struct dimuonV1 {
175176

176177
o2::aod::rctsel::RCTFlagsChecker rctChecker;
177178
int mRunNumber{0};
179+
std::mt19937 engine;
180+
std::uniform_real_distribution<float> distDPhi;
178181

179182
o2::framework::HistogramRegistry fRegistry{"output", {}, o2::framework::OutputObjHandlingPolicy::AnalysisObject, false, false};
180183
static constexpr std::string_view event_pair_types[2] = {"same/", "mix/"};
@@ -183,6 +186,10 @@ struct dimuonV1 {
183186
{
184187
mRunNumber = 0;
185188

189+
// std::random_device seed_gen;
190+
engine = std::mt19937(cfgRandomSeed);
191+
distDPhi = std::uniform_real_distribution<float>(cfgRotationMin, cfgRotationMax);
192+
186193
rctChecker.init(eventcuts.cfgRCTLabel.value, eventcuts.cfgCheckZDC.value, eventcuts.cfgTreatLimitedAcceptanceAsBad.value);
187194

188195
// emh_pos = new MyEMH_muon(ndepth);
@@ -231,9 +238,11 @@ struct dimuonV1 {
231238
const o2::framework::AxisSpec axis_uyQyp{ConfUQBins, "u_{y}Q_{y}^{p}"};
232239

233240
fRegistry.add("Pair/same/uls/hs", "dilepton", o2::framework::HistType::kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_uxQxt, axis_uxQxp, axis_uyQyt, axis_uyQyp}, true);
234-
fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/");
235-
fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/");
236-
fRegistry.addClone("Pair/same/", "Pair/mix/");
241+
fRegistry.add("Pair/same/uls/hsRotBkg", "dilepton", o2::framework::HistType::kTHnSparseD, {axis_mass, axis_pt, axis_y}, true);
242+
243+
// fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/");
244+
// fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/");
245+
// fRegistry.addClone("Pair/same/", "Pair/mix/");
237246
}
238247

239248
void DefineEMEventCut()
@@ -307,8 +316,8 @@ struct dimuonV1 {
307316
}
308317
}
309318

310-
ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassMuon);
311-
ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassMuon);
319+
ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), RecoDecay::constrainAngle(t1.phi(), 0, 1U), o2::constants::physics::MassMuon);
320+
ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), RecoDecay::constrainAngle(t2.phi(), 0, 1U), o2::constants::physics::MassMuon);
312321
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
313322
float phi = RecoDecay::constrainAngle(v12.Phi(), 0, 1U);
314323

@@ -320,10 +329,18 @@ struct dimuonV1 {
320329

321330
if (t1.sign() * t2.sign() < 0) { // ULS
322331
fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), uxQxt, uxQxp, uyQyt, uyQyp, weight);
323-
} else if (t1.sign() > 0 && t2.sign() > 0) { // LS++
324-
fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), uxQxt, uxQxp, uyQyt, uyQyp, weight);
325-
} else if (t1.sign() < 0 && t2.sign() < 0) { // LS--
326-
fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), uxQxt, uxQxp, uyQyt, uyQyp, weight);
332+
333+
for (int i = 0; i < cfgNrotation; i++) {
334+
float dphi = distDPhi(engine);
335+
ROOT::Math::PtEtaPhiMVector v2rot(t2.pt(), t2.eta(), RecoDecay::constrainAngle(t2.phi() + dphi, 0, 1U), o2::constants::physics::MassMuon);
336+
ROOT::Math::PtEtaPhiMVector v12bkg = v1 + v2rot;
337+
fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hsRotBkg"), v12bkg.M(), v12bkg.Pt(), v12bkg.Rapidity(), weight * 1.f / static_cast<float>(cfgNrotation));
338+
}
339+
340+
// } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++
341+
// fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), uxQxt, uxQxp, uyQyt, uyQyp, weight);
342+
// } else if (t1.sign() < 0 && t2.sign() < 0) { // LS--
343+
// fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), uxQxt, uxQxp, uyQyt, uyQyp, weight);
327344
}
328345
return true;
329346
}
@@ -373,21 +390,15 @@ struct dimuonV1 {
373390
for (const auto& [pos, neg] : combinations(o2::soa::CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS
374391
fillPairInfo<0>(collision, pos, neg, cut);
375392
}
393+
376394
// for (const auto& [pos1, pos2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++
377-
// bool is_pair_ok = fillPairInfo<0>(collision, pos1, pos2, cut);
378-
// if (is_pair_ok) {
379-
// nlspp++;
380-
// }
395+
// fillPairInfo<0>(collision, pos1, pos2, cut);
381396
// }
382397
// for (const auto& [neg1, neg2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS--
383-
// bool is_pair_ok = fillPairInfo<0>(collision, neg1, neg2, cut);
384-
// if (is_pair_ok) {
385-
// nlsmm++;
386-
// }
398+
// fillPairInfo<0>(collision, neg1, neg2, cut);
387399
// }
388400

389401
} // end of collision loop
390-
391402
} // end of DF
392403

393404
template <typename TTrack1, typename TTrack2, typename TCut>

0 commit comments

Comments
 (0)