CMS 3D CMS Logo

SiStripCablingDQM.cc
Go to the documentation of this file.
4 #include "TCanvas.h"
5 using namespace std;
6 // -----
7 
9  edm::RunNumber_t iRun,
10  edm::ParameterSet const& hPSet,
11  edm::ParameterSet const& fPSet):SiStripBaseCondObjDQM(eSetup, iRun, hPSet, fPSet){
12 
13  // Build the Histo_TkMap:
14  if ( HistoMaps_On_ ) {
15  edm::ESHandle<TkDetMap> tkDetMapHandle;
16  eSetup.get<TrackerTopologyRcd>().get(tkDetMapHandle);
17  Tk_HM_ = std::make_unique<TkHistoMap>(tkDetMapHandle.product(), "SiStrip/Histo_Map","Cabling_TkMap",0.);
18  }
19 }
20 // -----
21 
22 // -----
24 // -----
25 
26 
27 
28 // -----
30 
31  //Retrieve tracker topology from geometry
33  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
34  const TrackerTopology* const tTopo = tTopoHandle.product();
35 
36  // Get active and total detIds
37  getConditionObject(eSetup);
38  if(!cablingHandle_.isValid()) {
39  edm::LogError("InvalidCablingHandle") << "Invalid Cabling Handle";
40  return;
41  }
44 
45 
46  //Initialize arrays for counting:
47  int counterTIB[4];
48  for(int i=0;i<4;i++) counterTIB[i]=0;
49  int counterTID[2][3];
50  for(int i=0;i<2;i++){
51  for(int j=0;j<3;j++)counterTID[i][j]=0;
52  }
53  int counterTOB[6];
54  for(int i=0;i<6;i++)counterTOB[i]=0;
55  int counterTEC[2][9];
56  for(int i=0;i<2;i++){
57  for(int j=0;j<9;j++)counterTEC[i][j]=0;
58  }
59 
60 
61 
62  std::vector<uint32_t>::const_iterator idet=activeDetIds.begin();
63 
64  //fill arrays for counting and fill Histo_Map with value for connected :
65  for(;idet!=activeDetIds.end();++idet){
66  uint32_t detId = *idet;
67  StripSubdetector subdet(detId);
68 
69  if(HistoMaps_On_ ) {Tk_HM_->fill(detId, cablingHandle_->nApvPairs(detId)*2);}
70  if(fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On")){
71 
72  int32_t n_conn = 0;
73  for(uint32_t connDet_i=0; connDet_i<cablingHandle_->getConnections(detId).size(); connDet_i++){
74  if(cablingHandle_->getConnections(detId)[connDet_i]!=nullptr && cablingHandle_->getConnections(detId)[connDet_i]->isConnected()!=0) n_conn++;
75  }
76  fillTkMap(detId,n_conn*2.);
77  }
78  switch (subdet.subdetId())
79  {
81  {
82  int i = tTopo->tibLayer(detId) - 1;
83  counterTIB[i]++;
84  break;
85  }
87  {
88  int j = tTopo->tidWheel(detId) - 1;
89  int side = tTopo->tidSide(detId);
90  if (side == 2) {
91  counterTID[0][j]++;
92  } else if (side == 1) {
93  counterTID[1][j]++;
94  }
95  break;
96  }
98  {
99  int i = tTopo->tobLayer(detId) - 1;
100  counterTOB[i]++;
101  break;
102  }
104  {
105  int j = tTopo->tecWheel(detId) - 1;
106  int side = tTopo->tecSide(detId);
107  if (side == 2) {
108  counterTEC[0][j]++;
109  } else if (side == 1) {
110  counterTEC[1][j]++;
111  }
112  break;
113  }
114  }
115 
116  } // idet
117 
118  //obtained from tracker.dat and hard-coded
119  int TIBDetIds[4]={672,864,540,648};
120  int TIDDetIds[2][3]={{136,136,136},{136,136,136}};
121  int TOBDetIds[6]={1008,1152,648,720,792,888};
122  int TECDetIds[2][9]={{408,408,408,360,360,360,312,312,272},{408,408,408,360,360,360,312,312,272}};
123 
124 
125 
127 
128  std::string FolderName=fPSet_.getParameter<std::string>("FolderName_For_QualityAndCabling_SummaryHistos");
129 
130  dqmStore_->setCurrentFolder(FolderName);
131 
132  // dqmStore_->cd("SiStrip/MechanicalView/");
134  ME = dqmStore_->book2D("SummaryOfCabling","SummaryOfCabling",6,0.5,6.5,9,0.5,9.5);
135  ME->setAxisTitle("Sub Det",1);
136  ME->setAxisTitle("Layer",2);
137 
138 
139  ME->getTH1()->GetXaxis()->SetBinLabel(1,"TIB");
140  ME->getTH1()->GetXaxis()->SetBinLabel(2,"TID F");
141  ME->getTH1()->GetXaxis()->SetBinLabel(3,"TID B");
142  ME->getTH1()->GetXaxis()->SetBinLabel(4,"TOB");
143  ME->getTH1()->GetXaxis()->SetBinLabel(5,"TEC F");
144  ME->getTH1()->GetXaxis()->SetBinLabel(6,"TEC B");
145 
146  for(int i=0;i<4;i++){
147  ME->Fill(1,i+1,float(counterTIB[i])/TIBDetIds[i]);
148  }
149 
150  for(int i=0;i<2;i++){
151  for(int j=0;j<3;j++){
152  ME->Fill(i+2,j+1,float(counterTID[i][j])/TIDDetIds[i][j]);
153  }
154  }
155 
156  for(int i=0;i<6;i++){
157  ME->Fill(4,i+1,float(counterTOB[i])/TOBDetIds[i]);
158  }
159 
160  for(int i=0;i<2;i++){
161  for(int j=0;j<9;j++){
162  ME->Fill(i+5,j+1,float(counterTEC[i][j])/TECDetIds[i][j]);
163  }
164  }
165 
166  if (fPSet_.getParameter<bool>("OutputSummaryAtLayerLevelAsImage")){
167 
168  TCanvas c1("c1");
169  ME->getTH1()->Draw("TEXT");
170  ME->getTH1()->SetStats(kFALSE);
171  std::string name (ME->getTH1()->GetTitle());
172  name+=".png";
173  c1.Print(name.c_str());
174  }
175 
176 }
177 
178 
T getParameter(std::string const &) const
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const
unsigned int tibLayer(const DetId &id) const
void getConditionObject(const edm::EventSetup &eSetup) override
TH1 * getTH1() const
unsigned int tidWheel(const DetId &id) const
void fillTkMap(const uint32_t &detid, const float &value)
void getActiveDetIds(const edm::EventSetup &eSetup) override
void Fill(long long x)
~SiStripCablingDQM() override
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
unsigned int tidSide(const DetId &id) const
edm::ESHandle< SiStripDetCabling > cablingHandle_
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:38
const T & get() const
Definition: EventSetup.h:59
const uint16_t nApvPairs(uint32_t det_id) const
MonitorElement ME
std::vector< uint32_t > activeDetIds
SiStripCablingDQM(const edm::EventSetup &eSetup, edm::RunNumber_t iRun, edm::ParameterSet const &hPSet, edm::ParameterSet const &fPSet)
unsigned int RunNumber_t
bool isValid() const
Definition: ESHandle.h:47
void addAllDetectorsRawIds(std::vector< uint32_t > &vector_to_fill_with_detids) const
unsigned int tecWheel(const DetId &id) const
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
T const * product() const
Definition: ESHandle.h:86
std::unique_ptr< TkHistoMap > Tk_HM_
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const