BOSS 7.0.9
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 ()
 
- 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.
 
virtual StatusCode DataObjectToTObject (DataObject *dat, RootAddress *addr)=0
 Do the concrete conversion from TDS to ROOT.
 
virtual StatusCode TObjectToDataObject (DataObject *&dat)=0
 Do the concrete conversion from ROOT to TDS.
 
TObject * getReadObject () const
 get the object to be read
 
- Public Member Functions inherited from Converter< Ty1, Ty2 >
destinationoperator (const source &) const
 

Static Public Member Functions

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

Protected Member Functions

 HltInfCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
 
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
 
- Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< HltInfCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
 
typedef Ty2 destination
 
- Protected Attributes inherited from RootEventBaseCnv
RootCnvSvcm_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 HltInfCnv.h.

Constructor & Destructor Documentation

◆ ~HltInfCnv()

virtual HltInfCnv::~HltInfCnv ( )
inlinevirtual

Definition at line 30 of file HltInfCnv.h.

30{ };

◆ HltInfCnv()

HltInfCnv::HltInfCnv ( ISvcLocator *  svc)
protected

Definition at line 23 of file HltInfCnv.cxx.

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

Member Function Documentation

◆ classID()

static const CLID & HltInfCnv::classID ( )
inlinestatic

Definition at line 25 of file HltInfCnv.h.

26 {
27 return CLID_HltInf;
28 }
const CLID & CLID_HltInf
Definition: EventModel.cxx:286

◆ DataObjectToTObject()

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 135 of file HltInfCnv.cxx.

135 {
136
137 MsgStream log(msgSvc(), "HltInfCnv");
138 log << MSG::DEBUG << "HltInfCnv::DataObjectToTObject" << endreq;
139 StatusCode sc=StatusCode::SUCCESS;
140
141 HltInf * hltInfCnvTds=dynamic_cast<HltInf*> (obj);
142 if (!hltInfCnvTds) {
143 log << MSG::ERROR << "Could not downcast to HltInf" << endreq;
144 return StatusCode::FAILURE;
145 }
146
147 DataObject *evt;
148 m_eds->findObject(EventModel::Hlt::Event,evt);
149 if (evt==NULL) {
150 log << MSG::ERROR << "Could not get HltInf in TDS " << endreq;
151 return StatusCode::FAILURE;
152 }
153
154 HltEvent * devtTds=dynamic_cast<HltEvent *> (evt);
155 if (!devtTds) {
156 log << MSG::ERROR << "HltInfCnv:Could not downcast to TDS HltInf" << endreq;
157 }
158
159 IOpaqueAddress *addr;
160 m_cnvSvc->getHltCnv()->createRep(evt,addr);
161
163
164 const TObject *tHltInf = hltInf->getHltInf();
165 if (!tHltInf) return sc;
166 hltInf->clearHltInf();
167
168 Int_t type = hltInfCnvTds->getEventType();
169 Int_t alg = hltInfCnvTds->getAlgProcess();
170 Int_t cri = hltInfCnvTds->getCriteriaTable();
171 Int_t ver = hltInfCnvTds->getVersion();
172 Double_t etot = hltInfCnvTds->getTotalEnergy();
173 Int_t nsub = hltInfCnvTds->getNumber();
174 Int_t ncon = hltInfCnvTds->getNCON();
175
176 THltInf *hltInfRoot = new THltInf();
177
178 hltInfRoot->setEventType(type);
179 hltInfRoot->setAlgProcess(alg);
180 hltInfRoot->setCriteriaTable(cri);
181 hltInfRoot->setVersion(ver);
182 hltInfRoot->setTotalEnergy(etot);
183 hltInfRoot->setNumber(nsub);
184 hltInfRoot->setNCON(ncon);
185
186
187 std::vector<uint32_t> mdcTds=hltInfCnvTds->getDataVec(HltID::MDC);
188 std::vector<Int_t> mdcRoot;
189 std::vector<uint32_t>::iterator it= mdcTds.begin();
190 for(;it!=mdcTds.end();it++){
191 Int_t data=*it;
192 mdcRoot.push_back(data);
193 }
194 hltInfRoot->setMdcData(mdcRoot);
195
196 std::vector<uint32_t> tofTds=hltInfCnvTds->getDataVec(HltID::TOF);
197 std::vector<Int_t> tofRoot;
198 for(it= tofTds.begin();it!=tofTds.end();it++){
199 Int_t data=*it;
200 tofRoot.push_back(data);
201 }
202 hltInfRoot->setTofData(tofRoot);
203
204 std::vector<uint32_t> emcTds=hltInfCnvTds->getDataVec(HltID::EMC);
205 std::vector<Int_t> emcRoot;
206 for(it= emcTds.begin();it!=emcTds.end();it++){
207 Int_t data=*it;
208 emcRoot.push_back(data);
209 }
210 hltInfRoot->setEmcData(emcRoot);
211
212 std::vector<uint32_t> mucTds=hltInfCnvTds->getDataVec(HltID::MUC);
213 std::vector<Int_t> mucRoot;
214 for(it= mucTds.begin();it!=mucTds.end();it++){
215 Int_t data=*it;
216 mucRoot.push_back(data);
217 }
218 hltInfRoot->setMucData(mucRoot);
219
220 std::vector<uint32_t> conTds=hltInfCnvTds->getDataVec(HltID::CON);
221 std::vector<Int_t> conRoot;
222 for(it= conTds.begin();it!=conTds.end();it++){
223 Int_t data=*it;
224 conRoot.push_back(data);
225 }
226 hltInfRoot->setConData(conRoot);
227
228 hltInf->addHltInf(hltInfRoot);
229
230 return StatusCode::SUCCESS;
231}
TTree * data
Double_t etot
#define NULL
float getTotalEnergy() const
Definition: DstHltInf.h:46
uint32_t getCriteriaTable() const
Definition: DstHltInf.h:44
uint32_t getNCON() const
Definition: DstHltInf.h:52
uint32_t getVersion() const
Definition: DstHltInf.h:45
uint32_t getNumber() const
Definition: DstHltInf.h:47
uint32_t getEventType() const
Definition: DstHltInf.h:42
uint32_t getAlgProcess() const
Definition: DstHltInf.h:43
static THltEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition: HltCnv.h:35
@ EMC
Definition: HltID.h:21
@ MUC
Definition: HltID.h:21
@ TOF
Definition: HltID.h:21
@ MDC
Definition: HltID.h:21
@ CON
Definition: HltID.h:21
Definition: HltInf.h:16
std::vector< uint32_t > & getDataVec(const Identifier &)
Definition: HltInf.cxx:67
HltCnv * getHltCnv()
Definition: RootCnvSvc.h:158
RootCnvSvc * m_cnvSvc
IDataProviderSvc * m_eds
pointer to eventdataservice
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void addHltInf(THltInf *hltInf)
Definition: THltEvent.cxx:76
const THltInf * getHltInf() const
Definition: THltEvent.cxx:79
void clearHltInf()
Definition: THltEvent.h:36
Definition: THltInf.h:9
void setTotalEnergy(const Double_t etot)
Definition: THltInf.h:20
void setVersion(const Int_t i)
Definition: THltInf.h:19
void setNCON(const Int_t i)
Definition: THltInf.h:22
void setNumber(const Int_t i)
Definition: THltInf.h:21
void setEventType(const Int_t i)
Definition: THltInf.h:16
void setCriteriaTable(const Int_t i)
Definition: THltInf.h:18
void setAlgProcess(const Int_t i)
Definition: THltInf.h:17
void setMucData(const vector< Int_t > &vec)
Definition: THltInf.h:26
void setMdcData(const vector< Int_t > &vec)
Definition: THltInf.h:23
void setTofData(const vector< Int_t > &vec)
Definition: THltInf.h:24
void setEmcData(const vector< Int_t > &vec)
Definition: THltInf.h:25
void setConData(const vector< Int_t > &vec)
Definition: THltInf.h:27
_EXTERN_ std::string Event
Definition: EventModel.h:72

◆ TObjectToDataObject()

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 36 of file HltInfCnv.cxx.

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

Friends And Related Function Documentation

◆ CnvFactory< HltInfCnv >

friend class CnvFactory< HltInfCnv >
friend

Definition at line 10 of file HltInfCnv.h.


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