00001 //------------------------------------------------- 00002 // 00003 // Class: DTConfigSectColl 00004 // 00005 // Description: Configurable parameters and constants 00006 // for Level1 Mu DT Trigger - TS Phi 00007 // 00008 // 00009 // Author List: 00010 // C. Battilana 00011 // 00012 //----------------------------------------------------------------------- 00013 00014 //----------------------- 00015 // This Class's Header -- 00016 //----------------------- 00017 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfigTSPhi.h" 00018 00019 //--------------- 00020 // C++ Headers -- 00021 //--------------- 00022 #include <iostream> 00023 00024 //------------------------------- 00025 // Collaborating Class Headers -- 00026 //------------------------------- 00027 00028 //---------------- 00029 // Constructors -- 00030 //---------------- 00031 DTConfigTSPhi::DTConfigTSPhi(const edm::ParameterSet& ps) { 00032 00033 setDefaults(ps); 00034 if (debug()) print(); 00035 00036 } 00037 00038 //-------------- 00039 // Destructor -- 00040 //-------------- 00041 DTConfigTSPhi::~DTConfigTSPhi() {} 00042 00043 //-------------- 00044 // Operations -- 00045 //-------------- 00046 00047 void 00048 DTConfigTSPhi::setDefaults(const edm::ParameterSet& ps) { 00049 00050 // Debug flag 00051 m_debug = ps.getUntrackedParameter<bool>("Debug"); 00052 00053 // Order of quaity bits in TSS for sort1 00054 int mymsk = ps.getParameter<int>("TSSMSK1"); 00055 if (checkMask(mymsk)) 00056 m_tssmsk[0] = mymsk; 00057 else { 00058 std::cout << "DTConfigTSPhi::setDefaults : TSSMSK1 not in correct form! Default Used" << std::endl; 00059 m_tssmsk[0] = default_tsmsk; 00060 } 00061 00062 // Order of quaity bits in TSS for sort2 00063 mymsk= ps.getParameter<int>("TSSMSK2"); 00064 if (checkMask(mymsk)) 00065 m_tssmsk[1] = mymsk; 00066 else { 00067 std::cout << "DTConfigTSPhi::setDefaults : TSSMSK2 not in correct form! Default Used" << std::endl; 00068 m_tssmsk[1] = default_tsmsk; 00069 } 00070 00071 // Htrig checking in TSS for sort1 00072 m_tsshte[0] = ps.getParameter<bool>("TSSHTE1"); 00073 00074 // Htrig checking in TSS for sort2 00075 m_tsshte[1] = ps.getParameter<bool>("TSSHTE2"); 00076 00077 // Htrig checking in TSS for carry 00078 m_tsshte[2] = ps.getParameter<bool>("TSSHTEC"); 00079 00080 // Inner SL checking in TSS for sort1 00081 m_tssnoe[0] = ps.getParameter<bool>("TSSNOE1"); 00082 00083 // Inner SL checking in TSS for sort2 00084 m_tssnoe[1] = ps.getParameter<bool>("TSSNOE2"); 00085 00086 // Inner SL checking in TSS for carry 00087 m_tssnoe[2] = ps.getParameter<bool>("TSSNOEC"); 00088 00089 // Correlation checking in TSS for sort1 00090 m_tsscce[0] = ps.getParameter<bool>("TSSCCE1"); 00091 00092 // Correlation checking in TSS for sort2 00093 m_tsscce[1] = ps.getParameter<bool>("TSSCCE2"); 00094 00095 // Correlation checking in TSS for carry 00096 m_tsscce[2] = ps.getParameter<bool>("TSSCCEC"); 00097 00098 // Ghost 1 supperssion option in TSS 00099 int mygs = ps.getParameter<int>("TSSGS1"); 00100 if (mygs>=0 && mygs<3) 00101 m_tssgs1 = mygs; 00102 else { 00103 std::cout << "DTConfigTSPhi::setDefaults : TSSGS1 value is not correct! Default Used" << std::endl; 00104 m_tssgs1 = default_gs; 00105 } 00106 00107 // Ghost 2 supperssion option in TSS 00108 mygs= ps.getParameter<int>("TSSGS2"); 00109 if (mygs>=0 && mygs<5) 00110 m_tssgs2 = mygs; 00111 else { 00112 std::cout << "DTConfigTSPhi::setDefaults : TSSGS2 value is not correct! Default Used" << std::endl; 00113 m_tssgs2 = default_gs; 00114 } 00115 00116 // Correlated ghost 1 supperssion option in TSS 00117 m_tsscgs1 = ps.getParameter<bool>("TSSCGS1"); 00118 00119 // Correlated ghost 2 supperssion option in TSS 00120 m_tsscgs2 = ps.getParameter<bool>("TSSCGS2"); 00121 00122 // Order of quaity bits in TSM for sort1 00123 mymsk = ps.getParameter<int>("TSMMSK1"); 00124 if (checkMask(mymsk)) 00125 m_tsmmsk[0] = mymsk; 00126 else { 00127 std::cout << "DTConfigTSPhi::setDefaults : TSMMSK1 not in correct form! Default Used" << std::endl; 00128 m_tsmmsk[0] = default_tsmsk; 00129 } 00130 00131 // Order of quaity bits in TSM for sort2 00132 mymsk= ps.getParameter<int>("TSMMSK2"); 00133 if (checkMask(mymsk)) 00134 m_tsmmsk[1] = mymsk; 00135 else { 00136 std::cout << "DTConfigTSPhi::setDefaults : TSMMSK2 not in correct form! Default Used" << std::endl; 00137 m_tsmmsk[1] = default_tsmsk; 00138 } 00139 00140 // Htrig checking in TSM for sort1 00141 m_tsmhte[0] = ps.getParameter<bool>("TSMHTE1"); 00142 00143 // Htrig checking in TSM for sort2 00144 m_tsmhte[1] = ps.getParameter<bool>("TSMHTE2"); 00145 00146 // Htrig checking in TSM for carry 00147 m_tsmhte[2] = ps.getParameter<bool>("TSMHTEC"); 00148 00149 // Inner SL checking in TSM for sort1 00150 m_tsmnoe[0] = ps.getParameter<bool>("TSMNOE1"); 00151 00152 // Inner SL checking in TSM for sort2 00153 m_tsmnoe[1] = ps.getParameter<bool>("TSMNOE2"); 00154 00155 // Inner SL checking in TSM for carry 00156 m_tsmnoe[2] = ps.getParameter<bool>("TSMNOEC"); 00157 00158 // Correlation checking in TSM for sort1 00159 m_tsmcce[0] = ps.getParameter<bool>("TSMCCE1"); 00160 00161 // Correlation checking in TSM for sort2 00162 m_tsmcce[1] = ps.getParameter<bool>("TSMCCE2"); 00163 00164 // Correlation checking in TSM for carry 00165 m_tsmcce[2] = ps.getParameter<bool>("TSMCCEC"); 00166 00167 // Ghost 1 supperssion option in TSM 00168 mygs = ps.getParameter<int>("TSMGS1"); 00169 if (mygs>=0 && mygs<3) 00170 m_tsmgs1 = mygs; 00171 else { 00172 std::cout << "DTConfigTSPhi::setDefaults : TSMGS1 value is not correct! Default Used" << std::endl; 00173 m_tsmgs1 = default_gs; 00174 } 00175 00176 // Ghost 2 supperssion option in TSM 00177 mygs= ps.getParameter<int>("TSMGS2"); 00178 if (mygs>=0 && mygs<5) 00179 m_tsmgs2 = mygs; 00180 else { 00181 std::cout << "DTConfigTSPhi::setDefaults : TSMGS2 value is not correct! Default Used" << std::endl; 00182 m_tsmgs2 = default_gs; 00183 } 00184 00185 // Correlated ghost 1 supperssion option in TSM 00186 m_tsmcgs1 = ps.getParameter<bool>("TSMCGS1"); 00187 00188 // Correlated ghost 2 supperssion option in TSM 00189 m_tsmcgs2 = ps.getParameter<bool>("TSMCGS2"); 00190 00191 // Handling carry in case of pile-up 00192 int myhsp = ps.getParameter<int>("TSMHSP"); 00193 if (myhsp>=0 && myhsp<3) 00194 m_tsmhsp = myhsp; 00195 else { 00196 std::cout << "DTConfigTSPhi::setDefaults : TSMHSP value is not correct! Default Used" << std::endl; 00197 m_tsmhsp = default_hsp; 00198 } 00199 00200 // Handling TSMS masking parameters 00201 m_tsmword.one(); 00202 int word = ps.getParameter<int>("TSMWORD"); 00203 if (word<0 || word>255){ 00204 std::cout << "DTConfigTSPhi::setDefaults : TSMWORD value is not correct! Default Used" << std::endl; 00205 word = default_tsmword; 00206 } 00207 for (int i=0;i<7;i++){ 00208 short int bit = word%2; 00209 word /= 2; 00210 if (bit==0) m_tsmword.unset(i); 00211 } 00212 00214 m_tstren.one(); 00215 for (int i=0;i<24;i++){ 00216 std::stringstream os; 00217 os << "TSTREN" << i; 00218 if (ps.getParameter<bool>(os.str())== 0) 00219 m_tstren.unset(i); 00220 } 00221 00222 } 00223 00224 int 00225 DTConfigTSPhi::TSSinTSMD(int stat, int sect) { //CB it should set value when constructor is called (it should be done when we have station by station config) 00226 00227 // Number of TSS for each TSMD (it changes from station to station) The DT stations are indicated in parenthesis 00228 // in the DT column. 00229 // 00230 // MB nb.TSS nb.TTS per TSMD 00231 // 1 3 2 00232 // 2 4 2 00233 // 3 5 3 00234 // 4(1,2,3,5,6,7) 6 3 00235 // 4(8,12) 6 3 00236 // 4(9,11) 3 2 00237 // 4(4L) 5 3 00238 // 4(4R) 5 3 00239 // 4(10L) 4 2 00240 // 4(10R) 4 2 00241 00242 if( stat==1 || 00243 stat==2 || 00244 ( stat==4 && (sect==9 || sect==11 || 00245 sect==10))) { 00246 m_ntsstsmd = 2; 00247 } else { 00248 m_ntsstsmd = 3; 00249 } 00250 00251 return (int)m_ntsstsmd; 00252 00253 } 00254 00255 void 00256 DTConfigTSPhi::print() const { 00257 00258 std::cout << "******************************************************************************" << std::endl; 00259 std::cout << "* DTTrigger configuration : TSPhi chips *" << std::endl; 00260 std::cout << "******************************************************************************" << std::endl << std::endl; 00261 std::cout << "Debug flag : " << debug() << std::endl; 00262 std::cout << " TSS Parameters:" << std::endl; 00263 std::cout << "TSSMSK 1/2:" << TssMasking(0) << " " << TssMasking(1) << std::endl; 00264 std::cout << "TSSHTE 1/2/carry :" << TssHtrigEna(0) << " " << TssHtrigEna(1) << " " << TssHtrigEnaCarry() << std::endl; 00265 std::cout << "TSSNOE 1/2/carry :" << TssInOutEna(0) << " " << TssInOutEna(1) << " " << TssInOutEnaCarry() << std::endl; 00266 std::cout << "TSSCCE 1/2/carry :" << TssCorrEna(0) << " " << TssCorrEna(1) << " " << TssCorrEnaCarry() << std::endl; 00267 std::cout << "TSSGS 1/2:" << TssGhost1Flag() << " " << TssGhost2Flag() << std::endl; 00268 std::cout << "TSSCGS 1/2:" << TssGhost1Corr() << " " << TssGhost2Corr() << std::endl; 00269 std::cout << " TSM Parameters:" << std::endl; 00270 std::cout << "TSMMSK 1/2:" << TsmMasking(0) << " " << TsmMasking(1) << std::endl; 00271 std::cout << "TSMHTE 1/2/carry :" << TsmHtrigEna(0) << " " << TsmHtrigEna(1) << " " << TsmHtrigEnaCarry() << std::endl; 00272 std::cout << "TSMNOE 1/2/carry :" << TsmInOutEna(0) << " " << TsmInOutEna(1) << " " << TsmInOutEnaCarry() << std::endl; 00273 std::cout << "TSMCCE 1/2/carry :" << TsmCorrEna(0) << " " << TsmCorrEna(1) << " " << TsmCorrEnaCarry() << std::endl; 00274 std::cout << "TSMGS 1/2:" << TsmGhost1Flag() << " " << TsmGhost2Flag() << std::endl; 00275 std::cout << "TSMCGS 1/2:" << TsmGhost1Corr() << " " << TsmGhost2Corr() << std::endl; 00276 std::cout << "TSMHSP :" << TsmGetCarryFlag() << std::endl; 00277 std::cout << "TSTREN[i] :"; 00278 for (int i=1;i<25;i++) std::cout << usedTraco(i) << " "; 00279 std::cout << std::endl; 00280 std::cout << "TSMWORD :"; 00281 TsmStatus().print(); 00282 std::cout << std::endl; 00283 // int stat=4, sect=5; 00284 // std::cout << "TSSTSMD(4,14 :" << TSSinTSMD(stat,sect) << std::endl; 00285 std::cout << "******************************************************************************" << std::endl; 00286 00287 } 00288 00289 bool 00290 DTConfigTSPhi::checkMask(int msk){ 00291 00292 bool hasone = false; 00293 bool hastwo = false; 00294 bool hasthree = false; 00295 for(int i=0;i<3;i++){ 00296 int mynum = msk%10; 00297 switch (mynum){ 00298 case 1: 00299 hasone = true; 00300 break; 00301 case 2: 00302 hastwo = true; 00303 break; 00304 case 3: 00305 hasthree =true; 00306 break; 00307 } 00308 msk /= 10; 00309 } 00310 if (hasone==true && hastwo==true && hasthree==true) return true; 00311 return false; 00312 00313 } 00314 00315