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

#include <SCEmulation.h>

Inheritance diagram for LVL1::SCEmulation:

Public Member Functions

 SCEmulation (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~SCEmulation () override
virtual StatusCode initialize () override
virtual StatusCode execute (const EventContext &ctx) const override
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

std::size_t getEtaIndex (CaloSampling::CaloSample sample, float eta) const
std::size_t getEtIndex (CaloSampling::CaloSample sample, float et) 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_inputCellsKey
SG::ReadHandleKey< xAOD::EventInfom_evtInfoKey
SG::ReadHandleKey< CaloBCIDAveragem_caloBCIDAverageKey
SG::ReadCondHandleKey< CaloNoiseSigmaDiffm_caloNoiseSigmaDiffKey
SG::ReadCondHandleKey< CaloSuperCellDetDescrManagerm_caloSuperCellMgrKey
 Super cell manager key.
SG::WriteHandleKey< CaloCellContainerm_outputSuperCellsKey
ToolHandle< ICaloSuperCellIDToolm_scidTool {"CaloSuperCellIDTool"}
 Offline<->supercell mapping tool.
bool m_useNoise
 Use noise values.
bool m_useBCID
 Compensate for BCIDs.
std::string m_cellTimingFile
 The cell timing file.
std::map< CaloSampling::CaloSample, std::vector< float > > m_etaBins
 eta binning read from timing file
std::map< CaloSampling::CaloSample, std::vector< float > > m_etBins
 Et binning read from timing file.
std::map< std::tuple< CaloSampling::CaloSample, std::size_t, std::size_t >, std::map< float, float > > m_timingSamples
 Timing distributions.
const CaloIdManagerm_caloIdMgr {nullptr}
 Calo ID helpers.
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 28 of file SCEmulation.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

◆ SCEmulation()

LVL1::SCEmulation::SCEmulation ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 76 of file SCEmulation.cxx.

77 : AthReentrantAlgorithm(name, pSvcLocator)
78 {
79 declareProperty("InputCells", m_inputCellsKey = "AllCalo");
80 declareProperty("OutputSuperCells", m_outputSuperCellsKey = "SCEmulationNoBCId");
81 declareProperty("EventInfo", m_evtInfoKey = "EventInfo");
82 declareProperty("SCIDTool", m_scidTool);
83 declareProperty("CompensateForNoise", m_useNoise = true);
84 declareProperty("CompensateForBCID", m_useBCID = true);
85 declareProperty("CellTimingFile", m_cellTimingFile = "Run3L1CaloSimulation/SuperCells/CellTimingDistributions.MiddleTrain.r11881.20210211.root");
86 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
Definition SCEmulation.h:39
SG::WriteHandleKey< CaloCellContainer > m_outputSuperCellsKey
Definition SCEmulation.h:47
SG::ReadHandleKey< CaloCellContainer > m_inputCellsKey
Definition SCEmulation.h:38
bool m_useBCID
Compensate for BCIDs.
Definition SCEmulation.h:54
std::string m_cellTimingFile
The cell timing file.
Definition SCEmulation.h:56
ToolHandle< ICaloSuperCellIDTool > m_scidTool
Offline<->supercell mapping tool.
Definition SCEmulation.h:50
bool m_useNoise
Use noise values.
Definition SCEmulation.h:52

◆ ~SCEmulation()

LVL1::SCEmulation::~SCEmulation ( )
overridevirtual

Definition at line 88 of file SCEmulation.cxx.

88{}

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 }

◆ 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::SCEmulation::execute ( const EventContext & ctx) const
overridevirtual

Definition at line 209 of file SCEmulation.cxx.

210 {
211 // Prepare output container
212 auto superCells = std::make_unique<CaloCellContainer>();
213 // Get input
215 if (!cells.isValid())
216 {
217 ATH_MSG_ERROR("Failed to retrieve input cells " << m_inputCellsKey.key());
218 return StatusCode::FAILURE;
219 }
220
221 const CaloBCIDAverage *caloBCIDAvg = nullptr;
222 const CaloNoiseSigmaDiff *caloNoiseSigmaDiff = nullptr;
223 if (m_useBCID)
224 {
225 auto handle = SG::makeHandle(m_caloBCIDAverageKey, ctx);
226 if (!handle.isValid())
227 {
228 ATH_MSG_ERROR("Failed to retrieve " << m_caloBCIDAverageKey);
229 return StatusCode::FAILURE;
230 }
231 caloBCIDAvg = handle.cptr();
232 }
233 if (m_useNoise)
234 {
235 SG::ReadCondHandle handle(m_caloNoiseSigmaDiffKey, ctx);
236 if (!handle.isValid())
237 {
238 ATH_MSG_ERROR("Failed to retrieve " << m_caloNoiseSigmaDiffKey);
239 return StatusCode::FAILURE;
240 }
241 caloNoiseSigmaDiff = handle.cptr();
242 }
243
244 SG::ReadCondHandle<CaloSuperCellDetDescrManager> caloSuperCellMgrHandle{m_caloSuperCellMgrKey,ctx};
245 const CaloSuperCellDetDescrManager* scellMgr = *caloSuperCellMgrHandle;
246
247 auto evtInfo = SG::makeHandle(m_evtInfoKey, ctx);
248 if (!evtInfo.isValid())
249 {
250 ATH_MSG_ERROR("Failed to retrieve " << m_evtInfoKey.key());
251 return StatusCode::FAILURE;
252 }
253 std::mt19937_64 generator;
254 // seed the generator for the whole event
255 generator.seed(evtInfo->eventNumber() * evtInfo->runNumber());
256
257 const CaloCell_SuperCell_ID *superCellIDHelper = m_caloIdMgr->getCaloCell_SuperCell_ID();
258 const TileID *tileCellID = m_caloIdMgr->getTileID();
259 const Tile_SuperCell_ID *tileSuperCellID = m_caloIdMgr->getTile_SuperCell_ID();
260 const CaloCell_ID *caloCellID = m_caloIdMgr->getCaloCell_ID();
261
262 // Prepare the output values
263 std::size_t nSuperCells = superCellIDHelper->calo_cell_hash_max();
264 std::vector<float> energies(nSuperCells, 0.0);
265 std::vector<float> enTime(nSuperCells, 0.0);
266 std::vector<float> enForTime(nSuperCells, 0.0);
267 std::vector<char> timeDef(nSuperCells, false);
268 std::vector<uint16_t> qualities(nSuperCells, 0);
269 std::vector<float> sigmaNoisePerSuperCell(nSuperCells, 0.0);
270
271 for (const CaloCell *cell : *cells)
272 {
273 Identifier cellID = cell->ID();
274 IdentifierHash cellIDHash = caloCellID->calo_cell_hash(cellID);
275 // map to super cell ID
276 Identifier superCellID = m_scidTool->offlineToSuperCellID(cellID);
277 const CaloDetDescrElement *cdde = cell->caloDDE();
278 if (!superCellID.is_valid())
279 {
280 continue;
281 }
282 IdentifierHash scIDHash = superCellIDHelper->calo_cell_hash(superCellID);
283 float energy = cell->energy();
284 if (m_useBCID)
285 energy += caloBCIDAvg->average(cellID);
286 energies[scIDHash] += energy;
287 if (m_useNoise && !cdde->is_tile() && cell->gain() == CaloGain::LARHIGHGAIN)
288 sigmaNoisePerSuperCell[scIDHash] += (*caloNoiseSigmaDiff)[cellIDHash];
289
290 // This is a bad definition, but it's needed to be consistent with the other code (for now...)
291 CaloSampling::CaloSample s = cell->caloDDE()->getSampling();
292 bool isTile_BAD = s >= 9 && s < 21;
293 if (cell->provenance() & 0x2000)
294 {
295 if (cell->energy() > 256)
296 {
297 // We have the timing values correctly for above 256
298 timeDef[scIDHash] |= true;
299 enForTime[scIDHash] += cell->energy();
300 enTime[scIDHash] += cell->energy() * cell->time();
301 }
302 else if (!isTile_BAD)
303 {
304 // Use the random sampling from timing histograms (only midtrain)
305
306 CaloSampling::CaloSample sample = cell->caloDDE()->getSampling();
307 // Locate the correct eta/et bins
308 std::size_t iEta = getEtaIndex(sample, std::abs(cell->eta()));
309 if (iEta == SIZE_MAX)
310 {
311 ATH_MSG_ERROR("Eta value " << cell->eta() << " for sampling " << sample << " does not fall in a bin");
312 return StatusCode::FAILURE;
313 }
314 std::size_t iEt = getEtIndex(sample, cell->et());
315 if (iEt == SIZE_MAX)
316 {
317 ATH_MSG_ERROR("Et value " << cell->et() << " for sampling " << sample << " does not fall in a bin");
318 return StatusCode::FAILURE;
319 }
320 float cellTime = getRandom(m_timingSamples.at(std::make_tuple(sample, iEta, iEt)), generator);
321 timeDef.at(scIDHash) |= true;
322 enForTime.at(scIDHash) += cell->energy();
323 enTime.at(scIDHash) += cell->energy() * cellTime;
324 }
325 } //> if (provenance & 0x2000)
326 uint16_t &quality = qualities.at(scIDHash);
327 // Add the qualities such that you don't overflow the storage
328 if ((std::numeric_limits<uint16_t>::max() + 1 - quality) < cell->quality())
329 quality = std::numeric_limits<uint16_t>::max();
330 else
331 quality += cell->quality();
332 //ATH_MSG_INFO("Quality is " << quality);
333 // Special case for SAMP_D in tile. The signal is split into two SCs
334 if (cdde->is_tile() && tileCellID->sampling(cellID) == TileID::SAMP_D)
335 {
336 int section = tileCellID->section(cellID);
337 int side = tileCellID->side(cellID);
338 int module = tileCellID->module(cellID);
339 int tower = tileCellID->tower(cellID);
340
341 // Get the parameters for the new SCs
342 int section1 = section;
343 int section2 = section;
344 int side1 = side;
345 int side2 = side;
346 int tower1 = tower;
347 int tower2 = tower - 1;
348 if (tower == 0)
349 {
350 side1 = -1;
351 side2 = 1;
352 tower1 = 0;
353 tower2 = 0;
354 }
355 else if (tower == 10)
356 {
357 section1 = TileID::EXTBAR;
358 section2 = TileID::BARREL;
359 }
360
361 Identifier scID1 = tileSuperCellID->cell_id(section1, side1, module, tower1, 0);
362 Identifier scID2 = tileSuperCellID->cell_id(section2, side2, module, tower2, 0);
363
364 // Split the energy between the SCs
365 energies.at(superCellIDHelper->calo_cell_hash(scID1)) += cell->energy() * 0.5;
366 energies.at(superCellIDHelper->calo_cell_hash(scID2)) += cell->energy() * 0.5;
367 }
368 } //> end loop over cells
369
370 for (std::size_t idx = 0; idx < energies.size(); ++idx)
371 {
372 const CaloDetDescrElement *dde = scellMgr->get_element(idx);
373 if (!dde)
374 {
375 ATH_MSG_WARNING("Invalid DDE for hash index " << idx);
376 continue;
377 }
378 // Only push LAr supercells
380 bool isTile_BAD = s >= 9 && s < 21;
381 if (isTile_BAD)
382 continue;
383 float energy = energies.at(idx);
384 float sigmaNoise = sigmaNoisePerSuperCell.at(dde->calo_hash());
385 if (!dde->is_tile() && sigmaNoise > 0.0)
386 {
387 std::normal_distribution<double> distribution(0.0, sigmaNoise);
388 energy += distribution(generator);
389 }
390 auto superCell = std::make_unique<CaloCell>();
391 superCell->setCaloDDE(dde);
392 superCell->setEnergy(energy);
393 uint16_t prov = 0;
394 if (timeDef.at(idx) && enForTime.at(idx) != 0)
395 {
396 float time = enTime.at(idx) / enForTime.at(idx);
397 superCell->setTime(time);
398 float et = superCell->et();
399 prov = 0x2000;
400 if ((et > 10e3 && time > -8 && time < 18) || (et <= 10e3 && std::abs(time) < 8))
401 prov |= 0x200;
402 }
403 else
404 superCell->setTime(999.0);
405 superCell->setProvenance(prov);
406 superCell->setGain(CaloGain::LARHIGHGAIN);
407 superCells->push_back(superCell.release());
408 }
409 auto superCellHandle = SG::makeHandle(m_outputSuperCellsKey, ctx);
410 ATH_CHECK(superCellHandle.record(std::move(superCells)));
411 return StatusCode::SUCCESS;
412 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
std::vector< float > CaloNoiseSigmaDiff
NAME : CaloNoiseSigmaDiff.h PACKAGE : Calorimeter/CaloConditions.
float et(const xAOD::jFexSRJetRoI *j)
static const std::vector< std::string > qualities
void section(const std::string &sec)
float average(const Identifier &id) const
size_type calo_cell_hash_max() const
cell 'global' hash table max size
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
CaloCell_ID::CaloSample getSampling() const
cell sampling
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
bool is_valid() const
Check if id is in a valid state.
SG::ReadCondHandleKey< CaloNoiseSigmaDiff > m_caloNoiseSigmaDiffKey
Definition SCEmulation.h:42
std::size_t getEtaIndex(CaloSampling::CaloSample sample, float eta) const
SG::ReadHandleKey< CaloBCIDAverage > m_caloBCIDAverageKey
Definition SCEmulation.h:40
SG::ReadCondHandleKey< CaloSuperCellDetDescrManager > m_caloSuperCellMgrKey
Super cell manager key.
Definition SCEmulation.h:45
std::map< std::tuple< CaloSampling::CaloSample, std::size_t, std::size_t >, std::map< float, float > > m_timingSamples
Timing distributions.
Definition SCEmulation.h:65
const CaloIdManager * m_caloIdMgr
Calo ID helpers.
Definition SCEmulation.h:68
std::size_t getEtIndex(CaloSampling::CaloSample sample, float et) const
int tower(const Identifier &id) const
Identifier cell_id(const Identifier &any_id) const
int side(const Identifier &id) const
int section(const Identifier &id) const
int sampling(const Identifier &id) const
@ LARHIGHGAIN
Definition CaloGain.h:18
time(flags, cells_name, *args, **kw)
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
generator
Configure Herwig7 These are the commands corresponding to what would go into the regular Herwig infil...
setScale setgFexType iEta
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

◆ getEtaIndex()

std::size_t LVL1::SCEmulation::getEtaIndex ( CaloSampling::CaloSample sample,
float eta ) const
private

Definition at line 414 of file SCEmulation.cxx.

415 {
416 return getIndex(m_etaBins.at(sample), eta);
417 }
Scalar eta() const
pseudorapidity method
std::map< CaloSampling::CaloSample, std::vector< float > > m_etaBins
eta binning read from timing file
Definition SCEmulation.h:60

◆ getEtIndex()

std::size_t LVL1::SCEmulation::getEtIndex ( CaloSampling::CaloSample sample,
float et ) const
private

Definition at line 419 of file SCEmulation.cxx.

420 {
421 return getIndex(m_etBins.at(sample), et);
422 }
std::map< CaloSampling::CaloSample, std::vector< float > > m_etBins
Et binning read from timing file.
Definition SCEmulation.h:62

◆ initialize()

StatusCode LVL1::SCEmulation::initialize ( )
overridevirtual

Definition at line 90 of file SCEmulation.cxx.

91 {
92 ATH_MSG_INFO("Initializing " << name() << "...");
93 ATH_CHECK(m_evtInfoKey.initialize());
94 ATH_CHECK(m_scidTool.retrieve());
95 ATH_CHECK(m_inputCellsKey.initialize());
96 ATH_CHECK(m_outputSuperCellsKey.initialize());
99
100 ATH_CHECK(m_caloSuperCellMgrKey.initialize());
102
103 std::unique_ptr<TFile> timingFile(TFile::Open(PathResolver::find_calib_file(m_cellTimingFile).c_str()));
104 ATH_MSG_INFO("...");
105 if (!timingFile || timingFile->IsZombie())
106 {
107 ATH_MSG_ERROR("Failed to open cell timing file " << m_cellTimingFile);
108 return StatusCode::FAILURE;
109 }
110 TDirectory *tdir = timingFile->GetDirectory("CellTiming");
111 if (!tdir)
112 {
113 ATH_MSG_ERROR(m_cellTimingFile << " has no CellTiming directory!");
114 return StatusCode::FAILURE;
115 }
116
117 // Regex pattern for histogram names
118 std::regex pattern("Layer(\\d+)_([\\d.]+)eta([\\d.]+)_([\\d.-]+)ET([\\d.-]+)_midtrain");
119 std::map<CaloSampling::CaloSample, std::set<std::pair<float, float>>> etaBins;
120 std::map<CaloSampling::CaloSample, std::set<std::pair<float, float>>> etBins;
121 std::map<CaloSampling::CaloSample, std::map<std::pair<std::pair<float, float>, std::pair<float, float>>, TH1F *>> tmpHistMap;
122 std::set<CaloSampling::CaloSample> samples;
123 for (TObject *obj : *tdir->GetListOfKeys())
124 {
125 TKey *key = dynamic_cast<TKey *>(obj);
126 if (!key)
127 {
128 ATH_MSG_ERROR(obj->GetName() << " is not a TKey");
129 return StatusCode::FAILURE;
130 }
131 std::cmatch match;
132 if (!std::regex_match(key->GetName(), match, pattern))
133 {
134 continue;
135 }
136 if (std::strcmp(key->GetClassName(), "TH1F") != 0)
137 {
138 ATH_MSG_ERROR("Object " << key->GetName() << " not histogram as expected!");
139 return StatusCode::FAILURE;
140 }
141 CaloSampling::CaloSample sample = static_cast<CaloSampling::CaloSample>(std::stoi(match.str(1)));
142 samples.insert(sample);
143
144 auto etaBin = std::make_pair(std::stof(match.str(2)), std::stof(match.str(3)));
145 auto etBin = std::make_pair(std::stof(match.str(4)), std::stof(match.str(5)));
146
147 etaBins[sample].insert(etaBin);
148 etBins[sample].insert(etBin);
149 tmpHistMap[sample][std::make_pair(etaBin, etBin)] = (TH1F *)key->ReadObj();
150 }
151 // Now regularise the binning
152 for (CaloSampling::CaloSample sample : samples)
153 {
154 auto itr = etaBins[sample].begin();
155 auto end = etaBins[sample].end();
156 m_etaBins[sample].reserve(std::distance(itr, end) + 1);
157 m_etaBins[sample].push_back(itr->first);
158 m_etaBins[sample].push_back(itr->second);
159 ++itr;
160 for (; itr != end; ++itr)
161 {
162 // Make sure that the bin edges match up
163 if (itr->first != m_etaBins[sample].back())
164 {
165 ATH_MSG_ERROR("Eta bins do not match up for sample " << sample << "(" << m_etaBins[sample].back() << ", " << itr->first << ")");
166 return StatusCode::FAILURE;
167 }
168 m_etaBins[sample].push_back(itr->second);
169 }
170
171 itr = etBins[sample].begin();
172 end = etBins[sample].end();
173 m_etBins[sample].reserve(std::distance(itr, end) + 1);
174 m_etBins[sample].push_back(itr->first);
175 m_etBins[sample].push_back(itr->second);
176 ++itr;
177 for (; itr != end; ++itr)
178 {
179 // Make sure that the bin edges match up
180 if (itr->first != m_etBins[sample].back())
181 {
182 ATH_MSG_ERROR("Et bins do not match up for sample " << sample);
183 return StatusCode::FAILURE;
184 }
185 m_etBins[sample].push_back(itr->second);
186 }
187
188 // Now copy the histograms over
189 for (const auto &p : tmpHistMap[sample])
190 {
191 // Use the lower bounds of each bins to get the index
192 std::size_t etaIndex = getEtaIndex(sample, p.first.first.first);
193 std::size_t etIndex = getEtIndex(sample, p.first.second.first);
194 auto mapKey = std::make_tuple(sample, etaIndex, etIndex);
195 std::map<float, float> &integrals = m_timingSamples[mapKey];
196 float cumulativeSum = 0;
197 TAxis *axis = p.second->GetXaxis();
198 integrals[cumulativeSum] = axis->GetBinLowEdge(1);
199 for (int idx = 1; idx < axis->GetNbins(); ++idx)
200 {
201 cumulativeSum += p.second->GetBinContent(idx);
202 integrals[cumulativeSum] = axis->GetBinUpEdge(idx);
203 }
204 }
205 }
206 return StatusCode::SUCCESS;
207 }
#define ATH_MSG_INFO(x)
const ServiceHandle< StoreGateSvc > & detStore() const
static std::string find_calib_file(const std::string &logical_file_name)
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition hcg.cxx:357
retrieve(aClass, aKey=None)
Definition PyKernel.py:110
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin

◆ 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.

◆ 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.

◆ 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_caloBCIDAverageKey

SG::ReadHandleKey<CaloBCIDAverage> LVL1::SCEmulation::m_caloBCIDAverageKey
private
Initial value:
{
this, "CaloBCIDAverage", "CaloBCIDAverage"}

Definition at line 40 of file SCEmulation.h.

40 {
41 this, "CaloBCIDAverage", "CaloBCIDAverage"};

◆ m_caloIdMgr

const CaloIdManager* LVL1::SCEmulation::m_caloIdMgr {nullptr}
private

Calo ID helpers.

Definition at line 68 of file SCEmulation.h.

68{nullptr};

◆ m_caloNoiseSigmaDiffKey

SG::ReadCondHandleKey<CaloNoiseSigmaDiff> LVL1::SCEmulation::m_caloNoiseSigmaDiffKey
private
Initial value:
{
this, "CaloNoiseSigmaDiff", "CaloNoiseSigmaDiff"}

Definition at line 42 of file SCEmulation.h.

42 {
43 this, "CaloNoiseSigmaDiff", "CaloNoiseSigmaDiff"};

◆ m_caloSuperCellMgrKey

SG::ReadCondHandleKey<CaloSuperCellDetDescrManager> LVL1::SCEmulation::m_caloSuperCellMgrKey
private
Initial value:
{
this,"CaloSuperCellDetDescrManager","CaloSuperCellDetDescrManager","SG key of the resulting CaloSuperCellDetDescrManager"}

Super cell manager key.

Definition at line 45 of file SCEmulation.h.

45 {
46 this,"CaloSuperCellDetDescrManager","CaloSuperCellDetDescrManager","SG key of the resulting CaloSuperCellDetDescrManager"};

◆ m_cellTimingFile

std::string LVL1::SCEmulation::m_cellTimingFile
private

The cell timing file.

Definition at line 56 of file SCEmulation.h.

◆ 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_etaBins

std::map<CaloSampling::CaloSample, std::vector<float> > LVL1::SCEmulation::m_etaBins
private

eta binning read from timing file

Definition at line 60 of file SCEmulation.h.

◆ m_etBins

std::map<CaloSampling::CaloSample, std::vector<float> > LVL1::SCEmulation::m_etBins
private

Et binning read from timing file.

Definition at line 62 of file SCEmulation.h.

◆ m_evtInfoKey

SG::ReadHandleKey<xAOD::EventInfo> LVL1::SCEmulation::m_evtInfoKey
private

Definition at line 39 of file SCEmulation.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_inputCellsKey

SG::ReadHandleKey<CaloCellContainer> LVL1::SCEmulation::m_inputCellsKey
private

Definition at line 38 of file SCEmulation.h.

◆ m_outputSuperCellsKey

SG::WriteHandleKey<CaloCellContainer> LVL1::SCEmulation::m_outputSuperCellsKey
private

Definition at line 47 of file SCEmulation.h.

◆ m_scidTool

ToolHandle<ICaloSuperCellIDTool> LVL1::SCEmulation::m_scidTool {"CaloSuperCellIDTool"}
private

Offline<->supercell mapping tool.

Definition at line 50 of file SCEmulation.h.

50{"CaloSuperCellIDTool"};

◆ m_timingSamples

std::map<std::tuple<CaloSampling::CaloSample, std::size_t, std::size_t>, std::map<float, float> > LVL1::SCEmulation::m_timingSamples
private

Timing distributions.

Definition at line 65 of file SCEmulation.h.

◆ m_useBCID

bool LVL1::SCEmulation::m_useBCID
private

Compensate for BCIDs.

Definition at line 54 of file SCEmulation.h.

◆ m_useNoise

bool LVL1::SCEmulation::m_useNoise
private

Use noise values.

Definition at line 52 of file SCEmulation.h.

◆ 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: