CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1TScalersSCAL.cc
Go to the documentation of this file.
1 // Class: L1TScalersSCAL
2 // user include files
3 
4 #include <sstream>
5 #include <vector>
6 
9 
12 
19 
23 
24 
25 const double SECS_PER_LUMI = 23.31040958083832;
26 
27 
28 using namespace edm;
29 using namespace std;
30 
31 
33  dbe_(0),
34  scalersSource_( ps.getParameter< edm::InputTag >("scalersResults")),
35  verbose_(ps.getUntrackedParameter <bool> ("verbose", false)),
36  denomIsTech_(ps.getUntrackedParameter <bool> ("denomIsTech", true)),
37  denomBit_(ps.getUntrackedParameter <unsigned int> ("denomBit", 40)),
38  muonBit_(ps.getUntrackedParameter <unsigned int> ("muonBit", 55)),
39  egammaBit_(ps.getUntrackedParameter <unsigned int> ("egammaBit", 46)),
40  jetBit_(ps.getUntrackedParameter <unsigned int> ("jetBit", 15))
41 {
42  LogDebug("Status") << "constructor" ;
43 
44  for ( int i=0; i<Level1TriggerScalers::nLevel1Triggers; i++)
45  { bufferAlgoRates_.push_back(0); algorithmRates_.push_back(0); integral_algo_.push_back(0.);}
47  { bufferTechRates_.push_back(0); technicalRates_.push_back(0); integral_tech_.push_back(0.);}
48 
49  buffertime_ = 0;
50  reftime_ = 0;
51  nev_ = 0;
53  bufferLumi_ = 0;
54 
55  int maxNbins = 2001;
56 
58  if(dbe_) {
59  dbe_->setVerbose(0);
60 
61  dbe_->setCurrentFolder("L1T/L1TScalersSCAL/Level1TriggerScalers");
62 
63  //orbitNum = dbe_->book1D("Orbit_Number","Orbit_Number", 1000,0,10E8);
64  orbitNum = dbe_->book1D("Orbit_Number","Orbit_Number", maxNbins,-0.5,double(maxNbins)-0.5);
65 
66  trigNum = dbe_->book1D("Number_of_Triggers","Number_of_Triggers",1000,0,4E4);
67  trigNum->setAxisTitle("Time [sec]", 1);
68 
69  //eventNum = dbe_->book1D("Number_of_Events","Number_of_Events", 1000,0,1E7);
70  eventNum = dbe_->book1D("Number_of_Events","Number_of_Events", maxNbins,-0.5,double(maxNbins)-0.5);
71 
72  physTrig = dbe_->book1D("Physics_Triggers","Physics_Triggers", maxNbins,-0.5,double(maxNbins)-0.5);
73  physTrig->setAxisTitle("Lumi Section", 1);
74 
75  randTrig = dbe_->book1D("Random_Triggers","Random_Triggers", maxNbins,-0.5,double(maxNbins)-0.5);
76  randTrig->setAxisTitle("Lumi Section", 1);
77 
78  //numberResets = dbe_->book1D("Number_Resets","Number_Resets", 1000,0,1000);
79  numberResets = dbe_->book1D("Number_Resets","Number_Resets", maxNbins,-0.5,double(maxNbins)-0.5);
80 
81  //deadTime = dbe_->book1D("DeadTime","DeadTime", 1000,0,1E9);
82  deadTime = dbe_->book1D("DeadTime","DeadTime", maxNbins,-0.5,double(maxNbins)-0.5);
83 
84  //lostFinalTriggers = dbe_->book1D("Lost_Final_Trigger","Lost_Final_Trigger", 1000,0,1E6);
85  lostFinalTriggers = dbe_->book1D("Lost_Final_Trigger","Lost_Final_Trigger", maxNbins,-0.5,double(maxNbins)-0.5);
86 
87  dbe_->setCurrentFolder("L1T/L1TScalersSCAL/Level1TriggerRates");
88 
89  physRate = dbe_->book1D("Physics_Trigger_Rate","Physics_Trigger_Rate",
90  maxNbins,-0.5,double(maxNbins)-0.5);
91  //physRate->setAxisTitle("Lumi Section", 1);
92 
93  randRate = dbe_->book1D("Random_Trigger_Rate","Random_Trigger_Rate",
94  maxNbins,-0.5,double(maxNbins)-0.5);
95  //randRate->setAxisTitle("Lumi Section", 1);
96 
97  deadTimePercent = dbe_->book1D("Deadtime_Percent","Deadtime_Percent",
98  maxNbins,-0.5,double(maxNbins)-0.5);
99  //deadTimePercent->setAxisTitle("Lumi Section", 1);
100 
101  lostPhysRate = dbe_->book1D("Lost_Physics_Trigger_Rate","Lost_Physics_Trigger_Rate",
102  maxNbins,-0.5,double(maxNbins)-0.5);
103  //lostPhysRate->setAxisTitle("Lumi Section", 1);
104 
105  lostPhysRateBeamActive = dbe_->book1D("Lost_Physics_Trigger_Rate_Beam_Active",
106  "Lost_Physics_Trigger_Rate_Beam_Active",
107  maxNbins,-0.5,double(maxNbins)-0.5);
108  //lostPhysRateBeamActive->setAxisTitle("Lumi Section", 1);
109 
110 
111  instTrigRate = dbe_->book1D("instTrigRate","instTrigRate",1000,0,4E4);
112  instTrigRate->setAxisTitle("Time [sec]", 1);
113 
114  instEventRate = dbe_->book1D("instEventRate","instEventRate",1000,0,4E4);
115  instEventRate->setAxisTitle("Time [sec]", 1);
116 
117  char hname[40];//histo name
118  char mename[40];//ME name
119 
120  dbe_->setCurrentFolder("L1T/L1TScalersSCAL/Level1TriggerRates/AlgorithmRates");
121 
122  for(int i=0; i<Level1TriggerScalers::nLevel1Triggers; i++) {
123  sprintf(hname, "Rate_AlgoBit_%03d", i);
124  sprintf(mename, "Rate_AlgoBit _%03d", i);
125 
126  algoRate[i] = dbe_->book1D(hname, mename,maxNbins,-0.5,double(maxNbins)-0.5);
127  algoRate[i]->setAxisTitle("Lumi Section" ,1);
128  }
129 
130  dbe_->setCurrentFolder("L1T/L1TScalersSCAL/Level1TriggerRates/AlgorithmRates/Integrated");
131 
132  for(int i=0; i<Level1TriggerScalers::nLevel1Triggers; i++) {
133  sprintf(hname, "Integral_AlgoBit_%03d", i);
134  sprintf(mename, "Integral_AlgoBit _%03d", i);
135 
136  integralAlgo[i] = dbe_->book1D(hname, mename,maxNbins,-0.5,double(maxNbins)-0.5);
137  integralAlgo[i]->setAxisTitle("Lumi Section" ,1);
138  }
139 
140  dbe_->setCurrentFolder("L1T/L1TScalersSCAL/Level1TriggerRates/TechnicalRates");
141 
143  sprintf(hname, "Rate_TechBit_%03d", i);
144  sprintf(mename, "Rate_TechBit _%03d", i);
145 
146  techRate[i] = dbe_->book1D(hname, mename,maxNbins,-0.5,double(maxNbins)-0.5);
147  techRate[i]->setAxisTitle("Lumi Section" ,1);
148  }
149 
150  dbe_->setCurrentFolder("L1T/L1TScalersSCAL/Level1TriggerRates/TechnicalRates/Integrated");
151 
153  sprintf(hname, "Integral_TechBit_%03d", i);
154  sprintf(mename, "Integral_TechBit _%03d", i);
155 
156  integralTech[i] = dbe_->book1D(hname, mename,maxNbins,-0.5,double(maxNbins)-0.5);
157  integralTech[i]->setAxisTitle("Lumi Section" ,1);
158  }
159  integralTech_42_OR_43 = dbe_->book1D("Integral_TechBit_042_OR_043","Integral_TechBit _042_OR_043",maxNbins,-0.5,double(maxNbins)-0.5);
160  integralTech_42_OR_43->setAxisTitle("Lumi Section" ,1);
161 
162 
163  dbe_->setCurrentFolder("L1T/L1TScalersSCAL/Level1TriggerRates/Ratios");
164 
165  std::stringstream smu,seg,sjet,sdenom;
166  //denominator string
167  if(denomIsTech_) sdenom << "_TechBit_";
168  else sdenom << "_AlgoBit_";
169  sdenom << denomBit_;
170  //Muon ratio
171  smu << muonBit_;
172  rateRatio_mu = dbe_->book1D("Rate_Ratio_mu_PhysBit_"+ smu.str()+sdenom.str(), "Rate_Ratio_mu_PhysBit_" + smu.str()+sdenom.str(),maxNbins,-0.5,double(maxNbins)-0.5);
173  //rateRatio_mu->setAxisTitle("Lumi Section" , 1);
174  //Egamma ratio
175  seg << egammaBit_;
176  rateRatio_egamma = dbe_->book1D("Rate_Ratio_egamma_PhysBit_"+ seg.str()+sdenom.str(), "Rate_Ratio_egamma_PhysBit_" + seg.str()+sdenom.str(),maxNbins,-0.5,double(maxNbins)-0.5);
177  //rateRatio_egamma->setAxisTitle("Lumi Section" , 1);
178  //Jet ratio
179  sjet << jetBit_;
180  rateRatio_jet = dbe_->book1D("Rate_Ratio_jet_PhysBit_" + sjet.str()+sdenom.str(), "Rate_Ratio_jet_PhysBit_" + sjet.str()+sdenom.str(),maxNbins,-0.5,double(maxNbins)-0.5);
181  //rateRatio_jet->setAxisTitle("Lumi Section" , 1);
182 
183  //HF bit ratios
184  techRateRatio_8 = dbe_->book1D("Rate_Ratio_TechBit_8"+sdenom.str(), "Rate_Ratio_TechBit_8"+sdenom.str(),maxNbins,-0.5,double(maxNbins)-0.5);
185  //techRateRatio_8->setAxisTitle("Lumi Section" ,1);
186  techRateRatio_9 = dbe_->book1D("Rate_Ratio_TechBit_9"+sdenom.str(), "Rate_Ratio_TechBit_9"+sdenom.str(),maxNbins,-0.5,double(maxNbins)-0.5);
187  //techRateRatio_9->setAxisTitle("Lumi Section" ,1);
188  techRateRatio_10 = dbe_->book1D("Rate_Ratio_TechBit_10"+sdenom.str(), "Rate_Ratio_TechBit_10"+sdenom.str(),maxNbins,-0.5,double(maxNbins)-0.5);
189  //techRateRatio_10->setAxisTitle("Lumi Section" ,1);
190 
191  //Other tech bit ratios
192  techRateRatio_33_over_32 = dbe_->book1D("Rate_Ratio_TechBits_33_over_32", "Rate_Ratio_TechBits_33_over_32",maxNbins,-0.5,double(maxNbins)-0.5);
193  techRateRatio_36 = dbe_->book1D("Rate_Ratio_TechBit_36"+sdenom.str(), "Rate_Ratio_TechBit_36"+sdenom.str(),maxNbins,-0.5,double(maxNbins)-0.5);
194  techRateRatio_37 = dbe_->book1D("Rate_Ratio_TechBit_37"+sdenom.str(), "Rate_Ratio_TechBit_37"+sdenom.str(),maxNbins,-0.5,double(maxNbins)-0.5);
195  techRateRatio_38 = dbe_->book1D("Rate_Ratio_TechBit_38"+sdenom.str(), "Rate_Ratio_TechBit_38"+sdenom.str(),maxNbins,-0.5,double(maxNbins)-0.5);
196  techRateRatio_39 = dbe_->book1D("Rate_Ratio_TechBit_39"+sdenom.str(), "Rate_Ratio_TechBit_39"+sdenom.str(),maxNbins,-0.5,double(maxNbins)-0.5);
197  techRateRatio_40 = dbe_->book1D("Rate_Ratio_TechBit_40"+sdenom.str(), "Rate_Ratio_TechBit_40"+sdenom.str(),maxNbins,-0.5,double(maxNbins)-0.5);
198  techRateRatio_41 = dbe_->book1D("Rate_Ratio_TechBit_41"+sdenom.str(), "Rate_Ratio_TechBit_41"+sdenom.str(),maxNbins,-0.5,double(maxNbins)-0.5);
199  techRateRatio_42 = dbe_->book1D("Rate_Ratio_TechBit_42"+sdenom.str(), "Rate_Ratio_TechBit_42"+sdenom.str(),maxNbins,-0.5,double(maxNbins)-0.5);
200  techRateRatio_43 = dbe_->book1D("Rate_Ratio_TechBit_43"+sdenom.str(), "Rate_Ratio_TechBit_43"+sdenom.str(),maxNbins,-0.5,double(maxNbins)-0.5);
201 
202 
203  dbe_->setCurrentFolder("L1T/L1TScalersSCAL/LumiScalers");
204  //instLumi = dbe_->book1D("Instant Lumi","Instant Lumi",100,0,100);
205  instLumi = dbe_->book1D("Instant_Lumi","Instant_Lumi", maxNbins,-0.5,double(maxNbins)-0.5);
206  //instLumiErr = dbe_->book1D("Instant Lumi Err","Instant Lumi Err",100,
207  // 0,100);
208  instLumiErr = dbe_->book1D("Instant_Lumi_Err","Instant_Lumi_Err",maxNbins,-0.5,double(maxNbins)-0.5);
209  //instLumiQlty = dbe_->book1D("Instant Lumi Qlty","Instant Lumi Qlty",100,
210  // 0,100);
211  instLumiQlty = dbe_->book1D("Instant_Lumi_Qlty","Instant_Lumi_Qlty",maxNbins,-0.5,double(maxNbins)-0.5);
212  //instEtLumi = dbe_->book1D("Instant Et Lumi","Instant Et Lumi",100,0,100);
213  instEtLumi = dbe_->book1D("Instant_Et_Lumi","Instant_Et_Lumi",maxNbins,-0.5,double(maxNbins)-0.5);
214  //instEtLumiErr = dbe_->book1D("Instant Et Lumi Err","Instant Et Lumi Err",
215  // 100,0,100);
216  instEtLumiErr = dbe_->book1D("Instant_Et_Lumi_Err","Instant_Et_Lumi_Err",maxNbins,-0.5,double(maxNbins)-0.5);
217  //instEtLumiQlty = dbe_->book1D("Instant Et Lumi Qlty",
218  // "Instant Et Lumi Qlty",100,0,100);
219  instEtLumiQlty = dbe_->book1D("Instant_Et_Lumi_Qlty",
220  "Instant_Et_Lumi_Qlty",maxNbins,-0.5,double(maxNbins)-0.5);
221  //sectionNum = dbe_->book1D("Section Number","Section Number",100,0,100);
222  //startOrbit = dbe_->book1D("Start Orbit","Start Orbit",100,0,100);
223  startOrbit = dbe_->book1D("Start_Orbit","Start_Orbit", maxNbins,-0.5,double(maxNbins)-0.5);
224  //numOrbits = dbe_->book1D("Num Orbits","Num Orbits",100,0,100);
225  numOrbits = dbe_->book1D("Num_Orbits","Num_Orbits", maxNbins,-0.5,double(maxNbins)-0.5);
226 
227 
228  dbe_->setCurrentFolder("L1T/L1TScalersSCAL/L1AcceptBunchCrossing");
229 
230  for(int i=0; i<4; i++){
231 
232  sprintf(hname, "OrbitNumber_L1A_%d", i+1);
233  sprintf(mename, "OrbitNumber_L1A_%d", i+1);
234  orbitNumL1A[i] = dbe_->book1D(hname,mename,200,0,10E8);
235 
236  sprintf(hname, "Bunch_Crossing_L1A_%d", i+1);
237  sprintf(mename, "Bunch_Crossing_L1A_%d", i+1);
238  bunchCrossingL1A[i]= dbe_->book1D(hname, mename, 3564, -0.5, 3563.5);
239  }
240  orbitNumL1A[0]->setAxisTitle("Current BX",1);
241  orbitNumL1A[1]->setAxisTitle("Previous BX",1);
242  orbitNumL1A[2]->setAxisTitle("Second Previous BX",1);
243  orbitNumL1A[3]->setAxisTitle("Third Previous BX",1);
244 
245  bunchCrossingL1A[0]->setAxisTitle("Current BX",1);
246  bunchCrossingL1A[1]->setAxisTitle("Previous BX",1);
247  bunchCrossingL1A[2]->setAxisTitle("Second Previous BX",1);
248  bunchCrossingL1A[3]->setAxisTitle("Third Previous BX",1);
249 
250 
251  for(int j=0; j<3; j++) {
252  sprintf(hname, "BX_Correlation_%d", j+1);
253  sprintf(mename, "BX_Correlation_%d", j+1);
254 
255  bunchCrossingCorr[j] = dbe_->book2D(hname, mename, 99,-0.5,3563.5, 99,-0.5,3563.5);
256  bunchCrossingCorr[j]->setAxisTitle("Current Event", 1);
257 
258  sprintf(hname, "Bunch_Crossing_Diff_%d", j+1);
259  sprintf(mename, "Bunch_Crossing_Diff_%d", j+1);
260 
261  bunchCrossingDiff[j] = dbe_->book1D(hname, mename, 1000,0,1E6);
262 
263  sprintf(hname, "Bunch_Crossing_Diff_small_%d", j+1);
264  sprintf(mename, "Bunch_Crossing_Diff_small_%d", j+1);
265 
266  bunchCrossingDiff_small[j] = dbe_->book1D(hname, mename, 1000,0,1000);
267 
268  }
269  bunchCrossingCorr[0]->setAxisTitle("Previous Event" , 2);
270  bunchCrossingCorr[1]->setAxisTitle("Second Previous Event" , 2);
271  bunchCrossingCorr[2]->setAxisTitle("Third Previous Event" , 2);
272 
273  bunchCrossingDiff[0]->setAxisTitle("BX_Current - BX_Previous" , 1);
274  bunchCrossingDiff[1]->setAxisTitle("BX_Current - BX_SecondPrevious" , 1);
275  bunchCrossingDiff[2]->setAxisTitle("BX_Current - BX_ThirdPrevious" , 1);
276 
277  bunchCrossingDiff_small[0]->setAxisTitle("BX_Current - BX_Previous" , 1);
278  bunchCrossingDiff_small[1]->setAxisTitle("BX_Current - BX_SecondPrevious" , 1);
279  bunchCrossingDiff_small[2]->setAxisTitle("BX_Current - BX_ThirdPrevious" , 1);
280 
281  }
282 
283 }
284 
285 
287 {
288  // do anything here that needs to be done at destruction time
289  // (e.g. close files, deallocate resources etc.)
290 }
291 
292 
293 //
294 // member functions
295 //
296 
297 // ------------ method called to for each event ------------
298 void
300 {
301  nev_++;
302 
303  //access SCAL info
305  bool a = iEvent.getByLabel(scalersSource_, triggerScalers);
306  //edm::Handle<L1TriggerRatesCollection> triggerRates;
307  //edm::Handle<Level1TriggerRatesCollection> triggerRates;
308  //bool b = iEvent.getByLabel(scalersSource_, triggerRates);
310  bool c = iEvent.getByLabel(scalersSource_, lumiScalers);
312  bool d = iEvent.getByLabel(scalersSource_, bunchCrossings);
313 
314  double evtLumi = iEvent.luminosityBlock();
315  int run = iEvent.id().run();
316 
317 
318  if ( ! (a && c && d) ) {
319  LogInfo("Status") << "getByLabel failed with label "
320  << scalersSource_;
321  }
322 
323  else { // we have the data
324 
325  Level1TriggerScalersCollection::const_iterator it = triggerScalers->begin();
326  if(triggerScalers->size()){
327 
328  //for(L1TriggerScalersCollection::const_iterator it = triggerScalers->begin();
329  //it != triggerScalers->end();
330  //++it){
331 
332  unsigned int lumisection = it->lumiSegmentNr();
333  struct timespec thetime = it->collectionTime();
334  long currenttime;
335  //cout << "lumisection = " << lumisection << endl;
336  if(nev_ == 1) reftime_ = thetime.tv_sec;
337  //cout << "reftime = " << reftime_ << endl;
338  if(lumisection){
339 
340  //orbitNum->Fill(it->orbitNr());
341  orbitNum->setBinContent(lumisection+1,it->orbitNr());
342 
343  //trigNum ->Fill(it->gtTriggers());
344  //trigNum->setBinContent(lumisection+1, it->gtTriggers());
345 
346  //eventNum->Fill(it->gtEvents());
347  eventNum->setBinContent(lumisection+1,it->gtEvents());
348 
349  //physTrig ->Fill(it->l1AsPhysics());
350  physTrig->setBinContent(lumisection+1, it->l1AsPhysics());
351 
352  //randTrig ->Fill(it->l1AsRandom());
353  randTrig->setBinContent(lumisection+1, it->l1AsRandom());
354 
355  //numberResets ->Fill(it->gtResets());
356  numberResets->setBinContent(lumisection+1, it->gtResets());
357 
358  //deadTime ->Fill(it->deadtime());
359  deadTime->setBinContent(lumisection+1, it->deadtime());
360 
361  //lostFinalTriggers ->Fill(it->triggersPhysicsLost());
362  lostFinalTriggers->setBinContent(lumisection+1, it->triggersPhysicsLost());
363 
364  //cout << "lumisection = " << lumisection << " , orbitNum = "
365  // << it->orbitNr() << ", lumiSegmentOrbits = " << it->lumiSegmentOrbits()
366  // << ", l1AsPhys = " << it->l1AsPhysics() << endl;
367  //cout << "gtTriggersRate = " << it->gtTriggersRate() << endl;
368 
369  if(buffertime_ < thetime.tv_sec){
370  buffertime_ = thetime.tv_sec;
371  currenttime = thetime.tv_sec - reftime_ ;
372  int timebin = (int)(currenttime/30) + 1;
373  //cout << "time bin = " << timebin << endl;
374  trigNum->setBinContent((int)timebin ,it->gtTriggers());
375  instTrigRate->setBinContent((int)timebin ,it->gtTriggersRate());
376  instEventRate->setBinContent((int)timebin ,it->gtEventsRate());
377  }
378 
379  //cout << "tv_sec = " << thetime.tv_sec << endl;
380 
381  //std::vector<unsigned int> algoBits = it->gtAlgoCounts();
382  //std::vector<unsigned int> techBits = it->gtTechCounts();
383  /*
384  int length = algoBits.size() / 4;
385  char line[128];
386  for ( int i=0; i<length; i++)
387  {
388  sprintf(line," %3.3d: %10u %3.3d: %10u %3.3d: %10u %3.3d: %10u",
389  i, algoBits[i],
390  (i+length), algoBits[i+length],
391  (i+(length*2)), algoBits[i+(length*2)],
392  (i+(length*3)), algoBits[i+(length*3)]);
393  std::cout << line << std::endl;
394  }
395  */
396  //sprintf(line,
397  // " LuminositySection: %15d BunchCrossingErrors: %15d",
398  // it->luminositySection(), it->bunchCrossingErrors());
399  //std::cout << line << std::endl;
400 
401  //Level1TriggerRatesCollection::const_iterator it2 = triggerRates->begin();
402 
403  Level1TriggerRates trigRates(*it,run);
404  Level1TriggerRates *triggerRates = &trigRates;
405  if(triggerRates){
406  algorithmRates_ = triggerRates->gtAlgoCountsRate();
407  technicalRates_ = triggerRates->gtTechCountsRate();
408 
409  if( ((bufferLumi_!=lumisection) && (bufferLumi_<lumisection) && (evtLumi>1 || evtLumi==lumisection+1)) ){
410  bufferLumi_ = lumisection;
411 
414  for (unsigned int i=0; i< algorithmRates_.size(); i++){
416  algoRate[i]->setBinContent(lumisection+1, algorithmRates_[i]);
417  integralAlgo[i]->setBinContent(lumisection+1,integral_algo_[i]);
418  }
419  }
422  for (unsigned int i=0; i< technicalRates_.size(); i++){
424  techRate[i]->setBinContent(lumisection+1, technicalRates_[i]);
425  integralTech[i]->setBinContent(lumisection+1, integral_tech_[i]);
426  if( (i==42 || i==43) ) integral_tech_42_OR_43_+=(technicalRates_[i]*SECS_PER_LUMI);
427  }
428 
429  //fill rate ratio plots
430  if(denomIsTech_){
431  if( denomBit_ < technicalRates_.size() ){
433 
434  if( muonBit_ < algorithmRates_.size() )
436  if( egammaBit_ < algorithmRates_.size() )
438  if( jetBit_ < algorithmRates_.size() )
440 
441  techRateRatio_8->setBinContent(lumisection+1, technicalRates_[8]/technicalRates_[denomBit_]);
442  techRateRatio_9->setBinContent(lumisection+1, technicalRates_[9]/technicalRates_[denomBit_]);
443  techRateRatio_10->setBinContent(lumisection+1, technicalRates_[10]/technicalRates_[denomBit_]);
444 
445  techRateRatio_36->setBinContent(lumisection+1, technicalRates_[36]/technicalRates_[denomBit_]);
446  techRateRatio_37->setBinContent(lumisection+1, technicalRates_[37]/technicalRates_[denomBit_]);
447  techRateRatio_38->setBinContent(lumisection+1, technicalRates_[38]/technicalRates_[denomBit_]);
448  techRateRatio_39->setBinContent(lumisection+1, technicalRates_[39]/technicalRates_[denomBit_]);
449  techRateRatio_40->setBinContent(lumisection+1, technicalRates_[40]/technicalRates_[denomBit_]);
450  techRateRatio_41->setBinContent(lumisection+1, technicalRates_[41]/technicalRates_[denomBit_]);
451  techRateRatio_42->setBinContent(lumisection+1, technicalRates_[42]/technicalRates_[denomBit_]);
452  techRateRatio_43->setBinContent(lumisection+1, technicalRates_[43]/technicalRates_[denomBit_]);
453  }
454  }
455  }
458 
459  }
460 
461  physRate->setBinContent(lumisection+1,
462  triggerRates->l1AsPhysicsRate());
463  randRate->setBinContent(lumisection+1,
464  triggerRates->l1AsRandomRate());
465  lostPhysRate->setBinContent(lumisection+1,
466  triggerRates->triggersPhysicsLostRate());
467  lostPhysRateBeamActive->setBinContent(lumisection+1,
468  triggerRates->triggersPhysicsLostBeamActiveRate());
469  deadTimePercent->setBinContent(lumisection+1,
470  triggerRates->deadtimePercent());
471 
472  }//bufferLumi test
473  }//triggerRates
474  }//lumisection
475  }//triggerScalers->size()
476 
477 
478  LumiScalersCollection::const_iterator it3 = lumiScalers->begin();
479  if(lumiScalers->size()){
480 
481  //for(LumiScalersCollection::const_iterator it3 = lumiScalers->begin();
482  //it3 != lumiScalers->end();
483  //++it3){
484  unsigned int lumisection = it3->sectionNumber();
485  if(lumisection){
486 
487  instLumi->setBinContent(lumisection+1, it3->instantLumi());
488  instLumiErr->setBinContent(lumisection+1, it3->instantLumiErr());
489  instLumiQlty->setBinContent(lumisection+1, it3->instantLumiQlty());
490  instEtLumi->setBinContent(lumisection+1, it3->instantETLumi());
491  instEtLumiErr->setBinContent(lumisection+1, it3->instantETLumiErr());
492  instEtLumiQlty->setBinContent(lumisection+1, it3->instantETLumiQlty());
493  //sectionNum->Fill(it3->sectionNumber());
494  startOrbit->setBinContent(lumisection+1, it3->startOrbit());
495  numOrbits->setBinContent(lumisection+1, it3->numOrbits());
496 
497  }
498  /*
499  char line2[128];
500  sprintf(line2," InstantLumi: %e Err: %e Qlty: %d",
501  it3->instantLumi(), it3->instantLumiErr(), it3->instantLumiQlty());
502  std::cout << line2 << std::endl;
503 
504  sprintf(line2," SectionNumber: %10d StartOrbit: %10d NumOrbits: %10d",
505  it3->sectionNumber(), it3->startOrbit(), it3->numOrbits());
506  std::cout << line2 << std::endl;
507  */
508  }
509 
510  // L1AcceptBunchCrossingCollection::const_iterator it4 = bunchCrossings->begin();
511  //if(bunchCrossings->size()){
512  //int counttest=0;
513  int l1accept;
514  unsigned int bx_current = 0, orbitnumber_current = 0, bxdiff = 0;
515 
516  for(L1AcceptBunchCrossingCollection::const_iterator it4 = bunchCrossings->begin();
517  it4 != bunchCrossings->end();
518  ++it4){
519  //counttest++;
520  //cout << "counttest = " << counttest << endl;
521  //cout << "bunchCrossing = " << it4->bunchCrossing() << endl;
522  //cout << "l1AcceptOffset = " << it4->l1AcceptOffset() << endl;
523 
524  l1accept = std::abs(it4->l1AcceptOffset());
525 
526  //cout << "l1a orbit number (before if)= " << it4->orbitNumber() << endl;
527  //cout << "l1a bunch crossing = " << it4->bunchCrossing() << endl;
528 
529  if(l1accept == 0){
530  orbitnumber_current = it4->orbitNumber();
531  orbitNumL1A[l1accept]->Fill(orbitnumber_current);
532 
533  bx_current = it4->bunchCrossing();
534  bunchCrossingL1A[l1accept]->Fill(bx_current);
535 
536  }
537  else if (l1accept==1 || l1accept==2 || l1accept==3){
538  orbitNumL1A[l1accept]->Fill(it4->orbitNumber());
539  bunchCrossingL1A[l1accept]->Fill(it4->bunchCrossing());
540  //cout << "l1accept = " << l1accept << ", bx_current = " << bx_current << ", it4->bunchCrossing() = " << it4->bunchCrossing() << endl;
541  bunchCrossingCorr[l1accept-1]->Fill(bx_current, it4->bunchCrossing());
542  bxdiff = 3564*(orbitnumber_current-it4->orbitNumber()) + bx_current - it4->bunchCrossing();
543  bunchCrossingDiff[l1accept-1]->Fill(bxdiff);
544  bunchCrossingDiff_small[l1accept-1]->Fill(bxdiff);
545  }
546 
547  }
548 
549  } // getByLabel succeeds for scalers
550 
551 
552 
553 }
554 
555 
556 // ------------ method called once each job just before starting event loop ------------
557 void
559 {
560 
561 }
562 
563 // ------------ method called once each job just after ending the event loop ------------
564 void
566 }
567 
568 
570  const edm::EventSetup& iSetup)
571 {
572 }
575 {
576 }
577 
580 {
581 }
582 
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:42
int i
Definition: DBlmapReader.cc:9
void endRun(const edm::Run &run, const edm::EventSetup &c)
EndRun.
MonitorElement * instEventRate
void analyze(const edm::Event &e, const edm::EventSetup &c)
void setBinContent(int binx, double content)
set content of bin (1-D)
void beginRun(const edm::Run &run, const edm::EventSetup &c)
BeginRun.
MonitorElement * techRateRatio_43
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
MonitorElement * integralTech_42_OR_43
MonitorElement * integralAlgo[128]
unsigned int muonBit_
const double SECS_PER_LUMI
MonitorElement * randRate
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:59
void endJob(void)
Endjob.
unsigned int bufferLumi_
MonitorElement * trigNum
MonitorElement * bunchCrossingDiff_small[3]
std::vector< double > bufferTechRates_
std::vector< double > algorithmRates_
MonitorElement * deadTimePercent
double integral_tech_42_OR_43_
double l1AsRandomRate() const
double triggersPhysicsLostBeamActiveRate() const
MonitorElement * algoRate[128]
MonitorElement * instEtLumi
MonitorElement * lostFinalTriggers
MonitorElement * rateRatio_egamma
void Fill(long long x)
std::vector< double > gtAlgoCountsRate() const
MonitorElement * techRateRatio_38
MonitorElement * bunchCrossingCorr[3]
edm::InputTag scalersSource_
int iEvent
Definition: GenABIO.cc:243
MonitorElement * integralTech[64]
MonitorElement * instTrigRate
MonitorElement * startOrbit
MonitorElement * instLumi
MonitorElement * techRateRatio_36
MonitorElement * techRateRatio_37
MonitorElement * eventNum
MonitorElement * techRateRatio_10
MonitorElement * techRateRatio_41
MonitorElement * orbitNumL1A[4]
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
MonitorElement * orbitNum
DQMStore * dbe_
MonitorElement * instEtLumiQlty
MonitorElement * techRateRatio_9
void setVerbose(unsigned level)
Definition: DQMStore.cc:548
MonitorElement * deadTime
MonitorElement * techRateRatio_42
std::vector< double > integral_algo_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
MonitorElement * techRateRatio_39
DQMStore * dbe_
MonitorElement * lostPhysRate
MonitorElement * randTrig
std::vector< double > integral_tech_
virtual ~L1TScalersSCAL()
Destructor.
MonitorElement * instEtLumiErr
MonitorElement * instLumiErr
MonitorElement * lostPhysRateBeamActive
unsigned int denomBit_
MonitorElement * numOrbits
std::vector< double > technicalRates_
MonitorElement * bunchCrossingDiff[3]
MonitorElement * techRate[64]
MonitorElement * rateRatio_mu
MonitorElement * techRateRatio_8
MonitorElement * rateRatio_jet
MonitorElement * physRate
MonitorElement * techRateRatio_33_over_32
double deadtimePercent() const
edm::EventID id() const
Definition: EventBase.h:56
double a
Definition: hdecay.h:121
MonitorElement * techRateRatio_40
double triggersPhysicsLostRate() const
unsigned int jetBit_
MonitorElement * physTrig
volatile std::atomic< bool > shutdown_flag false
MonitorElement * bunchCrossingL1A[4]
std::vector< double > gtTechCountsRate() const
unsigned int egammaBit_
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1000
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * instLumiQlty
double l1AsPhysicsRate() const
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
void beginJob(void)
BeginJob.
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
Definition: Run.h:41
L1TScalersSCAL(const edm::ParameterSet &ps)
Constructors.
MonitorElement * numberResets
std::vector< double > bufferAlgoRates_