|
ATLAS Offline Software
|
Go to the documentation of this file.
14 #include <initializer_list>
40 std::array<double, 3>
m_p;
48 std::array<double, 3>
m_p;
57 declareInterface<IL1DynamicPedestalProvider>(
this);
93 if(fileNameEMShort.empty()) {
95 return StatusCode::FAILURE;
97 ATH_MSG_VERBOSE(
"::initialize: resolved input file: " << fileNameEMShort);
102 ATH_MSG_FATAL(
"Could not parse input file: " << fileNameEMShort <<
"; error: " <<
e.what());
103 return StatusCode::FAILURE;
107 if(fileNameEMLong.empty()) {
109 return StatusCode::FAILURE;
111 ATH_MSG_VERBOSE(
"::initialize: resolved input file: " << fileNameEMLong);
116 ATH_MSG_FATAL(
"Could not parse input file: " << fileNameEMLong <<
"; error: " <<
e.what());
117 return StatusCode::FAILURE;
122 if(fileNameHADShort.empty()) {
124 return StatusCode::FAILURE;
126 ATH_MSG_VERBOSE(
"::initialize: resolved input file: " << fileNameHADShort);
131 ATH_MSG_FATAL(
"Could not parse input file: " << fileNameHADShort <<
"; error: " <<
e.what());
132 return StatusCode::FAILURE;
136 if(fileNameHADLong.empty()) {
138 return StatusCode::FAILURE;
140 ATH_MSG_VERBOSE(
"::initialize: resolved input file: " << fileNameHADLong);
145 ATH_MSG_FATAL(
"Could not parse input file: " << fileNameHADLong <<
"; error: " <<
e.what());
146 return StatusCode::FAILURE;
149 return StatusCode::SUCCESS;
155 template<
typename ResultVector>
223 if(iBCID < 0 || (
unsigned)iBCID >= MAX_BCID)
return pedestal;
229 bool longGap = bcidInfo.first;
230 int bcid = bcidInfo.second + 1;
232 if(
bcid < 0)
return pedestal;
241 }
else if(
layer == 1) {
244 ATH_MSG_ERROR(
"Wrong layer index. Give 0 for Em, 1 for Had.");
249 if (dynamic_pedestal < 0) dynamic_pedestal = 0;
251 return dynamic_pedestal;
265 std::vector<size_t>
poly;
266 std::vector<size_t>
exp;
296 std::vector<std::vector<std::unique_ptr<ParamFunc>>>&
params)
298 using std::istream_iterator;
304 const std::set<char> whitespaces{
'\t',
' ',
'\n',
'\r'};
305 for(std::string L; std::getline(
F, L); ) {
306 while ((!L.empty()) && whitespaces.count(L.back())) L.pop_back();
307 if(L.empty())
continue;
308 if(L[0] ==
'#')
continue;
310 std::istringstream
S(L);
313 if(ctx.P == Context::Element) {
322 ctx.P = Context::Poly;
323 }
else if(ctx.P == Context::Poly) {
327 if(C !=
"poly")
throw ParseException(
"got '" + C +
"' expected 'poly'.");
328 std::copy(istream_iterator<size_t>(
S), istream_iterator<size_t>(), std::back_inserter(ctx.poly));
330 ctx.P = Context::Exp;
331 }
else if(ctx.P == Context::Exp) {
335 if(C !=
"exp")
throw ParseException(
"got '" + C +
"' expected 'exp'.");
336 std::copy(istream_iterator<size_t>(
S), istream_iterator<size_t>(), std::back_inserter(ctx.exp));
341 std::vector<float>
P;
343 std::copy(istream_iterator<float>(
S), istream_iterator<float>(), back_inserter(
P));
348 if(std::binary_search(ctx.poly.begin(), ctx.poly.end(), B)) {
349 params[ctx.E][B] = make_unique<ParamFuncPol2>(
P[0],
P[1],
P[2]);
350 }
else if(std::binary_search(ctx.exp.begin(), ctx.exp.end(), B)) {
351 params[ctx.E][B] = make_unique<ParamFuncExp>(
P[0],
P[1],
P[2]);
357 if(++ctx.N == (ctx.poly.size() + ctx.exp.size())) {
369 if(std::find_if(V.begin(), V.end(), [](std::unique_ptr<ParamFunc>&
p) { return p == nullptr; }) != V.end()) {
static const unsigned s_nBCIDPerTrain
int gapAfterBunch(bcid_type bcid=0, BunchDistanceType type=NanoSec) const
Get the distance of the specified bunch crossing to the next filled bunch.
static const unsigned s_nElements
virtual double operator()(double mu)=0
std::string m_inputFileEMShort
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
std::array< double, 3 > m_p
std::string tail(std::string s, const std::string &pattern)
tail of a string
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
std::array< std::vector< std::vector< std::unique_ptr< ParamFunc > > >, 2 > m_hadParameterizations
float round(const float toRound, const unsigned int decimals)
int gapBeforeTrain(bcid_type bcid=0, BunchDistanceType type=NanoSec) const
Gap before the train this BCID is in.
int gapBeforeBunch(bcid_type bcid=0, BunchDistanceType type=NanoSec) const
Get the distance of the specified bunch crossing to the preceeding filled bunch.
#define ATH_MSG_VERBOSE(x)
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
virtual double operator()(double mu)
virtual double operator()(double mu)
std::array< std::vector< std::vector< std::unique_ptr< ParamFunc > > >, 2 > m_emParameterizations
std::array< double, 3 > m_p
constexpr double poly(const double x)
static constexpr int m_MAX_BCID
virtual StatusCode initialize() override
standard Athena-Algorithm method
virtual ~L1DynamicPedestalProviderTxt()
default destructor
std::pair< bool, int > distanceFromHeadOfTrain(int bcid) const
std::string m_inputFileEMLong
virtual int dynamicPedestal(int iEta, int layer, int pedestal, int iBCID, float mu) const override
retrieve the bcidCorrection value
::StatusCode StatusCode
StatusCode definition for legacy code.
@ BunchCrossings
Distance in units of 25 nanoseconds.
@ MiddleEmpty
An empty BCID in the middle of a train.
int distanceFromFront(const bcid_type bcid, const BunchDistanceType type=NanoSec) const
The distance of the specific bunch crossing from the front of the train.
void parseInputFile(const std::string &fileName, std::vector< std::vector< std::unique_ptr< ParamFunc >>> ¶ms)
std::string head(std::string s, const std::string &pattern)
head of a string
std::string to_string(const DetectorType &type)
StatusCode initialize(bool used=true)
setEventNumber setTimeStamp bcid
std::string m_inputFileHADShort
BunchCrossingType bcType(const bcid_type bcid) const
Convenience function for the type of the specific bunch crossing.
constexpr std::enable_if_t< is_bitmask_v< E >, E & > reset(E &lhs, E rhs)
Convenience function to clear bits in a class enum bitmask.
ParamFuncPol2(double p0, double p1, double p2)
L1DynamicPedestalProviderTxt(const std::string &, const std::string &, const IInterface *)
constructor
ParamFuncExp(double p0, double p1, double p2)
SG::ReadCondHandleKey< BunchCrossingCondData > m_bcDataKey
bool isFilled(const bcid_type bcid) const
The simplest query: Is the bunch crossing filled or not?
std::string m_inputFileHADLong