CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
bak_RootCnvSvc-04-01-14/src/Rec/RecCgemKalTrackCnv.cxx
Go to the documentation of this file.
1#ifndef RecCgemKalTrackCnv_CXX
2#define RecCgemKalTrackCnv_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/CgemID.h"
10#include "Identifier/Identifier.h"
11
12#include "EventModel/EventModel.h"
13#include "CgemRecEvent/RecCgemKalTrack.h"
14#include "CgemRecEvent/RecCgemKalHelixSeg.h"
15#include "ReconEvent/ReconEvent.h"
16//#include "RootEventData/TDstEvent.h"
17#include "RootEventData/TRecTrackEvent.h"
18#include "RootEventData/TRecCgemKalTrack.h"
19
20#include "RootCnvSvc/Rec/RecTrackCnv.h"
21#include "RootCnvSvc/Rec/RecCgemKalTrackCnv.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<RecCgemKalTrackCnv> s_factory;
31//const ICnvFactory& RecCgemKalTrackCnvFactory = 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(), "RecCgemKalTrackCnv");
39 //log << MSG::DEBUG << "Constructor called for " << objType() << endreq;
40 //m_rootTreename ="Rec";
41 m_rootBranchname ="m_recCgemKalTrackCol";
42 // declareObject(EventModel::Recon::CgemKalTrackCol, objType(), m_rootTreename, m_rootBranchname);
43 m_adresses.push_back(&m_recCgemKalTrackCol);
44 m_recCgemKalTrackCol = 0;
45}
46
47StatusCode RecCgemKalTrackCnv::TObjectToDataObject(DataObject*& refpObject) {
48 // creation of TDS object from root object
49 MsgStream log(msgSvc(), "RecCgemKalTrackCnv");
50 log << MSG::DEBUG << "RecCgemKalTrackCnv::TObjectToDataObject" << endreq;
51 StatusCode sc = StatusCode::SUCCESS;
52
53 // create the TDS location for the CgemKalTrack Collection
54 RecCgemKalTrackCol* recCgemKalTrackCol = new RecCgemKalTrackCol;
55 refpObject = recCgemKalTrackCol;
56
57 // now convert
58 if (!m_recCgemKalTrackCol) return sc;
59 TIter recCgemKalTrackIter(m_recCgemKalTrackCol);
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 RecCgemTrackCnv" << endreq;
66 return( StatusCode::FAILURE);
67 }
68 SmartDataPtr<RecCgemKalHelixSegCol> recCgemKalHelixSegCol(dataSvc,"/Event/Recon/RecCgemKalHelixSegCol");
69 if (!recCgemKalHelixSegCol) {
70 log << MSG::FATAL << "Could not find RecCgemKalHelixSegCol" << endreq;
71 return( StatusCode::FAILURE);
72 }
73
74 TRecCgemKalTrack *recCgemKalTrackRoot = 0;
75 while ((recCgemKalTrackRoot = (TRecCgemKalTrack*)recCgemKalTrackIter.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 trackId;
154 double pathSM[5];
155 double fiTerm[5];
156 //std::cout<<" step 0: "<<std::endl;
157
158
159 RecCgemKalTrack *recCgemKalTrackTds = new RecCgemKalTrack();
160
161 //std::cout<<" step 1: "<<std::endl;
162
163 trackId = recCgemKalTrackRoot->getTrackId();
164 // std::cout<<"track id: "<<trackId<<std::endl;
165 recCgemKalTrackTds->setTrackId(trackId);
166
167 for (int u=0; u<5; u++){
168 mass[u] = recCgemKalTrackRoot->getMass(u);
169 length[u] = recCgemKalTrackRoot->getLength(u);
170 tof[u] = recCgemKalTrackRoot->getTof(u);
171 nhits[u] = recCgemKalTrackRoot->getNhits(u);
172 fiTerm[u]=recCgemKalTrackRoot->getfiTerm(u);
173 pathSM[u]=recCgemKalTrackRoot->getPathSM(u);
174
175 recCgemKalTrackTds->setMass(mass[u],u);
176 recCgemKalTrackTds->setLength(length[u],u);
177 recCgemKalTrackTds->setTof(tof[u],u);
178 recCgemKalTrackTds->setNhits(nhits[u],u);
179 recCgemKalTrackTds->setFiTerm(fiTerm[u],u);
180 recCgemKalTrackTds->setPathSM(pathSM[u],u);
181 }
182
183
184 for(int v=0; v<3; v++){
185 poca_e[v] = recCgemKalTrackRoot->getPocaE(v);
186 poca_mu[v] = recCgemKalTrackRoot->getPocaMu(v);
187 poca[v] = recCgemKalTrackRoot->getPoca(v);
188 poca_k[v] = recCgemKalTrackRoot->getPocaK(v);
189 poca_p[v] = recCgemKalTrackRoot->getPocaP(v);
190 lpivot_e[v] = recCgemKalTrackRoot->getLPivotE(v);
191 lpivot_mu[v] = recCgemKalTrackRoot->getLPivotMu(v);
192 lpivot[v] = recCgemKalTrackRoot->getLPivot(v);
193 lpivot_k[v] = recCgemKalTrackRoot->getLPivotK(v);
194 lpivot_p[v] = recCgemKalTrackRoot->getLPivotP(v);
195 lpoint_e[v] = recCgemKalTrackRoot->getLPointE(v);
196 lpoint_mu[v] = recCgemKalTrackRoot->getLPointMu(v);
197 lpoint[v] = recCgemKalTrackRoot->getLPoint(v);
198 lpoint_k[v] = recCgemKalTrackRoot->getLPointK(v);
199 lpoint_p[v] = recCgemKalTrackRoot->getLPointP(v);
200 //std::cout<<"poca_e[v]: "<<setprecision(6)<<poca_e[v]<<std::endl;
201 //std::cout<<"lpoint_e[v]: "<<setprecision(6)<<lpoint_e[v]<<std::endl;
202 //std::cout<<"lpivot_e[v]: "<<setprecision(6)<<lpivot_e[v]<<std::endl;
203
204 }
205
206 for (int i=0, k=0; i<5; i++){
207 zhelix[i] = recCgemKalTrackRoot->getZHelix(i);
208 zhelix_e[i] = recCgemKalTrackRoot->getZHelixE(i);
209 zhelix_mu[i] = recCgemKalTrackRoot->getZHelixMu(i);
210 zhelix_k[i] = recCgemKalTrackRoot->getZHelixK(i);
211 zhelix_p[i] = recCgemKalTrackRoot->getZHelixP(i);
212
213
214 fhelix[i] = recCgemKalTrackRoot->getFHelix(i);
215 fhelix_e[i] = recCgemKalTrackRoot->getFHelixE(i);
216 fhelix_mu[i] = recCgemKalTrackRoot->getFHelixMu(i);
217 fhelix_k[i] = recCgemKalTrackRoot->getFHelixK(i);
218 fhelix_p[i] = recCgemKalTrackRoot->getFHelixP(i);
219
220 lhelix[i] = recCgemKalTrackRoot->getLHelix(i);
221 lhelix_e[i] = recCgemKalTrackRoot->getLHelixE(i);
222 lhelix_mu[i] = recCgemKalTrackRoot->getLHelixMu(i);
223 lhelix_k[i] = recCgemKalTrackRoot->getLHelixK(i);
224 lhelix_p[i] = recCgemKalTrackRoot->getLHelixP(i);
225
226 thelix[i] = recCgemKalTrackRoot->getTHelix(i);
227
228 for (int j=0; j<=i; j++){
229
230 zerror[i][j] = recCgemKalTrackRoot->getZError(i,j);
231 zerror_e[i][j] = recCgemKalTrackRoot->getZErrorE(i,j);
232 zerror_mu[i][j] = recCgemKalTrackRoot->getZErrorMu(i,j);
233 zerror_k[i][j] = recCgemKalTrackRoot->getZErrorK(i,j);
234 zerror_p[i][j] = recCgemKalTrackRoot->getZErrorP(i,j);
235 zerror[j][i] = zerror[i][j];
236 zerror_e[j][i] = zerror_e[i][j];
237 zerror_mu[j][i] = zerror_mu[i][j];
238 zerror_k[j][i] = zerror_k[i][j];
239 zerror_p[j][i] = zerror_p[i][j];
240
241 ferror[i][j] = recCgemKalTrackRoot->getFError(i,j);
242 ferror_e[i][j] = recCgemKalTrackRoot->getFErrorE(i,j);
243 ferror_mu[i][j] = recCgemKalTrackRoot->getFErrorMu(i,j);
244 ferror_k[i][j] = recCgemKalTrackRoot->getFErrorK(i,j);
245 ferror_p[i][j] = recCgemKalTrackRoot->getFErrorP(i,j);
246 ferror[j][i] = ferror[i][j];
247 ferror_e[j][i] = ferror_e[i][j];
248 ferror_mu[j][i] = ferror_mu[i][j];
249 ferror_k[j][i] = ferror_k[i][j];
250 ferror_p[j][i] = ferror_p[i][j];
251
252 lerror[i][j] = recCgemKalTrackRoot->getLError(i,j);
253 lerror_e[i][j] = recCgemKalTrackRoot->getLErrorE(i,j);
254 lerror_mu[i][j] = recCgemKalTrackRoot->getLErrorMu(i,j);
255 lerror_k[i][j] = recCgemKalTrackRoot->getLErrorK(i,j);
256 lerror_p[i][j] = recCgemKalTrackRoot->getLErrorP(i,j);
257 lerror[j][i] = lerror[i][j];
258 lerror_e[j][i] = lerror_e[i][j];
259 lerror_mu[j][i] = lerror_mu[i][j];
260 lerror_k[j][i] = lerror_k[i][j];
261 lerror_p[j][i] = lerror_p[i][j];
262
263 terror[i][j] = recCgemKalTrackRoot->getTError(k++);
264 terror[j][i] = terror[i][j];
265
266 }
267 }
268
269 //std::cout<<" step 2: "<<std::endl;
270
271 //std::cout<<"T to rec tds: "<<endl;
272 //std::cout<<"lpoint_e: "<<lpoint_e<<std::endl;
273 //std::cout<<"lpivot_e: "<<lpivot_e<<std::endl;
274 /// for zero point
275 zhelixs.push_back(zhelix_e);
276 zhelixs.push_back(zhelix_mu);
277 zhelixs.push_back(zhelix);
278 zhelixs.push_back(zhelix_k);
279 zhelixs.push_back(zhelix_p);
280 zerrors.push_back(zerror_e);
281 zerrors.push_back(zerror_mu);
282 zerrors.push_back(zerror);
283 zerrors.push_back(zerror_k);
284 zerrors.push_back(zerror_p);
285 /// first hit point
286 fhelixs.push_back(fhelix_e);
287 fhelixs.push_back(fhelix_mu);
288 fhelixs.push_back(fhelix);
289 fhelixs.push_back(fhelix_k);
290 fhelixs.push_back(fhelix_p);
291 ferrors.push_back(ferror_e);
292 ferrors.push_back(ferror_mu);
293 ferrors.push_back(ferror);
294 ferrors.push_back(ferror_k);
295 ferrors.push_back(ferror_p);
296 /// last hit point
297 lhelixs.push_back(lhelix_e);
298 lhelixs.push_back(lhelix_mu);
299 lhelixs.push_back(lhelix);
300 lhelixs.push_back(lhelix_k);
301 lhelixs.push_back(lhelix_p);
302 lerrors.push_back(lerror_e);
303 lerrors.push_back(lerror_mu);
304 lerrors.push_back(lerror);
305 lerrors.push_back(lerror_k);
306 lerrors.push_back(lerror_p);
307 /// track finding helix for dE/dx usage
308
309 pocas.push_back(poca_e);
310 pocas.push_back(poca_mu);
311 pocas.push_back(poca);
312 pocas.push_back(poca_k);
313 pocas.push_back(poca_p);
314 lpivots.push_back(lpivot_e);
315 lpivots.push_back(lpivot_mu);
316 lpivots.push_back(lpivot);
317 lpivots.push_back(lpivot_k);
318 lpivots.push_back(lpivot_p);
319 lpoints.push_back(lpoint_e);
320 lpoints.push_back(lpoint_mu);
321 lpoints.push_back(lpoint);
322 lpoints.push_back(lpoint_k);
323 lpoints.push_back(lpoint_p);
324
325 for(int m=0; m<5; m++){
326 int charge;
327 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.);
328 dr = zhelixs[m][0];
329 phi0 = zhelixs[m][1];
330 kappa = zhelixs[m][2];
331 dz = zhelixs[m][3];
332 tanl = zhelixs[m][4];
333
334 // x = pocas[m][0];
335 // y = pocas[m][1];
336 // z = pocas[m][2];
337 x = dr * cos(phi0);
338 y = dr * sin(phi0);
339 z = dz;
340 // std::cout<<"x: "<<x<<"y: "<<y<<"z: "<<z<<std::endl;
341
342 if (kappa > 0.0000000001)
343 charge = 1;
344 else if (kappa < -0.0000000001)
345 charge = -1;
346 else
347 charge = 0;
348
349 if(kappa!=0) pxy = 1.0/fabs(kappa);
350 else pxy = 0;
351
352 px = pxy * (-sin(phi0));
353 py = pxy * cos(phi0);
354 pz = pxy * tanl;
355 ptot = sqrt(px*px+py*py+pz*pz);
356 // cout<<"x, y, z, charge, px, py, pz, ptot: "<<x<<" , "<<y<<" , "<<z<<" , "<<charge<<" , "<<px<<" , "<<py<<" , "<<pz<<" , "<<ptot<<endl;
357 recCgemKalTrackTds->setCharge(charge,m);
358 recCgemKalTrackTds->setPxy(pxy,m);
359 recCgemKalTrackTds->setPx(px,m);
360 recCgemKalTrackTds->setPy(py,m);
361 recCgemKalTrackTds->setPz(pz,m);
362 recCgemKalTrackTds->setP(ptot,m);
363 recCgemKalTrackTds->setTheta(acos(pz/ptot),m);
364 recCgemKalTrackTds->setPhi(atan2(py,px),m);
365 recCgemKalTrackTds->setX(x,m);
366 recCgemKalTrackTds->setY(y,m);
367 recCgemKalTrackTds->setZ(z,m);
368 recCgemKalTrackTds->setR(sqrt(x*x+y*y),m);
369 /// the next three function need more consideration, temporarily
370
371 for(int n=0; n<2; n++){
372 int stat = recCgemKalTrackRoot->getStat(n,m);
373 int chisq = recCgemKalTrackRoot->getChisq(n,m);
374 int ndf = recCgemKalTrackRoot->getNdf(n,m);
375 recCgemKalTrackTds->setStat(stat,n,m);
376 recCgemKalTrackTds->setChisq(chisq,n,m);
377 recCgemKalTrackTds->setNdf(ndf,n,m);
378 }
379 }
380
381 //std::cout<<" step 3: "<<std::endl;
382
383
384
385 for(int jj=0; jj<5; jj++){
386 //std::cout<<" step 3.0: "<<std::endl;
387 //std::cout<<"zhelixs[jj]: "<<zhelixs[jj]<<std::endl;
388
389 recCgemKalTrackTds->setZHelix(zhelixs[jj],jj);
390 //std::cout<<" step 3.1: "<<std::endl;
391
392 recCgemKalTrackTds->setZError(zerrors[jj],jj);
393 recCgemKalTrackTds->setFHelix(fhelixs[jj],jj);
394 recCgemKalTrackTds->setFError(ferrors[jj],jj);
395 //std::cout<<" step 3.5: "<<std::endl;
396
397 recCgemKalTrackTds->setLHelix(lhelixs[jj],jj);
398 recCgemKalTrackTds->setLError(lerrors[jj],jj);
399 recCgemKalTrackTds->setPoca(pocas[jj],jj);
400
401
402 recCgemKalTrackTds->setLPoint(lpoints[jj],jj);
403 recCgemKalTrackTds->setLPivot(lpivots[jj],jj);
404 }
405 recCgemKalTrackTds->setTHelix(thelix);
406 recCgemKalTrackTds->setTError(terror);
407
408 //std::cout<<" step 4: "<<std::endl;
409
410
411 log<<MSG::DEBUG<<"T to REC TDS, zhelix: "<<zhelix<<endreq;
412 log<<MSG::DEBUG<<"T to REC TDS, zerror: "<<zerror<<endreq;
413
414 m_common.m_rootRecCgemKalTrackMap[recCgemKalTrackRoot] = recCgemKalTrackTds;
415
416 RecCgemHelixSegRefVec theKalHelixSegRefVec;
417
418 RecCgemKalHelixSegCol::iterator iter = recCgemKalHelixSegCol->begin();
419 for (;iter != recCgemKalHelixSegCol->end(); iter++){
420
421 //cout<<" (*iter)->getTrkId(): "<<(*iter)->getTrkId()<<endl;
422 if((*iter)->getTrackId() == trackId){
423 SmartRef<RecCgemKalHelixSeg> refhit(*iter);
424 theKalHelixSegRefVec.push_back(refhit);
425 }
426 }
427
428 recCgemKalTrackTds->setVecHelixSegs(theKalHelixSegRefVec);
429
430 int nhelixsegs = recCgemKalTrackTds->getVecHelixSegs().size();
431
432 //std::cout<<" cgem hits: "<<nhelixsegs<< std::endl;
433
434 for(int ii=0; ii <nhelixsegs ; ii++)
435 {
436 //cout<<"ddl: "<<(recCgemTrack->getVecKalHelixSegs()[ii])->getDriftDistLeft()<<endl;
437 //cout<<"erddl: "<<(recCgemTrack->getVecKalHelixSegs()[ii])->getErrDriftDistLeft()<<endl;
438 Identifier id(recCgemKalTrackTds->getVecHelixSegs()[ii]->getCgemId());
439 int layer = CgemID::layer(id);
440 int sheet = CgemID::sheet(id);
441 int strip = CgemID::strip(id);
442 //cout<<"layer: "<<layer<<" wire: "<<wire<<endl;
443 }
444
445 recCgemKalTrackCol->push_back(recCgemKalTrackTds);
446
447 }
448
449 delete m_recCgemKalTrackCol;
450
451 m_recCgemKalTrackCol = 0;
452
453 return StatusCode::SUCCESS;
454}
455
456
457StatusCode RecCgemKalTrackCnv::DataObjectToTObject(DataObject* obj,RootAddress* rootaddr) {
458
459
460
461 MsgStream log(msgSvc(), "RecCgemKalTrackCnv");
462 log << MSG::DEBUG << "RecCgemKalTrackCnv::DataObjectToTObject" << endreq;
463 StatusCode sc=StatusCode::SUCCESS;
464
465 RecCgemKalTrackCol * cgemKalTrackColTds=dynamic_cast<RecCgemKalTrackCol *> (obj);
466 if (!cgemKalTrackColTds) {
467 log << MSG::ERROR << "Could not downcast to RecCgemKalTrackCol" << endreq;
468 return StatusCode::FAILURE;
469 }
470
471 DataObject *evt;
472 m_eds->findObject(EventModel::Recon::Event,evt);
473 if (evt==NULL) {
474 log << MSG::ERROR << "Could not get ReconEvent in TDS " << endreq;
475 return StatusCode::FAILURE;
476 }
477
478 ReconEvent * devtTds=dynamic_cast<ReconEvent *> (evt);
479 if (!devtTds) {
480 log << MSG::ERROR << "CgemKalTrackCnv:Could not downcast to TDS Recon Event" << endreq;
481 }
482 IOpaqueAddress *addr;
483
484 m_cnvSvc->getRecTrackCnv()->createRep(evt,addr);
486
487 const TObjArray *m_recCgemKalTrackCol = recEvt->getRecCgemKalTrackCol();
488
489 if (!m_recCgemKalTrackCol) return sc;
490
491 recEvt->clearRecCgemKalTrackCol(); //necessary in case there is I/O at the same time since array is static
492 RecCgemKalTrackCol::const_iterator cgemKalTrackTds;
493
494 for (cgemKalTrackTds = cgemKalTrackColTds->begin(); cgemKalTrackTds != cgemKalTrackColTds->end(); cgemKalTrackTds++) {
495
496 // Get Data from TDS
497 // root data
498 Int_t trackId;
499 Double_t mass[5];
500 Double_t length[5];
501 Double_t tof[5];
502 Int_t nhits[5];
503 Int_t stat[2][5];
504 Double_t chisq[2][5];
505 Int_t ndf[2][5];
506 Double_t fiTerm[5];
507 Double_t pathSM[5];
508
509 Double_t poca_e[3];
510 Double_t poca_mu[3];
511 Double_t poca[3];
512 Double_t poca_k[3];
513 Double_t poca_p[3];
514
515 Double_t zhelix[5];
516 Double_t zerror[5][5];
517 Double_t zhelix_e[5];
518 Double_t zerror_e[5][5];
519 Double_t zhelix_mu[5];
520 Double_t zerror_mu[5][5];
521 Double_t zhelix_k[5];
522 Double_t zerror_k[5][5];
523 Double_t zhelix_p[5];
524 Double_t zerror_p[5][5];
525
526 Double_t fhelix[5];
527 Double_t ferror[5][5];
528 Double_t fhelix_e[5];
529 Double_t ferror_e[5][5];
530 Double_t fhelix_mu[5];
531 Double_t ferror_mu[5][5];
532 Double_t fhelix_k[5];
533 Double_t ferror_k[5][5];
534 Double_t fhelix_p[5];
535 Double_t ferror_p[5][5];
536
537 Double_t lhelix[5];
538 Double_t lerror[5][5];
539 Double_t lhelix_e[5];
540 Double_t lerror_e[5][5];
541 Double_t lhelix_mu[5];
542 Double_t lerror_mu[5][5];
543 Double_t lhelix_k[5];
544 Double_t lerror_k[5][5];
545 Double_t lhelix_p[5];
546 Double_t lerror_p[5][5];
547
548 Double_t thelix[5];
549 Double_t terror[15];
550
551 Double_t lpoint_e[3];
552 Double_t lpoint_mu[3];
553 Double_t lpoint[3];
554 Double_t lpoint_k[3];
555 Double_t lpoint_p[3];
556
557 Double_t lpivot_e[3];
558 Double_t lpivot_mu[3];
559 Double_t lpivot[3];
560 Double_t lpivot_k[3];
561 Double_t lpivot_p[3];
562
563 TRecCgemKalTrack *cgemKalTrackRoot = new TRecCgemKalTrack();
564
565 trackId = (*cgemKalTrackTds)->getTrackId();
566 for (Int_t i = 0 ; i < 5 ; i++){
567 mass[i] = (*cgemKalTrackTds)->getMass(i);
568 length[i] = (*cgemKalTrackTds)->getLength(i);
569 tof[i] = (*cgemKalTrackTds)->getTof(i);
570 nhits[i] = (*cgemKalTrackTds)->getNhits(i);
571 fiTerm[i]=(*cgemKalTrackTds)->getFiTerm(i);
572 pathSM[i]=(*cgemKalTrackTds)->getPathSM(i);
573 //stat[i] = (*cgemKalTrackTds)->getStat(i);
574 for (Int_t j = 0 ; j< 2 ; j++){
575 stat[j][i] = (*cgemKalTrackTds)->getStat(j,i);
576 chisq[j][i] = (*cgemKalTrackTds)->getChisq(j,i);
577 ndf[j][i] = (*cgemKalTrackTds)->getNdf(j,i);
578 cgemKalTrackRoot->setStat(stat[j][i],j,i);
579 cgemKalTrackRoot->setChisq(chisq[j][i],j,i);
580 cgemKalTrackRoot->setNdf(ndf[j][i],j,i);
581 }
582 }
583 for(Int_t i=0;i<5;i++){
584 log<<MSG::INFO<<" recCgemKalTrack.helix("<<i<<"): "<<(*cgemKalTrackTds)->getTHelix(i)<<endreq;
585 thelix[i] = (*cgemKalTrackTds)->getTHelix(i);
586 }
587 for(Int_t i=0; i<15; i++){
588 terror[i] = (*cgemKalTrackTds)->getTError(i);
589 }
590 HepPoint3D h_poca_e = (*cgemKalTrackTds)->getPocaE();
591 HepPoint3D h_poca_mu = (*cgemKalTrackTds)->getPocaMu();
592 HepPoint3D h_poca = (*cgemKalTrackTds)->getPoca();
593 HepPoint3D h_poca_k = (*cgemKalTrackTds)->getPocaK();
594 HepPoint3D h_poca_p = (*cgemKalTrackTds)->getPocaP();
595 HepPoint3D h_lpoint_e = (*cgemKalTrackTds)->getLPointE();
596 HepPoint3D h_lpoint_mu = (*cgemKalTrackTds)->getLPointMu();
597 HepPoint3D h_lpoint = (*cgemKalTrackTds)->getLPoint();
598 HepPoint3D h_lpoint_k = (*cgemKalTrackTds)->getLPointK();
599 HepPoint3D h_lpoint_p = (*cgemKalTrackTds)->getLPointP();
600 HepPoint3D h_lpivot_e = (*cgemKalTrackTds)->getLPivotE();
601 HepPoint3D h_lpivot_mu = (*cgemKalTrackTds)->getLPivotMu();
602 HepPoint3D h_lpivot = (*cgemKalTrackTds)->getLPivot();
603 HepPoint3D h_lpivot_k = (*cgemKalTrackTds)->getLPivotK();
604 HepPoint3D h_lpivot_p = (*cgemKalTrackTds)->getLPivotP();
605
606 //std::cout<<" h_poca_mu: "<<h_poca_mu<<std::endl;
607 //std::cout<<" h_poca: "<<h_poca<<std::endl;
608 //std::cout<<" h_poca_k: "<<h_poca_k<<std::endl;
609 //std::cout<<" h_poca_p: "<<h_poca_p<<std::endl;
610
611
612 HepVector h_zhelix = (*cgemKalTrackTds)->getZHelix();
613 HepSymMatrix h_zerror = (*cgemKalTrackTds)->getZError();
614 HepVector h_zhelix_e = (*cgemKalTrackTds)->getZHelixE();
615 HepSymMatrix h_zerror_e = (*cgemKalTrackTds)->getZErrorE();
616 HepVector h_zhelix_mu = (*cgemKalTrackTds)->getZHelixMu();
617 HepSymMatrix h_zerror_mu= (*cgemKalTrackTds)->getZErrorMu();
618 HepVector h_zhelix_k = (*cgemKalTrackTds)->getZHelixK();
619 HepSymMatrix h_zerror_k = (*cgemKalTrackTds)->getZErrorK();
620 HepVector h_zhelix_p = (*cgemKalTrackTds)->getZHelixP();
621 HepSymMatrix h_zerror_p = (*cgemKalTrackTds)->getZErrorP();
622
623 HepVector h_fhelix = (*cgemKalTrackTds)->getFHelix();
624 HepSymMatrix h_ferror = (*cgemKalTrackTds)->getFError();
625 HepVector h_fhelix_e = (*cgemKalTrackTds)->getFHelixE();
626 HepSymMatrix h_ferror_e = (*cgemKalTrackTds)->getFErrorE();
627 HepVector h_fhelix_mu = (*cgemKalTrackTds)->getFHelixMu();
628 HepSymMatrix h_ferror_mu= (*cgemKalTrackTds)->getFErrorMu();
629 HepVector h_fhelix_k = (*cgemKalTrackTds)->getFHelixK();
630 HepSymMatrix h_ferror_k = (*cgemKalTrackTds)->getFErrorK();
631 HepVector h_fhelix_p = (*cgemKalTrackTds)->getFHelixP();
632 HepSymMatrix h_ferror_p = (*cgemKalTrackTds)->getFErrorP();
633
634 HepVector h_lhelix = (*cgemKalTrackTds)->getLHelix();
635 HepSymMatrix h_lerror = (*cgemKalTrackTds)->getLError();
636 HepVector h_lhelix_e = (*cgemKalTrackTds)->getLHelixE();
637 HepSymMatrix h_lerror_e = (*cgemKalTrackTds)->getLErrorE();
638 HepVector h_lhelix_mu = (*cgemKalTrackTds)->getLHelixMu();
639 HepSymMatrix h_lerror_mu= (*cgemKalTrackTds)->getLErrorMu();
640 HepVector h_lhelix_k = (*cgemKalTrackTds)->getLHelixK();
641 HepSymMatrix h_lerror_k = (*cgemKalTrackTds)->getLErrorK();
642 HepVector h_lhelix_p = (*cgemKalTrackTds)->getLHelixP();
643 HepSymMatrix h_lerror_p = (*cgemKalTrackTds)->getLErrorP();
644
645 cgemKalTrackRoot->setTrackId(trackId);
646 cgemKalTrackRoot->setMass(mass);
647 cgemKalTrackRoot->setLength(length);
648 cgemKalTrackRoot->setTof(tof);
649 cgemKalTrackRoot->setNhits(nhits);
650 cgemKalTrackRoot->setFiTerm(fiTerm);
651 cgemKalTrackRoot->setPathSM(pathSM);
652 // cgemKalTrackRoot->setStat(stat);
653
654 for(int s=0; s<3; s++){
655 poca_e[s] = h_poca_e[s];
656 poca_mu[s] = h_poca_mu[s];
657 poca[s] = h_poca[s];
658 poca_k[s] = h_poca_k[s];
659 poca_p[s] = h_poca_p[s];
660 lpoint_e[s] = h_lpoint_e[s];
661 lpoint_mu[s] = h_lpoint_mu[s];
662 lpoint[s] = h_lpoint[s];
663 lpoint_k[s] = h_lpoint_k[s];
664 lpoint_p[s] = h_lpoint_p[s];
665 lpivot_e[s] = h_lpivot_e[s];
666 lpivot_mu[s] = h_lpivot_mu[s];
667 lpivot[s] = h_lpivot[s];
668 lpivot_k[s] = h_lpivot_k[s];
669 lpivot_p[s] = h_lpivot_p[s];
670 }
671
672 for (int i=0; i<5; i++){
673 zhelix[i] = h_zhelix[i];
674 zhelix_e[i] = h_zhelix_e[i];
675 zhelix_mu[i] = h_zhelix_mu[i];
676 zhelix_p[i] = h_zhelix_p[i];
677 zhelix_k[i] = h_zhelix_k[i];
678
679 fhelix[i] = h_fhelix[i];
680 fhelix_e[i] = h_fhelix_e[i];
681 fhelix_mu[i] = h_fhelix_mu[i];
682 fhelix_p[i] = h_fhelix_p[i];
683 fhelix_k[i] = h_fhelix_k[i];
684
685 lhelix[i] = h_lhelix[i];
686 lhelix_e[i] = h_lhelix_e[i];
687 lhelix_mu[i] = h_lhelix_mu[i];
688 lhelix_p[i] = h_lhelix_p[i];
689 lhelix_k[i] = h_lhelix_k[i];
690
691 for (int j=0; j<=i; j++){
692 zerror[i][j] = h_zerror[i][j];
693 zerror_e[i][j] = h_zerror_e[i][j];
694 zerror_mu[i][j] = h_zerror_mu[i][j];
695 zerror_p[i][j] = h_zerror_p[i][j];
696 zerror_k[i][j] = h_zerror_k[i][j];
697
698
699 ferror[i][j] = h_ferror[i][j];
700 ferror_e[i][j] = h_ferror_e[i][j];
701 ferror_mu[i][j] = h_ferror_mu[i][j];
702 ferror_p[i][j] = h_ferror_p[i][j];
703 ferror_k[i][j] = h_ferror_k[i][j];
704
705
706 lerror[i][j] = h_lerror[i][j];
707 lerror_e[i][j] = h_lerror_e[i][j];
708 lerror_mu[i][j] = h_lerror_mu[i][j];
709 lerror_p[i][j] = h_lerror_p[i][j];
710 lerror_k[i][j] = h_lerror_k[i][j];
711
712 zerror[j][i] = h_zerror[i][j];
713 zerror_e[j][i] = h_zerror_e[i][j];
714 zerror_mu[j][i] = h_zerror_mu[i][j];
715 zerror_p[j][i] = h_zerror_p[i][j];
716 zerror_k[j][i] = h_zerror_k[i][j];
717
718
719 ferror[j][i] = h_ferror[i][j];
720 ferror_e[j][i] = h_ferror_e[i][j];
721 ferror_mu[j][i] = h_ferror_mu[i][j];
722 ferror_p[j][i] = h_ferror_p[i][j];
723 ferror_k[j][i] = h_ferror_k[i][j];
724
725
726 lerror[j][i] = h_lerror[i][j];
727 lerror_e[j][i] = h_lerror_e[i][j];
728 lerror_mu[j][i] = h_lerror_mu[i][j];
729 lerror_p[j][i] = h_lerror_p[i][j];
730 lerror_k[j][i] = h_lerror_k[i][j];
731
732 }
733 }
734
735 cgemKalTrackRoot->setZHelix(zhelix);
736 cgemKalTrackRoot->setZError(zerror);
737 for(int k=0; k<5; k++){
738 log<<MSG::INFO<<" RecCgemKalTrackRoot.ZHelix "<<"["<<k<<"]"
739 <<cgemKalTrackRoot->getZHelix(k)<<endreq;
740 }
741 cgemKalTrackRoot->setZHelixE(zhelix_e);
742 cgemKalTrackRoot->setZErrorE(zerror_e);
743 cgemKalTrackRoot->setZHelixMu(zhelix_mu);
744 cgemKalTrackRoot->setZErrorMu(zerror_mu);
745 cgemKalTrackRoot->setZHelixK(zhelix_k);
746 cgemKalTrackRoot->setZErrorK(zerror_k);
747 cgemKalTrackRoot->setZHelixP(zhelix_p);
748 cgemKalTrackRoot->setZErrorP(zerror_p);
749 cgemKalTrackRoot->setFHelix(fhelix);
750 cgemKalTrackRoot->setFError(ferror);
751 cgemKalTrackRoot->setFHelixE(fhelix_e);
752 cgemKalTrackRoot->setFErrorE(ferror_e);
753 cgemKalTrackRoot->setFHelixMu(fhelix_mu);
754 cgemKalTrackRoot->setFErrorMu(ferror_mu);
755 cgemKalTrackRoot->setFHelixK(fhelix_k);
756 cgemKalTrackRoot->setFErrorK(ferror_k);
757 cgemKalTrackRoot->setFHelixP(fhelix_p);
758 cgemKalTrackRoot->setFErrorP(ferror_p);
759
760 cgemKalTrackRoot->setLHelix(lhelix);
761 cgemKalTrackRoot->setLError(lerror);
762 cgemKalTrackRoot->setLHelixE(lhelix_e);
763 cgemKalTrackRoot->setLErrorE(lerror_e);
764 cgemKalTrackRoot->setLHelixMu(lhelix_mu);
765 cgemKalTrackRoot->setLErrorMu(lerror_mu);
766 cgemKalTrackRoot->setLHelixK(lhelix_k);
767 cgemKalTrackRoot->setLErrorK(lerror_k);
768 cgemKalTrackRoot->setLHelixP(lhelix_p);
769 cgemKalTrackRoot->setLErrorP(lerror_p);
770
771 cgemKalTrackRoot->setTHelix(thelix);
772 cgemKalTrackRoot->setTError(terror);
773
774 cgemKalTrackRoot->setPocaE(poca_e);
775 cgemKalTrackRoot->setPocaMu(poca_mu);
776 cgemKalTrackRoot->setPoca(poca);
777 cgemKalTrackRoot->setPocaK(poca_k);
778 cgemKalTrackRoot->setPocaP(poca_p);
779
780 cgemKalTrackRoot->setLPointE(lpoint_e);
781 cgemKalTrackRoot->setLPointMu(lpoint_mu);
782 cgemKalTrackRoot->setLPoint(lpoint);
783 cgemKalTrackRoot->setLPointK(lpoint_k);
784 cgemKalTrackRoot->setLPointP(lpoint_p);
785
786 cgemKalTrackRoot->setLPivotE(lpivot_e);
787 cgemKalTrackRoot->setLPivotMu(lpivot_mu);
788 cgemKalTrackRoot->setLPivot(lpivot);
789 cgemKalTrackRoot->setLPivotK(lpivot_k);
790 cgemKalTrackRoot->setLPivotP(lpivot_p);
791 //std::cout<<" cgemKalTrackRoot->getPivotE(1): "<<cgemKalTrackRoot->getLPivotE(1)<<std::endl;
792
793 recEvt->addRecCgemKalTrack(cgemKalTrackRoot);
794 }
795
796
797 return StatusCode::SUCCESS;
798}
799#endif
SmartRefVector< RecCgemKalHelixSeg > RecCgemHelixSegRefVec
ObjectVector< RecCgemKalTrack > RecCgemKalTrackCol
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)
**********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
static int strip(const Identifier &id)
static int sheet(const Identifier &id)
static int layer(const Identifier &id)
void setPoca(const HepPoint3D &poca, const int pid)
void setZHelix(const HepVector &helix, const int pid)
void setTheta(const double theta, const int pid)
void setZError(const HepSymMatrix &error, const int pid)
void setFError(const HepSymMatrix &ferror, const int pid)
void setFHelix(const HepVector &fhelix, const int pid)
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
RecCgemHelixSegRefVec getVecHelixSegs(void) const
void setLError(const HepSymMatrix &error, const int pid)
void setVecHelixSegs(const RecCgemHelixSegRefVec &vechelixsegs)
static TRecTrackEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition of a Root address, derived from IOpaqueAddress.
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 addRecCgemKalTrack(TRecCgemKalTrack *Track)
static std::map< const TObject *, const RecCgemKalTrack * > m_rootRecCgemKalTrackMap