7#include <nlohmann/json.hpp>
14 case IonDataType::_N: \
27 return std::string(
"UNKNOWN HI DATA TAKING PERIOD ") +
28 std::to_string(
static_cast<uint8_t
>(period));
35 case PileupVariation::_N: \
43 return std::string(
"UNKNOWN PU VARIATION ") +
44 std::to_string(
static_cast<uint8_t
>(variation));
51 case HI::SelectionMask::_N: \
66 return std::string(
"UNKNOWN mask bit ") +
67 std::to_string(
static_cast<unsigned int>(m));
72static const double MeV = 1.;
73static const double GeV = 1e3;
74static const double TeV = 1e6;
77 const std::string path =
79 std::ifstream i(path);
81 throw std::runtime_error(path +
" does nto exist");
88 const size_t nbins = j.at(
"fNbins").get<
size_t>();
90 auto h = std::make_unique<TH1D>(j.at(
"fName").get<std::string>().c_str(),
91 j.at(
"fTitle").get<std::string>().c_str(),
92 nbins, j.at(
"fXmin").get<
double>(),
93 j.at(
"fXmax").get<
double>());
94 const std::vector<double>
bins = j.at(
"fArray").get<std::vector<double>>();
95 if (
bins.size() != j.at(
"fNbins").get<
size_t>() + 2) {
96 throw std::runtime_error(
97 "Histogram " + j.at(
"fName").get<std::string>() +
98 " has inconsistent number of bins and fNbins (should +2) value " +
99 std::to_string(
bins.size()) +
" and " + std::to_string(nbins));
102 for (
size_t bin = 0;
bin < nbins + 2;
bin++) {
137 loadHist(
"PUFCalVsZDCNominalPbPb2023.json");
139 return StatusCode::SUCCESS;
163 for (
auto slice : *es) {
164 const static std::set fcalLayers({21, 22, 23});
165 if (fcalLayers.contains(slice->layer()))
175 for (
auto module : *zdcModules) {
176 e += calibEnergyAccessor(*module);
210 if (trk->pt() < min_pt_cut)
223 double min_pt_cut = -1;
231 nTrk(period, tracks, vertices, min_pt_cut),
244 if (ntrk < (-80 +
fcalEt * 0.6))
246 if (ntrk < (-30 +
fcalEt * 0.4))
248 if (ntrk > (100 +
fcalEt * 1.7))
252 if (ntrk < (-70 +
fcalEt * 0.6))
254 if (ntrk < (-20 +
fcalEt * 0.35))
256 if (ntrk > (100 +
fcalEt * 1.7))
260 throw std::runtime_error(std::string(
"puFCalVsNtracks for period of id ") +
268 float PreSamplerAmp_A = 0;
269 float PreSamplerAmp_C = 0;
271 for (
const auto module : *zdcModules) {
273 if (module->zdcType() != 0)
275 if (module->zdcSide() > 0)
276 PreSamplerAmp_C += accPreSampleAmp(*module);
277 if (module->zdcSide() < 0)
278 PreSamplerAmp_A += accPreSampleAmp(*module);
280 return {PreSamplerAmp_A, PreSamplerAmp_C};
291 IonDataType period,
float presamplerA,
float presamplerC,
295 const float peakPositionA = -56;
296 const float peakPositionC = -156;
297 const float peakWidthA = 51.8;
298 const float peakWidthC = 51.8;
306 if (presamplerA > (peakPositionA + sigma * peakWidthA) and
307 presamplerC > (peakPositionC + sigma * peakWidthC)) {
312 throw std::runtime_error(std::string(
"ZDC PreSampleAmp for period of id ") +
321 if (vertices->
size() <= 1) {
326 unsigned int nPrimary = 0;
327 unsigned int nSplit = 0;
330 int num_vtx_tot = vertices->
size() - 1;
334 if (vtx_counter > num_vtx_tot)
339 const double sigmaZSq = vtx_err(2, 2);
340 if (sigmaZSq >= 0.02)
345 ATH_MSG_DEBUG(
"nPrimary " << nPrimary <<
", nSplit " << nSplit);
349 if (nSplit > 0 && nPrimary == 0) {
350 ATH_MSG_DEBUG(
"Returning true as all vertices classified as split");
354 return nPrimary == 1;
365 if (fcalEtTeV <= 1.0)
367 if (fcalEtTeV >= 4.0)
404 throw std::runtime_error(
405 std::string(
"zdcCutValue needed in FCal vs ZDC E for period of id ") +
413 int negSideCount = 0;
414 int posSideCount = 0;
415 for (
auto topo : *topos) {
416 if (topo->pt() < 400. *
MeV)
419 if (topo->eta() > 3.1) {
422 if (topo->eta() < -3.1) {
426 return posSideCount > 0 && negSideCount > 0;
440 uint32_t
run)
const {
442 throw std::runtime_error(std::to_string(
run) +
443 " not handled by selection tool");
459 throw std::runtime_error(std::to_string(
run) +
460 " not handled by selection tool");
#define ATH_CHECK
Evaluate an expression and check for errors.
#define AmgSymMatrix(dim)
static const std::vector< std::string > bins
Header file for AthHistogramAlgorithm.
size_type size() const noexcept
Returns the number of elements in the collection.
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
Helper class to provide constant type-safe access to aux data.
@ 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.
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
@ NoPUOOSingleVertexNominal
@ NoPUFCalVsNTrackNominal
std::string toString(IonDataType)
ZdcModuleContainer_v1 ZdcModuleContainer
EventInfo_v1 EventInfo
Definition of the latest event info version.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
HIEventShapeContainer_v2 HIEventShapeContainer
Define the latest version of the container.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
Extra patterns decribing particle interation process.
int run(int argc, char *argv[])