BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcDedxCnv Class Reference

#include <MdcDedxCnv.h>

+ Inheritance diagram for MdcDedxCnv:

Public Member Functions

virtual ~MdcDedxCnv ()
 
virtual ~MdcDedxCnv ()
 
- 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
 
 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
 
destinationoperator (const source &) const
 

Static Public Member Functions

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.
 

Protected Member Functions

 MdcDedxCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
 
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
 
 MdcDedxCnv (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
 
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< MdcDedxCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
 
typedef Ty2 destination
 
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

Constructor & Destructor Documentation

◆ ~MdcDedxCnv() [1/2]

virtual MdcDedxCnv::~MdcDedxCnv ( )
inlinevirtual

◆ MdcDedxCnv() [1/2]

MdcDedxCnv::MdcDedxCnv ( ISvcLocator *  svc)
protected

Definition at line 26 of file MdcDedxCnv.cxx.

28{
29 // Here we associate this converter with the /Event path on the TDS.
30 MsgStream log(msgSvc(), "MdcDedxCnv");
31 //log << MSG::DEBUG << "Constructor called for " << objType() << endreq;
32 m_rootBranchname ="m_mdcDedxCol";
33 //declareObject(EventModel::Dst::DstDedxCol, objType(), m_rootTreename, m_rootBranchname);
34 m_adresses.push_back(&m_mdcDedxCol);
35 m_mdcDedxCol=0;
36}
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)

◆ ~MdcDedxCnv() [2/2]

virtual MdcDedxCnv::~MdcDedxCnv ( )
inlinevirtual

◆ MdcDedxCnv() [2/2]

MdcDedxCnv::MdcDedxCnv ( ISvcLocator *  svc)
protected

Member Function Documentation

◆ classID() [1/2]

static const CLID & MdcDedxCnv::classID ( )
inlinestatic

Definition at line 20 of file Event/RootCnvSvc/RootCnvSvc-02-01-13/RootCnvSvc/Dst/MdcDedxCnv.h.

21 {
22 return CLID_DstMdcDedxCol;
23 }
const CLID & CLID_DstMdcDedxCol
Definition: EventModel.cxx:259

◆ classID() [2/2]

static const CLID & MdcDedxCnv::classID ( )
inlinestatic

Definition at line 20 of file InstallArea/include/RootCnvSvc/RootCnvSvc/Dst/MdcDedxCnv.h.

21 {
22 return CLID_DstMdcDedxCol;
23 }

◆ DataObjectToTObject() [1/2]

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 126 of file MdcDedxCnv.cxx.

126 {
127
128 MsgStream log(msgSvc(), "MdcDedxCnv");
129 log << MSG::DEBUG << "MdcDedxCnv::DataObjectToTObject" << endreq;
130 StatusCode sc=StatusCode::SUCCESS;
131
132 DstMdcDedxCol * mdcDedxColTds=dynamic_cast<DstMdcDedxCol *> (obj);
133 if (!mdcDedxColTds) {
134 log << MSG::ERROR << "Could not downcast to MdcDedxCol" << endreq;
135 return StatusCode::FAILURE;
136 }
137
138 DataObject *evt;
139 m_eds->findObject(EventModel::Dst::Event,evt);
140 if (evt==NULL) {
141 log << MSG::ERROR << "Could not get DstEvent in TDS " << endreq;
142 return StatusCode::FAILURE;
143 }
144 DstEvent * devtTds=dynamic_cast<DstEvent *> (evt);
145 if (!devtTds) {
146 log << MSG::ERROR << "MdcDedxCnv:Could not downcast to TDS DstEvent" << endreq;
147 }
148 IOpaqueAddress *addr;
149
150 m_cnvSvc->getDstCnv()->createRep(evt,addr);
152
153 const TObjArray *m_mdcDedxCol = recEvt->getMdcDedxCol();
154 if (!m_mdcDedxCol) return sc;
155 recEvt->clearMdcDedxCol(); //necessary in case there is I/O at the same time since array is static
156 DstMdcDedxCol::const_iterator mdcDedxTds;
157
158 for (mdcDedxTds = mdcDedxColTds->begin(); mdcDedxTds != mdcDedxColTds->end(); mdcDedxTds++) {
159 Int_t trackId = (*mdcDedxTds)->trackId();
160 Int_t particleId = (*mdcDedxTds)->particleId();
161 Int_t status = (*mdcDedxTds)->status();
162 Int_t truncAlg =(*mdcDedxTds)->truncAlg();
163 /*
164 Double_t pb[5];
165 for (Int_t i = 0; i < 5; i++)
166 pb[i] = (*dedxTds)->prob(i);
167 */
168 Double_t chiE = (*mdcDedxTds)->chi(0);
169 Double_t chiMu = (*mdcDedxTds)->chi(1);
170 Double_t chiPi = (*mdcDedxTds)->chi(2);
171 Double_t chiK = (*mdcDedxTds)->chi(3);
172 Double_t chiP = (*mdcDedxTds)->chi(4);
173
174 Int_t numGoodHits = (*mdcDedxTds)->numGoodHits();
175 Int_t numTotalHits = (*mdcDedxTds)->numTotalHits();
176
177 Double_t probPH = (*mdcDedxTds)->probPH();
178 Double_t normPH = (*mdcDedxTds)->normPH();
179 Double_t errorPH = (*mdcDedxTds)->errorPH();
180 Double_t twentyPH =(*mdcDedxTds)->twentyPH();
181 //Double_t fracErrPH = (*dedxTds)-> fracErrPH();
182 //Double_t minIronPH = (*dedxTds)->minIronPH();
183 //Double_t corrPH = (*dedxTds)->corrPH();
184 log << MSG::INFO <<"check Reconstrunction root"<<" particle Id is : "<<particleId
185 <<"track id is : "<<trackId
186 <<" and status is : "<<status<<endreq;
187
188
189 TMdcDedx *mdcDedxRoot = new TMdcDedx();
190 //m_common.m_mdcDedxMap[(*mdcDedxTds)] = mdcDedxRoot;
191
192 mdcDedxRoot->setTrackId(trackId);
193 mdcDedxRoot->setParticleId(particleId);
194 mdcDedxRoot->setStatus (status);
195 mdcDedxRoot->setTruncAlg(truncAlg);
196 //dedxRoot->setProb(pb);
197 mdcDedxRoot->setChiE(chiE);
198 mdcDedxRoot->setChiMu(chiMu);
199 mdcDedxRoot->setChiPi(chiPi);
200 mdcDedxRoot->setChiK(chiK);
201 mdcDedxRoot->setChiP(chiP);
202
203 mdcDedxRoot->setNumGoodHits( numGoodHits);
204 mdcDedxRoot->setNumTotalHits( numTotalHits);
205
206 mdcDedxRoot->setProbPH(probPH);
207 mdcDedxRoot->setNormPH(normPH);
208 mdcDedxRoot->setErrorPH(errorPH);
209 mdcDedxRoot->setTwentyPH(twentyPH);
210 // dedxRoot->setFracErrPH(fracErrPH);
211 //dedxRoot->setMinIronPH(minIronPH);
212 //dedxRoot->setCorrPH(corrPH);
213 log << MSG::INFO << "check Reconstrunction root"<<" particle Id is : "<<particleId
214 <<"track id is : "<<trackId
215 <<" and status is : "<<status<<endreq;
216
217
218
219 recEvt->addMdcDedx(mdcDedxRoot);
220 }
221
222 return StatusCode::SUCCESS;
223}
ObjectVector< DstMdcDedx > DstMdcDedxCol
static TDstEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
IDataProviderSvc * m_eds
pointer to eventdataservice
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
const TObjArray * getMdcDedxCol() const
retrieve the whole TObjArray of Dedx Data
void addMdcDedx(TMdcDedx *Track)
Add a Dedx into the TOF Data collection.
Definition: TDstEvent.cxx:163

◆ DataObjectToTObject() [2/2]

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

transformation to root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [1/2]

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 38 of file MdcDedxCnv.cxx.

38 {
39 // creation of TDS object from root object
40
41 MsgStream log(msgSvc(), "MdcDedxCnv");
42 log << MSG::DEBUG << "MdcDedxCnv::TObjectToDataObject" << endreq;
43 StatusCode sc=StatusCode::SUCCESS;
44
45 // create the TDS location for the Dedx Collection
46 DstMdcDedxCol* mdcDedxTdsCol = new DstMdcDedxCol;
47 refpObject=mdcDedxTdsCol;
48
49
50 // now convert
51 if (!m_mdcDedxCol) return sc;
52 TIter mdcDedxIter(m_mdcDedxCol);
53 TMdcDedx *mdcDedxRoot = 0;
54 while ((mdcDedxRoot = (TMdcDedx*)mdcDedxIter.Next())) {
55
56 int trackId = mdcDedxRoot->trackId();
57 int particleId = mdcDedxRoot->particleId();
58 int status = mdcDedxRoot->status();
59 int truncAlg = mdcDedxRoot->truncAlg();
60 /*
61 double pb[5];
62 for ( int i = 0; i < 5; i++)
63 pb[i] = dedxRoot->prob(i);
64
65 double numSigmaE = dedxRoot->numSigmaE();
66 double numSigmaMu = dedxRoot->numSigmaMu();
67 double numSigmaPi = dedxRoot->numSigmaPi();
68 double numSigmaK = dedxRoot->numSigmaK();
69 double numSigmaP = dedxRoot->numSigmaP();
70 */
71 double chi[5];
72 chi[0] = mdcDedxRoot->chiE();
73 chi[1] = mdcDedxRoot->chiMu();
74 chi[2] = mdcDedxRoot->chiPi();
75 chi[3] = mdcDedxRoot->chiK();
76 chi[4] = mdcDedxRoot->chiP();
77 int numGoodHits = mdcDedxRoot->numGoodHits();
78 int numTotalHits = mdcDedxRoot->numTotalHits();
79
80 double probPH = mdcDedxRoot->probPH();
81 double normPH = mdcDedxRoot->normPH();
82 double errorPH = mdcDedxRoot->errorPH();
83 double twentyPH = mdcDedxRoot->twentyPH();
84 //double fracErrPH = dedxRoot-> fracErrPH();
85 //double minIronPH = dedxRoot->minIronPH();
86 //double corrPH = dedxRoot->corrPH();
87
88 DstMdcDedx *mdcDedxTds = new DstMdcDedx();
89 m_common.m_rootMdcDedxMap[mdcDedxRoot] = mdcDedxTds;
90
91 mdcDedxTds->setTrackId(trackId);
92 mdcDedxTds->setParticleId(particleId);
93 mdcDedxTds->setStatus (status);
94 mdcDedxTds->setTruncAlg(truncAlg);
95 /*
96 dedxTds->setProb(pb);
97 dedxTds->setNumSigmaE(numSigmaE);
98 dedxTds->setNumSigmaMu(numSigmaMu);
99 dedxTds->setNumSigmaPi(numSigmaPi);
100 dedxTds->setNumSigmaK(numSigmaK);
101 dedxTds->setNumSigmaP(numSigmaP);
102 */
103 mdcDedxTds->setChi(chi);
104
105 mdcDedxTds->setNumGoodHits( numGoodHits);
106 mdcDedxTds->setNumTotalHits( numTotalHits);
107
108 mdcDedxTds->setProbPH(probPH);
109 mdcDedxTds->setNormPH(normPH);
110 mdcDedxTds->setErrorPH(errorPH);
111 mdcDedxTds->setTwentyPH(twentyPH);
112 //dedxTds->setFracErrPH(fracErrPH);
113 //dedxTds->setMinIronPH(minIronPH);
114 //dedxTds->setCorrPH(corrPH);
115
116 mdcDedxTdsCol->push_back(mdcDedxTds);
117 //delete dedxTds;
118 // dedxTds = NULL;
119 }
120 //m_dedxCol->Delete();
121 delete m_mdcDedxCol;
122 m_mdcDedxCol = 0;
123 return StatusCode::SUCCESS;
124}
static std::map< const TObject *, const DstMdcDedx * > m_rootMdcDedxMap

◆ TObjectToDataObject() [2/2]

virtual StatusCode MdcDedxCnv::TObjectToDataObject ( DataObject *&  obj)
protectedvirtual

transformation from root

Implements RootEventBaseCnv.

Friends And Related Function Documentation

◆ CnvFactory< MdcDedxCnv >


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