210 DotsConnection (
const std::string& name, ISvcLocator* pSvcLocator);
219 if(layer1<layer2) less=
true;
220 else if(layer1==layer2) {
221 int wCell1=myMdcGeomSvc->
Wire(dot1->
id)->
Cell();
222 int wCell2=myMdcGeomSvc->
Wire(dot2->
id)->
Cell();
224 if(fabs(wCell1-wCell2)<0.5*myNWire[layer1]) less=
true;
226 else if(fabs(wCell1-wCell2)>0.5*myNWire[layer1]) less=
true;
257 while(i>0) { it++; i--; }
263 vector<const MdcDigi*> getMdcDigiVec(cell& aCell);
266 bool forward(cell& a, cell& b);
268 void print(cell& aCell);
272 if(l.
S.size()==0)
return false;
273 map<double, int> map_S_i;
274 int n_minus(0), n_plus(0);
275 vector<double>::iterator it_S=l.
S.begin();
277 for(
int i=0; it_S!=l.
S.end(); it_S++,i++)
280 if((*it_S)<0) n_minus++;
282 map_S_i[fabs(*it_S)]=i;
285 if(n_minus==l.
S.size()||n_plus==l.
S.size())
287 map<double, int>::iterator it=map_S_i.begin();
288 for(; it!=map_S_i.end(); it++) l.
order.push_back((*it).second);
315 vector<vector<int> >
CellAutomaton(vector<int>& v_cellIdx, vector<cell>& v_cell, vector<edge>& v_edge);
317 void nextCellFinding(
cell& aCell, vector<cell>& v_cell, vector<edge>& v_edge, map<
int, pair<double,double> >& setWireHitPos, map<int, int>& setWireEntry);
334 double myDriftTimeUpLimit;
335 double myMdcHitChi2Cut;
336 bool myUseWireCrossPoint;
338 bool myWireCrossPointAvgMode;
339 bool myWireCrossPointPersistent;
341 bool myRunIdealTracking;
342 bool myUseInTrkerHits;
346 double getEventStartTime();
355 void getMcFinalChargedStates();
356 vector<int> myVecMCTrkId;
357 vector<int> myVecPDG;
358 vector<double> myVecTrkLenFirstHalf;
359 vector< vector<double> > myVecHelix;
360 vector<Event::CgemMcHit*> myVecCgemMcHit;
361 vector<const RecCgemCluster*> myVecCgemXcluster;
362 vector<const RecCgemCluster*> myVecCgemVcluster;
363 vector<const RecCgemCluster*> myVecCgem1DCluster;
364 vector<int> myVecCgemXCluIdx[3][2];
365 vector<int> myVecCgemVCluIdx[3][2];
366 vector<double> myVecCgemXCluChi[3][2];
367 vector<double> myVecCgemVCluChi[3][2];
368 void clearVecCgemClu() {
369 for(
int l=0; l<3; l++) {
370 for(
int m=0; m<2; m++) {
371 myVecCgemXCluIdx[l][m].clear();
372 myVecCgemVCluIdx[l][m].clear();
373 myVecCgemXCluChi[l][m].clear();
374 myVecCgemVCluChi[l][m].clear();
378 vector<const MdcDigi*> myVecMdcDigi;
380 void associateDigisToMcParticles();
384 const MdcDigi* myMdcDigiPointer[43][288];
385 void clearMdcDigiPointer();
387 vector<const RecCgemCluster*> getCgemClusterVec(
int view=0);
388 double getRoughDD(
const MdcDigi* aMdcDigi);
391 map<int, const MdcDigi*> myMapMdcDigi;
392 map<int, double> myMapMdcDigiDd;
395 vector<int> myOuterEnds;
396 vector<int> myNeighbourSeeds;
397 void clearMdcNeighbours();
398 void fillMdcDigiBuildNeighbors(vector<const MdcDigi*> vecMdcDigiPnt,
int SameLRange=1,
int DiffLRange=1);
399 void fillMdcDigiMap(vector<const MdcDigi*>& vecMdcDigiPnt);
400 void buildMdcDigiNeighbors(map<int, const MdcDigi*>& aMapMdcDigi,
int SameLRange=1,
int DiffLRange=1);
401 void findOuterEnds();
403 void getMdcHitCluster();
406 void mdcHitClustering(
const vector<int>& vecWireIdx, vector<vector<int> >& vecHitClu);
416 int myOuterWire[43][288][2];
417 int myInnerWire[43][288][2];
418 double myWirePhi[43][288];
423 double dPhi(
double phi1,
double phi2);
430 RecCgemClusterCol::iterator myIterCgemClusterBegin;
431 RecCgemClusterCol::iterator myIterCgemClusterEnd;
432 RecCgemClusterCol::iterator myIterClu;
433 vector<int> myVecCgemXClusterIdx[3];
434 vector<int> myVecCgemVClusterIdx[3];
435 vector<int> myVecCgemXClusterTrkIdx[3];
436 vector<int> myVecCgemVClusterTrkIdx[3];
437 bool getCgemClusters();
438 bool getCgemClusterIntersection(
int idx_Xclu,
int idx_Vclu,
double& z);
439 void findCgemTrkSeg();
446 double myChi2CutDiverge;
447 void testDotsHelixFitterAllHits();
448 void testDotsHelixFitterPartHits();
449 double myChiCut_circle;
450 int myNmaxDeact_circle;
451 double myChiCut_helix;
452 int myNmaxDeact_helix;
456 vector<struct trkCandi> myVecTrkCandidates;
457 vector<struct trkCandi> myVecTrkPaths;
458 vector<pair<int, int> > myVecNhitPathId;
460 vector<int> myVecDigiIdx;
461 vector<int> myVecCluIdx;
463 void printTrkCandi(
struct trkCandi& aTrkCandi);
464 int nXHitsActive(
struct trkCandi& aTrkCandi);
465 int setFitFlagUncertain(
struct trkCandi& aTrkCandi,
int layerMin=-1,
int layerMax=50);
466 int setXHitsInBigSetFitFlagUncertain(
struct trkCandi& aTrkCandi,
bool set=
true);
467 vector<const MdcDigi*> getXDigiVec(
struct trkCandi& aTrkCandi,
int sel=0, vector<int>* vecFitFlag=NULL);
469 vector<const MdcDigi*> getVDigiVec(
struct trkCandi& aTrkCandi,
int sel=0);
470 vector<const MdcDigi*> getDigiVec(
struct trkCandi& aTrkCandi,
int sel=0);
471 vector<const RecCgemCluster*> getXCluVec(
struct trkCandi& aTrkCandi,
int sel=0);
472 vector<const RecCgemCluster*> getVCluVec(
struct trkCandi& aTrkCandi,
int sel=0);
473 vector<const RecCgemCluster*> getCluVec(
struct trkCandi& aTrkCandi,
int sel=0);
474 void tagRedudantHits(
struct trkCandi& aTrkCandi);
475 bool split(
struct trkCandi& aTrkCandi,
int idxCandi);
476 void tagClusterHits(
struct trkCandi& aTrkCandi);
477 bool isInOutNeighbours(
struct trkCandi& innerTrkCandi,
struct trkCandi& outerTrkCandi,
int gap=1);
478 bool isInOutNeighbours(
const vector<int>& innerSet,
const vector<int>& outerSet);
479 void combineTrkCandi(
struct trkCandi& trkCandi_1,
struct trkCandi& trkCandi_2);
481 void resetXDigiFitItem(
struct trkCandi& aTrkCandi);
482 void resetVDigiFitItem(
struct trkCandi& aTrkCandi);
483 void updateDigiFitItem(
struct trkCandi& aTrkCandi);
484 void updateCgemFitItem(
struct trkCandi& aTrkCandi,
int assignCgemClu=0);
485 void dropRedundantMdcXDigi(
struct trkCandi& aTrkCandi);
486 void calcuCiclePar3CgemClu(
struct trkCandi& aTrkCandi);
487 std::vector<std::pair<double, double> > findWireCrossPoint(
struct trkCandi& aTrkCandi, vector<double>* ref_track_param=
nullptr);
488 int circleFitTaubin(
struct trkCandi& aTrkCandi,
double chiCut=9999.0,
bool useIniHelx=
false,
int hitSel=1,
bool setHitFitFlag=
false,
int layerMin=-1,
int layerMax=50,
bool use_additional_points=
false,
bool usePhiAmbi=
false,
const vector<double>& vPhiAmb=vector<double>() );
489 void circleFit(
struct trkCandi& aTrkCandi);
490 void matchCgemClusterMdcDigi();
491 void processTrkCandi();
492 void processMdcHitCluter();
493 bool completeTrkCandi(
struct trkCandi& aTrkCandi,
int idxCandi);
494 bool matchMdcDigi(
struct trkCandi& aTrkCandi,
int idx);
495 bool matchCgemXCluster(
struct trkCandi& aTrkCandi);
496 bool selectVHits(
struct trkCandi& aTrkCandi);
497 int helixFit(
struct trkCandi& aTrkCandi,
double chiCut=9999.0,
int layerMin=-1,
int layerMax=50);
498 int saveGoodTrkCandi();
499 void fillVecCgemClu(
struct trkCandi& aTrkCandi);
500 int NXcluToDrop(
struct trkCandi& aTrkCandi);
501 bool isGoodCgemCircleCandi(
struct trkCandi& aTrkCandi);
502 struct trkCandi getTrkCandi(const vector<int>& vecWireIdx);
504 vector<int> getUncommonVec(vector<int> v1, vector<int>& v2);
505 void setMinusVec(set<int>&
s, vector<int>&
v);
512 TH2D myRoughTanlDzMap;
513 int fillTanlDzMap(
double s,
double z,
int vote=3);
514 void getWeightedPeak(TH2D& h,
double& x_peak,
double& y_peak,
double& x_weight,
double&y_weight,
int x_ext=2,
int y_ext=1);
519 void getRhoTheta_bisection(vector<const MdcDigi*>& aVecMdcDigi);
520 TH2D myRoughRhoThetaMap;
523 bool LineFit_TLS(vector<const MdcDigi*>& aVecMdcDigi, vector<double>& vRho, vector<double>& vTheta, vector<vector<int> >& vvLR, vector<vector<double> >& vvS,
bool ini=
false,
double rho_ini=0,
double theta_ini=0,
const vector<int>& LR_ini=vector<int>() );
524 bool isGood_Drho2_line(
double drho2_tls,
int layer=40) {
525 if(drho2_tls<0.025)
return true;
528 double getS(
double rho,
double theta,
double x,
double y) {
533 double r=sqrt(x*x+y*y);
534 double phi=atan2(y,x);
535 double s=r*
sin(theta-phi);
538 void getXY(
double rho,
double theta,
double s,
double& x,
double& y) {
548 vector<vector<double> > getTangentCircles(vector<const MdcDigi*>& aVecMdcDigi);
551 vector<double> getBestTangentCircle(vector<const MdcDigi*>& aVecMdcDigi);
556 bool registerRecMdcTrack();
559 bool saveARecMdcTrack(
int iTrk);
560 bool saveARecMdcTrack(
struct trkCandi& aTrkCandi);
567 Bool_t myWatch_reset;
568 TStopwatch myWatch_tot;
569 TStopwatch myWatch_finding;
570 TStopwatch myWatch_fitting;
573 NTuple::Tuple* myNtHelixFitter;
574 NTuple::Item<int> myRUN;
575 NTuple::Item<int> myEVT;
576 NTuple::Item<int> myPID;
577 NTuple::Item<int> myNPar;
578 NTuple::Item<int> myNXHits;
579 NTuple::Item<int> myNVHits;
580 NTuple::Item<int> myNXCluster;
581 NTuple::Item<int> myNVCluster;
583 NTuple::Array<double> myArrayHelixMC;
584 NTuple::Array<double> myArrayHelixMCInDec;
585 NTuple::Array<double> myArrayHelixFitted;
586 NTuple::Item<int> myNHitsCircle;
587 NTuple::Array<double> myLayerHitsCircle;
588 NTuple::Array<double> myChiHitsCircle;
589 NTuple::Item<int> myNHits;
590 NTuple::Array<double> myLayerHits;
591 NTuple::Array<double> myChiHits;
592 NTuple::Item<int> myTrkIdBest;
593 NTuple::Item<int> myNHitsBestTrk;
594 NTuple::Item<int> myNSameHitsBestTrk;
597 NTuple::Tuple* myNtTrkSeg;
598 NTuple::Item<int> myNt_nhits;
599 NTuple::Array<int> myNt_layer;
600 NTuple::Array<int> myNt_wire;
601 NTuple::Array<double> myNt_Xhit;
602 NTuple::Array<double> myNt_Yhit;
603 NTuple::Array<double> myNt_DDhit;
604 NTuple::Item<double> myNt_rho;
605 NTuple::Item<double> myNt_theta;