ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
LVL1CTP::ResultBuilder Class Reference

Class used to create the CTP output (RDO, SLink and TriggerInfo) More...

#include <ResultBuilder.h>

Inheritance diagram for LVL1CTP::ResultBuilder:
Collaboration diagram for LVL1CTP::ResultBuilder:

Public Member Functions

 ResultBuilder (const std::string &type, const std::string &name, const IInterface *parent)
 
 ~ResultBuilder ()
 
void setRandomEngine (CLHEP::HepRandomEngine *rndmEngine)
 
StatusCode setConfiguration (const TrigConf::L1Menu &l1menu)
 
StatusCode buildItemDecision (const std::map< std::string, unsigned int > &thrMultiMap, std::map< std::string, unsigned int > &itemDecisionMap, CLHEP::HepRandomEngine *rndmEngine) const
 
StatusCode constructResultVectors (const std::map< std::string, unsigned int > &itemDecisionMap, std::vector< uint32_t > &tbp, std::vector< uint32_t > &tap, std::vector< uint32_t > &tav, unsigned char &triggerType) const
 
StatusCode constructTIPVector (const std::map< std::string, unsigned int > &thrMultiMap, std::vector< uint32_t > &tip) const
 
std::unique_ptr< CTPSLinkconstructRoIResult (const EventIDBase &eventID, const std::vector< uint32_t > &tbp, const std::vector< uint32_t > &tap, const std::vector< uint32_t > &tav, const std::vector< uint32_t > &tip, const std::vector< uint32_t > &extra, const unsigned char triggerType) const
 build RoI result (LVL1CTP::CTPSLink) More...
 
std::unique_ptr< CTP_RDOconstructRDOResult (const EventIDBase &eventID, const std::vector< uint32_t > &tbp, const std::vector< uint32_t > &tap, const std::vector< uint32_t > &tav, const std::vector< uint32_t > &tip, const std::vector< uint32_t > &extra) const
 build RDO result (CTP_RDO) - TODO obsolete it in favor of xAOD::CTPResult More...
 
std::pair< std::unique_ptr< xAOD::CTPResult >, std::unique_ptr< xAOD::CTPResultAuxInfo > > constructCTPResult (const EventIDBase &eventID, const std::vector< uint32_t > &tbp, const std::vector< uint32_t > &tap, const std::vector< uint32_t > &tav, const std::vector< uint32_t > &tip, const std::vector< uint32_t > &extra) const
 build RDO result (CTPResult) More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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. More...
 

Private Types

enum  WrdType { TBP = 0x01, TAP = 0x02, TAV = 0x04 }
 
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

StatusCode createTriggerConfigMaps (const TrigConf::L1Menu &l1menu)
 
std::vector< std::string > firedItems (const std::vector< uint32_t > &triggerWords) const
 build list of fired items and dump to string More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

std::unique_ptr< ThresholdMapm_thrConfigMap { nullptr }
 Map between threshold objects and their CTP-internal description. More...
 
std::unique_ptr< ItemMapm_itemConfigMap { nullptr }
 Map between item objects and their CTP-internal description. More...
 
InternalTriggerMap m_internalTrigger
 internal triggers BGRP and RNDM More...
 
unsigned int m_ctpVersionNumber { 4 }
 CTP data format version (4 in most of Run 2 and in Run 3) More...
 
CTPdataformatVersion * m_ctpDataFormat { nullptr }
 CTP data format details. More...
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Class used to create the CTP output (RDO, SLink and TriggerInfo)

This class constructs and uses vectors of the following words to form the CTP output:

Definition at line 51 of file ResultBuilder.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ WrdType

Enumerator
TBP 
TAP 
TAV 

Definition at line 98 of file ResultBuilder.h.

98 { TBP = 0x01, TAP = 0x02, TAV = 0x04 };

Constructor & Destructor Documentation

◆ ResultBuilder()

LVL1CTP::ResultBuilder::ResultBuilder ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 33 of file ResultBuilder.cxx.

37 {
38  m_ctpDataFormat = new CTPdataformatVersion(m_ctpVersionNumber);
39 }

◆ ~ResultBuilder()

LVL1CTP::ResultBuilder::~ResultBuilder ( )

Definition at line 42 of file ResultBuilder.cxx.

42  {
43  delete m_ctpDataFormat;
44  for(auto & x : m_internalTrigger) {
45  delete x.second;
46  }
47 }

Member Function Documentation

◆ buildItemDecision()

StatusCode LVL1CTP::ResultBuilder::buildItemDecision ( const std::map< std::string, unsigned int > &  thrMultiMap,
std::map< std::string, unsigned int > &  itemDecisionMap,
CLHEP::HepRandomEngine *  rndmEngine 
) const

Definition at line 149 of file ResultBuilder.cxx.

152 {
153  // build trigger result for all items
154  itemDecisionMap.clear();
155 
156  try {
157  for( const auto & itemName : m_itemConfigMap->itemNames() ) {
158  auto ctpItem = m_itemConfigMap->getItem(itemName);
159 
160  bool pass_beforePrescale = ctpItem->evaluate(thrMultiMap);
161  bool pass_afterPrescale = false;
162  bool pass_afterVeto = false;
163 
164  if ( pass_beforePrescale ) {
165  long random = CLHEP::RandFlat::shootInt( rndmEngine, pow(2,24) );
166  int32_t cut = TrigConf::PrescaleSet::getCutFromPrescale( m_itemConfigMap->getItem( itemName )->prescale() );
167  pass_afterPrescale = (random >= cut) && (cut > 0); // no pass if PS set to "-1"
168  pass_afterVeto = pass_afterPrescale; // dead time is not simulated
169  }
170 
171  unsigned int result = (pass_beforePrescale ? TBP : 0) + (pass_afterPrescale ? TAP : 0) + (pass_afterVeto ? TAV : 0);
172 
173  itemDecisionMap[itemName] = result;
174  }
175  } catch (TrigConf::LogicParsingException & ex) {
176  ATH_MSG_FATAL("Error in evaluating logic. " << ex.msg());
177  return StatusCode::FAILURE;
178  }
179  return StatusCode::SUCCESS;
180 }

◆ constructCTPResult()

std::pair< std::unique_ptr< xAOD::CTPResult >, std::unique_ptr< xAOD::CTPResultAuxInfo > > LVL1CTP::ResultBuilder::constructCTPResult ( const EventIDBase &  eventID,
const std::vector< uint32_t > &  tbp,
const std::vector< uint32_t > &  tap,
const std::vector< uint32_t > &  tav,
const std::vector< uint32_t > &  tip,
const std::vector< uint32_t > &  extra 
) const

build RDO result (CTPResult)

Definition at line 352 of file ResultBuilder.cxx.

358 {
359  auto wrongSize = [this](const std::vector<uint32_t> & vec, uint32_t exp, std::string_view name) {
360  if (vec.size() == exp) {return false;}
361  ATH_MSG_ERROR("Wrong " << name << " vector size passed to constructRDOResult, " << vec.size() << " instead of " << exp);
362  return true;
363  };
364  if (wrongSize(tip, m_ctpDataFormat->getTIPwords(), "TIP")
365  || wrongSize(tbp, m_ctpDataFormat->getTBPwords(), "TBP")
366  || wrongSize(tap, m_ctpDataFormat->getTAPwords(), "TAP")
367  || wrongSize(tav, m_ctpDataFormat->getTAVwords(), "TAV")) {
368  return {nullptr, nullptr};
369  }
370 
371  std::vector<uint32_t> data(static_cast<size_t>(m_ctpDataFormat->getNumberTimeWords()), uint32_t{0});
372  data.reserve(m_ctpDataFormat->getNumberTimeWords() + m_ctpDataFormat->getDAQwordsPerBunch() + extra.size());
373  data.insert(data.end(),tip.begin(),tip.end());
374  data.insert(data.end(),tbp.begin(),tbp.end());
375  data.insert(data.end(),tap.begin(),tap.end());
376  data.insert(data.end(),tav.begin(),tav.end());
377  data.insert(data.end(),extra.begin(),extra.end());
378 
379  auto result = std::make_unique<xAOD::CTPResult>();
380  auto resultAux = std::make_unique<xAOD::CTPResultAuxInfo>();
381  result->setStore(resultAux.get());
383  CTPResultUtils::setTimeSec(*result, eventID.time_stamp()); // Time stamp: 32-bit UTC seconds
384  CTPResultUtils::setTimeNanoSec(*result, eventID.time_stamp_ns_offset()); // Time stamp: 28-bit nanoseconds
385  ATH_MSG_DEBUG( "Created CTPResult object" );
386  return std::make_pair(std::move(result), std::move(resultAux));
387 }

◆ constructRDOResult()

std::unique_ptr< CTP_RDO > LVL1CTP::ResultBuilder::constructRDOResult ( const EventIDBase &  eventID,
const std::vector< uint32_t > &  tbp,
const std::vector< uint32_t > &  tap,
const std::vector< uint32_t > &  tav,
const std::vector< uint32_t > &  tip,
const std::vector< uint32_t > &  extra 
) const

build RDO result (CTP_RDO) - TODO obsolete it in favor of xAOD::CTPResult

Definition at line 314 of file ResultBuilder.cxx.

320 {
321  auto wrongSize = [this](const std::vector<uint32_t> & vec, uint32_t exp, std::string_view name) {
322  if (vec.size() == exp) {return false;}
323  ATH_MSG_ERROR("Wrong " << name << " vector size passed to constructRDOResult, " << vec.size() << " instead of " << exp);
324  return true;
325  };
326  if (wrongSize(tip, m_ctpDataFormat->getTIPwords(), "TIP")
327  || wrongSize(tbp, m_ctpDataFormat->getTBPwords(), "TBP")
328  || wrongSize(tap, m_ctpDataFormat->getTAPwords(), "TAP")
329  || wrongSize(tav, m_ctpDataFormat->getTAVwords(), "TAV")) {
330  return nullptr;
331  }
332 
333  std::vector<uint32_t> data(static_cast<size_t>(m_ctpDataFormat->getNumberTimeWords()), uint32_t{0});
334  data.reserve(m_ctpDataFormat->getNumberTimeWords() + m_ctpDataFormat->getDAQwordsPerBunch() + extra.size());
335  data.insert(data.end(),tip.begin(),tip.end());
336  data.insert(data.end(),tbp.begin(),tbp.end());
337  data.insert(data.end(),tap.begin(),tap.end());
338  data.insert(data.end(),tav.begin(),tav.end());
339  data.insert(data.end(),extra.begin(),extra.end());
340 
341  std::unique_ptr<CTP_RDO> result( new CTP_RDO(m_ctpVersionNumber, std::move(data), extra.size()) );
342  result->setTimeSec(eventID.time_stamp()); // Time stamp: 32-bit UTC seconds
343  result->setTimeNanoSec(eventID.time_stamp_ns_offset()); // Time stamp: 28-bit nanoseconds
344  ATH_MSG_DEBUG( "Created CTP_RDO object" );
345  return result;
346 }

◆ constructResultVectors()

StatusCode LVL1CTP::ResultBuilder::constructResultVectors ( const std::map< std::string, unsigned int > &  itemDecisionMap,
std::vector< uint32_t > &  tbp,
std::vector< uint32_t > &  tap,
std::vector< uint32_t > &  tav,
unsigned char &  triggerType 
) const

Definition at line 183 of file ResultBuilder.cxx.

186 {
187  tbp.resize( m_ctpDataFormat->getTBPwords(), 0 );
188  tap.resize( m_ctpDataFormat->getTAPwords(), 0 );
189  tav.resize( m_ctpDataFormat->getTAVwords(), 0 );
190  triggerType = 0;
191 
192  for( auto & entry : itemDecisionMap ) {
193  const std::string & itemName = entry.first;
194  unsigned int result = entry.second;
195  bool passBP = (result & TBP) != 0;
196  bool passAP = (result & TAP) != 0;
197  bool passAV = (result & TAV) != 0;
198 
199 
200 
201 
202  auto l1Item = m_itemConfigMap->getItem( itemName );
203 
204  if( passAV ) {
205  triggerType |= l1Item->triggerType();
206  }
207 
208  auto ctpId = l1Item->ctpId();
209  unsigned int wordNr = ctpId / 32;
210  unsigned int posWithinWord = ctpId % 32;
211 
212  if( passBP ) { tbp[wordNr] |= 1L << posWithinWord; }
213  if( passAP ) { tap[wordNr] |= 1L << posWithinWord; }
214  if( passAV ) { tav[wordNr] |= 1L << posWithinWord; }
215 
216  ATH_MSG_DEBUG( " --> Trigger item " << itemName <<
217  " is " << ( !passBP ? "INACTIVE" : ( passAV ? "ACTIVE" : "ACTIVE (but PRESCALED)" ) ) );
218  }
219  ATH_MSG_DEBUG( "REGTEST - " << "TriggerType byte is: 0x" << std::setw( 2 ) << std::setfill( '0' ) << std::hex << int(triggerType) );
220 
221  return StatusCode::SUCCESS;
222 }

◆ constructRoIResult()

std::unique_ptr< LVL1CTP::CTPSLink > LVL1CTP::ResultBuilder::constructRoIResult ( const EventIDBase &  eventID,
const std::vector< uint32_t > &  tbp,
const std::vector< uint32_t > &  tap,
const std::vector< uint32_t > &  tav,
const std::vector< uint32_t > &  tip,
const std::vector< uint32_t > &  extra,
const unsigned char  triggerType 
) const

build RoI result (LVL1CTP::CTPSLink)

Definition at line 228 of file ResultBuilder.cxx.

235 {
236  //
237  // Build the data words:
238  //
239  std::vector<uint32_t> roi_vector;
240  roi_vector.push_back( eventID.time_stamp_ns_offset() ); // Time stamp: 28-bit nanoseconds
241  roi_vector.push_back( eventID.time_stamp() ); // Time stamp: 32-bit UTC seconds
242 
243  roi_vector.insert(roi_vector.end(), tip.begin(), tip.end()); // TIP + 1 extra word
244  roi_vector.insert(roi_vector.end(), tbp.begin(), tbp.end()); // TBP
245  roi_vector.insert(roi_vector.end(), tap.begin(), tap.end()); // TAP
246  roi_vector.insert(roi_vector.end(), tav.begin(), tav.end()); // TAV
247  roi_vector.insert(roi_vector.end(), extra.begin(), extra.end()); // Extra words
248 
249  ATH_MSG_VERBOSE( "Stored data elements of RoI result" );
250 
251  //
252  // Build the trailer:
253  //
254 
255  std::vector<unsigned int> trailer(ROIB::Trailer(roi_vector.size()).trailer());
256  roi_vector.insert(roi_vector.end(), trailer.begin(), trailer.end());
257  ATH_MSG_VERBOSE( "Created trailer of RoI result" );
258 
259  //
260  // Build the header:
261  //
262 
263  // convention for source id in LVL1: 0 for DAQ, 1 for RoIB
264  const uint32_t source_id{eformat::helper::SourceIdentifier(eformat::TDAQ_CTP, 1).code()};
265 
266  // version word
267  uint32_t version_word = eformat::DEFAULT_ROD_VERSION;
268  const uint32_t l1a_pos{0}; // there's only one BC in RoIB fragment, which is the L1A one
269  version_word |= ((extra.size() & m_ctpDataFormat->getProgrammableExtraWordsMask()) << m_ctpDataFormat->getProgrammableExtraWordsShift());
270  version_word |= ((l1a_pos & m_ctpDataFormat->getL1APositionMask()) << m_ctpDataFormat->getL1APositionShift());
271  version_word |= ((m_ctpVersionNumber & m_ctpDataFormat->getCTPFormatVersionMask()) << m_ctpDataFormat->getCTPFormatVersionShift());
272 
273  ROIB::Header helperHeader(source_id, 0, version_word);
274 
275  helperHeader.setRunNumber( eventID.run_number());
276  //helperHeader.setL1ID( eventID.extendedL1ID());
277  helperHeader.setBCID( eventID.bunch_crossing_id());
278  helperHeader.setTriggerType(triggerType);
279  //helperHeader.setEventType(EventInfo::instance().eventType());
280 
281  std::vector<unsigned int> header(helperHeader.header());
282  roi_vector.insert(roi_vector.begin(), header.begin(), header.end());
283  ATH_MSG_VERBOSE( "Created header of RoI result" );
284 
285  //
286  // Build the SLink:
287  //
288 
289  std::unique_ptr<CTPSLink> result ( new CTPSLink( roi_vector, m_ctpVersionNumber ));
290  ATH_MSG_DEBUG( "Created CTPSlink object" );
291  ATH_MSG_VERBOSE( "Dump CTPSlink object:\n" + result->dump() );
292 
293  //
294  // Debug output for ART
295  //
296  if( msgLvl(MSG::VERBOSE) ) {
297  for( auto & itemName : firedItems(tbp) ) {
298  ATH_MSG_VERBOSE( "REGTEST - Items fired before prescale: " << itemName );
299  }
300  for( auto & itemName : firedItems(tap) ) {
301  ATH_MSG_VERBOSE( "REGTEST - Items fired after prescale: " << itemName );
302  }
303  for( auto & itemName : firedItems(tav) ) {
304  ATH_MSG_VERBOSE( "REGTEST - Items fired after veto: " << itemName );
305  }
306  }
307  return result;
308 }

◆ constructTIPVector()

StatusCode LVL1CTP::ResultBuilder::constructTIPVector ( const std::map< std::string, unsigned int > &  thrMultiMap,
std::vector< uint32_t > &  tip 
) const

Definition at line 89 of file ResultBuilder.cxx.

91 {
92  tip.resize( m_ctpDataFormat->getTIPwords(), 0 );
93 
94  for( auto & entry : thrMultiMap ) {
95  const std::string & thrName = entry.first;
96  size_t multiplicity = entry.second;
97 
98  // if multiplicity is 0 then there is nothing to set
99  if(multiplicity==0) {
100  continue;
101  }
102 
103  auto x = m_internalTrigger.find(thrName);
104  if(x != m_internalTrigger.end()) {
105  // internal triggers (BGRP or RNDM)
106 
107  size_t wordNr = m_ctpDataFormat->getTIPwords() - 1; // internal triggers are stored in the last word
108  size_t posWithinWord = x->second->pitPos() % 32;
109 
110  tip[wordNr] |= ( 1L << posWithinWord );
111 
112  } else {
113  // all other trigger threshold multiplicities
114 
115  const CTPTriggerThreshold & ctpTT = m_thrConfigMap->getCTPThreshold( thrName );
116  size_t startBit = ctpTT.startBit();
117  size_t nBits = ctpTT.endBit() - startBit + 1;
118 
119  // restrict to the maximum possible multiplicity
120  if(multiplicity >= (1U<<nBits)) {
121  multiplicity = (1U<<nBits)-1;
122  }
123 
124  size_t wordNr = startBit / 32;
125  size_t posWithinWord = startBit % 32;
126 
127  uint64_t result = multiplicity; // need 64 bit in case the word boundary is crossed by the threshold start..end
128  result <<= posWithinWord;
129 
130  tip[wordNr] |= result & 0xFFFFFFFF;
131  if(wordNr+1 < m_ctpDataFormat->getTIPwords()-1) {
132  tip[wordNr+1] |= uint32_t((result & 0xFFFFFFFF00000000) >> 32);
133  }
134  }
135  }
136 
137  size_t wrdNr(0);
138  for( uint32_t word : tip ) {
139  ATH_MSG_DEBUG( "REGTEST - " << "TIP word #" << std::dec << wrdNr++
140  << " is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << word );
141  }
142 
143  return StatusCode::SUCCESS;
144 }

◆ createTriggerConfigMaps()

StatusCode LVL1CTP::ResultBuilder::createTriggerConfigMaps ( const TrigConf::L1Menu l1menu)
private

Definition at line 60 of file ResultBuilder.cxx.

61 {
62  ATH_MSG_DEBUG("Creating trigger configuration maps from run-3-style menu");
63 
64  std::vector<unsigned int> bg{1};
65  std::vector<unsigned int> bgEmpty{1};
66 
67  // declare internal bunch group triggers
68  for (size_t i = 0; i < 16; ++i) {
69  auto bgrp = new BunchGroupTrigger(i, bg, m_ctpDataFormat);
70  m_internalTrigger[ bgrp->name() ] = bgrp;
71  }
72 
73  // declare internal random triggers
74  for(int rndmIdx = 0; rndmIdx<4; rndmIdx++) {
75  auto rndm = new RandomTrigger(rndmIdx, m_ctpDataFormat);
76  m_internalTrigger[ rndm->name() ] = rndm;
77  }
78 
79  // build map of name to ctp thresholds
80  m_thrConfigMap = std::make_unique<ThresholdMap>( &l1menu );
81 
82  // build map of name to ctp items
83  m_itemConfigMap = std::make_unique<ItemMap>( &l1menu );
84 
85  return StatusCode::SUCCESS;
86 }

◆ declareGaudiProperty() [1/4]

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

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

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::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  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

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

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

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::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  }

◆ detStore()

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

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

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

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

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

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::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

◆ firedItems()

std::vector< std::string > LVL1CTP::ResultBuilder::firedItems ( const std::vector< uint32_t > &  triggerWords) const
private

build list of fired items and dump to string

Definition at line 391 of file ResultBuilder.cxx.

391  {
392  std::vector<std::string> passedItems;
393  for( const std::string & itemName : m_itemConfigMap->itemNames() ) {
394  auto item = m_itemConfigMap->getItem(itemName);
395  size_t idx = item->ctpId() / 32;
396  size_t bit = item->ctpId() % 32;
397  if ( triggerWords[idx] % (1L << bit) ) {
398  passedItems.push_back(item->name());
399  }
400  }
401  std::sort(passedItems.begin(), passedItems.end());
402  return passedItems;
403 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::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.

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::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< AlgTool > >::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< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ setConfiguration()

StatusCode LVL1CTP::ResultBuilder::setConfiguration ( const TrigConf::L1Menu l1menu)

Definition at line 51 of file ResultBuilder.cxx.

52 {
53  ATH_MSG_DEBUG( "Set configuration with CTP version " << m_ctpVersionNumber );
54 
56 }

◆ setRandomEngine()

void LVL1CTP::ResultBuilder::setRandomEngine ( CLHEP::HepRandomEngine *  rndmEngine)

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_ctpDataFormat

CTPdataformatVersion* LVL1CTP::ResultBuilder::m_ctpDataFormat { nullptr }
private

CTP data format details.

Definition at line 110 of file ResultBuilder.h.

◆ m_ctpVersionNumber

unsigned int LVL1CTP::ResultBuilder::m_ctpVersionNumber { 4 }
private

CTP data format version (4 in most of Run 2 and in Run 3)

Definition at line 109 of file ResultBuilder.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_internalTrigger

InternalTriggerMap LVL1CTP::ResultBuilder::m_internalTrigger
private

internal triggers BGRP and RNDM

Definition at line 108 of file ResultBuilder.h.

◆ m_itemConfigMap

std::unique_ptr<ItemMap> LVL1CTP::ResultBuilder::m_itemConfigMap { nullptr }
private

Map between item objects and their CTP-internal description.

Definition at line 107 of file ResultBuilder.h.

◆ m_thrConfigMap

std::unique_ptr<ThresholdMap> LVL1CTP::ResultBuilder::m_thrConfigMap { nullptr }
private

Map between threshold objects and their CTP-internal description.

Definition at line 106 of file ResultBuilder.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
get_generator_info.result
result
Definition: get_generator_info.py:21
header
Definition: hcg.cxx:526
CTPResultUtils::setTimeSec
void setTimeSec(xAOD::CTPResult &ctpRes, const uint32_t sec)
Set the time in seconds.
Definition: CTPResultUtils.cxx:55
StandaloneBunchgroupHandler.bg
bg
Definition: StandaloneBunchgroupHandler.py:241
CTP_RDO
CTP_RDO
Definition: TrigT1EventTPCnv.cxx:102
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LVL1CTP::ResultBuilder::firedItems
std::vector< std::string > firedItems(const std::vector< uint32_t > &triggerWords) const
build list of fired items and dump to string
Definition: ResultBuilder.cxx:391
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
LVL1CTP::ResultBuilder::m_ctpDataFormat
CTPdataformatVersion * m_ctpDataFormat
CTP data format details.
Definition: ResultBuilder.h:110
ROIB::Trailer::trailer
const std::vector< uint32_t > & trailer() const
get full trailer
CTPResultUtils::setTimeNanoSec
void setTimeNanoSec(xAOD::CTPResult &ctpRes, const uint32_t nano)
Set the time in nanoseconds.
Definition: CTPResultUtils.cxx:74
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
LVL1CTP::ResultBuilder::m_internalTrigger
InternalTriggerMap m_internalTrigger
internal triggers BGRP and RNDM
Definition: ResultBuilder.h:108
x
#define x
xAOD::tap
setBGCode tap
Definition: TrigDecision_v1.cxx:43
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
CTPResultUtils::initialize
void initialize(xAOD::CTPResult &ctpRes, uint32_t ctpVersionNumber, const uint32_t nBCs, uint32_t nExtraWords)
Initialize with a number of bunch crossings of the readout window.
Definition: CTPResultUtils.cxx:17
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
CxxUtils::vec
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Definition: vec.h:207
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
LVL1CTP::ResultBuilder::TBP
@ TBP
Definition: ResultBuilder.h:98
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
ROIB::Header
Header models the LVL1 ROD Header.
Definition: TrigT1Result/TrigT1Result/Header.h:37
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TrigConf::PrescaleSet::getCutFromPrescale
static int32_t getCutFromPrescale(double prescale)
calculate cut value for hardware configuration cut = 2*24/prescale - 1
Definition: PrescaleSet.cxx:33
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
TrigConf::LogicParsingException::msg
const std::string & msg() const
Definition: Logic.h:21
python.handimod.extra
int extra
Definition: handimod.py:521
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
LVL1CTP::ResultBuilder::m_ctpVersionNumber
unsigned int m_ctpVersionNumber
CTP data format version (4 in most of Run 2 and in Run 3)
Definition: ResultBuilder.h:109
ROIB::Trailer
ROIB::Trailer models the LVL1 ROD Trailer.
Definition: Trailer.h:37
item
Definition: ItemListSvc.h:43
LVL1CTP::ResultBuilder::m_thrConfigMap
std::unique_ptr< ThresholdMap > m_thrConfigMap
Map between threshold objects and their CTP-internal description.
Definition: ResultBuilder.h:106
LVL1CTP::ResultBuilder::TAV
@ TAV
Definition: ResultBuilder.h:98
a
TList * a
Definition: liststreamerinfos.cxx:10
h
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
LVL1CTP::ResultBuilder::m_itemConfigMap
std::unique_ptr< ItemMap > m_itemConfigMap
Map between item objects and their CTP-internal description.
Definition: ResultBuilder.h:107
python.XMLReader.l1menu
l1menu
Definition: XMLReader.py:73
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:629
RunTileMonitoring.triggerType
triggerType
Definition: RunTileMonitoring.py:162
LVL1CTP::ResultBuilder::createTriggerConfigMaps
StatusCode createTriggerConfigMaps(const TrigConf::L1Menu &l1menu)
Definition: ResultBuilder.cxx:60
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:13
makeTOC.header
header
Definition: makeTOC.py:28
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
LVL1CTP::ResultBuilder::TAP
@ TAP
Definition: ResultBuilder.h:98
TrigConf::LogicParsingException
Definition: Logic.h:16
fitman.k
k
Definition: fitman.py:528
python.SystemOfUnits.L
float L
Definition: SystemOfUnits.py:92