CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
RecTofTrackCnv.cxx
Go to the documentation of this file.
1#ifndef RecTofTrackCnv_CXX
2#define RecTofTrackCnv_CXX 1
3
4#include "GaudiKernel/MsgStream.h"
5#include "GaudiKernel/DataObject.h"
6#include "GaudiKernel/ObjectVector.h"
7
8#include "TClonesArray.h"
9
11
14
15#include "RootEventData/TRecTofTrack.h" // standard root object
17
21
22#include <vector>
23
24using namespace std;
25
26// Instantiation of a static factory class used by clients to create
27// instances of this service
28//static CnvFactory<RecTofTrackCnv> s_factory;
29//const ICnvFactory& RecTofTrackCnvFactory = s_factory;
30
32: RootEventBaseCnv(classID(), svc)
33{
34
35 // Here we associate this converter with the /Event path on the TDS.
36 MsgStream log(msgSvc(), "RecTofTrackCnv");
37 //log << MSG::DEBUG << "Constructor called for " << objType() << endreq;
38 //m_rootTreename ="Rec";
39 //m_rootBranchname ="m_RecTofTrackCol";
40 //declareObject(EventModel::Recon::RecTofTrackCol, objType(), m_rootTreename, m_rootBranchname);
41 m_adresses.push_back(&m_recTofTrackCol);
42 m_recTofTrackCol=0;
43}
44
45StatusCode RecTofTrackCnv::TObjectToDataObject(DataObject*& refpObject) {
46 // creation of TDS object from root object
47
48
49 MsgStream log(msgSvc(), "RecTofTrackCnv");
50 log << MSG::DEBUG << "RecTofTrackCnv::TObjectToDataObject" << endreq;
51 StatusCode sc=StatusCode::SUCCESS;
52
53 // create the TDS location for the MucTrack Collection
54 RecTofTrackCol* recTofTrackTdsCol = new RecTofTrackCol;
55 refpObject=recTofTrackTdsCol;
56
57 // now convert
58 if (!m_recTofTrackCol) return sc;
59 TIter recTofTrackIter(m_recTofTrackCol);
60 TRecTofTrack *recTofTrackRoot = 0;
61 while ((recTofTrackRoot = (TRecTofTrack*)recTofTrackIter.Next())) {
62
63 int tofTrackID = recTofTrackRoot->tofTrackID();
64 int trackID = recTofTrackRoot->trackID();
65 int tofID = recTofTrackRoot->tofID();
66 unsigned int status = recTofTrackRoot->status();
67 double path = recTofTrackRoot->path();
68 double zrhit = recTofTrackRoot->zrhit();
69 double ph = recTofTrackRoot->ph();
70 double tof = recTofTrackRoot->tof();
71 double errtof = recTofTrackRoot->errtof();
72 double beta = recTofTrackRoot->beta();
73 double texpElectron = recTofTrackRoot->texpElectron();
74 double texpMuon = recTofTrackRoot->texpMuon();
75 double texpPion = recTofTrackRoot->texpPion();
76 double texpKaon = recTofTrackRoot->texpKaon();
77 double texpProton = recTofTrackRoot->texpProton();
78 double toffsetElectron = recTofTrackRoot->toffsetElectron();
79 double toffsetMuon = recTofTrackRoot->toffsetMuon();
80 double toffsetPion = recTofTrackRoot->toffsetPion();
81 double toffsetKaon = recTofTrackRoot->toffsetKaon();
82 double toffsetProton = recTofTrackRoot->toffsetProton();
83 double toffsetAntiProton = recTofTrackRoot->toffsetAntiProton();
84 double sigmaElectron = recTofTrackRoot->sigmaElectron();
85 double sigmaMuon = recTofTrackRoot->sigmaMuon();
86 double sigmaPion = recTofTrackRoot->sigmaPion();
87 double sigmaKaon = recTofTrackRoot->sigmaKaon();
88 double sigmaProton = recTofTrackRoot->sigmaProton();
89 double sigmaAntiProton = recTofTrackRoot->sigmaAntiProton();
90 int quality = recTofTrackRoot->quality();
91 double t0 = recTofTrackRoot->t0();
92 double errt0 = recTofTrackRoot->errt0();
93 double errz = recTofTrackRoot->errz();
94 double phi = recTofTrackRoot->phi();
95 double errphi = recTofTrackRoot->errphi();
96 double energy = recTofTrackRoot->energy();
97 double errenergy = recTofTrackRoot->errenergy();
98
99 RecTofTrack *recTofTrackTds = new RecTofTrack();
100 m_common.m_rootRecTofTrackMap[recTofTrackRoot] = recTofTrackTds;
101
102 recTofTrackTds->setTofTrackID(tofTrackID);
103 recTofTrackTds->setTrackID(trackID);
104 recTofTrackTds->setTofID(tofID);
105 recTofTrackTds->setStatus(status);
106 recTofTrackTds->setPath(path);
107 recTofTrackTds->setZrHit(zrhit);
108 recTofTrackTds->setPh(ph);
109 recTofTrackTds->setTof(tof);
110 recTofTrackTds->setErrTof(errtof);
111 recTofTrackTds->setBeta(beta);
112 recTofTrackTds->setTexpElectron(texpElectron);
113 recTofTrackTds->setTexpMuon(texpMuon);
114 recTofTrackTds->setTexpPion(texpPion);
115 recTofTrackTds->setTexpKaon(texpKaon);
116 recTofTrackTds->setTexpProton(texpProton);
117 recTofTrackTds->setToffsetElectron(toffsetElectron);
118 recTofTrackTds->setToffsetMuon(toffsetMuon);
119 recTofTrackTds->setToffsetPion(toffsetPion);
120 recTofTrackTds->setToffsetKaon(toffsetKaon);
121 recTofTrackTds->setToffsetProton(toffsetProton);
122 recTofTrackTds->setToffsetAntiProton(toffsetAntiProton);
123 recTofTrackTds->setSigmaElectron(sigmaElectron);
124 recTofTrackTds->setSigmaMuon(sigmaMuon);
125 recTofTrackTds->setSigmaPion(sigmaPion);
126 recTofTrackTds->setSigmaKaon(sigmaKaon);
127 recTofTrackTds->setSigmaProton(sigmaProton);
128 recTofTrackTds->setSigmaAntiProton(sigmaAntiProton);
129 recTofTrackTds->setQuality(quality);
130 recTofTrackTds->setT0(t0);
131 recTofTrackTds->setErrT0(errt0);
132 recTofTrackTds->setErrZ(errz);
133 recTofTrackTds->setPhi(phi);
134 recTofTrackTds->setErrPhi(errphi);
135 recTofTrackTds->setEnergy(energy);
136 recTofTrackTds->setErrEnergy(errenergy);
137
138 recTofTrackTdsCol->push_back(recTofTrackTds);
139 }
140
141 delete m_recTofTrackCol;
142 m_recTofTrackCol = 0;
143
144 return StatusCode::SUCCESS;
145}
146
147StatusCode RecTofTrackCnv::DataObjectToTObject(DataObject* obj,RootAddress* rootaddr) {
148
149 MsgStream log(msgSvc(), "RecTofTrackCnv");
150 log << MSG::DEBUG << "RecTofTrackCnv::DataObjectToTObject" << endreq;
151 StatusCode sc=StatusCode::SUCCESS;
152
153 RecTofTrackCol * recTofTrackColTds=dynamic_cast<RecTofTrackCol *> (obj);
154 if (!recTofTrackColTds) {
155 log << MSG::ERROR << "Could not downcast to TofTrackCol" << endreq;
156 return StatusCode::FAILURE;
157 }
158
159 DataObject *evt;
160 m_eds->findObject(EventModel::Recon::Event,evt);
161 if (evt==NULL) {
162 log << MSG::ERROR << "Could not get RecEvent in TDS " << endreq;
163 return StatusCode::FAILURE;
164 }
165
166 ReconEvent * devtTds=dynamic_cast<ReconEvent *> (evt);
167 if (!devtTds) {
168 log << MSG::ERROR << "RecMucTrackCnv:Could not downcast to TDS DigiEvent" << endreq;
169 }
170
171 IOpaqueAddress *addr;
172
173 m_cnvSvc->getRecTrackCnv()->createRep(evt,addr);
175
176 const TObjArray *m_recTofTrackCol = recEvt->getTofTrackCol();
177 if (!m_recTofTrackCol) return sc;
178 recEvt->clearTofTrackCol(); //necessary in case there is I/O at the same time since array is static
179 RecTofTrackCol::const_iterator recTofTrackTds;
180
181 for (recTofTrackTds = recTofTrackColTds->begin(); recTofTrackTds != recTofTrackColTds->end(); recTofTrackTds++) {
182
183 Int_t tofTrackID = (*recTofTrackTds)->tofTrackID();
184 Int_t trackID = (*recTofTrackTds)->trackID();
185 Int_t tofID = (*recTofTrackTds)->tofID();
186 UInt_t status = (*recTofTrackTds)->status();
187 Double_t path = (*recTofTrackTds)->path();
188 Double_t zrhit = (*recTofTrackTds)->zrhit();
189 Double_t ph = (*recTofTrackTds)->ph();
190 Double_t tof = (*recTofTrackTds)->tof();
191 Double_t errtof = (*recTofTrackTds)->errtof();
192 Double_t beta = (*recTofTrackTds)->beta();
193 Double_t texpElectron = (*recTofTrackTds)->texpElectron();
194 Double_t texpMuon = (*recTofTrackTds)->texpMuon();
195 Double_t texpPion = (*recTofTrackTds)->texpPion();
196 Double_t texpKaon = (*recTofTrackTds)->texpKaon();
197 Double_t texpProton = (*recTofTrackTds)->texpProton();
198 Double_t toffsetElectron = (*recTofTrackTds)->toffsetElectron();
199 Double_t toffsetMuon = (*recTofTrackTds)->toffsetMuon();
200 Double_t toffsetPion = (*recTofTrackTds)->toffsetPion();
201 Double_t toffsetKaon = (*recTofTrackTds)->toffsetKaon();
202 Double_t toffsetProton = (*recTofTrackTds)->toffsetProton();
203 Double_t toffsetAntiProton = (*recTofTrackTds)->toffsetAntiProton();
204 Double_t sigmaElectron = (*recTofTrackTds)->sigmaElectron();
205 Double_t sigmaMuon = (*recTofTrackTds)->sigmaMuon();
206 Double_t sigmaPion = (*recTofTrackTds)->sigmaPion();
207 Double_t sigmaKaon = (*recTofTrackTds)->sigmaKaon();
208 Double_t sigmaProton = (*recTofTrackTds)->sigmaProton();
209 Double_t sigmaAntiProton = (*recTofTrackTds)->sigmaAntiProton();
210 Int_t quality = (*recTofTrackTds)->quality();
211 Double_t t0 = (*recTofTrackTds)->t0();
212 Double_t errt0 = (*recTofTrackTds)->errt0();
213 Double_t errz = (*recTofTrackTds)->errz();
214 Double_t phi = (*recTofTrackTds)->phi();
215 Double_t errphi = (*recTofTrackTds)->errphi();
216 Double_t energy = (*recTofTrackTds)->energy();
217 Double_t errenergy = (*recTofTrackTds)->errenergy();
218
219 TRecTofTrack *recTofTrackRoot = new TRecTofTrack();
220 //m_common.m_RecTofTrackMap[(*recTofTrackTds)] = recTofTrackRoot;
221
222 recTofTrackRoot->setTofTrackID(tofTrackID);
223 recTofTrackRoot->setTrackID(trackID);
224 recTofTrackRoot->setTofID(tofID);
225 recTofTrackRoot->setStatus(status);
226 recTofTrackRoot->setPath(path);
227 recTofTrackRoot->setZrHit(zrhit);
228 recTofTrackRoot->setPh(ph);
229 recTofTrackRoot->setTof(tof);
230 recTofTrackRoot->setErrTof(errtof);
231 recTofTrackRoot->setBeta(beta);
232 recTofTrackRoot->setTexpElectron(texpElectron);
233 recTofTrackRoot->setTexpMuon(texpMuon);
234 recTofTrackRoot->setTexpPion(texpPion);
235 recTofTrackRoot->setTexpKaon(texpKaon);
236 recTofTrackRoot->setTexpProton(texpProton);
237 recTofTrackRoot->setToffsetElectron(toffsetElectron);
238 recTofTrackRoot->setToffsetMuon(toffsetMuon);
239 recTofTrackRoot->setToffsetPion(toffsetPion);
240 recTofTrackRoot->setToffsetKaon(toffsetKaon);
241 recTofTrackRoot->setToffsetProton(toffsetProton);
242 recTofTrackRoot->setToffsetAntiProton(toffsetAntiProton);
243 recTofTrackRoot->setSigmaElectron(sigmaElectron);
244 recTofTrackRoot->setSigmaMuon(sigmaMuon);
245 recTofTrackRoot->setSigmaPion(sigmaPion);
246 recTofTrackRoot->setSigmaKaon(sigmaKaon);
247 recTofTrackRoot->setSigmaProton(sigmaProton);
248 recTofTrackRoot->setSigmaAntiProton(sigmaAntiProton);
249 recTofTrackRoot->setQuality(quality);
250 recTofTrackRoot->setT0(t0);
251 recTofTrackRoot->setErrT0(errt0);
252 recTofTrackRoot->setErrZ(errz);
253 recTofTrackRoot->setPhi(phi);
254 recTofTrackRoot->setErrPhi(errphi);
255 recTofTrackRoot->setEnergy(energy);
256 recTofTrackRoot->setErrEnergy(errenergy);
257
258 recEvt->addTofTrack(recTofTrackRoot);
259
260 }
261
262 return StatusCode::SUCCESS;
263}
264#endif
************Class m_ypar INTEGER m_KeyWgt INTEGER m_nphot INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
Definition KK2f.h:50
ObjectVector< RecTofTrack > RecTofTrackCol
Definition RecTofTrack.h:33
IMessageSvc * msgSvc()
void setStatus(unsigned int status)
Definition DstTofTrack.h:92
void setTexpElectron(double texpe)
void setTexpMuon(double texpmu)
void setToffsetPion(double topi)
void setEnergy(double energy)
void setPath(double path)
Definition DstTofTrack.h:94
void setTexpPion(double texppi)
void setTofTrackID(int tofTrackID)
Definition DstTofTrack.h:89
void setPh(double ph)
Definition DstTofTrack.h:96
void setSigmaMuon(double smu)
void setQuality(int quality)
void setTexpKaon(double texpk)
void setZrHit(double zrhit)
Definition DstTofTrack.h:95
void setTof(double tof)
Definition DstTofTrack.h:97
void setToffsetMuon(double tomu)
void setSigmaProton(double sp)
void setPhi(double phi)
void setToffsetProton(double top)
void setErrTof(double etof)
Definition DstTofTrack.h:98
void setErrT0(double errt0)
void setTexpProton(double texpp)
void setToffsetAntiProton(double topb)
void setBeta(double beta)
Definition DstTofTrack.h:99
void setSigmaKaon(double sk)
void setErrEnergy(double errenergy)
void setTrackID(int trackID)
Definition DstTofTrack.h:90
void setT0(double t0)
void setErrZ(double errz)
void setSigmaAntiProton(double spb)
void setErrPhi(double errphi)
void setSigmaPion(double spi)
void setTofID(int tofID)
Definition DstTofTrack.h:91
void setSigmaElectron(double se)
void setToffsetKaon(double tok)
void setToffsetElectron(double toe)
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
RecTofTrackCnv(ISvcLocator *svc)
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
static TRecTrackEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition RecTrackCnv.h:36
Definition of a Root address, derived from IOpaqueAddress.
Definition RootAddress.h:21
RecTrackCnv * getRecTrackCnv()
Definition RootCnvSvc.h:166
Base class for all Root Converters.
std::vector< void * > m_adresses
each converter knows the corresponding adresses
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 setTexpElectron(Double_t texpe)
Double_t texpMuon() const
void setToffsetAntiProton(Double_t topb)
void setSigmaKaon(Double_t sk)
Double_t sigmaPion() const
Double_t sigmaAntiProton() const
Double_t errz() const
void setTof(Double_t tof)
Double_t path() const
void setTrackID(Int_t trackID)
Double_t texpKaon() const
void setTexpProton(Double_t texpp)
Double_t toffsetMuon() const
void setToffsetKaon(Double_t tok)
Int_t tofID() const
Double_t sigmaProton() const
Double_t texpProton() const
void setSigmaElectron(Double_t se)
void setEnergy(Double_t energy)
Double_t texpElectron() const
Int_t quality() const
void setStatus(UInt_t status)
void setToffsetElectron(Double_t toe)
Double_t sigmaMuon() const
void setTexpKaon(Double_t texpk)
Int_t trackID() const
void setT0(Double_t t0)
Double_t errphi() const
void setToffsetMuon(Double_t tomu)
void setQuality(Int_t quality)
void setSigmaPion(Double_t spi)
Double_t toffsetPion() const
void setErrZ(Double_t errz)
void setErrTof(Double_t etof)
Double_t toffsetKaon() const
Double_t beta() const
Double_t phi() const
Double_t energy() const
Double_t zrhit() const
Double_t errtof() const
Double_t ph() const
Double_t texpPion() const
void setTofID(Int_t tofID)
Double_t errt0() const
void setSigmaAntiProton(Double_t spb)
Double_t toffsetAntiProton() const
void setToffsetPion(Double_t topi)
void setBeta(Double_t beta)
Double_t toffsetProton() const
Double_t errenergy() const
Double_t tof() const
void setSigmaMuon(Double_t smu)
void setPhi(Double_t phi)
void setErrPhi(Double_t errphi)
Double_t sigmaElectron() const
Double_t t0() const
void setTofTrackID(Int_t tofTrackID)
void setPath(Double_t path)
void setPh(Double_t ph)
void setErrEnergy(Double_t errenergy)
void setTexpMuon(Double_t texpmu)
void setToffsetProton(Double_t top)
void setSigmaProton(Double_t sp)
void setZrHit(Double_t zrhit)
void setTexpPion(Double_t texppi)
Int_t tofTrackID() const
UInt_t status() const
Double_t sigmaKaon() const
Double_t toffsetElectron() const
void setErrT0(Double_t errt0)
void clearTofTrackCol()
clear the whole array
const TObjArray * getTofTrackCol() const
retrieve the whole TObjArray of TofTrack Data
void addTofTrack(TRecTofTrack *Track)
Add a TofTrack into the TOF Data collection.
static std::map< const TObject *, const RecTofTrack * > m_rootRecTofTrackMap
Definition commonData.h:261
_EXTERN_ std::string Event
Definition EventModel.h:90