CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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::one::EDAnalyzer< edm::one::WatchRuns, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Types

enum  { Summary, Module, ROC }
 
- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase 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::one::EDAnalyzer< edm::one::WatchRuns, edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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
 
void endRun (const edm::Run &, const edm::EventSetup &) 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::ParameterSet
m_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::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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 96 of file SiPixelQualityHistory.cc.

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

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

Definition at line 127 of file SiPixelQualityHistory.cc.

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

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 137 of file SiPixelQualityHistory.cc.

References HcalObjRepresent::Fill(), edm::EventSetup::getData(), LogDebug, m_badmodrun, m_mode, m_spqTokens, Module, mergeVDriftHistosByStation::name, edm::EventBase::orbitNumber(), ROC, PixelMapPlotter::roc, AlCaHLTBitMon_QueryRunRegistry::string, and Summary.

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

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 224 of file SiPixelQualityHistory.cc.

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

Definition at line 173 of file SiPixelQualityHistory.cc.

References RunHistogramManager::beginRun(), edm::EventSetup::getData(), LogDebug, m_badmodrun, m_history, m_mode, m_rhm, m_run, m_spqTokens, Module, mergeVDriftHistosByStation::name, ROC, PixelMapPlotter::roc, edm::RunBase::run(), AlCaHLTBitMon_QueryRunRegistry::string, and Summary.

173  {
174  m_rhm.beginRun(iRun);
175 
176  // loop on all the SiPixelQuality objects to be monitored
177  for (std::size_t iMon = 0; iMon != m_monitoredspq.size(); ++iMon) {
178  const auto& ps = m_monitoredspq[iMon];
179  std::string name = ps.getParameter<std::string>("name");
180 
181  if (m_badmodrun.find(name) != m_badmodrun.end()) {
182  if (m_badmodrun[name] && *m_badmodrun[name]) {
183  (*m_badmodrun[name])->SetCanExtend(TH1::kXaxis);
184  (*m_badmodrun[name])->GetXaxis()->SetTitle("time [Orb#]");
185  (*m_badmodrun[name])->GetYaxis()->SetTitle("bad components");
186  }
187  }
188 
189  if (m_run) {
190  const auto& spq = iSetup.getData(m_spqTokens[iMon]);
191 
192  int nbad = 0;
193 
194  if (m_mode == Summary) {
195  // nbad = spq.BadModuleNumber();
196 
197  } else {
198  std::vector<SiPixelQuality::disabledModuleType> bads = spq.getBadComponentList();
199 
200  LogDebug("BadComponents") << bads.size() << " bad components found";
201 
202  for (const auto& bc : bads) {
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 }
RunNumber_t run() const
Definition: RunBase.h:40
std::map< std::string, TH1F * > m_history
bool getData(T &iHolder) const
Definition: EventSetup.h:122
RunHistogramManager m_rhm
const std::vector< edm::ParameterSet > m_monitoredspq
std::vector< edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd > > m_spqTokens
void beginRun(const edm::Run &iRun)
std::map< std::string, TProfile ** > m_badmodrun
#define LogDebug(id)
void SiPixelQualityHistory::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

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 }
void SiPixelQualityHistory::endRun ( const edm::Run ,
const edm::EventSetup  
)
inlineoverrideprivate

Definition at line 67 of file SiPixelQualityHistory.cc.

67 {}

Member Data Documentation

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

Definition at line 82 of file SiPixelQualityHistory.cc.

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

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

Definition at line 81 of file SiPixelQualityHistory.cc.

Referenced by beginRun(), and SiPixelQualityHistory().

const unsigned int SiPixelQualityHistory::m_LSfrac
private

Definition at line 79 of file SiPixelQualityHistory.cc.

Referenced by SiPixelQualityHistory().

const unsigned int SiPixelQualityHistory::m_maxLS
private

Definition at line 78 of file SiPixelQualityHistory.cc.

Referenced by SiPixelQualityHistory().

const unsigned int SiPixelQualityHistory::m_mode
private

Definition at line 76 of file SiPixelQualityHistory.cc.

Referenced by analyze(), and beginRun().

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

Definition at line 74 of file SiPixelQualityHistory.cc.

Referenced by SiPixelQualityHistory().

RunHistogramManager SiPixelQualityHistory::m_rhm
private

Definition at line 73 of file SiPixelQualityHistory.cc.

Referenced by beginRun(), and SiPixelQualityHistory().

const bool SiPixelQualityHistory::m_run
private

Definition at line 77 of file SiPixelQualityHistory.cc.

Referenced by beginRun(), and SiPixelQualityHistory().

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

Definition at line 75 of file SiPixelQualityHistory.cc.

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