1#include "MdcNavigation/MdcNavigation.h"
2#include "GaudiKernel/MsgStream.h"
3#include "GaudiKernel/SmartDataPtr.h"
4#include "EventNavigator/EventNavigator.h"
6#include "HepPDT/ParticleDataTable.hh"
7#include "HepPDT/ParticleData.hh"
8#include "GaudiKernel/IPartPropSvc.h"
9#include "CLHEP/Geometry/Point3D.h"
10#include "EventModel/EventModel.h"
11#include "EventModel/Event.h"
12#include "EventModel/EventHeader.h"
13#include "RawEvent/RawDataUtil.h"
14#include "MdcGeom/Constants.h"
16#include "MdcGeom/BesAngle.h"
17#include "TrkBase/HelixTraj.h"
18#include "CLHEP/Matrix/SymMatrix.h"
19#include "TrkBase/TrkPocaBase.h"
20#include "TrkBase/TrkPoca.h"
21#include "MdcGeom/MdcLayer.h"
22#include "MdcGeom/MdcDetector.h"
23#include "MdcData/MdcHit.h"
25#include "Identifier/MdcID.h"
26#include "MdcRawEvent/MdcDigi.h"
27#include "EvTimeEvent/RecEsTime.h"
29#include "GaudiKernel/INTupleSvc.h"
30#include "GaudiKernel/NTuple.h"
32#ifndef ENABLE_BACKWARDS_COMPATIBILITY
45 Algorithm(name, pSvcLocator) {
46 declareProperty(
"hist", m_hist = 0);
47 declareProperty(
"nMcHit", m_nMcHit= 5);
48 declareProperty(
"mc", m_mc = 1);
50 declareProperty(
"maxMdcDigi", m_maxMdcDigi= 0);
51 declareProperty(
"keepBadTdc", m_keepBadTdc= 0);
52 declareProperty(
"dropHot", m_dropHot= 0);
53 declareProperty(
"keepUnmatch", m_keepUnmatch= 0);
55 declareProperty(
"poca", m_poca =
false);
56 declareProperty(
"doSag", m_doSag =
false);
58 declareProperty(
"d0Cut", m_d0Cut= 1.);
59 declareProperty(
"z0Cut", m_z0Cut= 10.);
60 declareProperty(
"debug", m_debug = 0);
68 MsgStream log(
msgSvc(), name());
69 StatusCode sc = StatusCode::SUCCESS;
73 sc = service (
"MagneticFieldSvc",m_pIMF);
74 if(sc!=StatusCode::SUCCESS) {
75 log << MSG::ERROR <<
"Unable to open Magnetic field service"<<endreq;
76 return StatusCode::FAILURE;
81 IPartPropSvc* p_PartPropSvc;
82 static const bool CREATEIFNOTTHERE(
true);
83 sc = service(
"PartPropSvc", p_PartPropSvc, CREATEIFNOTTHERE);
84 if (!sc.isSuccess() || 0 == p_PartPropSvc) {
85 log << MSG::ERROR <<
" Could not initialize PartPropSvc" << endreq;
89 m_particleTable = p_PartPropSvc->PDT();
92 sc = service (
"RawDataProviderSvc", irawDataProviderSvc);
94 if ( sc.isFailure() ){
95 log << MSG::FATAL <<
"Could not load RawDataProviderSvc!" << endreq;
96 return StatusCode::FAILURE;
102 if (!sc.isSuccess()) {
103 log << MSG::WARNING <<
" Could not book NTuple" << endreq;
108 keepedParticles =
new int(211);
111 return StatusCode::SUCCESS;
115 MsgStream log(
msgSvc(), name());
116 log << MSG::INFO <<
"in beginRun()" << endreq;
119 if(NULL == m_gm)
return StatusCode::FAILURE;
121 return StatusCode::SUCCESS;
127 setFilterPassed(
false);
128 MsgStream log(
msgSvc(), name());
129 StatusCode sc = StatusCode::SUCCESS;
132 SmartDataPtr<EventNavigator> navigator (eventSvc(),
"/Event/Navigator");
134 log << MSG::WARNING<<
" Unable to retrieve EventNavigator" << endreq;
137 SmartDataPtr<RecMdcTrackCol> recMdcTrackCol(eventSvc(),
"/Event/Recon/RecMdcTrackCol");
138 SmartDataPtr<RecMdcHitCol> recMdcHitCol(eventSvc(),
"/Event/Recon/RecMdcHitCol");
143 if ( sc!=StatusCode::SUCCESS ) {
144 return StatusCode::FAILURE;
149 SmartDataPtr<Event::McParticleCol> mcParticles(eventSvc(),
"/Event/MC/McParticleCol");
150 SmartDataPtr<Event::MdcMcHitCol> mcHit(eventSvc(),
"/Event/MC/MdcMcHitCol");
151 if( ! mcParticles ) {
152 log << MSG::WARNING<<
" Unable to retrieve McParticleCol" << endreq;
156 McParticleCol::iterator it= mcParticles->begin();
157 log <<MSG::INFO <<
"mcParticles size = "<<mcParticles->size() << endreq;
158 for(; it!= mcParticles->end(); it++ ) {
168 if (!recMdcTrackCol){
169 log << MSG::WARNING<<
" Unable to retrieve recMdcTrackCol" << endreq;
170 return StatusCode::SUCCESS;
172 t_recTkNum = recMdcTrackCol->size();
175 RecMdcTrackCol::iterator it = recMdcTrackCol->begin();
176 for(;it != recMdcTrackCol->end(); it++ ) {
177 if ( m_mc && navigator ) {
179 t_mcTkNum = particles.size();
182 if ( sc!=StatusCode::SUCCESS )
return StatusCode::FAILURE;
184 sc = fillRecTrack(*it, t_mcTkNum, t_recTkNum);
186 if ( sc!=StatusCode::SUCCESS )
return StatusCode::FAILURE;
190 fillRecHits(*recMdcHitCol);
193 if(m_hist){fillEvent();}
195 return StatusCode::SUCCESS;
201 MsgStream log(
msgSvc(), name());
202 log << MSG::INFO <<
"in finalize()" << endreq;
203 std::cout<<
"nTk == "<<t_nTk << std::endl;
204 delete keepedParticles;
205 return StatusCode::SUCCESS;
209Hep3Vector MdcNavigation::momentum(
const RecMdcTrack* trk) {
211 double fi0 = trk->
helix(1);
212 double cpa = trk->
helix(2);
213 double tanl = trk->
helix(4);
216 if(cpa != 0) pxy = 1/fabs(cpa);
218 double px = pxy * (-
sin(fi0));
219 double py = pxy *
cos(fi0);
220 double pz = pxy * tanl;
227StatusCode MdcNavigation::fillRecTrack(
const RecMdcTrack* tk,
int mcTkNum,
int recTkNum){
231 m_na_nEvtNoise = nNoise;
233 m_na_recTkNum = recTkNum;
234 CLHEP::Hep3Vector rec_mom =
momentum(tk);
236 m_na_p = rec_mom.mag();
237 m_na_pt = rec_mom.perp();
238 m_na_pz = rec_mom.z();
242 m_na_d0 = tk->
helix(0);
243 m_na_phi0 = tk->
helix(1);
244 m_na_cpa = tk->
helix(2);
245 m_na_z0 = tk->
helix(3);
246 m_na_tanl = tk->
helix(4);
248 if( m_na_d0 > m_d0Cut ) {
249 std::cout<<__FILE__<<
" "<<__LINE__<<
" evtNo: "<<t_eventNo<<
" d0:"<<std::setw(5)<<m_na_d0<<
">"<<m_d0Cut<< std::endl;
250 setFilterPassed(
true);
252 if( m_na_z0 > m_z0Cut ) {
253 std::cout<<__FILE__<<
" "<<__LINE__<<
" evtNo: "<<t_eventNo<<
" z0:"<<std::setw(5)<<m_na_z0<<
">"<<m_z0Cut<< std::endl;
254 setFilterPassed(
true);
257 m_na_d0E = tk->
err(0);
258 m_na_phi0E = tk->
err(2);
259 m_na_cpaE = tk->
err(5);
260 m_na_z0E = tk->
err(9);
261 m_na_tanlE = tk->
err(14);
264 m_na_chi2 = tk->
chi2();
266 m_na_nDof = tk->
ndof();
267 if ( m_na_nDof > 0 ) {
268 m_na_chi2Dof = m_na_chi2/(float)m_na_nDof;
272 m_na_chi2Prob = probab(m_na_nDof, m_na_chi2);
273 m_na_nSt = tk->
nster();
278 }
else if(tk->
stat()==1){
280 }
else if(tk->
stat()==2){
282 }
else if(tk->
stat()==3){
285 m_na_tkStat = tk->
stat();
297 HitRefVec::iterator hitIt = hl.begin();
298 for (;hitIt!=hl.end();++hitIt){
333 if(havedigi[tlayer][twire]<0){
343 m_na_nNoise = noiseHit;
344 m_na_nMatch = matchHit;
351 uint32_t getDigiFlag = 0;
352 getDigiFlag += m_maxMdcDigi;
357 MdcDigiCol::iterator
iter = mdcDigiVec.begin();
358 for (;
iter != mdcDigiVec.end();
iter++) {
363 return StatusCode::SUCCESS;
366StatusCode MdcNavigation::bookNTuple(){
367 MsgStream log(
msgSvc(), name());
368 StatusCode sc = StatusCode::SUCCESS;
369 g_layerEff =
histoSvc()->book(
"layerEff",
"layerEff",43,-0.5,42.5 );
371 NTuplePtr nt1(
ntupleSvc(),
"MdcNavigation/rec");
372 if ( nt1 ) { g_tupleMc = nt1;}
374 g_tupleMc =
ntupleSvc()->book (
"MdcNavigation/rec", CLID_ColumnWiseTuple,
"rec and delta with mc truth");
376 sc = g_tupleMc->addItem (
"tkStat", m_na_tkStat);
377 sc = g_tupleMc->addItem (
"p", m_na_p);
378 sc = g_tupleMc->addItem (
"pt", m_na_pt);
379 sc = g_tupleMc->addItem (
"pz", m_na_pz);
380 sc = g_tupleMc->addItem (
"d0", m_na_d0);
381 sc = g_tupleMc->addItem (
"phi0", m_na_phi0);
382 sc = g_tupleMc->addItem (
"cpa", m_na_cpa);
383 sc = g_tupleMc->addItem (
"z0", m_na_z0);
384 sc = g_tupleMc->addItem (
"tanl", m_na_tanl);
385 sc = g_tupleMc->addItem (
"d0E", m_na_d0E);
386 sc = g_tupleMc->addItem (
"phi0E", m_na_phi0E);
387 sc = g_tupleMc->addItem (
"cpaE", m_na_cpaE);
388 sc = g_tupleMc->addItem (
"z0E", m_na_z0E);
389 sc = g_tupleMc->addItem (
"tanlE", m_na_tanlE);
390 sc = g_tupleMc->addItem (
"q", m_na_q);
392 sc = g_tupleMc->addItem (
"dP", m_na_dP);
393 sc = g_tupleMc->addItem (
"dPt", m_na_dPt);
394 sc = g_tupleMc->addItem (
"dPz", m_na_dPz);
395 sc = g_tupleMc->addItem (
"dD0", m_na_dD0);
396 sc = g_tupleMc->addItem (
"dPhi0", m_na_dPhi0);
397 sc = g_tupleMc->addItem (
"dCpa", m_na_dCpa);
398 sc = g_tupleMc->addItem (
"dZ0", m_na_dZ0);
399 sc = g_tupleMc->addItem (
"dTanl", m_na_dTanl);
401 sc = g_tupleMc->addItem (
"d0Res", m_na_d0Res);
402 sc = g_tupleMc->addItem (
"phiRes", m_na_phi0Res);
403 sc = g_tupleMc->addItem (
"z0Res", m_na_z0Res);
404 sc = g_tupleMc->addItem (
"tanlRes", m_na_tanlRes);
405 sc = g_tupleMc->addItem (
"cpaRes", m_na_cpaRes);
407 sc = g_tupleMc->addItem (
"recTkNum",m_na_recTkNum);
408 sc = g_tupleMc->addItem (
"mcTkId", m_na_mcTkId);
409 sc = g_tupleMc->addItem (
"mcTkNum", m_na_mcTkNum);
410 sc = g_tupleMc->addItem (
"evtNo", m_na_evtNo);
411 sc = g_tupleMc->addItem (
"nSt", m_na_nSt);
412 sc = g_tupleMc->addItem (
"nDof", m_na_nDof);
413 sc = g_tupleMc->addItem (
"chi2", m_na_chi2);
414 sc = g_tupleMc->addItem (
"chi2Dof", m_na_chi2Dof);
415 sc = g_tupleMc->addItem (
"chi2Porb",m_na_chi2Prob);
416 sc = g_tupleMc->addItem (
"fiTerm", m_na_fiTerm);
417 sc = g_tupleMc->addItem (
"nMatch", m_na_nMatch);
418 sc = g_tupleMc->addItem (
"nAct", m_na_nAct);
419 sc = g_tupleMc->addItem (
"nTkNoise",m_na_nNoise);
420 sc = g_tupleMc->addItem (
"nEvtNoise",m_na_nEvtNoise);
421 sc = g_tupleMc->addItem (
"nHit", m_na_nHit, 0, 10000);
422 sc = g_tupleMc->addItem (
"nDigi", m_na_nDigi, 0, 10000);
423 sc = g_tupleMc->addIndexedItem (
"resid", m_na_nHit, m_na_resid);
424 sc = g_tupleMc->addIndexedItem (
"driftD", m_na_nHit, m_na_driftD);
425 sc = g_tupleMc->addIndexedItem (
"driftT", m_na_nHit, m_na_driftT);
426 sc = g_tupleMc->addIndexedItem (
"doca", m_na_nHit, m_na_doca);
427 sc = g_tupleMc->addIndexedItem (
"entra", m_na_nHit, m_na_entra);
428 sc = g_tupleMc->addIndexedItem (
"zhit", m_na_nHit, m_na_zhit);
429 sc = g_tupleMc->addIndexedItem (
"chi2add", m_na_nHit, m_na_chi2add);
430 sc = g_tupleMc->addIndexedItem (
"flaglr", m_na_nHit, m_na_flaglr);
431 sc = g_tupleMc->addIndexedItem (
"hitStat", m_na_nHit, m_na_hitStat);
432 sc = g_tupleMc->addIndexedItem (
"tdc", m_na_nHit, m_na_Tdc);
433 sc = g_tupleMc->addIndexedItem (
"adc", m_na_nHit, m_na_Adc);
434 sc = g_tupleMc->addIndexedItem (
"act", m_na_nHit, m_na_act);
435 sc = g_tupleMc->addIndexedItem (
"layer", m_na_nHit, m_na_layer);
436 sc = g_tupleMc->addIndexedItem (
"wire", m_na_nHit, m_na_wire);
437 sc = g_tupleMc->addIndexedItem (
"gwire", m_na_nHit, m_na_gwire);
438 sc = g_tupleMc->addIndexedItem (
"hitTkId", m_na_nHit, m_na_hitTkId);
439 sc = g_tupleMc->addIndexedItem (
"digiTkId", m_na_nDigi, m_na_digiTkId);
440 sc = g_tupleMc->addIndexedItem (
"mclayer", m_na_nDigi, m_na_digiLayer);
442 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(g_tupleMc) << endmsg;
443 return StatusCode::FAILURE;
446 NTuplePtr nt3(
ntupleSvc(),
"MdcNavigation/evt");
447 if ( nt3 ) { g_tupleEvt = nt3;}
449 g_tupleEvt =
ntupleSvc()->book (
"MdcNavigation/evt", CLID_ColumnWiseTuple,
"event");
451 sc = g_tupleEvt->addItem (
"nTdsTk", m_na_t3recTk);
452 sc = g_tupleEvt->addItem (
"trkReco", m_na_t3TrkReco);
453 sc = g_tupleEvt->addItem (
"curlFinder", m_na_t3Curl);
454 sc = g_tupleEvt->addItem (
"patRec", m_na_t3PatRec);
455 sc = g_tupleEvt->addItem (
"xRec", m_na_t3XRec);
456 sc = g_tupleEvt->addItem (
"mcTkNum", m_na_t3mcTk);
457 sc = g_tupleEvt->addItem (
"evtNo", m_na_t3evtNo);
458 sc = g_tupleEvt->addItem (
"t0", m_na_t3t0);
459 sc = g_tupleEvt->addItem (
"t0Truth", m_na_t3t0Truth);
460 sc = g_tupleEvt->addItem (
"t0Stat", m_na_t3t0Stat);
461 sc = g_tupleEvt->addItem (
"runNo", m_na_t3runNo);
462 sc = g_tupleEvt->addItem (
"nDigi", m_na_t3nDigi, 0, 10000);
463 sc = g_tupleEvt->addIndexedItem (
"layer", m_na_t3nDigi, m_na_t3layer);
464 sc = g_tupleEvt->addIndexedItem (
"wire", m_na_t3nDigi, m_na_t3wire);
465 sc = g_tupleEvt->addIndexedItem (
"gwire", m_na_t3nDigi, m_na_t3gwire);
466 sc = g_tupleEvt->addIndexedItem (
"rt", m_na_t3nDigi, m_na_t3rt);
467 sc = g_tupleEvt->addIndexedItem (
"rtNot0",m_na_t3nDigi, m_na_t3rtNot0);
468 sc = g_tupleEvt->addIndexedItem (
"rc", m_na_t3nDigi, m_na_t3rc);
469 sc = g_tupleEvt->addIndexedItem (
"phi", m_na_t3nDigi, m_na_t3phi);
470 sc = g_tupleEvt->addIndexedItem (
"ovfl", m_na_t3nDigi, m_na_t3ovfl);
471 sc = g_tupleEvt->addIndexedItem (
"tNum", m_na_t3nDigi, m_na_t3tNum);
476StatusCode MdcNavigation::fillInit(){
477 MsgStream log(
msgSvc(), name());
478 StatusCode sc = StatusCode::SUCCESS;
487 SmartDataPtr<Event::EventHeader> evtHead(eventSvc(),
"/Event/EventHeader");
489 t_runNo = evtHead->runNumber();
490 t_eventNo = evtHead->eventNumber();
492 log << MSG::WARNING<<
"Could not retrieve event header" << endreq;
493 return StatusCode::FAILURE;
495 if(m_debug) std::cout<<
"evtNo:"<<t_eventNo << std::endl;
500 SmartDataPtr<RecEsTimeCol> aevtimeCol(eventSvc(),
"/Event/Recon/RecEsTimeCol");
502 if (!aevtimeCol || aevtimeCol->size()==0) {
503 log << MSG::WARNING <<
"Could not find RecEsTimeCol" << endreq;
505 RecEsTimeCol::iterator iter_evt = aevtimeCol->begin();
506 t_t0 = (*iter_evt)->getTest();
507 t_t0Stat = (*iter_evt)->getStat();
511 uint32_t getDigiFlag = 0;
512 getDigiFlag += m_maxMdcDigi;
517 if ((mdcDigiVec.size()==0)) {
518 log << MSG::WARNING << t_eventNo <<
"No digi or could not find event in MdcDigiVec" << endreq;
521 for (
int ii=0;ii<43;ii++){
522 for (
int jj=0;jj<288;jj++){
523 havedigi[ii][jj]= -99;
527 for(
int imc=0;imc<100;imc++){
532 for(
int ii=0;ii<43;ii++)
for(
int jj=0;jj<288;jj++) multiTdcCount[ii][jj]=0;
533 MdcDigiCol::iterator
iter = mdcDigiVec.begin();
534 for (;
iter != mdcDigiVec.end();
iter++ ) {
536 double c = (*iter)->getChargeChannel();
539 multiTdcCount[l][
w]++;
543 iter = mdcDigiVec.begin();
544 for (;
iter != mdcDigiVec.end();
iter++,++t_i ) {
546 double c = (*iter)->getChargeChannel();
550 int tkid = (*iter)->getTrackIndex();
551 havedigi[l][
w]= tkid;
566StatusCode MdcNavigation::skipMcParticle(
const McParticle* it,
int nKindKeeped,
int* pid){
568 MsgStream log(
msgSvc(), name());
570 int pdg_code = (*it).particleProperty();
571 if (fabs(pdg_code)>=8) {
572 const HepPDT::ParticleData* particles = m_particleTable->particle(
abs(pdg_code));
574 log<<MSG::WARNING<<
"Exotic particle found with PDG code "<<pdg_code<<endreq;
577 if( particles->charge() == 0 ){
578 log<<MSG::INFO<<
"Skip charge == 0 mc particle "<<pdg_code<<endreq;
579 return StatusCode::FAILURE;
584 int mcTkId = (*it).trackIndex();
586 SmartDataPtr<Event::MdcMcHitCol> mcMdcMcHitCol(eventSvc(),
"/Event/MC/MdcMcHitCol");
587 if (!mcMdcMcHitCol) {
588 log << MSG::INFO <<
"Could not find MdcMcHit" << endreq;
590 Event::MdcMcHitCol::iterator iter_mchit = mcMdcMcHitCol->begin();
591 for (;iter_mchit != mcMdcMcHitCol->end(); iter_mchit++ ) {
592 int iMcTk = (*iter_mchit)->getTrackIndex();
593 if (mcTkId == iMcTk) nMcHit++;
596 if(nMcHit<m_nMcHit)
return StatusCode::FAILURE;
599 for (
int i=0; i<nKindKeeped; i++){
600 if (
abs(pdg_code) == pid[i]) keeped =
true;
603 if (!keeped)
return StatusCode::FAILURE;
605 return StatusCode::SUCCESS;
608StatusCode MdcNavigation::fillEvent(){
609 if (!g_tupleEvt)
return StatusCode::FAILURE;
610 uint32_t getDigiFlag = 0;
611 getDigiFlag += m_maxMdcDigi;
617 MdcDigiCol::iterator
iter = mdcDigiVec.begin();
619 for (;
iter != mdcDigiVec.end();
iter++,++t_i ) {
621 double c = (*iter)->getChargeChannel();
625 m_na_t3layer[t_i] = l;
626 m_na_t3wire[t_i] =
w;
629 m_na_t3rtNot0[t_i] =
t - t_t0;
632 m_na_t3ovfl[t_i] = (*iter)->getOverflow();
633 m_na_t3tNum[t_i] = ((*iter)->getOverflow()&0xF0)>>4;
636 if(g_tupleEvt) m_na_t3nDigi = t_i;
638 m_na_t3TrkReco = t_trkRecoTk;
639 m_na_t3Curl = t_curlTk;
640 m_na_t3PatRec= t_patRecTk;
641 m_na_t3XRec= t_xRecTk;
644 m_na_t3t0Stat = t_t0Stat;
646 m_na_t3recTk = t_recTkNum;
647 m_na_t3mcTk = t_mcTkNum;
649 m_na_t3evtNo = t_eventNo;
650 m_na_t3runNo = t_runNo;
653 return StatusCode::SUCCESS;
656double MdcNavigation::poca(
const MdcDigi* aDigi,
const HepVector helixPar,
const HepSymMatrix errMat){
660 double ALPHA_loc,rho,pt,kappa,phiIn;
663 ALPHA_loc = 333.567*Bz;
664 charge = ( kappa >=0 ) ? 1 : -1 ;
665 rho = ALPHA_loc/kappa ;
666 pt = fabs( 1.0 / kappa);
667 HepVector helix(helix);
668 helix[0] = -helixPar[0];
669 helix[1] = helixPar[1]+
pi/2;
670 helix[2] = -1./helixPar[2];
671 helix[3] = helixPar[3];
672 helix[4] = helixPar[4];
681 m_helixTraj =
new HelixTraj(helix,errMat);
684 double fltLenIn = layPtr->
rMid();
685 phiIn = helix[1] + helix[2]*fltLenIn;
687 int wlow = (int)floor(layPtr->
nWires() * tmp.rad() / twopi );
688 int wbig = (int)ceil(layPtr->
nWires() * tmp.rad() / twopi );
689 if (tmp == 0 ){ wlow = -1; wbig = 1; }
693 std::cout<<
" in MdcNavigation lay/4 "<<lay/4<<
" phi "<<tmp<<
" wire "<<wireIn<<
" "<<wireOut<<std::endl;
696StatusCode MdcNavigation::fillRecHits(
RecMdcHitCol& hitCol){
698 RecMdcHitCol::iterator itHit = hitCol.begin();
699 for(;itHit != hitCol.end(); itHit++ ) {
703 double ddrift = -999;
708 m_na_resid[ihit] = fabs(ddrift) - fabs(ddoca);
709 if( 0 == m_na_lr ){ m_na_resid[ihit] *= -1.0;}
710 m_na_driftD[ihit] = ddrift;
712 m_na_doca[ihit] = ddoca;
714 m_na_zhit[ihit] = h->
getZhit();
717 m_na_hitStat[ihit] = h->
getStat();
718 m_na_Tdc[ihit] = h->
getTdc();
719 m_na_Adc[ihit] = h->
getAdc();
723 m_na_layer[ihit] = tlayer;
724 m_na_wire[ihit] = twire;
729 return StatusCode::SUCCESS;
732double MdcNavigation::probab(
const int& ndof,
const double& chisq){
735 static double srtopi=2.0/sqrt(2.0*
M_PI);
736 static double upl=100.0;
739 if(ndof<=0) {
return prob;}
740 if(chisq<0.0) {
return prob;}
743 if(chisq>upl) {
return prob;}
744 double sum=
exp(-0.5*chisq);
749 if(m==1){
return sum;}
750 for(
int i=2; i<=m;i++){
751 term=0.5*term*chisq/(i-1);
759 double srty=sqrt(chisq);
760 double temp=srty/M_SQRT2;
762 if(ndof==1) {
return prob;}
763 if(ndof==3) {
return (srtopi*srty*sum+prob);}
765 for(
int i=1; i<=m; i++){
766 term=term*chisq/(2*i+1);
769 return (srtopi*srty*sum+prob);
775 double srty=sqrt(chisq)-sqrt(ndof-0.5);
776 if(srty<12.0) {prob=0.5*erfc(srty);};
**********INTEGER nmxhep !maximum number of particles DOUBLE PRECISION vhep INTEGER jdahep COMMON hepevt $ !serial number $ !number of particles $ !status code $ !particle ident KF $ !parent particles $ !childreen particles $ !four momentum
std::vector< const RecMdcTrack * > RecMdcTrackVector
std::vector< const Event::McParticle * > McParticleVector
std::vector< MdcDigi * > MdcDigiVec
EvtComplex exp(const EvtComplex &c)
double sin(const BesAngle a)
double cos(const BesAngle a)
ObjectVector< RecMdcHit > RecMdcHitCol
SmartRefVector< RecMdcHit > HitRefVec
IHistogramSvc * histoSvc()
HepGeom::Point3D< double > HepPoint3D
static const int nWireBeforeLayer[43]
const HepSymMatrix err() const
const double chi2() const
const HepVector helix() const
......
virtual double getReferField()=0
const MdcLayer * Layer(unsigned id) const
static MdcDetector * instance()
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
static int wire(const Identifier &id)
double phiEPOffset(void) const
MdcNavigation(const std::string &name, ISvcLocator *pSvcLocator)
MdcDigiVec & getMdcDigiVec(uint32_t control=0)
static double MdcTime(int timeChannel)
virtual Identifier identify() const
const int getFlagLR(void) const
const double getZhit(void) const
const int getStat(void) const
const double getChisqAdd(void) const
const double getAdc(void) const
const Identifier getMdcId(void) const
const double getTdc(void) const
const double getDriftDistRight(void) const
const double getDriftT(void) const
const double getEntra(void) const
const double getDriftDistLeft(void) const
const double getDoca(void) const
const HitRefVec getVecHits(void) const
const double getFiTerm() const