CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/L1Trigger/DTBti/interface/DTBtiChip.h

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00014 //
00015 //--------------------------------------------------
00016 #ifndef DT_BTI_CHIP_H
00017 #define DT_BTI_CHIP_H
00018 
00019 //------------------------------------
00020 // Collaborating Class Declarations --
00021 //------------------------------------
00022 class DTBtiHit;
00023 class DTBtiTrig;
00024 class DTBtiTrigData;
00025 class DTDigi;
00026 
00027 //----------------------
00028 // Base Class Headers --
00029 //----------------------
00030 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00031 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
00032 #include "DataFormats/MuonDetId/interface/DTBtiId.h"
00033 #include "L1Trigger/DTUtilities/interface/DTTrigGeom.h"
00034 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfig.h"
00035 #include "L1TriggerConfig/DTTPGConfig/interface/BitArray.h"
00036 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfigBti.h"
00037 #include "L1Trigger/DTBti/interface/DTBtiCard.h"
00038 
00039 //---------------
00040 // C++ Headers --
00041 //---------------
00042 #include <vector>
00043 
00044 //              ---------------------
00045 //              -- Class Interface --
00046 //              ---------------------
00047 
00048 class DTBtiChip {
00049 
00050   public:
00051 
00053   //DTBtiChip(DTTrigGeom* geom, int supl, int n);
00054 
00056   DTBtiChip(DTBtiCard* card, DTTrigGeom* geom, int supl, int n, DTConfigBti* _config );
00057 
00059   DTBtiChip(const DTBtiChip& bti);
00060 
00062   ~DTBtiChip();
00063 
00065   DTBtiChip& operator=(const DTBtiChip& bti);
00066 
00068   void add_digi(int cell, const DTDigi* digi);
00069 
00071   void add_digi_clock(int cell, int clock_digi);
00072 
00074   std::vector<const DTDigi*> get_CellDigis(int cell) { return _digis[cell];}
00075 
00077   void run();
00078 
00080   void clear();
00081 
00084   void addTrig(int step, DTBtiTrig* btitrig);
00085 
00086   // Public const methods
00087 
00089   inline int number() const { return _id.bti(); }
00090 
00092   inline int superlayer() const { return _id.superlayer(); }
00093 
00095   inline LocalPoint localPosition() const { return _geom->localPosition(_id); }
00096 
00098   inline GlobalPoint CMSPosition() const { return _geom->CMSPosition(_id); }
00099 
00101   int nCellHit() const;
00102 
00104   int nTrig(int step) const;
00105 
00106   //  // Return the trigger vector
00107   std::vector<DTBtiTrig*> trigList(int step) const;
00108 
00110   DTBtiTrig* trigger(int step, unsigned n) const;
00111 
00113   DTBtiTrigData triggerData(int step, unsigned n) const;
00114 
00116   //inline DTConfig* config() const { return _geom->config(); }
00117 
00119   inline DTConfigBti* config() const { return _config; }
00120 
00121 
00123   inline DTTrigGeom* geom() const { return _geom; }
00124 
00126   inline DTBtiId id() const { return _id; }
00127 
00129   inline int wheel() const { return _geom->wheel(); }
00130 
00132   inline int station() const { return _geom->station(); }
00133 
00135   inline int sector() const { return _geom->sector(); }
00136 
00137   void init_clock();    // initialization from clocks
00138 
00139 
00140 
00141  private:
00142 
00143   void init(); // initialization
00144   void tick(); // next step (80 MHz)
00145   // return current step (40MHz)
00146   inline int currentStep() const { return (int)(((float)(_curStep)+0.5)/2); }
00147   inline int currentIntStep() const { return _curStep; } // int. step (80MHz)
00148   void computeSums();                                 // compute sums and diffs
00149   void sum(const int s, const int a, const int b);    //   "     a sum and dif
00150   void computeEqs();                                  // compute X and K equat.
00151   void findTrig();                                    // find triggers
00152   int keepTrig(const int eq, const int acp, const int code); // find  a trigger
00153   int keepTrigPatt(int flag, const int eq, const int pattType, int hlflag);//SV
00154   bool matchEq(float eqA, float eqB, int AC);
00155   void acceptMask(BitArray<80> * BitArrPtr,int k,int accep);   
00156   void doLTS();                                   // adjacent LTRIG suppression
00157   int store(const int eq, const int code, const int K, const int X, 
00158              float KeqAB=0., float KeqBC=0., float KeqCD=0., 
00159              float KeqAC=0., float KeqBD=0., float KeqAD=0.); 
00160   void eraseTrigger(int step, unsigned n); // Erase the requested trigger
00161   void setSnap();
00162   void reSumSet(); //remainder table compute
00163   int reSum(int a, int b) { return reSumAr[a][b+2];}
00164   int reSum23(int a, int b) { return reSumAr23[a][b+2];}
00165 
00166  private:
00167 
00168   // parent card
00169   DTBtiCard* _card;
00170 
00171   DTTrigGeom*  _geom;
00172   DTConfigBti* _config;
00173 
00174   DTBtiId _id;
00175 
00176   // input data from DTDigis
00177   std::vector<const DTDigi*> _digis[9];
00178   // input data from clock digis
00179   std::vector<int > _digis_clock[9];
00180 
00181   // output data (ordered by step number)
00182   std::vector<DTBtiTrig*> _trigs[ DTConfig::NSTEPL - DTConfig::NSTEPF+1 ];
00183 
00184   // internal use variables
00185   int _curStep;                      // current step
00186   std::vector<DTBtiHit*> _hits[9];    // current hits in cells
00187   int _thisStepUsedTimes[9];         // current used times in cells (JTRIG)
00188   DTBtiHit* _thisStepUsedHit[9]; // link to currently used hits
00189   int _nStepUsedHits;                // number of currently used hits
00190   float _sums[25], _difs[25];        // time sums and differences 
00191   float _Keq[32][6];                 // The K equations
00192   float _Xeq[32][2];                 // The X equations
00193   int _MinKAcc;                      // min K value accepted by DTBtiChip 
00194   int _MaxKAcc;                      // max K value accepted by DTBtiChip
00195   int _MinKleftTraco;                // K limits for left traco
00196   int _MaxKleftTraco;
00197   int _MinKcenterTraco;              // K limits for center traco
00198   int _MaxKcenterTraco;
00199   int _MinKrightTraco;               // K limits for right traco
00200   int _MaxKrightTraco;
00201 
00202   float _XeqAC_patt0, _XeqBD_patt0;  // special pattern 0 X equations
00203   float _XeqAB_patt0, _XeqCD_patt0;
00204 
00205   float _KTR[32][2];                 //
00206   float _JTR[32][3];                 //
00207   int init_done;                     // initialization flag
00208   int _busyStart_clock[9];            // SV - busy wire flag
00209 
00210   //snap register variables
00211   int ST43, RE43, ST23, RE23, ST, ST2, ST3, ST4, ST5, ST7;
00212   //remainder table
00213   int reSumAr[3][5];
00214   int reSumAr23[3][5];
00215 
00216 };
00217 #endif
00218