CMS 3D CMS Logo

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