CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripMonitorQuality Class Reference

#include <SiStripMonitorQuality.h>

Inheritance diagram for SiStripMonitorQuality:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void endJob () override
 
void endRun (edm::Run const &run, edm::EventSetup const &eSetup) override
 
 SiStripMonitorQuality (const edm::ParameterSet &)
 
 ~SiStripMonitorQuality () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Private Member Functions

MonitorElementgetQualityME (uint32_t idet, const TrackerTopology *tTopo)
 

Private Attributes

edm::ParameterSet conf_
 
std::string dataLabel_
 
edm::ESHandle< SiStripDetCablingdetCabling_
 
DQMStoredqmStore_
 
unsigned long long m_cacheID_
 
std::map< uint32_t, MonitorElement * > QualityMEs
 
edm::ESHandle< SiStripQualitystripQuality_
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 47 of file SiStripMonitorQuality.h.

Constructor & Destructor Documentation

SiStripMonitorQuality::SiStripMonitorQuality ( const edm::ParameterSet )
explicit

Definition at line 44 of file SiStripMonitorQuality.cc.

46  conf_(iConfig),
47  m_cacheID_(0)
48 
49 {
50  edm::LogInfo("SiStripMonitorQuality") << "SiStripMonitorQuality "
51  << " Constructing....... ";
52 }
unsigned long long m_cacheID_
SiStripMonitorQuality::~SiStripMonitorQuality ( )
override

Definition at line 54 of file SiStripMonitorQuality.cc.

54  {
55  edm::LogInfo("SiStripMonitorQuality") << "SiStripMonitorQuality "
56  << " Destructing....... ";
57 }

Member Function Documentation

void SiStripMonitorQuality::analyze ( const edm::Event ,
const edm::EventSetup  
)
override

Definition at line 126 of file SiStripMonitorQuality.cc.

References conf_, SiStripBadStrip::decode(), detCabling_, MonitorElement::Fill(), SiStripBadStrip::data::firstStrip, edm::EventSetup::get(), SiStripBadStrip::getDataVectorBegin(), MonitorElement::getNbinsX(), edm::ParameterSet::getParameter(), getQualityME(), SiStripBadStrip::getRegistryVectorBegin(), SiStripBadStrip::getRegistryVectorEnd(), SiStripDetCabling::IsConnected(), m_cacheID_, edm::ESHandle< T >::product(), SiStripBadStrip::data::range, create_public_lumi_plots::str_end, AlCaHLTBitMon_QueryRunRegistry::string, and stripQuality_.

126  {
127  unsigned long long cacheID = eSetup.get<SiStripQualityRcd>().cacheIdentifier();
128  if (m_cacheID_ == cacheID)
129  return;
130 
131  // Retrieve tracker topology from geometry
132  edm::ESHandle<TrackerTopology> tTopoHandle;
133  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
134  const TrackerTopology *const tTopo = tTopoHandle.product();
135 
136  m_cacheID_ = cacheID;
137 
138  std::string quality_label = conf_.getParameter<std::string>("StripQualityLabel");
139  eSetup.get<SiStripQualityRcd>().get(quality_label, stripQuality_);
140  eSetup.get<SiStripDetCablingRcd>().get(detCabling_);
141 
142  edm::LogInfo("SiStripMonitorQuality") << "SiStripMonitorQuality::analyze: "
143  << " Reading SiStripQuality " << std::endl;
144 
147  uint32_t detid;
148 
149  if (rbegin == rend)
150  return;
151 
152  for (SiStripBadStrip::RegistryIterator rp = rbegin; rp != rend; ++rp) {
153  detid = rp->detid;
154  // Check consistency in DetId
155  if (detid == 0 || detid == 0xFFFFFFFF) {
156  edm::LogError("SiStripMonitorQuality") << "SiStripMonitorQuality::analyze : "
157  << "Wrong DetId !!!!!! " << detid << " Neglecting !!!!!! ";
158  continue;
159  }
160  // check if the detid is connected in cabling
161  if (!detCabling_->IsConnected(detid)) {
162  edm::LogError("SiStripMonitorQuality") << "SiStripMonitorQuality::analyze : "
163  << " DetId " << detid << " not connected, Neglecting !!!!!! ";
164  continue;
165  }
166  MonitorElement *me = getQualityME(detid, tTopo);
168  stripQuality_->getDataVectorBegin() + rp->iend);
169  SiStripBadStrip::ContainerIterator it = range.first;
170  for (; it != range.second; ++it) {
171  unsigned int value = (*it);
172  short str_start = stripQuality_->decode(value).firstStrip;
173  short str_end = str_start + stripQuality_->decode(value).range;
174  for (short isr = str_start; isr < str_end + 1; isr++) {
175  if (isr <= (me->getNbinsX() - 1))
176  me->Fill(isr + 1, 1.0);
177  }
178  }
179  }
180 }
unsigned short range
T getParameter(std::string const &) const
std::vector< unsigned int >::const_iterator ContainerIterator
edm::ESHandle< SiStripQuality > stripQuality_
bool IsConnected(const uint32_t &det_id) const
Registry::const_iterator RegistryIterator
void Fill(long long x)
MonitorElement * getQualityME(uint32_t idet, const TrackerTopology *tTopo)
RegistryIterator getRegistryVectorEnd() const
edm::ESHandle< SiStripDetCabling > detCabling_
Definition: value.py:1
ContainerIterator getDataVectorBegin() const
unsigned short firstStrip
RegistryIterator getRegistryVectorBegin() const
std::pair< ContainerIterator, ContainerIterator > Range
unsigned long long m_cacheID_
int getNbinsX() const
get # of bins in X-axis
T const * product() const
Definition: ESHandle.h:86
data decode(const unsigned int &value) const
void SiStripMonitorQuality::bookHistograms ( DQMStore::IBooker ,
edm::Run const &  ,
edm::EventSetup const &   
)
override

Definition at line 59 of file SiStripMonitorQuality.cc.

References DQMStore::IBooker::book1D(), conf_, SiStripHistoId::createHistoId(), detCabling_, edm::EventSetup::get(), edm::ParameterSet::getParameter(), SiStripBadStrip::getRegistryVectorBegin(), SiStripBadStrip::getRegistryVectorEnd(), SiStripDetCabling::IsConnected(), m_cacheID_, SiStripDetCabling::nApvPairs(), edm::ESHandle< T >::product(), QualityMEs, MonitorElement::setAxisTitle(), SiStripFolderOrganizer::setDetectorFolder(), AlCaHLTBitMon_QueryRunRegistry::string, stripQuality_, and DQMStore::IBooker::tag().

61  {
62  unsigned long long cacheID = eSetup.get<SiStripQualityRcd>().cacheIdentifier();
63  if (m_cacheID_ == cacheID)
64  return;
65 
66  // Retrieve tracker topology from geometry
68  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
69  const TrackerTopology *const tTopo = tTopoHandle.product();
70 
71  m_cacheID_ = cacheID;
72 
73  std::string quality_label = conf_.getParameter<std::string>("StripQualityLabel");
74  eSetup.get<SiStripQualityRcd>().get(quality_label, stripQuality_);
75  eSetup.get<SiStripDetCablingRcd>().get(detCabling_);
76 
77  edm::LogInfo("SiStripMonitorQuality") << "SiStripMonitorQuality::analyze: "
78  << " Reading SiStripQuality " << std::endl;
79 
82  uint32_t detid;
83 
84  if (rbegin == rend)
85  return;
86 
87  for (SiStripBadStrip::RegistryIterator rp = rbegin; rp != rend; ++rp) {
88  detid = rp->detid;
89  // Check consistency in DetId
90  if (detid == 0 || detid == 0xFFFFFFFF) {
91  edm::LogError("SiStripMonitorQuality") << "SiStripMonitorQuality::bookHistograms : "
92  << "Wrong DetId !!!!!! " << detid << " Neglecting !!!!!! ";
93  continue;
94  }
95  // check if the detid is connected in cabling
96  if (!detCabling_->IsConnected(detid)) {
97  edm::LogError("SiStripMonitorQuality") << "SiStripMonitorQuality::bookHistograms : "
98  << " DetId " << detid << " not connected, Neglecting !!!!!! ";
99  continue;
100  }
101 
102  MonitorElement *det_me;
103 
104  int nStrip = detCabling_->nApvPairs(detid) * 256;
105 
106  // use SistripHistoId for producing histogram id (and title)
107  SiStripHistoId hidmanager;
108  // create SiStripFolderOrganizer
109  SiStripFolderOrganizer folder_organizer;
110  // set appropriate folder using SiStripFolderOrganizer
111  folder_organizer.setDetectorFolder(detid,
112  tTopo); // pass the detid to this method
113 
114  std::string hid;
115  hid = hidmanager.createHistoId("StripQualityFromCondDB", "det", detid);
116 
117  det_me = ibooker.book1D(hid, hid, nStrip, 0.5, nStrip + 0.5);
118  ibooker.tag(det_me, detid);
119  det_me->setAxisTitle("Strip Number", 1);
120  det_me->setAxisTitle("Quality Flag from CondDB ", 2);
121  QualityMEs.insert(std::make_pair(detid, det_me));
122  }
123 }
T getParameter(std::string const &) const
std::map< uint32_t, MonitorElement * > QualityMEs
edm::ESHandle< SiStripQuality > stripQuality_
bool IsConnected(const uint32_t &det_id) const
Registry::const_iterator RegistryIterator
void setDetectorFolder(uint32_t rawdetid, const TrackerTopology *tTopo)
RegistryIterator getRegistryVectorEnd() const
edm::ESHandle< SiStripDetCabling > detCabling_
std::string createHistoId(std::string description, std::string id_type, uint32_t component_id)
RegistryIterator getRegistryVectorBegin() const
const uint16_t nApvPairs(uint32_t det_id) const
unsigned long long m_cacheID_
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
T const * product() const
Definition: ESHandle.h:86
void SiStripMonitorQuality::endJob ( void  )
override

Definition at line 195 of file SiStripMonitorQuality.cc.

195  {
196  edm::LogInfo("SiStripMonitorQuality") << "SiStripMonitorQuality::EndJob: "
197  << " Finishing!! ";
198 }
void SiStripMonitorQuality::endRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
override

Definition at line 184 of file SiStripMonitorQuality.cc.

References conf_, dqmStore_, edm::ParameterSet::getParameter(), PostProcessorHGCAL_cfi::outputFileName, DQMStore::save(), and AlCaHLTBitMon_QueryRunRegistry::string.

184  {
185  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
187  if (outputMEsInRootFile) {
188  // dqmStore_->showDirStructure();
189  dqmStore_->save(outputFileName);
190  }
191 }
T getParameter(std::string const &) const
void save(std::string const &filename, std::string const &path="", std::string const &pattern="", std::string const &rewrite="", uint32_t run=0, uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, std::string const &fileupdate="RECREATE")
Definition: DQMStore.cc:2465
MonitorElement * SiStripMonitorQuality::getQualityME ( uint32_t  idet,
const TrackerTopology tTopo 
)
private

Definition at line 202 of file SiStripMonitorQuality.cc.

References DEFINE_FWK_MODULE, QualityMEs, and MonitorElement::Reset().

Referenced by analyze().

202  {
203  std::map<uint32_t, MonitorElement *>::iterator pos = QualityMEs.find(idet);
204  MonitorElement *det_me = nullptr;
205  if (pos != QualityMEs.end()) {
206  det_me = pos->second;
207  det_me->Reset();
208  } else {
209  // this should never happen because of bookHistograms()
210  edm::LogError("SiStripMonitorQuality") << "SiStripMonitorQuality::getQualityME : "
211  << "Wrong DetId !!!!!! " << idet << " No ME found!";
212  }
213  return det_me;
214 }
std::map< uint32_t, MonitorElement * > QualityMEs
void Reset()
reset ME (ie. contents, errors, etc)

Member Data Documentation

edm::ParameterSet SiStripMonitorQuality::conf_
private

Definition at line 61 of file SiStripMonitorQuality.h.

Referenced by analyze(), bookHistograms(), and endRun().

std::string SiStripMonitorQuality::dataLabel_
private

Definition at line 66 of file SiStripMonitorQuality.h.

edm::ESHandle<SiStripDetCabling> SiStripMonitorQuality::detCabling_
private

Definition at line 62 of file SiStripMonitorQuality.h.

Referenced by analyze(), and bookHistograms().

DQMStore* SiStripMonitorQuality::dqmStore_
private

Definition at line 60 of file SiStripMonitorQuality.h.

Referenced by endRun().

unsigned long long SiStripMonitorQuality::m_cacheID_
private

Definition at line 68 of file SiStripMonitorQuality.h.

Referenced by analyze(), and bookHistograms().

std::map<uint32_t, MonitorElement *> SiStripMonitorQuality::QualityMEs
private

Definition at line 65 of file SiStripMonitorQuality.h.

Referenced by bookHistograms(), and getQualityME().

edm::ESHandle<SiStripQuality> SiStripMonitorQuality::stripQuality_
private

Definition at line 63 of file SiStripMonitorQuality.h.

Referenced by analyze(), and bookHistograms().