BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
RecMdcKalTrackCnv.cxx
Go to the documentation of this file.
1#ifndef RecMdcKalTrackCnv_CXX
2#define RecMdcKalTrackCnv_CXX 1
3
4#include "GaudiKernel/MsgStream.h"
5#include "GaudiKernel/DataObject.h"
6#include "GaudiKernel/ObjectVector.h"
7#include "TClonesArray.h"
8#include "TClonesArray.h"
9#include "Identifier/MdcID.h"
10#include "Identifier/Identifier.h"
11
12#include "EventModel/EventModel.h"
13#include "MdcRecEvent/RecMdcKalTrack.h"
14#include "MdcRecEvent/RecMdcKalHelixSeg.h"
15#include "ReconEvent/ReconEvent.h"
16//#include "RootEventData/TDstEvent.h"
17#include "RootEventData/TRecTrackEvent.h"
18#include "RootEventData/TRecMdcKalTrack.h"
19
20#include "RootCnvSvc/Rec/RecTrackCnv.h"
21#include "RootCnvSvc/Rec/RecMdcKalTrackCnv.h"
22#include "RootCnvSvc/RootAddress.h"
23
24#include <vector>
25
26using namespace std;
27
28// Instantiation of a static factory class used by clients to create
29// instances of this service
30//static CnvFactory<RecMdcKalTrackCnv> s_factory;
31//const ICnvFactory& RecMdcKalTrackCnvFactory = s_factory;
32
34: RootEventBaseCnv(classID(), svc)
35{
36
37 // Here we associate this converter with the /Event path on the TDS.
38 MsgStream log(msgSvc(), "RecMdcKalTrackCnv");
39 //log << MSG::DEBUG << "Constructor called for " << objType() << endreq;
40 //m_rootTreename ="Rec";
41 m_rootBranchname ="m_recMdcKalTrackCol";
42 // declareObject(EventModel::Recon::MdcKalTrackCol, objType(), m_rootTreename, m_rootBranchname);
43 m_adresses.push_back(&m_recMdcKalTrackCol);
44 m_recMdcKalTrackCol = 0;
45}
46
47StatusCode RecMdcKalTrackCnv::TObjectToDataObject(DataObject*& refpObject) {
48 // creation of TDS object from root object
49 MsgStream log(msgSvc(), "RecMdcKalTrackCnv");
50 log << MSG::DEBUG << "RecMdcKalTrackCnv::TObjectToDataObject" << endreq;
51 StatusCode sc = StatusCode::SUCCESS;
52
53 // create the TDS location for the MdcKalTrack Collection
54 RecMdcKalTrackCol* recMdcKalTrackCol = new RecMdcKalTrackCol;
55 refpObject = recMdcKalTrackCol;
56
57 // now convert
58 if (!m_recMdcKalTrackCol) return sc;
59 TIter recMdcKalTrackIter(m_recMdcKalTrackCol);
60
61 IDataProviderSvc* dataSvc = 0;
62 sc = serviceLocator()->getService ("EventDataSvc",
63 IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc);
64 if (!sc.isSuccess()) {
65 log << MSG::FATAL << "Could not get EventDataSvc in RecMdcTrackCnv" << endreq;
66 return( StatusCode::FAILURE);
67 }
68 SmartDataPtr<RecMdcKalHelixSegCol> recMdcKalHelixSegCol(dataSvc,"/Event/Recon/RecMdcKalHelixSegCol");
69 if (!recMdcKalHelixSegCol) {
70 log << MSG::FATAL << "Could not find RecMdcKalHelixSegCol" << endreq;
71 return( StatusCode::FAILURE);
72 }
73
74 TRecMdcKalTrack *recMdcKalTrackRoot = 0;
75 while ((recMdcKalTrackRoot = (TRecMdcKalTrack*)recMdcKalTrackIter.Next())) {
76
77 std::vector<HepVector> zhelixs;
78 std::vector<HepSymMatrix> zerrors;
79 std::vector<HepVector> fhelixs;
80 std::vector<HepSymMatrix> ferrors;
81 std::vector<HepVector> lhelixs;
82 std::vector<HepSymMatrix> lerrors;
83 std::vector<HepPoint3D> pocas;
84 std::vector<HepPoint3D> lpivots;
85 std::vector<HepPoint3D> lpoints;
86
87
88 HepVector zhelix(5);
89 HepSymMatrix zerror(5);
90 HepVector fhelix(5);
91 HepSymMatrix ferror(5);
92 HepVector lhelix(5);
93 HepSymMatrix lerror(5);
94 HepVector thelix(5);
95 HepSymMatrix terror(5);
96 HepPoint3D poca(0,0,0);
97 HepPoint3D lpivot(0,0,0);
98 HepPoint3D lpoint(0,0,0);
99
100
101 HepVector zhelix_e(5);
102 HepSymMatrix zerror_e(5);
103 HepVector fhelix_e(5);
104 HepSymMatrix ferror_e(5);
105 HepVector lhelix_e(5);
106 HepSymMatrix lerror_e(5);
107 HepPoint3D poca_e(0,0,0);
108 HepPoint3D lpivot_e(0,0,0);
109 HepPoint3D lpoint_e(0,0,0);
110
111
112 HepVector zhelix_mu(5);
113 HepSymMatrix zerror_mu(5);
114 HepVector fhelix_mu(5);
115 HepSymMatrix ferror_mu(5);
116 HepVector lhelix_mu(5);
117 HepSymMatrix lerror_mu(5);
118 HepPoint3D poca_mu(0,0,0);
119 HepPoint3D lpivot_mu(0,0,0);
120 HepPoint3D lpoint_mu(0,0,0);
121
122
123 HepVector zhelix_k(5);
124 HepSymMatrix zerror_k(5);
125 HepVector fhelix_k(5);
126 HepSymMatrix ferror_k(5);
127 HepVector lhelix_k(5);
128 HepSymMatrix lerror_k(5);
129 HepPoint3D poca_k(0,0,0);
130 HepPoint3D lpivot_k(0,0,0);
131 HepPoint3D lpoint_k(0,0,0);
132
133
134 HepVector zhelix_p(5);
135 HepSymMatrix zerror_p(5);
136 HepVector fhelix_p(5);
137 HepSymMatrix ferror_p(5);
138 HepVector lhelix_p(5);
139 HepSymMatrix lerror_p(5);
140 HepPoint3D poca_p(0,0,0);
141 HepPoint3D lpivot_p(0,0,0);
142 HepPoint3D lpoint_p(0,0,0);
143
144
145 int stat[2][5];
146 double chisq[2][5];
147 int ndf[2][5];
148
149 double mass[5];
150 double length[5];
151 double tof[5];
152 int nhits[5];
153 int nlayer[5];
154 int trackId;
155 double pathSM[5];
156 double fiTerm[5];
157 //std::cout<<" step 0: "<<std::endl;
158
159
160 RecMdcKalTrack *recMdcKalTrackTds = new RecMdcKalTrack();
161
162 //std::cout<<" step 1: "<<std::endl;
163
164 trackId = recMdcKalTrackRoot->getTrackId();
165 // std::cout<<"track id: "<<trackId<<std::endl;
166 recMdcKalTrackTds->setTrackId(trackId);
167
168 for (int u=0; u<5; u++){
169 mass[u] = recMdcKalTrackRoot->getMass(u);
170 length[u] = recMdcKalTrackRoot->getLength(u);
171 tof[u] = recMdcKalTrackRoot->getTof(u);
172 nhits[u] = recMdcKalTrackRoot->getNhits(u);
173 fiTerm[u]=recMdcKalTrackRoot->getfiTerm(u);
174 pathSM[u]=recMdcKalTrackRoot->getPathSM(u);
175 nlayer[u]=recMdcKalTrackRoot->getNlayer(u);
176
177 recMdcKalTrackTds->setMass(mass[u],u);
178 recMdcKalTrackTds->setLength(length[u],u);
179 recMdcKalTrackTds->setTof(tof[u],u);
180 recMdcKalTrackTds->setNhits(nhits[u],u);
181 recMdcKalTrackTds->setFiTerm(fiTerm[u],u);
182 recMdcKalTrackTds->setPathSM(pathSM[u],u);
183 recMdcKalTrackTds->setNlayer(nlayer[u],u);
184 }
185
186
187 for(int v=0; v<3; v++){
188 poca_e[v] = recMdcKalTrackRoot->getPocaE(v);
189 poca_mu[v] = recMdcKalTrackRoot->getPocaMu(v);
190 poca[v] = recMdcKalTrackRoot->getPoca(v);
191 poca_k[v] = recMdcKalTrackRoot->getPocaK(v);
192 poca_p[v] = recMdcKalTrackRoot->getPocaP(v);
193 lpivot_e[v] = recMdcKalTrackRoot->getLPivotE(v);
194 lpivot_mu[v] = recMdcKalTrackRoot->getLPivotMu(v);
195 lpivot[v] = recMdcKalTrackRoot->getLPivot(v);
196 lpivot_k[v] = recMdcKalTrackRoot->getLPivotK(v);
197 lpivot_p[v] = recMdcKalTrackRoot->getLPivotP(v);
198 lpoint_e[v] = recMdcKalTrackRoot->getLPointE(v);
199 lpoint_mu[v] = recMdcKalTrackRoot->getLPointMu(v);
200 lpoint[v] = recMdcKalTrackRoot->getLPoint(v);
201 lpoint_k[v] = recMdcKalTrackRoot->getLPointK(v);
202 lpoint_p[v] = recMdcKalTrackRoot->getLPointP(v);
203 //std::cout<<"poca_e[v]: "<<setprecision(6)<<poca_e[v]<<std::endl;
204 //std::cout<<"lpoint_e[v]: "<<setprecision(6)<<lpoint_e[v]<<std::endl;
205 //std::cout<<"lpivot_e[v]: "<<setprecision(6)<<lpivot_e[v]<<std::endl;
206
207 }
208
209 for (int i=0, k=0; i<5; i++){
210 zhelix[i] = recMdcKalTrackRoot->getZHelix(i);
211 zhelix_e[i] = recMdcKalTrackRoot->getZHelixE(i);
212 zhelix_mu[i] = recMdcKalTrackRoot->getZHelixMu(i);
213 zhelix_k[i] = recMdcKalTrackRoot->getZHelixK(i);
214 zhelix_p[i] = recMdcKalTrackRoot->getZHelixP(i);
215
216
217 fhelix[i] = recMdcKalTrackRoot->getFHelix(i);
218 fhelix_e[i] = recMdcKalTrackRoot->getFHelixE(i);
219 fhelix_mu[i] = recMdcKalTrackRoot->getFHelixMu(i);
220 fhelix_k[i] = recMdcKalTrackRoot->getFHelixK(i);
221 fhelix_p[i] = recMdcKalTrackRoot->getFHelixP(i);
222
223 lhelix[i] = recMdcKalTrackRoot->getLHelix(i);
224 lhelix_e[i] = recMdcKalTrackRoot->getLHelixE(i);
225 lhelix_mu[i] = recMdcKalTrackRoot->getLHelixMu(i);
226 lhelix_k[i] = recMdcKalTrackRoot->getLHelixK(i);
227 lhelix_p[i] = recMdcKalTrackRoot->getLHelixP(i);
228
229 thelix[i] = recMdcKalTrackRoot->getTHelix(i);
230
231 for (int j=0; j<=i; j++){
232
233 zerror[i][j] = recMdcKalTrackRoot->getZError(i,j);
234 zerror_e[i][j] = recMdcKalTrackRoot->getZErrorE(i,j);
235 zerror_mu[i][j] = recMdcKalTrackRoot->getZErrorMu(i,j);
236 zerror_k[i][j] = recMdcKalTrackRoot->getZErrorK(i,j);
237 zerror_p[i][j] = recMdcKalTrackRoot->getZErrorP(i,j);
238 zerror[j][i] = zerror[i][j];
239 zerror_e[j][i] = zerror_e[i][j];
240 zerror_mu[j][i] = zerror_mu[i][j];
241 zerror_k[j][i] = zerror_k[i][j];
242 zerror_p[j][i] = zerror_p[i][j];
243
244 ferror[i][j] = recMdcKalTrackRoot->getFError(i,j);
245 ferror_e[i][j] = recMdcKalTrackRoot->getFErrorE(i,j);
246 ferror_mu[i][j] = recMdcKalTrackRoot->getFErrorMu(i,j);
247 ferror_k[i][j] = recMdcKalTrackRoot->getFErrorK(i,j);
248 ferror_p[i][j] = recMdcKalTrackRoot->getFErrorP(i,j);
249 ferror[j][i] = ferror[i][j];
250 ferror_e[j][i] = ferror_e[i][j];
251 ferror_mu[j][i] = ferror_mu[i][j];
252 ferror_k[j][i] = ferror_k[i][j];
253 ferror_p[j][i] = ferror_p[i][j];
254
255 lerror[i][j] = recMdcKalTrackRoot->getLError(i,j);
256 lerror_e[i][j] = recMdcKalTrackRoot->getLErrorE(i,j);
257 lerror_mu[i][j] = recMdcKalTrackRoot->getLErrorMu(i,j);
258 lerror_k[i][j] = recMdcKalTrackRoot->getLErrorK(i,j);
259 lerror_p[i][j] = recMdcKalTrackRoot->getLErrorP(i,j);
260 lerror[j][i] = lerror[i][j];
261 lerror_e[j][i] = lerror_e[i][j];
262 lerror_mu[j][i] = lerror_mu[i][j];
263 lerror_k[j][i] = lerror_k[i][j];
264 lerror_p[j][i] = lerror_p[i][j];
265
266 terror[i][j] = recMdcKalTrackRoot->getTError(k++);
267 terror[j][i] = terror[i][j];
268
269 }
270 }
271
272 //std::cout<<" step 2: "<<std::endl;
273
274 //std::cout<<"T to rec tds: "<<endl;
275 //std::cout<<"lpoint_e: "<<lpoint_e<<std::endl;
276 //std::cout<<"lpivot_e: "<<lpivot_e<<std::endl;
277 /// for zero point
278 zhelixs.push_back(zhelix_e);
279 zhelixs.push_back(zhelix_mu);
280 zhelixs.push_back(zhelix);
281 zhelixs.push_back(zhelix_k);
282 zhelixs.push_back(zhelix_p);
283 zerrors.push_back(zerror_e);
284 zerrors.push_back(zerror_mu);
285 zerrors.push_back(zerror);
286 zerrors.push_back(zerror_k);
287 zerrors.push_back(zerror_p);
288 /// first hit point
289 fhelixs.push_back(fhelix_e);
290 fhelixs.push_back(fhelix_mu);
291 fhelixs.push_back(fhelix);
292 fhelixs.push_back(fhelix_k);
293 fhelixs.push_back(fhelix_p);
294 ferrors.push_back(ferror_e);
295 ferrors.push_back(ferror_mu);
296 ferrors.push_back(ferror);
297 ferrors.push_back(ferror_k);
298 ferrors.push_back(ferror_p);
299 /// last hit point
300 lhelixs.push_back(lhelix_e);
301 lhelixs.push_back(lhelix_mu);
302 lhelixs.push_back(lhelix);
303 lhelixs.push_back(lhelix_k);
304 lhelixs.push_back(lhelix_p);
305 lerrors.push_back(lerror_e);
306 lerrors.push_back(lerror_mu);
307 lerrors.push_back(lerror);
308 lerrors.push_back(lerror_k);
309 lerrors.push_back(lerror_p);
310 /// track finding helix for dE/dx usage
311
312 pocas.push_back(poca_e);
313 pocas.push_back(poca_mu);
314 pocas.push_back(poca);
315 pocas.push_back(poca_k);
316 pocas.push_back(poca_p);
317 lpivots.push_back(lpivot_e);
318 lpivots.push_back(lpivot_mu);
319 lpivots.push_back(lpivot);
320 lpivots.push_back(lpivot_k);
321 lpivots.push_back(lpivot_p);
322 lpoints.push_back(lpoint_e);
323 lpoints.push_back(lpoint_mu);
324 lpoints.push_back(lpoint);
325 lpoints.push_back(lpoint_k);
326 lpoints.push_back(lpoint_p);
327
328 for(int m=0; m<5; m++){
329 int charge;
330 double pxy(0.),px(0.),py(0.),pz(0.),ptot(0.),dr(0.),phi0(0.),kappa(0.),dz(0.),tanl(0.),x(0.),y(0.),z(0.),vx0(0.),vy0(0.),vz0(0.);
331 dr = zhelixs[m][0];
332 phi0 = zhelixs[m][1];
333 kappa = zhelixs[m][2];
334 dz = zhelixs[m][3];
335 tanl = zhelixs[m][4];
336
337 // x = pocas[m][0];
338 // y = pocas[m][1];
339 // z = pocas[m][2];
340 x = dr * cos(phi0);
341 y = dr * sin(phi0);
342 z = dz;
343 // std::cout<<"x: "<<x<<"y: "<<y<<"z: "<<z<<std::endl;
344
345 if (kappa > 0.0000000001)
346 charge = 1;
347 else if (kappa < -0.0000000001)
348 charge = -1;
349 else
350 charge = 0;
351
352 if(kappa!=0) pxy = 1.0/fabs(kappa);
353 else pxy = 0;
354
355 px = pxy * (-sin(phi0));
356 py = pxy * cos(phi0);
357 pz = pxy * tanl;
358 ptot = sqrt(px*px+py*py+pz*pz);
359 // cout<<"x, y, z, charge, px, py, pz, ptot: "<<x<<" , "<<y<<" , "<<z<<" , "<<charge<<" , "<<px<<" , "<<py<<" , "<<pz<<" , "<<ptot<<endl;
360 recMdcKalTrackTds->setCharge(charge,m);
361 recMdcKalTrackTds->setPxy(pxy,m);
362 recMdcKalTrackTds->setPx(px,m);
363 recMdcKalTrackTds->setPy(py,m);
364 recMdcKalTrackTds->setPz(pz,m);
365 recMdcKalTrackTds->setP(ptot,m);
366 recMdcKalTrackTds->setTheta(acos(pz/ptot),m);
367 recMdcKalTrackTds->setPhi(atan2(py,px),m);
368 recMdcKalTrackTds->setX(x,m);
369 recMdcKalTrackTds->setY(y,m);
370 recMdcKalTrackTds->setZ(z,m);
371 recMdcKalTrackTds->setR(sqrt(x*x+y*y),m);
372 /// the next three function need more consideration, temporarily
373
374 for(int n=0; n<2; n++){
375 int stat = recMdcKalTrackRoot->getStat(n,m);
376 int chisq = recMdcKalTrackRoot->getChisq(n,m);
377 int ndf = recMdcKalTrackRoot->getNdf(n,m);
378 recMdcKalTrackTds->setStat(stat,n,m);
379 recMdcKalTrackTds->setChisq(chisq,n,m);
380 recMdcKalTrackTds->setNdf(ndf,n,m);
381 }
382 }
383
384 //std::cout<<" step 3: "<<std::endl;
385
386
387
388 for(int jj=0; jj<5; jj++){
389 //std::cout<<" step 3.0: "<<std::endl;
390 //std::cout<<"zhelixs[jj]: "<<zhelixs[jj]<<std::endl;
391
392 recMdcKalTrackTds->setZHelix(zhelixs[jj],jj);
393 //std::cout<<" step 3.1: "<<std::endl;
394
395 recMdcKalTrackTds->setZError(zerrors[jj],jj);
396 recMdcKalTrackTds->setFHelix(fhelixs[jj],jj);
397 recMdcKalTrackTds->setFError(ferrors[jj],jj);
398 //std::cout<<" step 3.5: "<<std::endl;
399
400 recMdcKalTrackTds->setLHelix(lhelixs[jj],jj);
401 recMdcKalTrackTds->setLError(lerrors[jj],jj);
402 recMdcKalTrackTds->setPoca(pocas[jj],jj);
403
404
405 recMdcKalTrackTds->setLPoint(lpoints[jj],jj);
406 recMdcKalTrackTds->setLPivot(lpivots[jj],jj);
407 }
408 recMdcKalTrackTds->setTHelix(thelix);
409 recMdcKalTrackTds->setTError(terror);
410
411 //std::cout<<" step 4: "<<std::endl;
412
413
414 log<<MSG::DEBUG<<"T to REC TDS, zhelix: "<<zhelix<<endreq;
415 log<<MSG::DEBUG<<"T to REC TDS, zerror: "<<zerror<<endreq;
416
417 m_common.m_rootRecMdcKalTrackMap[recMdcKalTrackRoot] = recMdcKalTrackTds;
418
419 int nSegTot=0;
420 for(int i=0; i<5; i++) {
421 HelixSegRefVec theKalHelixSegRefVec;
422
423 int nSeg=recMdcKalTrackRoot->getNseg(i);
424 int iSeg=0;
425 RecMdcKalHelixSegCol::iterator iter = recMdcKalHelixSegCol->begin();
426 for (;iter != recMdcKalHelixSegCol->end(); iter++){
427
428 //cout<<" (*iter)->getTrkId(): "<<(*iter)->getTrkId()<<endl;
429 if((*iter)->getTrackId() == trackId){
430 if(iSeg>=nSegTot&&iSeg<nSeg+nSegTot) {
431 SmartRef<RecMdcKalHelixSeg> refhit(*iter);
432 theKalHelixSegRefVec.push_back(refhit);
433 }
434 iSeg++;
435 }
436 }
437 nSegTot+=nSeg;
438
439 recMdcKalTrackTds->setVecHelixSegs(theKalHelixSegRefVec,i);
440 }
441
442 int nhelixsegs = recMdcKalTrackTds->getVecHelixSegs().size();
443
444 //std::cout<<" mdc hits: "<<nhelixsegs<< std::endl;
445
446 for(int ii=0; ii <nhelixsegs ; ii++){
447
448 //cout<<"ddl: "<<(recMdcTrack->getVecKalHelixSegs()[ii])->getDriftDistLeft()<<endl;
449 //cout<<"erddl: "<<(recMdcTrack->getVecKalHelixSegs()[ii])->getErrDriftDistLeft()<<endl;
450 Identifier id(recMdcKalTrackTds->getVecHelixSegs()[ii]->getMdcId());
451 int layer = MdcID::layer(id);
452 int wire = MdcID::wire(id);
453 //cout<<"layer: "<<layer<<" wire: "<<wire<<endl;
454 }
455
456 recMdcKalTrackCol->push_back(recMdcKalTrackTds);
457
458 }
459
460 delete m_recMdcKalTrackCol;
461
462 m_recMdcKalTrackCol = 0;
463
464 return StatusCode::SUCCESS;
465}
466
467
468StatusCode RecMdcKalTrackCnv::DataObjectToTObject(DataObject* obj,RootAddress* rootaddr) {
469
470
471 MsgStream log(msgSvc(), "RecMdcKalTrackCnv");
472 log << MSG::DEBUG << "RecMdcKalTrackCnv::DataObjectToTObject" << endreq;
473 StatusCode sc=StatusCode::SUCCESS;
474
475 RecMdcKalTrackCol * mdcKalTrackColTds=dynamic_cast<RecMdcKalTrackCol *> (obj);
476 if (!mdcKalTrackColTds) {
477 log << MSG::ERROR << "Could not downcast to RecMdcKalTrackCol" << endreq;
478 return StatusCode::FAILURE;
479 }
480
481 DataObject *evt;
482 m_eds->findObject(EventModel::Recon::Event,evt);
483 if (evt==NULL) {
484 log << MSG::ERROR << "Could not get ReconEvent in TDS " << endreq;
485 return StatusCode::FAILURE;
486 }
487
488 ReconEvent * devtTds=dynamic_cast<ReconEvent *> (evt);
489 if (!devtTds) {
490 log << MSG::ERROR << "MdcKalTrackCnv:Could not downcast to TDS Recon Event" << endreq;
491 }
492 IOpaqueAddress *addr;
493
494 m_cnvSvc->getRecTrackCnv()->createRep(evt,addr);
496
497 const TObjArray *m_recMdcKalTrackCol = recEvt->getRecMdcKalTrackCol();
498
499 if (!m_recMdcKalTrackCol) return sc;
500
501 recEvt->clearRecMdcKalTrackCol(); //necessary in case there is I/O at the same time since array is static
502 RecMdcKalTrackCol::const_iterator mdcKalTrackTds;
503
504 for (mdcKalTrackTds = mdcKalTrackColTds->begin(); mdcKalTrackTds != mdcKalTrackColTds->end(); mdcKalTrackTds++) {
505
506 // Get Data from TDS
507 // root data
508 Int_t trackId;
509 Double_t mass[5];
510 Double_t length[5];
511 Double_t tof[5];
512 Int_t nhits[5];
513 Int_t nlayer[5];
514 Int_t stat[2][5];
515 Double_t chisq[2][5];
516 Int_t ndf[2][5];
517 Int_t nSeg[5];
518 Double_t fiTerm[5];
519 Double_t pathSM[5];
520
521 Double_t poca_e[3];
522 Double_t poca_mu[3];
523 Double_t poca[3];
524 Double_t poca_k[3];
525 Double_t poca_p[3];
526
527 Double_t zhelix[5];
528 Double_t zerror[5][5];
529 Double_t zhelix_e[5];
530 Double_t zerror_e[5][5];
531 Double_t zhelix_mu[5];
532 Double_t zerror_mu[5][5];
533 Double_t zhelix_k[5];
534 Double_t zerror_k[5][5];
535 Double_t zhelix_p[5];
536 Double_t zerror_p[5][5];
537
538 Double_t fhelix[5];
539 Double_t ferror[5][5];
540 Double_t fhelix_e[5];
541 Double_t ferror_e[5][5];
542 Double_t fhelix_mu[5];
543 Double_t ferror_mu[5][5];
544 Double_t fhelix_k[5];
545 Double_t ferror_k[5][5];
546 Double_t fhelix_p[5];
547 Double_t ferror_p[5][5];
548
549 Double_t lhelix[5];
550 Double_t lerror[5][5];
551 Double_t lhelix_e[5];
552 Double_t lerror_e[5][5];
553 Double_t lhelix_mu[5];
554 Double_t lerror_mu[5][5];
555 Double_t lhelix_k[5];
556 Double_t lerror_k[5][5];
557 Double_t lhelix_p[5];
558 Double_t lerror_p[5][5];
559
560 Double_t thelix[5];
561 Double_t terror[15];
562
563 Double_t lpoint_e[3];
564 Double_t lpoint_mu[3];
565 Double_t lpoint[3];
566 Double_t lpoint_k[3];
567 Double_t lpoint_p[3];
568
569 Double_t lpivot_e[3];
570 Double_t lpivot_mu[3];
571 Double_t lpivot[3];
572 Double_t lpivot_k[3];
573 Double_t lpivot_p[3];
574
575 TRecMdcKalTrack *mdcKalTrackRoot = new TRecMdcKalTrack();
576
577 trackId = (*mdcKalTrackTds)->getTrackId();
578 for (Int_t i = 0 ; i < 5 ; i++){
579 mass[i] = (*mdcKalTrackTds)->getMass(i);
580 length[i] = (*mdcKalTrackTds)->getLength(i);
581 tof[i] = (*mdcKalTrackTds)->getTof(i);
582 nhits[i] = (*mdcKalTrackTds)->getNhits(i);
583 nlayer[i] = (*mdcKalTrackTds)->getNlayer(i);
584 fiTerm[i]=(*mdcKalTrackTds)->getFiTerm(i);
585 pathSM[i]=(*mdcKalTrackTds)->getPathSM(i);
586 //stat[i] = (*mdcKalTrackTds)->getStat(i);
587 nSeg[i]=((*mdcKalTrackTds)->getVecHelixSegs(i)).size();
588 mdcKalTrackRoot->setNseg(nSeg[i],i);
589 mdcKalTrackRoot->setNlayer(nlayer[i],i);
590 for (Int_t j = 0 ; j< 2 ; j++){
591 stat[j][i] = (*mdcKalTrackTds)->getStat(j,i);
592 chisq[j][i] = (*mdcKalTrackTds)->getChisq(j,i);
593 ndf[j][i] = (*mdcKalTrackTds)->getNdf(j,i);
594 mdcKalTrackRoot->setStat(stat[j][i],j,i);
595 mdcKalTrackRoot->setChisq(chisq[j][i],j,i);
596 mdcKalTrackRoot->setNdf(ndf[j][i],j,i);
597 }
598 }
599 for(Int_t i=0;i<5;i++){
600 log<<MSG::INFO<<" recMdcKalTrack.helix("<<i<<"): "<<(*mdcKalTrackTds)->getTHelix(i)<<endreq;
601 thelix[i] = (*mdcKalTrackTds)->getTHelix(i);
602 }
603 for(Int_t i=0; i<15; i++){
604 terror[i] = (*mdcKalTrackTds)->getTError(i);
605 }
606 HepPoint3D h_poca_e = (*mdcKalTrackTds)->getPocaE();
607 HepPoint3D h_poca_mu = (*mdcKalTrackTds)->getPocaMu();
608 HepPoint3D h_poca = (*mdcKalTrackTds)->getPoca();
609 HepPoint3D h_poca_k = (*mdcKalTrackTds)->getPocaK();
610 HepPoint3D h_poca_p = (*mdcKalTrackTds)->getPocaP();
611 HepPoint3D h_lpoint_e = (*mdcKalTrackTds)->getLPointE();
612 HepPoint3D h_lpoint_mu = (*mdcKalTrackTds)->getLPointMu();
613 HepPoint3D h_lpoint = (*mdcKalTrackTds)->getLPoint();
614 HepPoint3D h_lpoint_k = (*mdcKalTrackTds)->getLPointK();
615 HepPoint3D h_lpoint_p = (*mdcKalTrackTds)->getLPointP();
616 HepPoint3D h_lpivot_e = (*mdcKalTrackTds)->getLPivotE();
617 HepPoint3D h_lpivot_mu = (*mdcKalTrackTds)->getLPivotMu();
618 HepPoint3D h_lpivot = (*mdcKalTrackTds)->getLPivot();
619 HepPoint3D h_lpivot_k = (*mdcKalTrackTds)->getLPivotK();
620 HepPoint3D h_lpivot_p = (*mdcKalTrackTds)->getLPivotP();
621
622 //std::cout<<" h_poca_mu: "<<h_poca_mu<<std::endl;
623 //std::cout<<" h_poca: "<<h_poca<<std::endl;
624 //std::cout<<" h_poca_k: "<<h_poca_k<<std::endl;
625 //std::cout<<" h_poca_p: "<<h_poca_p<<std::endl;
626
627
628 HepVector h_zhelix = (*mdcKalTrackTds)->getZHelix();
629 HepSymMatrix h_zerror = (*mdcKalTrackTds)->getZError();
630 HepVector h_zhelix_e = (*mdcKalTrackTds)->getZHelixE();
631 HepSymMatrix h_zerror_e = (*mdcKalTrackTds)->getZErrorE();
632 HepVector h_zhelix_mu = (*mdcKalTrackTds)->getZHelixMu();
633 HepSymMatrix h_zerror_mu= (*mdcKalTrackTds)->getZErrorMu();
634 HepVector h_zhelix_k = (*mdcKalTrackTds)->getZHelixK();
635 HepSymMatrix h_zerror_k = (*mdcKalTrackTds)->getZErrorK();
636 HepVector h_zhelix_p = (*mdcKalTrackTds)->getZHelixP();
637 HepSymMatrix h_zerror_p = (*mdcKalTrackTds)->getZErrorP();
638
639 HepVector h_fhelix = (*mdcKalTrackTds)->getFHelix();
640 HepSymMatrix h_ferror = (*mdcKalTrackTds)->getFError();
641 HepVector h_fhelix_e = (*mdcKalTrackTds)->getFHelixE();
642 HepSymMatrix h_ferror_e = (*mdcKalTrackTds)->getFErrorE();
643 HepVector h_fhelix_mu = (*mdcKalTrackTds)->getFHelixMu();
644 HepSymMatrix h_ferror_mu= (*mdcKalTrackTds)->getFErrorMu();
645 HepVector h_fhelix_k = (*mdcKalTrackTds)->getFHelixK();
646 HepSymMatrix h_ferror_k = (*mdcKalTrackTds)->getFErrorK();
647 HepVector h_fhelix_p = (*mdcKalTrackTds)->getFHelixP();
648 HepSymMatrix h_ferror_p = (*mdcKalTrackTds)->getFErrorP();
649
650 HepVector h_lhelix = (*mdcKalTrackTds)->getLHelix();
651 HepSymMatrix h_lerror = (*mdcKalTrackTds)->getLError();
652 HepVector h_lhelix_e = (*mdcKalTrackTds)->getLHelixE();
653 HepSymMatrix h_lerror_e = (*mdcKalTrackTds)->getLErrorE();
654 HepVector h_lhelix_mu = (*mdcKalTrackTds)->getLHelixMu();
655 HepSymMatrix h_lerror_mu= (*mdcKalTrackTds)->getLErrorMu();
656 HepVector h_lhelix_k = (*mdcKalTrackTds)->getLHelixK();
657 HepSymMatrix h_lerror_k = (*mdcKalTrackTds)->getLErrorK();
658 HepVector h_lhelix_p = (*mdcKalTrackTds)->getLHelixP();
659 HepSymMatrix h_lerror_p = (*mdcKalTrackTds)->getLErrorP();
660
661 mdcKalTrackRoot->setTrackId(trackId);
662 mdcKalTrackRoot->setMass(mass);
663 mdcKalTrackRoot->setLength(length);
664 mdcKalTrackRoot->setTof(tof);
665 mdcKalTrackRoot->setNhits(nhits);
666 mdcKalTrackRoot->setFiTerm(fiTerm);
667 mdcKalTrackRoot->setPathSM(pathSM);
668 // mdcKalTrackRoot->setStat(stat);
669
670 for(int s=0; s<3; s++){
671 poca_e[s] = h_poca_e[s];
672 poca_mu[s] = h_poca_mu[s];
673 poca[s] = h_poca[s];
674 poca_k[s] = h_poca_k[s];
675 poca_p[s] = h_poca_p[s];
676 lpoint_e[s] = h_lpoint_e[s];
677 lpoint_mu[s] = h_lpoint_mu[s];
678 lpoint[s] = h_lpoint[s];
679 lpoint_k[s] = h_lpoint_k[s];
680 lpoint_p[s] = h_lpoint_p[s];
681 lpivot_e[s] = h_lpivot_e[s];
682 lpivot_mu[s] = h_lpivot_mu[s];
683 lpivot[s] = h_lpivot[s];
684 lpivot_k[s] = h_lpivot_k[s];
685 lpivot_p[s] = h_lpivot_p[s];
686 }
687
688 for (int i=0; i<5; i++){
689 zhelix[i] = h_zhelix[i];
690 zhelix_e[i] = h_zhelix_e[i];
691 zhelix_mu[i] = h_zhelix_mu[i];
692 zhelix_p[i] = h_zhelix_p[i];
693 zhelix_k[i] = h_zhelix_k[i];
694
695 fhelix[i] = h_fhelix[i];
696 fhelix_e[i] = h_fhelix_e[i];
697 fhelix_mu[i] = h_fhelix_mu[i];
698 fhelix_p[i] = h_fhelix_p[i];
699 fhelix_k[i] = h_fhelix_k[i];
700
701 lhelix[i] = h_lhelix[i];
702 lhelix_e[i] = h_lhelix_e[i];
703 lhelix_mu[i] = h_lhelix_mu[i];
704 lhelix_p[i] = h_lhelix_p[i];
705 lhelix_k[i] = h_lhelix_k[i];
706
707 for (int j=0; j<=i; j++){
708 zerror[i][j] = h_zerror[i][j];
709 zerror_e[i][j] = h_zerror_e[i][j];
710 zerror_mu[i][j] = h_zerror_mu[i][j];
711 zerror_p[i][j] = h_zerror_p[i][j];
712 zerror_k[i][j] = h_zerror_k[i][j];
713
714
715 ferror[i][j] = h_ferror[i][j];
716 ferror_e[i][j] = h_ferror_e[i][j];
717 ferror_mu[i][j] = h_ferror_mu[i][j];
718 ferror_p[i][j] = h_ferror_p[i][j];
719 ferror_k[i][j] = h_ferror_k[i][j];
720
721
722 lerror[i][j] = h_lerror[i][j];
723 lerror_e[i][j] = h_lerror_e[i][j];
724 lerror_mu[i][j] = h_lerror_mu[i][j];
725 lerror_p[i][j] = h_lerror_p[i][j];
726 lerror_k[i][j] = h_lerror_k[i][j];
727
728 zerror[j][i] = h_zerror[i][j];
729 zerror_e[j][i] = h_zerror_e[i][j];
730 zerror_mu[j][i] = h_zerror_mu[i][j];
731 zerror_p[j][i] = h_zerror_p[i][j];
732 zerror_k[j][i] = h_zerror_k[i][j];
733
734
735 ferror[j][i] = h_ferror[i][j];
736 ferror_e[j][i] = h_ferror_e[i][j];
737 ferror_mu[j][i] = h_ferror_mu[i][j];
738 ferror_p[j][i] = h_ferror_p[i][j];
739 ferror_k[j][i] = h_ferror_k[i][j];
740
741
742 lerror[j][i] = h_lerror[i][j];
743 lerror_e[j][i] = h_lerror_e[i][j];
744 lerror_mu[j][i] = h_lerror_mu[i][j];
745 lerror_p[j][i] = h_lerror_p[i][j];
746 lerror_k[j][i] = h_lerror_k[i][j];
747
748 }
749 }
750
751 mdcKalTrackRoot->setZHelix(zhelix);
752 mdcKalTrackRoot->setZError(zerror);
753 for(int k=0; k<5; k++){
754 log<<MSG::INFO<<" RecMdcKalTrackRoot.ZHelix "<<"["<<k<<"]"
755 <<mdcKalTrackRoot->getZHelix(k)<<endreq;
756 }
757 mdcKalTrackRoot->setZHelixE(zhelix_e);
758 mdcKalTrackRoot->setZErrorE(zerror_e);
759 mdcKalTrackRoot->setZHelixMu(zhelix_mu);
760 mdcKalTrackRoot->setZErrorMu(zerror_mu);
761 mdcKalTrackRoot->setZHelixK(zhelix_k);
762 mdcKalTrackRoot->setZErrorK(zerror_k);
763 mdcKalTrackRoot->setZHelixP(zhelix_p);
764 mdcKalTrackRoot->setZErrorP(zerror_p);
765 mdcKalTrackRoot->setFHelix(fhelix);
766 mdcKalTrackRoot->setFError(ferror);
767 mdcKalTrackRoot->setFHelixE(fhelix_e);
768 mdcKalTrackRoot->setFErrorE(ferror_e);
769 mdcKalTrackRoot->setFHelixMu(fhelix_mu);
770 mdcKalTrackRoot->setFErrorMu(ferror_mu);
771 mdcKalTrackRoot->setFHelixK(fhelix_k);
772 mdcKalTrackRoot->setFErrorK(ferror_k);
773 mdcKalTrackRoot->setFHelixP(fhelix_p);
774 mdcKalTrackRoot->setFErrorP(ferror_p);
775
776 mdcKalTrackRoot->setLHelix(lhelix);
777 mdcKalTrackRoot->setLError(lerror);
778 mdcKalTrackRoot->setLHelixE(lhelix_e);
779 mdcKalTrackRoot->setLErrorE(lerror_e);
780 mdcKalTrackRoot->setLHelixMu(lhelix_mu);
781 mdcKalTrackRoot->setLErrorMu(lerror_mu);
782 mdcKalTrackRoot->setLHelixK(lhelix_k);
783 mdcKalTrackRoot->setLErrorK(lerror_k);
784 mdcKalTrackRoot->setLHelixP(lhelix_p);
785 mdcKalTrackRoot->setLErrorP(lerror_p);
786
787 mdcKalTrackRoot->setTHelix(thelix);
788 mdcKalTrackRoot->setTError(terror);
789
790 mdcKalTrackRoot->setPocaE(poca_e);
791 mdcKalTrackRoot->setPocaMu(poca_mu);
792 mdcKalTrackRoot->setPoca(poca);
793 mdcKalTrackRoot->setPocaK(poca_k);
794 mdcKalTrackRoot->setPocaP(poca_p);
795
796 mdcKalTrackRoot->setLPointE(lpoint_e);
797 mdcKalTrackRoot->setLPointMu(lpoint_mu);
798 mdcKalTrackRoot->setLPoint(lpoint);
799 mdcKalTrackRoot->setLPointK(lpoint_k);
800 mdcKalTrackRoot->setLPointP(lpoint_p);
801
802 mdcKalTrackRoot->setLPivotE(lpivot_e);
803 mdcKalTrackRoot->setLPivotMu(lpivot_mu);
804 mdcKalTrackRoot->setLPivot(lpivot);
805 mdcKalTrackRoot->setLPivotK(lpivot_k);
806 mdcKalTrackRoot->setLPivotP(lpivot_p);
807 //std::cout<<" mdcKalTrackRoot->getPivotE(1): "<<mdcKalTrackRoot->getLPivotE(1)<<std::endl;
808
809 recEvt->addRecMdcKalTrack(mdcKalTrackRoot);
810 }
811
812
813 return StatusCode::SUCCESS;
814}
815#endif
double mass
const Int_t n
Double_t x[10]
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
XmlRpcServer s
Definition: HelloServer.cpp:11
double sin(const BesAngle a)
double cos(const BesAngle a)
SmartRefVector< RecMdcKalHelixSeg > HelixSegRefVec
ObjectVector< RecMdcKalTrack > RecMdcKalTrackCol
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35
void setFHelix(const HepVector &fhelix, const int pid)
void setPhi(const double phi, const int pid)
void setZError(const HepSymMatrix &error, const int pid)
void setPoca(const HepPoint3D &poca, const int pid)
void setTheta(const double theta, const int pid)
void setPxy(const double pxy, const int pid)
void setFError(const HepSymMatrix &ferror, const int pid)
void setZHelix(const HepVector &helix, const int pid)
void setCharge(const int charge, const int pid)
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
Definition: MdcID.cxx:49
static int wire(const Identifier &id)
Definition: MdcID.cxx:54
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
RecMdcKalTrackCnv(ISvcLocator *svc)
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
void setLHelix(const HepVector &helix, const int pid)
HelixSegRefVec getVecHelixSegs(int pid=-1) const
void setVecHelixSegs(const HelixSegRefVec &vechelixsegs, int pid=-1)
void setLError(const HepSymMatrix &error, const int pid)
void setLPoint(const HepPoint3D &point, const int pid)
void setLPivot(const HepPoint3D &pivot, const int pid)
static TRecTrackEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition of a Root address, derived from IOpaqueAddress.
IDataProviderSvc * m_eds
pointer to eventdataservice
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void addRecMdcKalTrack(TRecMdcKalTrack *Track)
static std::map< const TObject *, const RecMdcKalTrack * > m_rootRecMdcKalTrackMap