#ifndef L1Algo_h #define L1Algo_h 1 #include "L1Field.h" #include "L1Station.h" #include "L1StsHit.h" #include "L1Triplet.h" #include "L1Branch.h" #include "L1Portion.h" #include "L1HitPoint.h" #include "L1Strip.h" #include #include #include #include // using namespace std; using std::vector; using std::map; class L1Algo{ public: void CATrackFinder(); // void KFTrackFitter(); void Init( fscal geo[] ); //local copy of measurements arranged vs station/planes double CATime; // time of trackfinding vector< L1Strip > vStsStrips, vStsStripsB; vector< L1StsHit > vStsHits; vector< unsigned char > vSFlag; // = iStation*4 + used*2 + used_by_duplets; vector< unsigned char > vSFlagB; int StsHitsStartIndex[20], StsHitsStopIndex[20]; vector< L1Track > vTracks; vector< unsigned /*short*/ int > vRecoHits; int NStations; private: L1Station vStations[20] _fvecalignment; L1FieldRegion vtxFieldRegion _fvecalignment; L1FieldValue vtxFieldValue _fvecalignment; vector vTriplets; int TripStartIndex[20], TripStopIndex[20]; int fTrackingLevel, fGhostSuppression; float fMomentumCutOff; /// Different parameters. enum { FIRSTCASTATION = 0 }; //first station used in CA // fNFindIterations - set number of interation for trackfinding // itetation of finding: // isec == 0 - primary fast track // isec == 1 - primary all track // isec == 2 - secondary all track enum { fNFindIterations = 3 }; // different parameters for CATrackFinder, which set at begin CATrackFinder(). Can depend of interation of finding. float TRACK_CHI2_CUT; float Pick_m, Pick_r; fscal MaxInvMom; float SigmaTargetX, SigmaTargetY; // target constraint [cm] // void FitTrack( L1TrackPar &T, /*short*/ unsigned int* vHits, int NHits, bool downstream ); void CAFindTrack(std::vector< L1StsHit > &svStsHits, unsigned int *RealIHit, int ista, const L1Triplet* ptrip, L1Branch& newtrack, unsigned char &new_L, fscal &new_chi2, L1Branch ¤ttrack, unsigned char &curr_L, fscal &curr_chi2, int &NCalls); unsigned char GetFStation( unsigned char flag ){ return flag/4; } bool GetFUsed ( unsigned char flag ){ return (flag&0x02)!=0; } bool GetFUsedD ( unsigned char flag ){ return (flag&0x01)!=0; } void SetFStation ( unsigned char &flag, unsigned iStation ){ flag = iStation*4 + (flag%4); } void SetFUsed ( unsigned char &flag ){ flag |= 0x02; } void SetFUsedD ( unsigned char &flag ){ flag |= 0x01; } void SetFUnUsed ( unsigned char &flag ){ flag &= 0xFC; } void SetFUnUsedD ( unsigned char &flag ){ flag &= 0xFE; } enum { multiCoeff = 1, // central - 1, mbias - coeff = 64, Portion = 1024/coeff, // portion of left hits MaxNStations = 10, MaxPortionDoublets = 10000/5 * 64/2 /coeff /*/ multiCoeff*/*1, MaxPortionTriplets = 10000*5 * 64/2 /coeff /*/ multiCoeff*/*1, MaxNPortion = 40 * coeff / multiCoeff, MaxArrSize = MaxNPortion*MaxPortionDoublets/MaxNStations //200000, // standart size of big arrays // mas be 40000 for normal work in cbmroot! }; /// Prepare the portion of left hits data void f10( // input int start_lh, int n1, L1HitPoint *vStsHits_l, // output fvec *u_front, fvec *u_back, vector &hitsl_1 ); /// Get the field approximation. Add the target to parameters estimation. Propagaete to middle station. void f11( // input int isec, int istal, L1Station *vStations, int n1_V, double MaxInvMom, double Pick_m, fvec targX, fvec targY, fvec targZ, L1FieldValue targB, L1XYMeasurementInfo TargetXYInfo, fvec *u_front, fvec *u_back, // output nsL1::vector::TSimd &T_1, vector &fld_1, fvec* x_minusV, fvec* x_plusV, fvec* y_minusV, fvec* y_plusV ); /// Find the doublets. Reformat data in the portion of doublets. void f20( // input int n1, int istar, int NStations, L1Station &stal, L1Station &stam, L1HitPoint *vStsHits_l, L1HitPoint *vStsHits_m, int NHits_m, fscal *y_minus, fscal *x_minus, fscal *y_plus, fscal *x_plus, nsL1::vector::TSimd &T_1, vector &fld_1, vector &hitsl_1, map &mrDuplets_start, // output int &n2, vector &i1_2, int &start_mhit, vector &hitsm_2, map &lmDuplets_start, vector &lmDuplets_hits, unsigned int &nDuplets_lm, std::vector &vSFlag, std::vector &vSFlagB ); /// Add the middle hits to parameters estimation. Propagate to right station. /// Find the triplets(right hit). Reformat data in the portion of triplets. void f30( // input L1HitPoint *vStsHits_r, L1Station &stam, L1Station &star, int istar, int NStations, int n1, L1HitPoint *vStsHits_m, nsL1::vector::TSimd &T_1,vector &fld_1, vector &hitsl_1, map &lmDuplets_start, vector &lmDuplets_hits, double Pick_r, int n2, vector &hitsm_2, vector &i1_2, map &mrDuplets_start, vector &mrDuplets_hits, // int MaxPortionTriplets, // output int &n3, // L1TrackPar *T_3, nsL1::vector::TSimd &T_3, vector &hitsl_3, vector &hitsm_3, vector &hitsr_3, nsL1::vector_fvec &u_front_3, nsL1::vector_fvec &u_back_3 ); /// Add the right hits to parameters estimation. void f31( // input int n3_V, L1Station &star, nsL1::vector_fvec &u_front_3, nsL1::vector_fvec &u_back_3, // output // L1TrackPar *T_3 nsL1::vector::TSimd &T_3 ); /// Fill vTriplets. void f4( // input int n3, int istal, // L1TrackPar *T_3, nsL1::vector::TSimd &T_3, double TRACK_CHI2_CUT, fscal MaxInvMom, int *StsHitsStartIndex, vector &hitsl_3, vector &hitsm_3, vector &hitsr_3, // output unsigned &nstaltriplets, std::vector &vTriplets, unsigned *TripStartIndexH, unsigned *TripStopIndexH // #ifdef XXX // ,unsigned int &stat_n_trip // #endif ); /// Find neighbours of triplets. void f5( // input int NStations, int *TripStartIndex, int *TripStopIndex, // output std::vector &vTriplets, unsigned *TripStartIndexH, unsigned *TripStopIndexH, int *nlevel ); /// ------------------- doublets on station ---------------------- void DupletsStaPort( // input int isec, int istal, L1Station *vStations, int NStations, int *StsHitsStartIndex, int *StsHitsStopIndex, vector &vSFlag, vector &vSFlagB, std::vector &vStsHits, double Pick_r, double Pick_m, double MaxInvMom, fvec targX, fvec targY, fvec targZ, L1FieldValue &targB, L1XYMeasurementInfo &TargetXYInfo, // int *n_g1, unsigned *portionStopIndex, // L1TrackPar *T_g1, // L1FieldRegion *fld_g1, // unsigned /*short*/ int *hitsl_g1, vector &n_g1, unsigned *portionStopIndex, L1Portion &T_g1, L1Portion &fld_g1, L1Portion &hitsl_g1, // output map *Duplets_start, vector *Duplets_hits, // int *n_g2, // unsigned /*short*/ int *i1_g2, // unsigned /*short*/ int *hitsm_g2 vector &n_g2, L1Portion &i1_g2, L1Portion &hitsm_g2 ); /// ------------------- Triplets on station ---------------------- void TripletsStaPort( // input int isec, int istal, L1Station *vStations, int NStations, int *StsHitsStartIndex, int *StsHitsStopIndex, std::vector &vStsHits, double Pick_r, double TRACK_CHI2_CUT, double MaxInvMom, // int *n_g1, // L1TrackPar *T_g1, // L1FieldRegion *fld_g1, // unsigned /*short*/ int *hitsl_g1, vector &n_g1, L1Portion &T_g1, L1Portion &fld_g1, L1Portion &hitsl_g1, // int *n_g2, unsigned *portionStopIndex, // unsigned /*short*/ int *i1_g2, // unsigned /*short*/ int *hitsm_g2, vector &n_g2, unsigned *portionStopIndex, L1Portion &i1_g2, L1Portion &hitsm_g2, // output map *Duplets_start, vector *Duplets_hits, std::vector *vTriplets_part, unsigned *TripStartIndexH, unsigned *TripStopIndexH ); #ifdef TBB enum { nthreads = 3, // number of threads nblocks = 1 // number of stations on one thread }; friend class ParalleledDup; friend class ParalleledTrip; #endif // TBB } _fvecalignment; #include "L1Algo.cxx" // uncomment if don't use make #include "L1CATrackFinder.cxx" // uncomment if don't use make #endif