ATLAS Offline Software
L1TriggerTowerTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
5 // L1TriggerTowerTool.h,
7 
8  /***************************************************************************
9  * *
10  * *
11  ***************************************************************************/
12 
13 #ifndef L1TRIGGERTOWERTOOL_H
14 #define L1TRIGGERTOWERTOOL_H
15 
16 #include <any>
17 
19 #include "GaudiKernel/IIncidentListener.h"
20 #include "GaudiKernel/ToolHandle.h"
21 #include "GaudiKernel/ServiceHandle.h"
26 #include "TrigConfData/L1Menu.h"
28 
33 
34 class CaloIdManager;
35 class CaloLVL1_ID;
37 class Incident;
38 
39 
40 
41 
42 namespace LVL1
43 {
44  class IL1CaloMappingTool;
45  class IL1CaloTTIdTools;
46  class IL1DynamicPedestalProvider;
47 
60  class ATLAS_NOT_THREAD_SAFE L1TriggerTowerTool : virtual public IL1TriggerTowerTool, public IIncidentListener, public AthAlgTool
61  {
62  public:
63 
64  L1TriggerTowerTool(const std::string&,const std::string&,const IInterface*);
65 
67  virtual ~L1TriggerTowerTool ();
68 
70  virtual StatusCode initialize();
72  virtual StatusCode finalize();
74  virtual void handle(const Incident&);
76  virtual StatusCode retrieveConditions();
77 
79  virtual void process(const std::vector<int> &digits,
80  double eta, double phi, int layer,
81  std::vector<int> &et, std::vector<int> &bcidResults,
82  std::vector<int> &bcidDecisions, bool useJepLut = true);
83 
84  virtual void process(const std::vector<int> &digits, const L1CaloCoolChannelId& channelId,
85  std::vector<int> &et, std::vector<int> &bcidResults,
86  std::vector<int> &bcidDecisions, bool useJepLut = true);
87 
88  virtual void simulateChannel(const xAOD::TriggerTower& tt, std::vector<int>& outCpLut, std::vector<int>& outJepLut, std::vector<int>& bcidResults, std::vector<int>& bcidDecisions);
89 
90  virtual void pedestalCorrection(std::vector<int>& firInOut, int firPed, int iElement, int layer,
91  int bcid, float mu, std::vector<int_least16_t>& correctionOut);
92  virtual void fir(const std::vector<int> &digits, const L1CaloCoolChannelId& channelId, std::vector<int> &output);
93  virtual void fir(const std::vector<int> &digits, const std::vector<int> &firCoeffs, std::vector<int> &output);
94  virtual void dropBits(const std::vector<int> &fir, const L1CaloCoolChannelId& channelId, std::vector<int> &output);
95  virtual void dropBits(const std::vector<int> &fir, unsigned int first, std::vector<int> &output);
96  virtual void etRange(const std::vector<int> &et, const L1CaloCoolChannelId& channelId, std::vector<int> &output);
97  virtual void etRange(const std::vector<int> &et, int energyLow, int energyHigh, std::vector<int> &output);
98  virtual void peakBcid(const std::vector<int> &fir, const L1CaloCoolChannelId& channelId, std::vector<int> &output);
99  virtual void peakBcid(const std::vector<int> &fir, unsigned int strategy, std::vector<int> &output);
100  virtual void satBcid(const std::vector<int> &digits, const L1CaloCoolChannelId& channelId, std::vector<int> &output);
101  virtual void satBcid(const std::vector<int> &digits, int satLow, int satHigh, int satLevel, std::vector<int> &output);
102  virtual void bcid(const std::vector<int> &fir, const std::vector<int> &digits, const L1CaloCoolChannelId& channelId, std::vector<int> &output);
103  virtual void bcid(const std::vector<int> &fir, const std::vector<int> &digits, unsigned int strategy, int satLow, int satHigh, int satLevel, std::vector<int> &output);
104  virtual void bcid(const std::vector<int> &fir, const std::vector<int> &lutInput, const std::vector<int> &digits, int energyLow, int energyHigh, int decisionSource, std::vector<unsigned int> &decisionConditions,
105  unsigned int strategy, int satLow, int satHigh, int satLevel, std::vector<int> &result, std::vector<int> &decision);
106  virtual void bcidDecisionRange(const std::vector<int>& lutInput, const std::vector<int>& digits, const L1CaloCoolChannelId& channelId, std::vector<int> &output);
107  virtual void bcidDecision(const std::vector<int> &bcidResults, const std::vector<int> &range, const L1CaloCoolChannelId& channelId, std::vector<int> &output);
108  virtual void bcidDecision(const std::vector<int> &bcidResults, const std::vector<int> &range, const std::vector<unsigned int> &mask, std::vector<int> &output);
109  virtual void lut(const std::vector<int> &fir, const L1CaloCoolChannelId& channelId, std::vector<int> &output);
110  virtual void cpLut(const std::vector<int> &fir, const L1CaloCoolChannelId& channelId, std::vector<int> &output);
111  virtual void jepLut(const std::vector<int> &fir, const L1CaloCoolChannelId& channelId, std::vector<int> &output);
112  virtual void lut(const std::vector<int> &fir, int slope, int offset, int cut, int ped, int strategy, bool disabled, std::vector<int> &output);
113  virtual void nonLinearLut(const std::vector<int> &fir, int slope, int offset, int cut, int scale, short par1, short par2, short par3, short par4, bool disabled, std::vector<int> &output);
114  virtual void applyEtRange(const std::vector<int>& lut, const std::vector<int>& range, const L1CaloCoolChannelId& channelId, std::vector<int> &output);
115  virtual void firParams(const L1CaloCoolChannelId& channelId, std::vector<int> &firCoeffs);
116  virtual void bcidParams(const L1CaloCoolChannelId& channelId, int &energyLow, int &energyHigh, int &decisionSource, std::vector<unsigned int> &decisionConditions,
117  unsigned int &peakFinderStrategy, int &satLow, int &satHigh, int &satLevel);
118  virtual void lutParams(const L1CaloCoolChannelId& channelId, int &startBit, int &slope, int &offset, int &cut, int &pedValue, float &pedMean, int &strategy, bool &disabled);
119  virtual void cpLutParams(const L1CaloCoolChannelId& channelId, int &startBit, int &slope, int &offset, int &cut, int &pedValue, float &pedMean, int &strategy, bool &disabled);
120  virtual void jepLutParams(const L1CaloCoolChannelId& channelId, int &startBit, int &slope, int &offset, int &cut, int &pedValue, float &pedMean, int &strategy, bool &disabled);
121  virtual Identifier identifier(double eta, double phi, int layer);
122  virtual HWIdentifier hwIdentifier(const Identifier& id);
123  virtual HWIdentifier hwIdentifier(double eta, double phi, int layer);
124  virtual L1CaloCoolChannelId channelID(double eta, double phi, int layer);
125  virtual L1CaloCoolChannelId channelID(const Identifier& id);
126  virtual bool satOverride(int range, const L1CaloCoolChannelId& channelId);
127  virtual bool disabledChannel(const L1CaloCoolChannelId& channelId);
128  virtual double FCalTTeta(const L1CaloCoolChannelId& channelId);
129  virtual double FCalTTeta(double nominalEta, double phi, int layer);
130  virtual void setDebug(bool debug);
131  virtual std::pair<double, double> refValues(const L1CaloCoolChannelId& channelId);
132  virtual StatusCode loadFTRefs();
133 
134  private:
135  bool isRun2() const;
136 
138  template <typename T>
139  void printVec(const std::vector<T>& vec);
140 
142  bool disabledChannel(const L1CaloCoolChannelId& channelId, unsigned int& noiseCut);
143 
144  bool m_debug = false;
145 
148 
151 // L1CaloTTIdTools* m_l1CaloTTIdTools;
152  ToolHandle<LVL1::IL1CaloTTIdTools> m_l1CaloTTIdTools;
153  ToolHandle<CaloTriggerTowerService> m_ttSvc;
154 
156  ToolHandle<LVL1::IL1CaloMappingTool> m_mappingTool;
157 
159  SG::ReadCondHandleKey<L1CaloRunParametersContainer> m_runParametersContainerKey{ this, "InputKeyRunParameters", "L1CaloRunParametersContainer"};
160  SG::ReadCondHandleKey<L1CaloPprConditionsContainerRun2> m_conditionsContainerKeyRun2{ this, "InputKeyPprConditionsRun2", "L1CaloPprConditionsContainerRun2"};
161  SG::ReadCondHandleKey<L1CaloPprDisabledChannelContainerRun2> m_disabledChannelContainerKeyRun2{ this, "InputKeyDisabledChannelRun2", "L1CaloPprDisabledChannelContainerRun2"};
162  SG::ReadCondHandleKey<L1CaloPpmFineTimeRefsContainer> m_dbFineTimeRefsTowersKey{ this, "InputKeyTimeRefs", "L1CaloPpmFineTimeRefsContainer"};
163 
164  const L1CaloRunParametersContainer* m_runParametersContainer = nullptr;
165 
166  // - Note: 2024, dropped support for non-Run2 case
167  // this is why these were std::any, to allow for both possibilities when it was previously supported
168  std::any m_conditionsContainer; // one of L1CaloPprConditionsContainer{,Run2}*
169  std::any m_disabledChannelContainer; // one of L1CaloPprDisabledChannelContainer{,Run2}*
170 
172  const L1CaloPpmFineTimeRefsContainer* m_dbFineTimeRefsTowers = nullptr;
173 
174 
176  std::vector<unsigned int> m_idTable;
177 
180  ToolHandle<LVL1::IL1DynamicPedestalProvider> m_dynamicPedestalProvider;
181 
183  { this, "EventInfoKey", "EventInfo", "" };
184  SG::ReadHandleKey<TrigConf::L1Menu> m_L1MenuKey{ this, "L1TriggerMenu", "DetectorStore+L1TriggerMenu", "L1 Menu" };
185 
186 
188  static const int s_saturationValue = 255;
189  static const int s_maxTowers = 7168;
190  static const int m_nBcid = 350; // mc12: max 350 // all: 3564
191  };
192 
193 } // end of namespace
194 
195 #endif
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
xAOD::strategy
strategy
Definition: L2CombinedMuon_v1.cxx:107
et
Extra patterns decribing particle interation process.
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:50
L1CaloPprDisabledChannelContainerRun2.h
LVL1::L1TriggerTowerTool::m_conditionsContainer
std::any m_conditionsContainer
Definition: L1TriggerTowerTool.h:168
get_generator_info.result
result
Definition: get_generator_info.py:21
LVL1::L1TriggerTowerTool::m_ttSvc
ToolHandle< CaloTriggerTowerService > m_ttSvc
Definition: L1TriggerTowerTool.h:153
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition: checker_macros.h:212
LVL1::L1TriggerTowerTool::m_l1CaloTTIdTools
ToolHandle< LVL1::IL1CaloTTIdTools > m_l1CaloTTIdTools
Definition: L1TriggerTowerTool.h:152
initialize
void initialize()
Definition: run_EoverP.cxx:894
CaloTriggerTowerService
Tool providing the mapping of the online and offline TriggerTower identifiers as well as the TT-cells...
Definition: CaloTriggerTowerService.h:50
LVL1::L1TriggerTowerTool::m_idTable
std::vector< unsigned int > m_idTable
Mapping lookup table.
Definition: L1TriggerTowerTool.h:176
TriggerTowerContainer.h
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
xAOD::identifier
identifier
Definition: UncalibratedMeasurement_v1.cxx:15
SG::ReadHandleKey< xAOD::EventInfo >
HWIdentifier
Definition: HWIdentifier.h:13
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
SUSY_SimplifiedModel_PostInclude.process
string process
Definition: SUSY_SimplifiedModel_PostInclude.py:42
ITkPixEncoding::lut
constexpr auto lut(Generator &&f)
Definition: ITkPixQCoreEncodingLUT.h:19
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
LVL1::L1TriggerTowerTool::m_caloMgr
const CaloIdManager * m_caloMgr
Id managers.
Definition: L1TriggerTowerTool.h:147
LVL1::L1TriggerTowerTool::m_dynamicPedestalProvider
ToolHandle< LVL1::IL1DynamicPedestalProvider > m_dynamicPedestalProvider
Definition: L1TriggerTowerTool.h:180
CaloIdManager
This class initializes the Calo (LAr and Tile) offline identifiers.
Definition: CaloIdManager.h:45
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
L1CaloRunParametersContainer.h
LVL1::L1TriggerTowerTool::m_lvl1Helper
const CaloLVL1_ID * m_lvl1Helper
and tools for computing identifiers
Definition: L1TriggerTowerTool.h:150
xAOD::TriggerTower_v2
Description of TriggerTower_v2.
Definition: TriggerTower_v2.h:49
BindingsTest.cut
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.
Definition: BindingsTest.py:13
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
LVL1::L1TriggerTowerTool::m_disabledChannelContainer
std::any m_disabledChannelContainer
Definition: L1TriggerTowerTool.h:169
Make4DCorrelationMatrix.nominalEta
int nominalEta
Definition: Make4DCorrelationMatrix.py:80
SCT_Monitoring::disabled
@ disabled
Definition: SCT_MonitoringNumbers.h:60
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
L1CaloPprConditionsContainerRun2.h
merge.output
output
Definition: merge.py:17
python.TrigConfigSvcUtils.isRun2
def isRun2(cursor, schemaname)
Definition: TrigConfigSvcUtils.py:290
LVL1::L1TriggerTowerTool
Definition: L1TriggerTowerTool.h:61
CaloLVL1_ID
Helper class for offline TT identifiers.
Definition: CaloLVL1_ID.h:66
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
L1CaloPpmFineTimeRefsContainer.h
EventInfo.h
LVL1::IL1TriggerTowerTool
Definition: IL1TriggerTowerTool.h:29
Example_ReadSampleNoise.ped
ped
Definition: Example_ReadSampleNoise.py:45
SG::ReadCondHandleKey< L1CaloRunParametersContainer >
IL1TriggerTowerTool.h
L1CaloCoolChannelId
Definition: L1CaloCoolChannelId.h:10
LVL1::L1TriggerTowerTool::m_mappingTool
ToolHandle< LVL1::IL1CaloMappingTool > m_mappingTool
and mappings
Definition: L1TriggerTowerTool.h:156
LVL1::L1TriggerTowerTool::m_correctFir
bool m_correctFir
Baseline correction Tool.
Definition: L1TriggerTowerTool.h:179
DeMoScan.first
bool first
Definition: DeMoScan.py:536
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
AthAlgTool
Definition: AthAlgTool.h:26
L1Menu.h
checker_macros.h
Define macros for attributes used to control the static checker.
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
L1CaloPpmFineTimeRefsContainer
Definition: L1CaloPpmFineTimeRefsContainer.h:30
TileDCSDataPlotter.tt
tt
Definition: TileDCSDataPlotter.py:874
L1CaloRunParametersContainer
Definition: L1CaloRunParametersContainer.h:26
Identifier
Definition: IdentifierFieldParser.cxx:14