ATLAS Offline Software
Loading...
Searching...
No Matches
HIEventSelectionToolRun3.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
5
6std::string HI::toString(HI::IonDataType when) {
7 switch (when) {
9 return "PbPb2015";
11 return "PbPb2018";
13 return "PbPb2023";
15 return "PbPb2024_Shadowing";
17 return "PbPb2024_NoShadowing";
19 return "OO2025";
21 return "NeNe2025";
23 return "PbPb2025";
25 return "PbPb2026";
26 default:
27 return std::string("UNKNOWN HI DATA TAKING PERIOD ") +
28 std::to_string(static_cast<uint8_t>(when));
29 }
30}
31
32std::string HI::toString(HI::PileupVariation variation) {
33 switch (variation) {
35 return "Nominal";
37 return "Tight";
39 return "Loose";
40 default:
41 return std::string("UNKNOWN PU VARIATION ") +
42 std::to_string(static_cast<uint8_t>(variation));
43 }
44}
45
48
50 ATH_MSG_INFO("Initializing HIEventSelectionToolRun3");
51 // add printout of overall selection that is configured
52 return StatusCode::SUCCESS;
53}
54
56 const xAOD::EventInfo* eventInfo) const {
57 if (!eventInfo)
58 return false;
59
60 // Standard ATLAS error checks
62 return false;
64 return false;
66 return false;
68 return false;
69
70 return true;
71}
72
74 float et = 0;
75 for (auto slice : *es) {
76 const static std::set fcalLayers({21, 22, 23});
77 if (fcalLayers.contains(slice->layer()))
78 et += slice->et();
79 }
80 return et * 1e-6; // we operate in TeV
81}
82float calcZDCE(const xAOD::ZdcModuleContainer* zdcModules) {
83 float e = 0;
84 static const SG::ConstAccessor<float> calibEnergyAccessor("CalibEnergy");
85 for (auto module : *zdcModules) {
86 e += calibEnergyAccessor(*module);
87 }
88 return e * 1e-3; // we operate in GeV
89}
90
93 const xAOD::ZdcModuleContainer* zdcModules,
94 HI::PileupVariation variation) const {
95 return puZDCvsFCal(when, calcFcalEt(es), calcZDCE(zdcModules), variation);
96}
97
99 HI::IonDataType when, float fcalEt, float zdcE,
100 HI::PileupVariation variation) const {
101 const float cut = zdcCutValue(when, fcalEt, variation);
102 return zdcE > cut;
103}
104
106 HI::IonDataType when, float fcalEt, int ntrk,
107 HI::PileupVariation variation) const {
108 const float cut = ntrkCutValue(when, fcalEt, variation);
109 return ntrk < cut;
110}
111
113 HI::IonDataType when, float /*fcalEt*/, float presamplerA,
114 float presamplerC, HI::PileupVariation variation) const {
115 // not sure if fcalEt will be involved i.e. apply this cut only above certain
116 // fcalEt
117
118 if (when == HI::IonDataType::PbPb2023) {
119 // from ATL-COM-PHYS-2025-033 + priv. communication F.Pauwels
120 const float peakPositionA = -56;
121 const float peakPositionC = -156;
122 const float peakWidthA = 51.8;
123 const float peakWidthC = 51.8;
124 float sigma = 7;
125 if (variation == HI::PileupVariation::Tight) {
126 sigma = 8;
127 }
128 if (variation == HI::PileupVariation::Loose) {
129 sigma = 6;
130 }
131 if (presamplerA > (peakPositionA + sigma * peakWidthA) and
132 presamplerC > (peakPositionC + sigma * peakWidthC)) {
133 return true; // it is pileup
134 }
135 }
136 return false;
137}
138
140 HI::IonDataType, const xAOD::VertexContainer* vertices) const {
141 if (!vertices)
142 return false;
143
144 unsigned int nPrimary = 0;
145 for (const xAOD::Vertex* vx : *vertices) {
146 if (vx->vertexType() == xAOD::VxType::PriVtx)
147 ++nPrimary;
148 }
149
150 // Typical HI requirement: exactly one PV
151 return (nPrimary == 1);
152}
153
155 HI::IonDataType when, float fcalEt, HI::PileupVariation variation) const {
156 if (fcalEt > 100.0)
157 throw std::runtime_error(
158 std::to_string(fcalEt) +
159 " the energy that is given to zdcCutValue is well above 100 TeV?, "
160 "likely you call it not converting energy to TeV");
161
162 if (when == HI::IonDataType::PbPb2023) {
163
164 auto cutFunction = [](float et) {
165 const static double a = 334.29, b = -20.39,
166 c = -2.38; // from ATL-COM-PHYS-2025-033
167 return a + b * et + c * et * et;
168 };
169
170 float cut = cutFunction(fcalEt);
171 if (fcalEt <= 1.0) // below 1 TeV use flat
172 cut = cutFunction(1.0);
173 if (fcalEt >= 4.0) // below 1 TeV use flat
174 cut = cutFunction(4.0);
175
176 if (variation == HI::PileupVariation::Tight) {
177 cut *= 1.02;
178 }
179 if (variation == HI::PileupVariation::Loose) {
180 cut *= 0.98;
181 }
182 return cut;
183 }
184 throw std::runtime_error(std::string("period of id ") + HI::toString(when) +
185 "is not handled");
186 ;
187 return 0;
188}
193
198
200 uint32_t run) const {
201 if (run < 365498)
202 throw std::runtime_error(std::to_string(run) +
203 " not handled by selection tool");
204 if (run <= 367384)
206 if (run <= 461633)
208 if (run <= 489691)
210 if (run <= 490223)
212 if (run <= 501969)
214 if (run <= 502008)
216 if (run <= 512049)
218 // fill it up with 2026
219 throw std::runtime_error(std::to_string(run) +
220 " not handled by selection tool");
221}
222// } // namespace HI
#define ATH_MSG_INFO(x)
float calcZDCE(const xAOD::ZdcModuleContainer *zdcModules)
float calcFcalEt(const xAOD::HIEventShapeContainer *es)
static Double_t a
virtual bool puZDCvsFCal(HI::IonDataType when, const xAOD::HIEventShapeContainer *es, const xAOD::ZdcModuleContainer *zdcModules, HI::PileupVariation variation) const override
true if this is pileup event It computes necessary quantities and invokes method defined next to perf...
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
float zdcCutValue(IonDataType, float fcalEt, PileupVariation) const
virtual bool puNtrkvsFCal(IonDataType dataType, float fcalEt, int ntrk, PileupVariation variation=PileupVariation::Nominal) const override
true if this is pileup event
virtual bool puZDCPSvsFCal(IonDataType dataType, float fcalEt, float presamplerA, float presamplerC, PileupVariation variation=PileupVariation::Nominal) const override
true if this is pileup event Code sample to obtain presampler energies Float_t PreSamplerAmp_A = 0; F...
virtual bool noDetectorError(const xAOD::EventInfo *eventInfo) const override
Checks basic event flags.
float ntrkCutValue(IonDataType, float fcalEt, PileupVariation) const
HIEventSelectionToolRun3(const std::string &name)
virtual bool puOOVertexCuts(IonDataType dataType, const xAOD::VertexContainer *vertices) const override
true if this is pileup event
virtual IonDataType toDataType(const xAOD::EventInfo *eventInfo) const override
translates info in EV into HI data type
IonDataType runNumberToDataType(uint32_t run) const
Helper class to provide constant type-safe access to aux data.
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
@ Tile
The Tile calorimeter.
@ Pixel
The pixel tracker.
@ LAr
The LAr calorimeter.
@ Error
The sub-detector issued an error.
uint32_t runNumber() const
The current event's run number.
EventFlagErrorState errorState(EventFlagSubDet subDet) const
Get the error state for a particular sub-detector.
std::string toString(IonDataType)
@ PriVtx
Primary vertex.
ZdcModuleContainer_v1 ZdcModuleContainer
EventInfo_v1 EventInfo
Definition of the latest event info version.
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
HIEventShapeContainer_v2 HIEventShapeContainer
Define the latest version of the container.
Extra patterns decribing particle interation process.
int run(int argc, char *argv[])