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
SiStripBadModuleFedErrESSource Class Reference
Inheritance diagram for SiStripBadModuleFedErrESSource:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Types

typedef std::shared_ptr
< SiStripBadStrip
ReturnType
 
- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair
< DataKey,
edm::propagate_const
< std::shared_ptr< DataProxy > > > > 
KeyedProxies
 
typedef std::vector
< EventSetupRecordKey
Keys
 
typedef std::map
< EventSetupRecordKey,
KeyedProxies
RecordProxies
 

Public Member Functions

ReturnType produce (const SiStripBadModuleFedErrRcd &)
 
void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity)
 
 SiStripBadModuleFedErrESSource (const edm::ParameterSet &)
 
 ~SiStripBadModuleFedErrESSource ()
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()(false)
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer () noexcept(false)
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
const
eventsetup::ComponentDescription
descriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
std::set
< eventsetup::EventSetupRecordKey
findingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder () noexcept(false)
 

Private Member Functions

std::vector< std::pair
< uint16_t, uint16_t > > 
getFedBadChannelList (DQMStore *dqmStore, const MonitorElement *me) const
 
float getProcessedEvents (DQMStore *dqmStore) const
 

Private Attributes

float m_cutoff
 
std::string m_fileName
 
bool m_readFlag
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
virtual void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList)
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 
- Protected Member Functions inherited from edm::EventSetupRecordIntervalFinder
template<class T >
void findingRecord ()
 
void findingRecordWithKey (const eventsetup::EventSetupRecordKey &)
 

Detailed Description

Description: SiStripBadStrip ESProducer from FED errors

A new SiStrip fake source has been added to create Bad Components from the list of Fed detected errors. This is done using a histogram from DQM output where FedId vs APVId is plotted for detected channels.

Implementation:

Original author: Suchandra Dutta Sucha.nosp@m.ndra.nosp@m..Dutt.nosp@m.a@ce.nosp@m.rn.ch

Port to edm::ESProducer: Pieter David Piete.nosp@m.r.Da.nosp@m.vid@c.nosp@m.ern..nosp@m.ch, summer 2016

Definition at line 43 of file SiStripBadModuleFedErrESSource.cc.

Member Typedef Documentation

Definition at line 50 of file SiStripBadModuleFedErrESSource.cc.

Constructor & Destructor Documentation

SiStripBadModuleFedErrESSource::SiStripBadModuleFedErrESSource ( const edm::ParameterSet iConfig)

Definition at line 70 of file SiStripBadModuleFedErrESSource.cc.

References edm::ParameterSet::getParameter(), m_cutoff, m_fileName, m_readFlag, edm::ESProducer::setWhatProduced(), and AlCaHLTBitMon_QueryRunRegistry::string.

71 {
72  setWhatProduced(this);
73  findingRecord<SiStripBadModuleFedErrRcd>();
74 
75  m_readFlag = iConfig.getParameter<bool>("ReadFromFile");
76  m_fileName = iConfig.getParameter<std::string>("FileName");
77  m_cutoff = iConfig.getParameter<double>("BadStripCutoff");
78 }
T getParameter(std::string const &) const
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
SiStripBadModuleFedErrESSource::~SiStripBadModuleFedErrESSource ( )

Definition at line 80 of file SiStripBadModuleFedErrESSource.cc.

80 {}

Member Function Documentation

std::vector< std::pair< uint16_t, uint16_t > > SiStripBadModuleFedErrESSource::getFedBadChannelList ( DQMStore dqmStore,
const MonitorElement me 
) const
private

Definition at line 100 of file SiStripBadModuleFedErrESSource.cc.

References MonitorElement::DQM_KIND_TH2F, getProcessedEvents(), MonitorElement::getTH2F(), i, j, MonitorElement::kind(), m_cutoff, and runTheMatrix::ret.

Referenced by produce().

101 {
102  std::vector<std::pair<uint16_t,uint16_t>> ret;
103  if (me->kind() == MonitorElement::DQM_KIND_TH2F) {
104  TH2F* th2 = me->getTH2F();
105  float entries = getProcessedEvents(dqmStore);
106  if ( ! entries ) entries = th2->GetBinContent(th2->GetMaximumBin());
107  for ( uint16_t i = 1; i < th2->GetNbinsY()+1; ++i ) {
108  for ( uint16_t j = 1; j < th2->GetNbinsX()+1; ++j ) {
109  if ( th2->GetBinContent(j,i) > m_cutoff * entries ) {
110  edm::LogInfo("SiStripBadModuleFedErrService") << " [SiStripBadModuleFedErrService::getFedBadChannelList] :: FedId & Channel " << th2->GetYaxis()->GetBinLowEdge(i) << " " << th2->GetXaxis()->GetBinLowEdge(j);
111  ret.push_back(std::pair<uint16_t, uint16_t>(th2->GetYaxis()->GetBinLowEdge(i), th2->GetXaxis()->GetBinLowEdge(j)));
112  }
113  }
114  }
115  }
116  return ret;
117 }
int i
Definition: DBlmapReader.cc:9
tuple ret
prodAgent to be discontinued
int j
Definition: DBlmapReader.cc:9
Kind kind(void) const
Get the type of the monitor element.
float getProcessedEvents(DQMStore *dqmStore) const
TH2F * getTH2F(void) const
float SiStripBadModuleFedErrESSource::getProcessedEvents ( DQMStore dqmStore) const
private

Definition at line 87 of file SiStripBadModuleFedErrESSource.cc.

References DQMStore::cd(), DQMStore::dirExists(), RefreshWebPage::dname, DQMStore::get(), MonitorElement::getEntries(), hlt_dqm_clientPB-live_cfg::me, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getFedBadChannelList().

88 {
89  dqmStore->cd();
90 
91  const std::string dname{"SiStrip/ReadoutView"};
92  const std::string hpath{dname+"/nTotalBadActiveChannels"};
93  if ( dqmStore->dirExists(dname) ) {
94  MonitorElement* me = dqmStore->get(hpath);
95  if (me) return me->getEntries();
96  }
97  return 0;
98 }
double getEntries(void) const
get # of entries
SiStripBadModuleFedErrESSource::ReturnType SiStripBadModuleFedErrESSource::produce ( const SiStripBadModuleFedErrRcd iRecord)

Definition at line 121 of file SiStripBadModuleFedErrESSource.cc.

References FedChannelConnection::apvPairNumber(), TauDecayModes::dec, FedChannelConnection::detId(), RefreshWebPage::dname, AlcaSiStripGainsAfterAbortGapHarvester_cff::DQMStore, getFedBadChannelList(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), m_fileName, m_readFlag, hlt_dqm_clientPB-live_cfg::me, cppFunctionSkipper::operator, TrackCollections2monitor_cff::quality, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

122 {
123  using namespace edm::es;
124 
126  iRecord.getRecord<SiStripFedCablingRcd>().get(cabling);
127 
128  std::shared_ptr<SiStripQuality> quality{new SiStripQuality};
129 
130  DQMStore* dqmStore = edm::Service<DQMStore>().operator->();
131  if ( m_readFlag ) { // open requested file
132  edm::LogInfo("SiStripBadModuleFedErrService") << "[SiStripBadModuleFedErrService::openRequestedFile] Accessing root File" << m_fileName;
133  if ( ! dqmStore->load(m_fileName, DQMStore::OpenRunDirs::StripRunDirs, true) ) {
134  edm::LogError("SiStripBadModuleFedErrService")<<"[SiStripBadModuleFedErrService::openRequestedFile] Requested file " << m_fileName << "Can not be opened!! ";
135  return quality;
136  }
137  }
138 
139  dqmStore->cd();
140 
141  const std::string dname{"SiStrip/ReadoutView"};
142  const std::string hpath{dname + "/FedIdVsApvId"};
143  if ( dqmStore->dirExists(dname) ) {
144  MonitorElement* me = dqmStore->get(hpath);
145  if ( me ) {
146  std::map<uint32_t, std::set<int>> detectorMap;
147  for ( const auto& elm : getFedBadChannelList(dqmStore, me) ) {
148  const uint16_t fId = elm.first;
149  const uint16_t fChan = elm.second/2;
150  if ( ( fId == 9999 ) && ( fChan == 9999 ) ) continue;
151 
152  FedChannelConnection channel = cabling->fedConnection(fId, fChan);
153  detectorMap[channel.detId()].insert(channel.apvPairNumber());
154  }
155 
156  for ( const auto& detElm : detectorMap ) { // pair(detId, pairs)
157  SiStripQuality::InputVector theSiStripVector;
158  unsigned short firstBadStrip{0};
159  unsigned short fNconsecutiveBadStrips{0};
160  int last_pair = -1;
161  for ( const auto pair : detElm.second ) {
162  if ( last_pair == -1 ) {
163  firstBadStrip = pair * 128*2;
164  fNconsecutiveBadStrips = 128*2;
165  } else if ( pair - last_pair > 1 ) {
166  theSiStripVector.push_back(quality->encode(firstBadStrip, fNconsecutiveBadStrips));
167  firstBadStrip = pair * 128*2;
168  fNconsecutiveBadStrips = 128*2;
169  } else {
170  fNconsecutiveBadStrips += 128*2;
171  }
172  last_pair = pair;
173  }
174  unsigned int theBadStripRange = quality->encode(firstBadStrip, fNconsecutiveBadStrips);
175  theSiStripVector.push_back(theBadStripRange);
176 
177  edm::LogInfo("SiStripBadModuleFedErrService")
178  << " SiStripBadModuleFedErrService::readBadComponentsFromFed "
179  << " detid " << detElm.first
180  << " firstBadStrip " << firstBadStrip
181  << " NconsecutiveBadStrips " << fNconsecutiveBadStrips
182  << " packed integer " << std::hex << theBadStripRange << std::dec;
183 
184  if ( ! quality->put(detElm.first, SiStripBadStrip::Range{theSiStripVector.begin(), theSiStripVector.end()}) ) {
185  edm::LogError("SiStripBadModuleFedErrService") << "[SiStripBadModuleFedErrService::readBadComponentsFromFed] detid already exists";
186  }
187  }
188  quality->cleanUp();
189  }
190  }
191 
192  return quality;
193 }
uint16_t apvPairNumber() const
tuple quality
[pTError/pT]*max(1,normChi2) &lt;= ptErrorCut
const uint32_t & detId() const
Class containning control, module, detector and connection information, at the level of a FED channel...
std::vector< std::pair< uint16_t, uint16_t > > getFedBadChannelList(DQMStore *dqmStore, const MonitorElement *me) const
std::pair< ContainerIterator, ContainerIterator > Range
Container InputVector
void SiStripBadModuleFedErrESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue iov,
edm::ValidityInterval iValidity 
)
virtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 82 of file SiStripBadModuleFedErrESSource.cc.

References edm::IOVSyncValue::beginOfTime(), and edm::IOVSyncValue::endOfTime().

83 {
84  iValidity = edm::ValidityInterval{iov.beginOfTime(), iov.endOfTime()};
85 }
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
static const IOVSyncValue & beginOfTime()

Member Data Documentation

float SiStripBadModuleFedErrESSource::m_cutoff
private
std::string SiStripBadModuleFedErrESSource::m_fileName
private

Definition at line 55 of file SiStripBadModuleFedErrESSource.cc.

Referenced by produce(), and SiStripBadModuleFedErrESSource().

bool SiStripBadModuleFedErrESSource::m_readFlag
private

Definition at line 54 of file SiStripBadModuleFedErrESSource.cc.

Referenced by produce(), and SiStripBadModuleFedErrESSource().