00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "DQM/L1TMonitor/interface/L1TdeCSCTF.h"
00015 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
00016 #include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h"
00017 #include "CondFormats/DataRecord/interface/L1MuTriggerScalesRcd.h"
00018 #include <DataFormats/L1CSCTrackFinder/interface/CSCTriggerContainer.h>
00019 #include <DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h>
00020
00021 #include "CondFormats/L1TObjects/interface/L1MuTriggerScales.h"
00022 #include "CondFormats/DataRecord/interface/L1MuTriggerScalesRcd.h"
00023 #include "CondFormats/L1TObjects/interface/L1MuTriggerPtScale.h"
00024 #include "CondFormats/DataRecord/interface/L1MuTriggerPtScaleRcd.h"
00025
00026
00027 #include "DataFormats/L1CSCTrackFinder/interface/TrackStub.h"
00028
00029 #include "DQMServices/Core/interface/DQMStore.h"
00030
00031 #include "FWCore/Framework/interface/ESHandle.h"
00032 #include "FWCore/Framework/interface/MakerMacros.h"
00033
00034 #include <iostream>
00035 #include <iomanip>
00036 #include <memory>
00037
00038
00039 using namespace std;
00040 using namespace edm;
00041
00042 L1TdeCSCTF::L1TdeCSCTF(ParameterSet const& pset):EDAnalyzer(){
00043 dataTrackProducer = pset.getParameter<InputTag>("dataTrackProducer");
00044 emulTrackProducer = pset.getParameter<InputTag>("emulTrackProducer");
00045 lctProducer = pset.getParameter<InputTag>("lctProducer");
00046 dataStubProducer = pset.getParameter<InputTag>("dataStubProducer");
00047 emulStubProducer = pset.getParameter<InputTag>("emulStubProducer");
00048
00049 m_dirName = pset.getUntrackedParameter("DQMFolder", string("L1TEMU/CSCTFexpert"));
00050
00051 ts=0;
00052 ptLUT_ = 0;
00053
00054 ptLUTset = pset.getParameter<ParameterSet>("PTLUT");
00055
00056 dbe = NULL;
00057 if(pset.getUntrackedParameter<bool>("DQMStore", false) )
00058 {
00059 dbe = Service<DQMStore>().operator->();
00060 dbe->setVerbose(0);
00061 dbe->setCurrentFolder(m_dirName);
00062 }
00063
00064 outFile = pset.getUntrackedParameter<string>("outFile", "");
00065 if( outFile.size() != 0 )
00066 {
00067 LogWarning("L1TdeCSCTF")
00068 << "L1T Monitoring histograms will be saved to "
00069 << outFile.c_str()
00070 << endl;
00071 }
00072
00073 bool disable = pset. getUntrackedParameter<bool>("disableROOToutput", false);
00074 if(disable){
00075 outFile="";
00076 }
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 my_dtrc = new CSCTFDTReceiver();
00105 }
00106
00107 void L1TdeCSCTF::beginJob()
00108 {
00109
00110
00112
00114 DQMStore * dbe = 0;
00115 dbe = Service<DQMStore>().operator->();
00116 if( dbe ){
00117 dbe->setCurrentFolder(m_dirName);
00119
00121
00122 pt1Comp = dbe->book2D("pt1Comp","Hardware Vs. Emulator #Delta #phi_{12}",256,0,256,256,0,256);
00123 pt1Comp->setAxisTitle("Hardware #Delta #phi_{12}",1);
00124 pt1Comp->setAxisTitle("Emulator #Delta #phi_{12}",2);
00125 pt2Comp = dbe->book2D("pt2Comp","Hardware Vs. Emulator #Delta #phi_{23}",16,0,16,16,0,16);
00126 pt2Comp->setAxisTitle("Hardware #Delta #phi_{23}",1);
00127 pt2Comp->setAxisTitle("Emulator #Delta #phi_{23}",2);
00128 pt3Comp = dbe->book2D("pt3Comp","Hardware Vs. Emulator #eta",16,0,16,16,0,16);
00129 pt3Comp->setAxisTitle("Hardware #eta",1);
00130 pt3Comp->setAxisTitle("Emulator #eta",2);
00131 pt4Comp = dbe->book2D("pt4Comp","Hardware Vs. Emulator Mode",19,0,19,19,0,19);
00132 pt4Comp->setAxisTitle("Hardware Mode",1);
00133 pt4Comp->setAxisTitle("Emulator Mode",2);
00134
00135 pt4Comp->setBinLabel(1,"No Track",1);
00136 pt4Comp->setBinLabel(2,"Bad Phi/Single",1);
00137 pt4Comp->setBinLabel(3,"ME1-2-3",1);
00138 pt4Comp->setBinLabel(4,"ME1-2-4",1);
00139 pt4Comp->setBinLabel(5,"ME1-3-4",1);
00140 pt4Comp->setBinLabel(6,"ME2-3-4",1);
00141 pt4Comp->setBinLabel(7,"ME1-2",1);
00142 pt4Comp->setBinLabel(8,"ME1-3",1);
00143 pt4Comp->setBinLabel(9,"ME2-3",1);
00144 pt4Comp->setBinLabel(10,"ME2-4",1);
00145 pt4Comp->setBinLabel(11,"ME3-4",1);
00146 pt4Comp->setBinLabel(12,"MB1-ME3",1);
00147 pt4Comp->setBinLabel(13,"MB1-ME2",1);
00148 pt4Comp->setBinLabel(14,"ME1-4",1);
00149 pt4Comp->setBinLabel(15,"MB1-ME1",1);
00150 pt4Comp->setBinLabel(16,"Halo Trigger",1);
00151 pt4Comp->setBinLabel(17,"MB1-ME1-2",1);
00152 pt4Comp->setBinLabel(18,"MB1-ME1-3",1);
00153 pt4Comp->setBinLabel(19,"MB1-ME2-3",1);
00154
00155 pt4Comp->setBinLabel(1,"No Track",2);
00156 pt4Comp->setBinLabel(2,"Bad Phi/Single",2);
00157 pt4Comp->setBinLabel(3,"ME1-2-3",2);
00158 pt4Comp->setBinLabel(4,"ME1-2-4",2);
00159 pt4Comp->setBinLabel(5,"ME1-3-4",2);
00160 pt4Comp->setBinLabel(6,"ME2-3-4",2);
00161 pt4Comp->setBinLabel(7,"ME1-2",2);
00162 pt4Comp->setBinLabel(8,"ME1-3",2);
00163 pt4Comp->setBinLabel(9,"ME2-3",2);
00164 pt4Comp->setBinLabel(10,"ME2-4",2);
00165 pt4Comp->setBinLabel(11,"ME3-4",2);
00166 pt4Comp->setBinLabel(12,"MB1-ME3",2);
00167 pt4Comp->setBinLabel(13,"MB1-ME2",2);
00168 pt4Comp->setBinLabel(14,"ME1-4",2);
00169 pt4Comp->setBinLabel(15,"MB1-ME1",2);
00170 pt4Comp->setBinLabel(16,"Halo Trigger",2);
00171 pt4Comp->setBinLabel(17,"MB1-ME1-2",2);
00172 pt4Comp->setBinLabel(18,"MB1-ME1-3",2);
00173 pt4Comp->setBinLabel(19,"MB1-ME2-3",2);
00174
00175 pt5Comp = dbe->book2D("pt5Comp","Hardware Vs. Emulator Sign, FR",4,0,4,4,0,4);
00176 pt5Comp->setAxisTitle("Hardware Sign<<1|FR",1);
00177 pt5Comp->setAxisTitle("Emulator Sign<<1|FR",2);
00178
00179
00180 phiComp = dbe->book2D("phiComp","Hardware Vs. Emulator Track #phi",32,0,32,32,0,32);
00181 phiComp->setAxisTitle("Hardware #phi",1);
00182 phiComp->setAxisTitle("Emulator #phi",2);
00183 etaComp = dbe->book2D("etaComp","Hardware Vs. Emulator Track #eta",32,0,32,32,0,32);
00184 etaComp->setAxisTitle("Hardware #eta",1);
00185 etaComp->setAxisTitle("Emulator #eta",2);
00186 occComp = dbe->book2D("occComp","Hardware Vs. Emulator Track Occupancy",5,0,5,5,0,5);
00187 occComp->setAxisTitle("Hardware Occupancy",1);
00188 occComp->setAxisTitle("Emulator Occupancy",2);
00189 ptComp = dbe->book2D("ptComp","Hardware Vs. Emulator Pt",32,0,32,32,0,32);
00190 ptComp->setAxisTitle("Hardware P_{t}",1);
00191 ptComp->setAxisTitle("Emulator P_{t}",2);
00192 qualComp= dbe->book2D("qualComp","Hardware Vs. Emulator Quality",4,0,4,4,0,4);
00193 qualComp->setAxisTitle("Hardware Quality",1);
00194 qualComp->setAxisTitle("Emulator Quality",2);
00195
00196
00197
00198 dtStubPhi = dbe->book2D("dtStubPhi","Hardware Vs. Emulator DT Stub #phi",200,400,2400,200,400,2400);
00199 dtStubPhi->setAxisTitle("Hardware Stub #phi",1);
00200 dtStubPhi->setAxisTitle("Emulator Stub #phi",2);
00201 badDtStubSector = dbe->book2D("badDtStubSector","Dt Sector for bad Dt stub #phi",6,1,7,2,1,3);
00202 badDtStubSector->setAxisTitle("Dt stub sector, subsector",1);
00203 badDtStubSector->setAxisTitle("Dt Stub Endcap",2);
00204
00205
00206
00207
00208
00209
00210 pt1Comp_1d = dbe->book1D("pt1Comp_1d","Hardware Vs. Emulator #Delta #phi_{12}",2,0,2);
00211 pt1Comp_1d->setAxisTitle("#Delta #phi_{12}",1);
00212 pt1Comp_1d->setBinLabel(1, "Agree", 1);
00213 pt1Comp_1d->setBinLabel(2, "Disagree", 1);
00214
00215 pt2Comp_1d = dbe->book1D("pt2Comp_1d","Hardware Vs. Emulator #Delta #phi_{23}",2,0,2);
00216 pt2Comp_1d->setAxisTitle("#Delta #phi_{23}",1);
00217 pt2Comp_1d->setBinLabel(1, "Agree", 1);
00218 pt2Comp_1d->setBinLabel(2, "Disagree", 1);
00219
00220 pt3Comp_1d = dbe->book1D("pt3Comp_1d","Hardware Vs. Emulator #eta",2,0,2);
00221 pt3Comp_1d->setAxisTitle("#eta",1);
00222 pt3Comp_1d->setBinLabel(1, "Agree", 1);
00223 pt3Comp_1d->setBinLabel(2, "Disagree", 1);
00224
00225 pt4Comp_1d = dbe->book1D("pt4Comp_1d","Hardware Vs. Emulator Mode",2,0,2);
00226 pt4Comp_1d->setAxisTitle("Mode",1);
00227 pt4Comp_1d->setBinLabel(1, "Agree", 1);
00228 pt4Comp_1d->setBinLabel(2, "Disagree", 1);
00229
00230 pt5Comp_1d = dbe->book1D("pt5Comp_1d","Hardware Vs. Emulator Sign, FR",2,0,2);
00231 pt5Comp_1d->setAxisTitle("Sign<<1|FR",1);
00232 pt5Comp_1d->setBinLabel(1, "Agree", 1);
00233 pt5Comp_1d->setBinLabel(2, "Disagree", 1);
00234
00235
00236
00237 phiComp_1d = dbe->book1D("phiComp_1d","Hardware Vs. Emulator Track #phi",2,0,2);
00238 phiComp_1d->setAxisTitle("#phi",1);
00239 phiComp_1d->setBinLabel(1, "Agree", 1);
00240 phiComp_1d->setBinLabel(2, "Disagree", 1);
00241
00242 etaComp_1d = dbe->book1D("etaComp_1d","Hardware Vs. Emulator Track #eta",2,0,2);
00243 etaComp_1d->setAxisTitle("#eta",1);
00244 etaComp_1d->setBinLabel(1, "Agree", 1);
00245 etaComp_1d->setBinLabel(2, "Disagree", 1);
00246
00247 occComp_1d = dbe->book1D("occComp_1d","Hardware Vs. Emulator Track Occupancy",2,0,2);
00248 occComp_1d->setAxisTitle("Occupancy",1);
00249 occComp_1d->setBinLabel(1, "Agree", 1);
00250 occComp_1d->setBinLabel(2, "Disagree", 1);
00251
00252 ptComp_1d = dbe->book1D("ptComp_1d","Hardware Vs. Emulator Pt",2,0,2);
00253 ptComp_1d->setAxisTitle("P_{t}",1);
00254 ptComp_1d->setBinLabel(1, "Agree", 1);
00255 ptComp_1d->setBinLabel(2, "Disagree", 1);
00256
00257 qualComp_1d= dbe->book1D("qualComp_1d","Hardware Vs. Emulator Quality",2,0,2);
00258 qualComp_1d->setAxisTitle("Quality",1);
00259 qualComp_1d->setBinLabel(1, "Agree", 1);
00260 qualComp_1d->setBinLabel(2, "Disagree", 1);
00261
00262
00263 dtStubPhi_1d = dbe->book1D("dtStubPhi_1d","Hardware Vs. Emulator DT Stub #phi",2,0,2);
00264 dtStubPhi_1d->setAxisTitle("DT Stub #phi",1);
00265 dtStubPhi_1d->setBinLabel(1, "Agree", 1);
00266 dtStubPhi_1d->setBinLabel(2, "Disagree", 1);
00267
00268 }
00269
00270 }
00271
00272 void L1TdeCSCTF::endJob(void){
00273
00274 if(ptLUT_) delete ptLUT_;
00275
00276 if ( outFile.size() != 0 && dbe ) dbe->save(outFile);
00277 return;
00278 }
00279
00280 void L1TdeCSCTF::analyze(Event const& e, EventSetup const& es){
00281
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00372 unsigned int nDataMuons = 0;
00373 unsigned int nEmulMuons = 0;
00374 int dataMuonArray[8][10], emuMuonArray[8][10];
00375 for(int muon=0; muon<8; muon++)
00376 {
00377 for(int par=0; par<3; par++)
00378 {
00379 dataMuonArray[muon][par]=0;
00380 emuMuonArray[muon][par] =0;
00381 }
00382 emuMuonArray[muon][3] =-1;
00383 dataMuonArray[muon][3]=-1;
00384
00385 emuMuonArray[muon][4]=7;
00386 dataMuonArray[muon][4]=7;
00387
00388 for(int par2=5; par2<10; par2++)
00389 {
00390 emuMuonArray[muon][par2]= -1;
00391 dataMuonArray[muon][par2]= -1;
00392 }
00393 }
00394
00396 if( dataTrackProducer.label() != "null" )
00397 {
00398 Handle<L1CSCTrackCollection> tracks;
00399 e.getByLabel(dataTrackProducer.label(),dataTrackProducer.instance(),tracks);
00400
00401
00402 if(!tracks.isValid()) {
00403 LogWarning("L1TdeCSCTF")
00404 << "\n No valid [data tracks] product found: "
00405 << " L1CSCTrackCollection"
00406 << endl;
00407 return;
00408 }
00409
00410
00411 for(L1CSCTrackCollection::const_iterator trk=tracks.product()->begin(); trk!=tracks.product()->end(); trk++)
00412 {
00413 if (nDataMuons>=8)
00414 break;
00415 if( (trk->first.BX() <2) && (trk->first.BX() > -1) )
00416 {
00417
00418
00419 dataMuonArray[nDataMuons][0] = trk->first.ptLUTAddress();
00420 dataMuonArray[nDataMuons][1] = trk->first.sector();
00421 dataMuonArray[nDataMuons][2] = trk->first.endcap();
00422 dataMuonArray[nDataMuons][8] = trk->first.outputLink();
00423 dataMuonArray[nDataMuons][4] = trk->first.BX();
00424 dataMuonArray[nDataMuons][5] = trk->first.rank();
00425 dataMuonArray[nDataMuons][6] = trk->first.localPhi();
00426 dataMuonArray[nDataMuons][7] = trk->first.eta_packed();
00427 dataMuonArray[nDataMuons][9] = trk->first.modeExtended();
00428 nDataMuons++;
00429 }
00430 }
00431 }
00432
00434 if( emulTrackProducer.label() != "null" )
00435 {
00436 Handle<L1CSCTrackCollection> tracks;
00437 e.getByLabel(emulTrackProducer.label(),emulTrackProducer.instance(),tracks);
00438
00439
00440 if(!tracks.isValid()) {
00441 LogWarning("L1TdeCSCTF")
00442 << "\n No valid [emulator tracks] product found: "
00443 << " L1CSCTrackCollection"
00444 << endl;
00445 return;
00446 }
00447
00448 for(L1CSCTrackCollection::const_iterator trk=tracks.product()->begin(); trk!=tracks.product()->end(); trk++)
00449 {
00450 if(nEmulMuons>=8)
00451 break;
00452 if((trk->first.BX() <2) && (trk->first.BX() >-1))
00453 {
00454
00455
00456 emuMuonArray[nEmulMuons][0] = trk->first.ptLUTAddress();
00457 emuMuonArray[nEmulMuons][1] = trk->first.sector();
00458 emuMuonArray[nEmulMuons][2] = trk->first.endcap();
00459 emuMuonArray[nEmulMuons][4] = trk->first.BX();
00460 emuMuonArray[nEmulMuons][5] = trk->first.rank();
00461 emuMuonArray[nEmulMuons][6] = trk->first.localPhi();
00462 emuMuonArray[nEmulMuons][7] = trk->first.eta_packed();
00463 emuMuonArray[nEmulMuons][9] = trk->first.modeExtended();
00464 nEmulMuons++;
00465 }
00466 }
00467 }
00468
00469 if( (nDataMuons!=0)||(nEmulMuons!=0) ) {
00470 occComp->Fill(nDataMuons,nEmulMuons);
00471 (nDataMuons==nEmulMuons) ? occComp_1d->Fill(0) : occComp_1d->Fill(1);
00472 }
00473
00475 if(nDataMuons==nEmulMuons)
00476 {
00477
00478 for(unsigned int mu1=0; mu1<nDataMuons; mu1++)
00479 {
00480 for(unsigned int mu2=0; mu2<nEmulMuons; mu2++)
00481 if((emuMuonArray[mu2][1]==dataMuonArray[mu1][1])&&(emuMuonArray[mu2][2]==dataMuonArray[mu1][2]))
00482 {
00483 if(emuMuonArray[mu2][0]==dataMuonArray[mu1][0])
00484 {
00485 emuMuonArray[mu2][3]=mu1;
00486 dataMuonArray[mu1][3]=1;
00487 }
00488 }
00489 }
00490
00491 for(unsigned int c2a=0; c2a<nEmulMuons; c2a++)
00492 {
00493 if(emuMuonArray[c2a][3]==-1)
00494 {
00495 for(unsigned int cor_a=0; cor_a<nDataMuons; cor_a++)
00496 {
00497 if( (dataMuonArray[cor_a][1]==emuMuonArray[c2a][1]) && (dataMuonArray[cor_a][2]==emuMuonArray[c2a][2]))
00498 {
00499 emuMuonArray[c2a][3]=cor_a;
00500 dataMuonArray[cor_a][3]=1;
00501 }
00502 }
00503 }
00504 }
00505
00506 bool multiMap = false;
00507 if(nEmulMuons>1)
00508 {
00509 for(unsigned int c1a=0; c1a<(nEmulMuons-1); c1a++)
00510 {
00511 for(unsigned int c1b=(c1a+1); c1b<nEmulMuons; c1b++)
00512 {
00513 if(emuMuonArray[c1a][3]==emuMuonArray[c1b][3])
00514 {
00515
00516 multiMap = true;
00517 break;
00518 }
00519 }
00520 if (multiMap)
00521 break;
00522 }
00523 }
00524
00525 for(unsigned int mu3=0; mu3<nEmulMuons; mu3++)
00526 {
00527 int mapping = emuMuonArray[mu3][3];
00528 if((mapping!=-1)&&(multiMap==false))
00529 {
00530
00531 int emuPhi12 = (0x0000ff & emuMuonArray[mu3][0]);
00532 int datPhi12 = (0x0000ff & dataMuonArray[mapping][0]);
00533 int emuPhi23 = (0x000f00 & emuMuonArray[mu3][0])>>8;
00534 int datPhi23 = (0x000f00 & dataMuonArray[mapping][0])>>8;
00535 int emuEta = (0x00f000 & emuMuonArray[mu3][0])>>12;
00536 int datEta = (0x00f000 & dataMuonArray[mapping][0])>>12;
00537
00538
00539 int emuFrSin = (0xf00000 & emuMuonArray[mu3][0])>>20;
00540 int datFrSin = (0xf00000 & dataMuonArray[mapping][0])>>20;
00541
00542 int emuQual = emuMuonArray[mu3][5]>>5;
00543 int datQual = dataMuonArray[mapping][5]>>5;
00544 int emuPt = 0x1f & emuMuonArray[mu3][5];
00545 int datPt = 0x1f & dataMuonArray[mapping][5];
00546 int emuModeExtended = emuMuonArray[mu3][9];
00547 int datModeExtended = dataMuonArray[mapping][9];
00548
00549
00550 pt4Comp->Fill(datModeExtended,emuModeExtended);
00551 (datModeExtended==emuModeExtended) ? pt4Comp_1d->Fill(0) : pt4Comp_1d->Fill(1);
00552
00553 if(emuModeExtended==datModeExtended)
00554 {
00555
00556 pt1Comp->Fill(datPhi12,emuPhi12); (datPhi12==emuPhi12) ? pt1Comp_1d->Fill(0) : pt1Comp_1d->Fill(1);
00557 pt2Comp->Fill(datPhi23,emuPhi23); (datPhi23==emuPhi23) ? pt2Comp_1d->Fill(0) : pt2Comp_1d->Fill(1);
00558 pt3Comp->Fill(datEta,emuEta); (datEta==emuEta) ? pt3Comp_1d->Fill(0) : pt3Comp_1d->Fill(1);
00559 pt5Comp->Fill(datFrSin,emuFrSin); (datFrSin==emuFrSin) ? pt5Comp_1d->Fill(0) : pt5Comp_1d->Fill(1);
00560
00561 if(dataMuonArray[mapping][8]==1)
00562 {
00563 ptComp->Fill(datPt,emuPt); (datPt==emuPt) ? ptComp_1d->Fill(0) : ptComp_1d->Fill(1);
00564 qualComp->Fill(datQual,emuQual);(datQual==emuQual) ? qualComp_1d->Fill(0) : qualComp_1d->Fill(1);
00565 }
00566 phiComp->Fill(dataMuonArray[mapping][6],emuMuonArray[mu3][6]);
00567 etaComp->Fill(dataMuonArray[mapping][7],emuMuonArray[mu3][7]);
00568
00569 (dataMuonArray[mapping][6]==emuMuonArray[mu3][6]) ? phiComp_1d->Fill(0) : phiComp_1d->Fill(1);
00570 (dataMuonArray[mapping][7]==emuMuonArray[mu3][7]) ? etaComp_1d->Fill(0) : etaComp_1d->Fill(1);
00571 }
00572 }
00573 }
00574 }
00575
00576
00578
00579 int eDtStub[7][15];
00580 int dDtStub[8][15];
00581 int eDtCounter = 0;
00582 int dDtCounter = 0;
00583 for(int dJ=0; dJ<7; dJ++)
00584 {
00585 for(int dK=0; dK<15; dK++)
00586 {
00587 eDtStub[dJ][dK] = -55;
00588 dDtStub[dJ][dK] = -55;
00589 dDtStub[7][dK] = -55;
00590 }
00591 }
00592
00593
00594 if( dataStubProducer.label() != "null" )
00595 {
00596 Handle<CSCTriggerContainer<csctf::TrackStub> > dtTrig;
00597 e.getByLabel(dataStubProducer.label(),dataStubProducer.instance(),dtTrig);
00598
00599 if(!dtTrig.isValid()) {
00600 LogWarning("L1TdeCSCTF")
00601 << "\n No valid [Data Stubs] product found: "
00602 << " L1CSCTrackCollection"
00603 << endl;
00604 return;
00605 }
00606 const CSCTriggerContainer<csctf::TrackStub>* dt_stubs = dtTrig.product();
00607 CSCTriggerContainer<csctf::TrackStub> stub_list;
00608 stub_list.push_many(*dt_stubs);
00609 vector<csctf::TrackStub> stuList = stub_list.get();
00610 vector<csctf::TrackStub>::const_iterator stu= stuList.begin();
00611 for(; stu!=stuList.end(); stu++)
00612 {
00613 if(dDtCounter>=15)
00614 break;
00615 if((stu->BX()>4) && (stu->BX()<9))
00616 {
00617 dDtStub[0][dDtCounter] = stu->phiPacked();
00618 dDtStub[1][dDtCounter] = stu->getQuality();
00619 dDtStub[2][dDtCounter] = stu->endcap();
00620 dDtStub[3][dDtCounter] = stu->sector();
00621 dDtStub[4][dDtCounter] = stu->subsector();
00622 dDtCounter++;
00623 }
00624 }
00625 }
00626
00627
00628 if( emulStubProducer.label() != "null" )
00629 {
00630
00631 Handle<L1MuDTChambPhContainer> pCon;
00632 e.getByLabel(emulStubProducer.label(),emulStubProducer.instance(),pCon);
00633
00634 if(!pCon.isValid()) {
00635 LogWarning("L1TdeCSCTF")
00636 << "\n No valid [Data Stubs] product found: "
00637 << " L1CSCTrackCollection"
00638 << endl;
00639 return;
00640 }
00641 CSCTriggerContainer<csctf::TrackStub> emulStub = my_dtrc->process(pCon.product());
00642 vector<csctf::TrackStub> emuList = emulStub.get();
00643 vector<csctf::TrackStub>::const_iterator eStu=emuList.begin();
00644 for(; eStu!=emuList.end(); eStu++)
00645 {
00646
00647 if (eDtCounter>=15)
00648 break;
00649 if((eStu->BX()>4) && (eStu->BX()<9) )
00650 {
00651 eDtStub[0][eDtCounter] = eStu->phiPacked();
00652 eDtStub[1][eDtCounter] = eStu->getQuality();
00653 eDtStub[2][eDtCounter] = eStu->endcap();
00654 eDtStub[3][eDtCounter] = eStu->sector();
00655 eDtStub[4][eDtCounter] = eStu->subsector();
00656 eDtCounter++;
00657 }
00658 }
00659 }
00660
00661
00662
00663 for(int eS=0; eS<eDtCounter; eS++)
00664 {
00665
00666 for(int dS=0; dS<dDtCounter; dS++)
00667 {
00668
00669 if(eDtStub[2][eS]==dDtStub[2][dS])
00670 {
00671
00672 if(eDtStub[3][eS]==dDtStub[3][dS])
00673 {
00674
00675 if(eDtStub[4][eS]==dDtStub[4][dS])
00676 {
00677
00678 if( (eDtStub[0][eS]==dDtStub[0][dS]) && (eDtStub[1][eS]==dDtStub[1][dS]) && (eDtStub[6][eS]!=1) && (dDtStub[6][dS]!=1) )
00679 {
00680
00681 eDtStub[5][eS] = dS;
00682 eDtStub[6][eS] = 1;
00683 dDtStub[5][dS] = eS;
00684 dDtStub[6][dS] = 1;
00685 }
00686 }
00687 }
00688 }
00689 }
00690 }
00691
00692
00693 for(int eS2=0; eS2<eDtCounter; eS2++)
00694 {
00695 for(int dS2=0; dS2<dDtCounter; dS2++)
00696 {
00697
00698 if( (eDtStub[2][eS2]==dDtStub[2][dS2]) && (eDtStub[3][eS2]==dDtStub[3][dS2]) && (eDtStub[4][eS2]==dDtStub[4][dS2]) )
00699 {
00700
00701 if( ((dDtStub[7][eS2]==-55) || (dDtStub[7][dS2]>(abs(eDtStub[0][eS2]-dDtStub[0][dS2]))) ) && (eDtStub[6][eS2]!=1) && (dDtStub[6][dS2]!=1) )
00702 {
00703
00704 dDtStub[5][dS2] = eS2;
00705 dDtStub[6][dS2] = 2;
00706 eDtStub[5][eS2] = dS2;
00707 eDtStub[6][eS2] = 2;
00708 dDtStub[7][dS2] = abs(eDtStub[0][eS2]-dDtStub[0][dS2]);
00709 }
00710 }
00711 }
00712 }
00713
00714
00715 bool dtSMulti = false;
00716 int dtUnmap = 0;
00717 if(eDtCounter>1)
00718 for(int eS3a=0; eS3a<eDtCounter-1; eS3a++)
00719 for(int eS3b=eS3a+1; eS3b<eDtCounter; eS3b++)
00720 {
00721 if( eDtStub[5][eS3a]==eDtStub[5][eS3b] ) dtSMulti=true;
00722 if( eDtStub[5][eS3a]==-55 || eDtStub[5][eS3b]==-55 ) dtUnmap++;
00723 }
00724
00725 if(dDtCounter>1)
00726 for(int dS3a=0; dS3a<dDtCounter-1; dS3a++)
00727 for(int dS3b=dS3a+1; dS3b<dDtCounter; dS3b++)
00728 {
00729 if( dDtStub[5][dS3a]==dDtStub[5][dS3b] ) dtSMulti=true;
00730 if( dDtStub[5][dS3a]==-55||dDtStub[5][dS3b]==-55 ) dtUnmap++;
00731 }
00732
00733
00734
00735
00736
00737 if(dtSMulti==false && dtUnmap==0)
00738 {
00739 for(int phil=0; phil<eDtCounter; phil++)
00740 {
00741 if(eDtStub[6][phil]==1 || eDtStub[6][phil]==2)
00742 {
00743 int indexFil = eDtStub[3][phil]*2+eDtStub[4][phil]-1;
00744 dtStubPhi->Fill(eDtStub[0][phil], dDtStub[0][ eDtStub[5][phil] ]);
00745 (eDtStub[0][phil] == dDtStub[0][ eDtStub[5][phil] ]) ? dtStubPhi_1d->Fill(0) : dtStubPhi_1d->Fill(1);
00746 if( eDtStub[0][phil] != dDtStub[0][ eDtStub[5][phil] ])
00747 badDtStubSector->Fill(indexFil,eDtStub[2][phil]);
00748 }
00749 }
00750 }
00751
00752 }