CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripMonitorQuality Class Reference

#include <SiStripMonitorQuality.h>

Inheritance diagram for SiStripMonitorQuality:
thread_unsafe::DQMEDAnalyzer edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
virtual void endJob ()
 
virtual void endRun (edm::Run const &run, edm::EventSetup const &eSetup)
 
 SiStripMonitorQuality (const edm::ParameterSet &)
 
 ~SiStripMonitorQuality ()
 
- Public Member Functions inherited from thread_unsafe::DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

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

Usage: <usage>

Definition at line 46 of file SiStripMonitorQuality.h.

Constructor & Destructor Documentation

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

Definition at line 43 of file SiStripMonitorQuality.cc.

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

Definition at line 55 of file SiStripMonitorQuality.cc.

56 {
57  edm::LogInfo("SiStripMonitorQuality") <<"SiStripMonitorQuality "
58  << " Destructing....... ";
59 }

Member Function Documentation

void SiStripMonitorQuality::analyze ( const edm::Event iEvent,
const edm::EventSetup eSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 132 of file SiStripMonitorQuality.cc.

References conf_, detCabling_, cond::rpcobgas::detid, MonitorElement::Fill(), edm::EventSetup::get(), MonitorElement::getNbinsX(), edm::ParameterSet::getParameter(), getQualityME(), m_cacheID_, edm::ESHandle< class >::product(), create_public_lumi_plots::str_end, AlCaHLTBitMon_QueryRunRegistry::string, stripQuality_, and relativeConstraints::value.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 63 of file SiStripMonitorQuality.cc.

63  {
64 }
void SiStripMonitorQuality::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
overridevirtual

Implements thread_unsafe::DQMEDAnalyzer.

Definition at line 66 of file SiStripMonitorQuality.cc.

References DQMStore::IBooker::book1D(), conf_, SiStripHistoId::createHistoId(), detCabling_, cond::rpcobgas::detid, edm::EventSetup::get(), edm::ParameterSet::getParameter(), m_cacheID_, edm::ESHandle< class >::product(), QualityMEs, MonitorElement::setAxisTitle(), SiStripFolderOrganizer::setDetectorFolder(), AlCaHLTBitMon_QueryRunRegistry::string, stripQuality_, and DQMStore::IBooker::tag().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 200 of file SiStripMonitorQuality.cc.

200  {
201  edm::LogInfo("SiStripMonitorQuality") <<"SiStripMonitorQuality::EndJob: "
202  << " Finishing!! ";
203 }
void SiStripMonitorQuality::endRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 189 of file SiStripMonitorQuality.cc.

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

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

Definition at line 207 of file SiStripMonitorQuality.cc.

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

Referenced by analyze().

207  {
208 
209  std::map<uint32_t, MonitorElement* >::iterator pos = QualityMEs.find(idet);
210  MonitorElement* det_me = NULL;
211  if (pos != QualityMEs.end()) {
212  det_me = pos->second;
213  det_me->Reset();
214  } else {
215  //this should never happen because of bookHistograms()
216  edm::LogError("SiStripMonitorQuality") <<"SiStripMonitorQuality::getQualityME : "
217  << "Wrong DetId !!!!!! " << idet << " No ME found!";
218  }
219  return det_me;
220 }
#define NULL
Definition: scimark2.h:8
void Reset(void)
reset ME (ie. contents, errors, etc)
std::map< uint32_t, MonitorElement * > QualityMEs

Member Data Documentation

edm::ParameterSet SiStripMonitorQuality::conf_
private

Definition at line 64 of file SiStripMonitorQuality.h.

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

std::string SiStripMonitorQuality::dataLabel_
private

Definition at line 69 of file SiStripMonitorQuality.h.

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

Definition at line 65 of file SiStripMonitorQuality.h.

Referenced by analyze(), and bookHistograms().

DQMStore* SiStripMonitorQuality::dqmStore_
private

Definition at line 63 of file SiStripMonitorQuality.h.

Referenced by endRun().

unsigned long long SiStripMonitorQuality::m_cacheID_
private

Definition at line 71 of file SiStripMonitorQuality.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 68 of file SiStripMonitorQuality.h.

Referenced by bookHistograms(), and getQualityME().

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

Definition at line 66 of file SiStripMonitorQuality.h.

Referenced by analyze(), and bookHistograms().