47 {
48
49 MsgStream log(
msgSvc(),
"RecCgemKalTrackCnv");
50 log << MSG::DEBUG << "RecCgemKalTrackCnv::TObjectToDataObject" << endreq;
51 StatusCode sc = StatusCode::SUCCESS;
52
53
55 refpObject = recCgemKalTrackCol;
56
57
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
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);
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);
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);
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);
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);
143
144
145 int stat[2][5];
146 double chisq[2][5];
147 int ndf[2][5];
148
151 double tof[5];
152 int nhits[5];
153 int trackId;
154 double pathSM[5];
155 double fiTerm[5];
156
157
158
160
161
162
164
166
167 for (int u=0; u<5; 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
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++){
187 poca[
v] = recCgemKalTrackRoot->
getPoca(
v);
200
201
202
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
270
271
272
273
274
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
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
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
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
335
336
339 z = dz;
340
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
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
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);
377 recCgemKalTrackTds->
setNdf(ndf,
n,m);
378 }
379 }
380
381
382
383
384
385 for(int jj=0; jj<5; jj++){
386
387
388
389 recCgemKalTrackTds->
setZHelix(zhelixs[jj],jj);
390
391
392 recCgemKalTrackTds->
setZError(zerrors[jj],jj);
393 recCgemKalTrackTds->
setFHelix(fhelixs[jj],jj);
394 recCgemKalTrackTds->
setFError(ferrors[jj],jj);
395
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 }
407
408
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
415
417
418 RecCgemKalHelixSegCol::iterator
iter = recCgemKalHelixSegCol->begin();
419 for (;
iter != recCgemKalHelixSegCol->end();
iter++){
420
421
422 if((*iter)->getTrackId() == trackId){
423 SmartRef<RecCgemKalHelixSeg> refhit(*
iter);
424 theKalHelixSegRefVec.push_back(refhit);
425 }
426 }
427
429
431
432
433
434 for(int ii=0; ii <nhelixsegs ; ii++)
435 {
436
437
442
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}
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
SmartRefVector< RecCgemKalHelixSeg > RecCgemHelixSegRefVec
static int strip(const Identifier &id)
static int sheet(const Identifier &id)
static int layer(const Identifier &id)
void setStat(int stat, int i, int pid)
void setCharge(const int charge, const int pid)
void setChisq(double chisq, int i, int pid)
void setZ(const double z, const int pid)
void setX(const double x, const int pid)
void setPy(const double py, const int pid)
void setR(const double r, const int pid)
void setPoca(const HepPoint3D &poca, const int pid)
void setP(const double p, const int pid)
void setTrackId(int trackId)
void setPz(const double pz, const int pid)
void setZHelix(const HepVector &helix, const int pid)
void setY(const double y, const int pid)
void setTheta(const double theta, const int pid)
void setPhi(const double phi, const int pid)
void setNdf(int ndf, int i, int pid)
void setZError(const HepSymMatrix &error, const int pid)
void setPxy(const double pxy, const int pid)
void setFError(const HepSymMatrix &ferror, const int pid)
void setPx(const double px, const int pid)
void setFHelix(const HepVector &fhelix, const int pid)
void setFiTerm(double fi, const int pid)
RecCgemHelixSegRefVec getVecHelixSegs(void) const
void setPathSM(double length, int pid)
void setLPoint(const HepPoint3D &point, const int pid)
void setTof(double tof, int pid)
void setMass(double mass, int pid)
void setTError(const HepSymMatrix &error)
void setLPivot(const HepPoint3D &pivot, const int pid)
void setLength(double length, int pid)
void setLError(const HepSymMatrix &error, const int pid)
void setLHelix(const HepVector &helix, const int pid)
void setTHelix(const HepVector &helix)
void setVecHelixSegs(const RecCgemHelixSegRefVec &vechelixsegs)
void setNhits(int nhits, int pid)
const Double_t getChisq(Int_t i, Int_t pid) const
const Double_t getZErrorMu(Int_t i, Int_t j) const
const Double_t getLPointMu(Int_t i) const
const Double_t getLHelixE(Int_t i) const
const Double_t getPocaMu(Int_t i) const
const Double_t getLPivot(Int_t i) const
const Double_t getLErrorMu(Int_t i, Int_t j) const
const Double_t getLHelixP(Int_t i) const
const Double_t getLPivotK(Int_t i) const
const Double_t getMass(Int_t pid) const
const Double_t getFErrorK(Int_t i, Int_t j) const
const Double_t getFErrorP(Int_t i, Int_t j) const
const Int_t getTrackId() const
const Double_t getZErrorE(Int_t i, Int_t j) const
const Double_t getLPivotP(Int_t i) const
const Double_t getLPivotE(Int_t i) const
const Double_t getPocaK(Int_t i) const
const Int_t getStat(Int_t i, Int_t pid) const
const Double_t getFErrorE(Int_t i, Int_t j) const
const Double_t getLPoint(Int_t i) const
const Double_t getLErrorP(Int_t i, Int_t j) const
const Double_t getZHelixK(Int_t i) const
const Double_t getLPointK(Int_t i) const
const Double_t getFHelix(Int_t i) const
const Double_t getLHelix(Int_t i) const
const Double_t getPoca(Int_t i) const
const Double_t getTHelix(Int_t i) const
const Double_t getLError(Int_t i, Int_t j) const
const Double_t getZHelixMu(Int_t i) const
const Double_t getLHelixMu(Int_t i) const
const Double_t getLErrorK(Int_t i, Int_t j) const
const Int_t getNdf(Int_t i, Int_t pid) const
const Double_t getLPivotMu(Int_t i) const
const Double_t getFError(Int_t i, Int_t j) const
const Double_t getZErrorK(Int_t i, Int_t j) const
const Double_t getFHelixMu(Int_t i) const
const Double_t getLErrorE(Int_t i, Int_t j) const
const Double_t getZHelixE(Int_t i) const
const Double_t getZErrorP(Int_t i, Int_t j) const
const Double_t getPocaE(Int_t i) const
const Double_t getFHelixE(Int_t i) const
const Double_t getPocaP(Int_t i) const
const Double_t getLPointP(Int_t i) const
const Double_t getZHelixP(Int_t i) const
const Double_t getFHelixK(Int_t i) const
const Double_t getfiTerm(Int_t pid) const
const Double_t getFErrorMu(Int_t i, Int_t j) const
const Double_t getTof(Int_t pid) const
const Double_t getLHelixK(Int_t i) const
const Double_t getPathSM(Int_t pid) const
const Double_t getLength(Int_t pid) const
const Double_t getZError(Int_t i, Int_t j) const
const Double_t getLPointE(Int_t i) const
const Int_t getNhits(Int_t pid) const
const Double_t getFHelixP(Int_t i) const
const Double_t getTError(Int_t i) const
static std::map< const TObject *, const RecCgemKalTrack * > m_rootRecCgemKalTrackMap