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 
34 
37 
40 
41 #include <iostream>
42 #include "TMath.h"
43 
44 //--------------------------------------------------------------------------------------------
46  : conf_(iConfig),
47  show_mechanical_structure_view(true),
48  show_readout_view(false),
49  show_control_view(false),
50  select_all_detectors(false),
51  reset_each_run(false),
52  m_cacheID_(0)
53 // , genTriggerEventFlag_(new GenericTriggerEventFlag(iConfig,
54 // consumesCollector()))
55 {
56  // initialize
57  passBPTXfilter_ = true;
58 
59  // initialize GenericTriggerEventFlag by specific configuration
60  // in this way, one can set specific selections for different MEs
62  new GenericTriggerEventFlag(iConfig.getParameter<edm::ParameterSet>("BPTXfilter"), consumesCollector(), *this);
64  iConfig.getParameter<edm::ParameterSet>("PixelDCSfilter"), consumesCollector(), *this);
66  iConfig.getParameter<edm::ParameterSet>("StripDCSfilter"), consumesCollector(), *this);
67 
68  firstEvent = -1;
69  eventNb = 0;
70 
71  // Detector Partitions
72  SubDetPhasePartMap["TIB"] = "TI";
73  SubDetPhasePartMap["TID__MINUS"] = "TI";
74  SubDetPhasePartMap["TID__PLUS"] = "TI";
75  SubDetPhasePartMap["TOB"] = "TO";
76  SubDetPhasePartMap["TEC__MINUS"] = "TM";
77  SubDetPhasePartMap["TEC__PLUS"] = "TP";
78 
79  // get on/off option for every cluster from cfi
80  edm::ParameterSet ParametersnClusters = conf_.getParameter<edm::ParameterSet>("TH1nClusters");
81  layerswitchncluson = ParametersnClusters.getParameter<bool>("layerswitchon");
82  moduleswitchncluson = ParametersnClusters.getParameter<bool>("moduleswitchon");
83 
84  edm::ParameterSet ParametersClusterCharge = conf_.getParameter<edm::ParameterSet>("TH1ClusterCharge");
85  layerswitchcluschargeon = ParametersClusterCharge.getParameter<bool>("layerswitchon");
86  moduleswitchcluschargeon = ParametersClusterCharge.getParameter<bool>("moduleswitchon");
87  subdetswitchcluschargeon = ParametersClusterCharge.getParameter<bool>("subdetswitchon");
88 
89  edm::ParameterSet ParametersClusterStoN = conf_.getParameter<edm::ParameterSet>("TH1ClusterStoN");
90  layerswitchclusstonon = ParametersClusterStoN.getParameter<bool>("layerswitchon");
91  moduleswitchclusstonon = ParametersClusterStoN.getParameter<bool>("moduleswitchon");
92 
93  edm::ParameterSet ParametersClusterStoNVsPos = conf_.getParameter<edm::ParameterSet>("TH1ClusterStoNVsPos");
94  layerswitchclusstonVsposon = ParametersClusterStoNVsPos.getParameter<bool>("layerswitchon");
95  moduleswitchclusstonVsposon = ParametersClusterStoNVsPos.getParameter<bool>("moduleswitchon");
96 
97  edm::ParameterSet ParametersClusterPos = conf_.getParameter<edm::ParameterSet>("TH1ClusterPos");
98  layerswitchclusposon = ParametersClusterPos.getParameter<bool>("layerswitchon");
99  moduleswitchclusposon = ParametersClusterPos.getParameter<bool>("moduleswitchon");
100 
101  edm::ParameterSet ParametersClusterDigiPos = conf_.getParameter<edm::ParameterSet>("TH1ClusterDigiPos");
102  layerswitchclusdigiposon = ParametersClusterDigiPos.getParameter<bool>("layerswitchon");
103  moduleswitchclusdigiposon = ParametersClusterDigiPos.getParameter<bool>("moduleswitchon");
104 
105  edm::ParameterSet ParametersClusterNoise = conf_.getParameter<edm::ParameterSet>("TH1ClusterNoise");
106  layerswitchclusnoiseon = ParametersClusterNoise.getParameter<bool>("layerswitchon");
107  moduleswitchclusnoiseon = ParametersClusterNoise.getParameter<bool>("moduleswitchon");
108 
109  edm::ParameterSet ParametersClusterWidth = conf_.getParameter<edm::ParameterSet>("TH1ClusterWidth");
110  layerswitchcluswidthon = ParametersClusterWidth.getParameter<bool>("layerswitchon");
111  moduleswitchcluswidthon = ParametersClusterWidth.getParameter<bool>("moduleswitchon");
112  subdetswitchcluswidthon = ParametersClusterWidth.getParameter<bool>("subdetswitchon");
113 
114  edm::ParameterSet ParametersModuleLocalOccupancy = conf_.getParameter<edm::ParameterSet>("TH1ModuleLocalOccupancy");
115  layerswitchlocaloccupancy = ParametersModuleLocalOccupancy.getParameter<bool>("layerswitchon");
116  moduleswitchlocaloccupancy = ParametersModuleLocalOccupancy.getParameter<bool>("moduleswitchon");
117 
118  edm::ParameterSet ParametersNrOfClusterizedStrips = conf_.getParameter<edm::ParameterSet>("TH1NrOfClusterizedStrips");
119  layerswitchnrclusterizedstrip = ParametersNrOfClusterizedStrips.getParameter<bool>("layerswitchon");
120  moduleswitchnrclusterizedstrip = ParametersNrOfClusterizedStrips.getParameter<bool>("moduleswitchon");
121 
122  edm::ParameterSet ParametersClusterProf = conf_.getParameter<edm::ParameterSet>("TProfNumberOfCluster");
123  layerswitchnumclusterprofon = ParametersClusterProf.getParameter<bool>("layerswitchon");
124 
125  edm::ParameterSet ParametersClusterWidthProf = conf_.getParameter<edm::ParameterSet>("TProfClusterWidth");
126  layerswitchclusterwidthprofon = ParametersClusterWidthProf.getParameter<bool>("layerswitchon");
127 
128  edm::ParameterSet ParametersTotClusterProf = conf_.getParameter<edm::ParameterSet>("TProfTotalNumberOfClusters");
129  subdetswitchtotclusprofon = ParametersTotClusterProf.getParameter<bool>("subdetswitchon");
130 
131  edm::ParameterSet ParametersTotClusterTH1 = conf_.getParameter<edm::ParameterSet>("TH1TotalNumberOfClusters");
132  subdetswitchtotclusth1on = ParametersTotClusterTH1.getParameter<bool>("subdetswitchon");
133 
134  edm::ParameterSet ParametersClusterApvProf = conf_.getParameter<edm::ParameterSet>("TProfClustersApvCycle");
135  subdetswitchapvcycleprofon = ParametersClusterApvProf.getParameter<bool>("subdetswitchon");
136 
137  edm::ParameterSet ParametersClustersApvTH2 = conf_.getParameter<edm::ParameterSet>("TH2ClustersApvCycle");
138  subdetswitchapvcycleth2on = ParametersClustersApvTH2.getParameter<bool>("subdetswitchon");
139 
140  edm::ParameterSet ParametersApvCycleDBxProf2 = conf_.getParameter<edm::ParameterSet>("TProf2ApvCycleVsDBx");
141  subdetswitchapvcycledbxprof2on = ParametersApvCycleDBxProf2.getParameter<bool>("subdetswitchon");
142 
143  edm::ParameterSet ParametersDBxCycleProf = conf_.getParameter<edm::ParameterSet>("TProfClustersVsDBxCycle");
144  subdetswitchdbxcycleprofon = ParametersDBxCycleProf.getParameter<bool>("subdetswitchon");
145 
146  edm::ParameterSet ParametersCStripVsCPix = conf_.getParameter<edm::ParameterSet>("TH2CStripVsCpixel");
147  globalswitchcstripvscpix = ParametersCStripVsCPix.getParameter<bool>("globalswitchon");
148 
149  edm::ParameterSet ParametersMultiplicityRegionsTH1 = conf_.getParameter<edm::ParameterSet>("TH1MultiplicityRegions");
150  globalswitchMultiRegions = ParametersMultiplicityRegionsTH1.getParameter<bool>("globalswitchon");
151 
152  edm::ParameterSet ParametersApvCycleVsDBxGlobalTH2 = conf_.getParameter<edm::ParameterSet>("TH2ApvCycleVsDBxGlobal");
153  globalswitchapvcycledbxth2on = ParametersApvCycleVsDBxGlobalTH2.getParameter<bool>("globalswitchon");
154 
155  edm::ParameterSet ParametersNoiseStrip2ApvCycle = conf_.getParameter<edm::ParameterSet>("TH1StripNoise2ApvCycle");
156  globalswitchstripnoise2apvcycle = ParametersNoiseStrip2ApvCycle.getParameter<bool>("globalswitchon");
157 
158  edm::ParameterSet ParametersNoiseStrip3ApvCycle = conf_.getParameter<edm::ParameterSet>("TH1StripNoise3ApvCycle");
159  globalswitchstripnoise3apvcycle = ParametersNoiseStrip3ApvCycle.getParameter<bool>("globalswitchon");
160 
161  edm::ParameterSet ParametersMainDiagonalPosition = conf_.getParameter<edm::ParameterSet>("TH1MainDiagonalPosition");
162  globalswitchmaindiagonalposition = ParametersMainDiagonalPosition.getParameter<bool>("globalswitchon");
163 
164  edm::ParameterSet ClusterMultiplicityRegions = conf_.getParameter<edm::ParameterSet>("MultiplicityRegions");
165  k0 = ClusterMultiplicityRegions.getParameter<double>("k0");
166  q0 = ClusterMultiplicityRegions.getParameter<double>("q0");
167  dk0 = ClusterMultiplicityRegions.getParameter<double>("dk0");
168  maxClus = ClusterMultiplicityRegions.getParameter<double>("MaxClus");
169  minPix = ClusterMultiplicityRegions.getParameter<double>("MinPix");
170 
171  edm::ParameterSet ParametersNclusVsCycleTimeProf2D = conf_.getParameter<edm::ParameterSet>("NclusVsCycleTimeProf2D");
172  globalswitchnclusvscycletimeprof2don = ParametersNclusVsCycleTimeProf2D.getParameter<bool>("globalswitchon");
173 
174  edm::ParameterSet ParametersFEDCluster = conf_.getParameter<edm::ParameterSet>("TProfNClustersFED");
175  globalswitchFEDCluster = ParametersFEDCluster.getParameter<bool>("globalswitchon");
176 
177  edm::ParameterSet ParametersClusWidthVsAmpTH2 = conf_.getParameter<edm::ParameterSet>("ClusWidthVsAmpTH2");
178  clusterWidth_vs_amplitude_on = ParametersClusWidthVsAmpTH2.getParameter<bool>("globalswitchon");
179  layer_clusterWidth_vs_amplitude_on = ParametersClusWidthVsAmpTH2.getParameter<bool>("layerswitchon");
180  subdet_clusterWidth_vs_amplitude_on = ParametersClusWidthVsAmpTH2.getParameter<bool>("subdetswitchon");
181  module_clusterWidth_vs_amplitude_on = ParametersClusWidthVsAmpTH2.getParameter<bool>("moduleswitchon");
182 
183  clustertkhistomapon = conf_.getParameter<bool>("TkHistoMap_On");
184  clusterchtkhistomapon = conf_.getParameter<bool>("ClusterChTkHistoMap_On");
185  createTrendMEs = conf_.getParameter<bool>("CreateTrendMEs");
186  trendVs10Ls_ = conf_.getParameter<bool>("TrendVs10LS");
187  Mod_On_ = conf_.getParameter<bool>("Mod_On");
188  ClusterHisto_ = conf_.getParameter<bool>("ClusterHisto");
189 
190  topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
191 
192  // Poducer name of input StripClusterCollection
194  consumes<edmNew::DetSetVector<SiStripCluster> >(conf_.getParameter<edm::InputTag>("ClusterProducerStrip"));
196  consumes<edmNew::DetSetVector<SiPixelCluster> >(conf_.getParameter<edm::InputTag>("ClusterProducerPix"));
197  /*
198  clusterProducerStrip_ =
199  conf_.getParameter<edm::InputTag>("ClusterProducerStrip"); clusterProducerPix_
200  = conf_.getParameter<edm::InputTag>("ClusterProducerPix");
201  */
202  // SiStrip Quality Label
203  qualityLabel_ = conf_.getParameter<std::string>("StripQualityLabel");
204  // cluster quality conditions
205  edm::ParameterSet cluster_condition = conf_.getParameter<edm::ParameterSet>("ClusterConditions");
206  applyClusterQuality_ = cluster_condition.getParameter<bool>("On");
207  sToNLowerLimit_ = cluster_condition.getParameter<double>("minStoN");
208  sToNUpperLimit_ = cluster_condition.getParameter<double>("maxStoN");
209  widthLowerLimit_ = cluster_condition.getParameter<double>("minWidth");
210  widthUpperLimit_ = cluster_condition.getParameter<double>("maxWidth");
211 
212  // Event History Producer
213  // historyProducer_ = conf_.getParameter<edm::InputTag>("HistoryProducer");
214  historyProducerToken_ = consumes<EventWithHistory>(conf_.getParameter<edm::InputTag>("HistoryProducer"));
215  // Apv Phase Producer
216  // apvPhaseProducer_ = conf_.getParameter<edm::InputTag>("ApvPhaseProducer");
217  apvPhaseProducerToken_ = consumes<APVCyclePhaseCollection>(conf_.getParameter<edm::InputTag>("ApvPhaseProducer"));
218  // Create DCS Status
219  bool checkDCS = conf_.getParameter<bool>("UseDCSFiltering");
220  if (checkDCS)
222  else
223  dcsStatus_ = nullptr;
224 }
225 
227  if (dcsStatus_)
228  delete dcsStatus_;
235 }
236 
237 //--------------------------------------------------------------------------------------------
239  // Initialize the GenericTriggerEventFlag
246 }
247 
248 //--------------------------------------------------------------------------------------------
251  // Retrieve tracker topology from geometry
252  edm::ESHandle<TrackerTopology> tTopoHandle;
253  es.get<TrackerTopologyRcd>().get(tTopoHandle);
254  const TrackerTopology* const tTopo = tTopoHandle.product();
255  edm::ESHandle<TkDetMap> tkDetMapHandle;
256  es.get<TrackerTopologyRcd>().get(tkDetMapHandle);
257  const TkDetMap* tkDetMap = tkDetMapHandle.product();
258 
259  // take from eventSetup the SiStripDetCabling object - here will use
260  // SiStripDetControl later on
262 
263  // get list of active detectors from SiStripDetCabling
264  std::vector<uint32_t> activeDets;
266 
267  SiStripFolderOrganizer folder_organizer;
268  folder_organizer.setSiStripFolderName(topFolderName_);
269  folder_organizer.setSiStripFolder();
270 
271  // Create TkHistoMap for Cluster
272  if (clustertkhistomapon) {
273  // std::cout << "[SiStripMonitorCluster::createMEs] topFolderName_: "
274  // << topFolderName_ << " ";
275  if ((topFolderName_ == "SiStrip") or (std::string::npos != topFolderName_.find("HLT")))
276  tkmapcluster =
277  std::make_unique<TkHistoMap>(tkDetMap, ibooker, topFolderName_, "TkHMap_NumberOfCluster", 0., true);
278  else
279  tkmapcluster = std::make_unique<TkHistoMap>(
280  tkDetMap, ibooker, topFolderName_ + "/TkHistoMap", "TkHMap_NumberOfCluster", 0., false);
281  }
282  if (clusterchtkhistomapon) {
283  if ((topFolderName_ == "SiStrip") or (std::string::npos != topFolderName_.find("HLT")))
285  std::make_unique<TkHistoMap>(tkDetMap, ibooker, topFolderName_, "TkHMap_ClusterCharge", 0., true);
286  else
287  tkmapclusterch = std::make_unique<TkHistoMap>(
288  tkDetMap, ibooker, topFolderName_ + "/TkHistoMap", "TkHMap_ClusterCharge", 0., false);
289  }
290 
291  // loop over detectors and book MEs
292  edm::LogInfo("SiStripTkDQM|SiStripMonitorCluster") << "nr. of activeDets: " << activeDets.size();
293  for (std::vector<uint32_t>::iterator detid_iterator = activeDets.begin(); detid_iterator != activeDets.end();
294  detid_iterator++) {
295  uint32_t detid = (*detid_iterator);
296  // remove any eventual zero elements - there should be none, but just in
297  // case
298  if (detid == 0) {
299  activeDets.erase(detid_iterator);
300  continue;
301  }
302 
303  if (Mod_On_) {
304  ModMEs mod_single;
305  // set appropriate folder using SiStripFolderOrganizer
306  folder_organizer.setDetectorFolder(detid, tTopo); // pass the detid to this method
307  if (reset_each_run)
308  ResetModuleMEs(detid);
309  createModuleMEs(mod_single, detid, ibooker);
310  // append to ModuleMEsMap
311  ModuleMEsMap.insert(std::make_pair(detid, mod_single));
312  }
313 
314  // Create Layer Level MEs if they are not created already
315  std::pair<std::string, int32_t> det_layer_pair = folder_organizer.GetSubDetAndLayer(detid, tTopo);
316  SiStripHistoId hidmanager;
317  std::string label = hidmanager.getSubdetid(detid, tTopo, false);
318 
319  std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(label);
320  if (iLayerME == LayerMEsMap.end()) {
321  // get detids for the layer
322  int32_t lnumber = det_layer_pair.second;
323  std::vector<uint32_t> layerDetIds;
324  if (det_layer_pair.first == "TIB") {
325  SiStripSubStructure::getTIBDetectors(activeDets, layerDetIds, tTopo, lnumber, 0, 0, 0);
326  } else if (det_layer_pair.first == "TOB") {
327  SiStripSubStructure::getTOBDetectors(activeDets, layerDetIds, tTopo, lnumber, 0, 0);
328  } else if (det_layer_pair.first == "TID" && lnumber > 0) {
329  SiStripSubStructure::getTIDDetectors(activeDets, layerDetIds, tTopo, 2, std::abs(lnumber), 0, 0);
330  } else if (det_layer_pair.first == "TID" && lnumber < 0) {
331  SiStripSubStructure::getTIDDetectors(activeDets, layerDetIds, tTopo, 1, std::abs(lnumber), 0, 0);
332  } else if (det_layer_pair.first == "TEC" && lnumber > 0) {
333  SiStripSubStructure::getTECDetectors(activeDets, layerDetIds, tTopo, 2, std::abs(lnumber), 0, 0, 0, 0);
334  } else if (det_layer_pair.first == "TEC" && lnumber < 0) {
335  SiStripSubStructure::getTECDetectors(activeDets, layerDetIds, tTopo, 1, std::abs(lnumber), 0, 0, 0, 0);
336  }
337  LayerDetMap[label] = layerDetIds;
338 
339  // book Layer MEs
340  folder_organizer.setLayerFolder(detid, tTopo, det_layer_pair.second);
341  createLayerMEs(label, layerDetIds.size(), ibooker);
342  }
343  // book sub-detector plots
344  auto sdet_pair = folder_organizer.getSubDetFolderAndTag(detid, tTopo);
345  if (SubDetMEsMap.find(sdet_pair.second) == SubDetMEsMap.end()) {
346  ibooker.setCurrentFolder(sdet_pair.first);
347 
348  createSubDetMEs(sdet_pair.second, ibooker);
349  }
350  } // end of loop over detectors
351 
352  // Create Global Histogram
354  ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
355  edm::ParameterSet GlobalTH2Parameters = conf_.getParameter<edm::ParameterSet>("TH2ApvCycleVsDBxGlobal");
356  std::string HistoName = "DeltaBx_vs_ApvCycle";
357  GlobalApvCycleDBxTH2 = ibooker.book2D(HistoName,
358  HistoName,
359  GlobalTH2Parameters.getParameter<int32_t>("Nbinsx"),
360  GlobalTH2Parameters.getParameter<double>("xmin"),
361  GlobalTH2Parameters.getParameter<double>("xmax"),
362  GlobalTH2Parameters.getParameter<int32_t>("Nbinsy"),
363  GlobalTH2Parameters.getParameter<double>("ymin"),
364  GlobalTH2Parameters.getParameter<double>("ymax"));
365  GlobalApvCycleDBxTH2->setAxisTitle("APV Cycle (Corrected Absolute Bx % 70)", 1);
366  GlobalApvCycleDBxTH2->setAxisTitle("Delta Bunch Crossing Cycle", 2);
367 
368  // plot DeltaBX ***************************
369  edm::ParameterSet GlobalTH1Parameters = conf_.getParameter<edm::ParameterSet>("TH1DBxGlobal");
370  HistoName = "DeltaBx";
371  GlobalDBxTH1 = ibooker.book1D(HistoName,
372  HistoName,
373  GlobalTH1Parameters.getParameter<int32_t>("Nbinsx"),
374  GlobalTH1Parameters.getParameter<double>("xmin"),
375  GlobalTH1Parameters.getParameter<double>("xmax"));
376  GlobalDBxTH1->setAxisTitle("Delta Bunch Crossing", 1);
377 
378  // plot DeltaBXCycle ***************************
379  edm::ParameterSet DBxCycle = conf_.getParameter<edm::ParameterSet>("TH1DBxCycleGlobal");
380  HistoName = "DeltaBxCycle";
381  GlobalDBxCycleTH1 = ibooker.book1D(HistoName,
382  HistoName,
383  DBxCycle.getParameter<int32_t>("Nbinsx"),
384  DBxCycle.getParameter<double>("xmin"),
385  DBxCycle.getParameter<double>("xmax"));
386  GlobalDBxCycleTH1->setAxisTitle("Delta Bunch Crossing Cycle", 1);
387  }
388 
390  ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
391  edm::ParameterSet GlobalTH2Parameters = conf_.getParameter<edm::ParameterSet>("TH2CStripVsCpixel");
392  std::string HistoName = "StripClusVsPixClus";
393  GlobalCStripVsCpix = ibooker.book2D(HistoName,
394  HistoName,
395  GlobalTH2Parameters.getParameter<int32_t>("Nbinsx"),
396  GlobalTH2Parameters.getParameter<double>("xmin"),
397  GlobalTH2Parameters.getParameter<double>("xmax"),
398  GlobalTH2Parameters.getParameter<int32_t>("Nbinsy"),
399  GlobalTH2Parameters.getParameter<double>("ymin"),
400  GlobalTH2Parameters.getParameter<double>("ymax"));
401  GlobalCStripVsCpix->setAxisTitle("Strip Clusters", 1);
402  GlobalCStripVsCpix->setAxisTitle("Pix Clusters", 2);
403 
404  // Absolute Bunch Crossing ***********************
405  edm::ParameterSet GlobalTH1Parameters = conf_.getParameter<edm::ParameterSet>("TH1ABx_CSCP");
406  HistoName = "AbsoluteBx_CStripVsCpixel";
407  GlobalABXTH1_CSCP = ibooker.book1D(HistoName,
408  HistoName,
409  GlobalTH1Parameters.getParameter<int32_t>("Nbinsx"),
410  GlobalTH1Parameters.getParameter<double>("xmin"),
411  GlobalTH1Parameters.getParameter<double>("xmax"));
412  GlobalABXTH1_CSCP->setAxisTitle("Absolute Bunch Crossing", 1);
413  }
414 
416  ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
417  edm::ParameterSet GlobalTH2Parameters = conf_.getParameter<edm::ParameterSet>("TH1MultiplicityRegions");
418  std::string HistoName = "ClusterMultiplicityRegions";
419  PixVsStripMultiplicityRegions = ibooker.book1D(HistoName,
420  HistoName,
421  GlobalTH2Parameters.getParameter<int32_t>("Nbinx"),
422  GlobalTH2Parameters.getParameter<double>("xmin"),
423  GlobalTH2Parameters.getParameter<double>("xmax"));
425  PixVsStripMultiplicityRegions->setBinLabel(1, "Main Diagonal");
426  PixVsStripMultiplicityRegions->setBinLabel(2, "Strip Noise");
427  PixVsStripMultiplicityRegions->setBinLabel(3, "High Strip Noise");
428  PixVsStripMultiplicityRegions->setBinLabel(4, "Beam Background");
429  PixVsStripMultiplicityRegions->setBinLabel(5, "No Strip Clusters");
430  }
431 
433  ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
434  edm::ParameterSet GlobalTH1Parameters = conf_.getParameter<edm::ParameterSet>("TH1MainDiagonalPosition");
435  std::string HistoName = "MainDiagonal Position";
436  GlobalMainDiagonalPosition = ibooker.book1D(HistoName,
437  HistoName,
438  GlobalTH1Parameters.getParameter<int32_t>("Nbinsx"),
439  GlobalTH1Parameters.getParameter<double>("xmin"),
440  GlobalTH1Parameters.getParameter<double>("xmax"));
441  GlobalMainDiagonalPosition->setAxisTitle("atan(NPix/(k*NStrip))");
442 
443  // PLOT MainDiagonalPosition_vs_BX ***************************
444  edm::ParameterSet GlobalTProfParameters = conf_.getParameter<edm::ParameterSet>("TProfMainDiagonalPosition");
445  HistoName = "MainDiagonalPosition_vs_BX";
446  GlobalMainDiagonalPosition_vs_BX = ibooker.bookProfile(HistoName,
447  HistoName,
448  GlobalTProfParameters.getParameter<int32_t>("Nbinsx"),
449  GlobalTProfParameters.getParameter<double>("xmin"),
450  GlobalTProfParameters.getParameter<double>("xmax"),
451  GlobalTProfParameters.getParameter<int32_t>("Nbinsy"),
452  GlobalTProfParameters.getParameter<double>("ymin"),
453  GlobalTProfParameters.getParameter<double>("ymax"));
454 
456  GlobalMainDiagonalPosition_vs_BX->setAxisTitle("tan^{-1}(NPix/k*NStrip))", 2);
457 
458  edm::ParameterSet GlobalTH2Parameters = conf_.getParameter<edm::ParameterSet>("TH2MainDiagonalPosition");
459  HistoName = "TH2MainDiagonalPosition_vs_BX";
460  GlobalTH2MainDiagonalPosition_vs_BX = ibooker.book2D(HistoName,
461  HistoName,
462  GlobalTH2Parameters.getParameter<int32_t>("Nbinsx"),
463  GlobalTH2Parameters.getParameter<double>("xmin"),
464  GlobalTH2Parameters.getParameter<double>("xmax"),
465  GlobalTH2Parameters.getParameter<int32_t>("Nbinsy"),
466  GlobalTH2Parameters.getParameter<double>("ymin"),
467  GlobalTH2Parameters.getParameter<double>("ymax"));
469  GlobalTH2MainDiagonalPosition_vs_BX->setAxisTitle("tan^{-1}(NPix/k*NStrip))", 2);
470  }
471 
472  // TO BE ADDED !!!
473  /*
474  if ( globalswitchapvcycledbxth2on or globalswitchcstripvscpix or
475  globalswitchMultiRegions or ClusterHisto_ ) {
476  ibooker.setCurrentFolder(topFolderName_+"/MechanicalView/");
477  std::string HistoName = "BPTX rate";
478  BPTXrateTrend = ibooker.bookProfile(HistoName,HistoName, LSBin, LSMin,
479  LSMax, 0, 10000.,""); BPTXrateTrend->getTH1()->SetCanExtend(TH1::kAllAxes);
480  BPTXrateTrend->setAxisTitle("#Lumi section",1);
481  BPTXrateTrend->setAxisTitle("Number of BPTX events per LS",2);
482  }
483  */
484 
486  ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
487  edm::ParameterSet GlobalTH1Parameters = conf_.getParameter<edm::ParameterSet>("TH1StripNoise2ApvCycle");
488  std::string HistoName = "StripNoise_ApvCycle";
489  StripNoise2Cycle = ibooker.book1D(HistoName,
490  HistoName,
491  GlobalTH1Parameters.getParameter<int32_t>("Nbinsx"),
492  GlobalTH1Parameters.getParameter<double>("xmin"),
493  GlobalTH1Parameters.getParameter<double>("xmax"));
494  StripNoise2Cycle->setAxisTitle("APV Cycle");
495  }
496 
498  ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
499  edm::ParameterSet GlobalTH1Parameters = conf_.getParameter<edm::ParameterSet>("TH1StripNoise3ApvCycle");
500  std::string HistoName = "HighStripNoise_ApvCycle";
501  StripNoise3Cycle = ibooker.book1D(HistoName,
502  HistoName,
503  GlobalTH1Parameters.getParameter<int32_t>("Nbinsx"),
504  GlobalTH1Parameters.getParameter<double>("xmin"),
505  GlobalTH1Parameters.getParameter<double>("xmax"));
506  StripNoise3Cycle->setAxisTitle("APV Cycle");
507  }
508 
510  const char* HistoName = "StripClusVsBXandOrbit";
511  const char* HistoTitle =
512  "Strip cluster multiplicity vs BX mod(70) and Orbit;Event 1 BX "
513  "mod(70);time [Orb#]";
514  edm::ParameterSet ParametersNclusVsCycleTimeProf2D =
515  conf_.getParameter<edm::ParameterSet>("NclusVsCycleTimeProf2D");
516  NclusVsCycleTimeProf2D = ibooker.bookProfile2D(HistoName,
517  HistoTitle,
518  ParametersNclusVsCycleTimeProf2D.getParameter<int32_t>("Nbins"),
519  ParametersNclusVsCycleTimeProf2D.getParameter<double>("xmin"),
520  ParametersNclusVsCycleTimeProf2D.getParameter<double>("xmax"),
521  ParametersNclusVsCycleTimeProf2D.getParameter<int32_t>("Nbinsy"),
522  ParametersNclusVsCycleTimeProf2D.getParameter<double>("ymin"),
523  ParametersNclusVsCycleTimeProf2D.getParameter<double>("ymax"),
524  0,
525  0);
526  if (NclusVsCycleTimeProf2D->kind() == MonitorElement::Kind::TPROFILE2D)
527  NclusVsCycleTimeProf2D->getTH1()->SetCanExtend(TH1::kAllAxes);
528  }
530  ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
531  edm::ParameterSet ParametersClusWidthVsAmpTH2 = conf_.getParameter<edm::ParameterSet>("ClusWidthVsAmpTH2");
532  const char* HistoName = "ClusterWidths_vs_Amplitudes";
533  const char* HistoTitle =
534  "Cluster widths vs amplitudes;Amplitudes (integrated ADC "
535  "counts);Cluster widths";
536  ClusWidthVsAmpTH2 = ibooker.book2D(HistoName,
537  HistoTitle,
538  ParametersClusWidthVsAmpTH2.getParameter<int32_t>("Nbinsx"),
539  ParametersClusWidthVsAmpTH2.getParameter<double>("xmin"),
540  ParametersClusWidthVsAmpTH2.getParameter<double>("xmax"),
541  ParametersClusWidthVsAmpTH2.getParameter<int32_t>("Nbinsy"),
542  ParametersClusWidthVsAmpTH2.getParameter<double>("ymin"),
543  ParametersClusWidthVsAmpTH2.getParameter<double>("ymax"));
544  }
545 
546  if (ClusterHisto_) {
547  ibooker.setCurrentFolder(topFolderName_ + "/MechanicalView/");
548  edm::ParameterSet PixelCluster = conf_.getParameter<edm::ParameterSet>("TH1NClusPx");
549  std::string HistoName = "NumberOfClustersInPixel";
550  NumberOfPixelClus = ibooker.book1D(HistoName,
551  HistoName,
552  PixelCluster.getParameter<int32_t>("Nbinsx"),
553  PixelCluster.getParameter<double>("xmin"),
554  PixelCluster.getParameter<double>("xmax"));
555  NumberOfPixelClus->setAxisTitle("# of Clusters in Pixel", 1);
556  NumberOfPixelClus->setAxisTitle("Number of Events", 2);
557  //
558  edm::ParameterSet StripCluster = conf_.getParameter<edm::ParameterSet>("TH1NClusStrip");
559  HistoName = "NumberOfClustersInStrip";
560  NumberOfStripClus = ibooker.book1D(HistoName,
561  HistoName,
562  StripCluster.getParameter<int32_t>("Nbinsx"),
563  StripCluster.getParameter<double>("xmin"),
564  StripCluster.getParameter<double>("xmax"));
565  NumberOfStripClus->setAxisTitle("# of Clusters in Strip", 1);
566  NumberOfStripClus->setAxisTitle("Number of Events", 2);
567 
568  // NumberOfClustersinStrip vs BX PLOT ****************************
569  edm::ParameterSet StripClusterBX = conf_.getParameter<edm::ParameterSet>("TProfNClusStrip");
570  HistoName = "NumberOfClustersInStrip_vs_BX";
571  NumberOfStripClus_vs_BX = ibooker.bookProfile(HistoName,
572  HistoName,
573  StripClusterBX.getParameter<int32_t>("Nbinsx"),
574  StripClusterBX.getParameter<double>("xmin"),
575  StripClusterBX.getParameter<double>("xmax"),
576  StripClusterBX.getParameter<int32_t>("Nbinsy"),
577  StripClusterBX.getParameter<double>("ymin"),
578  StripClusterBX.getParameter<double>("ymax"));
579 
580  NumberOfStripClus_vs_BX->setAxisTitle("Absolute BX", 1);
581  NumberOfStripClus_vs_BX->setAxisTitle("# of Clusters in Strip", 2);
582 
583  // NumberOfClustersinStrip vs BX PLOT ****************************
584  edm::ParameterSet PixelClusterBX = conf_.getParameter<edm::ParameterSet>("TProfNClusPixel");
585  HistoName = "NumberOfClustersInPixel_vs_BX";
586  NumberOfPixelClus_vs_BX = ibooker.bookProfile(HistoName,
587  HistoName,
588  PixelClusterBX.getParameter<int32_t>("Nbinsx"),
589  PixelClusterBX.getParameter<double>("xmin"),
590  PixelClusterBX.getParameter<double>("xmax"),
591  PixelClusterBX.getParameter<int32_t>("Nbinsy"),
592  PixelClusterBX.getParameter<double>("ymin"),
593  PixelClusterBX.getParameter<double>("ymax"));
594 
595  NumberOfPixelClus_vs_BX->setAxisTitle("Absolute BX", 1);
596  NumberOfPixelClus_vs_BX->setAxisTitle("# of Clusters in Pixel", 2);
597 
599  // Number of clusters per FED
600  edm::ParameterSet FEDCluster = conf_.getParameter<edm::ParameterSet>("TProfNClustersFED");
601  HistoName = "NumberOfClustersinFED_v_FEDID";
602  NumberOfFEDClus = ibooker.bookProfile(HistoName,
603  HistoName,
604  FEDCluster.getParameter<int32_t>("Nbinsx"),
605  FEDCluster.getParameter<double>("xmin"),
606  FEDCluster.getParameter<double>("xmax"),
607  FEDCluster.getParameter<int32_t>("Nbinsy"),
608  FEDCluster.getParameter<double>("ymin"),
609  FEDCluster.getParameter<double>("ymax"),
610  "");
611  NumberOfFEDClus->setAxisTitle("FED ID", 1);
612  NumberOfFEDClus->setAxisTitle("Mean # of Cluster in FED", 2);
613  }
614  }
615 
616  } // end of if
617 } // end of method
618 
619 //--------------------------------------------------------------------------------------------
620 
623  unsigned long long cacheID = es.get<SiStripDetCablingRcd>().cacheIdentifier();
624  if (m_cacheID_ != cacheID) {
625  m_cacheID_ = cacheID;
626  edm::LogInfo("SiStripMonitorCluster") << "SiStripMonitorCluster::bookHistograms: "
627  << " Creating MEs for new Cabling ";
628 
629  createMEs(es, ibooker);
630  }
631  } else if (reset_each_run) {
632  edm::LogInfo("SiStripMonitorCluster") << "SiStripMonitorCluster::bookHistograms: "
633  << " Resetting MEs ";
634  for (std::map<uint32_t, ModMEs>::const_iterator idet = ModuleMEsMap.begin(); idet != ModuleMEsMap.end(); idet++) {
635  ResetModuleMEs(idet->first);
636  }
637  }
638 }
639 
640 //--------------------------------------------------------------------------------------------
642  // Retrieve tracker topology from geometry
643  edm::ESHandle<TrackerTopology> tTopoHandle;
644  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
645  const TrackerTopology* const tTopo = tTopoHandle.product();
646 
647  // Filter out events if Trigger Filtering is requested
649  ? genTriggerEventFlagBPTXfilter_->accept(iEvent, iSetup)
650  : true;
652  ? genTriggerEventFlagPixelDCSfilter_->accept(iEvent, iSetup)
653  : true;
655  ? genTriggerEventFlagStripDCSfilter_->accept(iEvent, iSetup)
656  : true;
657  // std::cout << "passBPTXfilter_ ? " << passBPTXfilter_ << std::endl;
658 
659  // Filter out events if DCS Event if requested
660  bool passDCSFilter_ = !(dcsStatus_ && !dcsStatus_->getStatus(iEvent, iSetup));
661 
662  runNb = iEvent.id().run();
663  eventNb++;
664  trendVar = trendVs10Ls_ ? iEvent.orbitNumber() / (10 * 262144.0)
665  : iEvent.orbitNumber() / (1 * 262144.0); // 10 lumisection : lumisection
666 
667  int NPixClusters = 0, NStripClusters = 0, MultiplicityRegion = 0;
668  bool isPixValid = false;
669 
670  edm::ESHandle<SiStripNoises> noiseHandle;
671  iSetup.get<SiStripNoisesRcd>().get(noiseHandle);
672 
673  edm::ESHandle<SiStripGain> gainHandle;
674  iSetup.get<SiStripGainRcd>().get(gainHandle);
675 
676  edm::ESHandle<SiStripQuality> qualityHandle;
677  iSetup.get<SiStripQualityRcd>().get(qualityLabel_, qualityHandle);
678 
680 
681  // get collection of DetSetVector of clusters from Event
683  iEvent.getByToken(clusterProducerStripToken_, cluster_detsetvektor);
684 
685  // get pixel clusters
686  edm::Handle<edmNew::DetSetVector<SiPixelCluster> > cluster_detsetvektor_pix;
687  iEvent.getByToken(clusterProducerPixToken_, cluster_detsetvektor_pix);
688 
689  if (!cluster_detsetvektor.isValid())
690  return;
691 
692  const edmNew::DetSetVector<SiStripCluster>* StrC = cluster_detsetvektor.product();
693  NStripClusters = StrC->data().size();
694 
695  if (cluster_detsetvektor_pix.isValid()) {
696  const edmNew::DetSetVector<SiPixelCluster>* PixC = cluster_detsetvektor_pix.product();
697  NPixClusters = PixC->data().size();
698  isPixValid = true;
699  MultiplicityRegion = FindRegion(NStripClusters, NPixClusters);
700 
701  if (passBPTXfilter_ and passPixelDCSfilter_ and passStripDCSfilter_ and passDCSFilter_) {
703  GlobalCStripVsCpix->Fill(NStripClusters, NPixClusters);
704  if (globalswitchmaindiagonalposition && NStripClusters > 0)
705  GlobalMainDiagonalPosition->Fill(atan(NPixClusters / (k0 * NStripClusters)));
706 
708  PixVsStripMultiplicityRegions->Fill(MultiplicityRegion);
709  }
710 
711  if (ClusterHisto_ and passDCSFilter_) {
713  NumberOfPixelClus->Fill(NPixClusters);
715  NumberOfStripClus->Fill(NStripClusters);
716  }
717  }
718  // initialise # of clusters to zero
719  for (std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.begin(); iSubdet != SubDetMEsMap.end();
720  iSubdet++) {
721  iSubdet->second.totNClusters = 0;
722  }
723 
724  SiStripFolderOrganizer folder_organizer;
725  bool found_layer_me = false;
726  // Map of cumulative clusters per fed ID.
727  std::map<int, int> FEDID_v_clustersum;
728 
729  for (std::map<std::string, std::vector<uint32_t> >::const_iterator iterLayer = LayerDetMap.begin();
730  iterLayer != LayerDetMap.end();
731  iterLayer++) {
732  std::string layer_label = iterLayer->first;
733 
734  int ncluster_layer = 0;
735  std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(layer_label);
736 
737  // get Layer MEs
738  LayerMEs layer_single;
739  if (iLayerME != LayerMEsMap.end()) {
740  layer_single = iLayerME->second;
741  found_layer_me = true;
742  }
743 
744  int ncluster_ring[20] = {0};
745 
746  bool found_module_me = false;
747  uint16_t iDet = 0;
748  std::string subdet_label = "";
749  // loop over all modules in the layer
750  for (std::vector<uint32_t>::const_iterator iterDets = iterLayer->second.begin();
751  iterDets != iterLayer->second.end();
752  iterDets++) {
753  iDet++;
754  // detid and type of ME
755  uint32_t detid = (*iterDets);
756 
757  // Get SubDet label once
758  if (subdet_label.empty())
759  subdet_label = folder_organizer.getSubDetFolderAndTag(detid, tTopo).second;
760 
761  // DetId and corresponding set of MEs
762  ModMEs mod_single;
763  if (Mod_On_) {
764  std::map<uint32_t, ModMEs>::iterator imodME = ModuleMEsMap.find(detid);
765  if (imodME != ModuleMEsMap.end()) {
766  mod_single = imodME->second;
767  found_module_me = true;
768  }
769  } else
770  found_module_me = false;
771 
773  cluster_detsetvektor->find(detid); // search clusters of detid
774 
775  if (isearch == cluster_detsetvektor->end() and passDCSFilter_) {
776  if (found_module_me && moduleswitchncluson && (mod_single.NumberOfClusters)) {
777  (mod_single.NumberOfClusters)->Fill(0.); // no clusters for this
778  // detector module,fill
779  // histogram with 0
780  }
782  tkmapcluster->fill(detid, 0.);
784  tkmapclusterch->fill(detid, 0.);
785  if (found_layer_me && layerswitchnumclusterprofon)
786  layer_single.LayerNumberOfClusterProfile->Fill(iDet, 0.0);
787  }
788 
789  if (isearch == cluster_detsetvektor->end()) {
790  continue; // no clusters for this detid => jump to next step of loop
791  }
792 
793  // cluster_detset is a structure, cluster_detset.data is a
794  // std::vector<SiStripCluster>, cluster_detset.id is uint32_t
795  // edmNew::DetSet<SiStripCluster> cluster_detset =
796  // (*cluster_detsetvektor)[detid]; // the statement above makes sure there
797  // exists an element with 'detid'
798  edmNew::DetSet<SiStripCluster> cluster_detset = (*isearch);
799 
801  // Get all FED connections associated with given detID.
802  // All connections for a detid have same FED Id therefore one FEDID is
803  // associated with a given detID. Vector of constant FedChannelConnection
804  // objects to variable pointers.
805  std::vector<const FedChannelConnection*> fedConnections = SiStripDetCabling_->getConnections(detid);
806 
807  // Filling FED Id associated clusters map.
808 
809  int good_fcc_index = -999;
810  for (unsigned int x = 0; x < fedConnections.size(); x++) {
811  if (fedConnections[x] != nullptr) {
812  good_fcc_index = x;
813  break;
814  }
815  }
816  if (good_fcc_index != -999 && fedConnections[good_fcc_index] != nullptr) {
817  int temp_fedid = fedConnections[good_fcc_index]->fedId();
818  if (FEDID_v_clustersum.find(temp_fedid) != FEDID_v_clustersum.end()) {
819  if (cluster_detset.size() < 1000 && !cluster_detset.empty()) {
820  FEDID_v_clustersum[temp_fedid] = FEDID_v_clustersum.find(temp_fedid)->second + cluster_detset.size();
821  }
822  } else {
823  if (cluster_detset.size() < 1000 && !cluster_detset.empty()) {
824  FEDID_v_clustersum[temp_fedid] = cluster_detset.size();
825  }
826  }
827  } else {
828  edm::LogInfo("SiStripMonitorCluster") << "SiStripMonitorCluster::analyze WARNING! no good connections "
829  "for detid = "
830  << detid << endl;
831  }
833 
834  // Filling TkHistoMap with number of clusters for each module
835  if (clustertkhistomapon and passDCSFilter_) {
836  tkmapcluster->fill(detid, static_cast<float>(cluster_detset.size()));
837  }
838 
839  if (moduleswitchncluson && found_module_me && (mod_single.NumberOfClusters != nullptr) &&
840  passDCSFilter_) { // nr. of clusters per module
841  (mod_single.NumberOfClusters)->Fill(static_cast<float>(cluster_detset.size()));
842  }
843 
844  if (found_layer_me && layerswitchnumclusterprofon && passDCSFilter_)
845  layer_single.LayerNumberOfClusterProfile->Fill(iDet, static_cast<float>(cluster_detset.size()));
846  ncluster_layer += cluster_detset.size();
847 
848  short total_clusterized_strips = 0;
849 
850  SiStripNoises::Range detNoiseRange = noiseHandle->getRange(detid);
851  SiStripApvGain::Range detGainRange = gainHandle->getRange(detid);
852  SiStripQuality::Range qualityRange = qualityHandle->getRange(detid);
853 
854  for (edmNew::DetSet<SiStripCluster>::const_iterator clusterIter = cluster_detset.begin();
855  clusterIter != cluster_detset.end();
856  clusterIter++) {
857  const auto& ampls = clusterIter->amplitudes();
858  // cluster position
859  float cluster_position = clusterIter->barycenter();
860  // start defined as nr. of first strip beloning to the cluster
861  short cluster_start = clusterIter->firstStrip();
862  // width defined as nr. of strips that belong to cluster
863  short cluster_width = ampls.size();
864  // add nr of strips of this cluster to total nr. of clusterized strips
865  total_clusterized_strips = total_clusterized_strips + cluster_width;
866 
867  if (clusterchtkhistomapon and passDCSFilter_)
868  tkmapclusterch->fill(detid, static_cast<float>(clusterIter->charge()));
869 
870  // cluster signal and noise from the amplitudes
871  float cluster_signal = 0.0;
872  float cluster_noise = 0.0;
873  int nrnonzeroamplitudes = 0;
874  float noise2 = 0.0;
875  float noise = 0.0;
876  for (uint iamp = 0; iamp < ampls.size(); iamp++) {
877  if (ampls[iamp] > 0) { // nonzero amplitude
878  cluster_signal += ampls[iamp];
879  if (!qualityHandle->IsStripBad(qualityRange, clusterIter->firstStrip() + iamp)) {
880  noise = noiseHandle->getNoise(clusterIter->firstStrip() + iamp, detNoiseRange) /
881  gainHandle->getStripGain(clusterIter->firstStrip() + iamp, detGainRange);
882  }
883  noise2 += noise * noise;
884  nrnonzeroamplitudes++;
885  }
886  } // End loop over cluster amplitude
887 
888  if (nrnonzeroamplitudes > 0)
889  cluster_noise = sqrt(noise2 / nrnonzeroamplitudes);
890 
891  if (applyClusterQuality_ &&
892  (cluster_signal / cluster_noise < sToNLowerLimit_ || cluster_signal / cluster_noise > sToNUpperLimit_ ||
893  cluster_width < widthLowerLimit_ || cluster_width > widthUpperLimit_))
894  continue;
895 
896  ClusterProperties cluster_properties;
897  cluster_properties.charge = cluster_signal;
898  cluster_properties.position = cluster_position;
899  cluster_properties.start = cluster_start;
900  cluster_properties.width = cluster_width;
901  cluster_properties.noise = cluster_noise;
902 
903  // Fill Module Level MEs
904  if (found_module_me and passDCSFilter_)
905  fillModuleMEs(mod_single, cluster_properties);
906 
907  // Fill Layer Level MEs
908  if (found_layer_me and passDCSFilter_) {
909  fillLayerMEs(layer_single, cluster_properties);
911  layer_single.LayerClusterWidthProfile->Fill(iDet, cluster_width);
912  }
913 
915  std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.find(subdet_label);
916  if (iSubdet != SubDetMEsMap.end()) {
917  if (subdetswitchcluschargeon and passDCSFilter_)
918  iSubdet->second.SubDetClusterChargeTH1->Fill(cluster_signal);
919  if (subdetswitchcluswidthon and passDCSFilter_)
920  iSubdet->second.SubDetClusterWidthTH1->Fill(cluster_width);
921  }
922  }
923 
924  if (subdet_clusterWidth_vs_amplitude_on and passDCSFilter_) {
925  std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.find(subdet_label);
926  if (iSubdet != SubDetMEsMap.end())
927  iSubdet->second.SubDetClusWidthVsAmpTH2->Fill(cluster_signal, cluster_width);
928  }
929 
930  if (clusterWidth_vs_amplitude_on and passDCSFilter_) {
931  ClusWidthVsAmpTH2->Fill(cluster_signal, cluster_width);
932  }
933 
935  (subdet_label.find("TID") != std::string::npos || subdet_label.find("TEC") != std::string::npos)) {
936  std::pair<std::string, int32_t> det_ring_pair = folder_organizer.GetSubDetAndLayer(detid, tTopo, true);
937  ncluster_ring[std::abs(det_ring_pair.second)]++;
938  }
939 
940  } // end loop over clusters
941 
943  std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.find(subdet_label);
944  std::pair<std::string, int32_t> det_layer_pair = folder_organizer.GetSubDetAndLayer(detid, tTopo);
945  iSubdet->second.SubDetNumberOfClusterPerLayerTrend->Fill(
946  trendVar, std::abs(det_layer_pair.second), ncluster_layer);
947  }
948 
950  (subdet_label.find("TID") != std::string::npos || subdet_label.find("TEC") != std::string::npos)) {
951  std::pair<std::string, int32_t> det_ring_pair = folder_organizer.GetSubDetAndLayer(detid, tTopo, true);
953  trendVar, std::abs(det_ring_pair.second), ncluster_ring[std::abs(det_ring_pair.second)]);
954  }
955 
956  short total_nr_strips = SiStripDetCabling_->nApvPairs(detid) * 2 * 128; // get correct # of avp pairs
957  float local_occupancy = static_cast<float>(total_clusterized_strips) / static_cast<float>(total_nr_strips);
958  if (found_module_me and passDCSFilter_) {
959  if (moduleswitchnrclusterizedstrip && mod_single.NrOfClusterizedStrips) { // nr of clusterized strips
960  mod_single.NrOfClusterizedStrips->Fill(static_cast<float>(total_clusterized_strips));
961  }
962 
963  if (moduleswitchlocaloccupancy && mod_single.ModuleLocalOccupancy) { // Occupancy
964  mod_single.ModuleLocalOccupancy->Fill(local_occupancy);
965  }
966  }
967  if (layerswitchlocaloccupancy && found_layer_me && layer_single.LayerLocalOccupancy && passDCSFilter_) {
968  fillME(layer_single.LayerLocalOccupancy, local_occupancy);
969  if (createTrendMEs)
970  fillME(layer_single.LayerLocalOccupancyTrend, trendVar, local_occupancy);
971  }
972  }
973 
975  fillME(layer_single.LayerNumberOfClusterTrend, trendVar, ncluster_layer);
976 
977  std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.find(subdet_label);
978  if (iSubdet != SubDetMEsMap.end())
979  iSubdet->second.totNClusters += ncluster_layer;
980  }
981 
982  // EventHistory
983  edm::Handle<EventWithHistory> event_history;
984  iEvent.getByToken(historyProducerToken_, event_history);
985 
986  // Phase of APV
987  edm::Handle<APVCyclePhaseCollection> apv_phase_collection;
988  iEvent.getByToken(apvPhaseProducerToken_, apv_phase_collection);
989 
990  if (event_history.isValid() && !event_history.failedToGet() && apv_phase_collection.isValid() &&
991  !apv_phase_collection.failedToGet()) {
992  long long dbx = event_history->deltaBX();
993  long long tbx = event_history->absoluteBX();
994 
995  bool global_histo_filled = false;
996  bool MultiplicityRegion_Vs_APVcycle_filled = false;
997 
998  // plot n 2
999  if (passBPTXfilter_ and passPixelDCSfilter_ and passStripDCSfilter_ && passDCSFilter_) {
1001  GlobalABXTH1_CSCP->Fill(tbx % 3564);
1002  }
1003  // plot n 2
1004 
1005  for (std::map<std::string, SubDetMEs>::iterator it = SubDetMEsMap.begin(); it != SubDetMEsMap.end(); it++) {
1006  std::string sdet = it->first;
1007  // std::string sdet = sdet_tag.substr(0,sdet_tag.find_first_of("_"));
1008  SubDetMEs sdetmes = it->second;
1009 
1010  int the_phase = APVCyclePhaseCollection::invalid;
1011  long long tbx_corr = tbx;
1012 
1013  if (SubDetPhasePartMap.find(sdet) != SubDetPhasePartMap.end())
1014  the_phase = apv_phase_collection->getPhase(SubDetPhasePartMap[sdet]);
1016  the_phase == APVCyclePhaseCollection::invalid) {
1017  the_phase = 30;
1018  // std::cout << " subdet " << it->first << " not valid" << " MR " <<
1019  // MultiplicityRegion <<std::endl;
1020  }
1021  tbx_corr -= the_phase;
1022 
1023  long long dbxincycle = event_history->deltaBXinCycle(the_phase);
1024  // std::cout<<"dbx in cycle: " << dbxincycle << std::endl;
1025  if (globalswitchapvcycledbxth2on && !global_histo_filled && passDCSFilter_) {
1026  GlobalApvCycleDBxTH2->Fill(tbx_corr % 70, dbx);
1027  GlobalDBxTH1->Fill(dbx);
1028  GlobalDBxCycleTH1->Fill(dbxincycle);
1029  global_histo_filled = true;
1030  }
1031 
1032  // Fill MainDiagonalPosition plots ***************
1033  if (cluster_detsetvektor_pix.isValid()) {
1034  if (ClusterHisto_) {
1035  if (passBPTXfilter_ and passStripDCSfilter_ and passDCSFilter_) {
1036  NumberOfStripClus_vs_BX->Fill(tbx % 3564, NStripClusters);
1037  if (passPixelDCSfilter_) {
1038  NumberOfPixelClus_vs_BX->Fill(tbx % 3564, NPixClusters);
1039  if (globalswitchmaindiagonalposition && NStripClusters > 0) {
1040  GlobalMainDiagonalPosition_vs_BX->Fill(tbx % 3564, atan(NPixClusters / (k0 * NStripClusters)));
1041  GlobalTH2MainDiagonalPosition_vs_BX->Fill(tbx % 3564, atan(NPixClusters / (k0 * NStripClusters)));
1042  }
1043  }
1044  }
1045 
1046  // Filling # clusters per FED ID histogram from FED Id clusters map
1047  // (for all layers simultaneously).
1048  map<int, int>::iterator it;
1049  // for(it=FEDID_v_clustersum.begin(); it!=FEDID_v_clustersum.end();
1050  // it++){
1051  for (auto const& fedidEntry : FEDID_v_clustersum) {
1052  // NumberOfFEDClus->Fill(it->first,it->second);
1053  if (passDCSFilter_)
1054  NumberOfFEDClus->Fill(fedidEntry.first, fedidEntry.second);
1055  // if(it->first < 100){
1056  // Trend_NumberOfFEDClus->Fill(trendVar,it->first,it->second);
1057  //}
1058  }
1059  FEDID_v_clustersum.clear();
1060  }
1061  }
1062 
1063  if (isPixValid && !MultiplicityRegion_Vs_APVcycle_filled && passDCSFilter_) {
1064  if (globalswitchstripnoise2apvcycle && MultiplicityRegion == 2) {
1065  StripNoise2Cycle->Fill(tbx_corr % 70);
1066  }
1067  if (globalswitchstripnoise3apvcycle && MultiplicityRegion == 3) {
1068  StripNoise3Cycle->Fill(tbx_corr % 70);
1069  }
1070  MultiplicityRegion_Vs_APVcycle_filled = true;
1071  }
1072 
1073  if (subdetswitchtotclusth1on and passDCSFilter_)
1074  sdetmes.SubDetTotClusterTH1->Fill(sdetmes.totNClusters);
1076  sdetmes.SubDetTotClusterProf->Fill(trendVar, sdetmes.totNClusters);
1077  if (subdetswitchapvcycleprofon and passDCSFilter_)
1078  sdetmes.SubDetClusterApvProf->Fill(tbx_corr % 70, sdetmes.totNClusters);
1079  if (subdetswitchapvcycleth2on and passDCSFilter_)
1080  sdetmes.SubDetClusterApvTH2->Fill(tbx_corr % 70, sdetmes.totNClusters);
1081  if (subdetswitchdbxcycleprofon and passDCSFilter_) {
1082  sdetmes.SubDetClusterDBxCycleProf->Fill(dbxincycle, sdetmes.totNClusters);
1083  }
1084  if (subdetswitchapvcycledbxprof2on and passDCSFilter_)
1085  sdetmes.SubDetApvDBxProf2->Fill(tbx_corr % 70, dbx, sdetmes.totNClusters);
1086  }
1087 
1088  if (globalswitchnclusvscycletimeprof2don and passDCSFilter_) {
1089  long long tbx_corr = tbx;
1090  int the_phase = apv_phase_collection->getPhase("All");
1091 
1093  the_phase == APVCyclePhaseCollection::invalid)
1094  the_phase = 30;
1095 
1096  tbx_corr -= the_phase;
1097 
1098  NclusVsCycleTimeProf2D->Fill(tbx_corr % 70, (int)event_history->_orbit, NStripClusters);
1099  }
1100  }
1101 }
1102 //
1103 // -- Reset MEs
1104 //------------------------------------------------------------------------------
1106  std::map<uint32_t, ModMEs>::iterator pos = ModuleMEsMap.find(idet);
1107  ModMEs mod_me = pos->second;
1108 
1109  if (moduleswitchncluson)
1110  mod_me.NumberOfClusters->Reset();
1112  mod_me.ClusterPosition->Reset();
1114  mod_me.ClusterDigiPosition->Reset();
1118  mod_me.ClusterWidth->Reset();
1120  mod_me.ClusterCharge->Reset();
1122  mod_me.ClusterNoise->Reset();
1124  mod_me.ClusterSignalOverNoise->Reset();
1126  mod_me.ModuleLocalOccupancy->Reset();
1128  mod_me.NrOfClusterizedStrips->Reset();
1130  mod_me.Module_ClusWidthVsAmpTH2->Reset();
1131 }
1132 //
1133 // -- Create Module Level MEs
1134 //
1135 void SiStripMonitorCluster::createModuleMEs(ModMEs& mod_single, uint32_t detid, DQMStore::IBooker& ibooker) {
1136  // use SistripHistoId for producing histogram id (and title)
1137  SiStripHistoId hidmanager;
1138  std::string hid;
1139 
1140  // nr. of clusters per module
1141  if (moduleswitchncluson) {
1142  hid = hidmanager.createHistoId("NumberOfClusters", "det", detid);
1143  mod_single.NumberOfClusters = bookME1D("TH1nClusters", hid.c_str(), ibooker);
1144  mod_single.NumberOfClusters->setAxisTitle("number of clusters in one detector module");
1145  mod_single.NumberOfClusters->setStatOverflows(kTRUE); // over/underflows in Mean calculation
1146  }
1147 
1148  // ClusterPosition
1149  if (moduleswitchclusposon) {
1150  short total_nr_strips = SiStripDetCabling_->nApvPairs(detid) * 2 * 128; // get correct # of avp pairs
1151  hid = hidmanager.createHistoId("ClusterPosition", "det", detid);
1152  mod_single.ClusterPosition = ibooker.book1D(hid, hid, total_nr_strips, 0.5, total_nr_strips + 0.5);
1153  mod_single.ClusterPosition->setAxisTitle("cluster position [strip number +0.5]");
1154  }
1155 
1156  // ClusterDigiPosition
1158  short total_nr_strips = SiStripDetCabling_->nApvPairs(detid) * 2 * 128; // get correct # of avp pairs
1159  hid = hidmanager.createHistoId("ClusterDigiPosition", "det", detid);
1160  mod_single.ClusterDigiPosition = ibooker.book1D(hid, hid, total_nr_strips, 0.5, total_nr_strips + 0.5);
1161  mod_single.ClusterDigiPosition->setAxisTitle("digi in cluster position [strip number +0.5]");
1162  }
1163 
1164  // ClusterWidth
1166  hid = hidmanager.createHistoId("ClusterWidth", "det", detid);
1167  mod_single.ClusterWidth = bookME1D("TH1ClusterWidth", hid.c_str(), ibooker);
1168  mod_single.ClusterWidth->setAxisTitle("cluster width [nr strips]");
1169  }
1170 
1171  // ClusterCharge
1173  hid = hidmanager.createHistoId("ClusterCharge", "det", detid);
1174  mod_single.ClusterCharge = bookME1D("TH1ClusterCharge", hid.c_str(), ibooker);
1175  mod_single.ClusterCharge->setAxisTitle("cluster charge [ADC]");
1176  }
1177 
1178  // ClusterNoise
1180  hid = hidmanager.createHistoId("ClusterNoise", "det", detid);
1181  mod_single.ClusterNoise = bookME1D("TH1ClusterNoise", hid.c_str(), ibooker);
1182  mod_single.ClusterNoise->setAxisTitle("cluster noise");
1183  }
1184 
1185  // ClusterSignalOverNoise
1186  if (moduleswitchclusstonon) {
1187  hid = hidmanager.createHistoId("ClusterSignalOverNoise", "det", detid);
1188  mod_single.ClusterSignalOverNoise = bookME1D("TH1ClusterStoN", hid.c_str(), ibooker);
1189  mod_single.ClusterSignalOverNoise->setAxisTitle("ratio of signal to noise for each cluster");
1190  }
1191 
1192  // ClusterSignalOverNoiseVsPos
1194  hid = hidmanager.createHistoId("ClusterSignalOverNoiseVsPos", "det", detid);
1195  Parameters = conf_.getParameter<edm::ParameterSet>("TH1ClusterStoNVsPos");
1196  mod_single.ClusterSignalOverNoiseVsPos = ibooker.bookProfile(hid.c_str(),
1197  hid.c_str(),
1198  Parameters.getParameter<int32_t>("Nbinx"),
1199  Parameters.getParameter<double>("xmin"),
1200  Parameters.getParameter<double>("xmax"),
1201  Parameters.getParameter<int32_t>("Nbiny"),
1202  Parameters.getParameter<double>("ymin"),
1203  Parameters.getParameter<double>("ymax"));
1204  mod_single.ClusterSignalOverNoiseVsPos->setAxisTitle("pos");
1205  }
1206 
1207  // ModuleLocalOccupancy
1209  hid = hidmanager.createHistoId("ClusterLocalOccupancy", "det", detid);
1210  mod_single.ModuleLocalOccupancy = bookME1D("TH1ModuleLocalOccupancy", hid.c_str(), ibooker);
1211  mod_single.ModuleLocalOccupancy->setAxisTitle("module local occupancy [% of clusterized strips]");
1212  }
1213 
1214  // NrOfClusterizedStrips
1216  hid = hidmanager.createHistoId("NrOfClusterizedStrips", "det", detid);
1217  mod_single.NrOfClusterizedStrips = bookME1D("TH1NrOfClusterizedStrips", hid.c_str(), ibooker);
1218  mod_single.NrOfClusterizedStrips->setAxisTitle("number of clusterized strips");
1219  }
1220 
1222  hid = hidmanager.createHistoId("ClusterWidths_vs_Amplitudes", "det", detid);
1223  Parameters = conf_.getParameter<edm::ParameterSet>("ClusWidthVsAmpTH2");
1224  int32_t Nbinsx = Parameters.getParameter<int32_t>("Nbinsx");
1225  Nbinsx = Nbinsx / 2; // Without this "rebinning" the job is killed on
1226  // lxplus. We think it's due to the high memory needed
1227  // to create all those histograms.
1228  mod_single.Module_ClusWidthVsAmpTH2 = ibooker.book2D(hid.c_str(),
1229  hid.c_str(),
1230  Nbinsx,
1231  Parameters.getParameter<double>("xmin"),
1232  Parameters.getParameter<double>("xmax"),
1233  Parameters.getParameter<int32_t>("Nbinsy"),
1234  Parameters.getParameter<double>("ymin"),
1235  Parameters.getParameter<double>("ymax"));
1236  mod_single.Module_ClusWidthVsAmpTH2->setAxisTitle("Amplitudes (integrated ADC counts)", 1);
1237  mod_single.Module_ClusWidthVsAmpTH2->setAxisTitle("Cluster widths", 2);
1238  }
1239 }
1240 //
1241 // -- Create Module Level MEs
1242 //
1244  SiStripHistoId hidmanager;
1245 
1246  LayerMEs layerMEs;
1247  layerMEs.LayerClusterStoN = nullptr;
1248  layerMEs.LayerClusterStoNTrend = nullptr;
1249  layerMEs.LayerClusterCharge = nullptr;
1250  layerMEs.LayerClusterChargeTrend = nullptr;
1251  layerMEs.LayerClusterNoise = nullptr;
1252  layerMEs.LayerClusterNoiseTrend = nullptr;
1253  layerMEs.LayerClusterWidth = nullptr;
1254  layerMEs.LayerClusterWidthTrend = nullptr;
1255  layerMEs.LayerLocalOccupancy = nullptr;
1256  layerMEs.LayerLocalOccupancyTrend = nullptr;
1257  layerMEs.LayerNumberOfClusterProfile = nullptr;
1258  layerMEs.LayerNumberOfClusterTrend = nullptr;
1259  layerMEs.LayerNumberOfClusterPerRingTrend = nullptr;
1260  layerMEs.LayerClusterWidthProfile = nullptr;
1261  layerMEs.LayerClusWidthVsAmpTH2 = nullptr;
1262  layerMEs.LayerClusterPosition = nullptr;
1263 
1264  // Cluster Width
1265  if (layerswitchcluswidthon) {
1266  layerMEs.LayerClusterWidth = bookME1D(
1267  "TH1ClusterWidth", hidmanager.createHistoLayer("Summary_ClusterWidth", "layer", label, "").c_str(), ibooker);
1268  if (createTrendMEs)
1269  layerMEs.LayerClusterWidthTrend =
1270  bookMETrend(hidmanager.createHistoLayer("Trend_ClusterWidth", "layer", label, "").c_str(), ibooker);
1271  }
1272 
1273  // Cluster Noise
1274  if (layerswitchclusnoiseon) {
1275  layerMEs.LayerClusterNoise = bookME1D(
1276  "TH1ClusterNoise", hidmanager.createHistoLayer("Summary_ClusterNoise", "layer", label, "").c_str(), ibooker);
1277  if (createTrendMEs)
1278  layerMEs.LayerClusterNoiseTrend =
1279  bookMETrend(hidmanager.createHistoLayer("Trend_ClusterNoise", "layer", label, "").c_str(), ibooker);
1280  }
1281 
1282  // Cluster Charge
1284  layerMEs.LayerClusterCharge = bookME1D(
1285  "TH1ClusterCharge", hidmanager.createHistoLayer("Summary_ClusterCharge", "layer", label, "").c_str(), ibooker);
1286  if (createTrendMEs)
1287  layerMEs.LayerClusterChargeTrend =
1288  bookMETrend(hidmanager.createHistoLayer("Trend_ClusterCharge", "layer", label, "").c_str(), ibooker);
1289  }
1290 
1291  // Cluster StoN
1292  if (layerswitchclusstonon) {
1293  layerMEs.LayerClusterStoN =
1294  bookME1D("TH1ClusterStoN",
1295  hidmanager.createHistoLayer("Summary_ClusterSignalOverNoise", "layer", label, "").c_str(),
1296  ibooker);
1297  if (createTrendMEs)
1298  layerMEs.LayerClusterStoNTrend =
1299  bookMETrend(hidmanager.createHistoLayer("Trend_ClusterSignalOverNoise", "layer", label, "").c_str(), ibooker);
1300  }
1301 
1302  // Cluster Occupancy
1304  layerMEs.LayerLocalOccupancy =
1305  bookME1D("TH1ModuleLocalOccupancy",
1306  hidmanager.createHistoLayer("Summary_ClusterLocalOccupancy", "layer", label, "").c_str(),
1307  ibooker);
1308  if (createTrendMEs)
1309  layerMEs.LayerLocalOccupancyTrend =
1310  bookMETrend(hidmanager.createHistoLayer("Trend_ClusterLocalOccupancy", "layer", label, "").c_str(), ibooker);
1311  }
1312 
1313  // # of Cluster Profile
1315  std::string hid = hidmanager.createHistoLayer("NumberOfClusterProfile", "layer", label, "");
1316  layerMEs.LayerNumberOfClusterProfile = ibooker.bookProfile(hid, hid, ndets, 0.5, ndets + 0.5, 21, -0.5, 20.5);
1317  }
1318 
1319  // # of Cluster Trend
1321  layerMEs.LayerNumberOfClusterTrend =
1322  bookMETrend(hidmanager.createHistoLayer("NumberOfClusterTrend", "layer", label, "").c_str(), ibooker);
1323 
1324  if (label.find("TID") != std::string::npos || label.find("TEC") != std::string::npos) {
1325  edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("NumberOfClusterPerRingVsTrendVar");
1326 
1328  "NumberOfClusterPerRingVsTrendVar",
1329  hidmanager.createHistoLayer("NumberOfClusterPerRing_vs_TrendVar", "layer", label, "").c_str(),
1330  Parameters.getParameter<int32_t>("Nbinsx"),
1331  Parameters.getParameter<double>("xmin"),
1332  Parameters.getParameter<double>("xmax"),
1333  Parameters.getParameter<int32_t>("Nbinsy"),
1334  Parameters.getParameter<double>("ymin"),
1335  Parameters.getParameter<double>("ymax"),
1336  0,
1337  0,
1338  "");
1339  }
1340  }
1341 
1342  // Cluster Width Profile
1344  std::string hid = hidmanager.createHistoLayer("ClusterWidthProfile", "layer", label, "");
1345  layerMEs.LayerClusterWidthProfile = ibooker.bookProfile(hid, hid, ndets, 0.5, ndets + 0.5, 20, -0.5, 19.5);
1346  }
1347 
1349  layerMEs.LayerClusWidthVsAmpTH2 =
1350  bookME2D("ClusWidthVsAmpTH2",
1351  hidmanager.createHistoLayer("ClusterWidths_vs_Amplitudes", "layer", label, "").c_str(),
1352  ibooker);
1353  }
1354 
1355  // Cluster Position
1356  if (layerswitchclusposon) {
1357  std::string hid = hidmanager.createHistoLayer("ClusterPosition", "layer", label, "");
1358  layerMEs.LayerClusterPosition = ibooker.book1D(hid, hid, 128 * 6, 0.5, 128 * 6 + 0.5);
1359  }
1360 
1361  LayerMEsMap[label] = layerMEs;
1362 }
1363 //
1364 // -- Create SubDetector MEs
1365 //
1367  SubDetMEs subdetMEs;
1368  subdetMEs.totNClusters = 0;
1369  subdetMEs.SubDetTotClusterTH1 = nullptr;
1370  subdetMEs.SubDetTotClusterProf = nullptr;
1371  subdetMEs.SubDetClusterApvProf = nullptr;
1372  subdetMEs.SubDetClusterApvTH2 = nullptr;
1373  subdetMEs.SubDetClusterDBxCycleProf = nullptr;
1374  subdetMEs.SubDetApvDBxProf2 = nullptr;
1375  subdetMEs.SubDetClusterChargeTH1 = nullptr;
1376  subdetMEs.SubDetClusterWidthTH1 = nullptr;
1377  subdetMEs.SubDetClusWidthVsAmpTH2 = nullptr;
1378  subdetMEs.SubDetNumberOfClusterPerLayerTrend = nullptr;
1379 
1381  // cluster charge
1383  HistoName = "ClusterCharge__" + label;
1384  subdetMEs.SubDetClusterChargeTH1 = bookME1D("TH1ClusterCharge", HistoName.c_str(), ibooker);
1385  subdetMEs.SubDetClusterChargeTH1->setAxisTitle("Cluster charge [ADC counts]");
1386  subdetMEs.SubDetClusterChargeTH1->setStatOverflows(kTRUE); // over/underflows in Mean calculation
1387  }
1388  // cluster width
1390  HistoName = "ClusterWidth__" + label;
1391  subdetMEs.SubDetClusterWidthTH1 = bookME1D("TH1ClusterWidth", HistoName.c_str(), ibooker);
1392  subdetMEs.SubDetClusterWidthTH1->setAxisTitle("Cluster width [strips]");
1393  subdetMEs.SubDetClusterWidthTH1->setStatOverflows(kTRUE); // over/underflows in Mean calculation
1394  }
1395  // Total Number of Cluster - 1D
1397  HistoName = "TotalNumberOfCluster__" + label;
1398  subdetMEs.SubDetTotClusterTH1 = bookME1D("TH1TotalNumberOfClusters", HistoName.c_str(), ibooker);
1399  subdetMEs.SubDetTotClusterTH1->setAxisTitle("Total number of clusters in subdetector");
1400  subdetMEs.SubDetTotClusterTH1->setStatOverflows(kTRUE); // over/underflows in Mean calculation
1401  }
1402  // Total Number of Cluster vs Time - Profile
1405  : conf_.getParameter<edm::ParameterSet>("Trending");
1406  HistoName = "TotalNumberOfClusterProfile__" + label;
1407  subdetMEs.SubDetTotClusterProf = ibooker.bookProfile(HistoName,
1408  HistoName,
1409  Parameters.getParameter<int32_t>("Nbins"),
1410  Parameters.getParameter<double>("xmin"),
1411  Parameters.getParameter<double>("xmax"),
1412  0,
1413  0,
1414  "");
1415  subdetMEs.SubDetTotClusterProf->setAxisTitle(Parameters.getParameter<std::string>("xaxis"), 1);
1417  subdetMEs.SubDetTotClusterProf->getTH1()->SetCanExtend(TH1::kAllAxes);
1418 
1419  Parameters = conf_.getParameter<edm::ParameterSet>("NumberOfClusterPerLayerTrendVar");
1420  HistoName = "TotalNumberOfClusterPerLayer__" + label;
1421  subdetMEs.SubDetNumberOfClusterPerLayerTrend = ibooker.bookProfile2D("NumberOfClusterPerLayerTrendVar",
1422  HistoName.c_str(),
1423  Parameters.getParameter<int32_t>("Nbinsx"),
1424  Parameters.getParameter<double>("xmin"),
1425  Parameters.getParameter<double>("xmax"),
1426  Parameters.getParameter<int32_t>("Nbinsy"),
1427  Parameters.getParameter<double>("ymin"),
1428  Parameters.getParameter<double>("ymax"),
1429  0,
1430  0,
1431  "");
1432  subdetMEs.SubDetNumberOfClusterPerLayerTrend->setAxisTitle("Lumisection", 1);
1433  subdetMEs.SubDetNumberOfClusterPerLayerTrend->setAxisTitle("Layer Number", 2);
1434  }
1435 
1436  // Total Number of Cluster vs APV cycle - Profile
1438  edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TProfClustersApvCycle");
1439  HistoName = "Cluster_vs_ApvCycle__" + label;
1440  subdetMEs.SubDetClusterApvProf = ibooker.bookProfile(HistoName,
1441  HistoName,
1442  Parameters.getParameter<int32_t>("Nbins"),
1443  Parameters.getParameter<double>("xmin"),
1444  Parameters.getParameter<double>("xmax"),
1445  200, // that parameter should not be there !?
1446  Parameters.getParameter<double>("ymin"),
1447  Parameters.getParameter<double>("ymax"),
1448  "");
1449  subdetMEs.SubDetClusterApvProf->setAxisTitle("Apv Cycle (Corrected Absolute Bx % 70)", 1);
1450  }
1451 
1452  // Total Number of Clusters vs ApvCycle - 2D
1455  HistoName = "Cluster_vs_ApvCycle_2D__" + label;
1456  // Adjusting the scale for 2D histogram
1457  double h2ymax = 9999.0;
1458  double yfact = Parameters.getParameter<double>("yfactor");
1459  if (label.find("TIB") != std::string::npos)
1460  h2ymax = (6984. * 256.) * yfact;
1461  else if (label.find("TID") != std::string::npos)
1462  h2ymax = (2208. * 256.) * yfact;
1463  else if (label.find("TOB") != std::string::npos)
1464  h2ymax = (12906. * 256.) * yfact;
1465  else if (label.find("TEC") != std::string::npos)
1466  h2ymax = (7552. * 2. * 256.) * yfact;
1467 
1468  subdetMEs.SubDetClusterApvTH2 = ibooker.book2D(HistoName,
1469  HistoName,
1470  Parameters.getParameter<int32_t>("Nbinsx"),
1471  Parameters.getParameter<double>("xmin"),
1472  Parameters.getParameter<double>("xmax"),
1473  Parameters.getParameter<int32_t>("Nbinsy"),
1474  Parameters.getParameter<double>("ymin"),
1475  h2ymax);
1476  subdetMEs.SubDetClusterApvTH2->setAxisTitle("Apv Cycle (Corrected Absolute Bx % 70))", 1);
1477  subdetMEs.SubDetClusterApvTH2->setAxisTitle("Total # of Clusters", 2);
1478  }
1479 
1480  // Cluster widths vs amplitudes - 2D
1483  HistoName = "ClusterWidths_vs_Amplitudes__" + label;
1484  subdetMEs.SubDetClusWidthVsAmpTH2 = ibooker.book2D(HistoName,
1485  HistoName,
1486  Parameters.getParameter<int32_t>("Nbinsx"),
1487  Parameters.getParameter<double>("xmin"),
1488  Parameters.getParameter<double>("xmax"),
1489  Parameters.getParameter<int32_t>("Nbinsy"),
1490  Parameters.getParameter<double>("ymin"),
1491  Parameters.getParameter<double>("ymax"));
1492  subdetMEs.SubDetClusWidthVsAmpTH2->setAxisTitle("Amplitudes (integrated ADC counts)", 1);
1493  subdetMEs.SubDetClusWidthVsAmpTH2->setAxisTitle("Cluster widths", 2);
1494  }
1495 
1496  // Total Number of Cluster vs DeltaBxCycle - Profile
1498  edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TProfClustersVsDBxCycle");
1499  HistoName = "Cluster_vs_DeltaBxCycle__" + label;
1500  subdetMEs.SubDetClusterDBxCycleProf = ibooker.bookProfile(HistoName,
1501  HistoName,
1502  Parameters.getParameter<int32_t>("Nbins"),
1503  Parameters.getParameter<double>("xmin"),
1504  Parameters.getParameter<double>("xmax"),
1505  200, // that parameter should not be there !?
1506  Parameters.getParameter<double>("ymin"),
1507  Parameters.getParameter<double>("ymax"),
1508  "");
1509  subdetMEs.SubDetClusterDBxCycleProf->setAxisTitle("Delta Bunch Crossing Cycle", 1);
1510  }
1511  // DeltaBx vs ApvCycle - 2DProfile
1514  HistoName = "DeltaBx_vs_ApvCycle__" + label;
1515  subdetMEs.SubDetApvDBxProf2 = ibooker.bookProfile2D(HistoName,
1516  HistoName,
1517  Parameters.getParameter<int32_t>("Nbinsx"),
1518  Parameters.getParameter<double>("xmin"),
1519  Parameters.getParameter<double>("xmax"),
1520  Parameters.getParameter<int32_t>("Nbinsy"),
1521  Parameters.getParameter<double>("ymin"),
1522  Parameters.getParameter<double>("ymax"),
1523  Parameters.getParameter<double>("zmin"),
1524  Parameters.getParameter<double>("zmax"),
1525  "");
1526  subdetMEs.SubDetApvDBxProf2->setAxisTitle("APV Cycle (Corrected Absolute Bx % 70)", 1);
1527  subdetMEs.SubDetApvDBxProf2->setAxisTitle("Delta Bunch Crossing Cycle", 2);
1528  }
1529  SubDetMEsMap[label] = subdetMEs;
1530 }
1531 
1532 //
1533 // -- Fill Module Level Histograms
1534 //
1536  if (moduleswitchclusposon && (mod_mes.ClusterPosition)) // position of cluster
1537  (mod_mes.ClusterPosition)->Fill(cluster.position);
1538 
1539  // position of digis in cluster
1541  for (int ipos = cluster.start + 1; ipos <= cluster.start + cluster.width; ipos++) {
1542  (mod_mes.ClusterDigiPosition)->Fill(ipos);
1543  }
1544  }
1545 
1546  if (moduleswitchcluswidthon && (mod_mes.ClusterWidth)) // width of cluster
1547  (mod_mes.ClusterWidth)->Fill(static_cast<float>(cluster.width));
1548 
1549  if (moduleswitchclusstonon && (mod_mes.ClusterSignalOverNoise)) { // SignalToNoise
1550  if (cluster.noise > 0)
1551  (mod_mes.ClusterSignalOverNoise)->Fill(cluster.charge / cluster.noise);
1552  }
1553 
1554  if (moduleswitchclusstonVsposon && (mod_mes.ClusterSignalOverNoiseVsPos)) { // SignalToNoise
1555  if (cluster.noise > 0)
1556  (mod_mes.ClusterSignalOverNoiseVsPos)->Fill(cluster.position, cluster.charge / cluster.noise);
1557  }
1558 
1559  if (moduleswitchclusnoiseon && (mod_mes.ClusterNoise)) // Noise
1560  (mod_mes.ClusterNoise)->Fill(cluster.noise);
1561 
1562  if (moduleswitchcluschargeon && (mod_mes.ClusterCharge)) // charge of cluster
1563  (mod_mes.ClusterCharge)->Fill(cluster.charge);
1564 
1566  (mod_mes.Module_ClusWidthVsAmpTH2)->Fill(cluster.charge, cluster.width);
1567 }
1568 //
1569 // -- Fill Layer Level MEs
1570 //
1572  if (layerswitchclusstonon) {
1573  fillME(layerMEs.LayerClusterStoN, cluster.charge / cluster.noise);
1574  if (createTrendMEs) {
1575  fillME(layerMEs.LayerClusterStoNTrend, trendVar, cluster.charge / cluster.noise);
1576  }
1577  }
1578 
1580  fillME(layerMEs.LayerClusterCharge, cluster.charge);
1581  if (createTrendMEs) {
1582  fillME(layerMEs.LayerClusterChargeTrend, trendVar, cluster.charge);
1583  }
1584  }
1585 
1586  if (layerswitchclusnoiseon) {
1587  fillME(layerMEs.LayerClusterNoise, cluster.noise);
1588  if (createTrendMEs) {
1589  fillME(layerMEs.LayerClusterNoiseTrend, trendVar, cluster.noise);
1590  }
1591  }
1592 
1593  if (layerswitchcluswidthon) {
1594  fillME(layerMEs.LayerClusterWidth, cluster.width);
1595  if (createTrendMEs) {
1596  fillME(layerMEs.LayerClusterWidthTrend, trendVar, cluster.width);
1597  }
1598  }
1599 
1601  fillME(layerMEs.LayerClusWidthVsAmpTH2, cluster.charge, cluster.width);
1602  }
1603 
1604  if (layerswitchclusposon) {
1605  fillME(layerMEs.LayerClusterPosition, cluster.position);
1606  }
1607 }
1608 //------------------------------------------------------------------------------------------
1610  DQMStore::IBooker& ibooker) {
1611  edm::ParameterSet ParametersTrend = trendVs10Ls_ ? conf_.getParameter<edm::ParameterSet>("TrendingLS")
1612  : conf_.getParameter<edm::ParameterSet>("Trending");
1613  MonitorElement* me = ibooker.bookProfile(HistoName,
1614  HistoName,
1615  ParametersTrend.getParameter<int32_t>("Nbins"),
1616  ParametersTrend.getParameter<double>("xmin"),
1617  ParametersTrend.getParameter<double>("xmax"),
1618  0,
1619  0,
1620  "");
1621  if (!me)
1622  return me;
1623  me->setAxisTitle(ParametersTrend.getParameter<std::string>("xaxis"), 1);
1624  if (me->kind() == MonitorElement::Kind::TPROFILE)
1625  me->getTH1()->SetCanExtend(TH1::kAllAxes);
1626  return me;
1627 }
1628 
1629 //------------------------------------------------------------------------------------------
1631  const char* HistoName,
1632  DQMStore::IBooker& ibooker) {
1633  Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
1634  return ibooker.book1D(HistoName,
1635  HistoName,
1636  Parameters.getParameter<int32_t>("Nbinx"),
1637  Parameters.getParameter<double>("xmin"),
1638  Parameters.getParameter<double>("xmax"));
1639 }
1640 
1641 //------------------------------------------------------------------------------------------
1643  const char* HistoName,
1644  DQMStore::IBooker& ibooker) {
1645  Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
1646  return ibooker.book2D(HistoName,
1647  HistoName,
1648  Parameters.getParameter<int32_t>("Nbinsx"),
1649  Parameters.getParameter<double>("xmin"),
1650  Parameters.getParameter<double>("xmax"),
1651  Parameters.getParameter<int32_t>("Nbinsy"),
1652  Parameters.getParameter<double>("ymin"),
1653  Parameters.getParameter<double>("ymax"));
1654 }
1655 
1656 int SiStripMonitorCluster::FindRegion(int nstrip, int npix) {
1657  double kplus = k0 * (1 + dk0 / 100);
1658  double kminus = k0 * (1 - dk0 / 100);
1659  int region = 0;
1660 
1661  if (nstrip != 0 && npix >= (nstrip * kminus - q0) && npix <= (nstrip * kplus + q0))
1662  region = 1;
1663  else if (nstrip != 0 && npix < (nstrip * kminus - q0) && nstrip <= maxClus)
1664  region = 2;
1665  else if (nstrip != 0 && npix < (nstrip * kminus - q0) && nstrip > maxClus)
1666  region = 3;
1667  else if (nstrip != 0 && npix > (nstrip * kplus + q0))
1668  region = 4;
1669  else if (npix > minPix && nstrip == 0)
1670  region = 5;
1671  return region;
1672 }
RunNumber_t run() const
Definition: EventID.h:38
MonitorElement * GlobalABXTH1_CSCP
void ResetModuleMEs(uint32_t idet)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
Definition: DQMStore.cc:239
T getParameter(std::string const &) const
int FindRegion(int nstrip, int npixel)
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 * GlobalTH2MainDiagonalPosition_vs_BX
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
MonitorElement * GlobalCStripVsCpix
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
bool IsStripBad(const uint32_t &detid, const short &strip) const
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)
Kind kind() const
Get the type of the monitor element.
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:31
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:62
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * NumberOfPixelClus
void setDetectorFolder(uint32_t rawdetid, const TrackerTopology *tTopo)
unsigned long long m_cacheID_
void Fill(long long x)
void createSubDetMEs(std::string label, DQMStore::IBooker &ibooker)
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
virtual void Reset()
reset ME (ie. contents, errors, etc)
std::map< uint32_t, ModMEs > ModuleMEsMap
bool getStatus(edm::Event const &e, edm::EventSetup const &eSetup)
char const * label
static float getNoise(uint16_t strip, const Range &range)
Definition: SiStripNoises.h:71
int iEvent
Definition: GenABIO.cc:224
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:73
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:19
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
MonitorElement * bookMETrend(const char *, DQMStore::IBooker &ibooker)
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, char const *option="s")
Definition: DQMStore.cc:333
bool empty() const
Definition: DetSetNew.h:70
data_type const * data(size_t cell) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::pair< ContainerIterator, ContainerIterator > Range
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s")
Definition: DQMStore.cc:381
int orbitNumber() const
Definition: EventBase.h:65
MonitorElement * NumberOfStripClus
std::string getSubdetid(uint32_t id, const TrackerTopology *tTopo, bool flag_ring)
MonitorElement * GlobalMainDiagonalPosition_vs_BX
bool isValid() const
Definition: HandleBase.h:70
MonitorElement * NumberOfStripClus_vs_BX
virtual 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)
edm::EDGetTokenT< EventWithHistory > historyProducerToken_
MonitorElement * bookME2D(const char *ParameterSetLabel, const char *HistoName, DQMStore::IBooker &ibooker)
MonitorElement * ClusWidthVsAmpTH2
MonitorElement * GlobalMainDiagonalPosition
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
SiStripDCSStatus * dcsStatus_
bool failedToGet() const
Definition: HandleBase.h:72
GenericTriggerEventFlag * genTriggerEventFlagBPTXfilter_
MonitorElement * LayerNumberOfClusterPerRingTrend
void fillME(MonitorElement *ME, float value1)
SiStripMonitorCluster(const edm::ParameterSet &)
T const * product() const
Definition: Handle.h:69
std::string createHistoId(std::string description, std::string id_type, uint32_t component_id)
virtual DQM_DEPRECATED void setStatOverflows(unsigned int value)
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:59
const Range getRange(const uint32_t detID) const
iterator end()
Definition: DetSetNew.h:56
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Definition: DQMStore.cc:266
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
T get() const
Definition: EventSetup.h:73
std::unique_ptr< TkHistoMap > tkmapcluster
unsigned int _orbit
Definition: TinyEvent.h:65
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:47
size_type size() const
Definition: DetSetNew.h:68
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_
T const * product() const
Definition: ESHandle.h:86
virtual TH1 * getTH1() const
MonitorElement * NclusVsCycleTimeProf2D
MonitorElement * bookME1D(const char *ParameterSetLabel, const char *HistoName, DQMStore::IBooker &ibooker)
void fillModuleMEs(ModMEs &mod_mes, ClusterProperties &cluster)
MonitorElement * SubDetNumberOfClusterPerLayerTrend
Definition: Run.h:45
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:71
int size() const
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
iterator begin()
Definition: DetSetNew.h:54