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