CMS 3D CMS Logo

SiStripNoisesDQM.cc
Go to the documentation of this file.
2 
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  gainRenormalisation_ = hPSet_.getParameter<bool>("GainRenormalisation");
14  simGainRenormalisation_ = hPSet_.getParameter<bool>("SimGainRenormalisation");
17  }
20  }
21 
22  // Build the Histo_TkMap:
23  if (HistoMaps_On_) {
24  edm::ESHandle<TkDetMap> tkDetMapHandle;
25  eSetup.get<TrackerTopologyRcd>().get(tkDetMapHandle);
26  Tk_HM_ = std::make_unique<TkHistoMap>(tkDetMapHandle.product(), "SiStrip/Histo_Map", "MeanNoise_TkMap", 0.);
27  }
28 }
29 // -----
30 
31 // -----
33 // -----
34 
35 // -----
37  getConditionObject(eSetup);
39 }
40 
41 // -----
42 void SiStripNoisesDQM::fillMEsForDet(const ModMEs &_selModME_, uint32_t selDetId_, const TrackerTopology *tTopo) {
43  ModMEs selModME_ = _selModME_;
44  std::vector<uint32_t> DetIds;
45  noiseHandle_->getDetIds(DetIds);
46 
47  SiStripNoises::Range noiseRange = noiseHandle_->getRange(selDetId_);
48 
49  int nStrip = reader->getNumberOfApvsAndStripLength(selDetId_).first * 128;
50 
51  getModMEs(selModME_, selDetId_, tTopo);
52 
53  float gainFactor;
54  float stripnoise;
55 
56  SiStripApvGain::Range gainRange;
58  gainRange = gainHandle_->getRange(selDetId_);
59  }
60 
61  for (int istrip = 0; istrip < nStrip; ++istrip) {
63  gainFactor = gainHandle_->getStripGain(istrip, gainRange) ? gainHandle_->getStripGain(istrip, gainRange) : 1.;
64  else
65  gainFactor = 1;
66 
67  stripnoise = noiseHandle_->getNoise(istrip, noiseRange) / gainFactor;
68  if (CondObj_fillId_ == "onlyProfile" || CondObj_fillId_ == "ProfileAndCumul") {
69  selModME_.ProfileDistr->Fill(istrip + 1, stripnoise);
70  }
71  if (CondObj_fillId_ == "onlyCumul" || CondObj_fillId_ == "ProfileAndCumul") {
72  selModME_.CumulDistr->Fill(stripnoise);
73  }
74  } // istrip
75 }
76 
77 // -----
78 // FIXME too long. factorize this method.
79 // FIXME the number of lines of code in the derived classes should be reduced
80 // ONLY at what cannot be done in the base class because of the specific
81 // implementation
82 // FIXME of the derived class. Moreover, several loops on the same quantities
83 // should be avoided...
84 
86  /*std::map<uint32_t, ModMEs> selMEsMap_,*/ uint32_t selDetId_, const TrackerTopology *tTopo) {
87  // ----
88  int subdetectorId_ = ((selDetId_ >> 25) & 0x7);
89 
90  if (subdetectorId_ < 3 || subdetectorId_ > 6) {
91  edm::LogError("SiStripNoisesDQM") << "[SiStripNoisesDQM::fillMEsForLayer] WRONG INPUT : no such "
92  "subdetector type : "
93  << subdetectorId_ << " no folder set!" << std::endl;
94  return;
95  }
96  // ----
97 
98  std::map<uint32_t, ModMEs>::iterator selMEsMapIter_ = SummaryMEsMap_.find(getLayerNameAndId(selDetId_, tTopo).second);
99  ModMEs selME_;
100  if (selMEsMapIter_ != SummaryMEsMap_.end())
101  selME_ = selMEsMapIter_->second;
102  getSummaryMEs(selME_, selDetId_, tTopo);
103 
104  SiStripNoises::Range noiseRange = noiseHandle_->getRange(selDetId_);
105  int nStrip = reader->getNumberOfApvsAndStripLength(selDetId_).first * 128;
106 
107  float stripnoise = -1.;
108  float meanNoise = 0;
109  int Nbadstrips = 0;
110 
111  SiStripApvGain::Range gainRange;
113  gainRange = gainHandle_->getRange(selDetId_);
114  }
115  float gainFactor = 1;
116 
118 
119  if (hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel")) {
120  // --> profile summary
121  std::string hSummaryOfProfile_description;
122  hSummaryOfProfile_description = hPSet_.getParameter<std::string>("SummaryOfProfile_description");
123 
124  std::string hSummaryOfProfile_name;
125  hSummaryOfProfile_name = hidmanager.createHistoLayer(
126  hSummaryOfProfile_description, "layer", getLayerNameAndId(selDetId_, tTopo).first, "");
127  }
128  if (hPSet_.getParameter<bool>("FillCumulativeSummaryAtLayerLevel")) {
129  std::string hSummaryOfCumul_description;
130  hSummaryOfCumul_description = hPSet_.getParameter<std::string>("Cumul_description");
131 
132  std::string hSummaryOfCumul_name;
133  hSummaryOfCumul_name = hidmanager.createHistoLayer(
134  hSummaryOfCumul_description, "layer", getStringNameAndId(selDetId_, tTopo).first, "");
135  }
136  if (hPSet_.getParameter<bool>("FillSummaryAtLayerLevel")) {
137  // --> cumul summary
138  std::string hSummary_description;
139  hSummary_description = hPSet_.getParameter<std::string>("Summary_description");
140 
141  std::string hSummary_name;
142  hSummary_name =
143  hidmanager.createHistoLayer(hSummary_description, "layer", getLayerNameAndId(selDetId_, tTopo).first, "");
144  }
145 
146  for (int istrip = 0; istrip < nStrip; ++istrip) {
148  gainFactor = gainHandle_->getStripGain(istrip, gainRange) ? gainHandle_->getStripGain(istrip, gainRange) : 1.;
149  } else {
150  gainFactor = 1.;
151  }
152 
153  stripnoise = noiseHandle_->getNoise(istrip, noiseRange) / gainFactor;
154  meanNoise += stripnoise;
155  if (hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel")) {
156  if (CondObj_fillId_ == "onlyProfile" || CondObj_fillId_ == "ProfileAndCumul") {
157  selME_.SummaryOfProfileDistr->Fill(istrip + 1, stripnoise);
158  }
159  }
160 
161  if (hPSet_.getParameter<bool>("FillCumulativeSummaryAtLayerLevel")) {
162  if (CondObj_fillId_ == "onlyCumul" || CondObj_fillId_ == "ProfileAndCumul") {
163  selME_.SummaryOfCumulDistr->Fill(stripnoise);
164  }
165  }
166 
167  // Fill the TkMap
168  if (fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On")) {
169  fillTkMap(selDetId_, stripnoise);
170  }
171 
172  } // istrip
173 
174  if (hPSet_.getParameter<bool>("FillSummaryAtLayerLevel")) {
175  meanNoise = meanNoise / (nStrip - Nbadstrips);
176  // get detIds belonging to same layer to fill X-axis with detId-number
177 
178  std::vector<uint32_t> sameLayerDetIds_;
179  sameLayerDetIds_ = GetSameLayerDetId(activeDetIds, selDetId_, tTopo);
180 
181  std::vector<uint32_t>::const_iterator ibound =
182  lower_bound(sameLayerDetIds_.begin(), sameLayerDetIds_.end(), selDetId_);
183  if (ibound != sameLayerDetIds_.end() && *ibound == selDetId_)
184  selME_.SummaryDistr->Fill(ibound - sameLayerDetIds_.begin() + 1, meanNoise);
185 
186  // Fill the Histo_TkMap with the mean Noise:
187  if (HistoMaps_On_) {
188  Tk_HM_->fill(selDetId_, meanNoise);
189  }
190 
191  // Check the axis range for tkmap, and in case redefine;
192  int intNoise = int(meanNoise);
193  if (intNoise + 1 > (int)tkMapScaler.size()) {
194  tkMapScaler.resize(intNoise + 1, 0);
195  }
196  tkMapScaler[intNoise]++;
197  }
198 }
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
SiStripNoisesDQM::getConditionObject
void getConditionObject(const edm::EventSetup &eSetup) override
Definition: SiStripNoisesDQM.h:30
SiStripNoisesDQM::~SiStripNoisesDQM
~SiStripNoisesDQM() override
Definition: SiStripNoisesDQM.cc:32
SiStripApvGain::getStripGain
static float getStripGain(uint16_t strip, const Range &range)
Definition: SiStripApvGain.h:78
SiStripBaseCondObjDQM::ModMEs::CumulDistr
MonitorElement * CumulDistr
Definition: SiStripBaseCondObjDQM.h:80
SiStripBaseCondObjDQM::ModMEs::ProfileDistr
MonitorElement * ProfileDistr
Definition: SiStripBaseCondObjDQM.h:79
SiStripNoisesDQM::simGainRenormalisation_
bool simGainRenormalisation_
Definition: SiStripNoisesDQM.h:37
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:215
DQMStore.h
SiStripBaseCondObjDQM::ModMEs::SummaryOfProfileDistr
MonitorElement * SummaryOfProfileDistr
Definition: SiStripBaseCondObjDQM.h:81
SiStripBaseCondObjDQM::HistoMaps_On_
bool HistoMaps_On_
Definition: SiStripBaseCondObjDQM.h:109
SiStripBaseCondObjDQM::tkMapScaler
std::vector< int > tkMapScaler
Definition: SiStripBaseCondObjDQM.h:114
SiStripNoises::getRange
const Range getRange(const uint32_t detID) const
Definition: SiStripNoises.cc:34
SiStripNoises::getDetIds
void getDetIds(std::vector< uint32_t > &DetIds_) const
Definition: SiStripNoises.cc:58
SiStripApvGain::getRange
const Range getRange(const uint32_t detID) const
Definition: SiStripApvGain.cc:30
SiStripBaseCondObjDQM
Definition: SiStripBaseCondObjDQM.h:37
dqmdumpme.first
first
Definition: dqmdumpme.py:55
SiStripNoisesDQM::noiseHandle_
edm::ESHandle< SiStripNoises > noiseHandle_
Definition: SiStripNoisesDQM.h:38
SiStripBaseCondObjDQM::SummaryMEsMap_
std::map< uint32_t, ModMEs > SummaryMEsMap_
Definition: SiStripBaseCondObjDQM.h:122
SiStripNoisesDQM::fillMEsForLayer
void fillMEsForLayer(uint32_t selDetId_, const TrackerTopology *tTopo) override
Definition: SiStripNoisesDQM.cc:85
SiStripBaseCondObjDQM::reader
SiStripDetInfoFileReader * reader
Definition: SiStripBaseCondObjDQM.h:102
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
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
SiStripNoises::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:47
SiStripNoisesDQM::gainRenormalisation_
bool gainRenormalisation_
Definition: SiStripNoisesDQM.h:36
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
SiStripBaseCondObjDQM::Tk_HM_
std::unique_ptr< TkHistoMap > Tk_HM_
Definition: SiStripBaseCondObjDQM.h:129
edm::ESHandle
Definition: DTSurvey.h:22
cuda_std::lower_bound
__host__ constexpr __device__ RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition: cudastdAlgorithm.h:27
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripBaseCondObjDQM::CondObj_fillId_
std::string CondObj_fillId_
Definition: SiStripBaseCondObjDQM.h:118
SiStripBaseCondObjDQM::getStringNameAndId
std::pair< std::string, uint32_t > getStringNameAndId(const uint32_t &detId_, const TrackerTopology *tTopo)
Definition: SiStripBaseCondObjDQM.cc:997
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
SiStripNoisesDQM::gainHandle_
edm::ESHandle< SiStripApvGain > gainHandle_
Definition: SiStripNoisesDQM.h:39
createfilelist.int
int
Definition: createfilelist.py:10
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
SiStripBaseCondObjDQM::getModMEs
void getModMEs(ModMEs &CondObj_ME, const uint32_t &detId_, const TrackerTopology *tTopo)
Definition: SiStripBaseCondObjDQM.cc:363
SiStripApvGainRcd
Definition: SiStripCondDataRecords.h:8
SiStripBaseCondObjDQM::ModMEs
Definition: SiStripBaseCondObjDQM.h:70
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
SiStripNoisesDQM::SiStripNoisesDQM
SiStripNoisesDQM(const edm::EventSetup &eSetup, edm::RunNumber_t iRun, edm::ParameterSet const &hPSet, edm::ParameterSet const &fPSet)
Definition: SiStripNoisesDQM.cc:8
SiStripHistoId
Definition: SiStripHistoId.h:25
SiStripNoisesDQM::fillMEsForDet
void fillMEsForDet(const ModMEs &selModME_, uint32_t selDetId_, const TrackerTopology *tTopo) override
Definition: SiStripNoisesDQM.cc:42
SiStripDetInfoFileReader::getNumberOfApvsAndStripLength
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
Definition: SiStripDetInfoFileReader.cc:101
SiStripApvGain::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripApvGain.h:28
SiStripBaseCondObjDQM::ModMEs::SummaryOfCumulDistr
MonitorElement * SummaryOfCumulDistr
Definition: SiStripBaseCondObjDQM.h:82
SiStripApvGainSimRcd
Definition: SiStripCondDataRecords.h:11
SiStripBaseCondObjDQM::fPSet_
edm::ParameterSet fPSet_
Definition: SiStripBaseCondObjDQM.h:106
SiStripNoisesDQM.h
SiStripBaseCondObjDQM::getSummaryMEs
void getSummaryMEs(ModMEs &CondObj_ME, const uint32_t &detId_, const TrackerTopology *tTopo)
Definition: SiStripBaseCondObjDQM.cc:399
SiStripNoisesDQM::getActiveDetIds
void getActiveDetIds(const edm::EventSetup &eSetup) override
Definition: SiStripNoisesDQM.cc:36
SiStripBaseCondObjDQM::hPSet_
edm::ParameterSet hPSet_
Definition: SiStripBaseCondObjDQM.h:105
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
SiStripNoises::getNoise
static float getNoise(uint16_t strip, const Range &range)
Definition: SiStripNoises.h:71
SiStripBaseCondObjDQM::GetSameLayerDetId
std::vector< uint32_t > GetSameLayerDetId(const std::vector< uint32_t > &activeDetIds, uint32_t selDetId, const TrackerTopology *tTopo)
Definition: SiStripBaseCondObjDQM.cc:1114