ATLAS Offline Software
Loading...
Searching...
No Matches
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
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}
LArHitContainer_p2 LArHitContainer_PERS
size_type size() const
Hit collection.
LArHitFloatContainer * createTransient()
LArHitContainer_PERS * createPersistent(LArHitFloatContainer *transCont)
LArHitFloatContainer * copyLArHitToFloat(const LArHitContainer *double_cont)
Container for LArHitFloat.
Class to store hit energy and time in LAr cell from G4 simulation.
Definition LArHitFloat.h:18
Class to store hit energy and time in LAr cell from G4 simulation.
Definition LArHit.h:25
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.