CMS 3D CMS Logo

SiStripMonitorCluster.cc
Go to the documentation of this file.
1 
2 // -*- C++ -*-
3 // Package: SiStripMonitorCluster
4 // Class: SiStripMonitorCluster
8 // Original Author: Dorian Kcira
9 // Created: Wed Feb 1 16:42:34 CET 2006
10 #include <cmath>
11 #include <fstream>
12 #include <numeric>
13 #include <vector>
16 #include "TNamed.h"
17 
35 
38 
41 
42 #include <iostream>
43 #include "TMath.h"
44 
45 //--------------------------------------------------------------------------------------------
47  : conf_(iConfig),
48  show_mechanical_structure_view(true),
49  show_readout_view(false),
50  show_control_view(false),
51  select_all_detectors(false),
52  reset_each_run(false),
53  m_cacheID_(0)
54 // , genTriggerEventFlag_(new GenericTriggerEventFlag(iConfig,
55 // consumesCollector()))
56 {
57  // initialize
58  passBPTXfilter_ = true;
59 
60  // initialize GenericTriggerEventFlag by specific configuration
61  // in this way, one can set specific selections for different MEs
63  iConfig.getParameter<edm::ParameterSet>("BPTXfilter"),
64  consumesCollector(), *this);
66  iConfig.getParameter<edm::ParameterSet>("PixelDCSfilter"),
67  consumesCollector(), *this);
69  iConfig.getParameter<edm::ParameterSet>("StripDCSfilter"),
70  consumesCollector(), *this);
71 
72  firstEvent = -1;
73  eventNb = 0;
74 
75  // Detector Partitions
76  SubDetPhasePartMap["TIB"] = "TI";
77  SubDetPhasePartMap["TID__MINUS"] = "TI";
78  SubDetPhasePartMap["TID__PLUS"] = "TI";
79  SubDetPhasePartMap["TOB"] = "TO";
80  SubDetPhasePartMap["TEC__MINUS"] = "TM";
81  SubDetPhasePartMap["TEC__PLUS"] = "TP";
82 
83  // get on/off option for every cluster from cfi
84  edm::ParameterSet ParametersnClusters =
85  conf_.getParameter<edm::ParameterSet>("TH1nClusters");
86  layerswitchncluson = ParametersnClusters.getParameter<bool>("layerswitchon");
88  ParametersnClusters.getParameter<bool>("moduleswitchon");
89 
90  edm::ParameterSet ParametersClusterCharge =
91  conf_.getParameter<edm::ParameterSet>("TH1ClusterCharge");
93  ParametersClusterCharge.getParameter<bool>("layerswitchon");
95  ParametersClusterCharge.getParameter<bool>("moduleswitchon");
97  ParametersClusterCharge.getParameter<bool>("subdetswitchon");
98 
99  edm::ParameterSet ParametersClusterStoN =
100  conf_.getParameter<edm::ParameterSet>("TH1ClusterStoN");
102  ParametersClusterStoN.getParameter<bool>("layerswitchon");
104  ParametersClusterStoN.getParameter<bool>("moduleswitchon");
105 
106  edm::ParameterSet ParametersClusterStoNVsPos =
107  conf_.getParameter<edm::ParameterSet>("TH1ClusterStoNVsPos");
109  ParametersClusterStoNVsPos.getParameter<bool>("layerswitchon");
111  ParametersClusterStoNVsPos.getParameter<bool>("moduleswitchon");
112 
113  edm::ParameterSet ParametersClusterPos =
114  conf_.getParameter<edm::ParameterSet>("TH1ClusterPos");
116  ParametersClusterPos.getParameter<bool>("layerswitchon");
118  ParametersClusterPos.getParameter<bool>("moduleswitchon");
119 
120  edm::ParameterSet ParametersClusterDigiPos =
121  conf_.getParameter<edm::ParameterSet>("TH1ClusterDigiPos");
123  ParametersClusterDigiPos.getParameter<bool>("layerswitchon");
125  ParametersClusterDigiPos.getParameter<bool>("moduleswitchon");
126 
127  edm::ParameterSet ParametersClusterNoise =
128  conf_.getParameter<edm::ParameterSet>("TH1ClusterNoise");
130  ParametersClusterNoise.getParameter<bool>("layerswitchon");
132  ParametersClusterNoise.getParameter<bool>("moduleswitchon");
133 
134  edm::ParameterSet ParametersClusterWidth =
135  conf_.getParameter<edm::ParameterSet>("TH1ClusterWidth");
137  ParametersClusterWidth.getParameter<bool>("layerswitchon");
139  ParametersClusterWidth.getParameter<bool>("moduleswitchon");
141  ParametersClusterWidth.getParameter<bool>("subdetswitchon");
142 
143  edm::ParameterSet ParametersModuleLocalOccupancy =
144  conf_.getParameter<edm::ParameterSet>("TH1ModuleLocalOccupancy");
146  ParametersModuleLocalOccupancy.getParameter<bool>("layerswitchon");
148  ParametersModuleLocalOccupancy.getParameter<bool>("moduleswitchon");
149 
150  edm::ParameterSet ParametersNrOfClusterizedStrips =
151  conf_.getParameter<edm::ParameterSet>("TH1NrOfClusterizedStrips");
153  ParametersNrOfClusterizedStrips.getParameter<bool>("layerswitchon");
155  ParametersNrOfClusterizedStrips.getParameter<bool>("moduleswitchon");
156 
157  edm::ParameterSet ParametersClusterProf =
158  conf_.getParameter<edm::ParameterSet>("TProfNumberOfCluster");
160  ParametersClusterProf.getParameter<bool>("layerswitchon");
161 
162  edm::ParameterSet ParametersClusterWidthProf =
163  conf_.getParameter<edm::ParameterSet>("TProfClusterWidth");
165  ParametersClusterWidthProf.getParameter<bool>("layerswitchon");
166 
167  edm::ParameterSet ParametersTotClusterProf =
168  conf_.getParameter<edm::ParameterSet>("TProfTotalNumberOfClusters");
170  ParametersTotClusterProf.getParameter<bool>("subdetswitchon");
171 
172  edm::ParameterSet ParametersTotClusterTH1 =
173  conf_.getParameter<edm::ParameterSet>("TH1TotalNumberOfClusters");
175  ParametersTotClusterTH1.getParameter<bool>("subdetswitchon");
176 
177  edm::ParameterSet ParametersClusterApvProf =
178  conf_.getParameter<edm::ParameterSet>("TProfClustersApvCycle");
180  ParametersClusterApvProf.getParameter<bool>("subdetswitchon");
181 
182  edm::ParameterSet ParametersClustersApvTH2 =
183  conf_.getParameter<edm::ParameterSet>("TH2ClustersApvCycle");
185  ParametersClustersApvTH2.getParameter<bool>("subdetswitchon");
186 
187  edm::ParameterSet ParametersApvCycleDBxProf2 =
188  conf_.getParameter<edm::ParameterSet>("TProf2ApvCycleVsDBx");
190  ParametersApvCycleDBxProf2.getParameter<bool>("subdetswitchon");
191 
192  edm::ParameterSet ParametersDBxCycleProf =
193  conf_.getParameter<edm::ParameterSet>("TProfClustersVsDBxCycle");
195  ParametersDBxCycleProf.getParameter<bool>("subdetswitchon");
196 
197  edm::ParameterSet ParametersCStripVsCPix =
198  conf_.getParameter<edm::ParameterSet>("TH2CStripVsCpixel");
200  ParametersCStripVsCPix.getParameter<bool>("globalswitchon");
201 
202  edm::ParameterSet ParametersMultiplicityRegionsTH1 =
203  conf_.getParameter<edm::ParameterSet>("TH1MultiplicityRegions");
205  ParametersMultiplicityRegionsTH1.getParameter<bool>("globalswitchon");
206 
207  edm::ParameterSet ParametersApvCycleVsDBxGlobalTH2 =
208  conf_.getParameter<edm::ParameterSet>("TH2ApvCycleVsDBxGlobal");
210  ParametersApvCycleVsDBxGlobalTH2.getParameter<bool>("globalswitchon");
211 
212  edm::ParameterSet ParametersNoiseStrip2ApvCycle =
213  conf_.getParameter<edm::ParameterSet>("TH1StripNoise2ApvCycle");
215  ParametersNoiseStrip2ApvCycle.getParameter<bool>("globalswitchon");
216 
217  edm::ParameterSet ParametersNoiseStrip3ApvCycle =
218  conf_.getParameter<edm::ParameterSet>("TH1StripNoise3ApvCycle");
220  ParametersNoiseStrip3ApvCycle.getParameter<bool>("globalswitchon");
221 
222  edm::ParameterSet ParametersMainDiagonalPosition =
223  conf_.getParameter<edm::ParameterSet>("TH1MainDiagonalPosition");
225  ParametersMainDiagonalPosition.getParameter<bool>("globalswitchon");
226 
227  edm::ParameterSet ClusterMultiplicityRegions =
228  conf_.getParameter<edm::ParameterSet>("MultiplicityRegions");
229  k0 = ClusterMultiplicityRegions.getParameter<double>("k0");
230  q0 = ClusterMultiplicityRegions.getParameter<double>("q0");
231  dk0 = ClusterMultiplicityRegions.getParameter<double>("dk0");
232  maxClus = ClusterMultiplicityRegions.getParameter<double>("MaxClus");
233  minPix = ClusterMultiplicityRegions.getParameter<double>("MinPix");
234 
235  edm::ParameterSet ParametersNclusVsCycleTimeProf2D =
236  conf_.getParameter<edm::ParameterSet>("NclusVsCycleTimeProf2D");
238  ParametersNclusVsCycleTimeProf2D.getParameter<bool>("globalswitchon");
239 
240  edm::ParameterSet ParametersFEDCluster =
241  conf_.getParameter<edm::ParameterSet>("TProfNClustersFED");
243  ParametersFEDCluster.getParameter<bool>("globalswitchon");
244 
245  edm::ParameterSet ParametersClusWidthVsAmpTH2 =
246  conf_.getParameter<edm::ParameterSet>("ClusWidthVsAmpTH2");
248  ParametersClusWidthVsAmpTH2.getParameter<bool>("globalswitchon");
250  ParametersClusWidthVsAmpTH2.getParameter<bool>("layerswitchon");
252  ParametersClusWidthVsAmpTH2.getParameter<bool>("subdetswitchon");
254  ParametersClusWidthVsAmpTH2.getParameter<bool>("moduleswitchon");
255 
256  clustertkhistomapon = conf_.getParameter<bool>("TkHistoMap_On");
257  clusterchtkhistomapon = conf_.getParameter<bool>("ClusterChTkHistoMap_On");
258  createTrendMEs = conf_.getParameter<bool>("CreateTrendMEs");
259  trendVs10Ls_ = conf_.getParameter<bool>("TrendVs10LS");
260  Mod_On_ = conf_.getParameter<bool>("Mod_On");
261  ClusterHisto_ = conf_.getParameter<bool>("ClusterHisto");
262 
263  topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
264 
265  // Poducer name of input StripClusterCollection
266  clusterProducerStripToken_ = consumes<edmNew::DetSetVector<SiStripCluster> >(
267  conf_.getParameter<edm::InputTag>("ClusterProducerStrip"));
268  clusterProducerPixToken_ = consumes<edmNew::DetSetVector<SiPixelCluster> >(
269  conf_.getParameter<edm::InputTag>("ClusterProducerPix"));
270  /*
271  clusterProducerStrip_ =
272  conf_.getParameter<edm::InputTag>("ClusterProducerStrip"); clusterProducerPix_
273  = conf_.getParameter<edm::InputTag>("ClusterProducerPix");
274  */
275  // SiStrip Quality Label
276  qualityLabel_ = conf_.getParameter<std::string>("StripQualityLabel");
277  // cluster quality conditions
278  edm::ParameterSet cluster_condition =
279  conf_.getParameter<edm::ParameterSet>("ClusterConditions");
280  applyClusterQuality_ = cluster_condition.getParameter<bool>("On");
281  sToNLowerLimit_ = cluster_condition.getParameter<double>("minStoN");
282  sToNUpperLimit_ = cluster_condition.getParameter<double>("maxStoN");
283  widthLowerLimit_ = cluster_condition.getParameter<double>("minWidth");
284  widthUpperLimit_ = cluster_condition.getParameter<double>("maxWidth");
285 
286  // Event History Producer
287  // historyProducer_ = conf_.getParameter<edm::InputTag>("HistoryProducer");
288  historyProducerToken_ = consumes<EventWithHistory>(
289  conf_.getParameter<edm::InputTag>("HistoryProducer"));
290  // Apv Phase Producer
291  // apvPhaseProducer_ = conf_.getParameter<edm::InputTag>("ApvPhaseProducer");
292  apvPhaseProducerToken_ = consumes<APVCyclePhaseCollection>(
293  conf_.getParameter<edm::InputTag>("ApvPhaseProducer"));
294  // Create DCS Status
295  bool checkDCS = conf_.getParameter<bool>("UseDCSFiltering");
296  if (checkDCS)
298  else
299  dcsStatus_ = nullptr;
300 }
301 
303  if (dcsStatus_) delete dcsStatus_;
309 }
310 
311 //--------------------------------------------------------------------------------------------
313  const edm::EventSetup& es) {
314  // Initialize the GenericTriggerEventFlag
321 }
322 
323 //--------------------------------------------------------------------------------------------
325  DQMStore::IBooker& ibooker) {
327  // Retrieve tracker topology from geometry
328  edm::ESHandle<TrackerTopology> tTopoHandle;
329  es.get<TrackerTopologyRcd>().get(tTopoHandle);
330  const TrackerTopology* const tTopo = tTopoHandle.product();
331  edm::ESHandle<TkDetMap> tkDetMapHandle;
332  es.get<TrackerTopologyRcd>().get(tkDetMapHandle);
333  const TkDetMap* tkDetMap = tkDetMapHandle.product();
334 
335  // take from eventSetup the SiStripDetCabling object - here will use
336  // SiStripDetControl later on
338 
339  // get list of active detectors from SiStripDetCabling
340  std::vector<uint32_t> activeDets;
342 
343  SiStripFolderOrganizer folder_organizer;
344  folder_organizer.setSiStripFolderName(topFolderName_);
345  folder_organizer.setSiStripFolder();
346 
347  // Create TkHistoMap for Cluster
348  if (clustertkhistomapon) {
349  // std::cout << "[SiStripMonitorCluster::createMEs] topFolderName_: "
350  // << topFolderName_ << " ";
351  if ((topFolderName_ == "SiStrip") or
352  (std::string::npos != topFolderName_.find("HLT")))
353  tkmapcluster =
354  std::make_unique<TkHistoMap>(tkDetMap, ibooker, topFolderName_,
355  "TkHMap_NumberOfCluster", 0., true);
356  else
357  tkmapcluster = std::make_unique<TkHistoMap>(
358  tkDetMap, ibooker, topFolderName_ + "/TkHistoMap",
359  "TkHMap_NumberOfCluster", 0., false);
360  }
361  if (clusterchtkhistomapon) {
362  if ((topFolderName_ == "SiStrip") or
363  (std::string::npos != topFolderName_.find("HLT")))
365  std::make_unique<TkHistoMap>(tkDetMap, ibooker, topFolderName_,
366  "TkHMap_ClusterCharge", 0., true);
367  else
368  tkmapclusterch = std::make_unique<TkHistoMap>(
369  tkDetMap, ibooker, topFolderName_ + "/TkHistoMap",
370  "TkHMap_ClusterCharge", 0., false);
371  }
372 
373  // loop over detectors and book MEs
374  edm::LogInfo("SiStripTkDQM|SiStripMonitorCluster")
375  << "nr. of activeDets: " << activeDets.size();
376  for (std::vector<uint32_t>::iterator detid_iterator = activeDets.begin();
377  detid_iterator != activeDets.end(); detid_iterator++) {
378  uint32_t detid = (*detid_iterator);
379  // remove any eventual zero elements - there should be none, but just in
380  // case
381  if (detid == 0) {
382  activeDets.erase(detid_iterator);
383  continue;
384  }
385 
386  if (Mod_On_) {
387  ModMEs mod_single;
388  // set appropriate folder using SiStripFolderOrganizer
389  folder_organizer.setDetectorFolder(
390  detid, tTopo); // pass the detid to this method
391  if (reset_each_run) ResetModuleMEs(detid);
392  createModuleMEs(mod_single, detid, ibooker);
393  // append to ModuleMEsMap
394  ModuleMEsMap.insert(std::make_pair(detid, mod_single));
395  }
396 
397  // Create Layer Level MEs if they are not created already
398  std::pair<std::string, int32_t> det_layer_pair =
399  folder_organizer.GetSubDetAndLayer(detid, tTopo);
400  SiStripHistoId hidmanager;
401  std::string label = hidmanager.getSubdetid(detid, tTopo, false);
402 
403  std::map<std::string, LayerMEs>::iterator iLayerME =
404  LayerMEsMap.find(label);
405  if (iLayerME == LayerMEsMap.end()) {
406  // get detids for the layer
407  int32_t lnumber = det_layer_pair.second;
408  std::vector<uint32_t> layerDetIds;
409  if (det_layer_pair.first == "TIB") {
410  SiStripSubStructure::getTIBDetectors(activeDets, layerDetIds, tTopo,
411  lnumber, 0, 0, 0);
412  } else if (det_layer_pair.first == "TOB") {
413  SiStripSubStructure::getTOBDetectors(activeDets, layerDetIds, tTopo,
414  lnumber, 0, 0);
415  } else if (det_layer_pair.first == "TID" && lnumber > 0) {
416  SiStripSubStructure::getTIDDetectors(activeDets, layerDetIds, tTopo,
417  2, std::abs(lnumber), 0, 0);
418  } else if (det_layer_pair.first == "TID" && lnumber < 0) {
419  SiStripSubStructure::getTIDDetectors(activeDets, layerDetIds, tTopo,
420  1, std::abs(lnumber), 0, 0);
421  } else if (det_layer_pair.first == "TEC" && lnumber > 0) {
423  activeDets, layerDetIds, tTopo, 2, std::abs(lnumber), 0, 0, 0, 0);
424  } else if (det_layer_pair.first == "TEC" && lnumber < 0) {
426  activeDets, layerDetIds, tTopo, 1, std::abs(lnumber), 0, 0, 0, 0);
427  }
428  LayerDetMap[label] = layerDetIds;
429 
430  // book Layer MEs
431  folder_organizer.setLayerFolder(detid, tTopo, det_layer_pair.second);
432  createLayerMEs(label, layerDetIds.size(), ibooker);
433  }
434  // book sub-detector plots
435  auto sdet_pair = folder_organizer.getSubDetFolderAndTag(detid, tTopo);
436  if (SubDetMEsMap.find(sdet_pair.second) == SubDetMEsMap.end()) {
437  ibooker.setCurrentFolder(sdet_pair.first);
438 
439  createSubDetMEs(sdet_pair.second, ibooker);
440  }
441  } // end of loop over detectors
442 
443  // Create Global Histogram
445  ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
446  edm::ParameterSet GlobalTH2Parameters =
447  conf_.getParameter<edm::ParameterSet>("TH2ApvCycleVsDBxGlobal");
448  std::string HistoName = "DeltaBx_vs_ApvCycle";
450  ibooker.book2D(HistoName, HistoName,
451  GlobalTH2Parameters.getParameter<int32_t>("Nbinsx"),
452  GlobalTH2Parameters.getParameter<double>("xmin"),
453  GlobalTH2Parameters.getParameter<double>("xmax"),
454  GlobalTH2Parameters.getParameter<int32_t>("Nbinsy"),
455  GlobalTH2Parameters.getParameter<double>("ymin"),
456  GlobalTH2Parameters.getParameter<double>("ymax"));
458  "APV Cycle (Corrected Absolute Bx % 70)", 1);
459  GlobalApvCycleDBxTH2->setAxisTitle("Delta Bunch Crossing Cycle", 2);
460 
461  // plot DeltaBX ***************************
462  edm::ParameterSet GlobalTH1Parameters =
463  conf_.getParameter<edm::ParameterSet>("TH1DBxGlobal");
464  HistoName = "DeltaBx";
465  GlobalDBxTH1 =
466  ibooker.book1D(HistoName, HistoName,
467  GlobalTH1Parameters.getParameter<int32_t>("Nbinsx"),
468  GlobalTH1Parameters.getParameter<double>("xmin"),
469  GlobalTH1Parameters.getParameter<double>("xmax"));
470  GlobalDBxTH1->setAxisTitle("Delta Bunch Crossing", 1);
471 
472  // plot DeltaBXCycle ***************************
473  edm::ParameterSet DBxCycle =
474  conf_.getParameter<edm::ParameterSet>("TH1DBxCycleGlobal");
475  HistoName = "DeltaBxCycle";
476  GlobalDBxCycleTH1 = ibooker.book1D(
477  HistoName, HistoName, DBxCycle.getParameter<int32_t>("Nbinsx"),
478  DBxCycle.getParameter<double>("xmin"),
479  DBxCycle.getParameter<double>("xmax"));
480  GlobalDBxCycleTH1->setAxisTitle("Delta Bunch Crossing Cycle", 1);
481  }
482 
484  ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
485  edm::ParameterSet GlobalTH2Parameters =
486  conf_.getParameter<edm::ParameterSet>("TH2CStripVsCpixel");
487  std::string HistoName = "StripClusVsPixClus";
489  ibooker.book2D(HistoName, HistoName,
490  GlobalTH2Parameters.getParameter<int32_t>("Nbinsx"),
491  GlobalTH2Parameters.getParameter<double>("xmin"),
492  GlobalTH2Parameters.getParameter<double>("xmax"),
493  GlobalTH2Parameters.getParameter<int32_t>("Nbinsy"),
494  GlobalTH2Parameters.getParameter<double>("ymin"),
495  GlobalTH2Parameters.getParameter<double>("ymax"));
496  GlobalCStripVsCpix->setAxisTitle("Strip Clusters", 1);
497  GlobalCStripVsCpix->setAxisTitle("Pix Clusters", 2);
498 
499  // Absolute Bunch Crossing ***********************
500  edm::ParameterSet GlobalTH1Parameters =
501  conf_.getParameter<edm::ParameterSet>("TH1ABx_CSCP");
502  HistoName = "AbsoluteBx_CStripVsCpixel";
504  ibooker.book1D(HistoName, HistoName,
505  GlobalTH1Parameters.getParameter<int32_t>("Nbinsx"),
506  GlobalTH1Parameters.getParameter<double>("xmin"),
507  GlobalTH1Parameters.getParameter<double>("xmax"));
508  GlobalABXTH1_CSCP->setAxisTitle("Absolute Bunch Crossing", 1);
509  }
510 
512  ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
513  edm::ParameterSet GlobalTH2Parameters =
514  conf_.getParameter<edm::ParameterSet>("TH1MultiplicityRegions");
515  std::string HistoName = "ClusterMultiplicityRegions";
517  ibooker.book1D(HistoName, HistoName,
518  GlobalTH2Parameters.getParameter<int32_t>("Nbinx"),
519  GlobalTH2Parameters.getParameter<double>("xmin"),
520  GlobalTH2Parameters.getParameter<double>("xmax"));
522  PixVsStripMultiplicityRegions->setBinLabel(1, "Main Diagonal");
523  PixVsStripMultiplicityRegions->setBinLabel(2, "Strip Noise");
524  PixVsStripMultiplicityRegions->setBinLabel(3, "High Strip Noise");
525  PixVsStripMultiplicityRegions->setBinLabel(4, "Beam Background");
526  PixVsStripMultiplicityRegions->setBinLabel(5, "No Strip Clusters");
527  }
528 
530  ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
531  edm::ParameterSet GlobalTH1Parameters =
532  conf_.getParameter<edm::ParameterSet>("TH1MainDiagonalPosition");
533  std::string HistoName = "MainDiagonal Position";
535  ibooker.book1D(HistoName, HistoName,
536  GlobalTH1Parameters.getParameter<int32_t>("Nbinsx"),
537  GlobalTH1Parameters.getParameter<double>("xmin"),
538  GlobalTH1Parameters.getParameter<double>("xmax"));
539  GlobalMainDiagonalPosition->setAxisTitle("atan(NPix/(k*NStrip))");
540 
541  // PLOT MainDiagonalPosition_vs_BX ***************************
542  edm::ParameterSet GlobalTProfParameters =
543  conf_.getParameter<edm::ParameterSet>("TProfMainDiagonalPosition");
544  HistoName = "MainDiagonalPosition_vs_BX";
546  HistoName, HistoName,
547  GlobalTProfParameters.getParameter<int32_t>("Nbinsx"),
548  GlobalTProfParameters.getParameter<double>("xmin"),
549  GlobalTProfParameters.getParameter<double>("xmax"),
550  GlobalTProfParameters.getParameter<int32_t>("Nbinsy"),
551  GlobalTProfParameters.getParameter<double>("ymin"),
552  GlobalTProfParameters.getParameter<double>("ymax"));
553 
555  GlobalMainDiagonalPosition_vs_BX->setAxisTitle("tan^{-1}(NPix/k*NStrip))",
556  2);
557 
558  edm::ParameterSet GlobalTH2Parameters =
559  conf_.getParameter<edm::ParameterSet>("TH2MainDiagonalPosition");
560  HistoName = "TH2MainDiagonalPosition_vs_BX";
562  ibooker.book2D(HistoName, HistoName,
563  GlobalTH2Parameters.getParameter<int32_t>("Nbinsx"),
564  GlobalTH2Parameters.getParameter<double>("xmin"),
565  GlobalTH2Parameters.getParameter<double>("xmax"),
566  GlobalTH2Parameters.getParameter<int32_t>("Nbinsy"),
567  GlobalTH2Parameters.getParameter<double>("ymin"),
568  GlobalTH2Parameters.getParameter<double>("ymax"));
571  "tan^{-1}(NPix/k*NStrip))", 2);
572  }
573 
574  // TO BE ADDED !!!
575  /*
576  if ( globalswitchapvcycledbxth2on or globalswitchcstripvscpix or
577  globalswitchMultiRegions or ClusterHisto_ ) {
578  ibooker.setCurrentFolder(topFolderName_+"/MechanicalView/");
579  std::string HistoName = "BPTX rate";
580  BPTXrateTrend = ibooker.bookProfile(HistoName,HistoName, LSBin, LSMin,
581  LSMax, 0, 10000.,""); BPTXrateTrend->getTH1()->SetCanExtend(TH1::kAllAxes);
582  BPTXrateTrend->setAxisTitle("#Lumi section",1);
583  BPTXrateTrend->setAxisTitle("Number of BPTX events per LS",2);
584  }
585  */
586 
588  ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
589  edm::ParameterSet GlobalTH1Parameters =
590  conf_.getParameter<edm::ParameterSet>("TH1StripNoise2ApvCycle");
591  std::string HistoName = "StripNoise_ApvCycle";
593  ibooker.book1D(HistoName, HistoName,
594  GlobalTH1Parameters.getParameter<int32_t>("Nbinsx"),
595  GlobalTH1Parameters.getParameter<double>("xmin"),
596  GlobalTH1Parameters.getParameter<double>("xmax"));
597  StripNoise2Cycle->setAxisTitle("APV Cycle");
598  }
599 
601  ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
602  edm::ParameterSet GlobalTH1Parameters =
603  conf_.getParameter<edm::ParameterSet>("TH1StripNoise3ApvCycle");
604  std::string HistoName = "HighStripNoise_ApvCycle";
606  ibooker.book1D(HistoName, HistoName,
607  GlobalTH1Parameters.getParameter<int32_t>("Nbinsx"),
608  GlobalTH1Parameters.getParameter<double>("xmin"),
609  GlobalTH1Parameters.getParameter<double>("xmax"));
610  StripNoise3Cycle->setAxisTitle("APV Cycle");
611  }
612 
614  const char* HistoName = "StripClusVsBXandOrbit";
615  const char* HistoTitle =
616  "Strip cluster multiplicity vs BX mod(70) and Orbit;Event 1 BX "
617  "mod(70);time [Orb#]";
618  edm::ParameterSet ParametersNclusVsCycleTimeProf2D =
619  conf_.getParameter<edm::ParameterSet>("NclusVsCycleTimeProf2D");
621  HistoName, HistoTitle,
622  ParametersNclusVsCycleTimeProf2D.getParameter<int32_t>("Nbins"),
623  ParametersNclusVsCycleTimeProf2D.getParameter<double>("xmin"),
624  ParametersNclusVsCycleTimeProf2D.getParameter<double>("xmax"),
625  ParametersNclusVsCycleTimeProf2D.getParameter<int32_t>("Nbinsy"),
626  ParametersNclusVsCycleTimeProf2D.getParameter<double>("ymin"),
627  ParametersNclusVsCycleTimeProf2D.getParameter<double>("ymax"), 0, 0);
628  if (NclusVsCycleTimeProf2D->kind() == MonitorElement::DQM_KIND_TPROFILE2D)
629  NclusVsCycleTimeProf2D->getTH1()->SetCanExtend(TH1::kAllAxes);
630  }
632  ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
633  edm::ParameterSet ParametersClusWidthVsAmpTH2 =
634  conf_.getParameter<edm::ParameterSet>("ClusWidthVsAmpTH2");
635  const char* HistoName = "ClusterWidths_vs_Amplitudes";
636  const char* HistoTitle =
637  "Cluster widths vs amplitudes;Amplitudes (integrated ADC "
638  "counts);Cluster widths";
639  ClusWidthVsAmpTH2 = ibooker.book2D(
640  HistoName, HistoTitle,
641  ParametersClusWidthVsAmpTH2.getParameter<int32_t>("Nbinsx"),
642  ParametersClusWidthVsAmpTH2.getParameter<double>("xmin"),
643  ParametersClusWidthVsAmpTH2.getParameter<double>("xmax"),
644  ParametersClusWidthVsAmpTH2.getParameter<int32_t>("Nbinsy"),
645  ParametersClusWidthVsAmpTH2.getParameter<double>("ymin"),
646  ParametersClusWidthVsAmpTH2.getParameter<double>("ymax"));
647  }
648 
649  if (ClusterHisto_) {
650  ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
651  edm::ParameterSet PixelCluster =
652  conf_.getParameter<edm::ParameterSet>("TH1NClusPx");
653  std::string HistoName = "NumberOfClustersInPixel";
654  NumberOfPixelClus = ibooker.book1D(
655  HistoName, HistoName, PixelCluster.getParameter<int32_t>("Nbinsx"),
656  PixelCluster.getParameter<double>("xmin"),
657  PixelCluster.getParameter<double>("xmax"));
658  NumberOfPixelClus->setAxisTitle("# of Clusters in Pixel", 1);
659  NumberOfPixelClus->setAxisTitle("Number of Events", 2);
660  //
661  edm::ParameterSet StripCluster =
662  conf_.getParameter<edm::ParameterSet>("TH1NClusStrip");
663  HistoName = "NumberOfClustersInStrip";
664  NumberOfStripClus = ibooker.book1D(
665  HistoName, HistoName, StripCluster.getParameter<int32_t>("Nbinsx"),
666  StripCluster.getParameter<double>("xmin"),
667  StripCluster.getParameter<double>("xmax"));
668  NumberOfStripClus->setAxisTitle("# of Clusters in Strip", 1);
669  NumberOfStripClus->setAxisTitle("Number of Events", 2);
670 
671  // NumberOfClustersinStrip vs BX PLOT ****************************
672  edm::ParameterSet StripClusterBX =
673  conf_.getParameter<edm::ParameterSet>("TProfNClusStrip");
674  HistoName = "NumberOfClustersInStrip_vs_BX";
676  HistoName, HistoName, StripClusterBX.getParameter<int32_t>("Nbinsx"),
677  StripClusterBX.getParameter<double>("xmin"),
678  StripClusterBX.getParameter<double>("xmax"),
679  StripClusterBX.getParameter<int32_t>("Nbinsy"),
680  StripClusterBX.getParameter<double>("ymin"),
681  StripClusterBX.getParameter<double>("ymax"));
682 
683  NumberOfStripClus_vs_BX->setAxisTitle("Absolute BX", 1);
684  NumberOfStripClus_vs_BX->setAxisTitle("# of Clusters in Strip", 2);
685 
686  // NumberOfClustersinStrip vs BX PLOT ****************************
687  edm::ParameterSet PixelClusterBX =
688  conf_.getParameter<edm::ParameterSet>("TProfNClusPixel");
689  HistoName = "NumberOfClustersInPixel_vs_BX";
691  HistoName, HistoName, PixelClusterBX.getParameter<int32_t>("Nbinsx"),
692  PixelClusterBX.getParameter<double>("xmin"),
693  PixelClusterBX.getParameter<double>("xmax"),
694  PixelClusterBX.getParameter<int32_t>("Nbinsy"),
695  PixelClusterBX.getParameter<double>("ymin"),
696  PixelClusterBX.getParameter<double>("ymax"));
697 
698  NumberOfPixelClus_vs_BX->setAxisTitle("Absolute BX", 1);
699  NumberOfPixelClus_vs_BX->setAxisTitle("# of Clusters in Pixel", 2);
700 
702  // Number of clusters per FED
703  edm::ParameterSet FEDCluster =
704  conf_.getParameter<edm::ParameterSet>("TProfNClustersFED");
705  HistoName = "NumberOfClustersinFED_v_FEDID";
706  NumberOfFEDClus = ibooker.bookProfile(
707  HistoName, HistoName, FEDCluster.getParameter<int32_t>("Nbinsx"),
708  FEDCluster.getParameter<double>("xmin"),
709  FEDCluster.getParameter<double>("xmax"),
710  FEDCluster.getParameter<int32_t>("Nbinsy"),
711  FEDCluster.getParameter<double>("ymin"),
712  FEDCluster.getParameter<double>("ymax"),"");
713  NumberOfFEDClus->setAxisTitle("FED ID", 1);
714  NumberOfFEDClus->setAxisTitle("Mean # of Cluster in FED", 2);
715  }
716  }
717 
718  } // end of if
719 } // end of method
720 
721 //--------------------------------------------------------------------------------------------
722 
724  const edm::Run& run,
725  const edm::EventSetup& es) {
727  unsigned long long cacheID =
728  es.get<SiStripDetCablingRcd>().cacheIdentifier();
729  if (m_cacheID_ != cacheID) {
730  m_cacheID_ = cacheID;
731  edm::LogInfo("SiStripMonitorCluster")
732  << "SiStripMonitorCluster::bookHistograms: "
733  << " Creating MEs for new Cabling ";
734 
735  createMEs(es, ibooker);
736  }
737  } else if (reset_each_run) {
738  edm::LogInfo("SiStripMonitorCluster")
739  << "SiStripMonitorCluster::bookHistograms: "
740  << " Resetting MEs ";
741  for (std::map<uint32_t, ModMEs>::const_iterator idet = ModuleMEsMap.begin();
742  idet != ModuleMEsMap.end(); idet++) {
743  ResetModuleMEs(idet->first);
744  }
745  }
746 }
747 
748 //--------------------------------------------------------------------------------------------
750  const edm::EventSetup& iSetup) {
751  // Retrieve tracker topology from geometry
752  edm::ESHandle<TrackerTopology> tTopoHandle;
753  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
754  const TrackerTopology* const tTopo = tTopoHandle.product();
755 
756  // Filter out events if Trigger Filtering is requested
759  ? genTriggerEventFlagBPTXfilter_->accept(iEvent, iSetup)
760  : true;
763  ? genTriggerEventFlagPixelDCSfilter_->accept(iEvent, iSetup)
764  : true;
767  ? genTriggerEventFlagStripDCSfilter_->accept(iEvent, iSetup)
768  : true;
769  // std::cout << "passBPTXfilter_ ? " << passBPTXfilter_ << std::endl;
770 
771  // Filter out events if DCS Event if requested
772  bool passDCSFilter_ = !(dcsStatus_ && !dcsStatus_->getStatus(iEvent, iSetup));
773 
774  runNb = iEvent.id().run();
775  eventNb++;
776  trendVar = trendVs10Ls_ ? iEvent.orbitNumber() / (10 * 262144.0)
777  : iEvent.orbitNumber() /
778  (1 * 262144.0); // 10 lumisection : lumisection
779 
780  int NPixClusters = 0, NStripClusters = 0, MultiplicityRegion = 0;
781  bool isPixValid = false;
782 
783  edm::ESHandle<SiStripNoises> noiseHandle;
784  iSetup.get<SiStripNoisesRcd>().get(noiseHandle);
785 
786  edm::ESHandle<SiStripGain> gainHandle;
787  iSetup.get<SiStripGainRcd>().get(gainHandle);
788 
789  edm::ESHandle<SiStripQuality> qualityHandle;
790  iSetup.get<SiStripQualityRcd>().get(qualityLabel_, qualityHandle);
791 
793 
794  // get collection of DetSetVector of clusters from Event
796  iEvent.getByToken(clusterProducerStripToken_, cluster_detsetvektor);
797 
798  // get pixel clusters
799  edm::Handle<edmNew::DetSetVector<SiPixelCluster> > cluster_detsetvektor_pix;
800  iEvent.getByToken(clusterProducerPixToken_, cluster_detsetvektor_pix);
801 
802  if (!cluster_detsetvektor.isValid()) return;
803 
805  cluster_detsetvektor.product();
806  NStripClusters = StrC->data().size();
807 
808  if (cluster_detsetvektor_pix.isValid()) {
810  cluster_detsetvektor_pix.product();
811  NPixClusters = PixC->data().size();
812  isPixValid = true;
813  MultiplicityRegion = FindRegion(NStripClusters, NPixClusters);
814 
816  passDCSFilter_) {
818  GlobalCStripVsCpix->Fill(NStripClusters, NPixClusters);
819  if (globalswitchmaindiagonalposition && NStripClusters > 0)
821  atan(NPixClusters / (k0 * NStripClusters)));
822 
824  PixVsStripMultiplicityRegions->Fill(MultiplicityRegion);
825  }
826 
827  if (ClusterHisto_ and passDCSFilter_) {
829  NumberOfPixelClus->Fill(NPixClusters);
831  NumberOfStripClus->Fill(NStripClusters);
832  }
833  }
834  // initialise # of clusters to zero
835  for (std::map<std::string, SubDetMEs>::iterator iSubdet =
836  SubDetMEsMap.begin();
837  iSubdet != SubDetMEsMap.end(); iSubdet++) {
838  iSubdet->second.totNClusters = 0;
839  }
840 
841  SiStripFolderOrganizer folder_organizer;
842  bool found_layer_me = false;
843  // Map of cumulative clusters per fed ID.
844  std::map<int, int> FEDID_v_clustersum;
845 
846  for (std::map<std::string, std::vector<uint32_t> >::const_iterator iterLayer =
847  LayerDetMap.begin();
848  iterLayer != LayerDetMap.end(); iterLayer++) {
849  std::string layer_label = iterLayer->first;
850 
851  int ncluster_layer = 0;
852  std::map<std::string, LayerMEs>::iterator iLayerME =
853  LayerMEsMap.find(layer_label);
854 
855  // get Layer MEs
856  LayerMEs layer_single;
857  if (iLayerME != LayerMEsMap.end()) {
858  layer_single = iLayerME->second;
859  found_layer_me = true;
860  }
861 
862  int ncluster_ring[20] = {0};
863 
864  bool found_module_me = false;
865  uint16_t iDet = 0;
866  std::string subdet_label = "";
867  // loop over all modules in the layer
868  for (std::vector<uint32_t>::const_iterator iterDets =
869  iterLayer->second.begin();
870  iterDets != iterLayer->second.end(); iterDets++) {
871  iDet++;
872  // detid and type of ME
873  uint32_t detid = (*iterDets);
874 
875  // Get SubDet label once
876  if (subdet_label.empty())
877  subdet_label =
878  folder_organizer.getSubDetFolderAndTag(detid, tTopo).second;
879 
880  // DetId and corresponding set of MEs
881  ModMEs mod_single;
882  if (Mod_On_) {
883  std::map<uint32_t, ModMEs>::iterator imodME = ModuleMEsMap.find(detid);
884  if (imodME != ModuleMEsMap.end()) {
885  mod_single = imodME->second;
886  found_module_me = true;
887  }
888  } else
889  found_module_me = false;
890 
892  cluster_detsetvektor->find(detid); // search clusters of detid
893 
894  if (isearch == cluster_detsetvektor->end() and passDCSFilter_) {
895  if (found_module_me && moduleswitchncluson &&
896  (mod_single.NumberOfClusters)) {
897  (mod_single.NumberOfClusters)->Fill(0.); // no clusters for this
898  // detector module,fill
899  // histogram with 0
900  }
901  if (clustertkhistomapon) tkmapcluster->fill(detid, 0.);
902  if (clusterchtkhistomapon) tkmapclusterch->fill(detid, 0.);
903  if (found_layer_me && layerswitchnumclusterprofon)
904  layer_single.LayerNumberOfClusterProfile->Fill(iDet, 0.0);
905  }
906 
907  if (isearch == cluster_detsetvektor->end()) {
908  continue; // no clusters for this detid => jump to next step of loop
909  }
910 
911  // cluster_detset is a structure, cluster_detset.data is a
912  // std::vector<SiStripCluster>, cluster_detset.id is uint32_t
913  // edmNew::DetSet<SiStripCluster> cluster_detset =
914  // (*cluster_detsetvektor)[detid]; // the statement above makes sure there
915  // exists an element with 'detid'
916  edmNew::DetSet<SiStripCluster> cluster_detset = (*isearch);
917 
919  // Get all FED connections associated with given detID.
920  // All connections for a detid have same FED Id therefore one FEDID is
921  // associated with a given detID. Vector of constant FedChannelConnection
922  // objects to variable pointers.
923  std::vector<const FedChannelConnection*> fedConnections =
925 
926  // Filling FED Id associated clusters map.
927 
928  int good_fcc_index = -999;
929  for (unsigned int x = 0; x < fedConnections.size(); x++) {
930  if (fedConnections[x] != nullptr) {
931  good_fcc_index = x;
932  break;
933  }
934  }
935  if (good_fcc_index != -999 && fedConnections[good_fcc_index] != nullptr) {
936  int temp_fedid = fedConnections[good_fcc_index]->fedId();
937  if (FEDID_v_clustersum.find(temp_fedid) != FEDID_v_clustersum.end()) {
938  if (cluster_detset.size() < 1000 && !cluster_detset.empty()) {
939  FEDID_v_clustersum[temp_fedid] =
940  FEDID_v_clustersum.find(temp_fedid)->second +
941  cluster_detset.size();
942  }
943  } else {
944  if (cluster_detset.size() < 1000 && !cluster_detset.empty()) {
945  FEDID_v_clustersum[temp_fedid] = cluster_detset.size();
946  }
947  }
948  } else {
949  edm::LogInfo("SiStripMonitorCluster")
950  << "SiStripMonitorCluster::analyze WARNING! no good connections "
951  "for detid = "
952  << detid << endl;
953  }
955 
956  // Filling TkHistoMap with number of clusters for each module
957  if (clustertkhistomapon and passDCSFilter_) {
958  tkmapcluster->fill(detid, static_cast<float>(cluster_detset.size()));
959  }
960 
961  if (moduleswitchncluson && found_module_me &&
962  (mod_single.NumberOfClusters != nullptr) &&
963  passDCSFilter_) { // nr. of clusters per module
964  (mod_single.NumberOfClusters)
965  ->Fill(static_cast<float>(cluster_detset.size()));
966  }
967 
968  if (found_layer_me && layerswitchnumclusterprofon && passDCSFilter_)
969  layer_single.LayerNumberOfClusterProfile->Fill(
970  iDet, static_cast<float>(cluster_detset.size()));
971  ncluster_layer += cluster_detset.size();
972 
973  short total_clusterized_strips = 0;
974 
975  SiStripNoises::Range detNoiseRange = noiseHandle->getRange(detid);
976  SiStripApvGain::Range detGainRange = gainHandle->getRange(detid);
977  SiStripQuality::Range qualityRange = qualityHandle->getRange(detid);
978 
980  cluster_detset.begin();
981  clusterIter != cluster_detset.end(); clusterIter++) {
982  const auto& ampls = clusterIter->amplitudes();
983  // cluster position
984  float cluster_position = clusterIter->barycenter();
985  // start defined as nr. of first strip beloning to the cluster
986  short cluster_start = clusterIter->firstStrip();
987  // width defined as nr. of strips that belong to cluster
988  short cluster_width = ampls.size();
989  // add nr of strips of this cluster to total nr. of clusterized strips
990  total_clusterized_strips = total_clusterized_strips + cluster_width;
991 
992  if (clusterchtkhistomapon and passDCSFilter_)
993  tkmapclusterch->fill(detid,
994  static_cast<float>(clusterIter->charge()));
995 
996  // cluster signal and noise from the amplitudes
997  float cluster_signal = 0.0;
998  float cluster_noise = 0.0;
999  int nrnonzeroamplitudes = 0;
1000  float noise2 = 0.0;
1001  float noise = 0.0;
1002  for (uint iamp = 0; iamp < ampls.size(); iamp++) {
1003  if (ampls[iamp] > 0) { // nonzero amplitude
1004  cluster_signal += ampls[iamp];
1005  if (!qualityHandle->IsStripBad(qualityRange,
1006  clusterIter->firstStrip() + iamp)) {
1007  noise = noiseHandle->getNoise(clusterIter->firstStrip() + iamp,
1008  detNoiseRange) /
1009  gainHandle->getStripGain(clusterIter->firstStrip() + iamp,
1010  detGainRange);
1011  }
1012  noise2 += noise * noise;
1013  nrnonzeroamplitudes++;
1014  }
1015  } // End loop over cluster amplitude
1016 
1017  if (nrnonzeroamplitudes > 0)
1018  cluster_noise = sqrt(noise2 / nrnonzeroamplitudes);
1019 
1020  if (applyClusterQuality_ &&
1021  (cluster_signal / cluster_noise < sToNLowerLimit_ ||
1022  cluster_signal / cluster_noise > sToNUpperLimit_ ||
1023  cluster_width < widthLowerLimit_ ||
1024  cluster_width > widthUpperLimit_))
1025  continue;
1026 
1027  ClusterProperties cluster_properties;
1028  cluster_properties.charge = cluster_signal;
1029  cluster_properties.position = cluster_position;
1030  cluster_properties.start = cluster_start;
1031  cluster_properties.width = cluster_width;
1032  cluster_properties.noise = cluster_noise;
1033 
1034  // Fill Module Level MEs
1035  if (found_module_me and passDCSFilter_)
1036  fillModuleMEs(mod_single, cluster_properties);
1037 
1038  // Fill Layer Level MEs
1039  if (found_layer_me and passDCSFilter_) {
1040  fillLayerMEs(layer_single, cluster_properties);
1042  layer_single.LayerClusterWidthProfile->Fill(iDet, cluster_width);
1043  }
1044 
1046  std::map<std::string, SubDetMEs>::iterator iSubdet =
1047  SubDetMEsMap.find(subdet_label);
1048  if (iSubdet != SubDetMEsMap.end()) {
1049  if (subdetswitchcluschargeon and passDCSFilter_)
1050  iSubdet->second.SubDetClusterChargeTH1->Fill(cluster_signal);
1051  if (subdetswitchcluswidthon and passDCSFilter_)
1052  iSubdet->second.SubDetClusterWidthTH1->Fill(cluster_width);
1053  }
1054  }
1055 
1056  if (subdet_clusterWidth_vs_amplitude_on and passDCSFilter_) {
1057  std::map<std::string, SubDetMEs>::iterator iSubdet =
1058  SubDetMEsMap.find(subdet_label);
1059  if (iSubdet != SubDetMEsMap.end())
1060  iSubdet->second.SubDetClusWidthVsAmpTH2->Fill(cluster_signal,
1061  cluster_width);
1062  }
1063 
1064  if (clusterWidth_vs_amplitude_on and passDCSFilter_) {
1065  ClusWidthVsAmpTH2->Fill(cluster_signal, cluster_width);
1066  }
1067 
1069  (subdet_label.find("TID") != std::string::npos ||
1070  subdet_label.find("TEC") != std::string::npos)) {
1071  std::pair<std::string, int32_t> det_ring_pair =
1072  folder_organizer.GetSubDetAndLayer(detid, tTopo, true);
1073  ncluster_ring[std::abs(det_ring_pair.second)]++;
1074  }
1075 
1076  } // end loop over clusters
1077 
1079  std::map<std::string, SubDetMEs>::iterator iSubdet =
1080  SubDetMEsMap.find(subdet_label);
1081  std::pair<std::string, int32_t> det_layer_pair =
1082  folder_organizer.GetSubDetAndLayer(detid, tTopo);
1083  iSubdet->second.SubDetNumberOfClusterPerLayerTrend->Fill(
1084  trendVar, std::abs(det_layer_pair.second), ncluster_layer);
1085  }
1086 
1088  (subdet_label.find("TID") != std::string::npos ||
1089  subdet_label.find("TEC") != std::string::npos)) {
1090  std::pair<std::string, int32_t> det_ring_pair =
1091  folder_organizer.GetSubDetAndLayer(detid, tTopo, true);
1092  layer_single.LayerNumberOfClusterPerRingTrend->Fill(
1093  trendVar, std::abs(det_ring_pair.second),
1094  ncluster_ring[std::abs(det_ring_pair.second)]);
1095  }
1096 
1097  short total_nr_strips = SiStripDetCabling_->nApvPairs(detid) * 2 *
1098  128; // get correct # of avp pairs
1099  float local_occupancy = static_cast<float>(total_clusterized_strips) /
1100  static_cast<float>(total_nr_strips);
1101  if (found_module_me and passDCSFilter_) {
1103  mod_single.NrOfClusterizedStrips) { // nr of clusterized strips
1104  mod_single.NrOfClusterizedStrips->Fill(
1105  static_cast<float>(total_clusterized_strips));
1106  }
1107 
1109  mod_single.ModuleLocalOccupancy) { // Occupancy
1110  mod_single.ModuleLocalOccupancy->Fill(local_occupancy);
1111  }
1112  }
1113  if (layerswitchlocaloccupancy && found_layer_me &&
1114  layer_single.LayerLocalOccupancy && passDCSFilter_) {
1115  fillME(layer_single.LayerLocalOccupancy, local_occupancy);
1116  if (createTrendMEs)
1118  local_occupancy);
1119  }
1120  }
1121 
1123  fillME(layer_single.LayerNumberOfClusterTrend, trendVar, ncluster_layer);
1124 
1125  std::map<std::string, SubDetMEs>::iterator iSubdet =
1126  SubDetMEsMap.find(subdet_label);
1127  if (iSubdet != SubDetMEsMap.end())
1128  iSubdet->second.totNClusters += ncluster_layer;
1129  }
1130 
1131  // EventHistory
1132  edm::Handle<EventWithHistory> event_history;
1133  iEvent.getByToken(historyProducerToken_, event_history);
1134 
1135  // Phase of APV
1136  edm::Handle<APVCyclePhaseCollection> apv_phase_collection;
1137  iEvent.getByToken(apvPhaseProducerToken_, apv_phase_collection);
1138 
1139  if (event_history.isValid() && !event_history.failedToGet() &&
1140  apv_phase_collection.isValid() && !apv_phase_collection.failedToGet()) {
1141  long long dbx = event_history->deltaBX();
1142  long long tbx = event_history->absoluteBX();
1143 
1144  bool global_histo_filled = false;
1145  bool MultiplicityRegion_Vs_APVcycle_filled = false;
1146 
1147  // plot n 2
1149  passDCSFilter_) {
1151  }
1152  // plot n 2
1153 
1154  for (std::map<std::string, SubDetMEs>::iterator it = SubDetMEsMap.begin();
1155  it != SubDetMEsMap.end(); it++) {
1156  std::string sdet = it->first;
1157  // std::string sdet = sdet_tag.substr(0,sdet_tag.find_first_of("_"));
1158  SubDetMEs sdetmes = it->second;
1159 
1160  int the_phase = APVCyclePhaseCollection::invalid;
1161  long long tbx_corr = tbx;
1162 
1163  if (SubDetPhasePartMap.find(sdet) != SubDetPhasePartMap.end())
1164  the_phase = apv_phase_collection->getPhase(SubDetPhasePartMap[sdet]);
1165  if (the_phase == APVCyclePhaseCollection::nopartition ||
1166  the_phase == APVCyclePhaseCollection::multiphase ||
1167  the_phase == APVCyclePhaseCollection::invalid) {
1168  the_phase = 30;
1169  // std::cout << " subdet " << it->first << " not valid" << " MR " <<
1170  // MultiplicityRegion <<std::endl;
1171  }
1172  tbx_corr -= the_phase;
1173 
1174  long long dbxincycle = event_history->deltaBXinCycle(the_phase);
1175  // std::cout<<"dbx in cycle: " << dbxincycle << std::endl;
1176  if (globalswitchapvcycledbxth2on && !global_histo_filled &&
1177  passDCSFilter_) {
1178  GlobalApvCycleDBxTH2->Fill(tbx_corr % 70, dbx);
1179  GlobalDBxTH1->Fill(dbx);
1180  GlobalDBxCycleTH1->Fill(dbxincycle);
1181  global_histo_filled = true;
1182  }
1183 
1184  // Fill MainDiagonalPosition plots ***************
1185  if (cluster_detsetvektor_pix.isValid()) {
1186  if (ClusterHisto_) {
1187  if (passBPTXfilter_ and passStripDCSfilter_ and passDCSFilter_) {
1188  NumberOfStripClus_vs_BX->Fill(tbx % 3564, NStripClusters);
1189  if (passPixelDCSfilter_) {
1190  NumberOfPixelClus_vs_BX->Fill(tbx % 3564, NPixClusters);
1191  if (globalswitchmaindiagonalposition && NStripClusters > 0) {
1193  tbx % 3564, atan(NPixClusters / (k0 * NStripClusters)));
1195  tbx % 3564, atan(NPixClusters / (k0 * NStripClusters)));
1196  }
1197  }
1198  }
1199 
1200  // Filling # clusters per FED ID histogram from FED Id clusters map
1201  // (for all layers simultaneously).
1202  map<int, int>::iterator it;
1203  // for(it=FEDID_v_clustersum.begin(); it!=FEDID_v_clustersum.end();
1204  // it++){
1205  for (auto const& fedidEntry : FEDID_v_clustersum) {
1206  // NumberOfFEDClus->Fill(it->first,it->second);
1207  if (passDCSFilter_)
1208  NumberOfFEDClus->Fill(fedidEntry.first, fedidEntry.second);
1209  // if(it->first < 100){
1210  // Trend_NumberOfFEDClus->Fill(trendVar,it->first,it->second);
1211  //}
1212  }
1213  FEDID_v_clustersum.clear();
1214  }
1215  }
1216 
1217  if (isPixValid && !MultiplicityRegion_Vs_APVcycle_filled &&
1218  passDCSFilter_) {
1219  if (globalswitchstripnoise2apvcycle && MultiplicityRegion == 2) {
1220  StripNoise2Cycle->Fill(tbx_corr % 70);
1221  }
1222  if (globalswitchstripnoise3apvcycle && MultiplicityRegion == 3) {
1223  StripNoise3Cycle->Fill(tbx_corr % 70);
1224  }
1225  MultiplicityRegion_Vs_APVcycle_filled = true;
1226  }
1227 
1228  if (subdetswitchtotclusth1on and passDCSFilter_)
1229  sdetmes.SubDetTotClusterTH1->Fill(sdetmes.totNClusters);
1231  sdetmes.SubDetTotClusterProf->Fill(trendVar, sdetmes.totNClusters);
1232  if (subdetswitchapvcycleprofon and passDCSFilter_)
1233  sdetmes.SubDetClusterApvProf->Fill(tbx_corr % 70, sdetmes.totNClusters);
1234  if (subdetswitchapvcycleth2on and passDCSFilter_)
1235  sdetmes.SubDetClusterApvTH2->Fill(tbx_corr % 70, sdetmes.totNClusters);
1236  if (subdetswitchdbxcycleprofon and passDCSFilter_) {
1237  sdetmes.SubDetClusterDBxCycleProf->Fill(dbxincycle,
1238  sdetmes.totNClusters);
1239  }
1240  if (subdetswitchapvcycledbxprof2on and passDCSFilter_)
1241  sdetmes.SubDetApvDBxProf2->Fill(tbx_corr % 70, dbx,
1242  sdetmes.totNClusters);
1243  }
1244 
1245  if (globalswitchnclusvscycletimeprof2don and passDCSFilter_) {
1246  long long tbx_corr = tbx;
1247  int the_phase = apv_phase_collection->getPhase("All");
1248 
1249  if (the_phase == APVCyclePhaseCollection::nopartition ||
1250  the_phase == APVCyclePhaseCollection::multiphase ||
1251  the_phase == APVCyclePhaseCollection::invalid)
1252  the_phase = 30;
1253 
1254  tbx_corr -= the_phase;
1255 
1256  NclusVsCycleTimeProf2D->Fill(tbx_corr % 70, (int)event_history->_orbit,
1257  NStripClusters);
1258  }
1259  }
1260 }
1261 //
1262 // -- Reset MEs
1263 //------------------------------------------------------------------------------
1265  std::map<uint32_t, ModMEs>::iterator pos = ModuleMEsMap.find(idet);
1266  ModMEs mod_me = pos->second;
1267 
1279  mod_me.Module_ClusWidthVsAmpTH2->Reset();
1280 }
1281 //
1282 // -- Create Module Level MEs
1283 //
1284 void SiStripMonitorCluster::createModuleMEs(ModMEs& mod_single, uint32_t detid,
1285  DQMStore::IBooker& ibooker) {
1286  // use SistripHistoId for producing histogram id (and title)
1287  SiStripHistoId hidmanager;
1288  std::string hid;
1289 
1290  // nr. of clusters per module
1291  if (moduleswitchncluson) {
1292  hid = hidmanager.createHistoId("NumberOfClusters", "det", detid);
1293  mod_single.NumberOfClusters =
1294  bookME1D("TH1nClusters", hid.c_str(), ibooker);
1295  ibooker.tag(mod_single.NumberOfClusters, detid);
1296  mod_single.NumberOfClusters->setAxisTitle(
1297  "number of clusters in one detector module");
1298  mod_single.NumberOfClusters->getTH1()->StatOverflows(
1299  kTRUE); // over/underflows in Mean calculation
1300  }
1301 
1302  // ClusterPosition
1303  if (moduleswitchclusposon) {
1304  short total_nr_strips = SiStripDetCabling_->nApvPairs(detid) * 2 *
1305  128; // get correct # of avp pairs
1306  hid = hidmanager.createHistoId("ClusterPosition", "det", detid);
1307  mod_single.ClusterPosition =
1308  ibooker.book1D(hid, hid, total_nr_strips, 0.5, total_nr_strips + 0.5);
1309  ibooker.tag(mod_single.ClusterPosition, detid);
1310  mod_single.ClusterPosition->setAxisTitle(
1311  "cluster position [strip number +0.5]");
1312  }
1313 
1314  // ClusterDigiPosition
1316  short total_nr_strips = SiStripDetCabling_->nApvPairs(detid) * 2 *
1317  128; // get correct # of avp pairs
1318  hid = hidmanager.createHistoId("ClusterDigiPosition", "det", detid);
1319  mod_single.ClusterDigiPosition =
1320  ibooker.book1D(hid, hid, total_nr_strips, 0.5, total_nr_strips + 0.5);
1321  ibooker.tag(mod_single.ClusterDigiPosition, detid);
1322  mod_single.ClusterDigiPosition->setAxisTitle(
1323  "digi in cluster position [strip number +0.5]");
1324  }
1325 
1326  // ClusterWidth
1328  hid = hidmanager.createHistoId("ClusterWidth", "det", detid);
1329  mod_single.ClusterWidth = bookME1D("TH1ClusterWidth", hid.c_str(), ibooker);
1330  ibooker.tag(mod_single.ClusterWidth, detid);
1331  mod_single.ClusterWidth->setAxisTitle("cluster width [nr strips]");
1332  }
1333 
1334  // ClusterCharge
1336  hid = hidmanager.createHistoId("ClusterCharge", "det", detid);
1337  mod_single.ClusterCharge =
1338  bookME1D("TH1ClusterCharge", hid.c_str(), ibooker);
1339  ibooker.tag(mod_single.ClusterCharge, detid);
1340  mod_single.ClusterCharge->setAxisTitle("cluster charge [ADC]");
1341  }
1342 
1343  // ClusterNoise
1345  hid = hidmanager.createHistoId("ClusterNoise", "det", detid);
1346  mod_single.ClusterNoise = bookME1D("TH1ClusterNoise", hid.c_str(), ibooker);
1347  ibooker.tag(mod_single.ClusterNoise, detid);
1348  mod_single.ClusterNoise->setAxisTitle("cluster noise");
1349  }
1350 
1351  // ClusterSignalOverNoise
1352  if (moduleswitchclusstonon) {
1353  hid = hidmanager.createHistoId("ClusterSignalOverNoise", "det", detid);
1354  mod_single.ClusterSignalOverNoise =
1355  bookME1D("TH1ClusterStoN", hid.c_str(), ibooker);
1356  ibooker.tag(mod_single.ClusterSignalOverNoise, detid);
1358  "ratio of signal to noise for each cluster");
1359  }
1360 
1361  // ClusterSignalOverNoiseVsPos
1363  hid = hidmanager.createHistoId("ClusterSignalOverNoiseVsPos", "det", detid);
1364  Parameters = conf_.getParameter<edm::ParameterSet>("TH1ClusterStoNVsPos");
1365  mod_single.ClusterSignalOverNoiseVsPos = ibooker.bookProfile(
1366  hid.c_str(), hid.c_str(), Parameters.getParameter<int32_t>("Nbinx"),
1367  Parameters.getParameter<double>("xmin"),
1368  Parameters.getParameter<double>("xmax"),
1369  Parameters.getParameter<int32_t>("Nbiny"),
1370  Parameters.getParameter<double>("ymin"),
1371  Parameters.getParameter<double>("ymax"));
1372  ibooker.tag(mod_single.ClusterSignalOverNoiseVsPos, detid);
1373  mod_single.ClusterSignalOverNoiseVsPos->setAxisTitle("pos");
1374  }
1375 
1376  // ModuleLocalOccupancy
1378  hid = hidmanager.createHistoId("ClusterLocalOccupancy", "det", detid);
1379  mod_single.ModuleLocalOccupancy =
1380  bookME1D("TH1ModuleLocalOccupancy", hid.c_str(), ibooker);
1381  ibooker.tag(mod_single.ModuleLocalOccupancy, detid);
1382  mod_single.ModuleLocalOccupancy->setAxisTitle(
1383  "module local occupancy [% of clusterized strips]");
1384  }
1385 
1386  // NrOfClusterizedStrips
1388  hid = hidmanager.createHistoId("NrOfClusterizedStrips", "det", detid);
1389  mod_single.NrOfClusterizedStrips =
1390  bookME1D("TH1NrOfClusterizedStrips", hid.c_str(), ibooker);
1391  ibooker.tag(mod_single.NrOfClusterizedStrips, detid);
1392  mod_single.NrOfClusterizedStrips->setAxisTitle(
1393  "number of clusterized strips");
1394  }
1395 
1397  hid = hidmanager.createHistoId("ClusterWidths_vs_Amplitudes", "det", detid);
1398  Parameters = conf_.getParameter<edm::ParameterSet>("ClusWidthVsAmpTH2");
1399  int32_t Nbinsx = Parameters.getParameter<int32_t>("Nbinsx");
1400  Nbinsx = Nbinsx / 2; // Without this "rebinning" the job is killed on
1401  // lxplus. We think it's due to the high memory needed
1402  // to create all those histograms.
1403  mod_single.Module_ClusWidthVsAmpTH2 =
1404  ibooker.book2D(hid.c_str(), hid.c_str(), Nbinsx,
1405  Parameters.getParameter<double>("xmin"),
1406  Parameters.getParameter<double>("xmax"),
1407  Parameters.getParameter<int32_t>("Nbinsy"),
1408  Parameters.getParameter<double>("ymin"),
1409  Parameters.getParameter<double>("ymax"));
1410  ibooker.tag(mod_single.Module_ClusWidthVsAmpTH2, detid);
1412  "Amplitudes (integrated ADC counts)", 1);
1413  mod_single.Module_ClusWidthVsAmpTH2->setAxisTitle("Cluster widths", 2);
1414  }
1415 }
1416 //
1417 // -- Create Module Level MEs
1418 //
1420  DQMStore::IBooker& ibooker) {
1421  SiStripHistoId hidmanager;
1422 
1423  LayerMEs layerMEs;
1424  layerMEs.LayerClusterStoN = nullptr;
1425  layerMEs.LayerClusterStoNTrend = nullptr;
1426  layerMEs.LayerClusterCharge = nullptr;
1427  layerMEs.LayerClusterChargeTrend = nullptr;
1428  layerMEs.LayerClusterNoise = nullptr;
1429  layerMEs.LayerClusterNoiseTrend = nullptr;
1430  layerMEs.LayerClusterWidth = nullptr;
1431  layerMEs.LayerClusterWidthTrend = nullptr;
1432  layerMEs.LayerLocalOccupancy = nullptr;
1433  layerMEs.LayerLocalOccupancyTrend = nullptr;
1434  layerMEs.LayerNumberOfClusterProfile = nullptr;
1435  layerMEs.LayerNumberOfClusterTrend = nullptr;
1436  layerMEs.LayerNumberOfClusterPerRingTrend = nullptr;
1437  layerMEs.LayerClusterWidthProfile = nullptr;
1438  layerMEs.LayerClusWidthVsAmpTH2 = nullptr;
1439  layerMEs.LayerClusterPosition = nullptr;
1440 
1441  // Cluster Width
1442  if (layerswitchcluswidthon) {
1443  layerMEs.LayerClusterWidth = bookME1D(
1444  "TH1ClusterWidth",
1445  hidmanager.createHistoLayer("Summary_ClusterWidth", "layer", label, "")
1446  .c_str(),
1447  ibooker);
1448  if (createTrendMEs)
1450  hidmanager.createHistoLayer("Trend_ClusterWidth", "layer", label, "")
1451  .c_str(),
1452  ibooker);
1453  }
1454 
1455  // Cluster Noise
1456  if (layerswitchclusnoiseon) {
1457  layerMEs.LayerClusterNoise = bookME1D(
1458  "TH1ClusterNoise",
1459  hidmanager.createHistoLayer("Summary_ClusterNoise", "layer", label, "")
1460  .c_str(),
1461  ibooker);
1462  if (createTrendMEs)
1464  hidmanager.createHistoLayer("Trend_ClusterNoise", "layer", label, "")
1465  .c_str(),
1466  ibooker);
1467  }
1468 
1469  // Cluster Charge
1471  layerMEs.LayerClusterCharge = bookME1D(
1472  "TH1ClusterCharge",
1473  hidmanager.createHistoLayer("Summary_ClusterCharge", "layer", label, "")
1474  .c_str(),
1475  ibooker);
1476  if (createTrendMEs)
1478  hidmanager.createHistoLayer("Trend_ClusterCharge", "layer", label, "")
1479  .c_str(),
1480  ibooker);
1481  }
1482 
1483  // Cluster StoN
1484  if (layerswitchclusstonon) {
1485  layerMEs.LayerClusterStoN =
1486  bookME1D("TH1ClusterStoN",
1487  hidmanager
1488  .createHistoLayer("Summary_ClusterSignalOverNoise",
1489  "layer", label, "")
1490  .c_str(),
1491  ibooker);
1492  if (createTrendMEs)
1493  layerMEs.LayerClusterStoNTrend =
1494  bookMETrend(hidmanager
1495  .createHistoLayer("Trend_ClusterSignalOverNoise",
1496  "layer", label, "")
1497  .c_str(),
1498  ibooker);
1499  }
1500 
1501  // Cluster Occupancy
1503  layerMEs.LayerLocalOccupancy =
1504  bookME1D("TH1ModuleLocalOccupancy",
1505  hidmanager
1506  .createHistoLayer("Summary_ClusterLocalOccupancy", "layer",
1507  label, "")
1508  .c_str(),
1509  ibooker);
1510  if (createTrendMEs)
1511  layerMEs.LayerLocalOccupancyTrend =
1512  bookMETrend(hidmanager
1513  .createHistoLayer("Trend_ClusterLocalOccupancy",
1514  "layer", label, "")
1515  .c_str(),
1516  ibooker);
1517  }
1518 
1519  // # of Cluster Profile
1521  std::string hid = hidmanager.createHistoLayer("NumberOfClusterProfile",
1522  "layer", label, "");
1523  layerMEs.LayerNumberOfClusterProfile =
1524  ibooker.bookProfile(hid, hid, ndets, 0.5, ndets + 0.5, 21, -0.5, 20.5);
1525  }
1526 
1527  // # of Cluster Trend
1530  hidmanager.createHistoLayer("NumberOfClusterTrend", "layer", label, "")
1531  .c_str(),
1532  ibooker);
1533 
1534  if (label.find("TID") != std::string::npos ||
1535  label.find("TEC") != std::string::npos) {
1537  "NumberOfClusterPerRingVsTrendVar");
1538 
1540  "NumberOfClusterPerRingVsTrendVar",
1541  hidmanager
1542  .createHistoLayer("NumberOfClusterPerRing_vs_TrendVar", "layer",
1543  label, "")
1544  .c_str(),
1545  Parameters.getParameter<int32_t>("Nbinsx"),
1546  Parameters.getParameter<double>("xmin"),
1547  Parameters.getParameter<double>("xmax"),
1548  Parameters.getParameter<int32_t>("Nbinsy"),
1549  Parameters.getParameter<double>("ymin"),
1550  Parameters.getParameter<double>("ymax"), 0, 0, "");
1551  }
1552  }
1553 
1554  // Cluster Width Profile
1556  std::string hid =
1557  hidmanager.createHistoLayer("ClusterWidthProfile", "layer", label, "");
1558  layerMEs.LayerClusterWidthProfile =
1559  ibooker.bookProfile(hid, hid, ndets, 0.5, ndets + 0.5, 20, -0.5, 19.5);
1560  }
1561 
1563  layerMEs.LayerClusWidthVsAmpTH2 = bookME2D(
1564  "ClusWidthVsAmpTH2",
1565  hidmanager
1566  .createHistoLayer("ClusterWidths_vs_Amplitudes", "layer", label, "")
1567  .c_str(),
1568  ibooker);
1569  }
1570 
1571  // Cluster Position
1572  if (layerswitchclusposon) {
1573  std::string hid =
1574  hidmanager.createHistoLayer("ClusterPosition", "layer", label, "");
1575  layerMEs.LayerClusterPosition =
1576  ibooker.book1D(hid, hid, 128 * 6, 0.5, 128 * 6 + 0.5);
1577  }
1578 
1579  LayerMEsMap[label] = layerMEs;
1580 }
1581 //
1582 // -- Create SubDetector MEs
1583 //
1585  DQMStore::IBooker& ibooker) {
1586  SubDetMEs subdetMEs;
1587  subdetMEs.totNClusters = 0;
1588  subdetMEs.SubDetTotClusterTH1 = nullptr;
1589  subdetMEs.SubDetTotClusterProf = nullptr;
1590  subdetMEs.SubDetClusterApvProf = nullptr;
1591  subdetMEs.SubDetClusterApvTH2 = nullptr;
1592  subdetMEs.SubDetClusterDBxCycleProf = nullptr;
1593  subdetMEs.SubDetApvDBxProf2 = nullptr;
1594  subdetMEs.SubDetClusterChargeTH1 = nullptr;
1595  subdetMEs.SubDetClusterWidthTH1 = nullptr;
1596  subdetMEs.SubDetClusWidthVsAmpTH2 = nullptr;
1597  subdetMEs.SubDetNumberOfClusterPerLayerTrend = nullptr;
1598 
1600  // cluster charge
1602  HistoName = "ClusterCharge__" + label;
1603  subdetMEs.SubDetClusterChargeTH1 =
1604  bookME1D("TH1ClusterCharge", HistoName.c_str(), ibooker);
1606  "Cluster charge [ADC counts]");
1607  subdetMEs.SubDetClusterChargeTH1->getTH1()->StatOverflows(
1608  kTRUE); // over/underflows in Mean calculation
1609  }
1610  // cluster width
1612  HistoName = "ClusterWidth__" + label;
1613  subdetMEs.SubDetClusterWidthTH1 =
1614  bookME1D("TH1ClusterWidth", HistoName.c_str(), ibooker);
1615  subdetMEs.SubDetClusterWidthTH1->setAxisTitle("Cluster width [strips]");
1616  subdetMEs.SubDetClusterWidthTH1->getTH1()->StatOverflows(
1617  kTRUE); // over/underflows in Mean calculation
1618  }
1619  // Total Number of Cluster - 1D
1621  HistoName = "TotalNumberOfCluster__" + label;
1622  subdetMEs.SubDetTotClusterTH1 =
1623  bookME1D("TH1TotalNumberOfClusters", HistoName.c_str(), ibooker);
1624  subdetMEs.SubDetTotClusterTH1->setAxisTitle(
1625  "Total number of clusters in subdetector");
1626  subdetMEs.SubDetTotClusterTH1->getTH1()->StatOverflows(
1627  kTRUE); // over/underflows in Mean calculation
1628  }
1629  // Total Number of Cluster vs Time - Profile
1633  : conf_.getParameter<edm::ParameterSet>("Trending");
1634  HistoName = "TotalNumberOfClusterProfile__" + label;
1635  subdetMEs.SubDetTotClusterProf = ibooker.bookProfile(
1636  HistoName, HistoName, Parameters.getParameter<int32_t>("Nbins"),
1637  Parameters.getParameter<double>("xmin"),
1638  Parameters.getParameter<double>("xmax"), 0, 0, "");
1640  Parameters.getParameter<std::string>("xaxis"), 1);
1641  if (subdetMEs.SubDetTotClusterProf->kind() ==
1643  subdetMEs.SubDetTotClusterProf->getTH1()->SetCanExtend(TH1::kAllAxes);
1644 
1645  Parameters = conf_.getParameter<edm::ParameterSet>(
1646  "NumberOfClusterPerLayerTrendVar");
1647  HistoName = "TotalNumberOfClusterPerLayer__" + label;
1649  "NumberOfClusterPerLayerTrendVar", HistoName.c_str(),
1650  Parameters.getParameter<int32_t>("Nbinsx"),
1651  Parameters.getParameter<double>("xmin"),
1652  Parameters.getParameter<double>("xmax"),
1653  Parameters.getParameter<int32_t>("Nbinsy"),
1654  Parameters.getParameter<double>("ymin"),
1655  Parameters.getParameter<double>("ymax"), 0, 0, "");
1656  subdetMEs.SubDetNumberOfClusterPerLayerTrend->setAxisTitle("Lumisection",
1657  1);
1658  subdetMEs.SubDetNumberOfClusterPerLayerTrend->setAxisTitle("Layer Number",
1659  2);
1660  }
1661 
1662  // Total Number of Cluster vs APV cycle - Profile
1665  conf_.getParameter<edm::ParameterSet>("TProfClustersApvCycle");
1666  HistoName = "Cluster_vs_ApvCycle__" + label;
1667  subdetMEs.SubDetClusterApvProf = ibooker.bookProfile(
1668  HistoName, HistoName, Parameters.getParameter<int32_t>("Nbins"),
1669  Parameters.getParameter<double>("xmin"),
1670  Parameters.getParameter<double>("xmax"),
1671  200, // that parameter should not be there !?
1672  Parameters.getParameter<double>("ymin"),
1673  Parameters.getParameter<double>("ymax"), "");
1675  "Apv Cycle (Corrected Absolute Bx % 70)", 1);
1676  }
1677 
1678  // Total Number of Clusters vs ApvCycle - 2D
1681  conf_.getParameter<edm::ParameterSet>("TH2ClustersApvCycle");
1682  HistoName = "Cluster_vs_ApvCycle_2D__" + label;
1683  // Adjusting the scale for 2D histogram
1684  double h2ymax = 9999.0;
1685  double yfact = Parameters.getParameter<double>("yfactor");
1686  if (label.find("TIB") != std::string::npos)
1687  h2ymax = (6984. * 256.) * yfact;
1688  else if (label.find("TID") != std::string::npos)
1689  h2ymax = (2208. * 256.) * yfact;
1690  else if (label.find("TOB") != std::string::npos)
1691  h2ymax = (12906. * 256.) * yfact;
1692  else if (label.find("TEC") != std::string::npos)
1693  h2ymax = (7552. * 2. * 256.) * yfact;
1694 
1695  subdetMEs.SubDetClusterApvTH2 = ibooker.book2D(
1696  HistoName, HistoName, Parameters.getParameter<int32_t>("Nbinsx"),
1697  Parameters.getParameter<double>("xmin"),
1698  Parameters.getParameter<double>("xmax"),
1699  Parameters.getParameter<int32_t>("Nbinsy"),
1700  Parameters.getParameter<double>("ymin"), h2ymax);
1701  subdetMEs.SubDetClusterApvTH2->setAxisTitle(
1702  "Apv Cycle (Corrected Absolute Bx % 70))", 1);
1703  subdetMEs.SubDetClusterApvTH2->setAxisTitle("Total # of Clusters", 2);
1704  }
1705 
1706  // Cluster widths vs amplitudes - 2D
1709  conf_.getParameter<edm::ParameterSet>("ClusWidthVsAmpTH2");
1710  HistoName = "ClusterWidths_vs_Amplitudes__" + label;
1711  subdetMEs.SubDetClusWidthVsAmpTH2 = ibooker.book2D(
1712  HistoName, HistoName, Parameters.getParameter<int32_t>("Nbinsx"),
1713  Parameters.getParameter<double>("xmin"),
1714  Parameters.getParameter<double>("xmax"),
1715  Parameters.getParameter<int32_t>("Nbinsy"),
1716  Parameters.getParameter<double>("ymin"),
1717  Parameters.getParameter<double>("ymax"));
1719  "Amplitudes (integrated ADC counts)", 1);
1720  subdetMEs.SubDetClusWidthVsAmpTH2->setAxisTitle("Cluster widths", 2);
1721  }
1722 
1723  // Total Number of Cluster vs DeltaBxCycle - Profile
1726  conf_.getParameter<edm::ParameterSet>("TProfClustersVsDBxCycle");
1727  HistoName = "Cluster_vs_DeltaBxCycle__" + label;
1728  subdetMEs.SubDetClusterDBxCycleProf = ibooker.bookProfile(
1729  HistoName, HistoName, Parameters.getParameter<int32_t>("Nbins"),
1730  Parameters.getParameter<double>("xmin"),
1731  Parameters.getParameter<double>("xmax"),
1732  200, // that parameter should not be there !?
1733  Parameters.getParameter<double>("ymin"),
1734  Parameters.getParameter<double>("ymax"), "");
1736  "Delta Bunch Crossing Cycle", 1);
1737  }
1738  // DeltaBx vs ApvCycle - 2DProfile
1741  conf_.getParameter<edm::ParameterSet>("TProf2ApvCycleVsDBx");
1742  HistoName = "DeltaBx_vs_ApvCycle__" + label;
1743  subdetMEs.SubDetApvDBxProf2 = ibooker.bookProfile2D(
1744  HistoName, HistoName, Parameters.getParameter<int32_t>("Nbinsx"),
1745  Parameters.getParameter<double>("xmin"),
1746  Parameters.getParameter<double>("xmax"),
1747  Parameters.getParameter<int32_t>("Nbinsy"),
1748  Parameters.getParameter<double>("ymin"),
1749  Parameters.getParameter<double>("ymax"),
1750  Parameters.getParameter<double>("zmin"),
1751  Parameters.getParameter<double>("zmax"), "");
1752  subdetMEs.SubDetApvDBxProf2->setAxisTitle(
1753  "APV Cycle (Corrected Absolute Bx % 70)", 1);
1754  subdetMEs.SubDetApvDBxProf2->setAxisTitle("Delta Bunch Crossing Cycle", 2);
1755  }
1756  SubDetMEsMap[label] = subdetMEs;
1757 }
1758 
1759 //
1760 // -- Fill Module Level Histograms
1761 //
1763  ClusterProperties& cluster) {
1764  if (moduleswitchclusposon &&
1765  (mod_mes.ClusterPosition)) // position of cluster
1766  (mod_mes.ClusterPosition)->Fill(cluster.position);
1767 
1768  // position of digis in cluster
1770  for (int ipos = cluster.start + 1; ipos <= cluster.start + cluster.width;
1771  ipos++) {
1772  (mod_mes.ClusterDigiPosition)->Fill(ipos);
1773  }
1774  }
1775 
1776  if (moduleswitchcluswidthon && (mod_mes.ClusterWidth)) // width of cluster
1777  (mod_mes.ClusterWidth)->Fill(static_cast<float>(cluster.width));
1778 
1779  if (moduleswitchclusstonon &&
1780  (mod_mes.ClusterSignalOverNoise)) { // SignalToNoise
1781  if (cluster.noise > 0)
1782  (mod_mes.ClusterSignalOverNoise)->Fill(cluster.charge / cluster.noise);
1783  }
1784 
1786  (mod_mes.ClusterSignalOverNoiseVsPos)) { // SignalToNoise
1787  if (cluster.noise > 0)
1788  (mod_mes.ClusterSignalOverNoiseVsPos)
1789  ->Fill(cluster.position, cluster.charge / cluster.noise);
1790  }
1791 
1792  if (moduleswitchclusnoiseon && (mod_mes.ClusterNoise)) // Noise
1793  (mod_mes.ClusterNoise)->Fill(cluster.noise);
1794 
1795  if (moduleswitchcluschargeon && (mod_mes.ClusterCharge)) // charge of cluster
1796  (mod_mes.ClusterCharge)->Fill(cluster.charge);
1797 
1799  (mod_mes.Module_ClusWidthVsAmpTH2)->Fill(cluster.charge, cluster.width);
1800 }
1801 //
1802 // -- Fill Layer Level MEs
1803 //
1805  ClusterProperties& cluster) {
1806  if (layerswitchclusstonon) {
1807  fillME(layerMEs.LayerClusterStoN, cluster.charge / cluster.noise);
1808  if (createTrendMEs) {
1810  cluster.charge / cluster.noise);
1811  }
1812  }
1813 
1815  fillME(layerMEs.LayerClusterCharge, cluster.charge);
1816  if (createTrendMEs) {
1817  fillME(layerMEs.LayerClusterChargeTrend, trendVar, cluster.charge);
1818  }
1819  }
1820 
1821  if (layerswitchclusnoiseon) {
1822  fillME(layerMEs.LayerClusterNoise, cluster.noise);
1823  if (createTrendMEs) {
1824  fillME(layerMEs.LayerClusterNoiseTrend, trendVar, cluster.noise);
1825  }
1826  }
1827 
1828  if (layerswitchcluswidthon) {
1829  fillME(layerMEs.LayerClusterWidth, cluster.width);
1830  if (createTrendMEs) {
1831  fillME(layerMEs.LayerClusterWidthTrend, trendVar, cluster.width);
1832  }
1833  }
1834 
1836  fillME(layerMEs.LayerClusWidthVsAmpTH2, cluster.charge, cluster.width);
1837  }
1838 
1839  if (layerswitchclusposon) {
1840  fillME(layerMEs.LayerClusterPosition, cluster.position);
1841  }
1842 }
1843 //------------------------------------------------------------------------------------------
1845  DQMStore::IBooker& ibooker) {
1846  edm::ParameterSet ParametersTrend =
1848  : conf_.getParameter<edm::ParameterSet>("Trending");
1849  MonitorElement* me = ibooker.bookProfile(
1850  HistoName, HistoName, ParametersTrend.getParameter<int32_t>("Nbins"),
1851  ParametersTrend.getParameter<double>("xmin"),
1852  ParametersTrend.getParameter<double>("xmax"), 0, 0, "");
1853  if (!me) return me;
1854  me->setAxisTitle(ParametersTrend.getParameter<std::string>("xaxis"), 1);
1856  me->getTH1()->SetCanExtend(TH1::kAllAxes);
1857  return me;
1858 }
1859 
1860 //------------------------------------------------------------------------------------------
1861 MonitorElement* SiStripMonitorCluster::bookME1D(const char* ParameterSetLabel,
1862  const char* HistoName,
1863  DQMStore::IBooker& ibooker) {
1864  Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
1865  return ibooker.book1D(HistoName, HistoName,
1866  Parameters.getParameter<int32_t>("Nbinx"),
1867  Parameters.getParameter<double>("xmin"),
1868  Parameters.getParameter<double>("xmax"));
1869 }
1870 
1871 //------------------------------------------------------------------------------------------
1872 MonitorElement* SiStripMonitorCluster::bookME2D(const char* ParameterSetLabel,
1873  const char* HistoName,
1874  DQMStore::IBooker& ibooker) {
1875  Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
1876  return ibooker.book2D(HistoName, HistoName,
1877  Parameters.getParameter<int32_t>("Nbinsx"),
1878  Parameters.getParameter<double>("xmin"),
1879  Parameters.getParameter<double>("xmax"),
1880  Parameters.getParameter<int32_t>("Nbinsy"),
1881  Parameters.getParameter<double>("ymin"),
1882  Parameters.getParameter<double>("ymax"));
1883 }
1884 
1885 int SiStripMonitorCluster::FindRegion(int nstrip, int npix) {
1886  double kplus = k0 * (1 + dk0 / 100);
1887  double kminus = k0 * (1 - dk0 / 100);
1888  int region = 0;
1889 
1890  if (nstrip != 0 && npix >= (nstrip * kminus - q0) &&
1891  npix <= (nstrip * kplus + q0))
1892  region = 1;
1893  else if (nstrip != 0 && npix < (nstrip * kminus - q0) && nstrip <= maxClus)
1894  region = 2;
1895  else if (nstrip != 0 && npix < (nstrip * kminus - q0) && nstrip > maxClus)
1896  region = 3;
1897  else if (nstrip != 0 && npix > (nstrip * kplus + q0))
1898  region = 4;
1899  else if (npix > minPix && nstrip == 0)
1900  region = 5;
1901  return region;
1902 }
RunNumber_t run() const
Definition: EventID.h:39
MonitorElement * GlobalABXTH1_CSCP
void ResetModuleMEs(uint32_t idet)
T getParameter(std::string const &) const
MonitorElement * bookME1D(const char *ParameterSetLabel, const char *HistoName, DQMStore::IBooker &ibooker)
int FindRegion(int nstrip, int npixel)
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
void getTIBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tibDetRawIds, const TrackerTopology *trackerTopology, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t int_ext=0, uint32_t string=0)
MonitorElement * NumberOfPixelClus_vs_BX
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const
void setSiStripFolderName(std::string name)
long long deltaBX(const unsigned int ev2, const unsigned int ev1) const
MonitorElement * PixVsStripMultiplicityRegions
std::pair< const std::string, const char * > getSubDetFolderAndTag(const uint32_t &detid, const TrackerTopology *tTopo)
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:160
MonitorElement * GlobalTH2MainDiagonalPosition_vs_BX
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
MonitorElement * GlobalCStripVsCpix
bool IsStripBad(const uint32_t &detid, const short &strip) const
TH1 * getTH1() const
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
long long absoluteBX(const unsigned int ev1) const
void getTIDDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tidDetRawIds, const TrackerTopology *trackerTopology, uint32_t side=0, uint32_t wheel=0, uint32_t ring=0, uint32_t ster=0)
edm::ESHandle< SiStripDetCabling > SiStripDetCabling_
MonitorElement * ClusterSignalOverNoiseVsPos
void setLayerFolder(uint32_t rawdetid, const TrackerTopology *tTopo, int32_t layer=0, bool ring_flag=false)
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
MonitorElement * StripNoise2Cycle
data_type const * const_iterator
Definition: DetSetNew.h:30
void createLayerMEs(std::string label, int ndets, DQMStore::IBooker &ibooker)
void getTECDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tecDetRawIds, const TrackerTopology *trackerTopology, 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)
std::map< std::string, LayerMEs > LayerMEsMap
void analyze(const edm::Event &, const edm::EventSetup &) override
bool isRealData() const
Definition: EventBase.h:64
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void Fill(long long x)
MonitorElement * NumberOfPixelClus
void setDetectorFolder(uint32_t rawdetid, const TrackerTopology *tTopo)
unsigned long long m_cacheID_
void createSubDetMEs(std::string label, DQMStore::IBooker &ibooker)
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
std::map< uint32_t, ModMEs > ModuleMEsMap
bool getStatus(edm::Event const &e, edm::EventSetup const &eSetup)
static float getNoise(uint16_t strip, const Range &range)
Definition: SiStripNoises.h:74
int iEvent
Definition: GenABIO.cc:230
void createMEs(const edm::EventSetup &es, DQMStore::IBooker &ibooker)
std::map< std::string, std::string > SubDetPhasePartMap
MonitorElement * GlobalApvCycleDBxTH2
const int getPhase(const std::string partition) const
vector< ParameterSet > Parameters
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:72
MonitorElement * bookProfile2D(Args &&...args)
Definition: DQMStore.h:166
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
GenericTriggerEventFlag * genTriggerEventFlagPixelDCSfilter_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
T sqrt(T t)
Definition: SSEVec.h:18
bool accept(const edm::Event &event, const edm::EventSetup &setup)
To be called from analyze/filter() methods.
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
bool empty() const
Definition: DetSetNew.h:90
data_type const * data(size_t cell) const
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
void tag(MonitorElement *, unsigned int)
Definition: DQMStore.cc:291
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::pair< ContainerIterator, ContainerIterator > Range
MonitorElement * bookMETrend(const char *, DQMStore::IBooker &ibooker)
int orbitNumber() const
Definition: EventBase.h:67
MonitorElement * NumberOfStripClus
std::string getSubdetid(uint32_t id, const TrackerTopology *tTopo, bool flag_ring)
void Reset()
reset ME (ie. contents, errors, etc)
MonitorElement * GlobalMainDiagonalPosition_vs_BX
bool isValid() const
Definition: HandleBase.h:74
MonitorElement * NumberOfStripClus_vs_BX
edm::EDGetTokenT< EventWithHistory > historyProducerToken_
MonitorElement * ClusWidthVsAmpTH2
MonitorElement * GlobalMainDiagonalPosition
MonitorElement * bookME2D(const char *ParameterSetLabel, const char *HistoName, DQMStore::IBooker &ibooker)
SiStripDCSStatus * dcsStatus_
bool failedToGet() const
Definition: HandleBase.h:78
GenericTriggerEventFlag * genTriggerEventFlagBPTXfilter_
MonitorElement * LayerNumberOfClusterPerRingTrend
void fillME(MonitorElement *ME, float value1)
SiStripMonitorCluster(const edm::ParameterSet &)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:279
T const * product() const
Definition: Handle.h:81
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:136
std::string createHistoId(std::string description, std::string id_type, uint32_t component_id)
const T & get() const
Definition: EventSetup.h:59
def uint(string)
MonitorElement * NumberOfFEDClus
std::string HistoName
MonitorElement * StripNoise3Cycle
std::pair< std::string, int32_t > GetSubDetAndLayer(const uint32_t &detid, const TrackerTopology *tTopo, bool ring_flag=false)
void createModuleMEs(ModMEs &mod_single, uint32_t detid, DQMStore::IBooker &ibooker)
long long deltaBXinCycle(const unsigned int ev2, const unsigned int ev1, const int bx0) const
const uint16_t nApvPairs(uint32_t det_id) const
edm::EventID id() const
Definition: EventBase.h:60
const Range getRange(const uint32_t detID) const
iterator end()
Definition: DetSetNew.h:70
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > clusterProducerPixToken_
std::map< std::string, SubDetMEs > SubDetMEsMap
const Range getRange(const uint32_t detID) const
void fillLayerMEs(LayerMEs &, ClusterProperties &cluster)
std::pair< ContainerIterator, ContainerIterator > Range
std::unique_ptr< TkHistoMap > tkmapcluster
unsigned int _orbit
Definition: TinyEvent.h:88
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusterProducerStripToken_
void initRun(const edm::Run &run, const edm::EventSetup &setup)
To be called from beginRun() methods.
void getTOBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tobDetRawIds, const TrackerTopology *trackerTopology, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t rod=0)
std::string createHistoLayer(std::string description, std::string id_type, std::string path, std::string flag)
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:50
size_type size() const
Definition: DetSetNew.h:87
std::map< std::string, std::vector< uint32_t > > LayerDetMap
std::unique_ptr< TkHistoMap > tkmapclusterch
MonitorElement * GlobalDBxCycleTH1
edm::EDGetTokenT< APVCyclePhaseCollection > apvPhaseProducerToken_
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
GenericTriggerEventFlag * genTriggerEventFlagStripDCSfilter_
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
T const * product() const
Definition: ESHandle.h:86
MonitorElement * NclusVsCycleTimeProf2D
Kind kind() const
Get the type of the monitor element.
void fillModuleMEs(ModMEs &mod_mes, ClusterProperties &cluster)
MonitorElement * SubDetNumberOfClusterPerLayerTrend
Definition: Run.h:43
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:70
int size() const
iterator begin()
Definition: DetSetNew.h:67