ATLAS Offline Software
Loading...
Searching...
No Matches
Run2TriggerTowerMaker.h
Go to the documentation of this file.
1// -*- C++ -*-
2
3/*
4 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5*/
6
7// ================================================
8// Run2TriggerTowerMaker class description
9// ================================================
10//
11// THIS TEXT TO BE REPLACED BY ATLAS STANDARD FORMAT
12//
13//
14// class: Run2TriggerTowerMaker
15//
16// Description:
17//
18//The Run2TriggerTowerMaker class takes calorimeter cells from the TES and
19// forms Trigger Towers, which it then places back into the TES The calorimeter
20// cells can be produced either by GEANT or other fast simulation packages
21// - this is defined by setting a parameter
22// CellType to 1 for CaloCells, 2 to reprocess TriggerTowers and 3 for LAr/Tile TTL1 input (a simulation of analogue towers);
23//
24// ................................................................ //
25
26#ifndef TRIGT1CALOSIM_RUN2TRIGGERTOWERMAKER_H
27#define TRIGT1CALOSIM_RUN2TRIGGERTOWERMAKER_H
28
29// STL
30#include <array>
31#include <map>
32#include <string>
33#include <utility> // for std::pair, std::make_pair
34#include <vector>
35
36// Athena/Gaudi
38#include "GaudiKernel/ServiceHandle.h"
39#include "GaudiKernel/ToolHandle.h"
44
45//Calorimeter tower includes
48
49//LVL1 Calo trigger includes
57
58#include "TrigConfData/L1Menu.h"
59
60// EDM include(s)
63
64// forward decl(s)
65class CaloLVL1_ID;
71
72class IAthRNGSvc;
73namespace ATHRNG {
74 class RNGWrapper;
75}
76
77namespace CLHEP { class HepRandomEngine; }
78
79namespace LVL1BS {
81}
82
83namespace LVL1
84{
87class TriggerTower;
88
89class Run2TriggerTowerMaker : public AthAlgorithm, virtual public IIncidentListener
90{
91public:
92 //-------------------------
93 // Constructors/Destructors
94 //-------------------------
95 Run2TriggerTowerMaker(const std::string& name, ISvcLocator* pSvcLocator);
96 virtual ~Run2TriggerTowerMaker();
97
98 // These are disallowed
101
102 //------------------------------------------------------
103 // Methods used by Athena to run the algorithm
104 //------------------------------------------------------
105 StatusCode initialize();
106 StatusCode execute();
107 StatusCode finalize();
108
109 void handle(const Incident&);
110
111private:
112 // constants
113 constexpr static int s_FIRLENGTH = 5; // number of FIR coefficients
114 constexpr static int s_MEV = 1000; // scale for converting ET -> counts
115 constexpr static unsigned int m_maxIetaBins = 51; // max numbers of eta regions if we choose a granularity of 0.1 in eta
116
117 // enums -- SIZE must be the last entry in each enum
119
120 // properties
121 // user-defined names for random number engines - keep streams distinct
122 std::string m_digiEngine;
123
124 // Input for this Algorithm, meaning in enum CellTypes
126
127 // pedestal uncertainty and ADC noise
128 double m_adcVar;
129
130 // digitisation, FIR, LUT calibration parameters
131 double m_adcStep;
134
135 //Flag to enable zero suppression (makes algorithm simulation much faster
137
138 // require all calorimeters, or allow running with some missing?
140
141 // database keys for the variousfolders
142 SG::ReadCondHandleKey<L1CaloPprChanCalibContainer> m_chanCalibKey{this,"ChanCalibFolderKey","/TRIGGER/L1Calo/V2/Calibration/Physics/PprChanCalib","PprChanCalib key"};
143 SG::ReadCondHandleKey<L1CaloPprChanDefaultsContainer> m_chanDefaultsKey{this,"ChanDefaultsFolderKey","/TRIGGER/L1Calo/V2/Configuration/PprChanDefaults","PprChanDefaults key"};
144 SG::ReadCondHandleKey<L1CaloDisabledTowersContainer> m_disabledTowersKey{this,"DisabledTowersFolderKey","/TRIGGER/L1Calo/V2/Conditions/DisabledTowers","DisabledTowers key"};
145 SG::ReadCondHandleKey<L1CaloPpmDeadChannelsContainer> m_deadChannelsKey{this,"DeadChannelsFolderKey","/TRIGGER/L1Calo/V2/Calibration/PpmDeadChannels","PpmDeadChannels key"};
150
151 // Tools/Services
152 ServiceHandle <IAthRNGSvc> m_rngSvc;
153 ATHRNG::RNGWrapper* m_rndmADCs; // non owning ptr
154
155 ToolHandle<IL1TriggerTowerTool> m_TTtool{this,"TTTool","LVL1::L1TriggerTowerTool/L1TriggerTowerTool", "The trigger tower tool"};
156 ToolHandle<IL1CaloMappingTool> m_mappingTool;
157 ToolHandle<LVL1BS::ITrigT1CaloDataAccessV2> m_bstowertool;
158
159 const CaloLVL1_ID* m_caloId; //non-owning ptr
160
161 // Global LUT scales
164 // conversion factor from tile amplitude to MeV
166 // TileTTL1 may come with a pedestal - need to subtract if so
168
169 // flag whether we reprocess data
170 // if yes, special treatment of the pedestal correction is necessary
172 // Do overlay?
175
176 // non-owning pointers
185
186 std::unique_ptr<xAOD::TriggerTowerContainer> m_xaodTowers;
187 std::unique_ptr<xAOD::TriggerTowerAuxContainer> m_xaodTowersAux;
188 std::vector<std::vector<double>> m_xaodTowersAmps; // stores the Amps (vector<double>) for each xaodTower
189 std::size_t m_curIndex = 0u;
190
197 std::array<double, m_maxIetaBins> m_sinThetaHash;
198
200 L1CaloCoolChannelId channelId(double eta, double phi, int layer);
201
202
204 StatusCode getTriggerTowers();
206 StatusCode getCaloTowers();
207
209 void digitize(const EventContext& ctx);
210
212 StatusCode preProcess(int bcid,float mu);
213 StatusCode preProcessTower(int bcid,float mu,xAOD::TriggerTower* tower);
214
216 virtual StatusCode addOverlay(int bcid,float mu);
217 virtual StatusCode addOverlay(int bcid,float mu,xAOD::TriggerTower* sigTT,xAOD::TriggerTower* ovTT);
218
220 StatusCode preProcessTower_getLutIn(int bcid,float mu,xAOD::TriggerTower* tower,const L1CaloPprChanCalib* db,const std::vector<int>& digits,std::vector<int>& output);
221
223 StatusCode calcLutOutCP(const std::vector<int>& sigLutIn,const L1CaloPprChanCalib* sigDB,const std::vector<int>& ovLutIn,const L1CaloPprChanCalib* ovDB,std::vector<int>& output);
224 StatusCode calcLutOutJEP(const std::vector<int>& sigLutIn,const L1CaloPprChanCalib* sigDB,const std::vector<int>& ovLutIn,const L1CaloPprChanCalib* ovDB,std::vector<int>& output);
225 void calcCombinedLUT(const std::vector<int>& sigIN,const int sigSlope,const int sigOffset,
226 const std::vector<int>& ovIN,const int ovSlope,const int ovOffset,const int ovNoiseCut,std::vector<int>& output);
227
229 bool IsDeadChannel(const L1CaloPpmDeadChannels* db) const;
230 bool IsDisabledChannel(const L1CaloDisabledTowers* db) const;
231 bool IsGoodTower(const xAOD::TriggerTower* tt,const L1CaloPpmDeadChannelsContainer* dead,const L1CaloDisabledTowersContainer* disabled) const;
232
233
235 void normaliseDigits(const std::vector<int>& sigDigits,const std::vector<int>& ovDigits,std::vector<int>& normDigits);
236
240 StatusCode store();
241
243 void processLArTowers(const LArTTL1Container * );
245
247 double IDeta(const Identifier& id, const CaloLVL1_ID* caloId);
248 double IDphi(const Identifier& id, const CaloLVL1_ID* caloId);
249
251 std::vector<int> ADC(CLHEP::HepRandomEngine* rndmADCs,
252 L1CaloCoolChannelId channel, const std::vector<double>& amps) const;
253 int EtRange(int et, unsigned short bcidEnergyRangeLow, unsigned short bcidEnergyRangeHigh) const;
254
255 // void preProcessLayer(int layer, int eventBCID, InternalTriggerTower* tower, std::vector<int>& etResultVector, std::vector<int>& bcidResultVector);
256
257 int etaToElement(float feta, int layer) const;
258
259 // non-linear LUT
260 int non_linear_lut(int lutin, unsigned short offset, unsigned short slope, unsigned short noiseCut, unsigned short scale, short par1, short par2, short par3, short par4);
261
262 // --------------------------------------------------------------------------
263 // Read and Write Handlers
264 // --------------------------------------------------------------------------
265 SG::ReadHandleKey<xAOD::EventInfo> m_xaodevtKey{this, "xAODEventInfoKey", "EventInfo"};
266 SG::ReadDecorHandleKey<xAOD::EventInfo> m_actMuKey { this, "actualInteractionsPerCrossingKey", m_xaodevtKey, "actualInteractionsPerCrossing", "Decoration for actual interactions per crossing" };
267
268 // location of input TriggerTowers (for reprocessing)
270 // locations within StoreGate to store collections of Trigger Towers
272 // locations within StoreGate to store collections of Trigger Towers for reprocessing
274
275 // location of LAr TTL1 data
279
280 SG::ReadHandleKey<TrigConf::L1Menu> m_L1MenuKey{ this, "L1TriggerMenu", "DetectorStore+L1TriggerMenu", "L1 Menu" };
281};
282
283} // namespace LVL1
284#endif
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
An STL vector of pointers that by default owns its pointed-to elements.
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
TileContainer< TileTTL1 > TileTTL1Container
A wrapper class for event-slot-local random engines.
Definition RNGWrapper.h:56
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Helper class for offline TT identifiers.
Definition CaloLVL1_ID.h:66
Tool providing the mapping of the online and offline TriggerTower identifiers as well as the TT-cells...
manage multiple RandomEngines in thread-safe way.
Definition IAthRNGSvc.h:28
Encapsulates the ID of one channel of conditions data in COOL, ie the ID of a row in a table.
Folder <-> Object mapping for /TRIGGER/L1Calo/V1/Conditions/DisabledTowers .
Folder <-> Object mapping for /TRIGGER/L1Calo/V1/Calibration/PpmDeadChannels .
Folder <-> Object mapping for /TRIGGER/L1Calo/V2/Calibration/Physics/PprChanCalib .
Folder <-> Object mapping for /TRIGGER/L1Calo/V2/Configuration/PprChanDefaults .
Container class for LArTTL1.
A version of the TriggerTower that contains information that would not be availiable during datatakin...
void processLArTowers(const LArTTL1Container *)
extract amplitudes from TTL1
SG::ReadCondHandleKey< L1CaloPpmDeadChannelsContainer > m_deadChannelsKey
int EtRange(int et, unsigned short bcidEnergyRangeLow, unsigned short bcidEnergyRangeHigh) const
SG::ReadHandleKey< xAOD::TriggerTowerContainer > m_inputTTLocation
L1CaloDisabledTowersContainer * m_disabledTowersContaineroverlay
std::vector< std::vector< double > > m_xaodTowersAmps
SG::ReadHandleKey< TileTTL1Container > m_TileTTL1ContainerName
SG::ReadCondHandleKey< L1CaloPprChanCalibContainer > m_chanCalibKey
L1CaloPpmDeadChannelsContainer * m_deadChannelsContaineroverlay
L1CaloPprChanDefaults m_chanDefaultsoverlay
bool IsGoodTower(const xAOD::TriggerTower *tt, const L1CaloPpmDeadChannelsContainer *dead, const L1CaloDisabledTowersContainer *disabled) const
bool IsDeadChannel(const L1CaloPpmDeadChannels *db) const
Database helper functions for dead and disabled towers.
std::unique_ptr< xAOD::TriggerTowerContainer > m_xaodTowers
SG::WriteHandleKey< xAOD::TriggerTowerContainer > m_outputLocationRerun
ToolHandle< IL1TriggerTowerTool > m_TTtool
void calcCombinedLUT(const std::vector< int > &sigIN, const int sigSlope, const int sigOffset, const std::vector< int > &ovIN, const int ovSlope, const int ovOffset, const int ovNoiseCut, std::vector< int > &output)
int non_linear_lut(int lutin, unsigned short offset, unsigned short slope, unsigned short noiseCut, unsigned short scale, short par1, short par2, short par3, short par4)
bool IsDisabledChannel(const L1CaloDisabledTowers *db) const
double IDphi(const Identifier &id, const CaloLVL1_ID *caloId)
L1CaloPprChanDefaults m_chanDefaults
ToolHandle< IL1CaloMappingTool > m_mappingTool
ServiceHandle< IAthRNGSvc > m_rngSvc
void normaliseDigits(const std::vector< int > &sigDigits, const std::vector< int > &ovDigits, std::vector< int > &normDigits)
normalise the number of ADC digits for overlay
L1CaloPprChanCalibContainer * m_chanCalibContaineroverlay
StatusCode preProcessTower(int bcid, float mu, xAOD::TriggerTower *tower)
int etaToElement(float feta, int layer) const
SG::ReadHandleKey< TrigConf::L1Menu > m_L1MenuKey
SG::ReadHandleKey< xAOD::EventInfo > m_xaodevtKey
virtual StatusCode addOverlay(int bcid, float mu)
Add overlay data.
const L1CaloPpmDeadChannelsContainer * m_deadChannelsContainer
StatusCode getTriggerTowers()
gets collection of input TriggerTowers for reprocessing
StatusCode getCaloTowers()
fetch Calorimeter Towers
Run2TriggerTowerMaker & operator=(const Run2TriggerTowerMaker &)=delete
double IDeta(const Identifier &id, const CaloLVL1_ID *caloId)
functions to extract eta, phi coordinates from calo tower identifiers
L1CaloCoolChannelId channelId(double eta, double phi, int layer)
Compute L1CaloCoolChannelId (including support for old geometries)
StatusCode calcLutOutCP(const std::vector< int > &sigLutIn, const L1CaloPprChanCalib *sigDB, const std::vector< int > &ovLutIn, const L1CaloPprChanCalib *ovDB, std::vector< int > &output)
calculate LUT out
Run2TriggerTowerMaker(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadHandleKey< LArTTL1Container > m_EmTTL1ContainerName
ToolHandle< LVL1BS::ITrigT1CaloDataAccessV2 > m_bstowertool
static constexpr unsigned int m_maxIetaBins
const L1CaloPprChanCalibContainer * m_chanCalibContainer
StatusCode preProcessTower_getLutIn(int bcid, float mu, xAOD::TriggerTower *tower, const L1CaloPprChanCalib *db, const std::vector< int > &digits, std::vector< int > &output)
PreProcess up to LUT in.
void digitize(const EventContext &ctx)
Convert analogue pulses to digits.
StatusCode calcLutOutJEP(const std::vector< int > &sigLutIn, const L1CaloPprChanCalib *sigDB, const std::vector< int > &ovLutIn, const L1CaloPprChanCalib *ovDB, std::vector< int > &output)
SG::ReadDecorHandleKey< xAOD::EventInfo > m_actMuKey
SG::ReadHandleKey< LArTTL1Container > m_HadTTL1ContainerName
SG::ReadCondHandleKey< L1CaloDisabledTowersContainer > m_disabledTowersKey
std::unique_ptr< xAOD::TriggerTowerAuxContainer > m_xaodTowersAux
Run2TriggerTowerMaker(const Run2TriggerTowerMaker &)=delete
StatusCode preProcess(int bcid, float mu)
Simulate PreProcessing on analogue amplitudes.
std::array< double, m_maxIetaBins > m_sinThetaHash
instead of calculating the expression: double theta =2.
void processTileTowers(const TileTTL1Container *)
StatusCode store()
Stores Trigger Towers in the TES, at a location defined in m_outputLocation.
const L1CaloDisabledTowersContainer * m_disabledTowersContainer
SG::ReadCondHandleKey< L1CaloPprChanDefaultsContainer > m_chanDefaultsKey
StatusCode execute()
Checks that the Cell Type is supported (terminates with errors if not) and calls relevant routine to ...
SG::WriteHandleKey< xAOD::TriggerTowerContainer > m_outputLocation
void handle(const Incident &)
Best if initialisation which uses COOL-derived values is done here rather than in initialize()
Trigger towers are the inputs to all other parts of the calorimeter trigger.
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
TriggerTower_v2 TriggerTower
Define the latest version of the TriggerTower class.
Extra patterns decribing particle interation process.