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

#include <TrigTSerializer.h>

Inheritance diagram for TrigTSerializer:
Collaboration diagram for TrigTSerializer:

Public Member Functions

 TrigTSerializer (const std::string &name, const std::string &type, const IInterface *parent)
 
virtual ~TrigTSerializer ()
 
StatusCode initialize ()
 
StatusCode finalize ()
 
std::vector< uint32_t > serialize (const std::string &nameOfClass, const void *instance)
 serializes an object of a class nameOfClass pointed to by instance and recursively also other objects which object may point to More...
 
void serialize (const std::string &nameOfClass, const void *instance, std::vector< uint32_t > &v)
 serializes an object of a class nameOfClass pointed to by instance and recursively also other objects which object may point to More...
 
void * deserialize (const std::string &nameOfClass, const std::vector< uint32_t > &v)
 deserializes an object of a class nameOfClass (and recursively other objects) found in std::vector<uint32_t>& v More...
 
StatusCode initClass (const std::string &nameOfClass) const
 initialize framework to be ready to serialize a given class method to be called to prevent delayed initializations on the first event More...
 
void reset ()
 clean internal serializer state. More...
 
StatusCode peekCLID (const std::vector< uint32_t > &v, uint32_t *guid) const
 access clid of the payload (stored in BS) More...
 
void setCLID (const uint32_t *guid)
 access clid of the payload virtual CLID getCLID() const = 0; More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

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

void do_persistify (const std::string &nameOfClass, void *instance)
 
void do_persistify_obj (const std::string &nameOfClass, void *instance)
 
void do_follow_ptr (const std::string &nameOfClass, void *instance)
 
void add_previous_streamerinfos ()
 
void prepareForTBuffer (const std::string &nameOfClass)
 
void restoreAfterTBuffer (const std::string &nameOfClass)
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Static Private Member Functions

static bool streamerErrorHandler (Int_t level, Bool_t abort_bool, const char *location, const char *msg)
 
static bool bsDictWarningFilter (Int_t level, Bool_t abort_bool, const char *location, const char *msg)
 

Private Attributes

bool m_onlineMode
 
uint32_t m_guid [4]
 
uint32_t m_IgnoreErrLvl {}
 
std::map< std::string, uint32_t > m_errCount
 
StringArrayProperty m_ignoreMissingDicts
 IgnoreMissingDicts. More...
 
TList * m_streamersList
 Remember streamer info list for cleaning up later. 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
 

Static Private Attributes

static bool s_decodingError = false
 
static std::vector< std::string > s_dictsToIgnore
 static copy of the IgnoreMissingDicts property for the static error handler More...
 

Detailed Description

Author
Jiri Masik Jiri..nosp@m.Masi.nosp@m.k@cer.nosp@m.n.ch

Definition at line 37 of file TrigTSerializer.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

◆ TrigTSerializer()

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

Definition at line 235 of file TrigTSerializer.cxx.

236  declareInterface<ITrigSerializerToolBase>( this );
237  declareProperty("OnlineMode", m_onlineMode=false, "avoid initializations not needed in the online");
238 
239  for (size_t i=0; i<4; i++) m_guid[i]=0;
240 }

◆ ~TrigTSerializer()

TrigTSerializer::~TrigTSerializer ( )
virtual

Definition at line 242 of file TrigTSerializer.cxx.

242  {
243  if (m_streamersList){
244  delete m_streamersList;
245  m_streamersList = nullptr;
246  }
247 }

Member Function Documentation

◆ add_previous_streamerinfos()

void TrigTSerializer::add_previous_streamerinfos ( )
private

Definition at line 303 of file TrigTSerializer.cxx.

304 {
306  //temporary
307  std::string extStreamerInfos = "bs-streamerinfos.root";
308  std::string extFile = PathResolver::find_file (extStreamerInfos, "DATAPATH");
309  ATH_MSG_DEBUG( "Using " << extFile );
310  TFile f(extFile.c_str());
311  m_streamersList = f.GetStreamerInfoList();
312  TIter nextinfo(m_streamersList);
313  while (TObject* obj = nextinfo()) {
314  TStreamerInfo *inf = dynamic_cast<TStreamerInfo*> (obj);
315  if (!inf) continue;
316  TString t_name=inf->GetName();
317 
318  if (t_name.BeginsWith("listOfRules")){
319  ATH_MSG_WARNING( "Could not re-load class " << t_name );
320  continue;
321  }
322 
323  inf->BuildCheck();
324  //this triggers a crash on lcg60
325  TClass *cl = inf->GetClass();
326  if (cl)
327  ATH_MSG_DEBUG( "external TStreamerInfo for " << cl->GetName()
328  << " checksum: " << inf->GetCheckSum() );
329  }
330  f.Close();
331 }

◆ bsDictWarningFilter()

bool TrigTSerializer::bsDictWarningFilter ( Int_t  level,
Bool_t  abort_bool,
const char *  location,
const char *  msg 
)
staticprivate

Definition at line 286 of file TrigTSerializer.cxx.

288 {
289  if( level == kWarning and gDebug == 0 ) {
290  if( strstr(msg, "no dictionary for class") ) {
291  for( std::string &type : s_dictsToIgnore ) {
292  if( strstr(msg, type.c_str()) ) {
293  return false;
294  }
295  }
296  }
297  }
298  DefaultErrorHandler(level,abort_bool, location, msg);
299  return false;
300 }

◆ declareGaudiProperty() [1/4]

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

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

Definition at line 170 of file AthCommonDataStore.h.

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

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

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

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

Definition at line 184 of file AthCommonDataStore.h.

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

◆ declareGaudiProperty() [4/4]

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

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

Definition at line 199 of file AthCommonDataStore.h.

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

◆ declareProperty() [1/6]

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

Declare a new Gaudi property.

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

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

Definition at line 245 of file AthCommonDataStore.h.

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

◆ declareProperty() [2/6]

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

Declare a new Gaudi property.

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

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

Definition at line 221 of file AthCommonDataStore.h.

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

◆ declareProperty() [3/6]

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

Definition at line 259 of file AthCommonDataStore.h.

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

◆ declareProperty() [4/6]

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

Declare a new Gaudi property.

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

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

Definition at line 333 of file AthCommonDataStore.h.

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

◆ declareProperty() [5/6]

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

Declare a new Gaudi property.

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

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

Definition at line 352 of file AthCommonDataStore.h.

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

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ deserialize()

void * TrigTSerializer::deserialize ( const std::string &  nameOfClass,
const std::vector< uint32_t > &  v 
)
virtual

deserializes an object of a class nameOfClass (and recursively other objects) found in std::vector<uint32_t>& v

Returns
pointer to a deserialized object

Implements ITrigSerializer.

Definition at line 477 of file TrigTSerializer.cxx.

477  {
478 
479  size_t rootDebug = gDebug;
480  if (msgLvl(MSG::DEBUG)){
481  ATH_MSG_DEBUG( "in deserialize for " << nameOfClass );
482  /*
483  //cannot be used in production
484  //higher gDebug seems to interfere with ErrorHandler
485  if (m_outputlevel<=MSG::VERBOSE &&rootDebug<5)
486  gDebug=5;
487  */
488  }
489 
490  const size_t vsize = v.size();
491  uint32_t rVersion(0);
492  size_t bufsiz(0);
493  bool newFormatOK=true;
494  bool decodeOldFormat=true;
495  size_t pBuffOffset(3); //adjust below
496  //
497  //
498 
499  if (vsize>2){
500  if (v.at(0)==TRIGTSERHEADER){
501  rVersion = v.at(1);
502  bufsiz = v.at(2);
503  if (rVersion>3)
504  pBuffOffset++;
505  if (rVersion>4)
506  pBuffOffset += 3; //wrt ver 4
507 
508  //check size with vsize
509  size_t expectsize = pBuffOffset + bufsiz/4 + bufsiz%4;
510 
511  if (expectsize!=vsize){
512  newFormatOK = false;
513  ATH_MSG_WARNING( "expected payload length "<<expectsize
514  << " does not match the container size " << vsize
515  << " for " << nameOfClass << " fallback to the old format:" );
516  }
517  ATH_MSG_DEBUG( bufsiz << "bytes of payload version " << std::hex << rVersion << std::dec
518  << " for " << nameOfClass );
519  }
520  else {
521  ATH_MSG_WARNING( "not a versioned payload of "
522  << nameOfClass << " trying initial TrigTSerializer" );
523  newFormatOK = false;
524  }
525 
526  } else {
527  ATH_MSG_WARNING( "zero bytes of payload for " << nameOfClass );
528  gDebug=rootDebug;
529  return NULL;
530  }
531 
532  //
533  char *pbuf = NULL;
534 
535  if (newFormatOK){
536  union {
537  uint32_t uint;
538  char pp[4];
539  } pbytes;
540 
541  // const size_t bufsiz = v.size();
542  pbuf = new char[bufsiz];
543  size_t bufpos=0;
544  const size_t nints = bufsiz/4;
545  for (size_t i=pBuffOffset; i<nints+pBuffOffset; i++){
546  pbytes.uint = v.at(i);
547  for (size_t c=0; c<4; c++){
548  pbuf[bufpos] = pbytes.pp[3-c];
549  bufpos++;
550  }
551  }
552 
553  for (size_t i=nints+pBuffOffset; i<vsize; i++){
554  pbuf[bufpos] = (char)v.at(i);
555  bufpos++;
556  }
557 
558  if (msgLvl(MSG::VERBOSE)){
559  msg(MSG::VERBOSE) << "deserialized dump: ";
560  for (size_t i=0; i<v.size(); i++){
561  msg(MSG::VERBOSE) << std::hex << v.at(i) <<std::dec << " ";
562  }
563  msg(MSG::VERBOSE) << endmsg;
564  }
565 
566  } else if (!newFormatOK && decodeOldFormat){
567  bufsiz = v.size();
568  pbuf = new char[bufsiz];
569 
570  for (size_t i=0; i<bufsiz; i++)
571  pbuf[i] = v.at(i);
572  } else {
573  gDebug=rootDebug;
574  return NULL;
575  }
576 
577  /*
578  if (newFormatOK && rVersion >3)
579  setCLID(v.at(3));
580  */
581 
582  //common part
583  TBufferFile *buff = new TBufferFile(TBuffer::kRead, bufsiz, pbuf, kTRUE);
584 
585  std::string noc= TrigSerializeResult::remapToDictName(nameOfClass);
586  TClass *pclass = gROOT->GetClass(noc.c_str());
587 
588  TObject *pobj = NULL;
589  if (pclass){
590  prepareForTBuffer(noc);
591  {
593  //pobj = (TObject *)(buff->ReadObjectAny(pclass));
594  pobj = (TObject *)(ROOT8367Workaround::TBufferFileWorkaround::doReadObjectAny (buff, pclass));
595  }
596  restoreAfterTBuffer(noc);
597  //ErrorHandlerFunc_t oldhandler= ::SetErrorHandler(streamerErrorHandler);
598  //SetErrorHandler(oldhandler);
599  //buff->StreamObject(instance, pclass);
600  }
601  else {
602  ATH_MSG_ERROR( "gROOT->GetClass failed for" << nameOfClass );
603  }
604 
605  delete buff; //this also deletes pbuf owned by buff
606  gDebug=rootDebug;
607 
608  return (void *)pobj;
609 }

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

◆ do_follow_ptr()

void TrigTSerializer::do_follow_ptr ( const std::string &  nameOfClass,
void *  instance 
)
private

Definition at line 668 of file TrigTSerializer.cxx.

668  {
669 
670  ATH_MSG_VERBOSE("Entering do_follow_ptr for " << name << " at " << ptr );
671 
672 
673  if (ptr){
674  const std::string classname = name.substr(0, name.find_last_of('*'));
675  ATH_MSG_DEBUG( "going deeper for " << classname << " at " << ptr );
676  do_persistify(classname, ptr);
677  }
678 
679 }

◆ do_persistify()

void TrigTSerializer::do_persistify ( const std::string &  nameOfClass,
void *  instance 
)
private

Definition at line 664 of file TrigTSerializer.cxx.

◆ do_persistify_obj()

void TrigTSerializer::do_persistify_obj ( const std::string &  nameOfClass,
void *  instance 
)
private

Definition at line 665 of file TrigTSerializer.cxx.

◆ 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

◆ finalize()

StatusCode TrigTSerializer::finalize ( )

Definition at line 270 of file TrigTSerializer.cxx.

270  {
271 
272  std::map<std::string,uint32_t>::const_iterator mitr(m_errCount.begin());
273  std::map<std::string,uint32_t>::const_iterator mend(m_errCount.end());
274  bool reported(false);
275  while (mitr!=mend){
276  reported=true;
277  ATH_MSG_WARNING( "Could not interpret persistent object " << (*mitr).first
278  << " /" << (*mitr).second << " times." );
279  ++mitr;
280  }
281  if (!reported)
282  ATH_MSG_INFO( name() << " no problems encountered" );
283  return StatusCode::SUCCESS;
284 }

◆ initClass()

StatusCode TrigTSerializer::initClass ( const std::string &  nameOfClass) const
virtual

initialize framework to be ready to serialize a given class method to be called to prevent delayed initializations on the first event

Returns
StatusCode

Implements ITrigSerializer.

Definition at line 612 of file TrigTSerializer.cxx.

612  {
613 
614  TClass *pclass = gROOT->GetClass(nameOfClass.c_str());
615 
616 
617  StatusCode sc(StatusCode::FAILURE);
618 
619  if (pclass)
620  sc = StatusCode::SUCCESS;
621 
622 
623  return sc;
624 
625 }

◆ initialize()

StatusCode TrigTSerializer::initialize ( )

Definition at line 249 of file TrigTSerializer.cxx.

249  {
250  ATH_MSG_DEBUG( "TrigTSerializer::initialize " << name() );
251 
252  // copy missing dictionary names from the property to the static member
254  std::string msg;
255  for( const auto& n:s_dictsToIgnore ) {
256  if( not msg.empty() ) msg += ", ";
257  msg += n;
258  }
259  ATH_MSG_DEBUG( "Suppressing missing dictionary warnings for: " << msg );
260 
261  if (!m_onlineMode)
263 
265 
266  return StatusCode::SUCCESS;
267 
268 }

◆ 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& ITrigSerializerToolBase::interfaceID ( )
inlinestaticinherited

Definition at line 92 of file ITrigSerializerToolBase.h.

92 { return IID_ITrigSerializerToolBase; }

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

◆ peekCLID()

StatusCode TrigTSerializer::peekCLID ( const std::vector< uint32_t > &  v,
uint32_t *  guid 
) const
virtual

access clid of the payload (stored in BS)

Implements ITrigSerializer.

Definition at line 633 of file TrigTSerializer.cxx.

633  {
634  if (v.size()>2){
635  if (v.at(0)==TRIGTSERHEADER){
636  const uint32_t rVersion = v.at(1);
637  if (rVersion>4){
638  guid[0] = v.at(3);
639  guid[1] = v.at(4);
640  guid[2] = v.at(5);
641  guid[3] = v.at(6);
642  return StatusCode::SUCCESS;
643  }
644  }
645  }
646  return StatusCode::FAILURE;
647 }

◆ prepareForTBuffer()

void TrigTSerializer::prepareForTBuffer ( const std::string &  nameOfClass)
private

Definition at line 350 of file TrigTSerializer.cxx.

350  {
352  //MN: this setting does not play well with ROOTDEBUG:
353  // gErrorIgnoreLevel = kInfo+1;
354  //had this class a problem before?
355  if (m_errCount.find(nameOfClass)!=m_errCount.end()){
357  }
358  s_decodingError = false;
359 }

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

◆ reset()

void TrigTSerializer::reset ( )
virtual

clean internal serializer state.

To be used between (de)serialization of unrelated data (for example of a new event)

Implements ITrigSerializer.

Definition at line 629 of file TrigTSerializer.cxx.

629  {
630  m_guid[0] = m_guid[1] = m_guid[2] = m_guid[3] = 0;
631 }

◆ restoreAfterTBuffer()

void TrigTSerializer::restoreAfterTBuffer ( const std::string &  nameOfClass)
private

Definition at line 361 of file TrigTSerializer.cxx.

361  {
362  if (s_decodingError){
363  s_decodingError = false;
364 
365 
366  if (m_errCount.find(nameOfClass)!=m_errCount.end()){
367  ++m_errCount[nameOfClass];
368  } else {
369  ATH_MSG_ERROR( "Errors while decoding " << nameOfClass
370  << " any further ROOT messages for this class will be suppressed" );
371  m_errCount[nameOfClass] = 1;
372  }
373  }
374 
376 }

◆ serialize() [1/2]

std::vector< uint32_t > TrigTSerializer::serialize ( const std::string &  nameOfClass,
const void *  instance 
)
virtual

serializes an object of a class nameOfClass pointed to by instance and recursively also other objects which object may point to

Returns
std::vector<uint32_t>

Implements ITrigSerializer.

Definition at line 378 of file TrigTSerializer.cxx.

378  {
379  std::vector<uint32_t> serialized;
380  serialize(nameOfClass, instance, serialized);
381  return serialized;
382 }

◆ serialize() [2/2]

void TrigTSerializer::serialize ( const std::string &  nameOfClass,
const void *  instance,
std::vector< uint32_t > &  v 
)
virtual

serializes an object of a class nameOfClass pointed to by instance and recursively also other objects which object may point to

Returns
std::vector<uint32_t>

Implements ITrigSerializer.

Definition at line 384 of file TrigTSerializer.cxx.

384  {
385 
386  serialized.clear();
387 
388  size_t rootDebug = gDebug;
389 
390  if (msgLvl(MSG::DEBUG)){
391  ATH_MSG_DEBUG( "in serialize for " << nameOfClass );
392  /*
393  //cannot be used in production
394  //higher gDebug seems to interfere with ErrorHandler
395  if (m_outputlevel<=MSG::VERBOSE && rootDebug<5)
396  gDebug=5;
397  */
398  }
399 
400  std::string noc= TrigSerializeResult::remapToDictName(nameOfClass);
401  TClass *pclass = gROOT->GetClass(noc.c_str());
402 
403  // do_persistify(noc, instance);
404 
405  TBufferFile *buff = new TBufferFile(TBuffer::kWrite);
406 
407  //std::vector<uint32_t> serialized;
408 
409  if (pclass){
410  //buff->StreamObject(instance, pclass);
411 
412  ATH_MSG_DEBUG( "writing instance " << instance << " to buffer for noc " << noc );
413 
414  prepareForTBuffer(noc);
415  {
417  buff->WriteObjectAny(instance, pclass);
418  }
419  restoreAfterTBuffer(noc);
420 
421  ATH_MSG_DEBUG( "wrote buffer of length " << buff->Length() );
422 
423 
424  const char *pbuff = buff->Buffer();
425  const size_t bufsiz = buff->Length();
426 
427  serialized.push_back(TRIGTSERHEADER);
428  serialized.push_back(TRIGTSERVERSION);
429  serialized.push_back(bufsiz);
430  serialized.push_back(m_guid[0]);
431  serialized.push_back(m_guid[1]);
432  serialized.push_back(m_guid[2]);
433  serialized.push_back(m_guid[3]);
434 
435  //inefficient - to be compatible with Serializer for the moment can be avoided later
436  union {
437  uint32_t uint;
438  char pp[4];
439  } pbytes;
440 
441  for (size_t i=0; i<bufsiz/4; i++){
442  pbytes.uint = 0;
443  for (size_t j=0; j<4; j++){
444  pbytes.pp[3-j] = pbuff[4*i+j];
445  }
446  // ATH_MSG_DEBUG( "packed " << std::hex << pbytes << std::dec );
447 
448  serialized.push_back(pbytes.uint);
449  }
450 
451  //send rest of chars as one int each
452  const size_t modb = bufsiz%4;
453  for (size_t i=0; i<modb; i++){
454  pbytes.uint = 0;
455  pbytes.pp[0] = pbuff[bufsiz-modb+i];
456  serialized.push_back(pbytes.uint);
457  }
458 
459  if (msgLvl(MSG::VERBOSE)){
460  msg(MSG::VERBOSE) << "serialized dump: ";
461  for (size_t i=0; i<serialized.size(); i++){
462  msg(MSG::VERBOSE) << std::hex << serialized.at(i) <<std::dec << " ";
463  }
464  msg(MSG::VERBOSE) << endmsg;
465  }
466  }
467  else {
468  ATH_MSG_ERROR( "gROOT->GetClass failed for" << nameOfClass );
469  }
470 
471  delete buff;
472  gDebug=rootDebug;
473 
474  // return serialized;
475 }

◆ setCLID()

void TrigTSerializer::setCLID ( const uint32_t *  guid)
virtual

access clid of the payload virtual CLID getCLID() const = 0;

set clid of the persistent class to be stored in data

Implements ITrigSerializer.

Definition at line 649 of file TrigTSerializer.cxx.

649  {
650  for (size_t i=0; i<4; i++)
651  m_guid[i] = guid[i];
652 }

◆ streamerErrorHandler()

bool TrigTSerializer::streamerErrorHandler ( Int_t  level,
Bool_t  abort_bool,
const char *  location,
const char *  msg 
)
staticprivate

Definition at line 334 of file TrigTSerializer.cxx.

335  {
336  if( level > kInfo ) {
337  //MN: ignore stuff below kWarning
338  s_decodingError = true;
339  }
340  int oldLvl = gErrorIgnoreLevel;
341  if( gDebug > 0 ) {
342  gErrorIgnoreLevel = kPrint;
343  }
344  ::DefaultErrorHandler(level,abort_bool, location, msg);
345  gErrorIgnoreLevel = oldLvl;
346 
347  return false;
348 }

◆ 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_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_errCount

std::map<std::string, uint32_t> TrigTSerializer::m_errCount
private

Definition at line 81 of file TrigTSerializer.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_guid

uint32_t TrigTSerializer::m_guid[4]
private

Definition at line 76 of file TrigTSerializer.h.

◆ m_IgnoreErrLvl

uint32_t TrigTSerializer::m_IgnoreErrLvl {}
private

Definition at line 80 of file TrigTSerializer.h.

◆ m_ignoreMissingDicts

StringArrayProperty TrigTSerializer::m_ignoreMissingDicts
private
Initial value:
{
this, "IgnoreMissingDicts", {},
"Suppress warining about missing dictionaries", "OrderedSet<std::string>" }

IgnoreMissingDicts.

Definition at line 84 of file TrigTSerializer.h.

◆ m_onlineMode

bool TrigTSerializer::m_onlineMode
private

Definition at line 75 of file TrigTSerializer.h.

◆ m_streamersList

TList* TrigTSerializer::m_streamersList
private

Remember streamer info list for cleaning up later.

Definition at line 91 of file TrigTSerializer.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.

◆ s_decodingError

bool TrigTSerializer::s_decodingError = false
staticprivate

Definition at line 79 of file TrigTSerializer.h.

◆ s_dictsToIgnore

std::vector< std::string > TrigTSerializer::s_dictsToIgnore
staticprivate
Initial value:
= {
"CosmicMuonCollection_tlp1", "MdtTrackSegmentCollection_tlp1",
"CosmicMuonCollection_p1", "CosmicMuon_p1", "MdtTrackSegmentCollection_p1",
"MdtTrackSegment_p1", "MdtTrackSegmentCollection_p2", "PanTauDetails_p1",
"SG::IAuxStoreCompression"
}

static copy of the IgnoreMissingDicts property for the static error handler

Definition at line 88 of file TrigTSerializer.h.


The documentation for this class was generated from the following files:
get_hdefs.buff
buff
Definition: get_hdefs.py:61
TrigTSerializer::m_streamersList
TList * m_streamersList
Remember streamer info list for cleaning up later.
Definition: TrigTSerializer.h:91
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TrigTSerializer::m_errCount
std::map< std::string, uint32_t > m_errCount
Definition: TrigTSerializer.h:81
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TrigTSerializer::add_previous_streamerinfos
void add_previous_streamerinfos()
Definition: TrigTSerializer.cxx:303
covarianceToolsLibrary.gErrorIgnoreLevel
gErrorIgnoreLevel
Definition: covarianceToolsLibrary.py:21
TrigTSerializer::m_ignoreMissingDicts
StringArrayProperty m_ignoreMissingDicts
IgnoreMissingDicts.
Definition: TrigTSerializer.h:84
xAOD::char
char
Definition: TrigDecision_v1.cxx:38
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
TrigTSerializer::m_guid
uint32_t m_guid[4]
Definition: TrigTSerializer.h:76
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
TrigTSerializer::s_dictsToIgnore
static std::vector< std::string > s_dictsToIgnore
static copy of the IgnoreMissingDicts property for the static error handler
Definition: TrigTSerializer.h:88
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
inf
TStreamerInfo * inf
Definition: liststreamerinfos.cxx:12
TrigTSerializer::bsDictWarningFilter
static bool bsDictWarningFilter(Int_t level, Bool_t abort_bool, const char *location, const char *msg)
Definition: TrigTSerializer.cxx:286
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:92
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
TrigTSerializer::s_decodingError
static bool s_decodingError
Definition: TrigTSerializer.h:79
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
TRIGTSERHEADER
#define TRIGTSERHEADER
Definition: TrigTSerializer.cxx:37
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
nextinfo
TIter nextinfo(a)
TrigTSerializer::do_persistify
void do_persistify(const std::string &nameOfClass, void *instance)
Definition: TrigTSerializer.cxx:664
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:729
Analysis::kError
@ kError
Definition: CalibrationDataVariables.h:60
TrigTSerializer::m_IgnoreErrLvl
uint32_t m_IgnoreErrLvl
Definition: TrigTSerializer.h:80
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
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
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
test_pyathena.parent
parent
Definition: test_pyathena.py:15
hist_file_dump.f
f
Definition: hist_file_dump.py:140
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
TrigTSerializer::restoreAfterTBuffer
void restoreAfterTBuffer(const std::string &nameOfClass)
Definition: TrigTSerializer.cxx:361
TrigSerializeResult::remapToDictName
std::string remapToDictName(const std::string &s)
Definition: SerializeCommon.cxx:31
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
pool_uuid.guid
guid
Definition: pool_uuid.py:112
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
python.hypoToolDisplay.toolname
def toolname(tool)
Definition: hypoToolDisplay.py:13
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
TRIGTSERVERSION
#define TRIGTSERVERSION
Definition: TrigTSerializer.cxx:39
RootUtils::WithRootErrorHandler
Run a MT piece of code with an alternate root error handler.
Definition: WithRootErrorHandler.h:56
TrigTSerializer::streamerErrorHandler
static bool streamerErrorHandler(Int_t level, Bool_t abort_bool, const char *location, const char *msg)
Definition: TrigTSerializer.cxx:334
TrigTSerializer::m_onlineMode
bool m_onlineMode
Definition: TrigTSerializer.h:75
TrigTSerializer::serialize
std::vector< uint32_t > serialize(const std::string &nameOfClass, const void *instance)
serializes an object of a class nameOfClass pointed to by instance and recursively also other objects...
Definition: TrigTSerializer.cxx:378
python.PyAthena.v
v
Definition: PyAthena.py:154
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
Definition: PathResolver.cxx:183
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:629
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:13
TrigTSerializerUnimplError
void TrigTSerializerUnimplError()
Definition: TrigTSerializer.cxx:657
TrigTSerializer::prepareForTBuffer
void prepareForTBuffer(const std::string &nameOfClass)
Definition: TrigTSerializer.cxx:350
python.PyAthena.obj
obj
Definition: PyAthena.py:132
python.compressB64.c
def c
Definition: compressB64.py:93
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:25
fitman.k
k
Definition: fitman.py:528