Skip to content

Commit 9fc053f

Browse files
tutripatalibuild
andauthored
[PWGLF] Modification in event selection cuts (#11805)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 1ccb3bd commit 9fc053f

File tree

1 file changed

+65
-59
lines changed

1 file changed

+65
-59
lines changed

PWGLF/Tasks/GlobalEventProperties/dndeta-mft-pp.cxx

Lines changed: 65 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,33 @@
1515
// \brief This code loops over MFT tracks and collisions and fills histograms
1616
// useful to compute dNdeta
1717

18-
#include <chrono>
19-
#include <cmath>
20-
#include <cstdint>
21-
#include <cstdlib>
22-
#include <iostream>
23-
#include <unordered_set>
24-
#include <vector>
18+
#include "PWGMM/Mult/DataModel/bestCollisionTable.h"
19+
20+
#include "Common/DataModel/Centrality.h"
21+
#include "Common/DataModel/EventSelection.h"
22+
#include "Common/DataModel/Multiplicity.h"
23+
#include "Common/DataModel/TrackSelectionTables.h"
2524

25+
#include "CommonConstants/MathConstants.h"
2626
#include "Framework/ASoAHelpers.h"
2727
#include "Framework/AnalysisDataModel.h"
2828
#include "Framework/AnalysisTask.h"
2929
#include "Framework/Configurable.h"
3030
#include "Framework/O2DatabasePDGPlugin.h"
3131
#include "Framework/RuntimeError.h"
3232
#include "Framework/runDataProcessing.h"
33-
34-
#include "Common/DataModel/Centrality.h"
35-
#include "Common/DataModel/EventSelection.h"
36-
#include "Common/DataModel/Multiplicity.h"
37-
#include "Common/DataModel/TrackSelectionTables.h"
38-
#include "CommonConstants/MathConstants.h"
3933
#include "MathUtils/Utils.h"
4034
#include "ReconstructionDataFormats/GlobalTrackID.h"
41-
#include "TDatabasePDG.h"
4235

43-
#include "PWGMM/Mult/DataModel/bestCollisionTable.h"
4436
#include "TFile.h"
4537

38+
#include <chrono>
39+
#include <cmath>
40+
#include <cstdint>
41+
#include <cstdlib>
42+
#include <unordered_set>
43+
#include <vector>
44+
4645
using namespace o2;
4746
using namespace o2::framework;
4847
using namespace o2::framework::expressions;
@@ -51,7 +50,7 @@ using namespace o2::aod::track;
5150
AxisSpec PtAxis = {1001, -0.005, 10.005};
5251
AxisSpec DeltaZAxis = {61, -6.1, 6.1};
5352
AxisSpec ZAxis = {301, -30.1, 30.1};
54-
AxisSpec PhiAxis = {629, 0, 2 * M_PI, "Rad", "phi axis"};
53+
AxisSpec PhiAxis = {629, 0, o2::constants::math::TwoPI, "Rad", "phi axis"};
5554
// AxisSpec EtaAxis = {18, -4.6, -1.};
5655
AxisSpec DCAxyAxis = {100, -1, 10};
5756
AxisSpec CentAxis = {{0, 10, 20, 30, 40, 50, 60, 70, 80, 100}};
@@ -82,6 +81,7 @@ struct PseudorapidityDensityMFT {
8281
"eta range for INEL>0 sample definition"};
8382

8483
Configurable<bool> useEvSel{"useEvSel", true, "use event selection"};
84+
Configurable<bool> disableITSROFCut{"disableITSROFCut", false, "Disable ITS ROC cut for event selection"};
8585
ConfigurableAxis multBinning{"multBinning", {701, -0.5, 700.5}, ""};
8686
ConfigurableAxis EtaAxis = {"etaBinning", {18, -4.6, -1.}, ""};
8787

@@ -145,15 +145,15 @@ struct PseudorapidityDensityMFT {
145145
auto hstat = registry.get<TH1>(HIST("EventSelection"));
146146
auto* x = hstat->GetXaxis();
147147
x->SetBinLabel(1, "All");
148-
x->SetBinLabel(2, "Selected");
149-
x->SetBinLabel(3, "Selected Vz Cut");
150-
x->SetBinLabel(4, "Sel8+Vz+INEL>0");
151-
x->SetBinLabel(5, "Sel INEL,INEL_fwd>0");
152-
x->SetBinLabel(6, "Rejected");
153-
x->SetBinLabel(7, "Good BCs");
154-
x->SetBinLabel(8, "BCs with collisions");
155-
x->SetBinLabel(9, "BCs with pile-up/splitting");
156-
x->SetBinLabel(10, "midtracks>0");
148+
x->SetBinLabel(2, "Vz");
149+
x->SetBinLabel(3, "Vz+ITSRof");
150+
x->SetBinLabel(4, "Vz+Selected");
151+
x->SetBinLabel(5, "Sel8+Vz+INEL>0");
152+
x->SetBinLabel(6, "Sel INEL,INEL_fwd>0");
153+
x->SetBinLabel(7, "Rejected");
154+
x->SetBinLabel(8, "Good BCs");
155+
x->SetBinLabel(9, "BCs with collisions");
156+
x->SetBinLabel(10, "BCs with pile-up/splitting");
157157
x->SetBinLabel(11, "percollisionSample>0");
158158
x->SetBinLabel(12, "midtracks+percollisionSample>0");
159159
registry.add({"EventsNtrkZvtx",
@@ -446,13 +446,13 @@ struct PseudorapidityDensityMFT {
446446
{
447447

448448
std::vector<typename std::decay_t<decltype(collisions)>::iterator> cols;
449-
for (auto& bc : bcs) {
449+
for (const auto& bc : bcs) {
450450
if (!useEvSel ||
451451
(useEvSel && ((bc.selection_bit(aod::evsel::kIsBBT0A) &&
452452
bc.selection_bit(aod::evsel::kIsBBT0C)) != 0))) {
453-
registry.fill(HIST("EventSelection"), 7); // added 5->12
453+
registry.fill(HIST("EventSelection"), 8); // added 5->12
454454
cols.clear();
455-
for (auto& collision : collisions) {
455+
for (const auto& collision : collisions) {
456456
if (collision.has_foundBC()) {
457457
if (collision.foundBCId() == bc.globalIndex()) {
458458
cols.emplace_back(collision);
@@ -463,9 +463,9 @@ struct PseudorapidityDensityMFT {
463463
}
464464
LOGP(debug, "BC {} has {} collisions", bc.globalBC(), cols.size());
465465
if (!cols.empty()) {
466-
registry.fill(HIST("EventSelection"), 8); // added 6->13
466+
registry.fill(HIST("EventSelection"), 9); // added 6->13
467467
if (cols.size() > 1) {
468-
registry.fill(HIST("EventSelection"), 9); // added 7->14
468+
registry.fill(HIST("EventSelection"), 10); // added 7->14
469469
}
470470
}
471471
}
@@ -522,17 +522,17 @@ struct PseudorapidityDensityMFT {
522522
}
523523

524524
if (tracks.size() > 0) {
525-
for (auto& track : tracks) {
525+
for (const auto& track : tracks) {
526526

527527
float phi = track.phi();
528528
o2::math_utils::bringTo02Pi(phi);
529529

530530
if (usePhiCut) {
531531
if ((phi < cfgPhiCut) ||
532-
((phi > M_PI - cfgPhiCut) && (phi < M_PI + cfgPhiCut)) ||
533-
(phi > 2. * M_PI - cfgPhiCut) ||
534-
((phi > ((M_PI / 2. - 0.1) * M_PI) - cfgPhiCut) &&
535-
(phi < ((M_PI / 2. - 0.1) * M_PI) + cfgPhiCut)))
532+
((phi > o2::constants::math::PI - cfgPhiCut) && (phi < o2::constants::math::PI + cfgPhiCut)) ||
533+
(phi > o2::constants::math::TwoPI - cfgPhiCut) ||
534+
((phi > ((o2::constants::math::PIHalf - 0.1) * o2::constants::math::PI) - cfgPhiCut) &&
535+
(phi < ((o2::constants::math::PIHalf - 0.1) * o2::constants::math::PI) + cfgPhiCut)))
536536
continue;
537537
}
538538

@@ -569,25 +569,28 @@ struct PseudorapidityDensityMFT {
569569
registry.fill(HIST("EventsNtrkZvtx"), Ntrk, z);
570570
if ((z >= cfgVzCut1) && (z <= cfgVzCut2)) {
571571
registry.fill(HIST("Tracks/2Danalysis/EventsNtrkZvtx_all"), Ntrk, z);
572-
for (auto& retrack : retracks) {
572+
registry.fill(HIST("EventSelection"), 2.);
573+
for (const auto& retrack : retracks) {
573574
auto track = retrack.mfttrack();
574575
if ((cfgnEta1 < track.eta()) && (track.eta() < cfgnEta2) && track.nClusters() >= cfgnCluster && retrack.ambDegree() > 0) {
575576
registry.fill(HIST("Tracks/2Danalysis/EtaZvtx"), track.eta(), z);
576577
}
577578
}
578-
if (!useEvSel || (useEvSel && collision.sel8())) {
579-
registry.fill(HIST("EventSelection"), 2.);
579+
if (!disableITSROFCut && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) {
580+
return;
581+
}
582+
registry.fill(HIST("EventSelection"), 3.);
583+
if (!useEvSel || (useEvSel && collision.selection_bit(aod::evsel::kIsTriggerTVX) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder))) {
584+
registry.fill(HIST("EventSelection"), 4.);
580585
registry.fill(HIST("Tracks/2Danalysis/EventsNtrkZvtx_sel8"), Ntrk, z);
581-
registry.fill(HIST("EventSelection"), 3.);
582586
std::unordered_set<int> uniqueEvents;
583587
std::unordered_set<int> uniqueEventsAmb;
584588
std::unordered_set<int> uniqueCollisions;
585589
std::unordered_set<int> uniqueCollisionsAmb;
586590
std::unordered_set<int> eventsInelMFT;
587591
std::unordered_set<int> eventsInel;
588592
if (midtracks.size() > 0) {
589-
registry.fill(HIST("EventSelection"), 4.);
590-
registry.fill(HIST("EventSelection"), 10.);
593+
registry.fill(HIST("EventSelection"), 5.);
591594
registry.fill(HIST("EventsNtrkZvtx_gt0"), Ntrk, z);
592595
registry.fill(HIST("Tracks/2Danalysis/EventsNtrkZvtx_sel8_inelgt0"), Ntrk, z);
593596
eventsInel.insert(collision.globalIndex());
@@ -599,7 +602,7 @@ struct PseudorapidityDensityMFT {
599602
registry.fill(HIST("EventSelection"), 12.);
600603
}
601604
int64_t i = 0.0, j = 0.0, k = 0.0;
602-
for (auto& retrack : retracks) {
605+
for (const auto& retrack : retracks) {
603606
auto track = retrack.mfttrack();
604607
if ((cfgnEta1 < track.eta()) && (track.eta() < cfgnEta2) && track.nClusters() >= cfgnCluster && retrack.ambDegree() > 0) {
605608
registry.fill(HIST("Tracks/2Danalysis/EtaZvtx_sel8"), track.eta(), z);
@@ -609,11 +612,11 @@ struct PseudorapidityDensityMFT {
609612
}
610613
}
611614
if (retracks.size() > 0) {
612-
registry.fill(HIST("EventSelection"), 5.);
615+
registry.fill(HIST("EventSelection"), 6.);
613616
if (midtracks.size() > 0) {
614617
registry.fill(HIST("Tracks/2Danalysis/EventsNtrkZvtx_sel8_inelfwdgt0"), Ntrk, z);
615618
}
616-
for (auto& retrack : retracks) {
619+
for (const auto& retrack : retracks) {
617620
auto track = retrack.mfttrack();
618621

619622
if ((cfgnEta1 < track.eta()) && (track.eta() < cfgnEta2) && track.nClusters() >= cfgnCluster) {
@@ -736,7 +739,7 @@ struct PseudorapidityDensityMFT {
736739
registry.fill(HIST("hNumCollisions_Inel"), 1, eventsInel.size());
737740
}
738741
} else {
739-
registry.fill(HIST("EventSelection"), 6);
742+
registry.fill(HIST("EventSelection"), 7);
740743
}
741744
}
742745
PROCESS_SWITCH(PseudorapidityDensityMFT, processMultReassoc,
@@ -759,17 +762,17 @@ struct PseudorapidityDensityMFT {
759762

760763
registry.fill(HIST("Events/Centrality/NtrkZvtx"), Ntrk, z, c);
761764

762-
for (auto& track : tracks) {
765+
for (const auto& track : tracks) {
763766

764767
float phi = track.phi();
765768
o2::math_utils::bringTo02Pi(phi);
766769

767770
if (usePhiCut) {
768771
if ((phi < cfgPhiCut) ||
769-
((phi > M_PI - cfgPhiCut) && (phi < M_PI + cfgPhiCut)) ||
770-
(phi > 2. * M_PI - cfgPhiCut) ||
771-
((phi > ((M_PI / 2. - 0.1) * M_PI) - cfgPhiCut) &&
772-
(phi < ((M_PI / 2. - 0.1) * M_PI) + cfgPhiCut)))
772+
((phi > o2::constants::math::PI - cfgPhiCut) && (phi < o2::constants::math::PI + cfgPhiCut)) ||
773+
(phi > o2::constants::math::TwoPI - cfgPhiCut) ||
774+
((phi > ((o2::constants::math::PIHalf - 0.1) * o2::constants::math::PI) - cfgPhiCut) &&
775+
(phi < ((o2::constants::math::PIHalf - 0.1) * o2::constants::math::PI) + cfgPhiCut)))
773776
continue;
774777
}
775778

@@ -807,7 +810,7 @@ struct PseudorapidityDensityMFT {
807810
auto perCollisionMCSample = mcSample->sliceByCached(
808811
aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache);
809812
auto nCharged = 0;
810-
for (auto& particle : perCollisionMCSample) {
813+
for (const auto& particle : perCollisionMCSample) {
811814
auto charge = 0.;
812815
auto p = pdg->GetParticle(particle.pdgCode());
813816
if (p != nullptr) {
@@ -824,7 +827,7 @@ struct PseudorapidityDensityMFT {
824827
auto perCollisionMCSampleCentral = mcSampleCentral->sliceByCached(
825828
aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache);
826829
auto nChargedCentral = 0;
827-
for (auto& particle : perCollisionMCSampleCentral) {
830+
for (const auto& particle : perCollisionMCSample) {
828831
auto charge = 0.;
829832
auto p = pdg->GetParticle(particle.pdgCode());
830833
if (p != nullptr) {
@@ -849,9 +852,12 @@ struct PseudorapidityDensityMFT {
849852

850853
LOGP(debug, "MC col {} has {} reco cols", mcCollision.globalIndex(),
851854
collisions.size());
852-
for (auto& collision : collisions) {
855+
for (const auto& collision : collisions) {
853856
registry.fill(HIST("EventEfficiency"), 3.);
854-
if (!useEvSel || (useEvSel && collision.sel8())) {
857+
if (!disableITSROFCut && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) {
858+
return;
859+
}
860+
if (!useEvSel || (useEvSel && collision.selection_bit(aod::evsel::kIsTriggerTVX) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder))) {
855861
atLeastOne = true;
856862
auto perCollisionSample = sample->sliceByCached(
857863
o2::aod::fwdtrack::collisionId, collision.globalIndex(), cache);
@@ -888,7 +894,7 @@ struct PseudorapidityDensityMFT {
888894
registry.fill(HIST("EventsSplitMult"), nCharged);
889895
}
890896
if ((mcCollision.posZ() >= cfgVzCut1) && (mcCollision.posZ() <= cfgVzCut2)) {
891-
for (auto& particle : particles) {
897+
for (const auto& particle : particles) {
892898
auto p = pdg->GetParticle(particle.pdgCode());
893899
auto charge = 0;
894900
if (p != nullptr) {
@@ -943,7 +949,7 @@ struct PseudorapidityDensityMFT {
943949

944950
float c_gen = -1;
945951
bool atLeastOne = false;
946-
for (auto& collision : collisions) {
952+
for (const auto& collision : collisions) {
947953
float c_rec = -1;
948954
if constexpr (ExColsGenCent::template contains<aod::CentFT0Cs>()) {
949955
c_rec = collision.centFT0C();
@@ -972,7 +978,7 @@ struct PseudorapidityDensityMFT {
972978
aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache);
973979
auto nCharged = 0;
974980

975-
for (auto& particle : perCollisionMCSample) {
981+
for (const auto& particle : perCollisionMCSample) {
976982
auto p = pdg->GetParticle(particle.pdgCode());
977983
auto charge = 0;
978984
if (p != nullptr) {
@@ -989,7 +995,7 @@ struct PseudorapidityDensityMFT {
989995
mcCollision.posZ(), c_gen);
990996
}
991997

992-
for (auto& particle : particles) {
998+
for (const auto& particle : particles) {
993999
auto p = pdg->GetParticle(particle.pdgCode());
9941000
auto charge = 0;
9951001
if (p != nullptr) {
@@ -1025,7 +1031,7 @@ struct PseudorapidityDensityMFT {
10251031
MFTTracksLabeled const& tracks, aod::McParticles const&)
10261032
{
10271033
if (!useEvSel || (useEvSel && collision.sel8())) {
1028-
for (auto& track : tracks) {
1034+
for (const auto& track : tracks) {
10291035
if (!track.has_mcParticle()) {
10301036
continue;
10311037
}

0 commit comments

Comments
 (0)