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

#include <FPGATrackSimOutputHeaderTool.h>

Inheritance diagram for FPGATrackSimOutputHeaderTool:
Collaboration diagram for FPGATrackSimOutputHeaderTool:

Public Member Functions

 FPGATrackSimOutputHeaderTool (const std::string &, const std::string &, const IInterface *)
 
virtual ~FPGATrackSimOutputHeaderTool ()=default
 
virtual StatusCode initialize () override
 
virtual StatusCode finalize () override
 
FPGATrackSimLogicalEventInputHeaderaddInputBranch (std::string branchName, bool write=true)
 
FPGATrackSimLogicalEventOutputHeaderaddOutputBranch (std::string branchName, bool write=true)
 
StatusCode configureReadBranches ()
 
StatusCode readData (bool &last)
 
StatusCode writeData ()
 
std::string fileName ()
 
TTree * getEventTree ()
 
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
 

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 openFile (std::string const &path)
 
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

Gaudi::Property< std::vector< std::string > > m_inpath {this, "InFileName", {"."}, "input file paths"}
 
Gaudi::Property< std::string > m_rwoption {this, "RWstatus", std::string("READ"), "define read or write file option: READ, RECREATE, HEADER"}
 
Gaudi::Property< std::string > m_treeName {this, "OutputTreeName", "FPGATrackSimLogicalEventTree", "Name of the output TTree to create."}
 
ServiceHandle< ITHistSvc > m_tHistSvc {this, "THistSvc", "THistSvc"}
 
std::atomic< unsigned > m_event = 0
 
std::atomic< unsigned > m_totevent = 0
 
std::atomic< unsigned > m_file = 0
 
std::vector< FPGATrackSimLogicalEventInputHeader * > m_eventInputHeaders
 
std::vector< FPGATrackSimLogicalEventOutputHeader * > m_eventOutputHeaders
 
std::vector< std::string > m_branchNameIns
 
std::vector< std::string > m_branchNameOuts
 
TFile * m_infile = nullptr
 
TTree * m_EventTree = nullptr
 
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

Definition at line 28 of file FPGATrackSimOutputHeaderTool.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

◆ FPGATrackSimOutputHeaderTool()

FPGATrackSimOutputHeaderTool::FPGATrackSimOutputHeaderTool ( const std::string &  algname,
const std::string &  name,
const IInterface *  ifc 
)

Definition at line 9 of file FPGATrackSimOutputHeaderTool.cxx.

9  :
10  AthAlgTool(algname,name,ifc) {}

◆ ~FPGATrackSimOutputHeaderTool()

virtual FPGATrackSimOutputHeaderTool::~FPGATrackSimOutputHeaderTool ( )
virtualdefault

Member Function Documentation

◆ addInputBranch()

FPGATrackSimLogicalEventInputHeader * FPGATrackSimOutputHeaderTool::addInputBranch ( std::string  branchName,
bool  write = true 
)

Definition at line 127 of file FPGATrackSimOutputHeaderTool.cxx.

127  {
130  m_branchNameIns.push_back(branchName);
131  if (write) {
132  m_EventTree->Branch(branchName.c_str(), "FPGATrackSimLogicalEventInputHeader", inputHeader);
133  }
134  return inputHeader;
135 }

◆ addOutputBranch()

FPGATrackSimLogicalEventOutputHeader * FPGATrackSimOutputHeaderTool::addOutputBranch ( std::string  branchName,
bool  write = true 
)

Definition at line 137 of file FPGATrackSimOutputHeaderTool.cxx.

137  {
140  m_branchNameOuts.push_back(branchName);
141  if (write) {
142  m_EventTree->Branch(branchName.c_str(), "FPGATrackSimLogicalEventOutputHeader", outputHeader);
143  }
144  return outputHeader;
145 }

◆ configureReadBranches()

StatusCode FPGATrackSimOutputHeaderTool::configureReadBranches ( )

Definition at line 51 of file FPGATrackSimOutputHeaderTool.cxx.

51  {
52 
53  // Don't do anything
54  if (m_rwoption.value() != std::string("READ")) {
55  ATH_MSG_FATAL("Called configureReadBranches() when ROOT file was not opened in READ mode.");
56  return StatusCode::FAILURE;
57  }
58 
59  // In read mode, we want to make sure the configured branches are actually available.
60  // Configuration is via a function call (to allow different algorithms to set up different numbers of branches).
61  for (unsigned i = 0; i < m_branchNameIns.size(); i++) {
62  std::string branchName = m_branchNameIns.at(i);
63  if (!m_EventTree->GetListOfBranches()->FindObject(branchName.c_str())) {
64  ATH_MSG_FATAL("Configured input branch: " << branchName << " not found!");
65  return StatusCode::FAILURE;
66  }
67  TBranch *branchIn = m_EventTree->GetBranch(branchName.c_str());
68  branchIn->SetAddress(&(m_eventInputHeaders.at(i)));
69  m_EventTree->SetBranchStatus(branchName.c_str(), 1);
70  }
71 
72  // Do the same thing for the output branches. In fact we could maybe combine these loops by making a function.
73  for (unsigned i = 0; i < m_branchNameOuts.size(); i++) {
74  std::string branchName = m_branchNameOuts.at(i);
75  if (!m_EventTree->GetListOfBranches()->FindObject(branchName.c_str())) {
76  ATH_MSG_FATAL("Configured output branch: " << branchName << " not found!");
77  return StatusCode::FAILURE;
78  }
79  TBranch *branchIn = m_EventTree->GetBranch(branchName.c_str());
80  branchIn->SetAddress(&(m_eventOutputHeaders.at(i)));
81  m_EventTree->SetBranchStatus(branchName.c_str(), 1);
82  }
83 
84  return StatusCode::SUCCESS;
85 }

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

◆ 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

◆ fileName()

std::string FPGATrackSimOutputHeaderTool::fileName ( )
inline

Definition at line 50 of file FPGATrackSimOutputHeaderTool.h.

50 { return std::accumulate(m_inpath.value().begin(), m_inpath.value().end(), std::string{}); }

◆ finalize()

StatusCode FPGATrackSimOutputHeaderTool::finalize ( )
overridevirtual

Definition at line 148 of file FPGATrackSimOutputHeaderTool.cxx.

149 {
150  ATH_MSG_INFO ("finalize: closing files");
151 
152  if (m_rwoption.value() == std::string("RECREATE")) {
153  ATH_MSG_INFO ("Contains " << m_EventTree->GetEntries() << " entries, over " << m_event << " events run");
154  // close the output files, but check that it exists (for athenaMP)
155  m_infile->Write();
156  }
157 
158  if (m_rwoption.value() != std::string("HEADER")) {
159  m_infile->Close();
160  }
161 
162  // deleting pointers
163  for (auto* header : m_eventInputHeaders) delete header;
164  for (auto* header : m_eventOutputHeaders) delete header;
165 
166  return StatusCode::SUCCESS;
167 }

◆ getEventTree()

TTree* FPGATrackSimOutputHeaderTool::getEventTree ( )
inline

Definition at line 53 of file FPGATrackSimOutputHeaderTool.h.

53 { return m_EventTree; };

◆ initialize()

StatusCode FPGATrackSimOutputHeaderTool::initialize ( )
overridevirtual

Definition at line 88 of file FPGATrackSimOutputHeaderTool.cxx.

89 {
90 
91  ATH_CHECK(m_tHistSvc.retrieve());
92 
93  if( m_rwoption.value()!=std::string("HEADER"))
94  {
95  if (m_inpath.value().empty())
96  {
97  ATH_MSG_ERROR("Empty input file list");
98  return StatusCode::FAILURE;
99  }
100  ATH_CHECK(openFile(m_inpath.value().front()));
101  }
102 
103  if (m_rwoption.value() == std::string("READ")) {
104  ATH_MSG_DEBUG ("Initialized in READ MODE");
105  } else if (m_rwoption.value()==std::string("RECREATE") || m_rwoption.value()==std::string("HEADER")) {
106 
107  // branches are NO LONGER created here, the user needs to do this.
108  m_EventTree = new TTree(m_treeName.value().c_str(), "data");
109 
110  // For HEADER-- use THistSvc explicitly to set things up.
111  if (m_rwoption.value() == std::string("HEADER")) {
112  ATH_CHECK(m_tHistSvc->regTree(Form("/FPGATRACKSIMOUTPUT/%s", m_treeName.value().c_str()), m_EventTree));
113  }
114 
115  } else {
116  ATH_MSG_ERROR ("RWstatus = " << m_rwoption.value() << " is not allowed!");
117  return StatusCode::FAILURE;
118  }
119 
120  m_event = 0; // in file
121  m_totevent = 0; // total counter
122  return StatusCode::SUCCESS;
123 }

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

◆ openFile()

StatusCode FPGATrackSimOutputHeaderTool::openFile ( std::string const path)
private

Definition at line 14 of file FPGATrackSimOutputHeaderTool.cxx.

15 {
16  // close old file (I don't think we delete the pointer. Does ROOT handle that?)
17  if (m_infile && m_infile->IsOpen()) m_infile->Close();
18 
19  // open new file
20  ATH_MSG_DEBUG ("Opening file " << path.c_str() << " in " << m_rwoption.value() << " mode.");
21  m_infile = TFile::Open(path.c_str(), m_rwoption.value().c_str());
22 
23  if (!m_infile) {
24  ATH_MSG_FATAL("Could not open input file: " << path);
25  return StatusCode::FAILURE;
26  }
27 
28  if (m_rwoption.value() == std::string("READ")) {
29  // get the tree
30  m_EventTree = (TTree*) m_infile->Get(m_treeName.value().c_str());
31  if (!m_EventTree || m_EventTree->GetEntries() == -1) {
32  ATH_MSG_FATAL ("Input file: " << m_inpath.value() << " has no entries");
33  return StatusCode::FAILURE;
34  }
35 
36  ATH_MSG_INFO ("Input file: " << path << " has " << m_EventTree->GetEntries() << " event entries.");
37  }
38 
39  m_infile->cd();
40  m_event = 0;
41  return StatusCode::SUCCESS;
42 }

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

◆ readData()

StatusCode FPGATrackSimOutputHeaderTool::readData ( bool &  last)

Definition at line 213 of file FPGATrackSimOutputHeaderTool.cxx.

214 {
215  if (m_rwoption.value() != std::string("READ")) {
216  ATH_MSG_WARNING ("Asked to read file that is not in READ mode");
217  return StatusCode::SUCCESS;
218  }
219 
220  for (auto* header : m_eventInputHeaders) {
221  header->reset();
222  }
223 
224  for (auto* header : m_eventOutputHeaders) {
225  header->reset();
226  }
227 
228  ATH_MSG_DEBUG ("Asked Event " << m_event << " in this file; current total is " << m_totevent);
229  last = false;
230  if (m_event >= m_EventTree->GetEntries()) {
231  if (++m_file < m_inpath.value().size()) {
232  ATH_CHECK(openFile(m_inpath.value().at(m_file)));
233  // If opening a new file we need to update the branch addresses.
235  }
236  else {
237  last = true;
238  return StatusCode::SUCCESS;
239  }
240  }
241 
242  // Read the objects. I removed some of the debug messages here, they could be readded.
243  for (std::string branchName : m_branchNameIns) {
244  int statIn = m_EventTree->GetBranch(branchName.c_str())->GetEntry(m_event);
245  if (statIn <= 0) ATH_MSG_WARNING("Error in reading from branch " << branchName);
246  }
247 
248  for (std::string branchName : m_branchNameOuts) {
249  int statOut = m_EventTree->GetBranch(branchName.c_str())->GetEntry(m_event);
250  if (statOut <= 0) ATH_MSG_WARNING("Error in reading from branch " << branchName);
251  }
252 
253  m_event++;
254  m_totevent++;
255 
256 
257  return StatusCode::SUCCESS;
258 }

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

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

◆ writeData()

StatusCode FPGATrackSimOutputHeaderTool::writeData ( )

Definition at line 172 of file FPGATrackSimOutputHeaderTool.cxx.

172  {
173 
174  if (m_rwoption.value() == std::string("READ")) {
175  ATH_MSG_WARNING ("Asked to write file in READ mode");
176  return StatusCode::SUCCESS;
177  }
178 
179  ATH_MSG_DEBUG ("Writing data in TTree");
180 
181  m_EventTree->Fill();
182 
183  // Reset any input headers that we wrote out (with debugging prints).
184  for (unsigned i = 0; i < m_eventInputHeaders.size(); i++) {
185  ATH_MSG_DEBUG("Wrote event " << m_event << " in input header (" << m_branchNameIns.at(i) << ") event " << m_eventInputHeaders.at(i)->event());
186  m_eventInputHeaders.at(i)->reset();
187  }
188 
189  // Reset any output headers that we wrote out (With debugging prints).
190  for (unsigned i = 0; i < m_eventOutputHeaders.size(); i++) {
191  ATH_MSG_DEBUG("Wrote event " << m_event << " in output header (" << m_branchNameOuts.at(i) << ")");
192  ATH_MSG_DEBUG("n.roads_1st = " << m_eventOutputHeaders.at(i)->nFPGATrackSimRoads_1st());
193  ATH_MSG_DEBUG("n.roads_2nd = " << m_eventOutputHeaders.at(i)->nFPGATrackSimRoads_2nd());
194  ATH_MSG_DEBUG("n.tracks_1st = " << m_eventOutputHeaders.at(i)->nFPGATrackSimTracks_1st());
195  ATH_MSG_DEBUG("n.tracks_2nd = " << m_eventOutputHeaders.at(i)->nFPGATrackSimTracks_2nd());
196  m_eventOutputHeaders.at(i)->reset();
197  }
198 
199  // Only return FAILURe if there were no input AND output headers (i.e. something is misconfigured).
200  if (m_eventInputHeaders.size() == 0 and m_eventOutputHeaders.size() == 0) {
201  ATH_MSG_ERROR("Tried to fill output ROOT file with no configured input or output headers.");
202  return StatusCode::FAILURE;
203  }
204 
205  m_event++;
206 
207  return StatusCode::SUCCESS;
208 }

Member Data Documentation

◆ m_branchNameIns

std::vector<std::string> FPGATrackSimOutputHeaderTool::m_branchNameIns
private

Definition at line 81 of file FPGATrackSimOutputHeaderTool.h.

◆ m_branchNameOuts

std::vector<std::string> FPGATrackSimOutputHeaderTool::m_branchNameOuts
private

Definition at line 82 of file FPGATrackSimOutputHeaderTool.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_event

std::atomic<unsigned> FPGATrackSimOutputHeaderTool::m_event = 0
private

Definition at line 73 of file FPGATrackSimOutputHeaderTool.h.

◆ m_eventInputHeaders

std::vector<FPGATrackSimLogicalEventInputHeader*> FPGATrackSimOutputHeaderTool::m_eventInputHeaders
private

Definition at line 78 of file FPGATrackSimOutputHeaderTool.h.

◆ m_eventOutputHeaders

std::vector<FPGATrackSimLogicalEventOutputHeader*> FPGATrackSimOutputHeaderTool::m_eventOutputHeaders
private

Definition at line 79 of file FPGATrackSimOutputHeaderTool.h.

◆ m_EventTree

TTree* FPGATrackSimOutputHeaderTool::m_EventTree = nullptr
private

Definition at line 85 of file FPGATrackSimOutputHeaderTool.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_file

std::atomic<unsigned> FPGATrackSimOutputHeaderTool::m_file = 0
private

Definition at line 75 of file FPGATrackSimOutputHeaderTool.h.

◆ m_infile

TFile* FPGATrackSimOutputHeaderTool::m_infile = nullptr
private

Definition at line 84 of file FPGATrackSimOutputHeaderTool.h.

◆ m_inpath

Gaudi::Property<std::vector<std::string> > FPGATrackSimOutputHeaderTool::m_inpath {this, "InFileName", {"."}, "input file paths"}
private

Definition at line 60 of file FPGATrackSimOutputHeaderTool.h.

◆ m_rwoption

Gaudi::Property<std::string> FPGATrackSimOutputHeaderTool::m_rwoption {this, "RWstatus", std::string("READ"), "define read or write file option: READ, RECREATE, HEADER"}
private

Definition at line 64 of file FPGATrackSimOutputHeaderTool.h.

◆ m_tHistSvc

ServiceHandle<ITHistSvc> FPGATrackSimOutputHeaderTool::m_tHistSvc {this, "THistSvc", "THistSvc"}
private

Definition at line 70 of file FPGATrackSimOutputHeaderTool.h.

◆ m_totevent

std::atomic<unsigned> FPGATrackSimOutputHeaderTool::m_totevent = 0
private

Definition at line 74 of file FPGATrackSimOutputHeaderTool.h.

◆ m_treeName

Gaudi::Property<std::string> FPGATrackSimOutputHeaderTool::m_treeName {this, "OutputTreeName", "FPGATrackSimLogicalEventTree", "Name of the output TTree to create."}
private

Definition at line 67 of file FPGATrackSimOutputHeaderTool.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:
FPGATrackSimOutputHeaderTool::m_tHistSvc
ServiceHandle< ITHistSvc > m_tHistSvc
Definition: FPGATrackSimOutputHeaderTool.h:70
FPGATrackSimOutputHeaderTool::m_branchNameOuts
std::vector< std::string > m_branchNameOuts
Definition: FPGATrackSimOutputHeaderTool.h:82
getMenu.algname
algname
Definition: getMenu.py:54
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
FPGATrackSimLogicalEventInputHeader
Definition: FPGATrackSimLogicalEventInputHeader.h:21
header
Definition: hcg.cxx:526
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
FPGATrackSimOutputHeaderTool::openFile
StatusCode openFile(std::string const &path)
Definition: FPGATrackSimOutputHeaderTool.cxx:14
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition: FPGATrackSimMatrixAccumulator.cxx:22
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
FPGATrackSimOutputHeaderTool::m_branchNameIns
std::vector< std::string > m_branchNameIns
Definition: FPGATrackSimOutputHeaderTool.h:81
FPGATrackSimOutputHeaderTool::m_file
std::atomic< unsigned > m_file
Definition: FPGATrackSimOutputHeaderTool.h:75
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
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
FPGATrackSimOutputHeaderTool::configureReadBranches
StatusCode configureReadBranches()
Definition: FPGATrackSimOutputHeaderTool.cxx:51
lumiFormat.i
int i
Definition: lumiFormat.py:85
FPGATrackSimOutputHeaderTool::m_rwoption
Gaudi::Property< std::string > m_rwoption
Definition: FPGATrackSimOutputHeaderTool.h:64
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
FPGATrackSimOutputHeaderTool::m_infile
TFile * m_infile
Definition: FPGATrackSimOutputHeaderTool.h:84
FPGATrackSimOutputHeaderTool::m_EventTree
TTree * m_EventTree
Definition: FPGATrackSimOutputHeaderTool.h:85
FPGATrackSimOutputHeaderTool::m_treeName
Gaudi::Property< std::string > m_treeName
Definition: FPGATrackSimOutputHeaderTool.h:67
python.ByteStreamConfig.write
def write
Definition: Event/ByteStreamCnvSvc/python/ByteStreamConfig.py:248
FPGATrackSimOutputHeaderTool::m_eventInputHeaders
std::vector< FPGATrackSimLogicalEventInputHeader * > m_eventInputHeaders
Definition: FPGATrackSimOutputHeaderTool.h:78
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
FPGATrackSimOutputHeaderTool::m_inpath
Gaudi::Property< std::vector< std::string > > m_inpath
Definition: FPGATrackSimOutputHeaderTool.h:60
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:
FPGATrackSimOutputHeaderTool::m_event
std::atomic< unsigned > m_event
Definition: FPGATrackSimOutputHeaderTool.h:73
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_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
a
TList * a
Definition: liststreamerinfos.cxx:10
h
FPGATrackSimOutputHeaderTool::m_totevent
std::atomic< unsigned > m_totevent
Definition: FPGATrackSimOutputHeaderTool.h:74
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
FPGATrackSimLogicalEventOutputHeader
Definition: FPGATrackSimLogicalEventOutputHeader.h:12
FPGATrackSimOutputHeaderTool::m_eventOutputHeaders
std::vector< FPGATrackSimLogicalEventOutputHeader * > m_eventOutputHeaders
Definition: FPGATrackSimOutputHeaderTool.h:79
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
makeTOC.header
header
Definition: makeTOC.py:28
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