CMS 3D CMS Logo

CSCTriggerPrimitivesReader.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: CSCTriggerPrimitivesReader
4 //
5 // Description: Basic analyzer class which accesses ALCTs, CLCTs, and
6 // correlated LCTs and plot various quantities.
7 //
8 // Author List: S. Valuev, UCLA.
9 //
10 //
11 // Modifications:
12 //
13 //--------------------------------------------------
14 
15 //-----------------------
16 // This Class's Header --
17 //-----------------------
19 
20 //-------------------------------
21 // Collaborating Class Headers --
22 //-------------------------------
23 
29 
31 
34 
35 // MC data
37 
38 // MC tests
43 
44 #include "TCanvas.h"
45 #include "TFile.h"
46 #include "TH1.h"
47 #include "TText.h"
48 #include "TPaveLabel.h"
49 #include "TPostScript.h"
50 #include "TStyle.h"
51 #include "TROOT.h"
52 
55 
56 #define MAXSTUBS 100
57 using namespace std;
58 
59 //-----------------
60 // Static variables
61 //-----------------
62 
63 // Various useful constants
64 const double CSCTriggerPrimitivesReader::TWOPI = 2. * M_PI;
66  "ME1/1", "ME1/2", "ME1/3", "ME1/A", "ME2/1", "ME2/2", "ME3/1", "ME3/2", "ME4/1", "ME4/2"};
68  "ME+1/1", "ME+1/2", "ME+1/3", "ME+1/A", "ME+2/1", "ME+2/2", "ME+3/1", "ME+3/2", "ME+4/1", "ME+4/2"};
70  "ME-1/1", "ME-1/2", "ME-1/3", "ME-1/A", "ME-2/1", "ME-2/2", "ME-3/1", "ME-3/2", "ME-4/1", "ME-4/2"};
71 const int CSCTriggerPrimitivesReader::NCHAMBERS[CSC_TYPES] = {36, 36, 36, 36, 18, 36, 18, 36, 18, 36};
73  48, 64, 32, 48, 112, 64, 96, 64, 96, 64}; //max. number of wiregroups
75  128, 160, 128, 96, 160, 160, 160, 160, 160, 160}; // max. # of halfstrips
77  -999, -5, 4, -4, 3, -3, 2, -2, 1, -1, 0}; // "signed" pattern (== phiBend)
78 
79 // LCT counters
84 
90 
92 
95 
97 
98 // LUT for which ME1/1 wire group can cross which ME1/a halfstrip
99 // 1st index: WG number
100 // 2nd index: inclusive HS range
102  {0, 95}, {0, 95}, {0, 95}, {0, 95}, {0, 95}, {0, 95}, {0, 95}, {0, 95}, {0, 95}, {0, 95},
103  {0, 95}, {0, 95}, {0, 77}, {0, 61}, {0, 39}, {0, 22}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1},
104  {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1},
105  {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1},
106  {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}};
107 // a modified LUT for ganged ME1a
109  {0, 31}, {0, 31}, {0, 31}, {0, 31}, {0, 31}, {0, 31}, {0, 31}, {0, 31}, {0, 31}, {0, 31},
110  {0, 31}, {0, 31}, {0, 31}, {0, 31}, {0, 31}, {0, 22}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1},
111  {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1},
112  {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1},
113  {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}};
114 
115 // LUT for which ME1/1 wire group can cross which ME1/b halfstrip
116 // 1st index: WG number
117 // 2nd index: inclusive HS range
119  {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1},
120  {100, 127}, {73, 127}, {47, 127}, {22, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127},
121  {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127},
122  {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127},
123  {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 105}, {0, 93}, {0, 78}, {0, 63}};
124 
125 //init My ttree
126 void TreePerStub::init(int run, int event) {
127  t_EventNumberAnalyzed = -1;
128  t_RUN = run;
129  t_Event = event;
130  t_nStubs = 0;
131  t_nStubs_readout = 0;
132 
133  t_chamber = -1;
134  t_ring = -1;
135  t_station = -1;
136  t_chambertype = -1;
137  t_endcap = -2;
138 }
139 
140 TTree* TreePerStub::bookTree(TTree* t, const std::string& name) {
142  t = fs->make<TTree>(name.c_str(), name.c_str());
143 
144  t->Branch("t_EventNumberAnalyzed", &t_EventNumberAnalyzed, "t_EventNumberAnalyzed/I");
145  t->Branch("t_RUN", &t_RUN, "t_RUN/I");
146  t->Branch("t_Event", &t_Event, "t_Event/I");
147  t->Branch("t_nStubs", &t_nStubs, "t_nStubs/I");
148  t->Branch("t_nStubs_readout", &t_nStubs_readout, "t_nStubs_readout/I");
149  t->Branch("t_nStubs_ME119", &t_nStubs_ME119, "t_nStubs_ME119/I");
150  t->Branch("t_nStubs_ME11no911", &t_nStubs_ME11no911, "t_nStubs_ME11no911/I");
151  t->Branch("t_nStubs_noMEpm11", &t_nStubs_noMEpm11, "t_nStubs_noMEpm11/I");
152 
153  t->Branch("t_chamber", &t_chamber, "t_chamber/I");
154  t->Branch("t_ring", &t_ring, "t_ring/I");
155  t->Branch("t_endcap", &t_endcap, "t_endcap/I");
156  t->Branch("t_station", &t_station, "t_station/I");
157  t->Branch("t_chambertype", &t_chambertype, "t_chambertype/I");
158 
159  return t;
160 }
161 
162 //init stub comparison struct
164  nEvents = -1;
165  nRUN = run;
166  nEvent = event;
167  firstfill = false;
168  totStubs_data = -1;
169  totStubs_emul = -1;
170  totStubs_emul_readout = -1;
171  nStub_data = 0;
172  nStub_emul = 0;
173  chamber = -1;
174  ring = -1;
175  endcap = -1;
176  station = -1;
177  chambertype = -1;
178  has_data = false;
179  has_emul = false;
180 
181  npretrig = 0;
182  quality_pretrig = -1;
183  maxquality_pretrig = -1;
184  bend_pretrig = -1;
185  bx_pretrig = -1;
186  key_hs_pretrig = -1;
187  pattern_pretrig = -1;
188  maxpattern_pretrig = -1;
189  quality_data = -1;
190  bend_data = -1;
191  bx_data = -1;
192  quality_emul = -1;
193  bend_emul = -1;
194  pattern_data = -1;
195  pattern_emul = -1;
196  bx_emul = -1;
197  bx_corr_emul = -1; //corrected
198  key_WG_data = -1;
199  key_WG_emul = -1;
200  key_hs_data = -1;
201  key_hs_emul = -1;
202  WGcrossHS_data = false;
203  WGcrossHS_emul = false;
204  trknmb_data = -1;
205  trknmb_emul = -1;
206  dphi_data = -1;
207  dphi_emul = -1;
208  eta_data = -1;
209  eta_emul = -1;
210  phi_data = -1;
211  phi_emul = -1;
212 }
213 
216  t = fs->make<TTree>(name.c_str(), name.c_str());
217 
218  t->Branch("nEvents", &nEvents);
219  t->Branch("nRUN", &nRUN);
220  t->Branch("nEvent", &nEvent);
221  t->Branch("firstfill", &firstfill);
222  t->Branch("totStubs_data", &totStubs_data);
223  t->Branch("totStubs_emul", &totStubs_emul);
224  t->Branch("totStubs_emul_readout", &totStubs_emul_readout);
225  t->Branch("nStub_data", &nStub_data);
226  t->Branch("nStub_emul", &nStub_emul);
227 
228  t->Branch("chamber", &chamber);
229  t->Branch("ring", &ring);
230  t->Branch("endcap", &endcap);
231  t->Branch("station", &station);
232  t->Branch("chambertype", &chambertype);
233  t->Branch("has_data", &has_data);
234  t->Branch("has_emul", &has_emul);
235  t->Branch("quality_data", &quality_data);
236  t->Branch("quality_emul", &quality_emul);
237  t->Branch("npretrig", &npretrig);
238  t->Branch("quality_pretrig", &quality_pretrig);
239  t->Branch("maxquality_pretrig", &maxquality_pretrig);
240  t->Branch("pattern_data", &pattern_data);
241  t->Branch("pattern_emul", &pattern_emul);
242  t->Branch("pattern_pretrig", &pattern_pretrig);
243  t->Branch("maxpattern_pretrig", &maxpattern_pretrig);
244  t->Branch("bend_data", &bend_data);
245  t->Branch("bx_data", &bx_data);
246  t->Branch("fullbx_data", &fullbx_data);
247  t->Branch("bend_emul", &bend_emul);
248  t->Branch("bx_emul", &bx_emul);
249  t->Branch("fullbx_emul", &fullbx_emul);
250  t->Branch("bend_pretrig", &bend_pretrig);
251  t->Branch("bx_pretrig", &bx_pretrig);
252  t->Branch("bx_corr_emul", &bx_corr_emul);
253  t->Branch("WGcrossHS_data", &WGcrossHS_data);
254  t->Branch("WGcrossHS_emul", &WGcrossHS_emul);
255  t->Branch("key_WG_data", &key_WG_data);
256  t->Branch("key_WG_emul", &key_WG_emul);
257  t->Branch("key_hs_data", &key_hs_data);
258  t->Branch("key_hs_emul", &key_hs_emul);
259  t->Branch("key_hs_pretrig", &key_hs_pretrig);
260  t->Branch("trknmb_data", &trknmb_data);
261  t->Branch("trknmb_emul", &trknmb_emul);
262  t->Branch("dphi_data", &dphi_data);
263  t->Branch("dphi_emul", &dphi_emul);
264  t->Branch("eta_data", &eta_data);
265  t->Branch("eta_emul", &eta_emul);
266  t->Branch("phi_data", &phi_data);
267  t->Branch("phi_emul", &phi_emul);
268 
269  return t;
270 }
271 
272 //----------------
273 // Constructor --
274 //----------------
277  // rootFileName = conf.getUntrackedParameter<string>("rootFileName","TPEHists.root");
278  // Create the root file for the histograms
279  // theFile = new TFile(rootFileName.c_str(), "RECREATE");
280  // theFile->cd();
281 
282  // Various input parameters.
283 
284  printps = conf.getParameter<bool>("printps");
285  dataLctsIn_ = conf.getParameter<bool>("dataLctsIn");
286  emulLctsIn_ = conf.getParameter<bool>("emulLctsIn");
287  edm::ParameterSet commonParams = conf.getParameter<edm::ParameterSet>("commonParam");
288 
289  // Switch for a new (2007) version of the TMB firmware.
290  gangedME1a = commonParams.getParameter<bool>("gangedME1a");
291 
292  // is it (non-upgrade algorithm) run along with upgrade one?
293  plotME1A = true;
294  plotME42 = true;
295  lctProducerData_ = conf.getUntrackedParameter<string>("CSCLCTProducerData", "cscunpacker");
296  mpclctProducerData_ = conf.getUntrackedParameter<string>("CSCMPCLCTProducerData", "csctfDigis");
297  lctProducerEmul_ = conf.getUntrackedParameter<string>("CSCLCTProducerEmul", "cscTriggerPrimitiveDigis");
298 
299  simHitProducer_ = conf.getParameter<edm::InputTag>("CSCSimHitProducer");
300  wireDigiProducer_ = conf.getParameter<edm::InputTag>("CSCWireDigiProducer");
301  compDigiProducer_ = conf.getParameter<edm::InputTag>("CSCComparatorDigiProducer");
302 
303  simHit_token_ = consumes<edm::PSimHitContainer>(simHitProducer_);
304  wireDigi_token_ = consumes<CSCWireDigiCollection>(wireDigiProducer_);
305  compDigi_token_ = consumes<CSCComparatorDigiCollection>(compDigiProducer_);
306 
307  alcts_d_token_ = consumes<CSCALCTDigiCollection>(edm::InputTag(lctProducerData_, "MuonCSCALCTDigi"));
308  clcts_d_token_ = consumes<CSCCLCTDigiCollection>(edm::InputTag(lctProducerData_, "MuonCSCCLCTDigi"));
310  consumes<CSCCorrelatedLCTDigiCollection>(edm::InputTag(lctProducerData_, "MuonCSCCorrelatedLCTDigi"));
311  lcts_mpc_d_token_ = consumes<CSCCorrelatedLCTDigiCollection>(edm::InputTag(mpclctProducerData_));
312 
313  alcts_e_token_ = consumes<CSCALCTDigiCollection>(edm::InputTag(lctProducerEmul_));
314  clcts_e_token_ = consumes<CSCCLCTDigiCollection>(edm::InputTag(lctProducerEmul_));
315  pretrigs_e_token_ = consumes<CSCCLCTPreTriggerDigiCollection>(edm::InputTag(lctProducerEmul_));
316  lcts_tmb_e_token_ = consumes<CSCCorrelatedLCTDigiCollection>(edm::InputTag(lctProducerEmul_));
317  lcts_mpc_e_token_ = consumes<CSCCorrelatedLCTDigiCollection>(edm::InputTag(lctProducerEmul_, "MPCSORTED"));
318 
319  consumesMany<edm::HepMCProduct>();
320  resultsFileNamesPrefix_ = conf.getUntrackedParameter<string>("resultsFileNamesPrefix", "");
321  checkBadChambers_ = conf.getUntrackedParameter<bool>("checkBadChambers", true);
322  debug = conf.getUntrackedParameter<bool>("debug", false);
323  dataIsAnotherMC_ = conf.getUntrackedParameter<bool>("dataIsAnotherMC", false);
324 
325  //rootFileName = conf.getUntrackedParameter<string>("rootFileName");
326  // Create the root file.
327  // Not sure we really need it - comment out for now. -Slava.
328  //theFile = new TFile(rootFileName.c_str(), "RECREATE");
329  //theFile->cd();
330  stub_tree[0] = stubs_comparison[0].bookTree(stub_tree[0], "alcttree");
331  stub_tree[1] = stubs_comparison[1].bookTree(stub_tree[1], "clcttree");
332  stub_tree[2] = stubs_comparison[2].bookTree(stub_tree[2], "lcttree");
333  stub_tree[3] = stubs_comparison[3].bookTree(stub_tree[3], "mpclcttree");
334  // Per event TTree
335  event_tree[0] = perStub[0].bookTree(event_tree[0], "Ev_alcttree");
336  event_tree[1] = perStub[1].bookTree(event_tree[1], "Ev_emul_alcttree");
337  event_tree[2] = perStub[2].bookTree(event_tree[2], "Ev_clcttree");
338  event_tree[3] = perStub[3].bookTree(event_tree[3], "Ev_emul_clcttree");
339  event_tree[4] = perStub[4].bookTree(event_tree[4], "Ev_lcttree");
340  event_tree[5] = perStub[5].bookTree(event_tree[5], "Ev_emul_lcttree");
341  // My favourite ROOT settings.
342  setRootStyle();
343 }
344 
345 //----------------
346 // Destructor --
347 //----------------
349  // histos->writeHists(theFile);
350  // theFile->Close();
351  //delete theFile;
352 }
353 
355  if (station == 1) {
356  if (plotME1A)
357  return 4;
358  else
359  return 3;
360  }
361  return 2;
362 }
363 
365  ++eventsAnalyzed;
366  //if (ev.id().event()%10 == 0)
367  LogTrace("CSCTriggerPrimitivesReader") << "\n** CSCTriggerPrimitivesReader: processing run #" << ev.id().run()
368  << " event #" << ev.id().event() << "; events so far: " << eventsAnalyzed
369  << " **";
370  RUN_ = ev.id().run();
371  Event_ = ev.id().event();
372 
373  // Find the geometry for this event & cache it. Needed in LCTAnalyzer
374  // modules.
376  setup.get<MuonGeometryRecord>().get(cscGeom);
377  geom_ = &*cscGeom;
378 
379  // Find conditions data for bad chambers & cache it. Needed for efficiency
380  // calculations.
381  if (checkBadChambers_) {
383  setup.get<CSCBadChambersRcd>().get(pBad);
384  badChambers_ = pBad.product();
385  }
386 
387  // Get the collections of ALCTs, CLCTs, and correlated LCTs from event.
397 
398  // Data
399  if (dataLctsIn_) {
400  HotWires(ev);
401  // ev.getByLabel(lctProducerData_, alcts_data);
402  // ev.getByLabel(lctProducerData_, clcts_data);
403  // ev.getByLabel(lctProducerData_, lcts_tmb_data);
404  ev.getByToken(alcts_d_token_, alcts_data);
405  ev.getByToken(clcts_d_token_, clcts_data);
406  ev.getByToken(lcts_tmb_d_token_, lcts_tmb_data);
407  ev.getByToken(lcts_mpc_d_token_, lcts_mpc_data);
408 
409  if (!alcts_data.isValid()) {
410  edm::LogWarning("L1CSCTPEmulatorWrongInput")
411  << "+++ Warning: Collection of ALCTs with label MuonCSCALCTDigi"
412  << " requested, but not found in the event... Skipping the rest +++\n";
413  return;
414  }
415  if (!clcts_data.isValid()) {
416  edm::LogWarning("L1CSCTPEmulatorWrongInput")
417  << "+++ Warning: Collection of CLCTs with label MuonCSCCLCTDigi"
418  << " requested, but not found in the event... Skipping the rest +++\n";
419  return;
420  }
421  if (!lcts_tmb_data.isValid()) {
422  edm::LogWarning("L1CSCTPEmulatorWrongInput") << "+++ Warning: Collection of correlated LCTs with label"
423  << " MuonCSCCorrelatedLCTDigi requested, but not found in the"
424  << " event... Skipping the rest +++\n";
425  return;
426  }
427  /*
428  if (!lcts_mpc_data.isValid()) {
429  edm::LogWarning("L1CSCTPEmulatorWrongInput")
430  << "+++ Warning: Collection of MPC correlated LCTs with label"
431  << " MuonCSCCorrelatedLCTDigi + MCPSorted requested, but not found in the"
432  << " event... Skipping the rest +++\n";
433  //return;
434  }*/
435  }
436 
437  // Emulator
438  if (emulLctsIn_) {
439  // ev.getByLabel(lctProducerEmul_, alcts_emul);
440  // ev.getByLabel(lctProducerEmul_, clcts_emul);
441  // ev.getByLabel(lctProducerEmul_, lcts_tmb_emul);
442  // ev.getByLabel(lctProducerEmul_, "MPCSORTED", lcts_mpc_emul);
443  ev.getByToken(alcts_e_token_, alcts_emul);
444  ev.getByToken(clcts_e_token_, clcts_emul);
445  ev.getByToken(pretrigs_e_token_, pretrigs_emul);
446  ev.getByToken(lcts_tmb_e_token_, lcts_tmb_emul);
447  ev.getByToken(lcts_mpc_e_token_, lcts_mpc_emul);
448 
449  if (!alcts_emul.isValid()) {
450  edm::LogWarning("L1CSCTPEmulatorWrongInput")
451  << "+++ Warning: Collection of emulated ALCTs"
452  << " requested, but not found in the event... Skipping the rest +++\n";
453  return;
454  }
455  if (!clcts_emul.isValid()) {
456  edm::LogWarning("L1CSCTPEmulatorWrongInput")
457  << "+++ Warning: Collection of emulated CLCTs"
458  << " requested, but not found in the event... Skipping the rest +++\n";
459  return;
460  }
461  if (!lcts_tmb_emul.isValid()) {
462  edm::LogWarning("L1CSCTPEmulatorWrongInput")
463  << "+++ Warning: Collection of emulated correlated LCTs"
464  << " requested, but not found in the event... Skipping the rest +++\n";
465  return;
466  }
467  /*
468  if (!lcts_mpc_emul.isValid()) {
469  edm::LogWarning("L1CSCTPEmulatorWrongInput")
470  << "+++ Warning: Collection of emulated correlated LCTs (MPCs)"
471  << " requested, but not found in the event... Skipping the rest +++\n";
472  //return;
473  }*/
474  }
475 
476  // Fill histograms with reconstructed or emulated quantities. If both are
477  // present, plot LCTs in data.
478  if (dataLctsIn_) {
479  fillALCTHistos(alcts_data.product());
480  fillCLCTHistos(clcts_data.product());
481  fillLCTTMBHistos(lcts_tmb_data.product());
482  } else if (emulLctsIn_) {
483  fillALCTHistos(alcts_emul.product());
484  fillCLCTHistos(clcts_emul.product());
485  fillLCTTMBHistos(lcts_tmb_emul.product());
486  //fillLCTMPCHistos(lcts_mpc_emul.product());
487  }
488 
489  // Compare LCTs in the data with the ones produced by the emulator.
490  if (dataLctsIn_ && emulLctsIn_) {
491  compare(alcts_data.product(),
492  alcts_emul.product(),
493  clcts_data.product(),
494  clcts_emul.product(),
495  pretrigs_emul.product(),
496  lcts_tmb_data.product(),
497  lcts_tmb_emul.product());
498  }
499  // Fill MC-based resolution/efficiency histograms, if needed.
500  if (emulLctsIn_) {
501  MCStudies(ev, alcts_emul.product(), clcts_emul.product());
502  }
503 } // analyze
504 
506  // Note: all operations involving ROOT should be placed here and not in the
507  // destructor.
508  // Plot histos if they were booked/filled.
509  if (printps) {
510  if (bookedALCTHistos)
511  drawALCTHistos();
512  if (bookedCLCTHistos)
513  drawCLCTHistos();
514  if (bookedLCTTMBHistos)
516  //if (bookedLCTMPCHistos) drawLCTMPCHistos();
517 
518  if (bookedCompHistos)
519  drawCompHistos();
520 
521  if (bookedResolHistos)
522  drawResolHistos();
523  if (bookedEfficHistos)
524  drawEfficHistos();
525  }
526  //drawHistosForTalks();
527 
528  //theFile->cd();
529  //theFile->Write();
530  //theFile->Close();
531 
532  // Job summary.
533  edm::LogInfo("CSCTriggerPrimitivesReader")
534  << "\n Average number of ALCTs/event = " << static_cast<float>(numALCT) / eventsAnalyzed << endl;
535  edm::LogInfo("CSCTriggerPrimitivesReader")
536  << " Average number of CLCTs/event = " << static_cast<float>(numCLCT) / eventsAnalyzed << endl;
537  edm::LogInfo("CSCTriggerPrimitivesReader")
538  << " Average number of TMB LCTs/event = " << static_cast<float>(numLCTTMB) / eventsAnalyzed << endl;
539  edm::LogInfo("CSCTriggerPrimitivesReader")
540  << " Average number of MPC LCTs/event = " << static_cast<float>(numLCTMPC) / eventsAnalyzed << endl;
541 
542  if (bookedEfficHistos) {
543  {
544  edm::LogInfo("CSCTriggerPrimitivesReader") << "\n ALCT efficiencies:";
545  double tot_simh = 0.0, tot_alct = 0.0;
546  for (int idh = 0; idh < CSC_TYPES; idh++) {
547  double simh = hEfficHitsEtaCsc[idh]->Integral();
548  double alct = hEfficALCTEtaCsc[idh]->Integral();
549  double eff = 0.;
550  if (simh > 0)
551  eff = alct / simh;
552  edm::LogInfo("CSCTriggerPrimitivesReader")
553  << " " << csc_type[idh] << ": alct = " << alct << ", simh = " << simh << " eff = " << eff;
554  tot_simh += simh;
555  tot_alct += alct;
556  }
557  edm::LogInfo("CSCTriggerPrimitivesReader")
558  << " overall: alct = " << tot_alct << ", simh = " << tot_simh << " eff = " << tot_alct / tot_simh;
559  }
560 
561  {
562  edm::LogInfo("CSCTriggerPrimitivesReader") << "\n CLCT efficiencies:";
563  double tot_simh = 0.0, tot_clct = 0.0;
564  for (int idh = 0; idh < CSC_TYPES; idh++) {
565  double simh = hEfficHitsEtaCsc[idh]->Integral();
566  double clct = hEfficCLCTEtaCsc[idh]->Integral();
567  double eff = 0.;
568  if (simh > 0.)
569  eff = clct / simh;
570  edm::LogInfo("CSCTriggerPrimitivesReader")
571  << " " << csc_type[idh] << ": clct = " << clct << ", simh = " << simh << " eff = " << eff;
572  tot_simh += simh;
573  tot_clct += clct;
574  }
575  edm::LogInfo("CSCTriggerPrimitivesReader")
576  << " overall: clct = " << tot_clct << ", simh = " << tot_simh << " eff = " << tot_clct / tot_simh;
577  }
578  }
579 
580  if (bookedResolHistos) {
581  double cor = 0.0, tot = 0.0;
582  cor = hResolDeltaHS->GetBinContent(hResolDeltaHS->FindBin(0.));
583  tot = hResolDeltaHS->GetEntries();
584  edm::LogInfo("CSCTriggerPrimitivesReader")
585  << "\n Correct half-strip assigned in " << cor << "/" << tot << " = " << cor / tot << " of half-strip CLCTs";
586  //cor = hResolDeltaDS->GetBinContent(hResolDeltaDS->FindBin(0.));
587  //tot = hResolDeltaDS->GetEntries();
588  //edm::LogInfo("CSCTriggerPrimitivesReader")
589  // << " Correct di-strip assigned in " << cor << "/" << tot
590  // << " = " << cor/tot << " of di-strip CLCTs";
591  cor = hResolDeltaWG->GetBinContent(hResolDeltaWG->FindBin(0.));
592  tot = hResolDeltaWG->GetEntries();
593  edm::LogInfo("CSCTriggerPrimitivesReader")
594  << " Correct wire group assigned in " << cor << "/" << tot << " = " << cor / tot << " of ALCTs";
595  }
596 }
597 
598 //---------------
599 // ROOT settings
600 //---------------
602  TH1::AddDirectory(false);
603 
604  gROOT->SetStyle("Plain");
605  gStyle->SetFillColor(0);
606  gStyle->SetOptDate();
607  gStyle->SetOptStat(111110);
608  gStyle->SetOptFit(1111);
609  gStyle->SetPadTickX(1);
610  gStyle->SetPadTickY(1);
611  gStyle->SetMarkerSize(0.5);
612  gStyle->SetMarkerStyle(8);
613  gStyle->SetGridStyle(3);
614  gStyle->SetPaperSize(TStyle::kA4);
615  gStyle->SetStatW(0.25); // width of statistics box; default is 0.19
616  gStyle->SetStatH(0.10); // height of statistics box; default is 0.1
617  gStyle->SetStatFormat("6.4g"); // leave default format for now
618  gStyle->SetTitleSize(0.055, ""); // size for pad title; default is 0.02
619  // Really big; useful for talks.
620  //gStyle->SetTitleSize(0.1, ""); // size for pad title; default is 0.02
621  gStyle->SetLabelSize(0.05, "XYZ"); // size for axis labels; default is 0.04
622  gStyle->SetStatFontSize(0.06); // size for stat. box
623  gStyle->SetTitleFont(32, "XYZ"); // times-bold-italic font (p. 153) for axes
624  gStyle->SetTitleFont(32, ""); // same for pad title
625  gStyle->SetLabelFont(32, "XYZ"); // same for axis labels
626  gStyle->SetStatFont(32); // same for stat. box
627  gStyle->SetLabelOffset(0.006, "Y"); // default is 0.005
628 }
629 
630 //---------------------
631 // Histograms for LCTs
632 //---------------------
635  hHotWire1 = fs->make<TH1F>("hHotWire1", "hHotWire1", 570 * 6 * 112, 0, 570 * 6 * 112);
636  hHotCham1 = fs->make<TH1F>("hHotCham1", "hHotCham1", 570, 0, 570);
637  bookedHotWireHistos = true;
638 }
639 
641  string s;
642 
644  hAlctPerEvent = fs->make<TH1F>("ALCTs_per_event", "ALCTs per event", 31, -0.5, 30.5);
645  hAlctPerChamber = fs->make<TH1F>("ALCTs_per_chamber", "ALCTs per chamber", 4, -0.5, 3.5);
646  hAlctPerCSC = fs->make<TH1F>("ALCTs_per_CSCtype", "ALCTs per CSC type", 10, -0.5, 9.5);
647  for (int i = 0; i < MAX_ENDCAPS; i++) { // endcaps
648  for (int j = 0; j < CSC_TYPES; j++) { // station/ring
649  float csc_max = NCHAMBERS[j] + 0.5;
650  char asdf[256];
651  sprintf(asdf, "ALCTs_%i", i * CSC_TYPES + j);
652  if (i == 0)
653  s = "ALCTs, " + csc_type_plus[j];
654  else
655  s = "ALCTs, " + csc_type_minus[j];
656  hAlctCsc[i][j] = fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
657  }
658  }
659 
660  hAlctValid = fs->make<TH1F>("ALCT_validity", "ALCT validity", 3, -0.5, 2.5);
661  hAlctQuality = fs->make<TH1F>("ALCT_quality", "ALCT quality", 5, -0.5, 4.5);
662  hAlctAccel = fs->make<TH1F>("ALCT_accel_flag", "ALCT accel. flag", 3, -0.5, 2.5);
663  hAlctCollis = fs->make<TH1F>("ALCT_collision_flag", "ALCT collision. flag", 3, -0.5, 2.5);
664  hAlctKeyGroup = fs->make<TH1F>("ALCT_key_wiregroup", "ALCT key wiregroup", 120, -0.5, 119.5);
665  hAlctBXN = fs->make<TH1F>("ALCT_bx", "ALCT bx", 20, -0.5, 19.5);
666 
667  hAlctKeyGroupME11 = fs->make<TH1F>("hAlctKeyGroupME11", "ALCT key wiregroup ME1/1", 50, -0.5, 49.5);
668 
669  bookedALCTHistos = true;
670  std::cout << " bookedALCTHistos " << std::endl;
671 }
672 
674  string s;
675 
677  hClctPerEvent = fs->make<TH1F>("CLCTs_per_event", "CLCTs per event", 31, -0.5, 30.5);
678  hClctPerChamber = fs->make<TH1F>("CLCTs_per_chamber", "CLCTs per chamber", 3, -0.5, 2.5);
679  hClctPerCSC = fs->make<TH1F>("CLCTs_per_CSCtype", "CLCTs per CSC type", 10, -0.5, 9.5);
680  for (int i = 0; i < MAX_ENDCAPS; i++) { // endcaps
681  for (int j = 0; j < CSC_TYPES; j++) { // station/ring
682  char asdf[256];
683  sprintf(asdf, "CLCTs_%i", i * CSC_TYPES + j);
684  float csc_max = NCHAMBERS[j] + 0.5;
685  if (i == 0)
686  s = "CLCTs, " + csc_type_plus[j];
687  else
688  s = "CLCTs, " + csc_type_minus[j];
689  hClctCsc[i][j] = fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
690  }
691  }
692 
693  hClctValid = fs->make<TH1F>("CLCT_validity", "CLCT validity", 3, -0.5, 2.5);
694  hClctQuality = fs->make<TH1F>("CLCT_layers_hit", "CLCT layers hit", 9, -0.5, 8.5);
695  hClctStripType = fs->make<TH1F>("CLCT_strip_type", "CLCT strip type", 3, -0.5, 2.5);
696  hClctSign = fs->make<TH1F>("CLCT_sing_(L/R)", "CLCT sign (L/R)", 3, -0.5, 2.5);
697  hClctCFEB = fs->make<TH1F>("CLCT_cfeb_#", "CLCT cfeb #", 6, -0.5, 5.5);
698  hClctBXN = fs->make<TH1F>("CLCT_bx", "CLCT bx", 20, -0.5, 19.5);
699 
700  hClctKeyStrip[0] = fs->make<TH1F>("CLCT_keystrip_distrips", "CLCT keystrip, distrips", 40, -0.5, 39.5);
701  //hClctKeyStrip[0] = fs->make<TH1F>("","CLCT keystrip, distrips", 160, -0.5, 159.5);
702  hClctKeyStrip[1] = fs->make<TH1F>("CLCT_keystrip_halfstrips", "CLCT keystrip, halfstrips", 160, -0.5, 159.5);
703  hClctPattern[0] = fs->make<TH1F>("CLCT_pattern_distrips", "CLCT pattern, distrips", 13, -0.5, 12.5);
704  hClctPattern[1] = fs->make<TH1F>("CLCT_pattern_halfstrips", "CLCT pattern, halfstrips", 13, -0.5, 12.5);
705 
706  for (int i = 0; i < CSC_TYPES; i++) {
707  char asdf[256];
708  string s1 = "CLCT bend, " + csc_type[i];
709  sprintf(asdf, "CLCT_bend0_%i", i + 1);
710  hClctBendCsc[i][0] = fs->make<TH1F>(asdf, s1.c_str(), 5, -0.5, 4.5);
711  sprintf(asdf, "CLCT_bend1_%i", i + 1);
712  hClctBendCsc[i][1] = fs->make<TH1F>(asdf, s1.c_str(), 5, -0.5, 4.5);
713 
714  sprintf(asdf, "CLCT_keystrip_%i", i + 1);
715  string s2 = "CLCT keystrip, " + csc_type[i];
716  int max_ds = MAX_HS[i] / 4;
717  hClctKeyStripCsc[i] = fs->make<TH1F>(asdf, s2.c_str(), max_ds, 0., max_ds);
718  }
719 
720  hClctKeyStripME11 = fs->make<TH1F>("hClctKeyStripME11", "CLCT keystrip, halfstrips ME1/1", 161, -0.5, 160.5);
721 
722  bookedCLCTHistos = true;
723  std::cout << " bookedCLCTHistos " << std::endl;
724 }
725 
727  string s;
728 
730  hLctTMBPerEvent = fs->make<TH1F>("LCTs_per_event", "LCTs per event", 31, -0.5, 30.5);
731  hLctTMBPerChamber = fs->make<TH1F>("LCTs_per_chamber", "LCTs per chamber", 3, -0.5, 2.5);
732  hLctTMBPerCSC = fs->make<TH1F>("LCTs_per_CSCtype", "LCTs per CSC type", 10, -0.5, 9.5);
733  hCorrLctTMBPerCSC = fs->make<TH1F>("CorrLCTs_per_CSCtype", "Corr. LCTs per CSC type", 10, -0.5, 9.5);
734  hLctTMBEndcap = fs->make<TH1F>("LCTS_endcap", "Endcap", 4, -0.5, 3.5);
735  hLctTMBStation = fs->make<TH1F>("LCTS_station", "Station", 6, -0.5, 5.5);
736  hLctTMBSector = fs->make<TH1F>("LCTS_sector", "Sector", 8, -0.5, 7.5);
737  hLctTMBRing = fs->make<TH1F>("LCTS_ring", "Ring", 5, -0.5, 4.5);
738  for (int i = 0; i < MAX_ENDCAPS; i++) { // endcaps
739  for (int j = 0; j < CSC_TYPES; j++) { // station/ring
740  char asdf[256];
741  float csc_max = NCHAMBERS[j] + 0.5;
742  if (i == 0)
743  s = "LCTs, " + csc_type_plus[j];
744  else
745  s = "LCTs, " + csc_type_minus[j];
746  sprintf(asdf, "LCTs_%i", i * CSC_TYPES + j);
747  hLctTMBCsc[i][j] = fs->make<TH1F>(s.c_str(), s.c_str(), NCHAMBERS[j], 0.5, csc_max);
748  }
749  }
750 
751  hLctTMBValid = fs->make<TH1F>("LCT_validity", "LCT validity", 3, -0.5, 2.5);
752  hLctTMBQuality = fs->make<TH1F>("LCT_quality", "LCT quality", 17, -0.5, 16.5);
753  hLctTMBKeyGroup = fs->make<TH1F>("LCT_key_wiregroup", "LCT key wiregroup", 120, -0.5, 119.5);
754  hLctTMBKeyStrip = fs->make<TH1F>("LCT_key_strip", "LCT key strip", 160, -0.5, 159.5);
755  hLctTMBStripType = fs->make<TH1F>("LCT_strip_type", "LCT strip type", 3, -0.5, 2.5);
756  hLctTMBPattern = fs->make<TH1F>("LCT_pattern", "LCT pattern", 13, -0.5, 12.5);
757  hLctTMBBend = fs->make<TH1F>("LCT_bend", "LCT L/R bend", 3, -0.5, 2.5);
758  hLctTMBBXN = fs->make<TH1F>("LCT_bx", "LCT bx", 20, -0.5, 19.5);
759 
760  // LCT quantities per station
761  char histname[60];
762  for (int istat = 0; istat < MAX_STATIONS; istat++) {
763  sprintf(histname, "LCT_CSCId, station %d", istat + 1);
764  hLctTMBChamber[istat] = fs->make<TH1F>("", histname, 10, -0.5, 9.5);
765  }
766 
767  hLctTMBKeyGroupME11 = fs->make<TH1F>("hLctTMBKeyGroupME11", "LCT key wiregroup ME1/1", 50, -0.5, 49.5);
768  hLctTMBKeyStripME11 = fs->make<TH1F>("hLctTMBKeyStripME11", "LCT key strip ME1/1", 161, -0.5, 160.5);
769 
770  bookedLCTTMBHistos = true;
771  std::cout << " bookedLCTTMBHistos " << std::endl;
772 }
773 
775  // 1/1 1/2 1/3 2/1 2/2 3/1 3/2 4/1 4/2 -1/1 -1/2 -1/3 -2/1 -2/2 -3/1 -3/2 -4/1 -4/2
776  //ix= 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
777  int ix = 0;
778  if (id.station() != 1) {
779  ix = (id.station() - 2) * 2 + 3;
780  }
781  ix += id.ring() - 1;
782  if (id.endcap() == 2) {
783  ix += 9;
784  }
785  return ix;
786 }
787 
789  int ix = 1;
790  if (id.station() != 1) {
791  ix = (id.station() - 2) * 2 + 3 + 1;
792  }
793  ix += id.ring() - 1;
794  if (id.endcap() == 2) {
795  ix *= -1;
796  }
797  return ix;
798 }
799 
801  int st = id.station();
802  int ri = id.ring();
803  int ch = id.chamber();
804  int ec = id.endcap();
805  int kSerial = ch;
806  if (st == 1 && ri == 1)
807  kSerial = ch;
808  if (st == 1 && ri == 2)
809  kSerial = ch + 36;
810  if (st == 1 && ri == 3)
811  kSerial = ch + 72;
812  if (st == 1 && ri == 4)
813  kSerial = ch;
814  if (st == 2 && ri == 1)
815  kSerial = ch + 108;
816  if (st == 2 && ri == 2)
817  kSerial = ch + 126;
818  if (st == 3 && ri == 1)
819  kSerial = ch + 162;
820  if (st == 3 && ri == 2)
821  kSerial = ch + 180;
822  if (st == 4 && ri == 1)
823  kSerial = ch + 216;
824  if (st == 4 && ri == 2)
825  kSerial = ch + 234; // one day...
826  if (ec == 2)
827  kSerial = kSerial + 300;
828  return kSerial;
829 }
830 
833  hLctMPCPerEvent = fs->make<TH1F>("MPC_per_event", "LCTs per event", 31, -0.5, 30.5);
834  hLctMPCPerCSC = fs->make<TH1F>("MPC_per_CSCtype", "LCTs per CSC type", 10, -0.5, 9.5);
835  hCorrLctMPCPerCSC = fs->make<TH1F>("CorrMPC_per_CSCtype", "Corr. LCTs per CSC type", 10, -0.5, 9.5);
836  hLctMPCEndcap = fs->make<TH1F>("MPC_Endcap", "Endcap", 4, -0.5, 3.5);
837  hLctMPCStation = fs->make<TH1F>("MPC_Station", "Station", 6, -0.5, 5.5);
838  hLctMPCSector = fs->make<TH1F>("MPC_Sector", "Sector", 8, -0.5, 7.5);
839  hLctMPCRing = fs->make<TH1F>("MPC_Ring", "Ring", 5, -0.5, 4.5);
840 
841  hLctMPCValid = fs->make<TH1F>("MPC_validity", "LCT validity", 3, -0.5, 2.5);
842  hLctMPCQuality = fs->make<TH1F>("MPC_quality", "LCT quality", 17, -0.5, 16.5);
843  hLctMPCKeyGroup = fs->make<TH1F>("MPC_key_wiregroup", "LCT key wiregroup", 120, -0.5, 119.5);
844  hLctMPCKeyStrip = fs->make<TH1F>("MPC_key_strip", "LCT key strip", 160, -0.5, 159.5);
845  hLctMPCStripType = fs->make<TH1F>("MPC_strip_type", "LCT strip type", 3, -0.5, 2.5);
846  hLctMPCPattern = fs->make<TH1F>("MPC_pattern", "LCT pattern", 13, -0.5, 12.5);
847  hLctMPCBend = fs->make<TH1F>("MPC_bend", "LCT L/R bend", 3, -0.5, 2.5);
848  hLctMPCBXN = fs->make<TH1F>("MPC_bx", "LCT bx", 20, -0.5, 19.5);
849 
850  // LCT quantities per station
851  char histname[60];
852  for (int istat = 0; istat < MAX_STATIONS; istat++) {
853  sprintf(histname, "MPC_CSCId, station %d", istat + 1);
854  hLctMPCChamber[istat] = fs->make<TH1F>("", histname, 10, -0.5, 9.5);
855  }
856 
857  hLctMPCKeyGroupME11 = fs->make<TH1F>("hLctMPCKeyGroupME11", "MPC LCT key wiregroup ME1/1", 50, -0.5, 49.5);
858  hLctMPCKeyStripME11 = fs->make<TH1F>("hLctMPCKeyStripME11", "MPC LCT key strip ME1/1", 161, -0.5, 160.5);
859 
860  bookedLCTMPCHistos = true;
861  if (debug)
862  LogTrace("CSCTriggerPrimitivesReader") << "bookedLCTMPCHistos ";
863  std::cout << " bookedLCTMPCHistos " << std::endl;
864 }
865 
867  string s;
868 
870  // hAlctCompMatch;
871 
872  hAlctCompFound = fs->make<TH1F>("h_ALCT_found", "h_ALCT_found", 600, 0.5, 600.5);
873  hAlctCompFound2 = fs->make<TH2F>("h_ALCT_found2", "h_ALCT_found2", 19, -9.5, 9.5, 36, 0.5, 36.5);
874  hAlctCompFound2x = fs->make<TH2F>("h_ALCT_found2x", "h_ALCT_found2x", 19, -9.5, 9.5, 18, 0.5, 36.5);
875 
876  hAlctCompSameN = fs->make<TH1F>("h_ALCT_SameN", "h_ALCT_SameN", 600, 0.5, 600.5);
877  hAlctCompSameN2 = fs->make<TH2F>("h_ALCT_SameN2", "h_ALCT_SameN2", 19, -9.5, 9.5, 36, 0.5, 36.5);
878  hAlctCompSameN2x = fs->make<TH2F>("h_ALCT_SameN2x", "h_ALCT_SameN2x", 19, -9.5, 9.5, 18, 0.5, 36.5);
879 
880  hAlctCompMatch = fs->make<TH1F>("h_ALCT_match", "h_ALCT_match", 600, 0.5, 600.5);
881  hAlctCompMatch2 = fs->make<TH2F>("h_ALCT_match2", "h_ALCT_match2", 19, -9.5, 9.5, 36, 0.5, 36.5);
882  hAlctCompMatch2x = fs->make<TH2F>("h_ALCT_match2x", "h_ALCT_match2x", 19, -9.5, 9.5, 18, 0.5, 36.5);
883 
884  hAlctCompTotal = fs->make<TH1F>("h_ALCT_total", "h_ALCT_total", 600, 0.5, 600.5);
885  hAlctCompTotal2 = fs->make<TH2F>("h_ALCT_total2", "h_ALCT_total2", 19, -9.5, 9.5, 36, 0.5, 36.5);
886  hAlctCompTotal2x = fs->make<TH2F>("h_ALCT_total2x", "h_ALCT_total2x", 19, -9.5, 9.5, 18, 0.5, 36.5);
887 
888  hClctCompFound = fs->make<TH1F>("h_CLCT_found", "h_CLCT_found", 600, 0.5, 600.5);
889  hClctCompFound2 = fs->make<TH2F>("h_CLCT_found2", "h_CLCT_found2", 19, -9.5, 9.5, 36, 0.5, 36.5);
890  hClctCompFound2x = fs->make<TH2F>("h_CLCT_found2x", "h_CLCT_found2x", 19, -9.5, 9.5, 18, 0.5, 36.5);
891 
892  hClctCompSameN = fs->make<TH1F>("h_CLCT_SameN", "h_CLCT_SameN", 600, 0.5, 600.5);
893  hClctCompSameN2 = fs->make<TH2F>("h_CLCT_SameN2", "h_CLCT_SameN2", 19, -9.5, 9.5, 36, 0.5, 36.5);
894  hClctCompSameN2x = fs->make<TH2F>("h_CLCT_SameN2x", "h_CLCT_SameN2x", 19, -9.5, 9.5, 18, 0.5, 36.5);
895 
896  hClctCompMatch = fs->make<TH1F>("h_CLCT_match", "h_CLCT_match", 600, 0.5, 600.5);
897  hClctCompMatch2 = fs->make<TH2F>("h_CLCT_match2", "h_CLCT_match2", 19, -9.5, 9.5, 36, 0.5, 36.5);
898  hClctCompMatch2x = fs->make<TH2F>("h_CLCT_match2x", "h_CLCT_match2x", 19, -9.5, 9.5, 18, 0.5, 36.5);
899 
900  hClctCompTotal = fs->make<TH1F>("h_CLCT_total", "h_CLCT_total", 600, 0.5, 600.5);
901  hClctCompTotal2 = fs->make<TH2F>("h_CLCT_total2", "h_CLCT_total2", 19, -9.5, 9.5, 36, 0.5, 36.5);
902  hClctCompTotal2x = fs->make<TH2F>("h_CLCT_total2x", "h_CLCT_total2x", 19, -9.5, 9.5, 18, 0.5, 36.5);
903 
904  hLCTCompFound = fs->make<TH1F>("h_LCT_found", "h_LCT_found", 600, 0.5, 600.5);
905  hLCTCompFound2 = fs->make<TH2F>("h_LCT_found2", "h_LCT_found2", 19, -9.5, 9.5, 36, 0.5, 36.5);
906  hLCTCompFound2x = fs->make<TH2F>("h_LCT_found2x", "h_LCT_found2x", 19, -9.5, 9.5, 18, 0.5, 36.5);
907 
908  hLCTCompSameN = fs->make<TH1F>("h_LCT_SameN", "h_LCT_SameN", 600, 0.5, 600.5);
909  hLCTCompSameN2 = fs->make<TH2F>("h_LCT_SameN2", "h_LCT_SameN2", 19, -9.5, 9.5, 36, 0.5, 36.5);
910  hLCTCompSameN2x = fs->make<TH2F>("h_LCT_SameN2x", "h_LCT_SameN2x", 19, -9.5, 9.5, 18, 0.5, 36.5);
911 
912  hLCTCompMatch = fs->make<TH1F>("h_LCT_match", "h_LCT_match", 600, 0.5, 600.5);
913  hLCTCompMatch2 = fs->make<TH2F>("h_LCT_match2", "h_LCT_match2", 19, -9.5, 9.5, 36, 0.5, 36.5);
914  hLCTCompMatch2x = fs->make<TH2F>("h_LCT_match2x", "h_LCT_match2x", 19, -9.5, 9.5, 18, 0.5, 36.5);
915 
916  hLCTCompTotal = fs->make<TH1F>("h_LCT_total", "h_LCT_total", 600, 0.5, 600.5);
917  hLCTCompTotal2 = fs->make<TH2F>("h_LCT_total2", "h_LCT_total2", 19, -9.5, 9.5, 36, 0.5, 36.5);
918  hLCTCompTotal2x = fs->make<TH2F>("h_LCT_total2x", "h_LCT_total2x", 19, -9.5, 9.5, 18, 0.5, 36.5);
919 
920  //Chad's improved historgrams
921  hAlctCompFound2i = fs->make<TH2F>("h_ALCT_found2i", "h_ALCT_found2i", 18, 0, 18, 36, 0.5, 36.5);
922  hAlctCompSameN2i = fs->make<TH2F>("h_ALCT_SameN2i", "h_ALCT_SameN2i", 18, 0, 18, 36, 0.5, 36.5);
923  hAlctCompMatch2i = fs->make<TH2F>("h_ALCT_match2i", "h_ALCT_match2i", 18, 0, 18, 36, 0.5, 36.5);
924  hAlctCompTotal2i = fs->make<TH2F>("h_ALCT_total2i", "h_ALCT_total2i", 18, 0, 18, 36, 0.5, 36.5);
925  hClctCompFound2i = fs->make<TH2F>("h_CLCT_found2i", "h_CLCT_found2i", 18, 0, 18, 36, 0.5, 36.5);
926  hClctCompSameN2i = fs->make<TH2F>("h_CLCT_SameN2i", "h_CLCT_SameN2i", 18, 0, 18, 36, 0.5, 36.5);
927  hClctCompMatch2i = fs->make<TH2F>("h_CLCT_match2i", "h_CLCT_match2i", 18, 0, 18, 36, 0.5, 36.5);
928  hClctCompTotal2i = fs->make<TH2F>("h_CLCT_total2i", "h_CLCT_total2i", 18, 0, 18, 36, 0.5, 36.5);
929  hLCTCompFound2i = fs->make<TH2F>("h_LCT_found2i", "h_LCT_found2i", 18, 0, 18, 36, 0.5, 36.5);
930  hLCTCompSameN2i = fs->make<TH2F>("h_LCT_SameN2i", "h_LCT_SameN2i", 18, 0, 18, 36, 0.5, 36.5);
931  hLCTCompMatch2i = fs->make<TH2F>("h_LCT_match2i", "h_LCT_match2i", 18, 0, 18, 36, 0.5, 36.5);
932  hLCTCompTotal2i = fs->make<TH2F>("h_LCT_total2i", "h_LCT_total2i", 18, 0, 18, 36, 0.5, 36.5);
933 
934  // hAlctCompFound = fs->make<TH1F>("h_ALCT_found","h_ALCT_found",600,0.5,600.5);
935 
936  // ALCTs.
937  for (int i = 0; i < MAX_ENDCAPS; i++) { // endcaps
938  for (int j = 0; j < CSC_TYPES; j++) { // station/ring
939  char asdf[256];
940 
941  float csc_max = NCHAMBERS[j] + 0.5;
942  if (i == 0)
943  s = "Comp_ALCTs, " + csc_type_plus[j];
944  else
945  s = "Comp_ALCTs, " + csc_type_minus[j];
946  sprintf(asdf, "Comp_ALCTsFound_%i", i * CSC_TYPES + j);
947  hAlctCompFoundCsc[i][j] = fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
948  sprintf(asdf, "Comp_ALCTsSame_%i", i * CSC_TYPES + j);
949  hAlctCompSameNCsc[i][j] = fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
950  sprintf(asdf, "Comp_ALCTsTotal_%i", i * CSC_TYPES + j);
951  hAlctCompTotalCsc[i][j] = fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
952  sprintf(asdf, "Comp_ALCTsMatch_%i", i * CSC_TYPES + j);
953  hAlctCompMatchCsc[i][j] = fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
954  hAlctCompFoundCsc[i][j]->Sumw2();
955  hAlctCompSameNCsc[i][j]->Sumw2();
956  hAlctCompTotalCsc[i][j]->Sumw2();
957  hAlctCompMatchCsc[i][j]->Sumw2();
958  }
959  }
960 
961  // CLCTs.
962  for (int i = 0; i < MAX_ENDCAPS; i++) { // endcaps
963  for (int j = 0; j < CSC_TYPES; j++) { // station/ring
964  float csc_max = NCHAMBERS[j] + 0.5;
965  char asdf[256];
966  if (i == 0)
967  s = "Comp_CLCTs, " + csc_type_plus[j];
968  else
969  s = "Comp_CLCTs, " + csc_type_minus[j];
970  sprintf(asdf, "Comp_CLCTsFound_%i", i * CSC_TYPES + j);
971  hClctCompFoundCsc[i][j] = fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
972  sprintf(asdf, "Comp_CLCTsSame_%i", i * CSC_TYPES + j);
973  hClctCompSameNCsc[i][j] = fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
974  sprintf(asdf, "Comp_CLCTsTotal_%i", i * CSC_TYPES + j);
975  hClctCompTotalCsc[i][j] = fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
976  sprintf(asdf, "Comp_CLCTsMatch_%i", i * CSC_TYPES + j);
977  hClctCompMatchCsc[i][j] = fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
978  hClctCompFoundCsc[i][j]->Sumw2();
979  hClctCompSameNCsc[i][j]->Sumw2();
980  hClctCompTotalCsc[i][j]->Sumw2();
981  hClctCompMatchCsc[i][j]->Sumw2();
982  }
983  }
984 
985  // Correlated LCTs.
986  for (int i = 0; i < MAX_ENDCAPS; i++) { // endcaps
987  for (int j = 0; j < CSC_TYPES; j++) { // station/ring
988  float csc_max = NCHAMBERS[j] + 0.5;
989  char asdf[256];
990  if (i == 0)
991  s = "LCTs, " + csc_type_plus[j];
992  else
993  s = "LCTs, " + csc_type_minus[j];
994  sprintf(asdf, "LCTs_CompFound_%i", i * CSC_TYPES + j);
995  hLctCompFoundCsc[i][j] = fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
996  sprintf(asdf, "LCTs_CompSame_%i", i * CSC_TYPES + j);
997  hLctCompSameNCsc[i][j] = fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
998  sprintf(asdf, "LCTs_CompTotal_%i", i * CSC_TYPES + j);
999  hLctCompTotalCsc[i][j] = fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
1000  sprintf(asdf, "LCTs_CompMatch_%i", i * CSC_TYPES + j);
1001  hLctCompMatchCsc[i][j] = fs->make<TH1F>(asdf, s.c_str(), NCHAMBERS[j], 0.5, csc_max);
1002  hLctCompFoundCsc[i][j]->Sumw2();
1003  hLctCompSameNCsc[i][j]->Sumw2();
1004  hLctCompTotalCsc[i][j]->Sumw2();
1005  hLctCompMatchCsc[i][j]->Sumw2();
1006  }
1007  }
1008 
1009  bookedCompHistos = true;
1010  if (debug)
1011  LogTrace("CSCTriggerPrimitivesReader") << "bookedCompHistos ";
1012  std::cout << "bookCompHistos " << std::endl;
1013 }
1014 
1017 
1018  // Limits for resolution histograms
1019  const double EDMIN = -0.05; // eta min
1020  const double EDMAX = 0.05; // eta max
1021  const double PDMIN = -5.0; // phi min (mrad)
1022  const double PDMAX = 5.0; // phi max (mrad)
1023 
1024  hResolDeltaWG = fs->make<TH1F>("", "Delta key wiregroup", 10, -5., 5.);
1025 
1026  hResolDeltaHS = fs->make<TH1F>("", "Delta key halfstrip", 10, -5., 5.);
1027  hResolDeltaDS = fs->make<TH1F>("", "Delta key distrip", 10, -5., 5.);
1028 
1029  hResolDeltaEta = fs->make<TH1F>("", "#eta_rec-#eta_sim", 100, EDMIN, EDMAX);
1030  hResolDeltaPhi = fs->make<TH1F>("", "#phi_rec-#phi_sim (mrad)", 100, -10., 10.);
1031  hResolDeltaPhiHS = fs->make<TH1F>("", "#phi_rec-#phi_sim (mrad), halfstrips", 100, -10., 10.);
1032  hResolDeltaPhiDS = fs->make<TH1F>("", "#phi_rec-#phi_sim (mrad), distrips", 100, -10., 10.);
1033 
1034  hEtaRecVsSim = fs->make<TH2F>("", "#eta_rec vs #eta_sim", 64, 0.9, 2.5, 64, 0.9, 2.5);
1035  hPhiRecVsSim = fs->make<TH2F>("", "#phi_rec vs #phi_sim", 100, 0., TWOPI, 100, 0., TWOPI);
1036 
1037  // LCT quantities per station
1038  char histname[60];
1039  for (int i = 0; i < MAX_STATIONS; i++) {
1040  sprintf(histname, "ALCTs vs eta, station %d", i + 1);
1041  hAlctVsEta[i] = fs->make<TH1F>("", histname, 66, 0.875, 2.525);
1042 
1043  sprintf(histname, "CLCTs vs phi, station %d", i + 1);
1044  hClctVsPhi[i] = fs->make<TH1F>("", histname, 100, 0., TWOPI);
1045 
1046  sprintf(histname, "#LT#eta_rec-#eta_sim#GT, station %d", i + 1);
1047  hEtaDiffVsEta[i] = fs->make<TH1F>("", histname, 66, 0.875, 2.525);
1048 
1049  sprintf(histname, "#LT#phi_rec-#phi_sim#GT, station %d", i + 1);
1050  hPhiDiffVsPhi[i] = fs->make<TH1F>("", histname, 100, 0., TWOPI);
1051  }
1052 
1053  for (int i = 0; i < CSC_TYPES; i++) {
1054  string t0 = "#eta_rec-#eta_sim, " + csc_type[i];
1055  hEtaDiffCsc[i][0] = fs->make<TH1F>("", t0.c_str(), 100, EDMIN, EDMAX);
1056  string t1 = t0 + ", endcap1";
1057  hEtaDiffCsc[i][1] = fs->make<TH1F>("", t1.c_str(), 100, EDMIN, EDMAX);
1058  string t2 = t0 + ", endcap2";
1059  hEtaDiffCsc[i][2] = fs->make<TH1F>("", t2.c_str(), 100, EDMIN, EDMAX);
1060 
1061  string t4 = "#eta_rec-#eta_sim vs wiregroup, " + csc_type[i];
1062  hEtaDiffVsWireCsc[i] = fs->make<TH2F>("", t4.c_str(), MAX_WG[i], 0., MAX_WG[i], 100, EDMIN, EDMAX);
1063 
1064  string u0 = "#phi_rec-#phi_sim, " + csc_type[i];
1065  hPhiDiffCsc[i][0] = fs->make<TH1F>("", u0.c_str(), 100, PDMIN, PDMAX);
1066  string u1 = u0 + ", endcap1";
1067  hPhiDiffCsc[i][1] = fs->make<TH1F>("", u1.c_str(), 100, PDMIN, PDMAX);
1068  string u2 = u0 + ", endcap2";
1069  hPhiDiffCsc[i][2] = fs->make<TH1F>("", u2.c_str(), 100, PDMIN, PDMAX);
1070  hPhiDiffCsc[i][3] = fs->make<TH1F>("", u0.c_str(), 100, PDMIN, PDMAX);
1071  hPhiDiffCsc[i][4] = fs->make<TH1F>("", u0.c_str(), 100, PDMIN, PDMAX);
1072 
1073  int MAX_DS = MAX_HS[i] / 4;
1074  string u5 = "#phi_rec-#phi_sim (mrad) vs distrip, " + csc_type[i];
1075  hPhiDiffVsStripCsc[i][0] = fs->make<TH2F>("", u5.c_str(), MAX_DS, 0., MAX_DS, 100, PDMIN, PDMAX);
1076  string u6 = "#phi_rec-#phi_sim (mrad) vs halfstrip, " + csc_type[i];
1077  hPhiDiffVsStripCsc[i][1] = fs->make<TH2F>("", u6.c_str(), MAX_HS[i], 0., MAX_HS[i], 100, PDMIN, PDMAX);
1078 
1079  string u7 = "#phi(layer 1)-#phi(layer 6), mrad, " + csc_type[i];
1080  hTrueBendCsc[i] = fs->make<TH1F>("", u7.c_str(), 100, -10., 10.);
1081  }
1082 
1083  int max_patterns, phibend;
1084  max_patterns = CSCConstants::NUM_CLCT_PATTERNS;
1085  for (int i = 0; i < max_patterns; i++) {
1086  phibend = ptype_TMB07[i];
1087  sprintf(histname, "#phi_rec-#phi_sim, bend = %d", phibend);
1088  hPhiDiffPattern[i] = fs->make<TH1F>("", histname, 100, PDMIN, PDMAX);
1089  }
1090 
1091  bookedResolHistos = true;
1092  if (debug)
1093  LogTrace("CSCTriggerPrimitivesReader") << "bookedResolHistos ";
1094 }
1095 
1098 
1099  // Efficiencies per station.
1100  char histname[60];
1101  for (int i = 0; i < MAX_STATIONS; i++) {
1102  sprintf(histname, "SimHits vs eta, station %d", i + 1);
1103  hEfficHitsEta[i] = fs->make<TH1F>("", histname, 66, 0.875, 2.525);
1104 
1105  sprintf(histname, "ALCTs vs eta, station %d", i + 1);
1106  hEfficALCTEta[i] = fs->make<TH1F>("", histname, 66, 0.875, 2.525);
1107 
1108  sprintf(histname, "CLCTs vs eta, station %d", i + 1);
1109  hEfficCLCTEta[i] = fs->make<TH1F>("", histname, 66, 0.875, 2.525);
1110  }
1111 
1112  // Efficiencies per chamber type.
1113  for (int i = 0; i < CSC_TYPES; i++) {
1114  string t0 = "SimHits vs eta, " + csc_type[i];
1115  hEfficHitsEtaCsc[i] = fs->make<TH1F>("", t0.c_str(), 66, 0.875, 2.525);
1116  string t1 = "ALCTs vs eta, " + csc_type[i];
1117  hEfficALCTEtaCsc[i] = fs->make<TH1F>("", t1.c_str(), 66, 0.875, 2.525);
1118  string t2 = "CLCTs vs eta, " + csc_type[i];
1119  hEfficCLCTEtaCsc[i] = fs->make<TH1F>("", t1.c_str(), 66, 0.875, 2.525);
1120  }
1121 
1122  bookedEfficHistos = true;
1123  if (debug)
1124  LogTrace("CSCTriggerPrimitivesReader") << "bookedEfficHistos ";
1125  std::cout << " bookedEfficHistos " << std::endl;
1126 }
1127 
1129  // Book histos when called for the first time.
1130  if (!bookedALCTHistos)
1131  bookALCTHistos();
1132 
1133  int nValidALCTs = 0;
1134  for (auto detUnitIt = alcts->begin(); detUnitIt != alcts->end(); detUnitIt++) {
1135  int nValidALCTsPerCSC = 0;
1136  const CSCDetId& id = (*detUnitIt).first;
1138  continue;
1139  const auto& range = (*detUnitIt).second;
1140  for (auto digiIt = range.first; digiIt != range.second; digiIt++) {
1141  bool alct_valid = (*digiIt).isValid();
1142  hAlctValid->Fill(alct_valid);
1143  if (alct_valid) {
1144  hAlctQuality->Fill((*digiIt).getQuality());
1145  hAlctAccel->Fill((*digiIt).getAccelerator());
1146  hAlctCollis->Fill((*digiIt).getCollisionB());
1147  hAlctKeyGroup->Fill((*digiIt).getKeyWG());
1148  hAlctBXN->Fill((*digiIt).getBX());
1149 
1150  int csctype = getCSCType(id);
1151  hAlctPerCSC->Fill(csctype);
1152  hAlctCsc[id.endcap() - 1][csctype]->Fill(id.chamber());
1153 
1154  if (csctype == 0)
1155  hAlctKeyGroupME11->Fill((*digiIt).getKeyWG());
1156 
1157  nValidALCTs++;
1158  nValidALCTsPerCSC++;
1159 
1160  if (debug)
1161  LogTrace("CSCTriggerPrimitivesReader")
1162  << (*digiIt) << " found in ME" << ((id.endcap() == 1) ? "+" : "-") << id.station() << "/" << id.ring()
1163  << "/" << id.chamber() << " (sector " << id.triggerSector() << " trig id. " << id.triggerCscId() << ")";
1164  //cout << "raw id = " << id.rawId() << endl;
1165  }
1166  }
1167  hAlctPerChamber->Fill(nValidALCTsPerCSC);
1168  }
1169  hAlctPerEvent->Fill(nValidALCTs);
1170  if (debug)
1171  LogTrace("CSCTriggerPrimitivesReader") << nValidALCTs << " valid ALCTs found in this event";
1172  numALCT += nValidALCTs;
1173 }
1174 
1176  // Book histos when called for the first time.
1177  if (!bookedCLCTHistos)
1178  bookCLCTHistos();
1179 
1180  int nValidCLCTs = 0;
1181  for (auto detUnitIt = clcts->begin(); detUnitIt != clcts->end(); detUnitIt++) {
1182  int nValidCLCTsPerCSC = 0;
1183  const CSCDetId& id = (*detUnitIt).first;
1185  continue;
1186  const auto& range = (*detUnitIt).second;
1187  for (auto digiIt = range.first; digiIt != range.second; digiIt++) {
1188  bool clct_valid = (*digiIt).isValid();
1189  hClctValid->Fill(clct_valid);
1190  if (clct_valid) {
1191  int striptype = (*digiIt).getStripType();
1192  int keystrip = (*digiIt).getKeyStrip(); // halfstrip #
1193  if (striptype == 0)
1194  keystrip /= 4; // distrip # for distrip ptns
1195  hClctQuality->Fill((*digiIt).getQuality());
1196  hClctStripType->Fill(striptype);
1197  hClctSign->Fill((*digiIt).getBend());
1198  hClctCFEB->Fill((*digiIt).getCFEB());
1199  hClctBXN->Fill((*digiIt).getBX());
1200  hClctKeyStrip[striptype]->Fill(keystrip);
1201  hClctPattern[striptype]->Fill((*digiIt).getPattern());
1202 
1203  int csctype = getCSCType(id);
1204  hClctPerCSC->Fill(csctype);
1205  hClctCsc[id.endcap() - 1][csctype]->Fill(id.chamber());
1206 
1207  if (striptype == 1 && csctype == 0)
1208  hClctKeyStripME11->Fill(keystrip);
1209 
1210  int phibend;
1211  int pattern = (*digiIt).getPattern();
1212  phibend = ptype_TMB07[pattern];
1213  hClctBendCsc[csctype][striptype]->Fill(abs(phibend));
1214 
1215  if (striptype == 0) // distrips
1216  hClctKeyStripCsc[csctype]->Fill(keystrip);
1217 
1218  nValidCLCTs++;
1219  nValidCLCTsPerCSC++;
1220 
1221  if (debug)
1222  LogTrace("CSCTriggerPrimitivesReader")
1223  << (*digiIt) << " found in ME" << ((id.endcap() == 1) ? "+" : "-") << id.station() << "/" << id.ring()
1224  << "/" << id.chamber() << " (sector " << id.triggerSector() << " trig id. " << id.triggerCscId() << ")";
1225  }
1226  }
1227  hClctPerChamber->Fill(nValidCLCTsPerCSC);
1228  }
1229  hClctPerEvent->Fill(nValidCLCTs);
1230  if (debug)
1231  LogTrace("CSCTriggerPrimitivesReader") << nValidCLCTs << " valid CLCTs found in this event";
1232  numCLCT += nValidCLCTs;
1233 }
1234 
1236  // Book histos when called for the first time.
1237  if (!bookedLCTTMBHistos)
1238  bookLCTTMBHistos();
1239 
1240  int nValidLCTs = 0;
1241  bool alct_valid, clct_valid;
1242 
1243  for (auto detUnitIt = lcts->begin(); detUnitIt != lcts->end(); detUnitIt++) {
1244  int nValidLCTsPerCSC = 0;
1245  const CSCDetId& id = (*detUnitIt).first;
1247  continue;
1248  const auto& range = (*detUnitIt).second;
1249  for (auto digiIt = range.first; digiIt != range.second; digiIt++) {
1250  bool lct_valid = (*digiIt).isValid();
1251  hLctTMBValid->Fill(lct_valid);
1252  if (lct_valid) {
1253  hLctTMBEndcap->Fill(id.endcap());
1254  hLctTMBStation->Fill(id.station());
1255  hLctTMBSector->Fill(id.triggerSector());
1256  hLctTMBRing->Fill(id.ring());
1257  hLctTMBChamber[id.station() - 1]->Fill(id.triggerCscId());
1258 
1259  int quality = (*digiIt).getQuality();
1260  hLctTMBQuality->Fill(quality);
1261  hLctTMBBXN->Fill((*digiIt).getBX());
1262 
1263  alct_valid = (quality != 0 && quality != 2);
1264  if (alct_valid) {
1265  hLctTMBKeyGroup->Fill((*digiIt).getKeyWG());
1266  }
1267 
1268  clct_valid = (quality != 0 && quality != 1);
1269  if (clct_valid) {
1270  hLctTMBKeyStrip->Fill((*digiIt).getStrip());
1271  hLctTMBStripType->Fill(1.);
1272  hLctTMBPattern->Fill((*digiIt).getPattern());
1273  hLctTMBBend->Fill((*digiIt).getBend());
1274  }
1275 
1276  int csctype = getCSCType(id);
1277  hLctTMBPerCSC->Fill(csctype);
1278  hLctTMBCsc[id.endcap() - 1][csctype]->Fill(id.chamber());
1279  // Truly correlated LCTs; for DAQ
1280  if (alct_valid && clct_valid)
1281  hCorrLctTMBPerCSC->Fill(csctype);
1282 
1283  if (alct_valid && csctype == 0) {
1284  hLctTMBKeyGroupME11->Fill((*digiIt).getKeyWG());
1285  }
1286  if (clct_valid && csctype == 0) {
1287  hLctTMBKeyStripME11->Fill((*digiIt).getStrip());
1288  }
1289 
1290  nValidLCTs++;
1291  nValidLCTsPerCSC++;
1292 
1293  if (debug)
1294  LogTrace("CSCTriggerPrimitivesReader")
1295  << (*digiIt) << " found in ME" << ((id.endcap() == 1) ? "+" : "-") << id.station() << "/" << id.ring()
1296  << "/" << id.chamber() << " (sector " << id.triggerSector() << " trig id. " << id.triggerCscId() << ")";
1297  }
1298  }
1299  hLctTMBPerChamber->Fill(nValidLCTsPerCSC);
1300  }
1301  hLctTMBPerEvent->Fill(nValidLCTs);
1302  if (debug)
1303  LogTrace("CSCTriggerPrimitivesReader") << nValidLCTs << " valid LCTs found in this event";
1304  numLCTTMB += nValidLCTs;
1305 }
1306 
1308  // Book histos when called for the first time.
1309  if (!bookedLCTMPCHistos)
1310  bookLCTMPCHistos();
1311 
1312  int nValidLCTs = 0;
1313  bool alct_valid, clct_valid;
1314 
1315  for (auto detUnitIt = lcts->begin(); detUnitIt != lcts->end(); detUnitIt++) {
1316  const CSCDetId& id = (*detUnitIt).first;
1318  continue;
1319  const auto& range = (*detUnitIt).second;
1320  for (auto digiIt = range.first; digiIt != range.second; digiIt++) {
1321  bool lct_valid = (*digiIt).isValid();
1322  hLctMPCValid->Fill(lct_valid);
1323  if (lct_valid) {
1324  hLctMPCEndcap->Fill(id.endcap());
1325  hLctMPCStation->Fill(id.station());
1326  hLctMPCSector->Fill(id.triggerSector());
1327  hLctMPCRing->Fill(id.ring());
1328  hLctMPCChamber[id.station() - 1]->Fill(id.triggerCscId());
1329 
1330  int quality = (*digiIt).getQuality();
1331  hLctMPCQuality->Fill(quality);
1332  hLctMPCBXN->Fill((*digiIt).getBX());
1333 
1334  alct_valid = (quality != 0 && quality != 2);
1335  if (alct_valid) {
1336  hLctMPCKeyGroup->Fill((*digiIt).getKeyWG());
1337  }
1338 
1339  clct_valid = (quality != 0 && quality != 1);
1340  if (clct_valid) {
1341  hLctMPCKeyStrip->Fill((*digiIt).getStrip());
1342  hLctMPCStripType->Fill(1.);
1343  hLctMPCPattern->Fill((*digiIt).getPattern());
1344  hLctMPCBend->Fill((*digiIt).getBend());
1345  }
1346 
1347  int csctype = getCSCType(id);
1348  hLctMPCPerCSC->Fill(csctype);
1349  // Truly correlated LCTs; for DAQ
1350  if (alct_valid && clct_valid)
1351  hCorrLctMPCPerCSC->Fill(csctype);
1352 
1353  if (alct_valid && csctype == 0) {
1354  hLctMPCKeyGroupME11->Fill((*digiIt).getKeyWG());
1355  }
1356  if (clct_valid && csctype == 0) {
1357  hLctMPCKeyStripME11->Fill((*digiIt).getStrip());
1358  }
1359 
1360  nValidLCTs++;
1361 
1362  if (debug)
1363  LogTrace("CSCTriggerPrimitivesReader")
1364  << "MPC " << (*digiIt) << " found in ME" << ((id.endcap() == 1) ? "+" : "-") << id.station() << "/"
1365  << id.ring() << "/" << id.chamber() << " (sector " << id.triggerSector() << " trig id. "
1366  << id.triggerCscId() << ")";
1367  }
1368  }
1369  }
1370  hLctMPCPerEvent->Fill(nValidLCTs);
1371  if (debug)
1372  LogTrace("CSCTriggerPrimitivesReader") << nValidLCTs << " MPC LCTs found in this event";
1373  numLCTMPC += nValidLCTs;
1374 }
1375 
1377  const CSCALCTDigiCollection* alcts_emul,
1378  const CSCCLCTDigiCollection* clcts_data,
1379  const CSCCLCTDigiCollection* clcts_emul,
1380  const CSCCLCTPreTriggerDigiCollection* pretrigs_emul,
1381  const CSCCorrelatedLCTDigiCollection* lcts_data,
1382  const CSCCorrelatedLCTDigiCollection* lcts_emul) {
1383  // Book histos when called for the first time.
1384  if (!bookedCompHistos)
1385  bookCompHistos();
1386 
1387  // Comparisons
1388  compareALCTs(alcts_data, alcts_emul);
1389  compareCLCTs(clcts_data, clcts_emul, pretrigs_emul);
1390  compareLCTs(lcts_data, lcts_emul, alcts_data, clcts_data);
1391  //compareMPCLCTs(mpclcts_data, mpclcts_emul, alcts_data, clcts_data);
1392 }
1393 
1395  const CSCALCTDigiCollection* alcts_emul) {
1396  int emul_corr_bx;
1397 
1398  // Should be taken from config. parameters.
1399  int fifo_pretrig = 10;
1400  int fpga_latency = 6;
1401  int l1a_window_width = 7;
1402  // Time offset of raw hits w.r.t. the full 12-bit BXN.
1403  int rawhit_tbin_offset = (fifo_pretrig - fpga_latency) + (l1a_window_width - 1) / 2;
1404  // Extra difference due to additional register stages; determined
1405  // empirically.
1406  int register_delay = 2;
1407  // Loop over all chambers in search for ALCTs.
1408  std::vector<CSCALCTDigi>::const_iterator pd, pe;
1409  for (int endc = 1; endc <= 2; endc++) {
1410  for (int stat = 1; stat <= 4; stat++) {
1411  for (int ring = 1; ring <= maxRing(stat); ring++) {
1412  for (int cham = 1; cham <= 36; cham++) {
1413  // Calculate DetId. 0th layer means whole chamber.
1414  CSCDetId detid(endc, stat, ring, cham, 0);
1415 
1416  // Skip chambers marked as bad.
1418  continue;
1419  std::vector<CSCALCTDigi> alctV_data, alctV_emul;
1420  const auto& drange = alcts_data->get(detid);
1421  for (auto digiIt = drange.first; digiIt != drange.second; digiIt++) {
1422  if ((*digiIt).isValid()) {
1423  alctV_data.push_back(*digiIt);
1424  }
1425  }
1426 
1427  const auto& erange = alcts_emul->get(detid);
1428  std::vector<bool> bookedalctV_emul;
1429  for (auto digiIt = erange.first; digiIt != erange.second; digiIt++) {
1430  if ((*digiIt).isValid()) {
1431  alctV_emul.push_back(*digiIt);
1432  bookedalctV_emul.push_back(false);
1433  }
1434  }
1435 
1436  int ndata = alctV_data.size();
1437  int nemul = alctV_emul.size();
1438 
1439  if (ndata == 0 && nemul == 0)
1440  continue;
1441  bool firstfill = true;
1442 
1443  if (debug or (stat == 1 and ring == 1 and (ndata != nemul))) {
1444  ostringstream strstrm;
1445  strstrm << "\n--- ME" << ((detid.endcap() == 1) ? "+" : "-") << detid.station() << "/" << detid.ring()
1446  << "/" << detid.chamber() << " (sector " << detid.triggerSector() << " trig id. "
1447  << detid.triggerCscId() << "):\n";
1448  strstrm << " **** " << ndata << " valid data ALCTs found:\n";
1449  for (pd = alctV_data.begin(); pd != alctV_data.end(); pd++) {
1450  strstrm << " " << (*pd) << " Full BX = " << (*pd).getFullBX() << "\n";
1451  }
1452  strstrm << " **** " << nemul << " valid emul ALCTs found:\n";
1453  for (pe = alctV_emul.begin(); pe != alctV_emul.end(); pe++) {
1454  strstrm << " " << (*pe);
1455  for (pd = alctV_data.begin(); pd != alctV_data.end(); pd++) {
1456  if ((*pd).getTrknmb() == (*pe).getTrknmb()) {
1457  int emul_bx = (*pe).getBX();
1458  emul_corr_bx = emul_bx - rawhit_tbin_offset + register_delay;
1459  strstrm << " Corr BX = " << emul_corr_bx;
1460  break;
1461  }
1462  }
1463  strstrm << "\n";
1464  }
1465  LogTrace("CSCTriggerPrimitivesReader") << strstrm.str();
1466  //if (stat==1 && ring==1)
1467  // std::cout <<"ME11 CompareALCTs "<< strstrm.str()<< std::endl;
1468  }
1469 
1470  //Data, add HS quality later
1471  int perEv_nStub_data = 0;
1472  int perEv_nStub_emul = 0;
1473  perStub[0].init(RUN_, Event_);
1474  perStub[1].init(RUN_, Event_);
1475  for (pd = alctV_data.begin(); pd != alctV_data.end(); pd++) {
1476  perEv_nStub_data++;
1477  }
1478  perStub[0].t_endcap = endc;
1479  perStub[0].t_station = stat;
1480  perStub[0].t_chamber = cham;
1481  perStub[0].t_ring = ring;
1483  perStub[0].t_nStubs = ndata;
1484  perStub[0].t_nStubs_readout = ndata;
1485  event_tree[0]->Fill();
1486  //Emul
1487  for (pe = alctV_emul.begin(); pe != alctV_emul.end(); pe++) {
1488  perEv_nStub_emul++;
1489  }
1490  perStub[1].t_endcap = endc;
1491  perStub[1].t_station = stat;
1492  perStub[1].t_chamber = cham;
1493  perStub[1].t_ring = ring;
1495  perStub[1].t_nStubs = nemul;
1496  perStub[1].t_nStubs_readout = nemul;
1497  event_tree[1]->Fill();
1498 
1499  int csctype = getCSCType(detid);
1500  hAlctCompFoundCsc[endc - 1][csctype]->Fill(cham);
1501  int mychamber = chamberSerial(detid);
1502  hAlctCompFound->Fill(mychamber);
1503  int ix = chamberIX(detid);
1504  int ix2 = chamberIXi(detid);
1505  // printf("station %i, ring %i, chamber %i, ix+(detid.ring()-1) %i\n",
1506  // detid.station(),detid.ring(),detid.chamber(),ix);
1507  if (detid.station() > 1 && detid.ring() == 1) {
1508  hAlctCompFound2x->Fill(ix, detid.chamber() * 2);
1509  } else {
1510  hAlctCompFound2->Fill(ix, detid.chamber());
1511  }
1512  hAlctCompFound2i->Fill(ix2, detid.chamber());
1513 
1514  if (ndata != nemul) {
1515  LogTrace("CSCTriggerPrimitivesReader")
1516  << " +++ Different numbers of ALCTs found in ME" << ((endc == 1) ? "+" : "-") << stat << "/" << ring
1517  << "/" << cham << ": data = " << ndata << " emulator = " << nemul << " +++\n";
1518  } else {
1519  hAlctCompSameNCsc[endc - 1][csctype]->Fill(cham);
1520  if (detid.station() > 1 && detid.ring() == 1) {
1521  hAlctCompSameN2x->Fill(ix, detid.chamber() * 2);
1522  } else {
1523  hAlctCompSameN2->Fill(ix, detid.chamber());
1524  }
1525  hAlctCompSameN2i->Fill(ix2, detid.chamber());
1526  }
1527 
1528  for (int i = 0; i < ndata; i++) {
1529  if (alctV_data[i].isValid() == 0)
1530  continue;
1531  int data_trknmb = alctV_data[i].getTrknmb();
1532  //int data_quality = alctV_data[i].getQuality();
1533  //int data_accel = alctV_data[i].getAccelerator();
1534  //int data_collB = alctV_data[i].getCollisionB();
1535  int data_wiregroup = alctV_data[i].getKeyWG();
1536  int data_bx = alctV_data[i].getBX();
1537 
1539  stubs_comparison[0].firstfill = firstfill;
1540  if (firstfill)
1541  firstfill = false;
1543  stubs_comparison[0].endcap = endc;
1545  stubs_comparison[0].ring = ring;
1548  stubs_comparison[0].totStubs_data = ndata;
1549  stubs_comparison[0].totStubs_emul = nemul;
1551  stubs_comparison[0].nStub_data = i + 1;
1552  stubs_comparison[0].has_data = true;
1553  stubs_comparison[0].quality_data = alctV_data[i].getQuality();
1554  stubs_comparison[0].key_WG_data = alctV_data[i].getKeyWG();
1555  stubs_comparison[0].bx_data = data_bx;
1556  stubs_comparison[0].fullbx_data = alctV_data[i].getFullBX();
1557  stubs_comparison[0].trknmb_data = data_trknmb;
1558  GlobalPoint gp_alct_data(getGlobalPosition(detid.rawId(), data_wiregroup, 60));
1559  stubs_comparison[0].eta_data = gp_alct_data.eta();
1560  for (int j = 0; j < nemul; j++) {
1561  if (alctV_emul[j].isValid() == 0)
1562  continue;
1563  if (bookedalctV_emul[j])
1564  continue; //used alct
1565 
1566  int emul_trknmb = alctV_emul[j].getTrknmb();
1567  //int emul_quality = alctV_emul[j].getQuality();
1568  //int emul_accel = alctV_emul[j].getAccelerator();
1569  //int emul_collB = alctV_emul[j].getCollisionB();
1570  int emul_wiregroup = alctV_emul[j].getKeyWG();
1571  int emul_bx = alctV_emul[j].getBX();
1572  // Emulator BX re-calculated for comparison with BX in the data.
1573  emul_corr_bx = emul_bx - rawhit_tbin_offset + register_delay;
1574  if (dataIsAnotherMC_)
1575  emul_corr_bx = emul_bx;
1576 
1577  if (ndata == nemul) {
1578  hAlctCompTotal->Fill(mychamber);
1579  hAlctCompTotalCsc[endc - 1][csctype]->Fill(cham);
1580  if (detid.station() > 1 && detid.ring() == 1) {
1581  hAlctCompTotal2x->Fill(ix, detid.chamber() * 2);
1582  } else {
1583  hAlctCompTotal2->Fill(ix, detid.chamber());
1584  }
1585  hAlctCompTotal2i->Fill(ix2, detid.chamber());
1586  }
1587  if (data_trknmb == emul_trknmb) {
1588  if (abs(data_wiregroup - emul_wiregroup) <= 2) {
1589  hAlctCompMatchCsc[endc - 1][csctype]->Fill(cham);
1590  hAlctCompMatch->Fill(mychamber);
1591  if (detid.station() > 1 && detid.ring() == 1) {
1592  hAlctCompMatch2x->Fill(ix, detid.chamber() * 2);
1593  } else {
1594  hAlctCompMatch2->Fill(ix, detid.chamber());
1595  }
1596  hAlctCompMatch2i->Fill(ix2, detid.chamber());
1597  }
1598  if (debug)
1599  LogTrace("CSCTriggerPrimitivesReader") << " Identical ALCTs #" << data_trknmb;
1600  stubs_comparison[0].nStub_emul = j + 1;
1601  stubs_comparison[0].has_emul = true;
1602  stubs_comparison[0].quality_emul = alctV_emul[j].getQuality();
1603  stubs_comparison[0].key_WG_emul = alctV_emul[j].getKeyWG();
1604  stubs_comparison[0].bx_emul = alctV_emul[j].getBX();
1605  stubs_comparison[0].trknmb_emul = emul_trknmb;
1606  GlobalPoint gp_alct_emul(getGlobalPosition(detid.rawId(), emul_wiregroup, 60));
1607  stubs_comparison[0].eta_emul = gp_alct_emul.eta();
1608  stubs_comparison[0].bx_corr_emul = emul_corr_bx;
1609  bookedalctV_emul[j] = true;
1610  break;
1611  } else {
1612  LogTrace("CSCTriggerPrimitivesReader")
1613  << " Different ALCTs #" << data_trknmb << " in ME" << ((endc == 1) ? "+" : "-") << stat << "/"
1614  << ring << "/" << cham;
1615  }
1616 
1617  } //loop emul
1618  if (debug and stubs_comparison[0].key_WG_data != stubs_comparison[0].key_WG_emul)
1619  LogTrace("CSCTriggerPrimitivesReader")
1620  << " not matched ALCT from data " << alctV_data[i] << " stubs_comparison 0 key_WG_data "
1621  << stubs_comparison[0].key_WG_data << " key_WG_emul " << stubs_comparison[0].key_WG_emul;
1622  //if (stat==1) std::cout <<" stub_tree filled , ring "<< stubs_comparison[0].ring << std::endl;
1623  //cout <<"ALCT data BX "<< stubs_comparison[0].bx_data <<" WG "<< stubs_comparison[0].key_WG_data <<" emul BX "<< stubs_comparison[0].bx_emul<<" emul BX corrected "<< stubs_comparison[0].bx_corr_emul <<" WG "<< stubs_comparison[0].key_WG_emul << endl;
1624  stub_tree[0]->Fill();
1625  } //loop data
1626  for (int i = 0; i < nemul; i++) {
1627  if (alctV_emul[i].isValid() == 0 or bookedalctV_emul[i])
1628  continue;
1629  int emul_bx = alctV_emul[i].getBX();
1631  stubs_comparison[0].firstfill = firstfill;
1632  if (firstfill)
1633  firstfill = false;
1635  stubs_comparison[0].endcap = endc;
1637  stubs_comparison[0].ring = ring;
1640  stubs_comparison[0].totStubs_data = ndata;
1641  stubs_comparison[0].totStubs_emul = nemul;
1643  stubs_comparison[0].nStub_data = -1;
1644  stubs_comparison[0].nStub_emul = i + 1;
1645  stubs_comparison[0].has_data = false;
1646  stubs_comparison[0].has_emul = true;
1647  stubs_comparison[0].trknmb_emul = alctV_emul[i].getTrknmb();
1648  stubs_comparison[0].quality_emul = alctV_emul[i].getQuality();
1649  stubs_comparison[0].key_WG_emul = alctV_emul[i].getKeyWG();
1650  stubs_comparison[0].bx_emul = alctV_emul[i].getBX();
1651  stubs_comparison[0].fullbx_emul = alctV_emul[i].getFullBX();
1652  GlobalPoint gp_alct_emul(getGlobalPosition(detid.rawId(), alctV_emul[i].getKeyWG(), 60));
1653  stubs_comparison[0].eta_emul = gp_alct_emul.eta();
1654  // Emulator BX re-calculated for comparison with BX in the data.
1655  emul_corr_bx = emul_bx - rawhit_tbin_offset + register_delay;
1656  if (dataIsAnotherMC_)
1657  emul_corr_bx = emul_bx;
1658  stubs_comparison[0].bx_corr_emul = emul_corr_bx;
1659  stub_tree[0]->Fill();
1660  if (debug)
1661  LogTrace("CSCTriggerPrimitivesReader") << "not matched ALCT from emulation " << alctV_emul[i];
1662 
1663  } //loop emul
1664  }
1665  }
1666  }
1667  }
1668 } // compare ALCT
1669 
1671  const CSCCLCTDigiCollection* clcts_emul,
1672  const CSCCLCTPreTriggerDigiCollection* pretrigs_emul) {
1673  // Number of Tbins before pre-trigger for raw cathode hits.
1674  const int tbin_cathode_offset = 7;
1675  //const int tbin_cathode_offset = 8;//in MC, it became 8, Tao
1676  const int pretrig_trig_zone = 5; // max distance between CLCT key hs and pretrigger hs
1677 
1678  // Loop over all chambers in search for CLCTs.
1679  std::vector<CSCCLCTDigi>::const_iterator pd, pe;
1680  std::vector<CSCCLCTPreTriggerDigi>::const_iterator pretrig;
1681  perStub[2].init(RUN_, Event_);
1682  perStub[3].init(RUN_, Event_);
1683  for (int endc = 1; endc <= 2; endc++) {
1684  for (int stat = 1; stat <= 4; stat++) {
1685  for (int ring = 1; ring <= maxRing(stat); ring++) {
1686  for (int cham = 1; cham <= 36; cham++) {
1687  // Calculate DetId. 0th layer means whole chamber.
1688  CSCDetId detid(endc, stat, ring, cham, 0);
1689 
1690  // Skip chambers marked as bad.
1692  continue;
1693 
1694  std::vector<CSCCLCTDigi> clctV_data, clctV_emul;
1695  const auto& drange = clcts_data->get(detid);
1696  for (auto digiIt = drange.first; digiIt != drange.second; digiIt++) {
1697  if ((*digiIt).isValid()) {
1698  clctV_data.push_back(*digiIt);
1699  }
1700  }
1701 
1702  const auto& erange = clcts_emul->get(detid);
1703  std::vector<bool> bookedclctV_emul;
1704  for (auto digiIt = erange.first; digiIt != erange.second; digiIt++) {
1705  if ((*digiIt).isValid()) {
1706  for (auto pclct : clctV_emul) {
1707  if (digiIt->getBX() != pclct.getBX() and abs(digiIt->getBX() - pclct.getBX()) < 5)
1708  LogTrace("CSCTriggerPrimitivesReader")
1709  << "Two CLCTs very close in timing!!! Special event: first clct " << pclct << " second clct "
1710  << *digiIt << std::endl;
1711  }
1712  clctV_emul.push_back(*digiIt);
1713  bookedclctV_emul.push_back(false);
1714  }
1715  }
1716 
1717  std::vector<CSCCLCTPreTriggerDigi> pretrigV_emul;
1718  const auto& pretrigrange = pretrigs_emul->get(detid);
1719  for (auto pretrigIt = pretrigrange.first; pretrigIt != pretrigrange.second; pretrigIt++) {
1720  if ((*pretrigIt).isValid()) {
1721  pretrigV_emul.push_back(*pretrigIt);
1722  }
1723  }
1724 
1725  int ndata = clctV_data.size();
1726  int nemul = clctV_emul.size();
1727  if (ndata == 0 && nemul == 0)
1728  continue;
1729  bool firstfill = true;
1730  int nemul_readout = 0;
1731  for (pe = clctV_emul.begin(); pe != clctV_emul.end(); pe++) {
1732  for (pd = clctV_data.begin(); pd != clctV_data.end(); pd++) {
1733  int emul_bx = (*pe).getBX();
1734  int corr_bx = ((*pd).getFullBX() + emul_bx - tbin_cathode_offset) & 0x03;
1735  int bx_data = pd->getBX();
1736  //if (corr_bx == bx_data or abs(pe->getKeyStrip() - pd->getKeyStrip())<=1){//if emulated BX after correction is same as data bx, it will be readout
1737  if (corr_bx == bx_data) { //if emulated BX after correction is same as data bx, it will be readout
1738  nemul_readout++;
1739  break;
1740  }
1741  }
1742  }
1743 
1744  if (debug or nemul > ndata or (ndata != nemul) or ndata != nemul_readout) {
1745  LogTrace("CSCTriggerPrimitivesReader")
1746  << " CLCTs from data " << ndata << " CLCTs from emul " << nemul << " readout " << nemul_readout;
1747  ostringstream strstrm;
1748  strstrm << "\n--- ME" << ((detid.endcap() == 1) ? "+" : "-") << detid.station() << "/" << detid.ring()
1749  << "/" << detid.chamber() << " (sector " << detid.triggerSector() << " trig id. "
1750  << detid.triggerCscId() << "):\n";
1751  strstrm << " **** " << ndata << " valid data CLCTs found:\n";
1752  for (pd = clctV_data.begin(); pd != clctV_data.end(); pd++) {
1753  strstrm << " " << (*pd) << " Full BX = " << (*pd).getFullBX() << "\n";
1754  }
1755  strstrm << " **** " << nemul << " valid emul CLCTs found:\n";
1756  for (pe = clctV_emul.begin(); pe != clctV_emul.end(); pe++) {
1757  strstrm << " " << (*pe);
1758  for (pd = clctV_data.begin(); pd != clctV_data.end(); pd++) {
1759  if ((*pd).getTrknmb() == (*pe).getTrknmb() or abs((*pe).getKeyStrip() - (*pd).getKeyStrip()) < 5) {
1760  int emul_bx = (*pe).getBX();
1761  int corr_bx = ((*pd).getFullBX() + emul_bx - tbin_cathode_offset) & 0x03;
1762  strstrm << " Corr BX = " << corr_bx;
1763  break;
1764  }
1765  }
1766  strstrm << "\n";
1767  }
1768  LogTrace("CSCTriggerPrimitivesReader") << strstrm.str();
1769  }
1770  if (nemul_readout > 2) { //reduce nemul_readout to 2 by hand
1771  //cout <<"CLCT matching nemul readout is "<< nemul_readout <<", larger than 2. reduce it to 2 by hand"<<endl;
1772  nemul_readout = 2;
1773  }
1774 
1775  //Per event Fill, From Luca
1776  //Data, add HS quality later
1777  int perEv_nStub_data = 0;
1778  int perEv_nStub_emul = 0;
1779  perStub[2].init(RUN_, Event_);
1780  perStub[3].init(RUN_, Event_);
1781  for (pd = clctV_data.begin(); pd != clctV_data.end(); pd++) {
1782  perEv_nStub_data++;
1783  }
1784  perStub[2].t_endcap = endc;
1785  perStub[2].t_station = stat;
1786  perStub[2].t_chamber = cham;
1787  perStub[2].t_ring = ring;
1789  perStub[2].t_nStubs = ndata;
1790  perStub[2].t_nStubs_readout = ndata;
1791  event_tree[2]->Fill();
1792  //Emul
1793  for (pe = clctV_emul.begin(); pe != clctV_emul.end(); pe++) {
1794  perEv_nStub_emul++;
1795  }
1796  perStub[3].t_endcap = endc;
1797  perStub[3].t_station = stat;
1798  perStub[3].t_chamber = cham;
1799  perStub[3].t_ring = ring;
1801  perStub[3].t_nStubs = nemul;
1802  perStub[3].t_nStubs_readout = nemul_readout;
1803  event_tree[3]->Fill();
1804 
1805  int csctype = getCSCType(detid);
1806  hClctCompFoundCsc[endc - 1][csctype]->Fill(cham);
1807  int ix = chamberIX(detid);
1808  int ix2 = chamberIXi(detid);
1809  if (detid.station() > 1 && detid.ring() == 1) {
1810  hClctCompFound2x->Fill(ix, detid.chamber() * 2);
1811  } else {
1812  hClctCompFound2->Fill(ix, detid.chamber());
1813  }
1814  hClctCompFound2i->Fill(ix2, detid.chamber());
1815  if (ndata != nemul) {
1816  LogTrace("CSCTriggerPrimitivesReader")
1817  //cerr
1818  << " +++ Different numbers of CLCTs found in ME" << ((endc == 1) ? "+" : "-") << stat << "/" << ring
1819  << "/" << cham << ": data = " << ndata << " emulator = " << nemul << " +++\n";
1820  } else {
1821  hClctCompSameNCsc[endc - 1][csctype]->Fill(cham);
1822  if (detid.station() > 1 && detid.ring() == 1) {
1823  hClctCompSameN2x->Fill(ix, detid.chamber() * 2);
1824  } else {
1825  hClctCompSameN2->Fill(ix, detid.chamber());
1826  }
1827  hClctCompSameN2i->Fill(ix2, detid.chamber());
1828  }
1829  int i = -1;
1830  int testwg = 20;
1831  for (pd = clctV_data.begin(); pd != clctV_data.end(); pd++) {
1832  i++;
1833  if ((*pd).isValid() == 0)
1834  continue;
1835  int data_trknmb = (*pd).getTrknmb();
1836  int data_quality = (*pd).getQuality();
1837  int data_pattern = (*pd).getPattern();
1838  int data_striptype = (*pd).getStripType();
1839  int data_bend = (*pd).getBend();
1840  int data_keystrip = (*pd).getKeyStrip();
1841  int data_cfeb = (*pd).getCFEB();
1842  int data_bx = (*pd).getBX();
1843  int fullBX = (*pd).getFullBX(); // 12-bit full BX
1844 
1845  if (data_keystrip >= 128 and stat == 1 and ring == 1)
1846  testwg = 5;
1847  else
1848  testwg = 20;
1849 
1851  stubs_comparison[1].firstfill = firstfill;
1852  if (firstfill)
1853  firstfill = false;
1855  stubs_comparison[1].endcap = endc;
1857  stubs_comparison[1].ring = ring;
1860  stubs_comparison[1].totStubs_data = ndata;
1861  stubs_comparison[1].totStubs_emul = nemul;
1862  stubs_comparison[1].totStubs_emul_readout = nemul_readout;
1863  stubs_comparison[1].nStub_data = i + 1;
1864  stubs_comparison[1].has_data = true;
1865  stubs_comparison[1].quality_data = (*pd).getQuality();
1866  stubs_comparison[1].key_hs_data = (*pd).getKeyStrip();
1867  stubs_comparison[1].bend_data = (*pd).getBend();
1868  stubs_comparison[1].pattern_data = (*pd).getPattern();
1869  stubs_comparison[1].bx_data = (*pd).getBX();
1870  stubs_comparison[1].fullbx_data = (*pd).getFullBX();
1871  stubs_comparison[1].trknmb_data = data_trknmb;
1872  GlobalPoint gp_clct_data(getGlobalPosition(detid.rawId(), testwg, (*pd).getKeyStrip()));
1873  stubs_comparison[1].phi_data = gp_clct_data.phi();
1874 
1875  int j = -1;
1876  for (pe = clctV_emul.begin(); pe != clctV_emul.end(); pe++) {
1877  j++;
1878  if ((*pe).isValid() == 0)
1879  continue;
1880  if (bookedclctV_emul[j])
1881  continue; //used alct
1882  int emul_trknmb = (*pe).getTrknmb();
1883  int emul_quality = (*pe).getQuality();
1884  int emul_pattern = (*pe).getPattern();
1885  int emul_striptype = (*pe).getStripType();
1886  int emul_bend = (*pe).getBend();
1887  int emul_keystrip = (*pe).getKeyStrip();
1888  int emul_cfeb = (*pe).getCFEB();
1889  int emul_bx = (*pe).getBX();
1890 
1891  if (abs(data_keystrip - emul_keystrip) <= 2) {
1892  // Emulator BX re-calculated using 12-bit full BX number.
1893  // Used for comparison with BX in the data.
1894  int emul_corr_bx = (fullBX + emul_bx - tbin_cathode_offset) & 0x03;
1895  //std::cout <<"CLCT data_bx "<< data_bx <<" emul_corr_bx "<< emul_corr_bx << std::endl;
1896  if (dataIsAnotherMC_)
1897  emul_corr_bx = (emul_bx & 0x03);
1898  if (ndata == nemul) {
1899  hClctCompTotalCsc[endc - 1][csctype]->Fill(cham);
1900  if (detid.station() > 1 && detid.ring() == 1) {
1901  hClctCompTotal2x->Fill(ix, detid.chamber() * 2);
1902  } else {
1903  hClctCompTotal2->Fill(ix, detid.chamber());
1904  }
1905  hClctCompTotal2i->Fill(ix2, detid.chamber());
1906  }
1907  if (data_quality == emul_quality && data_pattern == emul_pattern && data_striptype == emul_striptype &&
1908  data_bend == emul_bend && data_keystrip == emul_keystrip && data_cfeb == emul_cfeb) {
1909  if (ndata == nemul) {
1910  hClctCompMatchCsc[endc - 1][csctype]->Fill(cham);
1911  if (detid.station() > 1 && detid.ring() == 1) {
1912  hClctCompMatch2x->Fill(ix, detid.chamber() * 2);
1913  } else {
1914  hClctCompMatch2->Fill(ix, detid.chamber());
1915  }
1916  hClctCompMatch2i->Fill(ix2, detid.chamber());
1917  }
1918  if (debug)
1919  LogTrace("CSCTriggerPrimitivesReader") << " Identical CLCTs #" << data_trknmb;
1920  } else {
1921  LogTrace("CSCTriggerPrimitivesReader")
1922  << " Different CLCTs #" << data_trknmb << " in ME" << ((endc == 1) ? "+" : "-") << stat
1923  << "/" << ring << "/" << cham << " data_bx " << data_bx << " emul_corr_bx " << emul_corr_bx;
1924  }
1925  stubs_comparison[1].nStub_emul = j + 1;
1926  stubs_comparison[1].has_emul = true;
1927  stubs_comparison[1].quality_emul = (*pe).getQuality();
1928  stubs_comparison[1].key_hs_emul = (*pe).getKeyStrip();
1929  stubs_comparison[1].bend_emul = (*pe).getBend();
1930  stubs_comparison[1].pattern_emul = (*pe).getPattern();
1931  stubs_comparison[1].bx_emul = (*pe).getBX();
1932  stubs_comparison[1].bx_corr_emul = emul_corr_bx;
1933  stubs_comparison[1].trknmb_emul = emul_trknmb;
1934  GlobalPoint gp_clct_emul(getGlobalPosition(detid.rawId(), testwg, (*pe).getKeyStrip()));
1935  stubs_comparison[1].phi_emul = gp_clct_emul.phi();
1936  bookedclctV_emul[j] = true;
1937 
1938  //int mingap_trig_pretrig = pretrig_trig_zone*2;
1939  int num_pretrig = 0;
1940  for (pretrig = pretrigV_emul.begin(); pretrig != pretrigV_emul.end(); pretrig++) {
1941  if ((*pretrig).getBX() != (*pe).getBX())
1942  continue;
1943  int hsgap = std::abs((*pretrig).getKeyStrip() - (*pe).getKeyStrip());
1944  bool samechamber = true;
1945  if (stat == 1 and ring == 1)
1946  samechamber = (((*pretrig).getKeyStrip() < 128 and (*pe).getKeyStrip() < 128) ||
1947  ((*pretrig).getKeyStrip() >= 128 and (*pe).getKeyStrip() >= 128));
1948  if (not samechamber)
1949  continue;
1950 
1951  if (hsgap <= pretrig_trig_zone)
1952  num_pretrig++;
1953  else
1954  continue;
1955  if ((*pretrig).getPattern() > stubs_comparison[1].maxpattern_pretrig)
1956  stubs_comparison[1].maxpattern_pretrig = (*pretrig).getPattern();
1957  if ((*pretrig).getQuality() > stubs_comparison[1].maxquality_pretrig) {
1958  stubs_comparison[1].quality_pretrig = (*pretrig).getQuality();
1959  stubs_comparison[1].key_hs_pretrig = (*pretrig).getKeyStrip();
1960  stubs_comparison[1].bend_pretrig = (*pretrig).getBend();
1961  stubs_comparison[1].pattern_pretrig = (*pretrig).getPattern();
1962  stubs_comparison[1].bx_pretrig = (*pretrig).getBX();
1963  }
1964  }
1965  stubs_comparison[1].npretrig = num_pretrig;
1966  break;
1967  } //if (data_trknmb == emul_trknmb)
1968  } //loop emul
1969  if (debug and stubs_comparison[1].key_hs_data != stubs_comparison[1].key_hs_emul)
1970  LogTrace("CSCTriggerPrimitivesReader")
1971  << "CSCDetid " << detid << " not matched CLCT from data " << (*pd)
1972  << " stubs_comparison 1 key_hs_data " << stubs_comparison[1].key_hs_data << " key_hs_emul "
1973  << stubs_comparison[1].key_hs_emul << endl;
1974  //cout <<"CLCT data BX "<< stubs_comparison[1].bx_data <<" emul BX "<< stubs_comparison[1].bx_emul<<" emul BX corrected "<< stubs_comparison[1].bx_corr_emul << endl;
1975  stub_tree[1]->Fill();
1976  } //loop data
1977  for (int k = 0; k < nemul; k++) {
1978  if (clctV_emul[i].isValid() == 0)
1979  continue;
1980  if (bookedclctV_emul[k])
1981  continue;
1983  stubs_comparison[1].firstfill = firstfill;
1984  if (firstfill)
1985  firstfill = false;
1987  stubs_comparison[1].endcap = endc;
1989  stubs_comparison[1].ring = ring;
1992  stubs_comparison[1].totStubs_data = ndata;
1993  stubs_comparison[1].totStubs_emul = nemul;
1994  stubs_comparison[1].totStubs_emul_readout = nemul_readout;
1995  stubs_comparison[1].trknmb_emul = clctV_emul[i].getTrknmb();
1996  stubs_comparison[1].nStub_data = -1;
1997  stubs_comparison[1].has_data = false;
1998  stubs_comparison[1].nStub_emul = k + 1;
1999  stubs_comparison[1].has_emul = true;
2000  stubs_comparison[1].quality_emul = clctV_emul[k].getQuality();
2001  stubs_comparison[1].key_hs_emul = clctV_emul[k].getKeyStrip();
2002  stubs_comparison[1].bend_emul = clctV_emul[k].getBend();
2003  stubs_comparison[1].pattern_emul = clctV_emul[k].getPattern();
2004  stubs_comparison[1].bx_emul = clctV_emul[k].getBX();
2005  stubs_comparison[1].fullbx_emul = clctV_emul[k].getFullBX();
2006  if (clctV_emul[k].getKeyStrip() >= 128 and stat == 1 and ring == 1)
2007  testwg = 5;
2008  else
2009  testwg = 20;
2010  // Emulator BX NOT Known from the data.
2011  GlobalPoint gp_clct_emul(getGlobalPosition(detid.rawId(), testwg, clctV_emul[k].getKeyStrip()));
2012  stubs_comparison[1].phi_emul = gp_clct_emul.phi();
2013  bookedclctV_emul[k] = true;
2014  stub_tree[1]->Fill();
2015  }
2016  }
2017  }
2018  }
2019  } // for all chambers
2020 } // compareCLCTs
2021 
2023  const CSCCorrelatedLCTDigiCollection* lcts_emul,
2024  const CSCALCTDigiCollection* alcts_data,
2025  const CSCCLCTDigiCollection* clcts_data) {
2026  // Need ALCT and CLCT digi collections to convert emulator bx into
2027  // hardware bx.
2028  // Loop over all chambers in search for correlated LCTs.
2029  std::vector<CSCCorrelatedLCTDigi>::const_iterator pd, pe;
2030  for (int endc = 1; endc <= 2; endc++) {
2031  for (int stat = 1; stat <= 4; stat++) {
2032  for (int ring = 1; ring <= maxRing(stat); ring++) {
2033  for (int cham = 1; cham <= 36; cham++) {
2034  // Calculate DetId. 0th layer means whole chamber.
2035  CSCDetId detid(endc, stat, ring, cham, 0);
2036 
2037  // Skip chambers marked as bad.
2039  continue;
2040 
2041  std::vector<CSCCorrelatedLCTDigi> lctV_data, lctV_emul;
2042  std::vector<bool> bookedlctV_emul;
2043  const auto& drange = lcts_data->get(detid);
2044  for (auto digiIt = drange.first; digiIt != drange.second; digiIt++) {
2045  if ((*digiIt).isValid()) {
2046  lctV_data.push_back(*digiIt);
2047  }
2048  }
2049 
2050  const auto& erange = lcts_emul->get(detid);
2051  for (auto digiIt = erange.first; digiIt != erange.second; digiIt++) {
2052  if ((*digiIt).isValid()) {
2053  lctV_emul.push_back(*digiIt);
2054  bookedlctV_emul.push_back(false);
2055  }
2056  }
2057 
2058  int ndata = lctV_data.size();
2059  int nemul = lctV_emul.size();
2060  if (ndata == 0 && nemul == 0)
2061  continue;
2062  bool firstfill = true;
2063  int nemul_readout = 0;
2064  for (pe = lctV_emul.begin(); pe != lctV_emul.end(); pe++) {
2065  for (pd = lctV_data.begin(); pd != lctV_data.end(); pd++) {
2066  int bx_data = pd->getBX();
2067  int bx_corr = convertBXofLCT((*pe).getBX(), detid, alcts_data, clcts_data);
2068  if ((bx_data == bx_corr) or (abs(pe->getKeyWG() - pd->getKeyWG()) <= 2)) {
2069  nemul_readout++;
2070  break;
2071  }
2072  }
2073  }
2074 
2075  if (debug or nemul > ndata or (nemul_readout != ndata) or nemul != ndata) {
2076  LogTrace("CSCTriggerPrimitivesReader")
2077  << " LCTs from data " << ndata << " LCTs from emul " << nemul << " readout " << nemul_readout;
2078  ostringstream strstrm;
2079  strstrm << "\n--- ME" << ((detid.endcap() == 1) ? "+" : "-") << detid.station() << "/" << detid.ring()
2080  << "/" << detid.chamber() << " (sector " << detid.triggerSector() << " trig id. "
2081  << detid.triggerCscId() << "):\n";
2082  strstrm << " **** " << ndata << " valid data LCTs found:\n";
2083  for (pd = lctV_data.begin(); pd != lctV_data.end(); pd++) {
2084  strstrm << " " << (*pd);
2085  }
2086  strstrm << "\n **** " << nemul << " valid emul LCTs found:\n";
2087  for (pe = lctV_emul.begin(); pe != lctV_emul.end(); pe++) {
2088  strstrm << " " << (*pe);
2089  strstrm << " corr BX = " << convertBXofLCT((*pe).getBX(), detid, alcts_data, clcts_data);
2090  strstrm << " LCT pattern = " << (*pe).getPattern();
2091  strstrm << "\n";
2092  }
2093  LogTrace("CSCTriggerPrimitivesReader") << strstrm.str();
2094  //std::cout <<"CompareLCTs "<< strstrm.str()<< std::endl;
2095  }
2096  if (nemul_readout > 2) { //reduce nemul_readout to 2 by hand
2097  //cout <<"LCT matching nemul readout is "<< nemul_readout <<", larger than 2. reduce it to 2 by hand"<<endl;
2098  nemul_readout = 2;
2099  }
2100 
2101  //
2102  //Data, add HS quality later
2103  int perEv_nStub_data = 0;
2104  int perEv_nStub_emul = 0;
2105  perStub[4].init(RUN_, Event_);
2106  perStub[5].init(RUN_, Event_);
2107  for (pd = lctV_data.begin(); pd != lctV_data.end(); pd++) {
2108  perEv_nStub_data++;
2109  }
2110  perStub[4].t_endcap = endc;
2111  perStub[4].t_station = stat;
2112  perStub[4].t_chamber = cham;
2113  perStub[4].t_ring = ring;
2115  perStub[4].t_nStubs = ndata;
2116  perStub[4].t_nStubs_readout = ndata;
2117  event_tree[4]->Fill();
2118  //Emul
2119  for (pe = lctV_emul.begin(); pe != lctV_emul.end(); pe++) {
2120  perEv_nStub_emul++;
2121  }
2122  perStub[5].t_endcap = endc;
2123  perStub[5].t_station = stat;
2124  perStub[5].t_chamber = cham;
2125  perStub[5].t_ring = ring;
2127  perStub[5].t_nStubs = nemul;
2128  perStub[5].t_nStubs_readout = nemul_readout;
2129  event_tree[5]->Fill();
2130 
2131  int csctype = getCSCType(detid);
2132  hLctCompFoundCsc[endc - 1][csctype]->Fill(cham);
2133  int ix = chamberIX(detid);
2134  int ix2 = chamberIXi(detid);
2135  if (detid.station() > 1 && detid.ring() == 1) {
2136  hLCTCompFound2x->Fill(ix, detid.chamber() * 2);
2137  } else {
2138  hLCTCompFound2->Fill(ix, detid.chamber());
2139  }
2140  hLCTCompFound2i->Fill(ix2, detid.chamber());
2141  if (ndata != nemul) {
2142  LogTrace("CSCTriggerPrimitivesReader")
2143  //cerr
2144  << " +++ Different numbers of LCTs found in ME" << ((endc == 1) ? "+" : "-") << stat << "/" << ring
2145  << "/" << cham << ": data = " << ndata << " emulator = " << nemul << " +++\n";
2146  } else {
2147  hLctCompSameNCsc[endc - 1][csctype]->Fill(cham);
2148  if (detid.station() > 1 && detid.ring() == 1) {
2149  hLCTCompSameN2x->Fill(ix, detid.chamber() * 2);
2150  } else {
2151  hLCTCompSameN2->Fill(ix, detid.chamber());
2152  }
2153  hLCTCompSameN2i->Fill(ix2, detid.chamber());
2154  }
2155  int i = -1;
2156  for (pd = lctV_data.begin(); pd != lctV_data.end(); pd++) {
2157  i++;
2158  if ((*pd).isValid() == 0)
2159  continue;
2160  int data_trknmb = (*pd).getTrknmb();
2161  int data_quality = (*pd).getQuality();
2162  int data_wiregroup = (*pd).getKeyWG();
2163  int data_keystrip = (*pd).getStrip();
2164  int data_pattern = (*pd).getCLCTPattern();
2165  int data_striptype = (*pd).getStripType();
2166  int data_bend = (*pd).getBend();
2167  int data_bx = (*pd).getBX();
2168 
2170  stubs_comparison[2].firstfill = firstfill;
2171  if (firstfill)
2172  firstfill = false;
2174  stubs_comparison[2].endcap = endc;
2176  stubs_comparison[2].ring = ring;
2179  stubs_comparison[2].totStubs_data = ndata;
2180  stubs_comparison[2].totStubs_emul = nemul;
2181  stubs_comparison[2].totStubs_emul_readout = nemul_readout;
2182  stubs_comparison[2].nStub_data = i + 1;
2183  stubs_comparison[2].has_data = true;
2184  stubs_comparison[2].quality_data = (*pd).getQuality();
2185  stubs_comparison[2].key_WG_data = (*pd).getKeyWG();
2186  stubs_comparison[2].key_hs_data = (*pd).getStrip();
2187  //cout <<" CSC detid "<< detid <<" LCT in data "<< (*pd) <<" do doesALCTCrossCLCT "<< endl;
2188  stubs_comparison[2].WGcrossHS_data = doesALCTCrossCLCT(detid, (*pd).getKeyWG(), (*pd).getStrip());
2189  stubs_comparison[2].bend_data = (*pd).getBend();
2190  stubs_comparison[2].pattern_data = (*pd).getCLCTPattern();
2191  stubs_comparison[2].bx_data = (*pd).getBX();
2192  stubs_comparison[2].trknmb_data = data_trknmb;
2193  GlobalPoint gp_lct_data(getGlobalPosition(detid.rawId(), (*pd).getKeyWG(), (*pd).getStrip()));
2194  stubs_comparison[2].eta_data = gp_lct_data.eta();
2195  stubs_comparison[2].phi_data = gp_lct_data.phi();
2196  int j = -1;
2197  for (pe = lctV_emul.begin(); pe != lctV_emul.end(); pe++) {
2198  j++;
2199  if ((*pe).isValid() == 0)
2200  continue;
2201  if (bookedlctV_emul[j])
2202  continue; //used alct
2203  int emul_trknmb = (*pe).getTrknmb();
2204  int emul_quality = (*pe).getQuality();
2205  int emul_wiregroup = (*pe).getKeyWG();
2206  int emul_keystrip = (*pe).getStrip();
2207  int emul_pattern = (*pe).getCLCTPattern();
2208  int emul_striptype = (*pe).getStripType();
2209  int emul_bend = (*pe).getBend();
2210  int emul_bx = (*pe).getBX();
2211  if (abs(data_keystrip - emul_keystrip) <= 2 || abs(data_wiregroup - emul_wiregroup) <= 2) {
2212  // Convert emulator BX into hardware BX using full 12-bit
2213  // BX words in ALCT and CLCT digi collections.
2214  int emul_corr_bx = convertBXofLCT(emul_bx, detid, alcts_data, clcts_data);
2215  //std::cout <<"LCT data_bx "<< data_bx <<" emul_corr_bx "<< emul_corr_bx << std::endl;
2216  if (dataIsAnotherMC_)
2217  emul_corr_bx = (emul_bx & 0x01);
2218 
2219  if (ndata == nemul) {
2220  hLctCompTotalCsc[endc - 1][csctype]->Fill(cham);
2221  if (detid.station() > 1 && detid.ring() == 1) {
2222  hLCTCompTotal2x->Fill(ix, detid.chamber() * 2);
2223  } else {
2224  hLCTCompTotal2->Fill(ix, detid.chamber());
2225  }
2226  hLCTCompTotal2i->Fill(ix2, detid.chamber());
2227  }
2228  if (data_quality == emul_quality && data_wiregroup == emul_wiregroup &&
2229  data_keystrip == emul_keystrip && data_pattern == emul_pattern &&
2230  data_striptype == emul_striptype && data_bend == emul_bend) {
2231  if (ndata == nemul) {
2232  hLctCompMatchCsc[endc - 1][csctype]->Fill(cham);
2233  if (detid.station() > 1 && detid.ring() == 1) {
2234  hLCTCompMatch2x->Fill(ix, detid.chamber() * 2);
2235  } else {
2236  hLCTCompMatch2->Fill(ix, detid.chamber());
2237  }
2238  hLCTCompMatch2i->Fill(ix2, detid.chamber());
2239  }
2240  if (debug)
2241  LogTrace("CSCTriggerPrimitivesReader") << " Identical LCTs #" << data_trknmb;
2242  } else {
2243  LogTrace("CSCTriggerPrimitivesReader")
2244  << " Different LCTs #" << data_trknmb << " in ME" << ((endc == 1) ? "+" : "-") << stat
2245  << "/" << ring << "/" << cham << " data_lct bx " << data_bx << " emul bx " << emul_corr_bx;
2246  }
2247  stubs_comparison[2].nStub_emul = j + 1;
2248  stubs_comparison[2].has_emul = true;
2249  stubs_comparison[2].quality_emul = (*pe).getQuality();
2250  stubs_comparison[2].key_WG_emul = (*pe).getKeyWG();
2251  stubs_comparison[2].key_hs_emul = (*pe).getStrip();
2252  stubs_comparison[2].bend_emul = (*pe).getBend();
2253  stubs_comparison[2].pattern_emul = (*pe).getCLCTPattern();
2254  stubs_comparison[2].bx_emul = (*pe).getBX();
2255  //cout <<" CSC detid "<< detid <<" LCT in emul "<< (*pe) <<" do doesALCTCrossCLCT "<< endl;
2256  stubs_comparison[2].WGcrossHS_emul = doesALCTCrossCLCT(detid, (*pe).getKeyWG(), (*pe).getStrip());
2257  stubs_comparison[2].bx_corr_emul = emul_corr_bx;
2258  stubs_comparison[2].trknmb_emul = emul_trknmb;
2259  GlobalPoint gp_lct_emul(getGlobalPosition(detid.rawId(), (*pe).getKeyWG(), (*pe).getStrip()));
2260  stubs_comparison[2].eta_emul = gp_lct_emul.eta();
2261  stubs_comparison[2].phi_emul = gp_lct_emul.phi();
2262  bookedlctV_emul[j] = true;
2263  break;
2264  } //if (data_trknmb == emul_trknmb)
2265  } //loop emul
2266  if (debug and stubs_comparison[2].key_hs_data != stubs_comparison[2].key_hs_emul)
2267  LogTrace("CSCTriggerPrimitivesReader")
2268  << "CSCDetid " << detid << " not matched LCT from Data " << (*pd)
2269  << " stubs_comparison 2 key_hs_data " << stubs_comparison[2].key_hs_data << " key_hs_emul "
2270  << stubs_comparison[2].key_hs_emul << endl;
2271  stub_tree[2]->Fill();
2272  } //loop data
2273  for (int k = 0; k < nemul; k++) {
2274  if (bookedlctV_emul[k])
2275  continue;
2276  if (lctV_emul[i].isValid() == 0)
2277  continue;
2280  stubs_comparison[2].endcap = endc;
2282  stubs_comparison[2].ring = ring;
2285  stubs_comparison[2].totStubs_data = ndata;
2286  stubs_comparison[2].totStubs_emul = nemul;
2287  stubs_comparison[2].totStubs_emul_readout = nemul_readout;
2288  stubs_comparison[2].trknmb_emul = lctV_emul[i].getTrknmb();
2289  stubs_comparison[2].nStub_data = -1;
2290  stubs_comparison[2].has_data = false;
2291  stubs_comparison[2].nStub_emul = k + 1;
2292  stubs_comparison[2].has_emul = true;
2294  doesALCTCrossCLCT(detid, lctV_emul[k].getKeyWG(), lctV_emul[k].getStrip());
2295  stubs_comparison[2].quality_emul = lctV_emul[k].getQuality();
2296  stubs_comparison[2].key_WG_emul = lctV_emul[k].getKeyWG();
2297  stubs_comparison[2].key_hs_emul = lctV_emul[k].getStrip();
2298  stubs_comparison[2].bend_emul = lctV_emul[k].getBend();
2299  stubs_comparison[2].pattern_emul = lctV_emul[k].getCLCTPattern();
2300  stubs_comparison[2].bx_emul = lctV_emul[k].getBX();
2301  //stubs_comparison[2].fullbx_emul = lctV_emul[k].getFullBX();
2302  // Emulator BX NOT Known from the data.
2303  GlobalPoint gp_lct_emul(getGlobalPosition(detid.rawId(), lctV_emul[k].getKeyWG(), lctV_emul[k].getStrip()));
2304  stubs_comparison[2].eta_emul = gp_lct_emul.eta();
2305  stubs_comparison[2].phi_emul = gp_lct_emul.phi();
2306  bookedlctV_emul[k] = true;
2307  stub_tree[2]->Fill();
2308  }
2309  }
2310  }
2311  }
2312  }
2313 }
2314 
2316  const CSCCorrelatedLCTDigiCollection* lcts_emul,
2317  const CSCALCTDigiCollection* alcts_data,
2318  const CSCCLCTDigiCollection* clcts_data) {
2319  // Need ALCT and CLCT digi collections to convert emulator bx into
2320  // hardware bx.
2321  // Loop over all chambers in search for correlated LCTs.
2322  std::vector<CSCCorrelatedLCTDigi>::const_iterator pd, pe;
2323  for (int endc = 1; endc <= 2; endc++) {
2324  for (int stat = 1; stat <= 4; stat++) {
2325  for (int ring = 1; ring <= maxRing(stat); ring++) {
2326  for (int cham = 1; cham <= 36; cham++) {
2327  // Calculate DetId. 0th layer means whole chamber.
2328  CSCDetId detid(endc, stat, ring, cham, 0);
2329 
2330  // Skip chambers marked as bad.
2332  continue;
2333 
2334  std::vector<CSCCorrelatedLCTDigi> lctV_data, lctV_emul;
2335  std::vector<bool> bookedlctV_emul;
2336  const auto& drange = lcts_data->get(detid);
2337  for (auto digiIt = drange.first; digiIt != drange.second; digiIt++) {
2338  if ((*digiIt).isValid()) {
2339  lctV_data.push_back(*digiIt);
2340  }
2341  }
2342 
2343  const auto& erange = lcts_emul->get(detid);
2344  for (auto digiIt = erange.first; digiIt != erange.second; digiIt++) {
2345  if ((*digiIt).isValid()) {
2346  lctV_emul.push_back(*digiIt);
2347  bookedlctV_emul.push_back(false);
2348  }
2349  }
2350 
2351  int ndata = lctV_data.size();
2352  int nemul = lctV_emul.size();
2353  if (ndata == 0 && nemul == 0)
2354  continue;
2355  bool firstfill = true;
2356 
2357  if (debug) {
2358  ostringstream strstrm;
2359  strstrm << "\n--- ME" << ((detid.endcap() == 1) ? "+" : "-") << detid.station() << "/" << detid.ring()
2360  << "/" << detid.chamber() << " (sector " << detid.triggerSector() << " trig id. "
2361  << detid.triggerCscId() << "):\n";
2362  strstrm << " **** " << ndata << " valid data LCTs found:\n";
2363  for (pd = lctV_data.begin(); pd != lctV_data.end(); pd++) {
2364  strstrm << " " << (*pd);
2365  }
2366  strstrm << "\n **** " << nemul << " valid emul LCTs found:\n";
2367  for (pe = lctV_emul.begin(); pe != lctV_emul.end(); pe++) {
2368  strstrm << " " << (*pe);
2369  strstrm << " corr BX = " << convertBXofLCT((*pe).getBX(), detid, alcts_data, clcts_data);
2370  strstrm << " LCT pattern = " << (*pe).getPattern();
2371  strstrm << "\n";
2372  }
2373  LogTrace("CSCTriggerPrimitivesReader") << strstrm.str();
2374  //std::cout <<"CompareLCTs "<< strstrm.str()<< std::endl;
2375  }
2376 
2377  //int ix = chamberIX(detid);
2378  //int ix2 = chamberIXi(detid);
2379  if (ndata != nemul) {
2380  LogTrace("CSCTriggerPrimitivesReader")
2381  << " +++ Different numbers of MPC LCTs found in ME" << ((endc == 1) ? "+" : "-") << stat << "/"
2382  << ring << "/" << cham << ": data = " << ndata << " emulator = " << nemul << " +++\n";
2383  }
2384  /*else {
2385  hLctCompSameNCsc[endc-1][csctype]->Fill(cham);
2386  if(detid.station()>1 && detid.ring()==1) {
2387  hLCTCompSameN2x->Fill(ix,detid.chamber()*2);
2388  }
2389  else {
2390  hLCTCompSameN2->Fill(ix,detid.chamber());
2391  }
2392  hLCTCompSameN2i->Fill(ix2,detid.chamber());
2393  }*/
2394  int i = -1;
2395  for (pd = lctV_data.begin(); pd != lctV_data.end(); pd++) {
2396  i++;
2397  if ((*pd).isValid() == 0)
2398  continue;
2399  int data_trknmb = (*pd).getTrknmb();
2400  int data_quality = (*pd).getQuality();
2401  int data_wiregroup = (*pd).getKeyWG();
2402  int data_keystrip = (*pd).getStrip();
2403  int data_pattern = (*pd).getCLCTPattern();
2404  int data_striptype = (*pd).getStripType();
2405  int data_bend = (*pd).getBend();
2406  int data_bx = (*pd).getBX();
2407 
2409  stubs_comparison[3].firstfill = firstfill;
2410  if (firstfill)
2411  firstfill = false;
2413  stubs_comparison[3].endcap = endc;
2415  stubs_comparison[3].ring = ring;
2418  stubs_comparison[3].totStubs_data = ndata;
2419  stubs_comparison[3].totStubs_emul = nemul;
2420  stubs_comparison[3].nStub_data = i + 1;
2421  stubs_comparison[3].has_data = true;
2422  stubs_comparison[3].WGcrossHS_data = doesALCTCrossCLCT(detid, (*pd).getKeyWG(), (*pd).getStrip());
2423  stubs_comparison[3].quality_data = (*pd).getQuality();
2424  stubs_comparison[3].key_WG_data = (*pd).getKeyWG();
2425  stubs_comparison[3].key_hs_data = (*pd).getStrip();
2426  stubs_comparison[3].bend_data = (*pd).getBend();
2427  stubs_comparison[3].pattern_data = (*pd).getCLCTPattern();
2428  stubs_comparison[3].bx_data = (*pd).getBX();
2429  stubs_comparison[3].trknmb_data = data_trknmb;
2430  GlobalPoint gp_lct_data(getGlobalPosition(detid.rawId(), (*pd).getKeyWG(), (*pd).getStrip()));
2431  stubs_comparison[3].eta_data = gp_lct_data.eta();
2432  stubs_comparison[3].phi_data = gp_lct_data.phi();
2433  int j = -1;
2434  for (pe = lctV_emul.begin(); pe != lctV_emul.end(); pe++) {
2435  j++;
2436  if ((*pe).isValid() == 0)
2437  continue;
2438  int emul_trknmb = (*pe).getTrknmb();
2439  int emul_quality = (*pe).getQuality();
2440  int emul_wiregroup = (*pe).getKeyWG();
2441  int emul_keystrip = (*pe).getStrip();
2442  int emul_pattern = (*pe).getCLCTPattern();
2443  int emul_striptype = (*pe).getStripType();
2444  int emul_bend = (*pe).getBend();
2445  int emul_bx = (*pe).getBX();
2446  if (data_trknmb == emul_trknmb) {
2447  // Convert emulator BX into hardware BX using full 12-bit
2448  // BX words in ALCT and CLCT digi collections.
2449  int emul_corr_bx = convertBXofLCT(emul_bx, detid, alcts_data, clcts_data);
2450  //std::cout <<"LCT data_bx "<< data_bx <<" emul_corr_bx "<< emul_corr_bx << std::endl;
2451  if (dataIsAnotherMC_)
2452  emul_corr_bx = (emul_bx & 0x01);
2453 
2454  /*if (ndata == nemul) {
2455  hLctCompTotalCsc[endc-1][csctype]->Fill(cham);
2456  if(detid.station()>1 && detid.ring()==1) {
2457  hLCTCompTotal2x->Fill(ix,detid.chamber()*2);
2458  }
2459  else {
2460  hLCTCompTotal2->Fill(ix,detid.chamber());
2461  }
2462  hLCTCompTotal2i->Fill(ix2,detid.chamber());
2463  }*/
2464  if (data_quality == emul_quality && data_wiregroup == emul_wiregroup &&
2465  data_keystrip == emul_keystrip && data_pattern == emul_pattern &&
2466  data_striptype == emul_striptype && data_bend == emul_bend) {
2467  //data_bx == emul_corr_bx) {
2468  /*if (ndata == nemul) {
2469  hLctCompMatchCsc[endc-1][csctype]->Fill(cham);
2470  if(detid.station()>1 && detid.ring()==1) {
2471  hLCTCompMatch2x->Fill(ix,detid.chamber()*2);
2472  }
2473  else {
2474  hLCTCompMatch2->Fill(ix,detid.chamber());
2475  }
2476  hLCTCompMatch2i->Fill(ix2,detid.chamber());
2477  }*/
2478  if (debug)
2479  LogTrace("CSCTriggerPrimitivesReader") << " Identical LCTs #" << data_trknmb;
2480  stubs_comparison[3].nStub_emul = j + 1;
2481  stubs_comparison[3].has_emul = true;
2482  stubs_comparison[3].WGcrossHS_emul = doesALCTCrossCLCT(detid, (*pe).getKeyWG(), (*pe).getStrip());
2483  stubs_comparison[3].quality_emul = (*pe).getQuality();
2484  stubs_comparison[3].key_WG_emul = (*pe).getKeyWG();
2485  stubs_comparison[3].key_hs_emul = (*pe).getStrip();
2486  stubs_comparison[3].bend_emul = (*pe).getBend();
2487  stubs_comparison[3].pattern_emul = (*pe).getCLCTPattern();
2488  stubs_comparison[3].bx_emul = (*pe).getBX();
2489  stubs_comparison[3].bx_corr_emul = emul_corr_bx;
2490  stubs_comparison[3].trknmb_emul = emul_trknmb;
2491  GlobalPoint gp_lct_emul(getGlobalPosition(detid.rawId(), (*pe).getKeyWG(), (*pe).getStrip()));
2492  stubs_comparison[3].eta_emul = gp_lct_emul.eta();
2493  stubs_comparison[3].phi_emul = gp_lct_emul.phi();
2494  bookedlctV_emul[j] = true;
2495  break;
2496  } else {
2497  LogTrace("CSCTriggerPrimitivesReader")
2498  //cerr
2499  << " Different LCTs #" << data_trknmb << " in ME" << ((endc == 1) ? "+" : "-") << stat
2500  << "/" << ring << "/" << cham << " data_lct bx " << data_bx << " emul bx " << emul_corr_bx;
2501  }
2502  }
2503  } //loop emul
2504  if (debug and stubs_comparison[3].key_hs_data != stubs_comparison[3].key_hs_emul)
2505  LogTrace("CSCTriggerPrimitivesReader")
2506  << "stubs_comparison 2 key_hs_data " << stubs_comparison[3].key_hs_data << " key_hs_emul "
2508  stub_tree[3]->Fill();
2509  } //loop data
2510 
2511  for (int k = 0; k < nemul; k++) {
2512  if (bookedlctV_emul[k])
2513  continue;
2515  stubs_comparison[3].firstfill = firstfill;
2516  if (firstfill)
2517  firstfill = false;
2519  stubs_comparison[3].endcap = endc;
2521  stubs_comparison[3].ring = ring;
2524  stubs_comparison[3].totStubs_data = ndata;
2525  stubs_comparison[3].totStubs_emul = nemul;
2526  stubs_comparison[3].trknmb_emul = lctV_emul[i].getTrknmb();
2527  stubs_comparison[3].nStub_data = -1;
2528  stubs_comparison[3].has_data = false;
2529  stubs_comparison[3].nStub_emul = k + 1;
2530  stubs_comparison[3].has_emul = true;
2532  doesALCTCrossCLCT(detid, lctV_emul[k].getKeyWG(), lctV_emul[k].getStrip());
2533  stubs_comparison[3].quality_emul = lctV_emul[k].getQuality();
2534  stubs_comparison[3].key_WG_emul = lctV_emul[k].getKeyWG();
2535  stubs_comparison[3].key_hs_emul = lctV_emul[k].getStrip();
2536  stubs_comparison[3].bend_emul = lctV_emul[k].getBend();
2537  stubs_comparison[3].pattern_emul = lctV_emul[k].getCLCTPattern();
2538  stubs_comparison[3].bx_emul = lctV_emul[k].getBX();
2539  //stubs_comparison[2].fullbx_emul = lctV_emul[k].getFullBX();
2540  // Emulator BX NOT Known from the data.
2541  GlobalPoint gp_lct_emul(getGlobalPosition(detid.rawId(), lctV_emul[k].getKeyWG(), lctV_emul[k].getStrip()));
2542  stubs_comparison[3].eta_emul = gp_lct_emul.eta();
2543  stubs_comparison[3].phi_emul = gp_lct_emul.phi();
2544  bookedlctV_emul[k] = true;
2545  stub_tree[3]->Fill();
2546  }
2547  } //end loop of chambers
2548  }
2549  }
2550  }
2551 }
2552 
2554  const CSCDetId& detid,
2555  const CSCALCTDigiCollection* alcts_data,
2556  const CSCCLCTDigiCollection* clcts_data) {
2557  int full_anode_bx = -999;
2558  //int full_cathode_bx = -999;
2559  int lct_bx = -999;
2560  int tbin_anode_offset = 5; // 2007, run 14419.
2561 
2562  // Extract full 12-bit anode BX word from ALCT collections.
2563  const auto& arange = alcts_data->get(detid);
2564  for (auto digiIt = arange.first; digiIt != arange.second; digiIt++) {
2565  if ((*digiIt).isValid()) {
2566  full_anode_bx = (*digiIt).getFullBX();
2567  break;
2568  }
2569  }
2570 
2571  // Extract full 12-bit cathode BX word from CLCT collections.
2572  const auto& crange = clcts_data->get(detid);
2573  for (auto digiIt = crange.first; digiIt != crange.second; digiIt++) {
2574  if ((*digiIt).isValid()) {
2575  //full_cathode_bx = (*digiIt).getFullBX();
2576  break;
2577  }
2578  }
2579 
2580  // Use these 12-bit BX's to convert emulator BX into hardware BX.
2581  if (full_anode_bx == -999) {
2582  // What to do???
2583  edm::LogWarning("L1CSCTPEmulatorWrongInput") << "+++ Warning in convertBXofLCT(): full anode BX is not available!"
2584  << " +++\n";
2585  } else {
2586  // LCT BX has two bits: the least-significant bit is the LSB of ALCT BX;
2587  // the MSB is 1/0 depending on whether the 12-bit full cathode BX is 0
2588  // or not.
2589  lct_bx = (full_anode_bx + emul_bx - tbin_anode_offset) & 0x01;
2590  // SV, 12/Jun/08: it looks like this bit is never set - docu must be
2591  // wrong.
2592  //lct_bx = lct_bx | ((full_cathode_bx == 0) << 1);
2593  }
2594  //std::cout <<"convertBXofLCT old emul_bx "<< emul_bx <<" new lct bx "<< lct_bx <<" ful_anode_bx "<< full_anode_bx << std::endl;
2595  return lct_bx;
2596 }
2597 
2599  if (!bookedHotWireHistos)
2602  // iEvent.getByLabel(wireDigiProducer_.label(), wireDigiProducer_.instance(), wires);
2603  iEvent.getByToken(wireDigi_token_, wires);
2604 
2605  int serial_old = -1;
2606  for (auto dWDiter = wires->begin(); dWDiter != wires->end(); dWDiter++) {
2607  CSCDetId id = (CSCDetId)(*dWDiter).first;
2608  int serial = chamberSerial(id) - 1;
2609  // printf("serial %i\n",serial);
2610  std::vector<CSCWireDigi>::const_iterator wireIter = (*dWDiter).second.first;
2611  std::vector<CSCWireDigi>::const_iterator lWire = (*dWDiter).second.second;
2612  bool has_layer = false;
2613  for (; wireIter != lWire; ++wireIter) {
2614  has_layer = true;
2615  int i_layer = id.layer() - 1;
2616  int i_wire = wireIter->getWireGroup() - 1;
2617  int nbins = wireIter->getTimeBinsOn().size();
2618  int serial2 = serial * (6 * 112) + i_layer * 112 + i_wire;
2619  /*
2620  printf("endcap %i, station %i, ring %i, chamber %i, serial %i, serial2 %i, layer %i, wg %i\n",
2621  id.endcap(), id.station(), id.ring(), id.chamber(), serial, serial2, i_layer, i_wire);
2622  */
2623  hHotWire1->Fill(serial2, nbins);
2624  /*
2625  if(id.station()==1) {
2626  printf("ring %i, chamber type %i, wg %i\n",id.ring(),id.iChamberType(),i_wire);
2627  }
2628  */
2629  }
2630  if (serial_old != serial && has_layer) {
2631  // nHotCham[serial]++;
2632  hHotCham1->Fill(serial);
2633  // printf("serial %i filled\n",serial);
2634  serial_old = serial;
2635  }
2636  }
2637 }
2638 
2640  const CSCALCTDigiCollection* alcts,
2641  const CSCCLCTDigiCollection* clcts) {
2642  // MC particles, if any.
2643  //edm::Handle<edm::HepMCProduct> mcp;
2644  //ev.getByLabel("source", mcp);
2645  //ev.getByType(mcp);
2646  vector<edm::Handle<edm::HepMCProduct> > allhepmcp;
2647  // Use "getManyByType" to be able to check the existence of MC info.
2648  ev.getManyByType(allhepmcp);
2649 
2650  //cout << "HepMC info: " << allhepmcp.size() << endl;
2651  if (!allhepmcp.empty()) {
2652  const HepMC::GenEvent& mc = allhepmcp[0]->getHepMCData();
2653  int i = 0;
2654  for (HepMC::GenEvent::particle_const_iterator p = mc.particles_begin(); p != mc.particles_end(); ++p) {
2655  int id = (*p)->pdg_id();
2656  double phitmp = (*p)->momentum().phi();
2657  if (phitmp < 0)
2658  phitmp += 2. * M_PI;
2659  if (debug)
2660  LogDebug("CSCTriggerPrimitivesReader")
2661  << "MC part #" << ++i << ": id = " << id << ", status = " << (*p)->status()
2662  << "\n pX = " << (*p)->momentum().x() << ", pY = " << (*p)->momentum().y()
2663  << ", pT = " << (*p)->momentum().perp() << " GeV"
2664  << ", p = " << (*p)->momentum().rho() << " GeV"
2665  << "\n eta = " << (*p)->momentum().pseudoRapidity() << ", phi = " << phitmp << " ("
2666  << phitmp * 180. / M_PI << " deg)";
2667  }
2668 
2669  // If hepMC info is there, try to get wire and comparator digis,
2670  // and SimHits.
2674  // ev.getByLabel(wireDigiProducer_.label(), wireDigiProducer_.instance(),
2675  // wireDigis);
2676  // ev.getByLabel(compDigiProducer_.label(), compDigiProducer_.instance(),
2677  // compDigis);
2678  // ev.getByLabel(simHitProducer_.label(), simHitProducer_.instance(),
2679  // simHits);
2680  ev.getByToken(wireDigi_token_, wireDigis);
2681  ev.getByToken(compDigi_token_, compDigis);
2682  ev.getByToken(simHit_token_, simHitsH);
2683  const edm::PSimHitContainer& simHits = *simHitsH.product();
2684 
2685  if (!wireDigis.isValid()) {
2686  edm::LogWarning("L1CSCTPEmulatorWrongInput")
2687  << "+++ Warning: Collection of wire digis with label" << wireDigiProducer_.label()
2688  << " requested, but not found in the event... Skipping the rest +++\n";
2689  return;
2690  }
2691  if (!compDigis.isValid()) {
2692  edm::LogWarning("L1CSCTPEmulatorWrongInput")
2693  << "+++ Warning: Collection of comparator digis with label" << compDigiProducer_.label()
2694  << " requested, but not found in the event... Skipping the rest +++\n";
2695  return;
2696  }
2697  if (!simHitsH.isValid()) {
2698  edm::LogWarning("L1CSCTPEmulatorWrongInput")
2699  << "+++ Warning: Collection of SimHits with label" << simHitProducer_.label()
2700  << " requested, but not found in the event... Skipping the rest +++\n";
2701  return;
2702  }
2703 
2704  if (debug)
2705  LogTrace("CSCTriggerPrimitivesReader") << " #CSC SimHits: " << simHits.size();
2706 
2707  // MC-based resolution studies.
2708  calcResolution(alcts, clcts, wireDigis.product(), compDigis.product(), simHits);
2709 
2710  // MC-based efficiency studies.
2711  calcEfficiency(alcts, clcts, simHits);
2712  }
2713 }
2714 
2716  const CSCCLCTDigiCollection* clcts,
2717  const CSCWireDigiCollection* wiredc,
2718  const CSCComparatorDigiCollection* compdc,
2719  const edm::PSimHitContainer& allSimHits) {
2720  // Book histos when called for the first time.
2721  if (!bookedResolHistos)
2722  bookResolHistos();
2723 
2724  // ALCT resolution
2725  CSCAnodeLCTAnalyzer alct_analyzer;
2726  alct_analyzer.setGeometry(geom_);
2727 
2728  for (auto adetUnitIt = alcts->begin(); adetUnitIt != alcts->end(); adetUnitIt++) {
2729  const CSCDetId& id = (*adetUnitIt).first;
2731  continue;
2732  const auto& range = (*adetUnitIt).second;
2733  for (auto digiIt = range.first; digiIt != range.second; digiIt++) {
2734  bool alct_valid = (*digiIt).isValid();
2735  if (alct_valid) {
2736  vector<CSCAnodeLayerInfo> alctInfo = alct_analyzer.getSimInfo(*digiIt, id, wiredc, &allSimHits);
2737 
2738  double hitPhi = -999.0, hitEta = -999.0;
2739  int hitWG = alct_analyzer.nearestWG(alctInfo, hitPhi, hitEta);
2740  if (hitWG >= 0.) {
2741  // Key wire group and key layer id.
2742  int wiregroup = (*digiIt).getKeyWG();
2743 
2744  CSCDetId layerId(id.endcap(), id.station(), id.ring(), id.chamber(), CSCConstants::KEY_ALCT_LAYER);
2745  int endc = id.endcap();
2746  int stat = id.station();
2747  int csctype = getCSCType(id);
2748 
2749  double alctEta = alct_analyzer.getWGEta(layerId, wiregroup);
2750  double deltaEta = alctEta - hitEta;
2751  hResolDeltaEta->Fill(deltaEta);
2752 
2753  double deltaWG = wiregroup - hitWG;
2754  if (debug)
2755  LogTrace("CSCTriggerPrimitivesReader")
2756  << "WG: MC = " << hitWG << " rec = " << wiregroup << " delta = " << deltaWG;
2757  hResolDeltaWG->Fill(deltaWG);
2758 
2759  hEtaRecVsSim->Fill(fabs(hitEta), fabs(alctEta));
2760  hEtaDiffCsc[csctype][0]->Fill(deltaEta);
2761  hEtaDiffCsc[csctype][endc]->Fill(deltaEta);
2762  hAlctVsEta[stat - 1]->Fill(fabs(alctEta));
2763  hEtaDiffVsEta[stat - 1]->Fill(fabs(alctEta), fabs(deltaEta));
2764  hEtaDiffVsWireCsc[csctype]->Fill(wiregroup, deltaEta);
2765  }
2766  // should I comment out this "else"?
2767  //else {
2768  // edm::LogWarning("L1CSCTPEmulatorWrongInput")
2769  // << "+++ Warning in calcResolution(): no matched SimHit"
2770  // << " found! +++\n";
2771  //}
2772  }
2773  }
2774  }
2775 
2776  // CLCT resolution
2777  static const int key_layer = CSCConstants::KEY_CLCT_LAYER;
2778  CSCCathodeLCTAnalyzer clct_analyzer;
2779  clct_analyzer.setGeometry(geom_);
2780 
2781  for (auto cdetUnitIt = clcts->begin(); cdetUnitIt != clcts->end(); cdetUnitIt++) {
2782  const CSCDetId& id = (*cdetUnitIt).first;
2784  continue;
2785  const auto& range = (*cdetUnitIt).second;
2786  for (auto digiIt = range.first; digiIt != range.second; digiIt++) {
2787  bool clct_valid = (*digiIt).isValid();
2788  if (clct_valid) {
2789  vector<CSCCathodeLayerInfo> clctInfo = clct_analyzer.getSimInfo(*digiIt, id, compdc, &allSimHits);
2790 
2791  double hitPhi = -999.0, hitEta = -999.0, deltaStrip = -999.0;
2792  int hitHS = clct_analyzer.nearestHS(clctInfo, hitPhi, hitEta);
2793  if (hitHS >= 0.) {
2794  // Key strip and key layer id.
2795  int halfstrip = (*digiIt).getKeyStrip();
2796  int strip = halfstrip / 2;
2797  int distrip = halfstrip / 4;
2798  int stripType = (*digiIt).getStripType();
2799 
2800  CSCDetId layerId(id.endcap(), id.station(), id.ring(), id.chamber(), key_layer);
2801  int endc = id.endcap();
2802  int stat = id.station();
2803  int csctype = getCSCType(id);
2804 
2805  // 'float strip' is in the units of 'strip', i.e., angular
2806  // widths of each strip. The counting is from 0.0 at the extreme
2807  // edge of the 'first' strip at one edge of the detector.
2808  float fstrip = -999.;
2809  if (stripType == 0) { // di-strip CLCT
2810  fstrip = strip + 1.;
2811  } else { // half-strip CLCT
2812  fstrip = strip + 0.5 * (halfstrip % 2) + 0.25;
2813  }
2814  double clctPhi = clct_analyzer.getStripPhi(layerId, fstrip);
2815  double deltaPhi = clctPhi - hitPhi;
2816  if (deltaPhi < -M_PI)
2817  deltaPhi += 2. * M_PI;
2818  else if (deltaPhi > M_PI)
2819  deltaPhi -= 2. * M_PI;
2820  deltaPhi *= 1000; // in mrad
2821  if (hitPhi < 0)
2822  hitPhi += 2. * M_PI;
2823  if (clctPhi < 0)
2824  clctPhi += 2. * M_PI;
2825  if (debug)
2826  LogTrace("CSCTriggerPrimitivesReader")
2827  << " clctPhi = " << clctPhi << " hitPhi = " << hitPhi << " deltaPhi = " << deltaPhi;
2828 
2829  hResolDeltaPhi->Fill(deltaPhi);
2830  if (stripType == 0) { // di-strip CLCT
2831  deltaStrip = distrip - hitHS / 4;
2832  hResolDeltaDS->Fill(deltaStrip);
2833  hResolDeltaPhiDS->Fill(deltaPhi);
2834  hPhiDiffVsStripCsc[csctype][0]->Fill(distrip, deltaPhi);
2835  } else { // half-strip CLCT
2836  deltaStrip = halfstrip - hitHS;
2837  hResolDeltaHS->Fill(deltaStrip);
2838  hResolDeltaPhiHS->Fill(deltaPhi);
2839  hPhiDiffVsStripCsc[csctype][1]->Fill(halfstrip, deltaPhi);
2840  }
2841  if (debug)
2842  LogTrace("CSCTriggerPrimitivesReader") << "Half-strip: MC = " << hitHS << " rec = " << halfstrip
2843  << " pattern type = " << stripType << " delta = " << deltaStrip;
2844 
2845  hPhiRecVsSim->Fill(hitPhi, clctPhi);
2846  hPhiDiffCsc[csctype][0]->Fill(deltaPhi);
2847  hPhiDiffCsc[csctype][endc]->Fill(deltaPhi);
2848  hPhiDiffCsc[csctype][stripType + 3]->Fill(deltaPhi);
2849  hClctVsPhi[stat - 1]->Fill(clctPhi);
2850  hPhiDiffVsPhi[stat - 1]->Fill(clctPhi, fabs(deltaPhi));
2851 
2852  // Histograms to check phi offsets for various pattern types
2853  if (stripType == 1) { // half-strips
2854  double hsperrad = getHsPerRad(csctype); // halfstrips-per-radian
2855  if ((endc == 1 && (stat == 1 || stat == 2)) || (endc == 2 && (stat == 3 || stat == 4))) {
2856  hPhiDiffPattern[(*digiIt).getPattern()]->Fill(deltaPhi / 1000 * hsperrad);
2857  }
2858  }
2859  }
2860  // should I comment out this "else"?
2861  //else {
2862  // edm::LogWarning("L1CSCTPEmulatorWrongInput")
2863  // << "+++ Warning in calcResolution(): no matched SimHit"
2864  // << " found! +++\n";
2865  //}
2866 
2867  // "True bend", defined as difference in phi between muon hit
2868  // positions in the first and in the sixth layers.
2869  double phi1 = -999.0, phi6 = -999.0;
2870  vector<CSCCathodeLayerInfo>::const_iterator pli;
2871  for (pli = clctInfo.begin(); pli != clctInfo.end(); pli++) {
2872  CSCDetId layerId = pli->getId();
2873  int layer = layerId.layer();
2874  if (layer == 1 || layer == 6) {
2875  // Get simHits in this layer.
2876  for (const auto& psh : allSimHits) {
2877  // Find detId where simHit is located.
2878  CSCDetId hitId = (CSCDetId)psh.detUnitId();
2879  if (hitId == layerId && abs(psh.particleType()) == 13) { // muon hits only
2880  const CSCLayer* csclayer = geom_->layer(layerId);
2881  const auto& thisPoint = csclayer->toGlobal(psh.localPosition());
2882  double phi = thisPoint.phi();
2883  if (layer == 1)
2884  phi1 = phi;
2885  else if (layer == 6)
2886  phi6 = phi;
2887  break; // simply take the first suitable hit.
2888  }
2889  }
2890  }
2891  }
2892  if (phi1 > -99. && phi6 > -99.) {
2893  double deltaPhi = phi1 - phi6;
2894  if (deltaPhi > M_PI)
2895  deltaPhi -= 2. * M_PI;
2896  else if (deltaPhi < -M_PI)
2897  deltaPhi += 2. * M_PI;
2898  int csctype = getCSCType(id);
2899  hTrueBendCsc[csctype]->Fill(deltaPhi * 1000.); // in mrad
2900  }
2901  }
2902  }
2903  }
2904 }
2905 
2907  const CSCCLCTDigiCollection* clcts,
2908  const edm::PSimHitContainer& allSimHits) {
2909  // Book histos when called for the first time.
2910  if (!bookedEfficHistos)
2911  bookEfficHistos();
2912 
2913  // Create list of chambers having SimHits.
2914  vector<CSCDetId> chamberIds;
2915  vector<CSCDetId>::const_iterator chamberIdIt;
2916  for (const auto& simHitIt : allSimHits) {
2917  // Find detId where simHit is located.
2918  bool sameId = false;
2919  CSCDetId hitId = (CSCDetId)simHitIt.detUnitId();
2920  // Skip chambers marked as bad (includes most of ME4/2 chambers).
2922  continue;
2923  //if (hitId.ring() == 4) continue; // skip ME1/A for now.
2924  if (!plotME1A && hitId.ring() == 4)
2925  continue;
2926  for (const auto& chamberId : chamberIds) {
2927  if (chamberId.endcap() == hitId.endcap() && chamberId.station() == hitId.station() &&
2928  chamberId.ring() == hitId.ring() && chamberId.chamber() == hitId.chamber()) {
2929  sameId = true;
2930  break;
2931  }
2932  }
2933  if (!sameId) {
2934  CSCDetId newChamberId(hitId.endcap(), hitId.station(), hitId.ring(), hitId.chamber(), 0);
2935  chamberIds.push_back(newChamberId);
2936  }
2937  }
2938  LogTrace("CSCTriggerPrimitivesReader") << "Found SimHits in " << chamberIds.size() << " CSCs";
2939 
2940  bool used[CSCConstants::NUM_LAYERS];
2941  vector<PSimHit> simHitsV[CSCConstants::NUM_LAYERS];
2942  for (const auto& chamberId : chamberIds) {
2943  // Find out how many layers of this chamber have SimHits.
2944  int nLayers = 0;
2945  for (int ilayer = 0; ilayer < CSCConstants::NUM_LAYERS; ilayer++) {
2946  used[ilayer] = false;
2947  simHitsV[ilayer].clear();
2948  }
2949 
2950  int endcap = chamberId.endcap();
2951  int station = chamberId.station();
2952  int ring = chamberId.ring();
2953  int chamber = chamberId.chamber();
2954  for (const auto& simHitIt : allSimHits) {
2955  CSCDetId hitId = (CSCDetId)simHitIt.detUnitId();
2956  if (hitId.endcap() == endcap && hitId.station() == station && hitId.ring() == ring &&
2957  hitId.chamber() == chamber) {
2958  int layer = hitId.layer() - 1;
2959  if (!used[layer] && abs(simHitIt.particleType()) == 13) {
2960  nLayers++;
2961  used[layer] = true;
2962  simHitsV[layer].push_back(simHitIt);
2963  }
2964  }
2965  }
2966  LogTrace("CSCTriggerPrimitivesReader") << "CSC in ME" << ((endcap == 1) ? "+" : "-") << station << "/" << ring
2967  << "/" << chamber << " has muon hits in " << nLayers << " layers";
2968 
2969  // If the number of layers with hits is above threshold, look for
2970  // a presence of LCTs.
2971  if (nLayers > 3) { // Should be a parameter.
2972  // Start with the key layer and take the eta of the first hit.
2973  // Really crude; should be improved.
2974  double hitEta = -999.;
2975  for (int ilayer = 2; ilayer < CSCConstants::NUM_LAYERS; ilayer++) {
2976  vector<PSimHit> layerSimHitsV = simHitsV[ilayer];
2977  if (!layerSimHitsV.empty()) {
2978  LocalPoint hitLP = layerSimHitsV[0].localPosition();
2979  CSCDetId layerId = (CSCDetId)(layerSimHitsV[0]).detUnitId();
2980  const CSCLayer* csclayer = geom_->layer(layerId);
2981  GlobalPoint hitGP = csclayer->toGlobal(hitLP);
2982  hitEta = hitGP.eta();
2983  break;
2984  }
2985  }
2986  if (hitEta < -3.) {
2987  edm::LogWarning("L1CSCTPEmulatorWrongValues") << "+++ Warning in calcEfficiency(): no SimHit found"
2988  << " where there must be at least " << nLayers << "! +++\n";
2989  continue;
2990  }
2991  int csctype = getCSCType(*chamberIdIt);
2992  hEfficHitsEta[station - 1]->Fill(fabs(hitEta));
2993  hEfficHitsEtaCsc[csctype]->Fill(fabs(hitEta));
2994 
2995  bool isALCT = false;
2996  for (auto adetUnitIt = alcts->begin(); adetUnitIt != alcts->end(); adetUnitIt++) {
2997  const CSCDetId& id = (*adetUnitIt).first;
2998  if (id == (*chamberIdIt)) {
2999  const auto& range = (*adetUnitIt).second;
3000  for (auto digiIt = range.first; digiIt != range.second; digiIt++) {
3001  if (digiIt->isValid()) {
3002  // Check the distance??
3003  LogTrace("CSCTriggerPrimitivesReader") << "ALCT was found";
3004  isALCT = true;
3005  break;
3006  }
3007  }
3008  }
3009  if (isALCT)
3010  break;
3011  }
3012  if (isALCT) {
3013  hEfficALCTEta[station - 1]->Fill(fabs(hitEta));
3014  hEfficALCTEtaCsc[csctype]->Fill(fabs(hitEta));
3015  } else {
3016  LogTrace("CSCTriggerPrimitivesReader") << "ALCT was not found";
3017  }
3018 
3019  bool isCLCT = false;
3020  for (auto cdetUnitIt = clcts->begin(); cdetUnitIt != clcts->end(); cdetUnitIt++) {
3021  const CSCDetId& id = (*cdetUnitIt).first;
3022  if (id == (*chamberIdIt)) {
3023  const auto& range = (*cdetUnitIt).second;
3024  for (auto digiIt = range.first; digiIt != range.second; digiIt++) {
3025  if (digiIt->isValid()) {
3026  // Check the distance??
3027  LogTrace("CSCTriggerPrimitivesReader") << "CLCT was found";
3028  isCLCT = true;
3029  break;
3030  }
3031  }
3032  }
3033  if (isCLCT)
3034  break;
3035  }
3036  if (isCLCT) {
3037  hEfficCLCTEta[station - 1]->Fill(fabs(hitEta));
3038  hEfficCLCTEtaCsc[csctype]->Fill(fabs(hitEta));
3039  } else {
3040  LogTrace("CSCTriggerPrimitivesReader") << "CLCT was not found";
3041  }
3042  }
3043  }
3044 }
3045 
3047  TCanvas* c1 = new TCanvas("c1", "", 0, 0, 500, 640);
3048  string fname = resultsFileNamesPrefix_ + "alcts.ps";
3049  TPostScript* ps = new TPostScript(fname.c_str(), 111);
3050 
3051  TPad* pad[MAXPAGES];
3052  for (int i_page = 0; i_page < MAXPAGES; i_page++) {
3053  pad[i_page] = new TPad("", "", .05, .05, .93, .93);
3054  }
3055 
3056  int page = 1;
3057  TText t;
3058  t.SetTextFont(32);
3059  t.SetTextSize(0.025);
3060  char pagenum[7], titl[50];
3061  TPaveLabel* title;
3062 
3063  int max_idh = plotME42 ? CSC_TYPES : CSC_TYPES - 1;
3064 
3065  ps->NewPage();
3066  c1->Clear();
3067  c1->cd(0);
3068  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "Number of ALCTs");
3069  title->SetFillColor(10);
3070  title->Draw();
3071  sprintf(pagenum, "- %d -", page);
3072  t.DrawText(0.9, 0.02, pagenum);
3073  gStyle->SetOptStat(111110);
3074  pad[page]->Draw();
3075  pad[page]->Divide(1, 3);
3076  pad[page]->cd(1);
3077  hAlctPerEvent->Draw();
3078  pad[page]->cd(2);
3079  hAlctPerChamber->Draw();
3080  for (int i = 0; i < CSC_TYPES; i++) {
3081  hAlctPerCSC->GetXaxis()->SetBinLabel(i + 1, csc_type[i].c_str());
3082  }
3083  // Should be multiplied by 40/nevents to convert to MHz
3084  pad[page]->cd(3);
3085  hAlctPerCSC->Draw();
3086  page++;
3087  c1->Update();
3088 
3089  for (int endc = 0; endc < MAX_ENDCAPS; endc++) {
3090  ps->NewPage();
3091  c1->Clear();
3092  c1->cd(0);
3093  sprintf(titl, "ALCTs per chamber, endcap %d", endc + 1);
3094  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, titl);
3095  title->SetFillColor(10);
3096  title->Draw();
3097  sprintf(pagenum, "- %d -", page);
3098  t.DrawText(0.9, 0.02, pagenum);
3099  gStyle->SetOptStat(10);
3100  pad[page]->Draw();
3101  pad[page]->Divide(2, 5);
3102  for (int idh = 0; idh < max_idh; idh++) {
3103  if (!plotME1A && idh == 3)
3104  continue;
3105  hAlctCsc[endc][idh]->SetMinimum(0.0);
3106  pad[page]->cd(idh + 1);
3107  hAlctCsc[endc][idh]->Draw();
3108  }
3109  page++;
3110  c1->Update();
3111  }
3112 
3113  ps->NewPage();
3114  c1->Clear();
3115  c1->cd(0);
3116  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "ALCT quantities");
3117  title->SetFillColor(10);
3118  title->Draw();
3119  sprintf(pagenum, "- %d -", page);
3120  t.DrawText(0.9, 0.02, pagenum);
3121  gStyle->SetOptStat(111110);
3122  pad[page]->Draw();
3123  pad[page]->Divide(2, 3);
3124  pad[page]->cd(1);
3125  hAlctValid->Draw();
3126  pad[page]->cd(2);
3127  hAlctQuality->Draw();
3128  pad[page]->cd(3);
3129  hAlctAccel->Draw();
3130  pad[page]->cd(4);
3131  hAlctCollis->Draw();
3132  pad[page]->cd(5);
3133  hAlctKeyGroup->Draw();
3134  pad[page]->cd(6);
3135  hAlctBXN->Draw();
3136  page++;
3137  c1->Update();
3138 
3139  ps->Close();
3140  delete c1;
3141 }
3142 
3144  TCanvas* c1 = new TCanvas("c1", "", 0, 0, 500, 640);
3145  string fname = resultsFileNamesPrefix_ + "clcts.ps";
3146  TPostScript* ps = new TPostScript(fname.c_str(), 111);
3147 
3148  TPad* pad[MAXPAGES];
3149  for (int i_page = 0; i_page < MAXPAGES; i_page++) {
3150  pad[i_page] = new TPad("", "", .05, .05, .93, .93);
3151  }
3152 
3153  int page = 1;
3154  TText t;
3155  t.SetTextFont(32);
3156  t.SetTextSize(0.025);
3157  char pagenum[7], titl[50];
3158  TPaveLabel* title;
3159 
3160  ps->NewPage();
3161  c1->Clear();
3162  c1->cd(0);
3163  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "Number of CLCTs");
3164  title->SetFillColor(10);
3165  title->Draw();
3166  sprintf(pagenum, "- %d -", page);
3167  t.DrawText(0.9, 0.02, pagenum);
3168  gStyle->SetOptStat(111110);
3169  pad[page]->Draw();
3170  pad[page]->Divide(1, 3);
3171  pad[page]->cd(1);
3172  hClctPerEvent->Draw();
3173 
3174  int max_idh = plotME42 ? CSC_TYPES : CSC_TYPES - 1;
3175 
3176  edm::LogInfo("CSCTriggerPrimitivesReader") << "\n";
3177  int nbins = hClctPerChamber->GetNbinsX();
3178  for (int ibin = 1; ibin <= nbins; ibin++) {
3179  double f_bin = hClctPerChamber->GetBinContent(ibin);
3180  edm::LogInfo("CSCTriggerPrimitivesReader") << " # CLCTs/chamber: " << ibin - 1 << "; events: " << f_bin << endl;
3181  }
3182 
3183  pad[page]->cd(2);
3184  hClctPerChamber->Draw();
3185  for (int i = 0; i < CSC_TYPES; i++) {
3186  hClctPerCSC->GetXaxis()->SetBinLabel(i + 1, csc_type[i].c_str());
3187  }
3188  // Should be multiplied by 40/nevents to convert to MHz
3189  pad[page]->cd(3);
3190  hClctPerCSC->Draw();
3191  page++;
3192  c1->Update();
3193 
3194  for (int endc = 0; endc < MAX_ENDCAPS; endc++) {
3195  ps->NewPage();
3196  c1->Clear();
3197  c1->cd(0);
3198  sprintf(titl, "CLCTs per chamber, endcap %d", endc + 1);
3199  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, titl);
3200  title->SetFillColor(10);
3201  title->Draw();
3202  sprintf(pagenum, "- %d -", page);
3203  t.DrawText(0.9, 0.02, pagenum);
3204  gStyle->SetOptStat(10);
3205  pad[page]->Draw();
3206  pad[page]->Divide(2, 5);
3207  for (int idh = 0; idh < max_idh; idh++) {
3208  if (!plotME1A && idh == 3)
3209  continue;
3210  hClctCsc[endc][idh]->SetMinimum(0.0);
3211  pad[page]->cd(idh + 1);
3212  hClctCsc[endc][idh]->Draw();
3213  }
3214  page++;
3215  c1->Update();
3216  }
3217 
3218  ps->NewPage();
3219  c1->Clear();
3220  c1->cd(0);
3221  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "CLCT quantities");
3222  title->SetFillColor(10);
3223  title->Draw();
3224  sprintf(pagenum, "- %d -", page);
3225  t.DrawText(0.9, 0.02, pagenum);
3226  gStyle->SetOptStat(111110);
3227  pad[page]->Draw();
3228  pad[page]->Divide(2, 4);
3229  pad[page]->cd(1);
3230  hClctValid->Draw();
3231  pad[page]->cd(2);
3232  hClctQuality->Draw();
3233  pad[page]->cd(3);
3234  hClctSign->Draw();
3235  hClctPattern[1]->SetTitle("CLCT pattern #");
3236  pad[page]->cd(4);
3237  hClctPattern[1]->Draw();
3238  pad[page]->cd(5);
3239  hClctCFEB->Draw();
3240  pad[page]->cd(7);
3241  hClctKeyStrip[1]->Draw();
3242  pad[page]->cd(8);
3243  hClctBXN->Draw();
3244  page++;
3245  c1->Update();
3246 
3247  ps->NewPage();
3248  c1->Clear();
3249  c1->cd(0);
3250  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "CLCT bend for various chamber types, halfstrips");
3251  title->SetFillColor(10);
3252  title->Draw();
3253  sprintf(pagenum, "- %d -", page);
3254  t.DrawText(0.9, 0.02, pagenum);
3255  gStyle->SetOptStat(110);
3256  pad[page]->Draw();
3257  pad[page]->Divide(2, 5);
3258  for (int idh = 0; idh < max_idh; idh++) {
3259  if (!plotME1A && idh == 3)
3260  continue;
3261  pad[page]->cd(idh + 1);
3262  hClctBendCsc[idh][1]->GetXaxis()->SetTitle("Pattern bend");
3263  hClctBendCsc[idh][1]->GetYaxis()->SetTitle("Number of LCTs");
3264  hClctBendCsc[idh][1]->Draw();
3265  }
3266  page++;
3267  c1->Update();
3268 
3269  ps->Close();
3270  delete c1;
3271 }
3272 
3274  TCanvas* c1 = new TCanvas("c1", "", 0, 0, 500, 640);
3275  string fname = resultsFileNamesPrefix_ + "lcts_tmb.ps";
3276  TPostScript* ps = new TPostScript(fname.c_str(), 111);
3277 
3278  TPad* pad[MAXPAGES];
3279  for (int i_page = 0; i_page < MAXPAGES; i_page++) {
3280  pad[i_page] = new TPad("", "", .05, .05, .93, .93);
3281  }
3282 
3283  int page = 1;
3284  TText t;
3285  t.SetTextFont(32);
3286  t.SetTextSize(0.025);
3287  char pagenum[7], titl[50];
3288  TPaveLabel* title;
3289 
3290  int max_idh = plotME42 ? CSC_TYPES : CSC_TYPES - 1;
3291 
3292  ps->NewPage();
3293  c1->Clear();
3294  c1->cd(0);
3295  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "Number of LCTs");
3296  title->SetFillColor(10);
3297  title->Draw();
3298  sprintf(pagenum, "- %d -", page);
3299  t.DrawText(0.9, 0.02, pagenum);
3300  gStyle->SetOptStat(111110);
3301  pad[page]->Draw();
3302  pad[page]->Divide(2, 2);
3303  pad[page]->cd(1);
3304  hLctTMBPerEvent->Draw();
3305  pad[page]->cd(2);
3306  hLctTMBPerChamber->Draw();
3307  c1->Update();
3308  for (int i = 0; i < CSC_TYPES; i++) {
3309  hLctTMBPerCSC->GetXaxis()->SetBinLabel(i + 1, csc_type[i].c_str());
3310  hCorrLctTMBPerCSC->GetXaxis()->SetBinLabel(i + 1, csc_type[i].c_str());
3311  }
3312  // Should be multiplied by 40/nevents to convert to MHz
3313  pad[page]->cd(3);
3314  hLctTMBPerCSC->Draw();
3315  pad[page]->cd(4);
3316  hCorrLctTMBPerCSC->Draw();
3317  gStyle->SetOptStat(1110);
3318  page++;
3319  c1->Update();
3320 
3321  ps->NewPage();
3322  c1->Clear();
3323  c1->cd(0);
3324  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "LCT geometry");
3325  title->SetFillColor(10);
3326  title->Draw();
3327  sprintf(pagenum, "- %d -", page);
3328  t.DrawText(0.9, 0.02, pagenum);
3329  gStyle->SetOptStat(110110);
3330  pad[page]->Draw();
3331  pad[page]->Divide(2, 4);
3332  pad[page]->cd(1);
3333  hLctTMBEndcap->Draw();
3334  pad[page]->cd(2);
3335  hLctTMBStation->Draw();
3336  pad[page]->cd(3);
3337  hLctTMBSector->Draw();
3338  pad[page]->cd(4);
3339  hLctTMBRing->Draw();
3340  for (int istat = 0; istat < MAX_STATIONS; istat++) {
3341  pad[page]->cd(istat + 5);
3342  hLctTMBChamber[istat]->Draw();
3343  }
3344  page++;
3345  c1->Update();
3346 
3347  for (int endc = 0; endc < MAX_ENDCAPS; endc++) {
3348  ps->NewPage();
3349  c1->Clear();
3350  c1->cd(0);
3351  sprintf(titl, "LCTs per chamber, endcap %d", endc + 1);
3352  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, titl);
3353  title->SetFillColor(10);
3354  title->Draw();
3355  sprintf(pagenum, "- %d -", page);
3356  t.DrawText(0.9, 0.02, pagenum);
3357  gStyle->SetOptStat(10);
3358  pad[page]->Draw();
3359  pad[page]->Divide(2, 5);
3360  for (int idh = 0; idh < max_idh; idh++) {
3361  if (!plotME1A && idh == 3)
3362  continue;
3363  hLctTMBCsc[endc][idh]->SetMinimum(0.0);
3364  pad[page]->cd(idh + 1);
3365  hLctTMBCsc[endc][idh]->Draw();
3366  }
3367  page++;
3368  c1->Update();
3369  }
3370 
3371  ps->NewPage();
3372  c1->Clear();
3373  c1->cd(0);
3374  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "LCT quantities");
3375  title->SetFillColor(10);
3376  title->Draw();
3377  sprintf(pagenum, "- %d -", page);
3378  t.DrawText(0.9, 0.02, pagenum);
3379  gStyle->SetOptStat(110110);
3380  pad[page]->Draw();
3381  pad[page]->Divide(2, 4);
3382  pad[page]->cd(1);
3383  hLctTMBValid->Draw();
3384  pad[page]->cd(2);
3385  hLctTMBQuality->Draw();
3386  pad[page]->cd(3);
3387  hLctTMBKeyGroup->Draw();
3388  pad[page]->cd(4);
3389  hLctTMBKeyStrip->Draw();
3390  pad[page]->cd(5);
3391  hLctTMBStripType->Draw();
3392  pad[page]->cd(6);
3393  hLctTMBPattern->Draw();
3394  pad[page]->cd(7);
3395  hLctTMBBend->Draw();
3396  pad[page]->cd(8);
3397  hLctTMBBXN->Draw();
3398  page++;
3399  c1->Update();
3400 
3401  ps->Close();
3402  delete c1;
3403 }
3404 
3406  TCanvas* c1 = new TCanvas("c1", "", 0, 0, 500, 640);
3407  string fname = resultsFileNamesPrefix_ + "lcts_mpc.ps";
3408  TPostScript* ps = new TPostScript(fname.c_str(), 111);
3409 
3410  TPad* pad[MAXPAGES];
3411  for (int i_page = 0; i_page < MAXPAGES; i_page++) {
3412  pad[i_page] = new TPad("", "", .05, .05, .93, .93);
3413  }
3414 
3415  int page = 1;
3416  TText t;
3417  t.SetTextFont(32);
3418  t.SetTextSize(0.025);
3419  char pagenum[7];
3420  TPaveLabel* title;
3421 
3422  ps->NewPage();
3423  c1->Clear();
3424  c1->cd(0);
3425  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "Number of LCTs");
3426  title->SetFillColor(10);
3427  title->Draw();
3428  sprintf(pagenum, "- %d -", page);
3429  t.DrawText(0.9, 0.02, pagenum);
3430  gStyle->SetOptStat(111110);
3431  pad[page]->Draw();
3432  pad[page]->Divide(1, 3);
3433  pad[page]->cd(1);
3434  hLctMPCPerEvent->Draw();
3435  for (int i = 0; i < CSC_TYPES; i++) {
3436  hLctMPCPerCSC->GetXaxis()->SetBinLabel(i + 1, csc_type[i].c_str());
3437  hCorrLctMPCPerCSC->GetXaxis()->SetBinLabel(i + 1, csc_type[i].c_str());
3438  }
3439  // Should be multiplied by 40/nevents to convert to MHz
3440  pad[page]->cd(2);
3441  hLctMPCPerCSC->Draw();
3442  pad[page]->cd(3);
3443  hCorrLctMPCPerCSC->Draw();
3444  page++;
3445  c1->Update();
3446 
3447  ps->NewPage();
3448  c1->Clear();
3449  c1->cd(0);
3450  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "LCT geometry");
3451  title->SetFillColor(10);
3452  title->Draw();
3453  sprintf(pagenum, "- %d -", page);
3454  t.DrawText(0.9, 0.02, pagenum);
3455  gStyle->SetOptStat(110110);
3456  pad[page]->Draw();
3457  pad[page]->Divide(2, 4);
3458  pad[page]->cd(1);
3459  hLctMPCEndcap->Draw();
3460  pad[page]->cd(2);
3461  hLctMPCStation->Draw();
3462  pad[page]->cd(3);
3463  hLctMPCSector->Draw();
3464  pad[page]->cd(4);
3465  hLctMPCRing->Draw();
3466  for (int istat = 0; istat < MAX_STATIONS; istat++) {
3467  pad[page]->cd(istat + 5);
3468  hLctMPCChamber[istat]->Draw();
3469  }
3470  page++;
3471  c1->Update();
3472 
3473  ps->NewPage();
3474  c1->Clear();
3475  c1->cd(0);
3476  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "LCT quantities");
3477  title->SetFillColor(10);
3478  title->Draw();
3479  sprintf(pagenum, "- %d -", page);
3480  t.DrawText(0.9, 0.02, pagenum);
3481  pad[page]->Draw();
3482  pad[page]->Divide(2, 4);
3483  pad[page]->cd(1);
3484  hLctMPCValid->Draw();
3485  pad[page]->cd(2);
3486  hLctMPCQuality->Draw();
3487  pad[page]->cd(3);
3488  hLctMPCKeyGroup->Draw();
3489  pad[page]->cd(4);
3490  hLctMPCKeyStrip->Draw();
3491  pad[page]->cd(5);
3492  hLctMPCStripType->Draw();
3493  pad[page]->cd(6);
3494  hLctMPCPattern->Draw();
3495  pad[page]->cd(7);
3496  hLctMPCBend->Draw();
3497  pad[page]->cd(8);
3498  hLctMPCBXN->Draw();
3499  page++;
3500  c1->Update();
3501 
3502  ps->Close();
3503  delete c1;
3504 }
3505 
3507  TCanvas* c1 = new TCanvas("c1", "", 0, 0, 500, 640);
3508  string fname = resultsFileNamesPrefix_ + "lcts_comp.ps";
3509  TPostScript* ps = new TPostScript(fname.c_str(), 111);
3510 
3511  TPad* pad[MAXPAGES];
3512  for (int i_page = 0; i_page < MAXPAGES; i_page++) {
3513  pad[i_page] = new TPad("", "", .05, .05, .93, .93);
3514  }
3515 
3516  int page = 1;
3517  TText t;
3518  t.SetTextFont(32);
3519  t.SetTextSize(0.025);
3520  char pagenum[15];
3521  TPaveLabel* title;
3522  Int_t nbins;
3523 
3524  TText teff;
3525  teff.SetTextFont(32);
3526  teff.SetTextSize(0.08);
3527  char eff[25], titl[60];
3528 
3529  int max_idh = plotME42 ? CSC_TYPES : CSC_TYPES - 1;
3530 
3531  for (int endc = 0; endc < MAX_ENDCAPS; endc++) { // endcaps
3532  ps->NewPage();
3533  c1->Clear();
3534  c1->cd(0);
3535  sprintf(titl, "ALCT firmware-emulator: match in number found, endcap %d", endc + 1);
3536  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, titl);
3537  title->SetFillColor(10);
3538  title->Draw();
3539  sprintf(pagenum, "- %d -", page);
3540  t.DrawText(0.9, 0.02, pagenum);
3541  //gStyle->SetOptStat(110010);
3542  gStyle->SetOptStat(0);
3543  pad[page]->Draw();
3544  pad[page]->Divide(2, 5);
3545  TH1F* hAlctFoundEffVsCsc[MAX_ENDCAPS][CSC_TYPES];
3546  for (int idh = 0; idh < max_idh; idh++) {
3547  if (!plotME1A && idh == 3)
3548  continue;
3549  hAlctFoundEffVsCsc[endc][idh] = (TH1F*)hAlctCompFoundCsc[endc][idh]->Clone();
3550  hAlctFoundEffVsCsc[endc][idh]->Divide(hAlctCompSameNCsc[endc][idh], hAlctCompFoundCsc[endc][idh], 1., 1., "B");
3551  nbins = hAlctCompFoundCsc[endc][idh]->GetNbinsX();
3552  for (Int_t ibin = 1; ibin <= nbins; ibin++) {
3553  if (hAlctCompFoundCsc[endc][idh]->GetBinContent(ibin) == 0) {
3554  hAlctFoundEffVsCsc[endc][idh]->SetBinContent(ibin, -1.);
3555  hAlctFoundEffVsCsc[endc][idh]->SetBinError(ibin, 0.);
3556  }
3557  }
3558  gPad->Update();
3559  gStyle->SetStatX(0.65);
3560  hAlctFoundEffVsCsc[endc][idh]->SetMinimum(-0.05);
3561  hAlctFoundEffVsCsc[endc][idh]->SetMaximum(1.05);
3562  hAlctFoundEffVsCsc[endc][idh]->GetXaxis()->SetTitleOffset(0.7);
3563  hAlctFoundEffVsCsc[endc][idh]->GetYaxis()->SetTitleOffset(0.8);
3564  hAlctFoundEffVsCsc[endc][idh]->GetXaxis()->SetLabelSize(0.06); // default=0.04
3565  hAlctFoundEffVsCsc[endc][idh]->GetYaxis()->SetLabelSize(0.06); // default=0.04
3566  hAlctFoundEffVsCsc[endc][idh]->GetXaxis()->SetTitleSize(0.07); // default=0.05
3567  hAlctFoundEffVsCsc[endc][idh]->GetYaxis()->SetTitleSize(0.07); // default=0.05
3568  hAlctFoundEffVsCsc[endc][idh]->GetXaxis()->SetTitle("CSC id");
3569  hAlctFoundEffVsCsc[endc][idh]->GetYaxis()->SetTitle("% of same number found");
3570  pad[page]->cd(idh + 1);
3571  hAlctFoundEffVsCsc[endc][idh]->Draw("e");
3572  double numer = hAlctCompSameNCsc[endc][idh]->Integral();
3573  double denom = hAlctCompFoundCsc[endc][idh]->Integral();
3574  double ratio = 0.0, error = 0.0;
3575  if (denom > 0.) {
3576  ratio = numer / denom;
3577  error = sqrt(ratio * (1. - ratio) / denom);
3578  }
3579  sprintf(eff, "eff = (%4.1f +/- %4.1f)%%", ratio * 100., error * 100.);
3580  teff.DrawTextNDC(0.3, 0.5, eff);
3581  }
3582  page++;
3583  c1->Update();
3584  }
3585 
3586  for (int endc = 0; endc < MAX_ENDCAPS; endc++) { // endcaps
3587  ps->NewPage();
3588  c1->Clear();
3589  c1->cd(0);
3590  sprintf(titl, "ALCT firmware-emulator: exact match, endcap %d", endc + 1);
3591  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, titl);
3592  title->SetFillColor(10);
3593  title->Draw();
3594  sprintf(pagenum, "- %d -", page);
3595  t.DrawText(0.9, 0.02, pagenum);
3596  //gStyle->SetOptStat(110010);
3597  gStyle->SetOptStat(0);
3598  pad[page]->Draw();
3599  pad[page]->Divide(2, 5);
3600  TH1F* hAlctMatchEffVsCsc[MAX_ENDCAPS][CSC_TYPES];
3601  for (int idh = 0; idh < max_idh; idh++) {
3602  if (!plotME1A && idh == 3)
3603  continue;
3604  hAlctMatchEffVsCsc[endc][idh] = (TH1F*)hAlctCompTotalCsc[endc][idh]->Clone();
3605  hAlctMatchEffVsCsc[endc][idh]->Divide(hAlctCompMatchCsc[endc][idh], hAlctCompTotalCsc[endc][idh], 1., 1., "B");
3606  nbins = hAlctCompTotalCsc[endc][idh]->GetNbinsX();
3607  for (Int_t ibin = 1; ibin <= nbins; ibin++) {
3608  if (hAlctCompTotalCsc[endc][idh]->GetBinContent(ibin) == 0) {
3609  hAlctMatchEffVsCsc[endc][idh]->SetBinContent(ibin, -1.);
3610  hAlctMatchEffVsCsc[endc][idh]->SetBinError(ibin, 0.);
3611  }
3612  }
3613  gPad->Update();
3614  gStyle->SetStatX(0.65);
3615  hAlctMatchEffVsCsc[endc][idh]->SetMinimum(-0.05);
3616  hAlctMatchEffVsCsc[endc][idh]->SetMaximum(1.05);
3617  hAlctMatchEffVsCsc[endc][idh]->GetXaxis()->SetTitleOffset(0.7);
3618  hAlctMatchEffVsCsc[endc][idh]->GetYaxis()->SetTitleOffset(0.8);
3619  hAlctMatchEffVsCsc[endc][idh]->GetXaxis()->SetLabelSize(0.06);
3620  hAlctMatchEffVsCsc[endc][idh]->GetYaxis()->SetLabelSize(0.06);
3621  hAlctMatchEffVsCsc[endc][idh]->GetXaxis()->SetTitleSize(0.07);
3622  hAlctMatchEffVsCsc[endc][idh]->GetYaxis()->SetTitleSize(0.07);
3623  hAlctMatchEffVsCsc[endc][idh]->GetXaxis()->SetTitle("CSC id");
3624  hAlctMatchEffVsCsc[endc][idh]->GetYaxis()->SetTitle("% of exact match");
3625  pad[page]->cd(idh + 1);
3626  hAlctMatchEffVsCsc[endc][idh]->Draw("e");
3627  double numer = hAlctCompMatchCsc[endc][idh]->Integral();
3628  double denom = hAlctCompTotalCsc[endc][idh]->Integral();
3629  double ratio = 0.0, error = 0.0;
3630  if (denom > 0.) {
3631  ratio = numer / denom;
3632  error = sqrt(ratio * (1. - ratio) / denom);
3633  }
3634  sprintf(eff, "eff = (%4.1f +/- %4.1f)%%", ratio * 100., error * 100.);
3635  teff.DrawTextNDC(0.3, 0.5, eff);
3636  }
3637  page++;
3638  c1->Update();
3639  }
3640 
3641  for (int endc = 0; endc < MAX_ENDCAPS; endc++) {
3642  ps->NewPage();
3643  c1->Clear();
3644  c1->cd(0);
3645  sprintf(titl, "CLCT firmware-emulator: match in number found, endcap %d", endc + 1);
3646  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, titl);
3647  title->SetFillColor(10);
3648  title->Draw();
3649  sprintf(pagenum, "- %d -", page);
3650  t.DrawText(0.9, 0.02, pagenum);
3651  //gStyle->SetOptStat(110010);
3652  gStyle->SetOptStat(0);
3653  pad[page]->Draw();
3654  pad[page]->Divide(2, 5);
3655  TH1F* hClctFoundEffVsCsc[MAX_ENDCAPS][CSC_TYPES];
3656  for (int idh = 0; idh < max_idh; idh++) {
3657  if (!plotME1A && idh == 3)
3658  continue;
3659  hClctFoundEffVsCsc[endc][idh] = (TH1F*)hClctCompFoundCsc[endc][idh]->Clone();
3660  hClctFoundEffVsCsc[endc][idh]->Divide(hClctCompSameNCsc[endc][idh], hClctCompFoundCsc[endc][idh], 1., 1., "B");
3661  nbins = hClctCompFoundCsc[endc][idh]->GetNbinsX();
3662  for (Int_t ibin = 1; ibin <= nbins; ibin++) {
3663  if (hClctCompFoundCsc[endc][idh]->GetBinContent(ibin) == 0) {
3664  hClctFoundEffVsCsc[endc][idh]->SetBinContent(ibin, -1.);
3665  hClctFoundEffVsCsc[endc][idh]->SetBinError(ibin, 0.);
3666  }
3667  }
3668  gPad->Update();
3669  gStyle->SetStatX(0.65);
3670  hClctFoundEffVsCsc[endc][idh]->SetMinimum(-0.05);
3671  hClctFoundEffVsCsc[endc][idh]->SetMaximum(1.05);
3672  hClctFoundEffVsCsc[endc][idh]->GetXaxis()->SetTitleOffset(0.7);
3673  hClctFoundEffVsCsc[endc][idh]->GetYaxis()->SetTitleOffset(0.8);
3674  hClctFoundEffVsCsc[endc][idh]->GetXaxis()->SetLabelSize(0.06);
3675  hClctFoundEffVsCsc[endc][idh]->GetYaxis()->SetLabelSize(0.06);
3676  hClctFoundEffVsCsc[endc][idh]->GetXaxis()->SetTitleSize(0.07);
3677  hClctFoundEffVsCsc[endc][idh]->GetYaxis()->SetTitleSize(0.07);
3678  hClctFoundEffVsCsc[endc][idh]->GetXaxis()->SetTitle("CSC id");
3679  hClctFoundEffVsCsc[endc][idh]->GetYaxis()->SetTitle("% of same number found");
3680  pad[page]->cd(idh + 1);
3681  hClctFoundEffVsCsc[endc][idh]->Draw("e");
3682  double numer = hClctCompSameNCsc[endc][idh]->Integral();
3683  double denom = hClctCompFoundCsc[endc][idh]->Integral();
3684  double ratio = 0.0, error = 0.0;
3685  if (denom > 0.) {
3686  ratio = numer / denom;
3687  error = sqrt(ratio * (1. - ratio) / denom);
3688  }
3689  sprintf(eff, "eff = (%4.1f +/- %4.1f)%%", ratio * 100., error * 100.);
3690  teff.DrawTextNDC(0.3, 0.5, eff);
3691  }
3692  page++;
3693  c1->Update();
3694  }
3695 
3696  for (int endc = 0; endc < MAX_ENDCAPS; endc++) {
3697  ps->NewPage();
3698  c1->Clear();
3699  c1->cd(0);
3700  sprintf(titl, "CLCT firmware-emulator: exact match, endcap %d", endc + 1);
3701  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, titl);
3702  title->SetFillColor(10);
3703  title->Draw();
3704  sprintf(pagenum, "- %d -", page);
3705  t.DrawText(0.9, 0.02, pagenum);
3706  //gStyle->SetOptStat(110010);
3707  gStyle->SetOptStat(0);
3708  pad[page]->Draw();
3709  pad[page]->Divide(2, 5);
3710  TH1F* hClctMatchEffVsCsc[MAX_ENDCAPS][CSC_TYPES];
3711  for (int idh = 0; idh < max_idh; idh++) {
3712  if (!plotME1A && idh == 3)
3713  continue;
3714  hClctMatchEffVsCsc[endc][idh] = (TH1F*)hClctCompTotalCsc[endc][idh]->Clone();
3715  hClctMatchEffVsCsc[endc][idh]->Divide(hClctCompMatchCsc[endc][idh], hClctCompTotalCsc[endc][idh], 1., 1., "B");
3716  nbins = hClctCompTotalCsc[endc][idh]->GetNbinsX();
3717  for (Int_t ibin = 1; ibin <= nbins; ibin++) {
3718  if (hClctCompTotalCsc[endc][idh]->GetBinContent(ibin) == 0) {
3719  hClctMatchEffVsCsc[endc][idh]->SetBinContent(ibin, -1.);
3720  hClctMatchEffVsCsc[endc][idh]->SetBinError(ibin, 0.);
3721  }
3722  }
3723  gPad->Update();
3724  gStyle->SetStatX(0.65);
3725  hClctMatchEffVsCsc[endc][idh]->SetMinimum(-0.05);
3726  hClctMatchEffVsCsc[endc][idh]->SetMaximum(1.05);
3727  hClctMatchEffVsCsc[endc][idh]->GetXaxis()->SetTitleOffset(0.7);
3728  hClctMatchEffVsCsc[endc][idh]->GetYaxis()->SetTitleOffset(0.8);
3729  hClctMatchEffVsCsc[endc][idh]->GetXaxis()->SetLabelSize(0.06);
3730  hClctMatchEffVsCsc[endc][idh]->GetYaxis()->SetLabelSize(0.06);
3731  hClctMatchEffVsCsc[endc][idh]->GetXaxis()->SetTitleSize(0.07);
3732  hClctMatchEffVsCsc[endc][idh]->GetYaxis()->SetTitleSize(0.07);
3733  hClctMatchEffVsCsc[endc][idh]->GetXaxis()->SetTitle("CSC id");
3734  hClctMatchEffVsCsc[endc][idh]->GetYaxis()->SetTitle("% of exact match");
3735  pad[page]->cd(idh + 1);
3736  hClctMatchEffVsCsc[endc][idh]->Draw("e");
3737  double numer = hClctCompMatchCsc[endc][idh]->Integral();
3738  double denom = hClctCompTotalCsc[endc][idh]->Integral();
3739  double ratio = 0.0, error = 0.0;
3740  if (denom > 0.) {
3741  ratio = numer / denom;
3742  error = sqrt(ratio * (1. - ratio) / denom);
3743  }
3744  sprintf(eff, "eff = (%4.1f +/- %4.1f)%%", ratio * 100., error * 100.);
3745  teff.DrawTextNDC(0.3, 0.5, eff);
3746  }
3747  page++;
3748  c1->Update();
3749  }
3750 
3751  for (int endc = 0; endc < MAX_ENDCAPS; endc++) {
3752  ps->NewPage();
3753  c1->Clear();
3754  c1->cd(0);
3755  sprintf(titl, "LCT firmware-emulator: match in number found, endcap %d", endc + 1);
3756  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, titl);
3757  title->SetFillColor(10);
3758  title->Draw();
3759  sprintf(pagenum, "- %d -", page);
3760  t.DrawText(0.9, 0.02, pagenum);
3761  //gStyle->SetOptStat(110010);
3762  gStyle->SetOptStat(0);
3763  pad[page]->Draw();
3764  pad[page]->Divide(2, 5);
3765  TH1F* hLctFoundEffVsCsc[MAX_ENDCAPS][CSC_TYPES];
3766  for (int idh = 0; idh < max_idh; idh++) {
3767  if (!plotME1A && idh == 3)
3768  continue;
3769  hLctFoundEffVsCsc[endc][idh] = (TH1F*)hLctCompFoundCsc[endc][idh]->Clone();
3770  hLctFoundEffVsCsc[endc][idh]->Divide(hLctCompSameNCsc[endc][idh], hLctCompFoundCsc[endc][idh], 1., 1., "B");
3771  nbins = hLctCompFoundCsc[endc][idh]->GetNbinsX();
3772  for (Int_t ibin = 1; ibin <= nbins; ibin++) {
3773  if (hLctCompFoundCsc[endc][idh]->GetBinContent(ibin) == 0) {
3774  hLctFoundEffVsCsc[endc][idh]->SetBinContent(ibin, -1.);
3775  hLctFoundEffVsCsc[endc][idh]->SetBinError(ibin, 0.);
3776  }
3777  }
3778  gPad->Update();
3779  gStyle->SetStatX(0.65);
3780  hLctFoundEffVsCsc[endc][idh]->SetMinimum(-0.05);
3781  hLctFoundEffVsCsc[endc][idh]->SetMaximum(1.05);
3782  hLctFoundEffVsCsc[endc][idh]->GetXaxis()->SetTitleOffset(0.7);
3783  hLctFoundEffVsCsc[endc][idh]->GetYaxis()->SetTitleOffset(0.8);
3784  hLctFoundEffVsCsc[endc][idh]->GetXaxis()->SetLabelSize(0.06);
3785  hLctFoundEffVsCsc[endc][idh]->GetYaxis()->SetLabelSize(0.06);
3786  hLctFoundEffVsCsc[endc][idh]->GetXaxis()->SetTitleSize(0.07);
3787  hLctFoundEffVsCsc[endc][idh]->GetYaxis()->SetTitleSize(0.07);
3788  hLctFoundEffVsCsc[endc][idh]->GetXaxis()->SetTitle("CSC id");
3789  hLctFoundEffVsCsc[endc][idh]->GetYaxis()->SetTitle("% of same number found");
3790  pad[page]->cd(idh + 1);
3791  hLctFoundEffVsCsc[endc][idh]->Draw("e");
3792  double numer = hLctCompSameNCsc[endc][idh]->Integral();
3793  double denom = hLctCompFoundCsc[endc][idh]->Integral();
3794  double ratio = 0.0, error = 0.0;
3795  if (denom > 0.) {
3796  ratio = numer / denom;
3797  error = sqrt(ratio * (1. - ratio) / denom);
3798  }
3799  sprintf(eff, "eff = (%4.1f +/- %4.1f)%%", ratio * 100., error * 100.);
3800  teff.DrawTextNDC(0.3, 0.5, eff);
3801  }
3802  page++;
3803  c1->Update();
3804  }
3805 
3806  for (int endc = 0; endc < MAX_ENDCAPS; endc++) {
3807  ps->NewPage();
3808  c1->Clear();
3809  c1->cd(0);
3810  sprintf(titl, "LCT firmware-emulator: exact match, endcap %d", endc + 1);
3811  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, titl);
3812  title->SetFillColor(10);
3813  title->Draw();
3814  sprintf(pagenum, "- %d -", page);
3815  t.DrawText(0.9, 0.02, pagenum);
3816  //gStyle->SetOptStat(110010);
3817  gStyle->SetOptStat(0);
3818  pad[page]->Draw();
3819  pad[page]->Divide(2, 5);
3820  TH1F* hLctMatchEffVsCsc[MAX_ENDCAPS][CSC_TYPES];
3821  for (int idh = 0; idh < max_idh; idh++) {
3822  if (!plotME1A && idh == 3)
3823  continue;
3824  hLctMatchEffVsCsc[endc][idh] = (TH1F*)hLctCompTotalCsc[endc][idh]->Clone();
3825  hLctMatchEffVsCsc[endc][idh]->Divide(hLctCompMatchCsc[endc][idh], hLctCompTotalCsc[endc][idh], 1., 1., "B");
3826  nbins = hLctCompTotalCsc[endc][idh]->GetNbinsX();
3827  for (Int_t ibin = 1; ibin <= nbins; ibin++) {
3828  if (hLctCompTotalCsc[endc][idh]->GetBinContent(ibin) == 0) {
3829  hLctMatchEffVsCsc[endc][idh]->SetBinContent(ibin, -1.);
3830  hLctMatchEffVsCsc[endc][idh]->SetBinError(ibin, 0.);
3831  }
3832  }
3833  gPad->Update();
3834  gStyle->SetStatX(0.65);
3835  hLctMatchEffVsCsc[endc][idh]->SetMinimum(-0.05);
3836  hLctMatchEffVsCsc[endc][idh]->SetMaximum(1.05);
3837  hLctMatchEffVsCsc[endc][idh]->GetXaxis()->SetTitleOffset(0.7);
3838  hLctMatchEffVsCsc[endc][idh]->GetYaxis()->SetTitleOffset(0.8);
3839  hLctMatchEffVsCsc[endc][idh]->GetXaxis()->SetLabelSize(0.06);
3840  hLctMatchEffVsCsc[endc][idh]->GetYaxis()->SetLabelSize(0.06);
3841  hLctMatchEffVsCsc[endc][idh]->GetXaxis()->SetTitleSize(0.07);
3842  hLctMatchEffVsCsc[endc][idh]->GetYaxis()->SetTitleSize(0.07);
3843  hLctMatchEffVsCsc[endc][idh]->GetXaxis()->SetTitle("CSC id");
3844  hLctMatchEffVsCsc[endc][idh]->GetYaxis()->SetTitle("% of exact match");
3845  pad[page]->cd(idh + 1);
3846  hLctMatchEffVsCsc[endc][idh]->Draw("e");
3847  double numer = hLctCompMatchCsc[endc][idh]->Integral();
3848  double denom = hLctCompTotalCsc[endc][idh]->Integral();
3849  double ratio = 0.0, error = 0.0;
3850  if (denom > 0.) {
3851  ratio = numer / denom;
3852  error = sqrt(ratio * (1. - ratio) / denom);
3853  }
3854  sprintf(eff, "eff = (%4.1f +/- %4.1f)%%", ratio * 100., error * 100.);
3855  teff.DrawTextNDC(0.3, 0.5, eff);
3856  }
3857  page++;
3858  c1->Update();
3859  }
3860 
3861  ps->Close();
3862  delete c1;
3863 }
3864 
3866  TCanvas* c1 = new TCanvas("c1", "", 0, 0, 500, 640);
3867  string fname = resultsFileNamesPrefix_ + "lcts_resol.ps";
3868  TPostScript* ps = new TPostScript(fname.c_str(), 111);
3869 
3870  TPad* pad[MAXPAGES];
3871  for (int i_page = 0; i_page < MAXPAGES; i_page++) {
3872  pad[i_page] = new TPad("", "", .05, .05, .93, .93);
3873  }
3874 
3875  int page = 1;
3876  TText t;
3877  t.SetTextFont(32);
3878  t.SetTextSize(0.025);
3879  char pagenum[7];
3880  TPaveLabel* title;
3881 
3882  int max_idh = plotME42 ? CSC_TYPES : CSC_TYPES - 1;
3883 
3884  ps->NewPage();
3885  c1->Clear();
3886  c1->cd(0);
3887  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "ALCT resolution");
3888  title->SetFillColor(10);
3889  title->Draw();
3890  sprintf(pagenum, "- %d -", page);
3891  t.DrawText(0.9, 0.02, pagenum);
3892  gStyle->SetOptStat(111110);
3893  pad[page]->Draw();
3894  pad[page]->Divide(2, 2);
3895  gStyle->SetStatX(1.00);
3896  gStyle->SetStatY(0.65);
3897  pad[page]->cd(1);
3898  hEtaRecVsSim->SetMarkerSize(0.2);
3899  hEtaRecVsSim->Draw();
3900  gPad->Update();
3901  gStyle->SetStatX(1.00);
3902  gStyle->SetStatY(0.995);
3903  hResolDeltaWG->GetXaxis()->SetTitle("WG_{rec} - WG_{sim}");
3904  hResolDeltaWG->GetXaxis()->SetTitleOffset(1.2);
3905  hResolDeltaWG->GetYaxis()->SetTitle("Entries");
3906  hResolDeltaWG->GetYaxis()->SetTitleOffset(1.9);
3907  hResolDeltaWG->GetXaxis()->SetLabelSize(0.03);
3908  hResolDeltaWG->GetYaxis()->SetLabelSize(0.03);
3909  pad[page]->cd(3);
3910  hResolDeltaWG->Draw();
3911  hResolDeltaEta->GetXaxis()->SetNdivisions(505); // twice fewer divisions
3912  hResolDeltaEta->GetXaxis()->SetLabelSize(0.04);
3913  hResolDeltaEta->GetYaxis()->SetLabelSize(0.04);
3914  pad[page]->cd(4);
3915  hResolDeltaEta->Draw();
3916  hResolDeltaEta->Fit("gaus", "Q");
3917  page++;
3918  c1->Update();
3919 
3920  ps->NewPage();
3921  c1->Clear();
3922  c1->cd(0);
3923  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "#eta_rec-#eta_sim");
3924  title->SetFillColor(10);
3925  title->Draw();
3926  sprintf(pagenum, "- %d -", page);
3927  t.DrawText(0.9, 0.02, pagenum);
3928  pad[page]->Draw();
3929  pad[page]->Divide(2, 5);
3930  for (int idh = 0; idh < max_idh; idh++) {
3931  if (!plotME1A && idh == 3)
3932  continue;
3933  hEtaDiffCsc[idh][0]->GetXaxis()->SetLabelSize(0.07); // default=0.04
3934  hEtaDiffCsc[idh][0]->GetYaxis()->SetLabelSize(0.07);
3935  pad[page]->cd(idh + 1);
3936  hEtaDiffCsc[idh][0]->Draw();
3937  if (hEtaDiffCsc[idh][0]->GetEntries() > 1)
3938  hEtaDiffCsc[idh][0]->Fit("gaus", "Q");
3939  }
3940  page++;
3941  c1->Update();
3942 
3943  ps->NewPage();
3944  c1->Clear();
3945  c1->cd(0);
3946  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "#eta_rec-#eta_sim, endcap1");
3947  title->SetFillColor(10);
3948  title->Draw();
3949  sprintf(pagenum, "- %d -", page);
3950  t.DrawText(0.9, 0.02, pagenum);
3951  pad[page]->Draw();
3952  pad[page]->Divide(2, 5);
3953  for (int idh = 0; idh < max_idh; idh++) {
3954  if (!plotME1A && idh == 3)
3955  continue;
3956  hEtaDiffCsc[idh][1]->GetXaxis()->SetLabelSize(0.07); // default=0.04
3957  hEtaDiffCsc[idh][1]->GetYaxis()->SetLabelSize(0.07);
3958  pad[page]->cd(idh + 1);
3959  hEtaDiffCsc[idh][1]->Draw();
3960  if (hEtaDiffCsc[idh][1]->GetEntries() > 1)
3961  hEtaDiffCsc[idh][1]->Fit("gaus", "Q");
3962  }
3963  page++;
3964  c1->Update();
3965 
3966  ps->NewPage();
3967  c1->Clear();
3968  c1->cd(0);
3969  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "#eta_rec-#eta_sim, endcap2");
3970  title->SetFillColor(10);
3971  title->Draw();
3972  sprintf(pagenum, "- %d -", page);
3973  t.DrawText(0.9, 0.02, pagenum);
3974  pad[page]->Draw();
3975  pad[page]->Divide(2, 5);
3976  for (int idh = 0; idh < max_idh; idh++) {
3977  if (!plotME1A && idh == 3)
3978  continue;
3979  hEtaDiffCsc[idh][2]->GetXaxis()->SetLabelSize(0.07); // default=0.04
3980  hEtaDiffCsc[idh][2]->GetYaxis()->SetLabelSize(0.07);
3981  pad[page]->cd(idh + 1);
3982  hEtaDiffCsc[idh][2]->Draw();
3983  if (hEtaDiffCsc[idh][2]->GetEntries() > 1)
3984  hEtaDiffCsc[idh][2]->Fit("gaus", "Q");
3985  }
3986  page++;
3987  c1->Update();
3988 
3989  ps->NewPage();
3990  c1->Clear();
3991  c1->cd(0);
3992  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "#LT#eta_rec-#eta_sim#GT vs #eta_rec");
3993  title->SetFillColor(10);
3994  title->Draw();
3995  sprintf(pagenum, "- %d -", page);
3996  t.DrawText(0.9, 0.02, pagenum);
3997  //gStyle->SetOptStat(0);
3998  pad[page]->Draw();
3999  pad[page]->Divide(2, 2);
4000  TH1F* hMeanEtaDiffVsEta[MAX_STATIONS];
4001  for (int istation = 0; istation < MAX_STATIONS; istation++) {
4002  hMeanEtaDiffVsEta[istation] = (TH1F*)hEtaDiffVsEta[istation]->Clone();
4003  hMeanEtaDiffVsEta[istation]->Divide(hEtaDiffVsEta[istation], hAlctVsEta[istation], 1., 1.);
4004  hMeanEtaDiffVsEta[istation]->GetXaxis()->SetTitleOffset(1.2);
4005  hMeanEtaDiffVsEta[istation]->GetXaxis()->SetTitle("#eta");
4006  hMeanEtaDiffVsEta[istation]->SetMaximum(0.05);
4007  pad[page]->cd(istation + 1);
4008  hMeanEtaDiffVsEta[istation]->Draw();
4009  }
4010  page++;
4011  c1->Update();
4012 
4013  c1->Clear();
4014  c1->cd(0);
4015  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "#eta_rec-#eta_sim vs wiregroup");
4016  title->SetFillColor(10);
4017  title->Draw();
4018  sprintf(pagenum, "- %d -", page);
4019  t.DrawText(0.9, 0.02, pagenum);
4020  pad[page]->Draw();
4021  pad[page]->Divide(2, 5);
4022  for (int idh = 0; idh < max_idh; idh++) {
4023  if (!plotME1A && idh == 3)
4024  continue;
4025  pad[page]->cd(idh + 1);
4026  hEtaDiffVsWireCsc[idh]->SetMarkerSize(0.2);
4027  hEtaDiffVsWireCsc[idh]->GetXaxis()->SetTitle("Wiregroup");
4028  hEtaDiffVsWireCsc[idh]->GetXaxis()->SetTitleSize(0.07);
4029  hEtaDiffVsWireCsc[idh]->GetXaxis()->SetTitleOffset(1.2);
4030  hEtaDiffVsWireCsc[idh]->GetYaxis()->SetTitle("#eta_rec-#eta_sim");
4031  hEtaDiffVsWireCsc[idh]->GetYaxis()->SetTitleSize(0.07);
4032  hEtaDiffVsWireCsc[idh]->GetXaxis()->SetLabelSize(0.07); // default=0.04
4033  hEtaDiffVsWireCsc[idh]->GetYaxis()->SetLabelSize(0.07);
4034  hEtaDiffVsWireCsc[idh]->Draw();
4035  }
4036  page++;
4037  c1->Update();
4038 
4039  ps->NewPage();
4040  c1->Clear();
4041  c1->cd(0);
4042  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "#phi resolution");
4043  title->SetFillColor(10);
4044  title->Draw();
4045  sprintf(pagenum, "- %d -", page);
4046  t.DrawText(0.9, 0.02, pagenum);
4047  gStyle->SetOptStat(111110);
4048  pad[page]->Draw();
4049  pad[page]->Divide(2, 2);
4050  gStyle->SetStatX(1.00);
4051  gStyle->SetStatY(0.65);
4052  pad[page]->cd(1);
4053  hPhiRecVsSim->SetMarkerSize(0.2);
4054  hPhiRecVsSim->Draw();
4055  gPad->Update();
4056  gStyle->SetStatX(1.00);
4057  gStyle->SetStatY(0.995);
4058  hResolDeltaPhi->GetXaxis()->SetLabelSize(0.04);
4059  hResolDeltaPhi->GetYaxis()->SetLabelSize(0.04);
4060  pad[page]->cd(2);
4061  hResolDeltaPhi->Draw();
4062  hResolDeltaPhi->Fit("gaus", "Q");
4063  hResolDeltaHS->GetXaxis()->SetTitle("HS_{rec} - HS_{sim}");
4064  hResolDeltaHS->GetXaxis()->SetTitleOffset(1.2);
4065  hResolDeltaHS->GetYaxis()->SetTitle("Entries");
4066  hResolDeltaHS->GetYaxis()->SetTitleOffset(1.7);
4067  hResolDeltaHS->GetXaxis()->SetLabelSize(0.03);
4068  hResolDeltaHS->GetYaxis()->SetLabelSize(0.03);
4069  pad[page]->cd(3);
4070  hResolDeltaHS->Draw();
4071  hResolDeltaDS->GetXaxis()->SetTitle("DS_{rec} - DS_{sim}");
4072  hResolDeltaDS->GetXaxis()->SetTitleOffset(1.2);
4073  hResolDeltaDS->GetYaxis()->SetTitle("Entries");
4074  hResolDeltaDS->GetYaxis()->SetTitleOffset(1.6);
4075  hResolDeltaDS->GetXaxis()->SetLabelSize(0.04);
4076  hResolDeltaDS->GetYaxis()->SetLabelSize(0.04);
4077  pad[page]->cd(4);
4078  hResolDeltaDS->Draw();
4079  page++;
4080  c1->Update();
4081 
4082  ps->NewPage();
4083  c1->Clear();
4084  c1->cd(0);
4085  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "#phi_rec-#phi_sim (mrad)");
4086  title->SetFillColor(10);
4087  title->Draw();
4088  sprintf(pagenum, "- %d -", page);
4089  t.DrawText(0.9, 0.02, pagenum);
4090  pad[page]->Draw();
4091  pad[page]->Divide(2, 5);
4092  for (int idh = 0; idh < max_idh; idh++) {
4093  if (!plotME1A && idh == 3)
4094  continue;
4095  hPhiDiffCsc[idh][0]->GetXaxis()->SetLabelSize(0.07); // default=0.04
4096  hPhiDiffCsc[idh][0]->GetYaxis()->SetLabelSize(0.07);
4097  pad[page]->cd(idh + 1);
4098  hPhiDiffCsc[idh][0]->Draw();
4099  if (hPhiDiffCsc[idh][0]->GetEntries() > 1)
4100  hPhiDiffCsc[idh][0]->Fit("gaus", "Q");
4101  }
4102  page++;
4103  c1->Update();
4104 
4105  ps->NewPage();
4106  c1->Clear();
4107  c1->cd(0);
4108  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "#phi_rec-#phi_sim (mrad), endcap1");
4109  title->SetFillColor(10);
4110  title->Draw();
4111  sprintf(pagenum, "- %d -", page);
4112  t.DrawText(0.9, 0.02, pagenum);
4113  pad[page]->Draw();
4114  pad[page]->Divide(2, 5);
4115  for (int idh = 0; idh < max_idh; idh++) {
4116  if (!plotME1A && idh == 3)
4117  continue;
4118  hPhiDiffCsc[idh][1]->GetXaxis()->SetLabelSize(0.07); // default=0.04
4119  hPhiDiffCsc[idh][1]->GetYaxis()->SetLabelSize(0.07);
4120  pad[page]->cd(idh + 1);
4121  hPhiDiffCsc[idh][1]->Draw();
4122  if (hPhiDiffCsc[idh][1]->GetEntries() > 1)
4123  hPhiDiffCsc[idh][1]->Fit("gaus", "Q");
4124  }
4125  page++;
4126  c1->Update();
4127 
4128  ps->NewPage();
4129  c1->Clear();
4130  c1->cd(0);
4131  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "#phi_rec-#phi_sim (mrad), endcap2");
4132  title->SetFillColor(10);
4133  title->Draw();
4134  sprintf(pagenum, "- %d -", page);
4135  t.DrawText(0.9, 0.02, pagenum);
4136  pad[page]->Draw();
4137  pad[page]->Divide(2, 5);
4138  for (int idh = 0; idh < max_idh; idh++) {
4139  if (!plotME1A && idh == 3)
4140  continue;
4141  hPhiDiffCsc[idh][2]->GetXaxis()->SetLabelSize(0.07); // default=0.04
4142  hPhiDiffCsc[idh][2]->GetYaxis()->SetLabelSize(0.07);
4143  pad[page]->cd(idh + 1);
4144  hPhiDiffCsc[idh][2]->Draw();
4145  if (hPhiDiffCsc[idh][2]->GetEntries() > 1)
4146  hPhiDiffCsc[idh][2]->Fit("gaus", "Q");
4147  }
4148  page++;
4149  c1->Update();
4150 
4151  ps->NewPage();
4152  c1->Clear();
4153  c1->cd(0);
4154  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "#LT#phi_rec-#phi_sim#GT (mrad) vs #phi_rec");
4155  title->SetFillColor(10);
4156  title->Draw();
4157  sprintf(pagenum, "- %d -", page);
4158  t.DrawText(0.9, 0.02, pagenum);
4159  gStyle->SetOptStat(0);
4160  pad[page]->Draw();
4161  pad[page]->Divide(2, 2);
4162  TH1F* hMeanPhiDiffVsPhi[MAX_STATIONS];
4163  for (int istation = 0; istation < MAX_STATIONS; istation++) {
4164  hMeanPhiDiffVsPhi[istation] = (TH1F*)hPhiDiffVsPhi[istation]->Clone();
4165  hMeanPhiDiffVsPhi[istation]->Divide(hPhiDiffVsPhi[istation], hClctVsPhi[istation], 1., 1.);
4166  hMeanPhiDiffVsPhi[istation]->GetXaxis()->SetTitleOffset(1.2);
4167  hMeanPhiDiffVsPhi[istation]->GetYaxis()->SetTitleOffset(1.7);
4168  hMeanPhiDiffVsPhi[istation]->GetXaxis()->SetTitle("#phi");
4169  hMeanPhiDiffVsPhi[istation]->GetYaxis()->SetTitle("#LT#phi_rec-#phi_sim#GT (mrad)");
4170  hMeanPhiDiffVsPhi[istation]->SetMaximum(5.);
4171  pad[page]->cd(istation + 1);
4172  hMeanPhiDiffVsPhi[istation]->Draw();
4173  }
4174  page++;
4175  c1->Update();
4176 
4177  c1->Clear();
4178  c1->cd(0);
4179  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "#phi_rec-#phi_sim (mrad) vs halfstrip #");
4180  title->SetFillColor(10);
4181  title->Draw();
4182  sprintf(pagenum, "- %d -", page);
4183  t.DrawText(0.9, 0.02, pagenum);
4184  gStyle->SetOptStat(0);
4185  pad[page]->Draw();
4186  pad[page]->Divide(2, 5);
4187  for (int idh = 0; idh < max_idh; idh++) {
4188  if (!plotME1A && idh == 3)
4189  continue;
4190  pad[page]->cd(idh + 1);
4191  hPhiDiffVsStripCsc[idh][1]->SetMarkerSize(0.2);
4192  hPhiDiffVsStripCsc[idh][1]->GetXaxis()->SetTitle("Halfstrip");
4193  hPhiDiffVsStripCsc[idh][1]->GetXaxis()->SetTitleOffset(1.4);
4194  hPhiDiffVsStripCsc[idh][1]->GetYaxis()->SetTitle("#phi_rec-#phi_sim (mrad)");
4195  hPhiDiffVsStripCsc[idh][1]->GetXaxis()->SetLabelSize(0.07); // default=0.04
4196  hPhiDiffVsStripCsc[idh][1]->GetYaxis()->SetLabelSize(0.07);
4197  hPhiDiffVsStripCsc[idh][1]->Draw();
4198  }
4199  page++;
4200  c1->Update();
4201 
4202  c1->Clear();
4203  c1->cd(0);
4204  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "#phi_rec-#phi_sim, halfstrips only, different patterns");
4205  title->SetFillColor(10);
4206  title->Draw();
4207  sprintf(pagenum, "- %d -", page);
4208  t.DrawText(0.9, 0.02, pagenum);
4209  gStyle->SetOptStat(111110);
4210  pad[page]->Draw();
4211  pad[page]->Divide(3, 3);
4212  int min_pattern, max_pattern;
4213  min_pattern = 2;
4214  max_pattern = CSCConstants::NUM_CLCT_PATTERNS;
4215  for (int idh = min_pattern; idh < max_pattern; idh++) {
4216  hPhiDiffPattern[idh]->GetXaxis()->SetTitle("Halfstrip");
4217  hPhiDiffPattern[idh]->GetXaxis()->SetTitleOffset(1.2);
4218  pad[page]->cd(idh - min_pattern + 1);
4219  hPhiDiffPattern[idh]->Draw();
4220  // if (hPhiDiffPattern[idh]->GetEntries() > 1)
4221  // hPhiDiffPattern[idh]->Fit("gaus","Q");
4222  }
4223  page++;
4224  c1->Update();
4225 
4226  ps->NewPage();
4227  c1->Clear();
4228  c1->cd(0);
4229  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "#phi_1-#phi_6 (mrad), muon SimHits");
4230  title->SetFillColor(10);
4231  title->Draw();
4232  sprintf(pagenum, "- %d -", page);
4233  t.DrawText(0.9, 0.02, pagenum);
4234  pad[page]->Draw();
4235  pad[page]->Divide(2, 5);
4236  for (int idh = 0; idh < max_idh; idh++) {
4237  if (!plotME1A && idh == 3)
4238  continue;
4239  hTrueBendCsc[idh]->GetYaxis()->SetTitle("Entries");
4240  hTrueBendCsc[idh]->GetYaxis()->SetTitleSize(0.07);
4241  hTrueBendCsc[idh]->GetXaxis()->SetLabelSize(0.07); // default=0.04
4242  hTrueBendCsc[idh]->GetYaxis()->SetLabelSize(0.07);
4243  pad[page]->cd(idh + 1);
4244  hTrueBendCsc[idh]->Draw();
4245  }
4246  page++;
4247  c1->Update();
4248 
4249  ps->Close();
4250  delete c1;
4251 }
4252 
4254  TCanvas* c1 = new TCanvas("c1", "", 0, 0, 500, 700);
4255  string fname = resultsFileNamesPrefix_ + "lcts_effic.ps";
4256  TPostScript* ps = new TPostScript(fname.c_str(), 111);
4257 
4258  TPad* pad[MAXPAGES];
4259  for (int i_page = 0; i_page < MAXPAGES; i_page++) {
4260  pad[i_page] = new TPad("", "", .05, .05, .93, .93);
4261  }
4262 
4263  int page = 1;
4264  TText t;
4265  t.SetTextFont(32);
4266  t.SetTextSize(0.025);
4267  char pagenum[7];
4268  TPaveLabel* title;
4269  char histtitle[60];
4270 
4271  gStyle->SetOptDate(0);
4272  gStyle->SetTitleSize(0.1, ""); // size for pad title; default is 0.02
4273 
4274  int max_idh = plotME42 ? CSC_TYPES : CSC_TYPES - 1;
4275 
4276  ps->NewPage();
4277  c1->Clear();
4278  c1->cd(0);
4279  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "ALCT efficiency vs #eta");
4280  title->SetFillColor(10);
4281  title->Draw();
4282  sprintf(pagenum, "- %d -", page);
4283  t.DrawText(0.9, 0.02, pagenum);
4284  gStyle->SetOptStat(0);
4285  pad[page]->Draw();
4286  pad[page]->Divide(2, 2);
4287  TH1F* hALCTEffVsEta[MAX_STATIONS];
4288  for (int istation = 0; istation < MAX_STATIONS; istation++) {
4289  hALCTEffVsEta[istation] = (TH1F*)hEfficHitsEta[istation]->Clone();
4290  hALCTEffVsEta[istation]->Divide(hEfficALCTEta[istation], hEfficHitsEta[istation], 1., 1., "B");
4291  hALCTEffVsEta[istation]->GetXaxis()->SetTitleOffset(1.2);
4292  hALCTEffVsEta[istation]->GetXaxis()->SetTitle("#eta");
4293  hALCTEffVsEta[istation]->SetMaximum(1.05);
4294  sprintf(histtitle, "ALCT efficiency vs #eta, station %d", istation + 1);
4295  hALCTEffVsEta[istation]->SetTitle(histtitle);
4296  pad[page]->cd(istation + 1);
4297  hALCTEffVsEta[istation]->Draw();
4298  }
4299  page++;
4300  c1->Update();
4301 
4302  c1->Clear();
4303  c1->cd(0);
4304  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "ALCT efficiency vs #eta");
4305  title->SetFillColor(10);
4306  title->Draw();
4307  sprintf(pagenum, "- %d -", page);
4308  t.DrawText(0.9, 0.02, pagenum);
4309  gStyle->SetOptStat(11111);
4310  pad[page]->Draw();
4311  pad[page]->Divide(2, 5);
4312  TH1F* hALCTEffVsEtaCsc[CSC_TYPES];
4313  for (int idh = 0; idh < max_idh; idh++) {
4314  if (!plotME1A && idh == 3)
4315  continue;
4316  hALCTEffVsEtaCsc[idh] = (TH1F*)hEfficHitsEtaCsc[idh]->Clone();
4317  hALCTEffVsEtaCsc[idh]->Divide(hEfficALCTEtaCsc[idh], hEfficHitsEtaCsc[idh], 1., 1., "B");
4318  if (idh == 3 || idh == 4 || idh == 6 || idh == 8) {
4319  gPad->Update();
4320  gStyle->SetStatX(0.43);
4321  } else {
4322  gPad->Update();
4323  gStyle->SetStatX(1.00);
4324  }
4325  hALCTEffVsEtaCsc[idh]->GetXaxis()->SetTitle("#eta");
4326  hALCTEffVsEtaCsc[idh]->GetXaxis()->SetTitleOffset(0.8);
4327  hALCTEffVsEtaCsc[idh]->GetXaxis()->SetTitleSize(0.07); // default=0.05
4328  hALCTEffVsEtaCsc[idh]->GetXaxis()->SetLabelSize(0.10); // default=0.04
4329  hALCTEffVsEtaCsc[idh]->GetYaxis()->SetLabelSize(0.10);
4330  hALCTEffVsEtaCsc[idh]->SetLabelOffset(0.012, "XY");
4331  hALCTEffVsEtaCsc[idh]->SetMinimum(0.50);
4332  hALCTEffVsEtaCsc[idh]->SetMaximum(1.05);
4333  hALCTEffVsEtaCsc[idh]->SetTitle(csc_type[idh].c_str());
4334  hALCTEffVsEtaCsc[idh]->SetTitleSize(0.1, "");
4335  hALCTEffVsEtaCsc[idh]->SetLineWidth(2);
4336  hALCTEffVsEtaCsc[idh]->SetLineColor(4);
4337  pad[page]->cd(idh + 1);
4338  gPad->SetGrid(1);
4339  hALCTEffVsEtaCsc[idh]->Draw();
4340  }
4341  page++;
4342  c1->Update();
4343 
4344  ps->NewPage();
4345  c1->Clear();
4346  c1->cd(0);
4347  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "CLCT efficiency vs #eta");
4348  title->SetFillColor(10);
4349  title->Draw();
4350  sprintf(pagenum, "- %d -", page);
4351  t.DrawText(0.9, 0.02, pagenum);
4352  gStyle->SetOptStat(0);
4353  pad[page]->Draw();
4354  pad[page]->Divide(2, 2);
4355  TH1F* hCLCTEffVsEta[MAX_STATIONS];
4356  for (int istation = 0; istation < MAX_STATIONS; istation++) {
4357  hCLCTEffVsEta[istation] = (TH1F*)hEfficHitsEta[istation]->Clone();
4358  hCLCTEffVsEta[istation]->Divide(hEfficCLCTEta[istation], hEfficHitsEta[istation], 1., 1., "B");
4359  hCLCTEffVsEta[istation]->GetXaxis()->SetTitleOffset(1.2);
4360  hCLCTEffVsEta[istation]->GetXaxis()->SetTitle("#eta");
4361  hCLCTEffVsEta[istation]->SetMaximum(1.05);
4362  sprintf(histtitle, "CLCT efficiency vs #eta, station %d", istation + 1);
4363  hCLCTEffVsEta[istation]->SetTitle(histtitle);
4364  pad[page]->cd(istation + 1);
4365  hCLCTEffVsEta[istation]->Draw();
4366  }
4367  page++;
4368  c1->Update();
4369 
4370  c1->Clear();
4371  c1->cd(0);
4372  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "CLCT efficiency vs #eta");
4373  title->SetFillColor(10);
4374  title->Draw();
4375  sprintf(pagenum, "- %d -", page);
4376  t.DrawText(0.9, 0.02, pagenum);
4377  gStyle->SetOptStat(111110);
4378  pad[page]->Draw();
4379  pad[page]->Divide(2, 5);
4380  TH1F* hCLCTEffVsEtaCsc[CSC_TYPES];
4381  for (int idh = 0; idh < max_idh; idh++) {
4382  if (!plotME1A && idh == 3)
4383  continue;
4384  hCLCTEffVsEtaCsc[idh] = (TH1F*)hEfficHitsEtaCsc[idh]->Clone();
4385  hCLCTEffVsEtaCsc[idh]->Divide(hEfficCLCTEtaCsc[idh], hEfficHitsEtaCsc[idh], 1., 1., "B");
4386  if (idh == 3 || idh == 4 || idh == 6 || idh == 8) {
4387  gPad->Update();
4388  gStyle->SetStatX(0.43);
4389  } else {
4390  gPad->Update();
4391  gStyle->SetStatX(1.00);
4392  }
4393  hCLCTEffVsEtaCsc[idh]->GetXaxis()->SetTitle("#eta");
4394  hCLCTEffVsEtaCsc[idh]->GetXaxis()->SetTitleOffset(0.8);
4395  hCLCTEffVsEtaCsc[idh]->GetXaxis()->SetTitleSize(0.07); // default=0.05
4396  hCLCTEffVsEtaCsc[idh]->GetXaxis()->SetLabelSize(0.10); // default=0.04
4397  hCLCTEffVsEtaCsc[idh]->GetYaxis()->SetLabelSize(0.10);
4398  hCLCTEffVsEtaCsc[idh]->SetLabelOffset(0.012, "XY");
4399  hCLCTEffVsEtaCsc[idh]->SetMinimum(0.50);
4400  hCLCTEffVsEtaCsc[idh]->SetMaximum(1.05);
4401  hCLCTEffVsEtaCsc[idh]->SetTitle(csc_type[idh].c_str());
4402  hCLCTEffVsEtaCsc[idh]->SetLineWidth(2);
4403  hCLCTEffVsEtaCsc[idh]->SetLineColor(4);
4404  pad[page]->cd(idh + 1);
4405  gPad->SetGrid(1);
4406  hCLCTEffVsEtaCsc[idh]->Draw();
4407  }
4408  page++;
4409  c1->Update();
4410 
4411  ps->Close();
4412  delete c1;
4413 }
4414 
4416  TCanvas* c1 = new TCanvas("c1", "", 0, 0, 500, 640);
4417  TCanvas* c2 = new TCanvas("c2", "", 0, 0, 540, 540);
4418 
4419  TPad* pad[MAXPAGES];
4420  for (int i_page = 0; i_page < MAXPAGES; i_page++) {
4421  pad[i_page] = new TPad("", "", .07, .07, .93, .93);
4422  }
4423 
4424  int page = 1;
4425  TPaveLabel* title;
4426  gStyle->SetOptDate(0);
4427 
4428  int max_idh = plotME42 ? CSC_TYPES : CSC_TYPES - 1;
4429 
4430  TPostScript* eps1 = new TPostScript("clcts.eps", 113);
4431  eps1->NewPage();
4432  c1->Clear();
4433  c1->cd(0);
4434  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "CLCT quantities");
4435  title->SetFillColor(10);
4436  title->Draw();
4437  pad[page]->Draw();
4438  pad[page]->Divide(2, 3);
4439  pad[page]->cd(1);
4440  hClctQuality->Draw();
4441  pad[page]->cd(2);
4442  hClctSign->Draw();
4443  TH1F* hClctPatternTot = (TH1F*)hClctPattern[0]->Clone();
4444  hClctPatternTot->SetTitle("CLCT pattern #");
4445  hClctPatternTot->Add(hClctPattern[0], hClctPattern[1], 1., 1.);
4446  pad[page]->cd(3);
4447  hClctPatternTot->Draw();
4448  hClctPattern[0]->SetLineStyle(2);
4449  hClctPattern[0]->Draw("same");
4450  hClctPattern[1]->SetLineStyle(3);
4451  hClctPattern[1]->Draw("same");
4452  pad[page]->cd(4);
4453  hClctCFEB->Draw();
4454  pad[page]->cd(5);
4455  hClctStripType->Draw();
4456  TH1F* hClctKeyStripTot = (TH1F*)hClctKeyStrip[0]->Clone();
4457  hClctKeyStripTot->SetTitle("CLCT key strip #");
4458  hClctKeyStripTot->Add(hClctKeyStrip[0], hClctKeyStrip[1], 1., 1.);
4459  pad[page]->cd(6);
4460  hClctKeyStripTot->Draw();
4461  page++;
4462  c1->Update();
4463  c1->Print("asdf.png");
4464  eps1->Close();
4465 
4466  // Resolution histograms.
4467  if (bookedResolHistos) {
4468  gStyle->SetTitleSize(0.055, ""); // size for pad title; default is 0.02
4469 
4470  TPostScript* eps2 = new TPostScript("alct_deltaWG.eps", 113);
4471  eps2->NewPage();
4472  c2->Clear();
4473  c2->cd(0);
4474  gStyle->SetOptStat(0);
4475  pad[page]->Draw();
4476  pad[page]->Divide(1, 1);
4477  hResolDeltaWG->GetXaxis()->SetTitle("WG_{rec} - WG_{sim}");
4478  hResolDeltaWG->GetXaxis()->SetTitleOffset(1.2);
4479  hResolDeltaWG->GetYaxis()->SetTitle("Entries");
4480  hResolDeltaWG->GetYaxis()->SetTitleOffset(1.9);
4481  hResolDeltaWG->GetXaxis()->SetLabelSize(0.04);
4482  hResolDeltaWG->GetYaxis()->SetLabelSize(0.04);
4483  pad[page]->cd(1);
4484  hResolDeltaWG->Draw();
4485  page++;
4486  c2->Update();
4487  eps2->Close();
4488 
4489  TPostScript* eps3 = new TPostScript("clct_deltaHS.eps", 113);
4490  eps3->NewPage();
4491  c2->Clear();
4492  c2->cd(0);
4493  pad[page]->Draw();
4494  pad[page]->Divide(1, 1);
4495  hResolDeltaHS->GetXaxis()->SetTitle("HS_{rec} - HS_{sim}");
4496  hResolDeltaHS->GetXaxis()->SetTitleOffset(1.2);
4497  hResolDeltaHS->GetYaxis()->SetTitle("Entries");
4498  hResolDeltaHS->GetYaxis()->SetTitleOffset(1.7);
4499  hResolDeltaHS->GetXaxis()->SetLabelSize(0.04); // default=0.04
4500  hResolDeltaHS->GetYaxis()->SetLabelSize(0.04);
4501  pad[page]->cd(1);
4502  hResolDeltaHS->Draw();
4503  page++;
4504  c2->Update();
4505  eps3->Close();
4506 
4507  TPostScript* eps4 = new TPostScript("clct_deltaDS.eps", 113);
4508  eps4->NewPage();
4509  c2->Clear();
4510  c2->cd(0);
4511  gStyle->SetOptStat(0);
4512  pad[page]->Draw();
4513  pad[page]->Divide(1, 1);
4514  hResolDeltaDS->GetXaxis()->SetTitle("DS_{rec} - DS_{sim}");
4515  hResolDeltaDS->GetXaxis()->SetTitleOffset(1.2);
4516  hResolDeltaDS->GetYaxis()->SetTitle("Entries");
4517  hResolDeltaDS->GetYaxis()->SetTitleOffset(1.6);
4518  hResolDeltaDS->GetXaxis()->SetLabelSize(0.04); // default=0.04
4519  hResolDeltaDS->GetYaxis()->SetLabelSize(0.04);
4520  pad[page]->cd(1);
4521  hResolDeltaDS->Draw();
4522  page++;
4523  c2->Update();
4524  eps4->Close();
4525 
4526  TPostScript* eps5 = new TPostScript("clct_deltaPhi_hs.eps", 113);
4527  eps5->NewPage();
4528  c1->Clear();
4529  c1->cd(0);
4530  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "#phi_rec-#phi_sim (mrad), halfstrips only");
4531  title->SetFillColor(10);
4532  title->Draw();
4533  gStyle->SetTitleSize(0.1, ""); // size for pad title; default is 0.02
4534  gStyle->SetOptStat(111110);
4535  pad[page]->Draw();
4536  pad[page]->Divide(2, 5);
4537  for (int idh = 0; idh < max_idh; idh++) {
4538  if (!plotME1A && idh == 3)
4539  continue;
4540  pad[page]->cd(idh + 1);
4541  hPhiDiffCsc[idh][4]->Draw();
4542  //if (hPhiDiffCsc[idh][4]->GetEntries() > 1)
4543  //hPhiDiffCsc[idh][4]->Fit("gaus","Q");
4544  //hPhiDiffCsc[idh][4]->GetXaxis()->SetTitle("#phi_{rec} - #phi_{sim} (mrad)");
4545  //hPhiDiffCsc[idh][4]->GetXaxis()->SetTitleSize(0.06);
4546  //hPhiDiffCsc[idh][4]->GetXaxis()->SetTitleOffset(0.9);
4547  hPhiDiffCsc[idh][4]->GetYaxis()->SetTitle("Entries ");
4548  hPhiDiffCsc[idh][4]->GetYaxis()->SetTitleSize(0.07);
4549  hPhiDiffCsc[idh][4]->GetYaxis()->SetTitleOffset(1.0);
4550  hPhiDiffCsc[idh][4]->GetXaxis()->SetLabelSize(0.10); // default=0.04
4551  hPhiDiffCsc[idh][4]->GetYaxis()->SetLabelSize(0.10);
4552  hPhiDiffCsc[idh][4]->SetLabelOffset(0.012, "XY");
4553  }
4554  page++;
4555  c1->Update();
4556  eps5->Close();
4557  }
4558 
4559  // Efficiency histograms.
4560  if (bookedEfficHistos) {
4561  TPostScript* eps6 = new TPostScript("alct_effic.eps", 113);
4562  eps6->NewPage();
4563  c1->Clear();
4564  c1->cd(0);
4565  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "ALCT efficiency vs #eta");
4566  title->SetFillColor(10);
4567  title->Draw();
4568  gStyle->SetOptStat(0);
4569  pad[page]->Draw();
4570  pad[page]->Divide(2, 5);
4571  TH1F* hALCTEffVsEtaCsc[CSC_TYPES];
4572  for (int idh = 0; idh < max_idh; idh++) {
4573  if (!plotME1A && idh == 3)
4574  continue;
4575  hALCTEffVsEtaCsc[idh] = (TH1F*)hEfficHitsEtaCsc[idh]->Clone();
4576  hALCTEffVsEtaCsc[idh]->Divide(hEfficALCTEtaCsc[idh], hEfficHitsEtaCsc[idh], 1., 1., "B");
4577  hALCTEffVsEtaCsc[idh]->GetXaxis()->SetTitle("#eta");
4578  hALCTEffVsEtaCsc[idh]->GetXaxis()->SetTitleOffset(0.8);
4579  hALCTEffVsEtaCsc[idh]->GetXaxis()->SetTitleSize(0.07); // default=0.05
4580  hALCTEffVsEtaCsc[idh]->GetXaxis()->SetLabelSize(0.10); // default=0.04
4581  hALCTEffVsEtaCsc[idh]->GetYaxis()->SetLabelSize(0.10);
4582  hALCTEffVsEtaCsc[idh]->SetLabelOffset(0.012, "XY");
4583  hALCTEffVsEtaCsc[idh]->SetMinimum(0.50);
4584  hALCTEffVsEtaCsc[idh]->SetMaximum(1.05);
4585  hALCTEffVsEtaCsc[idh]->SetTitle(csc_type[idh].c_str());
4586  hALCTEffVsEtaCsc[idh]->SetTitleSize(0.1, "");
4587  hALCTEffVsEtaCsc[idh]->SetLineWidth(2);
4588  hALCTEffVsEtaCsc[idh]->SetLineColor(4);
4589  hALCTEffVsEtaCsc[idh]->SetLineColor(4);
4590  pad[page]->cd(idh + 1);
4591  gPad->SetGrid(1);
4592  hALCTEffVsEtaCsc[idh]->Draw();
4593  }
4594  page++;
4595  c1->Update();
4596  eps6->Close();
4597 
4598  TPostScript* eps7 = new TPostScript("clct_effic.eps", 113);
4599  eps7->NewPage();
4600  c1->Clear();
4601  c1->cd(0);
4602  title = new TPaveLabel(0.1, 0.94, 0.9, 0.98, "CLCT efficiency vs #eta");
4603  title->SetFillColor(10);
4604  title->Draw();
4605  gStyle->SetOptStat(0);
4606  pad[page]->Draw();
4607  pad[page]->Divide(2, 5);
4608  TH1F* hCLCTEffVsEtaCsc[CSC_TYPES];
4609  for (int idh = 0; idh < max_idh; idh++) {
4610  if (!plotME1A && idh == 3)
4611  continue;
4612  hCLCTEffVsEtaCsc[idh] = (TH1F*)hEfficHitsEtaCsc[idh]->Clone();
4613  hCLCTEffVsEtaCsc[idh]->Divide(hEfficCLCTEtaCsc[idh], hEfficHitsEtaCsc[idh], 1., 1., "B");
4614  hCLCTEffVsEtaCsc[idh]->GetXaxis()->SetTitle("#eta");
4615  hCLCTEffVsEtaCsc[idh]->GetXaxis()->SetTitleOffset(0.8);
4616  hCLCTEffVsEtaCsc[idh]->GetXaxis()->SetTitleSize(0.07); // default=0.05
4617  hCLCTEffVsEtaCsc[idh]->GetXaxis()->SetLabelSize(0.10); // default=0.04
4618  hCLCTEffVsEtaCsc[idh]->GetYaxis()->SetLabelSize(0.10);
4619  hCLCTEffVsEtaCsc[idh]->SetLabelOffset(0.012, "XY");
4620  hCLCTEffVsEtaCsc[idh]->SetMinimum(0.50);
4621  hCLCTEffVsEtaCsc[idh]->SetMaximum(1.05);
4622  hCLCTEffVsEtaCsc[idh]->SetTitle(csc_type[idh].c_str());
4623  hCLCTEffVsEtaCsc[idh]->SetLineWidth(2);
4624  hCLCTEffVsEtaCsc[idh]->SetLineColor(4);
4625  pad[page]->cd(idh + 1);
4626  gPad->SetGrid(1);
4627  hCLCTEffVsEtaCsc[idh]->Draw();
4628  }
4629  page++;
4630  c1->Update();
4631  eps7->Close();
4632  }
4633  delete c1;
4634  delete c2;
4635 }
4636 
4637 GlobalPoint CSCTriggerPrimitivesReader::getGlobalPosition(unsigned int rawId, int keyWg, int keyHS) const {
4638  // taken from https://github.com/cms-sw/cmssw/blob/dc9f78b6af4ad56c9342cf14041b6485a60b0691/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesReaderGEM.cc
4639  CSCDetId cscId = CSCDetId(rawId);
4640  int ring = cscId.ring();
4641  if (cscId.station() == 1 and cscId.ring() == 1 and (lut_wg_vs_hs_me1b[keyWg][0] < 0 || keyHS >= 128)) {
4642  ring = 4;
4643  if (keyHS >= 128)
4644  keyHS = keyHS - 128;
4645  }
4646 
4647  CSCDetId key_id(cscId.endcap(), cscId.station(), ring, cscId.chamber(), CSCConstants::KEY_CLCT_LAYER);
4648  auto cscChamber = geom_->chamber(cscId);
4649  float fractional_strip = 0.5 * (keyHS + 1) - 0.25;
4650  auto layer_geo = cscChamber->layer(CSCConstants::KEY_CLCT_LAYER)->geometry();
4651  // LCT::getKeyWG() also starts from 0
4652  float wire = layer_geo->middleWireOfGroup(keyWg + 1);
4653  LocalPoint csc_intersect = layer_geo->intersectionOfStripAndWire(fractional_strip, wire);
4654  GlobalPoint csc_gp = geom_->idToDet(key_id)->surface().toGlobal(csc_intersect);
4655  return csc_gp;
4656 }
4657 
4658 bool CSCTriggerPrimitivesReader::doesALCTCrossCLCT(CSCDetId id, int key_wg, int key_hs) const {
4659  bool isME11 = (id.station() == 1 and (id.ring() == 1 or id.ring() == 4));
4660  if (not isME11)
4661  return true;
4662 
4663  int theEndcap = (id.endcap() == 1) ? 1 : 2;
4664 
4665  if (key_hs > CSCConstants::MAX_HALF_STRIP_ME1B) {
4666  key_hs = key_hs - CSCConstants::MAX_HALF_STRIP_ME1B - 1; //convert it from 128-223 -> 0-95
4667  if (!gangedME1a) {
4668  // wrap around ME11 HS number for -z endcap
4669  if (theEndcap == 2)
4671  if (key_hs >= lut_wg_vs_hs_me1a[key_wg][0] && key_hs <= lut_wg_vs_hs_me1a[key_wg][1])
4672  return true;
4673  return false;
4674  } else {
4675  if (theEndcap == 2)
4676  key_hs = CSCConstants::MAX_HALF_STRIP_ME1A_GANGED - key_hs;
4677  if (key_hs >= lut_wg_vs_hs_me1ag[key_wg][0] && key_hs <= lut_wg_vs_hs_me1ag[key_wg][1])
4678  return true;
4679  return false;
4680  }
4681  }
4682  if (key_hs <= CSCConstants::MAX_HALF_STRIP_ME1B) {
4683  if (theEndcap == 2)
4684  key_hs = CSCConstants::MAX_HALF_STRIP_ME1B - key_hs;
4685  if (key_hs >= lut_wg_vs_hs_me1b[key_wg][0] && key_hs <= lut_wg_vs_hs_me1b[key_wg][1])
4686  return true;
4687  }
4688  return false;
4689 }
4690 
4691 // Returns chamber type (0-9) according to the station and ring number
4693  int type = -999;
4694 
4695  if (id.station() == 1) {
4696  type = (id.triggerCscId() - 1) / 3;
4697  if (id.ring() == 4) {
4698  type = 3;
4699  }
4700  } else { // stations 2-4
4701  type = 3 + id.ring() + 2 * (id.station() - 2);
4702  }
4703 
4704  assert(type >= 0 && type < CSC_TYPES);
4705  return type;
4706 }
4707 
4708 // Returns halfstrips-per-radian for different CSC types
4709 double CSCTriggerPrimitivesReader::getHsPerRad(const int idh) { return (NCHAMBERS[idh] * MAX_HS[idh] / TWOPI); }
4710 
4712 //-------------------------------------------------
CSCTriggerPrimitivesReader::hAlctCompMatch2i
TH2F * hAlctCompMatch2i
Definition: CSCTriggerPrimitivesReader.h:360
CSCTriggerPrimitivesReader::hAlctCompTotalCsc
TH1F * hAlctCompTotalCsc[MAX_ENDCAPS][CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:410
CSCTriggerPrimitivesReader::hClctBendCsc
TH1F * hClctBendCsc[CSC_TYPES][2]
Definition: CSCTriggerPrimitivesReader.h:328
MyStubComparison::quality_data
Int_t quality_data
Definition: CSCTriggerPrimitivesReader.h:86
CSCTriggerPrimitivesReader::clcts_e_token_
edm::EDGetTokenT< CSCCLCTDigiCollection > clcts_e_token_
Definition: CSCTriggerPrimitivesReader.h:185
CSCTriggerPrimitivesReader::hResolDeltaWG
TH1F * hResolDeltaWG
Definition: CSCTriggerPrimitivesReader.h:426
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
CSCTriggerPrimitivesReader::lut_wg_vs_hs_me1a
static const int lut_wg_vs_hs_me1a[48][2]
Definition: CSCTriggerPrimitivesReader.h:216
RandomServiceHelper.t2
t2
Definition: RandomServiceHelper.py:257
CSCTriggerPrimitivesReader::MCStudies
void MCStudies(const edm::Event &ev, const CSCALCTDigiCollection *alcts, const CSCCLCTDigiCollection *clcts)
Definition: CSCTriggerPrimitivesReader.cc:2639
CSCTriggerPrimitivesReader::hAlctQuality
TH1F * hAlctQuality
Definition: CSCTriggerPrimitivesReader.h:320
CSCTriggerPrimitivesReader::dataLctsIn_
bool dataLctsIn_
Definition: CSCTriggerPrimitivesReader.h:157
CSCTriggerPrimitivesReader::hLCTCompFound2x
TH2F * hLCTCompFound2x
Definition: CSCTriggerPrimitivesReader.h:388
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
CSCTriggerPrimitivesReader::bookResolHistos
void bookResolHistos()
Definition: CSCTriggerPrimitivesReader.cc:1015
TreePerStub::t_ring
Int_t t_ring
Definition: CSCTriggerPrimitivesReader.h:59
CSCCathodeLCTAnalyzer::getStripPhi
double getStripPhi(const CSCDetId &layerId, const float strip)
Definition: CSCCathodeLCTAnalyzer.cc:401
CSCTriggerPrimitivesReader::csc_type_minus
static const std::string csc_type_minus[CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:209
CSCTriggerPrimitivesReader::hEfficCLCTEtaCsc
TH1F * hEfficCLCTEtaCsc[CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:445
Handle.h
CSCTriggerPrimitivesReader::numLCTTMB
static int numLCTTMB
Definition: CSCTriggerPrimitivesReader.h:221
MyStubComparison::has_emul
Bool_t has_emul
Definition: CSCTriggerPrimitivesReader.h:84
CSCTriggerPrimitivesReader::hLCTCompTotal
TH1F * hLCTCompTotal
Definition: CSCTriggerPrimitivesReader.h:401
mps_fire.i
i
Definition: mps_fire.py:355
CSCTriggerPrimitivesReader::drawCompHistos
void drawCompHistos()
Definition: CSCTriggerPrimitivesReader.cc:3506
CSCTriggerPrimitivesReader::stubs_comparison
MyStubComparison stubs_comparison[4]
Definition: CSCTriggerPrimitivesReader.h:307
CSCTriggerPrimitivesReader::MAX_HS
static const int MAX_HS[CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:212
CSCTriggerPrimitivesReader::bookLCTMPCHistos
void bookLCTMPCHistos()
Definition: CSCTriggerPrimitivesReader.cc:831
CSCTriggerPrimitivesReader::hClctCompTotal2i
TH2F * hClctCompTotal2i
Definition: CSCTriggerPrimitivesReader.h:384
MessageLogger.h
MyStubComparison::chamber
Int_t chamber
Definition: CSCTriggerPrimitivesReader.h:78
CSCChamber::layer
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:30
CSCAnodeLCTAnalyzer::getSimInfo
std::vector< CSCAnodeLayerInfo > getSimInfo(const CSCALCTDigi &alct, const CSCDetId &alctId, const CSCWireDigiCollection *wiredc, const edm::PSimHitContainer *allSimHits)
Definition: CSCAnodeLCTAnalyzer.cc:16
CSCTriggerPrimitivesReader::hLctTMBStripType
TH1F * hLctTMBStripType
Definition: CSCTriggerPrimitivesReader.h:335
CSCTriggerPrimitivesReader::hClctCompTotal2x
TH2F * hClctCompTotal2x
Definition: CSCTriggerPrimitivesReader.h:383
CSCTriggerPrimitivesReader::hAlctCompFound
TH1F * hAlctCompFound
Definition: CSCTriggerPrimitivesReader.h:347
CSCTriggerPrimitivesReader::hCorrLctMPCPerCSC
TH1F * hCorrLctMPCPerCSC
Definition: CSCTriggerPrimitivesReader.h:338
CSCTriggerPrimitivesReader::lctProducerData_
std::string lctProducerData_
Definition: CSCTriggerPrimitivesReader.h:169
edm::Handle::product
T const * product() const
Definition: Handle.h:70
MyStubComparison::bookTree
TTree * bookTree(TTree *t, const std::string &name="Stub_compare")
Definition: CSCTriggerPrimitivesReader.cc:214
CSCTriggerPrimitivesReader::hEfficALCTEta
TH1F * hEfficALCTEta[MAX_STATIONS]
Definition: CSCTriggerPrimitivesReader.h:443
CSCTriggerPrimitivesReader::hLctMPCQuality
TH1F * hLctMPCQuality
Definition: CSCTriggerPrimitivesReader.h:341
CSCTriggerPrimitivesReader::checkBadChambers_
bool checkBadChambers_
Definition: CSCTriggerPrimitivesReader.h:194
CSCTriggerPrimitivesReader::hEfficHitsEta
TH1F * hEfficHitsEta[MAX_STATIONS]
Definition: CSCTriggerPrimitivesReader.h:442
makePileupJSON.denom
denom
Definition: makePileupJSON.py:147
ESHandle.h
CSCTriggerPrimitivesReader::hLctMPCKeyGroup
TH1F * hLctMPCKeyGroup
Definition: CSCTriggerPrimitivesReader.h:341
CSCTriggerPrimitivesReader::numLCTMPC
static int numLCTMPC
Definition: CSCTriggerPrimitivesReader.h:222
CSCTriggerPrimitivesReader::maxRing
int maxRing(int station)
Definition: CSCTriggerPrimitivesReader.cc:354
TreePerStub::t_endcap
Int_t t_endcap
Definition: CSCTriggerPrimitivesReader.h:60
CSCTriggerPrimitivesReader::gangedME1a
bool gangedME1a
Definition: CSCTriggerPrimitivesReader.h:160
CSCAnodeLCTAnalyzer::setGeometry
void setGeometry(const CSCGeometry *geom)
Definition: CSCAnodeLCTAnalyzer.cc:330
CSCTriggerPrimitivesReader::hAlctKeyGroup
TH1F * hAlctKeyGroup
Definition: CSCTriggerPrimitivesReader.h:320
CSCTriggerPrimitivesReader::hPhiRecVsSim
TH2F * hPhiRecVsSim
Definition: CSCTriggerPrimitivesReader.h:432
CSCTriggerPrimitivesReader::compareMPCLCTs
void compareMPCLCTs(const CSCCorrelatedLCTDigiCollection *lcts_data, const CSCCorrelatedLCTDigiCollection *lcts_emul, const CSCALCTDigiCollection *alcts_data, const CSCCLCTDigiCollection *clcts_data)
Definition: CSCTriggerPrimitivesReader.cc:2315
CaloTowersParam_cfi.mc
mc
Definition: CaloTowersParam_cfi.py:8
CSCTriggerPrimitivesReader::hLCTCompTotal2i
TH2F * hLCTCompTotal2i
Definition: CSCTriggerPrimitivesReader.h:404
CSCTriggerPrimitivesReader::drawLCTMPCHistos
void drawLCTMPCHistos()
Definition: CSCTriggerPrimitivesReader.cc:3405
CSCTriggerPrimitivesReader::chamberSerial
int chamberSerial(CSCDetId id)
Definition: CSCTriggerPrimitivesReader.cc:800
MyStubComparison::eta_data
Float_t eta_data
Definition: CSCTriggerPrimitivesReader.h:115
CSCTriggerPrimitivesReader::hLctMPCKeyGroupME11
TH1F * hLctMPCKeyGroupME11
Definition: CSCTriggerPrimitivesReader.h:451
CSCTriggerPrimitivesReader::mpclctProducerData_
std::string mpclctProducerData_
Definition: CSCTriggerPrimitivesReader.h:170
CSCTriggerPrimitivesReader::hEtaDiffVsWireCsc
TH2F * hEtaDiffVsWireCsc[CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:430
CSCTriggerPrimitivesReader::hAlctCompSameN2
TH2F * hAlctCompSameN2
Definition: CSCTriggerPrimitivesReader.h:353
relativeConstraints.cham
cham
Definition: relativeConstraints.py:69
CSCTriggerPrimitivesReader::hClctCompSameN
TH1F * hClctCompSameN
Definition: CSCTriggerPrimitivesReader.h:371
CSCTriggerPrimitivesReader::hAlctBXN
TH1F * hAlctBXN
Definition: CSCTriggerPrimitivesReader.h:321
CSCTriggerPrimitivesReader::getCSCType
int getCSCType(const CSCDetId &id)
Definition: CSCTriggerPrimitivesReader.cc:4692
MyStubComparison::quality_emul
Int_t quality_emul
Definition: CSCTriggerPrimitivesReader.h:89
CSCTriggerPrimitivesReader::hLCTCompFound2
TH2F * hLCTCompFound2
Definition: CSCTriggerPrimitivesReader.h:387
MyStubComparison::nEvents
Int_t nEvents
Definition: CSCTriggerPrimitivesReader.h:69
CSCTriggerPrimitivesReader::hClctCompSameN2i
TH2F * hClctCompSameN2i
Definition: CSCTriggerPrimitivesReader.h:374
CSCTriggerPrimitivesReader::bookedResolHistos
static bool bookedResolHistos
Definition: CSCTriggerPrimitivesReader.h:232
relativeConstraints.station
station
Definition: relativeConstraints.py:67
CSCDetId::ring
int ring() const
Definition: CSCDetId.h:68
DigiDM_cff.wires
wires
Definition: DigiDM_cff.py:33
CSCTriggerPrimitivesReader::hAlctCompMatch2x
TH2F * hAlctCompMatch2x
Definition: CSCTriggerPrimitivesReader.h:359
CSCTriggerPrimitivesReader::analyze
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
Does the job.
Definition: CSCTriggerPrimitivesReader.cc:364
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
CSCTriggerPrimitivesReader::hLCTCompFound2i
TH2F * hLCTCompFound2i
Definition: CSCTriggerPrimitivesReader.h:389
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CSCGeometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: CSCGeometry.cc:91
MyStubComparison::pattern_data
Int_t pattern_data
Definition: CSCTriggerPrimitivesReader.h:103
MuonDigiCollection
A container for a generic type of digis indexed by some index, implemented with a map<IndexType,...
Definition: MuonDigiCollection.h:87
CSCTriggerPrimitivesReader::hClctKeyStripME11
TH1F * hClctKeyStripME11
Definition: CSCTriggerPrimitivesReader.h:448
gather_cfg.cout
cout
Definition: gather_cfg.py:144
CSCTriggerPrimitivesReader::pretrigs_e_token_
edm::EDGetTokenT< CSCCLCTPreTriggerDigiCollection > pretrigs_e_token_
Definition: CSCTriggerPrimitivesReader.h:186
CSCTriggerPrimitivesReader::hLCTCompSameN2i
TH2F * hLCTCompSameN2i
Definition: CSCTriggerPrimitivesReader.h:394
CSCTriggerPrimitivesReader::hLctMPCChamber
TH1F * hLctMPCChamber[MAX_STATIONS]
Definition: CSCTriggerPrimitivesReader.h:340
CSCTriggerPrimitivesReader::hClctCompTotal
TH1F * hClctCompTotal
Definition: CSCTriggerPrimitivesReader.h:381
CSCTriggerPrimitivesReader::hResolDeltaPhiHS
TH1F * hResolDeltaPhiHS
Definition: CSCTriggerPrimitivesReader.h:434
CSCTriggerPrimitivesReader::hAlctCompFoundCsc
TH1F * hAlctCompFoundCsc[MAX_ENDCAPS][CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:408
edm::LogInfo
Definition: MessageLogger.h:254
CSCTriggerPrimitivesReader::hAlctKeyGroupME11
TH1F * hAlctKeyGroupME11
Definition: CSCTriggerPrimitivesReader.h:447
CSCTriggerPrimitivesReader::hHotWire1
TH1F * hHotWire1
Definition: CSCTriggerPrimitivesReader.h:315
CSCTriggerPrimitivesReader::hLCTCompMatch2i
TH2F * hLCTCompMatch2i
Definition: CSCTriggerPrimitivesReader.h:399
CSCTriggerPrimitivesReader::TWOPI
static const double TWOPI
Definition: CSCTriggerPrimitivesReader.h:204
cms::cuda::assert
assert(be >=bs)
CSCTriggerPrimitivesReader::lcts_tmb_e_token_
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > lcts_tmb_e_token_
Definition: CSCTriggerPrimitivesReader.h:187
CSCTriggerPrimitivesReader::hLCTCompSameN
TH1F * hLCTCompSameN
Definition: CSCTriggerPrimitivesReader.h:391
FastTrackerRecHitCombiner_cfi.simHits
simHits
Definition: FastTrackerRecHitCombiner_cfi.py:5
CSCTriggerPrimitivesReader::hLCTCompSameN2x
TH2F * hLCTCompSameN2x
Definition: CSCTriggerPrimitivesReader.h:393
CSCTriggerPrimitivesReader::hLCTCompMatch
TH1F * hLCTCompMatch
Definition: CSCTriggerPrimitivesReader.h:396
CSCConstants::KEY_ALCT_LAYER
Definition: CSCConstants.h:46
CSCTriggerPrimitivesReader::bookedCLCTHistos
static bool bookedCLCTHistos
Definition: CSCTriggerPrimitivesReader.h:226
CSCTriggerPrimitivesReader::bookedCompHistos
static bool bookedCompHistos
Definition: CSCTriggerPrimitivesReader.h:230
CSCLayer
Definition: CSCLayer.h:24
CSCTriggerPrimitivesReader::hAlctCompTotal2i
TH2F * hAlctCompTotal2i
Definition: CSCTriggerPrimitivesReader.h:365
CSCTriggerPrimitivesReader::chamberIX
int chamberIX(CSCDetId id)
Definition: CSCTriggerPrimitivesReader.cc:788
CSCTriggerPrimitivesReader::emulLctsIn_
bool emulLctsIn_
Definition: CSCTriggerPrimitivesReader.h:158
CSCTriggerPrimitivesReader::hLctTMBCsc
TH1F * hLctTMBCsc[MAX_ENDCAPS][CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:333
CSCTriggerPrimitivesReader::badChambers_
const CSCBadChambers * badChambers_
Definition: CSCTriggerPrimitivesReader.h:153
CSCTriggerPrimitivesReader::hEfficALCTEtaCsc
TH1F * hEfficALCTEtaCsc[CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:445
CSCTriggerPrimitivesReader::hLctMPCBXN
TH1F * hLctMPCBXN
Definition: CSCTriggerPrimitivesReader.h:343
CSCTriggerPrimitivesReader::MAX_ENDCAPS
Definition: CSCTriggerPrimitivesReader.h:202
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
CSCTriggerPrimitivesReader::bookCLCTHistos
void bookCLCTHistos()
Definition: CSCTriggerPrimitivesReader.cc:673
CSCTriggerPrimitivesReader::hClctPerEvent
TH1F * hClctPerEvent
Definition: CSCTriggerPrimitivesReader.h:323
indexGen.s2
s2
Definition: indexGen.py:107
CSCTriggerPrimitivesReader::hAlctValid
TH1F * hAlctValid
Definition: CSCTriggerPrimitivesReader.h:320
MyStubComparison::pattern_emul
Int_t pattern_emul
Definition: CSCTriggerPrimitivesReader.h:104
CSCTriggerPrimitivesReader::hTrueBendCsc
TH1F * hTrueBendCsc[CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:439
CSCTriggerPrimitivesReader::hLCTCompMatch2x
TH2F * hLCTCompMatch2x
Definition: CSCTriggerPrimitivesReader.h:398
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
CSCTriggerPrimitivesReader::hPhiDiffPattern
TH1F * hPhiDiffPattern[CSCConstants::NUM_CLCT_PATTERNS]
Definition: CSCTriggerPrimitivesReader.h:440
CSCTriggerPrimitivesReader::hLctTMBChamber
TH1F * hLctTMBChamber[MAX_STATIONS]
Definition: CSCTriggerPrimitivesReader.h:333
CSCTriggerPrimitivesReader::simHit_token_
edm::EDGetTokenT< edm::PSimHitContainer > simHit_token_
Definition: CSCTriggerPrimitivesReader.h:176
CSCTriggerPrimitivesReader::hResolDeltaPhiDS
TH1F * hResolDeltaPhiDS
Definition: CSCTriggerPrimitivesReader.h:434
CSCTriggerPrimitivesReader::~CSCTriggerPrimitivesReader
~CSCTriggerPrimitivesReader() override
Destructor.
Definition: CSCTriggerPrimitivesReader.cc:348
edm::Handle< CSCALCTDigiCollection >
relativeConstraints.error
error
Definition: relativeConstraints.py:53
CSCDetId::iChamberType
unsigned short iChamberType() const
Definition: CSCDetId.h:96
CSCTriggerPrimitivesReader::clcts_d_token_
edm::EDGetTokenT< CSCCLCTDigiCollection > clcts_d_token_
Definition: CSCTriggerPrimitivesReader.h:181
CSCTriggerPrimitivesReader::bookedLCTMPCHistos
static bool bookedLCTMPCHistos
Definition: CSCTriggerPrimitivesReader.h:228
MyStubComparison::WGcrossHS_data
Bool_t WGcrossHS_data
Definition: CSCTriggerPrimitivesReader.h:105
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
CSCTriggerPrimitivesReader::hResolDeltaDS
TH1F * hResolDeltaDS
Definition: CSCTriggerPrimitivesReader.h:433
CSCTriggerPrimitivesReader::hAlctPerCSC
TH1F * hAlctPerCSC
Definition: CSCTriggerPrimitivesReader.h:318
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
CSCTriggerPrimitivesReader::CSC_TYPES
Definition: CSCTriggerPrimitivesReader.h:202
nEvent
int nEvent
Definition: myFastSimVal.cc:45
MyStubComparison::bx_corr_emul
Int_t bx_corr_emul
Definition: CSCTriggerPrimitivesReader.h:92
CSCTriggerPrimitivesReader::hHotCham1
TH1F * hHotCham1
Definition: CSCTriggerPrimitivesReader.h:315
CSCTriggerPrimitivesReader::drawCLCTHistos
void drawCLCTHistos()
Definition: CSCTriggerPrimitivesReader.cc:3143
CSCTriggerPrimitivesReader::hAlctVsEta
TH1F * hAlctVsEta[MAX_STATIONS]
Definition: CSCTriggerPrimitivesReader.h:427
MyStubComparison::bend_emul
Int_t bend_emul
Definition: CSCTriggerPrimitivesReader.h:90
TreePerStub::t_chamber
Int_t t_chamber
Definition: CSCTriggerPrimitivesReader.h:58
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
CSCTriggerPrimitivesReader::hClctCompTotal2
TH2F * hClctCompTotal2
Definition: CSCTriggerPrimitivesReader.h:382
CSCDetId::triggerCscId
int triggerCscId() const
Definition: CSCDetId.cc:22
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
CSCTriggerPrimitivesReader::hClctKeyStripCsc
TH1F * hClctKeyStripCsc[CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:328
TreePerStub::t_station
Int_t t_station
Definition: CSCTriggerPrimitivesReader.h:61
MakerMacros.h
CSCTriggerPrimitivesReader::hLctMPCPattern
TH1F * hLctMPCPattern
Definition: CSCTriggerPrimitivesReader.h:343
CSCTriggerPrimitivesReader::hClctCompMatch2
TH2F * hClctCompMatch2
Definition: CSCTriggerPrimitivesReader.h:377
alignCSCRings.s
s
Definition: alignCSCRings.py:92
MyStubComparison::totStubs_emul
Int_t totStubs_emul
Definition: CSCTriggerPrimitivesReader.h:74
CSCTriggerPrimitivesReader::hLctTMBValid
TH1F * hLctTMBValid
Definition: CSCTriggerPrimitivesReader.h:334
CSCAnodeLCTAnalyzer::nearestWG
int nearestWG(const std::vector< CSCAnodeLayerInfo > &allLayerInfo, double &closestPhi, double &closestEta)
Definition: CSCAnodeLCTAnalyzer.cc:243
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
CSCTriggerPrimitivesReader::hAlctCollis
TH1F * hAlctCollis
Definition: CSCTriggerPrimitivesReader.h:320
mutypes.CSC_TYPES
list CSC_TYPES
Definition: mutypes.py:7
CSCTriggerPrimitivesReader::hClctCompFound2
TH2F * hClctCompFound2
Definition: CSCTriggerPrimitivesReader.h:368
CSCTriggerPrimitivesReader::hClctCompFound
TH1F * hClctCompFound
Definition: CSCTriggerPrimitivesReader.h:367
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
hgcalPlots.stat
stat
Definition: hgcalPlots.py:1111
spr::deltaEta
static const double deltaEta
Definition: CaloConstants.h:8
CSCTriggerPrimitivesReader::fillLCTMPCHistos
void fillLCTMPCHistos(const CSCCorrelatedLCTDigiCollection *lcts)
Definition: CSCTriggerPrimitivesReader.cc:1307
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
CSCTriggerPrimitivesReader::hLctMPCBend
TH1F * hLctMPCBend
Definition: CSCTriggerPrimitivesReader.h:343
FrontierCondition_GT_autoExpress_cfi.t0
t0
Definition: FrontierCondition_GT_autoExpress_cfi.py:148
CSCTriggerPrimitivesReader::hLctCompTotalCsc
TH1F * hLctCompTotalCsc[MAX_ENDCAPS][CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:420
MyStubComparison::bx_emul
Int_t bx_emul
Definition: CSCTriggerPrimitivesReader.h:91
Service.h
CSCTriggerPrimitivesReader::hPhiDiffVsPhi
TH1F * hPhiDiffVsPhi[MAX_STATIONS]
Definition: CSCTriggerPrimitivesReader.h:436
MyStubComparison::nStub_emul
Int_t nStub_emul
Definition: CSCTriggerPrimitivesReader.h:77
CSCTriggerPrimitivesReader::hClctCompSameNCsc
TH1F * hClctCompSameNCsc[MAX_ENDCAPS][CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:414
CSCTriggerPrimitivesReader::fillLCTTMBHistos
void fillLCTTMBHistos(const CSCCorrelatedLCTDigiCollection *lcts)
Definition: CSCTriggerPrimitivesReader.cc:1235
CSCCathodeLCTAnalyzer.h
CSCTriggerPrimitivesReader::hLctTMBPattern
TH1F * hLctTMBPattern
Definition: CSCTriggerPrimitivesReader.h:336
CSCTriggerPrimitivesReader::chamberIXi
int chamberIXi(CSCDetId id)
Definition: CSCTriggerPrimitivesReader.cc:774
CSCTriggerPrimitivesReader::compDigiProducer_
edm::InputTag compDigiProducer_
Definition: CSCTriggerPrimitivesReader.h:174
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
CSCTriggerPrimitivesReader::hClctKeyStrip
TH1F * hClctKeyStrip[2]
Definition: CSCTriggerPrimitivesReader.h:327
CSCConstants::NUM_LAYERS
Definition: CSCConstants.h:46
Surface::toGlobal
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
CSCDetId::layer
int layer() const
Definition: CSCDetId.h:56
MyStubComparison::key_WG_data
Int_t key_WG_data
Definition: CSCTriggerPrimitivesReader.h:107
CSCTriggerPrimitivesReader::hAlctCompTotal
TH1F * hAlctCompTotal
Definition: CSCTriggerPrimitivesReader.h:362
edm::ESHandle< CSCGeometry >
CSCTriggerPrimitivesReader::getHsPerRad
double getHsPerRad(const int idh)
Definition: CSCTriggerPrimitivesReader.cc:4709
CSCTriggerPrimitivesReader::compareALCTs
void compareALCTs(const CSCALCTDigiCollection *alcts_data, const CSCALCTDigiCollection *alcts_emul)
Definition: CSCTriggerPrimitivesReader.cc:1394
CSCTriggerPrimitivesReader::hEfficCLCTEta
TH1F * hEfficCLCTEta[MAX_STATIONS]
Definition: CSCTriggerPrimitivesReader.h:443
LaserClient_cfi.nbins
nbins
Definition: LaserClient_cfi.py:51
CSCLayerGeometry::middleWireOfGroup
float middleWireOfGroup(int wireGroup) const
Definition: CSCLayerGeometry.h:191
MyStubComparison::key_hs_emul
Int_t key_hs_emul
Definition: CSCTriggerPrimitivesReader.h:110
MyStubComparison::maxpattern_pretrig
Int_t maxpattern_pretrig
Definition: CSCTriggerPrimitivesReader.h:100
CSCTriggerPrimitivesReader::MAXPAGES
Definition: CSCTriggerPrimitivesReader.h:203
CSCTriggerPrimitivesReader::hAlctPerChamber
TH1F * hAlctPerChamber
Definition: CSCTriggerPrimitivesReader.h:318
CSCLayer::geometry
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:44
CSCTriggerPrimitivesReader::lctProducerEmul_
std::string lctProducerEmul_
Definition: CSCTriggerPrimitivesReader.h:171
CSCTriggerPrimitivesReader::bookedHotWireHistos
static bool bookedHotWireHistos
Definition: CSCTriggerPrimitivesReader.h:224
dqmdumpme.k
k
Definition: dqmdumpme.py:60
CSCTriggerPrimitivesReader::hLctTMBPerCSC
TH1F * hLctTMBPerCSC
Definition: CSCTriggerPrimitivesReader.h:331
Point3DBase< float, GlobalTag >
CSCTriggerPrimitivesReader::hAlctCompTotal2
TH2F * hAlctCompTotal2
Definition: CSCTriggerPrimitivesReader.h:363
CSCTriggerPrimitivesReader::hClctCompMatch
TH1F * hClctCompMatch
Definition: CSCTriggerPrimitivesReader.h:376
OrderedSet.t
t
Definition: OrderedSet.py:90
CSCTriggerPrimitivesReader::hLctTMBKeyStrip
TH1F * hLctTMBKeyStrip
Definition: CSCTriggerPrimitivesReader.h:335
CSCTriggerPrimitivesReader::bookCompHistos
void bookCompHistos()
Definition: CSCTriggerPrimitivesReader.cc:866
CSCTriggerPrimitivesReader::hLctMPCEndcap
TH1F * hLctMPCEndcap
Definition: CSCTriggerPrimitivesReader.h:339
CSCTriggerPrimitivesReader::hAlctCompMatch2
TH2F * hAlctCompMatch2
Definition: CSCTriggerPrimitivesReader.h:358
CSCTriggerPrimitivesReader::drawEfficHistos
void drawEfficHistos()
Definition: CSCTriggerPrimitivesReader.cc:4253
particleFlowDisplacedVertex_cfi.ratio
ratio
Definition: particleFlowDisplacedVertex_cfi.py:93
CSCTriggerPrimitivesReader::hClctBXN
TH1F * hClctBXN
Definition: CSCTriggerPrimitivesReader.h:326
MyStubComparison::npretrig
Int_t npretrig
Definition: CSCTriggerPrimitivesReader.h:93
CSCTriggerPrimitivesReader::hLCTCompTotal2x
TH2F * hLCTCompTotal2x
Definition: CSCTriggerPrimitivesReader.h:403
CSCTriggerPrimitivesReader::hClctCompFound2x
TH2F * hClctCompFound2x
Definition: CSCTriggerPrimitivesReader.h:369
TreePerStub::t_nStubs
Int_t t_nStubs
Definition: CSCTriggerPrimitivesReader.h:52
CSCTriggerPrimitivesReader::alcts_e_token_
edm::EDGetTokenT< CSCALCTDigiCollection > alcts_e_token_
Definition: CSCTriggerPrimitivesReader.h:184
MyStubComparison::bx_data
Int_t bx_data
Definition: CSCTriggerPrimitivesReader.h:88
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CSCTriggerPrimitivesReader::hClctCompFound2i
TH2F * hClctCompFound2i
Definition: CSCTriggerPrimitivesReader.h:370
MyStubComparison::nStub_data
Int_t nStub_data
Definition: CSCTriggerPrimitivesReader.h:76
CSCTriggerPrimitivesReader::hAlctCompTotal2x
TH2F * hAlctCompTotal2x
Definition: CSCTriggerPrimitivesReader.h:364
MuonTCMETValueMapProducer_cff.nLayers
nLayers
Definition: MuonTCMETValueMapProducer_cff.py:38
CSCTriggerPrimitivesReader::hLctTMBSector
TH1F * hLctTMBSector
Definition: CSCTriggerPrimitivesReader.h:332
CSCTriggerPrimitivesReader::hLctMPCKeyStripME11
TH1F * hLctMPCKeyStripME11
Definition: CSCTriggerPrimitivesReader.h:452
CSCTriggerPrimitivesReader::hClctCompMatchCsc
TH1F * hClctCompMatchCsc[MAX_ENDCAPS][CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:416
edm::LogWarning
Definition: MessageLogger.h:141
MyStubComparison::key_WG_emul
Int_t key_WG_emul
Definition: CSCTriggerPrimitivesReader.h:108
CSCTriggerPrimitivesReader::hClctCFEB
TH1F * hClctCFEB
Definition: CSCTriggerPrimitivesReader.h:325
TFileService.h
CSCBadChambers::isInBadChamber
bool isInBadChamber(IndexType ichamber) const
Is the chamber with index 'ichamber' flagged as bad?
Definition: CSCBadChambers.cc:4
MyStubComparison::totStubs_emul_readout
Int_t totStubs_emul_readout
Definition: CSCTriggerPrimitivesReader.h:75
CSCTriggerPrimitivesReader::debug
bool debug
Definition: CSCTriggerPrimitivesReader.h:142
CSCTriggerPrimitivesReader::hLctCompMatchCsc
TH1F * hLctCompMatchCsc[MAX_ENDCAPS][CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:421
CSCDetId::triggerSector
int triggerSector() const
Definition: CSCDetId.cc:3
CSCTriggerPrimitivesReader::hClctCompSameN2x
TH2F * hClctCompSameN2x
Definition: CSCTriggerPrimitivesReader.h:373
CSCTriggerPrimitivesReader::lut_wg_vs_hs_me1b
static const int lut_wg_vs_hs_me1b[48][2]
Definition: CSCTriggerPrimitivesReader.h:215
CSCTriggerPrimitivesReader::compDigi_token_
edm::EDGetTokenT< CSCComparatorDigiCollection > compDigi_token_
Definition: CSCTriggerPrimitivesReader.h:178
CSCTriggerPrimitivesReader::hLctTMBPerChamber
TH1F * hLctTMBPerChamber
Definition: CSCTriggerPrimitivesReader.h:330
CSCTriggerPrimitivesReader::resultsFileNamesPrefix_
std::string resultsFileNamesPrefix_
Definition: CSCTriggerPrimitivesReader.h:191
CSCTriggerPrimitivesReader::fillCLCTHistos
void fillCLCTHistos(const CSCCLCTDigiCollection *clcts)
Definition: CSCTriggerPrimitivesReader.cc:1175
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
CSCTriggerPrimitivesReader::hLctMPCKeyStrip
TH1F * hLctMPCKeyStrip
Definition: CSCTriggerPrimitivesReader.h:342
CSCTriggerPrimitivesReader::calcEfficiency
void calcEfficiency(const CSCALCTDigiCollection *alcts, const CSCCLCTDigiCollection *clcts, const edm::PSimHitContainer &allSimHits)
Definition: CSCTriggerPrimitivesReader.cc:2906
edm::ParameterSet
Definition: ParameterSet.h:36
CSCTriggerPrimitivesReader::eventsAnalyzed
int eventsAnalyzed
Definition: CSCTriggerPrimitivesReader.h:141
CSCTriggerPrimitivesReader::setRootStyle
void setRootStyle()
Definition: CSCTriggerPrimitivesReader.cc:601
MyStubComparison::bend_data
Int_t bend_data
Definition: CSCTriggerPrimitivesReader.h:87
MyStubComparison::firstfill
Bool_t firstfill
Definition: CSCTriggerPrimitivesReader.h:72
CSCTriggerPrimitivesReader::compareCLCTs
void compareCLCTs(const CSCCLCTDigiCollection *clcts_data, const CSCCLCTDigiCollection *clcts_emul, const CSCCLCTPreTriggerDigiCollection *pretrigs_emul)
Definition: CSCTriggerPrimitivesReader.cc:1670
CSCTriggerPrimitivesReader::event_tree
TTree * event_tree[6]
Definition: CSCTriggerPrimitivesReader.h:311
CSCTriggerPrimitivesReader::hClctStripType
TH1F * hClctStripType
Definition: CSCTriggerPrimitivesReader.h:325
CSCTriggerPrimitivesReader::hClctVsPhi
TH1F * hClctVsPhi[MAX_STATIONS]
Definition: CSCTriggerPrimitivesReader.h:435
MyStubComparison::phi_data
Float_t phi_data
Definition: CSCTriggerPrimitivesReader.h:117
CSCTriggerPrimitivesReader::Event_
int Event_
Definition: CSCTriggerPrimitivesReader.h:147
CSCTriggerPrimitivesReader::hClctCompTotalCsc
TH1F * hClctCompTotalCsc[MAX_ENDCAPS][CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:415
CSCTriggerPrimitivesReader::hAlctCompSameN2i
TH2F * hAlctCompSameN2i
Definition: CSCTriggerPrimitivesReader.h:355
CSCTriggerPrimitivesReader::plotME1A
bool plotME1A
Definition: CSCTriggerPrimitivesReader.h:163
CSCTriggerPrimitivesReader::hLctMPCStripType
TH1F * hLctMPCStripType
Definition: CSCTriggerPrimitivesReader.h:342
CSCTriggerPrimitivesReader::hLctMPCRing
TH1F * hLctMPCRing
Definition: CSCTriggerPrimitivesReader.h:339
CSCTriggerPrimitivesReader::hLctMPCValid
TH1F * hLctMPCValid
Definition: CSCTriggerPrimitivesReader.h:341
CSCConstants::MAX_HALF_STRIP_ME1B
Definition: CSCConstants.h:39
CSCTriggerPrimitivesReader::hLctTMBBend
TH1F * hLctTMBBend
Definition: CSCTriggerPrimitivesReader.h:336
CSCTriggerPrimitivesReader::hAlctCompSameNCsc
TH1F * hAlctCompSameNCsc[MAX_ENDCAPS][CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:409
CSCDetId
Definition: CSCDetId.h:26
CSCTriggerPrimitivesReader::ptype_TMB07
static const int ptype_TMB07[CSCConstants::NUM_CLCT_PATTERNS]
Definition: CSCTriggerPrimitivesReader.h:213
CSCTriggerPrimitivesReader::hClctCompFoundCsc
TH1F * hClctCompFoundCsc[MAX_ENDCAPS][CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:413
PV3DBase::eta
T eta() const
Definition: PV3DBase.h:73
CSCTriggerPrimitivesReader::hLctMPCPerEvent
TH1F * hLctMPCPerEvent
Definition: CSCTriggerPrimitivesReader.h:338
MyStubComparison::bend_pretrig
Int_t bend_pretrig
Definition: CSCTriggerPrimitivesReader.h:96
CSCTriggerPrimitivesReader::numCLCT
static int numCLCT
Definition: CSCTriggerPrimitivesReader.h:220
edm::Service< TFileService >
CSCTriggerPrimitivesReader::hLctCompSameNCsc
TH1F * hLctCompSameNCsc[MAX_ENDCAPS][CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:419
CSCTriggerPrimitivesReader::bookedEfficHistos
static bool bookedEfficHistos
Definition: CSCTriggerPrimitivesReader.h:233
CSCTriggerPrimitivesReader::hPhiDiffCsc
TH1F * hPhiDiffCsc[CSC_TYPES][5]
Definition: CSCTriggerPrimitivesReader.h:437
CSCTriggerPrimitivesReader::hResolDeltaHS
TH1F * hResolDeltaHS
Definition: CSCTriggerPrimitivesReader.h:433
iEvent
int iEvent
Definition: GenABIO.cc:224
testProducerWithPsetDescEmpty_cfi.u1
u1
Definition: testProducerWithPsetDescEmpty_cfi.py:49
CSCTriggerPrimitivesReader::hLCTCompSameN2
TH2F * hLCTCompSameN2
Definition: CSCTriggerPrimitivesReader.h:392
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
CSCTriggerPrimitivesReader::drawLCTTMBHistos
void drawLCTTMBHistos()
Definition: CSCTriggerPrimitivesReader.cc:3273
CSCTriggerPrimitivesReader::CSCTriggerPrimitivesReader
CSCTriggerPrimitivesReader(const edm::ParameterSet &conf)
Constructor.
Definition: CSCTriggerPrimitivesReader.cc:275
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
topSingleLeptonDQM_PU_cfi.pattern
pattern
Definition: topSingleLeptonDQM_PU_cfi.py:39
CSCALCTDigiCollection
CSCTriggerPrimitivesReader::hClctPerChamber
TH1F * hClctPerChamber
Definition: CSCTriggerPrimitivesReader.h:323
CSCTriggerPrimitivesReader::hAlctPerEvent
TH1F * hAlctPerEvent
Definition: CSCTriggerPrimitivesReader.h:318
CSCTriggerPrimitivesReader::wireDigiProducer_
edm::InputTag wireDigiProducer_
Definition: CSCTriggerPrimitivesReader.h:173
MuonDigiCollection::get
Range get(const IndexType &index) const
return the digis for a given DetUnit
Definition: MuonDigiCollection.h:121
CSCTriggerPrimitivesReader::hAlctCompFound2i
TH2F * hAlctCompFound2i
Definition: CSCTriggerPrimitivesReader.h:350
CSCTriggerPrimitivesReader::hAlctAccel
TH1F * hAlctAccel
Definition: CSCTriggerPrimitivesReader.h:320
CSCComparatorDigiCollection
CSCTriggerPrimitivesReader::hLctTMBStation
TH1F * hLctTMBStation
Definition: CSCTriggerPrimitivesReader.h:332
CSCDetId::chamber
int chamber() const
Definition: CSCDetId.h:62
TreePerStub::t_EventNumberAnalyzed
Int_t t_EventNumberAnalyzed
Definition: CSCTriggerPrimitivesReader.h:49
CSCAnodeLCTAnalyzer.h
CSCTriggerPrimitivesReader::hLctTMBPerEvent
TH1F * hLctTMBPerEvent
Definition: CSCTriggerPrimitivesReader.h:330
edm::EventSetup
Definition: EventSetup.h:57
CSCTriggerPrimitivesReader::hLctTMBRing
TH1F * hLctTMBRing
Definition: CSCTriggerPrimitivesReader.h:332
CSCTriggerPrimitivesReader::hEtaDiffCsc
TH1F * hEtaDiffCsc[CSC_TYPES][3]
Definition: CSCTriggerPrimitivesReader.h:429
CSCTriggerPrimitivesReader::lcts_mpc_d_token_
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > lcts_mpc_d_token_
Definition: CSCTriggerPrimitivesReader.h:183
CSCCorrelatedLCTDigiCollection
CSCTriggerPrimitivesReader::hClctCompMatch2i
TH2F * hClctCompMatch2i
Definition: CSCTriggerPrimitivesReader.h:379
get
#define get
CSCTriggerPrimitivesReader::hAlctCsc
TH1F * hAlctCsc[MAX_ENDCAPS][CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:319
CSCTriggerPrimitivesReader::bookLCTTMBHistos
void bookLCTTMBHistos()
Definition: CSCTriggerPrimitivesReader.cc:726
CSCTriggerPrimitivesReader::printps
static bool printps
Definition: CSCTriggerPrimitivesReader.h:235
CSCTriggerPrimitivesReader::hClctCompMatch2x
TH2F * hClctCompMatch2x
Definition: CSCTriggerPrimitivesReader.h:378
CSCTriggerPrimitivesReader::hLctTMBKeyGroupME11
TH1F * hLctTMBKeyGroupME11
Definition: CSCTriggerPrimitivesReader.h:449
CSCTriggerPrimitivesReader::bookedLCTTMBHistos
static bool bookedLCTTMBHistos
Definition: CSCTriggerPrimitivesReader.h:227
MyStubComparison::ring
Int_t ring
Definition: CSCTriggerPrimitivesReader.h:79
CSCBadChambersRcd.h
CSCTriggerPrimitivesReader::MAX_STATIONS
Definition: CSCTriggerPrimitivesReader.h:202
CSCTriggerPrimitivesReader::hClctCsc
TH1F * hClctCsc[MAX_ENDCAPS][CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:324
CSCTriggerPrimitivesReader::compare
void compare(const CSCALCTDigiCollection *alcts_data, const CSCALCTDigiCollection *alcts_emul, const CSCCLCTDigiCollection *clcts_data, const CSCCLCTDigiCollection *clcts_emul, const CSCCLCTPreTriggerDigiCollection *pretrigs_emul, const CSCCorrelatedLCTDigiCollection *lcts_data, const CSCCorrelatedLCTDigiCollection *lcts_emul)
Definition: CSCTriggerPrimitivesReader.cc:1376
CSCTriggerPrimitivesReader::NCHAMBERS
static const int NCHAMBERS[CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:210
CSCConstants::MAX_HALF_STRIP_ME1A_UNGANGED
Definition: CSCConstants.h:37
overlapproblemtsosanalyzer_cfi.title
title
Definition: overlapproblemtsosanalyzer_cfi.py:7
CSCCathodeLCTAnalyzer::getSimInfo
std::vector< CSCCathodeLayerInfo > getSimInfo(const CSCCLCTDigi &clct, const CSCDetId &clctId, const CSCComparatorDigiCollection *compdc, const edm::PSimHitContainer *allSimHits)
Definition: CSCCathodeLCTAnalyzer.cc:16
CSCTriggerPrimitivesReader::hClctPerCSC
TH1F * hClctPerCSC
Definition: CSCTriggerPrimitivesReader.h:323
MyStubComparison::key_hs_pretrig
Int_t key_hs_pretrig
Definition: CSCTriggerPrimitivesReader.h:98
DDAxes::phi
CSCTriggerPrimitivesReader::hLctCompFoundCsc
TH1F * hLctCompFoundCsc[MAX_ENDCAPS][CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:418
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
CSCTriggerPrimitivesReader::drawALCTHistos
void drawALCTHistos()
Definition: CSCTriggerPrimitivesReader.cc:3046
MyStubComparison::maxquality_pretrig
Int_t maxquality_pretrig
Definition: CSCTriggerPrimitivesReader.h:95
CSCTriggerPrimitivesReader::hLCTCompFound
TH1F * hLCTCompFound
Definition: CSCTriggerPrimitivesReader.h:386
MyStubComparison::station
Int_t station
Definition: CSCTriggerPrimitivesReader.h:81
CSCTriggerPrimitivesReader::hEtaRecVsSim
TH2F * hEtaRecVsSim
Definition: CSCTriggerPrimitivesReader.h:425
CSCTriggerPrimitivesReader::hLctMPCStation
TH1F * hLctMPCStation
Definition: CSCTriggerPrimitivesReader.h:339
CSCBadChambersRcd
Definition: CSCBadChambersRcd.h:5
type
type
Definition: HCALResponse.h:21
CSCTriggerPrimitivesReader::lut_wg_vs_hs_me1ag
static const int lut_wg_vs_hs_me1ag[48][2]
Definition: CSCTriggerPrimitivesReader.h:217
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
writedatasetfile.run
run
Definition: writedatasetfile.py:27
CSCWireDigiCollection
CSCGeometry::layer
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:105
CSCTriggerPrimitivesReader::hAlctCompMatch
TH1F * hAlctCompMatch
Definition: CSCTriggerPrimitivesReader.h:357
CSCTriggerPrimitivesReader::bookEfficHistos
void bookEfficHistos()
Definition: CSCTriggerPrimitivesReader.cc:1096
TreePerStub::bookTree
TTree * bookTree(TTree *t, const std::string &name="TreePerStub")
Definition: CSCTriggerPrimitivesReader.cc:140
CSCTriggerPrimitivesReader::plotME42
bool plotME42
Definition: CSCTriggerPrimitivesReader.h:166
CSCTriggerPrimitivesReader::hEtaDiffVsEta
TH1F * hEtaDiffVsEta[MAX_STATIONS]
Definition: CSCTriggerPrimitivesReader.h:428
CSCTriggerPrimitivesReader::hResolDeltaEta
TH1F * hResolDeltaEta
Definition: CSCTriggerPrimitivesReader.h:426
qcdUeDQM_cfi.quality
quality
Definition: qcdUeDQM_cfi.py:31
CSCTriggerPrimitivesReader::hAlctCompFound2x
TH2F * hAlctCompFound2x
Definition: CSCTriggerPrimitivesReader.h:349
CSCTriggerPrimitivesReader::numALCT
static int numALCT
Definition: CSCTriggerPrimitivesReader.h:219
CSCLayer.h
CSCTriggerPrimitivesReader.h
CSCTriggerPrimitivesReader::fillALCTHistos
void fillALCTHistos(const CSCALCTDigiCollection *alcts)
Definition: CSCTriggerPrimitivesReader.cc:1128
CSCDetId::endcap
int endcap() const
Definition: CSCDetId.h:85
CSCTriggerPrimitivesReader::hLctTMBEndcap
TH1F * hLctTMBEndcap
Definition: CSCTriggerPrimitivesReader.h:332
MainPageGenerator.page
page
Definition: MainPageGenerator.py:300
TreePerStub::init
void init(int run, int event)
Definition: CSCTriggerPrimitivesReader.cc:126
CSCTriggerPrimitivesReader::hLctTMBQuality
TH1F * hLctTMBQuality
Definition: CSCTriggerPrimitivesReader.h:334
CSCCLCTDigiCollection
CSCTriggerPrimitivesReader::hAlctCompMatchCsc
TH1F * hAlctCompMatchCsc[MAX_ENDCAPS][CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:411
CSCCathodeLCTAnalyzer::nearestHS
int nearestHS(const std::vector< CSCCathodeLayerInfo > &allLayerInfo, double &closestPhi, double &closestEta)
Definition: CSCCathodeLCTAnalyzer.cc:304
CSCAnodeLCTAnalyzer::getWGEta
double getWGEta(const CSCDetId &layerId, const int wiregroup)
Definition: CSCAnodeLCTAnalyzer.cc:332
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
MyStubComparison::fullbx_data
Int_t fullbx_data
Definition: CSCTriggerPrimitivesReader.h:101
CSCTriggerPrimitivesReader::hAlctCompSameN
TH1F * hAlctCompSameN
Definition: CSCTriggerPrimitivesReader.h:352
MyStubComparison::WGcrossHS_emul
Bool_t WGcrossHS_emul
Definition: CSCTriggerPrimitivesReader.h:106
CSCTriggerPrimitivesReader::hPhiDiffVsStripCsc
TH2F * hPhiDiffVsStripCsc[CSC_TYPES][2]
Definition: CSCTriggerPrimitivesReader.h:438
CSCTriggerPrimitivesReader::hClctValid
TH1F * hClctValid
Definition: CSCTriggerPrimitivesReader.h:325
CSCTriggerPrimitivesReader::hAlctCompFound2
TH2F * hAlctCompFound2
Definition: CSCTriggerPrimitivesReader.h:348
CSCConstants::KEY_CLCT_LAYER
Definition: CSCConstants.h:46
CSCTriggerPrimitivesReader::drawHistosForTalks
void drawHistosForTalks()
Definition: CSCTriggerPrimitivesReader.cc:4415
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
CSCTriggerPrimitivesReader::convertBXofLCT
int convertBXofLCT(const int emul_bx, const CSCDetId &detid, const CSCALCTDigiCollection *alcts_data, const CSCCLCTDigiCollection *clcts_data)
Definition: CSCTriggerPrimitivesReader.cc:2553
CSCTriggerPrimitivesReader::wireDigi_token_
edm::EDGetTokenT< CSCWireDigiCollection > wireDigi_token_
Definition: CSCTriggerPrimitivesReader.h:177
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
CSCTriggerPrimitivesReader::bookedALCTHistos
static bool bookedALCTHistos
Definition: CSCTriggerPrimitivesReader.h:225
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
CSCTriggerPrimitivesReader::getGlobalPosition
GlobalPoint getGlobalPosition(unsigned int rawId, int keWg, int keyHS) const
Definition: CSCTriggerPrimitivesReader.cc:4637
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
CSCTriggerPrimitivesReader::simHitProducer_
edm::InputTag simHitProducer_
Definition: CSCTriggerPrimitivesReader.h:172
CSCTriggerPrimitivesReader::bookHotWireHistos
void bookHotWireHistos()
Definition: CSCTriggerPrimitivesReader.cc:633
CSCTriggerPrimitivesReader::hClctQuality
TH1F * hClctQuality
Definition: CSCTriggerPrimitivesReader.h:325
CSCTriggerPrimitivesReader::hCorrLctTMBPerCSC
TH1F * hCorrLctTMBPerCSC
Definition: CSCTriggerPrimitivesReader.h:331
MyStubComparison::trknmb_data
Int_t trknmb_data
Definition: CSCTriggerPrimitivesReader.h:111
CSCCathodeLCTAnalyzer::setGeometry
void setGeometry(const CSCGeometry *geom)
Definition: CSCCathodeLCTAnalyzer.cc:399
CSCTriggerPrimitivesReader
Definition: CSCTriggerPrimitivesReader.h:121
MyStubComparison::fullbx_emul
Int_t fullbx_emul
Definition: CSCTriggerPrimitivesReader.h:102
CSCTriggerPrimitivesReader::alcts_d_token_
edm::EDGetTokenT< CSCALCTDigiCollection > alcts_d_token_
Definition: CSCTriggerPrimitivesReader.h:180
CSCTriggerPrimitivesReader::endJob
void endJob() override
Write to ROOT file, make plots, etc.
Definition: CSCTriggerPrimitivesReader.cc:505
CSCTriggerPrimitivesReader::perStub
TreePerStub perStub[6]
Definition: CSCTriggerPrimitivesReader.h:310
MyStubComparison::has_data
Bool_t has_data
Definition: CSCTriggerPrimitivesReader.h:83
ConsumesCollector.h
CSCTriggerPrimitivesReader::hClctPattern
TH1F * hClctPattern[2]
Definition: CSCTriggerPrimitivesReader.h:327
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
MyStubComparison::endcap
Int_t endcap
Definition: CSCTriggerPrimitivesReader.h:80
CSCTriggerPrimitivesReader::compareLCTs
void compareLCTs(const CSCCorrelatedLCTDigiCollection *lcts_data, const CSCCorrelatedLCTDigiCollection *lcts_emul, const CSCALCTDigiCollection *alcts_data, const CSCCLCTDigiCollection *clcts_data)
Definition: CSCTriggerPrimitivesReader.cc:2022
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition: PSimHitContainer.h:11
CSCConstants::NUM_CLCT_PATTERNS
Definition: CSCConstants.h:51
CSCTriggerPrimitivesReader::hEfficHitsEtaCsc
TH1F * hEfficHitsEtaCsc[CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:444
CSCDetId::station
int station() const
Definition: CSCDetId.h:79
CSCTriggerPrimitivesReader::hClctSign
TH1F * hClctSign
Definition: CSCTriggerPrimitivesReader.h:325
CSCTriggerPrimitivesReader::calcResolution
void calcResolution(const CSCALCTDigiCollection *alcts, const CSCCLCTDigiCollection *clcts, const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const edm::PSimHitContainer &allSimHits)
Definition: CSCTriggerPrimitivesReader.cc:2715
CSCTriggerPrimitivesReader::hLctMPCSector
TH1F * hLctMPCSector
Definition: CSCTriggerPrimitivesReader.h:339
CSCTriggerPrimitivesReader::csc_type_plus
static const std::string csc_type_plus[CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:208
MyStubComparison::key_hs_data
Int_t key_hs_data
Definition: CSCTriggerPrimitivesReader.h:109
HepMCProduct.h
MuonGeometryRecord.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
CSCTriggerPrimitivesReader::stub_tree
TTree * stub_tree[4]
Definition: CSCTriggerPrimitivesReader.h:308
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
event
Definition: event.py:1
nEvents
UInt_t nEvents
Definition: hcalCalib.cc:41
MetAnalyzer.u2
u2
Definition: MetAnalyzer.py:61
MyStubComparison::trknmb_emul
Int_t trknmb_emul
Definition: CSCTriggerPrimitivesReader.h:112
edm::Event
Definition: Event.h:73
CSCTriggerPrimitivesReader::lcts_tmb_d_token_
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > lcts_tmb_d_token_
Definition: CSCTriggerPrimitivesReader.h:182
MyStubComparison::chambertype
Int_t chambertype
Definition: CSCTriggerPrimitivesReader.h:82
CSCTriggerPrimitivesReader::drawResolHistos
void drawResolHistos()
Definition: CSCTriggerPrimitivesReader.cc:3865
CSCTriggerPrimitivesReader::HotWires
void HotWires(const edm::Event &iEvent)
Definition: CSCTriggerPrimitivesReader.cc:2598
triggerCscId
Int_t triggerCscId(Int_t station, Int_t ring, Int_t chamber) const
Definition: triggerCscIdSector.h:21
CSCTriggerPrimitivesReader::hLctMPCPerCSC
TH1F * hLctMPCPerCSC
Definition: CSCTriggerPrimitivesReader.h:338
MyStubComparison::phi_emul
Float_t phi_emul
Definition: CSCTriggerPrimitivesReader.h:118
MyStubComparison::init
void init(int run, int event)
Definition: CSCTriggerPrimitivesReader.cc:163
event
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of "!*" before the partial wildcard feature was incorporated). The per-event "cost" of each negative criterion with multiple relevant triggers is about the same as ! *was in the past
CSCTriggerPrimitivesReader::hLCTCompTotal2
TH2F * hLCTCompTotal2
Definition: CSCTriggerPrimitivesReader.h:402
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
edm::InputTag
Definition: InputTag.h:15
CSCTriggerPrimitivesReader::MAX_WG
static const int MAX_WG[CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:211
CSCBadChambers.h
MyStubComparison::pattern_pretrig
Int_t pattern_pretrig
Definition: CSCTriggerPrimitivesReader.h:99
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
CSCTriggerPrimitivesReader::hLctTMBBXN
TH1F * hLctTMBBXN
Definition: CSCTriggerPrimitivesReader.h:336
MyStubComparison::eta_emul
Float_t eta_emul
Definition: CSCTriggerPrimitivesReader.h:116
TreePerStub::t_nStubs_readout
Int_t t_nStubs_readout
Definition: CSCTriggerPrimitivesReader.h:53
CSCGeometry::chamber
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
Definition: CSCGeometry.cc:100
CSCConstants::MAX_HALF_STRIP_ME1A_GANGED
Definition: CSCConstants.h:35
CSCAnodeLCTAnalyzer
Definition: CSCAnodeLCTAnalyzer.h:25
CSCTriggerPrimitivesReader::dataIsAnotherMC_
bool dataIsAnotherMC_
Definition: CSCTriggerPrimitivesReader.h:197
CSCTriggerPrimitivesReader::doesALCTCrossCLCT
bool doesALCTCrossCLCT(CSCDetId id, int key_wg, int key_hs) const
Definition: CSCTriggerPrimitivesReader.cc:4658
CSCTriggerPrimitivesReader::hLctTMBKeyGroup
TH1F * hLctTMBKeyGroup
Definition: CSCTriggerPrimitivesReader.h:334
CSCTriggerPrimitivesReader::hLctTMBKeyStripME11
TH1F * hLctTMBKeyStripME11
Definition: CSCTriggerPrimitivesReader.h:450
MyStubComparison::bx_pretrig
Int_t bx_pretrig
Definition: CSCTriggerPrimitivesReader.h:97
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
MyStubComparison::totStubs_data
Int_t totStubs_data
Definition: CSCTriggerPrimitivesReader.h:73
CSCTriggerPrimitivesReader::hLCTCompMatch2
TH2F * hLCTCompMatch2
Definition: CSCTriggerPrimitivesReader.h:397
triggerSector
Int_t triggerSector(Int_t station, Int_t ring, Int_t chamber) const
Definition: triggerCscIdSector.h:3
CSCTriggerPrimitivesReader::bookALCTHistos
void bookALCTHistos()
Definition: CSCTriggerPrimitivesReader.cc:640
CSCCathodeLCTAnalyzer
Definition: CSCCathodeLCTAnalyzer.h:25
CSCGeometry.h
CSCTriggerPrimitivesReader::geom_
const CSCGeometry * geom_
Definition: CSCTriggerPrimitivesReader.h:150
MyStubComparison::quality_pretrig
Int_t quality_pretrig
Definition: CSCTriggerPrimitivesReader.h:94
CSCTriggerPrimitivesReader::lcts_mpc_e_token_
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > lcts_mpc_e_token_
Definition: CSCTriggerPrimitivesReader.h:188
CSCTriggerPrimitivesReader::csc_type
static const std::string csc_type[CSC_TYPES]
Definition: CSCTriggerPrimitivesReader.h:207
CSCTriggerPrimitivesReader::hClctCompSameN2
TH2F * hClctCompSameN2
Definition: CSCTriggerPrimitivesReader.h:372
CSCTriggerPrimitivesReader::RUN_
int RUN_
Definition: CSCTriggerPrimitivesReader.h:146
CSCTriggerPrimitivesReader::hResolDeltaPhi
TH1F * hResolDeltaPhi
Definition: CSCTriggerPrimitivesReader.h:434
CSCTriggerPrimitivesReader::hAlctCompSameN2x
TH2F * hAlctCompSameN2x
Definition: CSCTriggerPrimitivesReader.h:354