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 // $Id: SiStripMonitorDigi.cc,v 1.75 2013/01/03 19:14:38 wmtan Exp $
7 #include<fstream>
8 #include "TNamed.h"
28 
31 
32 #include "TMath.h"
34 
35 #include "iostream"
36 
42 
43 //--------------------------------------------------------------------------------------------
44 SiStripMonitorDigi::SiStripMonitorDigi(const edm::ParameterSet& iConfig) : dqmStore_(edm::Service<DQMStore>().operator->()), conf_(iConfig), show_mechanical_structure_view(true), show_readout_view(false), show_control_view(false), select_all_detectors(true), reset_each_run(false), folder_organizer(), m_cacheID_(0)
45 {
46  firstEvent = -1;
47  eventNb = 0;
48 
49  // Detector Partitions
50  SubDetPhasePartMap["TIB"] = "TI";
51  SubDetPhasePartMap["TID__side__1"] = "TI";
52  SubDetPhasePartMap["TID__side__2"] = "TI";
53  SubDetPhasePartMap["TOB"] = "TO";
54  SubDetPhasePartMap["TEC__side__1"] = "TM";
55  SubDetPhasePartMap["TEC__side__2"] = "TP";
56 
57  // get Digi Producer List
58  digiProducerList = conf_.getParameter<std::vector<edm::InputTag> >("DigiProducersList");
59 
60  //get on/off option for every cluster from cfi
61  edm::ParameterSet ParametersNumberOfDigis = conf_.getParameter<edm::ParameterSet>("TH1NumberOfDigis");
62  layerswitchnumdigison = ParametersNumberOfDigis.getParameter<bool>("layerswitchon");
63  moduleswitchnumdigison = ParametersNumberOfDigis.getParameter<bool>("moduleswitchon");
64 
65  edm::ParameterSet ParametersNumberOfDigisPerStrip = conf_.getParameter<edm::ParameterSet>("TH1NumberOfDigisPerStrip");
66  moduleswitchnumdigispstripon = ParametersNumberOfDigisPerStrip.getParameter<bool>("moduleswitchon");
67 
68  edm::ParameterSet ParametersADCsHottestStrip = conf_.getParameter<edm::ParameterSet>("TH1ADCsHottestStrip");
69  layerswitchadchotteston = ParametersADCsHottestStrip.getParameter<bool>("layerswitchon");
70  moduleswitchadchotteston = ParametersADCsHottestStrip.getParameter<bool>("moduleswitchon");
71 
72  edm::ParameterSet ParametersADCsCoolestStrip = conf_.getParameter<edm::ParameterSet>("TH1ADCsCoolestStrip");
73  layerswitchadccooleston = ParametersADCsCoolestStrip.getParameter<bool>("layerswitchon");
74  moduleswitchadccooleston = ParametersADCsCoolestStrip.getParameter<bool>("moduleswitchon");
75 
76  edm::ParameterSet ParametersDigiADCs = conf_.getParameter<edm::ParameterSet>("TH1DigiADCs");
77  layerswitchdigiadcson = ParametersDigiADCs.getParameter<bool>("layerswitchon");
78  moduleswitchdigiadcson = ParametersDigiADCs.getParameter<bool>("moduleswitchon");
79 
80  edm::ParameterSet ParametersStripOccupancy = conf_.getParameter<edm::ParameterSet>("TH1StripOccupancy");
81  layerswitchstripoccupancyon = ParametersStripOccupancy.getParameter<bool>("layerswitchon");
82  moduleswitchstripoccupancyon = ParametersStripOccupancy.getParameter<bool>("moduleswitchon");
83 
84  edm::ParameterSet ParametersDigiProf = conf_.getParameter<edm::ParameterSet>("TProfNumberOfDigi");
85  layerswitchnumdigisprofon = ParametersDigiProf.getParameter<bool>("layerswitchon");
86 
87  edm::ParameterSet ParametersDigiADC = conf_.getParameter<edm::ParameterSet>("TProfDigiADC");
88  layerswitchdigiadcprofon = ParametersDigiProf.getParameter<bool>("layerswitchon");
89 
90  edm::ParameterSet ParametersTotDigiProf = conf_.getParameter<edm::ParameterSet>("TProfTotalNumberOfDigis");
91  subdetswitchtotdigiprofon = ParametersTotDigiProf.getParameter<bool>("subdetswitchon");
92 
93  edm::ParameterSet ParametersTotDigisProfVsLS = conf_.getParameter<edm::ParameterSet>("TProfTotalNumberOfDigisVsLS");
94  subdetswitchtotdigiproflson = ParametersTotDigisProfVsLS.getParameter<bool>("subdetswitchon");
95 
96  edm::ParameterSet ParametersTotDigiFailure = conf_.getParameter<edm::ParameterSet>("TotalNumberOfDigisFailure");
97  subdetswitchtotdigifailureon = ParametersTotDigiFailure.getParameter<bool>("subdetswitchon");
98 
99  edm::ParameterSet ParametersDigiApvProf = conf_.getParameter<edm::ParameterSet>("TProfDigiApvCycle");
100  subdetswitchapvcycleprofon = ParametersDigiApvProf.getParameter<bool>("subdetswitchon");
101 
102  edm::ParameterSet ParametersDigiApvTH2 = conf_.getParameter<edm::ParameterSet>("TH2DigiApvCycle");
103  subdetswitchapvcycleth2on = ParametersDigiApvTH2.getParameter<bool>("subdetswitchon");
104 
105  edm::ParameterSet ParametersNApvShots = conf_.getParameter<edm::ParameterSet>("TH1NApvShots");
106  subdetswitchnapvshotson = ParametersNApvShots.getParameter<bool>("subdetswitchon");
107 
108  edm::ParameterSet ParametersNStripApvShots = conf_.getParameter<edm::ParameterSet>("TH1NStripsApvShots");
109  subdetswitchnstripsapvshotson = ParametersNStripApvShots.getParameter<bool>("subdetswitchon");
110 
111  edm::ParameterSet ParametersChargeMedianApvShots = conf_.getParameter<edm::ParameterSet>("TH1ChargeMedianApvShots");
112  subdetswitchchargemedianapvshotson = ParametersChargeMedianApvShots.getParameter<bool>("subdetswitchon");
113 
114  edm::ParameterSet ParametersApvNumberApvShots = conf_.getParameter<edm::ParameterSet>("TH1ApvNumApvShots");
115  subdetswitchapvshotsApvon = ParametersChargeMedianApvShots.getParameter<bool>("subdetswitchon");
116 
117  edm::ParameterSet ParametersNApvShotsProf = conf_.getParameter<edm::ParameterSet>("TProfNShotsVsTime");
118  subdetswitchapvshotsonprof = ParametersNApvShotsProf.getParameter<bool>("subdetswitchon");
119 
120  //Global Histograms
121 
122  edm::ParameterSet ParametersGlobalNApvShots = conf_.getParameter<edm::ParameterSet>("TH1NApvShots");
123  globalswitchnapvshotson = ParametersGlobalNApvShots.getParameter<bool>("globalswitchon");
124 
125  edm::ParameterSet ParametersGlobalNApvShotsProf = conf_.getParameter<edm::ParameterSet>("TProfGlobalNShots");
126  globalsummaryapvshotson = ParametersGlobalNApvShotsProf.getParameter<bool>("globalswitchon");
127 
128  edm::ParameterSet ParametersGlobalNStripApvShots = conf_.getParameter<edm::ParameterSet>("TH1NStripsApvShots");
129  globalswitchnstripsapvshotson = ParametersGlobalNStripApvShots.getParameter<bool>("globalswitchon");
130 
131  edm::ParameterSet ParametersGlobalApvNumApvShots = conf_.getParameter<edm::ParameterSet>("TH1ApvNumApvShots");
132  globalswitchapvshotsApvon = ParametersGlobalApvNumApvShots.getParameter<bool>("globalswitchon");
133 
134  edm::ParameterSet ParametersGlobalChargeMedianApvShots = conf_.getParameter<edm::ParameterSet>("TH1ChargeMedianApvShots");
135  globalswitchchargemedianapvshotson = ParametersGlobalChargeMedianApvShots.getParameter<bool>("globalswitchon");
136 
137  edm::ParameterSet ParametersGlobalNApvShotsTimeProf = conf_.getParameter<edm::ParameterSet>("TProfNShotsVsTime");
138  globalswitchapvshotsonprof = ParametersGlobalNApvShotsTimeProf.getParameter<bool>("globalswitchon");
139 
140  //Digi and APV Shots Maps
141 
142  digitkhistomapon = conf_.getParameter<bool>("TkHistoMap_On");
143 
144  shotshistomapon= conf_.getParameter<bool>("TkHistoMapNApvShots_On");
145  shotsstripshistomapon= conf_.getParameter<bool>("TkHistoMapNStripApvShots_On");
146  shotschargehistomapon= conf_.getParameter<bool>("TkHistoMapMedianChargeApvShots_On");
147 
148  createTrendMEs = conf_.getParameter<bool>("CreateTrendMEs");
149  Mod_On_ = conf_.getParameter<bool>("Mod_On");
150  xLumiProf = conf_.getParameter<int>("xLumiProf");
151  // Event History Producer
152  historyProducer_ = conf_.getParameter<edm::InputTag>("HistoryProducer");
153 
154  // Apv Phase Producer
155  apvPhaseProducer_ = conf_.getParameter<edm::InputTag>("ApvPhaseProducer");
156 
157  // Create DCS Status
158  bool checkDCS = conf_.getParameter<bool>("UseDCSFiltering");
159  if (checkDCS) dcsStatus_ = new SiStripDCSStatus();
160  else dcsStatus_ = 0;
161 
162  //initialize boolean for the data-presence check (needed for TotalNumberOfDigisFailure histogram)
163  isStableBeams = false;
164 }
165 //------------------------------------------------------------------------------------------
166 
168  if (dcsStatus_) delete dcsStatus_;
169 }
170 
171 //--------------------------------------------------------------------------------------------
173 
175  unsigned long long cacheID = es.get<SiStripDetCablingRcd>().cacheIdentifier();
176  if (m_cacheID_ != cacheID) {
177  m_cacheID_ = cacheID;
178  edm::LogInfo("SiStripMonitorDigi") <<"SiStripMonitorDigi::beginRun: "
179  << " Creating MEs for new Cabling ";
180  createMEs(es);
181  }
182  } else if (reset_each_run) {
183  edm::LogInfo("SiStripMonitorDigi") <<"SiStripMonitorDigi::beginRun: "
184  << " Resetting MEs ";
185  for (std::map<uint32_t, ModMEs >::const_iterator idet = DigiMEs.begin() ; idet!=DigiMEs.end() ; idet++) {
186  ResetModuleMEs(idet->first);
187  }
188  }
189 
191  //get FED cabling to know if SiStrip is in DAQ or no
192  unsigned long long cacheID = es.get<SiStripDetCablingRcd>().cacheIdentifier();
193  if (m_cacheID_ != cacheID) {
194  m_cacheID_ = cacheID;
195  }
197  es.get<SiStripDetCablingRcd>().get(detCabling_);
198 
199  nFEDConnected = 0;
200  const int siStripFedIdMin = FEDNumbering::MINSiStripFEDID;
201  const int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID;
202 
204  if( es.find( recordKey ) != 0) {
205 
206  edm::ESHandle<RunInfo> sumFED;
207  es.get<RunInfoRcd>().get(sumFED);
208 
209  if ( sumFED.isValid() ) {
210  std::vector<int> FedsInIds= sumFED->m_fed_in;
211  for(unsigned int it = 0; it < FedsInIds.size(); ++it) {
212  int fedID = FedsInIds[it];
213  if(fedID>=siStripFedIdMin && fedID<=siStripFedIdMax) ++nFEDConnected;
214  }
215  }
216  }
217  }
218 
219 }
220 
221 //--------------------------------------------------------------------------------------------
223 }
224 
225 //--------------------------------------------------------------------------------------------
229  }
231  isStableBeams = false;
232 }
233 
234 //--------------------------------------------------------------------------------------------
236 
238  MonitorElement * me = dqmStore_->get("SiStrip/MechanicalView/NumberOfDigisInLastLS");
239  if (me) {
240 
241  for (int ibin = 1; ibin<7;ibin++){
242 
243  float value = me->getBinContent(ibin);
244  if ( isStableBeams && nFEDConnected > 100 && value < 50. ){
245  digiFailureMEs.SubDetDigiFailures2D -> Fill(lb.id().luminosityBlock() , ibin-1 , 0.01);
246  }
247  else{
249  }
250  }
251  }
252  }
253 }
254 //--------------------------------------------------------------------------------------------
256 }
257 
258 
259 //--------------------------------------------------------------------------------------------
261 
263 
264  //Retrieve tracker topology from geometry
265  edm::ESHandle<TrackerTopology> tTopoHandle;
266  es.get<IdealGeometryRecord>().get(tTopoHandle);
267  const TrackerTopology* const tTopo = tTopoHandle.product();
268 
269  // take from eventSetup the SiStripDetCabling object - here will use SiStripDetControl later on
271 
272  // get list of active detectors from SiStripDetCabling
273  std::vector<uint32_t> activeDets;
274  activeDets.clear(); // just in case
275  SiStripDetCabling_->addActiveDetectorsRawIds(activeDets);
276 
277  SiStripSubStructure substructure;
278 
279  // remove any eventual zero elements - there should be none, but just in case
280  for(std::vector<uint32_t>::iterator idets = activeDets.begin(); idets != activeDets.end(); idets++){
281  if(*idets == 0) activeDets.erase(idets);
282  }
283 
284  // create SiStripFolderOrganizer
286 
287  // Create TkHistoMap for Digi and APV shots properies
288 
289  if (digitkhistomapon) tkmapdigi = new TkHistoMap("SiStrip/TkHisto","TkHMap_NumberOfDigi",0.0,1);
290  if (shotshistomapon) tkmapNApvshots = new TkHistoMap("SiStrip/TkHisto","TkHMap_NApvShots",0.0,1);
291  if (shotsstripshistomapon) tkmapNstripApvshot= new TkHistoMap("SiStrip/TkHisto","TkHMap_NStripApvShots",0.0,1);
292  if (shotschargehistomapon) tkmapMedianChargeApvshots= new TkHistoMap("SiStrip/TkHisto","TkHMap_MedianChargeApvShots",0.0,1);
293 
294  std::vector<uint32_t> tibDetIds;
295 
296  // loop over detectors and book MEs
297  edm::LogInfo("SiStripTkDQM|SiStripMonitorDigi")<<"nr. of activeDets: "<<activeDets.size();
298  for(std::vector<uint32_t>::const_iterator detid_iterator = activeDets.begin(); detid_iterator!=activeDets.end(); detid_iterator++){
299 
300  uint32_t detid = (*detid_iterator);
301 
302  ModMEs local_modmes;
303 
304  local_modmes.NumberOfDigis = 0;
305  local_modmes.NumberOfDigisPerStrip = 0;
306  local_modmes.ADCsHottestStrip = 0;
307  local_modmes.ADCsCoolestStrip = 0;
308  local_modmes.DigiADCs = 0;
309  local_modmes.StripOccupancy = 0;
310 
311  if (Mod_On_) {
312 
313  // set appropriate folder using SiStripFolderOrganizer
314  folder_organizer.setDetectorFolder(detid, tTopo); // pass the detid to this method
315  if (reset_each_run) ResetModuleMEs(detid);
316  createModuleMEs(local_modmes, detid);
317 
318  // append to DigiMEs
319  DigiMEs.insert( std::make_pair(detid, local_modmes));
320  }
321 
322  // Create Layer Level MEs if they are not created already
323  std::pair<std::string,int32_t> det_layer_pair = folder_organizer.GetSubDetAndLayer(detid, tTopo);
324  SiStripHistoId hidmanager;
325  std::string label = hidmanager.getSubdetid(detid,tTopo,false);
326 
327  // get detids for the layer
328  std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(label);
329 
330  if(iLayerME==LayerMEsMap.end()) {
331  int32_t lnumber = det_layer_pair.second;
332  std::vector<uint32_t> layerDetIds;
333  if (det_layer_pair.first == "TIB") {
334  substructure.getTIBDetectors(activeDets,layerDetIds,lnumber,0,0,0);
335  } else if (det_layer_pair.first == "TOB") {
336  substructure.getTOBDetectors(activeDets,layerDetIds,lnumber,0,0);
337  } else if (det_layer_pair.first == "TID" && lnumber > 0) {
338  substructure.getTIDDetectors(activeDets,layerDetIds,2,abs(lnumber),0,0);
339  } else if (det_layer_pair.first == "TID" && lnumber < 0) {
340  substructure.getTIDDetectors(activeDets,layerDetIds,1,abs(lnumber),0,0);
341  } else if (det_layer_pair.first == "TEC" && lnumber > 0) {
342  substructure.getTECDetectors(activeDets,layerDetIds,2,abs(lnumber),0,0,0,0);
343  } else if (det_layer_pair.first == "TEC" && lnumber < 0) {
344  substructure.getTECDetectors(activeDets,layerDetIds,1,abs(lnumber),0,0,0,0);
345  }
346 
347  LayerDetMap[label] = layerDetIds;
348 
349  // book Layer plots
350  folder_organizer.setLayerFolder(detid,tTopo,det_layer_pair.second);
351  createLayerMEs(label, layerDetIds.size());
352  }
353 
354  // book sub-detector plots
355  std::pair<std::string,std::string> sdet_pair = folder_organizer.getSubDetFolderAndTag(detid, tTopo);
356  if (SubDetMEsMap.find(sdet_pair.second) == SubDetMEsMap.end()){
357  dqmStore_->setCurrentFolder(sdet_pair.first);
358  createSubDetMEs(sdet_pair.second);
359  }
360 
361  }//end of loop over detectors
362 
363  //book some Summary histograms on APV shots in the MechanicalView
364 
365  dqmStore_->setCurrentFolder("SiStrip/MechanicalView/");
366 
368  const char* HistoName = "Summary Mean Apv shots for SubDets";
369  NApvShotsGlobalProf= dqmStore_->bookProfile(HistoName, HistoName,
370  6,0.5,6.5,
371  100, 0., 0., "" );
378  NApvShotsGlobalProf->setAxisTitle(" mean APV shots # / evt",2);
379  }
380 
381  //cumulative number of APV shots Vs Time
384  const char* HistoName = "NApv_Shots_vs_Time";
385  ShotsVsTimeApvShotsGlobal=dqmStore_->bookProfile(HistoName,HistoName,
386  Parameters.getParameter<int32_t>("Nbins"),
387  Parameters.getParameter<double>("xmin"),
388  Parameters.getParameter<double>("xmax"),
389  200, //that parameter should not be there !?
390  Parameters.getParameter<double>("ymin"),
391  Parameters.getParameter<double>("ymax"),
392  "" );
394  ShotsVsTimeApvShotsGlobal->setAxisTitle("# Apv Shots",2);
396  }
397 
398  //cumulative number of Strips in APV shots
401  const char* HistoName = "Number_of_Strips_in_Apv_Shots";
402  StripMultiplicityApvShotsGlobal=dqmStore_->book1D(HistoName,HistoName,
403  Parameters.getParameter<int32_t>("Nbins"),
404  Parameters.getParameter<double>("xmin"),
405  Parameters.getParameter<double>("xmax"));
406  StripMultiplicityApvShotsGlobal->setAxisTitle("# strips in Apv Shots",1);
407  }
408 
409  //cumulative number of APV shots
412  const char* HistoName = "Number_of_Apv_Shots";
413  NApvShotsGlobal=dqmStore_->book1D(HistoName,HistoName,
414  Parameters.getParameter<int32_t>("Nbins"),
415  Parameters.getParameter<double>("xmin"),
416  Parameters.getParameter<double>("xmax"));
417  NApvShotsGlobal->setAxisTitle("# Apv Shots",1);
418  }
419 
420  //cumulative Median Charge in APV shots
422  edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TH1ChargeMedianApvShots");
423  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
424  const char* HistoName = "Apv_Shots_Charge_Median";
425  MedianChargeApvShotsGlobal=dqmStore_->book1D(HistoName,HistoName,
426  Parameters.getParameter<int32_t>("Nbins"),
427  Parameters.getParameter<double>("xmin"),
428  Parameters.getParameter<double>("xmax"));
429  MedianChargeApvShotsGlobal->setAxisTitle("Apv Shots Charge Median (ADC)",1);
430  }
431 
432  //cmulative APV number with shots
435  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
436  const char* HistoName = "Apv_Shots_Apv_Number";
437  NApvApvShotsGlobal=dqmStore_->book1D(HistoName,HistoName,
438  Parameters.getParameter<int32_t>("Nbins"),
439  Parameters.getParameter<double>("xmin"),
440  Parameters.getParameter<double>("xmax"));
441  NApvApvShotsGlobal->setAxisTitle("Apv Number",1);
442  }
443 
444  //
445  // Book new histogram to monitor digi in last LS
446  //
447 
450 
451  std::stringstream ss;
452 
453  folder_organizer.getLayerFolderName(ss, 0, tTopo);
454  dqmStore_->setCurrentFolder(ss.str().c_str());
455 
457  const char* HistoName = "NumberOfDigisInLastLS";
459  6,0.5,6.5,
460  100, 0., 10000., "" );
467  }
468 
470  std::string HistoName = "DataPresentInLS";
471  edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TotalNumberOfDigisFailure");
472 
473  digiFailureMEs.SubDetDigiFailures2D = dqmStore_->book2D(HistoName,HistoName,
474  Parameters.getParameter<int32_t>("Nbins"), //bins X
475  1, //xmin
476  Parameters.getParameter<int32_t>("Nbins") + 1, //xmax
477  6, //bins Y
478  0, //ymin
479  6); //ymax
480 
487  digiFailureMEs.SubDetDigiFailures2D->setAxisTitle("Luminosity Section");
488  }
489  }//end of if
490 
491 }//end of method
492 
493 //--------------------------------------------------------------------------------------------
495 
496  // Filter out events if DCS Event if requested
497  if (dcsStatus_ && !dcsStatus_->getStatus(iEvent, iSetup)) return;
498 
499  //Retrieve tracker topology from geometry
500  edm::ESHandle<TrackerTopology> tTopoHandle;
501  iSetup.get<IdealGeometryRecord>().get(tTopoHandle);
502  const TrackerTopology* const tTopo = tTopoHandle.product();
503 
504  TotalNShots=0;
505 
506  runNb = iEvent.id().run();
507  eventNb++;
508 
509  float iOrbitSec = iEvent.orbitNumber()/11223.0;
510 
511  digi_detset_handles.clear();
512  for(std::vector<edm::InputTag>::iterator itDigiProducerList = digiProducerList.begin();
513  itDigiProducerList != digiProducerList.end(); ++itDigiProducerList ) {
514 
516 
517  iEvent.getByLabel((*itDigiProducerList),digi_handle);
518 
519  if (digi_handle.isValid()) digi_detset_handles.push_back(digi_handle.product());
520  }
521 
522  // initialise # of clusters to zero
523  for (std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.begin();
524  iSubdet != SubDetMEsMap.end(); iSubdet++) {
525  iSubdet->second.totNDigis = 0;
526  iSubdet->second.SubDetApvShots.clear();
527  }
528 
529  for (std::map<std::string, std::vector< uint32_t > >::const_iterator iterLayer = LayerDetMap.begin();
530  iterLayer != LayerDetMap.end(); iterLayer++) {
531 
532  std::string layer_label = iterLayer->first;
533 
534  std::vector< uint32_t > layer_dets = iterLayer->second;
535  std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(layer_label);
536 
537  //get Layer MEs
538  LayerMEs local_layermes;
539 
540  if(iLayerME == LayerMEsMap.end()) continue;
541  else local_layermes = iLayerME->second;
542 
543  int largest_adc_layer= 0;
544  int smallest_adc_layer= 99999;
545 
546  int ndigi_layer = 0;
547 
548  uint16_t iDet = 0;
549 
550  std::string subdet_label = "";
551 
552  // loop over all modules in the layer
553  for (std::vector< uint32_t >::const_iterator iterDets = layer_dets.begin() ;
554  iterDets != layer_dets.end() ; iterDets++) {
555  iDet++;
556 
557  // detid and type of ME
558  uint32_t detid = (*iterDets);
559 
560  // Get SubDet label once
561  if (subdet_label.size() == 0) subdet_label = folder_organizer.getSubDetFolderAndTag(detid, tTopo).second;
562 
563  // DetId and corresponding set of MEs
564 
565  std::map<uint32_t, ModMEs >::iterator pos = DigiMEs.find(detid);
566  ModMEs local_modmes = pos->second;
567 
568  // search digis of detid
569  int loc = getDigiSourceIndex(detid);
570 
571  int ndigi_det = 0;
572 
573  if (loc > -1) {
574  ndigi_det = (*(digi_detset_handles[loc]))[detid].size();
575  APVShotFinder theShotFinder = APVShotFinder((*(digi_detset_handles[loc]))[detid]);
576  const std::vector<APVShot>& shots = theShotFinder.getShots();
577  AddApvShotsToSubDet(shots,SubDetMEsMap[subdet_label].SubDetApvShots);
578  if (shotshistomapon) tkmapNApvshots->fill(detid,shots.size());
581  }
582 
583  if(Mod_On_ && moduleswitchnumdigison && (local_modmes.NumberOfDigis != NULL))
584  (local_modmes.NumberOfDigis)->Fill(ndigi_det);
585 
587  local_layermes.LayerNumberOfDigisProfile->Fill(iDet*1.0,ndigi_det);
588 
589  if (digitkhistomapon) tkmapdigi->fill(detid,ndigi_det);
590 
591  if (ndigi_det == 0) continue; // no digis for this detid => jump to next step of loop
592 
593  const edm::DetSet<SiStripDigi> & digi_detset = (*(digi_detset_handles[loc]))[detid];
594 
595  ndigi_layer += ndigi_det;
596 
597  // ADCs
598  int largest_adc=(digi_detset.data.begin())->adc();
599  int smallest_adc=(digi_detset.data.begin())->adc();
600 
601 
602  // Check if these parameters are really needed
603  float det_occupancy = 0.0;
604 
605  for(edm::DetSet<SiStripDigi>::const_iterator digiIter = digi_detset.data.begin();
606  digiIter!= digi_detset.data.end(); digiIter++ ){
607 
608  int this_adc = digiIter->adc();
609 
610  if (this_adc > 0.0) det_occupancy++;
611 
612  if(this_adc>largest_adc) largest_adc = this_adc;
613  if(this_adc<smallest_adc) smallest_adc = this_adc;
614 
615  if(Mod_On_ && moduleswitchnumdigispstripon && (local_modmes.NumberOfDigisPerStrip != NULL) && (this_adc > 0.0) )
616  (local_modmes.NumberOfDigisPerStrip)->Fill(digiIter->strip());
617 
618  if(Mod_On_ && moduleswitchdigiadcson && (local_modmes.DigiADCs != NULL) )
619  (local_modmes.DigiADCs)->Fill(static_cast<float>(this_adc));
620 
621  //Fill #ADCs for this digi at layer level
623  fillME(local_layermes.LayerDigiADCs , this_adc);
624  if (createTrendMEs) fillTrend(local_layermes.LayerDigiADCsTrend, this_adc, iOrbitSec);
625  }
626 
628  local_layermes.LayerDigiADCProfile->Fill(iDet*1.0,this_adc);
629 
630  }//end of loop over digis in this det
631 
632  // Occupancy
633  short nstrips = SiStripDetCabling_->nApvPairs(detid) * 2 * 128;
634  if (nstrips > 0 && det_occupancy > 0 ) {
635  det_occupancy = det_occupancy/nstrips;
636  if (Mod_On_ && moduleswitchstripoccupancyon && (local_modmes.StripOccupancy != NULL))
637  (local_modmes.StripOccupancy)->Fill(det_occupancy);
639  fillME(local_layermes.LayerStripOccupancy, det_occupancy);
640  if (createTrendMEs) fillTrend(local_layermes.LayerStripOccupancyTrend, det_occupancy, iOrbitSec);
641  }
642  }
643 
644  if (largest_adc > largest_adc_layer) largest_adc_layer = largest_adc;
645  if (smallest_adc < smallest_adc_layer) smallest_adc_layer = smallest_adc;
646 
647  // nr. of adcs for hottest strip
648  if( Mod_On_ && moduleswitchadchotteston && (local_modmes.ADCsHottestStrip != NULL))
649  (local_modmes.ADCsHottestStrip)->Fill(static_cast<float>(largest_adc));
650 
651  // nr. of adcs for coolest strip
652  if(Mod_On_ && moduleswitchadccooleston && (local_modmes.ADCsCoolestStrip != NULL))
653  (local_modmes.ADCsCoolestStrip)->Fill(static_cast<float>(smallest_adc));
654 
655  }//end of loop over DetIds
656 
658  fillME(local_layermes.LayerNumberOfDigis,ndigi_layer);
659  if (createTrendMEs) fillTrend(local_layermes.LayerNumberOfDigisTrend, ndigi_layer, iOrbitSec);
660  }
662  fillME(local_layermes.LayerADCsHottestStrip,largest_adc_layer);
663  if (createTrendMEs) fillTrend(local_layermes.LayerADCsHottestStripTrend, largest_adc_layer, iOrbitSec);
664  }
666  fillME(local_layermes.LayerADCsCoolestStrip ,smallest_adc_layer);
667  if (createTrendMEs) fillTrend(local_layermes.LayerADCsCoolestStripTrend, smallest_adc_layer, iOrbitSec);
668  }
669 
670  std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.find(subdet_label);
671  if(iSubdet != SubDetMEsMap.end()) {
672  iSubdet->second.totNDigis += ndigi_layer;
673  //std::cout << " totDigis" << iSubdet->second.totNDigis << " in " << subdet_label << std::endl;
674  }
675  }
676 
678 
679  //check Stable beams bit
681  iEvent.getByLabel("gtEvmDigis", gtEvm_handle);
682  L1GlobalTriggerEvmReadoutRecord const* gtevm = gtEvm_handle.product();
683 
684  L1GtfeExtWord gtfeEvmExtWord;
685  if (gtevm)
686  {
687  gtfeEvmExtWord = gtevm->gtfeWord();
688  }
689  else
690  edm::LogInfo("DQMProvInfo") << " gtfeEvmWord inaccessible" ;
691 
692  if ( gtfeEvmExtWord.beamMode() == 11 )
693  isStableBeams = true;
694  }
695 
696  for (std::map<std::string, SubDetMEs>::iterator it = SubDetMEsMap.begin();
697  it != SubDetMEsMap.end(); it++) {
698 
700  if (strcmp(it->first.c_str(),"TEC__side__1")==0){
701  digiFailureMEs.SubDetTotDigiProfLS->Fill(1, it->second.totNDigis);
702  }else if (strcmp(it->first.c_str(),"TEC__side__2")==0){
703  digiFailureMEs.SubDetTotDigiProfLS->Fill(2, it->second.totNDigis);
704  }else if (strcmp(it->first.c_str(),"TIB")==0){
705  digiFailureMEs.SubDetTotDigiProfLS->Fill(3, it->second.totNDigis);
706  }else if (strcmp(it->first.c_str(),"TID__side__1")==0){
707  digiFailureMEs.SubDetTotDigiProfLS->Fill(4, it->second.totNDigis);
708  }else if (strcmp(it->first.c_str(),"TID__side__2")==0){
709  digiFailureMEs.SubDetTotDigiProfLS->Fill(5, it->second.totNDigis);
710  }else if (strcmp(it->first.c_str(),"TOB")==0){
711  digiFailureMEs.SubDetTotDigiProfLS->Fill(6, it->second.totNDigis);
712  }
713  }
714 
716  if (strcmp(it->first.c_str(),"TEC__side__1")==0){
717  NApvShotsGlobalProf->Fill(1,it->second.SubDetApvShots.size());
718  }else if (strcmp(it->first.c_str(),"TEC__side__2")==0){
719  NApvShotsGlobalProf->Fill(2,it->second.SubDetApvShots.size());
720  }else if (strcmp(it->first.c_str(),"TIB")==0){
721  NApvShotsGlobalProf->Fill(3,it->second.SubDetApvShots.size());
722  }else if (strcmp(it->first.c_str(),"TID__side__1")==0){
723  NApvShotsGlobalProf->Fill(4,it->second.SubDetApvShots.size());
724  }else if (strcmp(it->first.c_str(),"TID__side__2")==0){
725  NApvShotsGlobalProf->Fill(5,it->second.SubDetApvShots.size());
726  }else if (strcmp(it->first.c_str(),"TOB")==0){
727  NApvShotsGlobalProf->Fill(6,it->second.SubDetApvShots.size());
728  }
729  }
730 
731  SubDetMEs subdetmes= it->second;
732  std::string subdet = it->first;
733 
734  // Fill APV shots histograms for SubDet
735 
736  uint ShotsSize=subdetmes.SubDetApvShots.size();
737  TotalNShots+=ShotsSize; //Counter for total Shots in the SiStrip Tracker
738 
739  if (subdetswitchnapvshotson ) subdetmes.SubDetNApvShotsTH1->Fill(ShotsSize);// N shots
740  if (subdetswitchapvshotsonprof) subdetmes.SubDetNApvShotsProf ->Fill(iOrbitSec,ShotsSize); //N shots vs time
741 
742  for (uint i=0; i< ShotsSize; ++i){ // Strip multiplicity, charge median and APV number distributions for APV shots
743 
744  if (subdetswitchapvshotsApvon) subdetmes.SubDetNApvShotsNApvTH1->Fill((subdetmes.SubDetApvShots[i].apvNumber()+1));//APV are defined by 0 to 5 I want 1 to 6
745  if (globalswitchapvshotsApvon) NApvApvShotsGlobal->Fill((subdetmes.SubDetApvShots[i].apvNumber()+1));
746 
747  if (subdetswitchnstripsapvshotson) subdetmes.SubDetNStripsApvShotsTH1->Fill(subdetmes.SubDetApvShots[i].nStrips());
749 
752 
753  }
754 
755  if (subdetswitchtotdigiprofon)subdetmes.SubDetTotDigiProf->Fill(iOrbitSec,subdetmes.totNDigis);
756  }
757 
760 
761  // get EventHistory
762 
763  edm::Handle<EventWithHistory> event_history;
764  iEvent.getByLabel(historyProducer_,event_history);
765 
766  // get Phase of APV
767  edm::Handle<APVCyclePhaseCollection> apv_phase_collection;
768  iEvent.getByLabel(apvPhaseProducer_,apv_phase_collection);
769 
770  if (event_history.isValid()
771  && !event_history.failedToGet()
772  && apv_phase_collection.isValid()
773  && !apv_phase_collection.failedToGet()) {
774 
775 
776  long long tbx = event_history->absoluteBX();
777 
778 
779  for (std::map<std::string, SubDetMEs>::iterator it = SubDetMEsMap.begin();
780  it != SubDetMEsMap.end(); it++) {
781 
782  SubDetMEs subdetmes;
783  std::string subdet = it->first;
784  subdetmes = it->second;
785 
786  int the_phase = APVCyclePhaseCollection::invalid;
787  long long tbx_corr = tbx;
788 
789  if (SubDetPhasePartMap.find(subdet) != SubDetPhasePartMap.end()) the_phase = apv_phase_collection->getPhase(SubDetPhasePartMap[subdet]);
790  if(the_phase==APVCyclePhaseCollection::nopartition ||
792  the_phase==APVCyclePhaseCollection::invalid) the_phase=30;
793  tbx_corr -= the_phase;
794 
795  if (subdetswitchapvcycleprofon)subdetmes.SubDetDigiApvProf->Fill(tbx_corr%70,subdetmes.totNDigis);
796  if (subdetswitchapvcycleth2on) subdetmes.SubDetDigiApvTH2->Fill(tbx_corr%70,subdetmes.totNDigis);
797  }
798  }
799 }//end of method analyze
800 //--------------------------------------------------------------------------------------------
801 
803  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
805 
806  // save histograms in a file
807  if(outputMEsInRootFile) dqmStore_->save(outputFileName);
808 
809 }//end of method
810 //--------------------------------------------------------------------------------------------
812  std::map<uint32_t, ModMEs >::iterator pos = DigiMEs.find(idet);
813  ModMEs mod_me = pos->second;
814 
819  if(Mod_On_ && moduleswitchdigiadcson) mod_me.DigiADCs->Reset();
821 
822 }
823 //------------------------------------------------------------------------------------------
824 MonitorElement* SiStripMonitorDigi::bookMETrend(const char* ParameterSetLabel, const char* HistoName)
825 {
826  edm::ParameterSet ParametersTrend = conf_.getParameter<edm::ParameterSet>("Trending");
827  MonitorElement* me = dqmStore_->bookProfile(HistoName,HistoName,
828  ParametersTrend.getParameter<int32_t>("Nbins"),
829  // 0,
830  ParametersTrend.getParameter<double>("xmin"),
831  ParametersTrend.getParameter<double>("xmax"),
832  // ParametersTrend.getParameter<int32_t>("Nbins"),
833  100, //that parameter should not be there !?
834  ParametersTrend.getParameter<double>("ymin"),
835  ParametersTrend.getParameter<double>("ymax"),
836  "" );
837  if(!me) return me;
838 
839  me->setAxisTitle("Event Time in Seconds",1);
840  if (me->kind() == MonitorElement::DQM_KIND_TPROFILE) me->getTH1()->SetBit(TH1::kCanRebin);
841  return me;
842 }
843 
844 //------------------------------------------------------------------------------------------
845 MonitorElement* SiStripMonitorDigi::bookME1D(const char* ParameterSetLabel, const char* HistoName)
846 {
848  return dqmStore_->book1D(HistoName,HistoName,
849  Parameters.getParameter<int32_t>("Nbinx"),
850  Parameters.getParameter<double>("xmin"),
851  Parameters.getParameter<double>("xmax")
852  );
853 }
854 
855 //--------------------------------------------------------------------------------
856 void SiStripMonitorDigi::fillTrend(MonitorElement* me ,float value, float timeinorbit)
857 {
858  if(!me) return;
859  me->Fill(timeinorbit,value);
860 }
861 
862 //
863 // -- Create Module Level MEs
864 //
865 void SiStripMonitorDigi::createModuleMEs(ModMEs& mod_single, uint32_t detid) {
866 
867  // use SistripHistoId for producing histogram id (and title)
868  SiStripHistoId hidmanager;
869  std::string hid;
870 
871  //nr. of digis per module
873  hid = hidmanager.createHistoId("NumberOfDigis","det",detid);
874  mod_single.NumberOfDigis = dqmStore_->book1D(hid, hid, 21, -0.5, 20.5);
875  dqmStore_->tag(mod_single.NumberOfDigis, detid);
876  mod_single.NumberOfDigis->setAxisTitle("number of digis in one detector module");
877  mod_single.NumberOfDigis->getTH1()->StatOverflows(kTRUE); // over/underflows in Mean calculation
878  }
879 
880  //nr. of digis per strip in module
882  hid = hidmanager.createHistoId("NumberOfDigisPerStrip","det",detid);
883  short nstrips = SiStripDetCabling_->nApvPairs(detid) * 2 * 128;
884  mod_single.NumberOfDigisPerStrip = dqmStore_->book1D(hid, hid, nstrips, -0.5, nstrips+0.5);
885  dqmStore_->tag(mod_single.NumberOfDigisPerStrip, detid);
886  mod_single.NumberOfDigisPerStrip->setAxisTitle("number of (digis > 0) per strip");
887  mod_single.NumberOfDigisPerStrip->getTH1()->StatOverflows(kTRUE); // over/underflows in Mean calculation
888  }
889  //#ADCs for hottest strip
891  hid = hidmanager.createHistoId("ADCsHottestStrip","det",detid);
892  mod_single.ADCsHottestStrip = bookME1D("TH1ADCsHottestStrip", hid.c_str());
893  dqmStore_->tag(mod_single.ADCsHottestStrip, detid); // 6 APVs -> 768 strips
894  mod_single.ADCsHottestStrip->setAxisTitle("number of ADCs for hottest strip");
895  }
896 
897  //#ADCs for coolest strip
899  hid = hidmanager.createHistoId("ADCsCoolestStrip","det",detid);
900  mod_single.ADCsCoolestStrip = bookME1D("TH1ADCsCoolestStrip", hid.c_str());
901  dqmStore_->tag(mod_single.ADCsCoolestStrip, detid);
902  mod_single.ADCsCoolestStrip->setAxisTitle("number of ADCs for coolest strip");
903  }
904 
905  //#ADCs for each digi
907  hid = hidmanager.createHistoId("DigiADCs","det",detid);
908  mod_single.DigiADCs = bookME1D("TH1DigiADCs", hid.c_str());
909  dqmStore_->tag(mod_single.DigiADCs, detid);
910  mod_single.DigiADCs->setAxisTitle("number of ADCs for each digi");
911  }
912 
913  //Strip occupancy
915  hid = hidmanager.createHistoId("StripOccupancy","det",detid);
916  mod_single.StripOccupancy = bookME1D("TH1StripOccupancy", hid.c_str());
917  dqmStore_->tag(mod_single.StripOccupancy, detid);
918  mod_single.StripOccupancy->setAxisTitle("strip occupancy");
919  }
920 
921 }
922 
923 //
924 // -- Create Module Level MEs
925 //
926 
928 
929  std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(label);
930  if(iLayerME==LayerMEsMap.end()){
931  SiStripHistoId hidmanager;
932  LayerMEs layerMEs;
933  layerMEs.LayerNumberOfDigis = 0;
934  layerMEs.LayerNumberOfDigisTrend = 0;
935  layerMEs.LayerADCsHottestStrip = 0;
936  layerMEs.LayerADCsHottestStripTrend = 0;
937  layerMEs.LayerADCsCoolestStrip = 0;
938  layerMEs.LayerADCsCoolestStripTrend = 0;
939  layerMEs.LayerDigiADCs = 0;
940  layerMEs.LayerDigiADCsTrend = 0;
941  layerMEs.LayerStripOccupancy = 0;
942  layerMEs.LayerStripOccupancyTrend = 0;
943  layerMEs.LayerNumberOfDigisProfile = 0;
944  layerMEs.LayerDigiADCProfile = 0;
945 
946 
947  //#Digis
949  layerMEs.LayerNumberOfDigis=bookME1D("TH1NumberOfDigis", hidmanager.createHistoLayer("Summary_TotalNumberOfDigis","layer",label,"").c_str());
950  if (createTrendMEs) layerMEs.LayerNumberOfDigisTrend=bookMETrend("TH1NumberOfDigis", hidmanager.createHistoLayer("Trend_NumberOfDigis","layer",label,"").c_str());
951  }
952 
953  //#ADCs for hottest strip
955  layerMEs.LayerADCsHottestStrip=bookME1D("TH1ADCsHottestStrip", hidmanager.createHistoLayer("Summary_ADCsHottestStrip","layer",label,"").c_str());
956  if (createTrendMEs) layerMEs.LayerADCsHottestStripTrend=bookMETrend("TH1ADCsHottestStrip", hidmanager.createHistoLayer("Trend_ADCsHottestStrip","layer",label,"").c_str());
957  }
958 
959  //#ADCs for coolest strip
961  layerMEs.LayerADCsCoolestStrip=bookME1D("TH1ADCsCoolestStrip", hidmanager.createHistoLayer("Summary_ADCsCoolestStrip","layer",label,"").c_str());
962  if (createTrendMEs) layerMEs.LayerADCsCoolestStripTrend=bookMETrend("TH1ADCsCoolestStrip", hidmanager.createHistoLayer("Trend_ADCsCoolestStrip","layer",label,"").c_str());
963  }
964 
965  //#ADCs for each digi
967  layerMEs.LayerDigiADCs=bookME1D("TH1DigiADCs", hidmanager.createHistoLayer("Summary_DigiADCs","layer",label,"").c_str());
968  if (createTrendMEs) layerMEs.LayerDigiADCsTrend=bookMETrend("TH1DigiADCs", hidmanager.createHistoLayer("Trend_DigiADCs","layer",label,"").c_str());
969  }
970 
971  //Strip Occupancy
973  layerMEs.LayerStripOccupancy=bookME1D("TH1StripOccupancy", hidmanager.createHistoLayer("Summary_StripOccupancy","layer",label,"").c_str());
974  if (createTrendMEs) layerMEs.LayerStripOccupancyTrend=bookMETrend("TH1StripOccupancy", hidmanager.createHistoLayer("Trend_StripOccupancy","layer",label,"").c_str());
975 
976  }
977  // # of Digis
979  std::string hid = hidmanager.createHistoLayer("NumberOfDigiProfile","layer",label,"");
980  layerMEs.LayerNumberOfDigisProfile = dqmStore_->bookProfile(hid, hid, ndets, 0.5, ndets+0.5,21, -0.5, 200.5);
981  }
982 
983  // # of Digis
985  std::string hid = hidmanager.createHistoLayer("DigiADCProfile","layer",label,"");
986  layerMEs.LayerDigiADCProfile = dqmStore_->bookProfile(hid, hid, ndets, 0.5, ndets+0.5, 64, -0.5, 255.5);
987  }
988 
989  LayerMEsMap[label]=layerMEs;
990  }
991 }
992 //
993 // -- Create SubDetector MEs
994 //
996 
997  SubDetMEs subdetMEs;
998  subdetMEs.totNDigis = 0;
999  subdetMEs.SubDetTotDigiProf = 0;
1000  subdetMEs.SubDetDigiApvProf = 0;
1001  subdetMEs.SubDetDigiApvTH2 = 0;
1002 
1003  subdetMEs.SubDetApvShots.clear();
1004  subdetMEs.SubDetNApvShotsTH1 = 0;
1005  subdetMEs.SubDetChargeMedianApvShotsTH1 = 0;
1006  subdetMEs.SubDetNStripsApvShotsTH1 = 0;
1007  subdetMEs.SubDetNApvShotsProf = 0;
1008 
1010 
1011  // Total Number of Digi - Profile
1013  edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TProfTotalNumberOfDigis");
1014  HistoName = "TotalNumberOfDigiProfile__" + label;
1015  subdetMEs.SubDetTotDigiProf=dqmStore_->bookProfile(HistoName,HistoName,
1016  Parameters.getParameter<int32_t>("Nbins"),
1017  Parameters.getParameter<double>("xmin"),
1018  Parameters.getParameter<double>("xmax"),
1019  100, //that parameter should not be there !?
1020  Parameters.getParameter<double>("ymin"),
1021  Parameters.getParameter<double>("ymax"),
1022  "" );
1023  subdetMEs.SubDetTotDigiProf->setAxisTitle("Event Time in Seconds",1);
1024  if (subdetMEs.SubDetTotDigiProf->kind() == MonitorElement::DQM_KIND_TPROFILE) subdetMEs.SubDetTotDigiProf->getTH1()->SetBit(TH1::kCanRebin);
1025  }
1026 
1027  // Number of Digi vs Bx - Profile
1030  HistoName = "Digi_vs_ApvCycle__" + label;
1031  subdetMEs.SubDetDigiApvProf=dqmStore_->bookProfile(HistoName,HistoName,
1032  Parameters.getParameter<int32_t>("Nbins"),
1033  Parameters.getParameter<double>("xmin"),
1034  Parameters.getParameter<double>("xmax"),
1035  200, //that parameter should not be there !?
1036  Parameters.getParameter<double>("ymin"),
1037  Parameters.getParameter<double>("ymax"),
1038  "" );
1039  subdetMEs.SubDetDigiApvProf->setAxisTitle("ApvCycle (Corrected Absolute Bx % 70)",1);
1040  }
1041 
1042  // Number of Digi vs Bx - TH2
1045  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
1046  HistoName = "Digi_vs_ApvCycle_2D__" + label;
1047  // Adjusting the scale for 2D histogram
1048  double h2ymax = 9999.0;
1049  double yfact = Parameters.getParameter<double>("yfactor");
1050  if(label.find("TIB") != std::string::npos) h2ymax = (6984.*256.)*yfact;
1051  else if (label.find("TID") != std::string::npos) h2ymax = (2208.*256.)*yfact;
1052  else if (label.find("TOB") != std::string::npos) h2ymax = (12906.*256.)*yfact;
1053  else if (label.find("TEC") != std::string::npos) h2ymax = (7552.*2.*256.)*yfact;
1054  subdetMEs.SubDetDigiApvTH2=dqmStore_->book2D(HistoName,HistoName,
1055  Parameters.getParameter<int32_t>("Nbins"),
1056  Parameters.getParameter<double>("xmin"),
1057  Parameters.getParameter<double>("xmax"),
1058  Parameters.getParameter<int32_t>("Nbinsy"), //it was 100 that parameter should not be there !?
1059  Parameters.getParameter<double>("ymin"),
1060  h2ymax);
1061  subdetMEs.SubDetDigiApvTH2->setAxisTitle("absolute Bx mod(70)",1);
1062  }
1063 
1064  //Number of APV Shots
1067  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
1068  HistoName = "Number_of_Apv_Shots_" + label;
1069  subdetMEs.SubDetNApvShotsTH1=dqmStore_->book1D(HistoName,HistoName,
1070  Parameters.getParameter<int32_t>("Nbins"),
1071  Parameters.getParameter<double>("xmin"),
1072  Parameters.getParameter<double>("xmax"));
1073  subdetMEs.SubDetNApvShotsTH1->setAxisTitle("# Apv Shots",1);
1074  }
1075 
1076  //Strip multiplicity of APV Shots
1079  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
1080  HistoName = "Number_of_Strips_in_Apv_Shots_" + label;
1081  subdetMEs.SubDetNStripsApvShotsTH1=dqmStore_->book1D(HistoName,HistoName,
1082  Parameters.getParameter<int32_t>("Nbins"),
1083  Parameters.getParameter<double>("xmin"),
1084  Parameters.getParameter<double>("xmax"));
1085  subdetMEs.SubDetNStripsApvShotsTH1->setAxisTitle("# strips in Apv Shots",1);
1086  }
1087 
1088  //Charge median of APV Shots
1090  edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TH1ChargeMedianApvShots");
1091  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
1092  HistoName = "Apv_Shots_Charge_Median_" + label;
1093  subdetMEs.SubDetChargeMedianApvShotsTH1=dqmStore_->book1D(HistoName,HistoName,
1094  Parameters.getParameter<int32_t>("Nbins"),
1095  Parameters.getParameter<double>("xmin"),
1096  Parameters.getParameter<double>("xmax"));
1097  subdetMEs.SubDetChargeMedianApvShotsTH1->setAxisTitle("Apv Shots Charge Median (ADC)",1);
1098  }
1099 
1100 
1103  //dqmStore_->setCurrentFolder("SiStrip/MechanicalView/"+label);
1104  HistoName = "Apv_Shots_Apv_Number_" + label;
1105  subdetMEs.SubDetNApvShotsNApvTH1=dqmStore_->book1D(HistoName,HistoName,
1106  Parameters.getParameter<int32_t>("Nbins"),
1107  Parameters.getParameter<double>("xmin"),
1108  Parameters.getParameter<double>("xmax"));
1109  subdetMEs.SubDetNApvShotsNApvTH1->setAxisTitle("Apv Number",1);
1110  }
1111 
1112 
1113 
1114 
1115 
1116  //APV Shots number Vs time
1119  HistoName = "NApv_Shots_vs_Time_" + label;
1120  subdetMEs.SubDetNApvShotsProf=dqmStore_->bookProfile(HistoName,HistoName,
1121  Parameters.getParameter<int32_t>("Nbins"),
1122  Parameters.getParameter<double>("xmin"),
1123  Parameters.getParameter<double>("xmax"),
1124  200, //that parameter should not be there !?
1125  Parameters.getParameter<double>("ymin"),
1126  Parameters.getParameter<double>("ymax"),
1127  "" );
1128  subdetMEs.SubDetNApvShotsProf->setAxisTitle("Time (s)",1);
1129  subdetMEs.SubDetNApvShotsProf->setAxisTitle("# Apv Shots",2);
1130  if (subdetMEs.SubDetNApvShotsProf->kind() == MonitorElement::DQM_KIND_TPROFILE) subdetMEs.SubDetNApvShotsProf->getTH1()->SetBit(TH1::kCanRebin);
1131  }
1132 
1133 
1134 
1135 
1136 
1137 
1138 
1139  SubDetMEsMap[label]=subdetMEs;
1140 }
1141 //
1142 // -- Get DetSet vector for a given Detector
1143 //
1145  int location = -1;
1146  for (unsigned int ival = 0; ival < digi_detset_handles.size(); ++ival){
1148  if(isearch != digi_detset_handles[ival]->end()) {
1149  location = ival;
1150  break;
1151  }
1152  }
1153  return location;
1154 }
1155 
1156 void SiStripMonitorDigi::AddApvShotsToSubDet(const std::vector<APVShot> & moduleShots, std::vector<APVShot> & subdetShots){
1157 
1158  for (uint i=0; i<moduleShots.size(); i++){
1159  subdetShots.push_back(moduleShots[i]);
1160  }
1161 }
1162 
1163 void SiStripMonitorDigi::FillApvShotsMap(TkHistoMap* the_map, const std::vector<APVShot> & shots, uint32_t id ,int mode){
1164 
1165  for (uint i=0; i<shots.size(); i++){
1166  if (mode==1) the_map->fill(id,shots[i].nStrips()); //mode == 1 fill with strip multiplicity
1167  if (mode==2) the_map->fill(id,shots[i].median()); // mode == 2 fill with charge median
1168  }
1169 }
1170 
1171 //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
LuminosityBlockID id() const
void ResetModuleMEs(uint32_t idet)
void createSubDetMEs(std::string label)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::map< std::string, LayerMEs > LayerMEsMap
MonitorElement * LayerNumberOfDigisTrend
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
MonitorElement * LayerStripOccupancy
MonitorElement * LayerADCsHottestStrip
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2118
edm::InputTag historyProducer_
void createModuleMEs(ModMEs &mod_single, uint32_t detid)
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)
#define abs(x)
Definition: mlp_lapack.h:159
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
dictionary map
Definition: Association.py:205
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
Definition: EventSetup.cc:90
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)
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1359
unsigned long long m_cacheID_
MonitorElement * SubDetNApvShotsNApvTH1
bool getStatus(edm::Event const &e, edm::EventSetup const &eSetup)
MonitorElement * NumberOfDigisPerStrip
const std::vector< APVShot > & getShots() const
int iEvent
Definition: GenABIO.cc:243
MonitorElement * ADCsCoolestStrip
vector< ParameterSet > Parameters
SiStripDCSStatus * dcsStatus_
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 * bookMETrend(const char *ParameterSetLabel, const char *HistoName)
MonitorElement * LayerADCsCoolestStripTrend
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * SubDetNStripsApvShotsTH1
DigiFailureMEs digiFailureMEs
void fill(uint32_t &detid, float value)
Definition: TkHistoMap.cc:130
void fillME(MonitorElement *ME, float value1)
MonitorElement * NApvApvShotsGlobal
std::vector< const edm::DetSetVector< SiStripDigi > * > digi_detset_handles
void createLayerMEs(std::string label, int ndet)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
TH1 * getTH1(void) const
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1036
#define end
Definition: vmac.h:38
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:1473
MonitorElement * ADCsHottestStrip
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
void fillTrend(MonitorElement *me, float value, float timeinorbit)
MonitorElement * NApvShotsGlobal
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)
std::map< std::string, std::vector< uint32_t > > LayerDetMap
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:74
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
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:79
TkHistoMap * tkmapNApvshots
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
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
void createMEs(const edm::EventSetup &es)
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:34
bool isValid() const
Definition: ESHandle.h:37
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:850
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 setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
Definition: Run.h:36
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:129
MonitorElement * bookME1D(const char *ParameterSetLabel, const char *HistoName)