CMS 3D CMS Logo

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