CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
CgemDedxCnv Class Reference

#include <CgemDedxCnv.h>

+ Inheritance diagram for CgemDedxCnv:

Public Member Functions

virtual ~CgemDedxCnv ()
 
- 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

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

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 CgemDedxCnv.h.

Constructor & Destructor Documentation

◆ ~CgemDedxCnv()

virtual CgemDedxCnv::~CgemDedxCnv ( )
inlinevirtual

Definition at line 25 of file CgemDedxCnv.h.

25{ };

◆ CgemDedxCnv()

CgemDedxCnv::CgemDedxCnv ( ISvcLocator *  svc)
protected

Definition at line 26 of file CgemDedxCnv.cxx.

28{
29 // Here we associate this converter with the /Event path on the TDS.
30 MsgStream log(msgSvc(), "CgemDedxCnv");
31 //log << MSG::DEBUG << "Constructor called for " << objType() << endreq;
32 m_rootBranchname ="m_cgemDedxCol";
33 //declareObject(EventModel::Dst::DstDedxCol, objType(), m_rootTreename, m_rootBranchname);
34 m_adresses.push_back(&m_cgemDedxCol);
35 m_cgemDedxCol=0;
36}
IMessageSvc * msgSvc()
static const CLID & classID()
Definition: CgemDedxCnv.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 & CgemDedxCnv::classID ( )
inlinestatic

Definition at line 20 of file CgemDedxCnv.h.

21 {
22 return CLID_DstCgemDedxCol;
23 }
const CLID & CLID_DstCgemDedxCol
Definition: EventModel.cxx:318

◆ DataObjectToTObject()

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 126 of file CgemDedxCnv.cxx.

126 {
127
128 MsgStream log(msgSvc(), "CgemDedxCnv");
129 log << MSG::DEBUG << "CgemDedxCnv::DataObjectToTObject" << endreq;
130 StatusCode sc=StatusCode::SUCCESS;
131
132 DstCgemDedxCol * cgemDedxColTds=dynamic_cast<DstCgemDedxCol *> (obj);
133 if (!cgemDedxColTds) {
134 log << MSG::ERROR << "Could not downcast to CgemDedxCol" << 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 << "CgemDedxCnv:Could not downcast to TDS DstEvent" << endreq;
147 }
148 IOpaqueAddress *addr;
149
150 m_cnvSvc->getDstCnv()->createRep(evt,addr);
152
153 const TObjArray *m_cgemDedxCol = recEvt->getCgemDedxCol();
154 if (!m_cgemDedxCol) return sc;
155 recEvt->clearCgemDedxCol(); //necessary in case there is I/O at the same time since array is static
156 DstCgemDedxCol::const_iterator cgemDedxTds;
157
158 for (cgemDedxTds = cgemDedxColTds->begin(); cgemDedxTds != cgemDedxColTds->end(); cgemDedxTds++) {
159 Int_t trackId = (*cgemDedxTds)->trackId();
160 Int_t particleId = (*cgemDedxTds)->particleId();
161 Int_t status = (*cgemDedxTds)->status();
162 Int_t truncAlg =(*cgemDedxTds)->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 = (*cgemDedxTds)->chi(0);
169 Double_t chiMu = (*cgemDedxTds)->chi(1);
170 Double_t chiPi = (*cgemDedxTds)->chi(2);
171 Double_t chiK = (*cgemDedxTds)->chi(3);
172 Double_t chiP = (*cgemDedxTds)->chi(4);
173
174 Int_t numGoodHits = (*cgemDedxTds)->numGoodHits();
175 Int_t numTotalHits = (*cgemDedxTds)->numTotalHits();
176
177 Double_t probPH = (*cgemDedxTds)->probPH();
178 Double_t normPH = (*cgemDedxTds)->normPH();
179 Double_t errorPH = (*cgemDedxTds)->errorPH();
180 Double_t twentyPH =(*cgemDedxTds)->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 TCgemDedx *cgemDedxRoot = new TCgemDedx();
190 //m_common.m_cgemDedxMap[(*cgemDedxTds)] = cgemDedxRoot;
191
192 cgemDedxRoot->setTrackId(trackId);
193 cgemDedxRoot->setParticleId(particleId);
194 cgemDedxRoot->setStatus (status);
195 cgemDedxRoot->setTruncAlg(truncAlg);
196 //dedxRoot->setProb(pb);
197 cgemDedxRoot->setChiE(chiE);
198 cgemDedxRoot->setChiMu(chiMu);
199 cgemDedxRoot->setChiPi(chiPi);
200 cgemDedxRoot->setChiK(chiK);
201 cgemDedxRoot->setChiP(chiP);
202
203 cgemDedxRoot->setNumGoodHits( numGoodHits);
204 cgemDedxRoot->setNumTotalHits( numTotalHits);
205
206 cgemDedxRoot->setProbPH(probPH);
207 cgemDedxRoot->setNormPH(normPH);
208 cgemDedxRoot->setErrorPH(errorPH);
209 cgemDedxRoot->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->addCgemDedx(cgemDedxRoot);
220 }
221
222 return StatusCode::SUCCESS;
223}
ObjectVector< DstCgemDedx > DstCgemDedxCol
Definition: DstCgemDedx.h:79
static TDstEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition: DstCnv.h:36
DstCnv * getDstCnv()
Definition: RootCnvSvc.h:148
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 setParticleId(const Int_t particleId)
Definition: TCgemDedx.h:48
void setChiPi(const Double_t chiPi)
Definition: TCgemDedx.h:57
void setTruncAlg(const Int_t trunc_alg)
Definition: TCgemDedx.h:50
void setChiK(const Double_t chiK)
Definition: TCgemDedx.h:58
void setChiE(const Double_t chiE)
Definition: TCgemDedx.h:55
void setChiP(const Double_t chiP)
Definition: TCgemDedx.h:59
void setChiMu(const Double_t chiMu)
Definition: TCgemDedx.h:56
void setNumTotalHits(const Int_t numTotalHits)
Definition: TCgemDedx.h:62
void setStatus(const Int_t status)
Definition: TCgemDedx.h:49
void setTwentyPH(const Double_t twentyPH)
Definition: TCgemDedx.h:67
void setProbPH(const Double_t probPH)
Definition: TCgemDedx.h:64
void setTrackId(const Int_t trackId)
Definition: TCgemDedx.h:47
void setNormPH(const Double_t normPH)
Definition: TCgemDedx.h:65
void setNumGoodHits(const Int_t numGoodHits)
Definition: TCgemDedx.h:61
void setErrorPH(const Double_t errorPH)
Definition: TCgemDedx.h:66
void clearCgemDedxCol()
clear the whole array
Definition: TDstEvent.h:133
const TObjArray * getCgemDedxCol() const
retrieve the whole TObjArray of Dedx Data
Definition: TDstEvent.h:124
void addCgemDedx(TCgemDedx *Track)
Add a Dedx into the TOF Data collection.
Definition: TDstEvent.cxx:238
_EXTERN_ std::string Event
Definition: EventModel.h:146

◆ TObjectToDataObject()

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 38 of file CgemDedxCnv.cxx.

38 {
39 // creation of TDS object from root object
40
41 MsgStream log(msgSvc(), "CgemDedxCnv");
42 log << MSG::DEBUG << "CgemDedxCnv::TObjectToDataObject" << endreq;
43 StatusCode sc=StatusCode::SUCCESS;
44
45 // create the TDS location for the Dedx Collection
46 DstCgemDedxCol* cgemDedxTdsCol = new DstCgemDedxCol;
47 refpObject=cgemDedxTdsCol;
48
49
50 // now convert
51 if (!m_cgemDedxCol) return sc;
52 TIter cgemDedxIter(m_cgemDedxCol);
53 TCgemDedx *cgemDedxRoot = 0;
54 while ((cgemDedxRoot = (TCgemDedx*)cgemDedxIter.Next())) {
55
56 int trackId = cgemDedxRoot->trackId();
57 int particleId = cgemDedxRoot->particleId();
58 int status = cgemDedxRoot->status();
59 int truncAlg = cgemDedxRoot->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] = cgemDedxRoot->chiE();
73 chi[1] = cgemDedxRoot->chiMu();
74 chi[2] = cgemDedxRoot->chiPi();
75 chi[3] = cgemDedxRoot->chiK();
76 chi[4] = cgemDedxRoot->chiP();
77 int numGoodHits = cgemDedxRoot->numGoodHits();
78 int numTotalHits = cgemDedxRoot->numTotalHits();
79
80 double probPH = cgemDedxRoot->probPH();
81 double normPH = cgemDedxRoot->normPH();
82 double errorPH = cgemDedxRoot->errorPH();
83 double twentyPH = cgemDedxRoot->twentyPH();
84 //double fracErrPH = dedxRoot-> fracErrPH();
85 //double minIronPH = dedxRoot->minIronPH();
86 //double corrPH = dedxRoot->corrPH();
87
88 DstCgemDedx *cgemDedxTds = new DstCgemDedx();
89 m_common.m_rootCgemDedxMap[cgemDedxRoot] = cgemDedxTds;
90
91 cgemDedxTds->setTrackId(trackId);
92 cgemDedxTds->setParticleId(particleId);
93 cgemDedxTds->setStatus (status);
94 cgemDedxTds->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 cgemDedxTds->setChi(chi);
104
105 cgemDedxTds->setNumGoodHits( numGoodHits);
106 cgemDedxTds->setNumTotalHits( numTotalHits);
107
108 cgemDedxTds->setProbPH(probPH);
109 cgemDedxTds->setNormPH(normPH);
110 cgemDedxTds->setErrorPH(errorPH);
111 cgemDedxTds->setTwentyPH(twentyPH);
112 //dedxTds->setFracErrPH(fracErrPH);
113 //dedxTds->setMinIronPH(minIronPH);
114 //dedxTds->setCorrPH(corrPH);
115
116 cgemDedxTdsCol->push_back(cgemDedxTds);
117 //delete dedxTds;
118 // dedxTds = NULL;
119 }
120 //m_dedxCol->Delete();
121 delete m_cgemDedxCol;
122 m_cgemDedxCol = 0;
123 return StatusCode::SUCCESS;
124}
void setNumTotalHits(int numTotalHits)
Definition: DstCgemDedx.h:59
void setChi(double *chi)
Definition: DstCgemDedx.h:54
void setProbPH(double probPH)
Definition: DstCgemDedx.h:60
void setErrorPH(double errorPH)
Definition: DstCgemDedx.h:62
void setNormPH(double normPH)
Definition: DstCgemDedx.h:61
void setParticleId(int particleId)
Definition: DstCgemDedx.h:50
void setTwentyPH(double twentyPH)
Definition: DstCgemDedx.h:63
void setTrackId(int trackId)
Definition: DstCgemDedx.h:49
void setNumGoodHits(int numGoodHits)
Definition: DstCgemDedx.h:58
void setStatus(int status)
Definition: DstCgemDedx.h:51
void setTruncAlg(int trunc_alg)
Definition: DstCgemDedx.h:52
Double_t errorPH() const
Definition: TCgemDedx.h:37
Double_t chiK() const
Definition: TCgemDedx.h:29
Double_t normPH() const
Definition: TCgemDedx.h:36
Int_t trackId() const
Definition: TCgemDedx.h:19
Int_t particleId() const
Definition: TCgemDedx.h:20
Double_t chiMu() const
Definition: TCgemDedx.h:27
Double_t twentyPH() const
Definition: TCgemDedx.h:38
Double_t probPH() const
Definition: TCgemDedx.h:35
Double_t chiE() const
Definition: TCgemDedx.h:26
Double_t chiP() const
Definition: TCgemDedx.h:30
Int_t status() const
Definition: TCgemDedx.h:21
Int_t numGoodHits() const
Definition: TCgemDedx.h:32
Double_t chiPi() const
Definition: TCgemDedx.h:28
Int_t numTotalHits() const
Definition: TCgemDedx.h:33
Int_t truncAlg() const
Definition: TCgemDedx.h:22
static std::map< const TObject *, const DstCgemDedx * > m_rootCgemDedxMap
Definition: commonData.h:186

Friends And Related Function Documentation

◆ CnvFactory< CgemDedxCnv >

friend class CnvFactory< CgemDedxCnv >
friend

Definition at line 9 of file CgemDedxCnv.h.


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