CMS 3D CMS Logo

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

#include <DPGAnalysis/SiStripTools/plugins/SiStripQualityHistory.cc>

Inheritance diagram for SiStripQualityHistory:
edm::EDAnalyzer edm::EDConsumerBase

Public Types

enum  { Module, Fiber, APV, Strip }
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 SiStripQualityHistory (const edm::ParameterSet &)
 
 ~SiStripQualityHistory () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void endJob () override
 

Private Attributes

std::map< std::string, TH1F * > _history
 
const unsigned int _mode
 
const std::vector< edm::ParameterSet_monitoredssq
 
std::map< std::string, TProfile ** > m_badmodrun
 
const unsigned int m_LSfrac
 
const unsigned int m_maxLS
 
RunHistogramManager m_rhm
 
const bool m_run
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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>="">

Implementation: <Notes on="" implementation>="">

Definition at line 56 of file SiStripQualityHistory.cc.

Member Enumeration Documentation

anonymous enum

Constructor & Destructor Documentation

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

Definition at line 93 of file SiStripQualityHistory.cc.

References _history, _monitoredssq, m_badmodrun, m_LSfrac, m_maxLS, m_rhm, m_run, TFileService::make(), RunHistogramManager::makeTProfile(), Skims_PA_cff::name, and AlCaHLTBitMon_QueryRunRegistry::string.

95  _monitoredssq(iConfig.getParameter<std::vector<edm::ParameterSet> >("monitoredSiStripQuality")),
96  _mode(iConfig.getUntrackedParameter<unsigned int>("granularityMode", Module)),
97  m_run(iConfig.getParameter<bool>("runProcess")),
98  m_maxLS(iConfig.getUntrackedParameter<unsigned int>("maxLSBeforeRebin", 100)),
99  m_LSfrac(iConfig.getUntrackedParameter<unsigned int>("startingLSFraction", 4)),
100  _history(),
101  m_badmodrun() {
102  //now do what ever initialization is needed
103 
105 
106  for (std::vector<edm::ParameterSet>::const_iterator ps = _monitoredssq.begin(); ps != _monitoredssq.end(); ++ps) {
107  std::string name = ps->getParameter<std::string>("name");
108  // _history[name] = tfserv->make<TGraph>();
109  // _history[name]->SetName(name.c_str()); _history[name]->SetTitle(name.c_str());
110 
111  if (m_run)
112  _history[name] = tfserv->make<TH1F>(name.c_str(), name.c_str(), 10, 0, 10);
113 
114  char hrunname[400];
115  sprintf(hrunname, "badmodrun_%s", name.c_str());
116  char hruntitle[400];
117  sprintf(hruntitle, "Number of bad modules %s", name.c_str());
118  m_badmodrun[name] = m_rhm.makeTProfile(hrunname, hruntitle, m_LSfrac * m_maxLS, 0, m_maxLS * 262144);
119  }
120 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
std::map< std::string, TProfile ** > m_badmodrun
const std::vector< edm::ParameterSet > _monitoredssq
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
TProfile ** makeTProfile(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
const unsigned int m_LSfrac
const unsigned int m_maxLS
RunHistogramManager m_rhm
std::map< std::string, TH1F * > _history
SiStripQualityHistory::~SiStripQualityHistory ( )
override

Definition at line 122 of file SiStripQualityHistory.cc.

122  {
123  // do anything here that needs to be done at desctruction time
124  // (e.g. close files, deallocate resources etc.)
125 }

Member Function Documentation

void SiStripQualityHistory::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 132 of file SiStripQualityHistory.cc.

References _mode, _monitoredssq, APV, data, Fiber, HcalObjRepresent::Fill(), edm::EventSetup::get(), label, LogDebug, m_badmodrun, Skims_PA_cff::name, edm::EventBase::orbitNumber(), AlCaHLTBitMon_QueryRunRegistry::string, and Strip.

132  {
133  // edm::LogInfo("EventProcessing") << "event being processed";
134 
135  for (std::vector<edm::ParameterSet>::const_iterator ps = _monitoredssq.begin(); ps != _monitoredssq.end(); ++ps) {
136  std::string name = ps->getParameter<std::string>("name");
137  std::string label = ps->getParameter<std::string>("ssqLabel");
138 
140  iSetup.get<SiStripQualityRcd>().get(label, ssq);
141 
142  std::vector<SiStripQuality::BadComponent> bads = ssq->getBadComponentList();
143 
144  LogDebug("BadComponents") << bads.size() << " bad components found";
145 
146  int nbad = 0;
147 
148  if (_mode == Module || _mode == Fiber || _mode == APV) {
149  for (std::vector<SiStripQuality::BadComponent>::const_iterator bc = bads.begin(); bc != bads.end(); ++bc) {
150  if (_mode == Module) {
151  if (bc->BadModule)
152  ++nbad;
153  } else if (_mode == Fiber) {
154  for (int fiber = 1; fiber < 5; fiber *= 2) {
155  if ((bc->BadFibers & fiber) > 0)
156  ++nbad;
157  }
158  } else if (_mode == APV) {
159  for (int apv = 1; apv < 33; apv *= 2) {
160  if ((bc->BadApvs & apv) > 0)
161  ++nbad;
162  }
163  }
164  }
165  } else if (_mode == Strip) {
166  SiStripBadStrip::ContainerIterator dbegin = ssq->getDataVectorBegin();
167  SiStripBadStrip::ContainerIterator dend = ssq->getDataVectorEnd();
168  for (SiStripBadStrip::ContainerIterator data = dbegin; data < dend; ++data) {
169  nbad += ssq->decode(*data).range;
170  }
171  }
172 
173  if (m_badmodrun.find(name) != m_badmodrun.end() && m_badmodrun[name] && *m_badmodrun[name]) {
174  (*m_badmodrun[name])->Fill(iEvent.orbitNumber(), nbad);
175  }
176  }
177 }
#define LogDebug(id)
std::vector< unsigned int >::const_iterator ContainerIterator
std::map< std::string, TProfile ** > m_badmodrun
char const * label
const std::vector< edm::ParameterSet > _monitoredssq
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
int orbitNumber() const
Definition: EventBase.h:65
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
T get() const
Definition: EventSetup.h:73
void SiStripQualityHistory::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 241 of file SiStripQualityHistory.cc.

241 {}
void SiStripQualityHistory::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 179 of file SiStripQualityHistory.cc.

References _history, _mode, _monitoredssq, APV, RunHistogramManager::beginRun(), data, SiStripBadStrip::decode(), Fiber, edm::EventSetup::get(), SiStripQuality::getBadComponentList(), SiStripBadStrip::getDataVectorBegin(), SiStripBadStrip::getDataVectorEnd(), label, LogDebug, m_badmodrun, m_rhm, m_run, Skims_PA_cff::name, SiStripBadStrip::data::range, edm::RunBase::run(), AlCaHLTBitMon_QueryRunRegistry::string, and Strip.

179  {
180  m_rhm.beginRun(iRun);
181 
182  // loop on all the SiStripQuality objects to be monitored
183 
184  for (std::vector<edm::ParameterSet>::const_iterator ps = _monitoredssq.begin(); ps != _monitoredssq.end(); ++ps) {
185  std::string name = ps->getParameter<std::string>("name");
186  std::string label = ps->getParameter<std::string>("ssqLabel");
187 
188  if (m_badmodrun.find(name) != m_badmodrun.end()) {
189  if (m_badmodrun[name] && *m_badmodrun[name]) {
190  (*m_badmodrun[name])->SetCanExtend(TH1::kXaxis);
191  (*m_badmodrun[name])->GetXaxis()->SetTitle("time [Orb#]");
192  (*m_badmodrun[name])->GetYaxis()->SetTitle("bad components");
193  }
194  }
195 
196  if (m_run) {
198  iSetup.get<SiStripQualityRcd>().get(label, ssq);
199 
200  std::vector<SiStripQuality::BadComponent> bads = ssq->getBadComponentList();
201 
202  LogDebug("BadComponents") << bads.size() << " bad components found";
203 
204  int nbad = 0;
205 
206  if (_mode == Module || _mode == Fiber || _mode == APV) {
207  for (std::vector<SiStripQuality::BadComponent>::const_iterator bc = bads.begin(); bc != bads.end(); ++bc) {
208  if (_mode == Module) {
209  if (bc->BadModule)
210  ++nbad;
211  } else if (_mode == Fiber) {
212  for (int fiber = 1; fiber < 5; fiber *= 2) {
213  if ((bc->BadFibers & fiber) > 0)
214  ++nbad;
215  }
216  } else if (_mode == APV) {
217  for (int apv = 1; apv < 33; apv *= 2) {
218  if ((bc->BadApvs & apv) > 0)
219  ++nbad;
220  }
221  }
222  }
223  } else if (_mode == Strip) {
226  for (SiStripBadStrip::ContainerIterator data = dbegin; data < dend; ++data) {
227  nbad += ssq->decode(*data).range;
228  }
229  }
230 
231  // _history[name]->SetPoint(_history[name]->GetN(),iRun.run(),nbad);
232  char runname[100];
233  sprintf(runname, "%d", iRun.run());
234  LogDebug("AnalyzedRun") << name << " " << runname << " " << nbad;
235  _history[name]->Fill(runname, nbad);
236  }
237  }
238 }
#define LogDebug(id)
unsigned short range
const std::vector< BadComponent > & getBadComponentList() const
RunNumber_t run() const
Definition: RunBase.h:40
std::vector< unsigned int >::const_iterator ContainerIterator
std::map< std::string, TProfile ** > m_badmodrun
ContainerIterator getDataVectorEnd() const
char const * label
const std::vector< edm::ParameterSet > _monitoredssq
ContainerIterator getDataVectorBegin() const
void beginRun(const edm::Run &iRun)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
T get() const
Definition: EventSetup.h:73
RunHistogramManager m_rhm
std::map< std::string, TH1F * > _history
data decode(const unsigned int &value) const
void SiStripQualityHistory::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 244 of file SiStripQualityHistory.cc.

References DEFINE_FWK_MODULE.

244  {
245  /*
246  for(std::vector<edm::ParameterSet>::const_iterator ps=_monitoredssq.begin();ps!=_monitoredssq.end();++ps) {
247 
248  std::string name = ps->getParameter<std::string>("name");
249  _history[name]->Write();
250 
251  }
252  */
253 }

Member Data Documentation

std::map<std::string, TH1F*> SiStripQualityHistory::_history
private
const unsigned int SiStripQualityHistory::_mode
private

Definition at line 73 of file SiStripQualityHistory.cc.

Referenced by analyze(), and beginRun().

const std::vector<edm::ParameterSet> SiStripQualityHistory::_monitoredssq
private

Definition at line 72 of file SiStripQualityHistory.cc.

Referenced by analyze(), beginRun(), and SiStripQualityHistory().

std::map<std::string, TProfile**> SiStripQualityHistory::m_badmodrun
private

Definition at line 79 of file SiStripQualityHistory.cc.

Referenced by analyze(), beginRun(), and SiStripQualityHistory().

const unsigned int SiStripQualityHistory::m_LSfrac
private

Definition at line 76 of file SiStripQualityHistory.cc.

Referenced by SiStripQualityHistory().

const unsigned int SiStripQualityHistory::m_maxLS
private

Definition at line 75 of file SiStripQualityHistory.cc.

Referenced by SiStripQualityHistory().

RunHistogramManager SiStripQualityHistory::m_rhm
private

Definition at line 71 of file SiStripQualityHistory.cc.

Referenced by beginRun(), and SiStripQualityHistory().

const bool SiStripQualityHistory::m_run
private

Definition at line 74 of file SiStripQualityHistory.cc.

Referenced by beginRun(), and SiStripQualityHistory().