45 {
46
47 MsgStream log(
msgSvc(),
"RecMdcKalTrackCnv" );
48 log << MSG::DEBUG << "RecMdcKalTrackCnv::TObjectToDataObject" << endmsg;
49 StatusCode sc = StatusCode::SUCCESS;
50
51
53 refpObject = recMdcKalTrackCol;
54
55
56 if ( !m_recMdcKalTrackCol ) return sc;
57 TIter recMdcKalTrackIter( m_recMdcKalTrackCol );
58
59 IDataProviderSvc* dataSvc = 0;
60 sc = serviceLocator()->getService( "EventDataSvc", IDataProviderSvc::interfaceID(),
61 (IInterface*&)dataSvc );
62 if ( !sc.isSuccess() )
63 {
64 log << MSG::FATAL << "Could not get EventDataSvc in RecMdcTrackCnv" << endmsg;
65 return ( StatusCode::FAILURE );
66 }
67 SmartDataPtr<RecMdcKalHelixSegCol> recMdcKalHelixSegCol(
68 dataSvc, "/Event/Recon/RecMdcKalHelixSegCol" );
69 if ( !recMdcKalHelixSegCol )
70 {
71 log << MSG::FATAL << "Could not find RecMdcKalHelixSegCol" << endmsg;
72 return ( StatusCode::FAILURE );
73 }
74
75 TRecMdcKalTrack* recMdcKalTrackRoot = 0;
76 while ( ( recMdcKalTrackRoot = (TRecMdcKalTrack*)recMdcKalTrackIter.Next() ) )
77 {
78
79 std::vector<HepVector> zhelixs;
80 std::vector<HepSymMatrix> zerrors;
81 std::vector<HepVector> fhelixs;
82 std::vector<HepSymMatrix> ferrors;
83 std::vector<HepVector> lhelixs;
84 std::vector<HepSymMatrix> lerrors;
85 std::vector<HepPoint3D> pocas;
86 std::vector<HepPoint3D> lpivots;
87 std::vector<HepPoint3D> lpoints;
88
89 HepVector zhelix( 5 );
90 HepSymMatrix zerror( 5 );
91 HepVector fhelix( 5 );
92 HepSymMatrix ferror( 5 );
93 HepVector lhelix( 5 );
94 HepSymMatrix lerror( 5 );
95 HepVector thelix( 5 );
96 HepSymMatrix terror( 5 );
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 HepVector zhelix_mu( 5 );
112 HepSymMatrix zerror_mu( 5 );
113 HepVector fhelix_mu( 5 );
114 HepSymMatrix ferror_mu( 5 );
115 HepVector lhelix_mu( 5 );
116 HepSymMatrix lerror_mu( 5 );
120
121 HepVector zhelix_k( 5 );
122 HepSymMatrix zerror_k( 5 );
123 HepVector fhelix_k( 5 );
124 HepSymMatrix ferror_k( 5 );
125 HepVector lhelix_k( 5 );
126 HepSymMatrix lerror_k( 5 );
130
131 HepVector zhelix_p( 5 );
132 HepSymMatrix zerror_p( 5 );
133 HepVector fhelix_p( 5 );
134 HepSymMatrix ferror_p( 5 );
135 HepVector lhelix_p( 5 );
136 HepSymMatrix lerror_p( 5 );
140
141 int stat[2][5];
142 double chisq[2][5];
143 int ndf[2][5];
144
146 double length[5];
147 double tof[5];
148 int nhits[5];
149 int nlayer[5];
150 int trackId;
151 double pathSM[5];
152 double fiTerm[5];
153
154
155 RecMdcKalTrack* recMdcKalTrackTds = new RecMdcKalTrack();
156
157
158
160
162
163 for ( int u = 0; u < 5; u++ )
164 {
166 length[u] = recMdcKalTrackRoot->
getLength( u );
167 tof[u] = recMdcKalTrackRoot->
getTof( u );
168 nhits[u] = recMdcKalTrackRoot->
getNhits( u );
169 fiTerm[u] = recMdcKalTrackRoot->
getfiTerm( u );
170 pathSM[u] = recMdcKalTrackRoot->
getPathSM( u );
171 nlayer[u] = recMdcKalTrackRoot->
getNlayer( u );
172
174 recMdcKalTrackTds->
setLength( length[u], u );
175 recMdcKalTrackTds->
setTof( tof[u], u );
176 recMdcKalTrackTds->
setNhits( nhits[u], u );
177 recMdcKalTrackTds->
setFiTerm( fiTerm[u], u );
178 recMdcKalTrackTds->
setPathSM( pathSM[u], u );
179 recMdcKalTrackTds->
setNlayer( nlayer[u], u );
180 }
181
182 for (
int v = 0;
v < 3;
v++ )
183 {
184 poca_e[
v] = recMdcKalTrackRoot->
getPocaE(
v );
186 poca[
v] = recMdcKalTrackRoot->
getPoca(
v );
187 poca_k[
v] = recMdcKalTrackRoot->
getPocaK(
v );
188 poca_p[
v] = recMdcKalTrackRoot->
getPocaP(
v );
199
200
201
202 }
203
204 for ( int i = 0, k = 0; i < 5; i++ )
205 {
206 zhelix[i] = recMdcKalTrackRoot->
getZHelix( i );
207 zhelix_e[i] = recMdcKalTrackRoot->
getZHelixE( i );
208 zhelix_mu[i] = recMdcKalTrackRoot->
getZHelixMu( i );
209 zhelix_k[i] = recMdcKalTrackRoot->
getZHelixK( i );
210 zhelix_p[i] = recMdcKalTrackRoot->
getZHelixP( i );
211
212 fhelix[i] = recMdcKalTrackRoot->
getFHelix( i );
213 fhelix_e[i] = recMdcKalTrackRoot->
getFHelixE( i );
214 fhelix_mu[i] = recMdcKalTrackRoot->
getFHelixMu( i );
215 fhelix_k[i] = recMdcKalTrackRoot->
getFHelixK( i );
216 fhelix_p[i] = recMdcKalTrackRoot->
getFHelixP( i );
217
218 lhelix[i] = recMdcKalTrackRoot->
getLHelix( i );
219 lhelix_e[i] = recMdcKalTrackRoot->
getLHelixE( i );
220 lhelix_mu[i] = recMdcKalTrackRoot->
getLHelixMu( i );
221 lhelix_k[i] = recMdcKalTrackRoot->
getLHelixK( i );
222 lhelix_p[i] = recMdcKalTrackRoot->
getLHelixP( i );
223
224 thelix[i] = recMdcKalTrackRoot->
getTHelix( i );
225
226 for ( int j = 0; j <= i; j++ )
227 {
228
229 zerror[i][j] = recMdcKalTrackRoot->
getZError( i, j );
230 zerror_e[i][j] = recMdcKalTrackRoot->
getZErrorE( i, j );
231 zerror_mu[i][j] = recMdcKalTrackRoot->
getZErrorMu( i, j );
232 zerror_k[i][j] = recMdcKalTrackRoot->
getZErrorK( i, j );
233 zerror_p[i][j] = recMdcKalTrackRoot->
getZErrorP( i, j );
234 zerror[j][i] = zerror[i][j];
235 zerror_e[j][i] = zerror_e[i][j];
236 zerror_mu[j][i] = zerror_mu[i][j];
237 zerror_k[j][i] = zerror_k[i][j];
238 zerror_p[j][i] = zerror_p[i][j];
239
240 ferror[i][j] = recMdcKalTrackRoot->
getFError( i, j );
241 ferror_e[i][j] = recMdcKalTrackRoot->
getFErrorE( i, j );
242 ferror_mu[i][j] = recMdcKalTrackRoot->
getFErrorMu( i, j );
243 ferror_k[i][j] = recMdcKalTrackRoot->
getFErrorK( i, j );
244 ferror_p[i][j] = recMdcKalTrackRoot->
getFErrorP( i, j );
245 ferror[j][i] = ferror[i][j];
246 ferror_e[j][i] = ferror_e[i][j];
247 ferror_mu[j][i] = ferror_mu[i][j];
248 ferror_k[j][i] = ferror_k[i][j];
249 ferror_p[j][i] = ferror_p[i][j];
250
251 lerror[i][j] = recMdcKalTrackRoot->
getLError( i, j );
252 lerror_e[i][j] = recMdcKalTrackRoot->
getLErrorE( i, j );
253 lerror_mu[i][j] = recMdcKalTrackRoot->
getLErrorMu( i, j );
254 lerror_k[i][j] = recMdcKalTrackRoot->
getLErrorK( i, j );
255 lerror_p[i][j] = recMdcKalTrackRoot->
getLErrorP( i, j );
256 lerror[j][i] = lerror[i][j];
257 lerror_e[j][i] = lerror_e[i][j];
258 lerror_mu[j][i] = lerror_mu[i][j];
259 lerror_k[j][i] = lerror_k[i][j];
260 lerror_p[j][i] = lerror_p[i][j];
261
262 terror[i][j] = recMdcKalTrackRoot->
getTError( k++ );
263 terror[j][i] = terror[i][j];
264 }
265 }
266
267
268
269
270
271
272
273 zhelixs.push_back( zhelix_e );
274 zhelixs.push_back( zhelix_mu );
275 zhelixs.push_back( zhelix );
276 zhelixs.push_back( zhelix_k );
277 zhelixs.push_back( zhelix_p );
278 zerrors.push_back( zerror_e );
279 zerrors.push_back( zerror_mu );
280 zerrors.push_back( zerror );
281 zerrors.push_back( zerror_k );
282 zerrors.push_back( zerror_p );
283
284 fhelixs.push_back( fhelix_e );
285 fhelixs.push_back( fhelix_mu );
286 fhelixs.push_back( fhelix );
287 fhelixs.push_back( fhelix_k );
288 fhelixs.push_back( fhelix_p );
289 ferrors.push_back( ferror_e );
290 ferrors.push_back( ferror_mu );
291 ferrors.push_back( ferror );
292 ferrors.push_back( ferror_k );
293 ferrors.push_back( ferror_p );
294
295 lhelixs.push_back( lhelix_e );
296 lhelixs.push_back( lhelix_mu );
297 lhelixs.push_back( lhelix );
298 lhelixs.push_back( lhelix_k );
299 lhelixs.push_back( lhelix_p );
300 lerrors.push_back( lerror_e );
301 lerrors.push_back( lerror_mu );
302 lerrors.push_back( lerror );
303 lerrors.push_back( lerror_k );
304 lerrors.push_back( lerror_p );
305
306
307 pocas.push_back( poca_e );
308 pocas.push_back( poca_mu );
309 pocas.push_back( poca );
310 pocas.push_back( poca_k );
311 pocas.push_back( poca_p );
312 lpivots.push_back( lpivot_e );
313 lpivots.push_back( lpivot_mu );
314 lpivots.push_back( lpivot );
315 lpivots.push_back( lpivot_k );
316 lpivots.push_back( lpivot_p );
317 lpoints.push_back( lpoint_e );
318 lpoints.push_back( lpoint_mu );
319 lpoints.push_back( lpoint );
320 lpoints.push_back( lpoint_k );
321 lpoints.push_back( lpoint_p );
322
323 for ( int m = 0; m < 5; m++ )
324 {
325 int charge;
326 double pxy( 0. ), px( 0. ), py( 0. ), pz( 0. ), ptot( 0. ), dr( 0. ), phi0( 0. ),
327 kappa( 0. ), dz( 0. ), tanl( 0. ),
x( 0. ), y( 0. ), z( 0. ), vx0( 0. ), vy0( 0. ),
328 vz0( 0. );
329 dr = zhelixs[m][0];
330 phi0 = zhelixs[m][1];
331 kappa = zhelixs[m][2];
332 dz = zhelixs[m][3];
333 tanl = zhelixs[m][4];
334
335
336
337
338 x = dr *
cos( phi0 );
339 y = dr *
sin( phi0 );
340 z = dz;
341
342
343 if ( kappa > 0.0000000001 ) charge = 1;
344 else if ( kappa < -0.0000000001 ) charge = -1;
345 else charge = 0;
346
347 if ( kappa != 0 ) pxy = 1.0 / fabs( kappa );
348 else pxy = 0;
349
350 px = pxy * ( -
sin( phi0 ) );
351 py = pxy *
cos( phi0 );
352 pz = pxy * tanl;
353 ptot = sqrt( px * px + py * py + pz * pz );
354
355
356
357 recMdcKalTrackTds->
setCharge( charge, m );
358 recMdcKalTrackTds->
setPxy( pxy, m );
359 recMdcKalTrackTds->
setPx( px, m );
360 recMdcKalTrackTds->
setPy( py, m );
361 recMdcKalTrackTds->
setPz( pz, m );
362 recMdcKalTrackTds->
setP( ptot, m );
363 recMdcKalTrackTds->
setTheta( acos( pz / ptot ), m );
364 recMdcKalTrackTds->
setPhi( atan2( py, px ), m );
365 recMdcKalTrackTds->
setX(
x, m );
366 recMdcKalTrackTds->
setY( y, m );
367 recMdcKalTrackTds->
setZ( z, m );
368 recMdcKalTrackTds->
setR( sqrt(
x *
x + y * y ), m );
369
370
371 for (
int n = 0;
n < 2;
n++ )
372 {
373 int stat = recMdcKalTrackRoot->
getStat(
n, m );
374 int chisq = recMdcKalTrackRoot->
getChisq(
n, m );
375 int ndf = recMdcKalTrackRoot->
getNdf(
n, m );
376 recMdcKalTrackTds->
setStat( stat,
n, m );
377 recMdcKalTrackTds->
setChisq( chisq,
n, m );
378 recMdcKalTrackTds->
setNdf( ndf,
n, m );
379 }
380 }
381
382
383
384 for ( int jj = 0; jj < 5; jj++ )
385 {
386
387
388
389 recMdcKalTrackTds->
setZHelix( zhelixs[jj], jj );
390
391
392 recMdcKalTrackTds->
setZError( zerrors[jj], jj );
393 recMdcKalTrackTds->
setFHelix( fhelixs[jj], jj );
394 recMdcKalTrackTds->
setFError( ferrors[jj], jj );
395
396
397 recMdcKalTrackTds->
setLHelix( lhelixs[jj], jj );
398 recMdcKalTrackTds->
setLError( lerrors[jj], jj );
399 recMdcKalTrackTds->
setPoca( pocas[jj], jj );
400
401 recMdcKalTrackTds->
setLPoint( lpoints[jj], jj );
402 recMdcKalTrackTds->
setLPivot( lpivots[jj], jj );
403 }
406
407
408
409 log << MSG::DEBUG << "T to REC TDS, zhelix: " << zhelix << endmsg;
410 log << MSG::DEBUG << "T to REC TDS, zerror: " << zerror << endmsg;
411
412 m_common.m_rootRecMdcKalTrackMap[recMdcKalTrackRoot] = recMdcKalTrackTds;
413
414 int nSegTot = 0;
415 for ( int i = 0; i < 5; i++ )
416 {
418
419 int nSeg = recMdcKalTrackRoot->
getNseg( i );
420 int iSeg = 0;
421 RecMdcKalHelixSegCol::iterator
iter = recMdcKalHelixSegCol->begin();
422 for ( ;
iter != recMdcKalHelixSegCol->end();
iter++ )
423 {
424
425
426 if ( ( *iter )->getTrackId() == trackId )
427 {
428 if ( iSeg >= nSegTot && iSeg < nSeg + nSegTot )
429 {
430 SmartRef<RecMdcKalHelixSeg> refhit( *
iter );
431 theKalHelixSegRefVec.push_back( refhit );
432 }
433 iSeg++;
434 }
435 }
436 nSegTot += nSeg;
437
439 }
440
442
443
444
445 for ( int ii = 0; ii < nhelixsegs; ii++ )
446 {
447
448
449
453
454 }
455
456 recMdcKalTrackCol->push_back( recMdcKalTrackTds );
457 }
458
459 delete m_recMdcKalTrackCol;
460
461 m_recMdcKalTrackCol = 0;
462
463 return StatusCode::SUCCESS;
464}
double sin(const BesAngle a)
double cos(const BesAngle a)
SmartRefVector< RecMdcKalHelixSeg > HelixSegRefVec
**********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
void setFHelix(const HepVector &fhelix, const int pid)
void setPhi(const double phi, const int pid)
void setStat(int stat, int i, int pid)
void setY(const double y, const int pid)
void setPz(const double pz, const int pid)
void setChisq(double chisq, int i, int pid)
void setZError(const HepSymMatrix &error, const int pid)
void setX(const double x, const int pid)
void setP(const double p, const int pid)
void setPoca(const HepPoint3D &poca, const int pid)
void setPx(const double px, const int pid)
void setZ(const double z, const int pid)
void setTheta(const double theta, const int pid)
void setR(const double r, const int pid)
void setPxy(const double pxy, const int pid)
void setPy(const double py, const int pid)
void setFError(const HepSymMatrix &ferror, const int pid)
void setTrackId(int trackId)
void setZHelix(const HepVector &helix, const int pid)
void setCharge(const int charge, const int pid)
void setNdf(int ndf, int i, int pid)
void setNlayer(int nlayer, int pid)
static int layer(const Identifier &id)
Values of different levels (failure returns 0).
static int wire(const Identifier &id)
void setLHelix(const HepVector &helix, const int pid)
void setFiTerm(double fi, const int pid)
void setPathSM(double length, int pid)
void setLength(double length, int pid)
void setTError(const HepSymMatrix &error)
void setMass(double mass, int pid)
HelixSegRefVec getVecHelixSegs(int pid=-1) const
void setTHelix(const HepVector &helix)
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)
void setTof(double tof, int pid)
void setNhits(int nhits, int pid)
Double_t getLPointP(Int_t i) const
Double_t getLErrorMu(Int_t i, Int_t j) const
Double_t getLPivotE(Int_t i) const
Double_t getLHelix(Int_t i) const
Double_t getLPivotMu(Int_t i) const
Int_t getNhits(Int_t pid) const
Double_t getFHelixP(Int_t i) const
Double_t getFHelixE(Int_t i) const
Double_t getPocaK(Int_t i) const
Double_t getPocaE(Int_t i) const
Double_t getLPivotP(Int_t i) const
Double_t getFErrorK(Int_t i, Int_t j) const
Double_t getTHelix(Int_t i) const
Double_t getZErrorE(Int_t i, Int_t j) const
Double_t getFErrorE(Int_t i, Int_t j) const
Double_t getZHelixMu(Int_t i) const
Double_t getLHelixMu(Int_t i) const
Double_t getPoca(Int_t i) const
Double_t getfiTerm(Int_t pid) const
Double_t getFHelixMu(Int_t i) const
Double_t getLHelixK(Int_t i) const
Double_t getFErrorP(Int_t i, Int_t j) const
Double_t getLPointE(Int_t i) const
Double_t getChisq(Int_t i, Int_t pid) const
Double_t getLength(Int_t pid) const
Double_t getZErrorP(Int_t i, Int_t j) const
Double_t getZErrorMu(Int_t i, Int_t j) const
Double_t getLErrorE(Int_t i, Int_t j) const
Int_t getNseg(Int_t pid) const
Double_t getLPivotK(Int_t i) const
Double_t getZHelixP(Int_t i) const
Double_t getLPointK(Int_t i) const
Double_t getLHelixE(Int_t i) const
Double_t getMass(Int_t pid) const
Double_t getZErrorK(Int_t i, Int_t j) const
Double_t getLErrorP(Int_t i, Int_t j) const
Double_t getLHelixP(Int_t i) const
Double_t getZHelixK(Int_t i) const
Int_t getStat(Int_t i, Int_t pid) const
Double_t getLError(Int_t i, Int_t j) const
Double_t getLErrorK(Int_t i, Int_t j) const
Int_t getNdf(Int_t i, Int_t pid) const
Double_t getLPointMu(Int_t i) const
Double_t getZError(Int_t i, Int_t j) const
Double_t getTof(Int_t pid) const
Double_t getZHelixE(Int_t i) const
Double_t getFHelixK(Int_t i) const
Int_t getNlayer(Int_t pid) const
Double_t getPocaMu(Int_t i) const
Double_t getPocaP(Int_t i) const
Double_t getLPoint(Int_t i) const
Double_t getFErrorMu(Int_t i, Int_t j) const
Double_t getFHelix(Int_t i) const
Double_t getFError(Int_t i, Int_t j) const
Double_t getLPivot(Int_t i) const
Double_t getPathSM(Int_t pid) const
Double_t getTError(Int_t i) const