CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 Member Functions

 SiStripQualityHistory (const edm::ParameterSet &)
 
 ~SiStripQualityHistory ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob () override
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
virtual void endJob () override
 

Private Attributes

std::map< std::string, TH1F * > _history
 
const unsigned int _mode
 
const std::vector
< edm::ParameterSet
_monitoredssq
 
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 &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 57 of file SiStripQualityHistory.cc.

Member Enumeration Documentation

anonymous enum

Constructor & Destructor Documentation

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

Definition at line 95 of file SiStripQualityHistory.cc.

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

95  :
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)),
103 {
104  //now do what ever initialization is needed
105 
107 
108  for(std::vector<edm::ParameterSet>::const_iterator ps=_monitoredssq.begin();ps!=_monitoredssq.end();++ps) {
109 
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) _history[name] = tfserv->make<TH1F>(name.c_str(),name.c_str(),10,0,10);
115 
116  char hrunname[400];
117  sprintf(hrunname,"badmodrun_%s",name.c_str());
118  char hruntitle[400];
119  sprintf(hruntitle,"Number of bad modules %s",name.c_str());
120  m_badmodrun[name] = m_rhm.makeTProfile(hrunname,hruntitle,m_LSfrac*m_maxLS,0,m_maxLS*262144);
121  }
122 
123 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
std::map< std::string, TH1F * > _history
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)
const unsigned int m_LSfrac
const unsigned int m_maxLS
std::map< std::string, TProfile ** > m_badmodrun
RunHistogramManager m_rhm
SiStripQualityHistory::~SiStripQualityHistory ( )

Definition at line 126 of file SiStripQualityHistory.cc.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 141 of file SiStripQualityHistory.cc.

References _mode, _monitoredssq, APV, data, Fiber, HcalObjRepresent::Fill(), edm::EventSetup::get(), diffTwoXMLs::label, LogDebug, m_badmodrun, Module, mergeVDriftHistosByStation::name, edm::EventBase::orbitNumber(), AlCaHLTBitMon_QueryRunRegistry::string, and Strip.

142 {
143  // edm::LogInfo("EventProcessing") << "event being processed";
144 
145  for(std::vector<edm::ParameterSet>::const_iterator ps=_monitoredssq.begin();ps!=_monitoredssq.end();++ps) {
146 
147  std::string name = ps->getParameter<std::string>("name");
148  std::string label = ps->getParameter<std::string>("ssqLabel");
149 
150 
151 
153  iSetup.get<SiStripQualityRcd>().get(label,ssq);
154 
155  std::vector<SiStripQuality::BadComponent> bads = ssq->getBadComponentList();
156 
157  LogDebug("BadComponents") << bads.size() << " bad components found";
158 
159  int nbad=0;
160 
161  if(_mode==Module || _mode==Fiber || _mode==APV) {
162  for(std::vector<SiStripQuality::BadComponent>::const_iterator bc=bads.begin();bc!=bads.end();++bc) {
163 
164  if(_mode==Module) {
165  if(bc->BadModule) ++nbad;
166  }
167  else if(_mode == Fiber) {
168  for(int fiber=1;fiber<5;fiber*=2) {
169  if((bc->BadFibers & fiber)>0) ++nbad;
170  }
171  }
172  else if(_mode ==APV) {
173  for(int apv=1;apv<33;apv*=2) {
174  if((bc->BadApvs & apv)>0) ++nbad;
175  }
176  }
177  }
178  }
179  else if(_mode==Strip) {
180  SiStripBadStrip::ContainerIterator dbegin = ssq->getDataVectorBegin();
181  SiStripBadStrip::ContainerIterator dend = ssq->getDataVectorEnd();
182  for(SiStripBadStrip::ContainerIterator data = dbegin; data < dend; ++data) {
183  nbad += ssq->decode(*data).range;
184  }
185 
186  }
187 
188  if(m_badmodrun.find(name)!=m_badmodrun.end() && m_badmodrun[name] && *m_badmodrun[name]) {
189  (*m_badmodrun[name])->Fill(iEvent.orbitNumber(),nbad);
190  }
191 
192  }
193 }
#define LogDebug(id)
std::vector< unsigned int >::const_iterator ContainerIterator
const std::vector< edm::ParameterSet > _monitoredssq
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
int orbitNumber() const
Definition: EventBase.h:63
const T & get() const
Definition: EventSetup.h:55
std::map< std::string, TProfile ** > m_badmodrun
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void SiStripQualityHistory::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 264 of file SiStripQualityHistory.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 196 of file SiStripQualityHistory.cc.

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

197 {
198 
199  m_rhm.beginRun(iRun);
200 
201  // loop on all the SiStripQuality objects to be monitored
202 
203  for(std::vector<edm::ParameterSet>::const_iterator ps=_monitoredssq.begin();ps!=_monitoredssq.end();++ps) {
204 
205  std::string name = ps->getParameter<std::string>("name");
206  std::string label = ps->getParameter<std::string>("ssqLabel");
207 
208  if(m_badmodrun.find(name)!=m_badmodrun.end()) {
209  if(m_badmodrun[name] && *m_badmodrun[name]) {
210  (*m_badmodrun[name])->SetBit(TH1::kCanRebin);
211  (*m_badmodrun[name])->GetXaxis()->SetTitle("time [Orb#]"); (*m_badmodrun[name])->GetYaxis()->SetTitle("bad components");
212  }
213  }
214 
215  if(m_run) {
216 
218  iSetup.get<SiStripQualityRcd>().get(label,ssq);
219 
220  std::vector<SiStripQuality::BadComponent> bads = ssq->getBadComponentList();
221 
222  LogDebug("BadComponents") << bads.size() << " bad components found";
223 
224  int nbad=0;
225 
226  if(_mode==Module || _mode==Fiber || _mode==APV) {
227  for(std::vector<SiStripQuality::BadComponent>::const_iterator bc=bads.begin();bc!=bads.end();++bc) {
228 
229  if(_mode==Module) {
230  if(bc->BadModule) ++nbad;
231  }
232  else if(_mode == Fiber) {
233  for(int fiber=1;fiber<5;fiber*=2) {
234  if((bc->BadFibers & fiber)>0) ++nbad;
235  }
236  }
237  else if(_mode ==APV) {
238  for(int apv=1;apv<33;apv*=2) {
239  if((bc->BadApvs & apv)>0) ++nbad;
240  }
241  }
242  }
243  }
244  else if(_mode==Strip) {
245  SiStripBadStrip::ContainerIterator dbegin = ssq->getDataVectorBegin();
246  SiStripBadStrip::ContainerIterator dend = ssq->getDataVectorEnd();
247  for(SiStripBadStrip::ContainerIterator data = dbegin; data < dend; ++data) {
248  nbad += ssq->decode(*data).range;
249  }
250  }
251 
252  // _history[name]->SetPoint(_history[name]->GetN(),iRun.run(),nbad);
253  char runname[100];
254  sprintf(runname,"%d",iRun.run());
255  LogDebug("AnalyzedRun") << name << " " << runname << " " << nbad;
256  _history[name]->Fill(runname,nbad);
257  }
258  }
259 
260 }
#define LogDebug(id)
RunNumber_t run() const
Definition: RunBase.h:42
std::vector< unsigned int >::const_iterator ContainerIterator
std::map< std::string, TH1F * > _history
const std::vector< edm::ParameterSet > _monitoredssq
const T & get() const
Definition: EventSetup.h:55
void beginRun(const edm::Run &iRun)
std::map< std::string, TProfile ** > m_badmodrun
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
RunHistogramManager m_rhm
void SiStripQualityHistory::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 269 of file SiStripQualityHistory.cc.

270 {
271  /*
272  for(std::vector<edm::ParameterSet>::const_iterator ps=_monitoredssq.begin();ps!=_monitoredssq.end();++ps) {
273 
274  std::string name = ps->getParameter<std::string>("name");
275  _history[name]->Write();
276 
277  }
278  */
279 }

Member Data Documentation

std::map<std::string,TH1F*> SiStripQualityHistory::_history
private
const unsigned int SiStripQualityHistory::_mode
private
const std::vector<edm::ParameterSet> SiStripQualityHistory::_monitoredssq
private

Definition at line 73 of file SiStripQualityHistory.cc.

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

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

Definition at line 80 of file SiStripQualityHistory.cc.

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

const unsigned int SiStripQualityHistory::m_LSfrac
private

Definition at line 77 of file SiStripQualityHistory.cc.

Referenced by SiStripQualityHistory().

const unsigned int SiStripQualityHistory::m_maxLS
private

Definition at line 76 of file SiStripQualityHistory.cc.

Referenced by SiStripQualityHistory().

RunHistogramManager SiStripQualityHistory::m_rhm
private

Definition at line 72 of file SiStripQualityHistory.cc.

Referenced by beginRun(), and SiStripQualityHistory().

const bool SiStripQualityHistory::m_run
private

Definition at line 75 of file SiStripQualityHistory.cc.

Referenced by beginRun(), and SiStripQualityHistory().