CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
41 
42 /* mia: but is there not a smarter way ?!?!?! */
43 const double NORBITS_PER_SECOND = 11223.;
44 
45 //--------------------------------------------------------------------------------------------
47  dqmStore_(edm::Service<DQMStore>().operator->()),
48  conf_(iConfig),
49  show_mechanical_structure_view(true),
50  show_readout_view (false),
51  show_control_view (false),
52  select_all_detectors (true),
53  reset_each_run (false),
54  folder_organizer(),
55  m_cacheID_(0)
56 {
57  firstEvent = -1;
58  eventNb = 0;
59 
60  // Detector Partitions
61  SubDetPhasePartMap["TIB"] = "TI";
62  SubDetPhasePartMap["TID__MINUS"] = "TI";
63  SubDetPhasePartMap["TID__PLUS"] = "TI";
64  SubDetPhasePartMap["TOB"] = "TO";
65  SubDetPhasePartMap["TEC__MINUS"] = "TM";
66  SubDetPhasePartMap["TEC__PLUS"] = "TP";
67 
68  topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
69 
70  // get Digi Producer List
71  digiProducerList = conf_.getParameter<std::vector<edm::InputTag> >("DigiProducersList");
72  for (auto const& tag : digiProducerList) {
74  }
75 
76  //get on/off option for every cluster from cfi
77  edm::ParameterSet ParametersNumberOfDigis = conf_.getParameter<edm::ParameterSet>("TH1NumberOfDigis");
78  layerswitchnumdigison = ParametersNumberOfDigis.getParameter<bool>("layerswitchon");
79  moduleswitchnumdigison = ParametersNumberOfDigis.getParameter<bool>("moduleswitchon");
80 
81  edm::ParameterSet ParametersNumberOfDigisPerStrip = conf_.getParameter<edm::ParameterSet>("TH1NumberOfDigisPerStrip");
82  moduleswitchnumdigispstripon = ParametersNumberOfDigisPerStrip.getParameter<bool>("moduleswitchon");
83 
84  edm::ParameterSet ParametersADCsHottestStrip = conf_.getParameter<edm::ParameterSet>("TH1ADCsHottestStrip");
85  layerswitchadchotteston = ParametersADCsHottestStrip.getParameter<bool>("layerswitchon");
86  moduleswitchadchotteston = ParametersADCsHottestStrip.getParameter<bool>("moduleswitchon");
87 
88  edm::ParameterSet ParametersADCsCoolestStrip = conf_.getParameter<edm::ParameterSet>("TH1ADCsCoolestStrip");
89  layerswitchadccooleston = ParametersADCsCoolestStrip.getParameter<bool>("layerswitchon");
90  moduleswitchadccooleston = ParametersADCsCoolestStrip.getParameter<bool>("moduleswitchon");
91 
92  edm::ParameterSet ParametersDigiADCs = conf_.getParameter<edm::ParameterSet>("TH1DigiADCs");
93  layerswitchdigiadcson = ParametersDigiADCs.getParameter<bool>("layerswitchon");
94  moduleswitchdigiadcson = ParametersDigiADCs.getParameter<bool>("moduleswitchon");
95 
96  edm::ParameterSet ParametersStripOccupancy = conf_.getParameter<edm::ParameterSet>("TH1StripOccupancy");
97  layerswitchstripoccupancyon = ParametersStripOccupancy.getParameter<bool>("layerswitchon");
98  moduleswitchstripoccupancyon = ParametersStripOccupancy.getParameter<bool>("moduleswitchon");
99 
100  edm::ParameterSet ParametersDigiProf = conf_.getParameter<edm::ParameterSet>("TProfNumberOfDigi");
101  layerswitchnumdigisprofon = ParametersDigiProf.getParameter<bool>("layerswitchon");
102 
103  edm::ParameterSet ParametersDigiADC = conf_.getParameter<edm::ParameterSet>("TProfDigiADC");
104  layerswitchdigiadcprofon = ParametersDigiProf.getParameter<bool>("layerswitchon");
105 
106  edm::ParameterSet ParametersTotDigiProf = conf_.getParameter<edm::ParameterSet>("TProfTotalNumberOfDigis");
107  subdetswitchtotdigiprofon = ParametersTotDigiProf.getParameter<bool>("subdetswitchon");
108 
109  // edm::ParameterSet ParametersTotDigisProfVsLS = conf_.getParameter<edm::ParameterSet>("TProfTotalNumberOfDigisVsLS");
110  // subdetswitchtotdigiproflson = ParametersTotDigisProfVsLS.getParameter<bool>("subdetswitchon");
111 
112  edm::ParameterSet ParametersTotDigiFailure = conf_.getParameter<edm::ParameterSet>("TotalNumberOfDigisFailure");
113  subdetswitchtotdigifailureon = ParametersTotDigiFailure.getParameter<bool>("subdetswitchon");
114 
115  edm::ParameterSet ParametersDigiApvProf = conf_.getParameter<edm::ParameterSet>("TProfDigiApvCycle");
116  subdetswitchapvcycleprofon = ParametersDigiApvProf.getParameter<bool>("subdetswitchon");
117 
118  edm::ParameterSet ParametersDigiApvTH2 = conf_.getParameter<edm::ParameterSet>("TH2DigiApvCycle");
119  subdetswitchapvcycleth2on = ParametersDigiApvTH2.getParameter<bool>("subdetswitchon");
120 
121  edm::ParameterSet ParametersNApvShots = conf_.getParameter<edm::ParameterSet>("TH1NApvShots");
122  subdetswitchnapvshotson = ParametersNApvShots.getParameter<bool>("subdetswitchon");
123 
124  edm::ParameterSet ParametersNStripApvShots = conf_.getParameter<edm::ParameterSet>("TH1NStripsApvShots");
125  subdetswitchnstripsapvshotson = ParametersNStripApvShots.getParameter<bool>("subdetswitchon");
126 
127  edm::ParameterSet ParametersChargeMedianApvShots = conf_.getParameter<edm::ParameterSet>("TH1ChargeMedianApvShots");
128  subdetswitchchargemedianapvshotson = ParametersChargeMedianApvShots.getParameter<bool>("subdetswitchon");
129 
130  edm::ParameterSet ParametersApvNumberApvShots = conf_.getParameter<edm::ParameterSet>("TH1ApvNumApvShots");
131  subdetswitchapvshotsApvon = ParametersChargeMedianApvShots.getParameter<bool>("subdetswitchon");
132 
133  edm::ParameterSet ParametersNApvShotsProf = conf_.getParameter<edm::ParameterSet>("TProfNShotsVsTime");
134  subdetswitchapvshotsonprof = ParametersNApvShotsProf.getParameter<bool>("subdetswitchon");
135 
136  //Global Histograms
137 
138  edm::ParameterSet ParametersGlobalNApvShots = conf_.getParameter<edm::ParameterSet>("TH1NApvShots");
139  globalswitchnapvshotson = ParametersGlobalNApvShots.getParameter<bool>("globalswitchon");
140 
141  edm::ParameterSet ParametersGlobalNApvShotsProf = conf_.getParameter<edm::ParameterSet>("TProfGlobalNShots");
142  globalsummaryapvshotson = ParametersGlobalNApvShotsProf.getParameter<bool>("globalswitchon");
143 
144  edm::ParameterSet ParametersGlobalNStripApvShots = conf_.getParameter<edm::ParameterSet>("TH1NStripsApvShots");
145  globalswitchnstripsapvshotson = ParametersGlobalNStripApvShots.getParameter<bool>("globalswitchon");
146 
147  edm::ParameterSet ParametersGlobalApvNumApvShots = conf_.getParameter<edm::ParameterSet>("TH1ApvNumApvShots");
148  globalswitchapvshotsApvon = ParametersGlobalApvNumApvShots.getParameter<bool>("globalswitchon");
149 
150  edm::ParameterSet ParametersGlobalChargeMedianApvShots = conf_.getParameter<edm::ParameterSet>("TH1ChargeMedianApvShots");
151  globalswitchchargemedianapvshotson = ParametersGlobalChargeMedianApvShots.getParameter<bool>("globalswitchon");
152 
153  edm::ParameterSet ParametersGlobalNApvShotsTimeProf = conf_.getParameter<edm::ParameterSet>("TProfNShotsVsTime");
154  globalswitchapvshotsonprof = ParametersGlobalNApvShotsTimeProf.getParameter<bool>("globalswitchon");
155 
156  //Digi and APV Shots Maps
157 
158  digitkhistomapon = conf_.getParameter<bool>("TkHistoMap_On");
159 
160  shotshistomapon = conf_.getParameter<bool>("TkHistoMapNApvShots_On");
161  shotsstripshistomapon = conf_.getParameter<bool>("TkHistoMapNStripApvShots_On");
162  shotschargehistomapon = conf_.getParameter<bool>("TkHistoMapMedianChargeApvShots_On");
163 
164  createTrendMEs = conf_.getParameter<bool>("CreateTrendMEs");
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  // if (digiFailureMEs.SubDetTotDigiProfLS) digiFailureMEs.SubDetTotDigiProfLS->Reset();
277  }
279  isStableBeams = false;
280  //integrate stats over several LS to prevent eventual low trigger rates
282  }
283 }
284 
285 //--------------------------------------------------------------------------------------------
287 
289  {
290  SBDeclaredAt = (int)lb.id().luminosityBlock();
291  SBTransitionDone = true;
292  }
293 
295 
296  int nFeds [6] = { 96 , 96 , 84 , 15 , 15 , 134 }; // tec- , tec+ , tib , tid- , tid+ , tob
297  int nFedsConnected [6] = { nFedTECm , nFedTECp , nFedTIB , nFedTIDm , nFedTIDp , nFedTOB };
298 
299  MonitorElement * me = dqmStore_->get(topFolderName_+"/MechanicalView/NumberOfDigisInLastLS");
300  if (me) {
301 
302  for (int ibin = 1; ibin<7;ibin++){
303 
304  float value = me->getBinContent(ibin);
305 
306  float fillvalue = 2;
307  if ( isStableBeams
308  // && (int)lb.id().luminosityBlock() > ignoreFirstNLumisections_ //ignore first X lumisections for HV rampup
310  && (float)nFedsConnected[ibin-1] / nFeds[ibin-1] > 0.5
311  && value < 50. ){
312 
313  fillvalue = 1.01;
314  }
315 
316  //account for integrated LS: fill previous bins as well
317  for ( int fillbin = (int)lb.id().luminosityBlock() - integrateNLumisections_ + 1 ; fillbin <= (int)lb.id().luminosityBlock() ; fillbin++ )
318  digiFailureMEs.SubDetDigiFailures2D -> Fill( fillbin , ibin-1 , fillvalue );
319  }
320  }
321  }
322 
323 }
324 //--------------------------------------------------------------------------------------------
326 }
327 
328 
329 //--------------------------------------------------------------------------------------------
331 
333 
334  //Retrieve tracker topology from geometry
335  edm::ESHandle<TrackerTopology> tTopoHandle;
336  es.get<IdealGeometryRecord>().get(tTopoHandle);
337  const TrackerTopology* const tTopo = tTopoHandle.product();
338 
339  // take from eventSetup the SiStripDetCabling object - here will use SiStripDetControl later on
341 
342  // get list of active detectors from SiStripDetCabling
343  std::vector<uint32_t> activeDets;
344  activeDets.clear(); // just in case
345  SiStripDetCabling_->addActiveDetectorsRawIds(activeDets);
346 
347  SiStripSubStructure substructure;
348 
349  // remove any eventual zero elements - there should be none, but just in case
350  for(std::vector<uint32_t>::iterator idets = activeDets.begin(); idets != activeDets.end(); idets++){
351  if(*idets == 0) activeDets.erase(idets);
352  }
353 
354  // create SiStripFolderOrganizer
356 
357  // Create TkHistoMap for Digi and APV shots properies
358 
359  if (digitkhistomapon) tkmapdigi = new TkHistoMap(ibooker , topFolderName_,"TkHMap_NumberOfDigi", 0.0,true);
360  if (shotshistomapon) tkmapNApvshots = new TkHistoMap(ibooker , topFolderName_,"TkHMap_NApvShots", 0.0,true);
361  if (shotsstripshistomapon) tkmapNstripApvshot = new TkHistoMap(ibooker , topFolderName_,"TkHMap_NStripApvShots", 0.0,true);
362  if (shotschargehistomapon) tkmapMedianChargeApvshots= new TkHistoMap(ibooker , topFolderName_,"TkHMap_MedianChargeApvShots",0.0,true);
363 
364  std::vector<uint32_t> tibDetIds;
365 
366  // loop over detectors and book MEs
367  edm::LogInfo("SiStripTkDQM|SiStripMonitorDigi")<<"nr. of activeDets: "<<activeDets.size();
368  for(std::vector<uint32_t>::const_iterator detid_iterator = activeDets.begin(); detid_iterator!=activeDets.end(); detid_iterator++){
369 
370  uint32_t detid = (*detid_iterator);
371 
372  ModMEs local_modmes;
373 
374  local_modmes.NumberOfDigis = 0;
375  local_modmes.NumberOfDigisPerStrip = 0;
376  local_modmes.ADCsHottestStrip = 0;
377  local_modmes.ADCsCoolestStrip = 0;
378  local_modmes.DigiADCs = 0;
379  local_modmes.StripOccupancy = 0;
380 
381  if (Mod_On_) {
382 
383  // set appropriate folder using SiStripFolderOrganizer
384  folder_organizer.setDetectorFolder(detid, tTopo); // pass the detid to this method
385  if (reset_each_run) ResetModuleMEs(detid);
386  createModuleMEs( ibooker , local_modmes, detid );
387 
388  // append to DigiMEs
389  DigiMEs.insert( std::make_pair(detid, local_modmes));
390  }
391 
392  // Create Layer Level MEs if they are not created already
393  std::pair<std::string,int32_t> det_layer_pair = folder_organizer.GetSubDetAndLayer(detid, tTopo);
394  SiStripHistoId hidmanager;
395  std::string label = hidmanager.getSubdetid(detid,tTopo,false);
396 
397  // get detids for the layer
398  std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(label);
399 
400  if(iLayerME==LayerMEsMap.end()) {
401  int32_t lnumber = det_layer_pair.second;
402  std::vector<uint32_t> layerDetIds;
403  if (det_layer_pair.first == "TIB") {
404  substructure.getTIBDetectors(activeDets,layerDetIds,lnumber,0,0,0);
405  } else if (det_layer_pair.first == "TOB") {
406  substructure.getTOBDetectors(activeDets,layerDetIds,lnumber,0,0);
407  } else if (det_layer_pair.first == "TID" && lnumber > 0) {
408  substructure.getTIDDetectors(activeDets,layerDetIds,2,abs(lnumber),0,0);
409  } else if (det_layer_pair.first == "TID" && lnumber < 0) {
410  substructure.getTIDDetectors(activeDets,layerDetIds,1,abs(lnumber),0,0);
411  } else if (det_layer_pair.first == "TEC" && lnumber > 0) {
412  substructure.getTECDetectors(activeDets,layerDetIds,2,abs(lnumber),0,0,0,0);
413  } else if (det_layer_pair.first == "TEC" && lnumber < 0) {
414  substructure.getTECDetectors(activeDets,layerDetIds,1,abs(lnumber),0,0,0,0);
415  }
416 
417  LayerDetMap[label] = layerDetIds;
418 
419  // book Layer plots
420  folder_organizer.setLayerFolder(detid,tTopo,det_layer_pair.second);
421  createLayerMEs( ibooker , label, layerDetIds.size() );
422  }
423 
424  // book sub-detector plots
425  std::pair<std::string,std::string> sdet_pair = folder_organizer.getSubDetFolderAndTag(detid, tTopo);
426  if (SubDetMEsMap.find(sdet_pair.second) == SubDetMEsMap.end()){
427  ibooker.setCurrentFolder(sdet_pair.first);
428  createSubDetMEs( ibooker , sdet_pair.second );
429  }
430 
431  }//end of loop over detectors
432 
433  //book some Summary histograms on APV shots in the MechanicalView
434 
435  ibooker.setCurrentFolder(topFolderName_+"/MechanicalView/");
436 
438  const char* HistoName = "Summary Mean Apv shots for SubDets";
439  NApvShotsGlobalProf= ibooker.bookProfile(HistoName, HistoName,
440  6,0.5,6.5,
441  100, 0., 0., "" );
448  NApvShotsGlobalProf->setAxisTitle(" mean APV shots # / evt",2);
449  }
450 
451  //cumulative number of APV shots Vs Time
454  const char* HistoName = "NApv_Shots_vs_Time";
455  ShotsVsTimeApvShotsGlobal=ibooker.bookProfile(HistoName,HistoName,
456  Parameters.getParameter<int32_t>("Nbins"),
457  Parameters.getParameter<double>("xmin"),
458  Parameters.getParameter<double>("xmax"),
459  200, //that parameter should not be there !?
460  Parameters.getParameter<double>("ymin"),
461  Parameters.getParameter<double>("ymax"),
462  "" );
464  ShotsVsTimeApvShotsGlobal->setAxisTitle("# Apv Shots",2);
466  }
467 
468  //cumulative number of Strips in APV shots
471  const char* HistoName = "Number_of_Strips_in_Apv_Shots";
472  StripMultiplicityApvShotsGlobal=ibooker.book1D(HistoName,HistoName,
473  Parameters.getParameter<int32_t>("Nbins"),
474  Parameters.getParameter<double>("xmin"),
475  Parameters.getParameter<double>("xmax"));
476  StripMultiplicityApvShotsGlobal->setAxisTitle("# strips in Apv Shots",1);
477  }
478 
479  //cumulative number of APV shots
482  const char* HistoName = "Number_of_Apv_Shots";
483  NApvShotsGlobal=ibooker.book1D(HistoName,HistoName,
484  Parameters.getParameter<int32_t>("Nbins"),
485  Parameters.getParameter<double>("xmin"),
486  Parameters.getParameter<double>("xmax"));
487  NApvShotsGlobal->setAxisTitle("# Apv Shots",1);
488  }
489 
490  //cumulative Median Charge in APV shots
492  edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TH1ChargeMedianApvShots");
493  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
494  const char* HistoName = "Apv_Shots_Charge_Median";
495  MedianChargeApvShotsGlobal=ibooker.book1D(HistoName,HistoName,
496  Parameters.getParameter<int32_t>("Nbins"),
497  Parameters.getParameter<double>("xmin"),
498  Parameters.getParameter<double>("xmax"));
499  MedianChargeApvShotsGlobal->setAxisTitle("Apv Shots Charge Median (ADC)",1);
500  }
501 
502  //cmulative APV number with shots
505  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
506  const char* HistoName = "Apv_Shots_Apv_Number";
507  NApvApvShotsGlobal=ibooker.book1D(HistoName,HistoName,
508  Parameters.getParameter<int32_t>("Nbins"),
509  Parameters.getParameter<double>("xmin"),
510  Parameters.getParameter<double>("xmax"));
511  NApvApvShotsGlobal->setAxisTitle("Apv Number",1);
512  }
513 
514  //
515  // Book new histogram to monitor digi in last LS
516  //
517 
520 
521  std::stringstream ss;
522 
523  folder_organizer.getLayerFolderName(ss, 0, tTopo);
524  ibooker.setCurrentFolder(ss.str().c_str());
525 
526  // if (subdetswitchtotdigiproflson) {
528  const char* HistoName = "NumberOfDigisInLastLS";
529  digiFailureMEs.SubDetTotDigiProfLS= ibooker.bookProfile(HistoName, HistoName,
530  6,0.5,6.5,
531  0., 0., "" );
538  }
539 
541  std::string HistoName = "DataPresentInLS";
542  edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TotalNumberOfDigisFailure");
543 
544  digiFailureMEs.SubDetDigiFailures2D = ibooker.book2D(HistoName,HistoName,
545  Parameters.getParameter<int32_t>("Nbins"), //bins X
546  1, //xmin
547  Parameters.getParameter<int32_t>("Nbins") + 1, //xmax
548  6, //bins Y
549  0, //ymin
550  6); //ymax
551 
558  digiFailureMEs.SubDetDigiFailures2D->setAxisTitle("Luminosity Section");
559  }
560  }//end of if
561 
562 }//end of method
563 
564 //--------------------------------------------------------------------------------------------
566 
567  // Filter out events if DCS Event if requested
568  if (dcsStatus_ && !dcsStatus_->getStatus(iEvent, iSetup)) return;
569 
570  //Retrieve tracker topology from geometry
571  edm::ESHandle<TrackerTopology> tTopoHandle;
572  iSetup.get<IdealGeometryRecord>().get(tTopoHandle);
573  const TrackerTopology* const tTopo = tTopoHandle.product();
574 
575  TotalNShots=0;
576 
577  runNb = iEvent.id().run();
578  eventNb++;
579 
580  float iOrbitSec = iEvent.orbitNumber()/NORBITS_PER_SECOND;
581 
582  digi_detset_handles.clear();
583 
584  std::vector<edm::EDGetTokenT<edm::DetSetVector<SiStripDigi> > >::const_iterator iToken = digiProducerTokenList.begin();
585  for(std::vector<edm::InputTag>::const_iterator iter = digiProducerList.begin(), iEnd = digiProducerList.end();
586  iter != iEnd; ++iter, ++iToken) {
588  iEvent.getByToken( *iToken, digi_handle );
589  if (digi_handle.isValid()) digi_detset_handles.push_back(digi_handle.product());
590  }
591 
592  // initialise # of clusters to zero
593  for (std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.begin();
594  iSubdet != SubDetMEsMap.end(); iSubdet++) {
595  iSubdet->second.totNDigis = 0;
596  iSubdet->second.SubDetApvShots.clear();
597  }
598 
599  for (std::map<std::string, std::vector< uint32_t > >::const_iterator iterLayer = LayerDetMap.begin();
600  iterLayer != LayerDetMap.end(); iterLayer++) {
601 
602  std::string layer_label = iterLayer->first;
603 
604  std::vector< uint32_t > layer_dets = iterLayer->second;
605  std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(layer_label);
606 
607  //get Layer MEs
608  LayerMEs local_layermes;
609 
610  if(iLayerME == LayerMEsMap.end()) continue;
611  else local_layermes = iLayerME->second;
612 
613  int largest_adc_layer= 0;
614  int smallest_adc_layer= 99999;
615 
616  int ndigi_layer = 0;
617 
618  uint16_t iDet = 0;
619 
620  std::string subdet_label = "";
621 
622  // loop over all modules in the layer
623  for (std::vector< uint32_t >::const_iterator iterDets = layer_dets.begin() ;
624  iterDets != layer_dets.end() ; iterDets++) {
625  iDet++;
626 
627  // detid and type of ME
628  uint32_t detid = (*iterDets);
629 
630  // Get SubDet label once
631  if (subdet_label.size() == 0) subdet_label = folder_organizer.getSubDetFolderAndTag(detid, tTopo).second;
632 
633  // DetId and corresponding set of MEs
634 
635  std::map<uint32_t, ModMEs >::iterator pos = DigiMEs.find(detid);
636  ModMEs local_modmes = pos->second;
637 
638  // search digis of detid
639  int loc = getDigiSourceIndex(detid);
640 
641  int ndigi_det = 0;
642 
643  if (loc > -1) {
644  ndigi_det = (*(digi_detset_handles[loc]))[detid].size();
645  APVShotFinder theShotFinder = APVShotFinder((*(digi_detset_handles[loc]))[detid]);
646  const std::vector<APVShot>& shots = theShotFinder.getShots();
647  AddApvShotsToSubDet(shots,SubDetMEsMap[subdet_label].SubDetApvShots);
648  if (shotshistomapon) tkmapNApvshots->fill(detid,shots.size());
651  }
652 
653  if(Mod_On_ && moduleswitchnumdigison && (local_modmes.NumberOfDigis != NULL))
654  (local_modmes.NumberOfDigis)->Fill(ndigi_det);
655 
657  local_layermes.LayerNumberOfDigisProfile->Fill(iDet*1.0,ndigi_det);
658 
659  if (digitkhistomapon) tkmapdigi->fill(detid,ndigi_det);
660 
661  if (ndigi_det == 0) continue; // no digis for this detid => jump to next step of loop
662 
663  const edm::DetSet<SiStripDigi> & digi_detset = (*(digi_detset_handles[loc]))[detid];
664 
665  ndigi_layer += ndigi_det;
666 
667  // ADCs
668  int largest_adc=(digi_detset.data.begin())->adc();
669  int smallest_adc=(digi_detset.data.begin())->adc();
670 
671 
672  // Check if these parameters are really needed
673  float det_occupancy = 0.0;
674 
675  for(edm::DetSet<SiStripDigi>::const_iterator digiIter = digi_detset.data.begin();
676  digiIter!= digi_detset.data.end(); digiIter++ ){
677 
678  int this_adc = digiIter->adc();
679 
680  if (this_adc > 0.0) det_occupancy++;
681 
682  if(this_adc>largest_adc) largest_adc = this_adc;
683  if(this_adc<smallest_adc) smallest_adc = this_adc;
684 
685  if(Mod_On_ && moduleswitchnumdigispstripon && (local_modmes.NumberOfDigisPerStrip != NULL) && (this_adc > 0.0) )
686  (local_modmes.NumberOfDigisPerStrip)->Fill(digiIter->strip());
687 
688  if(Mod_On_ && moduleswitchdigiadcson && (local_modmes.DigiADCs != NULL) )
689  (local_modmes.DigiADCs)->Fill(static_cast<float>(this_adc));
690 
691  //Fill #ADCs for this digi at layer level
693  fillME(local_layermes.LayerDigiADCs , this_adc);
694  if (createTrendMEs) fillTrend(local_layermes.LayerDigiADCsTrend, this_adc, iOrbitSec);
695  }
696 
698  local_layermes.LayerDigiADCProfile->Fill(iDet*1.0,this_adc);
699 
700  }//end of loop over digis in this det
701 
702  // Occupancy
703  short nstrips = SiStripDetCabling_->nApvPairs(detid) * 2 * 128;
704  if (nstrips > 0 && det_occupancy > 0 ) {
705  det_occupancy = det_occupancy/nstrips;
706  if (Mod_On_ && moduleswitchstripoccupancyon && (local_modmes.StripOccupancy != NULL))
707  (local_modmes.StripOccupancy)->Fill(det_occupancy);
709  fillME(local_layermes.LayerStripOccupancy, det_occupancy);
710  if (createTrendMEs) fillTrend(local_layermes.LayerStripOccupancyTrend, det_occupancy, iOrbitSec);
711  }
712  }
713 
714  if (largest_adc > largest_adc_layer) largest_adc_layer = largest_adc;
715  if (smallest_adc < smallest_adc_layer) smallest_adc_layer = smallest_adc;
716 
717  // nr. of adcs for hottest strip
718  if( Mod_On_ && moduleswitchadchotteston && (local_modmes.ADCsHottestStrip != NULL))
719  (local_modmes.ADCsHottestStrip)->Fill(static_cast<float>(largest_adc));
720 
721  // nr. of adcs for coolest strip
722  if(Mod_On_ && moduleswitchadccooleston && (local_modmes.ADCsCoolestStrip != NULL))
723  (local_modmes.ADCsCoolestStrip)->Fill(static_cast<float>(smallest_adc));
724 
725  }//end of loop over DetIds
726 
728  fillME(local_layermes.LayerNumberOfDigis,ndigi_layer);
729  if (createTrendMEs) fillTrend(local_layermes.LayerNumberOfDigisTrend, ndigi_layer, iOrbitSec);
730  }
732  fillME(local_layermes.LayerADCsHottestStrip,largest_adc_layer);
733  if (createTrendMEs) fillTrend(local_layermes.LayerADCsHottestStripTrend, largest_adc_layer, iOrbitSec);
734  }
736  fillME(local_layermes.LayerADCsCoolestStrip ,smallest_adc_layer);
737  if (createTrendMEs) fillTrend(local_layermes.LayerADCsCoolestStripTrend, smallest_adc_layer, iOrbitSec);
738  }
739 
740  std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.find(subdet_label);
741  if(iSubdet != SubDetMEsMap.end()) {
742  iSubdet->second.totNDigis += ndigi_layer;
743  //std::cout << " totDigis" << iSubdet->second.totNDigis << " in " << subdet_label << std::endl;
744  }
745  }
746 
748 
749  //check Stable beams bit
751  iEvent.getByToken( gtEvmToken_, gtEvm_handle );
752  L1GlobalTriggerEvmReadoutRecord const* gtevm = gtEvm_handle.product();
753 
754  L1GtfeExtWord gtfeEvmExtWord;
755  if (gtevm)
756  {
757  gtfeEvmExtWord = gtevm->gtfeWord();
758  }
759  else
760  edm::LogInfo("DQMProvInfo") << " gtfeEvmWord inaccessible" ;
761 
762  /* mia: is there not a smarter way !?!?!?!? */
763  if ( gtfeEvmExtWord.beamMode() == 11 )
764  isStableBeams = true;
765  }
766 
767  for (std::map<std::string, SubDetMEs>::iterator it = SubDetMEsMap.begin();
768  it != SubDetMEsMap.end(); it++) {
769 
770  // if (subdetswitchtotdigiproflson) {
772  if (strcmp(it->first.c_str(),"TEC__MINUS")==0){
773  digiFailureMEs.SubDetTotDigiProfLS->Fill(1, it->second.totNDigis);
774  }else if (strcmp(it->first.c_str(),"TEC__PLUS")==0){
775  digiFailureMEs.SubDetTotDigiProfLS->Fill(2, it->second.totNDigis);
776  }else if (strcmp(it->first.c_str(),"TIB")==0){
777  digiFailureMEs.SubDetTotDigiProfLS->Fill(3, it->second.totNDigis);
778  }else if (strcmp(it->first.c_str(),"TID__MINUS")==0){
779  digiFailureMEs.SubDetTotDigiProfLS->Fill(4, it->second.totNDigis);
780  }else if (strcmp(it->first.c_str(),"TID__PLUS")==0){
781  digiFailureMEs.SubDetTotDigiProfLS->Fill(5, it->second.totNDigis);
782  }else if (strcmp(it->first.c_str(),"TOB")==0){
783  digiFailureMEs.SubDetTotDigiProfLS->Fill(6, it->second.totNDigis);
784  }
785  }
786 
788  if (strcmp(it->first.c_str(),"TEC__MINUS")==0){
789  NApvShotsGlobalProf->Fill(1,it->second.SubDetApvShots.size());
790  }else if (strcmp(it->first.c_str(),"TEC__PLUS")==0){
791  NApvShotsGlobalProf->Fill(2,it->second.SubDetApvShots.size());
792  }else if (strcmp(it->first.c_str(),"TIB")==0){
793  NApvShotsGlobalProf->Fill(3,it->second.SubDetApvShots.size());
794  }else if (strcmp(it->first.c_str(),"TID__MINUS")==0){
795  NApvShotsGlobalProf->Fill(4,it->second.SubDetApvShots.size());
796  }else if (strcmp(it->first.c_str(),"TID__PLUS")==0){
797  NApvShotsGlobalProf->Fill(5,it->second.SubDetApvShots.size());
798  }else if (strcmp(it->first.c_str(),"TOB")==0){
799  NApvShotsGlobalProf->Fill(6,it->second.SubDetApvShots.size());
800  }
801  }
802 
803  SubDetMEs subdetmes= it->second;
804  std::string subdet = it->first;
805 
806  // Fill APV shots histograms for SubDet
807 
808  uint ShotsSize=subdetmes.SubDetApvShots.size();
809  TotalNShots+=ShotsSize; //Counter for total Shots in the SiStrip Tracker
810 
811  if (subdetswitchnapvshotson ) subdetmes.SubDetNApvShotsTH1->Fill(ShotsSize);// N shots
812  if (subdetswitchapvshotsonprof) subdetmes.SubDetNApvShotsProf ->Fill(iOrbitSec,ShotsSize); //N shots vs time
813 
814  for (uint i=0; i< ShotsSize; ++i){ // Strip multiplicity, charge median and APV number distributions for APV shots
815 
816  if (subdetswitchapvshotsApvon) subdetmes.SubDetNApvShotsNApvTH1->Fill((subdetmes.SubDetApvShots[i].apvNumber()+1));//APV are defined by 0 to 5 I want 1 to 6
817  if (globalswitchapvshotsApvon) NApvApvShotsGlobal->Fill((subdetmes.SubDetApvShots[i].apvNumber()+1));
818 
819  if (subdetswitchnstripsapvshotson) subdetmes.SubDetNStripsApvShotsTH1->Fill(subdetmes.SubDetApvShots[i].nStrips());
821 
824 
825  }
826 
827  if (subdetswitchtotdigiprofon)subdetmes.SubDetTotDigiProf->Fill(iOrbitSec,subdetmes.totNDigis);
828  }
829 
832 
833  // get EventHistory
834 
835  edm::Handle<EventWithHistory> event_history;
836  iEvent.getByToken(historyProducerToken_,event_history);
837 
838  // get Phase of APV
839  edm::Handle<APVCyclePhaseCollection> apv_phase_collection;
840  iEvent.getByToken(apvPhaseProducerToken_,apv_phase_collection);
841 
842  if (event_history.isValid()
843  && !event_history.failedToGet()
844  && apv_phase_collection.isValid()
845  && !apv_phase_collection.failedToGet()) {
846 
847 
848  long long tbx = event_history->absoluteBX();
849 
850 
851  for (std::map<std::string, SubDetMEs>::iterator it = SubDetMEsMap.begin();
852  it != SubDetMEsMap.end(); it++) {
853 
854  SubDetMEs subdetmes;
855  std::string subdet = it->first;
856  subdetmes = it->second;
857 
858  int the_phase = APVCyclePhaseCollection::invalid;
859  long long tbx_corr = tbx;
860 
861  if (SubDetPhasePartMap.find(subdet) != SubDetPhasePartMap.end()) the_phase = apv_phase_collection->getPhase(SubDetPhasePartMap[subdet]);
862  if(the_phase==APVCyclePhaseCollection::nopartition ||
864  the_phase==APVCyclePhaseCollection::invalid) the_phase=30;
865  tbx_corr -= the_phase;
866 
867  if (subdetswitchapvcycleprofon)subdetmes.SubDetDigiApvProf->Fill(tbx_corr%70,subdetmes.totNDigis);
868  if (subdetswitchapvcycleth2on) subdetmes.SubDetDigiApvTH2->Fill(tbx_corr%70,subdetmes.totNDigis);
869  }
870  }
871 }//end of method analyze
872 //--------------------------------------------------------------------------------------------
873 
875  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
877 
878  // save histograms in a file
879  if(outputMEsInRootFile) dqmStore_->save(outputFileName);
880 
881 }//end of method
882 //--------------------------------------------------------------------------------------------
884  std::map<uint32_t, ModMEs >::iterator pos = DigiMEs.find(idet);
885  ModMEs mod_me = pos->second;
886 
891  if(Mod_On_ && moduleswitchdigiadcson) mod_me.DigiADCs->Reset();
893 
894 }
895 //------------------------------------------------------------------------------------------
896 MonitorElement* SiStripMonitorDigi::bookMETrend(DQMStore::IBooker & ibooker , const char* ParameterSetLabel, const char* HistoName )
897 {
898  edm::ParameterSet ParametersTrend = conf_.getParameter<edm::ParameterSet>("Trending");
899  MonitorElement* me = ibooker.bookProfile(HistoName,HistoName,
900  ParametersTrend.getParameter<int32_t>("Nbins"),
901  // 0,
902  ParametersTrend.getParameter<double>("xmin"),
903  ParametersTrend.getParameter<double>("xmax"),
904  // ParametersTrend.getParameter<int32_t>("Nbins"),
905  100, //that parameter should not be there !?
906  ParametersTrend.getParameter<double>("ymin"),
907  ParametersTrend.getParameter<double>("ymax"),
908  "" );
909  if(!me) return me;
910 
911  me->setAxisTitle("Event Time in Seconds",1);
912  if (me->kind() == MonitorElement::DQM_KIND_TPROFILE) me->getTH1()->SetBit(TH1::kCanRebin);
913  return me;
914 }
915 
916 //------------------------------------------------------------------------------------------
917 MonitorElement* SiStripMonitorDigi::bookME1D(DQMStore::IBooker & ibooker , const char* ParameterSetLabel, const char* HistoName )
918 {
920  return ibooker.book1D(HistoName,HistoName,
921  Parameters.getParameter<int32_t>("Nbinx"),
922  Parameters.getParameter<double>("xmin"),
923  Parameters.getParameter<double>("xmax")
924  );
925 }
926 
927 //--------------------------------------------------------------------------------
928 void SiStripMonitorDigi::fillTrend(MonitorElement* me ,float value, float timeinorbit)
929 {
930  if(!me) return;
931  me->Fill(timeinorbit,value);
932 }
933 
934 //
935 // -- Create Module Level MEs
936 //
937 void SiStripMonitorDigi::createModuleMEs(DQMStore::IBooker & ibooker , ModMEs& mod_single, uint32_t detid ) {
938 
939  // use SistripHistoId for producing histogram id (and title)
940  SiStripHistoId hidmanager;
941  std::string hid;
942 
943  //nr. of digis per module
945  hid = hidmanager.createHistoId("NumberOfDigis","det",detid);
946  mod_single.NumberOfDigis = ibooker.book1D(hid, hid, 21, -0.5, 20.5);
947  ibooker.tag(mod_single.NumberOfDigis, detid);
948  mod_single.NumberOfDigis->setAxisTitle("number of digis in one detector module");
949  mod_single.NumberOfDigis->getTH1()->StatOverflows(kTRUE); // over/underflows in Mean calculation
950  }
951 
952  //nr. of digis per strip in module
954  hid = hidmanager.createHistoId("NumberOfDigisPerStrip","det",detid);
955  short nstrips = SiStripDetCabling_->nApvPairs(detid) * 2 * 128;
956  mod_single.NumberOfDigisPerStrip = ibooker.book1D(hid, hid, nstrips, -0.5, nstrips+0.5);
957  ibooker.tag(mod_single.NumberOfDigisPerStrip, detid);
958  mod_single.NumberOfDigisPerStrip->setAxisTitle("number of (digis > 0) per strip");
959  mod_single.NumberOfDigisPerStrip->getTH1()->StatOverflows(kTRUE); // over/underflows in Mean calculation
960  }
961  //#ADCs for hottest strip
963  hid = hidmanager.createHistoId("ADCsHottestStrip","det",detid);
964  mod_single.ADCsHottestStrip = bookME1D(ibooker , "TH1ADCsHottestStrip", hid.c_str() );
965  ibooker.tag(mod_single.ADCsHottestStrip, detid); // 6 APVs -> 768 strips
966  mod_single.ADCsHottestStrip->setAxisTitle("number of ADCs for hottest strip");
967  }
968 
969  //#ADCs for coolest strip
971  hid = hidmanager.createHistoId("ADCsCoolestStrip","det",detid);
972  mod_single.ADCsCoolestStrip = bookME1D(ibooker , "TH1ADCsCoolestStrip", hid.c_str() );
973  ibooker.tag(mod_single.ADCsCoolestStrip, detid);
974  mod_single.ADCsCoolestStrip->setAxisTitle("number of ADCs for coolest strip");
975  }
976 
977  //#ADCs for each digi
979  hid = hidmanager.createHistoId("DigiADCs","det",detid);
980  mod_single.DigiADCs = bookME1D( ibooker , "TH1DigiADCs", hid.c_str() );
981  ibooker.tag(mod_single.DigiADCs, detid);
982  mod_single.DigiADCs->setAxisTitle("number of ADCs for each digi");
983  }
984 
985  //Strip occupancy
987  hid = hidmanager.createHistoId("StripOccupancy","det",detid);
988  mod_single.StripOccupancy = bookME1D( ibooker , "TH1StripOccupancy", hid.c_str() );
989  ibooker.tag(mod_single.StripOccupancy, detid);
990  mod_single.StripOccupancy->setAxisTitle("strip occupancy");
991  }
992 
993 }
994 
995 //
996 // -- Create Module Level MEs
997 //
998 
1000 
1001  std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(label);
1002  if(iLayerME==LayerMEsMap.end()){
1003  SiStripHistoId hidmanager;
1004  LayerMEs layerMEs;
1005  layerMEs.LayerNumberOfDigis = 0;
1006  layerMEs.LayerNumberOfDigisTrend = 0;
1007  layerMEs.LayerADCsHottestStrip = 0;
1008  layerMEs.LayerADCsHottestStripTrend = 0;
1009  layerMEs.LayerADCsCoolestStrip = 0;
1010  layerMEs.LayerADCsCoolestStripTrend = 0;
1011  layerMEs.LayerDigiADCs = 0;
1012  layerMEs.LayerDigiADCsTrend = 0;
1013  layerMEs.LayerStripOccupancy = 0;
1014  layerMEs.LayerStripOccupancyTrend = 0;
1015  layerMEs.LayerNumberOfDigisProfile = 0;
1016  layerMEs.LayerDigiADCProfile = 0;
1017 
1018 
1019  //#Digis
1020  if(layerswitchnumdigison) {
1021  layerMEs.LayerNumberOfDigis=bookME1D( ibooker , "TH1NumberOfDigis", hidmanager.createHistoLayer("Summary_TotalNumberOfDigis","layer",label,"").c_str() );
1022  if (createTrendMEs) layerMEs.LayerNumberOfDigisTrend=bookMETrend( ibooker , "TH1NumberOfDigis", hidmanager.createHistoLayer("Trend_NumberOfDigis","layer",label,"").c_str() );
1023  }
1024 
1025  //#ADCs for hottest strip
1027  layerMEs.LayerADCsHottestStrip=bookME1D( ibooker , "TH1ADCsHottestStrip", hidmanager.createHistoLayer("Summary_ADCsHottestStrip","layer",label,"").c_str() );
1028  if (createTrendMEs) layerMEs.LayerADCsHottestStripTrend=bookMETrend( ibooker , "TH1ADCsHottestStrip", hidmanager.createHistoLayer("Trend_ADCsHottestStrip","layer",label,"").c_str() );
1029  }
1030 
1031  //#ADCs for coolest strip
1033  layerMEs.LayerADCsCoolestStrip=bookME1D(ibooker , "TH1ADCsCoolestStrip", hidmanager.createHistoLayer("Summary_ADCsCoolestStrip","layer",label,"").c_str() );
1034  if (createTrendMEs) layerMEs.LayerADCsCoolestStripTrend=bookMETrend( ibooker , "TH1ADCsCoolestStrip", hidmanager.createHistoLayer("Trend_ADCsCoolestStrip","layer",label,"").c_str() );
1035  }
1036 
1037  //#ADCs for each digi
1038  if(layerswitchdigiadcson) {
1039  layerMEs.LayerDigiADCs=bookME1D( ibooker , "TH1DigiADCs", hidmanager.createHistoLayer("Summary_DigiADCs","layer",label,"").c_str() );
1040  if (createTrendMEs) layerMEs.LayerDigiADCsTrend=bookMETrend( ibooker , "TH1DigiADCs", hidmanager.createHistoLayer("Trend_DigiADCs","layer",label,"").c_str() );
1041  }
1042 
1043  //Strip Occupancy
1045  layerMEs.LayerStripOccupancy=bookME1D( ibooker , "TH1StripOccupancy", hidmanager.createHistoLayer("Summary_StripOccupancy","layer",label,"").c_str() );
1046  if (createTrendMEs) layerMEs.LayerStripOccupancyTrend=bookMETrend( ibooker , "TH1StripOccupancy", hidmanager.createHistoLayer("Trend_StripOccupancy","layer",label,"").c_str() );
1047 
1048  }
1049  // # of Digis
1051  std::string hid = hidmanager.createHistoLayer("NumberOfDigiProfile","layer",label,"");
1052  layerMEs.LayerNumberOfDigisProfile = ibooker.bookProfile(hid, hid, ndets, 0.5, ndets+0.5,21, -0.5, 200.5);
1053  }
1054 
1055  // # of Digis
1057  std::string hid = hidmanager.createHistoLayer("DigiADCProfile","layer",label,"");
1058  layerMEs.LayerDigiADCProfile = ibooker.bookProfile(hid, hid, ndets, 0.5, ndets+0.5, 64, -0.5, 255.5);
1059  }
1060 
1061  LayerMEsMap[label]=layerMEs;
1062  }
1063 }
1064 //
1065 // -- Create SubDetector MEs
1066 //
1068 
1069  SubDetMEs subdetMEs;
1070  subdetMEs.totNDigis = 0;
1071  subdetMEs.SubDetTotDigiProf = 0;
1072  subdetMEs.SubDetDigiApvProf = 0;
1073  subdetMEs.SubDetDigiApvTH2 = 0;
1074 
1075  subdetMEs.SubDetApvShots.clear();
1076  subdetMEs.SubDetNApvShotsTH1 = 0;
1077  subdetMEs.SubDetChargeMedianApvShotsTH1 = 0;
1078  subdetMEs.SubDetNStripsApvShotsTH1 = 0;
1079  subdetMEs.SubDetNApvShotsProf = 0;
1080 
1082 
1083  // Total Number of Digi - Profile
1085  edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TProfTotalNumberOfDigis");
1086  HistoName = "TotalNumberOfDigiProfile__" + label;
1087  subdetMEs.SubDetTotDigiProf=ibooker.bookProfile(HistoName,HistoName,
1088  Parameters.getParameter<int32_t>("Nbins"),
1089  Parameters.getParameter<double>("xmin"),
1090  Parameters.getParameter<double>("xmax"),
1091  100, //that parameter should not be there !?
1092  Parameters.getParameter<double>("ymin"),
1093  Parameters.getParameter<double>("ymax"),
1094  "" );
1095  subdetMEs.SubDetTotDigiProf->setAxisTitle("Event Time in Seconds",1);
1096  if (subdetMEs.SubDetTotDigiProf->kind() == MonitorElement::DQM_KIND_TPROFILE) subdetMEs.SubDetTotDigiProf->getTH1()->SetBit(TH1::kCanRebin);
1097  }
1098 
1099  // Number of Digi vs Bx - Profile
1102  HistoName = "Digi_vs_ApvCycle__" + label;
1103  subdetMEs.SubDetDigiApvProf=ibooker.bookProfile(HistoName,HistoName,
1104  Parameters.getParameter<int32_t>("Nbins"),
1105  Parameters.getParameter<double>("xmin"),
1106  Parameters.getParameter<double>("xmax"),
1107  200, //that parameter should not be there !?
1108  Parameters.getParameter<double>("ymin"),
1109  Parameters.getParameter<double>("ymax"),
1110  "" );
1111  subdetMEs.SubDetDigiApvProf->setAxisTitle("ApvCycle (Corrected Absolute Bx % 70)",1);
1112  }
1113 
1114  // Number of Digi vs Bx - TH2
1117  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
1118  HistoName = "Digi_vs_ApvCycle_2D__" + label;
1119  // Adjusting the scale for 2D histogram
1120  double h2ymax = 9999.0;
1121  double yfact = Parameters.getParameter<double>("yfactor");
1122  if(label.find("TIB") != std::string::npos) h2ymax = (6984.*256.)*yfact;
1123  else if (label.find("TID") != std::string::npos) h2ymax = (2208.*256.)*yfact;
1124  else if (label.find("TOB") != std::string::npos) h2ymax = (12906.*256.)*yfact;
1125  else if (label.find("TEC") != std::string::npos) h2ymax = (7552.*2.*256.)*yfact;
1126  subdetMEs.SubDetDigiApvTH2=ibooker.book2D(HistoName,HistoName,
1127  Parameters.getParameter<int32_t>("Nbins"),
1128  Parameters.getParameter<double>("xmin"),
1129  Parameters.getParameter<double>("xmax"),
1130  Parameters.getParameter<int32_t>("Nbinsy"), //it was 100 that parameter should not be there !?
1131  Parameters.getParameter<double>("ymin"),
1132  h2ymax);
1133  subdetMEs.SubDetDigiApvTH2->setAxisTitle("absolute Bx mod(70)",1);
1134  }
1135 
1136  //Number of APV Shots
1139  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
1140  HistoName = "Number_of_Apv_Shots_" + label;
1141  subdetMEs.SubDetNApvShotsTH1=ibooker.book1D(HistoName,HistoName,
1142  Parameters.getParameter<int32_t>("Nbins"),
1143  Parameters.getParameter<double>("xmin"),
1144  Parameters.getParameter<double>("xmax"));
1145  subdetMEs.SubDetNApvShotsTH1->setAxisTitle("# Apv Shots",1);
1146  }
1147 
1148  //Strip multiplicity of APV Shots
1151  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
1152  HistoName = "Number_of_Strips_in_Apv_Shots_" + label;
1153  subdetMEs.SubDetNStripsApvShotsTH1=ibooker.book1D(HistoName,HistoName,
1154  Parameters.getParameter<int32_t>("Nbins"),
1155  Parameters.getParameter<double>("xmin"),
1156  Parameters.getParameter<double>("xmax"));
1157  subdetMEs.SubDetNStripsApvShotsTH1->setAxisTitle("# strips in Apv Shots",1);
1158  }
1159 
1160  //Charge median of APV Shots
1162  edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TH1ChargeMedianApvShots");
1163  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
1164  HistoName = "Apv_Shots_Charge_Median_" + label;
1165  subdetMEs.SubDetChargeMedianApvShotsTH1=ibooker.book1D(HistoName,HistoName,
1166  Parameters.getParameter<int32_t>("Nbins"),
1167  Parameters.getParameter<double>("xmin"),
1168  Parameters.getParameter<double>("xmax"));
1169  subdetMEs.SubDetChargeMedianApvShotsTH1->setAxisTitle("Apv Shots Charge Median (ADC)",1);
1170  }
1171 
1172 
1175  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
1176  HistoName = "Apv_Shots_Apv_Number_" + label;
1177  subdetMEs.SubDetNApvShotsNApvTH1=ibooker.book1D(HistoName,HistoName,
1178  Parameters.getParameter<int32_t>("Nbins"),
1179  Parameters.getParameter<double>("xmin"),
1180  Parameters.getParameter<double>("xmax"));
1181  subdetMEs.SubDetNApvShotsNApvTH1->setAxisTitle("Apv Number",1);
1182  }
1183 
1184 
1185 
1186 
1187 
1188  //APV Shots number Vs time
1191  HistoName = "NApv_Shots_vs_Time_" + label;
1192  subdetMEs.SubDetNApvShotsProf=ibooker.bookProfile(HistoName,HistoName,
1193  Parameters.getParameter<int32_t>("Nbins"),
1194  Parameters.getParameter<double>("xmin"),
1195  Parameters.getParameter<double>("xmax"),
1196  200, //that parameter should not be there !?
1197  Parameters.getParameter<double>("ymin"),
1198  Parameters.getParameter<double>("ymax"),
1199  "" );
1200  subdetMEs.SubDetNApvShotsProf->setAxisTitle("Time (s)",1);
1201  subdetMEs.SubDetNApvShotsProf->setAxisTitle("# Apv Shots",2);
1202  if (subdetMEs.SubDetNApvShotsProf->kind() == MonitorElement::DQM_KIND_TPROFILE) subdetMEs.SubDetNApvShotsProf->getTH1()->SetBit(TH1::kCanRebin);
1203  }
1204 
1205 
1206 
1207 
1208 
1209 
1210 
1211  SubDetMEsMap[label]=subdetMEs;
1212 }
1213 //
1214 // -- Get DetSet vector for a given Detector
1215 //
1217  int location = -1;
1218  for (unsigned int ival = 0; ival < digi_detset_handles.size(); ++ival){
1220  if(isearch != digi_detset_handles[ival]->end()) {
1221  location = ival;
1222  break;
1223  }
1224  }
1225  return location;
1226 }
1227 
1228 void SiStripMonitorDigi::AddApvShotsToSubDet(const std::vector<APVShot> & moduleShots, std::vector<APVShot> & subdetShots){
1229 
1230  for (uint i=0; i<moduleShots.size(); i++){
1231  subdetShots.push_back(moduleShots[i]);
1232  }
1233 }
1234 
1235 void SiStripMonitorDigi::FillApvShotsMap(TkHistoMap* the_map, const std::vector<APVShot> & shots, uint32_t id ,int mode){
1236 
1237  for (uint i=0; i<shots.size(); i++){
1238  if (mode==1) the_map->fill(id,shots[i].nStrips()); //mode == 1 fill with strip multiplicity
1239  if (mode==2) the_map->fill(id,shots[i].median()); // mode == 2 fill with charge median
1240  }
1241 }
1242 
1243 //define this as a plug-in
int adc(sample_type sample)
get the ADC sample (12 bits)
RunNumber_t run() const
Definition: EventID.h:42
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
int i
Definition: DBlmapReader.cc:9
std::map< std::string, LayerMEs > LayerMEsMap
void createMEs(DQMStore::IBooker &ibooker, const edm::EventSetup &es)
MonitorElement * LayerNumberOfDigisTrend
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:155
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
MonitorElement * LayerStripOccupancy
MonitorElement * LayerADCsHottestStrip
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)
void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c)
MonitorElement * NApvShotsGlobalProf
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:90
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void Fill(long long x)
std::vector< APVShot > SubDetApvShots
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
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
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
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:113
std::vector< const edm::DetSetVector< SiStripDigi > * > digi_detset_handles
void tag(MonitorElement *, unsigned int)
Definition: DQMStore.cc:286
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual void analyze(const edm::Event &, const edm::EventSetup &)
TH1 * getTH1(void) const
#define end
Definition: vmac.h:37
int orbitNumber() const
Definition: EventBase.h:63
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. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1696
MonitorElement * ADCsHottestStrip
bool isValid() const
Definition: HandleBase.h:76
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
bool failedToGet() const
Definition: HandleBase.h:80
int getDigiSourceIndex(uint32_t id)
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:274
std::map< std::string, std::vector< uint32_t > > LayerDetMap
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:131
std::string createHistoId(std::string description, std::string id_type, uint32_t component_id)
MonitorElement * SubDetChargeMedianApvShotsTH1
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
LuminosityBlockNumber_t luminosityBlock() const
T const * product() const
Definition: Handle.h:81
std::string topFolderName_
edm::ParameterSet conf_
std::pair< std::string, std::string > getSubDetFolderAndTag(const uint32_t &detid, const TrackerTopology *tTopo)
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
TkHistoMap * tkmapMedianChargeApvshots
edm::EDGetTokenT< APVCyclePhaseCollection > apvPhaseProducerToken_
double getBinContent(int binx) const
get content of bin (1-D)
edm::EventID id() const
Definition: EventBase.h:56
collection_type data
Definition: DetSet.h:78
TkHistoMap * tkmapNApvshots
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2490
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
virtual void endRun(const edm::Run &, const edm::EventSetup &)
MonitorElement * LayerADCsCoolestStrip
MonitorElement * bookMETrend(DQMStore::IBooker &ibooker, const char *ParameterSetLabel, const char *HistoName)
void AddApvShotsToSubDet(const std::vector< APVShot > &, std::vector< APVShot > &)
virtual void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
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
volatile std::atomic< bool > shutdown_flag false
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:37
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106
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
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:41
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:125