CMS 3D CMS Logo

Phase2TrackerMonitorDigi.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Phase2TrackerMonitorDigi
4 // Class: Phase2TrackerMonitorDigi
5 //
11 //
12 // Author: Suchandra Dutta, Gourab Saha, Suvankar Roy Chowdhury, Subir Sarkar
13 // Date: January 29, 2016
14 // Date: November 8, 2019 (Modified for adding in phase2 DQM Offline)
15 //
16 // system include files
17 
18 #include <memory>
19 
21 
24 
28 
34 
39 
40 // DQM Histograming
43 
45 //
46 // constructors
47 //
49  : config_(iConfig),
50  pixelFlag_(config_.getParameter<bool>("PixelPlotFillingFlag")),
51  clsFlag_(config_.getParameter<bool>("StandAloneClusteriserFlag")),
52  geomType_(config_.getParameter<std::string>("GeometryType")),
53  otDigiSrc_(config_.getParameter<edm::InputTag>("OuterTrackerDigiSource")),
54  itPixelDigiSrc_(config_.getParameter<edm::InputTag>("InnerPixelDigiSource")),
55  otDigiToken_(consumes<edm::DetSetVector<Phase2TrackerDigi>>(otDigiSrc_)),
56  itPixelDigiToken_(consumes<edm::DetSetVector<PixelDigi>>(itPixelDigiSrc_)),
58  topoToken_(esConsumes<TrackerTopology, TrackerTopologyRcd, edm::Transition::BeginRun>()) {
59  edm::LogInfo("Phase2TrackerMonitorDigi") << ">>> Construct Phase2TrackerMonitorDigi ";
60 }
61 
62 //
63 // destructor
64 //
66  // do anything here that needs to be done at desctruction time
67  // (e.g. close files, deallocate resources etc.)
68  edm::LogInfo("Phase2TrackerMonitorDigi") << ">>> Destroy Phase2TrackerMonitorDigi ";
69 }
70 
72  tkGeom_ = &iSetup.getData(geomToken_);
73  tTopo_ = &iSetup.getData(topoToken_);
74 }
75 
76 // -- Analyze
77 //
79  using namespace edm;
80 
81  // Get digis
82  const auto& pixDigiHandle = iEvent.getHandle(itPixelDigiToken_);
83  const auto& otDigiHandle = iEvent.getHandle(otDigiToken_);
84 
85  // Tracker Topology
86  edm::ESWatcher<TrackerDigiGeometryRecord> theTkDigiGeomWatcher;
87  if (theTkDigiGeomWatcher.check(iSetup)) {
88  if (pixelFlag_)
89  fillITPixelDigiHistos(pixDigiHandle);
90  else
91  fillOTDigiHistos(otDigiHandle);
92  }
93 }
95  const edm::DetSetVector<PixelDigi>* digis = handle.product();
96 
97  for (typename edm::DetSetVector<PixelDigi>::const_iterator DSViter = digis->begin(); DSViter != digis->end();
98  DSViter++) {
99  unsigned int rawid = DSViter->id;
100  edm::LogInfo("Phase2TrackerMonitorDigi") << " Det Id = " << rawid;
101 
102  int layer = tTopo_->getITPixelLayerNumber(rawid);
103 
104  if (layer < 0)
105  continue;
106  const DetId detId(rawid);
107 
109  std::map<std::string, DigiMEs>::iterator pos = layerMEs.find(key);
110 
111  if (pos == layerMEs.end())
112  continue;
113 
115  continue;
116 
117  const GeomDetUnit* gDetUnit = tkGeom_->idToDetUnit(detId);
118  const GeomDet* geomDet = tkGeom_->idToDet(detId);
119 
120  const Phase2TrackerGeomDetUnit* tkDetUnit = dynamic_cast<const Phase2TrackerGeomDetUnit*>(gDetUnit);
121  int nRows = tkDetUnit->specificTopology().nrows();
122  int nColumns = tkDetUnit->specificTopology().ncolumns();
123  if (nRows * nColumns == 0)
124  continue;
125 
126  DigiMEs& local_mes = pos->second;
127 
128  local_mes.nHitDetsPerLayer++;
129 
130  int nDigi = 0;
131  int row_last = -1;
132  int col_last = -1;
133  std::vector<Ph2DigiCluster> digiClusters;
134  for (typename edm::DetSet<PixelDigi>::const_iterator di = DSViter->begin(); di != DSViter->end(); di++) {
135  int col = di->column(); // column
136  int row = di->row(); // row
137  int adc = di->adc(); // digi charge
138  if (geomDet) {
139  MeasurementPoint mp(row + 0.5, col + 0.5);
140  GlobalPoint pdPos = geomDet->surface().toGlobal(gDetUnit->topology().localPosition(mp));
141  if (XYPositionMap)
142  XYPositionMap->Fill(pdPos.x() * 10., pdPos.y() * 10.);
143  if (RZPositionMap)
144  RZPositionMap->Fill(pdPos.z() * 10., std::hypot(pdPos.x(), pdPos.y()) * 10.);
145  }
146  nDigi++;
147  edm::LogInfo("Phase2TrackerMonitorDigi") << " column " << col << " row " << row << std::dec << std::endl;
148  if (local_mes.ChargeXYMap)
149  local_mes.ChargeXYMap->Fill(col, row, adc);
150  if (local_mes.PositionOfDigisP)
151  local_mes.PositionOfDigisP->Fill(row + 1, col + 1);
152  if (local_mes.ChargeOfDigis)
153  local_mes.ChargeOfDigis->Fill(adc);
154  if (clsFlag_) {
155  if (row_last == -1 || abs(row - row_last) != 1 || col != col_last) {
156  Ph2DigiCluster dClus;
157  dClus.position = row + 1;
158  dClus.column = col;
159  dClus.width = 1;
160  dClus.charge = 255;
161  digiClusters.push_back(dClus);
162  } else {
163  int pos = digiClusters.back().position + row + 1;
164  int width = digiClusters.back().width + 1;
165  pos /= width;
166 
167  digiClusters.back().position = pos;
168  digiClusters.back().width += 1;
169  }
170  edm::LogInfo("Phase2TrackerMonitorDigi") << " row " << row << " col " << col << " row_last " << row_last
171  << " col_last " << col_last << " width " << digiClusters.back().width;
172  row_last = row;
173  col_last = col;
174  }
175  }
176  if (local_mes.NumberOfDigisPerDet)
177  local_mes.NumberOfDigisPerDet->Fill(nDigi);
178  if (clsFlag_)
179  fillDigiClusters(local_mes, digiClusters);
180  local_mes.nDigiPerLayer += nDigi;
181  float occupancy = 1.0;
182  if (nRows * nColumns > 0)
183  occupancy = nDigi * 1.0 / (nRows * nColumns);
184  if (geomDet) {
185  GlobalPoint gp = geomDet->surface().toGlobal(
186  gDetUnit->topology().localPosition(MeasurementPoint(nRows / 2.0, nColumns / 2.0)));
187  if (XYOccupancyMap)
188  XYOccupancyMap->Fill(gp.x() * 10., gp.y() * 10, occupancy);
189  if (RZOccupancyMap)
190  RZOccupancyMap->Fill(gp.z() * 10., std::hypot(gp.x(), gp.y()) * 10., occupancy);
191  if (local_mes.EtaOccupancyProfP)
192  local_mes.EtaOccupancyProfP->Fill(gp.eta(), occupancy);
193  }
194 
195  if (local_mes.DigiOccupancyP)
196  local_mes.DigiOccupancyP->Fill(occupancy);
197  }
198  // Fill histograms after loop over digis are complete
199  for (auto& ilayer : layerMEs) {
200  DigiMEs& local_mes = ilayer.second;
201  if (local_mes.TotalNumberOfDigisPerLayer)
202  local_mes.TotalNumberOfDigisPerLayer->Fill(local_mes.nDigiPerLayer);
203  if (local_mes.NumberOfHitDetectorsPerLayer)
204  local_mes.NumberOfHitDetectorsPerLayer->Fill(local_mes.nHitDetsPerLayer);
205  local_mes.nDigiPerLayer = 0;
206  local_mes.nHitDetsPerLayer = 0;
207  }
208 }
210  const edm::DetSetVector<Phase2TrackerDigi>* digis = handle.product();
211 
212  for (typename edm::DetSetVector<Phase2TrackerDigi>::const_iterator DSViter = digis->begin(); DSViter != digis->end();
213  DSViter++) {
214  unsigned int rawid = DSViter->id;
215  DetId detId(rawid);
216  edm::LogInfo("Phase2TrackerMonitorDigi") << " Det Id = " << rawid;
217  int layer = tTopo_->getOTLayerNumber(rawid);
218  if (layer < 0)
219  continue;
221  std::map<std::string, DigiMEs>::iterator pos = layerMEs.find(key);
222  if (pos == layerMEs.end())
223  continue;
224  DigiMEs& local_mes = pos->second;
225 
226  local_mes.nHitDetsPerLayer++;
228  continue;
229 
230  const GeomDetUnit* gDetUnit = tkGeom_->idToDetUnit(detId);
231  const GeomDet* geomDet = tkGeom_->idToDet(detId);
232 
233  const Phase2TrackerGeomDetUnit* tkDetUnit = dynamic_cast<const Phase2TrackerGeomDetUnit*>(gDetUnit);
234  int nRows = tkDetUnit->specificTopology().nrows();
235  int nColumns = tkDetUnit->specificTopology().ncolumns();
236  if (nRows * nColumns == 0)
237  continue;
238 
239  int nDigi = 0;
240  int row_last = -1;
241  int col_last = -1;
242  float frac_ot = 0.;
243  std::vector<Ph2DigiCluster> digiClusters;
244  for (typename edm::DetSet<Phase2TrackerDigi>::const_iterator di = DSViter->begin(); di != DSViter->end(); di++) {
245  int col = di->column(); // column
246  int row = di->row(); // row
247  const DetId detId(rawid);
248 
249  if (geomDet) {
250  MeasurementPoint mp(row + 0.5, col + 0.5);
251  GlobalPoint pdPos = geomDet->surface().toGlobal(gDetUnit->topology().localPosition(mp));
252  if (XYPositionMap)
253  XYPositionMap->Fill(pdPos.x() * 10., pdPos.y() * 10.);
254  if (RZPositionMap)
255  RZPositionMap->Fill(pdPos.z() * 10., std::hypot(pdPos.x(), pdPos.y()) * 10.);
256  }
257  nDigi++;
258  if (di->overThreshold())
259  frac_ot++;
260  edm::LogInfo("Phase2TrackerMonitorDigi") << " column " << col << " row " << row << std::dec << std::endl;
261  if (nColumns > 2 && local_mes.PositionOfDigisP)
262  local_mes.PositionOfDigisP->Fill(row + 1, col + 1);
263  if (nColumns <= 2 && local_mes.PositionOfDigisS)
264  local_mes.PositionOfDigisS->Fill(row + 1, col + 1);
265 
266  if (clsFlag_) {
267  if (row_last == -1 || abs(row - row_last) != 1 || col != col_last) {
268  Ph2DigiCluster dClus;
269  dClus.position = row + 1;
270  dClus.column = col;
271  dClus.width = 1;
272  dClus.charge = 255;
273  digiClusters.push_back(dClus);
274  } else {
275  int pos = digiClusters.back().position + row + 1;
276  int width = digiClusters.back().width + 1;
277  pos /= width;
278 
279  digiClusters.back().position = pos;
280  digiClusters.back().width += 1;
281  }
282  row_last = row;
283  col_last = col;
284  edm::LogInfo("Phase2TrackerMonitorDigi") << " row " << row << " col " << col << " row_last " << row_last
285  << " col_last " << col_last << " width " << digiClusters.back().width;
286  }
287  }
288  if (local_mes.NumberOfDigisPerDet)
289  local_mes.NumberOfDigisPerDet->Fill(nDigi);
290  if (clsFlag_)
291  fillDigiClusters(local_mes, digiClusters);
292  local_mes.nDigiPerLayer += nDigi;
293  if (nDigi)
294  frac_ot /= nDigi;
295  if (local_mes.FractionOfOvTBits && nColumns <= 2)
296  local_mes.FractionOfOvTBits->Fill(frac_ot);
297 
298  float occupancy = 1.0;
299  if (nRows * nColumns > 0)
300  occupancy = nDigi * 1.0 / (nRows * nColumns);
301  if (geomDet) {
302  GlobalPoint gp = geomDet->surface().toGlobal(gDetUnit->topology().localPosition(MeasurementPoint(0.0, 0.0)));
303  if (XYOccupancyMap)
304  XYOccupancyMap->Fill(gp.x() * 10., gp.y() * 10., occupancy);
305  if (RZOccupancyMap)
306  RZOccupancyMap->Fill(gp.z() * 10., std::hypot(gp.x(), gp.y()) * 10., occupancy);
307  if (nColumns > 2) {
308  if (local_mes.DigiOccupancyP)
309  local_mes.DigiOccupancyP->Fill(occupancy);
310  if (local_mes.EtaOccupancyProfP)
311  local_mes.EtaOccupancyProfP->Fill(gp.eta(), occupancy);
312  } else {
313  if (local_mes.DigiOccupancyS)
314  local_mes.DigiOccupancyS->Fill(occupancy);
315  if (local_mes.EtaOccupancyProfS)
316  local_mes.EtaOccupancyProfS->Fill(gp.eta(), occupancy);
317  if (local_mes.FractionOfOvTBitsVsEta)
318  local_mes.FractionOfOvTBitsVsEta->Fill(gp.eta(), frac_ot);
319  }
320  }
321  }
322  // Fill histograms after loop over digis are complete
323  for (auto& ilayer : layerMEs) {
324  DigiMEs& local_mes = ilayer.second;
325  if (local_mes.TotalNumberOfDigisPerLayer)
326  local_mes.TotalNumberOfDigisPerLayer->Fill(local_mes.nDigiPerLayer);
327  if (local_mes.NumberOfHitDetectorsPerLayer)
328  local_mes.NumberOfHitDetectorsPerLayer->Fill(local_mes.nHitDetsPerLayer);
329  local_mes.nDigiPerLayer = 0;
330  local_mes.nHitDetsPerLayer = 0;
331  }
332 }
333 //
334 // -- Book Histograms
335 //
337  edm::Run const& iRun,
338  edm::EventSetup const& iSetup) {
339  std::string top_folder = config_.getParameter<std::string>("TopFolderName");
340  edm::ESWatcher<TrackerDigiGeometryRecord> theTkDigiGeomWatcher;
341 
342  if (theTkDigiGeomWatcher.check(iSetup)) {
343  for (auto const& det_u : tkGeom_->detUnits()) {
344  unsigned int detId_raw = det_u->geographicalId().rawId();
345  bookLayerHistos(ibooker, detId_raw);
346  }
347  }
348  ibooker.cd();
349  std::stringstream folder_name;
350  folder_name << top_folder << "/"
351  << "DigiMonitor";
352  ibooker.setCurrentFolder(folder_name.str());
353 
355  edm::ParameterSet ParametersOcc = config_.getParameter<edm::ParameterSet>("DigiOccupancyPH");
356  if (Parameters.getParameter<bool>("switch"))
357  XYPositionMap = ibooker.book2D("DigiXPosVsYPos",
358  "DigiXPosVsYPos",
359  Parameters.getParameter<int32_t>("Nxbins"),
360  Parameters.getParameter<double>("xmin"),
361  Parameters.getParameter<double>("xmax"),
362  Parameters.getParameter<int32_t>("Nybins"),
363  Parameters.getParameter<double>("ymin"),
364  Parameters.getParameter<double>("ymax"));
365  else
366  XYPositionMap = nullptr;
367 
368  if (Parameters.getParameter<bool>("switch") && ParametersOcc.getParameter<bool>("switch"))
369  XYOccupancyMap = ibooker.bookProfile2D("OccupancyInXY",
370  "OccupancyInXY",
371  Parameters.getParameter<int32_t>("Nxbins"),
372  Parameters.getParameter<double>("xmin"),
373  Parameters.getParameter<double>("xmax"),
374  Parameters.getParameter<int32_t>("Nybins"),
375  Parameters.getParameter<double>("ymin"),
376  Parameters.getParameter<double>("ymax"),
377  ParametersOcc.getParameter<double>("xmin"),
378  ParametersOcc.getParameter<double>("xmax"));
379  else
380  XYOccupancyMap = nullptr;
381 
382  Parameters = config_.getParameter<edm::ParameterSet>("RZPositionMapH");
383  if (Parameters.getParameter<bool>("switch"))
384  RZPositionMap = ibooker.book2D("DigiRPosVsZPos",
385  "DigiRPosVsZPos",
386  Parameters.getParameter<int32_t>("Nxbins"),
387  Parameters.getParameter<double>("xmin"),
388  Parameters.getParameter<double>("xmax"),
389  Parameters.getParameter<int32_t>("Nybins"),
390  Parameters.getParameter<double>("ymin"),
391  Parameters.getParameter<double>("ymax"));
392  else
393  RZPositionMap = nullptr;
394 
395  if (Parameters.getParameter<bool>("switch") && ParametersOcc.getParameter<bool>("switch"))
396  RZOccupancyMap = ibooker.bookProfile2D("OccupancyInRZ",
397  "OccupancyInRZ",
398  Parameters.getParameter<int32_t>("Nxbins"),
399  Parameters.getParameter<double>("xmin"),
400  Parameters.getParameter<double>("xmax"),
401  Parameters.getParameter<int32_t>("Nybins"),
402  Parameters.getParameter<double>("ymin"),
403  Parameters.getParameter<double>("ymax"),
404  ParametersOcc.getParameter<double>("xmin"),
405  ParametersOcc.getParameter<double>("xmax"));
406  else
407  RZOccupancyMap = nullptr;
408 }
409 //
410 // -- Book Layer Histograms
411 //
413  int layer;
414  if (pixelFlag_)
416  else
417  layer = tTopo_->getOTLayerNumber(det_id);
418 
419  if (layer < 0)
420  return;
422  std::map<std::string, DigiMEs>::iterator pos = layerMEs.find(key);
423 
424  if (pos == layerMEs.end()) {
425  std::string top_folder = config_.getParameter<std::string>("TopFolderName");
426  std::stringstream folder_name;
427 
428  //For endCap: P-type sensors are present only upto ring 10 for discs 1&2 (TEDD-1) and upto ring 7 for discs 3,4&5 (TEDD-2)
429  bool isPStypeModForTEDD_1 =
430  (!pixelFlag_ && layer > 100 && tTopo_->tidWheel(det_id) < 3 && tTopo_->tidRing(det_id) <= 10) ? true : false;
431  bool isPStypeModForTEDD_2 =
432  (!pixelFlag_ && layer > 100 && tTopo_->tidWheel(det_id) >= 3 && tTopo_->tidRing(det_id) <= 7) ? true : false;
433 
434  bool isPtypeSensor =
435  (pixelFlag_ || (layer < 4 || (layer > 6 && (isPStypeModForTEDD_1 || isPStypeModForTEDD_2)))) ? true : false;
436 
437  ibooker.cd();
438  ibooker.setCurrentFolder(top_folder + "/DigiMonitor/" + key);
439  edm::LogInfo("Phase2TrackerMonitorDigi") << " Booking Histograms in : " << key;
440 
441  std::ostringstream HistoName;
442  DigiMEs local_mes;
443 
444  local_mes.nDigiPerLayer = 0;
445  local_mes.nHitDetsPerLayer = 0;
446 
448  edm::ParameterSet EtaParameters = config_.getParameter<edm::ParameterSet>("EtaH");
449  HistoName.str("");
450  HistoName << "NumberOfDigisPerDet";
451  if (Parameters.getParameter<bool>("switch"))
452  local_mes.NumberOfDigisPerDet = ibooker.book1D(HistoName.str(),
453  HistoName.str(),
454  Parameters.getParameter<int32_t>("Nbins"),
455  Parameters.getParameter<double>("xmin"),
456  Parameters.getParameter<double>("xmax"));
457  else
458  local_mes.NumberOfDigisPerDet = nullptr;
459 
460  Parameters = config_.getParameter<edm::ParameterSet>("TotalNumberOfDigisPerLayerH");
461  HistoName.str("");
462  HistoName << "TotalNumberOfDigisPerLayer";
463  if (Parameters.getParameter<bool>("switch"))
464  local_mes.TotalNumberOfDigisPerLayer = ibooker.book1D(HistoName.str(),
465  HistoName.str(),
466  Parameters.getParameter<int32_t>("Nbins"),
467  Parameters.getParameter<double>("xmin"),
468  Parameters.getParameter<double>("xmax"));
469  else
470  local_mes.TotalNumberOfDigisPerLayer = nullptr;
471 
472  Parameters = config_.getParameter<edm::ParameterSet>("NumberOfHitDetsPerLayerH");
473  HistoName.str("");
474  HistoName << "NumberOfHitDetectorsPerLayer";
475  if (Parameters.getParameter<bool>("switch"))
476  local_mes.NumberOfHitDetectorsPerLayer = ibooker.book1D(HistoName.str(),
477  HistoName.str(),
478  Parameters.getParameter<int32_t>("Nbins"),
479  Parameters.getParameter<double>("xmin"),
480  Parameters.getParameter<double>("xmax"));
481  else
482  local_mes.NumberOfHitDetectorsPerLayer = nullptr;
483 
484  // Plots only for the inner pixel
485  if (pixelFlag_) {
487  HistoName.str("");
488  HistoName << "ChargeXYMap";
489  if (Parameters.getParameter<bool>("switch"))
490  local_mes.ChargeXYMap = ibooker.book2D(HistoName.str(),
491  HistoName.str(),
492  Parameters.getParameter<int32_t>("Nxbins"),
493  Parameters.getParameter<double>("xmin"),
494  Parameters.getParameter<double>("xmax"),
495  Parameters.getParameter<int32_t>("Nybins"),
496  Parameters.getParameter<double>("ymin"),
497  Parameters.getParameter<double>("ymax"));
498  else
499  local_mes.ChargeXYMap = nullptr;
500 
502  HistoName.str("");
503  HistoName << "ChargeOfDigis";
504  if (Parameters.getParameter<bool>("switch"))
505  local_mes.ChargeOfDigis = ibooker.book1D(HistoName.str(),
506  HistoName.str(),
507  Parameters.getParameter<int32_t>("Nbins"),
508  Parameters.getParameter<double>("xmin"),
509  Parameters.getParameter<double>("xmax"));
510  else
511  local_mes.ChargeOfDigis = nullptr;
512 
513  // For standalone clusteriser
514  if (clsFlag_) {
515  edm::ParameterSet WidthParameters = config_.getParameter<edm::ParameterSet>("ClusterWidthH");
516  HistoName.str("");
517  HistoName << "ChargeOfDigisVsWidth";
518  if (Parameters.getParameter<bool>("switch") && WidthParameters.getParameter<bool>("switch"))
519  local_mes.ChargeOfDigisVsWidth = ibooker.book2D(HistoName.str(),
520  HistoName.str(),
521  Parameters.getParameter<int32_t>("Nbins"),
522  Parameters.getParameter<double>("xmin"),
523  Parameters.getParameter<double>("xmax"),
524  WidthParameters.getParameter<int32_t>("Nbins"),
525  WidthParameters.getParameter<double>("xmin"),
526  WidthParameters.getParameter<double>("xmax"));
527  else
528  local_mes.ChargeOfDigisVsWidth = nullptr;
529  }
530  }
531  // For outer tracker modules (S-type histograms)
532  else {
533  Parameters = config_.getParameter<edm::ParameterSet>("DigiOccupancySH");
534  HistoName.str("");
535  HistoName << "DigiOccupancyS";
536  if (Parameters.getParameter<bool>("switch"))
537  local_mes.DigiOccupancyS = ibooker.book1D(HistoName.str(),
538  HistoName.str(),
539  Parameters.getParameter<int32_t>("Nbins"),
540  Parameters.getParameter<double>("xmin"),
541  Parameters.getParameter<double>("xmax"));
542  else
543  local_mes.DigiOccupancyS = nullptr;
544 
545  HistoName.str("");
546  HistoName << "DigiOccupancyVsEtaS";
547  if (Parameters.getParameter<bool>("switch") && EtaParameters.getParameter<bool>("switch"))
548  local_mes.EtaOccupancyProfS = ibooker.bookProfile(HistoName.str(),
549  HistoName.str(),
550  EtaParameters.getParameter<int32_t>("Nbins"),
551  EtaParameters.getParameter<double>("xmin"),
552  EtaParameters.getParameter<double>("xmax"),
553  Parameters.getParameter<double>("xmin"),
554  Parameters.getParameter<double>("xmax"),
555  "");
556  else
557  local_mes.EtaOccupancyProfS = nullptr;
558 
559  Parameters = config_.getParameter<edm::ParameterSet>("PositionOfDigisSH");
560  HistoName.str("");
561  HistoName << "PositionOfDigisS";
562  if (Parameters.getParameter<bool>("switch"))
563  local_mes.PositionOfDigisS = ibooker.book2D(HistoName.str(),
564  HistoName.str(),
565  Parameters.getParameter<int32_t>("Nxbins"),
566  Parameters.getParameter<double>("xmin"),
567  Parameters.getParameter<double>("xmax"),
568  Parameters.getParameter<int32_t>("Nybins"),
569  Parameters.getParameter<double>("ymin"),
570  Parameters.getParameter<double>("ymax"));
571  else
572  local_mes.PositionOfDigisS = nullptr;
573 
574  // For standalone clusteriser
575  if (clsFlag_) {
576  Parameters = config_.getParameter<edm::ParameterSet>("ClusterPositionSH");
577  HistoName.str("");
578  HistoName << "ClusterPositionS";
579  if (Parameters.getParameter<bool>("switch"))
580  local_mes.ClusterPositionS = ibooker.book2D(HistoName.str(),
581  HistoName.str(),
582  Parameters.getParameter<int32_t>("Nxbins"),
583  Parameters.getParameter<double>("xmin"),
584  Parameters.getParameter<double>("xmax"),
585  Parameters.getParameter<int32_t>("Nybins"),
586  Parameters.getParameter<double>("ymin"),
587  Parameters.getParameter<double>("ymax"));
588  else
589  local_mes.ClusterPositionS = nullptr;
590  }
591  // Only for the S-type sensor of PS module
592  // FracOfOverThresholdBits is only available for S-type sensor of PS module
593  if (isPStypeModForTEDD_1 || isPStypeModForTEDD_2) {
594  HistoName.str("");
595  HistoName << "FractionOfOverThresholdDigis";
596  local_mes.FractionOfOvTBits = ibooker.book1D(HistoName.str(), HistoName.str(), 11, -0.05, 1.05);
597 
598  Parameters = config_.getParameter<edm::ParameterSet>("NumberOfDigisPerDetH");
599  HistoName.str("");
600  HistoName << "FractionOfOverThresholdDigisVaEta";
601  if (Parameters.getParameter<bool>("switch") && EtaParameters.getParameter<bool>("switch"))
602  local_mes.FractionOfOvTBitsVsEta = ibooker.bookProfile(HistoName.str(),
603  HistoName.str(),
604  EtaParameters.getParameter<int32_t>("Nbins"),
605  EtaParameters.getParameter<double>("xmin"),
606  EtaParameters.getParameter<double>("xmax"),
607  Parameters.getParameter<double>("xmin"),
608  Parameters.getParameter<double>("xmax"),
609  "");
610  else
611  local_mes.FractionOfOvTBitsVsEta = nullptr;
612  }
613  }
614 
615  // Plots for P-type sensor (Pixel or P-side of PS module)
616  if (isPtypeSensor) {
617  Parameters = config_.getParameter<edm::ParameterSet>("DigiOccupancyPH");
618  HistoName.str("");
619  HistoName << "DigiOccupancyP";
620  if (Parameters.getParameter<bool>("switch"))
621  local_mes.DigiOccupancyP = ibooker.book1D(HistoName.str(),
622  HistoName.str(),
623  Parameters.getParameter<int32_t>("Nbins"),
624  Parameters.getParameter<double>("xmin"),
625  Parameters.getParameter<double>("xmax"));
626  else
627  local_mes.DigiOccupancyP = nullptr;
628 
629  HistoName.str("");
630  HistoName << "DigiOccupancyVsEtaP";
631  if (Parameters.getParameter<bool>("switch") && EtaParameters.getParameter<bool>("switch"))
632  local_mes.EtaOccupancyProfP = ibooker.bookProfile(HistoName.str(),
633  HistoName.str(),
634  EtaParameters.getParameter<int32_t>("Nbins"),
635  EtaParameters.getParameter<double>("xmin"),
636  EtaParameters.getParameter<double>("xmax"),
637  Parameters.getParameter<double>("xmin"),
638  Parameters.getParameter<double>("xmax"),
639  "");
640  else
641  local_mes.EtaOccupancyProfP = nullptr;
642 
643  Parameters = config_.getParameter<edm::ParameterSet>("PositionOfDigisPH");
644  HistoName.str("");
645  HistoName << "PositionOfDigisP";
646  if (Parameters.getParameter<bool>("switch"))
647  local_mes.PositionOfDigisP = ibooker.book2D(HistoName.str(),
648  HistoName.str(),
649  Parameters.getParameter<int32_t>("Nxbins"),
650  Parameters.getParameter<double>("xmin"),
651  Parameters.getParameter<double>("xmax"),
652  Parameters.getParameter<int32_t>("Nybins"),
653  Parameters.getParameter<double>("ymin"),
654  Parameters.getParameter<double>("ymax"));
655  else
656  local_mes.PositionOfDigisP = nullptr;
657 
658  if (clsFlag_) {
659  Parameters = config_.getParameter<edm::ParameterSet>("ClusterPositionPH");
660  HistoName.str("");
661  HistoName << "ClusterPositionP";
662  if (Parameters.getParameter<bool>("switch"))
663  local_mes.ClusterPositionP = ibooker.book2D(HistoName.str(),
664  HistoName.str(),
665  Parameters.getParameter<int32_t>("Nxbins"),
666  Parameters.getParameter<double>("xmin"),
667  Parameters.getParameter<double>("xmax"),
668  Parameters.getParameter<int32_t>("Nybins"),
669  Parameters.getParameter<double>("ymin"),
670  Parameters.getParameter<double>("ymax"));
671  else
672  local_mes.ClusterPositionP = nullptr;
673  }
674  }
675 
676  // Plots for Standalone clusters (Can be switched on from configs)
677  if (clsFlag_) {
678  Parameters = config_.getParameter<edm::ParameterSet>("NumberOfClustersPerDetH");
679  HistoName.str("");
680  HistoName << "NumberOfClustersPerDet";
681  if (Parameters.getParameter<bool>("switch"))
682  local_mes.NumberOfClustersPerDet = ibooker.book1D(HistoName.str(),
683  HistoName.str(),
684  Parameters.getParameter<int32_t>("Nbins"),
685  Parameters.getParameter<double>("xmin"),
686  Parameters.getParameter<double>("xmax"));
687  else
688  local_mes.NumberOfClustersPerDet = nullptr;
689 
690  Parameters = config_.getParameter<edm::ParameterSet>("ClusterWidthH");
691  HistoName.str("");
692  HistoName << "ClusterWidth";
693  if (Parameters.getParameter<bool>("switch"))
694  local_mes.ClusterWidth = ibooker.book1D(HistoName.str(),
695  HistoName.str(),
696  Parameters.getParameter<int32_t>("Nbins"),
697  Parameters.getParameter<double>("xmin"),
698  Parameters.getParameter<double>("xmax"));
699  else
700  local_mes.ClusterWidth = nullptr;
701  }
702 
703  layerMEs.insert(std::make_pair(key, local_mes));
704  }
705 }
706 
708  if (flag)
709  return phase2tkutil::getITHistoId(det_id, tTopo_);
710  else
711  return phase2tkutil::getOTHistoId(det_id, tTopo_);
712 }
713 
714 void Phase2TrackerMonitorDigi::fillDigiClusters(DigiMEs& mes, std::vector<Ph2DigiCluster>& digi_clusters) {
715  int nclus = digi_clusters.size();
716  if (mes.NumberOfClustersPerDet)
717  mes.NumberOfClustersPerDet->Fill(nclus);
718  for (auto& iclus : digi_clusters) {
719  if (mes.ClusterWidth)
720  mes.ClusterWidth->Fill(iclus.width);
721  if (pixelFlag_ && mes.ChargeOfDigisVsWidth)
722  mes.ChargeOfDigisVsWidth->Fill(iclus.charge, iclus.width);
723  if (mes.ClusterPositionP)
724  mes.ClusterPositionP->Fill(iclus.position, iclus.column + 1);
725  if (!pixelFlag_ && mes.ClusterPositionS && iclus.column <= 2)
726  mes.ClusterPositionS->Fill(iclus.position, iclus.column + 1);
727  }
728 }
729 //define this as a plug-in
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
MPlex< T, D1, D2, N > hypot(const MPlex< T, D1, D2, N > &a, const MPlex< T, D1, D2, N > &b)
Definition: Matriplex.h:417
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:476
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
virtual int ncolumns() const =0
T z() const
Definition: PV3DBase.h:61
virtual const Topology & topology() const
Definition: GeomDet.cc:67
unsigned int tidWheel(const DetId &id) const
virtual int nrows() const =0
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
std::string getITHistoId(uint32_t det_id, const TrackerTopology *tTopo)
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
const edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > itPixelDigiToken_
void fillOTDigiHistos(const edm::Handle< edm::DetSetVector< Phase2TrackerDigi >> handle)
void fillITPixelDigiHistos(const edm::Handle< edm::DetSetVector< PixelDigi >> handle)
std::map< std::string, DigiMEs > layerMEs
void Fill(long long x)
int getITPixelLayerNumber(const DetId &id) const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
int iEvent
Definition: GenABIO.cc:224
std::string getOTHistoId(uint32_t det_id, const TrackerTopology *tTopo)
int getOTLayerNumber(const DetId &id) const
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:399
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Transition
Definition: Transition.h:12
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void dqmBeginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
const TrackerGeomDet * idToDet(DetId) const override
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:316
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
Log< level::Info, false > LogInfo
const TrackerGeometry * tkGeom_
Definition: DetId.h:17
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
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:212
Phase2TrackerMonitorDigi(const edm::ParameterSet &)
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
std::string HistoName
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
void fillDigiClusters(DigiMEs &mes, std::vector< Ph2DigiCluster > &digi_clusters)
std::vector< AlignmentParameters * > Parameters
Definition: Utilities.h:32
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &iRun, edm::EventSetup const &iSetup) override
HLT enums.
const TrackerTopology * tTopo_
void bookLayerHistos(DQMStore::IBooker &ibooker, unsigned int det_id)
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
std::string getHistoId(uint32_t det_id, bool flag)
col
Definition: cuy.py:1009
unsigned int tidRing(const DetId &id) const
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:305
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
collection_type::const_iterator const_iterator
Definition: DetSet.h:31
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
const edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > otDigiToken_
Definition: Run.h:45
uint16_t *__restrict__ uint16_t const *__restrict__ adc