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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (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

anonymous enum
Enumerator
Summary 
Module 
ROC 

Definition at line 62 of file SiPixelQualityHistory.cc.

62 { Summary, Module, ROC };

Constructor & Destructor Documentation

◆ SiPixelQualityHistory()

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

Definition at line 94 of file SiPixelQualityHistory.cc.

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 }

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.

◆ ~SiPixelQualityHistory()

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

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 131 of file SiPixelQualityHistory.cc.

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 }

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

◆ beginJob()

void SiPixelQualityHistory::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 224 of file SiPixelQualityHistory.cc.

224 {}

◆ beginRun()

void SiPixelQualityHistory::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 170 of file SiPixelQualityHistory.cc.

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 }

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

◆ endJob()

void SiPixelQualityHistory::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 227 of file SiPixelQualityHistory.cc.

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

◆ m_badmodrun

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

Definition at line 80 of file SiPixelQualityHistory.cc.

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

◆ m_history

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

Definition at line 79 of file SiPixelQualityHistory.cc.

Referenced by beginRun(), and SiPixelQualityHistory().

◆ m_LSfrac

const unsigned int SiPixelQualityHistory::m_LSfrac
private

Definition at line 77 of file SiPixelQualityHistory.cc.

Referenced by SiPixelQualityHistory().

◆ m_maxLS

const unsigned int SiPixelQualityHistory::m_maxLS
private

Definition at line 76 of file SiPixelQualityHistory.cc.

Referenced by SiPixelQualityHistory().

◆ m_mode

const unsigned int SiPixelQualityHistory::m_mode
private

Definition at line 74 of file SiPixelQualityHistory.cc.

Referenced by analyze(), and beginRun().

◆ m_monitoredspq

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

Definition at line 73 of file SiPixelQualityHistory.cc.

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

◆ m_rhm

RunHistogramManager SiPixelQualityHistory::m_rhm
private

Definition at line 72 of file SiPixelQualityHistory.cc.

Referenced by beginRun(), and SiPixelQualityHistory().

◆ m_run

const bool SiPixelQualityHistory::m_run
private

Definition at line 75 of file SiPixelQualityHistory.cc.

Referenced by beginRun(), and SiPixelQualityHistory().

SiPixelQuality::IsModuleBad
bool IsModuleBad(const uint32_t &detid) const
Definition: SiPixelQuality.cc:97
SiPixelQualityRcd
Definition: SiPixelQualityRcd.h:13
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:71
SiPixelQualityHistory::m_mode
const unsigned int m_mode
Definition: SiPixelQualityHistory.cc:74
SiPixelQualityHistory::Module
Definition: SiPixelQualityHistory.cc:62
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::RunBase::run
RunNumber_t run() const
Definition: RunBase.h:40
SiPixelQualityHistory::m_maxLS
const unsigned int m_maxLS
Definition: SiPixelQualityHistory.cc:76
SiPixelQualityHistory::Summary
Definition: SiPixelQualityHistory.cc:62
SiPixelQualityHistory::m_LSfrac
const unsigned int m_LSfrac
Definition: SiPixelQualityHistory.cc:77
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
SiPixelQualityHistory::ROC
Definition: SiPixelQualityHistory.cc:62
SiPixelQualityHistory::m_history
std::map< std::string, TH1F * > m_history
Definition: SiPixelQualityHistory.cc:79
edm::ESHandle< SiPixelQuality >
SiPixelQualityHistory::m_rhm
RunHistogramManager m_rhm
Definition: SiPixelQualityHistory.cc:72
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
SiPixelQualityHistory::m_monitoredspq
const std::vector< edm::ParameterSet > m_monitoredspq
Definition: SiPixelQualityHistory.cc:73
RunHistogramManager::beginRun
void beginRun(const edm::Run &iRun)
Definition: RunHistogramManager.cc:101
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
get
#define get
HcalObjRepresent::Fill
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Definition: HcalObjRepresent.h:1053
SiPixelQuality::getBadComponentList
const std::vector< disabledModuleType > getBadComponentList() const
Definition: SiPixelQuality.h:100
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
SiPixelQualityHistory::m_badmodrun
std::map< std::string, TProfile ** > m_badmodrun
Definition: SiPixelQualityHistory.cc:80
SiPixelQualityHistory::m_run
const bool m_run
Definition: SiPixelQualityHistory.cc:75
PixelMapPlotter.roc
roc
Definition: PixelMapPlotter.py:498
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
label
const char * label
Definition: PFTauDecayModeTools.cc:11
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
RunHistogramManager::makeTProfile
TProfile ** makeTProfile(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
Definition: RunHistogramManager.cc:52