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

#include <VP1BatchOnLatestEvent.h>

Inheritance diagram for VP1BatchOnLatestEvent:
Collaboration diagram for VP1BatchOnLatestEvent:

Public Member Functions

 VP1BatchOnLatestEvent (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual StatusCode initialize () override
 
virtual StatusCode execute () override
 
virtual StatusCode finalize () override
 
virtual void handle (const Incident &inc) override
 
virtual StatusCode sysInitialize () override
 Override sysInitialize. More...
 
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies. 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 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

std::string getRandomConfigFile ()
 
void overlayATLASlogo ()
 
void overlayEventDetails ()
 
void getHumanReadableTimestamp ()
 
void makeEventDisplay ()
 
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

std::string m_inputVP1CfgFile
 
std::string m_inputDir
 
std::string m_destinationDir
 
bool m_isGetRandomFile
 
SG::ReadHandleKey< xAOD::EventInfom_eventInfoKey {this, "EventInfo", "EventInfo", "EventInfo Key"}
 
int m_nEvent
 
int m_indexFile
 
int m_lastIndexFile
 
uint64_t m_eventNumber = 0
 
unsigned long m_runNumber = 0
 
unsigned long m_timeStamp = 0
 
std::string m_humanTimestamp
 
DataObjIDColl m_extendedExtraObjects
 
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 27 of file VP1BatchOnLatestEvent.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ VP1BatchOnLatestEvent()

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

Definition at line 28 of file VP1BatchOnLatestEvent.cxx.

29  : AthAlgorithm(name, svcLocator)
30  , m_nEvent(0)
31  , m_indexFile(0)
32  , m_lastIndexFile(0)
33 {
34  declareProperty("VP1ConfigFile", m_inputVP1CfgFile="");
35  declareProperty("DestinationDirectory", m_destinationDir=""); // produce files in the run directory by default
36  declareProperty("InputDirectory", m_inputDir=""); // the directory where the input data files (e.g. ESDs) are stored
37  declareProperty("UseRandomVP1ConfigFile", m_isGetRandomFile = false); // get random configuration files if TRUE
38 }

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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 VP1BatchOnLatestEvent::execute ( )
overridevirtual

Definition at line 53 of file VP1BatchOnLatestEvent.cxx.

54 {
55  ATH_MSG_DEBUG(" in execute() ");
57  if(eventInfo.isValid()) {
58  m_eventNumber = eventInfo->eventNumber();
59  m_runNumber = eventInfo->runNumber();
60  m_timeStamp = eventInfo->timeStamp(); // posix time in seconds from 1970, 32 bit unsigned
61 
62  ATH_MSG_DEBUG("run number: "<< m_runNumber
63  << ", event number: "
64  << m_eventNumber << " : timestamp (UNIX): "
65  << m_timeStamp
66  << "] ");
67 
68  if(msgLvl(MSG::DEBUG)) {
69  std::stringstream stream;
70  stream << "Event type: SIMULATION '" << std::boolalpha
71  << eventInfo->eventType (xAOD::EventInfo::IS_SIMULATION)
72  << "' - ";
73  int i{-1};
74  for(float weight : eventInfo->mcEventWeights()) {
75  stream << " weight " << ++i << ": " << weight;
76  }
77  ATH_MSG_DEBUG(stream.str());
78  }
79  }
80  else {
81  ATH_MSG_ERROR(" Unable to retrieve EventInfo from StoreGate!!!");
82  m_eventNumber = 0;
83  m_runNumber = 0;
84  m_timeStamp = 0;
85  }
86 
87  // get a human-readable timestamp from UNIX time
89 
90  return StatusCode::SUCCESS;
91 }

◆ extraDeps_update_handler()

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

Add StoreName to extra input/output deps as needed.

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

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

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

Definition at line 50 of file AthAlgorithm.cxx.

51 {
52  // If we didn't find any symlinks to add, just return the collection
53  // from the base class. Otherwise, return the extended collection.
54  if (!m_extendedExtraObjects.empty()) {
56  }
57  return Algorithm::extraOutputDeps();
58 }

◆ finalize()

StatusCode VP1BatchOnLatestEvent::finalize ( )
overridevirtual

Definition at line 93 of file VP1BatchOnLatestEvent.cxx.

94 {
95  ATH_MSG_VERBOSE("in finalize() ");
96 
97  // Let VP1FileUtilities handle the output of the last event
98  if(m_nEvent) {
100  }
101 
102  return StatusCode::SUCCESS;
103 }

◆ getHumanReadableTimestamp()

void VP1BatchOnLatestEvent::getHumanReadableTimestamp ( )
private

Definition at line 278 of file VP1BatchOnLatestEvent.cxx.

279 {
280  time_t t_timestamp = m_timeStamp;
281  struct tm ltm;
282  localtime_r(&t_timestamp, &ltm);
283 
284  // print various components of tm structure.
285  ATH_MSG_DEBUG( "Year: "<< 1900 + ltm.tm_year
286  << " - " << "Month: "<< 1 + ltm.tm_mon<< " - " // tm_mon is in the range [0, 11], so 1 must be added to get real months
287  << "Day: "<< ltm.tm_mday
288  << " - " "Time: "<< ltm.tm_hour << ":" << ltm.tm_min << ":" << ltm.tm_sec); // << "CEST" FIXME: check if time zone is available on data file
289 
290 
291  std::ostringstream ostri;
292  ostri << 1900 + ltm.tm_year
293  << "-" << 1 + ltm.tm_mon // tm_mon is in the range [0, 11], so 1 must be added to get real months
294  << "-" << ltm.tm_mday
295  << "T" << ltm.tm_hour << "-" << ltm.tm_min << "-" << ltm.tm_sec; // << "CEST"; FIXME: check if time zone is available on data file
296 
297  m_humanTimestamp = ostri.str();
298  ATH_MSG_DEBUG( "'human readable' timestamp: " << m_humanTimestamp );
299 }

◆ getRandomConfigFile()

std::string VP1BatchOnLatestEvent::getRandomConfigFile ( )
private

Definition at line 159 of file VP1BatchOnLatestEvent.cxx.

160 {
161  ATH_MSG_DEBUG(" in getRandomConfigFile() ");
162 
163 
164  std::string configFile;
165 
166  // a list of possible config files, which are stored in the "share/" folder
167  std::vector<std::string> configFiles;
168  configFiles.push_back("vp1_conf_ATLASatHOME_truth_event_wTRTGeo.vp1");
169  configFiles.push_back("vp1_conf_ATLASatHOME_truth_event_wTRTGeo_IAview.vp1");
170  configFiles.push_back("vp1_conf_ATLASatHOME_truth_event_wTRTGeo_wBarrel.vp1");
171  configFiles.push_back("vp1_conf_ATLASatHOME_truth_event_wPixel_wSCT_wOpenCalo_wGeo_3D.vp1");
172  configFiles.push_back("vp1_conf_ATLASatHOME_truth_event_wPixel_wSCT_wGeo_3D.vp1");
173  configFiles.push_back("vp1_conf_ATLASatHOME_truth_event_wPixel_3D.vp1");
174  configFiles.push_back("vp1_conf_ATLASatHOME_truth_event_wIDGeo.vp1");
175  configFiles.push_back("vp1_conf_ATLASatHOME_truth_event_wGeo_frontView.vp1");
176 
177  int nConfigFiles = configFiles.size();
178  ATH_MSG_DEBUG(" ===> # config files: " << nConfigFiles);
179  int nPositions = nConfigFiles - 1;
180 
181  // setup random generator in [0, nConfigFiles]
182  auto seed = std::random_device{}();
183  auto randomDist = std::bind(std::uniform_int_distribution<int>(0, nPositions ),
184  std::mt19937(seed));
185 
186  // get a random index,
187  // avoiding having the same index in a row
188  while ( m_indexFile == m_lastIndexFile )
189  m_indexFile = randomDist();
191  ATH_MSG_DEBUG(" ===> random index: " << m_indexFile);
192 
193  //std::string configFile = "vp1_conf_ATLASatHOME_truth_event_wTRTGeo.vp1";
194  configFile = configFiles[m_indexFile];
195  ATH_MSG_DEBUG(" ===> random file: " << configFile);
196 
197  return configFile;
198 
199 }

◆ handle()

void VP1BatchOnLatestEvent::handle ( const Incident &  inc)
overridevirtual

Definition at line 106 of file VP1BatchOnLatestEvent.cxx.

107 {
108  ATH_MSG_INFO("Handling incident '" << inc.type() << "'");
109 
110  // Let VP1FileUtilities handle the output of the previous event
111  if(m_nEvent) {
113  }
114  m_nEvent++;
115 }

◆ initialize()

StatusCode VP1BatchOnLatestEvent::initialize ( )
overridevirtual

Definition at line 43 of file VP1BatchOnLatestEvent.cxx.

44 {
45  ATH_MSG_INFO(" in initialize() ");
47  ServiceHandle<IIncidentSvc> incSvc("IncidentSvc",name());
48  ATH_CHECK(incSvc.retrieve());
49  incSvc->addListener(this, "BeginEvent", 0);
50  return StatusCode::SUCCESS;
51 }

◆ inputHandles()

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

Return this algorithm's input handles.

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

◆ makeEventDisplay()

void VP1BatchOnLatestEvent::makeEventDisplay ( )
private

Definition at line 119 of file VP1BatchOnLatestEvent.cxx.

119  {
120 
121  // if the user specified empty config file name and declared 'VP1BatchOnLatestEvent.UseRandomVP1ConfigFile=True' in the jobOption
122  if (m_isGetRandomFile) {
123  ATH_MSG_INFO("--> RANDOM MODE: Using a random VP1 configuration file...");
125  }
126 
127  ATH_MSG_INFO("--> Input VP1 Configuration file: " << m_inputVP1CfgFile);
128 
129  // build the command to launch VP1-Batch on the latest-produced ESD file
130  std::string commandStr = "vp1 -batch";
131 
132  // add custom output folder, if user specified it
133  if (m_destinationDir != "") {
134  ATH_MSG_INFO(" --> Using user-defined output folder: " << m_destinationDir);
135  commandStr += " -batch-output-folder=" + m_destinationDir;
136  }
137 
138  commandStr += " `cat latest_vp1event` " + m_inputVP1CfgFile;
139 
140  bool vp1OK = false;
141  ATH_MSG_INFO(" ===> launching VP1-Batch: " << commandStr);
142  try {
143  system(commandStr.c_str());
144  vp1OK = true;
145  } catch (std::runtime_error& err) {
146  ATH_MSG_WARNING("Exception caught: " << err.what());
147  ATH_MSG_WARNING("Unable to launch VP1-Batch on the latest-produced event file");
148  }
149  if (vp1OK) {
150  // Overlay the ATLAS logo to the image
152  // Overlay the event details to the image
154  }
155 }

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

MsgStream& AthCommonMsg< Algorithm >::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< Algorithm >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

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

◆ outputHandles()

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

Return this algorithm's output handles.

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

◆ overlayATLASlogo()

void VP1BatchOnLatestEvent::overlayATLASlogo ( )
private

Definition at line 202 of file VP1BatchOnLatestEvent.cxx.

203 {
204  //std::string commandStr = "convert -composite `cat latest_vp1image` $TestArea/InstallArea/share/ATLAS-Logo-New_300pixels.png -geometry 150x150+0+0 -depth 8 test.png"; // this set the logo size to 150px and it draws it at (0,0)px
205  //std::string commandStr = "convert -composite `cat latest_vp1image` $TestArea/InstallArea/share/ATLAS-Logo-New_300pixels.png -geometry +10+10 -depth 8 test.png"; // this uses the original logo size and it draws it at (10,10)px
206  std::string commandStr = "convert -composite `cat latest_vp1image` $TestArea/InstallArea/share/ATLAS-Logo-New_300pixels.png -geometry +10+10 -depth 8 `cat latest_vp1image`";
207 
208  ATH_MSG_DEBUG( " ===> overlay the ATLAS logo: " << commandStr );
209  try {
210  system(commandStr.c_str());
211  } catch (std::runtime_error& err) {
212  ATH_MSG_WARNING( "Exception caught: " << err.what() );
213  ATH_MSG_WARNING( "Unable to run 'convert'!" );
214  }
215 }

◆ overlayEventDetails()

void VP1BatchOnLatestEvent::overlayEventDetails ( )
private

Definition at line 219 of file VP1BatchOnLatestEvent.cxx.

220 {
221 
222 
223 
224  std::string nRun = std::to_string(m_runNumber);
225  std::string nEvent = std::to_string(m_eventNumber);
226 
227  // bash command:
228  // nRun=0; nEvent=4; img=`cat latest_vp1image`; width=$(identify -format %W ${img}); width=$(( ${width} * 3 / 10 )); convert -background '#0008' -gravity west -fill white -size ${width}x80 -font Courier -density 72 -pointsize 18 -interline-spacing 4 caption:'Run number: '${nRun}'\nEvent number: '${nEvent}'\n2015-02-02, 15:10:00' ${img} +swap -gravity SouthEast -composite ${img}-30
229  // nRun=0; nEvent=4; timestamp='ciao'; img=`cat latest_vp1image`; width=$(identify -format %W ${img}); width=$(( ${width} * 3 / 10 )); convert -background '#0008' -gravity west -fill white -size ${width}x80 -font Courier -density 72 -pointsize 18 -interline-spacing 4 caption:'Run number: '${nRun}'\nEvent number: '${nEvent}'\n'${timestamp} ${img} +swap -gravity SouthEast -composite ${img}-31
230  // nRun=0; nEvent=4; timestamp='2015-02-02T10:10:00'; img=`cat latest_vp1image`; width=$(identify -format %W ${img}); width=$(( ${width} * 3 / 10 )); convert -background '#0008' -gravity west -fill white -size ${width}x80 -font Courier -density 72 -pointsize 18 -interline-spacing 4 caption:'Run number: '${nRun}'\nEvent number: '${nEvent}'\n'${timestamp} ${img} +swap -gravity SouthEast -composite ${img}-36
231  std::string commandStr;
232 
233  // setting bash variables
234  commandStr += "nRun="+nRun+"; ";
235  commandStr += "nEvent="+nEvent+"; ";
236  if (m_timeStamp > 0) commandStr += "timestamp='"+m_humanTimestamp+"'; "; // 'timestamp' must not have white spaces
237 
238  // get input image
239  commandStr += "img=`cat latest_vp1image`; "; // get the filename of the latest image produced
240  commandStr += "width=$(identify -format %W ${img}); "; // get the width of the image
241  commandStr += "width=$(( ${width} * 3 / 10 )); "; // set the caption width as a fraction of the image width
242 
243  // ImageMagik 'convert' command settings. (ImageMagik is installed by default on SLC LXPLUS machines)
244  commandStr = commandStr
245  + "convert "
246  + "-background '#0008' " // semi-transparent grey bkg
247  + "-geometry +20+20 " // set an offset to the label position
248  + "-gravity West " // set text position inside the caption space (justification)
249  + "-fill white " // text font color
250  + "-size ${width}x80 " // set text size relative to 'width'
251 
252  + "-font Courier " // text font
253  + "-density 72 " // dots-per-inch resolution
254  + "-pointsize 18 " // text size in points
255  //+ "-interline-spacing 4 " // additional number of pixels between lines of text (only with ImageMagik >= 6.5.5-8!!! Lxplus has 6.7 but not all SLC6 machines...)
256 
257  //+ "caption:'Run number: ${nRun}' " // set the caption text
258  //+ (m_timeStamp > 0 ? "caption:'Run number: '${nRun}'\\nEvent number: '${nEvent}'\\n'${timestamp} " : "caption:'Run number: '${nRun}'\\nEvent number: '${nEvent}'\\n'${timestamp} ") // set the caption text; '\n' needs to be double-escaped while passed to system()
259  + "caption:'Run number: '${nRun}'\\nEvent number: '${nEvent}'\\n'${timestamp} " // set the caption text; '\n' needs to be double-escaped while passed to system()
260 
261  + "${img} " // imput image
262  + "+swap "
263  + "-gravity SouthEast " // set overall caption position
264  + "-composite "
265  + "${img}"; // output image: here we replace the original image
266 
267 
268  ATH_MSG_DEBUG( " ===> overlay the event details: " << commandStr );
269  try {
270  system(commandStr.c_str());
271  } catch (std::runtime_error& err) {
272  ATH_MSG_WARNING( "Exception caught: " << err.what() );
273  ATH_MSG_WARNING( "Unable to run 'convert'!" );
274  }
275 }

◆ 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< Algorithm > >::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< Algorithm > >::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()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

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

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

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, PyAthena::Alg, and AthHistogramAlgorithm.

Definition at line 66 of file AthAlgorithm.cxx.

66  {
68 
69  if (sc.isFailure()) {
70  return sc;
71  }
72  ServiceHandle<ICondSvc> cs("CondSvc",name());
73  for (auto h : outputHandles()) {
74  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75  // do this inside the loop so we don't create the CondSvc until needed
76  if ( cs.retrieve().isFailure() ) {
77  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78  return StatusCode::SUCCESS;
79  }
80  if (cs->regHandle(this,*h).isFailure()) {
81  sc = StatusCode::FAILURE;
82  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83  << " with CondSvc");
84  }
85  }
86  }
87  return sc;
88 }

◆ sysStart()

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

Handle START transition.

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

◆ updateVHKA()

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

Definition at line 308 of file AthCommonDataStore.h.

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

Member Data Documentation

◆ m_destinationDir

std::string VP1BatchOnLatestEvent::m_destinationDir
private

Definition at line 56 of file VP1BatchOnLatestEvent.h.

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_eventInfoKey

SG::ReadHandleKey<xAOD::EventInfo> VP1BatchOnLatestEvent::m_eventInfoKey {this, "EventInfo", "EventInfo", "EventInfo Key"}
private

Definition at line 59 of file VP1BatchOnLatestEvent.h.

◆ m_eventNumber

uint64_t VP1BatchOnLatestEvent::m_eventNumber = 0
private

Definition at line 66 of file VP1BatchOnLatestEvent.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_humanTimestamp

std::string VP1BatchOnLatestEvent::m_humanTimestamp
private

Definition at line 69 of file VP1BatchOnLatestEvent.h.

◆ m_indexFile

int VP1BatchOnLatestEvent::m_indexFile
private

Definition at line 63 of file VP1BatchOnLatestEvent.h.

◆ m_inputDir

std::string VP1BatchOnLatestEvent::m_inputDir
private

Definition at line 55 of file VP1BatchOnLatestEvent.h.

◆ m_inputVP1CfgFile

std::string VP1BatchOnLatestEvent::m_inputVP1CfgFile
private

Definition at line 54 of file VP1BatchOnLatestEvent.h.

◆ m_isGetRandomFile

bool VP1BatchOnLatestEvent::m_isGetRandomFile
private

Definition at line 57 of file VP1BatchOnLatestEvent.h.

◆ m_lastIndexFile

int VP1BatchOnLatestEvent::m_lastIndexFile
private

Definition at line 64 of file VP1BatchOnLatestEvent.h.

◆ m_nEvent

int VP1BatchOnLatestEvent::m_nEvent
private

Definition at line 62 of file VP1BatchOnLatestEvent.h.

◆ m_runNumber

unsigned long VP1BatchOnLatestEvent::m_runNumber = 0
private

Definition at line 67 of file VP1BatchOnLatestEvent.h.

◆ m_timeStamp

unsigned long VP1BatchOnLatestEvent::m_timeStamp = 0
private

Definition at line 68 of file VP1BatchOnLatestEvent.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
VP1BatchOnLatestEvent::getRandomConfigFile
std::string getRandomConfigFile()
Definition: VP1BatchOnLatestEvent.cxx:159
taskman.configFile
configFile
Definition: taskman.py:311
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
VP1BatchOnLatestEvent::m_lastIndexFile
int m_lastIndexFile
Definition: VP1BatchOnLatestEvent.h:64
AthCommonMsg< Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
VP1BatchOnLatestEvent::makeEventDisplay
void makeEventDisplay()
Definition: VP1BatchOnLatestEvent.cxx:119
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
VP1BatchOnLatestEvent::m_runNumber
unsigned long m_runNumber
Definition: VP1BatchOnLatestEvent.h:67
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
xAOD::EventInfo_v1::IS_SIMULATION
@ IS_SIMULATION
true: simulation, false: data
Definition: EventInfo_v1.h:151
VP1BatchOnLatestEvent::m_inputDir
std::string m_inputDir
Definition: VP1BatchOnLatestEvent.h:55
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
VP1BatchOnLatestEvent::overlayATLASlogo
void overlayATLASlogo()
Definition: VP1BatchOnLatestEvent.cxx:202
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
VP1BatchOnLatestEvent::overlayEventDetails
void overlayEventDetails()
Definition: VP1BatchOnLatestEvent.cxx:219
VP1BatchOnLatestEvent::m_timeStamp
unsigned long m_timeStamp
Definition: VP1BatchOnLatestEvent.h:68
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
Generate_dsid_ranseed.seed
seed
Definition: Generate_dsid_ranseed.py:10
AthAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthAlgorithm.cxx:66
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
VP1BatchOnLatestEvent::m_eventNumber
uint64_t m_eventNumber
Definition: VP1BatchOnLatestEvent.h:66
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
VP1BatchOnLatestEvent::m_destinationDir
std::string m_destinationDir
Definition: VP1BatchOnLatestEvent.h:56
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
VP1BatchOnLatestEvent::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition: VP1BatchOnLatestEvent.h:59
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
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:228
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
VP1BatchOnLatestEvent::m_isGetRandomFile
bool m_isGetRandomFile
Definition: VP1BatchOnLatestEvent.h:57
VP1BatchOnLatestEvent::getHumanReadableTimestamp
void getHumanReadableTimestamp()
Definition: VP1BatchOnLatestEvent.cxx:278
VP1BatchOnLatestEvent::m_indexFile
int m_indexFile
Definition: VP1BatchOnLatestEvent.h:63
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition: AthAlgorithm.h:79
VP1BatchOnLatestEvent::m_inputVP1CfgFile
std::string m_inputVP1CfgFile
Definition: VP1BatchOnLatestEvent.h:54
a
TList * a
Definition: liststreamerinfos.cxx:10
h
VP1BatchOnLatestEvent::m_nEvent
int m_nEvent
Definition: VP1BatchOnLatestEvent.h:62
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
VP1BatchOnLatestEvent::m_humanTimestamp
std::string m_humanTimestamp
Definition: VP1BatchOnLatestEvent.h:69
DEBUG
#define DEBUG
Definition: page_access.h:11
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
AthAlgorithm::AthAlgorithm
AthAlgorithm()
Default constructor:
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
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
ServiceHandle< IIncidentSvc >