00001 #ifndef CSCTriggerPrimitives_CSCAnodeLCTProcessor_h 00002 #define CSCTriggerPrimitives_CSCAnodeLCTProcessor_h 00003 00021 #include <vector> 00022 #include <FWCore/ParameterSet/interface/ParameterSet.h> 00023 #include <DataFormats/CSCDigi/interface/CSCWireDigiCollection.h> 00024 #include <DataFormats/CSCDigi/interface/CSCALCTDigi.h> 00025 #include <CondFormats/CSCObjects/interface/CSCL1TPParameters.h> 00026 #include <L1Trigger/CSCCommonTrigger/interface/CSCConstants.h> 00027 00028 class CSCAnodeLCTProcessor 00029 { 00030 public: 00032 CSCAnodeLCTProcessor(unsigned endcap, unsigned station, unsigned sector, 00033 unsigned subsector, unsigned chamber, 00034 const edm::ParameterSet& conf, 00035 const edm::ParameterSet& comm); 00036 00038 CSCAnodeLCTProcessor(); 00039 00041 void setConfigParameters(const CSCL1TPParameters* conf); 00042 00044 void clear(); 00045 00048 std::vector<CSCALCTDigi> run(const CSCWireDigiCollection* wiredc); 00049 00052 void run(const std::vector<int> wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]); 00053 00055 bool getDigis(const CSCWireDigiCollection* wiredc); 00056 00058 enum {MAX_ALCT_BINS = 16}; 00059 00065 CSCALCTDigi bestALCT[MAX_ALCT_BINS]; 00066 00068 CSCALCTDigi secondALCT[MAX_ALCT_BINS]; 00069 00071 std::vector<CSCALCTDigi> getALCTs(); 00072 00074 enum {NUM_PATTERN_WIRES = 14}; 00075 static const int pattern_envelope[CSCConstants::NUM_ALCT_PATTERNS][NUM_PATTERN_WIRES]; 00076 static const int pattern_mask_default[CSCConstants::NUM_ALCT_PATTERNS][NUM_PATTERN_WIRES]; 00077 static const int pattern_mask_MTCC[CSCConstants::NUM_ALCT_PATTERNS][NUM_PATTERN_WIRES]; 00078 00079 private: 00084 int infoV; 00085 00087 const unsigned theEndcap; 00088 const unsigned theStation; 00089 const unsigned theSector; 00090 const unsigned theSubsector; 00091 const unsigned theTrigChamber; 00092 00093 int numWireGroups; 00094 int MESelection; 00095 00096 int first_bx[CSCConstants::MAX_NUM_WIRES]; 00097 int quality[CSCConstants::MAX_NUM_WIRES][3]; 00098 std::vector<CSCWireDigi> digiV[CSCConstants::NUM_LAYERS]; 00099 unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]; 00100 00102 bool isMTCC; 00103 00105 bool isTMB07; 00106 00108 unsigned int fifo_tbins, fifo_pretrig, drift_delay; 00109 unsigned int nplanes_hit_pretrig, nplanes_hit_accel_pretrig; 00110 unsigned int nplanes_hit_pattern, nplanes_hit_accel_pattern; 00111 unsigned int trig_mode, accel_mode, l1a_window_width; 00112 00114 static const unsigned int def_fifo_tbins, def_fifo_pretrig; 00115 static const unsigned int def_drift_delay; 00116 static const unsigned int def_nplanes_hit_pretrig, def_nplanes_hit_pattern; 00117 static const unsigned int def_nplanes_hit_accel_pretrig; 00118 static const unsigned int def_nplanes_hit_accel_pattern; 00119 static const unsigned int def_trig_mode, def_accel_mode; 00120 static const unsigned int def_l1a_window_width; 00121 00123 int pattern_mask[CSCConstants::NUM_ALCT_PATTERNS][NUM_PATTERN_WIRES]; 00124 00126 void setDefaultConfigParameters(); 00127 00129 void checkConfigParameters(); 00130 00132 void clear(const int wire, const int pattern); 00133 00135 void readWireDigis(std::vector<int> wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]); 00136 bool pulseExtension(const std::vector<int> wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]); 00137 bool preTrigger(const int key_wire, const int start_bx); 00138 bool patternDetection(const int key_wire); 00139 void ghostCancellationLogic(); 00140 void lctSearch(); 00141 void trigMode(const int key_wire); 00142 void accelMode(const int key_wire); 00143 00144 std::vector<CSCALCTDigi> 00145 bestTrackSelector(const std::vector<CSCALCTDigi>& all_alcts); 00146 bool isBetterALCT(const CSCALCTDigi& lhsALCT, const CSCALCTDigi& rhsALCT); 00147 00149 void dumpConfigParams() const; 00150 00152 void dumpDigis(const std::vector<int> wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) const; 00153 00154 void showPatterns(const int key_wire); 00155 }; 00156 00157 #endif