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::EDAnalyzer edm::EDConsumerBase

Public Types

enum  { Module, Fiber, APV, Strip }
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer 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::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::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, 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::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 56 of file SiStripQualityHistory.cc.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Module 
Fiber 
APV 
Strip 

Definition at line 61 of file SiStripQualityHistory.cc.

61 { Module, Fiber, APV, Strip };

Constructor & Destructor Documentation

◆ SiStripQualityHistory()

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

Definition at line 94 of file SiStripQualityHistory.cc.

96  _monitoredssq(iConfig.getParameter<std::vector<edm::ParameterSet>>("monitoredSiStripQuality")),
97  _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  _history(),
102  m_badmodrun() {
103  //now do what ever initialization is needed
104 
106 
107  for (const auto& ps : _monitoredssq) {
108  _ssqTokens.emplace_back(
109  esConsumes<edm::Transition::BeginRun>(edm::ESInputTag{"", ps.getParameter<std::string>("ssqLabel")}));
110  std::string name = ps.getParameter<std::string>("name");
111  // _history[name] = tfserv->make<TGraph>();
112  // _history[name]->SetName(name.c_str()); _history[name]->SetTitle(name.c_str());
113 
114  if (m_run)
115  _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 _history, _monitoredssq, _ssqTokens, m_badmodrun, m_LSfrac, m_maxLS, m_rhm, m_run, TFileService::make(), RunHistogramManager::makeTProfile(), Skims_PA_cff::name, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~SiStripQualityHistory()

SiStripQualityHistory::~SiStripQualityHistory ( )
override

Definition at line 125 of file SiStripQualityHistory.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 SiStripQualityHistory::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 135 of file SiStripQualityHistory.cc.

135  {
136  // edm::LogInfo("EventProcessing") << "event being processed";
137 
138  for (std::size_t iMon = 0; iMon != _monitoredssq.size(); ++iMon) {
139  std::string name = _monitoredssq[iMon].getParameter<std::string>("name");
140  const auto& ssq = iSetup.getData(_ssqTokens[iMon]);
141 
142  std::vector<SiStripQuality::BadComponent> bads = ssq.getBadComponentList();
143 
144  LogDebug("BadComponents") << bads.size() << " bad components found";
145 
146  int nbad = 0;
147 
148  if (_mode == Module || _mode == Fiber || _mode == APV) {
149  for (const auto& bc : bads) {
150  if (_mode == Module) {
151  if (bc.BadModule)
152  ++nbad;
153  } else if (_mode == Fiber) {
154  for (int fiber = 1; fiber < 5; fiber *= 2) {
155  if ((bc.BadFibers & fiber) > 0)
156  ++nbad;
157  }
158  } else if (_mode == APV) {
159  for (int apv = 1; apv < 33; apv *= 2) {
160  if ((bc.BadApvs & apv) > 0)
161  ++nbad;
162  }
163  }
164  }
165  } else if (_mode == Strip) {
166  SiStripBadStrip::ContainerIterator dbegin = ssq.getDataVectorBegin();
167  SiStripBadStrip::ContainerIterator dend = ssq.getDataVectorEnd();
168  for (SiStripBadStrip::ContainerIterator data = dbegin; data < dend; ++data) {
169  nbad += ssq.decode(*data).range;
170  }
171  }
172 
173  if (m_badmodrun.find(name) != m_badmodrun.end() && m_badmodrun[name] && *m_badmodrun[name]) {
174  (*m_badmodrun[name])->Fill(iEvent.orbitNumber(), nbad);
175  }
176  }
177 }

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

◆ beginJob()

void SiStripQualityHistory::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 238 of file SiStripQualityHistory.cc.

238 {}

◆ beginRun()

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

Reimplemented from edm::EDAnalyzer.

Definition at line 179 of file SiStripQualityHistory.cc.

179  {
180  m_rhm.beginRun(iRun);
181 
182  // loop on all the SiStripQuality objects to be monitored
183  for (std::size_t iMon = 0; iMon != _monitoredssq.size(); ++iMon) {
184  std::string name = _monitoredssq[iMon].getParameter<std::string>("name");
185 
186  if (m_badmodrun.find(name) != m_badmodrun.end()) {
187  if (m_badmodrun[name] && *m_badmodrun[name]) {
188  (*m_badmodrun[name])->SetCanExtend(TH1::kXaxis);
189  (*m_badmodrun[name])->GetXaxis()->SetTitle("time [Orb#]");
190  (*m_badmodrun[name])->GetYaxis()->SetTitle("bad components");
191  }
192  }
193 
194  if (m_run) {
195  const auto& ssq = iSetup.getData(_ssqTokens[iMon]);
196 
197  std::vector<SiStripQuality::BadComponent> bads = ssq.getBadComponentList();
198 
199  LogDebug("BadComponents") << bads.size() << " bad components found";
200 
201  int nbad = 0;
202 
203  if (_mode == Module || _mode == Fiber || _mode == APV) {
204  for (const auto& bc : bads) {
205  if (_mode == Module) {
206  if (bc.BadModule)
207  ++nbad;
208  } else if (_mode == Fiber) {
209  for (int fiber = 1; fiber < 5; fiber *= 2) {
210  if ((bc.BadFibers & fiber) > 0)
211  ++nbad;
212  }
213  } else if (_mode == APV) {
214  for (int apv = 1; apv < 33; apv *= 2) {
215  if ((bc.BadApvs & apv) > 0)
216  ++nbad;
217  }
218  }
219  }
220  } else if (_mode == Strip) {
221  SiStripBadStrip::ContainerIterator dbegin = ssq.getDataVectorBegin();
222  SiStripBadStrip::ContainerIterator dend = ssq.getDataVectorEnd();
223  for (SiStripBadStrip::ContainerIterator data = dbegin; data < dend; ++data) {
224  nbad += ssq.decode(*data).range;
225  }
226  }
227 
228  // _history[name]->SetPoint(_history[name]->GetN(),iRun.run(),nbad);
229  char runname[100];
230  sprintf(runname, "%d", iRun.run());
231  LogDebug("AnalyzedRun") << name << " " << runname << " " << nbad;
232  _history[name]->Fill(runname, nbad);
233  }
234  }
235 }

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

◆ endJob()

void SiStripQualityHistory::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 241 of file SiStripQualityHistory.cc.

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

Member Data Documentation

◆ _history

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

Definition at line 79 of file SiStripQualityHistory.cc.

Referenced by beginRun(), and SiStripQualityHistory().

◆ _mode

const unsigned int SiStripQualityHistory::_mode
private

Definition at line 74 of file SiStripQualityHistory.cc.

Referenced by analyze(), and beginRun().

◆ _monitoredssq

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

Definition at line 72 of file SiStripQualityHistory.cc.

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

◆ _ssqTokens

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

Definition at line 73 of file SiStripQualityHistory.cc.

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

◆ m_badmodrun

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

Definition at line 80 of file SiStripQualityHistory.cc.

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

◆ m_LSfrac

const unsigned int SiStripQualityHistory::m_LSfrac
private

Definition at line 77 of file SiStripQualityHistory.cc.

Referenced by SiStripQualityHistory().

◆ m_maxLS

const unsigned int SiStripQualityHistory::m_maxLS
private

Definition at line 76 of file SiStripQualityHistory.cc.

Referenced by SiStripQualityHistory().

◆ m_rhm

RunHistogramManager SiStripQualityHistory::m_rhm
private

Definition at line 71 of file SiStripQualityHistory.cc.

Referenced by beginRun(), and SiStripQualityHistory().

◆ m_run

const bool SiStripQualityHistory::m_run
private

Definition at line 75 of file SiStripQualityHistory.cc.

Referenced by beginRun(), and SiStripQualityHistory().

SiStripQualityHistory::Module
Definition: SiStripQualityHistory.cc:61
edm::ESInputTag
Definition: ESInputTag.h:87
SiStripQualityHistory::Strip
Definition: SiStripQualityHistory.cc:61
SiStripQualityHistory::APV
Definition: SiStripQualityHistory.cc:61
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:46
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
SiStripQualityHistory::_monitoredssq
const std::vector< edm::ParameterSet > _monitoredssq
Definition: SiStripQualityHistory.cc:72
edm::RunBase::run
RunNumber_t run() const
Definition: RunBase.h:40
SiStripQualityHistory::_ssqTokens
std::vector< edm::ESGetToken< SiStripQuality, SiStripQualityRcd > > _ssqTokens
Definition: SiStripQualityHistory.cc:73
SiStripQualityHistory::_history
std::map< std::string, TH1F * > _history
Definition: SiStripQualityHistory.cc:79
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
SiStripQualityHistory::m_LSfrac
const unsigned int m_LSfrac
Definition: SiStripQualityHistory.cc:77
SiStripQualityHistory::m_run
const bool m_run
Definition: SiStripQualityHistory.cc:75
SiStripQualityHistory::m_maxLS
const unsigned int m_maxLS
Definition: SiStripQualityHistory.cc:76
RunHistogramManager::beginRun
void beginRun(const edm::Run &iRun)
Definition: RunHistogramManager.cc:101
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
SiStripQualityHistory::m_badmodrun
std::map< std::string, TProfile ** > m_badmodrun
Definition: SiStripQualityHistory.cc:80
SiStripQualityHistory::m_rhm
RunHistogramManager m_rhm
Definition: SiStripQualityHistory.cc:71
SiStripQualityHistory::_mode
const unsigned int _mode
Definition: SiStripQualityHistory.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:120
SiStripQualityHistory::Fiber
Definition: SiStripQualityHistory.cc:61
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
SiStripBadStrip::ContainerIterator
std::vector< unsigned int >::const_iterator ContainerIterator
Definition: SiStripBadStrip.h:52
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