Skip to content

Commit bff4a00

Browse files
authored
[PWGLF] Applied track selection to MC closure (#11063)
1 parent 657a599 commit bff4a00

File tree

1 file changed

+34
-9
lines changed

1 file changed

+34
-9
lines changed

PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ struct UccZdc {
156156
Service<ccdb::BasicCCDBManager> ccdb;
157157
Configurable<std::string> paTH{"paTH", "Users/o/omvazque/TrackingEfficiency", "base path to the ccdb object"};
158158
Configurable<std::string> uRl{"uRl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
159-
Configurable<int64_t> noLaterThan{"noLaterThan", 1740173636328, "latest acceptable timestamp of creation for the object"};
159+
// Configurable<int64_t> noLaterThan{"noLaterThan", 1740173636328, "latest acceptable timestamp of creation for the object"};
160+
Configurable<int64_t> noLaterThan{"noLaterThan", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"};
160161

161162
// the efficiency has been previously stored in the CCDB as TH1F histogram
162163
TH1F* efficiency = nullptr;
@@ -199,11 +200,11 @@ struct UccZdc {
199200
if (doprocessZdcCollAss) {
200201
registry.add("T0Ccent", ";;Entries", kTH1F, {axisCent});
201202
registry.add("ZposVsEta", "", kTProfile, {axisZpos});
203+
registry.add("ZN", ";ZNA+ZNC;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZN}});
202204
registry.add("EtaVsPhi", ";#eta;#varphi", kTH2F, {{{axisEta}, {100, -0.1 * PI, +2.1 * PI}}});
203205
registry.add("sigma1Pt", ";;#sigma(p_{T})/p_{T};", kTProfile, {axisPt});
204206
registry.add("dcaXYvspT", ";DCA_{xy} (cm);;", kTH2F, {{{50, -1., 1.}, {axisPt}}});
205207

206-
registry.add("NchRaw", ";#it{N}_{ch} (|#eta| < 0.8);", kTH1F, {{nBinsNch, minNch, maxNch}});
207208
registry.add("Nch", ";#it{N}_{ch} (|#eta| < 0.8, Corrected);", kTH1F, {{nBinsNch, minNch, maxNch}});
208209
registry.add("NchVsPt", ";#it{N}_{ch} (|#eta| < 0.8, Corrected);;", kTH2F, {{{nBinsNch, minNch, maxNch}, {axisPt}}});
209210
registry.add("NchVsOneParCorr", ";#it{N}_{ch} (|#eta| < 0.8, Corrected);#LT[#it{p}_{T}^{(1)}]#GT (GeV/#it{c})", kTProfile, {{nBinsNch, minNch, maxNch}});
@@ -315,10 +316,10 @@ struct UccZdc {
315316
// This avoids that users can replace objects **while** a train is running
316317
ccdb->setCreatedNotAfter(noLaterThan.value);
317318
LOGF(info, "Getting object %s", paTH.value.data());
318-
efficiency = ccdb->getForTimeStamp<TH1F>(paTH.value, noLaterThan);
319-
if (!efficiency) {
320-
LOGF(fatal, "Efficiency object not found!");
321-
}
319+
// efficiency = ccdb->getForTimeStamp<TH1F>(paTH.value, noLaterThan);
320+
// if (!efficiency) {
321+
// LOGF(fatal, "Efficiency object not found!");
322+
// }
322323
}
323324

324325
template <typename CheckCol>
@@ -562,6 +563,14 @@ struct UccZdc {
562563
}
563564

564565
const auto& foundBC = collision.foundBC_as<o2::aod::BCsRun3>();
566+
// LOGF(info, "Getting object %s for run number %i from timestamp=%llu", paTH.value.data(), foundBC.runNumber(), foundBC.timestamp());
567+
568+
// auto efficiency = ccdb->getForTimeStamp<TH1F>(paTH.value, foundBC.timestamp());
569+
auto efficiency = ccdb->getForRun<TH1F>(paTH.value, foundBC.runNumber());
570+
if (!efficiency) {
571+
LOGF(fatal, "Efficiency object not found!");
572+
}
573+
565574
// has ZDC?
566575
if (!foundBC.has_zdc()) {
567576
return;
@@ -669,7 +678,7 @@ struct UccZdc {
669678
}
670679

671680
registry.fill(HIST("Nch"), w1);
672-
registry.fill(HIST("NchRaw"), nch);
681+
registry.fill(HIST("ZN"), sumZNs);
673682
registry.fill(HIST("NchVsOneParCorr"), w1, oneParCorr, w1);
674683
registry.fill(HIST("NchVsOneParCorrVsZN"), w1, sumZNs, oneParCorr, w1);
675684
registry.fill(HIST("NchVsTwoParCorrVsZN"), w1, sumZNs, twoParCorr, denTwoParCorr);
@@ -681,8 +690,9 @@ struct UccZdc {
681690
// Preslice<aod::McParticles> perMCCollision = aod::mcparticle::mcCollisionId;
682691
Preslice<TheFilteredSimTracks> perCollision = aod::track::collisionId;
683692
TRandom* randPointer = new TRandom();
684-
void processMCclosure(aod::McCollisions::iterator const& mccollision, soa::SmallGroups<o2::aod::SimCollisions> const& collisions, aod::McParticles const& mcParticles, TheFilteredSimTracks const& simTracks)
693+
void processMCclosure(aod::McCollisions::iterator const& mccollision, soa::SmallGroups<o2::aod::SimCollisions> const& collisions, o2::aod::BCsRun3 const& /*bcs*/, aod::McParticles const& mcParticles, TheFilteredSimTracks const& simTracks)
685694
{
695+
686696
float rndNum = randPointer->Uniform(0.0, 1.0);
687697
registry.fill(HIST("RandomNumber"), rndNum);
688698

@@ -691,6 +701,15 @@ struct UccZdc {
691701
registry.fill(HIST("EvtsDivided"), 0);
692702
//----- MC reconstructed -----//
693703
for (const auto& collision : collisions) {
704+
705+
// To use run-by-run efficiency
706+
const auto& foundBC = collision.foundBC_as<o2::aod::BCsRun3>();
707+
// auto efficiency = ccdb->getForTimeStamp<TH1F>(paTH.value, foundBC.timestamp());
708+
auto efficiency = ccdb->getForRun<TH1F>(paTH.value, foundBC.runNumber());
709+
if (!efficiency) {
710+
LOGF(fatal, "Efficiency object not found!");
711+
}
712+
694713
// Event selection
695714
if (!isEventSelected(collision)) {
696715
continue;
@@ -804,7 +823,7 @@ struct UccZdc {
804823
registry.fill(HIST("NchvsThreeParCorrGen"), nchMC, threeParCorrMC, denThreeParCorrMC);
805824
registry.fill(HIST("NchvsFourParCorrGen"), nchMC, fourParCorrMC, denFourParCorrMC);
806825
}
807-
} else {
826+
} else { // Correction with the remaining half of the sample
808827
registry.fill(HIST("EvtsDivided"), 1);
809828
//----- MC reconstructed -----//
810829
for (const auto& collision : collisions) {
@@ -825,6 +844,12 @@ struct UccZdc {
825844

826845
const auto& groupedTracks{simTracks.sliceBy(perCollision, collision.globalIndex())};
827846
for (const auto& track : groupedTracks) {
847+
// Track Selection
848+
if (!track.isGlobalTrack()) {
849+
continue;
850+
}
851+
852+
// Has MC particle?
828853
if (!track.has_mcParticle()) {
829854
continue;
830855
}

0 commit comments

Comments
 (0)