CMS 3D CMS Logo

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