CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripCablingDQM.cc
Go to the documentation of this file.
3 #include "TCanvas.h"
4 using namespace std;
5 // -----
6 
8  edm::ParameterSet const& hPSet,
9  edm::ParameterSet const& fPSet):SiStripBaseCondObjDQM(eSetup, hPSet, fPSet){
10 
11  // Build the Histo_TkMap:
12  if(HistoMaps_On_ ) Tk_HM_ = new TkHistoMap("SiStrip/Histo_Map","Cabling_TkMap",0.);
13 
14 }
15 // -----
16 
17 // -----
19 // -----
20 
21 
22 
23 // -----
25 
26  // Get active and total detIds
27  getConditionObject(eSetup);
28  if(!cablingHandle_.isValid()) {
29  edm::LogError("InvalidCablingHandle") << "Invalid Cabling Handle";
30  return;
31  }
32  cablingHandle_->addActiveDetectorsRawIds(activeDetIds);
33  cablingHandle_->addAllDetectorsRawIds(activeDetIds);
34 
35 
36  //Initialize arrays for counting:
37  int counterTIB[4];
38  for(int i=0;i<4;i++) counterTIB[i]=0;
39  int counterTID[2][3];
40  for(int i=0;i<2;i++){
41  for(int j=0;j<3;j++)counterTID[i][j]=0;
42  }
43  int counterTOB[6];
44  for(int i=0;i<6;i++)counterTOB[i]=0;
45  int counterTEC[2][9];
46  for(int i=0;i<2;i++){
47  for(int j=0;j<9;j++)counterTEC[i][j]=0;
48  }
49 
50 
51 
52  std::vector<uint32_t>::const_iterator idet=activeDetIds.begin();
53 
54  //fill arrays for counting and fill Histo_Map with value for connected :
55  for(;idet!=activeDetIds.end();++idet){
56  uint32_t detId = *idet;
57  StripSubdetector subdet(detId);
58 
59  if(HistoMaps_On_ ) {Tk_HM_->fill(detId, cablingHandle_->nApvPairs(detId)*2);}
60  if(fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On")){
61 
62  int32_t n_conn = 0;
63  for(uint32_t connDet_i=0; connDet_i<cablingHandle_->getConnections(detId).size(); connDet_i++){
64  if(cablingHandle_->getConnections(detId)[connDet_i]!=0 && cablingHandle_->getConnections(detId)[connDet_i]->isConnected()!=0) n_conn++;
65  }
66  fillTkMap(detId,n_conn*2.);
67  }
68  switch (subdet.subdetId())
69  {
71  {
72  TIBDetId tibId(detId);
73  int i = tibId.layer() - 1;
74  counterTIB[i]++;
75  break;
76  }
78  {
79  TIDDetId tidId(detId);
80  if (tidId.side() == 2) {
81  int j = tidId.wheel() - 1;
82  counterTID[0][j]++;
83  } else if (tidId.side() == 1) {
84  int j = tidId.wheel() - 1;
85  counterTID[1][j]++;
86  }
87  break;
88  }
90  {
91  TOBDetId tobId(detId);
92  int i = tobId.layer() - 1;
93  counterTOB[i]++;
94  break;
95  }
97  {
98  TECDetId tecId(detId);
99  if (tecId.side() == 2) {
100  int j = tecId.wheel() - 1;
101  counterTEC[0][j]++;
102  } else if (tecId.side() == 1) {
103  int j = tecId.wheel() - 1;
104  counterTEC[1][j]++;
105  }
106  break;
107  }
108  }
109 
110  } // idet
111 
112  //obtained from tracker.dat and hard-coded
113  int TIBDetIds[4]={672,864,540,648};
114  int TIDDetIds[2][3]={{136,136,136},{136,136,136}};
115  int TOBDetIds[6]={1008,1152,648,720,792,888};
116  int TECDetIds[2][9]={{408,408,408,360,360,360,312,312,272},{408,408,408,360,360,360,312,312,272}};
117 
118 
119 
121 
122  std::string FolderName=fPSet_.getParameter<std::string>("FolderName_For_QualityAndCabling_SummaryHistos");
123 
124  dqmStore_->setCurrentFolder(FolderName);
125 
126  // dqmStore_->cd("SiStrip/MechanicalView/");
128  ME = dqmStore_->book2D("SummaryOfCabling","SummaryOfCabling",6,0.5,6.5,9,0.5,9.5);
129  ME->setAxisTitle("Sub Det",1);
130  ME->setAxisTitle("Layer",2);
131 
132 
133  ME->getTH1()->GetXaxis()->SetBinLabel(1,"TIB");
134  ME->getTH1()->GetXaxis()->SetBinLabel(2,"TID F");
135  ME->getTH1()->GetXaxis()->SetBinLabel(3,"TID B");
136  ME->getTH1()->GetXaxis()->SetBinLabel(4,"TOB");
137  ME->getTH1()->GetXaxis()->SetBinLabel(5,"TEC F");
138  ME->getTH1()->GetXaxis()->SetBinLabel(6,"TEC B");
139 
140  for(int i=0;i<4;i++){
141  ME->Fill(1,i+1,float(counterTIB[i])/TIBDetIds[i]);
142  }
143 
144  for(int i=0;i<2;i++){
145  for(int j=0;j<3;j++){
146  ME->Fill(i+2,j+1,float(counterTID[i][j])/TIDDetIds[i][j]);
147  }
148  }
149 
150  for(int i=0;i<6;i++){
151  ME->Fill(4,i+1,float(counterTOB[i])/TOBDetIds[i]);
152  }
153 
154  for(int i=0;i<2;i++){
155  for(int j=0;j<9;j++){
156  ME->Fill(i+5,j+1,float(counterTEC[i][j])/TECDetIds[i][j]);
157  }
158  }
159 
160  if (fPSet_.getParameter<bool>("OutputSummaryAtLayerLevelAsImage")){
161 
162  TCanvas c1("c1");
163  ME->getTH1()->Draw("TEXT");
164  ME->getTH1()->SetStats(kFALSE);
165  std::string name (ME->getTH1()->GetTitle());
166  name+=".png";
167  c1.Print(name.c_str());
168  }
169 
170 }
171 
172 
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
ADDITON OF TK_HISTO_MAP.
unsigned int layer() const
layer id
Definition: TOBDetId.h:39
void fillTkMap(const uint32_t &detid, const float &value)
unsigned int side() const
positive or negative id
Definition: TECDetId.h:47
void Fill(long long x)
void fill(uint32_t &detid, float value)
Definition: TkHistoMap.cc:130
int j
Definition: DBlmapReader.cc:9
TH1 * getTH1(void) const
void getConditionObject(const edm::EventSetup &eSetup)
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:39
SiStripCablingDQM(const edm::EventSetup &eSetup, edm::ParameterSet const &hPSet, edm::ParameterSet const &fPSet)
unsigned int side() const
positive or negative id
Definition: TIDDetId.h:45
void getActiveDetIds(const edm::EventSetup &eSetup)
unsigned int wheel() const
wheel id
Definition: TECDetId.h:52
MonitorElement ME
unsigned int layer() const
layer id
Definition: TIBDetId.h:41
std::vector< uint32_t > activeDetIds
bool isValid() const
Definition: ESHandle.h:37
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:845
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
unsigned int wheel() const
wheel id
Definition: TIDDetId.h:50