CMS 3D CMS Logo

SiStripMonitorDigi.cc
Go to the documentation of this file.
1 // -*- c++ -*-
4 // Original Author: Dorian Kcira
5 // Created: Sat Feb 4 20:49:10 CET 2006
6 #include<fstream>
7 #include "TNamed.h"
27 
30 
31 #include "TMath.h"
33 
34 #include <iostream>
35 
42 
43 /* mia: but is there not a smarter way ?!?!?! */
44 const double NORBITS_PER_SECOND = 11223.;
45 const double NORBITS_PER_LS = 262144.;
46 
47 //--------------------------------------------------------------------------------------------
49  dqmStore_(edm::Service<DQMStore>().operator->()),
50  conf_(iConfig),
51  show_mechanical_structure_view(true),
52  show_readout_view (false),
53  show_control_view (false),
54  select_all_detectors (true),
55  reset_each_run (false),
56  folder_organizer(),
57  m_cacheID_(0)
58 {
59  firstEvent = -1;
60  eventNb = 0;
61 
62  // Detector Partitions
63  SubDetPhasePartMap["TIB"] = "TI";
64  SubDetPhasePartMap["TID__MINUS"] = "TI";
65  SubDetPhasePartMap["TID__PLUS"] = "TI";
66  SubDetPhasePartMap["TOB"] = "TO";
67  SubDetPhasePartMap["TEC__MINUS"] = "TM";
68  SubDetPhasePartMap["TEC__PLUS"] = "TP";
69 
70  topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
71 
72  // get Digi Producer List
73  digiProducerList = conf_.getParameter<std::vector<edm::InputTag> >("DigiProducersList");
74  for (auto const& tag : digiProducerList) {
76  }
77 
78  //get on/off option for every cluster from cfi
79  edm::ParameterSet ParametersNumberOfDigis = conf_.getParameter<edm::ParameterSet>("TH1NumberOfDigis");
80  layerswitchnumdigison = ParametersNumberOfDigis.getParameter<bool>("layerswitchon");
81  moduleswitchnumdigison = ParametersNumberOfDigis.getParameter<bool>("moduleswitchon");
82 
83  edm::ParameterSet ParametersNumberOfDigisPerStrip = conf_.getParameter<edm::ParameterSet>("TH1NumberOfDigisPerStrip");
84  moduleswitchnumdigispstripon = ParametersNumberOfDigisPerStrip.getParameter<bool>("moduleswitchon");
85 
86  edm::ParameterSet ParametersADCsHottestStrip = conf_.getParameter<edm::ParameterSet>("TH1ADCsHottestStrip");
87  layerswitchadchotteston = ParametersADCsHottestStrip.getParameter<bool>("layerswitchon");
88  moduleswitchadchotteston = ParametersADCsHottestStrip.getParameter<bool>("moduleswitchon");
89 
90  edm::ParameterSet ParametersADCsCoolestStrip = conf_.getParameter<edm::ParameterSet>("TH1ADCsCoolestStrip");
91  layerswitchadccooleston = ParametersADCsCoolestStrip.getParameter<bool>("layerswitchon");
92  moduleswitchadccooleston = ParametersADCsCoolestStrip.getParameter<bool>("moduleswitchon");
93 
94  edm::ParameterSet ParametersDigiADCs = conf_.getParameter<edm::ParameterSet>("TH1DigiADCs");
95  layerswitchdigiadcson = ParametersDigiADCs.getParameter<bool>("layerswitchon");
96  moduleswitchdigiadcson = ParametersDigiADCs.getParameter<bool>("moduleswitchon");
97 
98  edm::ParameterSet ParametersStripOccupancy = conf_.getParameter<edm::ParameterSet>("TH1StripOccupancy");
99  layerswitchstripoccupancyon = ParametersStripOccupancy.getParameter<bool>("layerswitchon");
100  moduleswitchstripoccupancyon = ParametersStripOccupancy.getParameter<bool>("moduleswitchon");
101 
102  edm::ParameterSet ParametersDigiProf = conf_.getParameter<edm::ParameterSet>("TProfNumberOfDigi");
103  layerswitchnumdigisprofon = ParametersDigiProf.getParameter<bool>("layerswitchon");
104 
105  edm::ParameterSet ParametersDigiADC = conf_.getParameter<edm::ParameterSet>("TProfDigiADC");
106  layerswitchdigiadcprofon = ParametersDigiProf.getParameter<bool>("layerswitchon");
107 
108  edm::ParameterSet ParametersTotDigiProf = conf_.getParameter<edm::ParameterSet>("TProfTotalNumberOfDigis");
109  subdetswitchtotdigiprofon = ParametersTotDigiProf.getParameter<bool>("subdetswitchon");
110 
111  edm::ParameterSet ParametersTotDigiFailure = conf_.getParameter<edm::ParameterSet>("TotalNumberOfDigisFailure");
112  subdetswitchtotdigifailureon = ParametersTotDigiFailure.getParameter<bool>("subdetswitchon");
113 
114  edm::ParameterSet ParametersDigiApvProf = conf_.getParameter<edm::ParameterSet>("TProfDigiApvCycle");
115  subdetswitchapvcycleprofon = ParametersDigiApvProf.getParameter<bool>("subdetswitchon");
116 
117  edm::ParameterSet ParametersDigiApvTH2 = conf_.getParameter<edm::ParameterSet>("TH2DigiApvCycle");
118  subdetswitchapvcycleth2on = ParametersDigiApvTH2.getParameter<bool>("subdetswitchon");
119 
120  edm::ParameterSet ParametersNApvShots = conf_.getParameter<edm::ParameterSet>("TH1NApvShots");
121  subdetswitchnapvshotson = ParametersNApvShots.getParameter<bool>("subdetswitchon");
122 
123  edm::ParameterSet ParametersNStripApvShots = conf_.getParameter<edm::ParameterSet>("TH1NStripsApvShots");
124  subdetswitchnstripsapvshotson = ParametersNStripApvShots.getParameter<bool>("subdetswitchon");
125 
126  edm::ParameterSet ParametersChargeMedianApvShots = conf_.getParameter<edm::ParameterSet>("TH1ChargeMedianApvShots");
127  subdetswitchchargemedianapvshotson = ParametersChargeMedianApvShots.getParameter<bool>("subdetswitchon");
128 
129  edm::ParameterSet ParametersApvNumberApvShots = conf_.getParameter<edm::ParameterSet>("TH1ApvNumApvShots");
130  subdetswitchapvshotsApvon = ParametersChargeMedianApvShots.getParameter<bool>("subdetswitchon");
131 
132  edm::ParameterSet ParametersNApvShotsProf = conf_.getParameter<edm::ParameterSet>("TProfNShotsVsTime");
133  subdetswitchapvshotsonprof = ParametersNApvShotsProf.getParameter<bool>("subdetswitchon");
134 
135  //Global Histograms
136 
137  edm::ParameterSet ParametersGlobalNApvShots = conf_.getParameter<edm::ParameterSet>("TH1NApvShots");
138  globalswitchnapvshotson = ParametersGlobalNApvShots.getParameter<bool>("globalswitchon");
139 
140  edm::ParameterSet ParametersGlobalNApvShotsProf = conf_.getParameter<edm::ParameterSet>("TProfGlobalNShots");
141  globalsummaryapvshotson = ParametersGlobalNApvShotsProf.getParameter<bool>("globalswitchon");
142 
143  edm::ParameterSet ParametersGlobalNStripApvShots = conf_.getParameter<edm::ParameterSet>("TH1NStripsApvShots");
144  globalswitchnstripsapvshotson = ParametersGlobalNStripApvShots.getParameter<bool>("globalswitchon");
145 
146  edm::ParameterSet ParametersGlobalApvNumApvShots = conf_.getParameter<edm::ParameterSet>("TH1ApvNumApvShots");
147  globalswitchapvshotsApvon = ParametersGlobalApvNumApvShots.getParameter<bool>("globalswitchon");
148 
149  edm::ParameterSet ParametersGlobalChargeMedianApvShots = conf_.getParameter<edm::ParameterSet>("TH1ChargeMedianApvShots");
150  globalswitchchargemedianapvshotson = ParametersGlobalChargeMedianApvShots.getParameter<bool>("globalswitchon");
151 
152  edm::ParameterSet ParametersGlobalNApvShotsTimeProf = conf_.getParameter<edm::ParameterSet>("TProfNShotsVsTime");
153  globalswitchapvshotsonprof = ParametersGlobalNApvShotsTimeProf.getParameter<bool>("globalswitchon");
154 
155  //Digi and APV Shots Maps
156 
157  digitkhistomapon = conf_.getParameter<bool>("TkHistoMap_On");
158 
159  shotshistomapon = conf_.getParameter<bool>("TkHistoMapNApvShots_On");
160  shotsstripshistomapon = conf_.getParameter<bool>("TkHistoMapNStripApvShots_On");
161  shotschargehistomapon = conf_.getParameter<bool>("TkHistoMapMedianChargeApvShots_On");
162 
163  createTrendMEs = conf_.getParameter<bool>("CreateTrendMEs");
164  m_trendVsLS = conf_.getParameter<bool>("TrendVsLS");
165  Mod_On_ = conf_.getParameter<bool>("Mod_On");
166  // xLumiProf = conf_.getParameter<int>("xLumiProf");
167  // Event History Producer
168  historyProducer_ = conf_.getParameter<edm::InputTag>("HistoryProducer");
169  historyProducerToken_ = consumes<EventWithHistory>(conf_.getParameter<edm::InputTag>("HistoryProducer") );
170 
171  // Apv Phase Producer
172  apvPhaseProducer_ = conf_.getParameter<edm::InputTag>("ApvPhaseProducer");
173  apvPhaseProducerToken_ = consumes<APVCyclePhaseCollection>(conf_.getParameter<edm::InputTag>("ApvPhaseProducer") );
174 
175  gtEvmToken_ = consumes<L1GlobalTriggerEvmReadoutRecord>(edm::InputTag("gtEvmDigis") );
176 
177  // Create DCS Status
178  bool checkDCS = conf_.getParameter<bool>("UseDCSFiltering");
179  if (checkDCS) dcsStatus_ = new SiStripDCSStatus(consumesCollector());
180  else dcsStatus_ = 0;
181 
182  //initialize boolean for the data-presence check (needed for TotalNumberOfDigisFailure histogram)
183  isStableBeams = false;
184  SBTransitionDone = false;
185  SBDeclaredAt = 0;
186  ignoreFirstNLumisections_ = TMath::Max ( 0 , ParametersTotDigiFailure.getParameter<int32_t>("ignoreFirstNLumisections") );
187  integrateNLumisections_ = TMath::Max ( 1 , ParametersTotDigiFailure.getParameter<int32_t>("integrateNLumisections") );
188 }
189 //------------------------------------------------------------------------------------------
190 
192  if (dcsStatus_) delete dcsStatus_;
193 }
194 
195 
197 {
199  unsigned long long cacheID = es.get<SiStripDetCablingRcd>().cacheIdentifier();
200  if (m_cacheID_ != cacheID) {
201  m_cacheID_ = cacheID;
202  edm::LogInfo("SiStripMonitorDigi") <<"SiStripMonitorDigi::bookHistograms: "
203  << " Creating MEs for new Cabling ";
204  createMEs( ibooker, es );
205  }
206  } else if (reset_each_run) {
207  edm::LogInfo("SiStripMonitorDigi") <<"SiStripMonitorDigi::bookHistograms: "
208  << " Resetting MEs ";
209  for (std::map<uint32_t, ModMEs >::const_iterator idet = DigiMEs.begin() ; idet!=DigiMEs.end() ; idet++) {
210  ResetModuleMEs(idet->first);
211  }
212  }
213 
214 }
215 
216 
217 
218 
219 
220 //--------------------------------------------------------------------------------------------
222 
224  //get FED cabling to know if SiStrip is in DAQ or no
225  unsigned long long cacheID = es.get<SiStripDetCablingRcd>().cacheIdentifier();
226  if (m_cacheID_ != cacheID) {
227  m_cacheID_ = cacheID;
228  }
230  es.get<SiStripDetCablingRcd>().get(detCabling_);
231 
232  //nFEDConnected = 0;
233  nFedTIB = 0;
234  nFedTIDm = 0;
235  nFedTIDp = 0;
236  nFedTECm = 0;
237  nFedTECp = 0;
238  nFedTOB = 0;
239 
240  //const int siStripFedIdMin = FEDNumbering::MINSiStripFEDID;
241  //const int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID;
242 
244  if( es.find( recordKey ) != 0) {
245 
246  edm::ESHandle<RunInfo> sumFED;
247  es.get<RunInfoRcd>().get(sumFED);
248 
249  if ( sumFED.isValid() ) {
250  std::vector<int> FedsInIds= sumFED->m_fed_in;
251  for(unsigned int it = 0; it < FedsInIds.size(); ++it) {
252  int fedID = FedsInIds[it];
253  // if(fedID>=siStripFedIdMin && fedID<=siStripFedIdMax) ++nFEDConnected;
254  /* mia: but is there not a smarter way !?!?!? */
255  if ( fedID >= 50 && fedID <= 133 ) ++nFedTIB;
256  if ( fedID >= 134 && fedID <= 148 ) ++nFedTIDm;
257  if ( fedID >= 149 && fedID <= 163 ) ++nFedTIDp;
258  if ( fedID >= 164 && fedID <= 259 ) ++nFedTECm;
259  if ( fedID >= 260 && fedID <= 355 ) ++nFedTECp;
260  if ( fedID >= 356 && fedID <= 489 ) ++nFedTOB;
261 
262  }
263  }
264  }
265  }
266 
267 }
268 
269 //--------------------------------------------------------------------------------------------
271 }
272 
273 //--------------------------------------------------------------------------------------------
276  isStableBeams = false;
277  //integrate stats over several LS to prevent eventual low trigger rates
279  }
280 }
281 
282 //--------------------------------------------------------------------------------------------
284 
286  {
288  SBTransitionDone = true;
289  }
290 
292 
293  int nFeds [6] = { 96 , 96 , 84 , 15 , 15 , 134 }; // tec- , tec+ , tib , tid- , tid+ , tob
294  int nFedsConnected [6] = { nFedTECm , nFedTECp , nFedTIB , nFedTIDm , nFedTIDp , nFedTOB };
295 
296  MonitorElement * me = dqmStore_->get(topFolderName_+"/MechanicalView/NumberOfDigisInLastLS");
297  if (me) {
298 
299  for (int ibin = 1; ibin<7;ibin++){
300 
301  float value = me->getBinContent(ibin);
302 
303  float fillvalue = 2;
304  if ( isStableBeams
305  // && (int)lb.id().luminosityBlock() > ignoreFirstNLumisections_ //ignore first X lumisections for HV rampup
307  && (float)nFedsConnected[ibin-1] / nFeds[ibin-1] > 0.5
308  && value < 50. ){
309 
310  fillvalue = 1.01;
311  }
312 
313  //account for integrated LS: fill previous bins as well
314  for ( int fillbin = (int)lb.id().luminosityBlock() - integrateNLumisections_ + 1 ; fillbin <= (int)lb.id().luminosityBlock() ; fillbin++ )
315  digiFailureMEs.SubDetDigiFailures2D -> Fill( fillbin , ibin-1 , fillvalue );
316  }
317  }
318  }
319 
320 }
321 //--------------------------------------------------------------------------------------------
323 
325 
326  //Retrieve tracker topology from geometry
327  edm::ESHandle<TrackerTopology> tTopoHandle;
328  es.get<TrackerTopologyRcd>().get(tTopoHandle);
329  const TrackerTopology* const tTopo = tTopoHandle.product();
330 
331  // take from eventSetup the SiStripDetCabling object - here will use SiStripDetControl later on
333 
334  // get list of active detectors from SiStripDetCabling
335  std::vector<uint32_t> activeDets;
336  activeDets.clear(); // just in case
338 
339  SiStripSubStructure substructure;
340 
341  // remove any eventual zero elements - there should be none, but just in case
342  for(std::vector<uint32_t>::iterator idets = activeDets.begin(); idets != activeDets.end(); idets++){
343  if(*idets == 0) activeDets.erase(idets);
344  }
345 
346  // create SiStripFolderOrganizer
348 
349  // Create TkHistoMap for Digi and APV shots properies
350 
351  if (digitkhistomapon) tkmapdigi = new TkHistoMap(ibooker , topFolderName_,"TkHMap_NumberOfDigi", 0.0,true);
352  if (shotshistomapon) tkmapNApvshots = new TkHistoMap(ibooker , topFolderName_,"TkHMap_NApvShots", 0.0,true);
353  if (shotsstripshistomapon) tkmapNstripApvshot = new TkHistoMap(ibooker , topFolderName_,"TkHMap_NStripApvShots", 0.0,true);
354  if (shotschargehistomapon) tkmapMedianChargeApvshots= new TkHistoMap(ibooker , topFolderName_,"TkHMap_MedianChargeApvShots",0.0,true);
355 
356  std::vector<uint32_t> tibDetIds;
357 
358  // loop over detectors and book MEs
359  edm::LogInfo("SiStripTkDQM|SiStripMonitorDigi")<<"nr. of activeDets: "<<activeDets.size();
360  for(std::vector<uint32_t>::const_iterator detid_iterator = activeDets.begin(); detid_iterator!=activeDets.end(); detid_iterator++){
361 
362  uint32_t detid = (*detid_iterator);
363 
364  ModMEs local_modmes;
365 
366  local_modmes.NumberOfDigis = 0;
367  local_modmes.NumberOfDigisPerStrip = 0;
368  local_modmes.ADCsHottestStrip = 0;
369  local_modmes.ADCsCoolestStrip = 0;
370  local_modmes.DigiADCs = 0;
371  local_modmes.StripOccupancy = 0;
372 
373  if (Mod_On_) {
374 
375  // set appropriate folder using SiStripFolderOrganizer
376  folder_organizer.setDetectorFolder(detid, tTopo); // pass the detid to this method
377  if (reset_each_run) ResetModuleMEs(detid);
378  createModuleMEs( ibooker , local_modmes, detid );
379 
380  // append to DigiMEs
381  DigiMEs.insert( std::make_pair(detid, local_modmes));
382  }
383 
384  // Create Layer Level MEs if they are not created already
385  std::pair<std::string,int32_t> det_layer_pair = folder_organizer.GetSubDetAndLayer(detid, tTopo);
386  SiStripHistoId hidmanager;
387  std::string label = hidmanager.getSubdetid(detid,tTopo,false);
388 
389  // get detids for the layer
390  std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(label);
391 
392  if(iLayerME==LayerMEsMap.end()) {
393  int32_t lnumber = det_layer_pair.second;
394  std::vector<uint32_t> layerDetIds;
395  if (det_layer_pair.first == "TIB") {
396  substructure.getTIBDetectors(activeDets,layerDetIds,lnumber,0,0,0);
397  } else if (det_layer_pair.first == "TOB") {
398  substructure.getTOBDetectors(activeDets,layerDetIds,lnumber,0,0);
399  } else if (det_layer_pair.first == "TID" && lnumber > 0) {
400  substructure.getTIDDetectors(activeDets,layerDetIds,2,abs(lnumber),0,0);
401  } else if (det_layer_pair.first == "TID" && lnumber < 0) {
402  substructure.getTIDDetectors(activeDets,layerDetIds,1,abs(lnumber),0,0);
403  } else if (det_layer_pair.first == "TEC" && lnumber > 0) {
404  substructure.getTECDetectors(activeDets,layerDetIds,2,abs(lnumber),0,0,0,0);
405  } else if (det_layer_pair.first == "TEC" && lnumber < 0) {
406  substructure.getTECDetectors(activeDets,layerDetIds,1,abs(lnumber),0,0,0,0);
407  }
408 
409  LayerDetMap[label] = layerDetIds;
410 
411  // book Layer plots
412  folder_organizer.setLayerFolder(detid,tTopo,det_layer_pair.second);
413  createLayerMEs( ibooker , label, layerDetIds.size() );
414  }
415 
416  // book sub-detector plots
417  auto sdet_pair = folder_organizer.getSubDetFolderAndTag(detid, tTopo);
418  if (SubDetMEsMap.find(sdet_pair.second) == SubDetMEsMap.end()){
419  ibooker.setCurrentFolder(sdet_pair.first);
420  createSubDetMEs( ibooker , sdet_pair.second );
421  }
422 
423  }//end of loop over detectors
424 
425  //book some Summary histograms on APV shots in the MechanicalView
426 
427  ibooker.setCurrentFolder(topFolderName_+"/MechanicalView/");
428 
430  const char* HistoName = "Summary Mean Apv shots for SubDets";
431  NApvShotsGlobalProf= ibooker.bookProfile(HistoName, HistoName,
432  6,0.5,6.5,
433  100, 0., 0., "" );
440  NApvShotsGlobalProf->setAxisTitle(" mean APV shots # / evt",2);
441  }
442 
443  //cumulative number of APV shots Vs Time
446  const char* HistoName = "NApv_Shots_vs_Time";
447  ShotsVsTimeApvShotsGlobal=ibooker.bookProfile(HistoName,HistoName,
448  Parameters.getParameter<int32_t>("Nbins"),
449  Parameters.getParameter<double>("xmin"),
450  Parameters.getParameter<double>("xmax"),
451  200, //that parameter should not be there !?
452  Parameters.getParameter<double>("ymin"),
453  Parameters.getParameter<double>("ymax"),
454  "" );
456  ShotsVsTimeApvShotsGlobal->setAxisTitle("# Apv Shots",2);
458  }
459 
460  //cumulative number of Strips in APV shots
463  const char* HistoName = "Number_of_Strips_in_Apv_Shots";
464  StripMultiplicityApvShotsGlobal=ibooker.book1D(HistoName,HistoName,
465  Parameters.getParameter<int32_t>("Nbins"),
466  Parameters.getParameter<double>("xmin"),
467  Parameters.getParameter<double>("xmax"));
468  StripMultiplicityApvShotsGlobal->setAxisTitle("# strips in Apv Shots",1);
469  }
470 
471  //cumulative number of APV shots
474  const char* HistoName = "Number_of_Apv_Shots";
475  NApvShotsGlobal=ibooker.book1D(HistoName,HistoName,
476  Parameters.getParameter<int32_t>("Nbins"),
477  Parameters.getParameter<double>("xmin"),
478  Parameters.getParameter<double>("xmax"));
479  NApvShotsGlobal->setAxisTitle("# Apv Shots",1);
480  }
481 
482  //cumulative Median Charge in APV shots
484  edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TH1ChargeMedianApvShots");
485  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
486  const char* HistoName = "Apv_Shots_Charge_Median";
487  MedianChargeApvShotsGlobal=ibooker.book1D(HistoName,HistoName,
488  Parameters.getParameter<int32_t>("Nbins"),
489  Parameters.getParameter<double>("xmin"),
490  Parameters.getParameter<double>("xmax"));
491  MedianChargeApvShotsGlobal->setAxisTitle("Apv Shots Charge Median (ADC)",1);
492  }
493 
494  //cmulative APV number with shots
497  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
498  const char* HistoName = "Apv_Shots_Apv_Number";
499  NApvApvShotsGlobal=ibooker.book1D(HistoName,HistoName,
500  Parameters.getParameter<int32_t>("Nbins"),
501  Parameters.getParameter<double>("xmin"),
502  Parameters.getParameter<double>("xmax"));
503  NApvApvShotsGlobal->setAxisTitle("Apv Number",1);
504  }
505 
506  //
507  // Book new histogram to monitor digi in last LS
508  //
509 
512 
513  std::stringstream ss;
514 
515  folder_organizer.getLayerFolderName(ss, 0, tTopo);
516  ibooker.setCurrentFolder(ss.str().c_str());
517 
519  const char* HistoName = "NumberOfDigisInLastLS";
520  digiFailureMEs.SubDetTotDigiProfLS= ibooker.bookProfile(HistoName, HistoName,
521  6,0.5,6.5,
522  0., 0., "" );
529  }
530 
532  std::string HistoName = "DataPresentInLS";
533  edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TotalNumberOfDigisFailure");
534 
535  digiFailureMEs.SubDetDigiFailures2D = ibooker.book2D(HistoName,HistoName,
536  Parameters.getParameter<int32_t>("Nbins"), //bins X
537  1, //xmin
538  Parameters.getParameter<int32_t>("Nbins") + 1, //xmax
539  6, //bins Y
540  0, //ymin
541  6); //ymax
542 
549  digiFailureMEs.SubDetDigiFailures2D->setAxisTitle("Luminosity Section");
550  }
551  }//end of if
552 
553 }//end of method
554 
555 //--------------------------------------------------------------------------------------------
557 
558  // Filter out events if DCS Event if requested
559  if (dcsStatus_ && !dcsStatus_->getStatus(iEvent, iSetup)) return;
560 
561  //Retrieve tracker topology from geometry
562  edm::ESHandle<TrackerTopology> tTopoHandle;
563  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
564  const TrackerTopology* const tTopo = tTopoHandle.product();
565 
566  TotalNShots=0;
567 
568  runNb = iEvent.id().run();
569  eventNb++;
570 
571  float iOrbitVar = m_trendVsLS ? iEvent.orbitNumber()/NORBITS_PER_LS : iEvent.orbitNumber()/NORBITS_PER_SECOND ;
572 
573  digi_detset_handles.clear();
574 
575  std::vector<edm::EDGetTokenT<edm::DetSetVector<SiStripDigi> > >::const_iterator iToken = digiProducerTokenList.begin();
576  for(std::vector<edm::InputTag>::const_iterator iter = digiProducerList.begin(), iEnd = digiProducerList.end();
577  iter != iEnd; ++iter, ++iToken) {
579  iEvent.getByToken( *iToken, digi_handle );
580  if (digi_handle.isValid()) digi_detset_handles.push_back(digi_handle.product());
581  }
582 
583  // initialise # of clusters to zero
584  for (std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.begin();
585  iSubdet != SubDetMEsMap.end(); iSubdet++) {
586  iSubdet->second.totNDigis = 0;
587  iSubdet->second.SubDetApvShots.clear();
588  }
589 
590  for (std::map<std::string, std::vector< uint32_t > >::const_iterator iterLayer = LayerDetMap.begin();
591  iterLayer != LayerDetMap.end(); iterLayer++) {
592 
593  std::string layer_label = iterLayer->first;
594 
595  std::vector< uint32_t > layer_dets = iterLayer->second;
596  std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(layer_label);
597 
598  //get Layer MEs
599  LayerMEs local_layermes;
600 
601  if(iLayerME == LayerMEsMap.end()) continue;
602  else local_layermes = iLayerME->second;
603 
604  int largest_adc_layer= 0;
605  int smallest_adc_layer= 99999;
606 
607  int ndigi_layer = 0;
608 
609  uint16_t iDet = 0;
610 
611  std::string subdet_label = "";
612 
613  // loop over all modules in the layer
614  for (std::vector< uint32_t >::const_iterator iterDets = layer_dets.begin() ;
615  iterDets != layer_dets.end() ; iterDets++) {
616  iDet++;
617 
618  // detid and type of ME
619  uint32_t detid = (*iterDets);
620 
621  // Get SubDet label once
622  if (subdet_label.size() == 0) subdet_label = folder_organizer.getSubDetFolderAndTag(detid, tTopo).second;
623 
624  // DetId and corresponding set of MEs
625 
626  std::map<uint32_t, ModMEs >::iterator pos = DigiMEs.find(detid);
627  ModMEs local_modmes = pos->second;
628 
629  // search digis of detid
630  int loc = getDigiSourceIndex(detid);
631 
632  int ndigi_det = 0;
633 
634  if (loc > -1) {
635  ndigi_det = (*(digi_detset_handles[loc]))[detid].size();
636  APVShotFinder theShotFinder = APVShotFinder((*(digi_detset_handles[loc]))[detid]);
637  const std::vector<APVShot>& shots = theShotFinder.getShots();
638  AddApvShotsToSubDet(shots,SubDetMEsMap[subdet_label].SubDetApvShots);
639  if (shotshistomapon) tkmapNApvshots->fill(detid,shots.size());
642  }
643 
644  if(Mod_On_ && moduleswitchnumdigison && (local_modmes.NumberOfDigis != NULL))
645  (local_modmes.NumberOfDigis)->Fill(ndigi_det);
646 
648  local_layermes.LayerNumberOfDigisProfile->Fill(iDet*1.0,ndigi_det);
649 
650  if (digitkhistomapon) tkmapdigi->fill(detid,ndigi_det);
651 
652  if (ndigi_det == 0) continue; // no digis for this detid => jump to next step of loop
653 
654  const edm::DetSet<SiStripDigi> & digi_detset = (*(digi_detset_handles[loc]))[detid];
655 
656  ndigi_layer += ndigi_det;
657 
658  // ADCs
659  int largest_adc=(digi_detset.data.begin())->adc();
660  int smallest_adc=(digi_detset.data.begin())->adc();
661 
662 
663  // Check if these parameters are really needed
664  float det_occupancy = 0.0;
665 
666  for(edm::DetSet<SiStripDigi>::const_iterator digiIter = digi_detset.data.begin();
667  digiIter!= digi_detset.data.end(); digiIter++ ){
668 
669  int this_adc = digiIter->adc();
670 
671  if (this_adc > 0.0) det_occupancy++;
672 
673  if(this_adc>largest_adc) largest_adc = this_adc;
674  if(this_adc<smallest_adc) smallest_adc = this_adc;
675 
676  if(Mod_On_ && moduleswitchnumdigispstripon && (local_modmes.NumberOfDigisPerStrip != NULL) && (this_adc > 0.0) )
677  (local_modmes.NumberOfDigisPerStrip)->Fill(digiIter->strip());
678 
679  if(Mod_On_ && moduleswitchdigiadcson && (local_modmes.DigiADCs != NULL) )
680  (local_modmes.DigiADCs)->Fill(static_cast<float>(this_adc));
681 
682  //Fill #ADCs for this digi at layer level
684  fillME(local_layermes.LayerDigiADCs , this_adc);
685  if (createTrendMEs) fillTrend(local_layermes.LayerDigiADCsTrend, this_adc, iOrbitVar);
686  }
687 
689  local_layermes.LayerDigiADCProfile->Fill(iDet*1.0,this_adc);
690 
691  }//end of loop over digis in this det
692 
693  // Occupancy
694  short nstrips = SiStripDetCabling_->nApvPairs(detid) * 2 * 128;
695  if (nstrips > 0 && det_occupancy > 0 ) {
696  det_occupancy = det_occupancy/nstrips;
697  if (Mod_On_ && moduleswitchstripoccupancyon && (local_modmes.StripOccupancy != NULL))
698  (local_modmes.StripOccupancy)->Fill(det_occupancy);
700  fillME(local_layermes.LayerStripOccupancy, det_occupancy);
701  if (createTrendMEs) fillTrend(local_layermes.LayerStripOccupancyTrend, det_occupancy, iOrbitVar);
702  }
703  }
704 
705  if (largest_adc > largest_adc_layer) largest_adc_layer = largest_adc;
706  if (smallest_adc < smallest_adc_layer) smallest_adc_layer = smallest_adc;
707 
708  // nr. of adcs for hottest strip
709  if( Mod_On_ && moduleswitchadchotteston && (local_modmes.ADCsHottestStrip != NULL))
710  (local_modmes.ADCsHottestStrip)->Fill(static_cast<float>(largest_adc));
711 
712  // nr. of adcs for coolest strip
713  if(Mod_On_ && moduleswitchadccooleston && (local_modmes.ADCsCoolestStrip != NULL))
714  (local_modmes.ADCsCoolestStrip)->Fill(static_cast<float>(smallest_adc));
715 
716  }//end of loop over DetIds
717 
719  fillME(local_layermes.LayerNumberOfDigis,ndigi_layer);
720  if (createTrendMEs) fillTrend(local_layermes.LayerNumberOfDigisTrend, ndigi_layer, iOrbitVar);
721  }
723  fillME(local_layermes.LayerADCsHottestStrip,largest_adc_layer);
724  if (createTrendMEs) fillTrend(local_layermes.LayerADCsHottestStripTrend, largest_adc_layer, iOrbitVar);
725  }
727  fillME(local_layermes.LayerADCsCoolestStrip ,smallest_adc_layer);
728  if (createTrendMEs) fillTrend(local_layermes.LayerADCsCoolestStripTrend, smallest_adc_layer, iOrbitVar);
729  }
730 
731  std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.find(subdet_label);
732  if(iSubdet != SubDetMEsMap.end()) {
733  iSubdet->second.totNDigis += ndigi_layer;
734  //std::cout << " totDigis" << iSubdet->second.totNDigis << " in " << subdet_label << std::endl;
735  }
736  }
737 
739 
740  //check Stable beams bit
742  iEvent.getByToken( gtEvmToken_, gtEvm_handle );
743  L1GlobalTriggerEvmReadoutRecord const* gtevm = gtEvm_handle.product();
744 
745  L1GtfeExtWord gtfeEvmExtWord;
746  if (gtevm)
747  {
748  gtfeEvmExtWord = gtevm->gtfeWord();
749  }
750  else
751  edm::LogInfo("DQMProvInfo") << " gtfeEvmWord inaccessible" ;
752 
753  /* mia: is there not a smarter way !?!?!?!? */
754  if ( gtfeEvmExtWord.beamMode() == 11 )
755  isStableBeams = true;
756  }
757 
758  for (std::map<std::string, SubDetMEs>::iterator it = SubDetMEsMap.begin();
759  it != SubDetMEsMap.end(); it++) {
760 
762  if (strcmp(it->first.c_str(),"TEC__MINUS")==0){
763  digiFailureMEs.SubDetTotDigiProfLS->Fill(1, it->second.totNDigis);
764  }else if (strcmp(it->first.c_str(),"TEC__PLUS")==0){
765  digiFailureMEs.SubDetTotDigiProfLS->Fill(2, it->second.totNDigis);
766  }else if (strcmp(it->first.c_str(),"TIB")==0){
767  digiFailureMEs.SubDetTotDigiProfLS->Fill(3, it->second.totNDigis);
768  }else if (strcmp(it->first.c_str(),"TID__MINUS")==0){
769  digiFailureMEs.SubDetTotDigiProfLS->Fill(4, it->second.totNDigis);
770  }else if (strcmp(it->first.c_str(),"TID__PLUS")==0){
771  digiFailureMEs.SubDetTotDigiProfLS->Fill(5, it->second.totNDigis);
772  }else if (strcmp(it->first.c_str(),"TOB")==0){
773  digiFailureMEs.SubDetTotDigiProfLS->Fill(6, it->second.totNDigis);
774  }
775  }
776 
778  if (strcmp(it->first.c_str(),"TEC__MINUS")==0){
779  NApvShotsGlobalProf->Fill(1,it->second.SubDetApvShots.size());
780  }else if (strcmp(it->first.c_str(),"TEC__PLUS")==0){
781  NApvShotsGlobalProf->Fill(2,it->second.SubDetApvShots.size());
782  }else if (strcmp(it->first.c_str(),"TIB")==0){
783  NApvShotsGlobalProf->Fill(3,it->second.SubDetApvShots.size());
784  }else if (strcmp(it->first.c_str(),"TID__MINUS")==0){
785  NApvShotsGlobalProf->Fill(4,it->second.SubDetApvShots.size());
786  }else if (strcmp(it->first.c_str(),"TID__PLUS")==0){
787  NApvShotsGlobalProf->Fill(5,it->second.SubDetApvShots.size());
788  }else if (strcmp(it->first.c_str(),"TOB")==0){
789  NApvShotsGlobalProf->Fill(6,it->second.SubDetApvShots.size());
790  }
791  }
792 
793  SubDetMEs subdetmes= it->second;
794  std::string subdet = it->first;
795 
796  // Fill APV shots histograms for SubDet
797 
798  uint ShotsSize=subdetmes.SubDetApvShots.size();
799  TotalNShots+=ShotsSize; //Counter for total Shots in the SiStrip Tracker
800 
801  if (subdetswitchnapvshotson ) subdetmes.SubDetNApvShotsTH1->Fill(ShotsSize);// N shots
802  if (subdetswitchapvshotsonprof) subdetmes.SubDetNApvShotsProf ->Fill(iOrbitVar,ShotsSize); //N shots vs time
803 
804  for (uint i=0; i< ShotsSize; ++i){ // Strip multiplicity, charge median and APV number distributions for APV shots
805 
806  if (subdetswitchapvshotsApvon) subdetmes.SubDetNApvShotsNApvTH1->Fill((subdetmes.SubDetApvShots[i].apvNumber()+1));//APV are defined by 0 to 5 I want 1 to 6
807  if (globalswitchapvshotsApvon) NApvApvShotsGlobal->Fill((subdetmes.SubDetApvShots[i].apvNumber()+1));
808 
809  if (subdetswitchnstripsapvshotson) subdetmes.SubDetNStripsApvShotsTH1->Fill(subdetmes.SubDetApvShots[i].nStrips());
811 
814 
815  }
816 
817  if (subdetswitchtotdigiprofon)subdetmes.SubDetTotDigiProf->Fill(iOrbitVar,subdetmes.totNDigis);
818  }
819 
822 
823  // get EventHistory
824 
825  edm::Handle<EventWithHistory> event_history;
826  iEvent.getByToken(historyProducerToken_,event_history);
827 
828  // get Phase of APV
829  edm::Handle<APVCyclePhaseCollection> apv_phase_collection;
830  iEvent.getByToken(apvPhaseProducerToken_,apv_phase_collection);
831 
832  if (event_history.isValid()
833  && !event_history.failedToGet()
834  && apv_phase_collection.isValid()
835  && !apv_phase_collection.failedToGet()) {
836 
837 
838  long long tbx = event_history->absoluteBX();
839 
840 
841  for (std::map<std::string, SubDetMEs>::iterator it = SubDetMEsMap.begin();
842  it != SubDetMEsMap.end(); it++) {
843 
844  SubDetMEs subdetmes;
845  std::string subdet = it->first;
846  subdetmes = it->second;
847 
848  int the_phase = APVCyclePhaseCollection::invalid;
849  long long tbx_corr = tbx;
850 
851  if (SubDetPhasePartMap.find(subdet) != SubDetPhasePartMap.end()) the_phase = apv_phase_collection->getPhase(SubDetPhasePartMap[subdet]);
852  if(the_phase==APVCyclePhaseCollection::nopartition ||
854  the_phase==APVCyclePhaseCollection::invalid) the_phase=30;
855  tbx_corr -= the_phase;
856 
857  if (subdetswitchapvcycleprofon)subdetmes.SubDetDigiApvProf->Fill(tbx_corr%70,subdetmes.totNDigis);
858  if (subdetswitchapvcycleth2on) subdetmes.SubDetDigiApvTH2->Fill(tbx_corr%70,subdetmes.totNDigis);
859  }
860  }
861 }//end of method analyze
862 //--------------------------------------------------------------------------------------------
864  std::map<uint32_t, ModMEs >::iterator pos = DigiMEs.find(idet);
865  ModMEs mod_me = pos->second;
866 
871  if(Mod_On_ && moduleswitchdigiadcson) mod_me.DigiADCs->Reset();
873 
874 }
875 //------------------------------------------------------------------------------------------
876 MonitorElement* SiStripMonitorDigi::bookMETrend(DQMStore::IBooker & ibooker , const char* ParameterSetLabel, const char* HistoName )
877 {
878  edm::ParameterSet ParametersTrend = conf_.getParameter<edm::ParameterSet>("Trending");
879  MonitorElement* me = ibooker.bookProfile(HistoName,HistoName,
880  ParametersTrend.getParameter<int32_t>("Nbins"),
881  // 0,
882  ParametersTrend.getParameter<double>("xmin"),
883  ParametersTrend.getParameter<double>("xmax"),
884  // ParametersTrend.getParameter<int32_t>("Nbins"),
885  100, //that parameter should not be there !?
886  ParametersTrend.getParameter<double>("ymin"),
887  ParametersTrend.getParameter<double>("ymax"),
888  "" );
889  if(!me) return me;
890 
891  me->setAxisTitle("Lumisection",1);
892  if (me->kind() == MonitorElement::DQM_KIND_TPROFILE) me->getTH1()->SetCanExtend(TH1::kAllAxes);
893  return me;
894 }
895 
896 //------------------------------------------------------------------------------------------
897 MonitorElement* SiStripMonitorDigi::bookME1D(DQMStore::IBooker & ibooker , const char* ParameterSetLabel, const char* HistoName )
898 {
900  return ibooker.book1D(HistoName,HistoName,
901  Parameters.getParameter<int32_t>("Nbinx"),
902  Parameters.getParameter<double>("xmin"),
903  Parameters.getParameter<double>("xmax")
904  );
905 }
906 
907 //--------------------------------------------------------------------------------
908 void SiStripMonitorDigi::fillTrend(MonitorElement* me ,float value, float timeinorbit)
909 {
910  if(!me) return;
911  me->Fill(timeinorbit,value);
912 }
913 
914 //
915 // -- Create Module Level MEs
916 //
917 void SiStripMonitorDigi::createModuleMEs(DQMStore::IBooker & ibooker , ModMEs& mod_single, uint32_t detid ) {
918 
919  // use SistripHistoId for producing histogram id (and title)
920  SiStripHistoId hidmanager;
921  std::string hid;
922 
923  //nr. of digis per module
925  hid = hidmanager.createHistoId("NumberOfDigis","det",detid);
926  mod_single.NumberOfDigis = ibooker.book1D(hid, hid, 21, -0.5, 20.5);
927  ibooker.tag(mod_single.NumberOfDigis, detid);
928  mod_single.NumberOfDigis->setAxisTitle("number of digis in one detector module");
929  mod_single.NumberOfDigis->getTH1()->StatOverflows(kTRUE); // over/underflows in Mean calculation
930  }
931 
932  //nr. of digis per strip in module
934  hid = hidmanager.createHistoId("NumberOfDigisPerStrip","det",detid);
935  short nstrips = SiStripDetCabling_->nApvPairs(detid) * 2 * 128;
936  mod_single.NumberOfDigisPerStrip = ibooker.book1D(hid, hid, nstrips, -0.5, nstrips+0.5);
937  ibooker.tag(mod_single.NumberOfDigisPerStrip, detid);
938  mod_single.NumberOfDigisPerStrip->setAxisTitle("number of (digis > 0) per strip");
939  mod_single.NumberOfDigisPerStrip->getTH1()->StatOverflows(kTRUE); // over/underflows in Mean calculation
940  }
941  //#ADCs for hottest strip
943  hid = hidmanager.createHistoId("ADCsHottestStrip","det",detid);
944  mod_single.ADCsHottestStrip = bookME1D(ibooker , "TH1ADCsHottestStrip", hid.c_str() );
945  ibooker.tag(mod_single.ADCsHottestStrip, detid); // 6 APVs -> 768 strips
946  mod_single.ADCsHottestStrip->setAxisTitle("number of ADCs for hottest strip");
947  }
948 
949  //#ADCs for coolest strip
951  hid = hidmanager.createHistoId("ADCsCoolestStrip","det",detid);
952  mod_single.ADCsCoolestStrip = bookME1D(ibooker , "TH1ADCsCoolestStrip", hid.c_str() );
953  ibooker.tag(mod_single.ADCsCoolestStrip, detid);
954  mod_single.ADCsCoolestStrip->setAxisTitle("number of ADCs for coolest strip");
955  }
956 
957  //#ADCs for each digi
959  hid = hidmanager.createHistoId("DigiADCs","det",detid);
960  mod_single.DigiADCs = bookME1D( ibooker , "TH1DigiADCs", hid.c_str() );
961  ibooker.tag(mod_single.DigiADCs, detid);
962  mod_single.DigiADCs->setAxisTitle("number of ADCs for each digi");
963  }
964 
965  //Strip occupancy
967  hid = hidmanager.createHistoId("StripOccupancy","det",detid);
968  mod_single.StripOccupancy = bookME1D( ibooker , "TH1StripOccupancy", hid.c_str() );
969  ibooker.tag(mod_single.StripOccupancy, detid);
970  mod_single.StripOccupancy->setAxisTitle("strip occupancy");
971  }
972 
973 }
974 
975 //
976 // -- Create Module Level MEs
977 //
978 
980 
981  std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(label);
982  if(iLayerME==LayerMEsMap.end()){
983  SiStripHistoId hidmanager;
984  LayerMEs layerMEs;
985  layerMEs.LayerNumberOfDigis = 0;
986  layerMEs.LayerNumberOfDigisTrend = 0;
987  layerMEs.LayerADCsHottestStrip = 0;
988  layerMEs.LayerADCsHottestStripTrend = 0;
989  layerMEs.LayerADCsCoolestStrip = 0;
990  layerMEs.LayerADCsCoolestStripTrend = 0;
991  layerMEs.LayerDigiADCs = 0;
992  layerMEs.LayerDigiADCsTrend = 0;
993  layerMEs.LayerStripOccupancy = 0;
994  layerMEs.LayerStripOccupancyTrend = 0;
995  layerMEs.LayerNumberOfDigisProfile = 0;
996  layerMEs.LayerDigiADCProfile = 0;
997 
998 
999  //#Digis
1000  if(layerswitchnumdigison) {
1001  layerMEs.LayerNumberOfDigis=bookME1D( ibooker , "TH1NumberOfDigis", hidmanager.createHistoLayer("Summary_TotalNumberOfDigis","layer",label,"").c_str() );
1002  if (createTrendMEs) layerMEs.LayerNumberOfDigisTrend=bookMETrend( ibooker , "TH1NumberOfDigis", hidmanager.createHistoLayer("Trend_NumberOfDigis","layer",label,"").c_str() );
1003  }
1004 
1005  //#ADCs for hottest strip
1007  layerMEs.LayerADCsHottestStrip=bookME1D( ibooker , "TH1ADCsHottestStrip", hidmanager.createHistoLayer("Summary_ADCsHottestStrip","layer",label,"").c_str() );
1008  if (createTrendMEs) layerMEs.LayerADCsHottestStripTrend=bookMETrend( ibooker , "TH1ADCsHottestStrip", hidmanager.createHistoLayer("Trend_ADCsHottestStrip","layer",label,"").c_str() );
1009  }
1010 
1011  //#ADCs for coolest strip
1013  layerMEs.LayerADCsCoolestStrip=bookME1D(ibooker , "TH1ADCsCoolestStrip", hidmanager.createHistoLayer("Summary_ADCsCoolestStrip","layer",label,"").c_str() );
1014  if (createTrendMEs) layerMEs.LayerADCsCoolestStripTrend=bookMETrend( ibooker , "TH1ADCsCoolestStrip", hidmanager.createHistoLayer("Trend_ADCsCoolestStrip","layer",label,"").c_str() );
1015  }
1016 
1017  //#ADCs for each digi
1018  if(layerswitchdigiadcson) {
1019  layerMEs.LayerDigiADCs=bookME1D( ibooker , "TH1DigiADCs", hidmanager.createHistoLayer("Summary_DigiADCs","layer",label,"").c_str() );
1020  if (createTrendMEs) layerMEs.LayerDigiADCsTrend=bookMETrend( ibooker , "TH1DigiADCs", hidmanager.createHistoLayer("Trend_DigiADCs","layer",label,"").c_str() );
1021  }
1022 
1023  //Strip Occupancy
1025  layerMEs.LayerStripOccupancy=bookME1D( ibooker , "TH1StripOccupancy", hidmanager.createHistoLayer("Summary_StripOccupancy","layer",label,"").c_str() );
1026  if (createTrendMEs) layerMEs.LayerStripOccupancyTrend=bookMETrend( ibooker , "TH1StripOccupancy", hidmanager.createHistoLayer("Trend_StripOccupancy","layer",label,"").c_str() );
1027 
1028  }
1029  // # of Digis
1031  std::string hid = hidmanager.createHistoLayer("NumberOfDigiProfile","layer",label,"");
1032  layerMEs.LayerNumberOfDigisProfile = ibooker.bookProfile(hid, hid, ndets, 0.5, ndets+0.5,21, -0.5, 200.5);
1033  }
1034 
1035  // # of Digis
1037  std::string hid = hidmanager.createHistoLayer("DigiADCProfile","layer",label,"");
1038  layerMEs.LayerDigiADCProfile = ibooker.bookProfile(hid, hid, ndets, 0.5, ndets+0.5, 64, -0.5, 255.5);
1039  }
1040 
1041  LayerMEsMap[label]=layerMEs;
1042  }
1043 }
1044 //
1045 // -- Create SubDetector MEs
1046 //
1048 
1049  SubDetMEs subdetMEs;
1050  subdetMEs.totNDigis = 0;
1051  subdetMEs.SubDetTotDigiProf = 0;
1052  subdetMEs.SubDetDigiApvProf = 0;
1053  subdetMEs.SubDetDigiApvTH2 = 0;
1054 
1055  subdetMEs.SubDetApvShots.clear();
1056  subdetMEs.SubDetNApvShotsTH1 = 0;
1057  subdetMEs.SubDetChargeMedianApvShotsTH1 = 0;
1058  subdetMEs.SubDetNStripsApvShotsTH1 = 0;
1059  subdetMEs.SubDetNApvShotsProf = 0;
1060 
1062 
1063  // Total Number of Digi - Profile
1065  edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TProfTotalNumberOfDigis");
1066  HistoName = "TotalNumberOfDigiProfile__" + label;
1067  subdetMEs.SubDetTotDigiProf=ibooker.bookProfile(HistoName,HistoName,
1068  Parameters.getParameter<int32_t>("Nbins"),
1069  Parameters.getParameter<double>("xmin"),
1070  Parameters.getParameter<double>("xmax"),
1071  100, //that parameter should not be there !?
1072  Parameters.getParameter<double>("ymin"),
1073  Parameters.getParameter<double>("ymax"),
1074  "" );
1075  subdetMEs.SubDetTotDigiProf->setAxisTitle("Lumisection",1);
1076  if (subdetMEs.SubDetTotDigiProf->kind() == MonitorElement::DQM_KIND_TPROFILE) subdetMEs.SubDetTotDigiProf->getTH1()->SetCanExtend(TH1::kAllAxes);
1077  }
1078 
1079  // Number of Digi vs Bx - Profile
1082  HistoName = "Digi_vs_ApvCycle__" + label;
1083  subdetMEs.SubDetDigiApvProf=ibooker.bookProfile(HistoName,HistoName,
1084  Parameters.getParameter<int32_t>("Nbins"),
1085  Parameters.getParameter<double>("xmin"),
1086  Parameters.getParameter<double>("xmax"),
1087  200, //that parameter should not be there !?
1088  Parameters.getParameter<double>("ymin"),
1089  Parameters.getParameter<double>("ymax"),
1090  "" );
1091  subdetMEs.SubDetDigiApvProf->setAxisTitle("ApvCycle (Corrected Absolute Bx % 70)",1);
1092  }
1093 
1094  // Number of Digi vs Bx - TH2
1097  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
1098  HistoName = "Digi_vs_ApvCycle_2D__" + label;
1099  // Adjusting the scale for 2D histogram
1100  double h2ymax = 9999.0;
1101  double yfact = Parameters.getParameter<double>("yfactor");
1102  if(label.find("TIB") != std::string::npos) h2ymax = (6984.*256.)*yfact;
1103  else if (label.find("TID") != std::string::npos) h2ymax = (2208.*256.)*yfact;
1104  else if (label.find("TOB") != std::string::npos) h2ymax = (12906.*256.)*yfact;
1105  else if (label.find("TEC") != std::string::npos) h2ymax = (7552.*2.*256.)*yfact;
1106  subdetMEs.SubDetDigiApvTH2=ibooker.book2D(HistoName,HistoName,
1107  Parameters.getParameter<int32_t>("Nbins"),
1108  Parameters.getParameter<double>("xmin"),
1109  Parameters.getParameter<double>("xmax"),
1110  Parameters.getParameter<int32_t>("Nbinsy"), //it was 100 that parameter should not be there !?
1111  Parameters.getParameter<double>("ymin"),
1112  h2ymax);
1113  subdetMEs.SubDetDigiApvTH2->setAxisTitle("absolute Bx mod(70)",1);
1114  }
1115 
1116  //Number of APV Shots
1119  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
1120  HistoName = "Number_of_Apv_Shots_" + label;
1121  subdetMEs.SubDetNApvShotsTH1=ibooker.book1D(HistoName,HistoName,
1122  Parameters.getParameter<int32_t>("Nbins"),
1123  Parameters.getParameter<double>("xmin"),
1124  Parameters.getParameter<double>("xmax"));
1125  subdetMEs.SubDetNApvShotsTH1->setAxisTitle("# Apv Shots",1);
1126  }
1127 
1128  //Strip multiplicity of APV Shots
1131  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
1132  HistoName = "Number_of_Strips_in_Apv_Shots_" + label;
1133  subdetMEs.SubDetNStripsApvShotsTH1=ibooker.book1D(HistoName,HistoName,
1134  Parameters.getParameter<int32_t>("Nbins"),
1135  Parameters.getParameter<double>("xmin"),
1136  Parameters.getParameter<double>("xmax"));
1137  subdetMEs.SubDetNStripsApvShotsTH1->setAxisTitle("# strips in Apv Shots",1);
1138  }
1139 
1140  //Charge median of APV Shots
1142  edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TH1ChargeMedianApvShots");
1143  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
1144  HistoName = "Apv_Shots_Charge_Median_" + label;
1145  subdetMEs.SubDetChargeMedianApvShotsTH1=ibooker.book1D(HistoName,HistoName,
1146  Parameters.getParameter<int32_t>("Nbins"),
1147  Parameters.getParameter<double>("xmin"),
1148  Parameters.getParameter<double>("xmax"));
1149  subdetMEs.SubDetChargeMedianApvShotsTH1->setAxisTitle("Apv Shots Charge Median (ADC)",1);
1150  }
1151 
1152 
1155  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
1156  HistoName = "Apv_Shots_Apv_Number_" + label;
1157  subdetMEs.SubDetNApvShotsNApvTH1=ibooker.book1D(HistoName,HistoName,
1158  Parameters.getParameter<int32_t>("Nbins"),
1159  Parameters.getParameter<double>("xmin"),
1160  Parameters.getParameter<double>("xmax"));
1161  subdetMEs.SubDetNApvShotsNApvTH1->setAxisTitle("Apv Number",1);
1162  }
1163 
1164 
1165 
1166 
1167 
1168  //APV Shots number Vs time
1171  HistoName = "NApv_Shots_vs_Time_" + label;
1172  subdetMEs.SubDetNApvShotsProf=ibooker.bookProfile(HistoName,HistoName,
1173  Parameters.getParameter<int32_t>("Nbins"),
1174  Parameters.getParameter<double>("xmin"),
1175  Parameters.getParameter<double>("xmax"),
1176  200, //that parameter should not be there !?
1177  Parameters.getParameter<double>("ymin"),
1178  Parameters.getParameter<double>("ymax"),
1179  "" );
1180  subdetMEs.SubDetNApvShotsProf->setAxisTitle("Time (s)",1);
1181  subdetMEs.SubDetNApvShotsProf->setAxisTitle("# Apv Shots",2);
1182  if (subdetMEs.SubDetNApvShotsProf->kind() == MonitorElement::DQM_KIND_TPROFILE) subdetMEs.SubDetNApvShotsProf->getTH1()->SetCanExtend(TH1::kAllAxes);
1183  }
1184 
1185 
1186 
1187 
1188 
1189 
1190 
1191  SubDetMEsMap[label]=subdetMEs;
1192 }
1193 //
1194 // -- Get DetSet vector for a given Detector
1195 //
1197  int location = -1;
1198  for (unsigned int ival = 0; ival < digi_detset_handles.size(); ++ival){
1200  if(isearch != digi_detset_handles[ival]->end()) {
1201  location = ival;
1202  break;
1203  }
1204  }
1205  return location;
1206 }
1207 
1208 void SiStripMonitorDigi::AddApvShotsToSubDet(const std::vector<APVShot> & moduleShots, std::vector<APVShot> & subdetShots){
1209 
1210  for (uint i=0; i<moduleShots.size(); i++){
1211  subdetShots.push_back(moduleShots[i]);
1212  }
1213 }
1214 
1215 void SiStripMonitorDigi::FillApvShotsMap(TkHistoMap* the_map, const std::vector<APVShot> & shots, uint32_t id ,int mode){
1216 
1217  for (uint i=0; i<shots.size(); i++){
1218  if (mode==1) the_map->fill(id,shots[i].nStrips()); //mode == 1 fill with strip multiplicity
1219  if (mode==2) the_map->fill(id,shots[i].median()); // mode == 2 fill with charge median
1220  }
1221 }
1222 
1223 //define this as a plug-in
int adc(sample_type sample)
get the ADC sample (12 bits)
RunNumber_t run() const
Definition: EventID.h:39
MonitorElement * bookME1D(DQMStore::IBooker &ibooker, const char *ParameterSetLabel, const char *HistoName)
LuminosityBlockID id() const
void ResetModuleMEs(uint32_t idet)
T getParameter(std::string const &) const
std::map< std::string, LayerMEs > LayerMEsMap
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const
void createMEs(DQMStore::IBooker &ibooker, const edm::EventSetup &es)
MonitorElement * LayerNumberOfDigisTrend
std::pair< const std::string, const char * > getSubDetFolderAndTag(const uint32_t &detid, const TrackerTopology *tTopo)
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
MonitorElement * LayerStripOccupancy
MonitorElement * LayerADCsHottestStrip
const double NORBITS_PER_LS
edm::InputTag historyProducer_
const L1GtfeExtWord gtfeWord() const
get / set GTFE word (record) in the GT readout record
void getLayerFolderName(std::stringstream &ss, uint32_t rawdetid, const TrackerTopology *tTopo, bool ring_flag=0)
MonitorElement * LayerADCsHottestStripTrend
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
long long absoluteBX(const unsigned int ev1) const
MonitorElement * NApvShotsGlobalProf
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
std::pair< std::string, int32_t > GetSubDetAndLayer(const uint32_t &detid, const TrackerTopology *tTopo, bool ring_flag=0)
std::map< uint32_t, ModMEs > DigiMEs
#define NULL
Definition: scimark2.h:8
std::map< std::string, std::string > SubDetPhasePartMap
MonitorElement * MedianChargeApvShotsGlobal
MonitorElement * StripMultiplicityApvShotsGlobal
TkHistoMap * tkmapNstripApvshot
MonitorElement * LayerNumberOfDigisProfile
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
Definition: EventSetup.cc:91
void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void Fill(long long x)
std::vector< APVShot > SubDetApvShots
void setDetectorFolder(uint32_t rawdetid, const TrackerTopology *tTopo)
unsigned long long m_cacheID_
MonitorElement * SubDetNApvShotsNApvTH1
void createSubDetMEs(DQMStore::IBooker &ibooker, std::string label)
bool getStatus(edm::Event const &e, edm::EventSetup const &eSetup)
MonitorElement * NumberOfDigisPerStrip
const std::vector< APVShot > & getShots() const
int iEvent
Definition: GenABIO.cc:230
MonitorElement * ADCsCoolestStrip
const int getPhase(const std::string partition) const
vector< ParameterSet > Parameters
SiStripDCSStatus * dcsStatus_
const double NORBITS_PER_SECOND
edm::ESHandle< SiStripDetCabling > SiStripDetCabling_
void getTOBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tobDetRawIds, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t rod=0) const
MonitorElement * LayerADCsCoolestStripTrend
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * SubDetNStripsApvShotsTH1
DigiFailureMEs digiFailureMEs
std::vector< int > m_fed_in
Definition: RunInfo.h:26
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void fill(uint32_t &detid, float value)
Definition: TkHistoMap.cc:180
edm::EDGetTokenT< EventWithHistory > historyProducerToken_
void fillME(MonitorElement *ME, float value1)
MonitorElement * NApvApvShotsGlobal
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
std::vector< const edm::DetSetVector< SiStripDigi > * > digi_detset_handles
void tag(MonitorElement *, unsigned int)
Definition: DQMStore.cc:289
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TH1 * getTH1(void) const
virtual void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
#define end
Definition: vmac.h:37
Definition: value.py:1
int orbitNumber() const
Definition: EventBase.h:67
Kind kind(void) const
Get the type of the monitor element.
std::map< std::string, SubDetMEs > SubDetMEsMap
std::string getSubdetid(uint32_t id, const TrackerTopology *tTopo, bool flag_ring)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
Definition: DQMStore.cc:1807
MonitorElement * ADCsHottestStrip
bool isValid() const
Definition: HandleBase.h:74
void createLayerMEs(DQMStore::IBooker &ibooker, std::string label, int ndet)
void fillTrend(MonitorElement *me, float value, float timeinorbit)
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > gtEvmToken_
MonitorElement * NApvShotsGlobal
std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > > digiProducerTokenList
MonitorElement * LayerDigiADCProfile
T Max(T a, T b)
Definition: MathUtil.h:44
bool failedToGet() const
Definition: HandleBase.h:78
int getDigiSourceIndex(uint32_t id)
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
SiStripMonitorDigi(const edm::ParameterSet &)
edm::InputTag apvPhaseProducer_
void setLayerFolder(uint32_t rawdetid, const TrackerTopology *tTopo, int32_t layer=0, bool ring_flag=0)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
std::map< std::string, std::vector< uint32_t > > LayerDetMap
T const * product() const
Definition: Handle.h:81
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
std::string createHistoId(std::string description, std::string id_type, uint32_t component_id)
MonitorElement * SubDetChargeMedianApvShotsTH1
const T & get() const
Definition: EventSetup.h:56
LuminosityBlockNumber_t luminosityBlock() const
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
std::string topFolderName_
edm::ParameterSet conf_
std::string HistoName
void getTECDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tecDetRawIds, uint32_t side=0, uint32_t wheel=0, uint32_t petal_bkw_frw=0, uint32_t petal=0, uint32_t ring=0, uint32_t ster=0) const
std::vector< edm::InputTag > digiProducerList
const uint16_t nApvPairs(uint32_t det_id) const
TkHistoMap * tkmapMedianChargeApvshots
edm::EDGetTokenT< APVCyclePhaseCollection > apvPhaseProducerToken_
double getBinContent(int binx) const
get content of bin (1-D)
edm::EventID id() const
Definition: EventBase.h:60
collection_type data
Definition: DetSet.h:78
TkHistoMap * tkmapNApvshots
HLT enums.
MonitorElement * LayerStripOccupancyTrend
void getTIBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tibDetRawIds, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t int_ext=0, uint32_t string=0) const
MonitorElement * LayerADCsCoolestStrip
MonitorElement * bookMETrend(DQMStore::IBooker &ibooker, const char *ParameterSetLabel, const char *HistoName)
void AddApvShotsToSubDet(const std::vector< APVShot > &, std::vector< APVShot > &)
SiStripFolderOrganizer folder_organizer
void getTIDDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tidDetRawIds, uint32_t side=0, uint32_t wheel=0, uint32_t ring=0, uint32_t ster=0) const
MonitorElement * ShotsVsTimeApvShotsGlobal
std::string createHistoLayer(std::string description, std::string id_type, std::string path, std::string flag)
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
bool isValid() const
Definition: ESHandle.h:47
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:104
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void Reset(void)
reset ME (ie. contents, errors, etc)
const cms_uint16_t beamMode() const
T const * product() const
Definition: ESHandle.h:86
void FillApvShotsMap(TkHistoMap *, const std::vector< APVShot > &, uint32_t id, int)
void createModuleMEs(DQMStore::IBooker &ibooker, ModMEs &mod_single, uint32_t detid)
Definition: Run.h:42
virtual void endRun(const edm::Run &, const edm::EventSetup &) override