CMS 3D CMS Logo

SiStripThresholdDQM.cc
Go to the documentation of this file.
2 
4  edm::RunNumber_t iRun,
5  edm::ParameterSet const &hPSet,
6  edm::ParameterSet const &fPSet,
7  const TrackerTopology *tTopo,
8  const TkDetMap *tkDetMap)
10  WhichThreshold = hPSet.getParameter<std::string>("WhichThreshold");
11 
12  if (HistoMaps_On_) {
13  if (WhichThreshold == "Low")
14  Tk_HM_L = std::make_unique<TkHistoMap>(tkDetMap, "SiStrip/Histo_Map", "LowThresh_TkMap", 0.);
15  if (WhichThreshold == "High")
16  Tk_HM_H = std::make_unique<TkHistoMap>(tkDetMap, "SiStrip/Histo_Map", "HighThresh_TkMap", 0.);
17  }
18 }
19 
21 
23  getConditionObject(eSetup);
25 }
26 
27 void SiStripThresholdDQM::fillModMEs(const std::vector<uint32_t> &selectedDetIds) {
28  ModMEs CondObj_ME;
29  for (const auto det : selectedDetIds) {
30  fillMEsForDet(CondObj_ME, det);
31  }
32 }
33 
34 void SiStripThresholdDQM::fillMEsForDet(const ModMEs &_selModME_, uint32_t selDetId_) {
35  ModMEs selModME_ = _selModME_;
36  std::vector<uint32_t> DetIds;
37  condObj_->getDetIds(DetIds);
38 
39  const auto ThresholdRange = condObj_->getRange(selDetId_);
40  int nStrip = detInfo_.getNumberOfApvsAndStripLength(selDetId_).first * 128;
41 
42  getModMEs(selModME_, selDetId_);
43 
44  for (int istrip = 0; istrip < nStrip; ++istrip) {
45  if (CondObj_fillId_ == "onlyProfile" || CondObj_fillId_ == "ProfileAndCumul") {
46  if (WhichThreshold == "Low")
47  selModME_.ProfileDistr->Fill(istrip + 1, condObj_->getData(istrip, ThresholdRange).getLth());
48  if (WhichThreshold == "High")
49  selModME_.ProfileDistr->Fill(istrip + 1, condObj_->getData(istrip, ThresholdRange).getHth());
50  }
51  } // istrip
52 }
53 
54 void SiStripThresholdDQM::fillSummaryMEs(const std::vector<uint32_t> &selectedDetIds) {
55  for (const auto det : selectedDetIds) {
56  fillMEsForLayer(/*SummaryMEsMap_,*/ det);
57  }
58 }
59 
61  /*std::map<uint32_t, ModMEs> selMEsMap_,*/ uint32_t selDetId_) {
62  // ----
63  int subdetectorId_ = ((selDetId_ >> 25) & 0x7);
64 
65  if (subdetectorId_ < 3 || subdetectorId_ > 6) {
66  edm::LogError("SiStripThresholdDQM") << "[SiStripThresholdDQM::fillMEsForLayer] WRONG INPUT : no such "
67  "subdetector type : "
68  << subdetectorId_ << " no folder set!" << std::endl;
69  return;
70  }
71  // ----
72 
73  const auto selMEsMapIter_ = SummaryMEsMap_.find(getLayerNameAndId(selDetId_).second);
74  ModMEs selME_;
75  if (selMEsMapIter_ != SummaryMEsMap_.end())
76  selME_ = selMEsMapIter_->second;
77 
78  getSummaryMEs(selME_, selDetId_);
79 
80  const auto ThresholdRange = condObj_->getRange(selDetId_);
81 
82  int nStrip = detInfo_.getNumberOfApvsAndStripLength(selDetId_).first * 128;
83 
85 
86  if (hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel")) {
87  // --> profile summary
88 
89  std::string hSummaryOfProfile_description;
90  hSummaryOfProfile_description = hPSet_.getParameter<std::string>("SummaryOfProfile_description");
91 
92  std::string hSummaryOfProfile_name;
93 
94  hSummaryOfProfile_name =
95  hidmanager.createHistoLayer(hSummaryOfProfile_description, "layer", getLayerNameAndId(selDetId_).first, "");
96 
97  for (int istrip = 0; istrip < nStrip; ++istrip) {
98  if (CondObj_fillId_ == "onlyProfile" || CondObj_fillId_ == "ProfileAndCumul") {
99  if (WhichThreshold == "Low") {
100  selME_.SummaryOfProfileDistr->Fill(istrip + 1, condObj_->getData(istrip, ThresholdRange).getLth());
101  if (fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On"))
102  fillTkMap(selDetId_, condObj_->getData(istrip, ThresholdRange).getLth());
103  }
104  if (WhichThreshold == "High") {
105  selME_.SummaryOfProfileDistr->Fill(istrip + 1, condObj_->getData(istrip, ThresholdRange).getHth());
106  if (fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On"))
107  fillTkMap(selDetId_, condObj_->getData(istrip, ThresholdRange).getHth());
108  }
109  }
110  } // istrip
111 
112  } // if Fill
113 
114  if (hPSet_.getParameter<bool>("FillSummaryAtLayerLevel")) {
115  // --> summary
116 
117  std::string hSummary_description;
118  hSummary_description = hPSet_.getParameter<std::string>("Summary_description");
119 
120  std::string hSummary_name;
121  hSummary_name = hidmanager.createHistoLayer(hSummary_description, "layer", getLayerNameAndId(selDetId_).first, "");
122 
123  float meanLowThreshold = 0;
124  float meanHighThreshold = 0;
125 
126  for (int istrip = 0; istrip < nStrip; ++istrip) {
127  meanLowThreshold = meanLowThreshold + condObj_->getData(istrip, ThresholdRange).getLth();
128  meanHighThreshold = meanHighThreshold + condObj_->getData(istrip, ThresholdRange).getHth();
129  } // istrip
130 
131  meanLowThreshold = meanLowThreshold / nStrip;
132  meanHighThreshold = meanHighThreshold / nStrip;
133 
134  // -----
135  // get detIds belonging to same layer to fill X-axis with detId-number
136 
137  std::vector<uint32_t> sameLayerDetIds_ = GetSameLayerDetId(activeDetIds, selDetId_);
138 
139  unsigned int iBin = 0;
140  for (unsigned int i = 0; i < sameLayerDetIds_.size(); i++) {
141  if (sameLayerDetIds_[i] == selDetId_) {
142  iBin = i + 1;
143  }
144  }
145 
146  if (WhichThreshold == "Low") {
147  selME_.SummaryDistr->Fill(iBin, meanLowThreshold);
148  if (HistoMaps_On_)
149  Tk_HM_L->fill(selDetId_, meanLowThreshold);
150  }
151  if (WhichThreshold == "High") {
152  selME_.SummaryDistr->Fill(iBin, meanHighThreshold);
153  if (HistoMaps_On_)
154  Tk_HM_H->fill(selDetId_, meanHighThreshold);
155  }
156 
157  } // if Fill ...
158 }
void getModMEs(ModMEs &CondObj_ME, const uint32_t &detId_)
std::unique_ptr< TkHistoMap > Tk_HM_L
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
SiStripThreshold::Data getData(const uint16_t &strip, const Range &range) const
std::unique_ptr< TkHistoMap > Tk_HM_H
Log< level::Error, false > LogError
SiStripThresholdDQM(edm::ESGetToken< SiStripThreshold, SiStripThresholdRcd > token, edm::RunNumber_t iRun, edm::ParameterSet const &hPSet, edm::ParameterSet const &fPSet, const TrackerTopology *tTopo, const TkDetMap *tkDetMap)
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_
void getActiveDetIds(const edm::EventSetup &eSetup) override
void fillMEsForLayer(uint32_t selDetId_) override
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
void getConditionObject(const edm::EventSetup &eSetup) override
void fillSummaryMEs(const std::vector< uint32_t > &selectedDetIds) override
void fillMEsForDet(const ModMEs &selModME_, uint32_t selDetId_) override
std::pair< std::string, uint32_t > getLayerNameAndId(const uint32_t &detId_)
const Range getRange(const uint32_t &detID) const
std::vector< uint32_t > GetSameLayerDetId(const std::vector< uint32_t > &activeDetIds, uint32_t selDetId)
std::vector< uint32_t > activeDetIds
unsigned int RunNumber_t
void getDetIds(std::vector< uint32_t > &DetIds_) const
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 fillModMEs(const std::vector< uint32_t > &selectedDetIds) override