ATLAS Offline Software
LArHitFloatContainerCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 
11  MsgStream mlog(msgSvc(), "LArHitContainerConverter" );
13  LArHitContainer_PERS *persObj = converter.createPersistent( transCont, mlog );
14  return persObj;
15 }
16 
17 
19  MsgStream mlog(msgSvc(), "LArHitFloatContainerConverter" );
20  LArHitFloatContainerCnv_p1 converter_p1;
21  LArHitFloatContainerCnv_p2 converter_p2;
22 
23  LArHitFloatContainer *trans_cont(0);
24 
25  static const pool::Guid p2_guid("1F1DE705-E0CE-4F0E-941A-C405CB2CD137");
26  static const pool::Guid p1_guid("ED1ECB80-B38C-46DE-94BF-22F9379796DB");
27  static const pool::Guid p0_guid("32703AED-CAA5-45ED-B804-8556900CA6B5");
28 
29  if( this->compareClassGuid(p2_guid)) {
30  std::unique_ptr< LArHitContainer_p2 > col_vect( this->poolReadObject< LArHitContainer_p2 >() );
31  trans_cont = converter_p2.createTransient( col_vect.get(), mlog );
32  }
33  else if( this->compareClassGuid(p1_guid)) {
34  std::unique_ptr< LArHitContainer_p1 > col_vect( this->poolReadObject< LArHitContainer_p1 >() );
35  trans_cont = converter_p1.createTransient( col_vect.get(), mlog );
36  }
37  else if( this->compareClassGuid(p0_guid)) {
38  // old version from before TP separation not supported
39  std::unique_ptr<LArHitContainer> double_cont (this->poolReadObject<LArHitContainer>() );
40  trans_cont = this->copyLArHitToFloat(double_cont.get());
41  } else {
42  throw std::runtime_error("Unsupported persistent version of Data container");
43  }
44  return trans_cont;
45 }
46 
48 
49  LArHitFloatContainer* float_cont = new LArHitFloatContainer();
50  float_cont->clear();
51  float_cont->reserve(double_cont->size());
52 
53  for (const LArHit* double_hit : *double_cont) {
54  float energy = (float)(double_hit->energy());
55  float time = (float)(double_hit->time());
56  LArHitFloat float_hit(double_hit->cellID(),energy,time);
57  float_cont->push_back(float_hit);
58  }
59 
60  return float_cont;
61 
62 }
LArHitFloatContainerCnv.h
LArHitFloatContainerCnv::createTransient
LArHitFloatContainer * createTransient()
Definition: LArHitFloatContainerCnv.cxx:18
LArHitFloatContainer
Container for LArHitFloat.
Definition: LArHitFloatContainer.h:18
LArHitFloatContainerCnv_p1.h
LArHitFloat
Class to store hit energy and time in LAr cell from G4 simulation.
Definition: LArHitFloat.h:18
TPPolyCnvBase::createTransient
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
LArHitFloatContainerCnv::createPersistent
LArHitContainer_PERS * createPersistent(LArHitFloatContainer *transCont)
Definition: LArHitFloatContainerCnv.cxx:10
LArHitContainer
Hit collection.
Definition: LArHitContainer.h:26
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
LArHitFloatContainerCnv_p2.h
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
python.InDetPriVxFinderConfig.mlog
mlog
Definition: InDetPriVxFinderConfig.py:134
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
LArHit
Class to store hit energy and time in LAr cell from G4 simulation.
Definition: LArHit.h:25
LArHitFloatContainerCnv_p1
Definition: LArHitFloatContainerCnv_p1.h:15
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
LArHitContainer.h
LArHitContainer_p2
Persistent represenation of a LArHitContainer,.
Definition: LArHitContainer_p2.h:16
AthenaHitsVector::size
size_type size() const
Definition: AthenaHitsVector.h:151
T_AthenaPoolCustCnv< LArHitFloatContainer, LArHitContainer_PERS >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
LArHitFloatContainerCnv::copyLArHitToFloat
LArHitFloatContainer * copyLArHitToFloat(const LArHitContainer *double_cont)
Definition: LArHitFloatContainerCnv.cxx:47
readCCLHist.float
float
Definition: readCCLHist.py:83
LArHitFloatContainerCnv_p2
Definition: LArHitFloatContainerCnv_p2.h:17