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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
std::vector< edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd > > m_spqTokens
 

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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
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 = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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 95 of file SiPixelQualityHistory.cc.

97  m_monitoredspq(iConfig.getParameter<std::vector<edm::ParameterSet>>("monitoredSiPixelQuality")),
98  m_mode(iConfig.getUntrackedParameter<unsigned int>("granularityMode", Module)),
99  m_run(iConfig.getParameter<bool>("runProcess")),
100  m_maxLS(iConfig.getUntrackedParameter<unsigned int>("maxLSBeforeRebin", 100)),
101  m_LSfrac(iConfig.getUntrackedParameter<unsigned int>("startingLSFraction", 4)),
102  m_history(),
103  m_badmodrun() {
104  //now do what ever initialization is needed
105 
107 
108  for (const auto& ps : m_monitoredspq) {
109  m_spqTokens.emplace_back(
110  esConsumes<edm::Transition::BeginRun>(edm::ESInputTag{"", ps.getParameter<std::string>("spqLabel")}));
111 
112  std::string name = ps.getParameter<std::string>("name");
113 
114  if (m_run)
115  m_history[name] = tfserv->make<TH1F>(name.c_str(), name.c_str(), 10, 0, 10);
116 
117  char hrunname[400];
118  sprintf(hrunname, "badmodrun_%s", name.c_str());
119  char hruntitle[400];
120  sprintf(hruntitle, "Number of bad modules %s", name.c_str());
121  m_badmodrun[name] = m_rhm.makeTProfile(hrunname, hruntitle, m_LSfrac * m_maxLS, 0, m_maxLS * 262144);
122  }
123 }

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

◆ ~SiPixelQualityHistory()

SiPixelQualityHistory::~SiPixelQualityHistory ( )
override

Definition at line 125 of file SiPixelQualityHistory.cc.

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

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 135 of file SiPixelQualityHistory.cc.

135  {
136  // edm::LogInfo("EventProcessing") << "event being processed";
137 
138  for (std::size_t iMon = 0; iMon != m_monitoredspq.size(); ++iMon) {
139  std::string name = m_monitoredspq[iMon].getParameter<std::string>("name");
140  const auto& spq = iSetup.getData(m_spqTokens[iMon]);
141 
142  int nbad = 0;
143 
144  if (m_mode == Summary) {
145  // nbad = spq.BadModuleNumber();
146 
147  } else {
148  std::vector<SiPixelQuality::disabledModuleType> bads = spq.getBadComponentList();
149 
150  LogDebug("BadComponents") << bads.size() << " bad components found";
151 
152  for (const auto& bc : bads) {
153  if (m_mode == Module) {
154  if (spq.IsModuleBad(bc.DetID))
155  ++nbad;
156  // if(bc.errorType==0) ++nbad;
157  } else if (m_mode == ROC) {
158  for (int roc = 1; roc < 2 * 2 * 2 * 2 * 2 * 2 * 2 + 1; roc *= 2) {
159  if ((bc.BadRocs & roc) > 0)
160  ++nbad;
161  }
162  }
163  }
164  }
165  if (m_badmodrun.find(name) != m_badmodrun.end() && m_badmodrun[name] && *m_badmodrun[name]) {
166  (*m_badmodrun[name])->Fill(iEvent.orbitNumber(), nbad);
167  }
168  }
169 }

References HcalObjRepresent::Fill(), edm::EventSetup::getData(), iEvent, LogDebug, m_badmodrun, m_mode, m_monitoredspq, m_spqTokens, 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 222 of file SiPixelQualityHistory.cc.

222 {}

◆ beginRun()

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

Reimplemented from edm::EDAnalyzer.

Definition at line 171 of file SiPixelQualityHistory.cc.

171  {
172  m_rhm.beginRun(iRun);
173 
174  // loop on all the SiPixelQuality objects to be monitored
175  for (std::size_t iMon = 0; iMon != m_monitoredspq.size(); ++iMon) {
176  const auto& ps = m_monitoredspq[iMon];
177  std::string name = ps.getParameter<std::string>("name");
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) {
188  const auto& spq = iSetup.getData(m_spqTokens[iMon]);
189 
190  int nbad = 0;
191 
192  if (m_mode == Summary) {
193  // nbad = spq.BadModuleNumber();
194 
195  } else {
196  std::vector<SiPixelQuality::disabledModuleType> bads = spq.getBadComponentList();
197 
198  LogDebug("BadComponents") << bads.size() << " bad components found";
199 
200  for (const auto& bc : bads) {
201  if (m_mode == Module) {
202  if (spq.IsModuleBad(bc.DetID))
203  ++nbad;
204  // if(bc.errorType==0) ++nbad;
205  } else if (m_mode == ROC) {
206  for (int roc = 1; roc < 2 * 2 * 2 * 2 * 2 * 2 * 2 + 1; roc *= 2) {
207  if ((bc.BadRocs & roc) > 0)
208  ++nbad;
209  }
210  }
211  }
212  }
213  char runname[100];
214  sprintf(runname, "%d", iRun.run());
215  LogDebug("AnalyzedRun") << name << " " << runname << " " << nbad;
216  m_history[name]->Fill(runname, nbad);
217  }
218  }
219 }

References RunHistogramManager::beginRun(), edm::EventSetup::getData(), LogDebug, m_badmodrun, m_history, m_mode, m_monitoredspq, m_rhm, m_run, m_spqTokens, 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 225 of file SiPixelQualityHistory.cc.

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

Member Data Documentation

◆ m_badmodrun

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

Definition at line 81 of file SiPixelQualityHistory.cc.

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

◆ m_history

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

Definition at line 80 of file SiPixelQualityHistory.cc.

Referenced by beginRun(), and SiPixelQualityHistory().

◆ m_LSfrac

const unsigned int SiPixelQualityHistory::m_LSfrac
private

Definition at line 78 of file SiPixelQualityHistory.cc.

Referenced by SiPixelQualityHistory().

◆ m_maxLS

const unsigned int SiPixelQualityHistory::m_maxLS
private

Definition at line 77 of file SiPixelQualityHistory.cc.

Referenced by SiPixelQualityHistory().

◆ m_mode

const unsigned int SiPixelQualityHistory::m_mode
private

Definition at line 75 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 76 of file SiPixelQualityHistory.cc.

Referenced by beginRun(), and SiPixelQualityHistory().

◆ m_spqTokens

std::vector<edm::ESGetToken<SiPixelQuality, SiPixelQualityRcd> > SiPixelQualityHistory::m_spqTokens
private

Definition at line 74 of file SiPixelQualityHistory.cc.

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

edm::ESInputTag
Definition: ESInputTag.h:87
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:47
SiPixelQualityHistory::m_mode
const unsigned int m_mode
Definition: SiPixelQualityHistory.cc:75
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
SiPixelQualityHistory::ROC
Definition: SiPixelQualityHistory.cc:62
edm::RunBase::run
RunNumber_t run() const
Definition: RunBase.h:40
SiPixelQualityHistory::m_maxLS
const unsigned int m_maxLS
Definition: SiPixelQualityHistory.cc:77
SiPixelQualityHistory::m_LSfrac
const unsigned int m_LSfrac
Definition: SiPixelQualityHistory.cc:78
SiPixelQualityHistory::Module
Definition: SiPixelQualityHistory.cc:62
SiPixelQualityHistory::m_history
std::map< std::string, TH1F * > m_history
Definition: SiPixelQualityHistory.cc:80
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:233
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
SiPixelQualityHistory::m_spqTokens
std::vector< edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd > > m_spqTokens
Definition: SiPixelQualityHistory.cc:74
HcalObjRepresent::Fill
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Definition: HcalObjRepresent.h:1053
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
SiPixelQualityHistory::m_badmodrun
std::map< std::string, TProfile ** > m_badmodrun
Definition: SiPixelQualityHistory.cc:81
SiPixelQualityHistory::m_run
const bool m_run
Definition: SiPixelQualityHistory.cc:76
PixelMapPlotter.roc
roc
Definition: PixelMapPlotter.py:498
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SiPixelQualityHistory::Summary
Definition: SiPixelQualityHistory.cc:62
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