00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "DQM/L1TMonitor/interface/L1TCSCTF.h"
00011 #include "DQMServices/Core/interface/DQMStore.h"
00012
00013
00014 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
00015 #include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h"
00016 #include "DataFormats/L1CSCTrackFinder/interface/L1CSCStatusDigiCollection.h"
00017 #include "L1Trigger/CSCCommonTrigger/interface/CSCTriggerGeometry.h"
00018 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00019
00020 #include "DataFormats/L1CSCTrackFinder/interface/CSCTriggerContainer.h"
00021 #include "DataFormats/L1CSCTrackFinder/interface/TrackStub.h"
00022
00023
00024 using namespace std;
00025 using namespace edm;
00026
00027 L1TCSCTF::L1TCSCTF(const ParameterSet& ps)
00028
00029
00030 : gmtProducer( ps.getParameter< InputTag >("gmtProducer") ),
00031 lctProducer( ps.getParameter< InputTag >("lctProducer") ),
00032 trackProducer( ps.getParameter< InputTag >("trackProducer") ),
00033 statusProducer( ps.getParameter< InputTag >("statusProducer") ),
00034 mbProducer( ps.getParameter< InputTag >("mbProducer") )
00035 {
00036
00037
00038 verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
00039
00040 if(verbose_) edm::LogInfo("DataNotFound") << "L1TCSCTF: constructor...." << endl;
00041
00042
00043 dbe = NULL;
00044 if ( ps.getUntrackedParameter<bool>("DQMStore", false) )
00045 {
00046 dbe = Service<DQMStore>().operator->();
00047 dbe->setVerbose(0);
00048 }
00049
00050 outputFile_ = ps.getUntrackedParameter<string>("outputFile", "");
00051 if ( outputFile_.size() != 0 )
00052 {
00053 edm::LogInfo("DataNotFound") << "L1T Monitoring histograms will be saved to " << outputFile_.c_str() << endl;
00054 }
00055
00056 bool disable = ps.getUntrackedParameter<bool>("disableROOToutput", false);
00057 if(disable){
00058 outputFile_="";
00059 }
00060
00061
00062 if ( dbe !=NULL )
00063 {
00064 dbe->setCurrentFolder("L1T/L1TCSCTF");
00065 }
00066
00067
00068 bzero(srLUTs_,sizeof(srLUTs_));
00069 int endcap=1, sector=1;
00070 bool TMB07=true;
00071
00072 edm::ParameterSet srLUTset;
00073 srLUTset.addUntrackedParameter<bool>("ReadLUTs", false);
00074 srLUTset.addUntrackedParameter<bool>("Binary", false);
00075 srLUTset.addUntrackedParameter<std::string>("LUTPath", "./");
00076 for(int station=1,fpga=0; station<=4 && fpga<5; station++)
00077 {
00078 if(station==1)
00079 for(int subSector=0; subSector<2 && fpga<5; subSector++)
00080 srLUTs_[fpga++] = new CSCSectorReceiverLUT(endcap, sector, subSector+1, station, srLUTset, TMB07);
00081 else
00082 srLUTs_[fpga++] = new CSCSectorReceiverLUT(endcap, sector, 0, station, srLUTset, TMB07);
00083 }
00084
00085 }
00086
00087 L1TCSCTF::~L1TCSCTF()
00088 {
00089
00090 for(int i=0; i<5; i++)
00091 delete srLUTs_[i];
00092 }
00093
00094 void L1TCSCTF::beginJob(void)
00095 {
00096 m_scalesCacheID = -999;
00097 m_ptScaleCacheID = -999;
00098
00099 nev_ = 0;
00100
00101
00102 DQMStore* dbe = 0;
00103 dbe = Service<DQMStore>().operator->();
00104
00105 if( dbe )
00106 {
00107 dbe->setCurrentFolder("L1T/L1TCSCTF");
00108 dbe->rmdir("L1T/L1TCSCTF");
00109 }
00110
00111
00112 if( dbe )
00113 {
00114 dbe->setCurrentFolder("L1T/L1TCSCTF");
00115
00116
00117
00118
00119
00120 csctferrors = dbe->book1D("CSCTF_errors","CSCTF Errors",6,0,6);
00121 csctferrors->setAxisTitle("Error type",1);
00122 csctferrors->setAxisTitle("Number of Errors",2);
00123 csctferrors->setBinLabel(1,"Corruptions",1);
00124 csctferrors->setBinLabel(2,"Synch. Err.",1);
00125 csctferrors->setBinLabel(3,"Synch. Mod.",1);
00126 csctferrors->setBinLabel(4,"BX mismatch",1);
00127 csctferrors->setBinLabel(5,"Time misalign.",1);
00128 csctferrors->setBinLabel(6,"FMM != Ready",1);
00129
00130
00131
00132
00133
00134 csctfoccupancies = dbe->book2D("CSCTF_occupancies", "CSCTF Occupancies", 64,-32,31,32,0,6.2);
00135 csctfoccupancies->setAxisTitle("#eta",1);
00136 csctfoccupancies->setAxisTitle("#phi",2);
00137 csctfoccupancies->setBinLabel( 1,"-2.5", 1);
00138 csctfoccupancies->setBinLabel( 8,"-2.1", 1);
00139 csctfoccupancies->setBinLabel(18,"-1.6", 1);
00140 csctfoccupancies->setBinLabel(26,"-1.2", 1);
00141 csctfoccupancies->setBinLabel(32,"-0.9", 1);
00142 csctfoccupancies->setBinLabel(33, "0.9", 1);
00143 csctfoccupancies->setBinLabel(39, "1.2", 1);
00144 csctfoccupancies->setBinLabel(47, "1.6", 1);
00145 csctfoccupancies->setBinLabel(57, "2.1", 1);
00146 csctfoccupancies->setBinLabel(64, "2.5", 1);
00147
00148
00149 csctfoccupancies_H = dbe->book2D("CSCTF_occupancies_H", "CSCTF Halo Occupancies", 64,-32,31,32,0,6.2);
00150 csctfoccupancies_H->setAxisTitle("#eta",1);
00151 csctfoccupancies_H->setAxisTitle("#phi",2);
00152 csctfoccupancies_H->setBinLabel( 1,"-2.5", 1);
00153 csctfoccupancies_H->setBinLabel( 8,"-2.1", 1);
00154 csctfoccupancies_H->setBinLabel(18,"-1.6", 1);
00155 csctfoccupancies_H->setBinLabel(26,"-1.2", 1);
00156 csctfoccupancies_H->setBinLabel(32,"-0.9", 1);
00157 csctfoccupancies_H->setBinLabel(33, "0.9", 1);
00158 csctfoccupancies_H->setBinLabel(39, "1.2", 1);
00159 csctfoccupancies_H->setBinLabel(47, "1.6", 1);
00160 csctfoccupancies_H->setBinLabel(57, "2.1", 1);
00161 csctfoccupancies_H->setBinLabel(64, "2.5", 1);
00162
00163
00164
00165
00166
00167
00168
00169 trackModeVsQ = dbe->book2D("CSCTF_Track_ModeVsQual","CSC Track Mode Vs Quality", 19, -0.5, 18.5, 4, 0, 4);
00170 trackModeVsQ->setAxisTitle("Track Type", 1);
00171 trackModeVsQ->setBinLabel(1,"No Track",1);
00172 trackModeVsQ->setBinLabel(2,"Bad Phi/Single",1);
00173 trackModeVsQ->setBinLabel(3,"ME1-2-3",1);
00174 trackModeVsQ->setBinLabel(4,"ME1-2-4",1);
00175 trackModeVsQ->setBinLabel(5,"ME1-3-4",1);
00176 trackModeVsQ->setBinLabel(6,"ME2-3-4",1);
00177 trackModeVsQ->setBinLabel(7,"ME1-2",1);
00178 trackModeVsQ->setBinLabel(8,"ME1-3",1);
00179 trackModeVsQ->setBinLabel(9,"ME2-3",1);
00180 trackModeVsQ->setBinLabel(10,"ME2-4",1);
00181 trackModeVsQ->setBinLabel(11,"ME3-4",1);
00182 trackModeVsQ->setBinLabel(12,"MB1-ME3",1);
00183 trackModeVsQ->setBinLabel(13,"MB1-ME2",1);
00184 trackModeVsQ->setBinLabel(14,"ME1-4",1);
00185 trackModeVsQ->setBinLabel(15,"MB1-ME1",1);
00186 trackModeVsQ->setBinLabel(16,"Halo Trigger",1);
00187 trackModeVsQ->setBinLabel(17,"MB1-ME1-2",1);
00188 trackModeVsQ->setBinLabel(18,"MB1-ME1-3",1);
00189 trackModeVsQ->setBinLabel(19,"MB1-ME2-3",1);
00190
00191 trackModeVsQ->setAxisTitle("Quality",2);
00192 trackModeVsQ->setBinLabel(1,"0",2);
00193 trackModeVsQ->setBinLabel(2,"1",2);
00194 trackModeVsQ->setBinLabel(3,"2",2);
00195 trackModeVsQ->setBinLabel(4,"3",2);
00196
00197
00198 csctfTrackM = dbe->book1D("CSCTF_Track_Mode","CSC Track Mode", 19, -0.5, 18.5);
00199 csctfTrackM->setAxisTitle("Track Type", 1);
00200 csctfTrackM->setBinLabel(1,"No Track",1);
00201 csctfTrackM->setBinLabel(2,"Bad Phi/Single",1);
00202 csctfTrackM->setBinLabel(3,"ME1-2-3",1);
00203 csctfTrackM->setBinLabel(4,"ME1-2-4",1);
00204 csctfTrackM->setBinLabel(5,"ME1-3-4",1);
00205 csctfTrackM->setBinLabel(6,"ME2-3-4",1);
00206 csctfTrackM->setBinLabel(7,"ME1-2",1);
00207 csctfTrackM->setBinLabel(8,"ME1-3",1);
00208 csctfTrackM->setBinLabel(9,"ME2-3",1);
00209 csctfTrackM->setBinLabel(10,"ME2-4",1);
00210 csctfTrackM->setBinLabel(11,"ME3-4",1);
00211 csctfTrackM->setBinLabel(12,"MB1-ME3",1);
00212 csctfTrackM->setBinLabel(13,"MB1-ME2",1);
00213 csctfTrackM->setBinLabel(14,"ME1-4",1);
00214 csctfTrackM->setBinLabel(15,"MB1-ME1",1);
00215 csctfTrackM->setBinLabel(16,"Halo Trigger",1);
00216 csctfTrackM->setBinLabel(17,"MB1-ME1-2",1);
00217 csctfTrackM->setBinLabel(18,"MB1-ME1-3",1);
00218 csctfTrackM->setBinLabel(19,"MB1-ME2-3",1);
00219
00220
00221 csctfChamberOccupancies = dbe->book2D("CSCTF_Chamber_Occupancies","CSCTF Chamber Occupancies", 54, -0.05, 5.35, 10, -5.5, 4.5);
00222 csctfChamberOccupancies->setAxisTitle("Sector, (chambers 1-9 not labeled)",1);
00223 csctfChamberOccupancies->setBinLabel(1,"ME-4",2);
00224 csctfChamberOccupancies->setBinLabel(2,"ME-3",2);
00225 csctfChamberOccupancies->setBinLabel(3,"ME-2",2);
00226 csctfChamberOccupancies->setBinLabel(4,"ME-1b",2);
00227 csctfChamberOccupancies->setBinLabel(5,"ME-1a",2);
00228 csctfChamberOccupancies->setBinLabel(6,"ME+1a",2);
00229 csctfChamberOccupancies->setBinLabel(7,"ME+1b",2);
00230 csctfChamberOccupancies->setBinLabel(8,"ME+2",2);
00231 csctfChamberOccupancies->setBinLabel(9,"ME+3",2);
00232 csctfChamberOccupancies->setBinLabel(10,"ME+4",2);
00233 csctfChamberOccupancies->setBinLabel(1, "1",1);
00234 csctfChamberOccupancies->setBinLabel(10,"2",1);
00235 csctfChamberOccupancies->setBinLabel(19,"3",1);
00236 csctfChamberOccupancies->setBinLabel(28,"4",1);
00237 csctfChamberOccupancies->setBinLabel(37,"5",1);
00238 csctfChamberOccupancies->setBinLabel(46,"6",1);
00239
00240
00241 csctfTrackPhi = dbe->book1D("CSCTF_Track_Phi", "CSCTF Track #phi",144,0,2*M_PI);
00242 csctfTrackPhi->setAxisTitle("Track #phi", 1);
00243
00244
00245 csctfTrackEta = dbe->book1D("CSCTF_Track_Eta", "CSCTF Track #eta",64,-32,32);
00246 csctfTrackEta->setAxisTitle("Track #eta", 1);
00247 csctfTrackEta->setBinLabel( 1,"-2.5", 1);
00248 csctfTrackEta->setBinLabel( 8,"-2.1", 1);
00249 csctfTrackEta->setBinLabel(18,"-1.6", 1);
00250 csctfTrackEta->setBinLabel(26,"-1.2", 1);
00251 csctfTrackEta->setBinLabel(32,"-0.9", 1);
00252 csctfTrackEta->setBinLabel(33, "0.9", 1);
00253 csctfTrackEta->setBinLabel(39, "1.2", 1);
00254 csctfTrackEta->setBinLabel(47, "1.6", 1);
00255 csctfTrackEta->setBinLabel(57, "2.1", 1);
00256 csctfTrackEta->setBinLabel(64, "2.5", 1);
00257
00258
00259 csctfTrackEtaLowQ = dbe->book1D("CSCTF_Track_Eta_LowQ", "CSCTF Track #eta LQ",64,-32,32);
00260 csctfTrackEtaLowQ->setAxisTitle("Track #eta", 1);
00261 csctfTrackEtaLowQ->setBinLabel( 1,"-2.5", 1);
00262 csctfTrackEtaLowQ->setBinLabel( 8,"-2.1", 1);
00263 csctfTrackEtaLowQ->setBinLabel(18,"-1.6", 1);
00264 csctfTrackEtaLowQ->setBinLabel(26,"-1.2", 1);
00265 csctfTrackEtaLowQ->setBinLabel(32,"-0.9", 1);
00266 csctfTrackEtaLowQ->setBinLabel(33, "0.9", 1);
00267 csctfTrackEtaLowQ->setBinLabel(39, "1.2", 1);
00268 csctfTrackEtaLowQ->setBinLabel(47, "1.6", 1);
00269 csctfTrackEtaLowQ->setBinLabel(57, "2.1", 1);
00270 csctfTrackEtaLowQ->setBinLabel(64, "2.5", 1);
00271
00272
00273
00274 csctfTrackEtaHighQ = dbe->book1D("CSCTF_Track_Eta_HighQ", "CSCTF Track #eta HQ",64,-32,32);
00275 csctfTrackEtaHighQ->setAxisTitle("Track #eta", 1);
00276 csctfTrackEtaHighQ->setBinLabel( 1,"-2.5", 1);
00277 csctfTrackEtaHighQ->setBinLabel( 8,"-2.1", 1);
00278 csctfTrackEtaHighQ->setBinLabel(18,"-1.6", 1);
00279 csctfTrackEtaHighQ->setBinLabel(26,"-1.2", 1);
00280 csctfTrackEtaHighQ->setBinLabel(32,"-0.9", 1);
00281 csctfTrackEtaHighQ->setBinLabel(33, "0.9", 1);
00282 csctfTrackEtaHighQ->setBinLabel(39, "1.2", 1);
00283 csctfTrackEtaHighQ->setBinLabel(47, "1.6", 1);
00284 csctfTrackEtaHighQ->setBinLabel(57, "2.1", 1);
00285 csctfTrackEtaHighQ->setBinLabel(64, "2.5", 1);
00286
00287
00288
00289 csctfTrackPhi_H = dbe->book1D("CSCTF_Track_Phi_H", "CSCTF Halo #phi",144,0,2*M_PI);
00290 csctfTrackPhi_H->setAxisTitle("Track #phi", 1);
00291
00292
00293 csctfTrackEta_H = dbe->book1D("CSCTF_Track_Eta_H", "CSCTF Halo #eta",64,-32,32);
00294 csctfTrackEta_H->setAxisTitle("Track #eta", 1);
00295 csctfTrackEta_H->setBinLabel( 1,"-2.5", 1);
00296 csctfTrackEta_H->setBinLabel( 8,"-2.1", 1);
00297 csctfTrackEta_H->setBinLabel(18,"-1.6", 1);
00298 csctfTrackEta_H->setBinLabel(26,"-1.2", 1);
00299 csctfTrackEta_H->setBinLabel(32,"-0.9", 1);
00300 csctfTrackEta_H->setBinLabel(33, "0.9", 1);
00301 csctfTrackEta_H->setBinLabel(39, "1.2", 1);
00302 csctfTrackEta_H->setBinLabel(47, "1.6", 1);
00303 csctfTrackEta_H->setBinLabel(57, "2.1", 1);
00304 csctfTrackEta_H->setBinLabel(64, "2.5", 1);
00305
00306
00307 csctfbx = dbe->book2D("CSCTF_bx","CSCTF BX", 12,1,13, 7,-3,3) ;
00308 csctfbx->setAxisTitle("Sector (Endcap)", 1);
00309 csctfbx->setBinLabel( 1," 1 (+)",1);
00310 csctfbx->setBinLabel( 2," 2 (+)",1);
00311 csctfbx->setBinLabel( 3," 3 (+)",1);
00312 csctfbx->setBinLabel( 4," 4 (+)",1);
00313 csctfbx->setBinLabel( 5," 5 (+)",1);
00314 csctfbx->setBinLabel( 6," 6 (+)",1);
00315 csctfbx->setBinLabel( 7," 7 (-)",1);
00316 csctfbx->setBinLabel( 8," 8 (-)",1);
00317 csctfbx->setBinLabel( 9," 9 (-)",1);
00318 csctfbx->setBinLabel(10,"10 (-)",1);
00319 csctfbx->setBinLabel(11,"11 (-)",1);
00320 csctfbx->setBinLabel(12,"12 (-)",1);
00321
00322 csctfbx->setAxisTitle("CSCTF BX", 2);
00323 csctfbx->setBinLabel( 1, "-3", 2);
00324 csctfbx->setBinLabel( 2, "-2", 2);
00325 csctfbx->setBinLabel( 3, "-1", 2);
00326 csctfbx->setBinLabel( 4, "-0", 2);
00327 csctfbx->setBinLabel( 5, " 1", 2);
00328 csctfbx->setBinLabel( 6, " 2", 2);
00329 csctfbx->setBinLabel( 7, " 3", 2);
00330
00331
00332 csctfbx_H = dbe->book2D("CSCTF_bx_H","CSCTF HALO BX", 12,1,13, 7,-3,3) ;
00333 csctfbx_H->setAxisTitle("Sector (Endcap)", 1);
00334 csctfbx_H->setBinLabel( 1," 1 (+)",1);
00335 csctfbx_H->setBinLabel( 2," 2 (+)",1);
00336 csctfbx_H->setBinLabel( 3," 3 (+)",1);
00337 csctfbx_H->setBinLabel( 4," 4 (+)",1);
00338 csctfbx_H->setBinLabel( 5," 5 (+)",1);
00339 csctfbx_H->setBinLabel( 6," 6 (+)",1);
00340 csctfbx_H->setBinLabel( 7," 7 (-)",1);
00341 csctfbx_H->setBinLabel( 8," 8 (-)",1);
00342 csctfbx_H->setBinLabel( 9," 9 (-)",1);
00343 csctfbx_H->setBinLabel(10,"10 (-)",1);
00344 csctfbx_H->setBinLabel(11,"11 (-)",1);
00345 csctfbx_H->setBinLabel(12,"12 (-)",1);
00346
00347 csctfbx_H->setAxisTitle("CSCTF BX", 2);
00348 csctfbx_H->setBinLabel( 1, "-3", 2);
00349 csctfbx_H->setBinLabel( 2, "-2", 2);
00350 csctfbx_H->setBinLabel( 3, "-1", 2);
00351 csctfbx_H->setBinLabel( 4, "-0", 2);
00352 csctfbx_H->setBinLabel( 5, " 1", 2);
00353 csctfbx_H->setBinLabel( 6, " 2", 2);
00354 csctfbx_H->setBinLabel( 7, " 3", 2);
00355
00356
00357 cscTrackStubNumbers = dbe->book1D("CSCTF_TrackStubs", "Number of Stubs in CSCTF Tracks", 5, 0, 5);
00358 cscTrackStubNumbers->setBinLabel( 1, "0", 1);
00359 cscTrackStubNumbers->setBinLabel( 2, "1", 1);
00360 cscTrackStubNumbers->setBinLabel( 3, "2", 1);
00361 cscTrackStubNumbers->setBinLabel( 4, "3", 1);
00362 cscTrackStubNumbers->setBinLabel( 5, "4", 1);
00363
00364
00365 csctfntrack = dbe->book1D("CSCTF_ntrack","Number of CSCTracks found per event", 5, 0, 5 ) ;
00366 csctfntrack->setBinLabel( 1, "0", 1);
00367 csctfntrack->setBinLabel( 2, "1", 1);
00368 csctfntrack->setBinLabel( 3, "2", 1);
00369 csctfntrack->setBinLabel( 4, "3", 1);
00370 csctfntrack->setBinLabel( 5, "4", 1);
00371 }
00372
00373 char hname [200];
00374 char htitle[200];
00375
00376 for(int i=0; i<12; i++) {
00377
00378 sprintf(hname ,"DTstubsTimeTrackMenTimeArrival_%d",i+1);
00379 sprintf(htitle,"T_{track} - T_{DT stub} sector %d",i+1);
00380
00381 DTstubsTimeTrackMenTimeArrival[i] = dbe->book2D(hname,htitle, 7,-3,3, 2,1,3);
00382 DTstubsTimeTrackMenTimeArrival[i]->getTH2F()->SetMinimum(0);
00383
00384
00385 DTstubsTimeTrackMenTimeArrival[i]->setAxisTitle("bx_{CSC track} - bx_{DT stub}",1);
00386 DTstubsTimeTrackMenTimeArrival[i]->setAxisTitle("subsector",2);
00387
00388 DTstubsTimeTrackMenTimeArrival[i]->setBinLabel(1,"-3",1);
00389 DTstubsTimeTrackMenTimeArrival[i]->setBinLabel(2,"-2",1);
00390 DTstubsTimeTrackMenTimeArrival[i]->setBinLabel(3,"-1",1);
00391 DTstubsTimeTrackMenTimeArrival[i]->setBinLabel(4, "0",1);
00392 DTstubsTimeTrackMenTimeArrival[i]->setBinLabel(5,"+1",1);
00393 DTstubsTimeTrackMenTimeArrival[i]->setBinLabel(6,"+2",1);
00394 DTstubsTimeTrackMenTimeArrival[i]->setBinLabel(7,"+3",1);
00395
00396 DTstubsTimeTrackMenTimeArrival[i]->setBinLabel(1,"sub1",2);
00397 DTstubsTimeTrackMenTimeArrival[i]->setBinLabel(2,"sub2",2);
00398
00399 }
00400
00401 }
00402
00403
00404 void L1TCSCTF::endJob(void)
00405 {
00406
00407 if(verbose_) edm::LogInfo("DataNotFound") << "L1TCSCTF: end job...." << endl;
00408 LogInfo("EndJob") << "analyzed " << nev_ << " events";
00409
00410 if ( outputFile_.size() != 0 && dbe ) dbe->save(outputFile_);
00411
00412 return;
00413 }
00414
00415 void L1TCSCTF::analyze(const Event& e, const EventSetup& c)
00416 {
00417
00418 if( c.get< L1MuTriggerScalesRcd > ().cacheIdentifier() != m_scalesCacheID ||
00419 c.get< L1MuTriggerPtScaleRcd >().cacheIdentifier() != m_ptScaleCacheID ){
00420
00421 ESHandle< L1MuTriggerScales > scales;
00422 c.get< L1MuTriggerScalesRcd >().get(scales);
00423 ts = scales.product();
00424 ESHandle< L1MuTriggerPtScale > ptscales;
00425 c.get< L1MuTriggerPtScaleRcd >().get(ptscales);
00426 tpts = ptscales.product();
00427 m_scalesCacheID = c.get< L1MuTriggerScalesRcd >().cacheIdentifier();
00428 m_ptScaleCacheID = c.get< L1MuTriggerPtScaleRcd >().cacheIdentifier();
00429
00430 edm::LogInfo("L1TCSCTF") << "Changing triggerscales and triggerptscales...";
00431 }
00432
00433 int NumCSCTfTracksRep = 0;
00434 nev_++;
00435 if(verbose_) edm::LogInfo("DataNotFound") << "L1TCSCTF: analyze...." << endl;
00436
00437 edm::Handle<L1MuGMTReadoutCollection> pCollection;
00438 if( gmtProducer.label() != "null" )
00439 {
00440 e.getByLabel(gmtProducer,pCollection);
00441 if (!pCollection.isValid())
00442 {
00443 edm::LogInfo("DataNotFound") << "can't find L1MuGMTReadoutCollection with label ";
00444 return;
00445 }
00446
00447 L1MuGMTReadoutCollection const* gmtrc = pCollection.product();
00448 vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
00449 vector<L1MuGMTReadoutRecord>::const_iterator RRItr;
00450
00451
00452
00453
00454
00455
00456 int bxWindow = 0;
00457 int nCands = 0;
00458
00459 for( RRItr = gmt_records.begin(); RRItr != gmt_records.end(); RRItr++ ) {
00460 bxWindow++;
00461
00462
00463 vector<L1MuRegionalCand> INPCands = RRItr->getCSCCands();
00464 vector<L1MuRegionalCand>::const_iterator INPItr;
00465
00466 BxInEvent_ = 0;
00467 isCSCcand_ = false;
00468 int nCandsBx = 0;
00469
00470 for( INPItr = INPCands.begin(); INPItr != INPCands.end(); ++INPItr ) {
00471 if(!INPItr->empty())
00472 {
00473 nCandsBx++;
00474 nCands++;
00475 BxInEvent_ = RRItr->getBxInEvent();
00476 if (verbose_) edm::LogInfo("DataNotFound") << "cand " << nCandsBx << " -> assigned CSCTF bx: " << INPItr->bx() << endl;
00477 }
00478 }
00479 if (verbose_)
00480 if(nCandsBx) edm::LogInfo("DataNotFound") << nCandsBx << " cands in bx: " << BxInEvent_ << endl;
00481 }
00482
00483 if (nCands != 1) return;
00484 else isCSCcand_ = true;
00485 if (verbose_) edm::LogInfo("DataNotFound") << "bxWindow: " << bxWindow << endl;
00486
00487 int ncsctftrack = 0;
00488 if (verbose_)
00489 {
00490 edm::LogInfo("DataNotFound") << "\tCSCTFCand ntrack " << ncsctftrack << endl;
00491 }
00492 }
00493
00494 L1ABXN = -999;
00495 if( statusProducer.label() != "null" )
00496 {
00497 edm::Handle<L1CSCStatusDigiCollection> status;
00498 e.getByLabel(statusProducer.label(),statusProducer.instance(),status);
00499 bool integrity=status->first, se=false, sm=false, bx=false, af=false, fmm=false;
00500 int nStat = 0;
00501
00502 for(std::vector<L1CSCSPStatusDigi>::const_iterator stat=status->second.begin(); stat!=status->second.end(); stat++)
00503 {
00504 se |= stat->SEs()&0xFFF;
00505 sm |= stat->SMs()&0xFFF;
00506 bx |= stat->BXs()&0xFFF;
00507 af |= stat->AFs()&0xFFF;
00508 fmm|= stat->FMM()!=8;
00509
00510 if(stat->VPs() != 0)
00511 {
00512 L1ABXN += stat->BXN();
00513 nStat++;
00514 }
00515 }
00516
00517 if(nStat!=0) L1ABXN /= nStat;
00518 if(integrity) csctferrors->Fill(0.5);
00519 if(se) csctferrors->Fill(1.5);
00520 if(sm) csctferrors->Fill(2.5);
00521 if(bx) csctferrors->Fill(3.5);
00522 if(af) csctferrors->Fill(4.5);
00523 if(fmm) csctferrors->Fill(5.5);
00524 }
00525
00526 if( lctProducer.label() != "null" )
00527 {
00528 edm::ESHandle<CSCGeometry> pDD;
00529 c.get<MuonGeometryRecord>().get( pDD );
00530 CSCTriggerGeometry::setGeometry(pDD);
00531
00532 edm::Handle<CSCCorrelatedLCTDigiCollection> corrlcts;
00533 e.getByLabel(lctProducer.label(),lctProducer.instance(),corrlcts);
00534
00535 for(CSCCorrelatedLCTDigiCollection::DigiRangeIterator csc=corrlcts.product()->begin(); csc!=corrlcts.product()->end(); csc++)
00536 {
00537 CSCCorrelatedLCTDigiCollection::Range range1 = corrlcts.product()->get((*csc).first);
00538 for(CSCCorrelatedLCTDigiCollection::const_iterator lct=range1.first; lct!=range1.second; lct++)
00539 {
00540 int endcap = (*csc).first.endcap()-1;
00541 int station = (*csc).first.station()-1;
00542 int sector = (*csc).first.triggerSector()-1;
00543 int subSector = CSCTriggerNumbering::triggerSubSectorFromLabels((*csc).first);
00544 int cscId = (*csc).first.triggerCscId()-1;
00545 int fpga = ( subSector ? subSector-1 : station+1 );
00546
00547 int endcapAssignment = 1;
00548 int shift = 1;
00549 float sectorArg = sector;
00550
00551
00552 if( endcap == 1 ){
00553 endcapAssignment = -1;
00554 shift = 2;
00555
00556 }
00557
00558 int signedStation = (station + shift)* endcapAssignment;
00559 if( (station == 0) && (endcap == 0)) signedStation = subSector - 1;
00560 if( (station == 0) && (endcap == 1)) signedStation = (-1)*subSector;
00561
00562 float chamberArg1 = cscId * 0.1 + sectorArg;
00563
00564
00565
00566 float chamberArg11 = chamberArg1;
00567 if(sectorArg == 1) chamberArg1 = chamberArg11 - 0.1;
00568 if(sectorArg == 2) chamberArg1 = chamberArg11 - 0.2;
00569 if(sectorArg == 3) chamberArg1 = chamberArg11 - 0.3;
00570 if(sectorArg == 4) chamberArg1 = chamberArg11 - 0.4;
00571 if(sectorArg == 5) chamberArg1 = chamberArg11 - 0.5;
00572
00573
00574
00575 csctfChamberOccupancies->Fill(chamberArg1, signedStation);
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587 if( endcap<0||endcap>1 || sector<0||sector>6 || station<0||station>3 || cscId<0||cscId>8 || fpga<0||fpga>4)
00588 {
00589 edm::LogError("L1CSCTF: CSC TP are out of range: ")<<" endcap: "<<(endcap+1)<<" station: "<<(station+1) <<" sector: "<<(sector+1)<<" subSector: "<<subSector<<" fpga: "<<fpga<<" cscId: "<<(cscId+1);
00590 continue;
00591 }
00592 lclphidat lclPhi;
00593 try {
00594 lclPhi = srLUTs_[fpga]->localPhi(lct->getStrip(), lct->getPattern(), lct->getQuality(), lct->getBend());
00595 } catch(cms::Exception &) {
00596 bzero(&lclPhi,sizeof(lclPhi));
00597 }
00598
00599 gblphidat gblPhi;
00600 try {
00601 gblPhi = srLUTs_[fpga]->globalPhiME(lclPhi.phi_local, lct->getKeyWG(), cscId+1);
00602 } catch(cms::Exception &) {
00603 bzero(&gblPhi,sizeof(gblPhi));
00604 }
00605
00606 gbletadat gblEta;
00607 try {
00608 gblEta = srLUTs_[fpga]->globalEtaME(lclPhi.phi_bend_local, lclPhi.phi_local, lct->getKeyWG(), cscId+1);
00609 } catch(cms::Exception &) {
00610 bzero(&gblEta,sizeof(gblEta));
00611 }
00612
00613
00614
00615
00616
00617
00618 }
00619 }
00620 }
00621
00622
00623
00624 if( trackProducer.label() != "null" )
00625 {
00626 edm::Handle<L1CSCTrackCollection> tracks;
00627 e.getByLabel(trackProducer.label(),trackProducer.instance(),tracks);
00628 for(L1CSCTrackCollection::const_iterator trk=tracks->begin(); trk<tracks->end(); trk++)
00629 {
00630
00631 NumCSCTfTracksRep++;
00632 long LUTAdd = trk->first.ptLUTAddress();
00633 int trigMode = ( (LUTAdd)&0xf0000 ) >> 16;
00634 int trEta = (trk->first.eta_packed() );
00635
00636
00637
00638
00639
00640 if( trk->first.endcap() != 1)
00641 {
00642 int holder = trEta;
00643 trEta = -1*holder;
00644 trEta -= 1;
00645 }
00646
00647 int trSector = 6*(trk->first.endcap()-1)+trk->first.sector();
00648 int trBX = trk->first.BX();
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661 double trPhi = ts->getPhiScale()->getLowEdge(trk->first.localPhi());
00662 double trPhi02PI = fmod(trPhi +
00663 ((trSector-1)*M_PI/3) +
00664 (M_PI*14/180.), 2*M_PI);
00665
00666 if (trigMode == 15) {
00667 csctfTrackPhi_H -> Fill( trPhi02PI );
00668 csctfTrackEta_H -> Fill( trEta );
00669 csctfoccupancies_H -> Fill( trEta, trPhi02PI );
00670 csctfbx_H -> Fill( trSector, trBX );
00671 }
00672 else{
00673 csctfTrackPhi -> Fill( trPhi02PI );
00674 csctfTrackEta -> Fill( trEta );
00675 csctfoccupancies -> Fill( trEta, trPhi02PI );
00676 csctfbx -> Fill( trSector, trBX );
00677
00678
00679
00680 if (abs(trEta) < 24) {
00681 if (trigMode == 2 ||
00682 trigMode == 3 ||
00683 trigMode == 4 ||
00684 trigMode == 5 ||
00685 trigMode == 6 ||
00686 trigMode == 7 ||
00687 trigMode == 11 ||
00688 trigMode == 12 ||
00689 trigMode == 13 ||
00690 trigMode == 14 ) csctfTrackEtaHighQ -> Fill (trEta);
00691
00692 if (trigMode == 8 ||
00693 trigMode == 9 ||
00694 trigMode == 10 ) csctfTrackEtaLowQ -> Fill (trEta);
00695 }
00696 else {
00697 if (trigMode == 2 ||
00698 trigMode == 3 ||
00699 trigMode == 4 ||
00700 trigMode == 5 ) csctfTrackEtaHighQ -> Fill (trEta);
00701 else
00702 csctfTrackEtaLowQ -> Fill (trEta);
00703 }
00704 }
00705
00706 csctfTrackM->Fill( trk->first.modeExtended() );
00707
00708
00709
00710
00711 int trRank = trk->first.rank();
00712 if (trRank) {
00713 int trQuality = ((trRank>>5)&0x3);
00714 trackModeVsQ->Fill( trk->first.modeExtended(), trQuality );
00715 }
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782 int cscTrackStub = 0;
00783
00784
00785
00786 CSCCorrelatedLCTDigiCollection lctsOfTracks=trk->second;
00787 for(CSCCorrelatedLCTDigiCollection::DigiRangeIterator trackStub=lctsOfTracks.begin(); trackStub!=lctsOfTracks.end(); trackStub++)
00788 {
00789 CSCCorrelatedLCTDigiCollection::Range range2 = lctsOfTracks.get((*trackStub).first);
00790 for(CSCCorrelatedLCTDigiCollection::const_iterator lct=range2.first; lct!=range2.second; lct++)
00791 {
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810 cscTrackStub++;
00811 }
00812 }
00813 cscTrackStubNumbers->Fill(cscTrackStub);
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832 }
00833 }
00834 csctfntrack->Fill(NumCSCTfTracksRep);
00835
00836
00837 if( mbProducer.label() != "null" )
00838 {
00839
00840 edm::Handle<CSCTriggerContainer<csctf::TrackStub> > dtStubs;
00841 e.getByLabel(mbProducer.label(), mbProducer.instance(), dtStubs);
00842 edm::Handle<L1CSCTrackCollection> tracks;
00843 e.getByLabel(trackProducer.label(),trackProducer.instance(),tracks);
00844
00845
00846 std::vector<csctf::TrackStub> vstubs = dtStubs->get();
00847 for(std::vector<csctf::TrackStub>::const_iterator stub=vstubs.begin();
00848 stub!=vstubs.end(); stub++)
00849 {
00850 if (verbose_)
00851 {
00852 edm::LogInfo("DataNotFound") << "\n mbEndcap: " << stub->endcap();
00853 edm::LogInfo("DataNotFound") << "\n stub->getStrip()[FLAG]: " << stub->getStrip();
00854 edm::LogInfo("DataNotFound") << "\n stub->getKeyWG()[CAL]: " << stub->getKeyWG();
00855 edm::LogInfo("DataNotFound") << "\n stub->BX(): " << stub->BX();
00856 edm::LogInfo("DataNotFound") << "\n stub->sector(): " << stub->sector();
00857 edm::LogInfo("DataNotFound") << "\n stub->subsector(): " << stub->subsector();
00858 edm::LogInfo("DataNotFound") << "\n stub->station(): " << stub->station();
00859 edm::LogInfo("DataNotFound") << "\n stub->phiPacked(): " << stub->phiPacked();
00860 edm::LogInfo("DataNotFound") << "\n stub->getBend(): " << stub->getBend();
00861 edm::LogInfo("DataNotFound") << "\n stub->getQuality(): " << stub->getQuality();
00862 edm::LogInfo("DataNotFound") << "\n stub->cscid(): " << stub->cscid() << endl;
00863 }
00864
00865 int mbId = (stub->endcap()==2) ? 6 : 0;
00866 mbId += stub->sector();
00867
00868
00869
00870
00871 if (stub->getKeyWG() == 0)
00872 {
00873
00874 int bxDT = stub->BX()-stub->getStrip();
00875 int subDT = stub->subsector();
00876
00877
00878 if (isCSCcand_)
00879 {
00880
00881 int trkBX = 0;
00882 for(L1CSCTrackCollection::const_iterator trk=tracks->begin(); trk<tracks->end(); trk++)
00883 {
00884 trkBX = trk->first.BX();
00885 int trkId = (trk->first.endcap()==2) ? 6 : 0;
00886 trkId += trk->first.sector();
00887 if (verbose_){
00888 edm::LogInfo("DataNotFound") << "\n trk BX: " << trkBX
00889 << " Sector: " << trkId
00890 << " SubSector: " << trk->first.subsector()
00891 << " Endcap: " << trk->first.endcap();
00892
00893 edm::LogInfo("DataNotFound") << "\n DT BX: " << stub->BX()
00894 << " Sector: " << mbId
00895 << " SubSector: " << stub->subsector()
00896 << " Endcap: " << stub->endcap() << endl;
00897 }
00898
00899 if (mbId == trkId)
00900 {
00901 if (verbose_) {
00902 edm::LogInfo("DataNotFound") << " --> MATCH" << endl;
00903 edm::LogInfo("DataNotFound") << "Fill :" << trkBX+6-bxDT << " -- " << subDT << " -- cands" << endl;
00904 }
00905
00906
00907 DTstubsTimeTrackMenTimeArrival[mbId-1]->Fill(bxDT-trkBX-6,subDT);
00908 }
00909 }
00910 }
00911 }
00912 }
00913 }
00914 }