BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
HltInfCnv Class Reference

Concrete converter for the HltInf. More...

#include <HltInfCnv.h>

Inheritance diagram for HltInfCnv:

Public Member Functions

virtual ~HltInfCnv ()
 HltInfCnv (ISvcLocator *svc)
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
virtual ~HltInfCnv ()
 HltInfCnv (ISvcLocator *svc)
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
virtual ~HltInfCnv ()
 HltInfCnv (ISvcLocator *svc)
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
Public Member Functions inherited from RootEventBaseCnv
 RootEventBaseCnv (const CLID &clid, ISvcLocator *svc)
virtual ~RootEventBaseCnv ()
virtual long repSvcType () const
virtual StatusCode initialize ()
virtual StatusCode finalize ()
void declareObject (const std::string &fullPath, const CLID &clid, const std::string &treename, const std::string &branchname)
 Store TDS path to link a particular converter to an object on the TDS.
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&dat)
 Convert the persistent object to transient.
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Convert the transient object to the requested representation.
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
TObject * getReadObject () const
 get the object to be read
 RootEventBaseCnv (const CLID &clid, ISvcLocator *svc)
virtual ~RootEventBaseCnv ()
virtual long repSvcType () const
virtual StatusCode initialize ()
virtual StatusCode finalize ()
void declareObject (const std::string &fullPath, const CLID &clid, const std::string &treename, const std::string &branchname)
 Store TDS path to link a particular converter to an object on the TDS.
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&dat)
 Convert the persistent object to transient.
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Convert the transient object to the requested representation.
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
TObject * getReadObject () const
 get the object to be read
 RootEventBaseCnv (const CLID &clid, ISvcLocator *svc)
virtual ~RootEventBaseCnv ()
virtual long repSvcType () const
virtual StatusCode initialize ()
virtual StatusCode finalize ()
void declareObject (const std::string &fullPath, const CLID &clid, const std::string &treename, const std::string &branchname)
 Store TDS path to link a particular converter to an object on the TDS.
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&dat)
 Convert the persistent object to transient.
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Convert the transient object to the requested representation.
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
TObject * getReadObject () const
 get the object to be read
Public Member Functions inherited from Converter< Ty1, Ty2 >
destinationoperator (const source &) const
destinationoperator (const source &) const
destinationoperator (const source &) const

Static Public Member Functions

static const CLID & classID ()
static const CLID & classID ()
static const CLID & classID ()
Static Public Member Functions inherited from RootEventBaseCnv
static const unsigned char storageType ()
 Storage type and class ID.
static const unsigned char storageType ()
 Storage type and class ID.
static const unsigned char storageType ()
 Storage type and class ID.

Friends

class CnvFactory< HltInfCnv >

Additional Inherited Members

Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
typedef Ty2 destination
typedef Ty1 source
typedef Ty2 destination
typedef Ty1 source
typedef Ty2 destination
Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
virtual destinationconvert (const source &) const =0
virtual destinationconvert (const source &) const =0
Protected Attributes inherited from RootEventBaseCnv
IRootCnvSvcm_cnvSvc
std::vector< RootCnvSvc::Leafm_leaves
RootInterfacem_rootInterface
 pointer to the RootInterface
IDataProviderSvc * m_eds
 pointer to eventdataservice
int m_branchNr
 the branchNr of this converter for writing
int m_branchNrDst
int m_branchNrMc
int m_branchNrRecon
int m_branchNrEvtRec
int m_branchNrEvtHeader
int m_branchNrEvtNavigator
TObject * m_objRead
 the object that was read
CLID CLID_top
 the CLID of the upper converter if any
TArrayS * m_branchNumbers
 array with number of branches for reading
std::string m_rootBranchname
 root branchname (may be concatenated of severals)
std::string m_rootTreename
 each converter knows it's treename
std::string m_currentFileName
std::vector< void * > m_adresses
 each converter knows the corresponding adresses
RootEvtSelectorm_evtsel

Detailed Description

Concrete converter for the HltInf.

Definition at line 20 of file Event/RootCnvSvc/include/RootCnvSvc/Hlt/HltInfCnv.h.

Constructor & Destructor Documentation

◆ ~HltInfCnv() [1/3]

virtual HltInfCnv::~HltInfCnv ( )
inlinevirtual

Definition at line 27 of file Event/RootCnvSvc/include/RootCnvSvc/Hlt/HltInfCnv.h.

27{};

◆ HltInfCnv() [1/3]

HltInfCnv::HltInfCnv ( ISvcLocator * svc)

Definition at line 22 of file HltInfCnv.cxx.

22 : RootEventBaseCnv( classID(), svc ), m_old( false ) {
23 // Here we associate this converter with the /Event path on the TDS.
24 MsgStream log( msgSvc(), "HltInfCnv" );
25 // log << MSG::DEBUG << "Constructor called for " << objType() << endmsg;
26 m_rootBranchname = "m_hltInf";
27 // declareObject(EventModel::MC::HltInf, objType(), m_rootTreename, m_rootBranchname);
28 m_adresses.push_back( &m_hltInf );
29 m_hltInf = 0;
30}
IMessageSvc * msgSvc()
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)
RootEventBaseCnv(const CLID &clid, ISvcLocator *svc)

◆ ~HltInfCnv() [2/3]

virtual HltInfCnv::~HltInfCnv ( )
inlinevirtual

◆ HltInfCnv() [2/3]

HltInfCnv::HltInfCnv ( ISvcLocator * svc)

◆ ~HltInfCnv() [3/3]

virtual HltInfCnv::~HltInfCnv ( )
inlinevirtual

◆ HltInfCnv() [3/3]

HltInfCnv::HltInfCnv ( ISvcLocator * svc)

Member Function Documentation

◆ classID() [1/3]

const CLID & HltInfCnv::classID ( )
inlinestatic

Definition at line 25 of file Event/RootCnvSvc/include/RootCnvSvc/Hlt/HltInfCnv.h.

25{ return CLID_HltInf; }
const CLID & CLID_HltInf

Referenced by RootCnvSvc::createConverter(), and HltInfCnv().

◆ classID() [2/3]

const CLID & HltInfCnv::classID ( )
inlinestatic

◆ classID() [3/3]

const CLID & HltInfCnv::classID ( )
inlinestatic

◆ DataObjectToTObject() [1/3]

StatusCode HltInfCnv::DataObjectToTObject ( DataObject * obj,
RootAddress * addr )
virtual

transformation to root

Implements RootEventBaseCnv.

Definition at line 126 of file HltInfCnv.cxx.

126 {
127
128 MsgStream log( msgSvc(), "HltInfCnv" );
129 log << MSG::DEBUG << "HltInfCnv::DataObjectToTObject" << endmsg;
130 StatusCode sc = StatusCode::SUCCESS;
131
132 HltInf* hltInfCnvTds = dynamic_cast<HltInf*>( obj );
133 if ( !hltInfCnvTds )
134 {
135 log << MSG::ERROR << "Could not downcast to HltInf" << endmsg;
136 return StatusCode::FAILURE;
137 }
138
139 DataObject* evt;
140 m_eds->findObject( EventModel::Hlt::Event, evt );
141 if ( evt == NULL )
142 {
143 log << MSG::ERROR << "Could not get HltInf in TDS " << endmsg;
144 return StatusCode::FAILURE;
145 }
146
147 HltEvent* devtTds = dynamic_cast<HltEvent*>( evt );
148 if ( !devtTds )
149 { log << MSG::ERROR << "HltInfCnv:Could not downcast to TDS HltInf" << endmsg; }
150
151 IOpaqueAddress* addr;
152 m_cnvSvc->getHltCnv()->createRep( evt, addr );
153
154 THltEvent* hltInf = m_cnvSvc->getHltCnv()->getWriteObject();
155
156 const TObject* tHltInf = hltInf->getHltInf();
157 if ( !tHltInf ) return sc;
158 hltInf->clearHltInf();
159
160 Int_t type = hltInfCnvTds->getEventType();
161 Int_t alg = hltInfCnvTds->getAlgProcess();
162 Int_t cri = hltInfCnvTds->getCriteriaTable();
163 Int_t ver = hltInfCnvTds->getVersion();
164 Double_t etot = hltInfCnvTds->getTotalEnergy();
165 Int_t nsub = hltInfCnvTds->getNumber();
166 Int_t ncon = hltInfCnvTds->getNCON();
167
168 THltInf* hltInfRoot = new THltInf();
169
170 hltInfRoot->setEventType( type );
171 hltInfRoot->setAlgProcess( alg );
172 hltInfRoot->setCriteriaTable( cri );
173 hltInfRoot->setVersion( ver );
174 hltInfRoot->setTotalEnergy( etot );
175 hltInfRoot->setNumber( nsub );
176 hltInfRoot->setNCON( ncon );
177
178 std::vector<uint32_t> mdcTds = hltInfCnvTds->getDataVec( HltID::MDC );
179 std::vector<Int_t> mdcRoot;
180 std::vector<uint32_t>::iterator it = mdcTds.begin();
181 for ( ; it != mdcTds.end(); it++ )
182 {
183 Int_t data = *it;
184 mdcRoot.push_back( data );
185 }
186 hltInfRoot->setMdcData( mdcRoot );
187
188 std::vector<uint32_t> tofTds = hltInfCnvTds->getDataVec( HltID::TOF );
189 std::vector<Int_t> tofRoot;
190 for ( it = tofTds.begin(); it != tofTds.end(); it++ )
191 {
192 Int_t data = *it;
193 tofRoot.push_back( data );
194 }
195 hltInfRoot->setTofData( tofRoot );
196
197 std::vector<uint32_t> emcTds = hltInfCnvTds->getDataVec( HltID::EMC );
198 std::vector<Int_t> emcRoot;
199 for ( it = emcTds.begin(); it != emcTds.end(); it++ )
200 {
201 Int_t data = *it;
202 emcRoot.push_back( data );
203 }
204 hltInfRoot->setEmcData( emcRoot );
205
206 std::vector<uint32_t> mucTds = hltInfCnvTds->getDataVec( HltID::MUC );
207 std::vector<Int_t> mucRoot;
208 for ( it = mucTds.begin(); it != mucTds.end(); it++ )
209 {
210 Int_t data = *it;
211 mucRoot.push_back( data );
212 }
213 hltInfRoot->setMucData( mucRoot );
214
215 std::vector<uint32_t> conTds = hltInfCnvTds->getDataVec( HltID::CON );
216 std::vector<Int_t> conRoot;
217 for ( it = conTds.begin(); it != conTds.end(); it++ )
218 {
219 Int_t data = *it;
220 conRoot.push_back( data );
221 }
222 hltInfRoot->setConData( conRoot );
223
224 hltInf->addHltInf( hltInfRoot );
225
226 return StatusCode::SUCCESS;
227}
TTree * data
Double_t etot
std::vector< uint32_t > & getDataVec(const Identifier &)
Definition HltInf.cxx:79
IDataProviderSvc * m_eds
pointer to eventdataservice
void addHltInf(THltInf *hltInf)
Definition THltEvent.cxx:60
const THltInf * getHltInf() const
Definition THltEvent.cxx:61
void setMucData(const vector< Int_t > &vec)
void setMdcData(const vector< Int_t > &vec)
void setTofData(const vector< Int_t > &vec)
void setEmcData(const vector< Int_t > &vec)
void setConData(const vector< Int_t > &vec)

◆ DataObjectToTObject() [2/3]

virtual StatusCode HltInfCnv::DataObjectToTObject ( DataObject * obj,
RootAddress * addr )
virtual

transformation to root

Implements RootEventBaseCnv.

◆ DataObjectToTObject() [3/3]

virtual StatusCode HltInfCnv::DataObjectToTObject ( DataObject * obj,
RootAddress * addr )
virtual

transformation to root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [1/3]

StatusCode HltInfCnv::TObjectToDataObject ( DataObject *& obj)
virtual

transformation from root

Implements RootEventBaseCnv.

Definition at line 32 of file HltInfCnv.cxx.

32 {
33 // creation of TDS object from root object
34
35 MsgStream log( msgSvc(), "HltInfCnv" );
36 log << MSG::DEBUG << "HltInfCnv::TObjectToDataObject" << endmsg;
37 StatusCode sc = StatusCode::SUCCESS;
38
39 // create the TDS location for the trigger data
40 HltInf* hltInfTds = new HltInf;
41 refpObject = hltInfTds;
42
43 // now convert
44 if ( !m_hltInf ) return sc;
45
46 int evt = m_hltInf->getEventType();
47 int alg = m_hltInf->getAlgProcess();
48 int cri = m_hltInf->getCriteriaTable();
49 int ver = m_hltInf->getVersion();
50 float etot = m_hltInf->getTotalEnergy();
51 hltInfTds->setEventType( evt );
52 hltInfTds->setAlgProcess( alg );
53 hltInfTds->setCriteriaTable( cri );
54 hltInfTds->setVersion( ver );
55 hltInfTds->setTotalEnergy( etot );
56
57 try
58 {
59 uint32_t nsub = m_hltInf->getNumber();
60 uint32_t ncon = m_hltInf->getNCON();
61 uint32_t nmdc = nsub & 0XFF;
62 uint32_t ntof = ( nsub >> 8 ) & 0XFF;
63 uint32_t nemc = ( nsub >> 16 ) & 0XFF;
64 uint32_t nmuc = nsub >> 24;
65 if ( nmuc > HltID::getID_MUC_MAX() + 1 || nemc > HltID::getID_EMC_MAX() + 1 ||
66 ntof > HltID::getID_TOF_MAX() + 1 || nmdc > HltID::getID_MDC_MAX() + 1 )
67 { throw exception(); }
68 hltInfTds->setNumber( nsub );
69 hltInfTds->setNCON( ncon );
70
71 std::vector<Int_t> mdcRoot = m_hltInf->getMdcData();
72 if ( mdcRoot.size() != nmdc ) { throw exception(); }
73 std::vector<Int_t>::iterator it = mdcRoot.begin();
74 for ( ; it != mdcRoot.end(); it++ )
75 {
76 uint32_t data = *it;
77 hltInfTds->push_mdc( data );
78 }
79 std::vector<Int_t> tofRoot = m_hltInf->getTofData();
80 if ( tofRoot.size() != ntof ) { throw exception(); }
81 it = tofRoot.begin();
82 for ( ; it != tofRoot.end(); it++ )
83 {
84 uint32_t data = *it;
85 hltInfTds->push_tof( data );
86 }
87 std::vector<Int_t> emcRoot = m_hltInf->getEmcData();
88 if ( emcRoot.size() != nemc ) { throw exception(); }
89 it = emcRoot.begin();
90 for ( ; it != emcRoot.end(); it++ )
91 {
92 uint32_t data = *it;
93 hltInfTds->push_emc( data );
94 }
95 std::vector<Int_t> mucRoot = m_hltInf->getMucData();
96 if ( mucRoot.size() != nmuc ) { throw exception(); }
97 it = mucRoot.begin();
98 for ( ; it != mucRoot.end(); it++ )
99 {
100 uint32_t data = *it;
101 hltInfTds->push_muc( data );
102 }
103 std::vector<Int_t> conRoot = m_hltInf->getConData();
104 if ( conRoot.size() != ncon ) { throw exception(); }
105 it = conRoot.begin();
106 for ( ; it != conRoot.end(); it++ )
107 {
108 uint32_t data = *it;
109 hltInfTds->push_con( data );
110 }
111 } catch ( ... )
112 {
113 // log << MSG::ERROR << "***********************************************************" <<
114 // endmsg; log << MSG::ERROR << "Input ROOT object is older version, please reconstrut
115 // again" << endmsg; log << MSG::ERROR << " or check out old RootCnvSvc! (mailto:
116 // fucd@ihep.ac.cn)" << endmsg; log << MSG::WARNING << "***** Continuing run may cause a
117 // little memory leakage ****" << endmsg; m_old=true;
118 }
119
120 delete m_hltInf;
121 m_hltInf = 0;
122
123 return StatusCode::SUCCESS;
124}
void setAlgProcess(const unsigned int i)
void setCriteriaTable(const unsigned int i)
void setNumber(const unsigned int i)
void setNCON(const unsigned int i)
void setEventType(const unsigned int i)
void setTotalEnergy(const float etot)
void setVersion(const unsigned int i)
virtual void push_muc(uint32_t data)
virtual void push_mdc(uint32_t data)
virtual void push_tof(uint32_t data)
virtual void push_con(uint32_t data)
virtual void push_emc(uint32_t data)

◆ TObjectToDataObject() [2/3]

virtual StatusCode HltInfCnv::TObjectToDataObject ( DataObject *& obj)
virtual

transformation from root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [3/3]

virtual StatusCode HltInfCnv::TObjectToDataObject ( DataObject *& obj)
virtual

transformation from root

Implements RootEventBaseCnv.

◆ CnvFactory< HltInfCnv >

friend class CnvFactory< HltInfCnv >
friend

The documentation for this class was generated from the following files: