ATLAS Offline Software
Loading...
Searching...
No Matches
LVL1::gFexTowerBuilder Class Reference

#include <gFexTowerBuilder.h>

Inheritance diagram for LVL1::gFexTowerBuilder:
Collaboration diagram for LVL1::gFexTowerBuilder:

Public Member Functions

 gFexTowerBuilder (const std::string &name, ISvcLocator *svc)
virtual StatusCode initialize () override
 Function initialising the algorithm.
virtual StatusCode execute (const EventContext &) const override
 Function executing the algorithm.
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
virtual void setFilterPassed (bool state, const EventContext &ctx) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

StatusCode ReadFibersfromFile (const std::string &)
StatusCode ReadTilefromFile (const std::string &)
StatusCode ReadSCfromFile (const std::string &)
bool isBadSCellID (const std::string &) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< CaloCellContainerm_SCellKey {this, "SCell", "SCell", "SCell container"}
SG::ReadHandleKey< xAOD::TriggerTowerContainerm_triggerTowerKey
SG::WriteHandleKey< xAOD::gFexTowerContainerm_gTowersWriteKey
Gaudi::Property< std::string > m_FiberMapping
Gaudi::Property< bool > m_apply_masking {this, "SCellMasking", true, "Applies masking. Only use for data"}
Gaudi::Property< bool > m_applyTimingCut
Gaudi::Property< bool > m_applyTimingCutAll
Gaudi::Property< bool > m_isDATA { this, "isDATA", true, "Tells the algorithm if it is data."}
Gaudi::Property< std::string > m_gFEX2Scellmapping
Gaudi::Property< std::string > m_gFEX2Tilemapping
std::unordered_map< uint32_t, std::vector< uint64_t > > m_map_TTower2SCells
std::unordered_map< uint32_t, std::vector< uint32_t > > m_map_TTower2Tile
std::unordered_map< unsigned int, std::array< float, 4 > > m_Firm2Tower_map
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 34 of file gFexTowerBuilder.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ gFexTowerBuilder()

LVL1::gFexTowerBuilder::gFexTowerBuilder ( const std::string & name,
ISvcLocator * svc )

Definition at line 30 of file gFexTowerBuilder.cxx.

31 : AthReentrantAlgorithm(name, svc) {}

Member Function Documentation

◆ cardinality()

unsigned int AthCommonReentrantAlgorithm< Gaudi::Algorithm >::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Definition at line 75 of file AthCommonReentrantAlgorithm.cxx.

64{
65 return 0;
66}

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode LVL1::gFexTowerBuilder::execute ( const EventContext & ctx) const
overridevirtual

Function executing the algorithm.

Definition at line 55 of file gFexTowerBuilder.cxx.

55 {
56
57 // Reading the Scell container
58 SG::ReadHandle<CaloCellContainer> ScellContainer(m_SCellKey, ctx);
59 if (!ScellContainer.isValid()) {
60 ATH_MSG_ERROR("Could not retrieve collection " << ScellContainer.key());
61 return StatusCode::FAILURE;
62 }
63
64 // Reading the TriggerTower container
65 SG::ReadHandle<xAOD::TriggerTowerContainer> triggerTowerContainer(
67 if (!triggerTowerContainer.isValid()) {
68 ATH_MSG_ERROR("Could not retrieve collection "
69 << triggerTowerContainer.key());
70 return StatusCode::FAILURE;
71 }
72
73
74 // WriteHandle for gFEX EDMs
75 SG::WriteHandle<xAOD::gFexTowerContainer> gTowersContainer(m_gTowersWriteKey, ctx);
76 ATH_CHECK( gTowersContainer.record(std::make_unique<xAOD::gFexTowerContainer>(),
77 std::make_unique<xAOD::gFexTowerAuxContainer>()) );
78 ATH_MSG_DEBUG("Recorded gFexEmulatedTower container with key " << gTowersContainer.key());
79
80 if (ScellContainer->empty() || triggerTowerContainer->empty()) {
82 "Cannot fill gTowers here, at least one container is empty. "
83 "ScellContainer.size="
84 << ScellContainer->size()
85 << " or triggerTowerContainer.size=" << triggerTowerContainer->size());
86 return StatusCode::SUCCESS;
87 }
88
89 // building Scell ID pointers
90 std::unordered_map<uint64_t, const CaloCell*> map_ScellID2ptr;
91 map_ScellID2ptr.reserve(ScellContainer->size());
92
93 for (const CaloCell* scell : *ScellContainer) {
94 const uint64_t ID = scell->ID().get_compact();
95 map_ScellID2ptr[ID] = scell;
96 }
97
98 // building Tile ID pointers
99 std::unordered_map<uint32_t, const xAOD::TriggerTower*> map_TileID2ptr;
100 map_TileID2ptr.reserve(triggerTowerContainer->size());
101
102 for (const xAOD::TriggerTower* tower : *triggerTowerContainer) {
103 map_TileID2ptr[tower->coolId()] = tower;
104 }
105 for (const auto& [key, element] : m_Firm2Tower_map) {
106 unsigned int towerID = key;
107 const auto [fpga, eta, phi, source] = element;
108
109 // the summed encoded Et from LAr or Tile
110 uint16_t total_et_encoded = 0;
111 char gTower_sat = 0;
112 // Note input fpga distinguishes between LAr (0,1,2), Tile (3) and duplicated channels (4)
113 if (source == 0) {
114
115 // check if the towerID exists in the LAr map
116 auto it_TTower2SCells = m_map_TTower2SCells.find(towerID);
117 if (it_TTower2SCells == m_map_TTower2SCells.end()) {
118 ATH_MSG_ERROR("gFEX ID: " << towerID
119 << " not found on map m_map_TTower2SCells");
120 return StatusCode::FAILURE;
121 }
122
123
124 bool invalid = m_apply_masking && m_isDATA; // the isDATA is because there is no concept of invalid supercell in MC (the provenance bit is actually used for BCID in MC), so can never have an invalid jTower
125 bool masked = m_apply_masking;
126
127 // loop over the SCell IDs and calculate encoded Et
128 int total_Et = 0;
129 bool isConnected = true;
130 for (const auto& scellID : it_TTower2SCells->second) {
131 // check if the SCell ID exists in the map
132 auto it_ScellID2ptr = map_ScellID2ptr.find(scellID);
133
134 // unconnected Towers have a single SCell with special id, set energy to zero
135 if (scellID == 0xffffffffffffffff) {
136 isConnected = false;
137 continue;
138 }
139
140 // check if other SCells are in the map
141 std::string str_hex = std::format("{:x}", scellID);
142
143 if (it_ScellID2ptr == map_ScellID2ptr.end()) {
144 if (m_isDATA)
145 ATH_MSG_WARNING("SCell ID: "
146 << scellID
147 << " not found in the CaloCellContainer, skipping");
148 continue;
149 }
150 // working with "local" fiber number, iFiber
151 unsigned int offset = (towerID > 20000) ? 20000 : (towerID > 10000 && towerID < 20000) ? 10000 : 0;
152 unsigned int iFiber = (towerID - offset)/16;
153
154 // Do not exceed maximum number of fibers for FPGA
155 unsigned int maxFiberN = (towerID > 20000) ? LVL1::gFEXPos::C_FIBERS : LVL1::gFEXPos::AB_FIBERS;
156 if (iFiber >= maxFiberN) continue;
157
158 int fiber_type = (towerID < 10000) ? LVL1::gFEXPos::AMPD_NFI[iFiber] :
159 (towerID > 10000 && towerID < 20000) ? LVL1::gFEXPos::BMPD_NFI[iFiber] :
161
162 // Data Type: 3 is extended region ( HEC), 6 is 200MeV region only ( HEC), 11 is HEC - Had contribution
163 int dataType = (towerID < 10000) ? LVL1::gFEXPos::AMPD_DTYP_ARR[fiber_type][towerID%16] :
164 (towerID > 10000 && towerID < 20000) ? LVL1::gFEXPos::BMPD_DTYP_ARR[fiber_type][towerID%16] :
165 LVL1::gFEXPos::CMPD_DTYP_ARR[fiber_type][towerID%16];
166
167 const CaloCell* scell = it_ScellID2ptr->second;
168 int val = std::round(scell->energy() / (12.5 * std::cosh(scell->eta()))); // 12.5 b.c. energy units of 12.5 MeV per count
169 if (!m_isDATA && m_applyTimingCut && !(scell->provenance()&0x200) && dataType != 11) {
170 val = 0; // apply timing cut to MC (already present in Data)
171 }
172 else if (!m_isDATA && m_applyTimingCutAll && !(scell->provenance()&0x200)) {
173 val = 0; // apply timing cut to MC (already present in Data)
174 }
175
176 bool isMasked =
177 m_apply_masking ? ((scell)->provenance() & 0x80) : false;
178 bool isInvalid =
179 (m_apply_masking&&m_isDATA) ? ((scell)->provenance()&0x40) : false;
180 bool isSaturated = (m_isDATA) ? scell->quality() : false; // saturation algorithm not implemented in MC yet
181
182 invalid &= isInvalid;
183 masked &= isMasked;
184 if (!isMasked) {
185 gTower_sat |= isSaturated;
186 }
187
188 if (isMasked) {
189 val = 0;
190 } else if( isInvalid&&m_isDATA) {
191 val = 0;
192 }
193
194 if (val != 0)
195 total_Et += val;
196
197 } // end of SCell loop
198
199 // now must convert Total_Et int value into fex value: multi-level encoding
200 if(!isConnected) {
201 total_et_encoded = 0; // no data
202 } else if(masked) {
203 total_et_encoded = 0; // no data
204 } else if(invalid) {
205 total_et_encoded = 4095; // invalid
206 } else {
207 total_et_encoded = gFEXCompression::compress(12.5 * total_Et);
208 }
209
210
211 } else if (source == 1) {
212
213 // Tile
214 // check that the gFEX Tower ID exists in the Tile map
215 auto it_TTower2Tile = m_map_TTower2Tile.find(towerID);
216
217 int Tile_Et = 0;
218 for (auto const& TileTowerID : it_TTower2Tile->second) {
219 auto it_TileID2ptr = map_TileID2ptr.find(TileTowerID);
220 if (it_TileID2ptr == map_TileID2ptr.end()) {
221 if(m_isDATA) {
222 ATH_MSG_WARNING("Tile cool ID: " << TileTowerID
223 << " not found in the xAOD::TriggerTower (map_TileID2ptr)");
224 }
225 continue; // in MC the xAODTriggerTowers have variable size due to noise cuts, continue on to the next tower
226 } else {
227 const xAOD::TriggerTower* tileTower = it_TileID2ptr->second;
228 unsigned int jepEt = tileTower->jepET();
229 Tile_Et += jepEt; // add the encoded energies
230 }
231 }
232 total_et_encoded = Tile_Et;
233
234 } else if (source == 2) {
235 // duplicated Towers, LATOME sends 0
236 total_et_encoded = 0;
237 }
238
239 // the EDM requires a float
240 float total_et_encoded_flt = total_et_encoded;
241
242 unsigned int fpga_out = (towerID < 10000) ? 0 : (towerID < 20000) ? 1 : 2;
243 unsigned int iEta = 0;
244 unsigned int iPhi = 0;
245
246 gTowersContainer->push_back(std::make_unique<xAOD::gFexTower>());
247 gTowersContainer->back()->initialize(iEta, iPhi, eta, phi,
248 total_et_encoded_flt, fpga_out,
249 gTower_sat, towerID);
250 }
251
252 return StatusCode::SUCCESS;
253 }
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
double energy() const
get energy (data member)
Definition CaloCell.h:327
uint16_t provenance() const
get provenance (data member)
Definition CaloCell.h:354
virtual double eta() const override final
get eta (through CaloDetDescrElement)
Definition CaloCell.h:382
uint16_t quality() const
get quality (data member)
Definition CaloCell.h:348
static unsigned int compress(float Energy)
Compress data.
std::unordered_map< uint32_t, std::vector< uint64_t > > m_map_TTower2SCells
Gaudi::Property< bool > m_apply_masking
virtual StatusCode initialize() override
Function initialising the algorithm.
SG::ReadHandleKey< xAOD::TriggerTowerContainer > m_triggerTowerKey
SG::WriteHandleKey< xAOD::gFexTowerContainer > m_gTowersWriteKey
SG::ReadHandleKey< CaloCellContainer > m_SCellKey
std::unordered_map< unsigned int, std::array< float, 4 > > m_Firm2Tower_map
Gaudi::Property< bool > m_applyTimingCut
Gaudi::Property< bool > m_applyTimingCutAll
Gaudi::Property< bool > m_isDATA
std::unordered_map< uint32_t, std::vector< uint32_t > > m_map_TTower2Tile
uint8_t jepET() const
get jepET from peak of lut_jep
constexpr std::array< std::array< char, 20 >, 4 > CMPD_DTYP_ARR
Definition gFexPos.h:494
constexpr std::array< int, 100 > CMPD_NFI
Definition gFexPos.h:375
constexpr int C_FIBERS
Definition gFexPos.h:60
constexpr std::array< std::array< char, 20 >, 4 > AMPD_DTYP_ARR
Definition gFexPos.h:216
constexpr std::array< std::array< char, 20 >, 4 > BMPD_DTYP_ARR
Definition gFexPos.h:351
constexpr std::array< int, 100 > AMPD_NFI
Definition gFexPos.h:105
constexpr std::array< int, 100 > BMPD_NFI
Definition gFexPos.h:241
constexpr int AB_FIBERS
Definition gFexPos.h:59
@ iPhi
Definition ParamDefs.h:47
ID
//////////////////////////////////////// JetAlgorithmType::ID defines most common physics jet finding...
setScale setgFexType iEta
TriggerTower_v2 TriggerTower
Define the latest version of the TriggerTower class.
setWord1 uint16_t

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonReentrantAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.

90{
91 // If we didn't find any symlinks to add, just return the collection
92 // from the base class. Otherwise, return the extended collection.
93 if (!m_extendedExtraObjects.empty()) {
95 }
97}
An algorithm that can be simultaneously executed in multiple threads.

◆ filterPassed()

virtual bool AthCommonReentrantAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Definition at line 96 of file AthCommonReentrantAlgorithm.h.

96 {
97 return execState( ctx ).filterPassed();
98 }
virtual bool filterPassed(const EventContext &ctx) const

◆ initialize()

StatusCode LVL1::gFexTowerBuilder::initialize ( )
overridevirtual

Function initialising the algorithm.

Definition at line 33 of file gFexTowerBuilder.cxx.

33 {
34
36 "Initializing L1CaloFEXAlgos/gFexEmulatedTowers algorithm with name: "
37 << name());
38 ATH_MSG_INFO("Writing into SG key: " << m_gTowersWriteKey);
39 ATH_MSG_INFO("SCell masking: " << m_apply_masking);
40
41 ATH_CHECK(m_SCellKey.initialize());
42 ATH_CHECK(m_triggerTowerKey.initialize());
43 ATH_CHECK(m_gTowersWriteKey.initialize());
44
45 // Reading from CVMFS Fiber mapping
47
48 // Reading from CVMFS Trigger Tower and their corresponding SCell ID
51
52 return StatusCode::SUCCESS;
53 }
#define ATH_MSG_INFO(x)
StatusCode ReadFibersfromFile(const std::string &)
Gaudi::Property< std::string > m_FiberMapping
Gaudi::Property< std::string > m_gFEX2Scellmapping
StatusCode ReadTilefromFile(const std::string &)
Gaudi::Property< std::string > m_gFEX2Tilemapping
StatusCode ReadSCfromFile(const std::string &)
static std::string find_calib_file(const std::string &logical_file_name)

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isBadSCellID()

bool LVL1::gFexTowerBuilder::isBadSCellID ( const std::string & ID) const
private

Definition at line 356 of file gFexTowerBuilder.cxx.

356 {
357
358 // does it start with "0x"?, if so then is a GOOD SCell ID!
359 if (ID.find("0x") == std::string::npos) {
360 ATH_MSG_ERROR("Invalid SuperCell ID "
361 << ID
362 << ". Expecting hexadecimal number on the mapping file");
363 return true;
364 }
365 return false;
366 }

◆ isClonable()

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ ReadFibersfromFile()

StatusCode LVL1::gFexTowerBuilder::ReadFibersfromFile ( const std::string & fileName)
private

Definition at line 255 of file gFexTowerBuilder.cxx.

255 {
256 // opening file with ifstream
257 std::ifstream file(fileName);
258
259 if (!file.is_open()) {
260 ATH_MSG_ERROR("Could not open file:" << fileName);
261 return StatusCode::FAILURE;
262 }
263 std::string line;
264 // loading the mapping information
265 while (std::getline(file, line)) {
266 // removing the header of the file (it is just information!)
267 if (line[0] == '#') continue;
268
269 // Splitting line in different substrings
270 std::stringstream oneLine(line);
271 // reading elements
272 std::vector<float> elements;
273 elements.reserve(5);
274 std::string element;
275 while (std::getline(oneLine, element, ' ')) {
276 elements.push_back(std::stof(element));
277 }
278
279 // It should have 5 elements
280 // ordered as: towerID fpga source eta phi
281
282 if (elements.size() != 5) {
284 "Unexpected number of elements (5 expected) in file: " << fileName);
285 return StatusCode::FAILURE;
286 }
287
288 // building array of <fpga, eta, phi, source>
289 std::array<float, 4> aux_arr{{elements.at(1), elements.at(3),
290 elements.at(4), elements.at(2)}};
291
292 // filling the map with the hash given by mapIndex()
293 m_Firm2Tower_map[elements.at(0)] = aux_arr;
294 }
295
296 file.close();
297
298 return StatusCode::SUCCESS;
299 }
TFile * file

◆ ReadSCfromFile()

StatusCode LVL1::gFexTowerBuilder::ReadSCfromFile ( const std::string & fileName)
private

Definition at line 301 of file gFexTowerBuilder.cxx.

301 {
302
303 // opening file with ifstream
304 std::ifstream file(fileName);
305
306 if (!file.is_open()) {
307 ATH_MSG_ERROR("Could not open file:" << fileName);
308 return StatusCode::FAILURE;
309 }
310
311 std::string line;
312 // loading the mapping information into an unordered_map <Fex Tower ID, vector
313 // of SCell IDs>
314 while (std::getline(file, line)) {
315 // removing the header of the file (it is just information!)
316 if (line[0] == '#')
317 continue;
318
319 std::vector<uint64_t> SCellvector;
320
321 // Splitting line in different substrings
322 std::stringstream oneSCellID(line);
323
324 // reading elements
325 std::string substr = "";
326 int TTID = 0;
327 int elem = 0;
328
329 while (std::getline(oneSCellID, substr, ' ')) {
330 ++elem;
331 if (elem == 1) {
332 TTID = std::stoi(substr);
333 } else {
334 // Check if it looks like a SCell Identifier
335 if (isBadSCellID(substr)) {
336 return StatusCode::FAILURE;
337 }
338
339 // converts hex number to unsigned long long int
340 // unconnnected slots are filled with 0xffffffffffffffff
341 // otherwise SCell map used shorter form, add extra zeroes back
342 std::string scell_full =
343 (substr == "0xffffffffffffffff") ? substr : substr + "00000000";
344 uint64_t scid_uint64 = std::strtoull(scell_full.c_str(), nullptr, 0);
345 SCellvector.push_back(scid_uint64);
346 }
347 }
348
349 m_map_TTower2SCells[TTID] = std::move(SCellvector);
350 }
351 file.close();
352
353 return StatusCode::SUCCESS;
354 }
bool isBadSCellID(const std::string &) const

◆ ReadTilefromFile()

StatusCode LVL1::gFexTowerBuilder::ReadTilefromFile ( const std::string & fileName)
private

Definition at line 368 of file gFexTowerBuilder.cxx.

368 {
369
370 std::string myline;
371
372 // openning file with ifstream
373 std::ifstream myfile(fileName);
374
375 if (!myfile.is_open()) {
376 ATH_MSG_FATAL("Could not open file:" << fileName);
377 return StatusCode::FAILURE;
378 }
379
380 // loading the mapping information into an unordered_map <Fex Tower ID, vector
381 // of Tile IDs>
382 while (std::getline(myfile, myline)) {
383 // removing the header of the file
384 myline.erase(myline.begin(),
385 std::find_if(myline.begin(), myline.end(),
386 [](int ch) { return !std::isspace(ch); }));
387 if (myline[0] == '#')
388 continue;
389
390 std::vector<uint32_t> Tilevector;
391
392 // Splitting myline in different substrings
393 std::stringstream oneTileID(myline);
394
395 // reading elements
396 std::string substr = "";
397 int gTowerID = 0;
398 int elem = 0;
399
400 while (std::getline(oneTileID, substr, ' ')) {
401 ++elem;
402 if (elem == 1) {
403 gTowerID = std::stoi(substr);
404 } else {
405 uint32_t tileid_uint32 = std::strtoul(substr.c_str(), nullptr, 0);
406 Tilevector.push_back(tileid_uint32);
407 }
408 }
409 m_map_TTower2Tile[gTowerID] = std::move(Tilevector);
410 }
411 myfile.close();
412
413 return StatusCode::SUCCESS;
414 }
#define ATH_MSG_FATAL(x)
setEventNumber uint32_t

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonReentrantAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Definition at line 100 of file AthCommonReentrantAlgorithm.h.

100 {
102 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const

◆ sysExecute()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Definition at line 85 of file AthCommonReentrantAlgorithm.cxx.

77{
78 return BaseAlg::sysExecute (ctx);
79}

◆ sysInitialize()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in HypoBase, and InputMakerBase.

Definition at line 61 of file AthCommonReentrantAlgorithm.cxx.

107 {
109
110 if (sc.isFailure()) {
111 return sc;
112 }
113
114 ServiceHandle<ICondSvc> cs("CondSvc",name());
115 for (auto h : outputHandles()) {
116 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
117 // do this inside the loop so we don't create the CondSvc until needed
118 if ( cs.retrieve().isFailure() ) {
119 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
120 return StatusCode::SUCCESS;
121 }
122 if (cs->regHandle(this,*h).isFailure()) {
124 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
125 << " with CondSvc");
126 }
127 }
128 }
129 return sc;
130}
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ m_apply_masking

Gaudi::Property<bool> LVL1::gFexTowerBuilder::m_apply_masking {this, "SCellMasking", true, "Applies masking. Only use for data"}
private

Definition at line 64 of file gFexTowerBuilder.h.

64{this, "SCellMasking", true, "Applies masking. Only use for data"};

◆ m_applyTimingCut

Gaudi::Property<bool> LVL1::gFexTowerBuilder::m_applyTimingCut
private
Initial value:
{this,"ApplyTimingCut", false,
"If true, will apply a timing cut to supercells in MC (but not in HEC). In data this property has no effect"}

Definition at line 66 of file gFexTowerBuilder.h.

66 {this,"ApplyTimingCut", false,
67 "If true, will apply a timing cut to supercells in MC (but not in HEC). In data this property has no effect"};

◆ m_applyTimingCutAll

Gaudi::Property<bool> LVL1::gFexTowerBuilder::m_applyTimingCutAll
private
Initial value:
{this,"ApplyTimingCutAll", false,
"If true, will apply a timing cut to supercells in MC. In data this property has no effect"}

Definition at line 69 of file gFexTowerBuilder.h.

69 {this,"ApplyTimingCutAll", false,
70 "If true, will apply a timing cut to supercells in MC. In data this property has no effect"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonReentrantAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 114 of file AthCommonReentrantAlgorithm.h.

◆ m_FiberMapping

Gaudi::Property<std::string> LVL1::gFexTowerBuilder::m_FiberMapping
private
Initial value:
{
this, "gFexFiberTowerMapping",
PathResolver::find_calib_file("Run3L1CaloSimulation/L1CaloFEXAlgos/gFEX/gFex_gCaloTowerMap_weighted_v1.txt"),
"Text file to convert from hardware fiber to eta-phi location"}

Definition at line 57 of file gFexTowerBuilder.h.

57 {
58 this, "gFexFiberTowerMapping",
59 // PathResolver::find_calib_file("L1CaloFEXAlgos/gFexFibrTowerMap.txt"),
60 PathResolver::find_calib_file("Run3L1CaloSimulation/L1CaloFEXAlgos/gFEX/gFex_gCaloTowerMap_weighted_v1.txt"),
61 "Text file to convert from hardware fiber to eta-phi location"};

◆ m_Firm2Tower_map

std::unordered_map<unsigned int, std::array<float, 4> > LVL1::gFexTowerBuilder::m_Firm2Tower_map
private

Definition at line 93 of file gFexTowerBuilder.h.

◆ m_gFEX2Scellmapping

Gaudi::Property<std::string> LVL1::gFexTowerBuilder::m_gFEX2Scellmapping
private
Initial value:
{
this, "gFEX2SCmapping",
"Run3L1CaloSimulation/L1CaloFEXAlgos/gFEX/gCaloTowers_to_scells_v1.txt",
"Text file to convert from simulation ID to SuperCell Identifier"}

Definition at line 74 of file gFexTowerBuilder.h.

74 {
75 this, "gFEX2SCmapping",
76 "Run3L1CaloSimulation/L1CaloFEXAlgos/gFEX/gCaloTowers_to_scells_v1.txt",
77 "Text file to convert from simulation ID to SuperCell Identifier"};

◆ m_gFEX2Tilemapping

Gaudi::Property<std::string> LVL1::gFexTowerBuilder::m_gFEX2Tilemapping
private
Initial value:
{
this, "gFEX2Tilemapping",
"Run3L1CaloSimulation/L1CaloFEXAlgos/gFEX/gCaloTowers_to_tile_v1.txt",
"Text file to convert from simulation ID to Tile Identifier"}

Definition at line 79 of file gFexTowerBuilder.h.

79 {
80 this, "gFEX2Tilemapping",
81 "Run3L1CaloSimulation/L1CaloFEXAlgos/gFEX/gCaloTowers_to_tile_v1.txt",
82 "Text file to convert from simulation ID to Tile Identifier"};

◆ m_gTowersWriteKey

SG::WriteHandleKey<xAOD::gFexTowerContainer> LVL1::gFexTowerBuilder::m_gTowersWriteKey
private
Initial value:
{
this, "gTowersWriteKey", "L1_gFexDataTowers", "Write gFexEDM Trigger Tower container"}

Definition at line 53 of file gFexTowerBuilder.h.

53 {
54 this, "gTowersWriteKey", "L1_gFexDataTowers", "Write gFexEDM Trigger Tower container"};

◆ m_isDATA

Gaudi::Property<bool> LVL1::gFexTowerBuilder::m_isDATA { this, "isDATA", true, "Tells the algorithm if it is data."}
private

Definition at line 72 of file gFexTowerBuilder.h.

72{ this, "isDATA", true, "Tells the algorithm if it is data."};

◆ m_map_TTower2SCells

std::unordered_map<uint32_t, std::vector<uint64_t> > LVL1::gFexTowerBuilder::m_map_TTower2SCells
private

Definition at line 91 of file gFexTowerBuilder.h.

◆ m_map_TTower2Tile

std::unordered_map<uint32_t, std::vector<uint32_t> > LVL1::gFexTowerBuilder::m_map_TTower2Tile
private

Definition at line 92 of file gFexTowerBuilder.h.

◆ m_SCellKey

SG::ReadHandleKey<CaloCellContainer> LVL1::gFexTowerBuilder::m_SCellKey {this, "SCell", "SCell", "SCell container"}
private

Definition at line 46 of file gFexTowerBuilder.h.

46{this, "SCell", "SCell", "SCell container"};

◆ m_triggerTowerKey

SG::ReadHandleKey<xAOD::TriggerTowerContainer> LVL1::gFexTowerBuilder::m_triggerTowerKey
private
Initial value:
{
this, "xODTriggerTowers", "xAODTriggerTowers", "xAODTriggerTowers container"}

Definition at line 49 of file gFexTowerBuilder.h.

49 {
50 this, "xODTriggerTowers", "xAODTriggerTowers", "xAODTriggerTowers container"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: