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

#include <RecCgemDedxCnv.h>

+ Inheritance diagram for RecCgemDedxCnv:

Public Member Functions

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

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

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

Constructor & Destructor Documentation

◆ ~RecCgemDedxCnv()

virtual RecCgemDedxCnv::~RecCgemDedxCnv ( )
inlinevirtual

Definition at line 25 of file RecCgemDedxCnv.h.

25{ };

◆ RecCgemDedxCnv()

RecCgemDedxCnv::RecCgemDedxCnv ( ISvcLocator *  svc)
protected

Definition at line 27 of file RecCgemDedxCnv.cxx.

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

Definition at line 20 of file RecCgemDedxCnv.h.

21 {
22 return CLID_RecCgemDedxCol;
23 }
const CLID & CLID_RecCgemDedxCol
Definition: EventModel.cxx:412

◆ DataObjectToTObject()

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 141 of file RecCgemDedxCnv.cxx.

141 {
142 MsgStream log(msgSvc(), "RecCgemDedxCnv");
143 log << MSG::DEBUG << "RecCgemDedxCnv::DataObjectToTObject" << endreq;
144 StatusCode sc=StatusCode::SUCCESS;
145
146 RecCgemDedxCol * recCgemDedxCol=dynamic_cast<RecCgemDedxCol *> (obj);
147 if (!recCgemDedxCol) {
148 log << MSG::ERROR << "Could not downcast to RecCgemDedxCol" << endreq;
149 return StatusCode::FAILURE;
150 }
151
152 DataObject *evt;
153 m_eds->findObject(EventModel::Recon::Event,evt);
154 if (evt==NULL) {
155 log << MSG::ERROR << "Could not get RecEvent in TDS " << endreq;
156 return StatusCode::FAILURE;
157 }
158 ReconEvent * devtTds=dynamic_cast<ReconEvent *> (evt);
159 if (!devtTds) {
160 log << MSG::ERROR << "RecCgemDedxCnv:Could not downcast to TDS RecEvent" << endreq;
161 }
162 IOpaqueAddress *addr;
163
164 m_cnvSvc->getRecTrackCnv()->createRep(evt,addr);
166
167 const TObjArray *m_recCgemDedxCol = recEvt->getRecCgemDedxCol();
168 if (!m_recCgemDedxCol) return sc;
169 recEvt->clearRecCgemDedxCol(); //necessary in case there is I/O at the same time since array is static
170 RecCgemDedxCol::const_iterator recCgemDedx;
171
172 for (recCgemDedx = recCgemDedxCol->begin(); recCgemDedx != recCgemDedxCol->end(); recCgemDedx++) {
173 Int_t trackId = (*recCgemDedx)->trackId();
174 Int_t particleId = (*recCgemDedx)->particleId();
175 Int_t status = (*recCgemDedx)->status();
176 Int_t truncAlg = (*recCgemDedx)->truncAlg();
177 // Double_t pb[5];
178 // for (Int_t i = 0; i < 5; i++)
179 // pb[i] = (*dedxTds)->prob(i);
180 Double_t dedxHit = (*recCgemDedx)->getDedxHit();
181 Double_t dedxEsat = (*recCgemDedx)->getDedxEsat();
182 Double_t dedxNoRun = (*recCgemDedx)->getDedxNoRun();
183 Double_t dedxMoment = (*recCgemDedx)->getDedxMoment();
184
185
186 Double_t chiE = (*recCgemDedx)->chi(0);
187 Double_t chiMu = (*recCgemDedx)->chi(1);
188 Double_t chiPi = (*recCgemDedx)->chi(2);
189 Double_t chiK = (*recCgemDedx)->chi(3);
190 Double_t chiP = (*recCgemDedx)->chi(4);
191
192 Int_t numGoodHits = (*recCgemDedx)->numGoodHits();
193 Int_t numTotalHits = (*recCgemDedx)->numTotalHits();
194
195 Double_t probPH = (*recCgemDedx)->probPH();
196 Double_t normPH = (*recCgemDedx)->normPH();
197 Double_t errorPH = (*recCgemDedx)->errorPH();
198 Double_t twentyPH = (*recCgemDedx)->twentyPH();
199 //Double_t fracErrPH = (*dedxTds)-> fracErrPH();
200 //Double_t minIronPH = (*dedxTds)->minIronPH();
201 //Double_t corrPH = (*dedxTds)->corrPH();
202 double dedxExpect[5],sigmaDedx[5],pidProb[5],chi[5];
203 for (int i=0; i<5; i++){
204 chi[i] = (*recCgemDedx)->chi(i);
205 dedxExpect[i] = (*recCgemDedx)->getDedxExpect(i);
206 sigmaDedx[i] = (*recCgemDedx)->getSigmaDedx(i);
207 pidProb[i] = (*recCgemDedx)->getPidProb(i);
208 }
209
210
211 TRecCgemDedx *recCgemDedxRoot = new TRecCgemDedx();
212 //m_common.m_recCgemDedxMap[(*recCgemDedx)] = recCgemDedxRoot;
213 //std::cout<<"check write to Reconstrunction root particle Id is "<<dedxRoot->particleId()<<endl;
214 recCgemDedxRoot->setTrackId(trackId);
215 recCgemDedxRoot->setParticleId(particleId);
216 recCgemDedxRoot->setStatus (status);
217 recCgemDedxRoot->setTruncAlg(truncAlg);
218 log << MSG::INFO<<"check Reconstrunction root"<<" particle Id is : "<<particleId
219 <<"track id is : "<<trackId
220 <<" and status is : "<<status<<endreq;
221 //dedxRoot->setProb(pb);
222 recCgemDedxRoot->setChiE(chiE);
223 recCgemDedxRoot->setChiMu(chiMu);
224 recCgemDedxRoot->setChiPi(chiPi);
225 recCgemDedxRoot->setChiK(chiK);
226 recCgemDedxRoot->setChiP(chiP);
227
228 recCgemDedxRoot->setNumGoodHits( numGoodHits);
229 recCgemDedxRoot->setNumTotalHits( numTotalHits);
230
231 recCgemDedxRoot->setProbPH(probPH);
232 recCgemDedxRoot->setNormPH(normPH);
233 recCgemDedxRoot->setErrorPH(errorPH);
234 recCgemDedxRoot->setTwentyPH(twentyPH);
235 // for (int i=0; i<5; i++){
236 recCgemDedxRoot->setChi(chi);
237 recCgemDedxRoot->setDedxExpect(dedxExpect);
238 recCgemDedxRoot->setSigmaDedx(sigmaDedx);
239 recCgemDedxRoot->setPidProb(pidProb);
240
241 recCgemDedxRoot->setDedxHit(dedxHit);
242 recCgemDedxRoot->setDedxEsat(dedxEsat);
243 recCgemDedxRoot->setDedxNoRun(dedxNoRun);
244 recCgemDedxRoot->setDedxMoment(dedxMoment);
245
246 //}
247 log << MSG::INFO<<"check Reconstrunction root"<<" particle Id is : "<<particleId
248 <<"track id is : "<<trackId
249 <<" and status is : "<<status<<endreq;
250
251 // dedxRoot->setFracErrPH(fracErrPH);
252 //dedxRoot->setMinIronPH(minIronPH);
253 //dedxRoot->setCorrPH(corrPH);
254 recEvt->addRecCgemDedx(recCgemDedxRoot);
255 }
256
257 return StatusCode::SUCCESS;
258}
ObjectVector< RecCgemDedx > RecCgemDedxCol
Definition: RecCgemDedx.h:120
static TRecTrackEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition: RecTrackCnv.h:36
RecTrackCnv * getRecTrackCnv()
Definition: RootCnvSvc.h:166
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 setDedxHit(const Double_t dedx_hit)
Definition: TRecCgemDedx.h:49
void setChiE(const Double_t chiE)
Definition: TRecCgemDedx.h:59
void setChiP(const Double_t chiP)
Definition: TRecCgemDedx.h:63
void setChiPi(const Double_t chiPi)
Definition: TRecCgemDedx.h:61
void setChiMu(const Double_t chiMu)
Definition: TRecCgemDedx.h:60
void setDedxNoRun(const Double_t dedx_norun)
Definition: TRecCgemDedx.h:51
void setParticleId(const Int_t particleId)
Definition: TRecCgemDedx.h:55
void setTrackId(const Int_t trackId)
Definition: TRecCgemDedx.h:54
void setNumGoodHits(const Int_t numGoodHits)
Definition: TRecCgemDedx.h:65
void setChiK(const Double_t chiK)
Definition: TRecCgemDedx.h:62
void setTruncAlg(const Int_t trunc_alg)
Definition: TRecCgemDedx.h:57
void setTwentyPH(const Double_t twentyPH)
Definition: TRecCgemDedx.h:71
void setSigmaDedx(double *sigma_dedx)
Definition: TRecCgemDedx.h:81
void setDedxMoment(const Double_t dedx_momentum)
Definition: TRecCgemDedx.h:52
void setStatus(const Int_t status)
Definition: TRecCgemDedx.h:56
void setNumTotalHits(const Int_t numTotalHits)
Definition: TRecCgemDedx.h:66
void setPidProb(double *pid_prob)
Definition: TRecCgemDedx.h:85
void setErrorPH(const Double_t errorPH)
Definition: TRecCgemDedx.h:70
void setNormPH(const Double_t normPH)
Definition: TRecCgemDedx.h:69
void setDedxEsat(const Double_t dedx_esat)
Definition: TRecCgemDedx.h:50
void setProbPH(const Double_t probPH)
Definition: TRecCgemDedx.h:68
void setDedxExpect(double *dedx_exp)
Definition: TRecCgemDedx.h:77
void setChi(double *chi)
Definition: TRecCgemDedx.h:73
void clearRecCgemDedxCol()
clear the whole array
void addRecCgemDedx(TRecCgemDedx *Track)
Add a Dedx into the TOF Data collection.
const TObjArray * getRecCgemDedxCol() const
retrieve the whole TObjArray of Dedx Data
_EXTERN_ std::string Event
Definition: EventModel.h:90

◆ TObjectToDataObject()

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 41 of file RecCgemDedxCnv.cxx.

41 {
42 // creation of TDS object from root object
43 MsgStream log(msgSvc(), "RecCgemDedxCnv");
44 log << MSG::DEBUG << "RecCgemDedxCnv::TObjectToDataObject" << endreq;
45 StatusCode sc=StatusCode::SUCCESS;
46
47 // create the TDS location for the Dedx Collection
48 RecCgemDedxCol* recCgemDedxCol = new RecCgemDedxCol;
49 refpObject=recCgemDedxCol;
50
51
52 // now convert
53 if (!m_recCgemDedxCol) return sc;
54 TIter dedxIter(m_recCgemDedxCol);
55 TRecCgemDedx *recCgemDedxRoot = 0;
56 while ((recCgemDedxRoot = (TRecCgemDedx*)dedxIter.Next())) {
57 double dedxHit = recCgemDedxRoot->dedxHit();
58 double dedxEsat = recCgemDedxRoot->dedxEsat();
59 double dedxNoRun = recCgemDedxRoot->dedxNoRun();
60 double dedxMoment = recCgemDedxRoot->dedxMoment();
61
62 int trackId = recCgemDedxRoot->trackId();
63 int particleId = recCgemDedxRoot->particleId();
64 int status = recCgemDedxRoot->status();
65 int truncAlg = recCgemDedxRoot->truncAlg();
66 // double pb[5];
67 // for ( int i = 0; i < 5; i++)
68 // pb[i] = dedxRoot->prob(i);
69
70 // double numSigmaE = dedxRoot->numSigmaE();
71 // double numSigmaMu = dedxRoot->numSigmaMu();
72 // double numSigmaPi = dedxRoot->numSigmaPi();
73 // double numSigmaK = dedxRoot->numSigmaK();
74 // double numSigmaP = dedxRoot->numSigmaP();
75 double chi[5];
76 chi[0] = recCgemDedxRoot->chiE();
77 chi[1] = recCgemDedxRoot->chiMu();
78 chi[2] = recCgemDedxRoot->chiPi();
79 chi[3] = recCgemDedxRoot->chiK();
80 chi[4] = recCgemDedxRoot->chiP();
81 int numGoodHits = recCgemDedxRoot->numGoodHits();
82 int numTotalHits = recCgemDedxRoot->numTotalHits();
83
84 double probPH = recCgemDedxRoot->probPH();
85 double normPH = recCgemDedxRoot->normPH();
86 double errorPH = recCgemDedxRoot->errorPH();
87 double twentyPH = recCgemDedxRoot->twentyPH();
88 double dedxExpect[5],sigmaDedx[5],pidProb[5];
89 for (int i=0; i<5; i++){
90 dedxExpect[i] = recCgemDedxRoot->dedxExpect(i);
91 sigmaDedx[i] = recCgemDedxRoot->sigmaDedx(i);
92 pidProb[i] = recCgemDedxRoot->pidProb(i);}
93
94 RecCgemDedx *recCgemDedx = new RecCgemDedx();
95 m_common.m_rootRecCgemDedxMap[recCgemDedxRoot] = recCgemDedx;
96
97 recCgemDedx->setTrackId(trackId);
98 recCgemDedx->setParticleId(particleId);
99 recCgemDedx->setStatus (status);
100 recCgemDedx->setTruncAlg(truncAlg);
101 // dedxTds->setProb(pb);
102 // dedxTds->setNumSigmaE(numSigmaE);
103 // dedxTds->setNumSigmaMu(numSigmaMu);
104 // dedxTds->setNumSigmaPi(numSigmaPi);
105 // dedxTds->setNumSigmaK(numSigmaK);
106 // dedxTds->setNumSigmaP(numSigmaP);
107 recCgemDedx->setChi(chi);
108 recCgemDedx->setNumGoodHits( numGoodHits);
109 recCgemDedx->setNumTotalHits( numTotalHits);
110
111 recCgemDedx->setProbPH(probPH);
112 recCgemDedx->setNormPH(normPH);
113 recCgemDedx->setErrorPH(errorPH);
114 recCgemDedx->setTwentyPH(twentyPH);
115 //for (int i=0; i<5; i++){
116 recCgemDedx->setDedxExpect(dedxExpect);
117 recCgemDedx->setSigmaDedx(sigmaDedx);
118 recCgemDedx->setPidProb(pidProb);
119
120 recCgemDedx->setDedxHit(dedxHit);
121 recCgemDedx->setDedxEsat(dedxEsat);
122 recCgemDedx->setDedxNoRun(dedxNoRun);
123 recCgemDedx->setDedxMoment(dedxMoment);
124
125 //}
126
127
128
129 recCgemDedxCol->push_back(recCgemDedx);
130 //delete dedxTds;
131 // dedxTds = NULL;
132 }
133 //m_dedxCol->Delete();
134 delete m_recCgemDedxCol;
135 m_recCgemDedxCol = 0;
136
137 return StatusCode::SUCCESS;
138}
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
void setDedxHit(double dedx_hit)
Definition: RecCgemDedx.h:69
void setDedxExpect(double *dedx_exp)
Definition: RecCgemDedx.h:81
void setSigmaDedx(double *sigma_dedx)
Definition: RecCgemDedx.h:85
void setDedxMoment(double dedx_momentum)
Definition: RecCgemDedx.h:72
void setDedxNoRun(double dedx_norun)
Definition: RecCgemDedx.h:71
void setPidProb(double *pid_prob)
Definition: RecCgemDedx.h:89
void setDedxEsat(double dedx_esat)
Definition: RecCgemDedx.h:70
Double_t dedxNoRun() const
Definition: TRecCgemDedx.h:45
Double_t dedxEsat() const
Definition: TRecCgemDedx.h:44
Double_t twentyPH() const
Definition: TRecCgemDedx.h:37
Double_t chiK() const
Definition: TRecCgemDedx.h:28
Double_t chiP() const
Definition: TRecCgemDedx.h:29
Int_t numGoodHits() const
Definition: TRecCgemDedx.h:31
Int_t particleId() const
Definition: TRecCgemDedx.h:20
Double_t chiE() const
Definition: TRecCgemDedx.h:25
Double_t normPH() const
Definition: TRecCgemDedx.h:35
Double_t dedxHit() const
Definition: TRecCgemDedx.h:43
Double_t errorPH() const
Definition: TRecCgemDedx.h:36
Int_t trackId() const
Definition: TRecCgemDedx.h:19
Int_t numTotalHits() const
Definition: TRecCgemDedx.h:32
Double_t dedxExpect(int pid) const
Definition: TRecCgemDedx.h:39
Double_t chiPi() const
Definition: TRecCgemDedx.h:27
Double_t dedxMoment() const
Definition: TRecCgemDedx.h:46
Int_t status() const
Definition: TRecCgemDedx.h:21
Double_t pidProb(int pid) const
Definition: TRecCgemDedx.h:41
Double_t chiMu() const
Definition: TRecCgemDedx.h:26
Double_t sigmaDedx(int pid) const
Definition: TRecCgemDedx.h:40
Int_t truncAlg() const
Definition: TRecCgemDedx.h:22
Double_t probPH() const
Definition: TRecCgemDedx.h:34
static std::map< const TObject *, const RecCgemDedx * > m_rootRecCgemDedxMap
Definition: commonData.h:282

Friends And Related Function Documentation

◆ CnvFactory< RecCgemDedxCnv >

friend class CnvFactory< RecCgemDedxCnv >
friend

Definition at line 9 of file RecCgemDedxCnv.h.


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