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::one::EDAnalyzer< edm::one::WatchRuns, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Types

enum  { Module, Fiber, APV, Strip }
 
- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase 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::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, TH1F * > _history
 
const unsigned int _mode
 
const std::vector< edm::ParameterSet_monitoredssq
 
std::vector< edm::ESGetToken< SiStripQuality, SiStripQualityRcd > > _ssqTokens
 
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::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 56 of file SiStripQualityHistory.cc.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Constructor & Destructor Documentation

◆ SiStripQualityHistory()

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

Definition at line 95 of file SiStripQualityHistory.cc.

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

97  _monitoredssq(iConfig.getParameter<std::vector<edm::ParameterSet>>("monitoredSiStripQuality")),
98  _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  _history(),
103  m_badmodrun() {
104  //now do what ever initialization is needed
105  usesResource(TFileService::kSharedResource);
106 
108 
109  for (const auto& ps : _monitoredssq) {
110  _ssqTokens.emplace_back(
111  esConsumes<edm::Transition::BeginRun>(edm::ESInputTag{"", ps.getParameter<std::string>("ssqLabel")}));
112  std::string name = ps.getParameter<std::string>("name");
113  // _history[name] = tfserv->make<TGraph>();
114  // _history[name]->SetName(name.c_str()); _history[name]->SetTitle(name.c_str());
115 
116  if (m_run)
117  _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 getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::map< std::string, TProfile ** > m_badmodrun
T getUntrackedParameter(std::string const &, T const &) const
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)
std::vector< edm::ESGetToken< SiStripQuality, SiStripQualityRcd > > _ssqTokens
const unsigned int m_LSfrac
const unsigned int m_maxLS
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
RunHistogramManager m_rhm
std::map< std::string, TH1F * > _history

◆ ~SiStripQualityHistory()

SiStripQualityHistory::~SiStripQualityHistory ( )
override

Definition at line 127 of file SiStripQualityHistory.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

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 137 of file SiStripQualityHistory.cc.

References _mode, _monitoredssq, _ssqTokens, APV, data, Fiber, HcalObjRepresent::Fill(), edm::EventSetup::getData(), iEvent, LogDebug, m_badmodrun, Skims_PA_cff::name, AlCaHLTBitMon_QueryRunRegistry::string, and Strip.

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

◆ beginJob()

void SiStripQualityHistory::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 240 of file SiStripQualityHistory.cc.

240 {}

◆ beginRun()

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

Definition at line 181 of file SiStripQualityHistory.cc.

References _history, _mode, _monitoredssq, _ssqTokens, APV, RunHistogramManager::beginRun(), data, Fiber, edm::EventSetup::getData(), LogDebug, m_badmodrun, m_rhm, m_run, Skims_PA_cff::name, edm::RunBase::run(), AlCaHLTBitMon_QueryRunRegistry::string, and Strip.

181  {
182  m_rhm.beginRun(iRun);
183 
184  // loop on all the SiStripQuality objects to be monitored
185  for (std::size_t iMon = 0; iMon != _monitoredssq.size(); ++iMon) {
186  std::string name = _monitoredssq[iMon].getParameter<std::string>("name");
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) {
197  const auto& ssq = iSetup.getData(_ssqTokens[iMon]);
198 
199  std::vector<SiStripQuality::BadComponent> bads = ssq.getBadComponentList();
200 
201  LogDebug("BadComponents") << bads.size() << " bad components found";
202 
203  int nbad = 0;
204 
205  if (_mode == Module || _mode == Fiber || _mode == APV) {
206  for (const auto& bc : bads) {
207  if (_mode == Module) {
208  if (bc.BadModule)
209  ++nbad;
210  } else if (_mode == Fiber) {
211  for (int fiber = 1; fiber < 5; fiber *= 2) {
212  if ((bc.BadFibers & fiber) > 0)
213  ++nbad;
214  }
215  } else if (_mode == APV) {
216  for (int apv = 1; apv < 33; apv *= 2) {
217  if ((bc.BadApvs & apv) > 0)
218  ++nbad;
219  }
220  }
221  }
222  } else if (_mode == Strip) {
223  SiStripBadStrip::ContainerIterator dbegin = ssq.getDataVectorBegin();
224  SiStripBadStrip::ContainerIterator dend = ssq.getDataVectorEnd();
225  for (SiStripBadStrip::ContainerIterator data = dbegin; data < dend; ++data) {
226  nbad += ssq.decode(*data).range;
227  }
228  }
229 
230  // _history[name]->SetPoint(_history[name]->GetN(),iRun.run(),nbad);
231  char runname[100];
232  sprintf(runname, "%d", iRun.run());
233  LogDebug("AnalyzedRun") << name << " " << runname << " " << nbad;
234  _history[name]->Fill(runname, nbad);
235  }
236  }
237 }
std::vector< unsigned int >::const_iterator ContainerIterator
std::map< std::string, TProfile ** > m_badmodrun
const std::vector< edm::ParameterSet > _monitoredssq
RunNumber_t run() const
Definition: RunBase.h:40
bool getData(T &iHolder) const
Definition: EventSetup.h:122
std::vector< edm::ESGetToken< SiStripQuality, SiStripQualityRcd > > _ssqTokens
void beginRun(const edm::Run &iRun)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
RunHistogramManager m_rhm
std::map< std::string, TH1F * > _history
#define LogDebug(id)

◆ endJob()

void SiStripQualityHistory::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 243 of file SiStripQualityHistory.cc.

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

◆ endRun()

void SiStripQualityHistory::endRun ( const edm::Run ,
const edm::EventSetup  
)
inlineoverrideprivate

Definition at line 66 of file SiStripQualityHistory.cc.

66 {}

Member Data Documentation

◆ _history

std::map<std::string, TH1F*> SiStripQualityHistory::_history
private

Definition at line 80 of file SiStripQualityHistory.cc.

Referenced by beginRun(), and SiStripQualityHistory().

◆ _mode

const unsigned int SiStripQualityHistory::_mode
private

Definition at line 75 of file SiStripQualityHistory.cc.

Referenced by analyze(), and beginRun().

◆ _monitoredssq

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

Definition at line 73 of file SiStripQualityHistory.cc.

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

◆ _ssqTokens

std::vector<edm::ESGetToken<SiStripQuality, SiStripQualityRcd> > SiStripQualityHistory::_ssqTokens
private

Definition at line 74 of file SiStripQualityHistory.cc.

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

◆ m_badmodrun

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

Definition at line 81 of file SiStripQualityHistory.cc.

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

◆ m_LSfrac

const unsigned int SiStripQualityHistory::m_LSfrac
private

Definition at line 78 of file SiStripQualityHistory.cc.

Referenced by SiStripQualityHistory().

◆ m_maxLS

const unsigned int SiStripQualityHistory::m_maxLS
private

Definition at line 77 of file SiStripQualityHistory.cc.

Referenced by SiStripQualityHistory().

◆ m_rhm

RunHistogramManager SiStripQualityHistory::m_rhm
private

Definition at line 72 of file SiStripQualityHistory.cc.

Referenced by beginRun(), and SiStripQualityHistory().

◆ m_run

const bool SiStripQualityHistory::m_run
private

Definition at line 76 of file SiStripQualityHistory.cc.

Referenced by beginRun(), and SiStripQualityHistory().