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
16 
19 
20 using namespace std;
21 using namespace edm;
22 
24  // if some piece of data is absent - configure corresponding source with 'null:'
25  // : csctfSource_( ps.getParameter< InputTag >("csctfSource") )
26  : gmtProducer(ps.getParameter<InputTag>("gmtProducer")),
27  lctProducer(ps.getParameter<InputTag>("lctProducer")),
28  trackProducer(ps.getParameter<InputTag>("trackProducer")),
29  statusProducer(ps.getParameter<InputTag>("statusProducer")),
30  mbProducer(ps.getParameter<InputTag>("mbProducer")) {
31  // verbosity switch
32  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
33 
34  if (verbose_)
35  edm::LogInfo("DataNotFound") << "L1TCSCTF: constructor...." << endl;
36 
37  outputFile_ = ps.getUntrackedParameter<string>("outputFile", "");
38  if (!outputFile_.empty()) {
39  edm::LogInfo("DataNotFound") << "L1T Monitoring histograms will be saved to " << outputFile_.c_str() << endl;
40  }
41 
42  bool disable = ps.getUntrackedParameter<bool>("disableROOToutput", false);
43  if (disable) {
44  outputFile_ = "";
45  }
46 
47  gangedME11a_ = ps.getUntrackedParameter<bool>("gangedME11a", false);
48 
49  // instantiate standard on-fly SR LUTs from CSC TF emulator package
50  bzero(srLUTs_, sizeof(srLUTs_));
51  //int sector=1; // assume SR LUTs are all same for every sector
52  bool TMB07 = true; // specific TMB firmware
53  // Create a pset for SR/PT LUTs: if you do not change the value in the
54  // configuration file, it will load the default minitLUTs
55  edm::ParameterSet srLUTset;
56  srLUTset.addUntrackedParameter<bool>("ReadLUTs", false);
57  srLUTset.addUntrackedParameter<bool>("Binary", false);
58  srLUTset.addUntrackedParameter<std::string>("LUTPath", "./");
59 
60  // positive endcap
61  int endcap = 1;
62  for (int sector = 0; sector < 6; sector++) {
63  for (int station = 1, fpga = 0; station <= 4 && fpga < 5; station++) {
64  if (station == 1)
65  for (int subSector = 0; subSector < 2 && fpga < 5; subSector++)
66  srLUTs_[fpga++][1][sector] =
67  new CSCSectorReceiverLUT(endcap, sector + 1, subSector + 1, station, srLUTset, TMB07);
68  else
69  srLUTs_[fpga++][1][sector] = new CSCSectorReceiverLUT(endcap, sector + 1, 0, station, srLUTset, TMB07);
70  }
71  }
72 
73  // negative endcap
74  endcap = 2;
75  for (int sector = 0; sector < 6; sector++) {
76  for (int station = 1, fpga = 0; station <= 4 && fpga < 5; station++) {
77  if (station == 1)
78  for (int subSector = 0; subSector < 2 && fpga < 5; subSector++)
79  srLUTs_[fpga++][0][sector] =
80  new CSCSectorReceiverLUT(endcap, sector + 1, subSector + 1, station, srLUTset, TMB07);
81  else
82  srLUTs_[fpga++][0][sector] = new CSCSectorReceiverLUT(endcap, sector + 1, 0, station, srLUTset, TMB07);
83  }
84  }
85 
86  //set Token(-s)
92 
93  gmtProducerToken_ = consumes<L1MuGMTReadoutCollection>(ps.getParameter<InputTag>("gmtProducer"));
94  statusToken_ = consumes<L1CSCStatusDigiCollection>(statusTag_);
95  corrlctsToken_ = consumes<CSCCorrelatedLCTDigiCollection>(corrlctsTag_);
96  tracksToken_ = consumes<L1CSCTrackCollection>(tracksTag_);
97  dtStubsToken_ = consumes<CSCTriggerContainer<csctf::TrackStub> >(dtStubsTag_);
98  mbtracksToken_ = consumes<L1CSCTrackCollection>(mbtracksTag_);
99 }
100 
102  for (unsigned int j = 0; j < 2; j++)
103  for (unsigned int i = 0; i < 5; i++)
104  for (unsigned int s = 0; s < 6; s++)
105  delete srLUTs_[i][j][s]; //free the array of pointers
106 }
107 
109 
111  m_scalesCacheID = -999;
112  m_ptScaleCacheID = -999;
113 
114  nev_ = 0;
115  ibooker.setCurrentFolder("L1T/L1TCSCTF");
116 
117  // Error counting histogram:
118  // 1) checks TF data integrity (error rate - first bin),
119  // 2) monitors sychronization on input links (4 errors types: SE/SM/BX/AF; ORed for all time bins, links, and SPs),
120  // 3) reports FMM status (if in any SP FMM status != "Ready" - fill the last bin)
121  csctferrors = ibooker.book1D("CSCTF_errors", "CSCTF Errors", 6, 0, 6);
122  csctferrors->setAxisTitle("Error type", 1);
123  csctferrors->setAxisTitle("Number of Errors", 2);
124  csctferrors->setBinLabel(1, "Corruptions", 1);
125  csctferrors->setBinLabel(2, "Synch. Err.", 1);
126  csctferrors->setBinLabel(3, "Synch. Mod.", 1);
127  csctferrors->setBinLabel(4, "BX mismatch", 1);
128  csctferrors->setBinLabel(5, "Time misalign.", 1);
129  csctferrors->setBinLabel(6, "FMM != Ready", 1);
130 
131  // Error with detailed MCPID
132  csctferrors_mpc = ibooker.book2D("CSCTF_errors_mpc", "CSCTF Errors", 6, 0, 6, 60, 1, 61);
133  csctferrors_mpc->setAxisTitle("Error type", 1);
134  csctferrors_mpc->setAxisTitle("MPC ID", 2);
135  csctferrors_mpc->setBinLabel(1, "Corruptions", 1);
136  csctferrors_mpc->setBinLabel(2, "Synch. Err.", 1);
137  csctferrors_mpc->setBinLabel(3, "Synch. Mod.", 1);
138  csctferrors_mpc->setBinLabel(4, "BX mismatch", 1);
139  csctferrors_mpc->setBinLabel(5, "Time misalign.", 1);
140  csctferrors_mpc->setBinLabel(6, "FMM != Ready", 1);
141  for (int ybin = 1; ybin <= 60; ybin++) {
142  if (ybin % 5)
143  continue;
144  char ytitle[50];
145  snprintf(ytitle, 50, "%d", ybin);
146  csctferrors_mpc->setBinLabel(ybin, ytitle, 2);
147  }
148 
149  // Occupancy histogram Eta x Y, where Y:
150  // 1) Phi_packed of input LCTs from 1st, 2nd, 3rd, and 4th stations
151  // 2) Phi_packed of output tracks
152  // (all 12 SPs - 360 degree coveradge)
153  csctfoccupancies = ibooker.book2D("CSCTF_occupancies", "CSCTF Occupancies", 64, -32, 31, 32, 0, 6.2);
154  csctfoccupancies->setAxisTitle("#eta", 1);
155  csctfoccupancies->setAxisTitle("#phi", 2);
156  csctfoccupancies->setBinLabel(1, "-2.5", 1);
157  csctfoccupancies->setBinLabel(8, "-2.1", 1);
158  csctfoccupancies->setBinLabel(18, "-1.6", 1);
159  csctfoccupancies->setBinLabel(26, "-1.2", 1);
160  csctfoccupancies->setBinLabel(32, "-0.9", 1);
161  csctfoccupancies->setBinLabel(33, "0.9", 1);
162  csctfoccupancies->setBinLabel(39, "1.2", 1);
163  csctfoccupancies->setBinLabel(47, "1.6", 1);
164  csctfoccupancies->setBinLabel(57, "2.1", 1);
165  csctfoccupancies->setBinLabel(64, "2.5", 1);
166 
167  // ... and for halo muons only
168  csctfoccupancies_H = ibooker.book2D("CSCTF_occupancies_H", "CSCTF Halo Occupancies", 64, -32, 31, 32, 0, 6.2);
169  csctfoccupancies_H->setAxisTitle("#eta", 1);
170  csctfoccupancies_H->setAxisTitle("#phi", 2);
171  csctfoccupancies_H->setBinLabel(1, "-2.5", 1);
172  csctfoccupancies_H->setBinLabel(8, "-2.1", 1);
173  csctfoccupancies_H->setBinLabel(18, "-1.6", 1);
174  csctfoccupancies_H->setBinLabel(26, "-1.2", 1);
175  csctfoccupancies_H->setBinLabel(32, "-0.9", 1);
176  csctfoccupancies_H->setBinLabel(33, "0.9", 1);
177  csctfoccupancies_H->setBinLabel(39, "1.2", 1);
178  csctfoccupancies_H->setBinLabel(47, "1.6", 1);
179  csctfoccupancies_H->setBinLabel(57, "2.1", 1);
180  csctfoccupancies_H->setBinLabel(64, "2.5", 1);
181 
182  //haloDelEta12 = ibooker.book1D("CSCTF_Halo_Eta12", "#Delta #eta_{12} for Halo Muons", 40, -0.20,0.30);
183  //haloDelEta112 = ibooker.book1D("CSCTF_Halo_Eta112","#Delta #eta_{112} for Halo Muons", 40, -0.20,0.30);
184  //haloDelEta13 = ibooker.book1D("CSCTF_Halo_Eta13", "#Delta #eta_{13} for Halo Muons", 40, -0.20,0.30);
185  //haloDelEta113 = ibooker.book1D("CSCTF_Halo_Eta113","#Delta #eta_{113} for Halo Muons", 40, -0.20,0.30);
186 
187  // Quality VS Mode
188  trackModeVsQ = ibooker.book2D("CSCTF_Track_ModeVsQual", "CSC Track Mode Vs Quality", 19, -0.5, 18.5, 4, 0, 4);
189  trackModeVsQ->setAxisTitle("Track Type", 1);
190  trackModeVsQ->setBinLabel(1, "No Track", 1);
191  trackModeVsQ->setBinLabel(2, "Bad Phi/Single", 1);
192  trackModeVsQ->setBinLabel(3, "ME1-2-3", 1);
193  trackModeVsQ->setBinLabel(4, "ME1-2-4", 1);
194  trackModeVsQ->setBinLabel(5, "ME1-3-4", 1);
195  trackModeVsQ->setBinLabel(6, "ME2-3-4", 1);
196  trackModeVsQ->setBinLabel(7, "ME1-2", 1);
197  trackModeVsQ->setBinLabel(8, "ME1-3", 1);
198  trackModeVsQ->setBinLabel(9, "ME2-3", 1);
199  trackModeVsQ->setBinLabel(10, "ME2-4", 1);
200  trackModeVsQ->setBinLabel(11, "ME3-4", 1);
201  trackModeVsQ->setBinLabel(12, "MB1-ME3", 1);
202  trackModeVsQ->setBinLabel(13, "MB1-ME2", 1);
203  trackModeVsQ->setBinLabel(14, "ME1-4", 1);
204  trackModeVsQ->setBinLabel(15, "MB1-ME1", 1);
205  trackModeVsQ->setBinLabel(16, "Halo Trigger", 1);
206  trackModeVsQ->setBinLabel(17, "MB1-ME1-2", 1);
207  trackModeVsQ->setBinLabel(18, "MB1-ME1-3", 1);
208  trackModeVsQ->setBinLabel(19, "MB1-ME2-3", 1);
209 
210  trackModeVsQ->setAxisTitle("Quality", 2);
211  trackModeVsQ->setBinLabel(1, "0", 2);
212  trackModeVsQ->setBinLabel(2, "1", 2);
213  trackModeVsQ->setBinLabel(3, "2", 2);
214  trackModeVsQ->setBinLabel(4, "3", 2);
215 
216  // Mode
217  csctfTrackM = ibooker.book1D("CSCTF_Track_Mode", "CSC Track Mode", 19, -0.5, 18.5);
218  csctfTrackM->setAxisTitle("Track Type", 1);
219  csctfTrackM->setBinLabel(1, "No Track", 1);
220  csctfTrackM->setBinLabel(2, "Bad Phi/Single", 1);
221  csctfTrackM->setBinLabel(3, "ME1-2-3", 1);
222  csctfTrackM->setBinLabel(4, "ME1-2-4", 1);
223  csctfTrackM->setBinLabel(5, "ME1-3-4", 1);
224  csctfTrackM->setBinLabel(6, "ME2-3-4", 1);
225  csctfTrackM->setBinLabel(7, "ME1-2", 1);
226  csctfTrackM->setBinLabel(8, "ME1-3", 1);
227  csctfTrackM->setBinLabel(9, "ME2-3", 1);
228  csctfTrackM->setBinLabel(10, "ME2-4", 1);
229  csctfTrackM->setBinLabel(11, "ME3-4", 1);
230  csctfTrackM->setBinLabel(12, "MB1-ME3", 1);
231  csctfTrackM->setBinLabel(13, "MB1-ME2", 1);
232  csctfTrackM->setBinLabel(14, "ME1-4", 1);
233  csctfTrackM->setBinLabel(15, "MB1-ME1", 1);
234  csctfTrackM->setBinLabel(16, "Halo Trigger", 1);
235  csctfTrackM->setBinLabel(17, "MB1-ME1-2", 1);
236  csctfTrackM->setBinLabel(18, "MB1-ME1-3", 1);
237  csctfTrackM->setBinLabel(19, "MB1-ME2-3", 1);
238 
239  // Chamber Occupancy
241  ibooker.book2D("CSCTF_Chamber_Occupancies", "CSCTF Chamber Occupancies", 54, -0.05, 5.35, 10, -5.5, 4.5);
242  csctfChamberOccupancies->setAxisTitle("Sector, (chambers 1-9 not labeled)", 1);
243  csctfChamberOccupancies->setBinLabel(1, "ME-4", 2);
244  csctfChamberOccupancies->setBinLabel(2, "ME-3", 2);
245  csctfChamberOccupancies->setBinLabel(3, "ME-2", 2);
246  csctfChamberOccupancies->setBinLabel(4, "ME-1b", 2);
247  csctfChamberOccupancies->setBinLabel(5, "ME-1a", 2);
248  csctfChamberOccupancies->setBinLabel(6, "ME+1a", 2);
249  csctfChamberOccupancies->setBinLabel(7, "ME+1b", 2);
250  csctfChamberOccupancies->setBinLabel(8, "ME+2", 2);
251  csctfChamberOccupancies->setBinLabel(9, "ME+3", 2);
252  csctfChamberOccupancies->setBinLabel(10, "ME+4", 2);
259 
260  // Track Phi
261  csctfTrackPhi = ibooker.book1D("CSCTF_Track_Phi", "CSCTF Track #phi", 144, 0, 2 * M_PI);
262  csctfTrackPhi->setAxisTitle("Track #phi", 1);
263 
264  // Track Eta
265  csctfTrackEta = ibooker.book1D("CSCTF_Track_Eta", "CSCTF Track #eta", 64, -32, 32);
266  csctfTrackEta->setAxisTitle("Track #eta", 1);
267  csctfTrackEta->setBinLabel(1, "-2.5", 1);
268  csctfTrackEta->setBinLabel(8, "-2.1", 1);
269  csctfTrackEta->setBinLabel(18, "-1.6", 1);
270  csctfTrackEta->setBinLabel(26, "-1.2", 1);
271  csctfTrackEta->setBinLabel(32, "-0.9", 1);
272  csctfTrackEta->setBinLabel(33, "0.9", 1);
273  csctfTrackEta->setBinLabel(39, "1.2", 1);
274  csctfTrackEta->setBinLabel(47, "1.6", 1);
275  csctfTrackEta->setBinLabel(57, "2.1", 1);
276  csctfTrackEta->setBinLabel(64, "2.5", 1);
277 
278  // Track Eta Low Quality
279  csctfTrackEtaLowQ = ibooker.book1D("CSCTF_Track_Eta_LowQ", "CSCTF Track #eta LQ", 64, -32, 32);
280  csctfTrackEtaLowQ->setAxisTitle("Track #eta", 1);
281  csctfTrackEtaLowQ->setBinLabel(1, "-2.5", 1);
282  csctfTrackEtaLowQ->setBinLabel(8, "-2.1", 1);
283  csctfTrackEtaLowQ->setBinLabel(18, "-1.6", 1);
284  csctfTrackEtaLowQ->setBinLabel(26, "-1.2", 1);
285  csctfTrackEtaLowQ->setBinLabel(32, "-0.9", 1);
286  csctfTrackEtaLowQ->setBinLabel(33, "0.9", 1);
287  csctfTrackEtaLowQ->setBinLabel(39, "1.2", 1);
288  csctfTrackEtaLowQ->setBinLabel(47, "1.6", 1);
289  csctfTrackEtaLowQ->setBinLabel(57, "2.1", 1);
290  csctfTrackEtaLowQ->setBinLabel(64, "2.5", 1);
291 
292  // Track Eta High Quality
293  csctfTrackEtaHighQ = ibooker.book1D("CSCTF_Track_Eta_HighQ", "CSCTF Track #eta HQ", 64, -32, 32);
294  csctfTrackEtaHighQ->setAxisTitle("Track #eta", 1);
295  csctfTrackEtaHighQ->setBinLabel(1, "-2.5", 1);
296  csctfTrackEtaHighQ->setBinLabel(8, "-2.1", 1);
297  csctfTrackEtaHighQ->setBinLabel(18, "-1.6", 1);
298  csctfTrackEtaHighQ->setBinLabel(26, "-1.2", 1);
299  csctfTrackEtaHighQ->setBinLabel(32, "-0.9", 1);
300  csctfTrackEtaHighQ->setBinLabel(33, "0.9", 1);
301  csctfTrackEtaHighQ->setBinLabel(39, "1.2", 1);
302  csctfTrackEtaHighQ->setBinLabel(47, "1.6", 1);
303  csctfTrackEtaHighQ->setBinLabel(57, "2.1", 1);
304  csctfTrackEtaHighQ->setBinLabel(64, "2.5", 1);
305 
306  // Halo Phi
307  csctfTrackPhi_H = ibooker.book1D("CSCTF_Track_Phi_H", "CSCTF Halo #phi", 144, 0, 2 * M_PI);
308  csctfTrackPhi_H->setAxisTitle("Track #phi", 1);
309 
310  // Halo Eta
311  csctfTrackEta_H = ibooker.book1D("CSCTF_Track_Eta_H", "CSCTF Halo #eta", 64, -32, 32);
312  csctfTrackEta_H->setAxisTitle("Track #eta", 1);
313  csctfTrackEta_H->setBinLabel(1, "-2.5", 1);
314  csctfTrackEta_H->setBinLabel(8, "-2.1", 1);
315  csctfTrackEta_H->setBinLabel(18, "-1.6", 1);
316  csctfTrackEta_H->setBinLabel(26, "-1.2", 1);
317  csctfTrackEta_H->setBinLabel(32, "-0.9", 1);
318  csctfTrackEta_H->setBinLabel(33, "0.9", 1);
319  csctfTrackEta_H->setBinLabel(39, "1.2", 1);
320  csctfTrackEta_H->setBinLabel(47, "1.6", 1);
321  csctfTrackEta_H->setBinLabel(57, "2.1", 1);
322  csctfTrackEta_H->setBinLabel(64, "2.5", 1);
323 
324  // Track Timing
325  csctfbx = ibooker.book2D("CSCTF_bx", "CSCTF BX", 12, 1, 13, 7, -3, 3);
326  csctfbx->setAxisTitle("Sector (Endcap)", 1);
327  csctfbx->setBinLabel(1, " 1 (+)", 1);
328  csctfbx->setBinLabel(2, " 2 (+)", 1);
329  csctfbx->setBinLabel(3, " 3 (+)", 1);
330  csctfbx->setBinLabel(4, " 4 (+)", 1);
331  csctfbx->setBinLabel(5, " 5 (+)", 1);
332  csctfbx->setBinLabel(6, " 6 (+)", 1);
333  csctfbx->setBinLabel(7, " 7 (-)", 1);
334  csctfbx->setBinLabel(8, " 8 (-)", 1);
335  csctfbx->setBinLabel(9, " 9 (-)", 1);
336  csctfbx->setBinLabel(10, "10 (-)", 1);
337  csctfbx->setBinLabel(11, "11 (-)", 1);
338  csctfbx->setBinLabel(12, "12 (-)", 1);
339 
340  csctfbx->setAxisTitle("CSCTF BX", 2);
341  csctfbx->setBinLabel(1, "-3", 2);
342  csctfbx->setBinLabel(2, "-2", 2);
343  csctfbx->setBinLabel(3, "-1", 2);
344  csctfbx->setBinLabel(4, "-0", 2);
345  csctfbx->setBinLabel(5, " 1", 2);
346  csctfbx->setBinLabel(6, " 2", 2);
347  csctfbx->setBinLabel(7, " 3", 2);
348 
349  // Halo Timing
350  csctfbx_H = ibooker.book2D("CSCTF_bx_H", "CSCTF HALO BX", 12, 1, 13, 7, -3, 3);
351  csctfbx_H->setAxisTitle("Sector (Endcap)", 1);
352  csctfbx_H->setBinLabel(1, " 1 (+)", 1);
353  csctfbx_H->setBinLabel(2, " 2 (+)", 1);
354  csctfbx_H->setBinLabel(3, " 3 (+)", 1);
355  csctfbx_H->setBinLabel(4, " 4 (+)", 1);
356  csctfbx_H->setBinLabel(5, " 5 (+)", 1);
357  csctfbx_H->setBinLabel(6, " 6 (+)", 1);
358  csctfbx_H->setBinLabel(7, " 7 (-)", 1);
359  csctfbx_H->setBinLabel(8, " 8 (-)", 1);
360  csctfbx_H->setBinLabel(9, " 9 (-)", 1);
361  csctfbx_H->setBinLabel(10, "10 (-)", 1);
362  csctfbx_H->setBinLabel(11, "11 (-)", 1);
363  csctfbx_H->setBinLabel(12, "12 (-)", 1);
364 
365  csctfbx_H->setAxisTitle("CSCTF BX", 2);
366  csctfbx_H->setBinLabel(1, "-3", 2);
367  csctfbx_H->setBinLabel(2, "-2", 2);
368  csctfbx_H->setBinLabel(3, "-1", 2);
369  csctfbx_H->setBinLabel(4, "-0", 2);
370  csctfbx_H->setBinLabel(5, " 1", 2);
371  csctfbx_H->setBinLabel(6, " 2", 2);
372  csctfbx_H->setBinLabel(7, " 3", 2);
373 
374  // Number of Tracks Stubs
375  cscTrackStubNumbers = ibooker.book1D("CSCTF_TrackStubs", "Number of Stubs in CSCTF Tracks", 5, 0, 5);
376  cscTrackStubNumbers->setBinLabel(1, "0", 1);
377  cscTrackStubNumbers->setBinLabel(2, "1", 1);
378  cscTrackStubNumbers->setBinLabel(3, "2", 1);
379  cscTrackStubNumbers->setBinLabel(4, "3", 1);
380  cscTrackStubNumbers->setBinLabel(5, "4", 1);
381 
382  // Number of Tracks
383  csctfntrack = ibooker.book1D("CSCTF_ntrack", "Number of CSCTracks found per event", 5, 0, 5);
384  csctfntrack->setBinLabel(1, "0", 1);
385  csctfntrack->setBinLabel(2, "1", 1);
386  csctfntrack->setBinLabel(3, "2", 1);
387  csctfntrack->setBinLabel(4, "3", 1);
388  csctfntrack->setBinLabel(5, "4", 1);
389  //}
390 
391  char hname[200];
392  char htitle[200];
393 
394  for (int i = 0; i < 12; i++) {
395  sprintf(hname, "DTstubsTimeTrackMenTimeArrival_%d", i + 1);
396  sprintf(htitle, "T_{track} - T_{DT stub} sector %d", i + 1);
397 
398  DTstubsTimeTrackMenTimeArrival[i] = ibooker.book2D(hname, htitle, 7, -3, 3, 2, 1, 3);
399  DTstubsTimeTrackMenTimeArrival[i]->getTH2F()->SetMinimum(0);
400 
401  // axis makeup
402  DTstubsTimeTrackMenTimeArrival[i]->setAxisTitle("bx_{CSC track} - bx_{DT stub}", 1);
404 
412 
415  }
416 
417  cscWireStripOverflow = ibooker.book2D("CSC_WireStripOverflow", "CSC WireStrip Overflow", 36, 1, 37, 18, 0, 18);
418 
419  // NEW: CSC EVENT LCT PLOTS
420  csctflcts = ibooker.book2D("CSCTF_LCT", "CSCTF LCTs", 12, 1, 13, 18, 0, 18);
421  csctflcts->setAxisTitle("CSCTF LCT BX", 1);
422  csctflcts->setBinLabel(1, "1", 1);
423  csctflcts->setBinLabel(2, "2", 1);
424  csctflcts->setBinLabel(3, "3", 1);
425  csctflcts->setBinLabel(4, "4", 1);
426  csctflcts->setBinLabel(5, "5", 1);
427  csctflcts->setBinLabel(6, "6", 1);
428  csctflcts->setBinLabel(7, "7", 1);
429  csctflcts->setBinLabel(8, "8", 1);
430  csctflcts->setBinLabel(9, "9", 1);
431  csctflcts->setBinLabel(10, "10", 1);
432  csctflcts->setBinLabel(11, "11", 1);
433  csctflcts->setBinLabel(12, "12", 1);
434 
435  int ihist = 0;
436  for (int iEndcap = 0; iEndcap < 2; iEndcap++) {
437  for (int iStation = 1; iStation < 5; iStation++) {
438  for (int iRing = 1; iRing < 4; iRing++) {
439  if (iStation != 1 && iRing > 2)
440  continue;
441  TString signEndcap = "+";
442  if (iEndcap == 0)
443  signEndcap = "-";
444 
445  char lcttitle[200];
446  snprintf(lcttitle, 200, "ME%s%d/%d", signEndcap.Data(), iStation, iRing);
447  if (ihist <= 8) {
448  csctflcts->setBinLabel(9 - ihist, lcttitle, 2);
449  cscWireStripOverflow->setBinLabel(9 - ihist, lcttitle, 2);
450  } else {
451  csctflcts->setBinLabel(ihist + 1, lcttitle, 2);
452  cscWireStripOverflow->setBinLabel(ihist + 1, lcttitle, 2);
453  }
454 
455  ihist++;
456  }
457  }
458  }
459 
460  // plots for ME1/1 chambers
461  me11_lctStrip = ibooker.book1D("CSC_ME11_LCT_Strip", "CSC_ME11_LCT_Strip", 223, 0, 223);
462  me11_lctStrip->setAxisTitle("Cathode HalfStrip, ME1/1", 1);
463 
464  me11_lctWire = ibooker.book1D("CSC_ME11_LCT_Wire", "CSC_ME11_LCT_Wire", 112, 0, 112);
465  me11_lctWire->setAxisTitle("Anode Wiregroup, ME1/1", 1);
466 
467  me11_lctLocalPhi = ibooker.book1D("CSC_ME11_LCT_LocalPhi", "CSC_ME11_LCT_LocalPhi", 200, 0, 1024);
468  me11_lctLocalPhi->setAxisTitle("LCT Local #it{#phi}, ME1/1", 1);
469 
470  me11_lctPackedPhi = ibooker.book1D("CSC_ME11_LCT_PackedPhi", "CSC_ME11_LCT_PackedPhi", 200, 0, 4096);
471  me11_lctPackedPhi->setAxisTitle("LCT Packed #it{#phi}, ME1/1", 1);
472 
473  me11_lctGblPhi = ibooker.book1D("CSC_ME11_LCT_GblPhi", "CSC_ME11_LCT_GblPhi", 200, 0, 2 * M_PI);
474  me11_lctGblPhi->setAxisTitle("LCT Global #it{#phi}, ME1/1", 1);
475 
476  me11_lctGblEta = ibooker.book1D("CSC_ME11_LCT_GblEta", "CSC_ME11_LCT_GblEta", 50, 0.9, 2.5);
477  me11_lctGblEta->setAxisTitle("LCT Global #eta, ME1/1", 1);
478 
479  // plots for ME4/2 chambers
480  me42_lctGblPhi = ibooker.book1D("CSC_ME42_LCT_GblPhi", "CSC_ME42_LCT_GblPhi", 200, 0, 2 * M_PI);
481  me42_lctGblPhi->setAxisTitle("LCT Global #it{#phi}, ME4/2", 1);
482 
483  me42_lctGblEta = ibooker.book1D("CSC_ME42_LCT_GblEta", "CSC_ME42_LCT_GblEta", 50, 0.9, 2.5);
484  me42_lctGblEta->setAxisTitle("LCT Global #eta, ME4/2", 1);
485 
486  //
487  csc_strip_MEplus11 = ibooker.book2D("csc_strip_MEplus11", "csc_strip_MEplus11", 36, 1, 37, 240, 0, 240);
488  csc_strip_MEplus11->setAxisTitle("Cathode HalfStrip", 2);
489  csc_strip_MEplus11->setAxisTitle("ME+1/1", 1);
490  csc_strip_MEplus12 = ibooker.book2D("csc_strip_MEplus12", "csc_strip_MEplus12", 36, 1, 37, 240, 0, 240);
491  csc_strip_MEplus12->setAxisTitle("Cathode HalfStrip", 2);
492  csc_strip_MEplus12->setAxisTitle("ME+1/2", 1);
493  csc_strip_MEplus13 = ibooker.book2D("csc_strip_MEplus13", "csc_strip_MEplus13", 36, 1, 37, 240, 0, 240);
494  csc_strip_MEplus13->setAxisTitle("Cathode HalfStrip", 2);
495  csc_strip_MEplus13->setAxisTitle("ME+1/3", 1);
496  csc_strip_MEplus21 = ibooker.book2D("csc_strip_MEplus21", "csc_strip_MEplus21", 18, 1, 19, 240, 0, 240);
497  csc_strip_MEplus21->setAxisTitle("Cathode HalfStrip", 2);
498  csc_strip_MEplus21->setAxisTitle("ME+2/1", 1);
499  csc_strip_MEplus22 = ibooker.book2D("csc_strip_MEplus22", "csc_strip_MEplus22", 36, 1, 37, 240, 0, 240);
500  csc_strip_MEplus22->setAxisTitle("Cathode HalfStrip", 2);
501  csc_strip_MEplus22->setAxisTitle("ME+2/2", 1);
502  csc_strip_MEplus31 = ibooker.book2D("csc_strip_MEplus31", "csc_strip_MEplus31", 18, 1, 19, 240, 0, 240);
503  csc_strip_MEplus31->setAxisTitle("Cathode HalfStrip", 2);
504  csc_strip_MEplus31->setAxisTitle("ME+3/1", 1);
505  csc_strip_MEplus32 = ibooker.book2D("csc_strip_MEplus32", "csc_strip_MEplus32", 36, 1, 37, 240, 0, 240);
506  csc_strip_MEplus32->setAxisTitle("Cathode HalfStrip", 2);
507  csc_strip_MEplus32->setAxisTitle("ME+3/2", 1);
508  csc_strip_MEplus41 = ibooker.book2D("csc_strip_MEplus41", "csc_strip_MEplus41", 18, 1, 19, 240, 0, 240);
509  csc_strip_MEplus41->setAxisTitle("Cathode HalfStrip", 2);
510  csc_strip_MEplus41->setAxisTitle("ME+4/1", 1);
511  csc_strip_MEplus42 = ibooker.book2D("csc_strip_MEplus42", "csc_strip_MEplus42", 36, 1, 37, 240, 0, 240);
512  csc_strip_MEplus42->setAxisTitle("Cathode HalfStrip", 2);
513  csc_strip_MEplus42->setAxisTitle("ME+4/2", 1);
514 
515  csc_strip_MEminus11 = ibooker.book2D("csc_strip_MEminus11", "csc_strip_MEminus11", 36, 1, 37, 240, 0, 240);
516  csc_strip_MEminus11->setAxisTitle("Cathode HalfStrip", 2);
517  csc_strip_MEminus11->setAxisTitle("ME-1/1", 1);
518  csc_strip_MEminus12 = ibooker.book2D("csc_strip_MEminus12", "csc_strip_MEminus12", 36, 1, 37, 240, 0, 240);
519  csc_strip_MEminus12->setAxisTitle("Cathode HalfStrip", 2);
520  csc_strip_MEminus12->setAxisTitle("ME-1/2", 1);
521  csc_strip_MEminus13 = ibooker.book2D("csc_strip_MEminus13", "csc_strip_MEminus13", 36, 1, 37, 240, 0, 240);
522  csc_strip_MEminus13->setAxisTitle("Cathode HalfStrip", 2);
523  csc_strip_MEminus13->setAxisTitle("ME-1/3", 1);
524  csc_strip_MEminus21 = ibooker.book2D("csc_strip_MEminus21", "csc_strip_MEminus21", 18, 1, 19, 240, 0, 240);
525  csc_strip_MEminus21->setAxisTitle("Cathode HalfStrip", 2);
526  csc_strip_MEminus21->setAxisTitle("ME-2/1", 1);
527  csc_strip_MEminus22 = ibooker.book2D("csc_strip_MEminus22", "csc_strip_MEminus22", 36, 1, 37, 240, 0, 240);
528  csc_strip_MEminus22->setAxisTitle("Cathode HalfStrip", 2);
529  csc_strip_MEminus22->setAxisTitle("ME-2/2", 1);
530  csc_strip_MEminus31 = ibooker.book2D("csc_strip_MEminus31", "csc_strip_MEminus31", 18, 1, 19, 240, 0, 240);
531  csc_strip_MEminus31->setAxisTitle("Cathode HalfStrip", 2);
532  csc_strip_MEminus31->setAxisTitle("ME-3/1", 1);
533  csc_strip_MEminus32 = ibooker.book2D("csc_strip_MEminus32", "csc_strip_MEminus32", 36, 1, 37, 240, 0, 240);
534  csc_strip_MEminus32->setAxisTitle("Cathode HalfStrip", 2);
535  csc_strip_MEminus32->setAxisTitle("ME-3/2", 1);
536  csc_strip_MEminus41 = ibooker.book2D("csc_strip_MEminus41", "csc_strip_MEminus41", 18, 1, 19, 240, 0, 240);
537  csc_strip_MEminus41->setAxisTitle("Cathode HalfStrip", 2);
538  csc_strip_MEminus41->setAxisTitle("ME-4/1", 1);
539  csc_strip_MEminus42 = ibooker.book2D("csc_strip_MEminus42", "csc_strip_MEminus42", 36, 1, 37, 240, 0, 240);
540  csc_strip_MEminus42->setAxisTitle("Cathode HalfStrip", 2);
541  csc_strip_MEminus42->setAxisTitle("ME-4/2", 1);
542 
543  csc_wire_MEplus11 = ibooker.book2D("csc_wire_MEplus11", "csc_wire_MEplus11", 36, 1, 37, 120, 0, 120);
544  csc_wire_MEplus11->setAxisTitle("Anode Wiregroup", 2);
545  csc_wire_MEplus11->setAxisTitle("ME+1/1", 1);
546  csc_wire_MEplus12 = ibooker.book2D("csc_wire_MEplus12", "csc_wire_MEplus12", 36, 1, 37, 120, 0, 120);
547  csc_wire_MEplus12->setAxisTitle("Anode Wiregroup", 2);
548  csc_wire_MEplus12->setAxisTitle("ME+1/2", 1);
549  csc_wire_MEplus13 = ibooker.book2D("csc_wire_MEplus13", "csc_wire_MEplus13", 36, 1, 37, 120, 0, 120);
550  csc_wire_MEplus13->setAxisTitle("Anode Wiregroup", 2);
551  csc_wire_MEplus13->setAxisTitle("ME+1/3", 1);
552  csc_wire_MEplus21 = ibooker.book2D("csc_wire_MEplus21", "csc_wire_MEplus21", 18, 1, 19, 120, 0, 120);
553  csc_wire_MEplus21->setAxisTitle("Anode Wiregroup", 2);
554  csc_wire_MEplus21->setAxisTitle("ME+2/1", 1);
555  csc_wire_MEplus22 = ibooker.book2D("csc_wire_MEplus22", "csc_wire_MEplus22", 36, 1, 37, 120, 0, 120);
556  csc_wire_MEplus22->setAxisTitle("Anode Wiregroup", 2);
557  csc_wire_MEplus22->setAxisTitle("ME+2/2", 1);
558  csc_wire_MEplus31 = ibooker.book2D("csc_wire_MEplus31", "csc_wire_MEplus31", 18, 1, 19, 120, 0, 120);
559  csc_wire_MEplus31->setAxisTitle("Anode Wiregroup", 2);
560  csc_wire_MEplus31->setAxisTitle("ME+3/1", 1);
561  csc_wire_MEplus32 = ibooker.book2D("csc_wire_MEplus32", "csc_wire_MEplus32", 36, 1, 37, 120, 0, 120);
562  csc_wire_MEplus32->setAxisTitle("Anode Wiregroup", 2);
563  csc_wire_MEplus32->setAxisTitle("ME+3/2", 1);
564  csc_wire_MEplus41 = ibooker.book2D("csc_wire_MEplus41", "csc_wire_MEplus41", 18, 1, 19, 120, 0, 120);
565  csc_wire_MEplus41->setAxisTitle("Anode Wiregroup", 2);
566  csc_wire_MEplus41->setAxisTitle("ME+4/1", 1);
567  csc_wire_MEplus42 = ibooker.book2D("csc_wire_MEplus42", "csc_wire_MEplus42", 36, 1, 37, 120, 0, 120);
568  csc_wire_MEplus42->setAxisTitle("Anode Wiregroup", 2);
569  csc_wire_MEplus42->setAxisTitle("ME+4/2", 1);
570 
571  csc_wire_MEminus11 = ibooker.book2D("csc_wire_MEminus11", "csc_wire_MEminus11", 36, 1, 37, 120, 0, 120);
572  csc_wire_MEminus11->setAxisTitle("Anode Wiregroup", 2);
573  csc_wire_MEminus11->setAxisTitle("ME-1/1", 1);
574  csc_wire_MEminus12 = ibooker.book2D("csc_wire_MEminus12", "csc_wire_MEminus12", 36, 1, 37, 120, 0, 120);
575  csc_wire_MEminus12->setAxisTitle("Anode Wiregroup", 2);
576  csc_wire_MEminus12->setAxisTitle("ME-1/2", 1);
577  csc_wire_MEminus13 = ibooker.book2D("csc_wire_MEminus13", "csc_wire_MEminus13", 36, 1, 37, 120, 0, 120);
578  csc_wire_MEminus13->setAxisTitle("Anode Wiregroup", 2);
579  csc_wire_MEminus13->setAxisTitle("ME-1/3", 1);
580  csc_wire_MEminus21 = ibooker.book2D("csc_wire_MEminus21", "csc_wire_MEminus21", 18, 1, 19, 120, 0, 120);
581  csc_wire_MEminus21->setAxisTitle("Anode Wiregroup", 2);
582  csc_wire_MEminus21->setAxisTitle("ME-2/1", 1);
583  csc_wire_MEminus22 = ibooker.book2D("csc_wire_MEminus22", "csc_wire_MEminus22", 36, 1, 37, 120, 0, 120);
584  csc_wire_MEminus22->setAxisTitle("Anode Wiregroup", 2);
585  csc_wire_MEminus22->setAxisTitle("ME-2/2", 1);
586  csc_wire_MEminus31 = ibooker.book2D("csc_wire_MEminus31", "csc_wire_MEminus31", 18, 1, 19, 120, 0, 120);
587  csc_wire_MEminus31->setAxisTitle("Anode Wiregroup", 2);
588  csc_wire_MEminus31->setAxisTitle("ME-3/1", 1);
589  csc_wire_MEminus32 = ibooker.book2D("csc_wire_MEminus32", "csc_wire_MEminus32", 36, 1, 37, 120, 0, 120);
590  csc_wire_MEminus32->setAxisTitle("Anode Wiregroup", 2);
591  csc_wire_MEminus32->setAxisTitle("ME-3/2", 1);
592  csc_wire_MEminus41 = ibooker.book2D("csc_wire_MEminus41", "csc_wire_MEminus41", 18, 1, 19, 120, 0, 120);
593  csc_wire_MEminus41->setAxisTitle("Anode Wiregroup", 2);
594  csc_wire_MEminus41->setAxisTitle("ME-4/1", 1);
595  csc_wire_MEminus42 = ibooker.book2D("csc_wire_MEminus42", "csc_wire_MEminus42", 36, 1, 37, 120, 0, 120);
596  csc_wire_MEminus42->setAxisTitle("Anode Wiregroup", 2);
597  csc_wire_MEminus42->setAxisTitle("ME-4/2", 1);
598 
599  for (int cscid = 1; cscid < 37; cscid++) {
600  char bxtitle[100];
601  sprintf(bxtitle, "%d", cscid);
602 
603  cscWireStripOverflow->setBinLabel(cscid, bxtitle, 1);
604  csc_strip_MEplus11->setBinLabel(cscid, bxtitle, 1);
605  csc_strip_MEplus12->setBinLabel(cscid, bxtitle, 1);
606  csc_strip_MEplus13->setBinLabel(cscid, bxtitle, 1);
607  csc_strip_MEplus22->setBinLabel(cscid, bxtitle, 1);
608  csc_strip_MEplus32->setBinLabel(cscid, bxtitle, 1);
609  csc_strip_MEplus42->setBinLabel(cscid, bxtitle, 1);
610 
611  csc_strip_MEminus11->setBinLabel(cscid, bxtitle, 1);
612  csc_strip_MEminus12->setBinLabel(cscid, bxtitle, 1);
613  csc_strip_MEminus13->setBinLabel(cscid, bxtitle, 1);
614  csc_strip_MEminus22->setBinLabel(cscid, bxtitle, 1);
615  csc_strip_MEminus32->setBinLabel(cscid, bxtitle, 1);
616  csc_strip_MEminus42->setBinLabel(cscid, bxtitle, 1);
617 
618  csc_wire_MEplus11->setBinLabel(cscid, bxtitle, 1);
619  csc_wire_MEplus12->setBinLabel(cscid, bxtitle, 1);
620  csc_wire_MEplus13->setBinLabel(cscid, bxtitle, 1);
621  csc_wire_MEplus22->setBinLabel(cscid, bxtitle, 1);
622  csc_wire_MEplus32->setBinLabel(cscid, bxtitle, 1);
623  csc_wire_MEplus42->setBinLabel(cscid, bxtitle, 1);
624 
625  csc_wire_MEminus11->setBinLabel(cscid, bxtitle, 1);
626  csc_wire_MEminus12->setBinLabel(cscid, bxtitle, 1);
627  csc_wire_MEminus13->setBinLabel(cscid, bxtitle, 1);
628  csc_wire_MEminus22->setBinLabel(cscid, bxtitle, 1);
629  csc_wire_MEminus32->setBinLabel(cscid, bxtitle, 1);
630  csc_wire_MEminus42->setBinLabel(cscid, bxtitle, 1);
631  }
632 
633  for (int cscid = 1; cscid < 19; cscid++) {
634  char bxtitle[100];
635  sprintf(bxtitle, "%d", cscid);
636 
637  csc_strip_MEplus21->setBinLabel(cscid, bxtitle, 1);
638  csc_strip_MEplus31->setBinLabel(cscid, bxtitle, 1);
639  csc_strip_MEplus41->setBinLabel(cscid, bxtitle, 1);
640 
641  csc_strip_MEminus21->setBinLabel(cscid, bxtitle, 1);
642  csc_strip_MEminus31->setBinLabel(cscid, bxtitle, 1);
643  csc_strip_MEminus41->setBinLabel(cscid, bxtitle, 1);
644 
645  csc_wire_MEplus21->setBinLabel(cscid, bxtitle, 1);
646  csc_wire_MEplus31->setBinLabel(cscid, bxtitle, 1);
647  csc_wire_MEplus41->setBinLabel(cscid, bxtitle, 1);
648 
649  csc_wire_MEminus21->setBinLabel(cscid, bxtitle, 1);
650  csc_wire_MEminus31->setBinLabel(cscid, bxtitle, 1);
651  csc_wire_MEminus41->setBinLabel(cscid, bxtitle, 1);
652  }
653 }
654 
655 void L1TCSCTF::analyze(const Event& e, const EventSetup& c) {
657  c.get<L1MuTriggerPtScaleRcd>().cacheIdentifier() != m_ptScaleCacheID) {
659  c.get<L1MuTriggerScalesRcd>().get(scales);
660  ts = scales.product();
662  c.get<L1MuTriggerPtScaleRcd>().get(ptscales);
663  tpts = ptscales.product();
664  m_scalesCacheID = c.get<L1MuTriggerScalesRcd>().cacheIdentifier();
665  m_ptScaleCacheID = c.get<L1MuTriggerPtScaleRcd>().cacheIdentifier();
666 
667  edm::LogInfo("L1TCSCTF") << "Changing triggerscales and triggerptscales...";
668  }
669 
670  int NumCSCTfTracksRep = 0;
671  nev_++;
672  if (verbose_)
673  edm::LogInfo("DataNotFound") << "L1TCSCTF: analyze...." << endl;
674 
676  if (gmtProducer.label() != "null") { // GMT block
677  e.getByToken(gmtProducerToken_, pCollection);
678  if (!pCollection.isValid()) {
679  edm::LogInfo("DataNotFound") << "can't find L1MuGMTReadoutCollection with label "; // << csctfSource_.label() ;
680  return;
681  }
682 
683  L1MuGMTReadoutCollection const* gmtrc = pCollection.product();
684  vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
685  vector<L1MuGMTReadoutRecord>::const_iterator RRItr;
686 
687  // Look if the readout window contains one (and only one CSC cands)
688  // to make it simpler I reject events with more than a CSC cand in the
689  // same readout window
690 
691  // count non-empty candidates in this bx
692  int bxWindow = 0;
693  int nCands = 0;
694 
695  for (RRItr = gmt_records.begin(); RRItr != gmt_records.end(); RRItr++) {
696  bxWindow++;
697 
698  // get the csc candidates
699  vector<L1MuRegionalCand> INPCands = RRItr->getCSCCands();
700  vector<L1MuRegionalCand>::const_iterator INPItr;
701 
702  BxInEvent_ = 0;
703  isCSCcand_ = false;
704  int nCandsBx = 0;
705 
706  for (INPItr = INPCands.begin(); INPItr != INPCands.end(); ++INPItr) {
707  if (!INPItr->empty()) {
708  nCandsBx++;
709  nCands++;
710  BxInEvent_ = RRItr->getBxInEvent();
711  if (verbose_)
712  edm::LogInfo("DataNotFound") << "cand " << nCandsBx << " -> assigned CSCTF bx: " << INPItr->bx() << endl;
713  }
714  }
715  if (verbose_)
716  if (nCandsBx)
717  edm::LogInfo("DataNotFound") << nCandsBx << " cands in bx: " << BxInEvent_ << endl;
718  }
719 
720  if (nCands != 1)
721  return;
722  else
723  isCSCcand_ = true;
724  if (verbose_)
725  edm::LogInfo("DataNotFound") << "bxWindow: " << bxWindow << endl;
726 
727  int ncsctftrack = 0;
728  if (verbose_) {
729  edm::LogInfo("DataNotFound") << "\tCSCTFCand ntrack " << ncsctftrack << endl;
730  }
731  } // end of GMT block
732 
733  L1ABXN = -999;
734  if (statusProducer.label() != "null") {
736  e.getByToken(statusToken_, status);
737  bool integrity = status->first, se = false, sm = false, bx = false, af = false, fmm = false;
738  int nStat = 0;
739 
740  for (std::vector<L1CSCSPStatusDigi>::const_iterator stat = status->second.begin(); stat != status->second.end();
741  stat++) {
742  se |= stat->SEs() & 0xFFF;
743  sm |= stat->SMs() & 0xFFF;
744  bx |= stat->BXs() & 0xFFF;
745  af |= stat->AFs() & 0xFFF;
746  fmm |= stat->FMM() != 8;
747 
748  int ise = stat->SEs() & 0xFFF;
749  int ism = stat->SMs() & 0xFFF;
750  int ibx = stat->BXs() & 0xFFF;
751  int iaf = stat->AFs() & 0xFFF;
752  int ifmm = stat->FMM();
753  int slot = stat->slot();
754 
755  for (int j = 0; j < 15; j++) {
756  int link = j + 1;
757  int mpc_id = 0;
758  int sp_num = 0;
759  if (slot >= 6 && slot <= 11)
760  sp_num = slot - 5;
761  if (slot >= 16 && slot <= 21)
762  sp_num = slot - 9;
763 
764  if (sp_num == 1) {
765  if (link >= 1 && link <= 3)
766  mpc_id = 2;
767  else if (link >= 4 && link <= 6)
768  mpc_id = 3;
769  else if (link >= 7 && link <= 9)
770  mpc_id = 13;
771  else if (link >= 10 && link <= 12)
772  mpc_id = 19;
773  else if (link >= 13 && link <= 15)
774  mpc_id = 25;
775  } else if (sp_num == 2) {
776  if (link >= 1 && link <= 3)
777  mpc_id = 4;
778  else if (link >= 4 && link <= 6)
779  mpc_id = 5;
780  else if (link >= 7 && link <= 9)
781  mpc_id = 14;
782  else if (link >= 10 && link <= 12)
783  mpc_id = 20;
784  else if (link >= 13 && link <= 15)
785  mpc_id = 26;
786  } else if (sp_num == 3) {
787  if (link >= 1 && link <= 3)
788  mpc_id = 6;
789  else if (link >= 4 && link <= 6)
790  mpc_id = 7;
791  else if (link >= 7 && link <= 9)
792  mpc_id = 15;
793  else if (link >= 10 && link <= 12)
794  mpc_id = 21;
795  else if (link >= 13 && link <= 15)
796  mpc_id = 27;
797  } else if (sp_num == 4) {
798  if (link >= 1 && link <= 3)
799  mpc_id = 8;
800  else if (link >= 4 && link <= 6)
801  mpc_id = 9;
802  else if (link >= 7 && link <= 9)
803  mpc_id = 16;
804  else if (link >= 10 && link <= 12)
805  mpc_id = 22;
806  else if (link >= 13 && link <= 15)
807  mpc_id = 28;
808  } else if (sp_num == 5) {
809  if (link >= 1 && link <= 3)
810  mpc_id = 10;
811  else if (link >= 4 && link <= 6)
812  mpc_id = 11;
813  else if (link >= 7 && link <= 9)
814  mpc_id = 17;
815  else if (link >= 10 && link <= 12)
816  mpc_id = 23;
817  else if (link >= 13 && link <= 15)
818  mpc_id = 29;
819  } else if (sp_num == 6) {
820  if (link >= 1 && link <= 3)
821  mpc_id = 12;
822  else if (link >= 4 && link <= 6)
823  mpc_id = 1;
824  else if (link >= 7 && link <= 9)
825  mpc_id = 18;
826  else if (link >= 10 && link <= 12)
827  mpc_id = 24;
828  else if (link >= 13 && link <= 15)
829  mpc_id = 30;
830  } else if (sp_num == 7) {
831  if (link >= 1 && link <= 3)
832  mpc_id = 32;
833  else if (link >= 4 && link <= 6)
834  mpc_id = 33;
835  else if (link >= 7 && link <= 9)
836  mpc_id = 43;
837  else if (link >= 10 && link <= 12)
838  mpc_id = 49;
839  else if (link >= 13 && link <= 15)
840  mpc_id = 55;
841  } else if (sp_num == 8) {
842  if (link >= 1 && link <= 3)
843  mpc_id = 34;
844  else if (link >= 4 && link <= 6)
845  mpc_id = 35;
846  else if (link >= 7 && link <= 9)
847  mpc_id = 44;
848  else if (link >= 10 && link <= 12)
849  mpc_id = 50;
850  else if (link >= 13 && link <= 15)
851  mpc_id = 56;
852  } else if (sp_num == 9) {
853  if (link >= 1 && link <= 3)
854  mpc_id = 36;
855  else if (link >= 4 && link <= 6)
856  mpc_id = 37;
857  else if (link >= 7 && link <= 9)
858  mpc_id = 45;
859  else if (link >= 10 && link <= 12)
860  mpc_id = 51;
861  else if (link >= 13 && link <= 15)
862  mpc_id = 57;
863  } else if (sp_num == 10) {
864  if (link >= 1 && link <= 3)
865  mpc_id = 38;
866  else if (link >= 4 && link <= 6)
867  mpc_id = 39;
868  else if (link >= 7 && link <= 9)
869  mpc_id = 46;
870  else if (link >= 10 && link <= 12)
871  mpc_id = 52;
872  else if (link >= 13 && link <= 15)
873  mpc_id = 58;
874  } else if (sp_num == 11) {
875  if (link >= 1 && link <= 3)
876  mpc_id = 40;
877  else if (link >= 4 && link <= 6)
878  mpc_id = 41;
879  else if (link >= 7 && link <= 9)
880  mpc_id = 47;
881  else if (link >= 10 && link <= 12)
882  mpc_id = 53;
883  else if (link >= 13 && link <= 15)
884  mpc_id = 59;
885  } else if (sp_num == 12) {
886  if (link >= 1 && link <= 3)
887  mpc_id = 42;
888  else if (link >= 4 && link <= 6)
889  mpc_id = 31;
890  else if (link >= 7 && link <= 9)
891  mpc_id = 48;
892  else if (link >= 10 && link <= 12)
893  mpc_id = 54;
894  else if (link >= 13 && link <= 15)
895  mpc_id = 60;
896  }
897 
898  if (integrity)
899  csctferrors_mpc->Fill(0.5, mpc_id);
900  if ((ise >> j) & 0x1)
901  csctferrors_mpc->Fill(1.5, mpc_id);
902  if ((ism >> j) & 0x1)
903  csctferrors_mpc->Fill(2.5, mpc_id);
904  if ((ibx >> j) & 0x1)
905  csctferrors_mpc->Fill(3.5, mpc_id);
906  if ((iaf >> j) & 0x1)
907  csctferrors_mpc->Fill(4.5, mpc_id);
908  if (ifmm != 8)
909  csctferrors_mpc->Fill(5.5, mpc_id);
910  }
911 
912  if (stat->VPs() != 0) {
913  L1ABXN += stat->BXN();
914  nStat++;
915  }
916  }
917  // compute the average
918  if (nStat != 0)
919  L1ABXN /= nStat;
920  if (integrity)
921  csctferrors->Fill(0.5);
922  if (se)
923  csctferrors->Fill(1.5);
924  if (sm)
925  csctferrors->Fill(2.5);
926  if (bx)
927  csctferrors->Fill(3.5);
928  if (af)
929  csctferrors->Fill(4.5);
930  if (fmm)
931  csctferrors->Fill(5.5);
932  }
933 
934  if (lctProducer.label() != "null") {
936  c.get<MuonGeometryRecord>().get(pDD);
937 
939  e.getByToken(corrlctsToken_, corrlcts);
940 
942  csc != corrlcts.product()->end();
943  csc++) {
944  CSCCorrelatedLCTDigiCollection::Range range1 = corrlcts.product()->get((*csc).first);
945  for (CSCCorrelatedLCTDigiCollection::const_iterator lct = range1.first; lct != range1.second; lct++) {
946  int endcap = (*csc).first.endcap() - 1;
947  int station = (*csc).first.station() - 1;
948  int sector = (*csc).first.triggerSector() - 1;
949  int subSector = CSCTriggerNumbering::triggerSubSectorFromLabels((*csc).first);
950  int ring = (*csc).first.ring();
951  int cscId = (*csc).first.triggerCscId() - 1;
952  int fpga = (subSector ? subSector - 1 : station + 1);
953  int strip = lct->getStrip();
954  int keyWire = lct->getKeyWG();
955  int bx = lct->getBX();
956 
957  int endcapAssignment = 1;
958  int shift = 1;
959  float sectorArg = sector;
960  //float sectorArg = j;
961 
962  if (endcap == 1) {
963  endcapAssignment = -1;
964  shift = 2;
965  //sectorArg = sector - 6;
966  }
967 
968  int signedStation = (station + shift) * endcapAssignment;
969  if ((station == 0) && (endcap == 0))
970  signedStation = subSector - 1;
971  if ((station == 0) && (endcap == 1))
972  signedStation = (-1) * subSector;
973 
974  float chamberArg1 = cscId * 0.1 + sectorArg;
975  //float chamberArg1 = i*0.1 + sectorArg;
976  //std::cout << "First" << i << " " << sectorArg << " " << chamberArg1 << std::endl;
977 
978  float chamberArg11 = chamberArg1;
979  if (sectorArg == 1)
980  chamberArg1 = chamberArg11 - 0.1;
981  if (sectorArg == 2)
982  chamberArg1 = chamberArg11 - 0.2;
983  if (sectorArg == 3)
984  chamberArg1 = chamberArg11 - 0.3;
985  if (sectorArg == 4)
986  chamberArg1 = chamberArg11 - 0.4;
987  if (sectorArg == 5)
988  chamberArg1 = chamberArg11 - 0.5;
989 
990  //std::cout << "cscId, station, sector, endcap, sectorArg, chamber Arg: " << cscId << ", " << station << ", " <<sector << ", " << endcap << ", " << chamberArg1 << ", " << signedStation << std::endl;
991 
992  csctfChamberOccupancies->Fill(chamberArg1, signedStation);
993  //int bunchX = ( (lct->getBX()) - 6 );
994 
995  //int timingSectorArg = 3*(sector) + (lct->getMPCLink());
996  //if( endcap == 1) timingSectorArg = 3*(sector + 6) + (lct->getMPCLink());
997  //std::cout << "Sector, MPCLink, TSA, endcap: " << sector << ", " << lct->getMPCLink() << ", " << timingSectorArg << ", " << endcap << std::endl;
998 
999  //csctfbx->Fill(timingSectorArg, bunchX );
1000  //std::cout << "LCT'S, encap: " << endcap << ", station: " << station << ", sector: " << sector << ", subSector: " << subSector << ", cscId: " << cscId << std:: endl;
1001  //End JAG
1002 
1003  // Check if Det Id is within pysical range:
1004  if (endcap < 0 || endcap > 1 || sector < 0 || sector > 6 || station < 0 || station > 3 || cscId < 0 ||
1005  cscId > 8 || fpga < 0 || fpga > 4) {
1006  edm::LogError("L1CSCTF: CSC TP are out of range: ")
1007  << " endcap: " << (endcap + 1) << " station: " << (station + 1) << " sector: " << (sector + 1)
1008  << " subSector: " << subSector << " fpga: " << fpga << " cscId: " << (cscId + 1);
1009  continue;
1010  }
1011 
1012  int EndCapLUT = 1;
1013  //if(endcap==0) EndCapLUT=1; // ME+
1014  if (endcap == 1)
1015  EndCapLUT = 0; // ME-
1016 
1017  lclphidat lclPhi;
1018  try {
1019  lclPhi = srLUTs_[fpga][EndCapLUT][sector]->localPhi(
1020  lct->getStrip(), lct->getPattern(), lct->getQuality(), lct->getBend(), gangedME11a_);
1021  } catch (cms::Exception&) {
1022  bzero(&lclPhi, sizeof(lclPhi));
1023  }
1024 
1025  gblphidat gblPhi;
1026  try {
1027  gblPhi =
1028  srLUTs_[fpga][EndCapLUT][sector]->globalPhiME(lclPhi.phi_local, lct->getKeyWG(), cscId + 1, gangedME11a_);
1029  } catch (cms::Exception&) {
1030  bzero(&gblPhi, sizeof(gblPhi));
1031  }
1032 
1033  gbletadat gblEta;
1034  try {
1035  gblEta = srLUTs_[fpga][EndCapLUT][sector]->globalEtaME(
1036  lclPhi.phi_bend_local, lclPhi.phi_local, lct->getKeyWG(), cscId + 1, gangedME11a_);
1037  } catch (cms::Exception&) {
1038  bzero(&gblEta, sizeof(gblEta));
1039  }
1040 
1041  //TrackStub
1042  csctf::TrackStub theStub((*lct), (*csc).first);
1043  theStub.setPhiPacked(gblPhi.global_phi);
1044  theStub.setEtaPacked(gblEta.global_eta);
1045 
1046  float etaG = theStub.etaValue();
1047  float phiG = fmod(theStub.phiValue() + 15.0 * M_PI / 180 + (sector)*60.0 * M_PI / 180, 2. * M_PI);
1048 
1049  //BX plots
1050  // endcap==1: minus side; endcap==0: plus side
1051  // station=0,1,2,3; ring=1,2,3;
1052  if (endcap == 1) {
1053  if (station == 0) {
1054  if (ring == 1)
1055  csctflcts->Fill(bx, 8.5);
1056  else if (ring == 2)
1057  csctflcts->Fill(bx, 7.5);
1058  else
1059  csctflcts->Fill(bx, 6.5);
1060  } else if (station == 1) {
1061  if (ring == 1)
1062  csctflcts->Fill(bx, 5.5);
1063  else
1064  csctflcts->Fill(bx, 4.5);
1065  } else if (station == 2) {
1066  if (ring == 1)
1067  csctflcts->Fill(bx, 3.5);
1068  else
1069  csctflcts->Fill(bx, 2.5);
1070  } else if (station == 3) {
1071  if (ring == 1)
1072  csctflcts->Fill(bx, 1.5);
1073  else
1074  csctflcts->Fill(bx, 0.5);
1075  }
1076 
1077  } else {
1078  if (station == 0) {
1079  if (ring == 1)
1080  csctflcts->Fill(bx, 9.5);
1081  else if (ring == 2)
1082  csctflcts->Fill(bx, 10.5);
1083  else
1084  csctflcts->Fill(bx, 11.5);
1085  } else if (station == 1) {
1086  if (ring == 1)
1087  csctflcts->Fill(bx, 12.5);
1088  else
1089  csctflcts->Fill(bx, 13.5);
1090  } else if (station == 2) {
1091  if (ring == 1)
1092  csctflcts->Fill(bx, 14.5);
1093  else
1094  csctflcts->Fill(bx, 15.5);
1095  } else if (station == 3) {
1096  if (ring == 1)
1097  csctflcts->Fill(bx, 16.5);
1098  else
1099  csctflcts->Fill(bx, 17.5);
1100  }
1101  }
1102 
1103  // only for ME1/1
1104  if (station == 0 && ring == 1) {
1105  me11_lctStrip->Fill(strip);
1106  me11_lctWire->Fill(keyWire);
1107  me11_lctLocalPhi->Fill(lclPhi.phi_local);
1108  me11_lctPackedPhi->Fill(theStub.phiPacked());
1109  me11_lctGblPhi->Fill(phiG);
1110  me11_lctGblEta->Fill(etaG);
1111  }
1112 
1113  // only for ME4/2
1114  if (station == 3 && ring == 2) {
1115  me42_lctGblPhi->Fill(phiG);
1116  me42_lctGblEta->Fill(etaG);
1117  }
1118 
1119  //ME1/1
1120  if (station == 0 && ring == 1) {
1121  int realID = cscId + 6 * sector + 3 * subSector;
1122  if (realID > 36)
1123  realID -= 36;
1124  if (endcap == 0) {
1125  csc_strip_MEplus11->Fill(realID, strip);
1126  csc_wire_MEplus11->Fill(realID, keyWire);
1127  if (keyWire > 48 || strip > 224)
1128  cscWireStripOverflow->Fill(realID, 9.5, 1);
1129  }
1130  if (endcap == 1) {
1131  csc_strip_MEminus11->Fill(realID, strip);
1132  csc_wire_MEminus11->Fill(realID, keyWire);
1133  if (keyWire > 48 || strip > 224)
1134  cscWireStripOverflow->Fill(realID, 8.5, 1);
1135  }
1136  }
1137  //ME1/2
1138  if (station == 0 && ring == 2) {
1139  int realID = (cscId - 3) + 6 * sector + 3 * subSector;
1140  if (realID > 36)
1141  realID -= 36;
1142  if (endcap == 0) {
1143  csc_strip_MEplus12->Fill(realID, strip);
1144  csc_wire_MEplus12->Fill(realID, keyWire);
1145  if (keyWire > 64 || strip > 160)
1146  cscWireStripOverflow->Fill(realID, 10.5, 1);
1147  }
1148  if (endcap == 1) {
1149  csc_strip_MEminus12->Fill(realID, strip);
1150  csc_wire_MEminus12->Fill(realID, keyWire);
1151  if (keyWire > 64 || strip > 160)
1152  cscWireStripOverflow->Fill(realID, 7.5, 1);
1153  }
1154  }
1155  //ME1/3
1156  if (station == 0 && ring == 3) {
1157  int realID = (cscId - 6) + 6 * sector + 3 * subSector;
1158  if (realID > 36)
1159  realID -= 36;
1160  if (endcap == 0) {
1161  csc_strip_MEplus13->Fill(realID, strip);
1162  csc_wire_MEplus13->Fill(realID, keyWire);
1163  if (keyWire > 32 || strip > 128)
1164  cscWireStripOverflow->Fill(realID, 11.5, 1);
1165  }
1166  if (endcap == 1) {
1167  csc_strip_MEminus13->Fill(realID, strip);
1168  csc_wire_MEminus13->Fill(realID, keyWire);
1169  if (keyWire > 32 || strip > 128)
1170  cscWireStripOverflow->Fill(realID, 6.5, 1);
1171  }
1172  }
1173  //ME2/1
1174  if (station == 1 && ring == 1) {
1175  int realID = cscId + 3 * sector + 2;
1176  if (realID > 18)
1177  realID -= 18;
1178  if (endcap == 0) {
1179  csc_strip_MEplus21->Fill(realID, strip);
1180  csc_wire_MEplus21->Fill(realID, keyWire);
1181  if (keyWire > 112 || strip > 160)
1182  cscWireStripOverflow->Fill(realID, 12.5, 1);
1183  }
1184  if (endcap == 1) {
1185  csc_strip_MEminus21->Fill(realID, strip);
1186  csc_wire_MEminus21->Fill(realID, keyWire);
1187  if (keyWire > 112 || strip > 160)
1188  cscWireStripOverflow->Fill(realID, 5.5, 1);
1189  }
1190  }
1191  //ME2/2
1192  if (station == 1 && ring == 2) {
1193  int realID = (cscId - 3) + 6 * sector + 3;
1194  if (realID > 36)
1195  realID -= 36;
1196  if (endcap == 0) {
1197  csc_strip_MEplus22->Fill(realID, strip);
1198  csc_wire_MEplus22->Fill(realID, keyWire);
1199  if (keyWire > 64 || strip > 160)
1200  cscWireStripOverflow->Fill(realID, 13.5, 1);
1201  }
1202  if (endcap == 1) {
1203  csc_strip_MEminus22->Fill(realID, strip);
1204  csc_wire_MEminus22->Fill(realID, keyWire);
1205  if (keyWire > 64 || strip > 160)
1206  cscWireStripOverflow->Fill(realID, 4.5, 1);
1207  }
1208  }
1209 
1210  //ME3/1
1211  if (station == 2 && ring == 1) {
1212  int realID = cscId + 3 * sector + 2;
1213  if (realID > 18)
1214  realID -= 18;
1215  if (endcap == 0) {
1216  csc_strip_MEplus31->Fill(realID, strip);
1217  csc_wire_MEplus31->Fill(realID, keyWire);
1218  if (keyWire > 96 || strip > 160)
1219  cscWireStripOverflow->Fill(realID, 14.5, 1);
1220  }
1221  if (endcap == 1) {
1222  csc_strip_MEminus31->Fill(realID, strip);
1223  csc_wire_MEminus31->Fill(realID, keyWire);
1224  if (keyWire > 96 || strip > 160)
1225  cscWireStripOverflow->Fill(realID, 3.5, 1);
1226  }
1227  }
1228 
1229  //ME3/2
1230  if (station == 2 && ring == 2) {
1231  int realID = (cscId - 3) + 6 * sector + 3;
1232  if (realID > 36)
1233  realID -= 36;
1234  if (endcap == 0) {
1235  csc_strip_MEplus32->Fill(realID, strip);
1236  csc_wire_MEplus32->Fill(realID, keyWire);
1237  if (keyWire > 64 || strip > 160)
1238  cscWireStripOverflow->Fill(realID, 15.5, 1);
1239  }
1240  if (endcap == 1) {
1241  csc_strip_MEminus32->Fill(realID, strip);
1242  csc_wire_MEminus32->Fill(realID, keyWire);
1243  if (keyWire > 64 || strip > 160)
1244  cscWireStripOverflow->Fill(realID, 2.5, 1);
1245  }
1246  }
1247  //ME4/1
1248  if (station == 3 && ring == 1) {
1249  int realID = cscId + 3 * sector + 2;
1250  if (realID > 18)
1251  realID -= 18;
1252  if (endcap == 0) {
1253  csc_strip_MEplus41->Fill(realID, strip);
1254  csc_wire_MEplus41->Fill(realID, keyWire);
1255  if (keyWire > 96 || strip > 160)
1256  cscWireStripOverflow->Fill(realID, 16.5, 1);
1257  }
1258  if (endcap == 1) {
1259  csc_strip_MEminus41->Fill(realID, strip);
1260  csc_wire_MEminus41->Fill(realID, keyWire);
1261  if (keyWire > 96 || strip > 160)
1262  cscWireStripOverflow->Fill(realID, 1.5, 1);
1263  }
1264  }
1265  //ME4/2
1266  if (station == 3 && ring == 2) {
1267  int realID = (cscId - 3) + 6 * sector + 3;
1268  if (realID > 36)
1269  realID -= 36;
1270  if (endcap == 0) {
1271  csc_strip_MEplus42->Fill(realID, strip);
1272  csc_wire_MEplus42->Fill(realID, keyWire);
1273  if (keyWire > 64 || strip > 160)
1274  cscWireStripOverflow->Fill(realID, 17.5, 1);
1275  }
1276  if (endcap == 1) {
1277  csc_strip_MEminus42->Fill(realID, strip);
1278  csc_wire_MEminus42->Fill(realID, keyWire);
1279  if (keyWire > 64 || strip > 160)
1280  cscWireStripOverflow->Fill(realID, 0.5, 1);
1281  }
1282  }
1283 
1284  // SR LUT gives packed eta and phi values -> normilize them to 1 by scale them to 'max' and shift by 'min'
1285  //float etaP = gblEta.global_eta/127*1.5 + 0.9;
1286  //float phiP = (gblPhi.global_phi);// + ( sector )*4096 + station*4096*12) * 1./(4*4096*12);
1287  //std::cout << "LCT Eta & Phi Coordinates: " << etaP << ", " << phiP << "." << std::endl;
1288  //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) );
1289  } //lct != range1.scond
1290  } //csc!=corrlcts.product()->end()
1291  } // lctProducer.label() != "null"
1292 
1293  if (trackProducer.label() != "null") {
1295  e.getByToken(tracksToken_, tracks);
1296  for (L1CSCTrackCollection::const_iterator trk = tracks->begin(); trk < tracks->end(); trk++) {
1297  NumCSCTfTracksRep++;
1298  long LUTAdd = trk->first.ptLUTAddress();
1299  int trigMode = ((LUTAdd)&0xf0000) >> 16;
1300  int trEta = (trk->first.eta_packed());
1301 
1302  // trk->first.endcap() = 2 for - endcap
1303  // = 1 for + endcap
1304  //int trEndcap = (trk->first.endcap()==2 ? trk->first.endcap()-3 : trk->first.endcap());
1305  if (trk->first.endcap() != 1) {
1306  int holder = trEta;
1307  trEta = -1 * holder;
1308  trEta -= 1;
1309  }
1310 
1311  int trSector = 6 * (trk->first.endcap() - 1) + trk->first.sector();
1312  int trBX = trk->first.BX();
1313 
1314  //Here is what is done with output phi value:
1315  //output_phi = (phi / 32) * 3 /16
1316  //where:
1317  //phi is 12-bit phi, 4096 bins covering 62 degrees
1318  //output_phi is 5-bit value
1319 
1320  //Easy to see that output_phi can have values from 0 to 23, or 24 total combinations.
1321  //This gives per-bin phi value of 62/24 = 2.583333 degrees.
1322 
1323  // Sector 1 nominally starts at 15 degrees but there 1 degree overlap between sectors so 14 degrees effectively
1324  //double trPhi = trk->first.localPhi() * 62. / 24.;
1325  double trPhi = ts->getPhiScale()->getLowEdge(trk->first.localPhi());
1326  double trPhi02PI = fmod(trPhi + ((trSector - 1) * M_PI / 3) + (M_PI * 14 / 180.), 2 * M_PI);
1327 
1328  if (trigMode == 15) {
1329  csctfTrackPhi_H->Fill(trPhi02PI);
1330  csctfTrackEta_H->Fill(trEta);
1331  csctfoccupancies_H->Fill(trEta, trPhi02PI);
1332  csctfbx_H->Fill(trSector, trBX);
1333  } else {
1334  csctfTrackPhi->Fill(trPhi02PI);
1335  csctfTrackEta->Fill(trEta);
1336  csctfoccupancies->Fill(trEta, trPhi02PI);
1337  csctfbx->Fill(trSector, trBX);
1338 
1339  // Low Quality / High Quality Eta Distributions
1340  //|eta| < 2.1
1341  if (abs(trEta) < 24) {
1342  if (trigMode == 2 || trigMode == 3 || trigMode == 4 || trigMode == 5 || trigMode == 6 || trigMode == 7 ||
1343  trigMode == 11 || trigMode == 12 || trigMode == 13 || trigMode == 14)
1344  csctfTrackEtaHighQ->Fill(trEta);
1345 
1346  if (trigMode == 8 || trigMode == 9 || trigMode == 10)
1347  csctfTrackEtaLowQ->Fill(trEta);
1348  } else { //|eta| > 2.1
1349  if (trigMode == 2 || trigMode == 3 || trigMode == 4 || trigMode == 5)
1350  csctfTrackEtaHighQ->Fill(trEta);
1351  else
1352  csctfTrackEtaLowQ->Fill(trEta);
1353  }
1354  }
1355 
1356  csctfTrackM->Fill(trk->first.modeExtended());
1357 
1358  // we monitor the track quality only on the first link
1359  // so let's make sure to fill the plot if there is something that
1360  // is read from the hardware
1361  int trRank = trk->first.rank();
1362  if (trRank) {
1363  int trQuality = ((trRank >> 5) & 0x3);
1364  trackModeVsQ->Fill(trk->first.modeExtended(), trQuality);
1365  }
1366 
1367  /*
1368  OLD METHOD FOR FILLING HALO PLOTS, IMPROVED METHOD USING ASSOCIATED TRACK STUBS
1369  BELOW ~LINE 605
1370  if( trigMode == 15 )
1371  {
1372 
1373  double haloVals[4][4];
1374  for( int i = 0; i < 4; i++)
1375  {
1376  haloVals[i][0] = 0;
1377  }
1378 
1379  edm::Handle<CSCCorrelatedLCTDigiCollection> corrlcts;
1380  for(CSCCorrelatedLCTDigiCollection::DigiRangeIterator csc=corrlcts.product()->begin(); csc!=corrlcts.product()->end(); csc++)
1381  {
1382  CSCCorrelatedLCTDigiCollection::Range range1 = corrlcts.product()->get((*csc).first);
1383  for(CSCCorrelatedLCTDigiCollection::const_iterator lct=range1.first; lct!=range1.second; lct++)
1384  {
1385  int endcap = (*csc).first.endcap()-1;
1386  int station = (*csc).first.station()-1;
1387  int sector = (*csc).first.triggerSector()-1;
1388  int cscId = (*csc).first.triggerCscId()-1;
1389  int subSector = CSCTriggerNumbering::triggerSubSectorFromLabels((*csc).first);
1390  int fpga = ( subSector ? subSector-1 : station+1 );
1391 
1392  if(station != 4)
1393  {
1394  int modEnd = 1;
1395  if( endcap == 0 ) modEnd = -1;
1396  int indexHalo = modEnd + station;
1397  if(haloVals[indexHalo][0] == 1.0) haloVals[indexHalo][3] = 1.0;
1398  if(haloVals[indexHalo][0] == 0) haloVals[indexHalo][0] = 1.0;
1399  haloVals[indexHalo][1] = sector*1.0;
1400 
1401  lclphidat lclPhi;
1402  lclPhi = srLUTs_[fpga]->localPhi(lct->getStrip(), lct->getPattern(), lct->getQuality(), lct->getBend());
1403  gblphidat gblPhi;
1404  gblPhi = srLUTs_[fpga]->globalPhiME(lclPhi.phi_local, lct->getKeyWG(), cscId+1);
1405  gbletadat gblEta;
1406  gblEta = srLUTs_[fpga]->globalEtaME(lclPhi.phi_bend_local, lclPhi.phi_local, lct->getKeyWG(), cscId+1);
1407 
1408  haloVals[indexHalo][2] = gblEta.global_eta/127. * 1.5 + 0.9;
1409  } //station1 or 2
1410  } //lct first to second
1411  } //corrlcts
1412 
1413  if( (haloVals[0][0] == 1.) && (haloVals[1][0] == 1.) && (haloVals[0][3] != 1.) && (haloVals[1][3] != 1.) )
1414  {
1415  if( haloVals[0][1] == haloVals[1][1] ){
1416  double delEta23 = haloVals[1][2] - haloVals[0][2];
1417  haloDelEta23->Fill( delEta23 );
1418  }
1419  }
1420 
1421  if( (haloVals[2][0] == 1.) && (haloVals[3][0] == 1.) && (haloVals[2][3] != 1.) && (haloVals[3][3] != 1.) )
1422  {
1423  if( haloVals[2][1] == haloVals[3][1] ){
1424  double delEta23 = haloVals[3][2] - haloVals[2][2];
1425  haloDelEta23->Fill( delEta23 );
1426  }
1427  }
1428  } //halo trigger
1429  */
1430 
1431  int cscTrackStub = 0;
1432  //float haloEta[3];
1433  //for(int i=0; i<3; i++) haloEta[i]=-1.0;
1434  //bool haloME11 = false;
1435  CSCCorrelatedLCTDigiCollection lctsOfTracks = trk->second;
1436  for (CSCCorrelatedLCTDigiCollection::DigiRangeIterator trackStub = lctsOfTracks.begin();
1437  trackStub != lctsOfTracks.end();
1438  trackStub++) {
1439  CSCCorrelatedLCTDigiCollection::Range range2 = lctsOfTracks.get((*trackStub).first);
1440  for (CSCCorrelatedLCTDigiCollection::const_iterator lct = range2.first; lct != range2.second; lct++) {
1441  // int station = (*trackStub).first.station()-1;
1442  // if(station != 4)
1443  // {
1444  // // int endcap = (*trackStub).first.endcap()-1;
1445  // // int sector = (*trackStub).first.triggerSector()-1;
1446  // int cscId = (*trackStub).first.triggerCscId()-1;
1447  // int subSector = CSCTriggerNumbering::triggerSubSectorFromLabels((*trackStub).first);
1448  // int fpga = ( subSector ? subSector-1 : station+1 );
1449 
1450  // lclphidat lclPhi;
1451  // lclPhi = srLUTs_[fpga]->localPhi(lct->getStrip(), lct->getPattern(), lct->getQuality(), lct->getBend());
1452  // gblphidat gblPhi;
1453  // gblPhi = srLUTs_[fpga]->globalPhiME(lclPhi.phi_local, lct->getKeyWG(), cscId+1);
1454  // gbletadat gblEta;
1455  // gblEta = srLUTs_[fpga]->globalEtaME(lclPhi.phi_bend_local, lclPhi.phi_local, lct->getKeyWG(), cscId+1);
1456  // haloEta[station-1] = gblEta.global_eta/127. * 1.5 + 0.9;
1457  // if(station==1 && cscId<2) haloME11 = true;
1458  // }
1459  cscTrackStub++;
1460  }
1461  }
1462  cscTrackStubNumbers->Fill(cscTrackStub);
1463 
1464  // if(trigMode == 15)
1465  // {
1466  // float dEta13 = haloEta[2]-haloEta[0];
1467  // float dEta12 = haloEta[1]-haloEta[0];
1468  // if(haloME11)
1469  // {
1470  // if(haloEta[1]!=-1.0) haloDelEta112->Fill(dEta12);
1471  // if(haloEta[2]!=-1.0) haloDelEta113->Fill(dEta13);
1472  // } else {
1473  // if(haloEta[1]!=-1.0) haloDelEta12->Fill(dEta12);
1474  // if(haloEta[2]!=-1.0) haloDelEta13->Fill(dEta13);
1475  // }
1476  // }
1477  //
1478  }
1479  }
1480  csctfntrack->Fill(NumCSCTfTracksRep);
1481 
1482  if (mbProducer.label() != "null") {
1483  // handle to needed collections
1485  e.getByToken(dtStubsToken_, dtStubs);
1487  e.getByToken(mbtracksToken_, tracks);
1488 
1489  // loop on the DT stubs
1490  std::vector<csctf::TrackStub> vstubs = dtStubs->get();
1491  for (std::vector<csctf::TrackStub>::const_iterator stub = vstubs.begin(); stub != vstubs.end(); stub++) {
1492  if (verbose_) {
1493  edm::LogInfo("DataNotFound") << "\n mbEndcap: " << stub->endcap();
1494  edm::LogInfo("DataNotFound") << "\n stub->getStrip()[FLAG]: " << stub->getStrip();
1495  edm::LogInfo("DataNotFound") << "\n stub->getKeyWG()[CAL]: " << stub->getKeyWG();
1496  edm::LogInfo("DataNotFound") << "\n stub->BX(): " << stub->BX();
1497  edm::LogInfo("DataNotFound") << "\n stub->sector(): " << stub->sector();
1498  edm::LogInfo("DataNotFound") << "\n stub->subsector(): " << stub->subsector();
1499  edm::LogInfo("DataNotFound") << "\n stub->station(): " << stub->station();
1500  edm::LogInfo("DataNotFound") << "\n stub->phiPacked(): " << stub->phiPacked();
1501  edm::LogInfo("DataNotFound") << "\n stub->getBend(): " << stub->getBend();
1502  edm::LogInfo("DataNotFound") << "\n stub->getQuality(): " << stub->getQuality();
1503  edm::LogInfo("DataNotFound") << "\n stub->cscid(): " << stub->cscid() << endl;
1504  }
1505  // define the sector ID
1506  int mbId = (stub->endcap() == 2) ? 6 : 0;
1507  mbId += stub->sector();
1508  // *** do not fill if CalMB variable is set ***
1509  // horrible! They used the same class to write up the LCT and MB info,
1510  // but given the MB does not have strip and WG they replaced this two
1511  // with the flag and cal bits... :S
1512  if (stub->getKeyWG() == 0)
1513  {
1514  // if FLAG =1, muon belong to previous BX
1515  int bxDT = stub->BX() - stub->getStrip(); // correct by the FLAG
1516  int subDT = stub->subsector();
1517 
1518  // Fill the event only if CSC had or would have triggered
1519  if (isCSCcand_) {
1520  //look for tracks in the event and compare the matching DT stubs
1521  int trkBX = 0;
1522  for (L1CSCTrackCollection::const_iterator trk = tracks->begin(); trk < tracks->end(); trk++) {
1523  trkBX = trk->first.BX();
1524  int trkId = (trk->first.endcap() == 2) ? 6 : 0;
1525  trkId += trk->first.sector();
1526  if (verbose_) {
1527  edm::LogInfo("DataNotFound")
1528  << "\n trk BX: " << trkBX << " Sector: " << trkId << " SubSector: " << trk->first.subsector()
1529  << " Endcap: " << trk->first.endcap();
1530 
1531  edm::LogInfo("DataNotFound")
1532  << "\n DT BX: " << stub->BX() << " Sector: " << mbId << " SubSector: " << stub->subsector()
1533  << " Endcap: " << stub->endcap() << endl;
1534  }
1535 
1536  if (mbId == trkId) {
1537  if (verbose_) {
1538  edm::LogInfo("DataNotFound") << " --> MATCH" << endl;
1539  edm::LogInfo("DataNotFound") << "Fill :" << trkBX + 6 - bxDT << " -- " << subDT << " -- cands" << endl;
1540  }
1541  // DT bx ranges from 3 to 9
1542  // trk bx ranges from -3 to 3
1543  DTstubsTimeTrackMenTimeArrival[mbId - 1]->Fill(bxDT - trkBX - 6, subDT); //subsec
1544  }
1545  } // loop on the tracks
1546  } //if (isCSCcand_){
1547  } //if (stub->getKeyWG() == 0) {
1548  }
1549  }
1550 }
MonitorElement * DTstubsTimeTrackMenTimeArrival[12]
Definition: L1TCSCTF.h:165
MonitorElement * csctfoccupancies
Definition: L1TCSCTF.h:81
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
Definition: DQMStore.cc:239
T getParameter(std::string const &) const
unsigned long long cacheIdentifier() const
MonitorElement * csctfTrackEtaHighQ
Definition: L1TCSCTF.h:99
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * csctflcts
Definition: L1TCSCTF.h:108
lclphidat localPhi(int strip, int pattern, int quality, int lr, const bool gangedME1a=false) const
Geometry Lookup Tables.
MonitorElement * csctfTrackPhi
Definition: L1TCSCTF.h:96
MonitorElement * csctferrors_mpc
Definition: L1TCSCTF.h:84
MonitorElement * csc_strip_MEminus22
Definition: L1TCSCTF.h:137
bool verbose_
Definition: L1TCSCTF.h:173
unsigned long long m_scalesCacheID
Definition: L1TCSCTF.h:183
MonitorElement * csctfTrackPhi_H
Definition: L1TCSCTF.h:100
MonitorElement * csc_wire_MEplus31
Definition: L1TCSCTF.h:148
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
MonitorElement * csc_strip_MEplus21
Definition: L1TCSCTF.h:126
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
MonitorElement * csc_strip_MEplus11
Definition: L1TCSCTF.h:123
MonitorElement * csc_wire_MEminus13
Definition: L1TCSCTF.h:155
MonitorElement * csc_wire_MEminus22
Definition: L1TCSCTF.h:157
MonitorElement * me11_lctGblPhi
Definition: L1TCSCTF.h:115
MonitorElement * csc_wire_MEplus12
Definition: L1TCSCTF.h:144
MonitorElement * csc_wire_MEminus31
Definition: L1TCSCTF.h:158
MonitorElement * csctfbx
Definition: L1TCSCTF.h:77
MonitorElement * csc_wire_MEminus32
Definition: L1TCSCTF.h:159
MonitorElement * csctfTrackEtaLowQ
Definition: L1TCSCTF.h:98
edm::InputTag mbProducer
Definition: L1TCSCTF.h:176
MonitorElement * csc_strip_MEminus12
Definition: L1TCSCTF.h:134
MonitorElement * csctfTrackEta
Definition: L1TCSCTF.h:97
MonitorElement * me11_lctWire
Definition: L1TCSCTF.h:112
MonitorElement * csc_strip_MEminus31
Definition: L1TCSCTF.h:138
std::string outputFile_
Definition: L1TCSCTF.h:172
unsigned phiPacked() const
Return the binned phi for this stub.
Definition: TrackStub.h:42
MonitorElement * csc_wire_MEminus21
Definition: L1TCSCTF.h:156
edm::InputTag statusProducer
Definition: L1TCSCTF.h:176
void Fill(long long x)
edm::EDGetTokenT< L1CSCStatusDigiCollection > statusToken_
Definition: L1TCSCTF.h:188
~L1TCSCTF() override
Definition: L1TCSCTF.cc:101
MonitorElement * csctfTrackEta_H
Definition: L1TCSCTF.h:101
MonitorElement * me42_lctGblPhi
Definition: L1TCSCTF.h:119
const L1MuTriggerScales * ts
Definition: L1TCSCTF.h:181
bool gangedME11a_
Definition: L1TCSCTF.h:177
gblphidat globalPhiME(int phi_local, int wire_group, int cscid, const bool gangedME1a=false) const
MonitorElement * cscTrackStubNumbers
Definition: L1TCSCTF.h:102
MonitorElement * csc_strip_MEminus32
Definition: L1TCSCTF.h:139
int L1ABXN
Definition: L1TCSCTF.h:169
MonitorElement * me11_lctStrip
Definition: L1TCSCTF.h:111
int BxInEvent_
Definition: L1TCSCTF.h:166
MonitorElement * csc_strip_MEminus42
Definition: L1TCSCTF.h:141
MonitorElement * csc_wire_MEplus41
Definition: L1TCSCTF.h:150
double etaValue() const
return the Eta Value of this stub&#39;s position.
Definition: TrackStub.h:34
const L1MuScale * getPhiScale() const
get the phi scale
MonitorElement * csc_strip_MEplus13
Definition: L1TCSCTF.h:125
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MonitorElement * csc_strip_MEplus22
Definition: L1TCSCTF.h:127
int nev_
Definition: L1TCSCTF.h:171
MonitorElement * csc_wire_MEminus41
Definition: L1TCSCTF.h:160
L1TCSCTF(const edm::ParameterSet &ps)
Definition: L1TCSCTF.cc:23
MonitorElement * csctfChamberOccupancies
Definition: L1TCSCTF.h:95
bool isValid() const
Definition: HandleBase.h:70
virtual 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)
MonitorElement * csc_wire_MEplus13
Definition: L1TCSCTF.h:145
edm::InputTag lctProducer
Definition: L1TCSCTF.h:176
Definition: L1Track.h:19
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: L1TCSCTF.cc:655
#define M_PI
MonitorElement * csc_wire_MEplus21
Definition: L1TCSCTF.h:146
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) override
Definition: L1TCSCTF.cc:110
edm::EDGetTokenT< L1CSCTrackCollection > tracksToken_
Definition: L1TCSCTF.h:190
MonitorElement * csc_strip_MEminus41
Definition: L1TCSCTF.h:140
MonitorElement * me42_lctGblEta
Definition: L1TCSCTF.h:120
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Definition: L1TCSCTF.cc:108
MonitorElement * csc_strip_MEplus31
Definition: L1TCSCTF.h:128
MonitorElement * csc_wire_MEplus32
Definition: L1TCSCTF.h:149
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > corrlctsToken_
Definition: L1TCSCTF.h:189
double phiValue() const
return the Phi Value of this stub&#39;s position in local coordinates.
Definition: TrackStub.h:36
MonitorElement * csctferrors
Definition: L1TCSCTF.h:80
T const * product() const
Definition: Handle.h:69
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:181
MonitorElement * csc_wire_MEminus42
Definition: L1TCSCTF.h:161
bool isCSCcand_
Definition: L1TCSCTF.h:167
class global_phi_data gblphidat
MonitorElement * csc_strip_MEplus41
Definition: L1TCSCTF.h:130
std::pair< const_iterator, const_iterator > Range
MonitorElement * csctfTrackM
Definition: L1TCSCTF.h:103
edm::EDGetTokenT< L1CSCTrackCollection > mbtracksToken_
Definition: L1TCSCTF.h:192
MonitorElement * csctfbx_H
Definition: L1TCSCTF.h:78
std::vector< DigiType >::const_iterator const_iterator
class local_phi_data lclphidat
Data Types.
static int triggerSubSectorFromLabels(int station, int chamber)
MonitorElement * csctfntrack
Definition: L1TCSCTF.h:76
edm::InputTag trackProducer
Definition: L1TCSCTF.h:176
edm::EDGetTokenT< L1MuGMTReadoutCollection > gmtProducerToken_
Definition: L1TCSCTF.h:187
std::string const & label() const
Definition: InputTag.h:36
MonitorElement * csc_wire_MEplus42
Definition: L1TCSCTF.h:151
MonitorElement * trackModeVsQ
Definition: L1TCSCTF.h:104
MonitorElement * me11_lctGblEta
Definition: L1TCSCTF.h:116
HLT enums.
gbletadat globalEtaME(int phi_bend, int phi_local, int wire_group, int cscid, const bool gangedME1a=false) const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Definition: DQMStore.cc:266
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
T get() const
Definition: EventSetup.h:73
virtual float getLowEdge(unsigned packed) const =0
get the low edge of bin represented by packed
MonitorElement * csc_strip_MEminus21
Definition: L1TCSCTF.h:136
MonitorElement * csctfoccupancies_H
Definition: L1TCSCTF.h:82
MonitorElement * csc_strip_MEplus32
Definition: L1TCSCTF.h:129
MonitorElement * csc_strip_MEplus12
Definition: L1TCSCTF.h:124
static unsigned int const shift
void setPhiPacked(const unsigned &phi_)
Definition: TrackStub.h:31
trackProducer
Run2: False; Run1: True.
Definition: L1TCSCTF_cfi.py:12
CSCSectorReceiverLUT * srLUTs_[5][2][6]
Definition: L1TCSCTF.h:179
const L1MuTriggerPtScale * tpts
Definition: L1TCSCTF.h:182
MonitorElement * me11_lctLocalPhi
Definition: L1TCSCTF.h:113
MonitorElement * csc_strip_MEminus11
Definition: L1TCSCTF.h:133
MonitorElement * csc_strip_MEminus13
Definition: L1TCSCTF.h:135
unsigned long long m_ptScaleCacheID
Definition: L1TCSCTF.h:184
MonitorElement * csc_wire_MEplus11
Definition: L1TCSCTF.h:143
MonitorElement * csc_wire_MEminus12
Definition: L1TCSCTF.h:154
class global_eta_data gbletadat
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:51
MonitorElement * cscWireStripOverflow
Definition: L1TCSCTF.h:85
T const * product() const
Definition: ESHandle.h:86
MonitorElement * csc_strip_MEplus42
Definition: L1TCSCTF.h:131
std::string const & instance() const
Definition: InputTag.h:37
edm::EDGetTokenT< CSCTriggerContainer< csctf::TrackStub > > dtStubsToken_
Definition: L1TCSCTF.h:191
edm::InputTag gmtProducer
Definition: L1TCSCTF.h:176
void setEtaPacked(const unsigned &eta_)
set Eta and Phi from integer values.
Definition: TrackStub.h:30
MonitorElement * me11_lctPackedPhi
Definition: L1TCSCTF.h:114
MonitorElement * csc_wire_MEplus22
Definition: L1TCSCTF.h:147
MonitorElement * csc_wire_MEminus11
Definition: L1TCSCTF.h:153
Definition: Run.h:45
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)