test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripBadModuleFedErrService Class Reference

#include <SiStripBadModuleFedErrService.h>

Inheritance diagram for SiStripBadModuleFedErrService:
SiStripDepCondObjBuilderBase< SiStripBadStrip, SiStripFedCabling >

Public Member Functions

virtual bool checkForCompatibility (std::string ss)
 Check is the transfer is needed. More...
 
void getMetaDataString (std::stringstream &ss)
 Used to fill the logDB. More...
 
void getObj (SiStripBadStrip *&obj, const SiStripFedCabling *cabling)
 
uint32_t getRunNumber () const
 
 SiStripBadModuleFedErrService (const edm::ParameterSet &, const edm::ActivityRegistry &)
 
 ~SiStripBadModuleFedErrService ()
 
- Public Member Functions inherited from SiStripDepCondObjBuilderBase< SiStripBadStrip, SiStripFedCabling >
virtual void initialize ()
 
 SiStripDepCondObjBuilderBase (const edm::ParameterSet &pset)
 
virtual ~SiStripDepCondObjBuilderBase ()
 

Private Member Functions

void getFedBadChannelList (MonitorElement *me, std::vector< std::pair< uint16_t, uint16_t >> &list)
 
float getProcessedEvents ()
 
bool openRequestedFile ()
 
SiStripBadStripreadBadComponentsFromFed (const SiStripFedCabling *cabling)
 

Private Attributes

DQMStoredqmStore_
 
edm::ParameterSet iConfig_
 
bool notAlreadyRead_
 

Additional Inherited Members

- Protected Attributes inherited from SiStripDepCondObjBuilderBase< SiStripBadStrip, SiStripFedCabling >
edm::ParameterSet _pset
 
SiStripBadStripobj_
 

Detailed Description

Definition at line 20 of file SiStripBadModuleFedErrService.h.

Constructor & Destructor Documentation

SiStripBadModuleFedErrService::SiStripBadModuleFedErrService ( const edm::ParameterSet iConfig,
const edm::ActivityRegistry aReg 
)
explicit

Definition at line 20 of file SiStripBadModuleFedErrService.cc.

20  :
22  iConfig_(iConfig)
23 {
24  edm::LogInfo("SiStripBadModuleFedErrService") << "[SiStripBadModuleFedErrService::SiStripBadModuleFedErrService]";
25 }
SiStripDepCondObjBuilderBase(const edm::ParameterSet &pset)
SiStripBadModuleFedErrService::~SiStripBadModuleFedErrService ( )

Definition at line 27 of file SiStripBadModuleFedErrService.cc.

28 {
29  edm::LogInfo("SiStripBadModuleFedErrService") << "[SiStripBadModuleFedErrService::~SiStripBadModuleFedErrService]";
30 }

Member Function Documentation

bool SiStripBadModuleFedErrService::checkForCompatibility ( std::string  ss)
virtual

Check is the transfer is needed.

Reimplemented from SiStripDepCondObjBuilderBase< SiStripBadStrip, SiStripFedCabling >.

Definition at line 38 of file SiStripBadModuleFedErrService.cc.

References getMetaDataString().

39 {
40  std::stringstream localString;
41  getMetaDataString(localString);
42  if( ss == localString.str() ) return false;
43 
44  return true;
45 }
void getMetaDataString(std::stringstream &ss)
Used to fill the logDB.
void SiStripBadModuleFedErrService::getFedBadChannelList ( MonitorElement me,
std::vector< std::pair< uint16_t, uint16_t >> &  list 
)
private

Definition at line 140 of file SiStripBadModuleFedErrService.cc.

References MonitorElement::DQM_KIND_TH2F, edm::ParameterSet::getParameter(), getProcessedEvents(), MonitorElement::getTH2F(), i, iConfig_, j, MonitorElement::kind(), and list().

Referenced by readBadComponentsFromFed().

140  {
141  float cutoff = iConfig_.getParameter<double>("BadStripCutoff");
142  if (me->kind() == MonitorElement::DQM_KIND_TH2F) {
143  TH2F* th2 = me->getTH2F();
144  float entries = getProcessedEvents();
145  if (!entries) entries = th2->GetBinContent(th2->GetMaximumBin());
146  for (uint16_t i = 1; i < th2->GetNbinsY()+1; i++) {
147  for (uint16_t j = 1; j < th2->GetNbinsX()+1; j++) {
148  if (th2->GetBinContent(j,i) > cutoff * entries) {
149  edm::LogInfo("SiStripBadModuleFedErrService") << " [SiStripBadModuleFedErrService::getFedBadChannelList] :: FedId & Channel " << th2->GetYaxis()->GetBinLowEdge(i) << " " << th2->GetXaxis()->GetBinLowEdge(j);
150  list.push_back(std::pair<uint16_t, uint16_t>(th2->GetYaxis()->GetBinLowEdge(i), th2->GetXaxis()->GetBinLowEdge(j)));
151  }
152  }
153  }
154  }
155 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
Kind kind(void) const
Get the type of the monitor element.
TH2F * getTH2F(void) const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
void SiStripBadModuleFedErrService::getMetaDataString ( std::stringstream &  ss)
virtual
void SiStripBadModuleFedErrService::getObj ( SiStripBadStrip *&  obj,
const SiStripFedCabling depObj 
)
inlinevirtual

Returns the CondObj

Reimplemented from SiStripDepCondObjBuilderBase< SiStripBadStrip, SiStripFedCabling >.

Definition at line 33 of file SiStripBadModuleFedErrService.h.

References readBadComponentsFromFed().

33 {obj = readBadComponentsFromFed(cabling);}
SiStripBadStrip * readBadComponentsFromFed(const SiStripFedCabling *cabling)
float SiStripBadModuleFedErrService::getProcessedEvents ( )
private

Definition at line 156 of file SiStripBadModuleFedErrService.cc.

References RefreshWebPage::dname, dqmStore_, MonitorElement::getEntries(), hlt_dqm_clientPB-live_cfg::me, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getFedBadChannelList().

156  {
157 
158  dqmStore_->cd();
159 
160  std::string dname = "SiStrip/ReadoutView";
161  std::string hpath = dname;
162  hpath += "/nTotalBadActiveChannels";
163  if (dqmStore_->dirExists(dname)) {
164  MonitorElement* me = dqmStore_->get(hpath);
165  if (me) return (me->getEntries());
166  }
167  return 0;
168 }
double getEntries(void) const
get # of entries
uint32_t SiStripBadModuleFedErrService::getRunNumber ( ) const

Definition at line 136 of file SiStripBadModuleFedErrService.cc.

References edm::ParameterSet::getParameter(), and iConfig_.

Referenced by getMetaDataString().

136  {
137  edm::LogInfo("SiStripBadModuleFedErrService") << "[SiStripBadModuleFedErrService::getRunNumber] " << iConfig_.getParameter<uint32_t>("RunNumber");
138  return iConfig_.getParameter<uint32_t>("RunNumber");
139 }
T getParameter(std::string const &) const
bool SiStripBadModuleFedErrService::openRequestedFile ( )
private

Definition at line 124 of file SiStripBadModuleFedErrService.cc.

References dqmStore_, MillePedeFileConverter_cfg::fileName, edm::ParameterSet::getParameter(), iConfig_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by readBadComponentsFromFed().

124  {
125 
127 
128  edm::LogInfo("SiStripBadModuleFedErrService") << "[SiStripBadModuleFedErrService::openRequestedFile] Accessing root File" << fileName;
129 
130  if (!dqmStore_->load(fileName, DQMStore::OpenRunDirs::StripRunDirs, true) ) {
131  edm::LogError("SiStripBadModuleFedErrService")<<"[SiStripBadModuleFedErrService::openRequestedFile] Requested file " << fileName << "Can not be opened!! ";
132  return false;
133  } else return true;
134 }
T getParameter(std::string const &) const
SiStripBadStrip * SiStripBadModuleFedErrService::readBadComponentsFromFed ( const SiStripFedCabling cabling)
private

Definition at line 47 of file SiStripBadModuleFedErrService.cc.

References FedChannelConnection::apvPairNumber(), SiStripQuality::cleanUp(), TauDecayModes::dec, FedChannelConnection::detId(), RefreshWebPage::dname, dqmStore_, SiStripBadStrip::encode(), SiStripFedCabling::fedConnection(), getFedBadChannelList(), edm::ParameterSet::getParameter(), iConfig_, hlt_dqm_clientPB-live_cfg::me, SiStripDepCondObjBuilderBase< SiStripBadStrip, SiStripFedCabling >::obj_, openRequestedFile(), cppFunctionSkipper::operator, SiStripBadStrip::put(), AlCaHarvesting_cff::SiStripQuality, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getObj().

47  {
48 
49 
51 
52  bool readFlag = iConfig_.getParameter<bool>("ReadFromFile");
54 
55 
56  if (readFlag && !openRequestedFile()) return obj_;
57 
58  dqmStore_->cd();
59 
60  std::string dname = "SiStrip/ReadoutView";
61  std::string hpath = dname;
62  hpath += "/FedIdVsApvId";
63  if (dqmStore_->dirExists(dname)) {
64  MonitorElement* me = dqmStore_->get(hpath);
65  if (me) {
66  std::vector<std::pair<uint16_t, uint16_t>> channelList;
67  getFedBadChannelList(me, channelList);
68  uint16_t fId_last = 9999;
69  uint16_t fChan_last = 9999;
70  std::map< uint32_t , std::set<int> > detectorMap;
71  for (std::vector<std::pair<uint16_t, uint16_t>>::iterator it = channelList.begin(); it != channelList.end(); it++) {
72  uint16_t fId = it->first;
73 
74  uint16_t fChan = it->second/2;
75  if (fId == fId_last && fChan == fChan_last) continue;
76 
77  FedChannelConnection channel = cabling->fedConnection(fId, fChan);
78  const uint32_t detId = channel.detId();
79  const uint16_t ipair = channel.apvPairNumber();
80  detectorMap[detId].insert(ipair);
81  }
82  for (std::map< uint32_t , std::set<int> >::iterator im = detectorMap.begin(); im != detectorMap.end(); im++) {
83  const uint32_t detId = im->first;
84  std::set<int> pairs = im->second;
85  SiStripQuality::InputVector theSiStripVector;
86  unsigned short firstBadStrip = 0;
87  unsigned short fNconsecutiveBadStrips = 0;
88  unsigned int theBadStripRange;
89  int last_pair = -1;
90  for (std::set<int>::iterator ip = pairs.begin(); ip != pairs.end(); ip++) {
91  if (last_pair == -1) {
92  firstBadStrip = (*ip) * 128 * 2;
93  fNconsecutiveBadStrips = 128*2;
94  } else if ((*ip) - last_pair > 1) {
95  theBadStripRange = obj_->encode(firstBadStrip,fNconsecutiveBadStrips);
96  theSiStripVector.push_back(theBadStripRange);
97  firstBadStrip = (*ip) * 128 * 2;
98  fNconsecutiveBadStrips = 128*2;
99  } else {
100  fNconsecutiveBadStrips += 128*2;
101  }
102  last_pair = (*ip);
103  }
104  theBadStripRange = obj_->encode(firstBadStrip,fNconsecutiveBadStrips);
105  theSiStripVector.push_back(theBadStripRange);
106 
107  edm::LogInfo("SiStripBadModuleFedErrService") << " SiStripBadModuleFedErrService::readBadComponentsFromFed "
108  << " detid " << detId
109  << " firstBadStrip " << firstBadStrip
110  << " NconsecutiveBadStrips " << fNconsecutiveBadStrips
111  << " packed integer " << std::hex << theBadStripRange << std::dec;
112  SiStripBadStrip::Range range(theSiStripVector.begin(),theSiStripVector.end());
113  if ( !obj_->put(detId,range) ) {
114  edm::LogError("SiStripBadModuleFedErrService")<<"[SiStripBadModuleFedErrService::readBadComponentsFromFed] detid already exists"<<std::endl;
115  }
116  }
117  obj_->cleanUp();
118  }
119  }
120  return obj_;
121 }
T getParameter(std::string const &) const
FedChannelConnection fedConnection(uint16_t fed_id, uint16_t fed_ch) const
uint16_t apvPairNumber() const
const uint32_t & detId() const
Class containning control, module, detector and connection information, at the level of a FED channel...
void getFedBadChannelList(MonitorElement *me, std::vector< std::pair< uint16_t, uint16_t >> &list)
std::pair< ContainerIterator, ContainerIterator > Range
bool put(const uint32_t &detID, const InputVector &vect)
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
Container InputVector

Member Data Documentation

DQMStore* SiStripBadModuleFedErrService::dqmStore_
private
edm::ParameterSet SiStripBadModuleFedErrService::iConfig_
private
bool SiStripBadModuleFedErrService::notAlreadyRead_
private

Definition at line 47 of file SiStripBadModuleFedErrService.h.