BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcHoughFinder Class Reference

#include <MdcHoughFinder.h>

+ Inheritance diagram for MdcHoughFinder:

Public Member Functions

 MdcHoughFinder (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
StatusCode beginRun ()
 
 MdcHoughFinder (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
StatusCode beginRun ()
 

Detailed Description

Constructor & Destructor Documentation

◆ MdcHoughFinder() [1/2]

MdcHoughFinder::MdcHoughFinder ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 56 of file MdcHoughFinder.cxx.

56 :
57 Algorithm(name, pSvcLocator)
58{
59 // Declare the properties
60 declareProperty("trackNumMc", m_trackNum_Mc_set=1);
61 declareProperty("method", m_method=0);
62 declareProperty("debug", m_debug = 0);
63 declareProperty("data", m_data= 0);
64 declareProperty("binx", m_binx= 100);
65 declareProperty("biny", m_biny= 100);
66 declareProperty("peakCellNum", m_peakCellNum);
67 declareProperty("ndev", m_ndev= 3);
68 declareProperty("f_pro", m_fpro= 0.8);
69 declareProperty("f_hit_pro", m_hit_pro= 0.8);
70 //declareProperty("debug", m_debug = 0);
71 declareProperty("pdtFile", m_pdtFile = "pdt.table");
72 declareProperty("pickHits", m_pickHits = true);
73 declareProperty("pid", m_pid = 0);
74 //declareProperty("helixHitsSigma", m_helixHitsSigma);
75 declareProperty("combineTracking",m_combineTracking = true);
76 declareProperty("getDigiFlag", m_getDigiFlag = 0);
77 declareProperty("maxMdcDigi", m_maxMdcDigi = 0);
78 declareProperty("keepBadTdc", m_keepBadTdc = 0);
79 declareProperty("dropHot", m_dropHot= 0);
80 declareProperty("keepUnmatch", m_keepUnmatch = 0);
81 declareProperty("minMdcDigi", m_minMdcDigi = 0);
82
83}

◆ MdcHoughFinder() [2/2]

MdcHoughFinder::MdcHoughFinder ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Member Function Documentation

◆ beginRun() [1/2]

StatusCode MdcHoughFinder::beginRun ( )

Definition at line 85 of file MdcHoughFinder.cxx.

85 {
86
87 //Initailize MdcDetector
88 m_gm = MdcDetector::instance(0);
89 if(NULL == m_gm) return StatusCode::FAILURE;
90
91
92 return StatusCode::SUCCESS;
93}
static MdcDetector * instance()
Definition: MdcDetector.cxx:21

◆ beginRun() [2/2]

StatusCode MdcHoughFinder::beginRun ( )

◆ execute() [1/2]

StatusCode MdcHoughFinder::execute ( )

Definition at line 275 of file MdcHoughFinder.cxx.

275 {
276
277 MsgStream log(msgSvc(), name());
278 log << MSG::INFO << "in execute()" << endreq;
279
280 //event start time
281 SmartDataPtr<RecEsTimeCol> evTimeCol(eventSvc(),"/Event/Recon/RecEsTimeCol");
282 if (!evTimeCol) {
283 log << MSG::WARNING<< "Could not retrieve RecEsTimeCol , use t0=0" << endreq;
284 m_bunchT0=0.;
285 }else{
286 RecEsTimeCol::iterator iter_evt = evTimeCol->begin();
287 if (iter_evt != evTimeCol->end()){
288 m_bunchT0 = (*iter_evt)->getTest()*1.e-9;//m_bunchT0-s, getTest-ns
289 }
290 }
291
292 //if(m_debug)TrkHelixFitter::m_debug = true;
293 // Get the event header, print out event and run number
294
295 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
296 if (!eventHeader) {
297 log << MSG::FATAL << "Could not find Event Header" << endreq;
298 return( StatusCode::FAILURE);
299 }
300
301
302 DataObject *aTrackCol;
303 DataObject *aRecHitCol;
304 SmartIF<IDataManagerSvc> dataManSvc(eventSvc());
305 if(!m_combineTracking){
306 eventSvc()->findObject("/Event/Recon/RecMdcTrackCol",aTrackCol);
307 if(aTrackCol != NULL) {
308 dataManSvc->clearSubTree("/Event/Recon/RecMdcTrackCol");
309 eventSvc()->unregisterObject("/Event/Recon/RecMdcTrackCol");
310 }
311 eventSvc()->findObject("/Event/Recon/RecMdcHitCol",aRecHitCol);
312 if(aRecHitCol != NULL) {
313 dataManSvc->clearSubTree("/Event/Recon/RecMdcHitCol");
314 eventSvc()->unregisterObject("/Event/Recon/RecMdcHitCol");
315 }
316 }
317
318 RecMdcTrackCol* trackList;
319 eventSvc()->findObject("/Event/Recon/RecMdcTrackCol",aTrackCol);
320 if (aTrackCol) {
321 trackList = dynamic_cast<RecMdcTrackCol*> (aTrackCol);
322 }else{
323 trackList = new RecMdcTrackCol;
324 StatusCode sc = eventSvc()->registerObject(EventModel::Recon::RecMdcTrackCol, trackList);
325 if(!sc.isSuccess()) {
326 log << MSG::FATAL << " Could not register RecMdcTrack collection" <<endreq;
327 return StatusCode::FAILURE;
328 }
329 }
330 int nTdsTk = (int) trackList->size();
331 int nFitSucess = 0;
332
333 RecMdcHitCol* hitList;
334 eventSvc()->findObject("/Event/Recon/RecMdcHitCol",aRecHitCol);
335 if (aRecHitCol) {
336 hitList = dynamic_cast<RecMdcHitCol*> (aRecHitCol);
337 }else{
338 hitList = new RecMdcHitCol;
339 StatusCode sc = eventSvc()->registerObject(EventModel::Recon::RecMdcHitCol, hitList);
340 if(!sc.isSuccess()) {
341 log << MSG::FATAL << " Could not register RecMdcHit collection" <<endreq;
342 return StatusCode::FAILURE;
343 }
344 }
345
346 //pick the first layer
347
348 // m_nLayerNum=43;
349 // for(int i=0;i<43;i++){
350 // const MdcGeoWire *geowir_first_layer =m_mdcGeomSvc->Wire(i,1);
351 // HepPoint3D eastP = geowir_first_layer->Backward()/10.0;//mm 2 cm
352 // HepPoint3D westP = geowir_first_layer->Forward() /10.0;//mm 2 cm
353 // m_layer1X[i]=(eastP.x()+westP.x())/2;
354 // m_layer1Y[i]=(eastP.y()+westP.y())/2;
355 // m_layer1U[i]=CFtrans((eastP.x()+westP.x())/2.,(eastP.y()+westP.y())/2.);
356 // m_layer1V[i]=CFtrans((eastP.y()+westP.y())/2.,(eastP.x()+westP.x())/2.);
357 //
358 // cout<<"("<<i<<","<<"1"<<")"<<":"<<"("<<m_layer1X[i]<<","<<m_layer1Y[i]<<")"<<endl;
359 // }
360
361 t_eventNum=eventHeader->eventNumber();
362 t_runNum=eventHeader->runNumber();
363 m_eventNum=t_eventNum;
364 m_runNum=t_runNum;
365 log << MSG::INFO << "MdcHoughFinder: retrieved event: " << eventHeader->eventNumber() << " run: " << eventHeader->runNumber() << endreq;
366
367 // get mc particle digi
368 int mc_particle=GetMcInfo();
369
370
371 if(abs(m_costaTruth)<=0.83){m_cosCut=1;}
372 else{m_cosCut=0;}
373
374 //int n_curve=0;
375 //double vec_ptTruth=m_ptTruth;
376 //double n_costaTruth=m_costaTruth;
377 //double z_flight=2*M_PI*(771.4/2)*(vec_ptTruth/tan(n_costaTruth));
378 //if(vec_ptTruth<0.12&&(z_flight<1193.)){
379 ///// n_curve++;
380 //// m_curve=n_curve;
381 //}
382 vector<double> vec_u;
383 vector<double> vec_v;
384 vector<double> vec_p;
385 vector<double> vec_x_east;
386 vector<double> vec_y_east;
387 vector<double> vec_z_east;
388 vector<double> vec_x_west;
389 vector<double> vec_y_west;
390 vector<double> vec_z_west;
391 vector<double> vec_z_Mc;
392 vector<double> vec_x;
393 vector<double> vec_y;
394 vector<double> vec_z;
395 vector<int> vec_layer;
396 vector<int> vec_wire;
397 vector<int> vec_slant;
398 vector<double> vec_zStereo;
399 vector<double> l;
400
401 vector<int> vec_layer_Mc;
402 vector<int> vec_wire_Mc;
403 t_maxP=-999.;
404 t_minP=999.;
405
406 // retrieve Mdc truth hits
407 int t_nHit_Mc;
408 int digiId_Mc=0;
409 int nHitAxial_Mc=0;
410
411 SmartDataPtr<Event::MdcMcHitCol> mcMdcMcHitCol(eventSvc(),"/Event/MC/MdcMcHitCol");
412 if (!mcMdcMcHitCol) {
413 log << MSG::INFO << "Could not find MdcMcHit" << endreq;
414 }else{
415 Event::MdcMcHitCol::iterator iterMcHit = mcMdcMcHitCol->begin();
416
417 for(; iterMcHit != mcMdcMcHitCol->end(); ++iterMcHit,digiId_Mc++) {
418 Identifier mdcid = (*iterMcHit)->identify();
419 int layerId_Mc = MdcID::layer(mdcid);
420 int wireId_Mc = MdcID::wire(mdcid);
421
422 vec_layer_Mc.push_back(layerId_Mc);
423 vec_wire_Mc.push_back(wireId_Mc);
424
425 // cout<<"mcHit: "<<"("<<layerId_Mc<<","<<wireId_Mc<<")"<<endl;
426 //vec_layer.push_back(layerId_Mc);
427 //vec_wire.push_back(wireId_Mc);
428 m_layer_Mc[digiId_Mc]=layerId_Mc;
429 m_cell_Mc[digiId_Mc]=wireId_Mc;
430
431 if(m_data==0){
432 if ((layerId_Mc>=8&&layerId_Mc<=19)||(layerId_Mc>=36)) {
433 nHitAxial_Mc++;}
434 if(m_debug>0) {cout<<"("<<layerId_Mc<<","<<wireId_Mc<<")"<<"nHitAxial_Mc: "<<nHitAxial_Mc<<endl;}
435 m_layer[digiId_Mc]=layerId_Mc;
436 m_cell[digiId_Mc]=wireId_Mc;
437 const MdcGeoWire *geowir =m_mdcGeomSvc->Wire(layerId_Mc,wireId_Mc);
438 HepPoint3D eastP = geowir->Backward()/10.0;//mm 2 cm
439 HepPoint3D westP = geowir->Forward() /10.0;//mm 2 cm
440
441 m_x_east[digiId_Mc]=eastP.x();
442 m_y_east[digiId_Mc]=eastP.y();
443 m_z_east[digiId_Mc]=eastP.z();
444 m_x_west[digiId_Mc]=westP.x();
445 m_y_west[digiId_Mc]=westP.y();
446 m_z_west[digiId_Mc]=westP.z();
447
448 vec_x_east.push_back(eastP.x());
449 vec_y_east.push_back(eastP.y());
450 vec_z_east.push_back(eastP.z());
451 vec_x_west.push_back(westP.x());
452 vec_y_west.push_back(westP.y());
453 vec_z_west.push_back(westP.z());
454
455 double x = (*iterMcHit)->getPositionX()/10.;//mm 2 cm
456 double y = (*iterMcHit)->getPositionY()/10.;//mm 2 cm
457 double z = (*iterMcHit)->getPositionZ()/10.;//mm 2 cm
458
459 double u=CFtrans(x,y);
460 double v=CFtrans(y,x);
461 double p=sqrt(u*u+v*v);
462
463 vec_x.push_back(x);
464 vec_y.push_back(y);
465 vec_z.push_back(z);
466 vec_u.push_back(u);
467 vec_v.push_back(v);
468 vec_p.push_back(p);
469
470 m_x[digiId_Mc]=x;
471 m_y[digiId_Mc]=y;
472 m_z[digiId_Mc]=z;
473 m_u[digiId_Mc]=u;
474 m_v[digiId_Mc]=v;
475 m_p[digiId_Mc]=p;
476
477 int layer= layerId_Mc;
478 vec_slant.push_back(SlantId(layer));
479 m_slant[digiId_Mc]=SlantId(layer);
480 if (m_slant!=0)
481 {cout<<"layer: "<<layerId_Mc<<"wire: "<<wireId_Mc<<"x_east: "<<m_x_east[digiId_Mc]<<"y_east: "<<m_y_east[digiId_Mc]<<endl;}
482 }
483 }
484 }
485
486 t_nHit_Mc=digiId_Mc;
487 m_nHit_Mc=digiId_Mc;
488 if(m_data==0) {m_nHit=digiId_Mc;}
489
490 //m_nHitAxial=nHitAxial_Mc;
491 // m_nFitFailure=0;
492
493 // for(int i =0;i<t_nHit_Mc;i++){
494 // if(t_maxP<vec_p[i]) {t_maxP=vec_p[i];}
495 // }
496 //cout<<"t_maxP:"<<t_maxP<<" "<<endl;
497
498 // for(int i =0;i<t_nHit_Mc;i++){
499 // if(t_minP>vec_p[i]) {t_minP=vec_p[i];}
500 // }
501 //cout<<"t_minP:"<<t_minP<<" "<<endl;
502
503
504 // retrieve Mdc digi vector form RawDataProviderSvc
505 vector<int> vec_hitSignal;
506 vector<int> vec_track_index;
507 int track_index_max=0;
508 uint32_t getDigiFlag = 0;
509 if(m_dropHot || m_combineTracking)getDigiFlag |= MdcRawDataProvider::b_dropHot;
510 if(m_keepBadTdc) getDigiFlag |= MdcRawDataProvider::b_keepBadTdc;
511 if(m_keepUnmatch) getDigiFlag |= MdcRawDataProvider::b_keepUnmatch;
512 MdcDigiVec mdcDigiVec = m_rawDataProviderSvc->getMdcDigiVec(getDigiFlag);
513 // MdcDigiVec mdcDigiVec = m_rawDataProviderSvc->getMdcDigiVec();
514 cout<<"MdcDigiVec: "<<mdcDigiVec.size()<<endl;
515 MdcDigiVec::iterator iter1 = mdcDigiVec.begin();
516 int t_nHit;
517 int digiId = 0;
518 int nHitAxial = 0;
519 int nHitLayer[43];
520 int nHitSignal=0;
521 int nHitAxialSignal=0;
522
523 for (;iter1 != mdcDigiVec.end(); iter1++, digiId++) {
524 int track_index=(*iter1)->getTrackIndex();
525// cout<<"mc track_index: "<<track_index<<endl;
526 if(track_index>=1000) track_index-=1000;
527 vec_track_index.push_back(track_index);
528 if(track_index>=0){
529 nHitSignal++;
530 m_hitSignal[digiId]=1;
531 }
532 //m_hitCol[digiId]=digiId;
533 Identifier mdcId= (*iter1)->identify();
534 int layerId = MdcID::layer(mdcId);
535 int wireId = MdcID::wire(mdcId);
536
537
538 //cout<<"layer: "<<layerId<<" "<<"wire: "<<wireId<<"hitSignal: "<<vec_hitSignal[digiId]<<endl;
539
540 if ((layerId>=8&&layerId<=19)||(layerId>=36)) {
541 nHitAxial++;}
542 if (((layerId>=8&&layerId<=19)||(layerId>=36))&&track_index>=0) {
543 nHitAxialSignal++;}
544
545 vec_layer.push_back(layerId);
546 vec_wire.push_back(wireId);
547
548 nHitLayer[layerId]++;
549 m_layerNhit[layerId]=nHitLayer[layerId];
550
551 const MdcGeoWire *geowir =m_mdcGeomSvc->Wire(layerId,wireId);
552 HepPoint3D eastP = geowir->Backward()/10.0;//mm 2 cm
553 HepPoint3D westP = geowir->Forward() /10.0;//mm 2 cm
554
555 vec_x_east.push_back(eastP.x());
556 vec_y_east.push_back(eastP.y());
557 vec_z_east.push_back(eastP.z());
558 vec_x_west.push_back(westP.x());
559 vec_y_west.push_back(westP.y());
560 vec_z_west.push_back(westP.z());
561
562 m_x_east[digiId]=eastP.x();
563 m_y_east[digiId]=eastP.y();
564 m_z_east[digiId]=eastP.z();
565 m_x_west[digiId]=westP.x();
566 m_y_west[digiId]=westP.y();
567 m_z_west[digiId]=westP.z();
568 if(m_debug>0) {cout<<"event: "<<t_eventNum<<" "<<"layer: "<<layerId<<" "<<"wireId: "<<wireId<<" "<<"zeast: "<<vec_z_east.at(digiId)<<" "<<"zwest: "<<vec_z_west.at(digiId)<<" "<<endl;}
569 //conformal trans:
570 double x =(eastP.x()+westP.x())/2.;
571 double y =(eastP.y()+westP.y())/2.;
572 vec_x.push_back((vec_x_east[digiId]+vec_x_west[digiId])/2);
573 vec_y.push_back((vec_y_east[digiId]+vec_y_west[digiId])/2);
574 m_x[digiId]=(vec_x_east[digiId]+vec_x_west[digiId])/2;
575 m_y[digiId]=(vec_y_east[digiId]+vec_y_west[digiId])/2;
576 double u=CFtrans(x,y);
577 double v=CFtrans(y,x);
578 // cout<< "u: "<<u<<"v: "<<v<<"digiId: "<<digiId<<endl;
579 //cout<<"layer: "<<layerId<<" "<<"wireId: "<<wireId<<" "<<"x: "<<x<<" "<<"y: "<<y<<" "<<endl;
580 vec_p.push_back(sqrt(u*u+v*v));
581 vec_u.push_back(u);
582 vec_v.push_back(v);
583 m_u[digiId]=u;
584 m_v[digiId]=v;
585 m_p[digiId]=sqrt(u*u+v*v);
586
587 m_layer[digiId]=geowir->Layer();
588 m_cell[digiId]=geowir->Cell();
589 int layer= layerId;
590 vec_slant.push_back(SlantId(layer));
591 m_slant[digiId]=SlantId(layer);
592 //cout<<"layer: "<<layer<<" "<<"slant: "<<m_slant[digiId]<<endl;
593 // if (m_slant!=0)
594 // {cout<<"layer: "<<layerId<<"wire: "<<wireId<<"x_east: "<<m_x_east[digiId]<<"y_east: "<<m_y_east[digiId]<<endl;}
595 }
596 for(int i=0;i<digiId;i++){
597 if(track_index_max<=vec_track_index[i]) track_index_max=vec_track_index[i];
598 }
599 track_index_max++;
600 m_trackNum_Mc=track_index_max;
601// cout<<"mc truth has :"<<track_index_max<<" mc track."<<endl;
602 vector< vector <int> > mc_track_hit(track_index_max,vector<int>() );
603 for(int i=0;i<track_index_max;i++){
604 for(int j=0;j<digiId;j++){
605 if(vec_track_index[j]==i) mc_track_hit[i].push_back(j);
606 }
607 }
608 //composory set mc_track number
609 track_index_max=m_trackNum_Mc_set;
610 //debug mc track hit
611 //for(int i=0;i<track_index_max;i++){
612 // for(int j=0;j<mc_track_hit[i].size();j++){
613 // int hitId=mc_track_hit[i][j];
614 // cout<<"track: "<<i<<" has hit: "<<mc_track_hit[i][j]<<"("<<vec_layer[hitId]<<","<<vec_wire[hitId]<<")"<<endl;
615 // }
616 //}
617
618 //t_nHit=digiId;
619 m_nHit=digiId;
620 m_nHitAxial=nHitAxial;
621 //m_nFitFailure=0;
622
623 m_nHitSignal=nHitSignal;
624 m_nHitAxialSignal=nHitAxialSignal;
625
626 cout<<"hit number: "<<digiId<<endl;
627
628
629 // get the max&min amplitude of the curve
630 for(int i =0;i<m_nHit;i++){
631 if(t_maxP<vec_p[i]) {t_maxP=vec_p[i];}
632 }
633
634 for(int i =0;i<m_nHit;i++){
635 if(t_minP>vec_p[i]) {t_minP=vec_p[i];}
636 }
637 t_maxP=t_maxP+0.01;
638
639
640 //double peakArea[100];
641 //m_npeak=100;
642 //for( int bin_i=0;bin_i<10;bin_i++){
643 // for(int bin_j=0;bin_j<10;bin_j++){
644 // int binx=m_binx+100*bin_i;
645 // int biny=m_biny+100*bin_j;
646 int nhit;
647 if(m_data==0) {
648 nhit=m_nHit_Mc;}
649 else{
650 nhit=m_nHit;}
651
652 binX=m_binx;
653 binY=m_biny;
654 double binwidth=M_PI/binX;
655 double binhigh=2*t_maxP/binY;
656 TH2D *h1=new TH2D("h1","h1",binX,0,M_PI,binY,-t_maxP,t_maxP);
657
658 //method 0
659 //2-point combine
660 vector<double> vec_rho;
661 vector<double> vec_theta;
662 vector< vector<int> > vec_hitNum(2,vector<int>()); //store 2 hits in a cross point
663 int numCross=(int)(nhit*(nhit-1)/2);
664 if(m_method==0){
665 RhoTheta(numCross,nhit,vec_u,vec_v,vec_rho,vec_theta,vec_hitNum); //calculate cross point
666 FillRhoTheta(h1,vec_theta,vec_rho,numCross); //fill histgram method by rhotheta
667 }
668 // method 1
669 vector< vector< vector<int> > > vec_selectNum(binX,vector< vector<int> >(binY,vector<int>() ) );
670 if(m_method==1){
671 FillHist(h1,vec_u,vec_v,nhit,vec_selectNum);
672 }
673
674
675 vector<bool> vec_truthHit(nhit,false);
676 vector< vector <int> > countij(binX,vector <int> (binY,0) );
677 // vector< vector < vector<int> > > vec_selectNum(binX,vector < vector<int> >(binY,vector<int>() ));
678 vector< vector< vector<int> > > vec_selectHit(binX,vector< vector<int> >(binY,vector<int>() ) );
679 if(m_method==2){
680 FillCells(h1,nhit,binX,binY,vec_u,vec_v,vec_layer,vec_wire,countij,vec_selectNum,vec_selectHit);
681 }
682
683 //cout h1
684 //for(int i=0;i<binX;i++){
685 // for(int j=0;j<binY;j++){
686 // int count =h1->GetBinContent(i+1,j+1);
687 //// for(int k=0;k<count;k++){
688 // cout<<"("<<i<<","<<j<<")"<<": "<<count<<endl;
689 //// }
690 // }
691 //}
692
693
694 //int nHitSelect=0;
695 //int nHitSignal_select=0;
696 //int nHitAxialSignal_select=0;
697 //find peak
698 int max_count=0;
699 int max_binx=1;
700 int max_biny=1;
701 for(int i=0;i<binX;i++){
702 for(int j=0;j<binY;j++){
703 int count=h1->GetBinContent(i+1,j+1);
704 if(max_count<count) {
705 max_count=count;
706 max_binx=i+1;
707 max_biny=j+1;
708 }
709 }
710 }
711 // cout<<"("<<max_binx<<","<<max_biny<<","<<max_count<<")"<<"numCross: "<<numCross<<endl;
712 // h1->Draw("lego2");
713
714 //int peak_cellNum=1; // to determine how many cell should be embraced in one orientation
715 //int count_sum[1000];
716 //for(int i=0;i<1000;i++){
717 // count_sum[i]=0;
718 // for(int alphax=max_binx-i;alphax<=max_binx+i;alphax++){
719 // for(int rhox=max_biny-i;rhox<=max_biny+i;rhox++){
720 // int ax;
721 // if (alphax<0) { ax=alphax+binX; }
722 // else if (alphax>=binX) { ax=alphax-binX; }
723 // else { ax=alphax; }
724 // count_sum[i]+=h1->GetBinContent(ax,rhox);
725 // }
726 // }
727 // if(count_sum[i]>m_fpro*numCross){
728 // peak_cellNum=i;
729 // cout<<"i: "<<i<<endl;
730 // cout<<"count_sum: "<<count_sum[i]<<endl;
731 // cout<<"pro: "<<(double)count_sum[i]/(double)numCross<<endl;
732 // break;
733 // }
734 //}
735
736
737 /*
738 //return hit number
739 vector<bool> vec_hitSelect(m_nHit,false);
740 int bin_left=max_binx-peak_cellNum;
741 int bin_right=max_binx+peak_cellNum;
742 int bin_up=max_biny+peak_cellNum;
743 int bin_down=max_biny-peak_cellNum;
744 double area_left=(bin_left-1)*binwidth;
745 double area_right=(bin_right)*binwidth;
746 double area_down=(bin_down-1)*binhigh-t_maxP;
747 double area_up=(bin_up)*binhigh-t_maxP;
748 // cout<<"("<<area_left<<","<<area_right<<","<<area_down<<","<<area_up<<")"<<endl;
749 double peak_width=(2*peak_cellNum+1)*binwidth;
750 double peak_high=(2*peak_cellNum+1)*binhigh;
751 cout<<"the area of the peak is: "<<peak_width*peak_high<<endl;
752 //test if the hit is in this area
753 for(int i=0;i<numCross;i++){
754 if(vec_theta[i]>=area_left&&vec_theta[i]<area_right&&vec_rho[i]>=area_down&&vec_rho[i]<area_up) {
755 int hitNum_1=vec_hitNum[0][i];
756 int hitNum_2=vec_hitNum[1][i];
757 vec_hitSelect[hitNum_1]=true;
758 vec_hitSelect[hitNum_2]=true;
759 }
760 }
761 int selectHitNum=0;
762 for(int i=0;i<m_nHit;i++){
763 if(vec_hitSelect[i]==1) {selectHitNum++;}
764 // cout<<"if hit is select: "<<i<<": "<<vec_hitSelect[i]<<endl;
765 }
766 cout<<"how many Hit have been selected: "<<selectHitNum<<" "<<(double)selectHitNum/(double)m_nHit;
767 m_areaSelectHit=(double)selectHitNum/(double)m_nHit;
768
769
770 // // the smallest cell has been found
771 // //cout<<"width: "<<peak_width<<" "<<"high: "<<peak_high<<endl;
772 // int column=(int)(bin_i*10+bin_j);
773 // peakArea[column]=peak_width*peak_high;
774 // m_peakWidth[column]=peak_width;
775 // m_peakHigh[column]=peak_high;
776 /// m_peakArea[column]=peak_width*peak_high;
777 // int columnx_split=(int)(column/10)*100+100;
778 // int columny_split=(int)(column%10)*100+100;
779 // //cout<<"column: "<<column<<" "<<"("<<columnx_split<<","<<columny_split<<")"<<peakArea[column]<<endl;
780 delete h1;
781 // }
782 // }
783 // double area_least=peakArea[0];
784 // for(int i=0;i<100;i++){
785 // if(area_least>peakArea[i]){
786 // area_least=peakArea[i];
787 // }
788 // }
789 // int num_area_least=0;
790 // for(int i=0;i<100;i++){
791 // if(area_least==peakArea[i]){
792 // num_area_least=i;
793 // }
794 // }
795 // int binx_split=(int)(num_area_least/10)*100+100;
796 // int biny_split=(int)(num_area_least%10)*100+100;
797 // m_areaLeast=area_least;
798 // m_areaLeastNum=num_area_least;
799 //cout<<"the max peakArea: "<<num_area_least<<"("<<binx_split<<","<<biny_split<<")"<<"peakarea is : "<<area_least<<endl;
800 */
801
802
803
804
805 // select hit
806 int count_use=0;
807 double sum=0;
808 double sum2=0;
809 for(int i=0;i<binX;i++){
810 for(int j=0;j<binY;j++){
811 int count=h1->GetBinContent(i+1,j+1);
812 // cout<<"("<<i<<","<<j<<")"<<" "<<"count: "<<count<<" ";
813 if(count!=0){
814 count_use++;
815 sum+=count;
816 sum2+=count*count;
817 }
818 }
819 }
820 double f_n=m_ndev;
821 cout<<"count_use: "<<count_use<<endl;
822 double aver=sum/count_use;
823 double dev=sqrt(sum2/count_use-aver*aver);
824 int min_counts=(int)(aver+f_n*dev);
825 cout<<"aver: "<<aver<<" "<<"dev: "<<dev<<" min: "<<min_counts<<endl;
826
827
828 vector< vector <int> > hough_trans_CS(binX,vector <int> (binY,0) );
829 vector< vector <int> > hough_trans_CS_peak(binX,vector <int> (binY,0) );
830 // int hough_trans_CS[binX][binY];
831 // int hough_trans_CS_peak[binX][binY];
832 for(int i=0;i<binX;i++){
833 for(int j=0;j<binY;j++){
834 hough_trans_CS[i][j]=h1->GetBinContent(i+1,j+1);
835 }
836 }
837
838 int peak_num=0;
839 for (int r=0; r<binY; r++) {
840 for (int a=0; a<binX; a++) {
841 long max_around=0;
842 for (int ar=a-1; ar<=a+1; ar++) {
843 for (int rx=r-1; rx<=r+1; rx++) {
844 int ax;
845 if (ar<0) { ax=ar+binX; }
846 else if (ar>=binX) { ax=ar-binX; }
847 else { ax=ar; }
848 if ( (ax!=a || rx!=r) && rx>=0 && rx<binY) {
849 if (hough_trans_CS[ax][rx]>max_around) { max_around=hough_trans_CS[ax][rx]; }
850 }
851 }
852 }
853 if (hough_trans_CS[a][r]<=min_counts) { hough_trans_CS_peak[a][r]=0; }
854 else if (hough_trans_CS[a][r]<max_around) { hough_trans_CS_peak[a][r]=0; }
855 else if (hough_trans_CS[a][r]==max_around) { hough_trans_CS_peak[a][r]=1; }
856 else if (hough_trans_CS[a][r]>max_around) { hough_trans_CS_peak[a][r]=2; }
857 if(hough_trans_CS_peak[a][r]!=0) {
858 // cout<<" peak: "<<"("<<a<<","<<r<<")"<<":"<<hough_trans_CS_peak[a][r]<<" "<<hough_trans_CS[a][r]<<endl;
859 peak_num++;
860 }
861 }
862 }
863 //cout<<"peak_num: "<<peak_num<<endl;
864
865 // //find double-point-peaks in parameter space
866 int peak_num_2=0;
867 for (int r=0; r<binY; r++) {
868 for (int a=0; a<binX; a++) {
869 if (hough_trans_CS_peak[a][r]==1) {
870 hough_trans_CS_peak[a][r]=2;
871 for (int ar=a-1; ar<=a+1; ar++) {
872 for (int rx=r-1; rx<=r+1; rx++) {
873 int ax;
874 if (ar<0) { ax=ar+binX; }
875 else if (ar>=binX) { ax=ar-binX; }
876 else { ax=ar; }
877 if ( (ax!=a || rx!=r) && rx>=0 && rx<binY) {
878 if (hough_trans_CS_peak[ax][rx]==1) { hough_trans_CS_peak[ax][rx]=0; }
879 }
880 }
881 }
882 }
883 if(hough_trans_CS_peak[a][r]!=0) {
884 peak_num_2++;
885 //cout<<" peak: "<<"("<<a<<","<<r<<")"<<":"<<hough_trans_CS_peak[a][r]<<" "<<hough_trans_CS[a][r]<<endl;
886 // for(int i=0;i<hough_trans_CS[a][r];i++){
887 // int hitNum=selectNum[a][r][i];
888 // cout<<"hit: "<<hitNum<<"("<<layer[hitNum]<<","<<cell[hitNum]<<")"<<endl;
889 // }
890 }
891 }
892 }
893 //cout<<"peak_mum_2: "<<peak_num_2<<endl;
894
895 //fill the histogram again
896 TH2D *h2 = new TH2D("h2","test2",binX,0,3.14,binY,-t_maxP,t_maxP);
897 for(int i=0;i<binX;i++){
898 for(int j=0;j<binY;j++){
899 if(hough_trans_CS_peak[i][j]==2){
900 h2->SetBinContent(i+1,j+1,hough_trans_CS[i][j]);
901 }
902 }
903 }
904
905 vector<int> peakList1[3];
906 for(int n=0;n<peak_num_2;n++){
907 for (int r=0; r<binY; r++) {
908 for (int a=0; a<binX; a++) {
909 if (hough_trans_CS_peak[a][r]==2) {
910 peakList1[0].push_back(a+1);
911 peakList1[1].push_back(r+1);
912 peakList1[2].push_back(hough_trans_CS[a][r]);
913 }
914 }
915 }
916 }
917 cout<<"finish peak?"<<endl;
918 if(m_method==0) cout<<"numCross: "<<numCross<<endl;
919 // //sort peaks by height
920 int npeak1=peak_num_2;
921 int n_max;
922 for (int na=0; na<npeak1-1; na++) {
923 n_max=na;
924 for (int nb=na+1; nb<npeak1; nb++) {
925 if (peakList1[2][n_max]<peakList1[2][nb]) { n_max=nb; }
926 }
927 if (n_max!=na) { // swap
928 float swap[3];
929 for (int i=0; i<3; i++) {
930 swap[i]=peakList1[i][na];
931 peakList1[i][na]=peakList1[i][n_max];
932 peakList1[i][n_max]=swap[i];
933 }
934 }
935 }
936 cout<<"npeak1: "<<npeak1<<endl;
937 for(int n=0;n<npeak1;n++){
938 int bintheta=peakList1[0][n];
939 int binrho=peakList1[1][n];
940 int count=peakList1[2][n];
941 for(int i=0;i<count;i++){
942 //cout<<"("<<bintheta<<","<<binrho<<","<<count<<")"<<endl;
943 //cout<<"n"<<n<<": "<<"("<<bintheta<<","<<binrho<<","<<count<<"):"<<vec_selectNum[bintheta-1][binrho-1][i]<<endl;
944 }
945 //cout<<"peakList1: "<<n<<" "<<"bina: "<<peakList1[0][n]<<" "<<"binr: "<<peakList1[1][n]<<" "<<"houghpeak: "<<peakList1[2][n]<<endl;
946 }
947
948 typedef std::map<int, int> M2;
949 typedef std::map<int, M2> M1;
950 M2 peak_combine_num;
951 M1 hit_combine;
952
953 int peak_track=0;
954
955 if(m_method==2){
956 //combine aroud
957 int m=0;
958 int n=0;
959 int addnum=999;
960 vector<bool> peaktrack(npeak1,true);
961 while(addnum!=0)
962 {
963 addnum=0;
964 double peak_cellNum[43];
965 int peakX[43];
966 int peakY[43];
967 double bin_left[43];
968 double bin_right[43];
969 double bin_up[43];
970 double bin_down[43];
971 double area_left[43];
972 double area_right[43];
973 //double area_mid[43];
974 double area_down[43];
975 double area_up[43];
976 // for(int i=0;i<npeak1;i++) { peaktrack[i]=true; }
977 for(int iLayer=0; iLayer<m_gm->nLayer(); iLayer++){
978 peak_cellNum[iLayer]=m_peakCellNum[iLayer];
979 peakX[iLayer]=peakList1[0][n]; //start from the highest peak
980 peakY[iLayer]=peakList1[1][n];
981 bin_left[iLayer]=peakX[iLayer]-peak_cellNum[iLayer];
982 bin_right[iLayer]=peakX[iLayer]+peak_cellNum[iLayer];
983 bin_up[iLayer]=peakY[iLayer]+peak_cellNum[iLayer];
984 bin_down[iLayer]=peakY[iLayer]-peak_cellNum[iLayer];
985 area_left[iLayer]=(bin_left[iLayer]-1)*binwidth;
986 area_right[iLayer]=(bin_right[iLayer])*binwidth;
987 // area_mid=(area_left+area_right)/2.;
988 area_down[iLayer]=(bin_down[iLayer]-1)*binhigh-t_maxP;
989 area_up[iLayer]=(bin_up[iLayer])*binhigh-t_maxP;
990 }
991 int count_peak=0;
992 for(int k=0;k<nhit;k++){
993 int layer=vec_layer[k];
994 double lineLeft=vec_u[k]*cos(area_left[layer])+vec_v.at(k)*sin(area_right[layer]);
995 double lineRight=vec_u[k]*cos(area_left[layer])+vec_v.at(k)*sin(area_right[layer]);
996 // double lineMid=vec_u[k]*cos(area_mid)+vec_v[k]*sin(area_mid);
997 if((lineLeft<area_up[layer])&&(lineLeft>area_down[layer])||(lineRight<area_up[layer])&&(lineRight>area_down[layer])||((lineLeft-area_up[layer])*(area_down[layer]-lineRight)>0)){
998 // hit_combine[m].push_back(k);
999 // if(m==0){
1000 // nHitSelect++;
1001 // if(vec_track_index[k]>=0){nHitSignal_select++;}
1002 // if(vec_track_index[k]>=0&&vec_slant[k]==0){nHitAxialSignal_select++;}
1003 // }
1004 hit_combine[m][count_peak]=k;
1005 //vec_truthHit[m][k]=1;
1006 count_peak++;
1007 }
1008 //else {vec_truthHit[m][k]=0;}
1009 peak_combine_num[m]=count_peak;
1010 //int sizepeak=hit_combine[0].size();
1011 //cout<<"peak1size: "<<sizepeak<<endl;
1012 }
1013 for(int i=n+1;i<npeak1;i++){
1014 if(peaktrack[i]==false) continue;
1015 int peaktheta=peakList1[0][i];
1016 int peakrho=peakList1[1][i];
1017 int peakhitNum=peakList1[2][i];
1018 int count_same_hit=0;
1019 for(int j=0;j<peakhitNum;j++){
1020 //for(int k=0;k<hit_combine[m].size();k++)
1021 for(int k=0;k<peak_combine_num[m];k++){
1022 if(vec_selectNum[peaktheta-1][peakrho-1][j]==hit_combine[m][k]){
1023 count_same_hit++;
1024 }
1025 }
1026 }
1027 double f_hit=m_hit_pro;
1028 if(count_same_hit>f_hit*peakhitNum){
1029 peaktrack[i]=false;
1030 }
1031 }
1032 for(int i=n+1;i<npeak1;i++){
1033 if(peaktrack[i]==true){
1034 addnum=i;
1035 break;
1036 }
1037 }
1038 if(addnum!=0) m++;
1039 cout<<"peak_m: "<<m+1<<endl;
1040 n=n+addnum;
1041 }
1042
1043
1044 for(int i=0;i<npeak1;i++){
1045 cout<<"track"<<i<<": "<<"("<<peakList1[0][i]<<","<<peakList1[1][i]<<","<<peakList1[2][i]<<")"<<" "<<"truth: "<<peaktrack[i]<<endl;
1046 if(peaktrack[i]==true){
1047 peak_track++;
1048 }
1049 }
1050 for( int i=0;i<peak_track;i++){
1051 for(int j =0;j<peak_combine_num[i];j++){
1052 int hit_number=hit_combine[i][j];
1053 cout<<" peak "<<i<<" has select hits: "<<vec_layer[hit_number]<<" "<<vec_wire[hit_number]<<endl;
1054 }
1055 cout<<"has collect :"<<peak_combine_num[i]<<" hits "<<endl;
1056 }
1057 cout<<"event"<<t_eventNum<<": "<<"has found: "<<peak_track<<" track."<<endl;
1058 m_trackNum=peak_track;
1059 //m_nHitSelect=nHitSelect;
1060 //m_nHitSignal_select=nHitSignal_select;
1061 //m_nHitAxialSignal_select=nHitAxialSignal_select;
1062
1063 //according mc and track
1064 vector< vector<int> > rec_mc_num(peak_track,vector<int>(track_index_max,0) );
1065 vector< vector<int> > rec_mc_num_axial(peak_track,vector<int>(track_index_max,0) );
1066 if(track_index_max!=peak_track) cout<<"not match track number !"<<endl;
1067 for(int mc_track_num=0;mc_track_num<track_index_max;mc_track_num++){
1068 for(int i=0;i<peak_track;i++){
1069 for(int j=0;j<peak_combine_num[i];j++){
1070 for(int k=0;k<mc_track_hit[mc_track_num].size();k++){
1071 if(hit_combine[i][j]==mc_track_hit[mc_track_num][k]){
1072 rec_mc_num[i][mc_track_num]++;
1073 int hit_num=mc_track_hit[mc_track_num][k];
1074 if(vec_slant[hit_num]==0) rec_mc_num_axial[i][mc_track_num]++;
1075 }
1076 }
1077 }
1078 }
1079 }
1080 vector<int> rec_mc(peak_track,999);
1081 for(int i=0;i<peak_track;i++){
1082 for(int mc_track_num=0;mc_track_num<track_index_max;mc_track_num++){
1083 if(rec_mc_num[i][mc_track_num]>0.5*peak_combine_num[i]) rec_mc[i]=mc_track_num;
1084 cout<<"trackrec: "<<i<<" trackmc: "<<mc_track_num<<" "<<rec_mc_num[i][mc_track_num]<<" "<<peak_combine_num[i]<<endl;
1085 }
1086 }
1087 for(int i=0;i<peak_track;i++){
1088 cout<<"rec :"<<i<<"belong to mc track: "<<rec_mc[i]<<endl;
1089 }
1090 for(int i=0;i<peak_track;i++){
1091 int mc_track_num=rec_mc[i];
1092 if(mc_track_num!=999) {
1093 cout<<"debug mc_track_num: "<<mc_track_num<<endl;
1094 m_nHitSignal_select[i]=rec_mc_num[i][mc_track_num]; //????????? mc_track_num=999?
1095 m_nHitAxialSignal_select[i]=rec_mc_num_axial[i][mc_track_num]; //????????? mc_track_num=999?
1096 cout<<"m_nHitSignal_select: "<<m_nHitSignal_select[i]<<endl;
1097 }
1098 }
1099
1100 //cout<<"peak1: "<<endl;
1101 //for(int i=0;i<peak_track;i++){
1102 // for(int j=0;j<peak_combine_num[i];j++){
1103 // int hitNumtemp=hit_combine[i][j];
1104 // vec_truthHit[hitNumtemp]=i;
1105 // cout<<" "<<"("<<vec_layer[hitNumtemp]<<","<<vec_wire[hitNumtemp]<<")"<<": "<<vec_track_index[hitNumtemp]<<endl;
1106 // }
1107 //}
1108
1109 // if(peak_track==2){
1110 // cout<<"peak2: "<<endl;
1111 // for(int i=0;i<hit_combine[1].size();i++){
1112 // int hitNumtemp=hit_combine[1][i];
1113 // vec_truthHit[hitNumtemp]=1;
1114 // cout<<" "<<"("<<vec_layer[hitNumtemp]<<","<<vec_wire[hitNumtemp]<<")"<<": "<<vec_track_index[hitNumtemp]<<endl;
1115 // }
1116 // }
1117
1118
1119 }
1120
1121
1122 //yzhang 2015-03-03 delete
1123// //return hit number
1124// if(m_method==0){
1125// vector<int> numCross_select;
1126// vector< vector<bool> > vec_hitSelect(npeak1,vector<bool> (nhit,false) );
1127// vector<int> vec_selectHitNum;
1128// vector<int> vec_selectHitNum_signal;
1129// for(int peakNum=0;peakNum<npeak1;peakNum++){
1130// int peak_cellNum=m_peakCellNum;
1131// // vector<bool> vec_hitSelect(nhit,false);
1132// int peakX=peakList1[0][peakNum];
1133// int peakY=peakList1[1][peakNum];
1134// int bin_left=peakX-peak_cellNum;
1135// int bin_right=peakX+peak_cellNum;
1136// int bin_up=peakY+peak_cellNum;
1137// int bin_down=peakY-peak_cellNum;
1138// double area_left=(bin_left-1)*binwidth;
1139// double area_right=(bin_right)*binwidth;
1140// double area_down=(bin_down-1)*binhigh-t_maxP;
1141// double area_up=(bin_up)*binhigh-t_maxP;
1142// // cout<<"("<<area_left<<","<<area_right<<","<<area_down<<","<<area_up<<")"<<endl;
1143// double peak_width=(2*peak_cellNum+1)*binwidth;
1144// double peak_high=(2*peak_cellNum+1)*binhigh;
1145// //cout<<"the area of the peak is: "<<peak_width*peak_high<<endl;
1146// //test if the hit is in this area
1147// int numCross_select_temp=0;
1148// for(int i=0;i<numCross;i++){
1149// if(vec_theta[i]>=area_left&&vec_theta[i]<area_right&&vec_rho[i]>=area_down&&vec_rho[i]<area_up) {
1150// numCross_select_temp++;
1151// int hitNum_1=vec_hitNum[0][i];
1152// int hitNum_2=vec_hitNum[1][i];
1153// vec_hitSelect[peakNum][hitNum_1]=true;
1154// vec_hitSelect[peakNum][hitNum_2]=true;
1155// }
1156// }
1157// numCross_select.push_back(numCross_select_temp);
1158// int selectHitNum=0;
1159// int selectHitNum_signal=0;
1160// for(int i=0;i<nhit;i++){
1161// if(vec_hitSelect[peakNum][i]==true) {
1162// selectHitNum++;
1163// if(vec_hitSignal[i]==1){
1164// selectHitNum_signal++;
1165// }
1166// // cout<<"if hit is select: "<<i<<": "<<vec_hitSelect[i]<<endl;
1167// }
1168// }
1169// vec_selectHitNum.push_back(selectHitNum);
1170// vec_selectHitNum_signal.push_back(selectHitNum_signal);
1171// // cout<<"hit: "<<selectHitNum<<" "<<(double)selectHitNum/(double)nhit<<endl;
1172// //cout<<"true hit : "<<selectHitNum_signal<<" "<<(double)selectHitNum_signal/(double)nhit<<endl;
1173// m_areaSelectHit=(double)selectHitNum/(double)nhit;
1174// m_areaSelectHit_signal=(double)selectHitNum_signal/(double)nhit;
1175// }
1176//
1177// for(int i=0;i<npeak1;i++){
1178// int selectHitNum=0;
1179// for(int j=0;j<nhit;j++){
1180// if(vec_hitSelect[i][j]==true){
1181// selectHitNum++;
1182// // cout<<"event"<<t_eventNum<<": "<<"peak"<<i<<": "<<"hit: "<<"("<<vec_layer[j]<<","<<vec_wire[j]<<")"<<endl; //cout picked hit
1183// }
1184// }
1185// cout<<"peak"<<i<<": "<<selectHitNum<<" hits"<<endl;
1186// }
1187// // for(int i=0;i<3;i++){
1188// // int bina=peakList1[0][i];
1189// // int binr=peakList1[1][i];
1190// // int hit_peak=peakList1[2][i];
1191// // for(int j=0;j<hit_peak;j++){
1192// // int hitList=vec_selectHit[bina][binr][j];
1193// // cout<<"peaknum: "<<i<<"("<<bina<<","<<binr<<")"<<" "<<peakList1[2][i]<<" hit : "<<hitList<<endl;
1194// // // cout<<"peaknum: "<<i<<"("<<bina<<","<<binr<<")"<<" "<<peakList1[2][i]<<" hit : "<<vec_selectHit[bina][binr][j]<<endl;
1195// // }
1196// // }
1197// //cout<<npeak1<<endl;
1198//
1199// for(int n=0;n<npeak1;n++){
1200// cout<<"peakList1: "<<n<<" "<<"bina: "<<peakList1[0][n]<<" "<<"binr: "<<peakList1[1][n]<<" "<<"houghpeak: "<<peakList1[2][n]<<" "<<"numCross_select:"<<numCross_select[n]<<" "<<" cross: "<<(double)numCross_select[n]/(double)numCross<<" "<<"hit_selectNum: "<<vec_selectHitNum_signal[n]<<" "<<100*(double)vec_selectHitNum_signal[n]/(double)m_nHitSignal<<"% "<<"noise: "<<(double)(vec_selectHitNum[n]-vec_selectHitNum_signal[n])<<endl;
1201// }
1202// }
1203
1204 /*
1205 //combine the neighbor cell
1206 //vector<int> peak_hitList[npeak1];
1207 vector< vector <int> > peak_hitList(npeak1,vector <int> () );
1208 for(int i=0;i<npeak1;i++){
1209 int bina=peakList1[0][i];
1210 int binr=peakList1[1][i];
1211 int hit_peak=peakList1[2][i];
1212 for(int j=0;j<hit_peak;j++){
1213 peak_hitList[i].push_back(vec_selectHit[bina][binr][j]);
1214// cout<<"j: "<<j<<" "<<vec_selectHit[bina][binr][j]<<endl;
1215}
1216
1217for(int a=bina-1;a<=bina+1;a++){
1218for(int rx=binr-1;rx<=binr+1;rx++){
1219int ax;
1220if (a<0) { ax=a+binX; }
1221else if (a>=binX) { ax=a-binX; }
1222else { ax=a; }
1223if ( (ax!=bina || rx!=binr) && rx>=0 && rx<binY) {
1224int hit_around=count[ax][rx];
1225for(int k=0;k<hit_around;k++){
1226bool combine=1;
1227for(int m=0;m<hit_peak;m++){
1228if(vec_selectHit[ax][rx][k]==peak_hitList[i][m]){
1229// cout<<i<<" "<<" "<<ax<<" "<<rx<<" "<<k<<" "<<vec_selectHit[ax][rx][k]<<endl;
1230combine=0;
1231continue;
1232}
1233}
1234if(combine==1) {
1235peak_hitList[i].push_back(vec_selectHit[ax][rx][k]);
1236peakList1[2][i]++;
1237hit_peak++;
1238// cout<<" there is a combine"<<" "<<vec_selectHit[ax][rx][k]<<endl;
1239}
1240}
1241}
1242}
1243}
1244}
1245
1246
1247//for(int n=0;n<npeak1;n++){
1248// cout<<"peakList2: "<<n<<" "<<"a: "<<peakList1[0][n]<<" "<<"r: "<<peakList1[1][n]<<" "<<"houghpeak: "<<peakList1[2][n]<<endl;
1249//}
1250
1251
1252for(int i=0;i<1;i++){
1253int bina=peakList1[0][i];
1254int binr=peakList1[1][i];
1255int hit_peak=peakList1[2][i];
1256for(int j=0;j<hit_peak;j++){
1257int hitList=peak_hitList[i][j];
1258// cout<<"peaknum: "<<i<<"("<<bina<<","<<binr<<")"<<" "<<peakList1[2][i]<<" hit : "<<hitList<<endl;
1259// cout<<"peaknum: "<<i<<"("<<bina<<","<<binr<<")"<<" "<<peakList1[2][i]<<" hit : "<<vec_selectHit[bina][binr][j]<<endl;
1260}
1261}
1262
1263//sort another time
1264int n_max_2;
1265for (int na=0; na<npeak1-1; na++) {
1266n_max_2=na;
1267for (int nb=na+1; nb<npeak1; nb++) {
1268if (peakList1[2][n_max_2]<peakList1[2][nb]) { n_max_2=nb; }
1269}
1270if (n_max_2!=na) { // swap
1271float swap[3];
1272for (int i=0; i<3; i++) {
1273swap[i]=peakList1[i][na];
1274peakList1[i][na]=peakList1[i][n_max_2];
1275peakList1[i][n_max_2]=swap[i];
1276}
1277}
1278}
1279*/
1280
1281// for(int n=0;n<npeak1;n++){
1282// cout<<"peakList3: "<<n<<" "<<"a: "<<peakList1[0][n]<<" "<<"r: "<<peakList1[1][n]<<" "<<"houghpeak: "<<peakList1[2][n]<<endl;
1283// }
1284
1285// int max_count=-999;
1286// for(int i=0;i<binX;i++){
1287// for(int j=0;j<binY;j++){
1288// if(max_count<count[i][j]) {max_count=count[i][j];}
1289// }
1290// }
1291
1292// m_maxCount=max_count;
1293//if(m_debug>0) cout<<"maxcount: "<<max_count<<endl;
1294
1295// for(int i=0;i<binX;i++){
1296// for(int j=0;j<binY;j++){
1297// // cout<<"("<<i<<","<<j<<")"<<" "<<"count: "<<count[i][j]<<" "<<endl;
1298// for(int l=0,m=vec_selectNum[i][j].size();l<m;++l){
1299// if(count[i][j]==max_count){
1300// //int layerId=vec_layer.at(vec_selectNum[i][j].at(l));
1301// //if ((layerId>=8&&layerId<=19)||(layerId>=36)) {
1302// // nHitAxialSelect++;
1303// //}
1304// vec_truthHit[vec_selectNum[i][j][l]]=true;
1305//
1306// }
1307// }
1308// }
1309//}
1310// for(int i=0;i<n;i++){
1311// cout<<"hit:("<<vec_layer[i]<<","<<vec_wire[i]<<")"<<"is"<<vec_truthHit[i]<<endl;
1312// }
1313// cout<<"selected true hits is: "<<endl;
1314
1315//for(int i=0;i<n;i++){
1316// if(vec_truthHit[i]==true){
1317// cout<<"hit:("<<vec_layer[i]<<","<<vec_wire[i]<<")"<<"is"<<vec_truthHit[i]<<" "<<"hitSignal:"<<vec_hitSignal[i]<<endl;
1318// }
1319//}
1320
1321
1322//int nHitAxialSelect=0;
1323//int nHitSelect=0;
1324//int nHitSignal_select=0;
1325//int nHitAxialSignal_select=0;
1326//for(int i=0;i<n;i++){
1327// if(vec_truthHit[i]==false) continue;
1328// nHitSelect++;
1329// if(vec_hitSignal[i]==1) {nHitSignal_select++;}
1330// int layerId=vec_layer[i];
1331// if ((layerId>=8&&layerId<=19)||(layerId>=36)) {
1332// nHitAxialSelect++;
1333// if(vec_hitSignal[i]==1) {nHitAxialSignal_select++;}
1334// }
1335//}
1336//
1337//m_nHitAxialSelect=nHitAxialSelect;
1338//m_nHitSelect=nHitSelect;
1339//
1340//m_nHitSignal_select=nHitSignal_select;
1341//m_nHitAxialSignal_select=nHitAxialSignal_select;
1342
1343// backtransform all track-
1344
1345double d0=-999.;
1346double phi0=-999.;
1347double omega=-999.;
1348double z0=0;
1349double tanl=0;
1350
1351for(track_fit=0;track_fit<peak_track;track_fit++){
1352 for(int i=0;i<nhit;i++){
1353 vec_truthHit[i]=false;
1354 }
1355 cout<<"track: "<<track_fit<<" has select: "<<peak_combine_num[track_fit]<<" hit ."<<endl;
1356 for(int i=0;i<peak_combine_num[track_fit];i++){
1357 int hitNum=hit_combine[track_fit][i];
1358 vec_truthHit[hitNum]=true;
1359 }
1360
1361 int nHitAxialSelect_temp=10;
1362 int leastSquare=LeastSquare(nhit,nHitAxialSelect_temp,vec_x,vec_y,vec_slant,vec_layer,vec_truthHit,d0,phi0,omega);
1363
1364 if(leastSquare==0){
1365
1366 TrkExchangePar tt(d0,phi0,omega,z0,tanl);
1367 TrkCircleMaker circlefactory;
1368 float chisum =0.;
1369 TrkRecoTrk* newTrack = circlefactory.makeTrack(tt, chisum, *m_context, m_bunchT0);
1370 bool permitFlips = true;
1371 bool lPickHits = m_pickHits;
1372 circlefactory.setFlipAndDrop(*newTrack, permitFlips, lPickHits);
1373 // combine hit list
1374 int nDigi = digiToHots(newTrack,vec_truthHit);
1375 int nRecTk = 0;
1376 //if(m_debug>0) newTrack->printAll(std::cout);
1377 //fit
1378 TrkHitList* qhits = newTrack->hits();
1379 TrkErrCode err=qhits->fit();
1380 //cout<<"++++++++++++++++++"<<err.failure()<<endl;
1381 const TrkFit* newFit = newTrack->fitResult();
1382 bool fitSuccess = false;
1383 //test fit result
1384 if (!newFit || (newFit->nActive()<3)) {
1385 if(m_debug>0){
1386 cout << "evt "<<t_eventNum<<" global fit failed ";
1387 if(newFit) cout <<" nAct "<<newFit->nActive();
1388 cout<<endl;
1389 }
1390 //return StatusCode::SUCCESS;
1391 }else{
1392 nRecTk = 1;
1393 fitSuccess = true;
1394 m_nEvtSuccess++;
1395 // if(m_debug>0) cout <<"evt "<<t_eventNum<< " global fit success"<<endl;
1396 if(m_debug>0) newTrack->print(std::cout);
1397
1398 }
1399
1400 vector<int> nfit2d(peak_track,0);
1401 if(m_debug>0) cout<<" hot list:"<<endl;
1402 TrkHotList::hot_iterator hotIter= qhits->hotList().begin();
1403 while (hotIter!=qhits->hotList().end()) {
1404 nfit2d[track_fit]++;
1405 cout <<"(" <<((MdcHit*)(hotIter->hit()))->layernumber()
1406 <<","<<((MdcHit*)(hotIter->hit()))->wirenumber()
1407 <<":"<<hotIter->isActive()<<") ";
1408 hotIter++;
1409 }
1410
1411 m_2d_nFit[track_fit]=nfit2d[track_fit];
1412
1413 //-------------try to out put parameters---
1414 double x_cirtemp;
1415 double y_cirtemp;
1416 double r_temp;
1417 if(err.failure()==0){
1418 //cout<<"++++++++++++++++++"<<err.failure()<<endl;
1419 TrkExchangePar par = newFit->helix(0.);
1420 d0=par.d0();
1421 phi0=par.phi0();
1422 omega=par.omega();
1423 // cout<<"d0: "<<par.d0()<<" "<<"d0temp: "<<-d0_temp<<endl;
1424 // cout<<"phi0: "<<par.phi0()<<" "<<"phi0temp: "<<phi0_temp<<endl;
1425 // cout<<"w: "<<par.omega()<<" "<<"omegatemp: "<<omega_temp<<endl;
1426 // vector<double> b; // vector<double> x_stereo;
1427 r_temp=1./-par.omega();
1428 x_cirtemp=(r_temp-par.d0())*cos(par.phi0()-M_PI/2.);
1429 y_cirtemp=(r_temp-par.d0())*sin(par.phi0()-M_PI/2.);
1430
1431 m_pt[track_fit]=r_temp/333.567;
1432 cout<<"pt_rec: "<<m_pt[track_fit]<<endl;
1433 }
1434 else{
1435 m_nFitFailure[track_fit]=2;
1436 }
1437 //caculate z position
1438
1439 int z_stereoNum= Zposition(nhit,vec_slant,x_cirtemp,y_cirtemp,r_temp,vec_x_east,vec_x_west,vec_y_east, vec_y_west,vec_z_east,vec_z_west, vec_layer, vec_wire,vec_z,vec_zStereo,l,vec_truthHit);
1440 //cout<<"z_stereoNum: "<<z_stereoNum<<endl;
1441 //cout<<"if zposition is finish: "<<endl;
1442
1443 m_zStereoNum=z_stereoNum;
1444 for(int i=0;i<z_stereoNum;i++){
1445
1446 m_zStereoNum=z_stereoNum;
1447 m_zStereo[i]=vec_zStereo[i];
1448 // cout<<"eventNum: "<<t_eventNum<<" "<<"1111111111111111"<<endl;
1449 m_l[i]=l[i];
1450 if(m_debug>0) cout<<" l: "<<m_l[i]<<" "<<"z: "<<vec_zStereo[i]<<endl;
1451 }
1452 // cout<<"333333333333333333"<<endl;
1453
1454 Linefit(z_stereoNum,vec_zStereo,l,tanl,z0);
1455
1456 cout<<"tanl: "<<tanl<<endl;
1457 cout<<"z0: "<<z0<<endl;
1458 z0=dz_mc;
1459 tanl=tanl_mc;
1460 cout<<"tanltruth: "<<tanl<<endl;
1461 cout<<"z0truth: "<<z0<<endl;
1462 //-------------------------------------------5 parameter fit-----------------------
1463
1464 TrkExchangePar tt2(d0,phi0,omega,z0,tanl);
1465 TrkHelixMaker helixfactory;
1466 chisum =0.;
1467 TrkRecoTrk* newTrack2 = helixfactory.makeTrack(tt2, chisum, *m_context, m_bunchT0);
1468 permitFlips = true;
1469 lPickHits = m_pickHits;
1470 helixfactory.setFlipAndDrop(*newTrack2, permitFlips, lPickHits);
1471 // combine hit list
1472 int nDigi2 = digiToHots2(newTrack2,vec_truthHit);
1473 // int nRecTk = 0;
1474 //if(m_debug>0) newTrack->printAll(std::cout);
1475 //fit
1476 TrkHitList* qhits2 = newTrack2->hits();
1477 TrkErrCode err2=qhits2->fit();
1478 //cout<<"++++++++++++++++++"<<err.failure()<<endl;
1479 const TrkFit* newFit2 = newTrack2->fitResult();
1480 // bool fitSuccess = false;
1481
1482 //test fit result
1483 if (!newFit2 || (newFit2->nActive()<5)) {
1484 //fit failed
1485 if(m_debug>0){
1486 cout << "evt "<<t_eventNum<<" global fit failed ";
1487 if(newFit2) cout <<" nAct "<<newFit2->nActive();
1488 cout<<endl;
1489 }
1490 //return StatusCode::SUCCESS;
1491 }else{
1492 //fit success
1493 nFitSucess++;
1494 MdcTrack* mdcTrack = new MdcTrack(newTrack2);
1495 int tkStat = 4;//track find by Hough set stat=4
1496 int tkId = nTdsTk + track_fit;
1497 mdcTrack->storeTrack(tkId, trackList, hitList, tkStat);
1498 nRecTk = 1;
1499 fitSuccess = true;
1500 m_nEvtSuccess++;
1501 // if(m_debug>0) cout <<"evt "<<t_eventNum<< " global fit success"<<endl;
1502 if(m_debug>0) newTrack2->print(std::cout);
1503
1504 }
1505
1506 vector<int> nfit3d(peak_track,0);
1507 if(m_debug>0) cout<<" hot list:"<<endl;
1508 TrkHotList::hot_iterator hotIter2= qhits2->hotList().begin();
1509 while (hotIter2!=qhits2->hotList().end()) {
1510 nfit3d[track_fit]++;
1511 cout <<"(" <<((MdcHit*)(hotIter2->hit()))->layernumber()
1512 <<","<<((MdcHit*)(hotIter2->hit()))->wirenumber()
1513 <<":"<<hotIter2->isActive()<<") ";
1514 hotIter2++;
1515 }
1516
1517 m_3d_nFit[track_fit]=nfit3d[track_fit];
1518
1519 // -------------try to out put parameters---
1520 if(err2.failure()==0){
1521 //cout<<"++++++++++++++++++"<<err2.failure()<<endl;
1522 TrkExchangePar par2 = newFit2->helix(0.);
1523
1524 //cout<<"d0: "<<par2.d0()<<endl;
1525 //cout<<"phi0: "<<par2.phi0()<<endl;
1526 //cout<<"w: "<<par2.omega()<<endl;
1527 //cout<<"z: "<<par2.z0()<<endl;
1528 //cout<<"tanl: "<<par2.tanDip()<<endl;
1529
1530 r_temp=1./-par2.omega();
1531 x_cirtemp=(r_temp-par2.d0())*cos(par2.phi0()-M_PI/2.);
1532 y_cirtemp=(r_temp-par2.d0())*sin(par2.phi0()-M_PI/2.);
1533
1534 m_d0[track_fit]=par2.d0();
1535 m_phi0[track_fit]=par2.phi0();
1536 m_omega[track_fit]=par2.omega();
1537 m_z0[track_fit]=par2.z0();
1538 m_tanl[track_fit]=par2.tanDip();
1539
1540 double pxy=r_temp/333.567;
1541 double pz=pxy*par2.tanDip();
1542 double pxyz=sqrt(pxy*pxy+pz*pz);
1543 m_pt2[track_fit]=pxy;
1544 m_pz[track_fit]=pxy*par2.tanDip();
1545 m_pxyz[track_fit]=pxyz;
1546 cout<<"track"<<track_fit<<": "<<"pt_rec2: "<<m_pt2[track_fit]<<endl;
1547 cout<<"eventNum: "<<t_eventNum<<" "<<"track"<<track_fit<<": "<<"pz_rec: "<<m_pz[track_fit]<<endl;
1548 }
1549 else{
1550 m_nFitFailure[track_fit]=3;
1551 }
1552 // vector<double> b; // vector<double> x_stereo;
1553 // r_temp=1./-par.omega();
1554 // x_cirtemp=(r_temp-par.d0())*cos(par.phi0()-M_PI/2.);
1555 // y_cirtemp=(r_temp-par.d0())*sin(par.phi0()-M_PI/2.);
1556 // if(m_data==0) {
1557 // m_mc_pt=r_temp/333.567;
1558 // cout<<"pt_rec: "<<m_mc_pt<<endl;
1559 // }
1560 // if(m_data==1) {m_pt=r_temp/333.567;}
1561 //
1562 // else{
1563 // if(m_data==0) {m_mc_nfitfailure=2;}
1564 // if(m_data==1){m_nFitFailure=2;}
1565 // }
1566
1567
1568 //------------------------------------clean-------------------------
1569 }
1570 //vector<double>().swap(vec_u);
1571 //vector<double>().swap(vec_v);
1572 //vector<double>().swap(vec_p);
1573 //vector<double>().swap(vec_x);
1574 //vector<double>().swap(vec_y);
1575 //vector<double>().swap(vec_z);
1576 //vector<double>().swap(vec_x_east);
1577 //vector<double>().swap(vec_x_west);
1578 //vector<double>().swap(vec_y_east);
1579 //vector<double>().swap(vec_y_west);
1580 //vector<double>().swap(vec_z_east);
1581 //vector<double>().swap(vec_z_west);
1582 //vector<double>().swap(vec_zStereo);
1583 //vector<double>().swap(l);
1584 //vector<int>().swap(vec_layer);
1585 //vector<int>().swap(vec_wire);
1586}
1587m_nFitSucess=nFitSucess;
1588cout<<" Hough finder find "<<nFitSucess<<" tot "<<nTdsTk<< endl;
1589
1590delete h1;
1591delete h2;
1592cout<<"break: ????"<<endl;
1593ntuplehit->write();
1594cout<<"finish event "<<t_eventNum<<endl;
1595cout<<endl;
1596cout<<endl;
1597return StatusCode::SUCCESS;
1598}
const Int_t n
Double_t x[10]
double sin(const BesAngle a)
double cos(const BesAngle a)
ObjectVector< RecMdcHit > RecMdcHitCol
ObjectVector< RecMdcTrack > RecMdcTrackCol
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35
#define M_PI
Definition: TConstant.h:4
const MdcGeoWire *const Wire(unsigned id)
Definition: MdcGeomSvc.cxx:768
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
Definition: MdcID.cxx:49
static int wire(const Identifier &id)
Definition: MdcID.cxx:54
void storeTrack(int trackId, RecMdcTrackCol *trackList, RecMdcHitCol *hitList, int tkStat)
Definition: MdcTrack.cxx:143
virtual int nActive() const =0
virtual TrkExchangePar helix(double fltL) const =0
TrkErrCode fit()
Definition: TrkHitList.cxx:59
const TrkHotList & hotList() const
Definition: TrkHitList.cxx:51
virtual void print(std::ostream &) const
const TrkFit * fitResult() const
Definition: TrkRecoTrk.cxx:387
bool setFlipAndDrop(TrkRecoTrk &, bool allowFlips, bool allowDrops) const
TrkRecoTrk * makeTrack(const TrkExchangePar &helix, const double chi2, const TrkContext &, double trackT0) const
uint32_t count(const node_t &list)
Definition: node.cxx:42

◆ execute() [2/2]

StatusCode MdcHoughFinder::execute ( )

◆ finalize() [1/2]

StatusCode MdcHoughFinder::finalize ( )

Definition at line 1601 of file MdcHoughFinder.cxx.

1601 {
1602 MsgStream log(msgSvc(), name());
1603 log << MSG::INFO << "in finalize()" << endreq;
1604 return StatusCode::SUCCESS;
1605}

◆ finalize() [2/2]

StatusCode MdcHoughFinder::finalize ( )

◆ initialize() [1/2]

StatusCode MdcHoughFinder::initialize ( )

Definition at line 96 of file MdcHoughFinder.cxx.

96 {
97
98 MsgStream log(msgSvc(), name());
99 log << MSG::INFO << "in initialize()" << endreq;
100
101 StatusCode sc;
102
103 //for(int i=0;i<43;i++) TrkHelixFitter::nSigmaCut[i] = m_helixHitsSigma[i];
104
105 //nfailure=0;
106 IPartPropSvc* p_PartPropSvc;
107 static const bool CREATEIFNOTTHERE(true);
108 sc = service("PartPropSvc", p_PartPropSvc, CREATEIFNOTTHERE);
109 if (!sc.isSuccess() || 0 == p_PartPropSvc) {
110 log << MSG::ERROR << " Could not initialize PartPropSvc" << endreq;
111 return sc;
112 }
113 m_particleTable = p_PartPropSvc->PDT();
114
115 // RawData
116 IRawDataProviderSvc* irawDataProviderSvc;
117 sc = service ("RawDataProviderSvc", irawDataProviderSvc);
118 m_rawDataProviderSvc = dynamic_cast<RawDataProviderSvc*> (irawDataProviderSvc);
119 if ( sc.isFailure() ){
120 log << MSG::FATAL << name()<<" Could not load RawDataProviderSvc!" << endreq;
121 return StatusCode::FAILURE;
122
123 }
124
125 // Geometry
126 IMdcGeomSvc* imdcGeomSvc;
127 sc = service ("MdcGeomSvc", imdcGeomSvc);
128 m_mdcGeomSvc = dynamic_cast<MdcGeomSvc*> (imdcGeomSvc);
129 if ( sc.isFailure() ){
130 log << MSG::FATAL << "Could not load MdcGeoSvc!" << endreq;
131 return StatusCode::FAILURE;
132 }
133
134 sc = service ("MagneticFieldSvc",m_pIMF);
135 if(sc!=StatusCode::SUCCESS) {
136 log << MSG::ERROR << "Unable to open Magnetic field service"<<endreq;
137 }
138 m_bfield = new BField(m_pIMF);
139 log << MSG::INFO << "field z = "<<m_bfield->bFieldNominal()<< endreq;
140
141 m_context = new TrkContextEv(m_bfield);
142
143 Pdt::readMCppTable(m_pdtFile);
144
145 //Get MdcCalibFunSvc
146 IMdcCalibFunSvc* imdcCalibSvc;
147 sc = service ("MdcCalibFunSvc", imdcCalibSvc);
148 m_mdcCalibFunSvc = dynamic_cast<MdcCalibFunSvc*>(imdcCalibSvc);
149 if ( sc.isFailure() ){
150 log << MSG::FATAL << "Could not load MdcCalibFunSvc!" << endreq;
151 return StatusCode::FAILURE;
152 }
153
154 //initialize ntuplehit
155 NTuplePtr nt(ntupleSvc(), "MdcHoughFinder/hit");
156 if ( nt ){
157 ntuplehit = nt;
158 } else {
159 ntuplehit = ntupleSvc()->book("MdcHoughFinder/hit", CLID_ColumnWiseTuple, "hit");
160 if(ntuplehit){
161 ntuplehit->addItem("eventNum", m_eventNum);
162 ntuplehit->addItem("runNum", m_runNum);
163 ntuplehit->addItem("costaCut", m_cosCut);
164 // test the first layer in hough space
165 // ntuplehit->addItem("Layer1Num", m_nLayerNum,0, 43);
166 // ntuplehit->addItem("layer1X", m_nLayerNum, m_layer1X);
167 // ntuplehit->addItem("layer1Y", m_nLayerNum, m_layer1Y);
168 // ntuplehit->addItem("layer1U", m_nLayerNum, m_layer1U);
169 // ntuplehit->addItem("layer1V", m_nLayerNum, m_layer1V);
170
171
172 ntuplehit->addItem("nHitMc", m_nHit_Mc,0, 6796);
173 ntuplehit->addItem("layerMc", m_nHit_Mc, m_layer_Mc);
174 ntuplehit->addItem("cellMc", m_nHit_Mc, m_cell_Mc);
175
176
177 ntuplehit->addItem("nHit", m_nHit,0, 6796);
178 ntuplehit->addItem("layerNhit", 43, m_layerNhit);
179 // ntuplehit->addItem("hitCol", m_nHit, m_hitCol);
180 ntuplehit->addItem("nCross", m_nCross,0, 125000);
181 ntuplehit->addItem("rho", m_nCross, m_rho);
182 ntuplehit->addItem("theta", m_nCross, m_theta);
183
184 ntuplehit->addItem("hitSignal", m_nHit, m_hitSignal);
185 ntuplehit->addItem("layer", m_nHit, m_layer);
186 ntuplehit->addItem("cell", m_nHit, m_cell);
187 ntuplehit->addItem("x_east", m_nHit, m_x_east);
188 ntuplehit->addItem("y_east", m_nHit, m_y_east);
189 ntuplehit->addItem("z_east", m_nHit, m_z_east);
190 ntuplehit->addItem("x_west", m_nHit, m_x_west);
191 ntuplehit->addItem("y_west", m_nHit, m_y_west);
192 ntuplehit->addItem("z_west", m_nHit, m_z_west);
193 ntuplehit->addItem("x", m_nHit, m_x);
194 ntuplehit->addItem("y", m_nHit, m_y);
195 ntuplehit->addItem("z", m_nHit, m_z);
196 ntuplehit->addItem("u", m_nHit, m_u);
197 ntuplehit->addItem("v", m_nHit, m_v);
198 ntuplehit->addItem("p", m_nHit, m_p);
199 ntuplehit->addItem("slant", m_nHit, m_slant);
200 // ntuplehit->addItem("z_stereo", m_stereohit, m_zStereo);
201 // ntuplehit->addItem("z_num", m_stereohit, m_z_num);
202 ntuplehit->addItem("maxCount", m_maxCount);
203
204 ntuplehit->addItem("peakColumn", m_npeak,0,100);
205 ntuplehit->addItem("peakWidth", m_npeak, m_peakWidth);
206 ntuplehit->addItem("peakHigh", m_npeak, m_peakHigh);
207 ntuplehit->addItem("peakArea", m_npeak, m_peakArea);
208 ntuplehit->addItem("peakAreaLeast", m_areaLeast);
209 ntuplehit->addItem("peakAreaLeastNum", m_areaLeastNum);
210 ntuplehit->addItem("peakHitSelect", m_areaSelectHit);
211 ntuplehit->addItem("peakHitSelectSignal", m_areaSelectHit_signal);
212 // ntuplehit->addItem("mc_x", m_Mcnhit, mc_x);
213 // ntuplehit->addItem("mc_y", m_Mcnhit, mc_y);
214 // ntuplehit->addItem("mc_z", m_Mcnhit, mc_z);
215 ntuplehit->addItem("circleCenterX", m_x_circle);
216 ntuplehit->addItem("circleCenterY", m_y_circle);
217 ntuplehit->addItem("circleR", m_r);
218
219
220 ntuplehit->addItem("zStereoNum", m_zStereoNum,0,1000);
221 ntuplehit->addItem("zStereo", m_zStereoNum, m_zStereo );
222 ntuplehit->addItem("l", m_zStereoNum, m_l);
223
224 ntuplehit->addItem("trackNum_Mc", m_trackNum_Mc, 0,100);
225 ntuplehit->addItem("trackNum", m_trackNum, 0,100);
226 ntuplehit->addItem("d0", m_trackNum, m_d0);
227 ntuplehit->addItem("phi0", m_trackNum, m_phi0);
228 ntuplehit->addItem("omega", m_trackNum, m_omega);
229 ntuplehit->addItem("z0", m_trackNum, m_z0);
230 ntuplehit->addItem("tanl", m_trackNum, m_tanl);
231
232 ntuplehit->addItem("pt_rec", m_trackNum, m_pt);
233 ntuplehit->addItem("pt2_rec", m_trackNum, m_pt2);
234 ntuplehit->addItem("pz_rec", m_trackNum, m_pz);
235 ntuplehit->addItem("p_rec", m_trackNum, m_pxyz);
236
237 ntuplehit->addItem("nHitSignal", m_nHitSignal);
238 ntuplehit->addItem("nHitAxialSignal", m_nHitAxialSignal);
239 ntuplehit->addItem("nHitSignal_select", m_trackNum, m_nHitSignal_select);
240 ntuplehit->addItem("nHitAxialSignal_selcet", m_trackNum, m_nHitAxialSignal_select);
241 ntuplehit->addItem("fitFailure", m_trackNum, m_nFitFailure);
242 ntuplehit->addItem("nFit", m_trackNum, m_2d_nFit);
243 ntuplehit->addItem("3dnFit", m_trackNum, m_3d_nFit);
244 ntuplehit->addItem("nHitAxial", m_nHitAxial);
245 ntuplehit->addItem("nFitSucess", m_nFitSucess);
246 // ntuplehit->addItem("nHitAxialSelect", m_nHitAxialSelect);
247 // ntuplehit->addItem("nHitSelect", m_trackNum, m_nHitSelect);
248
249 ntuplehit->addItem("pidTruth", m_pidTruth);
250 ntuplehit->addItem("costaTruth", m_costaTruth);
251 ntuplehit->addItem("phiTruth", m_phi0Truth);
252 ntuplehit->addItem("drTruth", m_drTruth);
253 ntuplehit->addItem("dzTruth", m_dzTruth);
254 ntuplehit->addItem("ptTruth", m_ptTruth);
255 ntuplehit->addItem("pzTruth", m_pzTruth);
256 ntuplehit->addItem("pTruth", m_pTruth);
257 ntuplehit->addItem("qTruth", m_qTruth);
258
259
260 } else { log << MSG::ERROR << "Cannot book tuple MdcHoughFinder/hit" << endmsg;
261 return StatusCode::FAILURE;
262 }
263 }
264
265
266 if(m_debug>2)TrkHelixFitter::m_debug = true;
267
268 return StatusCode::SUCCESS;
269
270
271}
static void readMCppTable(std::string filenm)

◆ initialize() [2/2]

StatusCode MdcHoughFinder::initialize ( )

The documentation for this class was generated from the following files: