ATLAS Offline Software
L1DynamicPedestalProviderTxt.h
Go to the documentation of this file.
1 
2 /*
3  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
4 */
5 /*
6  * @file L1DynamicPedestalProviderTxt.h
7  * @author V. Scharf <vscharf@kip.uni-heidelberg.de>
8  * @date June 2014
9  * @brief Tool to retrieve dynamic pedestal values from a text file.
10  */
11 
12 #ifndef TRIGT1CALOTOOLS_L1DYNAMICPEDESTALPYTHON_H
13 #define TRIGT1CALOTOOLS_L1DYNAMICPEDESTALPYTHON_H
14 
16 
18 #include "GaudiKernel/ToolHandle.h"
21 
22 #include <array>
23 #include <cstdint> // for guaranteed size-types
24 #include <memory>
25 #include <stdexcept>
26 #include <string>
27 #include <utility> // std::pair
28 #include <vector>
29 
30 namespace LVL1
31 {
35  class ParseException : public std::runtime_error
36  {
37  public:
38  ParseException(const std::string& what) : std::runtime_error(what)
39  {}
40  };
41 
54  virtual public IL1DynamicPedestalProvider
55  {
56  public:
58  L1DynamicPedestalProviderTxt(const std::string&,const std::string&,const IInterface*);
59 
62 
64  virtual StatusCode initialize() override;
65 
67  virtual int dynamicPedestal(int iEta, int layer, int pedestal, int iBCID, float mu) const override;
68 
69  // forward declaration for a function that evaluates the correction as function of mu
70  class ParamFunc;
71  private:
72 
73  // Stores the the correction for each eta-slice (the "outer" index of the vector) and bcid (the "inner" index).
74  // The first entry of the array is for trains after short gaps, the second for trains after long gaps.
75  std::array<std::vector<std::vector<std::unique_ptr<ParamFunc>>>, 2> m_emParameterizations;
76  std::array<std::vector<std::vector<std::unique_ptr<ParamFunc>>>, 2> m_hadParameterizations;
77 
80  {this, "BunchCrossingCondDataKey", "BunchCrossingData" ,"SG Key of BunchCrossing CDO"};
81 
82  std::string m_inputFileEMShort;
83  std::string m_inputFileHADShort;
84  std::string m_inputFileEMLong;
85  std::string m_inputFileHADLong;
86 
87  // maps the BCID (index) to the distance from the head of the train (after short or long gap)
88  // bool: long-gap train (true); short-gap train (false)
89  std::pair<bool, int> distanceFromHeadOfTrain(int bcid) const;
90 
91  // parses the input file
92  void parseInputFile(const std::string& fileName, std::vector<std::vector<std::unique_ptr<ParamFunc>>>& params);
93 
94  static const unsigned s_nElements = 33;
95  static const unsigned s_nBCIDPerTrain = 74; // actually 72 filled BCIDs + one before and one after
96  }; // end of class L1DynamicPedestalProviderTxt
97 } // end of namespace
98 
99 #endif // TRIGT1CALOTOOLS_L1DYNAMICPEDESTALPYTHON_H
LVL1::L1DynamicPedestalProviderTxt::s_nBCIDPerTrain
static const unsigned s_nBCIDPerTrain
Definition: L1DynamicPedestalProviderTxt.h:95
LVL1::L1DynamicPedestalProviderTxt::s_nElements
static const unsigned s_nElements
Definition: L1DynamicPedestalProviderTxt.h:94
LVL1::L1DynamicPedestalProviderTxt::m_inputFileEMShort
std::string m_inputFileEMShort
Definition: L1DynamicPedestalProviderTxt.h:82
LVL1::L1DynamicPedestalProviderTxt::ParamFunc
Definition: L1DynamicPedestalProviderTxt.cxx:29
LVL1::L1DynamicPedestalProviderTxt::m_hadParameterizations
std::array< std::vector< std::vector< std::unique_ptr< ParamFunc > > >, 2 > m_hadParameterizations
Definition: L1DynamicPedestalProviderTxt.h:76
IL1DynamicPedestalProvider.h
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1::L1DynamicPedestalProviderTxt::m_emParameterizations
std::array< std::vector< std::vector< std::unique_ptr< ParamFunc > > >, 2 > m_emParameterizations
Definition: L1DynamicPedestalProviderTxt.h:70
LVL1::L1DynamicPedestalProviderTxt::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition: L1DynamicPedestalProviderTxt.cxx:87
LVL1::L1DynamicPedestalProviderTxt::~L1DynamicPedestalProviderTxt
virtual ~L1DynamicPedestalProviderTxt()
default destructor
Definition: L1DynamicPedestalProviderTxt.cxx:80
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
LVL1::ParseException::ParseException
ParseException(const std::string &what)
Definition: L1DynamicPedestalProviderTxt.h:38
LVL1::L1DynamicPedestalProviderTxt::distanceFromHeadOfTrain
std::pair< bool, int > distanceFromHeadOfTrain(int bcid) const
Definition: L1DynamicPedestalProviderTxt.cxx:179
LVL1::L1DynamicPedestalProviderTxt::m_inputFileEMLong
std::string m_inputFileEMLong
Definition: L1DynamicPedestalProviderTxt.h:84
LVL1::L1DynamicPedestalProviderTxt::dynamicPedestal
virtual int dynamicPedestal(int iEta, int layer, int pedestal, int iBCID, float mu) const override
retrieve the bcidCorrection value
Definition: L1DynamicPedestalProviderTxt.cxx:205
LVL1::L1DynamicPedestalProviderTxt
Tool to retrieve dynamic pedestal values from a text file.
Definition: L1DynamicPedestalProviderTxt.h:55
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
AthAlgTool.h
ReadCondHandleKey.h
LVL1::L1DynamicPedestalProviderTxt::parseInputFile
void parseInputFile(const std::string &fileName, std::vector< std::vector< std::unique_ptr< ParamFunc >>> &params)
Definition: L1DynamicPedestalProviderTxt.cxx:295
python.ExitCodes.what
def what(code)
Definition: ExitCodes.py:73
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
SG::ReadCondHandleKey< BunchCrossingCondData >
LVL1::L1DynamicPedestalProviderTxt::m_inputFileHADShort
std::string m_inputFileHADShort
Definition: L1DynamicPedestalProviderTxt.h:83
BunchCrossingCondData.h
Replaces the BunchCrossing AlgTool used in run1/2.
LVL1::L1DynamicPedestalProviderTxt::L1DynamicPedestalProviderTxt
L1DynamicPedestalProviderTxt(const std::string &, const std::string &, const IInterface *)
constructor
Definition: L1DynamicPedestalProviderTxt.cxx:52
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
AthAlgTool
Definition: AthAlgTool.h:26
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
xAOD::iEta
setScale setgFexType iEta
Definition: gFexJetRoI_v1.cxx:74
LVL1::ParseException
Definition: L1DynamicPedestalProviderTxt.h:36
LVL1::L1DynamicPedestalProviderTxt::m_bcDataKey
SG::ReadCondHandleKey< BunchCrossingCondData > m_bcDataKey
Definition: L1DynamicPedestalProviderTxt.h:80
LVL1::IL1DynamicPedestalProvider
Definition: IL1DynamicPedestalProvider.h:22
LVL1::L1DynamicPedestalProviderTxt::m_inputFileHADLong
std::string m_inputFileHADLong
Definition: L1DynamicPedestalProviderTxt.h:85