CMS 3D CMS Logo

CSCCathodeLCTProcessor.h

Go to the documentation of this file.
00001 #ifndef CSCTriggerPrimitives_CSCCathodeLCTProcessor_h
00002 #define CSCTriggerPrimitives_CSCCathodeLCTProcessor_h
00003 
00031 #include <vector>
00032 #include <FWCore/ParameterSet/interface/ParameterSet.h>
00033 #include <DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h>
00034 #include <DataFormats/CSCDigi/interface/CSCCLCTDigi.h>
00035 #include <CondFormats/CSCObjects/interface/CSCL1TPParameters.h>
00036 #include <L1Trigger/CSCCommonTrigger/interface/CSCConstants.h>
00037 
00038 class CSCCathodeLCTProcessor
00039 {
00040  public:
00042   CSCCathodeLCTProcessor(unsigned endcap, unsigned station, unsigned sector,
00043                          unsigned subsector, unsigned chamber,
00044                          const edm::ParameterSet& conf,
00045                          const edm::ParameterSet& comm);
00046 
00048   CSCCathodeLCTProcessor();
00049 
00051   void setConfigParameters(const CSCL1TPParameters* conf);
00052 
00054   void clear();
00055 
00058   std::vector<CSCCLCTDigi> run(const CSCComparatorDigiCollection* compdc);
00059 
00062   void run(int triad[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_STRIPS],
00063            int time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_STRIPS],
00064            int digiNum[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_STRIPS]);
00065  
00067   bool getDigis(const CSCComparatorDigiCollection* compdc);
00068 
00070   CSCCLCTDigi bestCLCT;
00071 
00073   CSCCLCTDigi secondCLCT;
00074 
00076   std::vector<CSCCLCTDigi> getCLCTs();
00077 
00078   static void distripStagger(int stag_triad[CSCConstants::MAX_NUM_STRIPS],
00079                              int stag_time[CSCConstants::MAX_NUM_STRIPS],
00080                              int stag_digi[CSCConstants::MAX_NUM_STRIPS],
00081                              int i_distrip, bool debug = false);
00082 
00084   enum {NUM_PATTERN_STRIPS = 26};
00085   static const int pre_hit_pattern[2][NUM_PATTERN_STRIPS];
00086   static const int pattern[CSCConstants::NUM_CLCT_PATTERNS_PRE_TMB07][NUM_PATTERN_STRIPS+1];
00087 
00088   bool isTMB07;
00089   enum {NUM_PATTERN_HALFSTRIPS = 42};
00090   static const int pattern2007_offset[NUM_PATTERN_HALFSTRIPS];
00091   static const int pattern2007[CSCConstants::NUM_CLCT_PATTERNS][NUM_PATTERN_HALFSTRIPS+1];
00092   unsigned int best_pid[CSCConstants::NUM_HALF_STRIPS];
00093   unsigned int nhits[CSCConstants::NUM_HALF_STRIPS];
00094 
00095   std::vector<CSCCLCTDigi> findLCTs2007(const int halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS]);
00096   void ptnFinding2007(
00097         const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
00098         const int nStrips, const unsigned int bx_time);
00099   void markBusyKeys(const int best_hstrip, const int best_pid,
00100                     int quality[CSCConstants::NUM_HALF_STRIPS]);
00101 
00103   static const int cfeb_strips[2];
00104 
00106   enum {MAX_CFEBS = 5};
00107 
00108   // we use these next ones to address the various bits inside the array that's
00109   // used to make the cathode LCTs.
00110   enum CLCT_INDICES {CLCT_PATTERN, CLCT_BEND, CLCT_STRIP, CLCT_BX,
00111                      CLCT_STRIP_TYPE, CLCT_QUALITY, CLCT_CFEB};
00112 
00113  private:
00118   int infoV;
00119 
00121   const unsigned theEndcap;
00122   const unsigned theStation;
00123   const unsigned theSector;
00124   const unsigned theSubsector;
00125   const unsigned theTrigChamber;
00126 
00127   int numStrips;
00128   int stagger[CSCConstants::NUM_LAYERS];
00129 
00130   std::vector<CSCComparatorDigi> digiV[CSCConstants::NUM_LAYERS];
00131 
00133   bool isMTCC; 
00134 
00136   unsigned int fifo_tbins,  fifo_pretrig; // only for test beam mode.
00137   unsigned int hit_persist, drift_delay;
00138   unsigned int nplanes_hit_pretrig, nplanes_hit_pattern;
00139   unsigned int pid_thresh_pretrig,  min_separation;
00140 
00142   static const unsigned int def_fifo_tbins,  def_fifo_pretrig;
00143   static const unsigned int def_hit_persist, def_drift_delay;
00144   static const unsigned int def_nplanes_hit_pretrig;
00145   static const unsigned int def_nplanes_hit_pattern;
00146   static const unsigned int def_pid_thresh_pretrig, def_min_separation;
00147 
00149   void setDefaultConfigParameters();
00150 
00152   void checkConfigParameters();
00153 
00154   //----------------------- Default functions ---------------------------------
00155   std::vector<CSCCLCTDigi> findLCTs(const int strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
00156                                     int width, int numStrips);
00157   bool preTrigger(const int strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
00158                   const int stripType, const int nStrips, int& first_bx);
00159   void getKeyStripData(const int strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
00160                        int keystrip_data[CSCConstants::NUM_HALF_STRIPS][7],
00161                        int nStrips, int first_bx, int& best_strip,
00162                        int stripType);
00163   void getPattern(int pattern_num, int strip_value[NUM_PATTERN_STRIPS],
00164                   int bx_time, int &quality, int &bend);
00165   bool hitIsGood(int hitTime, int BX);
00166 
00167   //----------------------- Test Beam Fcns below ----------------------------
00168   std::vector<CSCCLCTDigi> findLCTs(const int halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
00169                                     const int distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS]);
00170   bool preTrigger(const int strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
00171                   unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS], 
00172                   const int stripType, const int nStrips,
00173                   const int start_bx, int& first_bx);
00174   bool preTrigLookUp(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
00175                      const int stripType, const int nStrips,
00176                      const unsigned int bx_time);
00177   void latchLCTs(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
00178                  int keyStrip[MAX_CFEBS], unsigned int nhits[MAX_CFEBS],
00179                  const int stripType, const int nStrips, const int bx_time);
00180   void priorityEncode(const int h_keyStrip[MAX_CFEBS],
00181                       const unsigned int h_nhits[MAX_CFEBS],
00182                       const int d_keyStrip[MAX_CFEBS],
00183                       const unsigned int d_nhits[MAX_CFEBS],
00184                       int keystrip_data[2][7]);
00185   void getKeyStripData(const unsigned int h_pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
00186                        const unsigned int d_pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
00187                        int keystrip_data[2][7], const int first_bx);
00188   void getPattern(unsigned int pattern_num,
00189                   const int strip_value[NUM_PATTERN_STRIPS],
00190                   unsigned int& quality, unsigned int& bend);
00191   //-------------------------------------------------------------------------
00192 
00194   void dumpConfigParams() const;
00195 
00197   void dumpDigis(const int strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
00198                  const int stripType, const int nStrips) const;
00199 
00200   void testDistripStagger();
00201   void testLCTs();
00202   void printPatterns();
00203   void testPatterns();
00204   int findNumLayersHit(int stripsHit[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS]);
00205 };
00206 
00207 #endif

Generated on Tue Jun 9 17:39:59 2009 for CMSSW by  doxygen 1.5.4