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

#include <MdcDedxCnv.h>

+ Inheritance diagram for MdcDedxCnv:

Public Member Functions

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
 
- 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

 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
 

Friends

class CnvFactory< MdcDedxCnv >
 

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

Definition at line 15 of file MdcDedxCnv.h.

Constructor & Destructor Documentation

◆ ~MdcDedxCnv()

virtual MdcDedxCnv::~MdcDedxCnv ( )
inlinevirtual

Definition at line 25 of file MdcDedxCnv.h.

25{ };

◆ MdcDedxCnv()

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}
IMessageSvc * msgSvc()
static const CLID & classID()
Definition: MdcDedxCnv.h:20
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 & MdcDedxCnv::classID ( )
inlinestatic

Definition at line 20 of file MdcDedxCnv.h.

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

◆ DataObjectToTObject()

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
Definition: DstMdcDedx.h:102
static TDstEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition: DstCnv.h:36
DstCnv * getDstCnv()
Definition: RootCnvSvc.h:155
RootCnvSvc * m_cnvSvc
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
Definition: TDstEvent.h:84
void clearMdcDedxCol()
clear the whole array
Definition: TDstEvent.h:93
void addMdcDedx(TMdcDedx *Track)
Add a Dedx into the TOF Data collection.
Definition: TDstEvent.cxx:163
void setChiP(const Double_t chiP)
Definition: TMdcDedx.h:59
void setNormPH(const Double_t normPH)
Definition: TMdcDedx.h:65
void setChiE(const Double_t chiE)
Definition: TMdcDedx.h:55
void setChiMu(const Double_t chiMu)
Definition: TMdcDedx.h:56
void setChiPi(const Double_t chiPi)
Definition: TMdcDedx.h:57
void setNumTotalHits(const Int_t numTotalHits)
Definition: TMdcDedx.h:62
void setParticleId(const Int_t particleId)
Definition: TMdcDedx.h:48
void setProbPH(const Double_t probPH)
Definition: TMdcDedx.h:64
void setTwentyPH(const Double_t twentyPH)
Definition: TMdcDedx.h:67
void setTrackId(const Int_t trackId)
Definition: TMdcDedx.h:47
void setStatus(const Int_t status)
Definition: TMdcDedx.h:49
void setTruncAlg(const Int_t trunc_alg)
Definition: TMdcDedx.h:50
void setChiK(const Double_t chiK)
Definition: TMdcDedx.h:58
void setNumGoodHits(const Int_t numGoodHits)
Definition: TMdcDedx.h:61
void setErrorPH(const Double_t errorPH)
Definition: TMdcDedx.h:66
_EXTERN_ std::string Event
Definition: EventModel.h:128

◆ TObjectToDataObject()

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}
void setChi(double *chi)
Definition: DstMdcDedx.h:77
void setTruncAlg(int trunc_alg)
Definition: DstMdcDedx.h:75
void setStatus(int status)
Definition: DstMdcDedx.h:74
void setTwentyPH(double twentyPH)
Definition: DstMdcDedx.h:86
void setNumGoodHits(int numGoodHits)
Definition: DstMdcDedx.h:81
void setProbPH(double probPH)
Definition: DstMdcDedx.h:83
void setNormPH(double normPH)
Definition: DstMdcDedx.h:84
void setParticleId(int particleId)
Definition: DstMdcDedx.h:73
void setTrackId(int trackId)
Definition: DstMdcDedx.h:72
void setNumTotalHits(int numTotalHits)
Definition: DstMdcDedx.h:82
void setErrorPH(double errorPH)
Definition: DstMdcDedx.h:85
Int_t particleId() const
Definition: TMdcDedx.h:20
Double_t probPH() const
Definition: TMdcDedx.h:35
Double_t chiMu() const
Definition: TMdcDedx.h:27
Int_t status() const
Definition: TMdcDedx.h:21
Int_t numTotalHits() const
Definition: TMdcDedx.h:33
Double_t chiP() const
Definition: TMdcDedx.h:30
Int_t numGoodHits() const
Definition: TMdcDedx.h:32
Double_t chiK() const
Definition: TMdcDedx.h:29
Int_t truncAlg() const
Definition: TMdcDedx.h:22
Double_t chiPi() const
Definition: TMdcDedx.h:28
Double_t errorPH() const
Definition: TMdcDedx.h:37
Int_t trackId() const
Definition: TMdcDedx.h:19
Double_t twentyPH() const
Definition: TMdcDedx.h:38
Double_t chiE() const
Definition: TMdcDedx.h:26
Double_t normPH() const
Definition: TMdcDedx.h:36
static std::map< const TObject *, const DstMdcDedx * > m_rootMdcDedxMap
Definition: commonData.h:155

Friends And Related Function Documentation

◆ CnvFactory< MdcDedxCnv >

friend class CnvFactory< MdcDedxCnv >
friend

Definition at line 9 of file MdcDedxCnv.h.


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