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

#include <TauJetContainer_p1_old_cnv.h>

Inheritance diagram for TauJetContainer_p1_old_cnv:
Collaboration diagram for TauJetContainer_p1_old_cnv:

Public Member Functions

virtual void Convert (TauJetContainer_p1 *newobj, const TauJetContainer_p1_old *oldobj)
 Do the conversion. More...
 
virtual void ConvertVoid (void *transobj, const void *persobj)
 Do the conversion. More...
 
TClass * GetTransClass ()
 Return the transient class, to which we're converting. More...
 
TClass * GetPersClass ()
 Return the persistent class, from which we're converting. More...
 
int GetCheckSum () const
 Return the checksum of the class from which we're converting. More...
 
virtual void * NewPersObj ()
 Create a new instance of the persistent class. More...
 
virtual void DeletePersObj (void *persobj)
 Destroy an instance of the persistent class. More...
 
virtual void ReadBuffer (TBuffer &b, void *obj, Version_t version, UInt_t R__S, UInt_t R__c)
 Read object in non-split mode. More...
 

Static Public Member Functions

static TClass * ToClass (const std::string &name)
 Helper to convert a class name to a Root class pointer. More...
 
static TClass * ToClass (const std::type_info &id)
 Helper to convert a type_info to a Root class pointer. More...
 

Protected Member Functions

void SetCtorInfo (UInt_t checksum, TClass *trans_cls, TClass *pers_cls)
 Set the parameters that would normally be passed to the constructor. More...
 

Protected Attributes

void * fPersObj
 The temporary persistent object instance, used for conversions (in non-split mode). More...
 

Private Member Functions

void CheckStreamInfos ()
 Helper to allow for automatic schema evolution for persistent classes. More...
 
void CheckClasses ()
 Helper to check that the classes have been defined properly. More...
 

Private Attributes

TClass * fTransClass
 The declared transient class. More...
 
TClass * fPersClass
 The declared persistent class. More...
 
UInt_t fCheckSum
 The declared checksum. More...
 
int fOldLast
 Used by CheckStreamInfos: the length of the streamerinfo list that we saw on the last CheckStreamInfos call. More...
 

Detailed Description

Definition at line 16 of file TauJetContainer_p1_old_cnv.h.

Member Function Documentation

◆ CheckClasses()

void TVirtualConverter::CheckClasses ( )
privateinherited

Helper to check that the classes have been defined properly.

Check that the class pointers got defined.

Definition at line 189 of file TVirtualConverter.cxx.

190 {
191  if (fTransClass == 0) {
192  if (fPersClass == 0)
193  Error ("TVirtualConverter",
194  "Both transient and persistent classes are null.");
195  else
196  Error ("TVirtualConverter",
197  "Transient class is null for persistent class `%s'",
198  fPersClass->GetName());
199  }
200  else if (fPersClass == 0)
201  Error ("TVirtualConverter",
202  "Persistent class is null for transient class `%s'",
203  fTransClass->GetName());
204 }

◆ CheckStreamInfos()

void TVirtualConverter::CheckStreamInfos ( )
privateinherited

Helper to allow for automatic schema evolution for persistent classes.

Automatic schema evolution doesn't work for persistent classes ‘out-of-the-box’ because we're reading the ‘persistent class’, but the relevant StreamerInfo stored in the file will have the name of the ‘transient class’.

This gets called each time we try to read an object (in non-split mode).

Definition at line 369 of file TVirtualConverter.cxx.

370 {
371  // First check to see if the list of TStreamerInfo's for the transient
372  // class has changed since the last time we were called. If not,
373  // then don't do anything.
374  const TObjArray* trans_sis = fTransClass->GetStreamerInfos();
375  if (trans_sis->GetLast() != fOldLast) {
376  // There was a change. Compare the TStreamerInfo list for the
377  // persistent class and the transient class. Look for entries
378  // where the transient class has a TStreamerInfo but the persistent
379  // class does not.
380  //
381  // Note: don't do this for `version' -1.
382  // That should always be built from the internal dictionary.
383  // (Otherwise, root can crash.)
384  const TObjArray* pers_sis = fPersClass->GetStreamerInfos();
385  assert (trans_sis->LowerBound() == pers_sis->LowerBound());
386  for (Int_t v = trans_sis->LowerBound(); v <= trans_sis->GetLast(); ++v) {
387  if (v != -1 &&
388  trans_sis->At(v) != 0 &&
389  (v > pers_sis->GetLast() || pers_sis->At(v) == 0))
390  {
391  // Ok, at this index, the transient class has a TStreamerInfo
392  // but the persistent class does not. Copy the TStreamerInfo
393  // (changing the class that it applies to to the persistent
394  // class), and add it to the persistent class's list.
395  TStreamerInfo* new_si =(TStreamerInfo*)(trans_sis->At(v)->Clone());
396  new_si->SetClass (fPersClass);
397  fPersClass->RegisterStreamerInfo (new_si);
398  }
399  }
400 
401  // Remember how many entries there were in the list for next time.
402  fOldLast = trans_sis->GetLast();
403  }
404 }

◆ Convert()

void TauJetContainer_p1_old_cnv::Convert ( TauJetContainer_p1 transobj,
const TauJetContainer_p1_old persobj 
)
virtual

Do the conversion.

Parameters
transobjPointer to an instance of the transient class.
persobjPointer to an instance of the persistent class.

An implementation of this must be provided in derived classes. It should initialize the object at transobj from the one at persobj.

Implements TVirtualConverter_T< TauJetContainer_p1, TauJetContainer_p1_old >.

Definition at line 8 of file TauJetContainer_p1_old_cnv.cxx.

10 {
11  newobj->clear();
12  size_t n = oldobj->m_momenta.size();
13  newobj->resize (n);
14  for (size_t i = 0; i < n; i++)
15  {
16  TauJet_p1& tau = (*newobj)[i];
17  tau.m_momentum = oldobj->m_momenta[i];
18  tau.m_particleBase = oldobj->m_particles[i];
19  tau.m_cluster = oldobj->m_clusters[i];
20  tau.m_tracks = oldobj->m_tracks[i];
21  //tau.m_cellCluster = XXX;
22  //tau.m_tauDetails = xxx;
23 
24  tau.m_flags |= 1;
25  tau.m_vetoFlags = 0;
26 
27  typedef std::pair<int, double> ppair;
28  const std::vector<double>& pold = oldobj->m_parameters[i];
29  std::vector<ppair>& pnew = tau.m_params;
30  if (oldobj->m_authors[i] == TauJetParameters::tauRec) {
31  tau.m_flags |= 0x04;
32  pnew.push_back(ppair(TauJetParameters::etHadCalib, pold[ 0]));
33  pnew.push_back(ppair(TauJetParameters::etEMCalib, pold[ 1]));
34  pnew.push_back(ppair(TauJetParameters::emRadius, pold[ 2]));
35  pnew.push_back(ppair(TauJetParameters::isolationFraction, pold[ 3]));
36  pnew.push_back(ppair(TauJetParameters::centralityFraction, pold[ 4]));
37  pnew.push_back(ppair(TauJetParameters::stripWidth2, pold[ 5]));
38  pnew.push_back(ppair(TauJetParameters::nStripCells, pold[ 6]));
39  pnew.push_back(ppair(TauJetParameters::logLikelihoodRatio, pold[ 7]));
40  pnew.push_back(ppair(TauJetParameters::lowPtTauJetDiscriminant,pold[8]));
41  pnew.push_back(ppair(TauJetParameters::lowPtTauEleDiscriminant,pold[9]));
42  pnew.push_back(ppair(TauJetParameters::tauJetNeuralnetwork, pold[10]));
43  pnew.push_back(ppair(TauJetParameters::tauENeuralNetwork, pold[11]));
44 
45  }
46  else if (oldobj->m_authors[i] == TauJetParameters::tau1P3P) {
47  tau.m_flags |= 0x08;
48  const std::vector<double>& pold = oldobj->m_parameters[i];
49  pnew.push_back(ppair(TauJetParameters::etHadCalib, pold[ 0] ));
50  pnew.push_back(ppair(TauJetParameters::etEMCalib, pold[ 1] ));
51  pnew.push_back(ppair(TauJetParameters::emRadius, pold[ 2] ));
52  pnew.push_back(ppair(TauJetParameters::isolationFraction, pold[ 3] ));
53  pnew.push_back(ppair(TauJetParameters::centralityFraction, pold[ 4] ));
54  pnew.push_back(ppair(TauJetParameters::stripWidth2, pold[ 5] ));
55  pnew.push_back(ppair(TauJetParameters::nStripCells, pold[ 6] ));
56  pnew.push_back(ppair(TauJetParameters::logLikelihoodRatio, pold[ 7] ));
57  pnew.push_back(ppair(TauJetParameters::annularIsolationFraction,pold[8]));
58  pnew.push_back(ppair(TauJetParameters::etCaloAtEMScale, pold[ 9] ));
59  pnew.push_back(ppair(TauJetParameters::etChargedHadCells, pold[10] ));
60  pnew.push_back(ppair(TauJetParameters::etOtherEMCells, pold[11] ));
61  pnew.push_back(ppair(TauJetParameters::etOtherHadCells, pold[12] ));
62  pnew.push_back(ppair(TauJetParameters::discriminant, pold[13] ));
63  }
64  }
65 }

◆ ConvertVoid()

virtual void TVirtualConverter_T< TauJetContainer_p1 , TauJetContainer_p1_old >::ConvertVoid ( void *  transobj,
const void *  persobj 
)
virtualinherited

Do the conversion.

Parameters
transobjPointer to an instance of the transient class.
persobjPointer to an instance of the persistent class.

This implementation simply calls the Convert below with the appropriate casting.

Implements TVirtualConverter.

◆ DeletePersObj()

void TVirtualConverter::DeletePersObj ( void *  persobj)
virtualinherited

Destroy an instance of the persistent class.

Parameters
persobjPointer to the instance to destroy.

The provided implementation of this uses TClass::Destructor, but you can override it if need be.

Definition at line 264 of file TVirtualConverter.cxx.

265 {
266  return fPersClass->Destructor (persobj);
267 }

◆ GetCheckSum()

int TVirtualConverter::GetCheckSum ( ) const
inherited

Return the checksum of the class from which we're converting.

Definition at line 239 of file TVirtualConverter.cxx.

240 {
241  return fCheckSum;
242 }

◆ GetPersClass()

TClass * TVirtualConverter::GetPersClass ( )
inherited

Return the persistent class, from which we're converting.

Definition at line 230 of file TVirtualConverter.cxx.

231 {
232  return fPersClass;
233 }

◆ GetTransClass()

TClass * TVirtualConverter::GetTransClass ( )
inherited

Return the transient class, to which we're converting.

Definition at line 221 of file TVirtualConverter.cxx.

222 {
223  return fTransClass;
224 }

◆ NewPersObj()

void * TVirtualConverter::NewPersObj ( )
virtualinherited

Create a new instance of the persistent class.

The provided implementation of this uses TClass::New, but you can override it if need be.

Definition at line 251 of file TVirtualConverter.cxx.

252 {
253  return fPersClass->New();
254 }

◆ ReadBuffer()

void TVirtualConverter::ReadBuffer ( TBuffer &  b,
void *  obj,
Version_t  version,
UInt_t  R__s,
UInt_t  R__c 
)
virtualinherited

Read object in non-split mode.

Parameters
bThe source of the data.
objThe object into which we're reading. (This will be the transient object.)
versionThe version number of the class.
R__sThe starting position in the buffer.
R__cThe number of bytes for this object in the buffer.

You normally shouldn't have to worry about this, but it's exposed here so that it can be overridden if needed. It's only used when reading in non-split mode.

Definition at line 283 of file TVirtualConverter.cxx.

288 {
289  // Make sure that we've done automatic schema evolution on the
290  // persistent side.
292 
293  // Make an instance of the persistent class, if we haven't done so already.
294  if (fPersObj == 0)
295  fPersObj = NewPersObj();
296 
297  // Read in the object, as an instance of the persistent class.
298  fPersClass->ReadBuffer (b, fPersObj, version, R__s, R__c);
299 
300  // Convert to the transient representation.
302 }

◆ SetCtorInfo()

void TVirtualConverter::SetCtorInfo ( UInt_t  checksum,
TClass *  trans_cls,
TClass *  pers_cls 
)
protectedinherited

Set the parameters that would normally be passed to the constructor.

Parameters
checksumThe Root checksum of the persistent class we'll convert.
trans_clsThe transient class to which we will be converting.
pers_clsThe persistent class from which we will be converting.

Intended for use with T_AthenaRootConverter only!

Definition at line 431 of file TVirtualConverter.cxx.

434 {
435  assert (fTransClass == 0);
436 
437  fCheckSum = checksum;
438  fTransClass = trans_cls;
439  fPersClass = pers_cls;
440  CheckClasses();
441 }

◆ ToClass() [1/2]

TClass * TVirtualConverter::ToClass ( const std::string &  name)
staticinherited

Helper to convert a class name to a Root class pointer.

Parameters
nameThe name of the class to convert.

Returns 0 on failure.

Definition at line 311 of file TVirtualConverter.cxx.

312 {
313  return gROOT->GetClass (name.c_str());
314 }

◆ ToClass() [2/2]

TClass * TVirtualConverter::ToClass ( const std::type_info &  id)
staticinherited

Helper to convert a type_info to a Root class pointer.

Parameters
nameThe type_info of the class to convert.

Returns 0 on failure.

Definition at line 323 of file TVirtualConverter.cxx.

324 {
325  TClass* cl = gROOT->GetClass (id);
326  if (cl) return cl;
327 
328  // This may fail if the dictionary hasn't been loaded yet,
329  // since we can auto-load only on the name.
330  // Make some attempt to get a name from the type_info.
331  const char* name = id.name();
332  cl = gROOT->GetClass (name);
333  if (cl) return cl;
334 
335  const char* n2 = name;
336  while (isdigit(*n2))
337  ++n2;
338  cl = gROOT->GetClass (n2);
339  if (cl) return cl;
340 
341  int errorCode = 0;
342  char* demname = nullptr;
343  {
344  // Protect against data race inside TClassEdit.
345  // https://github.com/root-project/root/issues/10353
346  // Should be fixed in root 6.26.02.
347  R__WRITE_LOCKGUARD(ROOT::gCoreMutex);
348  demname = TClassEdit::DemangleTypeIdName (id, errorCode);
349  }
350  if (demname) {
351  cl = gROOT->GetClass (demname);
352  free (demname);
353  }
354  return cl;
355 }

Member Data Documentation

◆ fCheckSum

UInt_t TVirtualConverter::fCheckSum
privateinherited

The declared checksum.

Definition at line 261 of file TVirtualConverter.h.

◆ fOldLast

int TVirtualConverter::fOldLast
privateinherited

Used by CheckStreamInfos: the length of the streamerinfo list that we saw on the last CheckStreamInfos call.

Definition at line 265 of file TVirtualConverter.h.

◆ fPersClass

TClass* TVirtualConverter::fPersClass
privateinherited

The declared persistent class.

Definition at line 258 of file TVirtualConverter.h.

◆ fPersObj

void* TVirtualConverter::fPersObj
protectedinherited

The temporary persistent object instance, used for conversions (in non-split mode).

Definition at line 271 of file TVirtualConverter.h.

◆ fTransClass

TClass* TVirtualConverter::fTransClass
privateinherited

The declared transient class.

Definition at line 255 of file TVirtualConverter.h.


The documentation for this class was generated from the following files:
TauJetParameters::lowPtTauEleDiscriminant
@ lowPtTauEleDiscriminant
Definition: TauJetParameters.h:157
TauJetParameters::tau1P3P
@ tau1P3P
Definition: TauJetParameters.h:36
TVirtualConverter::fOldLast
int fOldLast
Used by CheckStreamInfos: the length of the streamerinfo list that we saw on the last CheckStreamInfo...
Definition: TVirtualConverter.h:265
TauJetParameters::etOtherEMCells
@ etOtherEMCells
Definition: TauJetParameters.h:164
TauJet_p1::m_particleBase
ParticleBase_p1 m_particleBase
Definition: TauJet_p1.h:38
TauJetParameters::etEMCalib
@ etEMCalib
Definition: TauJetParameters.h:148
TauJetParameters::annularIsolationFraction
@ annularIsolationFraction
Definition: TauJetParameters.h:161
TauJetParameters::lowPtTauJetDiscriminant
@ lowPtTauJetDiscriminant
Definition: TauJetParameters.h:156
TauJetParameters::etCaloAtEMScale
@ etCaloAtEMScale
Definition: TauJetParameters.h:162
TauJet_p1::m_cluster
ElementLinkInt_p1 m_cluster
Definition: TauJet_p1.h:39
TVirtualConverter::fCheckSum
UInt_t fCheckSum
The declared checksum.
Definition: TVirtualConverter.h:261
TauJetParameters::centralityFraction
@ centralityFraction
Definition: TauJetParameters.h:151
TauJetParameters::isolationFraction
@ isolationFraction
Definition: TauJetParameters.h:150
TVirtualConverter::fTransClass
TClass * fTransClass
The declared transient class.
Definition: TVirtualConverter.h:255
TVirtualConverter::fPersObj
void * fPersObj
The temporary persistent object instance, used for conversions (in non-split mode).
Definition: TVirtualConverter.h:271
TauJetParameters::tauRec
@ tauRec
Definition: TauJetParameters.h:35
TVirtualConverter::CheckClasses
void CheckClasses()
Helper to check that the classes have been defined properly.
Definition: TVirtualConverter.cxx:189
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
TauJet_p1::m_momentum
P4EEtaPhiM_p1 m_momentum
Definition: TauJet_p1.h:37
TauJet_p1::m_flags
unsigned char m_flags
Definition: TauJet_p1.h:44
TVirtualConverter::CheckStreamInfos
void CheckStreamInfos()
Helper to allow for automatic schema evolution for persistent classes.
Definition: TVirtualConverter.cxx:369
TauJet_p1
Definition: TauJet_p1.h:24
TauJetParameters::etHadCalib
@ etHadCalib
Definition: TauJetParameters.h:147
TVirtualConverter::fPersClass
TClass * fPersClass
The declared persistent class.
Definition: TVirtualConverter.h:258
TauJetParameters::emRadius
@ emRadius
Definition: TauJetParameters.h:149
TauJetParameters::stripWidth2
@ stripWidth2
Definition: TauJetParameters.h:152
TauJetParameters::tauENeuralNetwork
@ tauENeuralNetwork
Definition: TauJetParameters.h:159
TauJetParameters::discriminant
@ discriminant
Definition: TauJetParameters.h:166
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
TauJet_p1::m_vetoFlags
unsigned long m_vetoFlags
Definition: TauJet_p1.h:48
python.PyAthena.v
v
Definition: PyAthena.py:154
get_generator_info.version
version
Definition: get_generator_info.py:33
TauJetParameters::tauJetNeuralnetwork
@ tauJetNeuralnetwork
Definition: TauJetParameters.h:158
TVirtualConverter::NewPersObj
virtual void * NewPersObj()
Create a new instance of the persistent class.
Definition: TVirtualConverter.cxx:251
TauJetParameters::etChargedHadCells
@ etChargedHadCells
Definition: TauJetParameters.h:163
L1Topo::Error
Error
The different types of error that can be flagged in the L1TopoRDO.
Definition: Error.h:16
TauJetParameters::nStripCells
@ nStripCells
Definition: TauJetParameters.h:153
TauJetParameters::etOtherHadCells
@ etOtherHadCells
Definition: TauJetParameters.h:165
python.PyAthena.obj
obj
Definition: PyAthena.py:132
TVirtualConverter::ConvertVoid
virtual void ConvertVoid(void *transobj, const void *persobj)=0
Do the conversion.
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
TauJet_p1::m_params
std ::vector< std ::pair< int, double > > m_params
Definition: TauJet_p1.h:51
TauJet_p1::m_tracks
ElementLinkIntVector_p1 m_tracks
Definition: TauJet_p1.h:42
TauJetParameters::logLikelihoodRatio
@ logLikelihoodRatio
Definition: TauJetParameters.h:155