CMS 3D CMS Logo

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