ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
LVL1::eFakeTower Class Reference

Load Et of the test vector. More...

#include <eFakeTower.h>

Inheritance diagram for LVL1::eFakeTower:
Collaboration diagram for LVL1::eFakeTower:

Public Member Functions

 eFakeTower (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor. More...
 
virtual StatusCode init (const std::string &) override
 initiate with the path to the test vector directory More...
 
 ~eFakeTower ()
 Destructor. More...
 
virtual int getET (int FPGAid, int eta, int phi, int layer, int cell) const override
 obtain the Et of a tower slot More...
 
virtual StatusCode loadnext () override
 Load the test vector of the next event. More...
 
virtual StatusCode execute () override
 replace the Tower Et with the ones stored in the test vector. More...
 
virtual StatusCode seteTowers (eTowerContainer *) override
 Define the eTowerContainer object for which the Et will be replaced. 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 > &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
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 

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

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

StatusCode changeFPGAET (int tmp_eTowersIDs_subset[][6], int FPGAnumber, int eFEXnumber)
 Replace the Et in an FOGA by the ones in the test vector. More...
 
StatusCode loadFPGA (int)
 load the Et in an FPGA More...
 
StatusCode loaddic (int)
 load index of Et More...
 
StatusCode changeTowerET (LVL1::eTower *inputtower, int eta, int phi, int FPGAid) const
 Replace the Et in a tower by the ones in the test vector. More...
 
int getFPGAnumber (int iefex, int ifpga) const
 determine the index of an FPGA More...
 
std::vector< int > * loadBlock (const std::string &, int) const
 Load the Et or index in a block. More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

eTowerContainerm_eTowerContainer
 
int m_numberofevents
 number of events More...
 
ToolHandle< IeFEXFPGATowerIdProviderm_eFEXFPGATowerIdProviderTool {this, "eFEXFPGATowerIdProviderTool", "LVL1::eFEXFPGATowerIdProvider", "Tool that provides tower-FPGA mapping"}
 tool needed for tower-FPGA mapping More...
 
std::string m_inputfile
 path to the input directory More...
 
std::unordered_map< int, std::unordered_map< int, unsigned int > * > m_alltowers
 map of all supercell ETs of FPGAs m_alltowers[FPGAid] = (supercell id,ET) supercell id = eta * 1000 + phi * 100 + layer * 10 + cell More...
 
std::unordered_map< int, std::vector< int > * > m_dict
 map for mapping infomation. m_dict[FPGAid] = [ list of supercell id in order ] 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

Load Et of the test vector.

Replace the Et in all towers with the ones store in test vector files for the validation of the L1Calo simulation.

The test vector files should be keep in one single directory. The Et of each FPGA should be stored in separate files. The file name should be ***.csv where The first two digits are the index of the eFEX (0-23) while the third digit is the index of the FPGA (0-3).

The Et will be set to zero if the file of an FPGA cannot be found.

The index of the Et should be defined in the first block of the test vector and the other blocks define Et of each event. An example of the test vector can be found in /athena/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/share/testvectorexample.txt.

Definition at line 51 of file eFakeTower.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ eFakeTower()

LVL1::eFakeTower::eFakeTower ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Constructor.

Definition at line 15 of file eFakeTower.cxx.

15  :
17 {
18  declareInterface<IeFakeTower>(this);
19 }

◆ ~eFakeTower()

LVL1::eFakeTower::~eFakeTower ( )

Destructor.

Definition at line 21 of file eFakeTower.cxx.

21  {
22  for (auto& allfpga : m_alltowers) {
23  delete allfpga.second;
24  }
25  for (auto& allfpga : m_dict) {
26  delete allfpga.second;
27  }
28  m_alltowers.clear();
29 }

Member Function Documentation

◆ changeFPGAET()

StatusCode LVL1::eFakeTower::changeFPGAET ( int  tmp_eTowersIDs_subset[][6],
int  FPGAnumber,
int  eFEXnumber 
)
private

Replace the Et in an FOGA by the ones in the test vector.

Parameters
tmp_eTowersIDs_subsetArray of tower IDs in the FPGA
FPGAnumberFPGA index to locate the FPGA
eFEXnumbereFEX index to locate the FPGA
Returns
status code

Definition at line 136 of file eFakeTower.cxx.

136  {
137  // replace all supercell energies in the FPGA using the test vector.
138  for (int myrow = 0; myrow<10; myrow++){
139  for (int mycol = 0; mycol<6; mycol++){
140  LVL1::eTower* thistower = m_eTowerContainer->findTower(tmp_eTowersIDs_subset[myrow][mycol]);
141 
142  // ignore umpty FPGA
143  bool nothaveFPGA = m_dict.find(getFPGAnumber(eFEXnumber, FPGAnumber)) == m_dict.end();
144  if (nothaveFPGA) {
145  continue;
146  }
147 
148  ATH_CHECK( changeTowerET(thistower, mycol, myrow, getFPGAnumber(eFEXnumber, FPGAnumber)) );
149  }
150  }
151  return StatusCode::SUCCESS;
152 }

◆ changeTowerET()

StatusCode LVL1::eFakeTower::changeTowerET ( LVL1::eTower inputtower,
int  eta,
int  phi,
int  FPGAid 
) const
private

Replace the Et in a tower by the ones in the test vector.

Parameters
inputtowereTower object to be processed
etaeta index to locate the SuperCell
phiphi index to locate the SuperCell
FPGAidFPGA Id to locate the SuperCell
Returns
status code

Definition at line 154 of file eFakeTower.cxx.

154  {
155  // update the ETs of the eTower using the values of test vector.
156  inputtower->clearET();
157 
158  inputtower->setET(0 ,getET(FPGAid, eta, phi, 0, 0), 0);
159 
160  inputtower->setET(1, getET(FPGAid, eta, phi, 1, 0), 1);
161  inputtower->setET(2, getET(FPGAid, eta, phi, 1, 1), 1);
162  inputtower->setET(3, getET(FPGAid, eta, phi, 1, 2), 1);
163  inputtower->setET(4, getET(FPGAid, eta, phi, 1, 3), 1);
164 
165  inputtower->setET(5, getET(FPGAid, eta, phi, 2, 0), 2);
166  inputtower->setET(6, getET(FPGAid, eta, phi, 2, 1), 2);
167  inputtower->setET(7, getET(FPGAid, eta, phi, 2, 2), 2);
168  inputtower->setET(8, getET(FPGAid, eta, phi, 2, 3), 2);
169 
170  inputtower->setET(9, getET(FPGAid, eta, phi, 3, 0), 3);
171 
172  inputtower->setET(10, getET(FPGAid, eta, phi, 4, 0), 4);
173  return StatusCode::SUCCESS;
174 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  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 > &  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 > &  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 > &  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 > &  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; }

◆ execute()

StatusCode LVL1::eFakeTower::execute ( )
overridevirtual

replace the Tower Et with the ones stored in the test vector.

Implements LVL1::IeFakeTower.

Definition at line 99 of file eFakeTower.cxx.

99  {
100  int FPGAtowerids[10][6];
101 
102  // set the Et of all towers to zero first
103  for (int efex{ 0 }; efex < 24; efex++) {
104  for (int fpga{ 0 }; fpga < 4; fpga++) {
105  StatusCode sc = m_eFEXFPGATowerIdProviderTool->getRankedTowerIDinFPGA(efex, fpga, FPGAtowerids);
106  if (sc == StatusCode::FAILURE) {
107  return StatusCode::FAILURE;
108  }
109  for (int myrow = 0; myrow<10; myrow++){
110  for (int mycol = 0; mycol<6; mycol++){
111  LVL1::eTower* thistower = m_eTowerContainer->findTower(FPGAtowerids[myrow][mycol]);
112  thistower->clearET();
113  }
114  }
115  }
116  }
117 
118  // replace all supercell energies in the eTowerContainer using the test vector.
119  for (int efex{ 0 }; efex < 24; efex++) {
120  for (int fpga{ 0 }; fpga < 4; fpga++) {
121  StatusCode sc = m_eFEXFPGATowerIdProviderTool->getRankedTowerIDinFPGA(efex, fpga, FPGAtowerids);
122  if (sc == StatusCode::FAILURE) {
123  return StatusCode::FAILURE;
124  }
125  ATH_CHECK( changeFPGAET(FPGAtowerids, fpga, efex) );
126  }
127  }
128  return StatusCode::SUCCESS;
129 }

◆ 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

◆ getET()

int LVL1::eFakeTower::getET ( int  FPGAid,
int  eta,
int  phi,
int  layer,
int  cell 
) const
overridevirtual

obtain the Et of a tower slot

Parameters
FPGAidFPGA id
etaeta index of the tower (0-5)
phiphi index of the tower (0-9)
layerlayer (0-4)
celltower slot. (pre-sample, layer-4 and had: 0, layer-2 and layer-3: 0-3)
Returns
Et

Implements LVL1::IeFakeTower.

Definition at line 49 of file eFakeTower.cxx.

49  {
50  // find the ET of a supercell.
51  if (eta > 5 || eta < 0) {
52  ATH_MSG_ERROR( "Requested Supercell does not exist.");
53  return 0;
54  }
55  if (phi > 9 || phi < 0) {
56  ATH_MSG_ERROR( "Requested Supercell does not exist.");
57  return 0;
58  }
59  if (layer > 4 || layer < 0) {
60  ATH_MSG_ERROR( "Requested Supercell does not exist.");
61  return 0;
62  }
63  if (cell > 3 || cell < 0) {
64  ATH_MSG_ERROR( "Requested Supercell does not exist.");
65  return 0;
66  }
67  if (m_dict.find(FPGAid) == m_dict.end()) {
68  return 0;
69  }
70  int id = eta * 1000 + phi * 100 + layer * 10 + cell;
71  if (m_alltowers.at(FPGAid)->find(id) == m_alltowers.at(FPGAid)->end()) {
72  ATH_MSG_ERROR( "Trying to access uninitiated supercell.");
73  return 0;
74  }
75  return m_alltowers.at(FPGAid)->at(id);
76 }

◆ getFPGAnumber()

int LVL1::eFakeTower::getFPGAnumber ( int  iefex,
int  ifpga 
) const
private

determine the index of an FPGA

Parameters
iefexId of the eFEX module (0-23)
ifpgaId of the FPGA (0-3)
Returns
FPGA index

Definition at line 244 of file eFakeTower.cxx.

244  {
245  return iefex * 10 + ifpga;
246 }

◆ init()

StatusCode LVL1::eFakeTower::init ( const std::string &  input_fileadress)
overridevirtual

initiate with the path to the test vector directory

Implements LVL1::IeFakeTower.

Definition at line 31 of file eFakeTower.cxx.

31  {
33  m_numberofevents = 0;
34  m_inputfile = input_fileadress;
35  std::string txt = ".txt";
36  for (int efex{ 0 }; efex < 24; efex++) {
37  for (int fpga{ 0 }; fpga < 4; fpga++) {
38  std::fstream fileStream;
39  fileStream.open(m_inputfile + std::to_string(getFPGAnumber(efex, fpga)) + txt);
40  if (fileStream.fail()) {
41  continue;
42  }
43  ATH_CHECK( loaddic(getFPGAnumber(efex, fpga)) );
44  }
45  }
46  return StatusCode::SUCCESS;
47 }

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

◆ interfaceID()

static const InterfaceID& LVL1::IeFakeTower::interfaceID ( )
inlinestaticinherited

Definition at line 16 of file IeFakeTower.h.

16 { return IID_IIeFakeTower; };

◆ loadBlock()

std::vector< int > * LVL1::eFakeTower::loadBlock ( const std::string &  inputfile,
int  eventnumber 
) const
private

Load the Et or index in a block.

Definition at line 209 of file eFakeTower.cxx.

209  {
210  // load the eventnumber_th block of the input file.
211  std::string eachline;
212  std::ifstream myfile(inputfile);
213  std::vector<int>* output = new std::vector<int>;
214  if (myfile.is_open()) {
215  int nblock = 0;
216  while (std::getline(myfile, eachline)) {
217  // The blocks are separated by empty lines.
218  if (eachline.length() < 3) {
219  nblock++;
220  }
221  if (nblock < eventnumber) {
222  continue;
223  }
224  else if (nblock > eventnumber) {
225  break;
226  }
227  std::string temvalue;
228  std::stringstream ss(eachline);
229  while (ss >> temvalue) {
230  // the first block is always the dic
231  if (eventnumber == 0) {
232  output->push_back(std::stoi(temvalue));
233  } else {
234  int et = eFEXCompression::expand(int(strtoull(temvalue.c_str(), nullptr, 16)));
235  output->push_back(et);
236  }
237  }
238  }
239  myfile.close();
240  }
241  return output;
242 }

◆ loaddic()

StatusCode LVL1::eFakeTower::loaddic ( int  FPGAid)
private

load index of Et

Definition at line 201 of file eFakeTower.cxx.

201  {
202  // load mapping information and store it in the m_dict object.
203  std::string txt = ".txt";
204  std::vector<int>* dic0 = loadBlock(m_inputfile + std::to_string(FPGAid) + txt, 0);
205  m_dict.insert(std::make_pair(FPGAid, dic0));
206  return StatusCode::SUCCESS;
207 }

◆ loadFPGA()

StatusCode LVL1::eFakeTower::loadFPGA ( int  FPGAid)
private

load the Et in an FPGA

Definition at line 176 of file eFakeTower.cxx.

176  {
177  std::string txt = ".txt";
178  // load ETs of an FPGA and store them in m_alltowers.
179 
180  // Check if the mapping exists.
181  if (m_dict.find(FPGAid) == m_dict.end()) {
182  ATH_MSG_ERROR( "Mapping for FPGA "<< FPGAid << " does not exist!");
183  return StatusCode::FAILURE;
184  }
185  std::vector<int>* Ets = loadBlock(m_inputfile + std::to_string(FPGAid) + txt, m_numberofevents);
186 
187  // check if the vector ETs have the same size as the mapping vector.
188  if (Ets->size() != (*m_dict[FPGAid]).size()) {
189  ATH_MSG_ERROR( "Unable to finish the tower mapping!" );
190  return StatusCode::FAILURE;
191  }
192  std::unordered_map<int, unsigned int>* ETmap = new std::unordered_map<int, unsigned int>;
193  for (unsigned int i = 0; i < Ets->size(); i++) {
194  ETmap->insert(std::make_pair((*m_dict[FPGAid])[i], (*Ets)[i]));
195  }
196  m_alltowers[FPGAid] = ETmap;
197  return StatusCode::SUCCESS;
198 }

◆ loadnext()

StatusCode LVL1::eFakeTower::loadnext ( )
overridevirtual

Load the test vector of the next event.

Implements LVL1::IeFakeTower.

Definition at line 78 of file eFakeTower.cxx.

79 {
81  // load the next events.
82  for (auto& allfpga : m_alltowers) {
83  delete allfpga.second;
84  }
85  std::string txt = ".txt";
86  for (int efex{ 0 }; efex < 24; efex++) {
87  for (int fpga{ 0 }; fpga < 4; fpga++) {
88  std::fstream fileStream;
89  fileStream.open(m_inputfile + std::to_string(getFPGAnumber(efex, fpga)) + txt);
90  if (fileStream.fail()) {
91  continue;
92  }
93  ATH_CHECK( loadFPGA(getFPGAnumber(efex, fpga)) );
94  }
95  }
96  return StatusCode::SUCCESS;
97 }

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

◆ seteTowers()

StatusCode LVL1::eFakeTower::seteTowers ( eTowerContainer input)
overridevirtual

Define the eTowerContainer object for which the Et will be replaced.

Implements LVL1::IeFakeTower.

Definition at line 131 of file eFakeTower.cxx.

131  {
133  return StatusCode::SUCCESS;
134 }

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

std::unordered_map<int, std::unordered_map<int, unsigned int>*> LVL1::eFakeTower::m_alltowers
private

map of all supercell ETs of FPGAs m_alltowers[FPGAid] = (supercell id,ET) supercell id = eta * 1000 + phi * 100 + layer * 10 + cell

Definition at line 146 of file eFakeTower.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_dict

std::unordered_map<int, std::vector<int>*> LVL1::eFakeTower::m_dict
private

map for mapping infomation. m_dict[FPGAid] = [ list of supercell id in order ]

Definition at line 149 of file eFakeTower.h.

◆ m_eFEXFPGATowerIdProviderTool

ToolHandle<IeFEXFPGATowerIdProvider> LVL1::eFakeTower::m_eFEXFPGATowerIdProviderTool {this, "eFEXFPGATowerIdProviderTool", "LVL1::eFEXFPGATowerIdProvider", "Tool that provides tower-FPGA mapping"}
private

tool needed for tower-FPGA mapping

Definition at line 137 of file eFakeTower.h.

◆ m_eTowerContainer

eTowerContainer* LVL1::eFakeTower::m_eTowerContainer
private

Definition at line 129 of file eFakeTower.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_inputfile

std::string LVL1::eFakeTower::m_inputfile
private

path to the input directory

Definition at line 139 of file eFakeTower.h.

◆ m_numberofevents

int LVL1::eFakeTower::m_numberofevents
private

number of events

Definition at line 134 of file eFakeTower.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:
test_pyathena.eta
eta
Definition: test_pyathena.py:10
et
Extra patterns decribing particle interation process.
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
LVL1::eTower
The eTower class is an interface object for eFEX trigger algorithms The purposes are twofold:
Definition: eTower.h:38
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
LVL1::eTower::clearET
void clearET()
Clear supercell ET values.
Definition: eTower.cxx:47
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
LVL1::eFEXCompression::expand
static int expand(unsigned int code)
Uncompress data.
Definition: eFEXCompression.cxx:55
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
LVL1::eFakeTower::loadBlock
std::vector< int > * loadBlock(const std::string &, int) const
Load the Et or index in a block.
Definition: eFakeTower.cxx:209
LVL1::eFakeTower::getFPGAnumber
int getFPGAnumber(int iefex, int ifpga) const
determine the index of an FPGA
Definition: eFakeTower.cxx:244
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
xAOD::phi
setEt phi
Definition: TrigEMCluster_v1.cxx:29
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
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
LVL1::eFakeTower::m_eFEXFPGATowerIdProviderTool
ToolHandle< IeFEXFPGATowerIdProvider > m_eFEXFPGATowerIdProviderTool
tool needed for tower-FPGA mapping
Definition: eFakeTower.h:137
LVL1::eFakeTower::loaddic
StatusCode loaddic(int)
load index of Et
Definition: eFakeTower.cxx:201
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
LVL1::eFakeTower::getET
virtual int getET(int FPGAid, int eta, int phi, int layer, int cell) const override
obtain the Et of a tower slot
Definition: eFakeTower.cxx:49
LVL1::eFakeTower::m_inputfile
std::string m_inputfile
path to the input directory
Definition: eFakeTower.h:139
LVL1::eFakeTower::m_dict
std::unordered_map< int, std::vector< int > * > m_dict
map for mapping infomation. m_dict[FPGAid] = [ list of supercell id in order ]
Definition: eFakeTower.h:149
LVL1::eFakeTower::m_eTowerContainer
eTowerContainer * m_eTowerContainer
Definition: eFakeTower.h:129
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
LVL1::eFakeTower::changeTowerET
StatusCode changeTowerET(LVL1::eTower *inputtower, int eta, int phi, int FPGAid) const
Replace the Et in a tower by the ones in the test vector.
Definition: eFakeTower.cxx:154
LVL1::eFakeTower::m_numberofevents
int m_numberofevents
number of events
Definition: eFakeTower.h:134
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
merge.output
output
Definition: merge.py:17
LVL1::eFakeTower::m_alltowers
std::unordered_map< int, std::unordered_map< int, unsigned int > * > m_alltowers
map of all supercell ETs of FPGAs m_alltowers[FPGAid] = (supercell id,ET) supercell id = eta * 1000 +...
Definition: eFakeTower.h:146
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
LVL1::eFakeTower::changeFPGAET
StatusCode changeFPGAET(int tmp_eTowersIDs_subset[][6], int FPGAnumber, int eFEXnumber)
Replace the Et in an FOGA by the ones in the test vector.
Definition: eFakeTower.cxx:136
a
TList * a
Definition: liststreamerinfos.cxx:10
h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
FullCPAlgorithmsTest_CA.inputfile
dictionary inputfile
Definition: FullCPAlgorithmsTest_CA.py:59
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
LVL1::eTowerContainer::findTower
const LVL1::eTower * findTower(int towerID) const
fast find method given identifier.
Definition: eTowerContainer.cxx:29
LVL1::eFakeTower::loadFPGA
StatusCode loadFPGA(int)
load the Et in an FPGA
Definition: eFakeTower.cxx:176
LVL1::eTower::setET
void setET(int cell, float et, int layer, bool ignoreDisable=false)
Definition: eTower.cxx:99
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528