BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcUtilitySvc.cxx
Go to the documentation of this file.
2#include "GaudiKernel/MsgStream.h"
3#include "GaudiKernel/SmartDataPtr.h"
4#include "GaudiKernel/Bootstrap.h"
5#include "GaudiKernel/ISvcLocator.h"
6#include "GaudiKernel/IPartPropSvc.h"
7#include "GaudiKernel/IDataProviderSvc.h"
9#include "MdcGeom/Constants.h"
10#include "MdcGeom/BesAngle.h"
11#include "TrkBase/HelixTraj.h"
12#include "TrkBase/TrkPoca.h"
13#include "MdcGeom/MdcLayer.h"
14#include "HepPDT/ParticleDataTable.hh"
15#include <cmath>
16#ifndef ENABLE_BACKWARDS_COMPATIBILITY
17// backwards compatblty wll be enabled ONLY n CLHEP 1.9
19#endif
20
21using namespace std;
22using namespace Event;
23DECLARE_COMPONENT(MdcUtilitySvc)
24MdcUtilitySvc::MdcUtilitySvc( const string& name, ISvcLocator* svcloc) :
25 base_class (name, svcloc) {
26 declareProperty("debug", m_debug = 0);
27 }
28
30}
31
33 MsgStream log(messageService(), name());
34 log << MSG::INFO << "MdcUtilitySvc::initialize()" << endreq;
35
36 StatusCode sc = Service::initialize();
37 if( sc.isFailure() ) {
38 log << MSG::ERROR << "Service::initialize() failure" << endreq;
39 return sc;
40 }
41
42 //Initalze magnetic flied
43
44 sc = service("MagneticFieldSvc", m_pIMF);
45 if(! m_pIMF){
46 log << MSG::FATAL <<" ERROR Unable to open Magnetic field service "<< endreq;
47 return StatusCode::FAILURE;
48 }
49
50 // Initialize MdcGeomSvc
51 IMdcGeomSvc* imdcGeomSvc;
52 sc = service("MdcGeomSvc", imdcGeomSvc);
53 m_mdcGeomSvc = dynamic_cast<MdcGeomSvc*> (imdcGeomSvc);
54 if(!imdcGeomSvc){
55 log << MSG::FATAL <<" Could not load MdcGeomSvc! "<< endreq;
56 return StatusCode::FAILURE;
57 }
58
59 IRawDataProviderSvc* irawDataProviderSvc;
60 sc = service ("RawDataProviderSvc", irawDataProviderSvc);
61 m_RawDataProviderSvc = dynamic_cast<RawDataProviderSvc*> (irawDataProviderSvc);
62 if ( sc.isFailure() ){
63 log << MSG::FATAL << name()<<" Could not load RawDataProviderSvc!" << endreq;
64 return StatusCode::FAILURE;
65 }
66
67 return StatusCode::SUCCESS;
68}
69
71 MsgStream log(messageService(), name());
72 log << MSG::INFO << "MdcUtilitySvc::finalize()" << endreq;
73
74 return StatusCode::SUCCESS;
75}
76
77vector<MdcDigi*> MdcUtilitySvc::getMdcDigiVec() const
78{
79 uint32_t getDigiFlag = 0;
80
81 MdcDigiVec mdcDigiVec = m_RawDataProviderSvc->getMdcDigiVec(getDigiFlag);
82 cout<<"MdcUtilitySvc::getMdcDigiVec() get "<<mdcDigiVec.size()<<" MDC digis from RawDataProviderSvc"<<endl;
83
84 return mdcDigiVec;
85}
86
87//vector<vector<MdcDigi*> > MdcUtilitySvc::ConnectionHitsGroup(int SameLRange,int DiffLRange) const
88//{
89// vector<MdcDigi*> MdcHits = MdcUtilitySvc::getMdcDigiVec();
90// return MdcUtilitySvc::ConnectionHitsGroup(MdcHits,SameLRange,DiffLRange);
91//}
92
93//vector<vector<MdcDigi*> > MdcUtilitySvc::ConnectionHitsGroup(vector<MdcDigi*> &MdcHits,int SameLRange,int DiffLRange) const
94//{
95// //cout<<"range1 "<<SameLRange<<" range2 "<<DiffLRange<<endl;
96// //group adjacent MdcDigis
97// vector<MdcHitGroup*> wires(6796);
98// for(int i=0;i<6796;i++){
99// wires[i] = new MdcHitGroup();
100// wires[i]->SetWire(m_mdcGeomSvc->Wire(i));
101// }
102//// vector<MdcDigi*> MdcHits = MdcUtilitySvc::getMdcDigiVec();
103// //int nHits = MdcHits.size();
104// for(vector<MdcDigi*>::iterator iter_mdcDigi = MdcHits.begin();iter_mdcDigi!=MdcHits.end(); iter_mdcDigi++) {
105// Identifier id = (*iter_mdcDigi)->identify();
106// int layer_id = MdcID::layer(id);
107// int wire_id = MdcID::wire(id);
108// int wireid = m_mdcGeomSvc->Wire(layer_id,wire_id)->Id();
109// wires[wireid]->AddHit(*iter_mdcDigi);
110// int wireT1_tem=wires[wireid]->GetWire()->GetNeighborIDType1();
111// int wireT2_tem=wires[wireid]->GetWire()->GetNeighborIDType2();
112// for(int range=0;range<SameLRange;range++){
113// // int type1 = wires[wireid]->GetWire()->GetNeighborIDType1();
114// int type1 = wireT1_tem;
115// wires[type1]->AddType2(wireid);
116// wireT1_tem = wires[type1]->GetWire()->GetNeighborIDType1();
117// // int type2 = wires[wireid]->GetWire()->GetNeighborIDType2();
118// int type2 = wireT2_tem;
119// wires[type2]->AddType1(wireid);
120// wireT2_tem = wires[type2]->GetWire()->GetNeighborIDType2();
121// }
122//
123// vector<int> wireT3_tem=wires[wireid]->GetWire()->GetNeighborIDType3();
124// vector<int> wireT4_tem=wires[wireid]->GetWire()->GetNeighborIDType4();
125// for(int range=0;range<DiffLRange;range++){
126// //vector<int> type3 = wires[wireid]->GetWire()->GetNeighborIDType3();
127// int flag = 0;
128// vector<int> type3 = wireT3_tem;
129// for(unsigned int i=0;i<type3.size();i++){
130// wires[type3[i]]->AddType4(wireid);
131// vector<int> tem1 = wires[type3[i]]->GetWire()->GetNeighborIDType3();
132// vector<int> tem2 = wireT3_tem;
133// if(i==0){
134// wireT3_tem = wires[type3[i]]->GetWire()->GetNeighborIDType3();
135// }
136// else{
137// for(unsigned int k=0;k<tem1.size();k++){
138// for(unsigned int j=0;j<tem2.size();j++){
139// if(tem1.at(k)==tem2.at(j)){
140// flag = 1;
141// break;
142// }
143// }
144// if(flag==0){
145// wireT3_tem.push_back(tem1.at(k));
146// }
147// flag = 0;
148// }
149//
150// }
151// }
152// //vector<int> type4 = wires[wireid]->GetWire()->GetNeighborIDType4();
153// vector<int> type4 = wireT4_tem;
154// for(unsigned int i=0;i<type4.size();i++){
155// wires[type4[i]]->AddType3(wireid);
156// vector<int> tem1 = wires[type4[i]]->GetWire()->GetNeighborIDType4();
157// vector<int> tem2 = wireT4_tem;
158// if(i==0){
159// wireT3_tem = wires[type4[i]]->GetWire()->GetNeighborIDType4();
160// }
161// else{
162// for(unsigned int k=0;k<tem1.size();k++){
163// for(unsigned int j=0;j<tem2.size();j++){
164// if(tem1.at(k)==tem2.at(j)){
165// flag = 1;
166// break;
167// }
168// }
169// if(flag==0){
170// wireT4_tem.push_back(tem1.at(k));
171// }
172// flag = 0;
173// }
174// }
175// }
176// }
177//}
178//vector<vector<MdcDigi*> > GroupDigis;
179//vector<vector<MdcHitGroup*> > GroupHits;
180//for(int i=0;i<6796;i++){
181// // vector<MdcDigi*> group;
182// vector<MdcHitGroup*> groups;
183// vector<MdcHitGroup*> tem_store;
184// //bool flag=true;
185// if(!wires[i]->Used()){
186// tem_store.push_back(wires[i]);
187// while(!tem_store.empty()){
188// MdcHitGroup* tem_wire = tem_store.back();
189// tem_store.pop_back();
190// if(!tem_wire->Used())
191// {
192// groups.push_back(tem_wire);
193// tem_wire->SetUsedFlag();
194// for(unsigned int k = 0;k<tem_wire->GetNeiborHits().size();k++){
195// int neiID=tem_wire->GetNeiborHits().at(k);
196// if(!wires[neiID]->Used()){
197// tem_store.push_back(wires[neiID]);
198// }
199// }
200// }
201// }
202// }
203// if(!groups.empty()){
204// GroupHits.push_back(groups);
205// }
206// }
207// for(unsigned int i=0;i<GroupHits.size();i++){
208// //cout<<"group: "<<i<<endl;
209// vector<MdcDigi*> aGroup;
210// for(unsigned int j=0;j<GroupHits[i].size();j++){
211// vector<MdcDigi*> testdigis = GroupHits[i].at(j)->GetHit();
212// for(unsigned int k=0;k< testdigis.size();k++){
213// aGroup.push_back(testdigis.at(k));
214// // Identifier id = testdigis.at(k)->identify();
215// // int layer_id = MdcID::layer(id);
216// // int wire_id = MdcID::wire(id);
217// // cout<<"layer: "<<layer_id<<" wire: "<<wire_id<<endl;
218//
219// }
220// }
221// GroupDigis.push_back(aGroup);
222// }
223// for(int i=0;i<6796;i++){
224// delete wires[i];
225// }
226// wires.clear();
227// return GroupDigis;
228//}
229
230double MdcUtilitySvc::dPhi(double phi1, double phi2)
231{
232 double dphi=phi1-phi2;
233 while(dphi>M_PI) dphi-=M_PI*2.0;
234 while(dphi<-M_PI) dphi+=M_PI*2.0;
235 return dphi;
236}
237
238/*StatusCode MdcUtilitySvc::queryInterface(const InterfaceID& riid, void** ppvInterface){
239
240 if( IID_IMdcUtilitySvc.versionMatch(riid) ){
241 *ppvInterface = static_cast<IMdcUtilitySvc*> (this);
242 } else{
243 return Service::queryInterface(riid, ppvInterface);
244 }
245
246 addRef();
247 return StatusCode::SUCCESS;
248}*/
249
250// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
251int MdcUtilitySvc::nLayerTrackPassed(const double helixBes[5]) const{
252
253 HepVector helixBesParam(5,0);
254 for(int i=0; i<5; ++i) helixBesParam[i] = helixBes[i];
255
256 return nLayerTrackPassed(helixBesParam);
257}
258
259// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
260int MdcUtilitySvc::nLayerTrackPassed(const HepVector helixBes) const{
261 HepVector helix= besPar2PatPar(helixBes);
262
263 int nLayer = 0;
264
265 for(unsigned iLayer=0; iLayer<43; iLayer++){
266 //flightLength is the path length of track in the x-y plane
267 //guess flightLength by the radius in middle of the wire.
268 double rMidLayer = m_mdcGeomSvc->Layer(iLayer)->Radius();
269 double flightLength = rMidLayer;
270
271 HepPoint3D pivot(0.,0.,0.);
272 double dz = helix[3];
273 double c = CLHEP::c_light * 100.; //unit from m/s to cm/s
274 double alpha = 1/(c * Bz());//~333.567
275 double kappa = helix[2];
276 double rc = (-1.)*alpha/kappa;
277 //std::cout<<"MdcUtilitySvc alpha "<<alpha<<std::endl;
278 double tanl = helix[4];
279 double phi0 = helix[1];
280 double phi = flightLength/rc + phi0;//turning angle
281 double z = pivot.z() + dz - (alpha/kappa) * tanl * phi;
282
283 double layerHalfLength = m_mdcGeomSvc->Layer(iLayer)->Length()/2.;
284
285 //std::cout<<"MdcUtilitySvc length "<<layerHalfLength<<std::endl;
286
287 if (fabs(z) < fabs(layerHalfLength)) ++nLayer;
288 }
289
290 return nLayer;
291}
292
293// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
294HepVector MdcUtilitySvc::patPar2BesPar(const HepVector& helixPar) const{
295 HepVector helix(5,0);
296 double d0 = -helixPar[0]; //cm
297 double phi0 = helixPar[1]+ CLHEP::halfpi;
298 double omega = Bz()*helixPar[2]/-333.567;
299 double z0 = helixPar[3]; //cm
300 double tanl = helixPar[4];
301 helix[0] = d0;
302 helix[1] = phi0;
303 helix[2] = omega;
304 helix[3] = z0;
305 helix[4] = tanl;
306 //std::cout<<"helix "<<helix<<std::endl;
307 return helix;
308}
309
310// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
311HepSymMatrix MdcUtilitySvc::patErr2BesErr(const HepSymMatrix& err) const{
312 //error matrix
313 //std::cout<<" err1 "<<err<<" "<<err.num_row()<<std::endl;
314 //V(Y)=S * V(X) * ST , mS = S , mVy = V(Y) , err() = V(X)
315 //int n = err.num_row();
316 HepSymMatrix mS(err.num_row(),0);
317 mS[0][0]=-1.;//dr0=-d0
318 mS[1][1]=1.;
319
320 mS[2][2]=Bz()/-333.567;//pxy -> cpa
321 mS[3][3]=1.;
322 mS[4][4]=1.;
323 HepSymMatrix mVy= err.similarity(mS);
324 //std::cout<<" err2 "<<n<<" "<<mVy<<std::endl;
325 return mVy;
326}
327
328// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
329//-------position of track pass this layer--------------
330HepPoint3D MdcUtilitySvc::pointOnHelix(const HepVector helixBes, int layer, int innerOrOuter) const{
331 HepVector helixPat= besPar2PatPar(helixBes);
332 return pointOnHelixPatPar(helixPat, layer, innerOrOuter);
333}
334
335// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
336//-------position of track pass this layer--------------
337HepPoint3D MdcUtilitySvc::pointOnHelixPatPar(const HepVector helixPat, int layer, int innerOrOuter) const{
338
339 double rInner,rOuter;
340 //retrieve Mdc geometry information
341 double rCize1 =0.1* m_mdcGeomSvc->Layer(layer)->RCSiz1(); //mm -> cm
342 double rCize2 =0.1* m_mdcGeomSvc->Layer(layer)->RCSiz2(); //mm -> cm
343 double rLay =0.1* m_mdcGeomSvc->Layer(layer)->Radius(); //mm -> cm
344
345 //(conversion of the units mm(mc)->cm(rec))
346 rInner = rLay - rCize1 ; //radius of inner field wire
347 rOuter = rLay + rCize2 ; //radius of outer field wire
348
349 //int sign = -1; //assumed the first half circle
350 HepPoint3D piv(0.,0.,0.);
351 double r;
352 if (innerOrOuter) r = rInner;
353 else r = rOuter;
354
355 double d0 = helixPat[0];
356 double phi0 = helixPat[1];
357 double omega = helixPat[2];
358 double z0 = helixPat[3];
359 double tanl = helixPat[4];
360
361 double rc;
362 if (abs(omega) <Constants::epsilon) rc = 9999.;
363 else rc = 1./omega;
364 double xc = piv.x() + ( d0 + rc) * cos(phi0);
365 double yc = piv.y() + ( d0 + rc) * sin(phi0);
366 HepPoint3D helixCenter(xc,yc,0.0);
367 rc = sqrt(xc*xc + yc*yc);//?
368 double a,b,c;
369 a = r;
370 b = d0 + rc;
371 c = rc;
372 double dphi = acos((a*a-b*b-c*c)/(-2.*b*c));
373 double fltlen = dphi * rc;
374 double phi = phi0 * omega * fltlen;
375 double x = piv.x()+d0*sin(phi) - (rc+d0)*sin(phi0);
376 double y = piv.y()+d0*cos(phi) + (rc+d0)*cos(phi0);
377 double z = piv.z()+ z0 + fltlen*tanl;
378 //std::cout<<" xc yc "<<xc<<" "<<yc
379 if(m_debug) {
380 std::cout<<" abc "<<a<<" "<<b<<" "<<c<<" omega "<<omega<<" r "<<r<<" rc "<<rc<<" dphi "<<dphi<<" piv "<<piv.z()
381 <<" z0 "<<z0<<" fltlen "<<fltlen<<" tanl "<<tanl<<std::endl;
382 std::cout<<" pointOnHelixPatPar in Hel "<<helixPat<<std::endl;
383 cout<<"HepPoint3D(x, y, z) = "<<HepPoint3D(x, y, z)<<endl;
384 }
385 return HepPoint3D(x, y, z);
386}
387
388// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
389//1. from five track parameter and layer,cell to calculate the poca postion
390double MdcUtilitySvc::doca(int layer, int cell, const HepVector helixBes, const HepSymMatrix errMatBes, bool passCellRequired, bool doSag) const{
391 HepVector helixPat = besPar2PatPar(helixBes);
392 HepSymMatrix errMatPat= besErr2PatErr(errMatBes);
393
394 return docaPatPar(layer, cell, helixPat, errMatPat, passCellRequired, doSag);//call 4.
395}
396
397// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
398//2. from five track parameter, layer, cell , eastP, westP to calculate the poca postion
399double MdcUtilitySvc::doca(int layer, int cell,HepPoint3D eastP,HepPoint3D westP, const HepVector helixBes, const HepSymMatrix errMatBes, bool passCellRequired, bool doSag) const{
400 HepVector helixPat = besPar2PatPar(helixBes);
401 HepSymMatrix errMatPat= besErr2PatErr(errMatBes);
402
403 return docaPatPar(layer, cell, eastP, westP, helixPat, errMatPat, passCellRequired, doSag);//call 5.
404}
405
406// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
407//3. from five track parameter, layer, cell, sWire to calculate the doca postion
408double MdcUtilitySvc::doca(int layer, int cell, const MdcSWire* sWire, const HepVector helixBes,const HepSymMatrix errMatBes, bool passCellRequired) const{
409 HepVector helixPat = besPar2PatPar(helixBes);
410 HepSymMatrix errMatPat= besErr2PatErr(errMatBes);
411
412 return docaPatPar(layer, cell, sWire, helixPat, errMatPat, passCellRequired);//call 6.
413}
414
415// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
416//4. from five track parameter to calculate the doca postion by Pat Param
417double MdcUtilitySvc::docaPatPar(int layer, int cell, const HepVector helixPat, const HepSymMatrix errMat, bool passCellRequired, bool doSag) const{
418
419 const MdcGeoWire *geowir = m_mdcGeomSvc->Wire(layer,cell);
420 int id = geowir->Id();
421 double sag = 0.;
422 if(doSag) sag = geowir->Sag()/10.;//mm2cm
423 HepPoint3D eastP = geowir->Backward()/10.0;//mm2cm
424 HepPoint3D westP = geowir->Forward() /10.0;//mm2cm
425 const MdcSWire* sWire = new MdcSWire(eastP, westP, sag, id , cell);
426
427 double doca = docaPatPar(layer, cell, sWire, helixPat, errMat, passCellRequired);//call 6.
428
429 delete sWire;
430 return doca;
431}
432
433// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
434//5. from five track parameter to calculate the doca postion by Pat Param
435double MdcUtilitySvc::docaPatPar(int layer, int cell,HepPoint3D eastP,HepPoint3D westP, const HepVector helixPat,const HepSymMatrix errMat, bool passCellRequired, bool doSag) const{
436
437 const MdcGeoWire *geowir = m_mdcGeomSvc->Wire(layer,cell);
438 int id = geowir->Id();
439 double sag = 0.;
440 if(doSag) sag = geowir->Sag()/10.;//mm2cm
441 const MdcSWire* sWire = new MdcSWire(eastP, westP, sag, id , cell);//cm
442
443 double doca = docaPatPar(layer, cell, sWire, helixPat, errMat, passCellRequired);//call 6.
444
445 delete sWire;
446 return doca;
447}
448
449// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
450//6. from five track parameter to calculate the doca postion by Pat Param
451double MdcUtilitySvc::docaPatPar(int layer, int cell, const MdcSWire* sWire, const HepVector helixPat,const HepSymMatrix errMat, bool passCellRequired) const{
452
453 if(m_debug) std::cout<<" helixPat "<<helixPat<<std::endl;
454 if(m_debug) std::cout<<" layer "<<layer<<" cell "<<cell<<std::endl;
455 //-----cell track passed
456 int cellId_in = -1;
457 int cellId_out = -1;
458
459 //cellTrackPassedPatPar(helixPat,layer,cellId_in,cellId_out);//yzhang FIXME 2012-07-11
460 cellTrackPassedByPhiPatPar(helixPat,layer,cellId_in,cellId_out);//yzhang FIXME 2012-07-11
461
462 if(m_debug) {
463 std::cout<<" cellId in "<<cellId_in<<" out "<<cellId_out <<std::endl;
464 cout << "cell = " << cell << ", cellId_in = " << cellId_in << ", cellId_out = " << cellId_out << endl;
465 }
466 if (passCellRequired &&(cell < cellId_in && cell > cellId_out)) return -999.;
467
468 //-----helix trajectory
469 HelixTraj* helixTraj = new HelixTraj(helixPat,errMat);
470 const Trajectory* trajHelix = dynamic_cast<const Trajectory*> (helixTraj);
471
472 //-----pointOnHelix
473 int innerOrOuter = 1;
474 Hep3Vector cell_IO = pointOnHelixPatPar(helixPat,layer,innerOrOuter);
475 double fltTrack = 0.1 * m_mdcGeomSvc -> Layer(layer)->Radius();
476 if(m_debug) {
477 std::cout<<" cell_IO "<<cell_IO<<std::endl;
478 std::cout<<" fltTrack "<<fltTrack<<std::endl;
479 }
480
481 //------wire trajectory
482 const MdcSagTraj* m_wireTraj = sWire->getTraj();
483 const Trajectory* trajWire = dynamic_cast<const Trajectory*> (m_wireTraj);
484 const HepPoint3D* start_In = sWire->getEastPoint();
485 //const HepPoint3D* stop_In = sWire->getWestPoint();
486 if(m_debug){
487 std::cout<<" sag "<<m_wireTraj->sag()<<std::endl;
488 std::cout<< " east -------- "<< start_In->x()<<","<<start_In->y()<<","<<start_In->z()<<std::endl;
489 }
490 //std::cout<< " west -------- "<< stop_In->x()<<","<<stop_In->y()<<","<<stop_In->z() <<std::endl;
491
492 //------calc poca
493 double doca = -999.;
494 TrkPoca* trkPoca;
495 double zWire = cell_IO.z();
496 //HepPoint3D pos_in(zWire,sWire->xWireDC(zWire),sWire->yWireDC(zWire)) ;
497 HepPoint3D pos_in(sWire->xWireDC(zWire),sWire->yWireDC(zWire),zWire) ;
498 if(m_debug) std::cout<<" zWire "<<zWire<<" zEndDC "<<sWire->zEndDC()<<std::endl;
499 //if(m_debug) std::cout<<"pos_in "<<pos_in<<" fltWire "<<fltWire<<std::endl;
500
501 double fltWire = sqrt( (pos_in.x()-start_In->x())*(pos_in.x()-start_In->x()) +
502 (pos_in.y()-start_In->y())*(pos_in.y()-start_In->y()) +
503 (pos_in.z()-start_In->z())*(pos_in.z()-start_In->z()) );
504 trkPoca = new TrkPoca(*trajHelix, fltTrack, *trajWire, fltWire);
505 doca = trkPoca->doca();
506
507 double hitLen = trkPoca->flt2();
508 double startLen = trajWire->lowRange() - 5.;
509 double endLen = trajWire->hiRange() + 5.;
510 if(hitLen < startLen || hitLen > endLen) {
511 if(m_debug) std::cout<<"WARNING MdcUtilitySvc::docaPatPar() isBeyondEndflange! hitLen="<<hitLen <<" startLen="<<startLen<<" endLen "<<endLen<<std::endl;
512 doca = -998.;
513 }
514 //std::cout<<" hitLen "<<hitLen<<" startLen "<<startLen<<" endLen "<<endLen <<" doca "<<doca<<std::endl;
515
516 if(m_debug) std::cout<<" doca "<<doca<<std::endl;
517 delete helixTraj;
518 delete trkPoca;
519
520 return doca;
521
522} //----------end of calculatng the doca ---------------------------------//
523
524/*
525// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
526void MdcUtilitySvc::cellPassed(const RecMdcTrack* tk, bool cellTkPassed[43][288]) const{
527HepVector helix(5);
528helix[0]=tk->helix(0);
529helix[1]=tk->helix(1);
530helix[2]=tk->helix(2);
531helix[3]=tk->helix(3);
532helix[4]=tk->helix(4);
533
534for(int i=0;i<43;i++){
535for(int j=0; j<288; j++){
536cellTkPassed[i][j]=false;
537}
538}
539
540for (int layer=0; layer<43; layer++){
541//-----cell track passed
542
543int cellId_in = -1;
544int cellId_out = -1;
545cellTrackPassed(helix,layer,cellId_in,cellId_out);
546cellTkPassed[layer][cellId_in] = true;
547cellTkPassed[layer][cellId_out] = true;
548}
549}
550*/
551// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
552bool MdcUtilitySvc::cellTrackPassedByPhi(const HepVector helixBes,int layer,int& cellId_in,int& cellId_out) const{
553 HepVector helixPat = besPar2PatPar(helixBes);
554 return cellTrackPassedByPhiPatPar(helixPat, layer, cellId_in, cellId_out);
555}
556
557// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
558// guess cell number of track passed given layer,
559// if passed more than one cell return 0, else return 1.
560// calc with phi , PAT track parameter convention
561bool MdcUtilitySvc::cellTrackPassedByPhiPatPar(const HepVector helixPat,int layer,int& cellId_in,int& cellId_out) const{
562 int nCell = m_mdcGeomSvc->Layer(layer)->NCell();
563
564 double dPhiz = (m_mdcGeomSvc->Wire(layer,0)->Forward().phi() - m_mdcGeomSvc->Wire(layer,0)->Backward().phi())*0.5;
565 double rEnd = m_mdcGeomSvc->Wire(layer,0)->Backward().rho()/10.;//mm2cm
566 double rMid = rEnd * cos(dPhiz);
567 //std::cout<<"( cell "<<0<<" westPphi "<<m_mdcGeomSvc->Wire(layer,0)->Forward().phi() <<" eastPphi "
568 //<<m_mdcGeomSvc->Wire(layer,0)->Backward().phi()<<" twist "<<dPhiz<<" rend "<<rEnd<<std::endl;
569 double fltLenIn = rMid;
570 double phiIn = helixPat[1] + helixPat[2]*fltLenIn;//phi0 + omega * L
571
572 double phiEPOffset = m_mdcGeomSvc->Wire(layer,0)->Backward().phi();//east.phi()= BackWard.phi
573 BesAngle tmp(phiIn - phiEPOffset);
574 if(m_debug) std::cout<<"cellTrackPassed nCell "<<nCell<<" layer "<<layer<<" fltLenIn "<<fltLenIn<<" phiEPOffset "<<phiEPOffset<<std::endl;
575 //BesAngle tmp(phiIn - layPtr->phiEPOffset());
576 int wlow = (int)floor(nCell * tmp.rad() / twopi );
577 int wbig = (int)ceil(nCell * tmp.rad() / twopi );
578 if (tmp == 0 ){ wlow = -1; wbig = 1; }
579
580 if ((wlow%nCell)< 0) wlow += nCell;
581 cellId_in = wlow;
582
583 if ((wbig%nCell)< 0) wbig += nCell;
584 cellId_out = wbig;
585
586 bool passedOneCell = (cellId_in == cellId_out);
587
588 return passedOneCell;//pass more than one cell
589}
590
591// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
592bool MdcUtilitySvc::cellTrackPassedPatPar(HepVector helixPat, int layer,int& cellId_in,int& cellId_out) const{
593 HepVector helixBes = patPar2BesPar(helixPat);
594 return cellTrackPassed(helixBes, layer, cellId_in, cellId_out);
595}
596
597// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
598// calc with Belle method, bes3 track parameter convention
599bool MdcUtilitySvc::cellTrackPassed(HepVector helixBes, int lay,int& cellId_in,int& cellId_out) const{
600 int charge,type,nCell;
601 double dr0,phi0,kappa,dz0,tanl;
602 double ALPHA_loc,rho,phi,cosphi0,sinphi0,x_hc,y_hc,z_hc;
603 double dphi0,IO_phi,C_alpha,xx,yy;
604 double inlow,inup,outlow,outup,phi_in,phi_out,phi_bin;
605 double rCize1,rCize2,rLay,length,phioffset,slant,shift;
606 double m_crio[2], phi_io[2], stphi[2],phioff[2],dphi[2];
607
608 dr0 = helixBes[0];
609 phi0 = helixBes[1];
610 kappa = helixBes[2];
611 dz0 = helixBes[3];
612 tanl = helixBes[4];
613
614 ALPHA_loc = 1000/(2.99792458*Bz()); //magnetic field const
615 charge = ( kappa >=0 ) ? 1 : -1 ;
616 rho = ALPHA_loc/kappa ;
617 double pi = Constants::pi;
618 phi = fmod(phi0 + 4*pi , 2*pi);
619 cosphi0 = cos(phi);
620 sinphi0 = (1.0 - cosphi0 ) * (1.0 + cosphi0 );
621 sinphi0 = sqrt(( sinphi0 > 0.) ? sinphi0 : 0.);
622 if( phi > pi ) sinphi0 = -sinphi0 ;
623
624 x_hc = 0. + ( dr0 + rho ) * cosphi0;
625 y_hc = 0. + ( dr0 + rho ) * sinphi0;
626 z_hc = 0. + dz0;
627
628
629 HepPoint3D piv(0.,0.,0.);
630 HepPoint3D hcenter(x_hc,y_hc,0.0);
631
632 double m_c_perp(hcenter.perp());
633 Hep3Vector m_c_unit((HepPoint3D)hcenter.unit());
634 HepPoint3D IO = (-1) * charge * m_c_unit;
635
636 dphi0 = fmod(IO.phi()+4*pi, 2*pi) - phi;
637 IO_phi = fmod(IO.phi()+4*pi, 2*pi);
638
639 if(dphi0 > pi) dphi0 -= 2*pi;
640 else if(dphi0 < -pi) dphi0 += 2*pi;
641
642 phi_io[0] = -(1+charge)*pi/2 - charge*dphi0;
643 phi_io[1] = phi_io[0]+1.5*pi;
644
645
646 bool outFlag = false;
647 //retrieve Mdc geometry information
648 rCize1 = 0.1 * m_mdcGeomSvc->Layer(lay)->RCSiz1(); //mm -> cm
649 rCize2 = 0.1 * m_mdcGeomSvc->Layer(lay)->RCSiz2(); //mm -> cm
650 rLay = 0.1 * m_mdcGeomSvc->Layer(lay)->Radius(); //mm -> cm
651 length = 0.1 * m_mdcGeomSvc->Layer(lay)->Length(); //mm -> cm
652 //double halfLength=length/2.;
653 //(conversion of the units mm(mc)->cm(rec))
654 nCell = m_mdcGeomSvc->Layer(lay)->NCell();
655 phioffset = m_mdcGeomSvc->Layer(lay)->Offset();
656 slant = m_mdcGeomSvc->Layer(lay)->Slant();
657 shift = m_mdcGeomSvc->Layer(lay)->Shift();
658 type = m_mdcGeomSvc->Layer(lay)->Sup()->Type();
659
660 m_crio[0] = rLay - rCize1 ; //radius of inner field wir ( beam pipe)
661 m_crio[1] = rLay + rCize2 ; //radius of outer field wir ( beam pipe)
662
663 int sign = -1; //assumed the first half circle
664
665 Hep3Vector iocand[2];
666 Hep3Vector cell_IO[2];
667
668 for(int ii =0; ii<2; ii++){
669 // By law of cosines to calculate the alpha(up and down field wir_Ge)
670 double cos_alpha = (m_c_perp*m_c_perp + m_crio[ii]*m_crio[ii] - rho*rho)
671 / ( 2 * m_c_perp * m_crio[ii] );
672 if(fabs(cos_alpha)>1&&(ii==0)){
673 cos_alpha = -1;
674 outFlag=true;
675 }
676 if(fabs(cos_alpha)>1&&(ii==1)){
677 cos_alpha = (m_c_perp*m_c_perp + m_crio[0]*m_crio[0] - rho*rho)
678 / ( 2 * m_c_perp * m_crio[0] );
679 C_alpha = 2*pi - acos( cos_alpha);
680 }else {
681 C_alpha = acos( cos_alpha );
682 }
683
684 iocand[ii] = m_c_unit;
685 iocand[ii].rotateZ( charge*sign*C_alpha );
686 iocand[ii] *= m_crio[ii];
687
688 xx = iocand[ii].x() - x_hc ;
689 yy = iocand[ii].y() - y_hc ;
690
691 dphi[ii] = atan2(yy,xx) - phi0 - 0.5*pi*(1-charge);
692 dphi[ii] = fmod( dphi[ii] + 8.0*pi,2*pi);
693
694
695 if( dphi[ii] < phi_io[0] ) {
696 dphi[ii] += 2*pi;
697 }else if( dphi[ii] > phi_io[1] ){ //very very nausea
698 dphi[ii] -= 2*pi;
699 }
700
701 cell_IO[ii] = Hel(piv, dr0, phi, ALPHA_loc, kappa,dz0, dphi[ii], tanl);
702
703 //cout<<" cell_IO["<<ii<<"] : "<<cell_IO[ii]<<endl;
704 if( (cell_IO[ii].x()==0 ) && (cell_IO[ii].y()==0) && (cell_IO[ii].z()==0)) continue;
705 }
706 //if(((fabs(cell_IO[0].z())*10-halfLength)>-7.) && ((fabs(cell_IO[1].z())*10-halfLength)>-7.))return true; //Out sensitive area
707
708 cellId_in = cellId_out = -1 ;
709 phi_in = cell_IO[0].phi();
710 phi_in = fmod ( phi_in + 4 * pi, 2 * pi );
711 phi_out = cell_IO[1].phi();
712 phi_out = fmod ( phi_out + 4 * pi, 2 * pi );
713 phi_bin = 2.0 * pi / nCell ;
714
715 //determine the in/out cell id
716 stphi[0] = shift * phi_bin * (0.5 - cell_IO[0].z()/length);
717 stphi[1] = shift * phi_bin * (0.5 - cell_IO[1].z()/length);
718 //stphi[0],stphi[1] to position fo z axis ,the angle of deflxsion in x_Y
719
720 phioff[0] = phioffset + stphi[0];
721 phioff[1] = phioffset + stphi[1];
722
723 for(int kk = 0; kk<nCell ; kk++){
724 //for stereo layer
725 inlow = phioff[0] + phi_bin*kk - phi_bin*0.5;
726 inlow = fmod( inlow + 4.0 * pi , 2.0 * pi);
727 inup = phioff[0] + phi_bin*kk + phi_bin*0.5;
728 inup = fmod( inup + 4.0 * pi , 2.0 * pi);
729 outlow = phioff[1] + phi_bin*kk - phi_bin*0.5;
730 outlow = fmod( outlow + 4.0 * pi ,2.0 * pi);
731 outup = phioff[1] + phi_bin*kk + phi_bin*0.5;
732 outup = fmod( outup + 4.0 * pi , 2.0 * pi);
733
734 if((phi_in>=inlow && phi_in<=inup)) cellId_in = kk;
735 if((phi_out>=outlow&&phi_out<outup)) cellId_out = kk;
736 if(inlow > inup ){
737 if((phi_in>=inlow&&phi_in<2.0*pi)||(phi_in>=0.0&&phi_in<inup)) cellId_in = kk;
738 }
739 if(outlow>outup){
740 if((phi_out>=outlow&&phi_out<=2.0*pi)||(phi_out>=0.0&&phi_out<outup)) cellId_out = kk;
741 }
742 }//end of nCell loop
743
744 return (cellId_in==cellId_out);
745}
746
747HepPoint3D MdcUtilitySvc::Hel(HepPoint3D piv, double dr,double phi0,double Alpha_L,double kappa,double dz,double dphi,double tanl) const{
748 double x = piv.x() + dr*cos(phi0) + (Alpha_L/kappa) * (cos(phi0) - cos(phi0+dphi));
749 double y = piv.y() + dr*sin(phi0) + (Alpha_L/kappa) * (sin(phi0) - sin(phi0+dphi));
750 double z = piv.z() + dz - (Alpha_L/kappa) * dphi * tanl;
751 //cout<<"HepPoint3D(x, y, z) = "<<HepPoint3D(x, y, z)<<endl;
752 if((x>-1000. && x<1000.) || (y >-1000. && y <1000. ) ||(z>-1000. && z<1000.)){
753 return HepPoint3D(x, y, z);
754 }else{
755 return HepPoint3D(0,0,0);
756 }
757}
758
759
760// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
761HepVector MdcUtilitySvc::besPar2PatPar(const HepVector& helixPar) const{
762 HepVector helix(5,0);
763 double d0 = -helixPar[0]; //cm
764 double phi0 = helixPar[1]+ CLHEP::halfpi;
765 double omega = Bz()*helixPar[2]/-333.567;
766 double z0 = helixPar[3]; //cm
767 double tanl = helixPar[4];
768 helix[0] = d0;
769 helix[1] = phi0;
770 helix[2] = omega;
771 helix[3] = z0;
772 helix[4] = tanl;
773 return helix;
774}
775
776// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
777HepSymMatrix MdcUtilitySvc::besErr2PatErr(const HepSymMatrix& err) const{
778 //error matrix
779 //std::cout<<" err1 "<<err<<" "<<err.num_row()<<std::endl;
780 //V(Y)=S * V(X) * ST , mS = S , mVy = V(Y) , err() = V(X)
781 //int n = err.num_row();
782 HepSymMatrix mS(err.num_row(),0);
783 mS[0][0]=-1.;//dr0=-d0
784 mS[1][1]=1.;
785 mS[2][2]=Bz()/-333.567;//pxy -> cpa
786 mS[3][3]=1.;
787 mS[4][4]=1.;
788 HepSymMatrix mVy= err.similarity(mS);
789 //std::cout<<" err2 "<<n<<" "<<mVy<<std::endl;
790 return mVy;
791}
792
793double MdcUtilitySvc::p_cms(HepVector helix, int runNo, double mass) const{
794 HepLorentzVector p4;
795 p4.setPx(- sin(helix[1]) / fabs(helix[2]));
796 p4.setPy(cos(helix[1]) / fabs(helix[2]));
797 p4.setPz(helix[4] / fabs(helix[2]));
798 double p3 = p4.mag();
799 mass = 0.000511;
800 p4.setE(sqrt(p3 * p3 + mass * mass));
801
802 double ecm;
803 if (runNo > 9815) {
804 ecm = 3.097;
805 }else{
806 ecm = 3.68632;
807 }
808 double zboost = 0.0075;
809 //HepLorentzVector psip(0.011 * 3.68632, 0, 0.0075, 3.68632);
810 HepLorentzVector psip(0.011 * ecm, 0, zboost, ecm);
811 //cout << setw(15) << ecm << setw(15) << zboost << endl;
812 Hep3Vector boostv = psip.boostVector();
813
814 //std::cout<<__FILE__<<" boostv "<<boostv<< std::endl;
815 p4.boost(- boostv);
816
817 //std::cout<<__FILE__<<" p4 "<<p4<< std::endl;
818 double p_cms = p4.rho();
819 //phicms = p4.phi();
820 //p4.boost(boostv);
821
822 return p_cms;
823}
824
825Hep3Vector MdcUtilitySvc::momentum(const RecMdcTrack* trk) const{
826 // double dr = trk->helix(0);
827 double fi0 = trk->helix(1);
828 double cpa = trk->helix(2);
829 double tanl = trk->helix(4);
830
831 double pxy = 0.;
832 if(cpa != 0) pxy = 1/fabs(cpa);
833
834 double px = pxy * (-sin(fi0));
835 double py = pxy * cos(fi0);
836 double pz = pxy * tanl;
837
838 Hep3Vector p;
839 p.set(px, py, pz); // MeV/c
840 return p;
841}
842
843double MdcUtilitySvc::probab(const int& ndof, const double& chisq) const{
844
845 //constants
846 double srtopi=2.0/sqrt(2.0*M_PI);
847 double upl=100.0;
848
849 double prob=0.0;
850 if(ndof<=0) {return prob;}
851 if(chisq<0.0) {return prob;}
852 if(ndof<=60) {
853 //full treatment
854 if(chisq>upl) {return prob;}
855 double sum=exp(-0.5*chisq);
856 double term=sum;
857
858 int m=ndof/2;
859 if(2*m==ndof){
860 if(m==1){return sum;}
861 for(int i=2; i<=m;i++){
862 term=0.5*term*chisq/(i-1);
863 sum+=term;
864 }//(int i=2; i<=m)
865 return sum;
866 //even
867
868 }else{
869 //odd
870 double srty=sqrt(chisq);
871 double temp=srty/M_SQRT2;
872 prob=erfc(temp);
873 if(ndof==1) {return prob;}
874 if(ndof==3) {return (srtopi*srty*sum+prob);}
875 m=m-1;
876 for(int i=1; i<=m; i++){
877 term=term*chisq/(2*i+1);
878 sum+=term;
879 }//(int i=1; i<=m; i++)
880 return (srtopi*srty*sum+prob);
881
882 }//(2*m==ndof)
883
884 }else{
885 //asymtotic Gaussian approx
886 double srty=sqrt(chisq)-sqrt(ndof-0.5);
887 if(srty<12.0) {prob=0.5*erfc(srty);};
888
889 }//ndof<30
890
891 return prob;
892}//endof probab
893
894
896 // get PartPropSvc
897 IPartPropSvc* partPropSvc;
898 static const bool CREATEIFNOTTHERE(true);
899 StatusCode sc=service("PartPropSvc",partPropSvc,CREATEIFNOTTHERE);
900 if(!sc.isSuccess()||nullptr==partPropSvc){
901 cout<< " Could not initialize Particle Properties Service" << endl;
902 }
903 HepPDT::ParticleDataTable* particleTable = partPropSvc->PDT();
904 if(particleTable->particle(mcParticle->particleProperty())){
905 return particleTable->particle(mcParticle->particleProperty())->charge();
906 }
907 return -1e6;
908}
909
911 if(nullptr==mcParticle) return;
912 pos.setX(mcParticle->initialPosition().x());
913 pos.setY(mcParticle->initialPosition().y());
914 pos.setZ(mcParticle->initialPosition().z());
915 mom.setX(mcParticle->initialFourMomentum().px());
916 mom.setY(mcParticle->initialFourMomentum().py());
917 mom.setZ(mcParticle->initialFourMomentum().pz());
918}
919
921 if(nullptr==mcParticle) return;
922 Hep3Vector pos,mom;
923 pos.setX(mcParticle->initialPosition().x());
924 pos.setY(mcParticle->initialPosition().y());
925 pos.setZ(mcParticle->initialPosition().z());
926 mom.setX(mcParticle->initialFourMomentum().px());
927 mom.setY(mcParticle->initialFourMomentum().py());
928 mom.setZ(mcParticle->initialFourMomentum().pz());
929
930 Helix helixTemp(pos,mom,
931 getChargeOfMcParticle(mcParticle));
932 helixTemp.pivot(HepPoint3D(0,0,0));
933 helix.set(helixTemp.pivot(),helixTemp.a(),helixTemp.Ea());
934}
935
937 const std::map<int,std::map<MdcDigi*,MdcMcHit*> > mdcMCAssociation,
938 MdcDigiVec& mdcDigiInput, MdcDigiVec& mdcDigiAssociated){
939 MdcDigiVec::iterator iter=mdcDigiInput.begin();
940 //auto iter=mdcDigiVecInput.begin();
941 for(;iter!=mdcDigiInput.end();iter++){
942 std::map<int, std::map<MdcDigi*,MdcMcHit*> >::const_iterator itMap0=
943 mdcMCAssociation.find(trackIndex);
944 if(itMap0!=mdcMCAssociation.end()){
945 std::map<MdcDigi*,MdcMcHit*>::const_iterator itMap=
946 (*itMap0).second.find(*iter);
947 MdcMcHit* mcHit;
948 if(itMap!=(*itMap0).second.end()){ mcHit=itMap->second; }
949 if( (trackIndex==mcHit->getTrackIndex())
950 && (mcHit->getCreatorProcess()=="Generator"||
951 mcHit->getCreatorProcess()=="Decay") ){
952 mdcDigiAssociated.push_back(*iter);
953 }
954 }
955 }
956}
957
959 const MdcDigiVec mdcDigiVecInput,
960 std::map<int,std::map<MdcDigi*,MdcMcHit*> >& mdcMCAssociation){
961
962 ///---get MDC MC hits and make a map vs wire id
963 IDataProviderSvc* eventSvc = NULL;
964 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
965 SmartDataPtr<Event::MdcMcHitCol> mdcMcHitCol(eventSvc,"/Event/MC/MdcMcHitCol");
966 if(!mdcMcHitCol){
967 std::cout<<"MdcUtilitySvc::getMdcMCAssoiciation() does not find MdcMcHitCol!"<<std::endl;
968 return;
969 }
970 std::map<int,Event::MdcMcHit*> mdcMcHitMap;
971 Event::MdcMcHitCol::iterator iterMdcMcHit=mdcMcHitCol->begin();
972 for(;iterMdcMcHit!=mdcMcHitCol->end();iterMdcMcHit++ )
973 {
974 int id=m_mdcGeomSvc->Wire(MdcID::layer((*iterMdcMcHit)->identify()),
975 MdcID::wire((*iterMdcMcHit)->identify()))->Id();
976 mdcMcHitMap.insert(std::pair<int,Event::MdcMcHit*>(id,*iterMdcMcHit));
977 }
978
979 ///loop over MdcDigi
980 MdcDigiVec::const_iterator iterMdcDigi=mdcDigiVecInput.begin();
981 for(;iterMdcDigi!=mdcDigiVecInput.end();iterMdcDigi++){
982 int digiTrackIndex=(*iterMdcDigi)->getTrackIndex();
983 std::cout<<__FILE__<<" "<<__LINE__<<" "<<digiTrackIndex<<std::endl;
984 if(digiTrackIndex>999) digiTrackIndex-=1000;//FIXME
985 if(digiTrackIndex!=digiTrackIndex) continue;
986 int id=m_mdcGeomSvc->Wire(MdcID::layer((*iterMdcMcHit)->identify()),
987 MdcID::wire((*iterMdcMcHit)->identify()))->Id();
988 std::map<MdcDigi*, MdcMcHit*> temp;
989 std::map<int,Event::MdcMcHit*>::iterator itMdcMcHit=mdcMcHitMap.find(id);
990 if(itMdcMcHit!=mdcMcHitMap.end()){
991 temp.insert(make_pair(*iterMdcDigi,(*itMdcMcHit).second));
992 mdcMCAssociation.insert(make_pair(trackIndex, temp));
993 //mdcMCAssociation.insert(std::pair<int,std::map<MdcDigi*,MdcMcHit*> >
994 //(trackIndex,make_pair(*iterMdcDigi,mdcMcHitMap[id])));
995 }
996 }
997
998}//end of getMdcMCAssoiciation
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
double mass
int runNo
Definition: DQA_TO_DB.cxx:12
Double_t phi2
Double_t x[10]
Double_t phi1
EvtComplex exp(const EvtComplex &c)
Definition: EvtComplex.hh:252
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
const double alpha
std::vector< MdcDigi * > MdcDigiVec
HepGeom::Point3D< double > HepPoint3D
HepGeom::Point3D< double > HepPoint3D
Definition: MdcUtilitySvc.h:32
#define M_PI
Definition: TConstant.h:4
#define NULL
double rad() const
Definition: BesAngle.h:118
static const double pi
Definition: Constants.h:38
static const double epsilon
Definition: Constants.h:46
const HepVector helix() const
......
const HepLorentzVector & initialPosition() const
Retrieve pointer to the start, end vertex positions.
Definition: McParticle.cxx:95
const HepLorentzVector & initialFourMomentum() const
Definition: McParticle.cxx:103
StdHepId particleProperty() const
Retrieve particle property.
Definition: McParticle.cxx:7
std::string getCreatorProcess() const
Definition: MdcMcHit.h:79
unsigned int getTrackIndex() const
Definition: MdcMcHit.cxx:28
void set(const HepPoint3D &pivot, const HepVector &a, const HepSymMatrix &Ea)
sets helix pivot position, parameters, and error matrix.
const HepSymMatrix & Ea(void) const
returns error matrix.
const HepVector & a(void) const
returns helix parameters.
const HepPoint3D & pivot(void) const
returns pivot position.
double Radius(void) const
Definition: MdcGeoLayer.h:160
double Slant(void) const
Definition: MdcGeoLayer.h:158
double RCSiz2(void) const
Definition: MdcGeoLayer.h:163
double Length(void) const
Definition: MdcGeoLayer.h:161
MdcGeoSuper * Sup(void) const
Definition: MdcGeoLayer.h:174
double Shift(void) const
Definition: MdcGeoLayer.h:167
double RCSiz1(void) const
Definition: MdcGeoLayer.h:162
int NCell(void) const
Definition: MdcGeoLayer.h:165
double Offset(void) const
Definition: MdcGeoLayer.h:166
int Type(void) const
Definition: MdcGeoSuper.h:35
const double Sag(void) const
Definition: MdcGeoWire.cxx:12
HepPoint3D Forward(void) const
Definition: MdcGeoWire.h:129
int Id(void) const
Definition: MdcGeoWire.h:127
HepPoint3D Backward(void) const
Definition: MdcGeoWire.h:128
const MdcGeoWire *const Wire(unsigned id)
Definition: MdcGeomSvc.cxx:766
const MdcGeoLayer *const Layer(unsigned id)
Definition: MdcGeomSvc.cxx:782
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
double yWireDC(double z) const
Definition: MdcSWire.h:62
double xWireDC(double z) const
Definition: MdcSWire.h:61
double zEndDC(void) const
Definition: MdcSWire.h:49
const MdcSagTraj * getTraj(void) const
Definition: MdcSWire.h:34
const HepPoint3D * getEastPoint(void) const
Definition: MdcSWire.h:32
double sag(void) const
Definition: MdcSagTraj.h:80
HepVector besPar2PatPar(const HepVector &helixPar) const
bool cellTrackPassedByPhi(const HepVector helix, int layer, int &cellId_in, int &cellId_out) const
virtual StatusCode initialize()
HepSymMatrix patErr2BesErr(const HepSymMatrix &err) const
HepPoint3D Hel(HepPoint3D piv, double dr, double phi0, double Alpha_L, double kappa, double dz, double dphi, double tanl) const
MdcDigiVec getMdcDigiVec() const
HepSymMatrix besErr2PatErr(const HepSymMatrix &err) const
float getChargeOfMcParticle(const Event::McParticle *mcParticle)
void getMdcMCAssoiciation(int trackIndex, const std::vector< MdcDigi * > mdcDigiVecInput, std::map< int, std::map< MdcDigi *, Event::MdcMcHit * > > &mdcMCAssociation)
Get association of MdcDigi and MdcMcHit according to track id.
bool cellTrackPassedByPhiPatPar(const HepVector helix, int layer, int &cellId_in, int &cellId_out) const
HepVector patPar2BesPar(const HepVector &helixPar) const
void getHelixOfMcParticle(const Event::McParticle *mcParticle, Helix &helix)
virtual StatusCode finalize()
void getMomPosOfMcParticle(const Event::McParticle *mcParticle, HepVector3D &pos, HepVector3D &mom)
double probab(const int &ndof, const double &chisq) const
Hep3Vector momentum(const RecMdcTrack *trk) const
double doca(int layer, int cell, const HepVector helix, const HepSymMatrix errMat, bool passCellRequired=true, bool doSag=true) const
int nLayerTrackPassed(const HepVector helix) const
bool cellTrackPassed(const HepVector helix, int layer, int &cellId_in, int &cellId_out) const
void getMdcDigiOnMcParticle(int trackIndex, const std::map< int, std::map< MdcDigi *, Event::MdcMcHit * > > mdcMCAssociation, MdcDigiVec &mdcDigiInput, MdcDigiVec &mdcDigiAssociated)
double p_cms(HepVector helix, int runNo, double mass) const
double docaPatPar(int layer, int cell, const HepVector helixPat, const HepSymMatrix errMatPat, bool passCellRequired=true, bool doSag=true) const
HepPoint3D pointOnHelixPatPar(const HepVector helixPat, int lay, int innerOrOuter) const
HepPoint3D pointOnHelix(const HepVector helixPar, int lay, int innerOrOuter) const
bool cellTrackPassedPatPar(const HepVector helix, int layer, int &cellId_in, int &cellId_out) const
MdcDigiVec & getMdcDigiVec(uint32_t control=0)
double lowRange() const
Definition: Trajectory.h:91
double hiRange() const
Definition: Trajectory.h:92
double flt2() const
Definition: TrkPocaBase.h:68
double doca() const
Definition: TrkPoca.h:56
double y[1000]
Definition: Event.h:21
float charge
double double double * p4
Definition: qcdloop1.h:77
double double * p3
Definition: qcdloop1.h:76
const double b
Definition: slope.cxx:9
const float pi
Definition: vector3.h:133