CMS 3D CMS Logo

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

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

Inheritance diagram for SiPixelQualityHistory:
edm::EDAnalyzer edm::EDConsumerBase

Public Types

enum  { Summary, Module, ROC }
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 SiPixelQualityHistory (const edm::ParameterSet &)
 
 ~SiPixelQualityHistory () 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, TProfile ** > m_badmodrun
 
std::map< std::string, TH1F * > m_history
 
const unsigned int m_LSfrac
 
const unsigned int m_maxLS
 
const unsigned int m_mode
 
const std::vector< edm::ParameterSetm_monitoredspq
 
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 57 of file SiPixelQualityHistory.cc.

Member Enumeration Documentation

anonymous enum

Constructor & Destructor Documentation

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

Definition at line 94 of file SiPixelQualityHistory.cc.

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

96  m_monitoredspq(iConfig.getParameter<std::vector<edm::ParameterSet> >("monitoredSiPixelQuality")),
97  m_mode(iConfig.getUntrackedParameter<unsigned int>("granularityMode", Module)),
98  m_run(iConfig.getParameter<bool>("runProcess")),
99  m_maxLS(iConfig.getUntrackedParameter<unsigned int>("maxLSBeforeRebin", 100)),
100  m_LSfrac(iConfig.getUntrackedParameter<unsigned int>("startingLSFraction", 4)),
101  m_history(),
102  m_badmodrun() {
103  //now do what ever initialization is needed
104 
106 
107  for (std::vector<edm::ParameterSet>::const_iterator ps = m_monitoredspq.begin(); ps != m_monitoredspq.end(); ++ps) {
108  std::string name = ps->getParameter<std::string>("name");
109 
110  if (m_run)
111  m_history[name] = tfserv->make<TH1F>(name.c_str(), name.c_str(), 10, 0, 10);
112 
113  char hrunname[400];
114  sprintf(hrunname, "badmodrun_%s", name.c_str());
115  char hruntitle[400];
116  sprintf(hruntitle, "Number of bad modules %s", name.c_str());
117  m_badmodrun[name] = m_rhm.makeTProfile(hrunname, hruntitle, m_LSfrac * m_maxLS, 0, m_maxLS * 262144);
118  }
119 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::map< std::string, TH1F * > m_history
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
RunHistogramManager m_rhm
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 std::vector< edm::ParameterSet > m_monitoredspq
const unsigned int m_LSfrac
std::map< std::string, TProfile ** > m_badmodrun
const unsigned int m_maxLS
SiPixelQualityHistory::~SiPixelQualityHistory ( )
override

Definition at line 121 of file SiPixelQualityHistory.cc.

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

Member Function Documentation

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

Definition at line 131 of file SiPixelQualityHistory.cc.

References HcalObjRepresent::Fill(), edm::EventSetup::get(), label, LogDebug, m_badmodrun, m_mode, m_monitoredspq, Skims_PA_cff::name, edm::EventBase::orbitNumber(), ROC, PixelMapPlotter::roc, AlCaHLTBitMon_QueryRunRegistry::string, and Summary.

131  {
132  // edm::LogInfo("EventProcessing") << "event being processed";
133 
134  for (std::vector<edm::ParameterSet>::const_iterator ps = m_monitoredspq.begin(); ps != m_monitoredspq.end(); ++ps) {
135  std::string name = ps->getParameter<std::string>("name");
136  std::string label = ps->getParameter<std::string>("spqLabel");
137 
139  iSetup.get<SiPixelQualityRcd>().get(label, spq);
140 
141  int nbad = 0;
142 
143  if (m_mode == Summary) {
144  // nbad = spq->BadModuleNumber();
145 
146  } else {
147  std::vector<SiPixelQuality::disabledModuleType> bads = spq->getBadComponentList();
148 
149  LogDebug("BadComponents") << bads.size() << " bad components found";
150 
151  for (std::vector<SiPixelQuality::disabledModuleType>::const_iterator bc = bads.begin(); bc != bads.end(); ++bc) {
152  if (m_mode == Module) {
153  if (spq->IsModuleBad(bc->DetID))
154  ++nbad;
155  // if(bc->errorType==0) ++nbad;
156  } else if (m_mode == ROC) {
157  for (int roc = 1; roc < 2 * 2 * 2 * 2 * 2 * 2 * 2 + 1; roc *= 2) {
158  if ((bc->BadRocs & roc) > 0)
159  ++nbad;
160  }
161  }
162  }
163  }
164  if (m_badmodrun.find(name) != m_badmodrun.end() && m_badmodrun[name] && *m_badmodrun[name]) {
165  (*m_badmodrun[name])->Fill(iEvent.orbitNumber(), nbad);
166  }
167  }
168 }
#define LogDebug(id)
char const * label
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
const std::vector< edm::ParameterSet > m_monitoredspq
int orbitNumber() const
Definition: EventBase.h:65
T get() const
Definition: EventSetup.h:73
std::map< std::string, TProfile ** > m_badmodrun
void SiPixelQualityHistory::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 224 of file SiPixelQualityHistory.cc.

224 {}
void SiPixelQualityHistory::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 170 of file SiPixelQualityHistory.cc.

References RunHistogramManager::beginRun(), edm::EventSetup::get(), SiPixelQuality::getBadComponentList(), SiPixelQuality::IsModuleBad(), label, LogDebug, m_badmodrun, m_history, m_mode, m_monitoredspq, m_rhm, m_run, Skims_PA_cff::name, ROC, PixelMapPlotter::roc, edm::RunBase::run(), AlCaHLTBitMon_QueryRunRegistry::string, and Summary.

170  {
171  m_rhm.beginRun(iRun);
172 
173  // loop on all the SiPixelQuality objects to be monitored
174 
175  for (std::vector<edm::ParameterSet>::const_iterator ps = m_monitoredspq.begin(); ps != m_monitoredspq.end(); ++ps) {
176  std::string name = ps->getParameter<std::string>("name");
177  std::string label = ps->getParameter<std::string>("spqLabel");
178 
179  if (m_badmodrun.find(name) != m_badmodrun.end()) {
180  if (m_badmodrun[name] && *m_badmodrun[name]) {
181  (*m_badmodrun[name])->SetCanExtend(TH1::kXaxis);
182  (*m_badmodrun[name])->GetXaxis()->SetTitle("time [Orb#]");
183  (*m_badmodrun[name])->GetYaxis()->SetTitle("bad components");
184  }
185  }
186 
187  if (m_run) {
189  iSetup.get<SiPixelQualityRcd>().get(label, spq);
190 
191  int nbad = 0;
192 
193  if (m_mode == Summary) {
194  // nbad = spq->BadModuleNumber();
195 
196  } else {
197  std::vector<SiPixelQuality::disabledModuleType> bads = spq->getBadComponentList();
198 
199  LogDebug("BadComponents") << bads.size() << " bad components found";
200 
201  for (std::vector<SiPixelQuality::disabledModuleType>::const_iterator bc = bads.begin(); bc != bads.end();
202  ++bc) {
203  if (m_mode == Module) {
204  if (spq->IsModuleBad(bc->DetID))
205  ++nbad;
206  // if(bc->errorType==0) ++nbad;
207  } else if (m_mode == ROC) {
208  for (int roc = 1; roc < 2 * 2 * 2 * 2 * 2 * 2 * 2 + 1; roc *= 2) {
209  if ((bc->BadRocs & roc) > 0)
210  ++nbad;
211  }
212  }
213  }
214  }
215  char runname[100];
216  sprintf(runname, "%d", iRun.run());
217  LogDebug("AnalyzedRun") << name << " " << runname << " " << nbad;
218  m_history[name]->Fill(runname, nbad);
219  }
220  }
221 }
#define LogDebug(id)
RunNumber_t run() const
Definition: RunBase.h:40
std::map< std::string, TH1F * > m_history
char const * label
RunHistogramManager m_rhm
const std::vector< edm::ParameterSet > m_monitoredspq
const std::vector< disabledModuleType > getBadComponentList() const
bool IsModuleBad(const uint32_t &detid) const
void beginRun(const edm::Run &iRun)
T get() const
Definition: EventSetup.h:73
std::map< std::string, TProfile ** > m_badmodrun
void SiPixelQualityHistory::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 227 of file SiPixelQualityHistory.cc.

References DEFINE_FWK_MODULE.

227  {
228  /*
229  for(std::vector<edm::ParameterSet>::const_iterator ps=m_monitoredspq.begin();ps!=m_monitoredspq.end();++ps) {
230 
231  std::string name = ps->getParameter<std::string>("name");
232  m_history[name]->Write();
233 
234  }
235  */
236 }

Member Data Documentation

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

Definition at line 80 of file SiPixelQualityHistory.cc.

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

std::map<std::string, TH1F*> SiPixelQualityHistory::m_history
private

Definition at line 79 of file SiPixelQualityHistory.cc.

Referenced by beginRun(), and SiPixelQualityHistory().

const unsigned int SiPixelQualityHistory::m_LSfrac
private

Definition at line 77 of file SiPixelQualityHistory.cc.

Referenced by SiPixelQualityHistory().

const unsigned int SiPixelQualityHistory::m_maxLS
private

Definition at line 76 of file SiPixelQualityHistory.cc.

Referenced by SiPixelQualityHistory().

const unsigned int SiPixelQualityHistory::m_mode
private

Definition at line 74 of file SiPixelQualityHistory.cc.

Referenced by analyze(), and beginRun().

const std::vector<edm::ParameterSet> SiPixelQualityHistory::m_monitoredspq
private

Definition at line 73 of file SiPixelQualityHistory.cc.

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

RunHistogramManager SiPixelQualityHistory::m_rhm
private

Definition at line 72 of file SiPixelQualityHistory.cc.

Referenced by beginRun(), and SiPixelQualityHistory().

const bool SiPixelQualityHistory::m_run
private

Definition at line 75 of file SiPixelQualityHistory.cc.

Referenced by beginRun(), and SiPixelQualityHistory().