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
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 Member Functions

 SiPixelQualityHistory (const edm::ParameterSet &)
 
 ~SiPixelQualityHistory ()
 
- 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
 
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,
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
 

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 58 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 m_badmodrun, m_history, m_LSfrac, m_maxLS, m_monitoredspq, m_rhm, m_run, TFileService::make(), RunHistogramManager::makeTProfile(), mergeVDriftHistosByStation::name, and AlCaHLTBitMon_QueryRunRegistry::string.

96  :
97  m_rhm(),
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)),
104 {
105  //now do what ever initialization is needed
106 
108 
109  for(std::vector<edm::ParameterSet>::const_iterator ps=m_monitoredspq.begin();ps!=m_monitoredspq.end();++ps) {
110 
111  std::string name = ps->getParameter<std::string>("name");
112 
113  if(m_run) m_history[name] = tfserv->make<TH1F>(name.c_str(),name.c_str(),10,0,10);
114 
115  char hrunname[400];
116  sprintf(hrunname,"badmodrun_%s",name.c_str());
117  char hruntitle[400];
118  sprintf(hruntitle,"Number of bad modules %s",name.c_str());
119  m_badmodrun[name] = m_rhm.makeTProfile(hrunname,hruntitle,m_LSfrac*m_maxLS,0,m_maxLS*262144);
120  }
121 
122 }
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 * > m_history
RunHistogramManager m_rhm
TProfile ** makeTProfile(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
std::map< std::string, TProfile ** > m_badmodrun
const std::vector< edm::ParameterSet > m_monitoredspq
const unsigned int m_LSfrac
const unsigned int m_maxLS
SiPixelQualityHistory::~SiPixelQualityHistory ( )

Definition at line 125 of file SiPixelQualityHistory.cc.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 140 of file SiPixelQualityHistory.cc.

References HcalObjRepresent::Fill(), edm::EventSetup::get(), diffTwoXMLs::label, LogDebug, m_badmodrun, m_mode, m_monitoredspq, Module, mergeVDriftHistosByStation::name, edm::EventBase::orbitNumber(), ROC, AlCaHLTBitMon_QueryRunRegistry::string, and Summary.

141 {
142  // edm::LogInfo("EventProcessing") << "event being processed";
143 
144  for(std::vector<edm::ParameterSet>::const_iterator ps=m_monitoredspq.begin();ps!=m_monitoredspq.end();++ps) {
145 
146  std::string name = ps->getParameter<std::string>("name");
147  std::string label = ps->getParameter<std::string>("spqLabel");
148 
149 
150 
152  iSetup.get<SiPixelQualityRcd>().get(label,spq);
153 
154  int nbad=0;
155 
156  if(m_mode==Summary) {
157 
158  // nbad = spq->BadModuleNumber();
159 
160  }
161  else {
162 
163  std::vector<SiPixelQuality::disabledModuleType> bads = spq->getBadComponentList();
164 
165  LogDebug("BadComponents") << bads.size() << " bad components found";
166 
167  for(std::vector<SiPixelQuality::disabledModuleType>::const_iterator bc=bads.begin();bc!=bads.end();++bc) {
168 
169  if(m_mode==Module) {
170  if(spq->IsModuleBad(bc->DetID)) ++nbad;
171  // if(bc->errorType==0) ++nbad;
172  }
173  else if(m_mode == ROC) {
174  for(int roc=1;roc<2*2*2*2*2*2*2+1;roc*=2) {
175  if((bc->BadRocs & roc)>0) ++nbad;
176  }
177  }
178  }
179  }
180  if(m_badmodrun.find(name)!=m_badmodrun.end() && m_badmodrun[name] && *m_badmodrun[name]) {
181  (*m_badmodrun[name])->Fill(iEvent.orbitNumber(),nbad);
182  }
183 
184  }
185 }
#define LogDebug(id)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::map< std::string, TProfile ** > m_badmodrun
const std::vector< edm::ParameterSet > m_monitoredspq
int orbitNumber() const
Definition: EventBase.h:63
const T & get() const
Definition: EventSetup.h:55
void SiPixelQualityHistory::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 249 of file SiPixelQualityHistory.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 188 of file SiPixelQualityHistory.cc.

References RunHistogramManager::beginRun(), edm::EventSetup::get(), diffTwoXMLs::label, LogDebug, m_badmodrun, m_history, m_mode, m_monitoredspq, m_rhm, m_run, Module, mergeVDriftHistosByStation::name, ROC, edm::RunBase::run(), AlCaHLTBitMon_QueryRunRegistry::string, and Summary.

189 {
190 
191  m_rhm.beginRun(iRun);
192 
193  // loop on all the SiPixelQuality objects to be monitored
194 
195  for(std::vector<edm::ParameterSet>::const_iterator ps=m_monitoredspq.begin();ps!=m_monitoredspq.end();++ps) {
196 
197  std::string name = ps->getParameter<std::string>("name");
198  std::string label = ps->getParameter<std::string>("spqLabel");
199 
200  if(m_badmodrun.find(name)!=m_badmodrun.end()) {
201  if(m_badmodrun[name] && *m_badmodrun[name]) {
202  (*m_badmodrun[name])->SetBit(TH1::kCanRebin);
203  (*m_badmodrun[name])->GetXaxis()->SetTitle("time [Orb#]"); (*m_badmodrun[name])->GetYaxis()->SetTitle("bad components");
204  }
205  }
206 
207  if(m_run) {
208 
210  iSetup.get<SiPixelQualityRcd>().get(label,spq);
211 
212  int nbad=0;
213 
214  if(m_mode==Summary) {
215 
216  // nbad = spq->BadModuleNumber();
217 
218  }
219  else {
220 
221  std::vector<SiPixelQuality::disabledModuleType> bads = spq->getBadComponentList();
222 
223  LogDebug("BadComponents") << bads.size() << " bad components found";
224 
225  for(std::vector<SiPixelQuality::disabledModuleType>::const_iterator bc=bads.begin();bc!=bads.end();++bc) {
226 
227  if(m_mode==Module) {
228  if(spq->IsModuleBad(bc->DetID)) ++nbad;
229  // if(bc->errorType==0) ++nbad;
230  }
231  else if(m_mode == ROC) {
232  for(int roc=1;roc<2*2*2*2*2*2*2+1;roc*=2) {
233  if((bc->BadRocs & roc)>0) ++nbad;
234  }
235  }
236  }
237  }
238  char runname[100];
239  sprintf(runname,"%d",iRun.run());
240  LogDebug("AnalyzedRun") << name << " " << runname << " " << nbad;
241  m_history[name]->Fill(runname,nbad);
242  }
243  }
244 
245 }
#define LogDebug(id)
RunNumber_t run() const
Definition: RunBase.h:42
std::map< std::string, TH1F * > m_history
RunHistogramManager m_rhm
std::map< std::string, TProfile ** > m_badmodrun
const std::vector< edm::ParameterSet > m_monitoredspq
const T & get() const
Definition: EventSetup.h:55
void beginRun(const edm::Run &iRun)
void SiPixelQualityHistory::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 254 of file SiPixelQualityHistory.cc.

255 {
256  /*
257  for(std::vector<edm::ParameterSet>::const_iterator ps=m_monitoredspq.begin();ps!=m_monitoredspq.end();++ps) {
258 
259  std::string name = ps->getParameter<std::string>("name");
260  m_history[name]->Write();
261 
262  }
263  */
264 }

Member Data Documentation

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

Definition at line 81 of file SiPixelQualityHistory.cc.

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

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

Definition at line 80 of file SiPixelQualityHistory.cc.

Referenced by beginRun(), and SiPixelQualityHistory().

const unsigned int SiPixelQualityHistory::m_LSfrac
private

Definition at line 78 of file SiPixelQualityHistory.cc.

Referenced by SiPixelQualityHistory().

const unsigned int SiPixelQualityHistory::m_maxLS
private

Definition at line 77 of file SiPixelQualityHistory.cc.

Referenced by SiPixelQualityHistory().

const unsigned int SiPixelQualityHistory::m_mode
private

Definition at line 75 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 analyze(), beginRun(), and 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 76 of file SiPixelQualityHistory.cc.

Referenced by beginRun(), and SiPixelQualityHistory().