CMS 3D CMS Logo

SiStripNoisesDQM.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,
9  const SiStripApvGain *gainHandle)
10  : SiStripBaseCondObjDQMGet<SiStripNoises, SiStripNoisesRcd>{noiseToken, iRun, hPSet, fPSet, tTopo},
11  gainHandle_{gainHandle} {
12  // Build the Histo_TkMap:
13  if (HistoMaps_On_) {
14  Tk_HM_ = std::make_unique<TkHistoMap>(tkDetMap, "SiStrip/Histo_Map", "MeanNoise_TkMap", 0.);
15  }
16 }
17 
19 
21  getConditionObject(eSetup);
23 }
24 
25 void SiStripNoisesDQM::fillMEsForDet(const ModMEs &_selModME_, uint32_t selDetId_) {
26  ModMEs selModME_ = _selModME_;
27  std::vector<uint32_t> DetIds;
28  condObj_->getDetIds(DetIds);
29 
30  const auto noiseRange = condObj_->getRange(selDetId_);
31 
32  int nStrip = detInfo_.getNumberOfApvsAndStripLength(selDetId_).first * 128;
33 
34  getModMEs(selModME_, selDetId_);
35 
36  float gainFactor;
37  float stripnoise;
38 
39  SiStripApvGain::Range gainRange;
40  if (gainHandle_) {
41  gainRange = gainHandle_->getRange(selDetId_);
42  }
43 
44  for (int istrip = 0; istrip < nStrip; ++istrip) {
45  if (gainHandle_)
46  gainFactor = gainHandle_->getStripGain(istrip, gainRange) ? gainHandle_->getStripGain(istrip, gainRange) : 1.;
47  else
48  gainFactor = 1;
49 
50  stripnoise = condObj_->getNoise(istrip, noiseRange) / gainFactor;
51  if (CondObj_fillId_ == "onlyProfile" || CondObj_fillId_ == "ProfileAndCumul") {
52  selModME_.ProfileDistr->Fill(istrip + 1, stripnoise);
53  }
54  if (CondObj_fillId_ == "onlyCumul" || CondObj_fillId_ == "ProfileAndCumul") {
55  selModME_.CumulDistr->Fill(stripnoise);
56  }
57  } // istrip
58 }
59 
60 // -----
61 // FIXME too long. factorize this method.
62 // FIXME the number of lines of code in the derived classes should be reduced
63 // ONLY at what cannot be done in the base class because of the specific
64 // implementation
65 // FIXME of the derived class. Moreover, several loops on the same quantities
66 // should be avoided...
67 
69  /*std::map<uint32_t, ModMEs> selMEsMap_,*/ uint32_t selDetId_) {
70  // ----
71  int subdetectorId_ = ((selDetId_ >> 25) & 0x7);
72 
73  if (subdetectorId_ < 3 || subdetectorId_ > 6) {
74  edm::LogError("SiStripNoisesDQM") << "[SiStripNoisesDQM::fillMEsForLayer] WRONG INPUT : no such "
75  "subdetector type : "
76  << subdetectorId_ << " no folder set!" << std::endl;
77  return;
78  }
79  // ----
80 
81  const auto selMEsMapIter_ = SummaryMEsMap_.find(getLayerNameAndId(selDetId_).second);
82  ModMEs selME_;
83  if (selMEsMapIter_ != SummaryMEsMap_.end())
84  selME_ = selMEsMapIter_->second;
85  getSummaryMEs(selME_, selDetId_);
86 
87  const auto noiseRange = condObj_->getRange(selDetId_);
88  int nStrip = detInfo_.getNumberOfApvsAndStripLength(selDetId_).first * 128;
89 
90  float stripnoise = -1.;
91  float meanNoise = 0;
92  int Nbadstrips = 0;
93 
94  SiStripApvGain::Range gainRange;
95  if (gainHandle_) {
96  gainRange = gainHandle_->getRange(selDetId_);
97  }
98  float gainFactor = 1;
99 
101 
102  if (hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel")) {
103  // --> profile summary
104  std::string hSummaryOfProfile_description;
105  hSummaryOfProfile_description = hPSet_.getParameter<std::string>("SummaryOfProfile_description");
106 
107  std::string hSummaryOfProfile_name;
108  hSummaryOfProfile_name =
109  hidmanager.createHistoLayer(hSummaryOfProfile_description, "layer", getLayerNameAndId(selDetId_).first, "");
110  }
111  if (hPSet_.getParameter<bool>("FillCumulativeSummaryAtLayerLevel")) {
112  std::string hSummaryOfCumul_description;
113  hSummaryOfCumul_description = hPSet_.getParameter<std::string>("Cumul_description");
114 
115  std::string hSummaryOfCumul_name;
116  hSummaryOfCumul_name =
117  hidmanager.createHistoLayer(hSummaryOfCumul_description, "layer", getStringNameAndId(selDetId_).first, "");
118  }
119  if (hPSet_.getParameter<bool>("FillSummaryAtLayerLevel")) {
120  // --> cumul summary
121  std::string hSummary_description;
122  hSummary_description = hPSet_.getParameter<std::string>("Summary_description");
123 
124  std::string hSummary_name;
125  hSummary_name = hidmanager.createHistoLayer(hSummary_description, "layer", getLayerNameAndId(selDetId_).first, "");
126  }
127 
128  for (int istrip = 0; istrip < nStrip; ++istrip) {
129  if (gainHandle_) {
130  gainFactor = gainHandle_->getStripGain(istrip, gainRange) ? gainHandle_->getStripGain(istrip, gainRange) : 1.;
131  } else {
132  gainFactor = 1.;
133  }
134 
135  stripnoise = condObj_->getNoise(istrip, noiseRange) / gainFactor;
136  meanNoise += stripnoise;
137  if (hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel")) {
138  if (CondObj_fillId_ == "onlyProfile" || CondObj_fillId_ == "ProfileAndCumul") {
139  selME_.SummaryOfProfileDistr->Fill(istrip + 1, stripnoise);
140  }
141  }
142 
143  if (hPSet_.getParameter<bool>("FillCumulativeSummaryAtLayerLevel")) {
144  if (CondObj_fillId_ == "onlyCumul" || CondObj_fillId_ == "ProfileAndCumul") {
145  selME_.SummaryOfCumulDistr->Fill(stripnoise);
146  }
147  }
148 
149  // Fill the TkMap
150  if (fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On")) {
151  fillTkMap(selDetId_, stripnoise);
152  }
153 
154  } // istrip
155 
156  if (hPSet_.getParameter<bool>("FillSummaryAtLayerLevel")) {
157  meanNoise = meanNoise / (nStrip - Nbadstrips);
158  // get detIds belonging to same layer to fill X-axis with detId-number
159 
160  std::vector<uint32_t> sameLayerDetIds_;
161  sameLayerDetIds_ = GetSameLayerDetId(activeDetIds, selDetId_);
162 
163  std::vector<uint32_t>::const_iterator ibound =
164  lower_bound(sameLayerDetIds_.begin(), sameLayerDetIds_.end(), selDetId_);
165  if (ibound != sameLayerDetIds_.end() && *ibound == selDetId_)
166  selME_.SummaryDistr->Fill(ibound - sameLayerDetIds_.begin() + 1, meanNoise);
167 
168  // Fill the Histo_TkMap with the mean Noise:
169  if (HistoMaps_On_) {
170  Tk_HM_->fill(selDetId_, meanNoise);
171  }
172 
173  // Check the axis range for tkmap, and in case redefine;
174  int intNoise = int(meanNoise);
175  if (intNoise + 1 > (int)tkMapScaler.size()) {
176  tkMapScaler.resize(intNoise + 1, 0);
177  }
178  tkMapScaler[intNoise]++;
179  }
180 }
SiStripHistoId::createHistoLayer
std::string createHistoLayer(std::string description, std::string id_type, std::string path, std::string flag)
Definition: SiStripHistoId.cc:51
edm::RunNumber_t
unsigned int RunNumber_t
Definition: RunLumiEventNumber.h:14
SiStripBaseCondObjDQM::hidmanager
SiStripHistoId hidmanager
Definition: SiStripBaseCondObjDQM.h:141
SiStripNoisesDQM::~SiStripNoisesDQM
~SiStripNoisesDQM() override
Definition: SiStripNoisesDQM.cc:18
SiStripApvGain::getStripGain
static float getStripGain(uint16_t strip, const Range &range)
Definition: SiStripApvGain.h:78
SiStripBaseCondObjDQM::ModMEs::CumulDistr
MonitorElement * CumulDistr
Definition: SiStripBaseCondObjDQM.h:74
SiStripBaseCondObjDQM::ModMEs::ProfileDistr
MonitorElement * ProfileDistr
Definition: SiStripBaseCondObjDQM.h:73
SiStripNoises
Definition: SiStripNoises.h:25
TrackerTopology
Definition: TrackerTopology.h:16
SiStripBaseCondObjDQM::activeDetIds
std::vector< uint32_t > activeDetIds
Definition: SiStripBaseCondObjDQM.h:114
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
SiStripBaseCondObjDQM::ModMEs::SummaryOfProfileDistr
MonitorElement * SummaryOfProfileDistr
Definition: SiStripBaseCondObjDQM.h:75
SiStripBaseCondObjDQM::HistoMaps_On_
bool HistoMaps_On_
Definition: SiStripBaseCondObjDQM.h:100
SiStripBaseCondObjDQM::tkMapScaler
std::vector< int > tkMapScaler
Definition: SiStripBaseCondObjDQM.h:105
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::SummaryMEsMap_
std::map< uint32_t, ModMEs > SummaryMEsMap_
Definition: SiStripBaseCondObjDQM.h:113
SiStripNoisesRcd
Definition: SiStripCondDataRecords.h:40
SiStripBaseCondObjDQM::ModMEs::SummaryDistr
MonitorElement * SummaryDistr
Definition: SiStripBaseCondObjDQM.h:77
SiStripBaseCondObjDQM::fillTkMap
void fillTkMap(const uint32_t &detid, const float &value)
Definition: SiStripBaseCondObjDQM.cc:1050
SiStripNoisesDQM::fillMEsForLayer
void fillMEsForLayer(uint32_t selDetId_) override
Definition: SiStripNoisesDQM.cc:68
SiStripNoisesDQM::fillMEsForDet
void fillMEsForDet(const ModMEs &selModME_, uint32_t selDetId_) override
Definition: SiStripNoisesDQM.cc:25
SiStripBaseCondObjDQM::getStringNameAndId
std::pair< std::string, uint32_t > getStringNameAndId(const uint32_t &detId_)
Definition: SiStripBaseCondObjDQM.cc:908
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
SiStripBaseCondObjDQM::getLayerNameAndId
std::pair< std::string, uint32_t > getLayerNameAndId(const uint32_t &detId_)
Definition: SiStripBaseCondObjDQM.cc:828
SiStripBaseCondObjDQM::Tk_HM_
std::unique_ptr< TkHistoMap > Tk_HM_
Definition: SiStripBaseCondObjDQM.h:117
SiStripDetInfo::getNumberOfApvsAndStripLength
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
Definition: SiStripDetInfo.cc:19
SiStripBaseCondObjDQM::getModMEs
void getModMEs(ModMEs &CondObj_ME, const uint32_t &detId_)
Definition: SiStripBaseCondObjDQM.cc:301
TkDetMap
Definition: TkDetMap.h:175
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
SiStripBaseCondObjDQMGet
Definition: SiStripBaseCondObjDQM.h:148
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
SiStripBaseCondObjDQM::CondObj_fillId_
std::string CondObj_fillId_
Definition: SiStripBaseCondObjDQM.h:109
edm::ParameterSet
Definition: ParameterSet.h:47
createfilelist.int
int
Definition: createfilelist.py:10
edm::EventSetup
Definition: EventSetup.h:58
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ESGetToken< SiStripNoises, SiStripNoisesRcd >
SiStripBaseCondObjDQM::GetSameLayerDetId
std::vector< uint32_t > GetSameLayerDetId(const std::vector< uint32_t > &activeDetIds, uint32_t selDetId)
Definition: SiStripBaseCondObjDQM.cc:1023
SiStripBaseCondObjDQM::detInfo_
SiStripDetInfo detInfo_
Definition: SiStripBaseCondObjDQM.h:94
SiStripBaseCondObjDQM::ModMEs
Definition: SiStripBaseCondObjDQM.h:64
SiStripHistoId
Definition: SiStripHistoId.h:25
SiStripBaseCondObjDQM::getSummaryMEs
void getSummaryMEs(ModMEs &CondObj_ME, const uint32_t &detId_)
Definition: SiStripBaseCondObjDQM.cc:334
SiStripApvGain::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripApvGain.h:28
SiStripBaseCondObjDQM::ModMEs::SummaryOfCumulDistr
MonitorElement * SummaryOfCumulDistr
Definition: SiStripBaseCondObjDQM.h:76
SiStripBaseCondObjDQM::fPSet_
edm::ParameterSet fPSet_
Definition: SiStripBaseCondObjDQM.h:97
SiStripNoisesDQM.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SiStripNoisesDQM::getActiveDetIds
void getActiveDetIds(const edm::EventSetup &eSetup) override
Definition: SiStripNoisesDQM.cc:20
SiStripBaseCondObjDQM::hPSet_
edm::ParameterSet hPSet_
Definition: SiStripBaseCondObjDQM.h:96
SiStripNoisesDQM::SiStripNoisesDQM
SiStripNoisesDQM(edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > noiseToken, edm::RunNumber_t iRun, edm::ParameterSet const &hPSet, edm::ParameterSet const &fPSet, const TrackerTopology *tTopo, const TkDetMap *tkDetMap, const SiStripApvGain *gainHandle)
Definition: SiStripNoisesDQM.cc:3
SiStripNoisesDQM::gainHandle_
const SiStripApvGain * gainHandle_
Definition: SiStripNoisesDQM.h:29
SiStripBaseCondObjDQMGet< SiStripNoises, SiStripNoisesRcd >::getConditionObject
void getConditionObject(const edm::EventSetup &eSetup) override
Definition: SiStripBaseCondObjDQM.h:159
SiStripBaseCondObjDQMGet< SiStripNoises, SiStripNoisesRcd >::condObj_
const SiStripNoises * condObj_
Definition: SiStripBaseCondObjDQM.h:163
SiStripNoises::getNoise
static float getNoise(uint16_t strip, const Range &range)
Definition: SiStripNoises.h:73
SiStripApvGain
Definition: SiStripApvGain.h:25