CMS 3D CMS Logo

SiStripCablingDQM.cc
Go to the documentation of this file.
4 #include "TCanvas.h"
5 
7  edm::RunNumber_t iRun,
8  edm::ParameterSet const &hPSet,
9  edm::ParameterSet const &fPSet,
10  const TrackerTopology *tTopo,
11  const TkDetMap *tkDetMap)
13  if (HistoMaps_On_) {
14  Tk_HM_ = std::make_unique<TkHistoMap>(tkDetMap, "SiStrip/Histo_Map", "Cabling_TkMap", 0.);
15  }
16 }
17 
19 
21  // Get active and total detIds
22  getConditionObject(eSetup);
23  if (!condObj_) {
24  edm::LogError("InvalidCablingHandle") << "Invalid Cabling Handle";
25  return;
26  }
29 
30  // Initialize arrays for counting:
31  int counterTIB[4];
32  for (int i = 0; i < 4; i++)
33  counterTIB[i] = 0;
34  int counterTID[2][3];
35  for (int i = 0; i < 2; i++) {
36  for (int j = 0; j < 3; j++)
37  counterTID[i][j] = 0;
38  }
39  int counterTOB[6];
40  for (int i = 0; i < 6; i++)
41  counterTOB[i] = 0;
42  int counterTEC[2][9];
43  for (int i = 0; i < 2; i++) {
44  for (int j = 0; j < 9; j++)
45  counterTEC[i][j] = 0;
46  }
47 
48  // fill arrays for counting and fill Histo_Map with value for connected :
49  for (const auto detId : activeDetIds) {
50  StripSubdetector subdet(detId);
51 
52  if (HistoMaps_On_) {
53  Tk_HM_->fill(detId, condObj_->nApvPairs(detId) * 2);
54  }
55  if (fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On")) {
56  int32_t n_conn = 0;
57  for (uint32_t connDet_i = 0; connDet_i < condObj_->getConnections(detId).size(); connDet_i++) {
58  if (condObj_->getConnections(detId)[connDet_i] != nullptr &&
59  condObj_->getConnections(detId)[connDet_i]->isConnected() != 0)
60  n_conn++;
61  }
62  fillTkMap(detId, n_conn * 2.);
63  }
64  switch (subdet.subdetId()) {
65  case StripSubdetector::TIB: {
66  int i = tTopo_->tibLayer(detId) - 1;
67  counterTIB[i]++;
68  break;
69  }
70  case StripSubdetector::TID: {
71  int j = tTopo_->tidWheel(detId) - 1;
72  int side = tTopo_->tidSide(detId);
73  if (side == 2) {
74  counterTID[0][j]++;
75  } else if (side == 1) {
76  counterTID[1][j]++;
77  }
78  break;
79  }
80  case StripSubdetector::TOB: {
81  int i = tTopo_->tobLayer(detId) - 1;
82  counterTOB[i]++;
83  break;
84  }
85  case StripSubdetector::TEC: {
86  int j = tTopo_->tecWheel(detId) - 1;
87  int side = tTopo_->tecSide(detId);
88  if (side == 2) {
89  counterTEC[0][j]++;
90  } else if (side == 1) {
91  counterTEC[1][j]++;
92  }
93  break;
94  }
95  }
96 
97  } // idet
98 
99  // obtained from tracker.dat and hard-coded
100  int TIBDetIds[4] = {672, 864, 540, 648};
101  int TIDDetIds[2][3] = {{136, 136, 136}, {136, 136, 136}};
102  int TOBDetIds[6] = {1008, 1152, 648, 720, 792, 888};
103  int TECDetIds[2][9] = {{408, 408, 408, 360, 360, 360, 312, 312, 272}, {408, 408, 408, 360, 360, 360, 312, 312, 272}};
104 
106 
107  std::string FolderName = fPSet_.getParameter<std::string>("FolderName_For_QualityAndCabling_SummaryHistos");
108 
110 
111  // dqmStore_->cd("SiStrip/MechanicalView/");
113  ME = dqmStore_->book2D("SummaryOfCabling", "SummaryOfCabling", 6, 0.5, 6.5, 9, 0.5, 9.5);
114  ME->setAxisTitle("Sub Det", 1);
115  ME->setAxisTitle("Layer", 2);
116 
117  ME->setBinLabel(1, "TIB");
118  ME->setBinLabel(2, "TID F");
119  ME->setBinLabel(3, "TID B");
120  ME->setBinLabel(4, "TOB");
121  ME->setBinLabel(5, "TEC F");
122  ME->setBinLabel(6, "TEC B");
123 
124  for (int i = 0; i < 4; i++) {
125  ME->Fill(1, i + 1, float(counterTIB[i]) / TIBDetIds[i]);
126  }
127 
128  for (int i = 0; i < 2; i++) {
129  for (int j = 0; j < 3; j++) {
130  ME->Fill(i + 2, j + 1, float(counterTID[i][j]) / TIDDetIds[i][j]);
131  }
132  }
133 
134  for (int i = 0; i < 6; i++) {
135  ME->Fill(4, i + 1, float(counterTOB[i]) / TOBDetIds[i]);
136  }
137 
138  for (int i = 0; i < 2; i++) {
139  for (int j = 0; j < 9; j++) {
140  ME->Fill(i + 5, j + 1, float(counterTEC[i][j]) / TECDetIds[i][j]);
141  }
142  }
143 
144  if (fPSet_.getParameter<bool>("OutputSummaryAtLayerLevelAsImage")) {
145  TCanvas c1("c1");
146  ME->getTH1()->Draw("TEXT");
147  ME->getTH1()->SetStats(kFALSE);
148  std::string name(ME->getTitle());
149  name += ".png";
150  c1.Print(name.c_str());
151  }
152 }
static constexpr auto TEC
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
unsigned int tobLayer(const DetId &id) const
const TrackerTopology * tTopo_
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
SiStripCablingDQM(edm::ESGetToken< SiStripDetCabling, SiStripDetCablingRcd > token, edm::RunNumber_t iRun, edm::ParameterSet const &hPSet, edm::ParameterSet const &fPSet, const TrackerTopology *tTopo, const TkDetMap *tkDetMap)
unsigned int tidSide(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:646
Log< level::Error, false > LogError
void fillTkMap(const uint32_t &detid, const float &value)
void getActiveDetIds(const edm::EventSetup &eSetup) override
~SiStripCablingDQM() override
Definition: ME.h:11
unsigned int tecSide(const DetId &id) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
static constexpr auto TIB
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
void addAllDetectorsRawIds(std::vector< uint32_t > &vector_to_fill_with_detids) const
dqm::harvesting::MonitorElement ME
std::vector< uint32_t > activeDetIds
unsigned int RunNumber_t
unsigned int tibLayer(const DetId &id) const
static constexpr auto TID
const uint16_t nApvPairs(uint32_t det_id) const
std::unique_ptr< TkHistoMap > Tk_HM_
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const