CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1TCSCTF.cc
Go to the documentation of this file.
1 /*
2  * \file L1TCSCTF.cc
3  *
4  * \author J. Berryhill
5  *
6  */
7 
10 
11 // includes to fetch all reguired data products from the edm::Event
17 
20 
21 
22 using namespace std;
23 using namespace edm;
24 
26 // if some piece of data is absent - configure corresponding source with 'null:'
27 // : csctfSource_( ps.getParameter< InputTag >("csctfSource") )
28  : gmtProducer( ps.getParameter< InputTag >("gmtProducer") ),
29  lctProducer( ps.getParameter< InputTag >("lctProducer") ),
30  trackProducer( ps.getParameter< InputTag >("trackProducer") ),
31  statusProducer( ps.getParameter< InputTag >("statusProducer") ),
32  mbProducer( ps.getParameter< InputTag >("mbProducer") )
33 {
34 
35  // verbosity switch
36  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
37 
38  if(verbose_) edm::LogInfo("DataNotFound") << "L1TCSCTF: constructor...." << endl;
39 
40 
41  dbe = NULL;
42  if ( ps.getUntrackedParameter<bool>("DQMStore", false) )
43  {
45  dbe->setVerbose(0);
46  }
47 
48  outputFile_ = ps.getUntrackedParameter<string>("outputFile", "");
49  if ( outputFile_.size() != 0 )
50  {
51  edm::LogInfo("DataNotFound") << "L1T Monitoring histograms will be saved to " << outputFile_.c_str() << endl;
52  }
53 
54  bool disable = ps.getUntrackedParameter<bool>("disableROOToutput", false);
55  if(disable){
56  outputFile_="";
57  }
58 
59  gangedME11a_ = ps.getUntrackedParameter<bool>("gangedME11a", false);
60 
61  if ( dbe !=NULL )
62  {
63  dbe->setCurrentFolder("L1T/L1TCSCTF");
64  }
65 
66  // instantiate standard on-fly SR LUTs from CSC TF emulator package
67  bzero(srLUTs_,sizeof(srLUTs_));
68  int endcap=1, sector=1; // assume SR LUTs are all same for every sector in either of endcaps
69  bool TMB07=true; // specific TMB firmware
70  // Create a dummy pset for SR LUTs
71  edm::ParameterSet srLUTset;
72  srLUTset.addUntrackedParameter<bool>("ReadLUTs", false);
73  srLUTset.addUntrackedParameter<bool>("Binary", false);
74  srLUTset.addUntrackedParameter<std::string>("LUTPath", "./");
75  for(int station=1,fpga=0; station<=4 && fpga<5; station++)
76  {
77  if(station==1)
78  for(int subSector=0; subSector<2 && fpga<5; subSector++)
79  srLUTs_[fpga++] = new CSCSectorReceiverLUT(endcap, sector, subSector+1, station, srLUTset, TMB07);
80  else
81  srLUTs_[fpga++] = new CSCSectorReceiverLUT(endcap, sector, 0, station, srLUTset, TMB07);
82  }
83 
84  //set Token(-s)
90 
91  gmtProducerToken_ = consumes<L1MuGMTReadoutCollection>(ps.getParameter< InputTag >("gmtProducer"));
92  statusToken_ = consumes<L1CSCStatusDigiCollection>(statusTag_);
93  corrlctsToken_ = consumes<CSCCorrelatedLCTDigiCollection>(corrlctsTag_);
94  tracksToken_ = consumes<L1CSCTrackCollection>(tracksTag_);
95  dtStubsToken_ = consumes<CSCTriggerContainer<csctf::TrackStub> >(dtStubsTag_);
96  mbtracksToken_ = consumes<L1CSCTrackCollection>(mbtracksTag_);
97 }
98 
100 {
101 
102  for(int i=0; i<5; i++)
103  delete srLUTs_[i]; //free the array of pointers
104 }
105 
107 {
108  m_scalesCacheID = -999;
109  m_ptScaleCacheID = -999;
110 
111  nev_ = 0;
112 
113  // get hold of back-end interface
114  DQMStore* dbe = 0;
115  dbe = Service<DQMStore>().operator->();
116 
117  if( dbe )
118  {
119  dbe->setCurrentFolder("L1T/L1TCSCTF");
120  dbe->rmdir("L1T/L1TCSCTF");
121  }
122 
123 
124  if( dbe )
125  {
126  dbe->setCurrentFolder("L1T/L1TCSCTF");
127 
128  // Error counting histogram:
129  // 1) checks TF data integrity (error rate - first bin),
130  // 2) monitors sychronization on input links (4 errors types: SE/SM/BX/AF; ORed for all time bins, links, and SPs),
131  // 3) reports FMM status (if in any SP FMM status != "Ready" - fill the last bin)
132  csctferrors = dbe->book1D("CSCTF_errors","CSCTF Errors",6,0,6);
133  csctferrors->setAxisTitle("Error type",1);
134  csctferrors->setAxisTitle("Number of Errors",2);
135  csctferrors->setBinLabel(1,"Corruptions",1);
136  csctferrors->setBinLabel(2,"Synch. Err.",1);
137  csctferrors->setBinLabel(3,"Synch. Mod.",1);
138  csctferrors->setBinLabel(4,"BX mismatch",1);
139  csctferrors->setBinLabel(5,"Time misalign.",1);
140  csctferrors->setBinLabel(6,"FMM != Ready",1);
141 
142  // Occupancy histogram Eta x Y, where Y:
143  // 1) Phi_packed of input LCTs from 1st, 2nd, 3rd, and 4th stations
144  // 2) Phi_packed of output tracks
145  // (all 12 SPs - 360 degree coveradge)
146  csctfoccupancies = dbe->book2D("CSCTF_occupancies", "CSCTF Occupancies", 64,-32,31,32,0,6.2);
147  csctfoccupancies->setAxisTitle("#eta",1);
148  csctfoccupancies->setAxisTitle("#phi",2);
149  csctfoccupancies->setBinLabel( 1,"-2.5", 1);
150  csctfoccupancies->setBinLabel( 8,"-2.1", 1);
151  csctfoccupancies->setBinLabel(18,"-1.6", 1);
152  csctfoccupancies->setBinLabel(26,"-1.2", 1);
153  csctfoccupancies->setBinLabel(32,"-0.9", 1);
154  csctfoccupancies->setBinLabel(33, "0.9", 1);
155  csctfoccupancies->setBinLabel(39, "1.2", 1);
156  csctfoccupancies->setBinLabel(47, "1.6", 1);
157  csctfoccupancies->setBinLabel(57, "2.1", 1);
158  csctfoccupancies->setBinLabel(64, "2.5", 1);
159 
160  // ... and for halo muons only
161  csctfoccupancies_H = dbe->book2D("CSCTF_occupancies_H", "CSCTF Halo Occupancies", 64,-32,31,32,0,6.2);
162  csctfoccupancies_H->setAxisTitle("#eta",1);
163  csctfoccupancies_H->setAxisTitle("#phi",2);
164  csctfoccupancies_H->setBinLabel( 1,"-2.5", 1);
165  csctfoccupancies_H->setBinLabel( 8,"-2.1", 1);
166  csctfoccupancies_H->setBinLabel(18,"-1.6", 1);
167  csctfoccupancies_H->setBinLabel(26,"-1.2", 1);
168  csctfoccupancies_H->setBinLabel(32,"-0.9", 1);
169  csctfoccupancies_H->setBinLabel(33, "0.9", 1);
170  csctfoccupancies_H->setBinLabel(39, "1.2", 1);
171  csctfoccupancies_H->setBinLabel(47, "1.6", 1);
172  csctfoccupancies_H->setBinLabel(57, "2.1", 1);
173  csctfoccupancies_H->setBinLabel(64, "2.5", 1);
174 
175  //haloDelEta12 = dbe->book1D("CSCTF_Halo_Eta12", "#Delta #eta_{12} for Halo Muons", 40, -0.20,0.30);
176  //haloDelEta112 = dbe->book1D("CSCTF_Halo_Eta112","#Delta #eta_{112} for Halo Muons", 40, -0.20,0.30);
177  //haloDelEta13 = dbe->book1D("CSCTF_Halo_Eta13", "#Delta #eta_{13} for Halo Muons", 40, -0.20,0.30);
178  //haloDelEta113 = dbe->book1D("CSCTF_Halo_Eta113","#Delta #eta_{113} for Halo Muons", 40, -0.20,0.30);
179 
180  // Quality VS Mode
181  trackModeVsQ = dbe->book2D("CSCTF_Track_ModeVsQual","CSC Track Mode Vs Quality", 19, -0.5, 18.5, 4, 0, 4);
182  trackModeVsQ->setAxisTitle("Track Type", 1);
183  trackModeVsQ->setBinLabel(1,"No Track",1);
184  trackModeVsQ->setBinLabel(2,"Bad Phi/Single",1);
185  trackModeVsQ->setBinLabel(3,"ME1-2-3",1);
186  trackModeVsQ->setBinLabel(4,"ME1-2-4",1);
187  trackModeVsQ->setBinLabel(5,"ME1-3-4",1);
188  trackModeVsQ->setBinLabel(6,"ME2-3-4",1);
189  trackModeVsQ->setBinLabel(7,"ME1-2",1);
190  trackModeVsQ->setBinLabel(8,"ME1-3",1);
191  trackModeVsQ->setBinLabel(9,"ME2-3",1);
192  trackModeVsQ->setBinLabel(10,"ME2-4",1);
193  trackModeVsQ->setBinLabel(11,"ME3-4",1);
194  trackModeVsQ->setBinLabel(12,"MB1-ME3",1);
195  trackModeVsQ->setBinLabel(13,"MB1-ME2",1);
196  trackModeVsQ->setBinLabel(14,"ME1-4",1);
197  trackModeVsQ->setBinLabel(15,"MB1-ME1",1);
198  trackModeVsQ->setBinLabel(16,"Halo Trigger",1);
199  trackModeVsQ->setBinLabel(17,"MB1-ME1-2",1);
200  trackModeVsQ->setBinLabel(18,"MB1-ME1-3",1);
201  trackModeVsQ->setBinLabel(19,"MB1-ME2-3",1);
202 
203  trackModeVsQ->setAxisTitle("Quality",2);
204  trackModeVsQ->setBinLabel(1,"0",2);
205  trackModeVsQ->setBinLabel(2,"1",2);
206  trackModeVsQ->setBinLabel(3,"2",2);
207  trackModeVsQ->setBinLabel(4,"3",2);
208 
209  // Mode
210  csctfTrackM = dbe->book1D("CSCTF_Track_Mode","CSC Track Mode", 19, -0.5, 18.5);
211  csctfTrackM->setAxisTitle("Track Type", 1);
212  csctfTrackM->setBinLabel(1,"No Track",1);
213  csctfTrackM->setBinLabel(2,"Bad Phi/Single",1);
214  csctfTrackM->setBinLabel(3,"ME1-2-3",1);
215  csctfTrackM->setBinLabel(4,"ME1-2-4",1);
216  csctfTrackM->setBinLabel(5,"ME1-3-4",1);
217  csctfTrackM->setBinLabel(6,"ME2-3-4",1);
218  csctfTrackM->setBinLabel(7,"ME1-2",1);
219  csctfTrackM->setBinLabel(8,"ME1-3",1);
220  csctfTrackM->setBinLabel(9,"ME2-3",1);
221  csctfTrackM->setBinLabel(10,"ME2-4",1);
222  csctfTrackM->setBinLabel(11,"ME3-4",1);
223  csctfTrackM->setBinLabel(12,"MB1-ME3",1);
224  csctfTrackM->setBinLabel(13,"MB1-ME2",1);
225  csctfTrackM->setBinLabel(14,"ME1-4",1);
226  csctfTrackM->setBinLabel(15,"MB1-ME1",1);
227  csctfTrackM->setBinLabel(16,"Halo Trigger",1);
228  csctfTrackM->setBinLabel(17,"MB1-ME1-2",1);
229  csctfTrackM->setBinLabel(18,"MB1-ME1-3",1);
230  csctfTrackM->setBinLabel(19,"MB1-ME2-3",1);
231 
232  // Chamber Occupancy
233  csctfChamberOccupancies = dbe->book2D("CSCTF_Chamber_Occupancies","CSCTF Chamber Occupancies", 54, -0.05, 5.35, 10, -5.5, 4.5);
234  csctfChamberOccupancies->setAxisTitle("Sector, (chambers 1-9 not labeled)",1);
238  csctfChamberOccupancies->setBinLabel(4,"ME-1b",2);
239  csctfChamberOccupancies->setBinLabel(5,"ME-1a",2);
240  csctfChamberOccupancies->setBinLabel(6,"ME+1a",2);
241  csctfChamberOccupancies->setBinLabel(7,"ME+1b",2);
244  csctfChamberOccupancies->setBinLabel(10,"ME+4",2);
251 
252  // Track Phi
253  csctfTrackPhi = dbe->book1D("CSCTF_Track_Phi", "CSCTF Track #phi",144,0,2*M_PI);
254  csctfTrackPhi->setAxisTitle("Track #phi", 1);
255 
256  // Track Eta
257  csctfTrackEta = dbe->book1D("CSCTF_Track_Eta", "CSCTF Track #eta",64,-32,32);
258  csctfTrackEta->setAxisTitle("Track #eta", 1);
259  csctfTrackEta->setBinLabel( 1,"-2.5", 1);
260  csctfTrackEta->setBinLabel( 8,"-2.1", 1);
261  csctfTrackEta->setBinLabel(18,"-1.6", 1);
262  csctfTrackEta->setBinLabel(26,"-1.2", 1);
263  csctfTrackEta->setBinLabel(32,"-0.9", 1);
264  csctfTrackEta->setBinLabel(33, "0.9", 1);
265  csctfTrackEta->setBinLabel(39, "1.2", 1);
266  csctfTrackEta->setBinLabel(47, "1.6", 1);
267  csctfTrackEta->setBinLabel(57, "2.1", 1);
268  csctfTrackEta->setBinLabel(64, "2.5", 1);
269 
270  // Track Eta Low Quality
271  csctfTrackEtaLowQ = dbe->book1D("CSCTF_Track_Eta_LowQ", "CSCTF Track #eta LQ",64,-32,32);
272  csctfTrackEtaLowQ->setAxisTitle("Track #eta", 1);
273  csctfTrackEtaLowQ->setBinLabel( 1,"-2.5", 1);
274  csctfTrackEtaLowQ->setBinLabel( 8,"-2.1", 1);
275  csctfTrackEtaLowQ->setBinLabel(18,"-1.6", 1);
276  csctfTrackEtaLowQ->setBinLabel(26,"-1.2", 1);
277  csctfTrackEtaLowQ->setBinLabel(32,"-0.9", 1);
278  csctfTrackEtaLowQ->setBinLabel(33, "0.9", 1);
279  csctfTrackEtaLowQ->setBinLabel(39, "1.2", 1);
280  csctfTrackEtaLowQ->setBinLabel(47, "1.6", 1);
281  csctfTrackEtaLowQ->setBinLabel(57, "2.1", 1);
282  csctfTrackEtaLowQ->setBinLabel(64, "2.5", 1);
283 
284 
285  // Track Eta High Quality
286  csctfTrackEtaHighQ = dbe->book1D("CSCTF_Track_Eta_HighQ", "CSCTF Track #eta HQ",64,-32,32);
287  csctfTrackEtaHighQ->setAxisTitle("Track #eta", 1);
288  csctfTrackEtaHighQ->setBinLabel( 1,"-2.5", 1);
289  csctfTrackEtaHighQ->setBinLabel( 8,"-2.1", 1);
290  csctfTrackEtaHighQ->setBinLabel(18,"-1.6", 1);
291  csctfTrackEtaHighQ->setBinLabel(26,"-1.2", 1);
292  csctfTrackEtaHighQ->setBinLabel(32,"-0.9", 1);
293  csctfTrackEtaHighQ->setBinLabel(33, "0.9", 1);
294  csctfTrackEtaHighQ->setBinLabel(39, "1.2", 1);
295  csctfTrackEtaHighQ->setBinLabel(47, "1.6", 1);
296  csctfTrackEtaHighQ->setBinLabel(57, "2.1", 1);
297  csctfTrackEtaHighQ->setBinLabel(64, "2.5", 1);
298 
299 
300  // Halo Phi
301  csctfTrackPhi_H = dbe->book1D("CSCTF_Track_Phi_H", "CSCTF Halo #phi",144,0,2*M_PI);
302  csctfTrackPhi_H->setAxisTitle("Track #phi", 1);
303 
304  // Halo Eta
305  csctfTrackEta_H = dbe->book1D("CSCTF_Track_Eta_H", "CSCTF Halo #eta",64,-32,32);
306  csctfTrackEta_H->setAxisTitle("Track #eta", 1);
307  csctfTrackEta_H->setBinLabel( 1,"-2.5", 1);
308  csctfTrackEta_H->setBinLabel( 8,"-2.1", 1);
309  csctfTrackEta_H->setBinLabel(18,"-1.6", 1);
310  csctfTrackEta_H->setBinLabel(26,"-1.2", 1);
311  csctfTrackEta_H->setBinLabel(32,"-0.9", 1);
312  csctfTrackEta_H->setBinLabel(33, "0.9", 1);
313  csctfTrackEta_H->setBinLabel(39, "1.2", 1);
314  csctfTrackEta_H->setBinLabel(47, "1.6", 1);
315  csctfTrackEta_H->setBinLabel(57, "2.1", 1);
316  csctfTrackEta_H->setBinLabel(64, "2.5", 1);
317 
318  // Track Timing
319  csctfbx = dbe->book2D("CSCTF_bx","CSCTF BX", 12,1,13, 7,-3,3) ;
320  csctfbx->setAxisTitle("Sector (Endcap)", 1);
321  csctfbx->setBinLabel( 1," 1 (+)",1);
322  csctfbx->setBinLabel( 2," 2 (+)",1);
323  csctfbx->setBinLabel( 3," 3 (+)",1);
324  csctfbx->setBinLabel( 4," 4 (+)",1);
325  csctfbx->setBinLabel( 5," 5 (+)",1);
326  csctfbx->setBinLabel( 6," 6 (+)",1);
327  csctfbx->setBinLabel( 7," 7 (-)",1);
328  csctfbx->setBinLabel( 8," 8 (-)",1);
329  csctfbx->setBinLabel( 9," 9 (-)",1);
330  csctfbx->setBinLabel(10,"10 (-)",1);
331  csctfbx->setBinLabel(11,"11 (-)",1);
332  csctfbx->setBinLabel(12,"12 (-)",1);
333 
334  csctfbx->setAxisTitle("CSCTF BX", 2);
335  csctfbx->setBinLabel( 1, "-3", 2);
336  csctfbx->setBinLabel( 2, "-2", 2);
337  csctfbx->setBinLabel( 3, "-1", 2);
338  csctfbx->setBinLabel( 4, "-0", 2);
339  csctfbx->setBinLabel( 5, " 1", 2);
340  csctfbx->setBinLabel( 6, " 2", 2);
341  csctfbx->setBinLabel( 7, " 3", 2);
342 
343  // Halo Timing
344  csctfbx_H = dbe->book2D("CSCTF_bx_H","CSCTF HALO BX", 12,1,13, 7,-3,3) ;
345  csctfbx_H->setAxisTitle("Sector (Endcap)", 1);
346  csctfbx_H->setBinLabel( 1," 1 (+)",1);
347  csctfbx_H->setBinLabel( 2," 2 (+)",1);
348  csctfbx_H->setBinLabel( 3," 3 (+)",1);
349  csctfbx_H->setBinLabel( 4," 4 (+)",1);
350  csctfbx_H->setBinLabel( 5," 5 (+)",1);
351  csctfbx_H->setBinLabel( 6," 6 (+)",1);
352  csctfbx_H->setBinLabel( 7," 7 (-)",1);
353  csctfbx_H->setBinLabel( 8," 8 (-)",1);
354  csctfbx_H->setBinLabel( 9," 9 (-)",1);
355  csctfbx_H->setBinLabel(10,"10 (-)",1);
356  csctfbx_H->setBinLabel(11,"11 (-)",1);
357  csctfbx_H->setBinLabel(12,"12 (-)",1);
358 
359  csctfbx_H->setAxisTitle("CSCTF BX", 2);
360  csctfbx_H->setBinLabel( 1, "-3", 2);
361  csctfbx_H->setBinLabel( 2, "-2", 2);
362  csctfbx_H->setBinLabel( 3, "-1", 2);
363  csctfbx_H->setBinLabel( 4, "-0", 2);
364  csctfbx_H->setBinLabel( 5, " 1", 2);
365  csctfbx_H->setBinLabel( 6, " 2", 2);
366  csctfbx_H->setBinLabel( 7, " 3", 2);
367 
368  // Number of Tracks Stubs
369  cscTrackStubNumbers = dbe->book1D("CSCTF_TrackStubs", "Number of Stubs in CSCTF Tracks", 5, 0, 5);
370  cscTrackStubNumbers->setBinLabel( 1, "0", 1);
371  cscTrackStubNumbers->setBinLabel( 2, "1", 1);
372  cscTrackStubNumbers->setBinLabel( 3, "2", 1);
373  cscTrackStubNumbers->setBinLabel( 4, "3", 1);
374  cscTrackStubNumbers->setBinLabel( 5, "4", 1);
375 
376  // Number of Tracks
377  csctfntrack = dbe->book1D("CSCTF_ntrack","Number of CSCTracks found per event", 5, 0, 5 ) ;
378  csctfntrack->setBinLabel( 1, "0", 1);
379  csctfntrack->setBinLabel( 2, "1", 1);
380  csctfntrack->setBinLabel( 3, "2", 1);
381  csctfntrack->setBinLabel( 4, "3", 1);
382  csctfntrack->setBinLabel( 5, "4", 1);
383  }
384 
385  char hname [200];
386  char htitle[200];
387 
388  for(int i=0; i<12; i++) {
389 
390  sprintf(hname ,"DTstubsTimeTrackMenTimeArrival_%d",i+1);
391  sprintf(htitle,"T_{track} - T_{DT stub} sector %d",i+1);
392 
393  DTstubsTimeTrackMenTimeArrival[i] = dbe->book2D(hname,htitle, 7,-3,3, 2,1,3);
394  DTstubsTimeTrackMenTimeArrival[i]->getTH2F()->SetMinimum(0);
395 
396  // axis makeup
397  DTstubsTimeTrackMenTimeArrival[i]->setAxisTitle("bx_{CSC track} - bx_{DT stub}",1);
399 
407 
410 
411  }
412 
413 
414  // NEW: CSC EVENT LCT PLOTS, Renjie Wang
415  csctflcts = dbe->book2D("CSCTF_LCT", "CSCTF LCTs", 12,1,13, 18,0,18);
416  csctflcts->setAxisTitle("CSCTF LCT BX",1);
417  csctflcts->setBinLabel(1,"1",1);
418  csctflcts->setBinLabel(2,"2",1);
419  csctflcts->setBinLabel(3,"3",1);
420  csctflcts->setBinLabel(4,"4",1);
421  csctflcts->setBinLabel(5,"5",1);
422  csctflcts->setBinLabel(6,"6",1);
423  csctflcts->setBinLabel(7,"7",1);
424  csctflcts->setBinLabel(8,"8",1);
425  csctflcts->setBinLabel(9,"9",1);
426  csctflcts->setBinLabel(10,"10",1);
427  csctflcts->setBinLabel(11,"11",1);
428  csctflcts->setBinLabel(12,"12",1);
429 
430  int ihist = 0;
431  for (int iEndcap = 0; iEndcap < 2; iEndcap++) {
432  for (int iStation = 1; iStation < 5; iStation++) {
433  for (int iRing = 1; iRing < 4; iRing++) {
434  if (iStation != 1 && iRing > 2) continue;
435  TString signEndcap="+";
436  if(iEndcap==0) signEndcap="-";
437 
438  char lcttitle[200];
439  snprintf(lcttitle,200,"ME%s%d/%d", signEndcap.Data(), iStation, iRing);
440  if(ihist<=8){
441  csctflcts -> setBinLabel(9-ihist,lcttitle,2);
442  }
443  else csctflcts -> setBinLabel(ihist+1,lcttitle,2);
444 
445  ihist++;
446  }
447  }
448  }
449 
450 
451  // plots for ME1/1 chambers
452  me11_lctStrip = dbe->book1D("CSC_ME11_LCT_Strip", "CSC_ME11_LCT_Strip", 223, 0, 223);
453  me11_lctStrip->setAxisTitle("Cathode HalfStrip, ME1/1", 1);
454 
455  me11_lctWire = dbe->book1D("CSC_ME11_LCT_Wire", "CSC_ME11_LCT_Wire", 112, 0, 112);
456  me11_lctWire->setAxisTitle("Anode Wiregroup, ME1/1", 1);
457 
458  me11_lctLocalPhi = dbe->book1D("CSC_ME11_LCT_LocalPhi", "CSC_ME11_LCT_LocalPhi", 200,0,1024);
459  me11_lctLocalPhi ->setAxisTitle("LCT Local #it{#phi}, ME1/1", 1);
460 
461  me11_lctPackedPhi = dbe->book1D("CSC_ME11_LCT_PackedPhi", "CSC_ME11_LCT_PackedPhi", 200,0,4096);
462  me11_lctPackedPhi ->setAxisTitle("LCT Packed #it{#phi}, ME1/1",1);
463 
464  me11_lctGblPhi = dbe->book1D("CSC_ME11_LCT_GblPhi", "CSC_ME11_LCT_GblPhi", 200, 0, 2*M_PI);
465  me11_lctGblPhi ->setAxisTitle("LCT Global #it{#phi}, ME1/1", 1);
466 
467  me11_lctGblEta = dbe->book1D("CSC_ME11_LCT_GblEta", "CSC_ME11_LCT_GblEta", 50, 0.9, 2.5);
468  me11_lctGblEta ->setAxisTitle("LCT Global #eta, ME1/1", 1);
469 
470 
471  // plots for ME4/2 chambers
472  me42_lctGblPhi = dbe->book1D("CSC_ME42_LCT_GblPhi", "CSC_ME42_LCT_GblPhi", 200, 0, 2*M_PI);
473  me42_lctGblPhi ->setAxisTitle("LCT Global #it{#phi}, ME4/2", 1);
474 
475  me42_lctGblEta = dbe->book1D("CSC_ME42_LCT_GblEta", "CSC_ME42_LCT_GblEta", 50, 0.9, 2.5);
476  me42_lctGblEta ->setAxisTitle("LCT Global #eta, ME4/2", 1);
477 
478 
479 
480 }
481 
482 
484 {
485 
486  if(verbose_) edm::LogInfo("DataNotFound") << "L1TCSCTF: end job...." << endl;
487  LogInfo("EndJob") << "analyzed " << nev_ << " events";
488 
489  if ( outputFile_.size() != 0 && dbe ) dbe->save(outputFile_);
490 
491  return;
492 }
493 
494 void L1TCSCTF::analyze(const Event& e, const EventSetup& c)
495 {
496 
498  c.get< L1MuTriggerPtScaleRcd >().cacheIdentifier() != m_ptScaleCacheID ){
499 
501  c.get< L1MuTriggerScalesRcd >().get(scales);
502  ts = scales.product();
504  c.get< L1MuTriggerPtScaleRcd >().get(ptscales);
505  tpts = ptscales.product();
506  m_scalesCacheID = c.get< L1MuTriggerScalesRcd >().cacheIdentifier();
507  m_ptScaleCacheID = c.get< L1MuTriggerPtScaleRcd >().cacheIdentifier();
508 
509  edm::LogInfo("L1TCSCTF") << "Changing triggerscales and triggerptscales...";
510  }
511 
512  int NumCSCTfTracksRep = 0;
513  nev_++;
514  if(verbose_) edm::LogInfo("DataNotFound") << "L1TCSCTF: analyze...." << endl;
515 
517  if( gmtProducer.label() != "null" )
518  { // GMT block
519  e.getByToken(gmtProducerToken_, pCollection);
520  if (!pCollection.isValid())
521  {
522  edm::LogInfo("DataNotFound") << "can't find L1MuGMTReadoutCollection with label "; // << csctfSource_.label() ;
523  return;
524  }
525 
526  L1MuGMTReadoutCollection const* gmtrc = pCollection.product();
527  vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
528  vector<L1MuGMTReadoutRecord>::const_iterator RRItr;
529 
530  // Look if the readout window contains one (and only one CSC cands)
531  // to make it simpler I reject events with more than a CSC cand in the
532  // same readout window
533 
534  // count non-empty candidates in this bx
535  int bxWindow = 0;
536  int nCands = 0;
537 
538  for( RRItr = gmt_records.begin(); RRItr != gmt_records.end(); RRItr++ ) {
539  bxWindow++;
540 
541  // get the csc candidates
542  vector<L1MuRegionalCand> INPCands = RRItr->getCSCCands();
543  vector<L1MuRegionalCand>::const_iterator INPItr;
544 
545  BxInEvent_ = 0;
546  isCSCcand_ = false;
547  int nCandsBx = 0;
548 
549  for( INPItr = INPCands.begin(); INPItr != INPCands.end(); ++INPItr ) {
550  if(!INPItr->empty())
551  {
552  nCandsBx++;
553  nCands++;
554  BxInEvent_ = RRItr->getBxInEvent();
555  if (verbose_) edm::LogInfo("DataNotFound") << "cand " << nCandsBx << " -> assigned CSCTF bx: " << INPItr->bx() << endl;
556  }
557  }
558  if (verbose_)
559  if(nCandsBx) edm::LogInfo("DataNotFound") << nCandsBx << " cands in bx: " << BxInEvent_ << endl;
560  }
561 
562  if (nCands != 1) return;
563  else isCSCcand_ = true;
564  if (verbose_) edm::LogInfo("DataNotFound") << "bxWindow: " << bxWindow << endl;
565 
566  int ncsctftrack = 0;
567  if (verbose_)
568  {
569  edm::LogInfo("DataNotFound") << "\tCSCTFCand ntrack " << ncsctftrack << endl;
570  }
571  } // end of GMT block
572 
573  L1ABXN = -999;
574  if( statusProducer.label() != "null" )
575  {
577  e.getByToken(statusToken_, status);
578  bool integrity=status->first, se=false, sm=false, bx=false, af=false, fmm=false;
579  int nStat = 0;
580 
581  for(std::vector<L1CSCSPStatusDigi>::const_iterator stat=status->second.begin(); stat!=status->second.end(); stat++)
582  {
583  se |= stat->SEs()&0xFFF;
584  sm |= stat->SMs()&0xFFF;
585  bx |= stat->BXs()&0xFFF;
586  af |= stat->AFs()&0xFFF;
587  fmm|= stat->FMM()!=8;
588 
589  if(stat->VPs() != 0)
590  {
591  L1ABXN += stat->BXN();
592  nStat++;
593  }
594  }
595  // compute the average
596  if(nStat!=0) L1ABXN /= nStat;
597  if(integrity) csctferrors->Fill(0.5);
598  if(se) csctferrors->Fill(1.5);
599  if(sm) csctferrors->Fill(2.5);
600  if(bx) csctferrors->Fill(3.5);
601  if(af) csctferrors->Fill(4.5);
602  if(fmm) csctferrors->Fill(5.5);
603  }
604 
605  if( lctProducer.label() != "null" )
606  {
608  c.get<MuonGeometryRecord>().get( pDD );
610 
612  e.getByToken(corrlctsToken_, corrlcts);
613 
614  for(CSCCorrelatedLCTDigiCollection::DigiRangeIterator csc=corrlcts.product()->begin(); csc!=corrlcts.product()->end(); csc++)
615  {
616  CSCCorrelatedLCTDigiCollection::Range range1 = corrlcts.product()->get((*csc).first);
617  for(CSCCorrelatedLCTDigiCollection::const_iterator lct=range1.first; lct!=range1.second; lct++)
618  {
619  int endcap = (*csc).first.endcap()-1;
620  int station = (*csc).first.station()-1;
621  int sector = (*csc).first.triggerSector()-1;
622  int subSector = CSCTriggerNumbering::triggerSubSectorFromLabels((*csc).first);
623  int ring = (*csc).first.ring();
624  int cscId = (*csc).first.triggerCscId()-1;
625  int fpga = ( subSector ? subSector-1 : station+1 );
626  int strip = lct -> getStrip();
627  int keyWire = lct -> getKeyWG();
628  int bx = lct -> getBX();
629 
630  int endcapAssignment = 1;
631  int shift = 1;
632  float sectorArg = sector;
633  //float sectorArg = j;
634 
635  if( endcap == 1 ){
636  endcapAssignment = -1;
637  shift = 2;
638  //sectorArg = sector - 6;
639  }
640 
641  int signedStation = (station + shift)* endcapAssignment;
642  if( (station == 0) && (endcap == 0)) signedStation = subSector - 1;
643  if( (station == 0) && (endcap == 1)) signedStation = (-1)*subSector;
644 
645  float chamberArg1 = cscId * 0.1 + sectorArg;
646  //float chamberArg1 = i*0.1 + sectorArg;
647  //std::cout << "First" << i << " " << sectorArg << " " << chamberArg1 << std::endl;
648 
649  float chamberArg11 = chamberArg1;
650  if(sectorArg == 1) chamberArg1 = chamberArg11 - 0.1;
651  if(sectorArg == 2) chamberArg1 = chamberArg11 - 0.2;
652  if(sectorArg == 3) chamberArg1 = chamberArg11 - 0.3;
653  if(sectorArg == 4) chamberArg1 = chamberArg11 - 0.4;
654  if(sectorArg == 5) chamberArg1 = chamberArg11 - 0.5;
655 
656  //std::cout << "cscId, station, sector, endcap, sectorArg, chamber Arg: " << cscId << ", " << station << ", " <<sector << ", " << endcap << ", " << chamberArg1 << ", " << signedStation << std::endl;
657 
658  csctfChamberOccupancies->Fill(chamberArg1, signedStation);
659  //int bunchX = ( (lct->getBX()) - 6 );
660 
661  //int timingSectorArg = 3*(sector) + (lct->getMPCLink());
662  //if( endcap == 1) timingSectorArg = 3*(sector + 6) + (lct->getMPCLink());
663  //std::cout << "Sector, MPCLink, TSA, endcap: " << sector << ", " << lct->getMPCLink() << ", " << timingSectorArg << ", " << endcap << std::endl;
664 
665  //csctfbx->Fill(timingSectorArg, bunchX );
666  //std::cout << "LCT'S, encap: " << endcap << ", station: " << station << ", sector: " << sector << ", subSector: " << subSector << ", cscId: " << cscId << std:: endl;
667  //End JAG
668 
669  // Check if Det Id is within pysical range:
670  if( endcap<0||endcap>1 || sector<0||sector>6 || station<0||station>3 || cscId<0||cscId>8 || fpga<0||fpga>4)
671  {
672  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);
673  continue;
674  }
675  lclphidat lclPhi;
676  try {
677  lclPhi = srLUTs_[fpga]->localPhi(lct->getStrip(), lct->getPattern(), lct->getQuality(), lct->getBend(), gangedME11a_);
678  } catch(cms::Exception &) {
679  bzero(&lclPhi,sizeof(lclPhi));
680  }
681 
682  gblphidat gblPhi;
683  try {
684  gblPhi = srLUTs_[fpga]->globalPhiME(lclPhi.phi_local, lct->getKeyWG(), cscId+1, gangedME11a_);
685  } catch(cms::Exception &) {
686  bzero(&gblPhi,sizeof(gblPhi));
687  }
688 
689  gbletadat gblEta;
690  try {
691  gblEta = srLUTs_[fpga]->globalEtaME(lclPhi.phi_bend_local, lclPhi.phi_local, lct->getKeyWG(), cscId+1, gangedME11a_);
692  } catch(cms::Exception &) {
693  bzero(&gblEta,sizeof(gblEta));
694  }
695 
696 
697  //TrackStub
698  csctf::TrackStub theStub((*lct), (*csc).first);
699  theStub.setPhiPacked(gblPhi.global_phi);
700  theStub.setEtaPacked(gblEta.global_eta);
701 
702  float etaG = theStub.etaValue();
703  float phiG = fmod( theStub.phiValue()+15.0*M_PI/180+(sector)*60.0*M_PI/180, 2.*M_PI );
704 
705  // BX plots
706  // minus side
707  if (endcap == 0 && station == 0 && ring == 1) { csctflcts -> Fill(bx, 8.5); }
708  if (endcap == 0 && station == 0 && ring == 2) { csctflcts -> Fill(bx, 7.5); }
709  if (endcap == 0 && station == 0 && ring == 3) { csctflcts -> Fill(bx, 6.5); }
710  if (endcap == 0 && station == 1 && ring == 1) { csctflcts -> Fill(bx, 5.5); }
711  if (endcap == 0 && station == 1 && ring == 2) { csctflcts -> Fill(bx, 4.5); }
712  if (endcap == 0 && station == 2 && ring == 1) { csctflcts -> Fill(bx, 3.5); }
713  if (endcap == 0 && station == 2 && ring == 2) { csctflcts -> Fill(bx, 2.5); }
714  if (endcap == 0 && station == 3 && ring == 1) { csctflcts -> Fill(bx, 1.5); }
715  if (endcap == 0 && station == 3 && ring == 2) { csctflcts -> Fill(bx, 0.5); }
716 
717  // plus side
718  if (endcap == 1 && station == 0 && ring == 1) { csctflcts -> Fill(bx, 9.5); }
719  if (endcap == 1 && station == 0 && ring == 2) { csctflcts -> Fill(bx, 10.5); }
720  if (endcap == 1 && station == 0 && ring == 3) { csctflcts -> Fill(bx, 11.5); }
721  if (endcap == 1 && station == 1 && ring == 1) { csctflcts -> Fill(bx, 12.5); }
722  if (endcap == 1 && station == 1 && ring == 2) { csctflcts -> Fill(bx, 13.5); }
723  if (endcap == 1 && station == 2 && ring == 1) { csctflcts -> Fill(bx, 14.5); }
724  if (endcap == 1 && station == 2 && ring == 2) { csctflcts -> Fill(bx, 15.5); }
725  if (endcap == 1 && station == 3 && ring == 1) { csctflcts -> Fill(bx, 16.5); }
726  if (endcap == 1 && station == 3 && ring == 2) { csctflcts -> Fill(bx, 17.5); }
727 
728  // only for ME1/1
729  if(station == 0 && ring == 1){
730  me11_lctStrip -> Fill(strip);
731  me11_lctWire -> Fill(keyWire);
732  me11_lctLocalPhi -> Fill(lclPhi.phi_local);
733  me11_lctPackedPhi-> Fill(theStub.phiPacked());
734  me11_lctGblPhi -> Fill(phiG);
735  me11_lctGblEta -> Fill(etaG);
736  }
737 
738  // only for ME4/2
739  if(station == 3 && ring == 2){
740  me42_lctGblPhi -> Fill(phiG);
741  me42_lctGblEta -> Fill(etaG);
742  }
743 
744 
745 
746 
747 
748  // SR LUT gives packed eta and phi values -> normilize them to 1 by scale them to 'max' and shift by 'min'
749  //float etaP = gblEta.global_eta/127*1.5 + 0.9;
750  //float phiP = (gblPhi.global_phi);// + ( sector )*4096 + station*4096*12) * 1./(4*4096*12);
751  //std::cout << "LCT Eta & Phi Coordinates: " << etaP << ", " << phiP << "." << std::endl;
752  //csctfoccupancies->Fill( gblEta.global_eta/127. * 1.5 + 0.9, (gblPhi.global_phi + ( sector + (endcap?0:6) )*4096 + station*4096*12) * 1./(4*4096*12) );
753  }//lct != range1.scond
754  }//csc!=corrlcts.product()->end()
755  }// lctProducer.label() != "null"
756 
757 
758 
759  if( trackProducer.label() != "null" )
760  {
762  e.getByToken(tracksToken_, tracks);
763  for(L1CSCTrackCollection::const_iterator trk=tracks->begin(); trk<tracks->end(); trk++)
764  {
765 
766  NumCSCTfTracksRep++;
767  long LUTAdd = trk->first.ptLUTAddress();
768  int trigMode = ( (LUTAdd)&0xf0000 ) >> 16;
769  int trEta = (trk->first.eta_packed() );
770 
771 
772  // trk->first.endcap() = 2 for - endcap
773  // = 1 for + endcap
774  //int trEndcap = (trk->first.endcap()==2 ? trk->first.endcap()-3 : trk->first.endcap());
775  if( trk->first.endcap() != 1)
776  {
777  int holder = trEta;
778  trEta = -1*holder;
779  trEta -= 1;
780  }
781 
782  int trSector = 6*(trk->first.endcap()-1)+trk->first.sector();
783  int trBX = trk->first.BX();
784 
785  //Here is what is done with output phi value:
786  //output_phi = (phi / 32) * 3 /16
787  //where:
788  //phi is 12-bit phi, 4096 bins covering 62 degrees
789  //output_phi is 5-bit value
790 
791  //Easy to see that output_phi can have values from 0 to 23, or 24 total combinations.
792  //This gives per-bin phi value of 62/24 = 2.583333 degrees.
793 
794  // Sector 1 nominally starts at 15 degrees but there 1 degree overlap between sectors so 14 degrees effectively
795  //double trPhi = trk->first.localPhi() * 62. / 24.;
796  double trPhi = ts->getPhiScale()->getLowEdge(trk->first.localPhi());
797  double trPhi02PI = fmod(trPhi +
798  ((trSector-1)*M_PI/3) +
799  (M_PI*14/180.), 2*M_PI);
800 
801  if (trigMode == 15) {
802  csctfTrackPhi_H -> Fill( trPhi02PI );
803  csctfTrackEta_H -> Fill( trEta );
804  csctfoccupancies_H -> Fill( trEta, trPhi02PI );
805  csctfbx_H -> Fill( trSector, trBX );
806  }
807  else{
808  csctfTrackPhi -> Fill( trPhi02PI );
809  csctfTrackEta -> Fill( trEta );
810  csctfoccupancies -> Fill( trEta, trPhi02PI );
811  csctfbx -> Fill( trSector, trBX );
812 
813  // Low Quality / High Quality Eta Distributions
814  //|eta| < 2.1
815  if (abs(trEta) < 24) {
816  if (trigMode == 2 ||
817  trigMode == 3 ||
818  trigMode == 4 ||
819  trigMode == 5 ||
820  trigMode == 6 ||
821  trigMode == 7 ||
822  trigMode == 11 ||
823  trigMode == 12 ||
824  trigMode == 13 ||
825  trigMode == 14 ) csctfTrackEtaHighQ -> Fill (trEta);
826 
827  if (trigMode == 8 ||
828  trigMode == 9 ||
829  trigMode == 10 ) csctfTrackEtaLowQ -> Fill (trEta);
830  }
831  else {//|eta| > 2.1
832  if (trigMode == 2 ||
833  trigMode == 3 ||
834  trigMode == 4 ||
835  trigMode == 5 ) csctfTrackEtaHighQ -> Fill (trEta);
836  else
837  csctfTrackEtaLowQ -> Fill (trEta);
838  }
839  }
840 
841  csctfTrackM->Fill( trk->first.modeExtended() );
842 
843  // we monitor the track quality only on the first link
844  // so let's make sure to fill the plot if there is something that
845  // is read from the hardware
846  int trRank = trk->first.rank();
847  if (trRank) {
848  int trQuality = ((trRank>>5)&0x3);
849  trackModeVsQ->Fill( trk->first.modeExtended(), trQuality );
850  }
851 
852  /*
853  OLD METHOD FOR FILLING HALO PLOTS, IMPROVED METHOD USING ASSOCIATED TRACK STUBS
854  BELOW ~LINE 605
855  if( trigMode == 15 )
856  {
857 
858  double haloVals[4][4];
859  for( int i = 0; i < 4; i++)
860  {
861  haloVals[i][0] = 0;
862  }
863 
864  edm::Handle<CSCCorrelatedLCTDigiCollection> corrlcts;
865  for(CSCCorrelatedLCTDigiCollection::DigiRangeIterator csc=corrlcts.product()->begin(); csc!=corrlcts.product()->end(); csc++)
866  {
867  CSCCorrelatedLCTDigiCollection::Range range1 = corrlcts.product()->get((*csc).first);
868  for(CSCCorrelatedLCTDigiCollection::const_iterator lct=range1.first; lct!=range1.second; lct++)
869  {
870  int endcap = (*csc).first.endcap()-1;
871  int station = (*csc).first.station()-1;
872  int sector = (*csc).first.triggerSector()-1;
873  int cscId = (*csc).first.triggerCscId()-1;
874  int subSector = CSCTriggerNumbering::triggerSubSectorFromLabels((*csc).first);
875  int fpga = ( subSector ? subSector-1 : station+1 );
876 
877  if(station != 4)
878  {
879  int modEnd = 1;
880  if( endcap == 0 ) modEnd = -1;
881  int indexHalo = modEnd + station;
882  if(haloVals[indexHalo][0] == 1.0) haloVals[indexHalo][3] = 1.0;
883  if(haloVals[indexHalo][0] == 0) haloVals[indexHalo][0] = 1.0;
884  haloVals[indexHalo][1] = sector*1.0;
885 
886  lclphidat lclPhi;
887  lclPhi = srLUTs_[fpga]->localPhi(lct->getStrip(), lct->getPattern(), lct->getQuality(), lct->getBend());
888  gblphidat gblPhi;
889  gblPhi = srLUTs_[fpga]->globalPhiME(lclPhi.phi_local, lct->getKeyWG(), cscId+1);
890  gbletadat gblEta;
891  gblEta = srLUTs_[fpga]->globalEtaME(lclPhi.phi_bend_local, lclPhi.phi_local, lct->getKeyWG(), cscId+1);
892 
893  haloVals[indexHalo][2] = gblEta.global_eta/127. * 1.5 + 0.9;
894  } //station1 or 2
895  } //lct first to second
896  } //corrlcts
897 
898  if( (haloVals[0][0] == 1.) && (haloVals[1][0] == 1.) && (haloVals[0][3] != 1.) && (haloVals[1][3] != 1.) )
899  {
900  if( haloVals[0][1] == haloVals[1][1] ){
901  double delEta23 = haloVals[1][2] - haloVals[0][2];
902  haloDelEta23->Fill( delEta23 );
903  }
904  }
905 
906  if( (haloVals[2][0] == 1.) && (haloVals[3][0] == 1.) && (haloVals[2][3] != 1.) && (haloVals[3][3] != 1.) )
907  {
908  if( haloVals[2][1] == haloVals[3][1] ){
909  double delEta23 = haloVals[3][2] - haloVals[2][2];
910  haloDelEta23->Fill( delEta23 );
911  }
912  }
913  } //halo trigger
914  */
915 
916  int cscTrackStub = 0;
917  //float haloEta[3];
918  //for(int i=0; i<3; i++) haloEta[i]=-1.0;
919  //bool haloME11 = false;
920  CSCCorrelatedLCTDigiCollection lctsOfTracks=trk->second;
921  for(CSCCorrelatedLCTDigiCollection::DigiRangeIterator trackStub=lctsOfTracks.begin(); trackStub!=lctsOfTracks.end(); trackStub++)
922  {
923  CSCCorrelatedLCTDigiCollection::Range range2 = lctsOfTracks.get((*trackStub).first);
924  for(CSCCorrelatedLCTDigiCollection::const_iterator lct=range2.first; lct!=range2.second; lct++)
925  {
926 // int station = (*trackStub).first.station()-1;
927 // if(station != 4)
928 // {
929 // // int endcap = (*trackStub).first.endcap()-1;
930 // // int sector = (*trackStub).first.triggerSector()-1;
931 // int cscId = (*trackStub).first.triggerCscId()-1;
932 // int subSector = CSCTriggerNumbering::triggerSubSectorFromLabels((*trackStub).first);
933 // int fpga = ( subSector ? subSector-1 : station+1 );
934 
935 // lclphidat lclPhi;
936 // lclPhi = srLUTs_[fpga]->localPhi(lct->getStrip(), lct->getPattern(), lct->getQuality(), lct->getBend());
937 // gblphidat gblPhi;
938 // gblPhi = srLUTs_[fpga]->globalPhiME(lclPhi.phi_local, lct->getKeyWG(), cscId+1);
939 // gbletadat gblEta;
940 // gblEta = srLUTs_[fpga]->globalEtaME(lclPhi.phi_bend_local, lclPhi.phi_local, lct->getKeyWG(), cscId+1);
941 // haloEta[station-1] = gblEta.global_eta/127. * 1.5 + 0.9;
942 // if(station==1 && cscId<2) haloME11 = true;
943 // }
944  cscTrackStub++;
945  }
946  }
947  cscTrackStubNumbers->Fill(cscTrackStub);
948 
949 // if(trigMode == 15)
950 // {
951 // float dEta13 = haloEta[2]-haloEta[0];
952 // float dEta12 = haloEta[1]-haloEta[0];
953 // if(haloME11)
954 // {
955 // if(haloEta[1]!=-1.0) haloDelEta112->Fill(dEta12);
956 // if(haloEta[2]!=-1.0) haloDelEta113->Fill(dEta13);
957 // } else {
958 // if(haloEta[1]!=-1.0) haloDelEta12->Fill(dEta12);
959 // if(haloEta[2]!=-1.0) haloDelEta13->Fill(dEta13);
960 // }
961 // }
962  //
963 
964 
965 
966  }
967  }
968  csctfntrack->Fill(NumCSCTfTracksRep);
969 
970 
971  if( mbProducer.label() != "null" )
972  {
973  // handle to needed collections
975  e.getByToken(dtStubsToken_, dtStubs);
977  e.getByToken(mbtracksToken_, tracks);
978 
979  // loop on the DT stubs
980  std::vector<csctf::TrackStub> vstubs = dtStubs->get();
981  for(std::vector<csctf::TrackStub>::const_iterator stub=vstubs.begin();
982  stub!=vstubs.end(); stub++)
983  {
984  if (verbose_)
985  {
986  edm::LogInfo("DataNotFound") << "\n mbEndcap: " << stub->endcap();
987  edm::LogInfo("DataNotFound") << "\n stub->getStrip()[FLAG]: " << stub->getStrip();
988  edm::LogInfo("DataNotFound") << "\n stub->getKeyWG()[CAL]: " << stub->getKeyWG();
989  edm::LogInfo("DataNotFound") << "\n stub->BX(): " << stub->BX();
990  edm::LogInfo("DataNotFound") << "\n stub->sector(): " << stub->sector();
991  edm::LogInfo("DataNotFound") << "\n stub->subsector(): " << stub->subsector();
992  edm::LogInfo("DataNotFound") << "\n stub->station(): " << stub->station();
993  edm::LogInfo("DataNotFound") << "\n stub->phiPacked(): " << stub->phiPacked();
994  edm::LogInfo("DataNotFound") << "\n stub->getBend(): " << stub->getBend();
995  edm::LogInfo("DataNotFound") << "\n stub->getQuality(): " << stub->getQuality();
996  edm::LogInfo("DataNotFound") << "\n stub->cscid(): " << stub->cscid() << endl;
997  }
998  // define the sector ID
999  int mbId = (stub->endcap()==2) ? 6 : 0;
1000  mbId += stub->sector();
1001  // *** do not fill if CalMB variable is set ***
1002  // horrible! They used the same class to write up the LCT and MB info,
1003  // but given the MB does not have strip and WG they replaced this two
1004  // with the flag and cal bits... :S
1005  if (stub->getKeyWG() == 0)
1006  {
1007  // if FLAG =1, muon belong to previous BX
1008  int bxDT = stub->BX()-stub->getStrip(); // correct by the FLAG
1009  int subDT = stub->subsector();
1010 
1011  // Fill the event only if CSC had or would have triggered
1012  if (isCSCcand_)
1013  {
1014  //look for tracks in the event and compare the matching DT stubs
1015  int trkBX = 0;
1016  for(L1CSCTrackCollection::const_iterator trk=tracks->begin(); trk<tracks->end(); trk++)
1017  {
1018  trkBX = trk->first.BX();
1019  int trkId = (trk->first.endcap()==2) ? 6 : 0;
1020  trkId += trk->first.sector();
1021  if (verbose_){
1022  edm::LogInfo("DataNotFound") << "\n trk BX: " << trkBX
1023  << " Sector: " << trkId
1024  << " SubSector: " << trk->first.subsector()
1025  << " Endcap: " << trk->first.endcap();
1026 
1027  edm::LogInfo("DataNotFound") << "\n DT BX: " << stub->BX()
1028  << " Sector: " << mbId
1029  << " SubSector: " << stub->subsector()
1030  << " Endcap: " << stub->endcap() << endl;
1031  }
1032 
1033  if (mbId == trkId)
1034  {
1035  if (verbose_) {
1036  edm::LogInfo("DataNotFound") << " --> MATCH" << endl;
1037  edm::LogInfo("DataNotFound") << "Fill :" << trkBX+6-bxDT << " -- " << subDT << " -- cands" << endl;
1038  }
1039  // DT bx ranges from 3 to 9
1040  // trk bx ranges from -3 to 3
1041  DTstubsTimeTrackMenTimeArrival[mbId-1]->Fill(bxDT-trkBX-6,subDT);//subsec
1042  }
1043  }// loop on the tracks
1044  }//if (isCSCcand_){
1045  }//if (stub->getKeyWG() == 0) {
1046  }
1047  }
1048 }
MonitorElement * DTstubsTimeTrackMenTimeArrival[12]
Definition: L1TCSCTF.h:124
MonitorElement * csctfoccupancies
Definition: L1TCSCTF.h:85
T getParameter(std::string const &) const
unsigned long long cacheIdentifier() const
MonitorElement * csctfTrackEtaHighQ
Definition: L1TCSCTF.h:97
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
MonitorElement * csctflcts
Definition: L1TCSCTF.h:106
DQMStore * dbe
Definition: L1TCSCTF.h:78
lclphidat localPhi(int strip, int pattern, int quality, int lr, const bool gangedME1a=false) const
Geometry Lookup Tables.
MonitorElement * csctfTrackPhi
Definition: L1TCSCTF.h:94
bool verbose_
Definition: L1TCSCTF.h:132
unsigned long long m_scalesCacheID
Definition: L1TCSCTF.h:142
MonitorElement * csctfTrackPhi_H
Definition: L1TCSCTF.h:98
void beginJob(void)
Definition: L1TCSCTF.cc:106
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
virtual float getLowEdge(unsigned packed) const =0
get the low edge of bin represented by packed
MonitorElement * me11_lctGblPhi
Definition: L1TCSCTF.h:113
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
#define NULL
Definition: scimark2.h:8
MonitorElement * csctfbx
Definition: L1TCSCTF.h:81
MonitorElement * csctfTrackEtaLowQ
Definition: L1TCSCTF.h:96
edm::InputTag mbProducer
Definition: L1TCSCTF.h:135
static void setGeometry(const edm::ESHandle< CSCGeometry > &thegeom)
MonitorElement * csctfTrackEta
Definition: L1TCSCTF.h:95
void analyze(const edm::Event &e, const edm::EventSetup &c)
Definition: L1TCSCTF.cc:494
MonitorElement * me11_lctWire
Definition: L1TCSCTF.h:110
std::string outputFile_
Definition: L1TCSCTF.h:131
unsigned phiPacked() const
Return the binned phi for this stub.
Definition: TrackStub.h:44
void Fill(long long x)
edm::InputTag statusProducer
Definition: L1TCSCTF.h:135
edm::EDGetTokenT< L1CSCStatusDigiCollection > statusToken_
Definition: L1TCSCTF.h:147
MonitorElement * csctfTrackEta_H
Definition: L1TCSCTF.h:99
MonitorElement * me42_lctGblPhi
Definition: L1TCSCTF.h:117
const L1MuTriggerScales * ts
Definition: L1TCSCTF.h:140
bool gangedME11a_
Definition: L1TCSCTF.h:136
gblphidat globalPhiME(int phi_local, int wire_group, int cscid, const bool gangedME1a=false) const
MonitorElement * cscTrackStubNumbers
Definition: L1TCSCTF.h:100
int L1ABXN
Definition: L1TCSCTF.h:128
MonitorElement * me11_lctStrip
Definition: L1TCSCTF.h:109
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
int BxInEvent_
Definition: L1TCSCTF.h:125
virtual ~L1TCSCTF()
Definition: L1TCSCTF.cc:99
double etaValue() const
return the Eta Value of this stub&#39;s position.
Definition: TrackStub.h:36
void endJob(void)
Definition: L1TCSCTF.cc:483
const L1MuScale * getPhiScale() const
get the phi scale
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int nev_
Definition: L1TCSCTF.h:130
L1TCSCTF(const edm::ParameterSet &ps)
Definition: L1TCSCTF.cc:25
MonitorElement * csctfChamberOccupancies
Definition: L1TCSCTF.h:93
bool isValid() const
Definition: HandleBase.h:76
edm::InputTag lctProducer
Definition: L1TCSCTF.h:135
#define M_PI
edm::EDGetTokenT< L1CSCTrackCollection > tracksToken_
Definition: L1TCSCTF.h:149
MonitorElement * me42_lctGblEta
Definition: L1TCSCTF.h:118
CSCSectorReceiverLUT * srLUTs_[5]
Definition: L1TCSCTF.h:138
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > corrlctsToken_
Definition: L1TCSCTF.h:148
double phiValue() const
return the Phi Value of this stub&#39;s position in local coordinates.
Definition: TrackStub.h:38
MonitorElement * csctferrors
Definition: L1TCSCTF.h:84
T const * product() const
Definition: Handle.h:81
tuple tracks
Definition: testEve_cfg.py:39
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:206
bool isCSCcand_
Definition: L1TCSCTF.h:126
class global_phi_data gblphidat
const T & get() const
Definition: EventSetup.h:55
MonitorElement * csctfTrackM
Definition: L1TCSCTF.h:101
edm::EDGetTokenT< L1CSCTrackCollection > mbtracksToken_
Definition: L1TCSCTF.h:151
T const * product() const
Definition: ESHandle.h:86
MonitorElement * csctfbx_H
Definition: L1TCSCTF.h:82
std::vector< CSCCorrelatedLCTDigi >::const_iterator const_iterator
class local_phi_data lclphidat
Data Types.
static int triggerSubSectorFromLabels(int station, int chamber)
MonitorElement * csctfntrack
Definition: L1TCSCTF.h:80
edm::InputTag trackProducer
Definition: L1TCSCTF.h:135
edm::EDGetTokenT< L1MuGMTReadoutCollection > gmtProducerToken_
Definition: L1TCSCTF.h:146
std::string const & label() const
Definition: InputTag.h:42
MonitorElement * trackModeVsQ
Definition: L1TCSCTF.h:102
MonitorElement * me11_lctGblEta
Definition: L1TCSCTF.h:114
gbletadat globalEtaME(int phi_bend, int phi_local, int wire_group, int cscid, const bool gangedME1a=false) const
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
MonitorElement * csctfoccupancies_H
Definition: L1TCSCTF.h:86
static unsigned int const shift
void setPhiPacked(const unsigned &phi_)
Definition: TrackStub.h:33
std::pair< const_iterator, const_iterator > Range
const L1MuTriggerPtScale * tpts
Definition: L1TCSCTF.h:141
MonitorElement * me11_lctLocalPhi
Definition: L1TCSCTF.h:111
unsigned long long m_ptScaleCacheID
Definition: L1TCSCTF.h:143
tuple status
Definition: ntuplemaker.py:245
TH2F * getTH2F(void) const
class global_eta_data gbletadat
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
std::string const & instance() const
Definition: InputTag.h:43
edm::EDGetTokenT< CSCTriggerContainer< csctf::TrackStub > > dtStubsToken_
Definition: L1TCSCTF.h:150
edm::InputTag gmtProducer
Definition: L1TCSCTF.h:135
void setEtaPacked(const unsigned &eta_)
set Eta and Phi from integer values.
Definition: TrackStub.h:32
MonitorElement * me11_lctPackedPhi
Definition: L1TCSCTF.h:112