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

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 229 of file TrigTSerializer.cxx.

230  declareInterface<ITrigSerializerToolBase>( this );
231  declareProperty("OnlineMode", m_onlineMode=false, "avoid initializations not needed in the online");
232 
233  for (size_t i=0; i<4; i++) m_guid[i]=0;
234 }

◆ ~TrigTSerializer()

TrigTSerializer::~TrigTSerializer ( )
virtual

Definition at line 236 of file TrigTSerializer.cxx.

236  {
237  if (m_streamersList){
238  delete m_streamersList;
239  m_streamersList = nullptr;
240  }
241 }

Member Function Documentation

◆ add_previous_streamerinfos()

void TrigTSerializer::add_previous_streamerinfos ( )
private

Definition at line 297 of file TrigTSerializer.cxx.

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

◆ bsDictWarningFilter()

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

Definition at line 280 of file TrigTSerializer.cxx.

282 {
283  if( level == kWarning and gDebug == 0 ) {
284  if( strstr(msg, "no dictionary for class") ) {
285  for( std::string &type : s_dictsToIgnore ) {
286  if( strstr(msg, type.c_str()) ) {
287  return false;
288  }
289  }
290  }
291  }
292  DefaultErrorHandler(level,abort_bool, location, msg);
293  return false;
294 }

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

◆ 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 469 of file TrigTSerializer.cxx.

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

◆ 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 656 of file TrigTSerializer.cxx.

656  {
657 
658  ATH_MSG_VERBOSE("Entering do_follow_ptr for " << name << " at " << ptr );
659 
660 
661  if (ptr){
662  const std::string classname = name.substr(0, name.find_last_of('*'));
663  ATH_MSG_DEBUG( "going deeper for " << classname << " at " << ptr );
664  do_persistify(classname, ptr);
665  }
666 
667 }

◆ do_persistify()

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

Definition at line 652 of file TrigTSerializer.cxx.

◆ do_persistify_obj()

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

Definition at line 653 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 264 of file TrigTSerializer.cxx.

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

◆ 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 600 of file TrigTSerializer.cxx.

600  {
601 
602  TClass *pclass = gROOT->GetClass(nameOfClass.c_str());
603 
604 
605  StatusCode sc(StatusCode::FAILURE);
606 
607  if (pclass)
608  sc = StatusCode::SUCCESS;
609 
610 
611  return sc;
612 
613 }

◆ initialize()

StatusCode TrigTSerializer::initialize ( )

Definition at line 243 of file TrigTSerializer.cxx.

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

◆ 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 621 of file TrigTSerializer.cxx.

621  {
622  if (v.size()>2){
623  if (v.at(0)==TRIGTSERHEADER){
624  const uint32_t rVersion = v.at(1);
625  if (rVersion>4){
626  guid[0] = v.at(3);
627  guid[1] = v.at(4);
628  guid[2] = v.at(5);
629  guid[3] = v.at(6);
630  return StatusCode::SUCCESS;
631  }
632  }
633  }
634  return StatusCode::FAILURE;
635 }

◆ prepareForTBuffer()

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

Definition at line 344 of file TrigTSerializer.cxx.

344  {
346  //MN: this setting does not play well with ROOTDEBUG:
347  // gErrorIgnoreLevel = kInfo+1;
348  //had this class a problem before?
349  if (m_errCount.find(nameOfClass)!=m_errCount.end()){
351  }
352  s_decodingError = false;
353 }

◆ 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 617 of file TrigTSerializer.cxx.

617  {
618  m_guid[0] = m_guid[1] = m_guid[2] = m_guid[3] = 0;
619 }

◆ restoreAfterTBuffer()

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

Definition at line 355 of file TrigTSerializer.cxx.

355  {
356  if (s_decodingError){
357  s_decodingError = false;
358 
359 
360  if (m_errCount.find(nameOfClass)!=m_errCount.end()){
361  ++m_errCount[nameOfClass];
362  } else {
363  ATH_MSG_ERROR( "Errors while decoding " << nameOfClass
364  << " any further ROOT messages for this class will be suppressed" );
365  m_errCount[nameOfClass] = 1;
366  }
367  }
368 
370 }

◆ 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 372 of file TrigTSerializer.cxx.

372  {
373  std::vector<uint32_t> serialized;
374  serialize(nameOfClass, instance, serialized);
375  return serialized;
376 }

◆ 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 378 of file TrigTSerializer.cxx.

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

◆ 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 637 of file TrigTSerializer.cxx.

637  {
638  for (size_t i=0; i<4; i++)
639  m_guid[i] = guid[i];
640 }

◆ streamerErrorHandler()

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

Definition at line 328 of file TrigTSerializer.cxx.

329  {
330  if( level > kInfo ) {
331  //MN: ignore stuff below kWarning
332  s_decodingError = true;
333  }
334  int oldLvl = gErrorIgnoreLevel;
335  if( gDebug > 0 ) {
336  gErrorIgnoreLevel = kPrint;
337  }
338  ::DefaultErrorHandler(level,abort_bool, location, msg);
339  gErrorIgnoreLevel = oldLvl;
340 
341  return false;
342 }

◆ 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
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
Definition: PathResolver.cxx:251
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
TrigTSerializer::add_previous_streamerinfos
void add_previous_streamerinfos()
Definition: TrigTSerializer.cxx:297
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
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:280
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
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:27
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
TRIGTSERHEADER
#define TRIGTSERHEADER
Definition: TrigTSerializer.cxx:37
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
nextinfo
TIter nextinfo(a)
TrigTSerializer::do_persistify
void do_persistify(const std::string &nameOfClass, void *instance)
Definition: TrigTSerializer.cxx:652
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
hist_file_dump.f
f
Definition: hist_file_dump.py:135
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:355
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:221
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:328
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:372
gErrorIgnoreLevel
int gErrorIgnoreLevel
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
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
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:623
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
TrigTSerializerUnimplError
void TrigTSerializerUnimplError()
Definition: TrigTSerializer.cxx:645
TrigTSerializer::prepareForTBuffer
void prepareForTBuffer(const std::string &nameOfClass)
Definition: TrigTSerializer.cxx:344
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:26
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