2#include "GaudiKernel/MsgStream.h"
3#include "GaudiKernel/AlgFactory.h"
4#include "GaudiKernel/ISvcLocator.h"
5#include "GaudiKernel/DataSvc.h"
6#include "GaudiKernel/SmartDataPtr.h"
7#include "GaudiKernel/IDataProviderSvc.h"
8#include "GaudiKernel/IDataManagerSvc.h"
9#include "GaudiKernel/PropertyMgr.h"
10#include "GaudiKernel/Bootstrap.h"
11#include "GaudiKernel/INTupleSvc.h"
54#ifdef MDCPATREC_TIMETEST
72 Algorithm(name, pSvcLocator),
73 m_hitData(0), m_segs(0), m_tracks(0), m_segFinder(0)
76 declareProperty(
"FittingMethod", m_fittingMethod = 2);
77 declareProperty(
"ConfigFile", m_configFile =
"MDCConfig.xml");
78 declareProperty(
"OnlyUnusedHits", m_onlyUnusedHits = 0);
79 declareProperty(
"PoisonHits", m_poisonHits = 0);
80 declareProperty(
"doLineFit", m_doLineFit =
false);
81 declareProperty(
"paramFile", m_paramFile =
"params");
82 declareProperty(
"pdtFile", m_pdtFile =
"pdt.table");
83 declareProperty(
"allHit", m_allHit = 1);
84 declareProperty(
"hist", m_hist=
false);
85 declareProperty(
"recForEsTime", m_recForEsTime=
false);
86 declareProperty(
"tryBunch", m_tryBunch =
false);
87 declareProperty(
"d0Cut", m_d0Cut= -999.);
88 declareProperty(
"z0Cut", m_z0Cut= -999.);
89 declareProperty(
"dropTrkPt", m_dropTrkPt = -999.);
90 declareProperty(
"debug", m_debug= 0);
91 declareProperty(
"mcHist", m_mcHist=
false);
92 declareProperty(
"fieldCosmic", m_fieldCosmic=
false);
93 declareProperty(
"doSag", m_doSagFlag=
false);
94 declareProperty(
"arbitrateHits", m_arbitrateHits =
true);
96 declareProperty(
"helixHitsSigma", m_helixHitsSigma);
98 declareProperty(
"getDigiFlag", m_getDigiFlag = 0);
99 declareProperty(
"maxMdcDigi", m_maxMdcDigi = 0);
100 declareProperty(
"keepBadTdc", m_keepBadTdc = 0);
101 declareProperty(
"dropHot", m_dropHot= 0);
102 declareProperty(
"keepUnmatch", m_keepUnmatch = 0);
103 declareProperty(
"minMdcDigi", m_minMdcDigi = 0);
104 declareProperty(
"selEvtNo", m_selEvtNo);
105 declareProperty(
"combineTracking",m_combineTracking =
false);
107#ifdef MDCPATREC_RESLAYER
108 declareProperty(
"resLayer",m_resLayer= -1);
116 m_segFinder.reset(0);
123 MsgStream log(
msgSvc(), name());
124 log << MSG::INFO <<
"in beginRun()" << endreq;
129 if(NULL == _gm)
return StatusCode::FAILURE;
134 return StatusCode::SUCCESS;
140 MsgStream log(
msgSvc(), name());
141 log << MSG::INFO <<
"in initialize()" << endreq;
149 m_flags.
lHist = m_hist;
156 std::cout<<
"MdcTrkRecon d0Cut "<<m_d0Cut<<
" z0Cut "<<
157 m_z0Cut<<
" ptCut "<<m_dropTrkPt << std::endl;
161 sc = service (
"MagneticFieldSvc",m_pIMF);
162 if(sc!=StatusCode::SUCCESS) {
163 log << MSG::ERROR << name() <<
" Unable to open magnetic field service"<<endreq;
165 m_bfield =
new BField(m_pIMF);
166 log << MSG::INFO <<name() <<
" field z = "<<m_bfield->
bFieldNominal()<< endreq;
170 sc = service (
"RawDataProviderSvc", irawDataProviderSvc);
172 if ( sc.isFailure() ){
173 log << MSG::FATAL << name()<<
" Could not load RawDataProviderSvc!" << endreq;
174 return StatusCode::FAILURE;
179 sc = service (
"MdcPrintSvc", imdcPrintSvc);
180 m_mdcPrintSvc =
dynamic_cast<MdcPrintSvc*
> (imdcPrintSvc);
181 if ( sc.isFailure() ){
182 log << MSG::FATAL <<
"Could not load MdcPrintSvc!" << endreq;
183 return StatusCode::FAILURE;
204 if (!sc.isSuccess()) { m_flags.
lHist = 0;}
211 return StatusCode::SUCCESS;
216 setFilterPassed(
false);
218 MsgStream log(
msgSvc(), name());
219 log << MSG::INFO <<
"in execute()" << endreq;
223 for (
int ii=0;ii<43;ii++){
224 for (
int jj=0;jj<288;jj++){
232 mcDrift[ii][jj] = -99.;
237 hitPoisoned[ii][jj]=-99;
244#ifdef MDCPATREC_TIMETEST
249 SmartDataPtr<Event::EventHeader> evtHead(eventSvc(),
"/Event/EventHeader");
251 log << MSG::FATAL<<
"Could not retrieve event header" << endreq;
252 return( StatusCode::FAILURE);
254 t_eventNo = evtHead->eventNumber();
255 if(m_debug!=0)std::cout<<t_iExexute<<
" run "<<evtHead->runNumber()<<
" evt "<<t_eventNo<<std::endl;
258 if (m_selEvtNo.size() >0){
259 std::vector<int>::iterator it = m_selEvtNo.begin();
260 for (; it!=m_selEvtNo.end(); it++){
261 if((*it)== t_eventNo) setFilterPassed(
true);
268 bool iterateT0 =
false;
269 const int nBunch = 3;
271 double BeamDeltaTime = 24. / nBunch;
272 SmartDataPtr<RecEsTimeCol> evTimeCol(eventSvc(),
"/Event/Recon/RecEsTimeCol");
273 if (!evTimeCol || evTimeCol->size()==0) {
274 log << MSG::WARNING <<
" run "<<evtHead->runNumber() <<
" evt "<<t_eventNo<<
" Could not find RecEsTimeCol" << endreq;
276 return StatusCode::SUCCESS;
279 RecEsTimeCol::iterator iter_evt = evTimeCol->begin();
281 if (iter_evt != evTimeCol->end()){
282 t_t0Stat = (*iter_evt)->getStat();
283 t_t0 = (*iter_evt)->getTest();
287 if (
abs(t_t0)<0.00001 || (t_t0 < 0) || (t_t0 > 9999.0) ){
288 log << MSG::WARNING <<
"Skip with t0 = "<<t_t0 << endreq;
289 return StatusCode::SUCCESS;
297 if ( !m_recForEsTime && m_tryBunch) {
298 if ( t_t0Stat < 10 )
return StatusCode::SUCCESS;
301 if ( iBunch > (nBunch - 1) )
return StatusCode::SUCCESS;
302 if ( t_t0Stat < 0 ){ iterateT0 =
true; }
305 if ( (t_t0Stat > -1) && (fabs( iBunch * BeamDeltaTime - t_t0) < 2.) ){
308 }
else{ t0 = iBunch * BeamDeltaTime *1.e-9;}
313 SmartDataPtr<MdcHitMap> hitMap(eventSvc(),
"/Event/Hit/MdcHitMap");
315 log << MSG::FATAL <<
"Could not retrieve MDC hit map" << endreq;
316 return( StatusCode::FAILURE);
319 SmartDataPtr<MdcHitCol> hitCol(eventSvc(),
"/Event/Hit/MdcHitCol");
321 log << MSG::FATAL <<
"Could not retrieve MDC hit list" << endreq;
322 return( StatusCode::FAILURE);
327 DataObject *aReconEvent;
328 eventSvc()->findObject(
"/Event/Recon",aReconEvent);
329 if(aReconEvent==NULL) {
331 StatusCode sc = eventSvc()->registerObject(
"/Event/Recon",aReconEvent);
332 if(sc!=StatusCode::SUCCESS) {
333 log << MSG::FATAL <<
"Could not register ReconEvent" <<endreq;
334 return( StatusCode::FAILURE);
338 DataObject *aTrackCol;
339 DataObject *aRecHitCol;
341 SmartIF<IDataManagerSvc> dataManSvc(eventSvc());
342 if(!m_combineTracking){
343 eventSvc()->findObject(
"/Event/Recon/RecMdcTrackCol",aTrackCol);
344 if(aTrackCol != NULL) {
345 dataManSvc->clearSubTree(
"/Event/Recon/RecMdcTrackCol");
346 eventSvc()->unregisterObject(
"/Event/Recon/RecMdcTrackCol");
348 eventSvc()->findObject(
"/Event/Recon/RecMdcHitCol",aRecHitCol);
349 if(aRecHitCol != NULL) {
350 dataManSvc->clearSubTree(
"/Event/Recon/RecMdcHitCol");
351 eventSvc()->unregisterObject(
"/Event/Recon/RecMdcHitCol");
356 eventSvc()->findObject(
"/Event/Recon/RecMdcTrackCol",aTrackCol);
362 if(!sc.isSuccess()) {
363 log << MSG::FATAL <<
" Could not register RecMdcTrack collection" <<endreq;
364 return StatusCode::FAILURE;
368 eventSvc()->findObject(
"/Event/Recon/RecMdcHitCol",aRecHitCol);
374 if(!sc.isSuccess()) {
375 log << MSG::FATAL <<
" Could not register RecMdcHit collection" <<endreq;
376 return StatusCode::FAILURE;
380 m_hitData->loadevent(hitCol, hitMap, t0);
381 t_nDigi = hitCol->size();
384 m_hitData->poisonHits(_gm,m_debug);
388 for(
int i=0;i<m_hitData->nhits();i++){
389 const MdcHit* thisHit = m_hitData->hit(i);
392 if(m_hitData->segUsage().get(thisHit)->deadHit()){
393 hitPoisoned[l][w] = 1;
395 hitPoisoned[l][w] = 0;
400#ifdef MDCPATREC_TIMETEST
401 SmartDataPtr<Event::McParticleCol> mcParticleCol(eventSvc(),
"/Event/MC/McParticleCol");
403 log << MSG::INFO <<
"Could not retrieve McParticelCol" << endreq;
405 m_mcTkNum = mcParticleCol->size();
416 nSegs = m_segFinder->createSegs(_gm, *m_segs, m_hitData->segUsage(),
417 m_hitData->hitMap(), t0);
419 log << MSG::INFO <<
" Found " << nSegs <<
" segments" << endreq;
421 std::cout<<
"------------------------------------------------"<<std::endl;
422 std::cout<<
"==event "<<t_eventNo<<
" Found " << nSegs <<
" segments" << std::endl;
437 nTracks = m_tracks->createFromSegs(m_segs.get(), m_hitData->hitMap(),
441 if(m_arbitrateHits) nDeleted = m_tracks->arbitrateHits();
442 int nKeep = nTracks - nDeleted;
444 if (m_debug>0 && (nTracks - nDeleted)>0){
445 std::cout<<
"MdcTrkRecon: evt "<< setw(5)<<t_eventNo
446 <<
" nDigi "<<setw(4)<<t_nDigi<<
" t0 "<<setw(5)<<t_t0
447 <<
" keep "<< nKeep <<
" track(s)";
448 if (nDeleted!=0){ std::cout <<
",deleted " <<nDeleted; }
449 std::cout<< std::endl;
452 std::cout<<
"MdcTrkRecon: evt "<< setw(5)<<t_eventNo
453 <<
" nDigi "<<setw(4)<<t_nDigi<<
" t0 "<<setw(5)<<t_t0
454 <<
" found 0 track "<< endl;
458 if (m_flags.
lHist) t_nRecTk = nKeep;
460#ifdef MDCPATREC_RESLAYER
461 m_tracks->setResLayer(m_resLayer);
465 m_tracks->store(trackList, hitList);
468 std::cout<<name()<<
" print track list "<<std::endl;
473#ifdef MDCPATREC_TIMETEST
474 RecMdcTrackCol::iterator
iter = trackList->begin();
475 for (;
iter != trackList->end();
iter++) {
477 ti_nHit += tk->getNhits();
483 m_segs->destroySegs();
489#ifdef MDCPATREC_TIMETEST
493 m_eventTime = m_timer[1]->elapsed();
494 m_t5recTkNum = m_tracks->length();
495 m_t5EvtNo = t_eventNo;
498 sc = m_tupleTime->write();
502 if ( nTracks <1 ){ iterateT0 =
true;
508 return StatusCode::SUCCESS;
513 MsgStream log(
msgSvc(), name());
514 log << MSG::INFO <<
"in finalize()" << endreq;
517#ifdef MDCPATREC_TIMETEST
520 return StatusCode::SUCCESS;
524 MsgStream log(
msgSvc(), name());
525 StatusCode sc = StatusCode::SUCCESS;
529 h_sfHit =
histoSvc()->book(
"sfHit",
"Hits after segment finding",46,-1.,44. );
536 g_cirTkChi2 =
histoSvc()->book(
"cirTkChi2",
"chi2 per dof in circle finding",21,-1. ,20. );
538 g_nSigAdd =
histoSvc()->book(
"nSigAdd",
"max allowed n sigma to add hit to existing segment",50,0,50 );
539 g_z0Cut =
histoSvc()->book(
"z0Cut",
"z0 for including stereo segs in cluster",100,0,600 );
540 g_ctCut =
histoSvc()->book(
"ctCut",
"ct for including stereo segs in cluster",100,-50,50 );
541 g_delCt =
histoSvc()->book(
"delCt",
"del ct cut forming seg group",100,-20,20 );
542 g_delZ0 =
histoSvc()->book(
"delZ0",
"del z0 cut forming seg group",100,-60,60 );
543 g_phiDiff =
histoSvc()->book(
"phiDiff",
"phidiff mult for drop dup seg",100,-0.5,6.5 );
558 NTuplePtr ntWireEff(
ntupleSvc(),
"MdcWire/mc");
577 log << MSG::ERROR <<
"Cannot book tuple MdcWire/mc" << endmsg;
582 NTuplePtr ntt(
ntupleSvc(),
"MdcRec/test");
585 m_tuplet =
ntupleSvc()->book (
"MdcRec/test", CLID_ColumnWiseTuple,
"MdcTrkRecon t particle");
593 log << MSG::ERROR <<
"Cannot book tuple MdcRec/test" << endmsg;
599 NTuplePtr ntMc(
ntupleSvc(),
"MdcMc/mcTk");
602 m_tupleMc =
ntupleSvc()->book (
"MdcMc/mcTk", CLID_ColumnWiseTuple,
"MdcTrkRecon Mc particle");
607 log << MSG::ERROR <<
"Cannot book tuple MdcMc/mcTk" << endmsg;
613 NTuplePtr ntMcHit(
ntupleSvc(),
"MdcMc/mcHit");
636 log << MSG::ERROR <<
"Cannot book tuple MdcMc/mcHit" << endmsg;
641 NTuplePtr nt1(
ntupleSvc(),
"MdcRec/rec");
644 m_tuple1 =
ntupleSvc()->book (
"MdcRec/rec", CLID_ColumnWiseTuple,
"MdcTrkRecon results");
698 log << MSG::ERROR <<
"Cannot book tuple MdcRec/rec" << endmsg;
703 NTuplePtr ntSeg(
ntupleSvc(),
"MdcSeg/seg");
706 m_tupleSeg =
ntupleSvc()->book (
"MdcSeg/seg", CLID_ColumnWiseTuple,
"MdcTrkRecon segment data");
716 log << MSG::ERROR <<
"Cannot book tuple MdcSeg/seg" << endmsg;
722 NTuplePtr nt4(
ntupleSvc(),
"MdcRec/evt");
725 m_tupleEvt =
ntupleSvc()->book (
"MdcRec/evt", CLID_ColumnWiseTuple,
"MdcTrkRecon event data");
744 log << MSG::ERROR <<
"Cannot book N-tuple: MdcRec/evt" << endmsg;
750 NTuplePtr ntCombAx(
ntupleSvc(),
"MdcCombAx/combAx");
753 g_tupleCombAx =
ntupleSvc()->book (
"MdcCombAx/combAx", CLID_RowWiseTuple,
"MdcTrkRecon cuts in combine ax seg");
774 log << MSG::ERROR <<
"Cannot book N-tuple: FILE101/combAx" << endmsg;
780 NTuplePtr ntFindSeg(
ntupleSvc(),
"MdcSeg/findSeg");
783 g_tupleFindSeg =
ntupleSvc()->book (
"MdcSeg/findSeg", CLID_RowWiseTuple,
"MdcTrkRecon cuts in segment finder");
797 log << MSG::ERROR <<
"Cannot book N-tuple: FILE101/findSeg" << endmsg;
803 NTuplePtr ntPick(
ntupleSvc(),
"MdcTrk/pick");
827 log << MSG::ERROR <<
"Cannot book N-tuple: MdcTrk/pick" << endmsg;
832#ifdef MDCPATREC_TIMETEST
834 NTuplePtr nt5(
ntupleSvc(),
"MdcTime/ti");
835 if ( nt5 ) { m_tupleTime = nt5;}
837 m_tupleTime =
ntupleSvc()->book (
"MdcTime/ti", CLID_RowWiseTuple,
"MdcTrkRecon time");
839 sc = m_tupleTime->addItem (
"eventtime", m_eventTime);
840 sc = m_tupleTime->addItem (
"recTkNum", m_t5recTkNum);
841 sc = m_tupleTime->addItem (
"mcTkNum", m_mcTkNum);
842 sc = m_tupleTime->addItem (
"evtNo", m_t5EvtNo);
843 sc = m_tupleTime->addItem (
"nHit", m_t5nHit);
844 sc = m_tupleTime->addItem (
"nDigi", m_t5nDigi);
846 log << MSG::ERROR <<
"Cannot book N-tuple: FILE101/time" << endmsg;
850 sc = service(
"BesTimerSvc", m_timersvc);
851 if( sc.isFailure() ) {
852 log << MSG::WARNING <<
" Unable to locate BesTimerSvc" << endreq;
855 m_timer[1] = m_timersvc->addItem(
"Execution");
856 m_timer[1]->propName(
"nExecution");
859#ifdef MDCPATREC_RESLAYER
861 NTuplePtr nt6(
ntupleSvc(),
"MdcRes/res");
862 if ( nt6 ) { g_tupleres = nt6;}
864 g_tupleres=
ntupleSvc()->book (
"MdcRes/res", CLID_RowWiseTuple,
"MdcTrkRecon res");
866 sc = g_tupleres->addItem (
"resid", g_resLayer);
867 sc = g_tupleres->addItem (
"layer", g_t6Layer);
869 log << MSG::ERROR <<
"Cannot book N-tuple: FILE101/res" << endmsg;
870 return StatusCode::FAILURE;
879 MsgStream log(
msgSvc(), name());
882 for(
int i=0;i<100;i++){
883 isPrimaryOfMcTk[i]=-9999;
886 double ptOfMcTk[100]={0.};
887 double thetaOfMcTk[100]={0.};
888 double phiOfMcTk[100]={0.};
889 double nDigiOfMcTk[100]={0.};
892 SmartDataPtr<Event::MdcMcHitCol> mcMdcMcHitCol(eventSvc(),
"/Event/MC/MdcMcHitCol");
893 if (!mcMdcMcHitCol) {
894 log << MSG::INFO <<
"Could not find MdcMcHit" << endreq;
896 Event::MdcMcHitCol::iterator iter_mchit = mcMdcMcHitCol->begin();
897 for (;iter_mchit != mcMdcMcHitCol->end(); iter_mchit++ ) {
898 const Identifier id= (*iter_mchit)->identify();
901 int iMcTk = (*iter_mchit)->getTrackIndex();
902 if(iMcTk<100&&iMcTk>0) nDigiOfMcTk[iMcTk]++;
903 mcDrift[layer][wire]= (*iter_mchit)->getDriftDistance()/10.;
905 mcX[layer][wire] = (*iter_mchit)->getPositionX()/10.;
906 mcY[layer][wire] = (*iter_mchit)->getPositionY()/10.;
907 mcZ[layer][wire] = (*iter_mchit)->getPositionZ()/10.;
908 mcLR[layer][wire] = (*iter_mchit)->getPositionFlag();
909 if (mcLR[layer][wire] == 0) mcLR[layer][wire] = -1;
918 SmartDataPtr<Event::McParticleCol> mcParticleCol(eventSvc(),
"/Event/MC/McParticleCol");
920 log << MSG::INFO <<
"Could not retrieve McParticelCol" << endreq;
923 Event::McParticleCol::iterator it = mcParticleCol->begin();
924 for (;it != mcParticleCol->end(); it++){
930 it = mcParticleCol->begin();
931 for (;it != mcParticleCol->end(); it++){
932 int tkId = (*it)->trackIndex();
933 if ((*it)->primaryParticle()){
934 t_t0Truth = (*it)->initialPosition().t();
935 isPrimaryOfMcTk[tkId] = 1;
937 isPrimaryOfMcTk[tkId] = 0;
941 int pdg_code = (*it)->particleProperty();
942 pdgOfMcTk[tkId] = pdg_code;
946 const CLHEP::Hep3Vector& true_mom = (*it)->initialFourMomentum().vect();
947 const CLHEP::HepLorentzVector& posIni = (*it)->initialPosition();
948 const CLHEP::HepLorentzVector& posFin = (*it)->finalPosition();
949 if(tkId<100&&tkId>=0) {
950 ptOfMcTk[tkId] = true_mom.perp();
951 thetaOfMcTk[tkId] = (*it)->initialFourMomentum().theta();
952 phiOfMcTk[tkId] = (*it)->initialFourMomentum().phi();
961 m_tMcTheta = (*it)->initialFourMomentum().theta();
977 uint32_t getDigiFlag = 0;
978 getDigiFlag += m_maxMdcDigi;
983 if ((
int)mdcDigiVec.size()<m_minMdcDigi){
984 std::cout <<
" Skip this event for MdcDigiVec.size() < "<<m_minMdcDigi << endl;
987 if (mdcDigiVec.size()<=0)
return;
989 MdcDigiCol::iterator
iter = mdcDigiVec.begin();
990 for (;
iter!= mdcDigiVec.end();
iter++ ) {
993 int tkId = (*iter)->getTrackIndex();
996 haveDigiPt[l][w] = ptOfMcTk[(*iter)->getTrackIndex()];
998 haveDigiPhi[l][w] = phiOfMcTk[(*iter)->getTrackIndex()];
1002 if(tkId>=1000) tkId-=1000;
1015 if(hitInSegList[l][w]>0)
m_we_seg = 1;
1019 if(l==35&&tkId>=0&&
abs(pdgOfMcTk[tkId])==11&&hitInSegList[l][w]<=0) {
1020 cout<<
"layer "<<l<<
" cell "<<w<<
" gwire "<<gwire<<
" inseg "<<hitInSegList[l][w]<<endl;
1032 std::cout <<
"print after Segment finding " << std::endl;
1034 if (!m_flags.
lHist)
return;
1036 for (
int ii=0;ii<43;ii++){
1037 for (
int jj=0;jj<288;jj++){ hitInSegList[ii][jj] = 0; }
1040 for (
int i = 0; i < _gm->
nSuper(); i++) {
1042 while (aSeg != NULL) {
1044 for (
int ihit=0 ; ihit< aSeg->
nHit() ; ihit++){
1048 hitInSegList[layer][wire]++;
1057 for (
int ii=0;ii<43;ii++){
1058 for (
int jj=0;jj<288;jj++){
1062 m_tsInSeg[iDigi] = hitInSegList[ii][jj];
1073 std::cout<<
"tksize = "<<trackList->size() << std::endl;
1074 RecMdcTrackCol::iterator it = trackList->begin();
1075 for (;it!= trackList->end();it++){
1077 std::cout<< endl<<
"//====RecMdcTrack "<<tk->
trackId()<<
"====:" << std::endl;
1078 cout <<
" d0 "<<tk->
helix(0)
1079 <<
" phi0 "<<tk->
helix(1)
1080 <<
" cpa "<<tk->
helix(2)
1081 <<
" z0 "<<tk->
helix(3)
1082 <<
" tanl "<<tk->
helix(4)
1084 std::cout<<
" q "<<tk->
charge()
1085 <<
" theta "<<tk->
theta()
1086 <<
" phi "<<tk->
phi()
1092 std::cout <<
" p "<<tk->
p()
1098 std::cout<<
" tkStat "<<tk->
stat()
1099 <<
" chi2 "<<tk->
chi2()
1100 <<
" ndof "<<tk->
ndof()
1102 <<
" nst "<<tk->
nster()
1104 std::cout<<
"errmat mat " << std::endl;
1105 std::cout<< tk->
err()<<std::endl;
1111 std::cout<<nhits <<
" Hits: " << std::endl;
1112 for(
int ii=0; ii <nhits ; ii++){
1116 cout<<
"("<< layer <<
","<<wire<<
","<<tk->
getVecHits()[ii]->getStat()
1117 <<
",lr:"<<tk->
getVecHits()[ii]->getFlagLR()<<
") ";
1119 std::cout <<
" "<< std::endl;
1121 std::cout <<
" "<< std::endl;
1126 std::cout <<
"=======Print after Track finding=======" << std::endl;
1130 if (!m_flags.
lHist)
return;
1132 int nTk = (*m_tracks).nTrack();
1133 for (
int itrack = 0; itrack < nTk; itrack++) {
1134 MdcTrack *atrack = (*m_tracks)[itrack];
1135 if (atrack==NULL)
continue;
1137 if (fitResult == 0)
continue;
1141 int seg[11] = {0};
int segme;
1145 int layerCount[43]={0};
1146 for(
int iii=0;iii<43;iii++){layerCount[iii]=0;}
1148 for (;hot!= hitlist->
end();hot++){
1153 layerCount[layer]++;
1157 if ( layer >0 ) {segme=(layer-1)/4;}
1159 if (recoHot->
layer()->
view()) { ++nSt; }
1166 double fltLen = recoHot->
fltLen();
1185 m_dx[i] =
m_x[i] - mcX[layer][wire];
1186 m_dy[i] =
m_y[i] - mcY[layer][wire];
1187 m_dz[i] =
m_z[i] - mcZ[layer][wire];
1194 double res=999.,rese=999.;
1195 if (recoHot->
resid(res,rese,
false)){
1201 for(
int i=0;i<11;i++){
1202 if (seg[i]>0) nSlay++;
1208 double fltLenPoca = 0.0;
1217 if (
m_pt > 0.00001){
1221 CLHEP::Hep3Vector p1 = fitResult->
momentum(fltLenPoca);
1222 double px,py,pz,pxy;
1223 pxy = fitResult->
pt();
1254 uint32_t getDigiFlag = 0;
1255 getDigiFlag += m_maxMdcDigi;
1260 if ((
int)mdcDigiVec.size()<m_minMdcDigi){
1261 std::cout <<
" Skip this event for MdcDigiVec.size() < "<<m_minMdcDigi << endl;
1266 MdcDigiCol::iterator
iter = mdcDigiVec.begin();
1285 SmartDataPtr<MdcDigiCol> mdcDigiCol(eventSvc(),
"/Event/Digi/MdcDigiCol");
1295 uint32_t getDigiFlag = 0;
1296 getDigiFlag += m_maxMdcDigi;
1301 MdcDigiCol::iterator
iter = mdcDigiVec.begin();
1302 std::cout<<name()<<
" dump MdcDigiVec, nDigi="<<mdcDigiVec.size()<<std::endl;
1303 for (
int iDigi=0;
iter!= mdcDigiVec.end();
iter++,iDigi++ ) {
1306 int tkTruth = (*iter)->getTrackIndex();
1309 std::cout<<
"("<<l<<
","<<w<<
";"<<tkTruth<<
",t "<<tdc<<
",c "<<adc<<
")";
1310 if(iDigi%4==0) std::cout<<std::endl;
1312 std::cout<<std::endl;
double abs(const EvtComplex &c)
NTuple::Array< long > m_tsLayer
NTuple::Array< double > m_entra
NTuple::Array< long > m_tsMcTkId
NTuple::Item< double > g_findSegMc
NTuple::Tuple * m_tupleMcHit
NTuple::Tuple * m_tupleSeg
NTuple::Item< double > m_t4nMcTk
NTuple::Array< double > m_tMcLR
NTuple::Array< double > m_adc
NTuple::Item< long > m_tsNDigi
NTuple::Item< double > g_combAxMcPt
NTuple::Item< long > m_tMcNHit
NTuple::Item< double > g_combAxSlTest
NTuple::Array< double > m_dDriftD
NTuple::Array< double > m_dz
NTuple::Array< double > m_ambig
NTuple::Array< long > m_pickIs2D
NTuple::Item< double > m_tMcEvtNo
NTuple::Item< double > m_nSt
NTuple::Item< long > m_we_poisoned
NTuple::Item< double > m_we_pt
NTuple::Item< double > g_combAxQualitySeed
NTuple::Array< long > m_t4Layer
NTuple::Item< double > g_combAxPatSeed
NTuple::Item< double > m_nSlay
NTuple::Item< long > m_tMcTkId
NTuple::Item< long > m_t4nDigi
NTuple::Array< double > m_pickPt
NTuple::Tuple * g_tupleFindSeg
NTuple::Item< long > m_pickLayer
NTuple::Item< double > m_pocax
NTuple::Item< double > m_tMcPz
NTuple::Array< long > m_pickMcTk
NTuple::Array< double > m_dlr
NTuple::Item< double > g_combAxMcAmbigTest
NTuple::Item< int > g_findSegPat34
NTuple::Item< double > m_p
NTuple::Item< double > g_findSegAmbig
NTuple::Item< long > m_tMcNTk
NTuple::Item< int > g_findSegPat
NTuple::Array< long > m_tsWire
AIDA::IHistogram1D * g_pickHitWire
NTuple::Item< long > m_pickNCellWithDigi
NTuple::Array< double > m_tof
NTuple::Array< double > m_tMcWire
NTuple::Item< double > m_we_phi
AIDA::IHistogram1D * g_delCt
AIDA::IHistogram1D * g_phiDiff
NTuple::Array< double > m_pickPhiLowCut
NTuple::Array< double > m_doca
NTuple::Item< double > m_tMcPx
NTuple::Item< double > g_findSegChi2Refit
NTuple::Item< double > m_phi0
NTuple::Item< long > m_tw
NTuple::Item< double > m_nDof
NTuple::Array< double > m_tdc
NTuple::Item< long > m_t4EvtNo
NTuple::Item< double > m_tMcPy
double haveDigiDrift[43][288]
NTuple::Item< long > m_we_layer
NTuple::Tuple * m_tupleWireEff
NTuple::Item< double > m_tdncell
NTuple::Array< double > m_tMcZ
NTuple::Array< long > m_t4Wire
NTuple::Array< double > m_pickDriftCut
NTuple::Item< double > m_z0
int haveDigiAmbig[43][288]
NTuple::Item< long > m_nHit
NTuple::Item< double > m_tMcTheta
NTuple::Item< double > g_findSegIntercept
double haveDigiPhi[43][288]
AIDA::IHistogram1D * g_nSigAdd
NTuple::Item< double > m_tdphi
NTuple::Array< double > m_act
NTuple::Item< long > m_we_primary
NTuple::Item< double > m_pz
NTuple::Array< double > m_tMcX
NTuple::Array< double > m_wire
NTuple::Item< double > m_pocay
NTuple::Item< double > m_tMcZ0
NTuple::Item< long > m_we_seg
NTuple::Array< double > m_t4Charge
NTuple::Item< double > m_evtNo
NTuple::Item< long > m_we_tkId
NTuple::Item< double > m_d0
NTuple::Array< double > m_pickCurv
NTuple::Item< double > m_we_theta
NTuple::Item< long > m_we_track
NTuple::Array< double > m_resid
NTuple::Array< double > m_pickDrift
NTuple::Item< long > m_tMcPid
NTuple::Item< long > m_we_pdg
NTuple::Array< double > m_tMcY
NTuple::Item< double > m_tMcD0
NTuple::Item< double > m_t4t0
double haveDigiTheta[43][288]
NTuple::Array< double > m_z
AIDA::IHistogram1D * g_delZ0
AIDA::IHistogram1D * g_z0Cut
NTuple::Array< double > m_pickResid
NTuple::Array< int > m_pickPhizOk
NTuple::Item< long > m_we_wire
NTuple::Item< double > m_t4nRecTk
NTuple::Item< double > m_q
AIDA::IHistogram2D * g_residVsLayer
NTuple::Array< double > m_x
NTuple::Item< double > g_combAxMcTheta
AIDA::IHistogram1D * g_cirTkChi2
AIDA::IHistogram1D * g_maxSegChisqSt
NTuple::Item< long > m_tsNSeg
NTuple::Item< double > g_findSegChi2
NTuple::Item< double > g_combAxQualityTest
AIDA::IHistogram1D * h_sfHit
NTuple::Item< double > m_chi2
NTuple::Item< double > m_t0
NTuple::Array< double > m_pickSigma
AIDA::IHistogram1D * g_3dTkChi2
NTuple::Item< long > m_t4t0Stat
NTuple::Item< double > g_combAxNhitTest
AIDA::IHistogram2D * g_residVsDoca
NTuple::Item< double > g_combAxSigPhi0
NTuple::Item< double > m_nTdsTk
NTuple::Item< double > m_tphi
NTuple::Item< double > g_combAxdCurv
NTuple::Array< long > m_pickWire
NTuple::Item< double > m_pocaz
NTuple::Array< double > m_tMcDrift
NTuple::Tuple * m_tupleEvt
NTuple::Item< double > g_findSegChi2Add
NTuple::Array< double > m_cellWidth
NTuple::Tuple * m_tuplePick
NTuple::Item< double > m_nMcTk
NTuple::Array< double > m_pickDriftTruth
NTuple::Item< double > g_findSegSlope
NTuple::Item< double > g_combAxSigCurv
NTuple::Array< double > m_driftT
NTuple::Item< double > m_tMcFiTerm
NTuple::Item< long > m_tl
NTuple::Array< double > m_dx
NTuple::Array< long > m_tsInSeg
NTuple::Array< double > m_dy
NTuple::Item< double > m_t4t0Truth
double haveDigiPt[43][288]
NTuple::Item< double > m_t0Truth
NTuple::Item< double > g_combAxdPhi0
NTuple::Array< double > m_pickZ
AIDA::IHistogram1D * g_slopeDiff
NTuple::Array< double > m_pickPredDrift
NTuple::Array< double > m_tMcLayer
NTuple::Item< int > g_findSegSl
NTuple::Array< double > m_t4PhiMid
NTuple::Array< double > m_layer
NTuple::Item< double > m_pt
NTuple::Item< double > m_cpa
NTuple::Array< double > m_driftD
NTuple::Item< double > m_tanl
NTuple::Item< double > m_t0Stat
NTuple::Array< double > m_sigma
NTuple::Item< double > g_combAxPatTest
NTuple::Item< double > g_combAxNhitSeed
NTuple::Item< double > m_nAct
NTuple::Item< double > g_combAxMc
NTuple::Item< long > m_we_gwire
NTuple::Item< long > m_t4nDigiUnmatch
NTuple::Array< double > m_y
AIDA::IHistogram1D * g_maxSegChisqAx
AIDA::IHistogram1D * g_ctCut
NTuple::Array< double > m_t4Time
NTuple::Item< double > g_combAxSlSeed
NTuple::Tuple * g_tupleCombAx
NTuple::Tuple * m_tupleMc
NTuple::Item< long > m_pickNCell
NTuple::Item< double > g_combAxMcAmbigSeed
NTuple::Item< long > m_tsEvtNo
NTuple::Item< double > g_combAxMcPhi
NTuple::Array< double > m_fltLen
NTuple::Array< double > m_pickPhiHighCut
NTuple::Item< double > m_tkId
NTuple::Array< double > m_t4Hot
NTuple::Item< int > g_findSegNhit
std::vector< MdcDigi * > MdcDigiVec
ObjectVector< RecMdcHit > RecMdcHitCol
ObjectVector< RecMdcTrack > RecMdcTrackCol
IHistogramSvc * histoSvc()
double bFieldNominal() const
static const double twoPi
static const int nWireBeforeLayer[43]
const double theta() const
const HepSymMatrix err() const
const double chi2() const
const int trackId() const
const HepVector helix() const
......
GmsListLink * next() const
const MdcLayer * Layer(unsigned id) const
static MdcDetector * instance()
void setDebug(int debugFlag)
void readPar(std::string inname)
MdcTrackParams tkParTight
double entranceAngle() const
const MdcLayer * layer() const
const MdcHit * mdcHit() const
unsigned layernumber() const
unsigned wirenumber() const
double driftTime(double tof, double z) const
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
static int wire(const Identifier &id)
double phiWire(int cell) const
void printRecMdcTrackCol() const
const MdcHit * mdcHit() const
MdcHitUse * hit(int i) const
void dumpTdsTrack(RecMdcTrackCol *trackList)
bool ignoringUsedHits() const
MdcTrkRecon(const std::string &name, ISvcLocator *pSvcLocator)
bool poisoningHits() const
static void readMCppTable(std::string filenm)
MdcDigiVec & getMdcDigiVec(uint32_t control=0)
static double MdcTime(int timeChannel)
static double MdcCharge(int chargeChannel)
const HitRefVec getVecHits(void) const
const int getNhits() const
virtual void getInfo(double fltLen, HepPoint3D &pos, Hep3Vector &direction) const =0
virtual Hep3Vector momentum(double fltL=0.) const =0
virtual double pt(double fltL=0.) const =0
virtual double chisq() const =0
virtual int charge() const =0
virtual int nDof() const =0
virtual const TrkDifTraj & traj() const =0
virtual HepPoint3D position(double fltL) const =0
virtual int nActive() const =0
virtual TrkExchangePar helix(double fltL) const =0
static double nSigmaCut[43]
hot_iterator begin() const
double resid(bool exclude=false) const
const TrkRep * getParentRep() const
const TrkFit * fitResult() const
virtual double arrivalTime(double fltL) const
_EXTERN_ std::string RecMdcTrackCol
_EXTERN_ std::string RecMdcHitCol