00001 #include <L1Trigger/CSCTrackFinder/interface/CSCTFSectorProcessor.h>
00002 #include <L1Trigger/CSCTrackFinder/interface/CSCTrackFinderDataTypes.h>
00003 #include <DataFormats/MuonDetId/interface/CSCTriggerNumbering.h>
00004
00005 #include <FWCore/MessageLogger/interface/MessageLogger.h>
00006
00007 #include "CondFormats/L1TObjects/interface/L1MuCSCTFConfiguration.h"
00008 #include "CondFormats/DataRecord/interface/L1MuCSCTFConfigurationRcd.h"
00009 #include "FWCore/Framework/interface/ESHandle.h"
00010 #include <stdlib.h>
00011 #include <sstream>
00012 #include <strings.h>
00013
00014 const std::string CSCTFSectorProcessor::FPGAs[5] = {"F1","F2","F3","F4","F5"};
00015
00016 CSCTFSectorProcessor::CSCTFSectorProcessor(const unsigned& endcap,
00017 const unsigned& sector,
00018 const edm::ParameterSet& pset,
00019 bool tmb07,
00020 const L1MuTriggerScales* scales,
00021 const L1MuTriggerPtScale* ptScale)
00022 {
00023 m_endcap = endcap;
00024 m_sector = sector;
00025 TMB07 = tmb07;
00026
00027
00028 m_gangedME1a = pset.getUntrackedParameter<bool>("gangedME1a", true);
00029
00030
00031 m_latency = pset.getParameter<unsigned>("CoreLatency");
00032 m_minBX = pset.getParameter<int>("MinBX");
00033 m_maxBX = pset.getParameter<int>("MaxBX");
00034 initializeFromPSet = pset.getParameter<bool>("initializeFromPSet");
00035 if( m_maxBX-m_minBX >= 7 ) edm::LogWarning("CSCTFTrackBuilder::ctor")<<" BX window width >= 7BX. Resetting m_maxBX="<<(m_maxBX=m_minBX+6);
00036
00037
00038 m_bxa_depth = -1;
00039 m_allowALCTonly = -1;
00040 m_allowCLCTonly = -1;
00041 m_preTrigger = -1;
00042
00043 for(int index=0; index<7; index++) m_etawin[index] = -1;
00044 for(int index=0; index<8; index++) m_etamin[index] = -1;
00045 for(int index=0; index<8; index++) m_etamax[index] = -1;
00046
00047 m_mindphip=-1;
00048 m_mindetap=-1;
00049
00050 m_mindeta12_accp=-1;
00051 m_maxdeta12_accp=-1;
00052 m_maxdphi12_accp=-1;
00053
00054 m_mindeta13_accp=-1;
00055 m_maxdeta13_accp=-1;
00056 m_maxdphi13_accp=-1;
00057
00058 m_mindeta112_accp=-1;
00059 m_maxdeta112_accp=-1;
00060 m_maxdphi112_accp=-1;
00061
00062 m_mindeta113_accp=-1;
00063 m_maxdeta113_accp=-1;
00064 m_maxdphi113_accp=-1;
00065 m_mindphip_halo=-1;
00066 m_mindetap_halo=-1;
00067
00068 m_widePhi=-1;
00069
00070 m_straightp=-1;
00071 m_curvedp=-1;
00072
00073 m_mbaPhiOff=-1;
00074 m_mbbPhiOff=-1;
00075
00076 kill_fiber = -1;
00077 QualityEnableME1a = -1;
00078 QualityEnableME1b = -1;
00079 QualityEnableME1c = -1;
00080 QualityEnableME1d = -1;
00081 QualityEnableME1e = -1;
00082 QualityEnableME1f = -1;
00083 QualityEnableME2a = -1;
00084 QualityEnableME2b = -1;
00085 QualityEnableME2c = -1;
00086 QualityEnableME3a = -1;
00087 QualityEnableME3b = -1;
00088 QualityEnableME3c = -1;
00089 QualityEnableME4a = -1;
00090 QualityEnableME4b = -1;
00091 QualityEnableME4c = -1;
00092
00093 run_core = -1;
00094 trigger_on_ME1a = -1;
00095 trigger_on_ME1b = -1;
00096 trigger_on_ME2 = -1;
00097 trigger_on_ME3 = -1;
00098 trigger_on_ME4 = -1;
00099 trigger_on_MB1a = -1;
00100 trigger_on_MB1d = -1;
00101
00102 singlesTrackOutput = 999;
00103 rescaleSinglesPhi = -1;
00104
00105 m_firmSP = -1;
00106 m_firmFA = -1;
00107 m_firmDD = -1;
00108 m_firmVM = -1;
00109
00110 isCoreVerbose = pset.getParameter<bool>("isCoreVerbose");
00111
00112 if(initializeFromPSet) readParameters(pset);
00113
00114
00115
00116 edm::ParameterSet srLUTset = pset.getParameter<edm::ParameterSet>("SRLUT");
00117 for(int i = 1; i <= 4; ++i)
00118 {
00119 if(i == 1)
00120 for(int j = 0; j < 2; j++)
00121 {
00122 srLUTs_[FPGAs[j]] = new CSCSectorReceiverLUT(endcap, sector, j+1, i, srLUTset, TMB07);
00123 }
00124 else
00125 srLUTs_[FPGAs[i]] = new CSCSectorReceiverLUT(endcap, sector, 0, i, srLUTset, TMB07);
00126 }
00127
00128 core_ = new CSCTFSPCoreLogic();
00129
00130
00131 if(initializeFromPSet){
00132 edm::ParameterSet ptLUTset = pset.getParameter<edm::ParameterSet>("PTLUT");
00133 ptLUT_ = new CSCTFPtLUT(ptLUTset, scales, ptScale);
00134 LogDebug("CSCTFSectorProcessor") << "Using stand-alone PT LUT for endcap="<<m_endcap<<", sector="<<m_sector;
00135 } else {
00136 ptLUT_=0;
00137 LogDebug("CSCTFSectorProcessor") << "Looking for PT LUT in EventSetup for endcap="<<m_endcap<<", sector="<<m_sector;
00138 }
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150 firmSP_Map.insert(std::pair<int,int>(20100210,20100122));
00151 firmSP_Map.insert(std::pair<int,int>(20100617,20100122));
00152 firmSP_Map.insert(std::pair<int,int>(20100629,20100122));
00153
00154 firmSP_Map.insert(std::pair<int,int>(20100728,20100728));
00155
00156 firmSP_Map.insert(std::pair<int,int>(20100901,20100901));
00157
00158
00159 firmSP_Map.insert(std::pair<int,int>(20101011,20101011));
00160 firmSP_Map.insert(std::pair<int,int>(20101210,20101210));
00161 firmSP_Map.insert(std::pair<int,int>(20110204,20110118));
00162 firmSP_Map.insert(std::pair<int,int>(20110322,20110118));
00163 }
00164
00165
00166 void CSCTFSectorProcessor::initialize(const edm::EventSetup& c){
00167 if(!initializeFromPSet){
00168
00169 LogDebug("CSCTFSectorProcessor") <<"Initializing endcap: "<<m_endcap<<" sector:"<<m_sector << "SP:" << (m_endcap-1)*6+(m_sector-1);
00170 LogDebug("CSCTFSectorProcessor") << "Initializing pT LUT from EventSetup";
00171
00172 ptLUT_ = new CSCTFPtLUT(c);
00173
00174
00175 edm::ESHandle<L1MuCSCTFConfiguration> config;
00176 c.get<L1MuCSCTFConfigurationRcd>().get(config);
00177
00178 readParameters(config.product()->parameters((m_endcap-1)*6+(m_sector-1)));
00179 }
00180
00181
00182
00183
00184 LogDebug("CSCTFSectorProcessor") << "\n !!! CSCTF EMULATOR CONFIGURATION !!!"
00185 << "\n\nCORE CONFIGURATION"
00186 << "\n Coincidence Trigger? " << run_core
00187 << "\n Singles in ME1a? " << trigger_on_ME1a
00188 << "\n Singles in ME1b? " << trigger_on_ME1b
00189 << "\n Singles in ME2? " << trigger_on_ME2
00190 << "\n Singles in ME3? " << trigger_on_ME3
00191 << "\n Singles in ME4? " << trigger_on_ME4
00192 << "\n Singles in MB1a? " << trigger_on_MB1a
00193 << "\n Singles in MB1d? " << trigger_on_MB1d
00194
00195 << "\n BX Analyzer depth: assemble coinc. track with stubs in +/-" << m_bxa_depth << " Bxs"
00196 << "\n Is Wide Phi Extrapolation (DeltaPhi valid up to ~15 degrees, otherwise ~7.67 degrees)? " << m_widePhi
00197 << "\n PreTrigger=" << m_preTrigger
00198
00199 << "\n CoreLatency=" << m_latency
00200 << "\n Is Phi for singles rescaled? " << rescaleSinglesPhi
00201
00202 << "\n\nVARIOUS CONFIGURATION PARAMETERS"
00203 << "\n Allow ALCT only? " << m_allowALCTonly
00204 << "\n Allow CLCT only? " << m_allowCLCTonly
00205
00206 << "\nQualityEnableME1a (in general accept all LCT qualities, i.e. 0xFFFF is expected)=" << QualityEnableME1a
00207 << "\nQualityEnableME1b (in general accept all LCT qualities, i.e. 0xFFFF is expected)=" << QualityEnableME1b
00208 << "\nQualityEnableME1c (in general accept all LCT qualities, i.e. 0xFFFF is expected)=" << QualityEnableME1c
00209 << "\nQualityEnableME1d (in general accept all LCT qualities, i.e. 0xFFFF is expected)=" << QualityEnableME1d
00210 << "\nQualityEnableME1e (in general accept all LCT qualities, i.e. 0xFFFF is expected)=" << QualityEnableME1e
00211 << "\nQualityEnableME1f (in general accept all LCT qualities, i.e. 0xFFFF is expected)=" << QualityEnableME1f
00212 << "\nQualityEnableME2a (in general accept all LCT qualities, i.e. 0xFFFF is expected)=" << QualityEnableME2a
00213 << "\nQualityEnableME2b (in general accept all LCT qualities, i.e. 0xFFFF is expected)=" << QualityEnableME2b
00214 << "\nQualityEnableME2c (in general accept all LCT qualities, i.e. 0xFFFF is expected)=" << QualityEnableME2c
00215 << "\nQualityEnableME3a (in general accept all LCT qualities, i.e. 0xFFFF is expected)=" << QualityEnableME3a
00216 << "\nQualityEnableME3b (in general accept all LCT qualities, i.e. 0xFFFF is expected)=" << QualityEnableME3b
00217 << "\nQualityEnableME3c (in general accept all LCT qualities, i.e. 0xFFFF is expected)=" << QualityEnableME3c
00218 << "\nQualityEnableME4a (in general accept all LCT qualities, i.e. 0xFFFF is expected)=" << QualityEnableME4a
00219 << "\nQualityEnableME4b (in general accept all LCT qualities, i.e. 0xFFFF is expected)=" << QualityEnableME4b
00220 << "\nQualityEnableME4c (in general accept all LCT qualities, i.e. 0xFFFF is expected)=" << QualityEnableME4c
00221
00222 << "\nkill_fiber=" << kill_fiber
00223 << "\nSingles Output Link=" << singlesTrackOutput
00224
00225
00226
00227
00228 << "\n\nDAT_ETA REGISTERS"
00229 << "\nMinimum eta difference for track cancellation logic=" << m_mindetap
00230 << "\nMinimum eta difference for halo track cancellation logic=" << m_mindetap_halo
00231
00232 << "\nMinimum eta for ME1-ME2 collision tracks=" << m_etamin[0]
00233 << "\nMinimum eta for ME1-ME3 collision tracks=" << m_etamin[1]
00234 << "\nMinimum eta for ME2-ME3 collision tracks=" << m_etamin[2]
00235 << "\nMinimum eta for ME2-ME4 collision tracks=" << m_etamin[3]
00236 << "\nMinimum eta for ME3-ME4 collision tracks=" << m_etamin[4]
00237 << "\nMinimum eta for ME1-ME2 collision tracks in overlap region=" << m_etamin[5]
00238 << "\nMinimum eta for ME2-MB1 collision tracks=" << m_etamin[6]
00239 << "\nMinimum eta for ME1-ME4 collision tracks=" << m_etamin[7]
00240
00241 << "\nMinimum eta difference for ME1-ME2 (except ME1/1) halo tracks=" << m_mindeta12_accp
00242 << "\nMinimum eta difference for ME1-ME3 (except ME1/1) halo tracks=" << m_mindeta13_accp
00243 << "\nMinimum eta difference for ME1/1-ME2 halo tracks=" << m_mindeta112_accp
00244 << "\nMinimum eta difference for ME1/1-ME3 halo tracks=" << m_mindeta113_accp
00245
00246 << "\nMaximum eta for ME1-ME2 collision tracks=" << m_etamax[0]
00247 << "\nMaximum eta for ME1-ME3 collision tracks=" << m_etamax[1]
00248 << "\nMaximum eta for ME2-ME3 collision tracks=" << m_etamax[2]
00249 << "\nMaximum eta for ME2-ME4 collision tracks=" << m_etamax[3]
00250 << "\nMaximum eta for ME3-ME4 collision tracks=" << m_etamax[4]
00251 << "\nMaximum eta for ME1-ME2 collision tracks in overlap region=" << m_etamax[5]
00252 << "\nMaximum eta for ME2-MB1 collision tracks=" << m_etamax[6]
00253 << "\nMaximum eta for ME1-ME4 collision tracks=" << m_etamax[7]
00254
00255 << "\nMaximum eta difference for ME1-ME2 (except ME1/1) halo tracks=" << m_maxdeta12_accp
00256 << "\nMaximum eta difference for ME1-ME3 (except ME1/1) halo tracks=" << m_maxdeta13_accp
00257 << "\nMaximum eta difference for ME1/1-ME2 halo tracks=" << m_maxdeta112_accp
00258 << "\nMaximum eta difference for ME1/1-ME3 halo tracks=" << m_maxdeta113_accp
00259
00260 << "\nEta window for ME1-ME2 collision tracks=" << m_etawin[0]
00261 << "\nEta window for ME1-ME3 collision tracks=" << m_etawin[1]
00262 << "\nEta window for ME2-ME3 collision tracks=" << m_etawin[2]
00263 << "\nEta window for ME2-ME4 collision tracks=" << m_etawin[3]
00264 << "\nEta window for ME3-ME4 collision tracks=" << m_etawin[4]
00265 << "\nEta window for ME1-ME2 collision tracks in overlap region=" << m_etawin[5]
00266 << "\nEta window for ME1-ME4 collision tracks=" << m_etawin[6]
00267
00268 << "\nMaximum phi difference for ME1-ME2 (except ME1/1) halo tracks=" << m_maxdphi12_accp
00269 << "\nMaximum phi difference for ME1-ME3 (except ME1/1) halo tracks=" << m_maxdphi13_accp
00270 << "\nMaximum phi difference for ME1/1-ME2 halo tracks=" << m_maxdphi112_accp
00271 << "\nMaximum phi difference for ME1/1-ME3 halo tracks=" << m_maxdphi113_accp
00272
00273 << "\nMinimum phi difference for track cancellation logic=" << m_mindphip
00274 << "\nMinimum phi difference for halo track cancellation logic=" << m_mindphip_halo
00275
00276 << "\nParameter for the correction of misaligned 1-2-3-4 straight tracks =" << m_straightp
00277 << "\nParameter for the correction of misaligned 1-2-3-4 curved tracks=" << m_curvedp
00278 << "\nPhi Offset for MB1A=" << m_mbaPhiOff
00279 << "\nPhi Offset for MB1D=" << m_mbbPhiOff
00280
00281 << "\nFirmware SP year+month+day:" << m_firmSP
00282 << "\nFirmware FA year+month+day:" << m_firmFA
00283 << "\nFirmware DD year+month+day:" << m_firmDD
00284 << "\nFirmware VM year+month+day:" << m_firmVM;
00285
00286
00287 printDisclaimer(m_firmSP,m_firmFA);
00288
00289
00290
00291 core_ -> SetVerbose(isCoreVerbose);
00292
00293
00294 core_ -> SetSPFirmwareVersion (m_firmSP);
00295
00296
00297 int firmVersCore = firmSP_Map.find(m_firmSP)->second;
00298 core_ -> SetCoreFirmwareVersion (firmVersCore);
00299 edm::LogInfo( "CSCTFSectorProcessor" ) << "\nCore Firmware is set to " << core_ -> GetCoreFirmwareVersion();
00300
00301
00302
00303 if(m_bxa_depth<0) throw cms::Exception("CSCTFSectorProcessor")<<"BXAdepth parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00304 if(m_allowALCTonly<0) throw cms::Exception("CSCTFSectorProcessor")<<"AllowALCTonly parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00305 if(m_allowCLCTonly<0) throw cms::Exception("CSCTFSectorProcessor")<<"AllowCLCTonly parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00306 if(m_preTrigger<0) throw cms::Exception("CSCTFSectorProcessor")<<"PreTrigger parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00307 if(m_mindphip<0) throw cms::Exception("CSCTFSectorProcessor")<<"mindphip parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00308 if(m_mindetap<0) throw cms::Exception("CSCTFSectorProcessor")<<"mindeta parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00309 if(m_straightp<0) throw cms::Exception("CSCTFSectorProcessor")<<"straightp parameter left unitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00310 if(m_curvedp<0) throw cms::Exception("CSCTFSectorProcessor")<<"curvedp parameter left unitialized for endcap="<<m_endcap<<",sector="<<m_sector;
00311 if(m_mbaPhiOff<0) throw cms::Exception("CSCTFSectorProcessor")<<"mbaPhiOff parameter left unitialized for endcap="<<m_endcap<<",sector="<<m_sector;
00312 if(m_mbbPhiOff<0) throw cms::Exception("CSCTFSectorProcessor")<<"mbbPhiOff parameter left unitialized for endcap="<<m_endcap<<",sector="<<m_sector;
00313 if(m_mindeta12_accp<0) throw cms::Exception("CSCTFSectorProcessor")<<"mindeta_accp12 parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00314 if(m_maxdeta12_accp<0) throw cms::Exception("CSCTFSectorProcessor")<<"maxdeta_accp12 parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00315 if(m_maxdphi12_accp<0) throw cms::Exception("CSCTFSectorProcessor")<<"maxdphi_accp12 parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00316 if(m_mindeta13_accp<0) throw cms::Exception("CSCTFSectorProcessor")<<"mindeta_accp13 parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00317 if(m_maxdeta13_accp<0) throw cms::Exception("CSCTFSectorProcessor")<<"maxdeta_accp13 parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00318 if(m_maxdphi13_accp<0) throw cms::Exception("CSCTFSectorProcessor")<<"maxdphi_accp13 parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00319 if(m_mindeta112_accp<0) throw cms::Exception("CSCTFSectorProcessor")<<"mindeta_accp112 parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00320 if(m_maxdeta112_accp<0) throw cms::Exception("CSCTFSectorProcessor")<<"maxdeta_accp112 parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00321 if(m_maxdphi112_accp<0) throw cms::Exception("CSCTFSectorProcessor")<<"maxdphi_accp112 parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00322 if(m_mindeta113_accp<0) throw cms::Exception("CSCTFSectorProcessor")<<"mindeta_accp113 parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00323 if(m_maxdeta113_accp<0) throw cms::Exception("CSCTFSectorProcessor")<<"maxdeta_accp113 parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00324 if(m_maxdphi113_accp<0) throw cms::Exception("CSCTFSectorProcessor")<<"maxdphi_accp113 parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00325 if(m_mindphip_halo<0) throw cms::Exception("CSCTFSectorProcessor")<<"mindphip_halo parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00326 if(m_mindetap_halo<0) throw cms::Exception("CSCTFSectorProcessor")<<"mindetep_halo parameter left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00327
00328 if(m_widePhi<0) throw cms::Exception("CSCTFSectorProcessor")<<"widePhi parameter left unitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00329
00330 for(int index=0; index<8; index++) if(m_etamax[index]<0) throw cms::Exception("CSCTFSectorProcessor")<<"Some ("<<(8-index)<<") of EtaMax parameters left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00331 for(int index=0; index<8; index++) if(m_etamin[index]<0) throw cms::Exception("CSCTFSectorProcessor")<<"Some ("<<(8-index)<<") of EtaMin parameters left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00332 for(int index=0; index<7; index++) if(m_etawin[index]<0) throw cms::Exception("CSCTFSectorProcessor")<<"Some ("<<(6-index)<<") of EtaWindows parameters left uninitialized for endcap="<<m_endcap<<", sector="<<m_sector;
00333 if(kill_fiber<0) throw cms::Exception("CSCTFTrackBuilder")<<"kill_fiber parameter left uninitialized";
00334 if(run_core<0) throw cms::Exception("CSCTFTrackBuilder")<<"run_core parameter left uninitialized";
00335 if(trigger_on_ME1a<0) throw cms::Exception("CSCTFTrackBuilder")<<"trigger_on_ME1a parameter left uninitialized";
00336 if(trigger_on_ME1b<0) throw cms::Exception("CSCTFTrackBuilder")<<"trigger_on_ME1b parameter left uninitialized";
00337 if(trigger_on_ME2 <0) throw cms::Exception("CSCTFTrackBuilder")<<"trigger_on_ME2 parameter left uninitialized";
00338 if(trigger_on_ME3 <0) throw cms::Exception("CSCTFTrackBuilder")<<"trigger_on_ME3 parameter left uninitialized";
00339 if(trigger_on_ME4 <0) throw cms::Exception("CSCTFTrackBuilder")<<"trigger_on_ME4 parameter left uninitialized";
00340 if(trigger_on_MB1a<0) throw cms::Exception("CSCTFTrackBuilder")<<"trigger_on_MB1a parameter left uninitialized";
00341 if(trigger_on_MB1d<0) throw cms::Exception("CSCTFTrackBuilder")<<"trigger_on_MB1d parameter left uninitialized";
00342 if( trigger_on_ME1a>0 || trigger_on_ME1b>0 ||trigger_on_ME2>0 ||
00343 trigger_on_ME3>0 || trigger_on_ME4>0 ||trigger_on_MB1a>0 ||trigger_on_MB1d>0 ){
00344
00345 if(singlesTrackOutput==999) throw cms::Exception("CSCTFTrackBuilder")<<"singlesTrackOutput parameter left uninitialized";
00346 if(rescaleSinglesPhi<0) throw cms::Exception("CSCTFTrackBuilder")<<"rescaleSinglesPhi parameter left uninitialized";
00347 }
00348 if(QualityEnableME1a<0) throw cms::Exception("CSCTFTrackBuilder")<<"QualityEnableME1a parameter left uninitialized";
00349 if(QualityEnableME1b<0) throw cms::Exception("CSCTFTrackBuilder")<<"QualityEnableME1b parameter left uninitialized";
00350 if(QualityEnableME1c<0) throw cms::Exception("CSCTFTrackBuilder")<<"QualityEnableME1c parameter left uninitialized";
00351 if(QualityEnableME1d<0) throw cms::Exception("CSCTFTrackBuilder")<<"QualityEnableME1d parameter left uninitialized";
00352 if(QualityEnableME1e<0) throw cms::Exception("CSCTFTrackBuilder")<<"QualityEnableME1e parameter left uninitialized";
00353 if(QualityEnableME1f<0) throw cms::Exception("CSCTFTrackBuilder")<<"QualityEnableME1f parameter left uninitialized";
00354 if(QualityEnableME2a<0) throw cms::Exception("CSCTFTrackBuilder")<<"QualityEnableME2a parameter left uninitialized";
00355 if(QualityEnableME2b<0) throw cms::Exception("CSCTFTrackBuilder")<<"QualityEnableME2b parameter left uninitialized";
00356 if(QualityEnableME2c<0) throw cms::Exception("CSCTFTrackBuilder")<<"QualityEnableME2c parameter left uninitialized";
00357 if(QualityEnableME3a<0) throw cms::Exception("CSCTFTrackBuilder")<<"QualityEnableME3a parameter left uninitialized";
00358 if(QualityEnableME3b<0) throw cms::Exception("CSCTFTrackBuilder")<<"QualityEnableME3b parameter left uninitialized";
00359 if(QualityEnableME3c<0) throw cms::Exception("CSCTFTrackBuilder")<<"QualityEnableME3c parameter left uninitialized";
00360 if(QualityEnableME4a<0) throw cms::Exception("CSCTFTrackBuilder")<<"QualityEnableME4a parameter left uninitialized";
00361 if(QualityEnableME4b<0) throw cms::Exception("CSCTFTrackBuilder")<<"QualityEnableME4b parameter left uninitialized";
00362 if(QualityEnableME4c<0) throw cms::Exception("CSCTFTrackBuilder")<<"QualityEnableME4c parameter left uninitialized";
00363
00364 if (m_firmSP<1) throw cms::Exception("CSCTFSectorProcessor")<< " firmwareSP parameter left uninitialized!!!\n";
00365 if (m_firmFA<1) throw cms::Exception("CSCTFSectorProcessor")<< " firmwareFA parameter left uninitialized!!!\n";
00366 if (m_firmDD<1) throw cms::Exception("CSCTFSectorProcessor")<< " firmwareDD parameter left uninitialized!!!\n";
00367 if (m_firmVM<1) throw cms::Exception("CSCTFSectorProcessor")<< " firmwareVM parameter left uninitialized!!!\n";
00368
00369 if ( (m_firmFA != m_firmDD) ||
00370 (m_firmFA != m_firmVM) ||
00371 (m_firmDD != m_firmVM) )
00372 throw cms::Exception("CSCTFSectorProcessor")<< " firmwareFA (=" << m_firmFA << "), "
00373 << " firmwareDD (=" << m_firmDD << "), "
00374 << " firmwareVM (=" << m_firmVM << ") are NOT identical: it shoultd NOT happen!";
00375
00376 }
00377
00378 void CSCTFSectorProcessor::readParameters(const edm::ParameterSet& pset){
00379 m_bxa_depth = pset.getParameter<unsigned>("BXAdepth");
00380 m_allowALCTonly = ( pset.getParameter<bool>("AllowALCTonly") ? 1 : 0 );
00381 m_allowCLCTonly = ( pset.getParameter<bool>("AllowCLCTonly") ? 1 : 0 );
00382 m_preTrigger = pset.getParameter<unsigned>("PreTrigger");
00383
00384 std::vector<unsigned>::const_iterator iter;
00385 int index=0;
00386 std::vector<unsigned> etawins = pset.getParameter<std::vector<unsigned> >("EtaWindows");
00387 for(iter=etawins.begin(),index=0; iter!=etawins.end()&&index<7; iter++,index++) m_etawin[index] = *iter;
00388 std::vector<unsigned> etamins = pset.getParameter<std::vector<unsigned> >("EtaMin");
00389 for(iter=etamins.begin(),index=0; iter!=etamins.end()&&index<8; iter++,index++) m_etamin[index] = *iter;
00390 std::vector<unsigned> etamaxs = pset.getParameter<std::vector<unsigned> >("EtaMax");
00391 for(iter=etamaxs.begin(),index=0; iter!=etamaxs.end()&&index<8; iter++,index++) m_etamax[index] = *iter;
00392
00393 m_mindphip = pset.getParameter<unsigned>("mindphip");
00394 m_mindetap = pset.getParameter<unsigned>("mindetap");
00395 m_straightp = pset.getParameter<unsigned>("straightp");
00396 m_curvedp = pset.getParameter<unsigned>("curvedp");
00397 m_mbaPhiOff = pset.getParameter<unsigned>("mbaPhiOff");
00398 m_mbbPhiOff = pset.getParameter<unsigned>("mbbPhiOff");
00399 m_widePhi = pset.getParameter<unsigned>("widePhi");
00400 m_mindeta12_accp = pset.getParameter<unsigned>("mindeta12_accp");
00401 m_maxdeta12_accp = pset.getParameter<unsigned>("maxdeta12_accp");
00402 m_maxdphi12_accp = pset.getParameter<unsigned>("maxdphi12_accp");
00403 m_mindeta13_accp = pset.getParameter<unsigned>("mindeta13_accp");
00404 m_maxdeta13_accp = pset.getParameter<unsigned>("maxdeta13_accp");
00405 m_maxdphi13_accp = pset.getParameter<unsigned>("maxdphi13_accp");
00406 m_mindeta112_accp = pset.getParameter<unsigned>("mindeta112_accp");
00407 m_maxdeta112_accp = pset.getParameter<unsigned>("maxdeta112_accp");
00408 m_maxdphi112_accp = pset.getParameter<unsigned>("maxdphi112_accp");
00409 m_mindeta113_accp = pset.getParameter<unsigned>("mindeta113_accp");
00410 m_maxdeta113_accp = pset.getParameter<unsigned>("maxdeta113_accp");
00411 m_maxdphi113_accp = pset.getParameter<unsigned>("maxdphi113_accp");
00412 m_mindphip_halo = pset.getParameter<unsigned>("mindphip_halo");
00413 m_mindetap_halo = pset.getParameter<unsigned>("mindetap_halo");
00414 kill_fiber = pset.getParameter<unsigned>("kill_fiber");
00415 run_core = pset.getParameter<bool>("run_core");
00416 trigger_on_ME1a = pset.getParameter<bool>("trigger_on_ME1a");
00417 trigger_on_ME1b = pset.getParameter<bool>("trigger_on_ME1b");
00418 trigger_on_ME2 = pset.getParameter<bool>("trigger_on_ME2");
00419 trigger_on_ME3 = pset.getParameter<bool>("trigger_on_ME3");
00420 trigger_on_ME4 = pset.getParameter<bool>("trigger_on_ME4");
00421 trigger_on_MB1a = pset.getParameter<bool>("trigger_on_MB1a");
00422 trigger_on_MB1d = pset.getParameter<bool>("trigger_on_MB1d");
00423
00424 singlesTrackOutput = pset.getParameter<unsigned int>("singlesTrackOutput");
00425 rescaleSinglesPhi = pset.getParameter<bool>("rescaleSinglesPhi");
00426 QualityEnableME1a = pset.getParameter<unsigned int>("QualityEnableME1a");
00427 QualityEnableME1b = pset.getParameter<unsigned int>("QualityEnableME1b");
00428 QualityEnableME1c = pset.getParameter<unsigned int>("QualityEnableME1c");
00429 QualityEnableME1d = pset.getParameter<unsigned int>("QualityEnableME1d");
00430 QualityEnableME1e = pset.getParameter<unsigned int>("QualityEnableME1e");
00431 QualityEnableME1f = pset.getParameter<unsigned int>("QualityEnableME1f");
00432 QualityEnableME2a = pset.getParameter<unsigned int>("QualityEnableME2a");
00433 QualityEnableME2b = pset.getParameter<unsigned int>("QualityEnableME2b");
00434 QualityEnableME2c = pset.getParameter<unsigned int>("QualityEnableME2c");
00435 QualityEnableME3a = pset.getParameter<unsigned int>("QualityEnableME3a");
00436 QualityEnableME3b = pset.getParameter<unsigned int>("QualityEnableME3b");
00437 QualityEnableME3c = pset.getParameter<unsigned int>("QualityEnableME3c");
00438 QualityEnableME4a = pset.getParameter<unsigned int>("QualityEnableME4a");
00439 QualityEnableME4b = pset.getParameter<unsigned int>("QualityEnableME4b");
00440 QualityEnableME4c = pset.getParameter<unsigned int>("QualityEnableME4c");
00441
00442 m_firmSP = pset.getParameter<unsigned int>("firmwareSP");
00443 m_firmFA = pset.getParameter<unsigned int>("firmwareFA");
00444 m_firmDD = pset.getParameter<unsigned int>("firmwareDD");
00445 m_firmVM = pset.getParameter<unsigned int>("firmwareVM");
00446
00447 }
00448
00449 CSCTFSectorProcessor::~CSCTFSectorProcessor()
00450 {
00451 for(int i = 0; i < 5; ++i)
00452 {
00453 if(srLUTs_[FPGAs[i]]) delete srLUTs_[FPGAs[i]];
00454 srLUTs_[FPGAs[i]] = NULL;
00455 }
00456
00457 delete core_;
00458 core_ = NULL;
00459
00460 if(ptLUT_) delete ptLUT_;
00461 ptLUT_ = NULL;
00462 }
00463
00464 bool CSCTFSectorProcessor::run(const CSCTriggerContainer<csctf::TrackStub>& stubs)
00465 {
00466
00467 if( !ptLUT_ )
00468 throw cms::Exception("Initialize CSC TF LUTs first (missed call to CSCTFTrackProducer::beginJob?)")<<"CSCTFSectorProcessor::run";
00469
00470
00471 l1_tracks.clear();
00472 dt_stubs.clear();
00473 stub_vec_filtered.clear();
00474
00475 std::vector<csctf::TrackStub> stub_vec = stubs.get();
00476
00480 for(std::vector<csctf::TrackStub>::const_iterator itr=stub_vec.begin(); itr!=stub_vec.end(); itr++)
00481 switch( itr->station() ){
00482 case 5: stub_vec_filtered.push_back(*itr); break;
00483 case 4:
00484 switch( itr->getMPCLink() ){
00485 case 3: if( (kill_fiber&0x4000)==0 && QualityEnableME4c&(1<<itr->getQuality()) ) stub_vec_filtered.push_back(*itr); break;
00486 case 2: if( (kill_fiber&0x2000)==0 && QualityEnableME4b&(1<<itr->getQuality()) ) stub_vec_filtered.push_back(*itr); break;
00487 case 1: if( (kill_fiber&0x1000)==0 && QualityEnableME4a&(1<<itr->getQuality()) ) stub_vec_filtered.push_back(*itr); break;
00488 default: edm::LogWarning("CSCTFSectorProcessor::run()") << "No MPC sorting for LCT: link="<<itr->getMPCLink()<<"\n";
00489 }
00490 break;
00491 case 3:
00492 switch( itr->getMPCLink() ){
00493 case 3: if( (kill_fiber&0x0800)==0 && QualityEnableME3c&(1<<itr->getQuality()) ) stub_vec_filtered.push_back(*itr); break;
00494 case 2: if( (kill_fiber&0x0400)==0 && QualityEnableME3b&(1<<itr->getQuality()) ) stub_vec_filtered.push_back(*itr); break;
00495 case 1: if( (kill_fiber&0x0200)==0 && QualityEnableME3a&(1<<itr->getQuality()) ) stub_vec_filtered.push_back(*itr); break;
00496 default: edm::LogWarning("CSCTFSectorProcessor::run()") << "No MPC sorting for LCT: link="<<itr->getMPCLink()<<"\n";
00497 }
00498 break;
00499 case 2:
00500 switch( itr->getMPCLink() ){
00501 case 3: if( (kill_fiber&0x0100)==0 && QualityEnableME2c&(1<<itr->getQuality()) ) stub_vec_filtered.push_back(*itr); break;
00502 case 2: if( (kill_fiber&0x0080)==0 && QualityEnableME2b&(1<<itr->getQuality()) ) stub_vec_filtered.push_back(*itr); break;
00503 case 1: if( (kill_fiber&0x0040)==0 && QualityEnableME2a&(1<<itr->getQuality()) ) stub_vec_filtered.push_back(*itr); break;
00504 default: edm::LogWarning("CSCTFSectorProcessor::run()") << "No MPC sorting for LCT: link="<<itr->getMPCLink()<<"\n";
00505 }
00506 break;
00507 case 1:
00508 switch( itr->getMPCLink() + (3*(CSCTriggerNumbering::triggerSubSectorFromLabels(CSCDetId(itr->getDetId().rawId())) - 1)) ){
00509 case 6: if( (kill_fiber&0x0020)==0 && QualityEnableME1f&(1<<itr->getQuality()) ) stub_vec_filtered.push_back(*itr); break;
00510 case 5: if( (kill_fiber&0x0010)==0 && QualityEnableME1e&(1<<itr->getQuality()) ) stub_vec_filtered.push_back(*itr); break;
00511 case 4: if( (kill_fiber&0x0008)==0 && QualityEnableME1d&(1<<itr->getQuality()) ) stub_vec_filtered.push_back(*itr); break;
00512 case 3: if( (kill_fiber&0x0004)==0 && QualityEnableME1c&(1<<itr->getQuality()) ) stub_vec_filtered.push_back(*itr); break;
00513 case 2: if( (kill_fiber&0x0002)==0 && QualityEnableME1b&(1<<itr->getQuality()) ) stub_vec_filtered.push_back(*itr); break;
00514 case 1: if( (kill_fiber&0x0001)==0 && QualityEnableME1a&(1<<itr->getQuality()) ) stub_vec_filtered.push_back(*itr); break;
00515 default: edm::LogWarning("CSCTFSectorProcessor::run()") << "No MPC sorting for LCT: link="<<itr->getMPCLink()<<"\n";
00516 }
00517 break;
00518 default: edm::LogWarning("CSCTFSectorProcessor::run()") << "Invalid station # encountered: "<<itr->station()<<"\n";
00519 }
00520
00529 for(std::vector<csctf::TrackStub>::iterator itr=stub_vec_filtered.begin(); itr!=stub_vec_filtered.end(); itr++)
00530 {
00531 if(itr->station() != 5)
00532 {
00533 CSCDetId id(itr->getDetId().rawId());
00534 unsigned fpga = (id.station() == 1) ? CSCTriggerNumbering::triggerSubSectorFromLabels(id) - 1 : id.station();
00535
00536 lclphidat lclPhi;
00537 try {
00538 lclPhi = srLUTs_[FPGAs[fpga]]->localPhi(itr->getStrip(), itr->getPattern(), itr->getQuality(), itr->getBend());
00539 } catch( cms::Exception &e ) {
00540 bzero(&lclPhi,sizeof(lclPhi));
00541 edm::LogWarning("CSCTFSectorProcessor:run()") << "Exception from LocalPhi LUT in " << FPGAs[fpga]
00542 << "(strip="<<itr->getStrip()<<",pattern="<<itr->getPattern()<<",quality="<<itr->getQuality()<<",bend="<<itr->getBend()<<")" <<std::endl;
00543 }
00544
00545 gblphidat gblPhi;
00546 try {
00547 unsigned csc_id = itr->cscid();
00548 if (!m_gangedME1a) csc_id = itr->cscidSeparateME1a();
00549 gblPhi = srLUTs_[FPGAs[fpga]]->globalPhiME(lclPhi.phi_local, itr->getKeyWG(), csc_id);
00550
00551 } catch( cms::Exception &e ) {
00552 bzero(&gblPhi,sizeof(gblPhi));
00553 edm::LogWarning("CSCTFSectorProcessor:run()") << "Exception from GlobalPhi LUT in " << FPGAs[fpga]
00554 << "(phi_local="<<lclPhi.phi_local<<",KeyWG="<<itr->getKeyWG()<<",csc="<<itr->cscid()<<")"<<std::endl;
00555 }
00556
00557 gbletadat gblEta;
00558 try {
00559 gblEta = srLUTs_[FPGAs[fpga]]->globalEtaME(lclPhi.phi_bend_local, lclPhi.phi_local, itr->getKeyWG(), itr->cscid());
00560 } catch( cms::Exception &e ) {
00561 bzero(&gblEta,sizeof(gblEta));
00562 edm::LogWarning("CSCTFSectorProcessor:run()") << "Exception from GlobalEta LUT in " << FPGAs[fpga]
00563 << "(phi_bend_local="<<lclPhi.phi_bend_local<<",phi_local="<<lclPhi.phi_local<<",KeyWG="<<itr->getKeyWG()<<",csc="<<itr->cscid()<<")"<<std::endl;
00564 }
00565
00566 gblphidat gblPhiDT;
00567 try {
00568 gblPhiDT = srLUTs_[FPGAs[fpga]]->globalPhiMB(lclPhi.phi_local, itr->getKeyWG(), itr->cscid());
00569 } catch( cms::Exception &e ) {
00570 bzero(&gblPhiDT,sizeof(gblPhiDT));
00571 edm::LogWarning("CSCTFSectorProcessor:run()") << "Exception from GlobalPhi DT LUT in " << FPGAs[fpga]
00572 << "(phi_local="<<lclPhi.phi_local<<",KeyWG="<<itr->getKeyWG()<<",csc="<<itr->cscid()<<")"<<std::endl;
00573 }
00574
00575 itr->setEtaPacked(gblEta.global_eta);
00576
00577 if(itr->station() == 1 ) {
00578
00579 itr->setPhiPacked(gblPhiDT.global_phi);
00580 dt_stubs.push_back(*itr);
00581 }
00582
00583
00584
00585
00586 itr->setPhiPacked(gblPhi.global_phi);
00587
00588 LogDebug("CSCTFSectorProcessor:run()") << "LCT found, processed by FPGA: " << FPGAs[fpga] << std::endl
00589 << " LCT now has (eta, phi) of: (" << itr->etaValue() << "," << itr->phiValue() <<")\n";
00590 }
00591 }
00592
00593 CSCTriggerContainer<csctf::TrackStub> processedStubs(stub_vec_filtered);
00594
00601 std::vector<csc::L1Track> tftks;
00602
00603 if(run_core){
00604 core_->loadData(processedStubs, m_endcap, m_sector, m_minBX, m_maxBX);
00605 if( core_->run(m_endcap, m_sector, m_latency,
00606 m_etamin[0], m_etamin[1], m_etamin[2], m_etamin[3],
00607 m_etamin[4], m_etamin[5], m_etamin[6], m_etamin[7],
00608 m_etamax[0], m_etamax[1], m_etamax[2], m_etamax[3],
00609 m_etamax[4], m_etamax[5], m_etamax[6], m_etamax[7],
00610 m_etawin[0], m_etawin[1], m_etawin[2],
00611 m_etawin[3], m_etawin[4], m_etawin[5], m_etawin[6],
00612 m_mindphip, m_mindetap,
00613 m_mindeta12_accp, m_maxdeta12_accp, m_maxdphi12_accp,
00614 m_mindeta13_accp, m_maxdeta13_accp, m_maxdphi13_accp,
00615 m_mindeta112_accp, m_maxdeta112_accp, m_maxdphi112_accp,
00616 m_mindeta113_accp, m_maxdeta113_accp, m_maxdphi113_accp,
00617 m_mindphip_halo, m_mindetap_halo,
00618 m_straightp, m_curvedp,
00619 m_mbaPhiOff, m_mbbPhiOff,
00620 m_bxa_depth, m_allowALCTonly, m_allowCLCTonly, m_preTrigger, m_widePhi,
00621 m_minBX, m_maxBX) )
00622 {
00623 l1_tracks = core_->tracks();
00624 }
00625
00626 tftks = l1_tracks.get();
00627
00633 std::vector<csc::L1Track>::iterator titr = tftks.begin();
00634
00635 for(; titr != tftks.end(); titr++)
00636 {
00637 ptadd thePtAddress(titr->ptLUTAddress());
00638 ptdat thePtData = ptLUT_->Pt(thePtAddress);
00639
00640 if(thePtAddress.track_fr)
00641 {
00642 titr->setRank(thePtData.front_rank);
00643 titr->setChargeValidPacked(thePtData.charge_valid_front);
00644 }
00645 else
00646 {
00647 titr->setRank(thePtData.rear_rank);
00648 titr->setChargeValidPacked(thePtData.charge_valid_rear);
00649 }
00650
00651 if( ((titr->ptLUTAddress()>>16)&0xf)==15 )
00652 {
00653 int unmodBx = titr->bx();
00654 titr->setBx(unmodBx+2);
00655 }
00656 }
00657 }
00658
00659 l1_tracks = tftks;
00660
00661
00662
00663 CSCTriggerContainer<csctf::TrackStub> myStubContainer[7];
00664
00665 if( trigger_on_ME1a || trigger_on_ME1b || trigger_on_ME2 || trigger_on_ME3 || trigger_on_ME4 || trigger_on_MB1a || trigger_on_MB1d )
00666 for(std::vector<csctf::TrackStub>::iterator itr=stub_vec_filtered.begin(); itr!=stub_vec_filtered.end(); itr++){
00667 int station = itr->station()-1;
00668 if(station != 4){
00669 int subSector = CSCTriggerNumbering::triggerSubSectorFromLabels(CSCDetId(itr->getDetId().rawId()));
00670 int mpc = ( subSector ? subSector-1 : station+1 );
00671 if( (mpc==0&&trigger_on_ME1a) || (mpc==1&&trigger_on_ME1b) ||
00672 (mpc==2&&trigger_on_ME2) || (mpc==3&&trigger_on_ME3) ||
00673 (mpc==4&&trigger_on_ME4) ||
00674 (mpc==5&& ( (trigger_on_MB1a&&subSector%2==1) || (trigger_on_MB1d&&subSector%2==0) ) ) ){
00675 int bx = itr->getBX() - m_minBX;
00676 if( bx<0 || bx>=7 ) edm::LogWarning("CSCTFTrackBuilder::buildTracks()") << " LCT BX is out of ["<<m_minBX<<","<<m_maxBX<<") range: "<<itr->getBX();
00677 else
00678 if( itr->isValid() ) myStubContainer[bx].push_back(*itr);
00679 }
00680 }
00681 }
00682
00683
00684
00685 int shift = (m_maxBX + m_minBX)/2 - m_minBX;
00686
00687
00688
00689 CSCTriggerContainer<csc::L1Track> tracksFromSingles;
00690 for(int bx=0; bx<7; bx++)
00691 if( myStubContainer[bx].get().size() ){
00692 bool coreTrackExists = false;
00693
00694 std::vector<csc::L1Track> tracks = l1_tracks.get();
00695 for(std::vector<csc::L1Track>::iterator trk=tracks.begin(); trk<tracks.end(); trk++)
00696 if( (trk->BX() == bx-shift && trk->outputLink() == singlesTrackOutput)
00697 || (((trk->ptLUTAddress()>>16)&0xf)==15 && trk->BX()-2 == bx-shift) ){
00698 coreTrackExists = true;
00699 break;
00700 }
00701 if( coreTrackExists == false ){
00702 csc::L1TrackId trackId(m_endcap,m_sector);
00703 csc::L1Track track(trackId);
00704 track.setBx(bx-shift);
00705 track.setOutputLink(singlesTrackOutput);
00706
00707 std::vector<csctf::TrackStub> stubs = myStubContainer[bx].get();
00708
00709 int qualityME=0, qualityMB=0, ME=100, MB=100, linkME=7;
00710 std::vector<csctf::TrackStub>::const_iterator bestStub=stubs.end();
00711 for(std::vector<csctf::TrackStub>::const_iterator st_iter=stubs.begin(); st_iter!=stubs.end(); st_iter++){
00712 int station = st_iter->station()-1;
00713 int subSector = CSCTriggerNumbering::triggerSubSectorFromLabels(CSCDetId(st_iter->getDetId().rawId()));
00714 int mpc = ( subSector ? subSector-1 : station+1 );
00715
00716 if( mpc==5 && (st_iter->getQuality()>qualityMB || (st_iter->getQuality()==qualityMB&&subSector<MB)) ){
00717 qualityMB = st_iter->getQuality();
00718 MB = subSector;
00719 if(ME>4) bestStub = st_iter;
00720 }
00721
00722 if( mpc<5 && (st_iter->getQuality()> qualityME
00723 || (st_iter->getQuality()==qualityME && mpc< ME)
00724 || (st_iter->getQuality()==qualityME && mpc==ME && st_iter->getMPCLink()<linkME))) {
00725 qualityME = st_iter->getQuality();
00726 ME = mpc;
00727 linkME = st_iter->getMPCLink();
00728 bestStub = st_iter;
00729 }
00730 }
00731 unsigned rescaled_phi = 999;
00732 if (m_firmSP <= 20100210) {
00733
00734
00735
00736 rescaled_phi = unsigned(24*(bestStub->phiPacked()&0x7f)/128.);
00737 }
00738 else {
00739
00740 rescaled_phi = unsigned(24*(bestStub->phiPacked()>>5)/128.);
00741 }
00742
00743 unsigned unscaled_phi = bestStub->phiPacked()>>7 ;
00744 track.setLocalPhi(rescaleSinglesPhi?rescaled_phi:unscaled_phi);
00745 track.setEtaPacked((bestStub->etaPacked()>>2)&0x1f);
00746 switch( bestStub->station() ){
00747 case 1: track.setStationIds(bestStub->getMPCLink(),0,0,0,0); break;
00748 case 2: track.setStationIds(0,bestStub->getMPCLink(),0,0,0); break;
00749 case 3: track.setStationIds(0,0,bestStub->getMPCLink(),0,0); break;
00750 case 4: track.setStationIds(0,0,0,bestStub->getMPCLink(),0); break;
00751 case 5: track.setStationIds(0,0,0,0,bestStub->getMPCLink()); break;
00752 default: edm::LogError("CSCTFSectorProcessor::run()") << "Illegal LCT link="<<bestStub->station()<<"\n"; break;
00753 }
00754
00755
00756 track.setPtLUTAddress( (11<<16) | ((bestStub->etaPacked()<<9)&0xf000) );
00757 ptadd thePtAddress( track.ptLUTAddress() );
00758 ptdat thePtData = ptLUT_->Pt(thePtAddress);
00759 if( thePtAddress.track_fr ){
00760 track.setRank(thePtData.front_rank);
00761 track.setChargeValidPacked(thePtData.charge_valid_front);
00762 } else {
00763 track.setRank(thePtData.rear_rank);
00764 track.setChargeValidPacked(thePtData.charge_valid_rear);
00765 }
00766 tracksFromSingles.push_back(track);
00767 }
00768 }
00769 std::vector<csc::L1Track> single_tracks = tracksFromSingles.get();
00770 if( single_tracks.size() ) l1_tracks.push_many(single_tracks);
00771
00772
00773 return (l1_tracks.get().size() > 0);
00774 }
00775
00776
00777 void CSCTFSectorProcessor::printDisclaimer(int firmSP, int firmFA){
00778
00779 edm::LogInfo( "CSCTFSectorProcessor" ) << "\n\n"
00780 << "******************************* \n"
00781 << "*** DISCLAIMER *** \n"
00782 << "******************************* \n"
00783 << "\n Firmware SP version (year+month+day)=" << firmSP
00784 << "\n Firmware FA/VM/DD version (year+month+day)=" << firmFA;
00785 if (firmSP==20100210)
00786 edm::LogInfo( "CSCTFSectorProcessor" ) << " -> KNOWN BUGS IN THE FIRMWARE:\n"
00787 << "\t * Wrong phi assignment for singles\n"
00788 << "\t * Wrapper passes to the core only even quality DT stubs\n"
00789 << "\n -> BUGS ARE GOING TO BE EMULATED BY THE SOFTWARE\n\n";
00790
00791 else
00792 edm::LogInfo( "CSCTFSectorProcessor" ) << "\t * Correct phi assignment for singles\n";
00793
00794 if (firmSP==20100629){
00795 edm::LogInfo( "CSCTFSectorProcessor" ) << "\t * Correct MB quality masking in the wrapper\n"
00796 << "\t * Core is 20100122\n";
00797 }
00798
00799 if (firmSP==20100728)
00800 edm::LogInfo( "CSCTFSectorProcessor" ) << "\t * Inverted MB clocks\n";
00801
00802 if (firmSP==20100901)
00803 edm::LogInfo( "CSCTFSectorProcessor" ) << "\t * Inverted charge bit\n";
00804
00805 if (firmSP==20101011)
00806 edm::LogInfo( "CSCTFSectorProcessor" ) << "\t **** WARNING THIS FIRMWARE IS UNDER TEST ****\n"
00807 << "\t * Added CSC-DT assembling tracks ME1-MB2/1 \n";
00808 if (firmSP==20101210)
00809 edm::LogInfo( "CSCTFSectorProcessor" ) << "\t **** WARNING THIS FIRMWARE IS UNDER TEST ****\n"
00810 << "\t * New Ghost Busting Algorithm Removing Tracks\n"
00811 << "\t Sharing at Least One LCT\n";
00812
00813 if (firmSP==20110118)
00814 edm::LogInfo( "CSCTFSectorProcessor" ) << "\t **** WARNING THIS FIRMWARE IS UNDER TEST ****\n"
00815 << "\t * New Ghost Busting Algorithm Removing Tracks\n"
00816 << "\t Sharing at Least One LCT\n"
00817 << "\t * Passing CLCT and PhiBend for PT LUTs\n";
00818 }