1#include "GaudiKernel/SmartDataPtr.h"
2#include "GaudiKernel/Bootstrap.h"
3#include "GaudiKernel/IDataManagerSvc.h"
4#include "GaudiKernel/IDataProviderSvc.h"
5#include "GaudiKernel/IPartPropSvc.h"
11#include "HepPDT/ParticleDataTable.hh"
33 declareProperty(
"debug", m_debug = 0);
34 declareProperty(
"cgem", m_cgem = 1);
35 declareProperty(
"mcTruth", m_mcTruth = 0);
36 declareProperty(
"fillNTuple", m_fillNTuple= 0);
37 declareProperty(
"trackCharge", m_trackCharge = 0);
38 declareProperty(
"findPeakMethod",m_findPeakMethod=0);
61 declareProperty(
"keepBadTdc", m_keepBadTdc = 0);
62 declareProperty(
"dropHot", m_dropHot = 0);
63 declareProperty(
"keepUnmatch", m_keepUnmatch = 0);
64 declareProperty(
"driftTimeUpLimit", m_driftTimeUpLimit = 1500);
66 declareProperty(
"pdtFile", m_pdtFile =
"pdt.table");
69 declareProperty(
"nBinTheta", m_nBinTheta=100 );
70 declareProperty(
"nBinRho", m_nBinRho=50 );
71 declareProperty(
"rhoRange", m_rhoRange = 0.1);
72 declareProperty(
"ExtPeak_theta",m_ExtPeak_theta= 4);
73 declareProperty(
"ExtPeak_rho", m_ExtPeak_rho= 4);
74 declareProperty(
"shareHitRate", m_shareHitRate = 0.7);
76 declareProperty(
"nBinTanl", m_nBinTanl = 100);
77 declareProperty(
"nBinDz", m_nBinDz = 100);
78 declareProperty(
"ExtPeak_tanl", m_ExtPeak_tanl = 1);
79 declareProperty(
"ExtPeak_dz", m_ExtPeak_dz = 1);
80 declareProperty(
"filter", m_filter= 0);
81 declareProperty(
"eventFile", m_evtFile=
"EventList.txt");
82 declareProperty(
"fitFlag", m_fitFlag= 3);
83 declareProperty(
"storeFlag",
storeFlag=1);
84 declareProperty(
"checkHits", m_checkHits=1);
85 declareProperty(
"Layer",
Layer=20);
88 declareProperty(
"printFlag",
printFlag=0);
89 declareProperty(
"removeNOuterHits", m_removeNOuterHits = 0);
92 declareProperty(
"circle_chiCut", m_circle_chiCut=25.0);
95 declareProperty(
"drCut_combine", m_drCut=2.0);
96 declareProperty(
"phi0Cut_combine", m_phi0Cut=0.2);
97 declareProperty(
"kappaCut_combine",m_kappaCut=1.5);
98 declareProperty(
"dzCut_combine", m_dzCut=5.0);
99 declareProperty(
"tanlCut_combine", m_tanlCut=0.5);
102 declareProperty(
"chi2CutHits", m_chi2CutHits=25);
110 MsgStream log(
msgSvc(), name());
111 log << MSG::INFO <<
"HoughFinder::initialize()" << endreq;
116 sc = service (
"RawDataProviderSvc", irawDataProviderSvc);
118 if ( sc.isFailure() ){
119 log << MSG::ERROR << name()<<
" Could not load RawDataProviderSvc!" << endreq;
120 return StatusCode::FAILURE;
126 sc = service (
"MdcGeomSvc", imdcGeomSvc);
127 m_mdcGeomSvc =
dynamic_cast<MdcGeomSvc*
> (imdcGeomSvc);
128 if ( sc.isFailure() ){
129 log << MSG::ERROR <<
"Could not load MdcGeoSvc!" << endreq;
130 return StatusCode::FAILURE;
135 sc = service (
"MdcCalibFunSvc", imdcCalibSvc);
137 if ( sc.isFailure() ){
138 log << MSG::ERROR <<
"Could not load MdcCalibFunSvc!" << endreq;
139 return StatusCode::FAILURE;
145 sc = service (
"CgemGeomSvc", icgemGeomSvc);
146 m_cgemGeomSvc =
dynamic_cast<CgemGeomSvc*
> (icgemGeomSvc);
147 if ( sc.isFailure() ){
148 log << MSG::ERROR <<
"Could not load CgemGeomSvc!" << endreq;
149 return StatusCode::FAILURE;
154 sc = service (
"CgemCalibFunSvc", icgemCalibSvc);
156 if ( sc.isFailure() ){
157 log << MSG::ERROR <<
"Could not load CgemCalibFunSvc!" << endreq;
158 return StatusCode::FAILURE;
164 sc = service (
"MagneticFieldSvc",m_pIMF);
165 if( sc.isFailure() ) {
166 log << MSG::ERROR <<
"Unable to open Magnetic field service"<<endreq;
167 return StatusCode::FAILURE;
169 m_bfield =
new BField(m_pIMF);
172 if(m_debug==5) cout<<
"field z = "<<m_bfield->
bFieldNominal()<< endl;
204 m_roughRhoThetaMap=TH2D(
"roughRhoThetaMap",
"roughRhoThetaMap",m_nBinTheta,0.,
M_PI, m_nBinRho, -1.*m_rhoRange, m_rhoRange);
208 m_roughTanlDzMap = TH2D(
"roughTanlDzMap",
"roughTanlDzMap",m_nBinTanl,-1.*m_tanlRange,m_tanlRange,m_nBinDz,-1.*m_dzRange,m_dzRange);
211 double rho[nPt] = {0.07, 0.056,0.045,0.038,0.0335,0.03,0.0198,0.0148,0.0074,0.00376,0.00303,0.00157};
212 double cut1_Cgem_99[12]={-2.14,-1.36, -0.6 , -0.46, -0.35, -0.59, -0.32, -0.26, -0.22, -0.21, -0.21, -0.211};
213 double cut2_Cgem_99[12]={ 0.5 , 1.77, 1.99, 1.94, 1.99, 1.9 , 0.31, 0.27, 0.24, 0.23, 0.23, 0.222};
214 double cut1_ODC1_99[12]={-1.28,-0.71, -0.58, -0.62, -0.64, -0.68, -0.18, -0.14, -0.11, -0.1 , -0.1 , -0.11 };
215 double cut2_ODC1_99[12]={ 0.9 , 0.74, 0.42, 0.37, 0.32, 0.37, 0.28, 0.25, 0.24, 0.24, 0.24, 0.23};
216 double cut1_ODC2_99[12]={ -2.14, -1.25, -1.28, -0.86, -0.47, -0.78, -0.36, -0.44, -0.61, -0.67, -0.64, -0.82 };
217 double cut2_ODC2_99[12]={ -1.35, 0.55 , 0.53 , 0.83 , 0.85 , 0.83 , 0.38 , 0.55 , 0.49 , 0.46 , 0.49 , 0.4};
218 m_cut1_cgem =
new TGraph(nPt, rho, cut1_Cgem_99);
219 m_cut2_cgem =
new TGraph(nPt, rho, cut2_Cgem_99);
220 m_cut1_ODC1 =
new TGraph(nPt, rho, cut1_ODC1_99);
221 m_cut2_ODC1 =
new TGraph(nPt, rho, cut2_ODC1_99);
222 m_cut1_ODC2 =
new TGraph(nPt, rho, cut1_ODC2_99);
223 m_cut2_ODC2 =
new TGraph(nPt, rho, cut2_ODC2_99);
226 int s(0),l(0),npt(0);
227 double momenta[100] = {0};
228 double cuts[2][43][100] = {0};
229 string cutFilePath = getenv(
"HOUGHTRANSALGROOT");
230 cutFilePath +=
"/share/cut.txt";
231 ifstream fin(cutFilePath.c_str(), ios::in);
235 cout <<
"Error in " << __FILE__<<
" when opening "<<cutFilePath.c_str()<<endl;
236 bool firstline(
true);
238 while(std::getline(fin, strcom)){
241 >> momenta[0] >> momenta[1] >> momenta[2] >> momenta[3] >> momenta[4] >> momenta[5] >> momenta[6] >> momenta[7] >> momenta[8] >> momenta[9]
242 >> momenta[10] >> momenta[11] >> momenta[12] >> momenta[13] >> momenta[14] >> momenta[15] >> momenta[16] >> momenta[17] >> momenta[18] >> momenta[19]
243 >> momenta[20] >> momenta[21] >> momenta[22] >> momenta[23] >> momenta[24] >> momenta[25] >> momenta[26] >> momenta[27] >> momenta[28] >> momenta[29]
244 >> momenta[30] >> momenta[31] >> momenta[32] >> momenta[33] >> momenta[34] >> momenta[35] >> momenta[36] >> momenta[37] >> momenta[38] >> momenta[39]
245 >> momenta[40] >> momenta[41] >> momenta[42] >> momenta[43] >> momenta[44] >> momenta[45] >> momenta[46] >> momenta[47] >> momenta[48] >> momenta[49]
246 >> momenta[50] >> momenta[51] >> momenta[52] >> momenta[53] >> momenta[54] >> momenta[55] >> momenta[56] >> momenta[57] >> momenta[58] >> momenta[59]
247 >> momenta[60] >> momenta[61] >> momenta[62] >> momenta[63] >> momenta[64] >> momenta[65] >> momenta[66] >> momenta[67] >> momenta[68] >> momenta[69]
248 >> momenta[70] >> momenta[71] >> momenta[72] >> momenta[73] >> momenta[74] >> momenta[75] >> momenta[76] >> momenta[77] >> momenta[78] >> momenta[79]
249 >> momenta[80] >> momenta[81] >> momenta[82] >> momenta[83] >> momenta[84] >> momenta[85] >> momenta[86] >> momenta[87] >> momenta[88] >> momenta[89]
250 >> momenta[90] >> momenta[91] >> momenta[92] >> momenta[93] >> momenta[94] >> momenta[95] >> momenta[96] >> momenta[97] >> momenta[98] >> momenta[99]
256 fin >> cuts[
s][l][0] >> cuts[
s][l][1] >> cuts[
s][l][2] >> cuts[
s][l][3] >> cuts[
s][l][4] >> cuts[
s][l][5] >> cuts[
s][l][6] >> cuts[
s][l][7] >> cuts[
s][l][8] >> cuts[
s][l][9]
257 >> cuts[
s][l][10] >> cuts[
s][l][11] >> cuts[
s][l][12] >> cuts[
s][l][13] >> cuts[
s][l][14] >> cuts[
s][l][15] >> cuts[
s][l][16] >> cuts[
s][l][17] >> cuts[
s][l][18] >> cuts[
s][l][19]
258 >> cuts[
s][l][20] >> cuts[
s][l][21] >> cuts[
s][l][22] >> cuts[
s][l][23] >> cuts[
s][l][24] >> cuts[
s][l][25] >> cuts[
s][l][26] >> cuts[
s][l][27] >> cuts[
s][l][28] >> cuts[
s][l][29]
259 >> cuts[
s][l][30] >> cuts[
s][l][31] >> cuts[
s][l][32] >> cuts[
s][l][33] >> cuts[
s][l][34] >> cuts[
s][l][35] >> cuts[
s][l][36] >> cuts[
s][l][37] >> cuts[
s][l][38] >> cuts[
s][l][39]
260 >> cuts[
s][l][40] >> cuts[
s][l][41] >> cuts[
s][l][42] >> cuts[
s][l][43] >> cuts[
s][l][44] >> cuts[
s][l][45] >> cuts[
s][l][46] >> cuts[
s][l][47] >> cuts[
s][l][48] >> cuts[
s][l][49]
261 >> cuts[
s][l][50] >> cuts[
s][l][51] >> cuts[
s][l][52] >> cuts[
s][l][53] >> cuts[
s][l][54] >> cuts[
s][l][55] >> cuts[
s][l][56] >> cuts[
s][l][57] >> cuts[
s][l][58] >> cuts[
s][l][59]
262 >> cuts[
s][l][60] >> cuts[
s][l][61] >> cuts[
s][l][62] >> cuts[
s][l][63] >> cuts[
s][l][64] >> cuts[
s][l][65] >> cuts[
s][l][66] >> cuts[
s][l][67] >> cuts[
s][l][68] >> cuts[
s][l][69]
263 >> cuts[
s][l][70] >> cuts[
s][l][71] >> cuts[
s][l][72] >> cuts[
s][l][73] >> cuts[
s][l][74] >> cuts[
s][l][75] >> cuts[
s][l][76] >> cuts[
s][l][77] >> cuts[
s][l][78] >> cuts[
s][l][79]
264 >> cuts[
s][l][80] >> cuts[
s][l][81] >> cuts[
s][l][82] >> cuts[
s][l][83] >> cuts[
s][l][84] >> cuts[
s][l][85] >> cuts[
s][l][86] >> cuts[
s][l][87] >> cuts[
s][l][88] >> cuts[
s][l][89]
265 >> cuts[
s][l][90] >> cuts[
s][l][91] >> cuts[
s][l][92] >> cuts[
s][l][93] >> cuts[
s][l][94] >> cuts[
s][l][95] >> cuts[
s][l][96] >> cuts[
s][l][97] >> cuts[
s][l][98] >> cuts[
s][l][99]
267 if(fin.peek()<0)
break;
269 for(
int is=0;is<=1;is++){
270 for(
int il=0;il<43;il++){
271 TGraph*
gr =
new TGraph();
274 for(
int ipt=0;ipt<npt;ipt++){
276 if(fabs(cuts[is][il][ipt])<1e-6)
continue;
278 gr->SetPoint(point,momenta[ipt]/1000.,cuts[is][il][ipt]);
288 if ( sc.isFailure() ){
289 log << MSG::FATAL <<
"Could not book Tuple !" << endreq;
290 return StatusCode::FAILURE;
296 return StatusCode::SUCCESS;
301 MsgStream log(
msgSvc(), name());
302 log << MSG::INFO <<
"HoughFinder::execute()" << endreq;
308 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
310 log << MSG::ERROR <<
"Could not find Event Header" << endreq;
311 return StatusCode::FAILURE;
313 m_run = eventHeader->runNumber();
314 m_event = eventHeader->eventNumber();
322 SmartDataPtr<RecEsTimeCol> evTimeCol(eventSvc(),
"/Event/Recon/RecEsTimeCol");
324 log << MSG::ERROR <<
"Could not retrieve RecEsTimeCol" << endreq;
325 return StatusCode::FAILURE;
328 RecEsTimeCol::iterator iter_evt = evTimeCol->begin();
329 if (iter_evt != evTimeCol->end()){
330 m_bunchT0 = (*iter_evt)->getTest()*1.e-9;
341 lowPt_Evt.open(m_evtFile.c_str());
344 while( lowPt_Evt >> evtNum) {
345 evtlist.push_back(evtNum);
347 vector<int>::iterator iter_evt = find(evtlist.begin(),evtlist.end(),m_event);
348 if(iter_evt == evtlist.end()){
349 setFilterPassed(
false);
350 return StatusCode::SUCCESS;
353 setFilterPassed(
true);
364 cout<<
"===================================================================================================="<<endl;
365 cout<<
"run:"<<m_run<<
" , event: "<<m_event<<endl;
377 if(m_run<0&&m_mcTruth){
380 if(
printFlag)cout<<
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ McParticle @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"<<endl;
382 if(
printFlag)cout<<
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ McParticle @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"<<endl;
401 if(
printFlag)cout<<
"################################################## HoughTrack ##################################################"<<endl;
407 if(
printFlag)cout<<
"################################################## HoughTrack ##################################################"<<endl;
413 if(m_fillNTuple)dumpHit();
414 if(m_fillNTuple==1)dumpHoughTrack();
415 if(m_fillNTuple==1)dumpHoughEvent();
416 if(m_fillNTuple==2)dumpTdsTrack();
417 if(m_fillNTuple==2)dumpTdsEvent();
420 if(
printFlag)cout<<
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ TdsTrack $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"<<endl;
422 if(
printFlag)cout<<
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ TdsTrack $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"<<endl;
427 if(
printFlag)cout<<
"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& HoughHit &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"<<endl;
429 if(
printFlag)cout<<
"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& HoughHit &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"<<endl;
439 if(m_debug==5) cout<<endl;
441 return StatusCode::SUCCESS;
446 MsgStream log(
msgSvc(), name());
447 log << MSG::INFO <<
"HoughFinder::finalize()" << endreq;
448 return StatusCode::SUCCESS;
453 return fabs(trk1.
pt())>fabs(trk2.
pt());
458 MsgStream log(
msgSvc(), name());
460 if(!(m_mdcHitCol.empty())) m_mdcHitCol.clear();
461 if(!(m_houghHitList.empty())) m_houghHitList.clear();
462 if(!(m_XHoughHitList.empty())) m_XHoughHitList.clear();
463 if(!(m_VHoughHitList.empty())) m_VHoughHitList.clear();
467 SmartDataPtr<RecCgemClusterCol> recCgemClusterCol(eventSvc(),
"/Event/Recon/RecCgemClusterCol");
468 if(!recCgemClusterCol){
469 log << MSG::ERROR <<
"Could not retrieve RecCgemClusterCol" << endreq;
471 RecCgemClusterCol::iterator cgemClusterIter = recCgemClusterCol->begin();
472 m_recCgemClusterColBegin=cgemClusterIter;
473 for (;cgemClusterIter != recCgemClusterCol->end(); cgemClusterIter++,nHit++){
476 HoughHit hit(recCgemCluster, m_bunchT0, nHit);
477 m_houghHitList.push_back(hit);
483 uint32_t getDigiFlag = 0;
489 MdcDigiVec::iterator mdcDigiIter = mdcDigiVec.begin();
490 for (;mdcDigiIter != mdcDigiVec.end(); mdcDigiIter++,nHit++){
491 const MdcDigi* mdcDigi = (*mdcDigiIter);
492 HoughHit hit(mdcDigi, m_bunchT0, nHit);
493 if(fabs(hit.
driftTime())>m_driftTimeUpLimit)
continue;
497 m_mdcHitCol.push_back(mdcHit);
498 m_houghHitList.push_back(hit);
502 for(
HitVector_Iterator hitIt = m_houghHitList.begin(); hitIt != m_houghHitList.end();hitIt++){
503 int flag=hitIt->getFlag();
505 if(flag==0)m_XHoughHitList.push_back(&(*hitIt));
506 if(flag==2)m_VHoughHitList.push_back(&(*hitIt));
509 if(flag==0)m_XHoughHitList.push_back(&(*hitIt));
510 else m_VHoughHitList.push_back(&(*hitIt));
525 MsgStream log(
msgSvc(), name());
527 if(!(m_mcHitCol.empty()))m_mcHitCol.clear();
531 SmartDataPtr<CgemMcHitCol> cgemMcHitCol(eventSvc(),
"/Event/MC/CgemMcHitCol");
533 log << MSG::ERROR <<
"Could not retrieve CgemMcHitCol" << endreq;
535 CgemMcHitCol::iterator cgemMcHitIt = cgemMcHitCol->begin();
536 for(;cgemMcHitIt != cgemMcHitCol->end();cgemMcHitIt++,nMcHit++){
537 const CgemMcHit* cgemMcHit = (*cgemMcHitIt);
538 HoughHit hit(cgemMcHit,m_bunchT0,nMcHit);
539 m_mcHitCol.push_back(hit);
540 HoughHit* phit = &(*m_mcHitCol.rbegin());
543 vector<int> xFireStripID;
544 vector<int> vFireStripID;
547 for(
int ii = 0; ii < identifier.GetSize(); ii++){
561 sort(xFireStripID.begin(),xFireStripID.end());
562 sort(vFireStripID.begin(),vFireStripID.end());
570 bool findX(
false), findV(
false);
573 for(
HitVector_Iterator hitIt = m_houghHitList.begin(); hitIt != m_houghHitList.end();hitIt++){
577 if(!(recCgemCluster->
getflag()==0||recCgemCluster->
getflag()==1))
continue;
581 findX = recCgemCluster->
getflag() == 0
582 && xFireStripID.size() > 0
586 xCluster = recCgemCluster;
587 hitIt->setPairHit(phit);
591 findV = recCgemCluster->
getflag() == 1
592 && vFireStripID.size() > 0
596 vCluster = recCgemCluster;
597 hitIt->setPairHit(phit);
605 for(
HitVector_Iterator hitIt = m_houghHitList.begin(); hitIt != m_houghHitList.end();hitIt++){
609 if(recCgemCluster->
getflag()==0||recCgemCluster->
getflag()==1)
continue;
618 hitIt->setPairHit(phit);
622 else if(findX&&!findV){
627 else if(!findX&&findV){
637 SmartDataPtr<MdcMcHitCol> mdcMcHitCol(eventSvc(),
"/Event/MC/MdcMcHitCol");
639 log << MSG::ERROR <<
"Could not retrieve MdcMcHitCol" << endreq;
641 MdcMcHitCol::iterator mdcMcHitIt = mdcMcHitCol->begin();
642 for(;mdcMcHitIt != mdcMcHitCol->end();mdcMcHitIt++,nMcHit++){
643 const MdcMcHit* mdcMcHit = (*mdcMcHitIt);
644 HoughHit hit(mdcMcHit,m_bunchT0,nMcHit);
645 m_mcHitCol.push_back(hit);
646 HoughHit* phit = &(*m_mcHitCol.rbegin());
647 for(
HitVector_Iterator hitIt = m_houghHitList.begin(); hitIt != m_houghHitList.end();hitIt++){
649 const MdcDigi* mdcDigi = hitIt->getDigi();
653 hitIt->setPairHit(phit);
659 for(
HitVector_Iterator hitIt = m_houghHitList.begin(); hitIt != m_houghHitList.end();hitIt++){
660 for(
HitVector_Iterator mcHitIt = m_mcHitCol.begin(); mcHitIt != m_mcHitCol.end();mcHitIt++){
661 if(hitIt->getLayer()!=mcHitIt->getLayer())
continue;
663 if(mcHitIt->getCgemCluster()==NULL)
continue;
664 int recClusterID(-1);
666 int recFlag = hitIt->getCgemCluster()->getflag();
667 int mcFlag = mcHitIt->getCgemCluster()->getflag();;
669 recClusterID = hitIt->getCgemCluster()->getclusterid();
670 mcClusterID = mcHitIt->getCgemCluster()->getclusterid();
673 if(recFlag==1&&mcFlag==2){
674 recClusterID = hitIt->getCgemCluster()->getclusterid();
675 mcClusterID = mcHitIt->getCgemCluster()->getclusterflage();
678 if(recFlag==0&&mcFlag==2){
679 recClusterID = hitIt->getCgemCluster()->getclusterid();
680 mcClusterID = mcHitIt->getCgemCluster()->getclusterflagb();
683 if(recFlag==2&&mcFlag==1){
684 recClusterID = hitIt->getCgemCluster()->getclusterflage();
685 mcClusterID = mcHitIt->getCgemCluster()->getclusterid();
688 if(recFlag==2&&mcFlag==0){
689 recClusterID = hitIt->getCgemCluster()->getclusterflagb();
690 mcClusterID = mcHitIt->getCgemCluster()->getclusterid();
693 if(recClusterID==mcClusterID){
694 hitIt->setPairHit(&(*mcHitIt));
695 hitIt->setCgemMcHit(mcHitIt->getCgemMcHit());
713 if(mcHitIt->getDigi()==NULL)
continue;
715 if(hitIt->getDigi()->identify() == mcHitIt->getDigi()->identify())
717 hitIt->setPairHit(&(*mcHitIt));
718 hitIt->setMdcMcHit(mcHitIt->getMdcMcHit());
742 const int maxCell[43] = {40,44,48,56, 64,72,80,80,
743 76,76,88,88, 100,100,112,112, 128,128,140,140,
744 160,160,160,160, 176,176,176,176, 208,208,208,208, 240,240,240,240,
745 256,256,256,256, 288,288,288 };
746 m_mcTrackCol.clear();
747 MsgStream log(
msgSvc(), name());
748 SmartDataPtr<McParticleCol> mcParticleCol(eventSvc(),
"/Event/MC/McParticleCol");
749 if (!mcParticleCol) {
750 log << MSG::ERROR <<
"Could not find McParticle" << endreq;
752 bool psipDecay(
false);
753 McParticleCol::iterator iter_mc = mcParticleCol->begin();
754 for (;iter_mc != mcParticleCol->end(); iter_mc++){
755 int trackIndex = (*iter_mc)->trackIndex();
756 int pid = (*iter_mc)->particleProperty();
757 bool primaryParticle = (*iter_mc)->primaryParticle();
758 bool leafParticle = (*iter_mc)->leafParticle();
759 bool decayFromGenerator = (*iter_mc)->decayFromGenerator();
760 bool decayInFlight = (*iter_mc)->decayInFlight();
761 HepLorentzVector initialPosition = (*iter_mc)->initialPosition();
762 HepLorentzVector initialFourMomentum = (*iter_mc)->initialFourMomentum();
765 unsigned int statusFlags = (*iter_mc)->statusFlags();
779 IPartPropSvc* p_PartPropSvc;
780 static const bool CREATEIFNOTTHERE(
true);
781 StatusCode PartPropStatus = service(
"PartPropSvc", p_PartPropSvc, CREATEIFNOTTHERE);
782 if (!PartPropStatus.isSuccess() || 0 == p_PartPropSvc) {
783 log << MSG::ERROR <<
"Could not initialize Particle Properties Service" << endreq;
785 HepPDT::ParticleDataTable* p_particleTable = p_PartPropSvc->PDT();
786 if( p_particleTable->particle(pid) ){
787 name = p_particleTable->particle(pid)->name();
788 charge = p_particleTable->particle(pid)->charge();
789 }
else if( p_particleTable->particle(-pid) ){
790 name =
"anti " + p_particleTable->particle(-pid)->name();
791 charge = (-1)*p_particleTable->particle(-pid)->charge();
806 HoughTrack track(charge,initialPosition.v(),initialFourMomentum.v(),trackIndex);
812 vector<HoughHit*> hotList;
813 vector<HoughHit>& hitList = m_mcHitCol;
815 vector<int> trkID = hitIt->getTrkID();
820 hotList.push_back(&(*hitIt));
823 if(hitIt->getFlag()==0)track.
addHitPnt(&(*hitIt));
825 hotList.push_back(&(*hitIt));
830 if(nHot>0)m_mcTrackCol.push_back(track);
833 bool classifyHotByHotLayer(
false);
834 bool classifyHotByTrackCenter(
true);
835 if(classifyHotByHotLayer){
840 vector<HoughHit*> hitOnLayer;
842 for(vector<HoughHit*>::iterator hitIt = hotList.begin(); hitIt != hotList.end(); hitIt++){
846 hitOnLayer.push_back(*hitIt);
847 lastLayerHit = *hitIt;
848 lastHitLayer = (*hitIt)->
getLayer();
852 if((*hitIt)->getLayer()==lastHitLayer){
853 hitOnLayer.push_back(*hitIt);
854 lastHitLayer = (*hitIt)->getLayer();
856 if(deltaLayer*((*hitIt)->getLayer()-lastHitLayer)>=0){
857 for(vector<HoughHit*>::iterator
iter = hitOnLayer.begin();
iter != hitOnLayer.end();
iter++){
858 (*iter)->setHalfCircle(halfCircle);
859 lastLayerHit = *
iter;
866 for(vector<HoughHit*>::iterator
iter = hitOnLayer.begin();
iter != hitOnLayer.end();
iter++){
867 deltaWire = fabs((*iter)->getWire()-lastLayerHit->
getWire());
868 if(deltaWire>(maxCell[(*iter)->getLayer()])/2) deltaWire = maxCell[(*iter)->getLayer()] - deltaWire;
869 if(deltaWire>maxWireGap){
870 maxWireGap = deltaWire;
871 turnPoint =
iter - hitOnLayer.begin();
873 lastLayerHit = *
iter;
875 deltaWire = fabs((*hitIt)->getWire()-lastLayerHit->
getWire());
876 if(deltaWire>(maxCell[(*hitIt)->getLayer()])/2) deltaWire = maxCell[(*hitIt)->getLayer()] - deltaWire;
877 if(deltaWire>maxWireGap){
878 maxWireGap = deltaWire;
879 turnPoint = hitOnLayer.size();
883 for(vector<HoughHit*>::iterator
iter = hitOnLayer.begin();
iter != hitOnLayer.end();
iter++){
884 int shift =
iter-hitOnLayer.begin();
885 if(shift<turnPoint)(*iter)->setHalfCircle(halfCircle-1);
886 else (*iter)->setHalfCircle(halfCircle);
889 for(vector<HoughHit*>::iterator
iter = hitOnLayer.begin();
iter != hitOnLayer.end();
iter++){
890 int shift =
iter-hitOnLayer.begin();
891 if(shift<hitOnLayer.size()/2)(*iter)->setHalfCircle(halfCircle-1);
892 else (*iter)->setHalfCircle(halfCircle);
897 hitOnLayer.push_back(*hitIt);
898 lastHitLayer = (*hitIt)->getLayer();
899 deltaLayer = (*hitIt)->getLayer()-lastHitLayer;
908 if(classifyHotByTrackCenter){
909 int cgemHalf(0), mdcHalf(0);
910 int cgemSign(0), mdcSign(0);
911 int half(0), sign(0);
912 for(vector<HoughHit*>::iterator hitIt = hotList.begin(); hitIt != hotList.end(); hitIt++){
930 (*hitIt)->setHalfCircle(half);
933 if(hotList.size()>0){
938 for(vector<HoughHit*>::iterator hotIt = hotList.begin(); hotIt != hotList.end();hotIt++){
945 if(
printFlag)
if(hotList.size())cout<<endl;
947 sort(m_mcTrackCol.begin(),m_mcTrackCol.end(),
largerPt);
949 for(vector<HoughTrack>::iterator trkIter=m_mcTrackCol.begin();trkIter!=m_mcTrackCol.end();trkIter++){
953 return m_mcTrackCol.size();
959 int nBin = hitMap->GetXaxis()->GetNbins();
960 double xMin = hitMap->GetXaxis()->GetXmin();
961 double xMax = hitMap->GetXaxis()->GetXmax();
962 double yMin = hitMap->GetYaxis()->GetXmin();
963 double yMax = hitMap->GetYaxis()->GetXmax();
964 double dx = (xMax-xMin)/(nBin*vote)>1e-6?(xMax-xMin)/(nBin*vote):1e-6;
965 double x = xMin + dx/2;
973 double denominator = xHit*xHit+yHit*yHit-rHit*rHit;
976 double X1 = 2*xHit/denominator;
977 double Y1 = 2*yHit/denominator;
978 double X2 = 2*xHit/denominator;
979 double Y2 = 2*yHit/denominator;
980 double R = 2*rHit/denominator;
987 double hitOnCircle1 = charge*slope1*y1;
988 double hitOnCircle2 = charge*slope2*y2;
991 cut = yMin<y1 && y1<yMax;
992 cut =
cut && hitOnCircle1 <=0;
999 cut = yMin<y2 && y2<yMax;
1000 cut =
cut && hitOnCircle2 <= 0;
1013 vector<HoughHit::S_Z> sz = hit->
getSZ();
1014 vector<HoughHit::S_Z>::iterator
iter = sz.begin();
1016 double S =
iter->first;
1017 double Z =
iter->second;
1025 cut = yMin<y && y<yMax;
1039 int charge =
trkCandi->getCharge();
1040 int nBin = hitMap->GetXaxis()->GetNbins();
1041 double xMin = hitMap->GetXaxis()->GetXmin();
1042 double xMax = hitMap->GetXaxis()->GetXmax();
1043 double yMin = hitMap->GetYaxis()->GetXmin();
1044 double yMax = hitMap->GetYaxis()->GetXmax();
1045 double dx = (xMax-xMin)/(nBin*vote)>1e-6?(xMax-xMin)/(nBin*vote):1e-6;
1046 double x = xMin + dx/2;
1052 bool firstHalf =
trkCandi->judgeHalf(hit)==1;
1053 if(!firstHalf)
return 0;
1057 double denominator = xHit*xHit+yHit*yHit-rHit*rHit;
1060 double X1 = 2*xHit/denominator;
1061 double Y1 = 2*yHit/denominator;
1062 double X2 = 2*xHit/denominator;
1063 double Y2 = 2*yHit/denominator;
1064 double R = 2*rHit/denominator;
1071 double hitOnCircle1 = charge*slope1*y1;
1072 double hitOnCircle2 = charge*slope2*y2;
1075 cut = yMin<y1 && y1<yMax;
1082 cut = yMin<y2 && y2<yMax;
1096 int nTangency =
trkCandi->calculateZ_S(hit);
1102 vector<HoughHit::S_Z> sz = hit->
getSZ();
1103 vector<HoughHit::S_Z>::iterator
iter = sz.begin();
1106 double S =
iter->first;
1107 double Z =
iter->second;
1110 double y = -S*
x + Z;
1113 cut = yMin<y && y<yMax;
1130 bool nearStereoHits=
false;
1133 int nHitsFilled = 0;
1134 m_nVClusterOnSZmap=0;
1135 m_VHoughHitListOnSZmap.clear();
1136 std::vector<HoughHit*>::iterator
iter = hitList.begin();
1137 for(;
iter!= hitList.end();
iter++)
1139 int used = (*iter)->getUse();
1147 if(!nearStereoHits&&(*iter)->getHitType()==
HoughHit::MDCHIT&&(*iter)->getFlag()!=0)
continue;
1161 m_VHoughHitListOnSZmap.push_back(*
iter);
1659 if(trackVector.size()==0)
return 0;
1660 std::sort(trackVector.begin(),trackVector.end(),
moreHot);
1662 vector<HoughTrack>::iterator trkIT1 = trackVector.end();
1669 if(trkIT1==trackVector.begin()) loop=
false;
1670 if((trkIT1)->getFlag() == 1)
continue;
1673 int nHits = trkIT1->getVecHitPnt().size();
1675 (trkIT1)->setFlag(1);
1676 trkIT1->releaseSelHits();
1678 cout<<
"too less hits ("<<nHits<<
") in track "<<(trkIT1)->getTrkID()<<endl;
1682 int nShared = trkIT1->getNHitsShared();
1685 if(nShared>m_shareHitRate*nHits){
1687 trkIT1->releaseSelHits();
1690 cout<<
"too many shared hits ("<<nShared<<
"/"<<nHits
1691 <<
") in track "<<(trkIT1)->getTrkID()
1711 std::sort(trackVector.begin(),trackVector.end(),
moreHot);
1712 for(vector<HoughTrack>::iterator trkIT1 = trackVector.begin(); trkIT1!=trackVector.end(); trkIT1++){
1713 if((trkIT1)->getFlag() == 1)
continue;
1714 int charge = (trkIT1)->getCharge();
1715 double dr = (trkIT1)->dr();
1716 double phi0 = (trkIT1)->phi0();
1717 double kappa = (trkIT1)->kappa();
1718 double dz = (trkIT1)->dz();
1719 double tanl = (trkIT1)->tanl();
1720 for(vector<HoughTrack>::iterator trkIT2 = trkIT1+1; trkIT2!=trackVector.end();trkIT2++){
1721 if((trkIT2)->getFlag() == 1)
continue;
1722 bool sameTrack(
false);
1723 dDr = fabs(dr - (trkIT2)->dr());
1724 dPhi0 = fabs(phi0 - (trkIT2)->phi0());
1725 if((trkIT2)->getCharge() == charge){
1726 dKappa = fabs(kappa - (trkIT2)->kappa());
1727 dTanl = fabs(tanl - (trkIT2)->tanl());
1729 dKappa = fabs(fabs(kappa) - fabs((trkIT2)->kappa()));
1730 dTanl = fabs(fabs(tanl) - fabs((trkIT2)->tanl()));
1732 double r = fabs(dz)<fabs((trkIT2)->dz())?(trkIT1)->radius():(trkIT2)->radius();
1733 double k = dz<fabs((trkIT2)->dz())?tanl:(trkIT2)->tanl();
1734 dDz = fabs(dz - (trkIT2)->dz());
1735 int nCircle = fabs(dDz)/(2*
M_PI*r*k);
1736 dDz = fabs(dDz - nCircle*(2*
M_PI*r*k));
1737 if(dDz>
M_PI*r*k)dDz = fabs(dDz - 2*
M_PI*r*k);
1738 if(dPhi0<m_phi0Cut&&dKappa<m_kappaCut&&dTanl<m_tanlCut) sameTrack=
true;
1748 (trkIT2)->setFlag(1);
1750 cout<<
"dDr, dPhi0, dKappa, dDz, dTanl "
1757 cout<<
"similar track "<<trkIT2->getTrkID()<<
" is removed from hough track list"<<endl;
1765 if(m_debug==5) cout<<
"checkTrack(): "<<nDelete<<
" similar tracks are removed from hough track list"<<endl;
1830 MsgStream log(
msgSvc(), name());
1832 IDataProviderSvc* eventSvc = NULL;
1833 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
1835 log << MSG::INFO <<
"makeTds:event Svc has been found" << endreq;
1837 log << MSG::FATAL <<
"makeTds:Could not find eventSvc" << endreq;
1838 return StatusCode::FAILURE;
1841 IDataManagerSvc *dataManSvc =
dynamic_cast<IDataManagerSvc*
>(eventSvc);;
1846 DataObject *aRecMdcTrackCol;
1847 eventSvc->findObject(
"/Event/Recon/RecMdcTrackCol",aRecMdcTrackCol);
1848 if(aRecMdcTrackCol != NULL) {
1849 dataManSvc->clearSubTree(
"/Event/Recon/RecMdcTrackCol");
1850 eventSvc->unregisterObject(
"/Event/Recon/RecMdcTrackCol");
1853 sc = eventSvc->registerObject(
"/Event/Recon/RecMdcTrackCol", recMdcTrackCol);
1854 if(sc.isFailure()) {
1855 log << MSG::FATAL <<
" Could not register RecMdcTrack collection" <<endreq;
1856 return StatusCode::FAILURE;
1858 log << MSG::INFO <<
"RecMdcTrackCol registered successfully!" <<endreq;
1863 DataObject *aRecMdcHitCol;
1864 eventSvc->findObject(
"/Event/Recon/RecMdcHitCol",aRecMdcHitCol);
1865 if(aRecMdcHitCol != NULL) {
1866 dataManSvc->clearSubTree(
"/Event/Recon/RecMdcHitCol");
1867 eventSvc->unregisterObject(
"/Event/Recon/RecMdcHitCol");
1870 sc = eventSvc->registerObject(
"/Event/Recon/RecMdcHitCol", recMdcHitCol);
1871 if(sc.isFailure()) {
1872 log << MSG::FATAL <<
" Could not register RecMdcHit collection" <<endreq;
1873 return StatusCode::FAILURE;
1875 log << MSG::INFO <<
"RecMdcHitCol registered successfully!" <<endreq;
1878 return StatusCode::SUCCESS;
1890 vector<MdcTrack*> mdcTrackVector;
1891 for(vector<HoughTrack>::iterator trkIT = trackVector.begin();trkIT!=trackVector.end();trkIT++){
1892 if((trkIT)->getFlag() == 1)
continue;
1893 if((trkIT)->getFlag() == -1)
continue;
1894 if((trkIT)->getFlag() == -2)
continue;
1897 mdcTrackList.append(mdcTrack);
1898 mdcTrackVector.push_back(mdcTrack);
1903 if(nDeleted>0)cout<<
"nDeleted "<<nDeleted<<endl;
1906 for(
int l=0;l<mdcTrackList.length();l++){
1907 mdcTrackList[l]->storeTrack(trkID,recMdcTrackCol,recMdcHitCol,4);
1911 vector<MdcTrack*>::iterator
iter = mdcTrackVector.begin();
1912 for(;
iter!=mdcTrackVector.end();
iter++){
1927 if(debug) cout<<
"N Rectrack: "<<trackVector.size()<<endl;
1928 sort(trackVector.begin(),trackVector.end(),
largerPt);
1930 for(vector<HoughTrack>::iterator trkIT = trackVector.begin(); trkIT!=trackVector.end(); trkIT++)
1933 if(debug) cout<<
"trk flag: "<<(trkIT)->getFlag()<<endl;
1938 if((trkIT)->getFlag()!=0)
continue;
1942 cout<<
"the following track will be saved: "<<endl;
1952 helixPar[0]=trkIT->getDr();
1953 helixPar[1]=trkIT->getPhi0();
1954 helixPar[2]=trkIT->getKappa();
1955 helixPar[3]=trkIT->getDz();
1956 helixPar[4]=trkIT->getTanl();
1959 int q = trkIT->getCharge();
1960 double pxy = trkIT->pt();
1961 double px = trkIT->momentum(0).x();
1962 double py = trkIT->momentum(0).y();
1963 double pz = trkIT->momentum(0).z();
1964 double p = trkIT->momentum(0).mag();
1965 double theta = trkIT->direction(0).theta();
1966 double phi = trkIT->direction(0).phi();
1969 double r = poca.perp();
1970 HepSymMatrix Ea = trkIT->Ea();
1972 double errorMat[15];
1974 for (
int ie = 0 ; ie < 5 ; ie ++){
1975 for (
int je = ie ; je < 5 ; je ++){
1976 errorMat[k] = Ea[ie][je];
1982 a(1) =trkIT->getDr();
1983 a(2) =trkIT->getPhi0();
1984 a(3) =trkIT->getKappa();
1985 a(4) =trkIT->getDz();
1986 a(5) =trkIT->getTanl();
1989 double chisq = trkIT->getChi2();
1991 recMdcTrack->
setPxy(pxy);
1992 recMdcTrack->
setPx(px);
1993 recMdcTrack->
setPy(py);
1994 recMdcTrack->
setPz(pz);
1995 recMdcTrack->
setP(p);
1997 recMdcTrack->
setPhi(phi);
1999 recMdcTrack->
setX(poca.x());
2000 recMdcTrack->
setY(poca.y());
2001 recMdcTrack->
setZ(poca.z());
2002 recMdcTrack->
setR(sqrt(poca.x()*poca.x() + poca.y()*poca.y()));
2018 map<int,int> clusterFitStat;
2020 int maxLayerId = -1;
2021 int minLayerId = 43;
2022 double fiTerm = 999.;
2026 vector<HoughHit*> hotList = trkIT->getHotList(2);
2027 for(vector<HoughHit*>::iterator hotIt = hotList.begin(); hotIt != hotList.end();hotIt++)
2131 clusterFitStat[clusterid] = stat;
2132 clusterRefVec.push_back(recCgemCluster);
2133 if(debug) cout<<
" cluster "<<clusterid<<
" kept! "<<endl;
2148 vector<RecMdcHit>* RecMdcHitVecPnt = trkIT->getRecMdcHitVec();
2149 int nMdcHits=RecMdcHitVecPnt->size();
2151 vector<RecMdcHit>::iterator iter_recMdcHit = RecMdcHitVecPnt->begin();
2152 for(; iter_recMdcHit!=RecMdcHitVecPnt->end(); iter_recMdcHit++)
2161 recMdcHit->
setId(hitId);
2164 hitList->push_back(recMdcHit);
2165 SmartRef<RecMdcHit> refHit(recMdcHit);
2166 hitRefVec.push_back(refHit);
2172 if(debug) cout<<
" hit at layer "<<layer<<
" wire "<<wire<<
" kept! "<<endl;
2173 if(layer>maxLayerId)
2179 if(layer<minLayerId)
2185 if(debug) cout<<
"track "<<trackId<<
", "<<nMdcHitsKept<<
"/"<<nMdcHits<<
" hits kept"<<endl;
2188 if (fiTermHot!=NULL){
2191 fiTerm = trkIT->flightArc(point)/trkIT->radius();
2193 if(fltLen>0) fiTerm=-fltLen*
sin(theta)/trkIT->radius();
2198 std::sort(clusterRefVec.begin(),clusterRefVec.end(),
sortCluster);
2200 trackList->push_back(recMdcTrack);
2203 return trackList->size();
2211 if(debug) cout<<
"N Rectrack: "<<trackVector.size()<<endl;
2212 sort(trackVector.begin(),trackVector.end(),
largerPt);
2214 for(vector<HoughTrack>::iterator trkIT = trackVector.begin();trkIT!=trackVector.end();trkIT++){
2215 if(debug) cout<<
"trk flag: "<<(trkIT)->getFlag()<<endl;
2216 if((trkIT)->getFlag() == 1)
continue;
2217 if((trkIT)->getFlag() == -1)
continue;
2218 if((trkIT)->getFlag() == -2)
continue;
2219 if(trkIT->getTrkRecoTrk()==NULL)
2221 if(debug) cout<<
"trk getTrkRecoTrk NULL!"<<endl;
2225 const TrkFit* fitresult = trkIT->getTrkRecoTrk()->fitResult();
2229 if(debug) cout<<
"no fit result!"<<endl;
2234 cout<<
"the following track will be saved: "<<endl;
2243 const TrkHitList* aList = trkIT->getTrkRecoTrk()->hits();
2245 const BField& theField = trkIT->getTrkRecoTrk()->bField();
2246 double Bz = theField.
bFieldZ();
2263 nHits = aList->
nHit();
2270 double chisq = fitresult->
chisq();
2271 int nDof = fitresult->
nDof();
2276 double fltLenPoca = 0.0;
2279 double phi0 = helix.
phi0();
2280 double tanDip = helix.
tanDip();
2282 double d0 = helix.
d0();
2293 helixPar[1] = tphi0;
2295 double pxy = fitresult->
pt();
2296 if (pxy == 0.) helixPar[2] = 9999.;
2297 else helixPar[2] =
q/fabs(pxy);
2298 if(pxy>9999.) helixPar[2] = 0.00001;
2300 helixPar[3] = helix.
z0();
2302 helixPar[4] = tanDip;
2305 HepSymMatrix mS(helix.
params().num_row(),0);
2308 mS[2][2]=-333.567/Bz;
2311 HepSymMatrix mVy = helix.
covariance().similarity(mS);
2312 double errorMat[15];
2314 for (
int ie = 0 ; ie < 5 ; ie ++){
2315 for (
int je = ie ; je < 5 ; je ++) {
2316 errorMat[k] = mVy[ie][je];
2321 px = pxy * (-
sin(helixPar[1]));
2322 py = pxy *
cos(helixPar[1]);
2323 pz = pxy * helixPar[4];
2324 p = sqrt(pxy*pxy + pz*pz);
2326 double theta = acos(pz/p);
2327 double phi = atan2(py,px);
2331 recMdcTrack->
setPxy(pxy);
2332 recMdcTrack->
setPx(px);
2333 recMdcTrack->
setPy(py);
2334 recMdcTrack->
setPz(pz);
2335 recMdcTrack->
setP(p);
2337 recMdcTrack->
setPhi(phi);
2339 recMdcTrack->
setX(poca.x());
2340 recMdcTrack->
setY(poca.y());
2341 recMdcTrack->
setZ(poca.z());
2342 recMdcTrack->
setR(sqrt(poca.x()*poca.x() + poca.y()*poca.y()));
2356 vector<int> vecHits;
2357 map<int,int> clusterFitStat;
2367 if(maxLayer < layerId)maxLayer = layerId;
2371 int maxLayerId = -1;
2372 int minLayerId = 43;
2373 double fiTerm = 999.;
2376 for (;hot!=aList->
end();hot++){
2381 if(!(recoHot->
isActive()))
continue;
2383 if(layerId>(maxLayer - m_removeNOuterHits))
continue;
2387 recMdcHit->
setId(hitId);
2399 double hotWireAmbig = recoHot->
wireAmbig();
2400 double driftDist = fabs(recoHot->
drift());
2401 double sigma = recoHot->
hitRms();
2402 double doca = fabs(recoHot->
dcaToWire());
2404 if ( hotWireAmbig == 1){
2407 }
else if( hotWireAmbig == -1){
2409 }
else if( hotWireAmbig == 0){
2424 double res=999.,rese=999.;
2425 if (recoHot->
resid(res,rese,
false)){
2439 double fltLen = recoHot->
fltLen();
2452 if (layerId >= maxLayerId){
2453 maxLayerId = layerId;
2454 fiTermHot = recoHot;
2456 if (layerId < minLayerId){
2457 minLayerId = layerId;
2469 hitList->push_back(recMdcHit);
2470 SmartRef<RecMdcHit> refHit(recMdcHit);
2471 hitRefVec.push_back(refHit);
2479 if(stat==0)
continue;
2481 clusterFitStat[clusterid] = stat;
2484 clusterRefVec.push_back(recCgemCluster);
2487 std::sort(clusterRefVec.begin(),clusterRefVec.end(),
sortCluster);
2489 if (fiTermHot!=NULL){
2490 fiTerm=(1./sqrt(1.+tanDip*tanDip))*fiTermHot->
fltLen()*helix.
omega();
2508 trackList->push_back(recMdcTrack);
2714return trackList->size();
2720 cout<<
"========== truth =========="<<endl;
2725 cout<<
"========== Digi =========="<<endl;
2726 for(
HitVector_Iterator hitIt = m_houghHitList.begin(); hitIt != m_houghHitList.end();hitIt++)
2792int HoughFinder::searchCircle()
2797 cout<<
"***************************************"<<endl;
2798 cout<<
"start circle search : "<<endl;
2800 m_triedCellInRoughMap.clear();
2801 bool tryCgemLeftOnly=
false;
2807 m_roughRhoThetaMap.Reset();
2812 nXhitsLeft =
fillHistogram(m_XHoughHitList,&m_roughRhoThetaMap,charge,vote);
2815 cout<<
"------------------------------------------------------------------------------------ "<<endl;
2816 cout<<
"nXhitsLeft = "<<nXhitsLeft<<endl;
2820 if(!tryCgemLeftOnly) {
2822 tryCgemLeftOnly=
true;
2823 if(nCgemHitsLeft>=3) {
2824 if(m_debug==5) cout<<
"Now try CGEM left only"<<endl;
2832 double x_peak(0.), y_peak(0.);
2833 double x_weight(0.), y_weight(0.);
2834 getWeightedPeak(m_roughRhoThetaMap, x_peak, y_peak, x_weight, y_weight);
2835 if(m_debug==5) cout<<
"rough x_weight, y_weight = "<<x_weight<<
", "<<y_weight<<endl;
2841 double x_min=x_peak-0.5*m_ExtPeak_theta*
M_PI/m_nBinTheta;
2842 double x_max=x_peak+0.5*m_ExtPeak_theta*
M_PI/m_nBinTheta;
2843 double y_min=y_peak-0.5*m_ExtPeak_rho*0.2/m_nBinRho;
2844 double y_max=y_peak+0.5*m_ExtPeak_rho*0.2/m_nBinRho;
2847 int nFineBin_Theta = nFineBinTheta(y_peak);
2848 int nFineBin_Rho = nFineBinRho(y_peak);
2849 if(m_debug==5) cout<<
"nThetaFine, nRhoFine = "<<nFineBin_Theta<<
", "<<nFineBin_Rho<<endl;
2851 int trkFoundThisTry = 0;
2854 for(charge=-1; charge<2; charge+=2)
2857 if(m_debug==5) cout<<
"/******** Try iCharge = "<<charge<<
" **********/"<<endl;
2860 int trkID = m_houghTrackList.size();
2861 double binTheta(0.), binRho(0.);
2862 HoughTrack track(charge, x_peak, y_peak, binTheta, binRho, trkID);
2863 if(m_debug==5) cout<<
"circle center = "<<track.center()<<endl;
2865 m_fineRhoThetaMap.Reset();
2866 m_fineRhoThetaMap.SetBins(nFineBin_Theta,x_min,x_max,nFineBin_Rho,y_min,y_max);
2870 if(fabs(y_weight)<0.02)
2873 nHitFilled =
fillHistogram(m_XHoughHitList,&m_fineRhoThetaMap,0,vote);
2878 nHitFilled =
fillHistogram(m_XHoughHitList,&m_fineRhoThetaMap,charge,vote);
2881 if(m_debug==5) cout<<
"nHitFilled<3 -> continue"<<endl;
2885 double theta_peak, rho_peak, theta_weight, rho_weight;
2886 getWeightedPeak(m_fineRhoThetaMap, theta_peak, rho_peak, theta_weight, rho_weight);
2889 track.update(theta_weight,rho_weight);
2897 track.resetNhitHalf();
2899 if(fabs(y_weight)<0.02)
2901 track.findXHot(m_XHoughHitList,0);
2903 if(charge==-1&&track.getNhitUnusedFirstHalf()<track.getNhitUnusedSecondHalf())
2905 if(m_debug==5) cout<<
"--- the second half has more hits, try next charge: "<<endl;
2913 if(m_debug==5) cout<<
" --- the first half has more hits, go ahead: "<<endl;
2916 nXsel = track.findXHot(m_XHoughHitList, charge);
2918 NHitTried = track.getNTried();
2920 cout<<
"sel "<<nXsel<<
" hits, "<<NHitTried<<
" new hits tried"<<endl;
2931 int fitFlag_circle = 0;
2940 fitFlag_circle = track.fitCircle(&myDotsHelixFitter,m_bunchT0*1e9, m_circle_chiCut, m_debug);
2942 if(fitFlag_circle==0)
2944 HepVector a_circle_fit = myDotsHelixFitter.
getHelix();
2945 track.updateCirclePar(a_circle_fit[0], a_circle_fit[1], a_circle_fit[2]);
2947 int nXsel_new = track.findXHot(m_XHoughHitList, charge);
2948 int nDrop = track.dropRedundentCgemXHits();
2950 cout<<
" sel "<<nXsel_new<<
" hits after fitCircle, fitted pt = "<<track.pt();
2951 if(nDrop>0) cout<<
", drop "<<nDrop<<
" redundent CgemXHits";
2955 NHitTried = track.getNTried();
2956 if(nXsel_new==0||NHitTried==0) {
2957 track.update(theta_weight,rho_weight);
2958 nXsel = track.findXHot(m_XHoughHitList, charge);
2959 NHitTried = track.getNTried();
2971 if(track.isAGoodCircle())
2973 track.markUsedHot(1);
2975 m_houghTrackList.push_back(track);
2976 if(m_debug==5) cout<<
"save this circle trk"<<endl;
2991 if(m_debug==5) cout<<
"drop this circle trk"<<endl;
2993 track.markUsedHot(-1);
2999 if(m_debug==5) cout<<
"no new hits tried in this try"<<endl;
3000 if(!tryCgemLeftOnly) {
3002 tryCgemLeftOnly=
true;
3003 if(m_debug==5) cout<<
"check nCgemHitsLeft="<<nCgemHitsLeft<<endl;
3004 if(nCgemHitsLeft>=3) {
3005 if(m_debug==5) cout<<
"Now try CGEM left only"<<endl;
3009 if(m_debug==5) cout<<
"stop circle trk finding "<<endl;
3018int HoughFinder::searchCircle2()
3022 cout<<
"***************************************"<<endl;
3023 cout<<
"start circle search : "<<endl;
3025 m_roughRhoThetaMap.Reset();
3029 nXhitsLeft =
fillHistogram(m_XHoughHitList,&m_roughRhoThetaMap,charge,vote);
3031 if(nXhitsLeft<=3)
return 0;
3037void HoughFinder::getWeightedPeak(TH2D& h,
double& x_peak,
double& y_peak,
double& x_weight,
double& y_weight,
int x_ext,
int y_ext)
3039 int ix_max, iy_max, iz_max;
3040 h.GetMaximumBin(ix_max, iy_max, iz_max);
3041 int nx=h.GetXaxis()->GetNbins();
3042 int ny=h.GetYaxis()->GetNbins();
3045 if(ix_max==0&&iy_max==0) {
3047 for(
int i=0; i<nx; i++)
3050 for(
int j=0; j<ny; j++)
3052 double n_tmp = h.GetBinContent(i,j);
3058 x_peak=h.GetXaxis()->GetBinCenter(ix_max);
3059 y_peak=h.GetYaxis()->GetBinCenter(iy_max);
3060 x_weight=0.; y_weight=0.;
3062 if(x_ext>=0&&y_ext>=0) {
3063 for(
int i1=ix_max-x_ext; i1<=ix_max+x_ext; i1++)
3065 double x_tmp = h.GetXaxis()->GetBinCenter(i1);
3070 for(
int i2=iy_max-y_ext; i2<=iy_max+y_ext; i2++)
3072 double n_tmp = h.GetBinContent(i1_tmp,i2);
3073 if(i2<1||i2>ny) n_tmp=0.;
3074 if(i1<1||i1>nx) n_tmp=0.;
3076 double y_tmp = h.GetYaxis()->GetBinCenter(i2);
3077 x_weight+=x_tmp*n_tmp;
3078 y_weight+=y_tmp*n_tmp;
3082 x_weight=x_weight/
weight;
3083 y_weight=y_weight/
weight;
3091void HoughFinder::getLocalPeaks(TH2D& h,
int minCut)
3093 int nx=h.GetXaxis()->GetNbins();
3094 int ny=h.GetYaxis()->GetNbins();
3095 vector<int> cell_locMax(nx*ny,0);
3096 for(
int i=0; i<nx; i++)
3098 for(
int j=0; j<ny; j++)
3101 if(h.GetBinContent(i+1,j+1)<minCut)
continue;
3102 if(cell_locMax[index]<0)
continue;
3103 for(
int i1=max(i-1,0); i1<min(i+2,nx); i1++)
3105 for(
int j1=max(j-1,0); j1<min(j+2,ny); j1++)
3107 if(i==i1&&j==j1)
continue;
3108 if(h.GetBinContent(i+1,j+1)<=h.GetBinContent(i1+1,j1+1)) {
3109 cell_locMax[index]=-1;
3114 cell_locMax[i1+j1*nx]=-1;
3118 if(cell_locMax[index]<0)
break;
3120 if(cell_locMax[index]==0) {
3121 cout<<
"a local maximum found ("<<i<<
", "<<j<<
")"<<endl;
3127int HoughFinder::nFineBinTheta(
double rho)
3129 double rho_rough = fabs(rho);
3130 double k_theta = (600.-1200.)/0.0335;
3131 int nThetaFine = int(k_theta*rho_rough+1200);
3132 if(nThetaFine<500) nThetaFine=500;
3135 nThetaFine=ceil(1.0*nThetaFine/m_nBinTheta*m_ExtPeak_theta);
3139int HoughFinder::nFineBinRho(
double rho)
3141 double rho_rough = fabs(rho);
3143 if(rho_rough<0.0198)
3145 double k1_rho = (850.-1200.)/0.0198;
3146 nRhoFine=int(k1_rho*rho_rough+1200);
3148 else if(rho_rough<0.03)
3150 double k2_rho = (300.-850.)/(0.03-0.0198);
3151 nRhoFine=int(k2_rho*(rho_rough-0.0198)+850.);
3155 double k3_rho = (100.-300.)/(0.056-0.03);
3156 nRhoFine=int(k3_rho*(rho_rough-0.03)+300.);
3157 if(nRhoFine<50) nRhoFine=50;
3160 nRhoFine=ceil(1.0*nRhoFine/m_nBinRho*m_ExtPeak_rho);
3165void HoughFinder::XhitCutWindow(
double rho,
int ilayer,
double charge,
double& cut1,
double &cut2)
3168 if(rho>0.07) rho=0.07;
3169 TGraph* g_cut1, *g_cut2;
3174 else if(ilayer<=19) {
3178 else if(ilayer<=42) {
3183 cut1=g_cut1->Eval(rho);
3184 cut2=g_cut2->Eval(rho);
3191 double cut=max(fabs(cut1),fabs(cut2));
3209 trackVector.clear();
3215 vector<MdcHit*>::iterator imdcHit = m_mdcHitCol.begin();
3216 for(;imdcHit != m_mdcHitCol.end();imdcHit++){
3220 for(vector<HoughTrack>::iterator trkIT = m_houghTrackList.begin();trkIT!=m_houghTrackList.end();trkIT++){
3221 trkIT->clearMemory();
3231 vector<HoughHit*>::iterator
iter = hitPntList.begin();
3232 for(;
iter!=hitPntList.end();
iter++)
3236 int useOld = (*iter)->getUse();
3237 int iLayer = (*iter)->getLayer();
3239 if(useOld==-1||useOld==0) {
3245 if(useOld==0) (*iter)->setUse(-1);
3254 vector<HoughHit*>::iterator itHit = hitList.begin();
3255 for(; itHit!=hitList.end(); itHit++)
3259 vector<int> trkIdList = (*itHit)->getTrkID();
3260 int nTrkSharing = trkIdList.size();
3265 int trkId_minDelD=-1;
3266 double minResid = 99.0;
3268 vector<double> vecRes = (*itHit)->getVecResid();
3269 int nTrk = vecRes.size();
3271 for(
int i=0; i<nTrk; i++)
3274 if(minResid>fabs(vecRes[i])) {
3275 minResid=fabs(vecRes[i]);
3276 trkId_minDelD=trkIdList[i];
3281 for(
int i=0; i<nTrk; i++)
3283 if(trkIdList[i]!=trkId_minDelD) {
3284 (*itHit)->dropTrkID(trkIdList[i]);
3285 vector<HoughTrack>::iterator itTrk =
getHoughTrkIt(m_houghTrackList,trkIdList[i]);
3286 if(itTrk!=m_houghTrackList.end()) itTrk->dropHitPnt(&(*(*itHit)));
3289 trkIdList = (*itHit)->getTrkID();
3290 nTrkSharing = trkIdList.size();
3299 vector<HoughTrack>::iterator it = houghTrkList.begin();
3300 for(; it!=houghTrkList.end(); it++)
3302 if(it->getTrkID()==trkId)
break;
3311int HoughFinder::associateVHits()
3318 cout<<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
3319 cout<<
" start V hits association: "<<endl;
3322 for(vector<HoughTrack>::iterator trkIT = m_houghTrackList.begin(); trkIT!=m_houghTrackList.end(); trkIT++)
3328 if(trkIT->getFlag()!=0)
continue;
3329 trkIT->updateLayerStat();
3331 cout<<
"try V-hits association for circle: "<<trkIT->getTrkID()<<endl;
3332 cout<<
"if near stereo hits: "<<trkIT->nearStereoHits()<<endl;
3334 trkIT->clearXVhitsCgem();
3338 m_roughTanlDzMap.Reset();
3341 nXVhit =
fillHistogram(m_VHoughHitList,&m_roughTanlDzMap,0,vote,&(*trkIT));
3343 cout<<nXVhit<<
" nXVhits filled in the sz Hough map"<<endl;
3345 double x_peak(0.), y_peak(0.);
3346 double x_weight(0.), y_weight(0.);
3351 cout<<
"not enough V hits "<<endl;
3356 else if(m_nVClusterOnSZmap>0.5*nXVhit)
3361 getWeightedPeak(m_roughTanlDzMap, x_peak, y_peak, x_weight, y_weight);
3376 double cosTh=x_weight/sqrt(x_weight*x_weight+1);
3378 cout<<
" cosTh="<<cosTh<<
", dz="<<y_weight<<endl;
3380 trkIT->setTanl(x_weight);
3381 trkIT->setDz(y_weight);
3382 trkIT->updateHelix();
3384 int charge = trkIT->getCharge();
3512 int helixFitFlag(0);
3516 for(
int j=0; j<2; j++)
3518 double cutFactor=1.0;
3519 if(nXVhit<4) cutFactor=3;
3520 if(fabs(cosTh)>0.8) cutFactor=5;
3521 int nHot = trkIT->findVHot(m_VHoughHitListOnSZmap,charge,lmax,cutFactor);
3522 trkIT->dropRedundentCgemVHits();
3524 if(m_debug==5) trkIT->printHot(3);
3525 helixFitFlag = trkIT->fitHelix(&myDotsHelixFitter,m_bunchT0*1e9,m_recCgemClusterColBegin, m_chi2CutHits);
3528 trkIT->updateHelix();
3540 trkIT->setFlag(helixFitFlag);
3542 cout<<
"Helix fit failed "<<endl;
3550 trkIT->setRecMdcHitVec(aRecMdcHitVec);
3553 cout<<
"Helix fit success and aRecMdcHitVec filled "<<endl;
3554 trkIT->printRecMdcHitVec();
3574void HoughFinder::findMcTrack(
HoughTrack* track)
3576 TH1I trkID(
"track index",
"",100,0,100);
3577 vector<HoughHit*> hotList = track->
getHotList();
3578 for(vector<HoughHit*>::iterator hotIt = hotList.begin(); hotIt != hotList.end(); hotIt++){
3579 if((*hotIt)->getPairHit()!=NULL)trkID.Fill(((*hotIt)->getPairHit()->getTrkID())[0]);
3581 int trkid = trkID.GetMaximumBin()-1;
3582 for(vector<HoughTrack>::iterator trkIter = m_mcTrackCol.begin();trkIter!=m_mcTrackCol.end();trkIter++){
3583 if(trkIter->getTrkID()==trkid){
3584 if(m_run<0&&m_mcTruth)track->
setMcTrack(&(*trkIter));
3590int HoughFinder::nFineBinTanl(
double tanl)
3594int HoughFinder::nFineBinDz(
double tanl)
3598void HoughFinder::XVhitCutWindow(
double tanl,
int ilayer,
double charge,
double& cut1,
double &cut2)
3604 MsgStream log(
msgSvc(), name());
3606 NTuplePtr nt1(
ntupleSvc(),
"mdcHoughFinder/hit");
3610 ntuple_hit=
ntupleSvc()->book(
"mdcHoughFinder/hit", CLID_ColumnWiseTuple,
"hit");
3612 ntuple_hit->addItem(
"hit_run", m_hit_run);
3613 ntuple_hit->addItem(
"hit_event", m_hit_event);
3615 ntuple_hit->addItem(
"hit_nhit", m_hit_nhit, 0, 10000);
3616 ntuple_hit->addItem(
"hit_hitID", m_hit_nhit, m_hit_hitID);
3617 ntuple_hit->addItem(
"hit_hitType", m_hit_nhit, m_hit_hitType);
3618 ntuple_hit->addItem(
"hit_layer", m_hit_nhit, m_hit_layer);
3619 ntuple_hit->addItem(
"hit_wire", m_hit_nhit, m_hit_wire);
3620 ntuple_hit->addItem(
"hit_flag", m_hit_nhit, m_hit_flag);
3621 ntuple_hit->addItem(
"hit_halfCircle", m_hit_nhit, m_hit_halfCircle);
3622 ntuple_hit->addItem(
"hit_x", m_hit_nhit, m_hit_x);
3623 ntuple_hit->addItem(
"hit_y", m_hit_nhit, m_hit_y);
3624 ntuple_hit->addItem(
"hit_z", m_hit_nhit, m_hit_z);
3625 ntuple_hit->addItem(
"hit_drift", m_hit_nhit, m_hit_drift);
3627 ntuple_hit->addItem(
"mcHit_hitID", m_hit_nhit, m_mcHit_hitID);
3628 ntuple_hit->addItem(
"mcHit_hitType", m_hit_nhit, m_mcHit_hitType);
3629 ntuple_hit->addItem(
"mcHit_layer", m_hit_nhit, m_mcHit_layer);
3630 ntuple_hit->addItem(
"mcHit_wire", m_hit_nhit, m_mcHit_wire);
3631 ntuple_hit->addItem(
"mcHit_flag", m_hit_nhit, m_mcHit_flag);
3632 ntuple_hit->addItem(
"mcHit_halfCircle", m_hit_nhit, m_mcHit_halfCircle);
3633 ntuple_hit->addItem(
"mcHit_x", m_hit_nhit, m_mcHit_x);
3634 ntuple_hit->addItem(
"mcHit_y", m_hit_nhit, m_mcHit_y);
3635 ntuple_hit->addItem(
"mcHit_z", m_hit_nhit, m_mcHit_z);
3636 ntuple_hit->addItem(
"mcHit_drift", m_hit_nhit, m_mcHit_drift);
3637 }
else { log << MSG::ERROR <<
"Cannot book tuple mdcHoughFinder/hit" <<endmsg;
3638 return StatusCode::FAILURE;
3642 NTuplePtr nt2(
ntupleSvc(),
"mdcHoughFinder/track");
3646 ntuple_track =
ntupleSvc()->book(
"mdcHoughFinder/track", CLID_ColumnWiseTuple,
"track");
3648 ntuple_track->addItem(
"trk_run", m_trk_run);
3649 ntuple_track->addItem(
"trk_event", m_trk_event);
3650 ntuple_track->addItem(
"trk_nTrack", m_trk_nTrack);
3651 ntuple_track->addItem(
"trk_trackID", m_trk_trackID);
3652 ntuple_track->addItem(
"trk_charge", m_trk_charge);
3653 ntuple_track->addItem(
"trk_flag", m_trk_flag);
3654 ntuple_track->addItem(
"trk_angle", m_trk_angle);
3655 ntuple_track->addItem(
"trk_rho", m_trk_rho);
3656 ntuple_track->addItem(
"trk_dAngle", m_trk_dAngle);
3657 ntuple_track->addItem(
"trk_dRho", m_trk_dRho);
3658 ntuple_track->addItem(
"trk_dTanl", m_trk_dTanl);
3659 ntuple_track->addItem(
"trk_dDz", m_trk_dDz);
3660 ntuple_track->addItem(
"trk_Xc", m_trk_Xc);
3661 ntuple_track->addItem(
"trk_Yc", m_trk_Yc);
3662 ntuple_track->addItem(
"trk_R", m_trk_R);
3663 ntuple_track->addItem(
"trk_dr", m_trk_dr);
3664 ntuple_track->addItem(
"trk_phi0", m_trk_phi0);
3665 ntuple_track->addItem(
"trk_kappa", m_trk_kappa);
3666 ntuple_track->addItem(
"trk_dz", m_trk_dz);
3667 ntuple_track->addItem(
"trk_tanl", m_trk_tanl);
3668 ntuple_track->addItem(
"trk_pxy", m_trk_pxy);
3669 ntuple_track->addItem(
"trk_px", m_trk_px);
3670 ntuple_track->addItem(
"trk_py", m_trk_py);
3671 ntuple_track->addItem(
"trk_pz", m_trk_pz);
3672 ntuple_track->addItem(
"trk_p", m_trk_p);
3673 ntuple_track->addItem(
"trk_phi", m_trk_phi);
3674 ntuple_track->addItem(
"trk_theta", m_trk_theta);
3675 ntuple_track->addItem(
"trk_cosTheta", m_trk_cosTheta);
3676 ntuple_track->addItem(
"trk_vx", m_trk_vx);
3677 ntuple_track->addItem(
"trk_vy", m_trk_vy);
3678 ntuple_track->addItem(
"trk_vz", m_trk_vz);
3679 ntuple_track->addItem(
"trk_vr", m_trk_vr);
3680 ntuple_track->addItem(
"trk_chi2", m_trk_chi2);
3681 ntuple_track->addItem(
"trk_fiTerm", m_trk_fiTerm);
3682 ntuple_track->addItem(
"trk_nhit", m_trk_nhit);
3683 ntuple_track->addItem(
"trk_ncluster", m_trk_ncluster);
3684 ntuple_track->addItem(
"trk_stat", m_trk_stat);
3685 ntuple_track->addItem(
"trk_ndof", m_trk_ndof);
3686 ntuple_track->addItem(
"trk_nster", m_trk_nster);
3687 ntuple_track->addItem(
"trk_nlayer", m_trk_nlayer);
3688 ntuple_track->addItem(
"trk_firstLayer", m_trk_firstLayer);
3689 ntuple_track->addItem(
"trk_lastLayer", m_trk_lastLayer);
3690 ntuple_track->addItem(
"trk_nCgemXClusters", m_trk_nCgemXClusters);
3691 ntuple_track->addItem(
"trk_nCgemVClusters", m_trk_nCgemVClusters);
3693 ntuple_track->addItem(
"trk_nHot", m_trk_nHot, 0, 10000);
3694 ntuple_track->addItem(
"hot_hitID", m_trk_nHot, m_hot_hitID);
3695 ntuple_track->addItem(
"hot_hitType", m_trk_nHot, m_hot_hitType);
3696 ntuple_track->addItem(
"hot_layer", m_trk_nHot, m_hot_layer);
3697 ntuple_track->addItem(
"hot_wire", m_trk_nHot, m_hot_wire);
3698 ntuple_track->addItem(
"hot_flag", m_trk_nHot, m_hot_flag);
3699 ntuple_track->addItem(
"hot_halfCircle", m_trk_nHot, m_hot_halfCircle);
3700 ntuple_track->addItem(
"hot_x", m_trk_nHot, m_hot_x);
3701 ntuple_track->addItem(
"hot_y", m_trk_nHot, m_hot_y);
3702 ntuple_track->addItem(
"hot_z", m_trk_nHot, m_hot_z);
3703 ntuple_track->addItem(
"hot_drift", m_trk_nHot, m_hot_drift);
3704 ntuple_track->addItem(
"hot_residual", m_trk_nHot, m_hot_residual);
3706 ntuple_track->addItem(
"mcHot_hitID", m_trk_nHot, m_mcHot_hitID);
3707 ntuple_track->addItem(
"mcHot_hitType", m_trk_nHot, m_mcHot_hitType);
3708 ntuple_track->addItem(
"mcHot_layer", m_trk_nHot, m_mcHot_layer);
3709 ntuple_track->addItem(
"mcHot_wire", m_trk_nHot, m_mcHot_wire);
3710 ntuple_track->addItem(
"mcHot_flag", m_trk_nHot, m_mcHot_flag);
3711 ntuple_track->addItem(
"mcHot_halfCircle", m_trk_nHot, m_mcHot_halfCircle);
3712 ntuple_track->addItem(
"mcHot_x", m_trk_nHot, m_mcHot_x);
3713 ntuple_track->addItem(
"mcHot_y", m_trk_nHot, m_mcHot_y);
3714 ntuple_track->addItem(
"mcHot_z", m_trk_nHot, m_mcHot_z);
3715 ntuple_track->addItem(
"mcHot_drift", m_trk_nHot, m_mcHot_drift);
3717 ntuple_track->addItem(
"mcTrk_trackID", m_mcTrk_trackID);
3718 ntuple_track->addItem(
"mcTrk_charge", m_mcTrk_charge);
3719 ntuple_track->addItem(
"mcTrk_flag", m_mcTrk_flag);
3720 ntuple_track->addItem(
"mcTrk_angle", m_mcTrk_angle);
3721 ntuple_track->addItem(
"mcTrk_rho", m_mcTrk_rho);
3722 ntuple_track->addItem(
"mcTrk_dAngle", m_mcTrk_dAngle);
3723 ntuple_track->addItem(
"mcTrk_dRho", m_mcTrk_dRho);
3724 ntuple_track->addItem(
"mcTrk_dTanl", m_mcTrk_dTanl);
3725 ntuple_track->addItem(
"mcTrk_dDz", m_mcTrk_dDz);
3726 ntuple_track->addItem(
"mcTrk_Xc", m_mcTrk_Xc);
3727 ntuple_track->addItem(
"mcTrk_Yc", m_mcTrk_Yc);
3728 ntuple_track->addItem(
"mcTrk_R", m_mcTrk_R);
3729 ntuple_track->addItem(
"mcTrk_dr", m_mcTrk_dr);
3730 ntuple_track->addItem(
"mcTrk_phi0", m_mcTrk_phi0);
3731 ntuple_track->addItem(
"mcTrk_kappa", m_mcTrk_kappa);
3732 ntuple_track->addItem(
"mcTrk_dz", m_mcTrk_dz);
3733 ntuple_track->addItem(
"mcTrk_tanl", m_mcTrk_tanl);
3734 ntuple_track->addItem(
"mcTrk_pxy", m_mcTrk_pxy);
3735 ntuple_track->addItem(
"mcTrk_px", m_mcTrk_px);
3736 ntuple_track->addItem(
"mcTrk_py", m_mcTrk_py);
3737 ntuple_track->addItem(
"mcTrk_pz", m_mcTrk_pz);
3738 ntuple_track->addItem(
"mcTrk_p", m_mcTrk_p);
3739 ntuple_track->addItem(
"mcTrk_phi", m_mcTrk_phi);
3740 ntuple_track->addItem(
"mcTrk_theta", m_mcTrk_theta);
3741 ntuple_track->addItem(
"mcTrk_cosTheta", m_mcTrk_cosTheta);
3742 ntuple_track->addItem(
"mcTrk_vx", m_mcTrk_vx);
3743 ntuple_track->addItem(
"mcTrk_vy", m_mcTrk_vy);
3744 ntuple_track->addItem(
"mcTrk_vz", m_mcTrk_vz);
3745 ntuple_track->addItem(
"mcTrk_vr", m_mcTrk_vr);
3746 ntuple_track->addItem(
"mcTrk_chi2", m_mcTrk_chi2);
3747 ntuple_track->addItem(
"mcTrk_fiTerm", m_mcTrk_fiTerm);
3748 ntuple_track->addItem(
"mcTrk_nhit", m_mcTrk_nhit);
3749 ntuple_track->addItem(
"mcTrk_ncluster", m_mcTrk_ncluster);
3750 ntuple_track->addItem(
"mcTrk_stat", m_mcTrk_stat);
3751 ntuple_track->addItem(
"mcTrk_ndof", m_mcTrk_ndof);
3752 ntuple_track->addItem(
"mcTrk_nster", m_mcTrk_nster);
3753 ntuple_track->addItem(
"mcTrk_nlayer", m_mcTrk_nlayer);
3754 ntuple_track->addItem(
"mcTrk_firstLayer", m_mcTrk_firstLayer);
3755 ntuple_track->addItem(
"mcTrk_lastLayer", m_mcTrk_lastLayer);
3756 ntuple_track->addItem(
"mcTrk_nCgemXClusters", m_mcTrk_nCgemXClusters);
3757 ntuple_track->addItem(
"mcTrk_nCgemVClusters", m_mcTrk_nCgemVClusters);
3759 ntuple_track->addItem(
"mcTrk_nHot", m_mcTrk_nHot, 0, 10000);
3760 ntuple_track->addItem(
"mcTrkHot_hitID", m_mcTrk_nHot, m_mcTrkHot_hitID);
3761 ntuple_track->addItem(
"mcTrkHot_hitType", m_mcTrk_nHot, m_mcTrkHot_hitType);
3762 ntuple_track->addItem(
"mcTrkHot_layer", m_mcTrk_nHot, m_mcTrkHot_layer);
3763 ntuple_track->addItem(
"mcTrkHot_wire", m_mcTrk_nHot, m_mcTrkHot_wire);
3764 ntuple_track->addItem(
"mcTrkHot_flag", m_mcTrk_nHot, m_mcTrkHot_flag);
3765 ntuple_track->addItem(
"mcTrkHot_halfCircle", m_mcTrk_nHot, m_mcTrkHot_halfCircle);
3766 ntuple_track->addItem(
"mcTrkHot_x", m_mcTrk_nHot, m_mcTrkHot_x);
3767 ntuple_track->addItem(
"mcTrkHot_y", m_mcTrk_nHot, m_mcTrkHot_y);
3768 ntuple_track->addItem(
"mcTrkHot_z", m_mcTrk_nHot, m_mcTrkHot_z);
3769 ntuple_track->addItem(
"mcTrkHot_drift", m_mcTrk_nHot, m_mcTrkHot_drift);
3771 log << MSG::ERROR <<
"Cannot book tuple mdcHoughFinder/track" <<endmsg;
3772 return StatusCode::FAILURE;
3776 NTuplePtr nt3(
ntupleSvc(),
"mdcHoughFinder/event");
3780 ntuple_event =
ntupleSvc()->book(
"mdcHoughFinder/event", CLID_ColumnWiseTuple,
"event");
3782 ntuple_event->addItem(
"evt_run", m_evt_run);
3783 ntuple_event->addItem(
"evt_event", m_evt_event);
3784 ntuple_event->addItem(
"evt_nXCluster", m_evt_nXCluster);
3785 ntuple_event->addItem(
"evt_nVCluster", m_evt_nVCluster);
3786 ntuple_event->addItem(
"evt_nXVCluster", m_evt_nXVCluster);
3787 ntuple_event->addItem(
"evt_nCgemCluster", m_evt_nCGEMCluster);
3788 ntuple_event->addItem(
"evt_nAxialHit", m_evt_nAxialHit);
3789 ntuple_event->addItem(
"evt_nStereoHit", m_evt_nStereoHit);
3790 ntuple_event->addItem(
"evt_nODCHit", m_evt_nODCHit);
3791 ntuple_event->addItem(
"evt_nHit", m_evt_nHit);
3793 ntuple_event->addItem(
"evt_nTrack", m_evt_nTrack, 0, 100);
3794 ntuple_event->addItem(
"evtTrk_trackID", m_evt_nTrack, m_evtTrk_trackID);
3795 ntuple_event->addItem(
"evtTrk_charge", m_evt_nTrack, m_evtTrk_charge);
3796 ntuple_event->addItem(
"evtTrk_flag", m_evt_nTrack, m_evtTrk_flag);
3797 ntuple_event->addItem(
"evtTrk_angle", m_evt_nTrack, m_evtTrk_angle);
3798 ntuple_event->addItem(
"evtTrk_rho", m_evt_nTrack, m_evtTrk_rho);
3799 ntuple_event->addItem(
"evtTrk_dAngle", m_evt_nTrack, m_evtTrk_dAngle);
3800 ntuple_event->addItem(
"evtTrk_dRho", m_evt_nTrack, m_evtTrk_dRho);
3801 ntuple_event->addItem(
"evtTrk_dTanl", m_evt_nTrack, m_evtTrk_dTanl);
3802 ntuple_event->addItem(
"evtTrk_dDz", m_evt_nTrack, m_evtTrk_dDz);
3803 ntuple_event->addItem(
"evtTrk_Xc", m_evt_nTrack, m_evtTrk_Xc);
3804 ntuple_event->addItem(
"evtTrk_Yc", m_evt_nTrack, m_evtTrk_Yc);
3805 ntuple_event->addItem(
"evtTrk_R", m_evt_nTrack, m_evtTrk_R);
3806 ntuple_event->addItem(
"evtTrk_dr", m_evt_nTrack, m_evtTrk_dr);
3807 ntuple_event->addItem(
"evtTrk_phi0", m_evt_nTrack, m_evtTrk_phi0);
3808 ntuple_event->addItem(
"evtTrk_kappa", m_evt_nTrack, m_evtTrk_kappa);
3809 ntuple_event->addItem(
"evtTrk_dz", m_evt_nTrack, m_evtTrk_dz);
3810 ntuple_event->addItem(
"evtTrk_tanl", m_evt_nTrack, m_evtTrk_tanl);
3811 ntuple_event->addItem(
"evtTrk_pxy", m_evt_nTrack, m_evtTrk_pxy);
3812 ntuple_event->addItem(
"evtTrk_px", m_evt_nTrack, m_evtTrk_px);
3813 ntuple_event->addItem(
"evtTrk_py", m_evt_nTrack, m_evtTrk_py);
3814 ntuple_event->addItem(
"evtTrk_pz", m_evt_nTrack, m_evtTrk_pz);
3815 ntuple_event->addItem(
"evtTrk_p", m_evt_nTrack, m_evtTrk_p);
3816 ntuple_event->addItem(
"evtTrk_phi", m_evt_nTrack, m_evtTrk_phi);
3817 ntuple_event->addItem(
"evtTrk_theta", m_evt_nTrack, m_evtTrk_theta);
3818 ntuple_event->addItem(
"evtTrk_cosTheta", m_evt_nTrack, m_evtTrk_cosTheta);
3819 ntuple_event->addItem(
"evtTrk_vx", m_evt_nTrack, m_evtTrk_vx);
3820 ntuple_event->addItem(
"evtTrk_vy", m_evt_nTrack, m_evtTrk_vy);
3821 ntuple_event->addItem(
"evtTrk_vz", m_evt_nTrack, m_evtTrk_vz);
3822 ntuple_event->addItem(
"evtTrk_vr", m_evt_nTrack, m_evtTrk_vr);
3823 ntuple_event->addItem(
"evtTrk_chi2", m_evt_nTrack, m_evtTrk_chi2);
3824 ntuple_event->addItem(
"evtTrk_fiTerm", m_evt_nTrack, m_evtTrk_fiTerm);
3825 ntuple_event->addItem(
"evtTrk_nhit", m_evt_nTrack, m_evtTrk_nhit);
3826 ntuple_event->addItem(
"evtTrk_ncluster", m_evt_nTrack, m_evtTrk_ncluster);
3827 ntuple_event->addItem(
"evtTrk_stat", m_evt_nTrack, m_evtTrk_stat);
3828 ntuple_event->addItem(
"evtTrk_ndof", m_evt_nTrack, m_evtTrk_ndof);
3829 ntuple_event->addItem(
"evtTrk_nster", m_evt_nTrack, m_evtTrk_nster);
3830 ntuple_event->addItem(
"evtTrk_nlayer", m_evt_nTrack, m_evtTrk_nlayer);
3831 ntuple_event->addItem(
"evtTrk_firstLayer", m_evt_nTrack, m_evtTrk_firstLayer);
3832 ntuple_event->addItem(
"evtTrk_lastLayer", m_evt_nTrack, m_evtTrk_lastLayer);
3833 ntuple_event->addItem(
"evtTrk_nCgemXClusters", m_evt_nTrack, m_evtTrk_nCgemXClusters);
3834 ntuple_event->addItem(
"evtTrk_nCgemVClusters", m_evt_nTrack, m_evtTrk_nCgemVClusters);
3836 ntuple_event->addItem(
"mcEvtTrk_trackID", m_evt_nTrack, m_mcEvtTrk_trackID);
3837 ntuple_event->addItem(
"mcEvtTrk_charge", m_evt_nTrack, m_mcEvtTrk_charge);
3838 ntuple_event->addItem(
"mcEvtTrk_flag", m_evt_nTrack, m_mcEvtTrk_flag);
3839 ntuple_event->addItem(
"mcEvtTrk_angle", m_evt_nTrack, m_mcEvtTrk_angle);
3840 ntuple_event->addItem(
"mcEvtTrk_rho", m_evt_nTrack, m_mcEvtTrk_rho);
3841 ntuple_event->addItem(
"mcEvtTrk_dAngle", m_evt_nTrack, m_mcEvtTrk_dAngle);
3842 ntuple_event->addItem(
"mcEvtTrk_dRho", m_evt_nTrack, m_mcEvtTrk_dRho);
3843 ntuple_event->addItem(
"mcEvtTrk_dTanl", m_evt_nTrack, m_mcEvtTrk_dTanl);
3844 ntuple_event->addItem(
"mcEvtTrk_dDz", m_evt_nTrack, m_mcEvtTrk_dDz);
3845 ntuple_event->addItem(
"mcEvtTrk_Xc", m_evt_nTrack, m_mcEvtTrk_Xc);
3846 ntuple_event->addItem(
"mcEvtTrk_Yc", m_evt_nTrack, m_mcEvtTrk_Yc);
3847 ntuple_event->addItem(
"mcEvtTrk_R", m_evt_nTrack, m_mcEvtTrk_R);
3848 ntuple_event->addItem(
"mcEvtTrk_dr", m_evt_nTrack, m_mcEvtTrk_dr);
3849 ntuple_event->addItem(
"mcEvtTrk_phi0", m_evt_nTrack, m_mcEvtTrk_phi0);
3850 ntuple_event->addItem(
"mcEvtTrk_kappa", m_evt_nTrack, m_mcEvtTrk_kappa);
3851 ntuple_event->addItem(
"mcEvtTrk_dz", m_evt_nTrack, m_mcEvtTrk_dz);
3852 ntuple_event->addItem(
"mcEvtTrk_tanl", m_evt_nTrack, m_mcEvtTrk_tanl);
3853 ntuple_event->addItem(
"mcEvtTrk_pxy", m_evt_nTrack, m_mcEvtTrk_pxy);
3854 ntuple_event->addItem(
"mcEvtTrk_px", m_evt_nTrack, m_mcEvtTrk_px);
3855 ntuple_event->addItem(
"mcEvtTrk_py", m_evt_nTrack, m_mcEvtTrk_py);
3856 ntuple_event->addItem(
"mcEvtTrk_pz", m_evt_nTrack, m_mcEvtTrk_pz);
3857 ntuple_event->addItem(
"mcEvtTrk_p", m_evt_nTrack, m_mcEvtTrk_p);
3858 ntuple_event->addItem(
"mcEvtTrk_phi", m_evt_nTrack, m_mcEvtTrk_phi);
3859 ntuple_event->addItem(
"mcEvtTrk_theta", m_evt_nTrack, m_mcEvtTrk_theta);
3860 ntuple_event->addItem(
"mcEvtTrk_cosTheta", m_evt_nTrack, m_mcEvtTrk_cosTheta);
3861 ntuple_event->addItem(
"mcEvtTrk_vx", m_evt_nTrack, m_mcEvtTrk_vx);
3862 ntuple_event->addItem(
"mcEvtTrk_vy", m_evt_nTrack, m_mcEvtTrk_vy);
3863 ntuple_event->addItem(
"mcEvtTrk_vz", m_evt_nTrack, m_mcEvtTrk_vz);
3864 ntuple_event->addItem(
"mcEvtTrk_vr", m_evt_nTrack, m_mcEvtTrk_vr);
3865 ntuple_event->addItem(
"mcEvtTrk_chi2", m_evt_nTrack, m_mcEvtTrk_chi2);
3866 ntuple_event->addItem(
"mcEvtTrk_fiTerm", m_evt_nTrack, m_mcEvtTrk_fiTerm);
3867 ntuple_event->addItem(
"mcEvtTrk_nhit", m_evt_nTrack, m_mcEvtTrk_nhit);
3868 ntuple_event->addItem(
"mcEvtTrk_ncluster", m_evt_nTrack, m_mcEvtTrk_ncluster);
3869 ntuple_event->addItem(
"mcEvtTrk_stat", m_evt_nTrack, m_mcEvtTrk_stat);
3870 ntuple_event->addItem(
"mcEvtTrk_ndof", m_evt_nTrack, m_mcEvtTrk_ndof);
3871 ntuple_event->addItem(
"mcEvtTrk_nster", m_evt_nTrack, m_mcEvtTrk_nster);
3872 ntuple_event->addItem(
"mcEvtTrk_nlayer", m_evt_nTrack, m_mcEvtTrk_nlayer);
3873 ntuple_event->addItem(
"mcEvtTrk_firstLayer", m_evt_nTrack, m_mcEvtTrk_firstLayer);
3874 ntuple_event->addItem(
"mcEvtTrk_lastLayer", m_evt_nTrack, m_mcEvtTrk_lastLayer);
3875 ntuple_event->addItem(
"mcEvtTrk_nCgemXClusters", m_evt_nTrack, m_mcEvtTrk_nCgemXClusters);
3876 ntuple_event->addItem(
"mcEvtTrk_nCgemVClusters", m_evt_nTrack, m_mcEvtTrk_nCgemVClusters);
3878 log << MSG::ERROR <<
"Cannot book tuple mdcHoughFinder/event" <<endmsg;
3879 return StatusCode::FAILURE;
3882 return StatusCode::SUCCESS;
3885int HoughFinder::dumpHit()
3888 m_hit_event = m_event;
3889 m_hit_nhit = m_houghHitList.size();
3891 for(
HitVector_Iterator hitIt = m_houghHitList.begin(); hitIt != m_houghHitList.end(); hitIt++){
3892 m_hit_hitID[i] = hitIt->getHitID();
3893 m_hit_hitType[i] = hitIt->getHitType();
3894 m_hit_layer[i] = hitIt->getLayer();
3895 m_hit_wire[i] = hitIt->getWire();
3896 m_hit_flag[i] = hitIt->getFlag();
3897 m_hit_halfCircle[i] = hitIt->getHalfCircle();
3898 m_hit_x[i] = hitIt->getHitPosition().x();
3899 m_hit_y[i] = hitIt->getHitPosition().y();
3900 m_hit_z[i] = hitIt->getHitPosition().z();
3901 m_hit_drift[i] = hitIt->getDriftDist();
3903 if(hitIt->getPairHit()!=NULL){
3904 m_mcHit_hitID[i] = hitIt->getPairHit()->getHitID();
3905 m_mcHit_hitType[i] = hitIt->getPairHit()->getHitType();
3906 m_mcHit_layer[i] = hitIt->getPairHit()->getLayer();
3907 m_mcHit_wire[i] = hitIt->getPairHit()->getWire();
3908 m_mcHit_flag[i] = hitIt->getPairHit()->getFlag();
3909 m_mcHit_halfCircle[i] = hitIt->getPairHit()->getHalfCircle();
3910 m_mcHit_x[i] = hitIt->getPairHit()->getHitPosition().x();
3911 m_mcHit_y[i] = hitIt->getPairHit()->getHitPosition().y();
3912 m_mcHit_z[i] = hitIt->getPairHit()->getHitPosition().z();
3913 m_mcHit_drift[i] = hitIt->getPairHit()->getDriftDist();
3917 ntuple_hit->write();
3918 return m_houghHitList.size();
3921int HoughFinder::dumpHoughTrack()
3923 if(m_houghTrackList.size()==0)
return 0;
3925 m_trk_event = m_event;
3926 m_trk_nTrack = m_houghTrackList.size();
3927 HepPoint3D positionOntrack(999,999,999), positionOnDetector(999,999,999);
3928 for(vector<HoughTrack>::iterator trkIt = m_houghTrackList.begin(); trkIt != m_houghTrackList.end(); trkIt++){
3929 m_trk_trackID = trkIt->getTrkID();
3930 m_trk_charge = trkIt->getCharge();
3931 m_trk_flag = trkIt->getFlag();
3932 m_trk_angle = trkIt->getAngle();
3933 m_trk_rho = trkIt->getRho();
3934 m_trk_dAngle = trkIt->getDAngle();
3935 m_trk_dRho = trkIt->getDRho();
3936 m_trk_dTanl = trkIt->getDTanl();
3937 m_trk_dDz = trkIt->getDDz();
3938 m_trk_Xc = trkIt->center().x();
3939 m_trk_Yc = trkIt->center().y();
3940 m_trk_R = trkIt->radius();
3941 m_trk_dr = trkIt->dr();
3942 m_trk_phi0 = trkIt->phi0();
3943 m_trk_kappa = trkIt->kappa();
3944 m_trk_dz = trkIt->dz();
3945 m_trk_tanl = trkIt->tanl();
3946 m_trk_pxy = trkIt->pt();
3947 m_trk_px = trkIt->momentum(0).x();
3948 m_trk_py = trkIt->momentum(0).y();
3949 m_trk_pz = trkIt->momentum(0).z();
3950 m_trk_p = trkIt->momentum(0).mag();
3951 m_trk_phi = trkIt->direction(0).phi();
3952 m_trk_theta = trkIt->direction(0).theta();
3953 m_trk_cosTheta =
cos(trkIt->direction(0).theta());
3954 m_trk_vx = trkIt->x(0).x();
3955 m_trk_vy = trkIt->x(0).y();
3956 m_trk_vz = trkIt->x(0).z();
3957 m_trk_vr = trkIt->x(0).perp();
3958 m_trk_chi2 = trkIt->getChi2();
3972 vector<HoughHit*> hotList = trkIt->getHotList();
3973 m_trk_nHot = hotList.size();
3975 for(vector<HoughHit*>::iterator hotIt = hotList.begin(); hotIt != hotList.end(); hotIt++){
3976 m_hot_hitID[i] = (*hotIt)->getHitID();
3977 m_hot_hitType[i] = (*hotIt)->getHitType();
3978 m_hot_layer[i] = (*hotIt)->getLayer();
3979 m_hot_wire[i] = (*hotIt)->getWire();
3980 m_hot_flag[i] = (*hotIt)->getFlag();
3981 m_hot_halfCircle[i] = (*hotIt)->getHalfCircle();
3982 m_hot_x[i] = (*hotIt)->getHitPosition().x();
3983 m_hot_y[i] = (*hotIt)->getHitPosition().y();
3984 m_hot_z[i] = (*hotIt)->getHitPosition().z();
3985 m_hot_drift[i] = (*hotIt)->getDriftDist();
3986 m_hot_residual[i] = (*hotIt)->residual(&(*trkIt),positionOntrack, positionOnDetector);
3988 if((*hotIt)->getPairHit()!=NULL){
3989 m_mcHot_hitID[i] = (*hotIt)->getPairHit()->getHitID();
3990 m_mcHot_hitType[i] = (*hotIt)->getPairHit()->getHitType();
3991 m_mcHot_layer[i] = (*hotIt)->getPairHit()->getLayer();
3992 m_mcHot_wire[i] = (*hotIt)->getPairHit()->getWire();
3993 m_mcHot_flag[i] = (*hotIt)->getPairHit()->getFlag();
3994 m_mcHot_halfCircle[i] = (*hotIt)->getPairHit()->getHalfCircle();
3995 m_mcHot_x[i] = (*hotIt)->getPairHit()->getHitPosition().x();
3996 m_mcHot_y[i] = (*hotIt)->getPairHit()->getHitPosition().y();
3997 m_mcHot_z[i] = (*hotIt)->getPairHit()->getHitPosition().z();
3998 m_mcHot_drift[i] = (*hotIt)->getPairHit()->getDriftDist();
4003 if(trkIt->getMcTrack()!=NULL){
4004 m_mcTrk_trackID = trkIt->getMcTrack()->getTrkID();
4005 m_mcTrk_charge = trkIt->getMcTrack()->getCharge();
4006 m_mcTrk_flag = trkIt->getMcTrack()->getFlag();
4007 m_mcTrk_angle = trkIt->getMcTrack()->getAngle();
4008 m_mcTrk_rho = trkIt->getMcTrack()->getRho();
4009 m_mcTrk_dAngle = trkIt->getMcTrack()->getDAngle();
4010 m_mcTrk_dRho = trkIt->getMcTrack()->getDRho();
4011 m_mcTrk_dTanl = trkIt->getMcTrack()->getDTanl();
4012 m_mcTrk_dDz = trkIt->getMcTrack()->getDDz();
4013 m_mcTrk_Xc = trkIt->getMcTrack()->center().x();
4014 m_mcTrk_Yc = trkIt->getMcTrack()->center().y();
4015 m_mcTrk_R = trkIt->getMcTrack()->radius();
4016 m_mcTrk_dr = trkIt->getMcTrack()->dr();
4017 m_mcTrk_phi0 = trkIt->getMcTrack()->phi0();
4018 m_mcTrk_kappa = trkIt->getMcTrack()->kappa();
4019 m_mcTrk_dz = trkIt->getMcTrack()->dz();
4020 m_mcTrk_tanl = trkIt->getMcTrack()->tanl();
4021 m_mcTrk_pxy = trkIt->getMcTrack()->pt();
4022 m_mcTrk_px = trkIt->getMcTrack()->momentum(0).x();
4023 m_mcTrk_py = trkIt->getMcTrack()->momentum(0).y();
4024 m_mcTrk_pz = trkIt->getMcTrack()->momentum(0).z();
4025 m_mcTrk_p = trkIt->getMcTrack()->momentum(0).mag();
4026 m_mcTrk_phi = trkIt->getMcTrack()->direction(0).phi();
4027 m_mcTrk_theta = trkIt->getMcTrack()->direction(0).theta();
4028 m_mcTrk_cosTheta =
cos(trkIt->getMcTrack()->direction(0).theta());
4029 m_mcTrk_vx = trkIt->getMcTrack()->x(0).x();
4030 m_mcTrk_vy = trkIt->getMcTrack()->x(0).y();
4031 m_mcTrk_vz = trkIt->getMcTrack()->x(0).z();
4032 m_mcTrk_vr = trkIt->getMcTrack()->x(0).perp();
4046 vector<HoughHit*> mcHotList = trkIt->getMcTrack()->getHotList();
4047 m_mcTrk_nHot = mcHotList.size();
4049 for(vector<HoughHit*>::iterator mcHotIt = mcHotList.begin(); mcHotIt != mcHotList.end(); mcHotIt++){
4050 m_mcTrkHot_hitID[j] = (*mcHotIt)->getHitID();
4051 m_mcTrkHot_hitType[j] = (*mcHotIt)->getHitType();
4052 m_mcTrkHot_layer[j] = (*mcHotIt)->getLayer();
4053 m_mcTrkHot_wire[j] = (*mcHotIt)->getWire();
4054 m_mcTrkHot_flag[j] = (*mcHotIt)->getFlag();
4055 m_mcTrkHot_halfCircle[j] = (*mcHotIt)->getHalfCircle();
4056 m_mcTrkHot_x[j] = (*mcHotIt)->getHitPosition().x();
4057 m_mcTrkHot_y[j] = (*mcHotIt)->getHitPosition().y();
4058 m_mcTrkHot_z[j] = (*mcHotIt)->getHitPosition().z();
4059 m_mcTrkHot_drift[j] = (*mcHotIt)->getDriftDist();
4063 ntuple_track->write();
4065 return m_houghTrackList.size();
4068int HoughFinder::dumpHoughEvent()
4070 if(m_houghTrackList.size()==0)
return 0;
4072 m_evt_event = m_event;
4073 m_evt_nTrack = m_houghTrackList.size();
4075 for(vector<HoughTrack>::iterator trkIt = m_houghTrackList.begin(); trkIt != m_houghTrackList.end(); trkIt++){
4077 m_evtTrk_trackID[i] = trkIt->getTrkID();
4078 m_evtTrk_charge[i] = trkIt->getCharge();
4079 m_evtTrk_flag[i] = trkIt->getFlag();
4080 m_evtTrk_angle[i] = trkIt->getAngle();
4081 m_evtTrk_rho[i] = trkIt->getRho();
4082 m_evtTrk_dAngle[i] = trkIt->getDAngle();
4083 m_evtTrk_dRho[i] = trkIt->getDRho();
4084 m_evtTrk_dTanl[i] = trkIt->getDTanl();
4085 m_evtTrk_dDz[i] = trkIt->getDDz();
4086 m_evtTrk_Xc[i] = trkIt->center().x();
4087 m_evtTrk_Yc[i] = trkIt->center().y();
4088 m_evtTrk_R[i] = trkIt->radius();
4089 m_evtTrk_dr[i] = trkIt->dr();
4090 m_evtTrk_phi0[i] = trkIt->phi0();
4091 m_evtTrk_kappa[i] = trkIt->kappa();
4092 m_evtTrk_dz[i] = trkIt->dz();
4093 m_evtTrk_tanl[i] = trkIt->tanl();
4094 m_evtTrk_pxy[i] = trkIt->pt();
4095 m_evtTrk_px[i] = trkIt->momentum(0).x();
4096 m_evtTrk_py[i] = trkIt->momentum(0).y();
4097 m_evtTrk_pz[i] = trkIt->momentum(0).z();
4098 m_evtTrk_p[i] = trkIt->momentum(0).mag();
4099 m_evtTrk_phi[i] = trkIt->direction(0).phi();
4100 m_evtTrk_theta[i] = trkIt->direction(0).theta();
4101 m_evtTrk_cosTheta[i] =
cos(trkIt->direction(0).theta());
4102 m_evtTrk_vx[i] = trkIt->x(0).x();
4103 m_evtTrk_vy[i] = trkIt->x(0).y();
4104 m_evtTrk_vz[i] = trkIt->x(0).z();
4105 m_evtTrk_vr[i] = trkIt->x(0).perp();
4119 if(trkIt->getMcTrack()!=NULL){
4120 m_mcEvtTrk_trackID[i] = trkIt->getMcTrack()->getTrkID();
4121 m_mcEvtTrk_charge[i] = trkIt->getMcTrack()->getCharge();
4122 m_mcEvtTrk_flag[i] = trkIt->getMcTrack()->getFlag();
4123 m_mcEvtTrk_angle[i] = trkIt->getMcTrack()->getAngle();
4124 m_mcEvtTrk_rho[i] = trkIt->getMcTrack()->getRho();
4125 m_mcEvtTrk_dAngle[i] = trkIt->getMcTrack()->getDAngle();
4126 m_mcEvtTrk_dRho[i] = trkIt->getMcTrack()->getDRho();
4127 m_mcEvtTrk_dTanl[i] = trkIt->getMcTrack()->getDTanl();
4128 m_mcEvtTrk_dDz[i] = trkIt->getMcTrack()->getDDz();
4129 m_mcEvtTrk_Xc[i] = trkIt->getMcTrack()->center().x();
4130 m_mcEvtTrk_Yc[i] = trkIt->getMcTrack()->center().y();
4131 m_mcEvtTrk_R[i] = trkIt->getMcTrack()->radius();
4132 m_mcEvtTrk_dr[i] = trkIt->getMcTrack()->dr();
4133 m_mcEvtTrk_phi0[i] = trkIt->getMcTrack()->phi0();
4134 m_mcEvtTrk_kappa[i] = trkIt->getMcTrack()->kappa();
4135 m_mcEvtTrk_dz[i] = trkIt->getMcTrack()->dz();
4136 m_mcEvtTrk_tanl[i] = trkIt->getMcTrack()->tanl();
4137 m_mcEvtTrk_pxy[i] = trkIt->getMcTrack()->pt();
4138 m_mcEvtTrk_px[i] = trkIt->getMcTrack()->momentum(0).x();
4139 m_mcEvtTrk_py[i] = trkIt->getMcTrack()->momentum(0).y();
4140 m_mcEvtTrk_pz[i] = trkIt->getMcTrack()->momentum(0).z();
4141 m_mcEvtTrk_p[i] = trkIt->getMcTrack()->momentum(0).mag();
4142 m_mcEvtTrk_phi[i] = trkIt->getMcTrack()->direction(0).phi();
4143 m_mcEvtTrk_theta[i] = trkIt->getMcTrack()->direction(0).theta();
4144 m_mcEvtTrk_cosTheta[i] =
cos(trkIt->getMcTrack()->direction(0).theta());
4145 m_mcEvtTrk_vx[i] = trkIt->getMcTrack()->x(0).x();
4146 m_mcEvtTrk_vy[i] = trkIt->getMcTrack()->x(0).y();
4147 m_mcEvtTrk_vz[i] = trkIt->getMcTrack()->x(0).z();
4148 m_mcEvtTrk_vr[i] = trkIt->getMcTrack()->x(0).perp();
4164 ntuple_event->write();
4165 return m_houghTrackList.size();
4168int HoughFinder::dumpTdsTrack()
4170 SmartDataPtr<RecMdcTrackCol> recMdcTrackCol(eventSvc(),
"/Event/Recon/RecMdcTrackCol");
4171 if(!recMdcTrackCol)
return 0;
4173 m_evt_event = m_event;
4174 m_evt_nTrack = recMdcTrackCol->size();
4175 for(RecMdcTrackCol::iterator
iter = recMdcTrackCol->begin();
iter!=recMdcTrackCol->end();
iter++){
4176 m_trk_trackID = (*iter)->trackId() ;
4177 m_trk_charge = (*iter)->charge() ;
4188 m_trk_dr = (*iter)->helix(0) ;
4189 m_trk_phi0 = (*iter)->helix(1) ;
4190 m_trk_kappa = (*iter)->helix(2) ;
4191 m_trk_dz = (*iter)->helix(3) ;
4192 m_trk_tanl = (*iter)->helix(4) ;
4193 m_trk_pxy = (*iter)->pxy() ;
4194 m_trk_px = (*iter)->px() ;
4195 m_trk_py = (*iter)->py() ;
4196 m_trk_pz = (*iter)->pz() ;
4197 m_trk_p = (*iter)->p() ;
4198 m_trk_phi = (*iter)->theta() ;
4199 m_trk_theta = (*iter)->phi() ;
4200 m_trk_cosTheta =
cos((*iter)->theta()) ;
4201 m_trk_vx = (*iter)->x() ;
4202 m_trk_vy = (*iter)->y() ;
4203 m_trk_vz = (*iter)->z() ;
4204 m_trk_vr = (*iter)->r() ;
4205 m_trk_chi2 = (*iter)->chi2() ;
4206 m_trk_fiTerm = (*iter)->getFiTerm() ;
4207 m_trk_nhit = (*iter)->getNhits() ;
4208 m_trk_ncluster = (*iter)->getNcluster() ;
4209 m_trk_stat = (*iter)->stat() ;
4210 m_trk_ndof = (*iter)->ndof() ;
4211 m_trk_nster = (*iter)->nster() ;
4212 m_trk_nlayer = (*iter)->nlayer() ;
4213 m_trk_firstLayer = (*iter)->firstLayer() ;
4214 m_trk_lastLayer = (*iter)->lastLayer() ;
4215 m_trk_nCgemXClusters = (*iter)->nCgemXCluster();
4216 m_trk_nCgemVClusters = (*iter)->nCgemVCluster();
4218 HitRefVec hitRefVec = (*iter)->getVecHits();
4219 HitRefVec::iterator hotIt = hitRefVec.begin();
4221 ClusterRefVec::iterator clusterIt = clusterRefVec.begin();
4222 m_trk_nHot = clusterRefVec.size() + hitRefVec.size();
4224 for(clusterIt=clusterRefVec.begin();clusterIt!=clusterRefVec.end();clusterIt++){
4225 for(
HitVector_Iterator hitIt = m_houghHitList.begin(); hitIt != m_houghHitList.end(); hitIt++){
4227 if((*clusterIt)->getclusterid()==(hitIt)->getCgemCluster()->getclusterid()){
4228 m_hot_hitID[i] = (hitIt)->getHitID();
4229 m_hot_hitType[i] = (hitIt)->getHitType();
4230 m_hot_layer[i] = (hitIt)->getLayer();
4231 m_hot_wire[i] = (hitIt)->getWire();
4232 m_hot_flag[i] = (hitIt)->getFlag();
4233 m_hot_halfCircle[i] = (hitIt)->getHalfCircle();
4234 m_hot_x[i] = (hitIt)->getHitPosition().x();
4235 m_hot_y[i] = (hitIt)->getHitPosition().y();
4236 m_hot_z[i] = (hitIt)->getHitPosition().z();
4237 m_hot_drift[i] = (hitIt)->getDriftDist();
4238 m_hot_residual[i] = -999;
4240 if((hitIt)->getPairHit()!=NULL){
4241 m_mcHot_hitID[i] = (hitIt)->getPairHit()->getHitID();
4242 m_mcHot_hitType[i] = (hitIt)->getPairHit()->getHitType();
4243 m_mcHot_layer[i] = (hitIt)->getPairHit()->getLayer();
4244 m_mcHot_wire[i] = (hitIt)->getPairHit()->getWire();
4245 m_mcHot_flag[i] = (hitIt)->getPairHit()->getFlag();
4246 m_mcHot_halfCircle[i] = (hitIt)->getPairHit()->getHalfCircle();
4247 m_mcHot_x[i] = (hitIt)->getPairHit()->getHitPosition().x();
4248 m_mcHot_y[i] = (hitIt)->getPairHit()->getHitPosition().y();
4249 m_mcHot_z[i] = (hitIt)->getPairHit()->getHitPosition().z();
4250 m_mcHot_drift[i] = (hitIt)->getPairHit()->getDriftDist();
4256 for(hotIt=hitRefVec.begin();hotIt!=hitRefVec.end();hotIt++){
4259 for(
HitVector_Iterator hitIt = m_houghHitList.begin(); hitIt != m_houghHitList.end(); hitIt++){
4261 if(layer == (hitIt)->getLayer() && wire == (hitIt)->getWire()){
4262 m_hot_hitID[i] = (hitIt)->getHitID();
4263 m_hot_hitType[i] = (hitIt)->getHitType();
4264 m_hot_layer[i] = (hitIt)->getLayer();
4265 m_hot_wire[i] = (hitIt)->getWire();
4266 m_hot_flag[i] = (hitIt)->getFlag();
4267 m_hot_halfCircle[i] = (hitIt)->getHalfCircle();
4268 m_hot_x[i] = (hitIt)->getHitPosition().x();
4269 m_hot_y[i] = (hitIt)->getHitPosition().y();
4270 m_hot_z[i] = (hitIt)->getHitPosition().z();
4271 m_hot_drift[i] = (hitIt)->getDriftDist();
4272 m_hot_residual[i] = 999;
4274 if((hitIt)->getPairHit()!=NULL){
4275 m_mcHot_hitID[i] = (hitIt)->getPairHit()->getHitID();
4276 m_mcHot_hitType[i] = (hitIt)->getPairHit()->getHitType();
4277 m_mcHot_layer[i] = (hitIt)->getPairHit()->getLayer();
4278 m_mcHot_wire[i] = (hitIt)->getPairHit()->getWire();
4279 m_mcHot_flag[i] = (hitIt)->getPairHit()->getFlag();
4280 m_mcHot_halfCircle[i] = (hitIt)->getPairHit()->getHalfCircle();
4281 m_mcHot_x[i] = (hitIt)->getPairHit()->getHitPosition().x();
4282 m_mcHot_y[i] = (hitIt)->getPairHit()->getHitPosition().y();
4283 m_mcHot_z[i] = (hitIt)->getPairHit()->getHitPosition().z();
4284 m_mcHot_drift[i] = (hitIt)->getPairHit()->getDriftDist();
4291 int maxSameHitNumber(0);
4292 vector<HoughTrack>::iterator sameTrkIt = m_mcTrackCol.end();
4293 vector<HoughTrack>::iterator trkIter = m_mcTrackCol.begin();
4294 for(;trkIter!=m_mcTrackCol.end();trkIter++){
4295 int sameHitNumber(0);
4296 vector<HoughHit*> hitList = trkIter->getHotList();
4297 for(vector<HoughHit*>::iterator mchotIt = hitList.begin(); mchotIt != hitList.end();mchotIt++){
4299 for(clusterIt=clusterRefVec.begin();clusterIt!=clusterRefVec.end();clusterIt++){
4300 if((*clusterIt)->getclusterid()==(*mchotIt)->getCgemCluster()->getclusterid()){
4305 for(hotIt=hitRefVec.begin();hotIt!=hitRefVec.end();hotIt++){
4308 if(layer == (*mchotIt)->getLayer() && wire == (*mchotIt)->getWire()){
4314 if(sameHitNumber>maxSameHitNumber){
4315 maxSameHitNumber = sameHitNumber;
4316 sameTrkIt = trkIter;
4321 if(sameTrkIt!=m_mcTrackCol.end()){
4322 m_mcTrk_trackID = sameTrkIt->getTrkID();
4323 m_mcTrk_charge = sameTrkIt->getCharge();
4324 m_mcTrk_flag = sameTrkIt->getFlag();
4325 m_mcTrk_angle = sameTrkIt->getAngle();
4326 m_mcTrk_rho = sameTrkIt->getRho();
4327 m_mcTrk_dAngle = sameTrkIt->getDAngle();
4328 m_mcTrk_dRho = sameTrkIt->getDRho();
4329 m_mcTrk_dTanl = sameTrkIt->getDTanl();
4330 m_mcTrk_dDz = sameTrkIt->getDDz();
4331 m_mcTrk_Xc = sameTrkIt->center().x();
4332 m_mcTrk_Yc = sameTrkIt->center().y();
4333 m_mcTrk_R = sameTrkIt->radius();
4334 m_mcTrk_dr = sameTrkIt->dr();
4335 m_mcTrk_phi0 = sameTrkIt->phi0();
4336 m_mcTrk_kappa = sameTrkIt->kappa();
4337 m_mcTrk_dz = sameTrkIt->dz();
4338 m_mcTrk_tanl = sameTrkIt->tanl();
4339 m_mcTrk_pxy = sameTrkIt->pt();
4340 m_mcTrk_px = sameTrkIt->momentum(0).x();
4341 m_mcTrk_py = sameTrkIt->momentum(0).y();
4342 m_mcTrk_pz = sameTrkIt->momentum(0).z();
4343 m_mcTrk_p = sameTrkIt->momentum(0).mag();
4344 m_mcTrk_phi = sameTrkIt->direction(0).phi();
4345 m_mcTrk_theta = sameTrkIt->direction(0).theta();
4346 m_mcTrk_cosTheta =
cos(sameTrkIt->direction(0).theta());
4347 m_mcTrk_vx = sameTrkIt->x(0).x();
4348 m_mcTrk_vy = sameTrkIt->x(0).y();
4349 m_mcTrk_vz = sameTrkIt->x(0).z();
4350 m_mcTrk_vr = sameTrkIt->x(0).perp();
4363 vector<HoughHit*> mcHotList = sameTrkIt->getHotList();
4365 for(vector<HoughHit*>::iterator mcHotIt = mcHotList.begin(); mcHotIt != mcHotList.end(); mcHotIt++){
4366 m_mcTrkHot_hitID[j] = (*mcHotIt)->getHitID();
4367 m_mcTrkHot_hitType[j] = (*mcHotIt)->getHitType();
4368 m_mcTrkHot_layer[j] = (*mcHotIt)->getLayer();
4369 m_mcTrkHot_wire[j] = (*mcHotIt)->getWire();
4370 m_mcTrkHot_flag[j] = (*mcHotIt)->getFlag();
4371 m_mcTrkHot_halfCircle[j] = (*mcHotIt)->getHalfCircle();
4372 m_mcTrkHot_x[j] = (*mcHotIt)->getHitPosition().x();
4373 m_mcTrkHot_y[j] = (*mcHotIt)->getHitPosition().y();
4374 m_mcTrkHot_z[j] = (*mcHotIt)->getHitPosition().z();
4375 m_mcTrkHot_drift[j] = (*mcHotIt)->getDriftDist();
4379 ntuple_track->write();
4381 return recMdcTrackCol->size();
4384int HoughFinder::dumpTdsEvent()
4386 SmartDataPtr<RecMdcTrackCol> recMdcTrackCol(eventSvc(),
"/Event/Recon/RecMdcTrackCol");
4387 if(!recMdcTrackCol)
return 0;
4389 m_evt_event = m_event;
4390 m_evt_nTrack = recMdcTrackCol->size();
4392 for(RecMdcTrackCol::iterator
iter = recMdcTrackCol->begin();
iter!=recMdcTrackCol->end();
iter++){
4393 m_evtTrk_trackID[i] = (*iter)->trackId() ;
4394 m_evtTrk_charge[i] = (*iter)->charge() ;
4405 m_evtTrk_dr[i] = (*iter)->helix(0) ;
4406 m_evtTrk_phi0[i] = (*iter)->helix(1) ;
4407 m_evtTrk_kappa[i] = (*iter)->helix(2) ;
4408 m_evtTrk_dz[i] = (*iter)->helix(3) ;
4409 m_evtTrk_tanl[i] = (*iter)->helix(4) ;
4410 m_evtTrk_pxy[i] = (*iter)->pxy() ;
4411 m_evtTrk_px[i] = (*iter)->px() ;
4412 m_evtTrk_py[i] = (*iter)->py() ;
4413 m_evtTrk_pz[i] = (*iter)->pz() ;
4414 m_evtTrk_p[i] = (*iter)->p() ;
4415 m_evtTrk_phi[i] = (*iter)->theta() ;
4416 m_evtTrk_theta[i] = (*iter)->phi() ;
4417 m_evtTrk_cosTheta[i] =
cos((*iter)->theta()) ;
4418 m_evtTrk_vx[i] = (*iter)->x() ;
4419 m_evtTrk_vy[i] = (*iter)->y() ;
4420 m_evtTrk_vz[i] = (*iter)->z() ;
4421 m_evtTrk_vr[i] = (*iter)->r() ;
4422 m_evtTrk_chi2[i] = (*iter)->chi2() ;
4423 m_evtTrk_fiTerm[i] = (*iter)->getFiTerm() ;
4424 m_evtTrk_nhit[i] = (*iter)->getNhits() ;
4425 m_evtTrk_ncluster[i] = (*iter)->getNcluster() ;
4426 m_evtTrk_stat[i] = (*iter)->stat() ;
4427 m_evtTrk_ndof[i] = (*iter)->ndof() ;
4428 m_evtTrk_nster[i] = (*iter)->nster() ;
4429 m_evtTrk_nlayer[i] = (*iter)->nlayer() ;
4430 m_evtTrk_firstLayer[i] = (*iter)->firstLayer() ;
4431 m_evtTrk_lastLayer[i] = (*iter)->lastLayer() ;
4432 m_evtTrk_nCgemXClusters[i] = (*iter)->nCgemXCluster();
4433 m_evtTrk_nCgemVClusters[i] = (*iter)->nCgemVCluster();
4435 HitRefVec hitRefVec = (*iter)->getVecHits();
4436 HitRefVec::iterator hitIt = hitRefVec.begin();
4438 ClusterRefVec::iterator clusterIt = clusterRefVec.begin();
4440 int maxSameHitNumber(0);
4441 vector<HoughTrack>::iterator sameTrkIt = m_mcTrackCol.end();
4442 vector<HoughTrack>::iterator trkIter = m_mcTrackCol.begin();
4443 for(;trkIter!=m_mcTrackCol.end();trkIter++){
4444 int sameHitNumber(0);
4445 vector<HoughHit*> hitList = trkIter->getHotList();
4446 for(vector<HoughHit*>::iterator hotIt = hitList.begin(); hotIt != hitList.end();hotIt++){
4448 for(;clusterIt!=clusterRefVec.end();clusterIt++){
4449 if((*clusterIt)->getclusterid()==(*hotIt)->getCgemCluster()->getclusterid()){
4454 for(;hitIt!=hitRefVec.end();hitIt++){
4457 if(layer == (*hotIt)->getLayer() && wire == (*hotIt)->getWire()){
4463 if(sameHitNumber>maxSameHitNumber){
4464 maxSameHitNumber = sameHitNumber;
4465 sameTrkIt = trkIter;
4470 if(sameTrkIt!=m_mcTrackCol.end()){
4471 m_mcEvtTrk_trackID[i] = sameTrkIt->getTrkID();
4472 m_mcEvtTrk_charge[i] = sameTrkIt->getCharge();
4473 m_mcEvtTrk_flag[i] = sameTrkIt->getFlag();
4474 m_mcEvtTrk_angle[i] = sameTrkIt->getAngle();
4475 m_mcEvtTrk_rho[i] = sameTrkIt->getRho();
4476 m_mcEvtTrk_dAngle[i] = sameTrkIt->getDAngle();
4477 m_mcEvtTrk_dRho[i] = sameTrkIt->getDRho();
4478 m_mcEvtTrk_dTanl[i] = sameTrkIt->getDTanl();
4479 m_mcEvtTrk_dDz[i] = sameTrkIt->getDDz();
4480 m_mcEvtTrk_Xc[i] = sameTrkIt->center().x();
4481 m_mcEvtTrk_Yc[i] = sameTrkIt->center().y();
4482 m_mcEvtTrk_R[i] = sameTrkIt->radius();
4483 m_mcEvtTrk_dr[i] = sameTrkIt->dr();
4484 m_mcEvtTrk_phi0[i] = sameTrkIt->phi0();
4485 m_mcEvtTrk_kappa[i] = sameTrkIt->kappa();
4486 m_mcEvtTrk_dz[i] = sameTrkIt->dz();
4487 m_mcEvtTrk_tanl[i] = sameTrkIt->tanl();
4488 m_mcEvtTrk_pxy[i] = sameTrkIt->pt();
4489 m_mcEvtTrk_px[i] = sameTrkIt->momentum(0).x();
4490 m_mcEvtTrk_py[i] = sameTrkIt->momentum(0).y();
4491 m_mcEvtTrk_pz[i] = sameTrkIt->momentum(0).z();
4492 m_mcEvtTrk_p[i] = sameTrkIt->momentum(0).mag();
4493 m_mcEvtTrk_phi[i] = sameTrkIt->direction(0).phi();
4494 m_mcEvtTrk_theta[i] = sameTrkIt->direction(0).theta();
4495 m_mcEvtTrk_cosTheta[i] =
cos(sameTrkIt->direction(0).theta());
4496 m_mcEvtTrk_vx[i] = sameTrkIt->x(0).x();
4497 m_mcEvtTrk_vy[i] = sameTrkIt->x(0).y();
4498 m_mcEvtTrk_vz[i] = sameTrkIt->x(0).z();
4499 m_mcEvtTrk_vr[i] = sameTrkIt->x(0).perp();
4515 ntuple_event->write();
4516 return recMdcTrackCol->size();
4521 SmartDataPtr<RecMdcTrackCol> recMdcTrackCol(eventSvc(),
"/Event/Recon/RecMdcTrackCol");
4522 if(!recMdcTrackCol)
return 0;
4523 for(RecMdcTrackCol::iterator
iter = recMdcTrackCol->begin();
iter!=recMdcTrackCol->end();
iter++){
4524 double dr = (*iter)->helix(0) ;
4525 double phi0 = (*iter)->helix(1) ;
4526 double kappa = (*iter)->helix(2) ;
4527 double dz = (*iter)->helix(3) ;
4528 double tanl = (*iter)->helix(4) ;
4529 cout<<setw(12)<<
"dr:" <<setw(15)<<dr
4530 <<setw(12)<<
"phi0:" <<setw(15)<<phi0
4531 <<setw(12)<<
"kappa:" <<setw(15)<<kappa
4532 <<setw(12)<<
"dz:" <<setw(15)<<dz
4533 <<setw(12)<<
"tanl:" <<setw(15)<<tanl
4537 ClusterRefVec::iterator clusterIt = clusterRefVec.begin();
4538 for(clusterIt=clusterRefVec.begin();clusterIt!=clusterRefVec.end();clusterIt++){
4542 HitRefVec hitRefVec = (*iter)->getVecHits();
4543 HitRefVec::iterator hotIt = hitRefVec.begin();
4545 cout<<
"("<<
"l "<<
","<<
" w "<<
") "
4563 for(hotIt=hitRefVec.begin();hotIt!=hitRefVec.end();hotIt++){
4566 cout<<
"("<<setw( 2)<<layer<<
","<<setw( 3)<<wire<<
") "
4567 <<setw( 3)<<(*hotIt)->getStat()
4568 <<setw( 3)<<(*hotIt)->getFlagLR()
4569 <<setw(12)<<(*hotIt)->getDriftDistLeft()
4570 <<setw(12)<<(*hotIt)->getDriftDistRight()
4571 <<setw(12)<<(*hotIt)->getErrDriftDistLeft()
4572 <<setw(12)<<(*hotIt)->getErrDriftDistRight()
4573 <<setw(12)<<(*hotIt)->getChisqAdd()
4576 <<setw(10)<<(*hotIt)->getDriftT()
4577 <<setw(12)<<(*hotIt)->getDoca()
4578 <<setw(12)<<(*hotIt)->getEntra()
4579 <<setw(10)<<(*hotIt)->getZhit()
4580 <<setw(8 )<<(*hotIt)->getFltLen()
4585 return recMdcTrackCol->size();
double sin(const BesAngle a)
double cos(const BesAngle a)
bool sortCluster(const RecCgemCluster *clusterA, const RecCgemCluster *clusterB)
vector< HoughHit >::iterator HitVector_Iterator
bool moreHot(HoughTrack trk1, HoughTrack trk2)
bool largerPt(HoughTrack trk1, HoughTrack trk2)
bool sortCluster(const RecCgemCluster *clusterA, const RecCgemCluster *clusterB)
****INTEGER imax DOUBLE PRECISION m_pi *DOUBLE PRECISION m_amfin DOUBLE PRECISION m_Chfin DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_sinw2 DOUBLE PRECISION m_GFermi DOUBLE PRECISION m_MfinMin DOUBLE PRECISION m_ta2 INTEGER m_out INTEGER m_KeyFSR INTEGER m_KeyQCD *COMMON c_Semalib $ !copy of input $ !CMS energy $ !beam mass $ !final mass $ !beam charge $ !final charge $ !smallest final mass $ !Z mass $ !Z width $ !EW mixing angle $ !Gmu Fermi $ alphaQED at q
*********Class see also m_nmax DOUBLE PRECISION m_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared cut
*********Class see also m_nmax DOUBLE PRECISION m_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared dimensionless $ !dummy photon IR regulator $ !crude photon multiplicity enhancement factor *EVENT $ !MC crude volume of PhhSpace *Sfactors $ !YFS formfactor IR part only $ !YFS formfactor non IR finite part $ !mass weight
std::vector< MdcDigi * > MdcDigiVec
ObjectVector< RecMdcHit > RecMdcHitCol
SmartRefVector< RecCgemCluster > ClusterRefVec
ObjectVector< RecMdcTrack > RecMdcTrackCol
SmartRefVector< RecMdcHit > HitRefVec
double bFieldNominal() const
const RecCgemCluster * baseHit() const
static int strip(const Identifier &id)
static int sheet(const Identifier &id)
static bool is_xstrip(const Identifier &id)
vector< RecMdcHit > makeRecMdcHitVec(int sel=1)
void setPxy(const double pxy)
void setTrackId(const int trackId)
void setPy(const double py)
void setZ(const double z)
void setX(const double x)
void setError(double err[15])
void setTheta(const double theta)
void setStat(const int stat)
void setP(const double p)
void setHelix(double helix[5])
void setPoca(double poca[3])
void setR(const double r)
void setCharge(const int charge)
void setY(const double y)
void setChi2(const double chi)
void setPhi(const double phi)
void setPz(const double pz)
void setPx(const double px)
TArrayI GetIdentifier() const
Identifier identify() const
const HepPoint3D & pivot(void) const
returns pivot position.
int activeUnusedCgemHitsOnly(vector< HoughHit * > &hitPntList)
int checkTrack(vector< HoughTrack > &trackVector)
int storeRecTracks(RecMdcTrackCol *trackList, RecMdcHitCol *hitList, vector< HoughTrack > &trackVector)
void solveSharedHits(vector< HoughHit * > &hitList)
int storeTrack(vector< HoughTrack > &trackVector, RecMdcTrackCol *&recMdcTrackCol, RecMdcHitCol *&recMdcHitCol)
int storeTracks(RecMdcTrackCol *trackList, RecMdcHitCol *hitList, vector< HoughTrack > &trackVector)
vector< HoughTrack >::iterator getHoughTrkIt(vector< HoughTrack > &houghTrkList, int trkId)
void clearTrack(vector< HoughTrack > &trackVector)
HoughFinder(const std::string &name, ISvcLocator *pSvcLocator)
int checkHot(vector< HoughTrack > &trackVector)
int fillHistogram(HoughHit *hit, TH2D *hitMap, int charge, int vote)
StatusCode registerTrack(RecMdcTrackCol *&trackList_tds, RecMdcHitCol *&hitList_tds)
void setCgemCluster(const RecCgemCluster *cgemCluster)
vector< S_Z > getSZ() const
static void setMdcGeomSvc(MdcGeomSvc *mdcGeomSvc)
const RecCgemCluster * getCgemCluster() const
double getDriftDist() const
void setMdcHit(MdcHit *mdcHit)
void setDigi(const MdcDigi *mdcDigi)
const MdcMcHit * getMdcMcHit() const
HepPoint3D getHitPosition() const
HitType getHitType() const
const CgemMcHit * getCgemMcHit() const
void setPairHit(HoughHit *pairHit)
static void setMdcCalibFunSvc(MdcCalibFunSvc *mdcCalibFunSvc)
static void setCgemCalibFunSvc(CgemCalibFunSvc *cgemCalibFunSvc)
static void setCgemGeomSvc(CgemGeomSvc *cgemGeomSvc)
static void setMdcDetector(const MdcDetector *mdcDetector)
static int m_useCgemInGlobalFit
void addVecStereoHitPnt(HoughHit *aHitPnt)
int judgeHalf(HoughHit *hit)
void setMcTrack(HoughTrack *mcTrack)
vector< HoughHit * > getHotList(int type=2)
static TGraph * m_cut[2][43]
void addHitPnt(HoughHit *aHitPnt)
value_type get_value() const
double entranceAngle() const
const MdcLayer * layer() const
const MdcDigi * digi() const
unsigned layernumber() const
unsigned wirenumber() const
unsigned adcIndex() const
double driftTime(double tof, double z) const
unsigned tdcIndex() const
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
static int wire(const Identifier &id)
const MdcHit * mdcHit() const
void setNoInner(bool noInnerFlag)
static void readMCppTable(std::string filenm)
MdcDigiVec & getMdcDigiVec(uint32_t control=0)
virtual Identifier identify() const
int getclusterid(void) const
int getlayerid(void) const
int getclusterflagb(void) const
int getclusterflage(void) const
void setMdcId(Identifier mdcid)
void setErrDriftDistRight(double erddr)
void setFltLen(double fltLen)
const double getChisqAdd(void) const
void setErrDriftDistLeft(double erddl)
void setDriftDistLeft(double ddl)
const Identifier getMdcId(void) const
void setDoca(double doca)
void setChisqAdd(double pChisq)
const double getFltLen(void) const
void setZhit(double zhit)
void setDriftT(double driftT)
void setDriftDistRight(double ddr)
void setEntra(double entra)
void setVecClusters(ClusterRefVec vecclusters)
void setPivot(const HepPoint3D &pivot)
void setVecHits(HitRefVec vechits)
void setFiTerm(double fiterm)
virtual void getInfo(double fltLen, HepPoint3D &pos, Hep3Vector &direction) const =0
virtual void print(std::ostream &ostr) 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
const HepVector & params() const
const HepSymMatrix & covariance() const
virtual TrkExchangePar helix(double fltL) const =0
hot_iterator begin() const
double resid(bool exclude=false) const
const TrkRep * getParentRep() const
TrkErrCode getFitStuff(HepVector &derivs, double &deltaChi) const
virtual double arrivalTime(double fltL) const