CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripThresholdDQM.cc
Go to the documentation of this file.
3 
4 #include "TCanvas.h"
5 
6 // -----
8  edm::ParameterSet const& hPSet,
9  edm::ParameterSet const& fPSet):SiStripBaseCondObjDQM(eSetup, hPSet, fPSet){
10  WhichThreshold=hPSet.getParameter<std::string>("WhichThreshold");
11 
12  // Build the Histo_TkMap:
13  if(HistoMaps_On_ ){
14  if(WhichThreshold=="Low") Tk_HM_L = new TkHistoMap("SiStrip/Histo_Map","LowThresh_TkMap",0.);
15  if(WhichThreshold=="High") Tk_HM_H = new TkHistoMap("SiStrip/Histo_Map","HighThresh_TkMap",0.);
16  }
17 }
18 
19 // -----
20 
21 
22 
23 // -----
25 // -----
26 
27 
28 // -----
30 
31  getConditionObject(eSetup);
32  thresholdHandle_->getDetIds(activeDetIds);
33 }
34 // -----
35 
36 //=====================================================================================
37 
38 
39 // -----
40 void SiStripThresholdDQM::fillModMEs(const std::vector<uint32_t> & selectedDetIds){
41 
42  ModMEs CondObj_ME;
43 
44 
45  for(std::vector<uint32_t>::const_iterator detIter_ = selectedDetIds.begin();
46  detIter_!= selectedDetIds.end();detIter_++){
47 
48  fillMEsForDet(CondObj_ME,*detIter_);
49 
50  }
51 }
52 // -----
53 
54 
55 
56 //======================================================================================
57 // -----
58 
59 
60 
61 void SiStripThresholdDQM::fillMEsForDet(ModMEs selModME_, uint32_t selDetId_){
62 
63  std::vector<uint32_t> DetIds;
64  thresholdHandle_->getDetIds(DetIds);
65 
66 
67  SiStripThreshold::Range ThresholdRange = thresholdHandle_->getRange(selDetId_);
68  int nStrip = reader->getNumberOfApvsAndStripLength(selDetId_).first*128;
69 
70 
71  getModMEs(selModME_,selDetId_);
72 
73 
74 
75  for( int istrip=0;istrip<nStrip;++istrip){
76  if( CondObj_fillId_ =="onlyProfile" || CondObj_fillId_ =="ProfileAndCumul"){
77  if(WhichThreshold=="Low")
78  selModME_.ProfileDistr->Fill(istrip+1,thresholdHandle_->getData(istrip,ThresholdRange).getLth());
79  if(WhichThreshold=="High")
80  selModME_.ProfileDistr->Fill(istrip+1,thresholdHandle_->getData(istrip,ThresholdRange).getHth());
81  }
82  }// istrip
83 
84 
85 }
86 
87 
88 // -----
89 
90 
91 
92 //=======================================================================================
93 // -----
94 void SiStripThresholdDQM::fillSummaryMEs(const std::vector<uint32_t> & selectedDetIds){
95 
96  for(std::vector<uint32_t>::const_iterator detIter_ = selectedDetIds.begin();
97  detIter_!= selectedDetIds.end();detIter_++){
98  fillMEsForLayer(/*SummaryMEsMap_,*/ *detIter_);
99 
100  }
101 
102 }
103 // -----
104 
105 
106 //=======================================================================================
107 // -----
108 void SiStripThresholdDQM::fillMEsForLayer( /*std::map<uint32_t, ModMEs> selMEsMap_,*/ uint32_t selDetId_){
109 
110  // ----
111  int subdetectorId_ = ((selDetId_>>25)&0x7);
112 
113  if( subdetectorId_<3 || subdetectorId_>6 ){
114  edm::LogError("SiStripThresholdDQM")
115  << "[SiStripThresholdDQM::fillMEsForLayer] WRONG INPUT : no such subdetector type : "
116  << subdetectorId_ << " no folder set!"
117  << std::endl;
118  return;
119  }
120  // ----
121 
122  std::map<uint32_t, ModMEs>::iterator selMEsMapIter_ = SummaryMEsMap_.find(getLayerNameAndId(selDetId_).second);
123  ModMEs selME_;
124  if ( selMEsMapIter_ != SummaryMEsMap_.end())
125  selME_ =selMEsMapIter_->second;
126 
127  getSummaryMEs(selME_,selDetId_);
128 
129 
130  SiStripThreshold::Range ThresholdRange = thresholdHandle_->getRange(selDetId_);
131 
132  int nStrip = reader->getNumberOfApvsAndStripLength(selDetId_).first*128;
133 
135 
136 
137  if(hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel")){
138  // --> profile summary
139 
140  std::string hSummaryOfProfile_description;
141  hSummaryOfProfile_description = hPSet_.getParameter<std::string>("SummaryOfProfile_description");
142 
143  std::string hSummaryOfProfile_name;
144 
145  hSummaryOfProfile_name = hidmanager.createHistoLayer(hSummaryOfProfile_description, "layer", getLayerNameAndId(selDetId_).first, "") ;
146 
147 
148 
149  for( int istrip=0;istrip<nStrip;++istrip){
150 
151  if( CondObj_fillId_ =="onlyProfile" || CondObj_fillId_ =="ProfileAndCumul"){
152  if(WhichThreshold=="Low"){
153  selME_.SummaryOfProfileDistr->Fill(istrip+1,thresholdHandle_->getData(istrip,ThresholdRange).getLth());
154  if(fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On")) fillTkMap(selDetId_, thresholdHandle_->getData(istrip,ThresholdRange).getLth());
155  }
156  if(WhichThreshold=="High"){
157  selME_.SummaryOfProfileDistr->Fill(istrip+1,thresholdHandle_->getData(istrip,ThresholdRange).getHth());
158  if(fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On")) fillTkMap(selDetId_, thresholdHandle_->getData(istrip,ThresholdRange).getHth());
159  }
160  }
161  }// istrip
162 
163 
164 
165  }//if Fill
166 
167 
168 
169  if(hPSet_.getParameter<bool>("FillSummaryAtLayerLevel")){
170 
171  // --> summary
172 
173  std::string hSummary_description;
174  hSummary_description = hPSet_.getParameter<std::string>("Summary_description");
175 
176  std::string hSummary_name;
177  hSummary_name = hidmanager.createHistoLayer(hSummary_description,
178  "layer",
179  getLayerNameAndId(selDetId_).first,
180  "") ;
181 
182 
183  float meanLowThreshold=0;
184  float meanHighThreshold=0;
185 
186  for( int istrip=0;istrip<nStrip;++istrip){
187 
188  meanLowThreshold = meanLowThreshold + thresholdHandle_->getData(istrip,ThresholdRange).getLth();
189  meanHighThreshold = meanHighThreshold + thresholdHandle_->getData(istrip,ThresholdRange).getHth();
190  }//istrip
191 
192 
193  meanLowThreshold = meanLowThreshold/nStrip;
194  meanHighThreshold = meanHighThreshold/nStrip;
195 
196 
197  // -----
198  // get detIds belonging to same layer to fill X-axis with detId-number
199 
200  std::vector<uint32_t> sameLayerDetIds_=GetSameLayerDetId(activeDetIds,selDetId_);
201 
202  unsigned int iBin=0;
203  for(unsigned int i=0;i<sameLayerDetIds_.size();i++){
204  if(sameLayerDetIds_[i]==selDetId_){iBin=i+1;}
205  }
206 
207  if(WhichThreshold=="Low"){
208  selME_.SummaryDistr->Fill(iBin,meanLowThreshold);
209  if(HistoMaps_On_ ) Tk_HM_L->fill(selDetId_, meanLowThreshold);
210  }
211  if(WhichThreshold=="High"){
212  selME_.SummaryDistr->Fill(iBin,meanHighThreshold);
213  if(HistoMaps_On_ )Tk_HM_H->fill(selDetId_, meanHighThreshold);
214  }
215 
216  }//if Fill ...
217 
218 
219 
220 }
221 // -----
222 
void getModMEs(ModMEs &CondObj_ME, const uint32_t &detId_)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
SiStripThresholdDQM(const edm::EventSetup &eSetup, edm::ParameterSet const &hPSet, edm::ParameterSet const &fPSet)
ADDITON OF TK_HISTO_MAP.
void fillModMEs(const std::vector< uint32_t > &selectedDetIds)
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
std::vector< uint32_t > GetSameLayerDetId(std::vector< uint32_t > activeDetIds, uint32_t selDetId)
edm::ESHandle< SiStripThreshold > thresholdHandle_
void fillTkMap(const uint32_t &detid, const float &value)
void Fill(long long x)
U second(std::pair< T, U > const &p)
std::map< uint32_t, ModMEs > SummaryMEsMap_
SiStripDetInfoFileReader * reader
void fillMEsForLayer(uint32_t selDetId_)
void fill(uint32_t &detid, float value)
Definition: TkHistoMap.cc:130
bool first
Definition: L1TdeRCT.cc:94
void getActiveDetIds(const edm::EventSetup &eSetup)
void fillMEsForDet(ModMEs selModME_, uint32_t selDetId_)
void fillSummaryMEs(const std::vector< uint32_t > &selectedDetIds)
std::pair< ContainerIterator, ContainerIterator > Range
std::pair< std::string, uint32_t > getLayerNameAndId(const uint32_t &detId_)
std::vector< uint32_t > activeDetIds
std::string createHistoLayer(std::string description, std::string id_type, std::string path, std::string flag)
void getSummaryMEs(ModMEs &CondObj_ME, const uint32_t &detId_)
void getConditionObject(const edm::EventSetup &eSetup)