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
SiStripFEDErrorsDQM Class Reference

#include <SiStripFEDErrorsDQM.h>

Inheritance diagram for SiStripFEDErrorsDQM:
edm::EDAnalyzer SiStripBaseServiceFromDQM< SiStripBadStrip > edm::EDConsumerBase SiStripCondObjBuilderBase< SiStripBadStrip >

Public Member Functions

 SiStripFEDErrorsDQM (const edm::ParameterSet &iConfig)
 
 ~SiStripFEDErrorsDQM ()
 
- 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 
- Public Member Functions inherited from SiStripBaseServiceFromDQM< SiStripBadStrip >
virtual bool checkForCompatibility (std::string ss)
 Check is the transfer is needed. More...
 
virtual void getMetaDataString (std::stringstream &ss)
 Used to fill the logDB. More...
 
 SiStripBaseServiceFromDQM (const edm::ParameterSet &)
 
virtual ~SiStripBaseServiceFromDQM ()
 
- Public Member Functions inherited from SiStripCondObjBuilderBase< SiStripBadStrip >
virtual void getObj (SiStripBadStrip *&obj)
 
virtual void initialize ()
 
 SiStripCondObjBuilderBase (const edm::ParameterSet &pset)
 
virtual ~SiStripCondObjBuilderBase ()
 

Private Member Functions

void addBadAPV (const FedChannelConnection &aConnection, const unsigned short aAPVNumber, const unsigned short aFlag, unsigned int &aCounter)
 
void addBadStrips (const FedChannelConnection &aConnection, const unsigned int aDetId, const unsigned short aApvNum, const unsigned short aFlag, unsigned int &aCounter)
 
void addErrors ()
 Writes the errors to the db. More...
 
virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 
bool readBadAPVs ()
 
void readHistogram (MonitorElement *aMe, unsigned int &aCounter, const float aNorm, const unsigned int aFedId)
 
void setFlagBit (unsigned short &aFlag, const unsigned short aBit)
 
void updateCabling (const edm::EventSetup &eventSetup)
 

Private Attributes

const SiStripFedCablingcabling_
 
uint32_t cablingCacheId_
 
unsigned int debug_
 
std::map< uint32_t,
std::vector< unsigned int > > 
detIdErrors_
 
edm::FileInPath fp_
 
edm::ParameterSet iConfig_
 
double threshold_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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)
 
- Protected Member Functions inherited from SiStripBaseServiceFromDQM< SiStripBadStrip >
void getModuleFolderList (std::vector< std::string > &mfolders)
 Fill the mfolders vector with the full list of directories for all the modules. More...
 
MonitorElementgetModuleHistogram (const uint32_t detId, const std::string &name)
 
uint32_t getRunNumber () const
 Returns the run number from the cfg. More...
 
bool goToDir (const std::string &name)
 Uses DQM utilities to access the requested dir. More...
 
void openRequestedFile ()
 Uses DQMStore to access the DQM file. More...
 
- Protected Attributes inherited from SiStripBaseServiceFromDQM< SiStripBadStrip >
DQMStoredqmStore_
 
boost::shared_ptr
< SiStripFolderOrganizer
folderOrganizer_
 
edm::ParameterSet iConfig_
 
- Protected Attributes inherited from SiStripCondObjBuilderBase< SiStripBadStrip >
edm::ParameterSet _pset
 
SiStripBadStripobj_
 

Detailed Description

Author
A.-M. Magnan, M. De Mattia to read modules flagged by the DQM due to FED errors as bad and write in the database with the proper error flag.

Definition at line 37 of file SiStripFEDErrorsDQM.h.

Constructor & Destructor Documentation

SiStripFEDErrorsDQM::SiStripFEDErrorsDQM ( const edm::ParameterSet iConfig)

Definition at line 8 of file SiStripFEDErrorsDQM.cc.

References SiStripCondObjBuilderBase< SiStripBadStrip >::obj_.

8  :
10  iConfig_(iConfig),
11  fp_(iConfig.getUntrackedParameter<edm::FileInPath>("file",edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"))),
12  cablingCacheId_(0),
13  threshold_(iConfig.getUntrackedParameter<double>("Threshold",0)),
14  debug_(iConfig.getUntrackedParameter<unsigned int>("Debug",0))
15 {
16  obj_ = 0;
17  edm::LogInfo("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::SiStripFEDErrorsDQM()]";
18 }
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet iConfig_
SiStripBaseServiceFromDQM(const edm::ParameterSet &)
SiStripFEDErrorsDQM::~SiStripFEDErrorsDQM ( )

Definition at line 20 of file SiStripFEDErrorsDQM.cc.

20  {
21  edm::LogInfo("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::~SiStripFEDErrorsDQM]";
22 }

Member Function Documentation

void SiStripFEDErrorsDQM::addBadAPV ( const FedChannelConnection aConnection,
const unsigned short  aAPVNumber,
const unsigned short  aFlag,
unsigned int &  aCounter 
)
private

Definition at line 338 of file SiStripFEDErrorsDQM.cc.

References addBadStrips(), FedChannelConnection::apvPairNumber(), FedChannelConnection::detId(), sistrip::invalid32_, and FedChannelConnection::isConnected().

Referenced by readHistogram().

342 {
343  if (!aConnection.isConnected()) {
344  edm::LogWarning("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::addBadAPV] Warning, incompatible cabling ! Channel is not connected, but entry found in histo ... " << std::endl;
345  return;
346  }
347  unsigned int lDetid = aConnection.detId();
348  if (!lDetid || lDetid == sistrip::invalid32_) {
349  edm::LogWarning("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::addBadAPV] Warning, DetId is invalid: " << lDetid << std::endl;
350  return;
351  }
352  //unsigned short nChInModule = aConnection.nApvPairs();
353  unsigned short lApvNum = 0;
354  if (aAPVNumber < 2) {
355  lApvNum = 2*aConnection.apvPairNumber();
356  addBadStrips(aConnection,lDetid,lApvNum,aFlag,aCounter);
357  }
358  if (aAPVNumber == 0 || aAPVNumber == 2) {
359  lApvNum = 2*aConnection.apvPairNumber()+1;
360  addBadStrips(aConnection,lDetid,lApvNum,aFlag,aCounter);
361  }
362 }
static const uint32_t invalid32_
Definition: Constants.h:15
uint16_t apvPairNumber() const
const uint32_t & detId() const
void addBadStrips(const FedChannelConnection &aConnection, const unsigned int aDetId, const unsigned short aApvNum, const unsigned short aFlag, unsigned int &aCounter)
void SiStripFEDErrorsDQM::addBadStrips ( const FedChannelConnection aConnection,
const unsigned int  aDetId,
const unsigned short  aApvNum,
const unsigned short  aFlag,
unsigned int &  aCounter 
)
private

Definition at line 365 of file SiStripFEDErrorsDQM.cc.

References detIdErrors_, SiStripBadStrip::encode(), FedChannelConnection::fedCh(), FedChannelConnection::fedId(), LogTrace, and SiStripCondObjBuilderBase< SiStripBadStrip >::obj_.

Referenced by addBadAPV().

370 {
371  // std::vector<unsigned int> lStripVector;
372  unsigned int lBadStripRange;
373  unsigned short lFirstBadStrip=aApvNum*128;
374  unsigned short lConsecutiveBadStrips=128;
375 
376  lBadStripRange = obj_->encode(lFirstBadStrip,lConsecutiveBadStrips,aFlag);
377 
378  LogTrace("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::addBadStrips] ---- Adding : detid " << aDetId
379  << " (FED " << aConnection.fedId()
380  << ", Ch " << aConnection.fedCh () << ")"
381  << ", APV " << aApvNum
382  << ", flag " << aFlag
383  << std::endl;
384 
385  detIdErrors_[aDetId].push_back(lBadStripRange);
386 
387  // lStripVector.push_back(lBadStripRange);
388  // SiStripBadStrip::Range lRange(lStripVector.begin(),lStripVector.end());
389  // if ( !obj_->put(aDetId,lRange) ) {
390  // edm::LogError("SiStripFEDErrorsDQM")<<"[SiStripFEDErrorsDQM::addBadStrips] detid already exists." << std::endl;
391  // }
392 
393  aCounter++;
394 }
std::map< uint32_t, std::vector< unsigned int > > detIdErrors_
const uint16_t & fedCh() const
const uint16_t & fedId() const
#define LogTrace(id)
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
void SiStripFEDErrorsDQM::addErrors ( )
private

Writes the errors to the db.

Definition at line 396 of file SiStripFEDErrorsDQM.cc.

References SiStripBadStrip::decode(), detIdErrors_, SiStripBadStrip::encode(), SiStripBadStrip::data::firstStrip, SiStripBadStrip::data::flag, python.multivaluedict::map(), SiStripCondObjBuilderBase< SiStripBadStrip >::obj_, SiStripBadStrip::put(), and setFlagBit().

Referenced by readBadAPVs().

397 {
398  for( std::map<uint32_t, std::vector<uint32_t> >::const_iterator it = detIdErrors_.begin(); it != detIdErrors_.end(); ++it )
399  {
400 
401  std::vector<uint32_t> lList = it->second;
402 
403  //map of first strip number and flag
404  //purpose is to encode all existing flags into a unique one...
405  std::map<unsigned short,unsigned short> lAPVMap;
406  lAPVMap.clear();
407 
408  for (uint32_t iCh(0); iCh<lList.size(); iCh++) {
409  SiStripBadStrip::data lData = obj_->decode(lList.at(iCh));
410  unsigned short lFlag = 0;
411  setFlagBit(lFlag,lData.flag);
412 
413  //std::cout << " -- Detid " << it->first << ", strip " << lData.firstStrip << ", flag " << lData.flag << std::endl;
414 
415  std::pair<std::map<unsigned short,unsigned short>::iterator,bool> lInsert = lAPVMap.insert(std::pair<unsigned short,unsigned short>(lData.firstStrip,lFlag));
416  if (!lInsert.second) {
417  //std::cout << " ---- Adding bit : " << lData.flag << " to " << lInsert.first->second << ": ";
418  setFlagBit(lInsert.first->second,lData.flag);
419  //std::cout << lInsert.first->second << std::endl;
420  }
421  }
422 
423  //encode the new flag
424  std::vector<unsigned int> lStripVector;
425  unsigned short lConsecutiveBadStrips=128;
426 
427  for (std::map<unsigned short,unsigned short>::iterator lIter = lAPVMap.begin();
428  lIter != lAPVMap.end();
429  lIter++)
430  {
431  lStripVector.push_back(obj_->encode(lIter->first,lConsecutiveBadStrips,lIter->second));
432  }
433 
434  SiStripBadStrip::Range lRange(lStripVector.begin(),lStripVector.end());
435  if ( !obj_->put(it->first,lRange) ) {
436  edm::LogError("SiStripFEDErrorsDQM")<<"[SiStripFEDErrorsDQM::addBadStrips] detid already exists." << std::endl;
437  }
438  }
439 }
std::map< uint32_t, std::vector< unsigned int > > detIdErrors_
void setFlagBit(unsigned short &aFlag, const unsigned short aBit)
unsigned short firstStrip
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)
data decode(const unsigned int &value) const
void SiStripFEDErrorsDQM::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 25 of file SiStripFEDErrorsDQM.cc.

References cond::service::PoolDBOutputService::appendSinceTime(), cond::service::PoolDBOutputService::beginOfTime(), cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::currentTime(), cond::service::PoolDBOutputService::endOfTime(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), SiStripCondObjBuilderBase< SiStripBadStrip >::obj_, readBadAPVs(), and updateCabling().

26 {
27  //update cabling
28  updateCabling(iSetup);
29 
30  if (readBadAPVs())
31  {
32  // Save the parameters to the db.
34  if( mydbservice.isAvailable() ){
35  if( mydbservice->isNewTagRequest("SiStripBadStripRcd") ){
36  mydbservice->createNewIOV<SiStripBadStrip>(obj_, mydbservice->beginOfTime(),mydbservice->endOfTime(),"SiStripBadStripRcd");
37  } else {
38  mydbservice->appendSinceTime<SiStripBadStrip>(obj_, mydbservice->currentTime(),"SiStripBadStripRcd");
39  }
40  } else {
41  edm::LogError("SiStripFEDErrorsDQM")<<"Service is unavailable"<<std::endl;
42  }
43  }
44 
45 }
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:46
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
void updateCabling(const edm::EventSetup &eventSetup)
void SiStripFEDErrorsDQM::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 49 of file SiStripFEDErrorsDQM.cc.

50 {
51 }
void SiStripFEDErrorsDQM::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 55 of file SiStripFEDErrorsDQM.cc.

55  {
56 }
bool SiStripFEDErrorsDQM::readBadAPVs ( )
private

Definition at line 69 of file SiStripFEDErrorsDQM.cc.

References addErrors(), cabling_, debug_, FedChannelConnection::detId(), SiStripBaseServiceFromDQM< SiStripBadStrip >::dqmStore_, sistrip::FED_ID_MAX, sistrip::FED_ID_MIN, SiStripFedCabling::fedConnections(), SiStripFedCabling::fedIds(), fp_, edm::FileInPath::fullPath(), SiStripBaseServiceFromDQM< SiStripBadStrip >::getRunNumber(), SiStripBaseServiceFromDQM< SiStripBadStrip >::goToDir(), sistrip::invalid32_, FedChannelConnection::isConnected(), LogTrace, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, SiStripCondObjBuilderBase< SiStripBadStrip >::obj_, SiStripBaseServiceFromDQM< SiStripBadStrip >::openRequestedFile(), readHistogram(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by analyze().

69  {
70 
71  //std::cout << "[SiStripFEDErrorsDQM::readBadAPVs]" << std::endl;
72 
74 
75  //std::cout << "[SiStripFEDErrorsDQM::readBadAPVs]: opened requested file" << std::endl;
76 
77  obj_=new SiStripBadStrip();
78 
80 
81  std::ostringstream lPath;
82  lPath << "Run " << getRunNumber() << "/SiStrip/Run summary/ReadoutView/";
83 
84  dqmStore_->setCurrentFolder(lPath.str());
85  LogTrace("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::readBadAPVs] Now in " << dqmStore_->pwd() << std::endl;
86 
87  std::string lBaseDir = dqmStore_->pwd();
88 
89  std::vector<std::pair<std::string,unsigned int> > lFedsFolder;
90  //for FED errors, use summary folder and fedId=0
91  //do not put a slash or "goToDir" won't work...
92  lFedsFolder.push_back(std::pair<std::string,unsigned int>("FedMonitoringSummary",0));
93 
94  //for FE/channel/APV errors, they are written in a folder per FED,
95  //if there was at least one error.
96  //So just loop on folders and see which ones exist.
97  for (unsigned int ifed(FEDNumbering::MINSiStripFEDID);
99  ifed++){//loop on FEDs
100 
101  std::ostringstream lFedDir;
102  lFedDir << "FrontEndDriver" << ifed;
103  if (!goToDir(lFedDir.str())) continue;
104  //if (!dqmStore_->dirExists(lFedDir.str())) continue;
105  else {
106  if (debug_) LogTrace("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::readBadAPVs] - Errors detected for FED " << ifed << std::endl;
107  lFedsFolder.push_back(std::pair<std::string,unsigned int>(lFedDir.str(),ifed));
108  }
109  dqmStore_->goUp();
110  }
111 
112  unsigned int nAPVsTotal = 0;
113  //retrieve total number of APVs valid and connected from cabling:
114  if (!cabling_) {
115  edm::LogError("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::readBadAPVs] cabling not filled, return false " << std::endl;
116  return false;
117  }
118  auto lFedVec = cabling_->fedIds();
119  for (unsigned int iFed(0);iFed<lFedVec.size();iFed++){
120  if (*(lFedVec.begin() + iFed) < sistrip::FED_ID_MIN || *(lFedVec.begin() + iFed) > sistrip::FED_ID_MAX) {
121  edm::LogError("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::readBadAPVs] Invalid fedid : " << *(lFedVec.begin() + iFed) << std::endl;
122  continue;
123  }
124  auto lConnVec = cabling_->fedConnections(*(lFedVec.begin() + iFed));
125  for (unsigned int iConn(0); iConn<lConnVec.size();iConn++){
126  const FedChannelConnection & lConnection = *(lConnVec.begin() + iConn);
127  if (!lConnection.isConnected()) continue;
128  unsigned int lDetid = lConnection.detId();
129  if (!lDetid || lDetid == sistrip::invalid32_) continue;
130  //2 APVs per channel....
131  nAPVsTotal += 2;
132  }
133  }
134 
135  edm::LogInfo("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::readBadAPVs] Total number of APVs found : " << nAPVsTotal << std::endl;
136 
137  unsigned int nAPVsWithErrorTotal = 0;
138  unsigned int nFolders = 0;
139  float lNorm = 0;
140 
141 
142  for( std::vector<std::pair<std::string,unsigned int> >::const_iterator iFolder = lFedsFolder.begin();
143  iFolder != lFedsFolder.end();
144  ++iFolder ) {//loop on lFedsFolders
145  std::string lDirName = lBaseDir + "/" + (*iFolder).first;
146  unsigned int lFedId = (*iFolder).second;
147 
148  if (!goToDir((*iFolder).first)) continue;
149 
150  std::vector<MonitorElement *> lMeVec = dqmStore_->getContents(lDirName);
151 
152  if (nFolders == 0) {
153 
154  for( std::vector<MonitorElement *>::const_iterator iMe = lMeVec.begin();
155  iMe != lMeVec.end();
156  ++iMe ) {//loop on ME found in directory
157 
158  std::string lMeName = (*iMe)->getName() ;
159  if (lMeName.find("nFEDErrors") != lMeName.npos){
160  lNorm = (*iMe)->getEntries();
161  }
162  }
163  //if norm histo has not been found, no point in continuing....
164  if (lNorm < 1) {
165  edm::LogError("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::readBadAPVs] nFEDErrors not found, norm is " << lNorm << std::endl;
166  return false;
167  }
168  }
169 
170  unsigned int nAPVsWithError = 0;
171 
172  for( std::vector<MonitorElement *>::const_iterator iMe = lMeVec.begin();
173  iMe != lMeVec.end();
174  ++iMe ) {//loop on ME found in directory
175 
176  if ((*iMe)->getEntries() == 0) continue;
177  std::string lMeName = (*iMe)->getName() ;
178 
179  bool lookForErrors = false;
180  if (nFolders == 0) {
181  //for the first element of lFedsFolder: this is FED errors
182  lookForErrors =
183  lMeName.find("DataMissing") != lMeName.npos ||
184  lMeName.find("AnyFEDErrors") != lMeName.npos ||
185  (lMeName.find("CorruptBuffer") != lMeName.npos &&
186  lMeName.find("nFED") == lMeName.npos);
187  }
188  else {
189  //for the others, it is channel or FE errors.
190  lookForErrors =
191  lMeName.find("APVAddressError") != lMeName.npos ||
192  lMeName.find("APVError") != lMeName.npos ||
193  lMeName.find("BadMajorityAddresses") != lMeName.npos ||
194  lMeName.find("FEMissing") != lMeName.npos ||
195  lMeName.find("OOSBits") != lMeName.npos ||
196  lMeName.find("UnlockedBits") != lMeName.npos;
197  }
198 
199  if (lookForErrors) readHistogram(*iMe,nAPVsWithError,lNorm,lFedId);
200 
201  }//loop on ME found in directory
202 
203  nAPVsWithErrorTotal += nAPVsWithError;
204  ++nFolders;
205 
206  dqmStore_->goUp();
207 
208  }//loop on lFedsFolders
209 
210  edm::LogInfo("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::readBadAPVs] Total APVs with error found above threshold = " << nAPVsWithErrorTotal << std::endl;
211 
212  dqmStore_->cd();
213 
214  addErrors();
215 
216  return true;
217 }//method
static const uint16_t FED_ID_MIN
static const uint32_t invalid32_
Definition: Constants.h:15
void addErrors()
Writes the errors to the db.
bool goToDir(const std::string &name)
Uses DQM utilities to access the requested dir.
uint32_t getRunNumber() const
Returns the run number from the cfg.
const uint32_t & detId() const
Class containning control, module, detector and connection information, at the level of a FED channel...
FedsConstIterRange fedIds() const
#define LogTrace(id)
ConnsConstIterRange fedConnections(uint16_t fed_id) const
const SiStripFedCabling * cabling_
static const uint16_t FED_ID_MAX
std::string fullPath() const
Definition: FileInPath.cc:165
void readHistogram(MonitorElement *aMe, unsigned int &aCounter, const float aNorm, const unsigned int aFedId)
void openRequestedFile()
Uses DQMStore to access the DQM file.
void SiStripFEDErrorsDQM::readHistogram ( MonitorElement aMe,
unsigned int &  aCounter,
const float  aNorm,
const unsigned int  aFedId 
)
private

Definition at line 219 of file SiStripFEDErrorsDQM.cc.

References addBadAPV(), cabling_, debug_, sistrip::FEDCH_PER_FED, sistrip::FEDCH_PER_FEUNIT, SiStripFedCabling::fedConnection(), MonitorElement::getBinContent(), MonitorElement::getName(), MonitorElement::getNbinsX(), FedChannelConnection::isConnected(), LogTrace, FEDNumbering::MINSiStripFEDID, AlCaHLTBitMon_QueryRunRegistry::string, and threshold_.

Referenced by readBadAPVs().

223 {
224  unsigned short lFlag = 0;
225  std::string lMeName = aMe->getName();
226  if (lMeName.find("DataMissing") != lMeName.npos) {
227  lFlag = 0;
228  }
229  else if (lMeName.find("AnyFEDErrors") != lMeName.npos) {
230  lFlag = 1;
231  }
232  else if (lMeName.find("CorruptBuffer") != lMeName.npos &&
233  lMeName.find("nFED") == lMeName.npos) {
234  lFlag = 2;
235  }
236  else if (lMeName.find("FEMissing") != lMeName.npos) {
237  lFlag = 3;
238  }
239  else if (lMeName.find("BadMajorityAddresses") != lMeName.npos) {
240  lFlag = 4;
241  }
242  else if (lMeName.find("UnlockedBits") != lMeName.npos) {
243  lFlag = 5;
244  }
245  else if (lMeName.find("OOSBits") != lMeName.npos) {
246  lFlag = 6;
247  }
248  else if (lMeName.find("APVAddressError") != lMeName.npos) {
249  lFlag = 7;
250  }
251  else if (lMeName.find("APVError") != lMeName.npos) {
252  lFlag = 8;
253  }
254  else {
255  edm::LogError("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::readHistogramError] Shouldn't be here ..." << std::endl;
256  return;
257  }
258 
259  if (debug_) {
260  LogTrace("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::readHistogramError] Reading histo : " << lMeName << ", flag = " << lFlag << std::endl;
261  }
262 
263  unsigned int lNBins = aMe->getNbinsX();
264  int lBinShift = 0;
265  bool lIsFedHist = false;
266  bool lIsAPVHist = false;
267  bool lIsFeHist = false;
268  bool lIsChHist = false;
269 
270  if (lNBins > 200) {
271  lBinShift = FEDNumbering::MINSiStripFEDID-1;//shift for FED ID from bin number
272  lIsFedHist = true;
273  }
274  else {
275  lBinShift = -1;//shift for channel/APV/FE id from bin number
276  if (lNBins > 100) lIsAPVHist = true;
277  else if (lNBins < 10) lIsFeHist = true;
278  else lIsChHist = true;
279  }
280 
281  if (debug_) {
282  LogTrace("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::readHistogramError] lIsFedHist: " << lIsFedHist << std::endl
283  << "[SiStripFEDErrorsDQM::readHistogramError] lIsAPVHist: " << lIsAPVHist << std::endl
284  << "[SiStripFEDErrorsDQM::readHistogramError] lIsFeHist : " << lIsFeHist << std::endl
285  << "[SiStripFEDErrorsDQM::readHistogramError] lIsChHist : " << lIsChHist << std::endl;
286  }
287 
288  for (unsigned int ibin(1); ibin<lNBins+1; ibin++){
289  if (aMe->getBinContent(ibin)>0){
290  float lStat = aMe->getBinContent(ibin)*1./aNorm;
291  if (lStat <= threshold_) {
292  if (debug_) LogTrace("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::readHistogramError] ---- Below threshold : " << lStat << std::endl;
293  continue;
294  }
295  if (lIsFedHist) {
296  unsigned int lFedId = ibin+lBinShift;
297  //loop on all enabled channels of this FED....
298  for (unsigned int iChId = 0;
299  iChId < sistrip::FEDCH_PER_FED;
300  iChId++) {//loop on channels
301  const FedChannelConnection & lConnection = cabling_->fedConnection(lFedId,iChId);
302  if (!lConnection.isConnected()) continue;
303  addBadAPV(lConnection,0,lFlag,aCounter);
304  }
305  }
306  else {
307  if(lIsFeHist) {
308  unsigned int iFeId = ibin+lBinShift;
309  //loop on all enabled channels of this FE....
310  for (unsigned int iFeCh = 0;
311  iFeCh < sistrip::FEDCH_PER_FEUNIT;
312  iFeCh++) {//loop on channels
313  unsigned int iChId = sistrip::FEDCH_PER_FEUNIT*iFeId+iFeCh;
314  const FedChannelConnection & lConnection = cabling_->fedConnection(aFedId,iChId);
315  if (!lConnection.isConnected()) continue;
316  addBadAPV(lConnection,0,lFlag,aCounter);
317  }
318  }
319  else {
320  unsigned int iChId = ibin+lBinShift;
321  if (lIsAPVHist) {
322  unsigned int iAPVid = iChId%2+1;
323  iChId = static_cast<unsigned int>(iChId/2.);
324  const FedChannelConnection & lConnection = cabling_->fedConnection(aFedId,iChId);
325  addBadAPV(lConnection,iAPVid,lFlag,aCounter);
326 
327  }//ifAPVhists
328  else {
329  const FedChannelConnection & lConnection = cabling_->fedConnection(aFedId,iChId);
330  addBadAPV(lConnection,0,lFlag,aCounter);
331  }
332  }//if not FE hist
333  }//if not FED hist
334  }//if entries in histo
335  }//loop on bins
336 }//method readHistogram
const std::string & getName(void) const
get name of ME
FedChannelConnection fedConnection(uint16_t fed_id, uint16_t fed_ch) const
void addBadAPV(const FedChannelConnection &aConnection, const unsigned short aAPVNumber, const unsigned short aFlag, unsigned int &aCounter)
Class containning control, module, detector and connection information, at the level of a FED channel...
#define LogTrace(id)
static const uint16_t FEDCH_PER_FEUNIT
double getBinContent(int binx) const
get content of bin (1-D)
static const uint16_t FEDCH_PER_FED
int getNbinsX(void) const
get # of bins in X-axis
const SiStripFedCabling * cabling_
void SiStripFEDErrorsDQM::setFlagBit ( unsigned short &  aFlag,
const unsigned short  aBit 
)
private

Definition at line 441 of file SiStripFEDErrorsDQM.cc.

Referenced by addErrors().

442 {
443 
444  aFlag = aFlag | (0x1 << aBit) ;
445 
446 
447 }
void SiStripFEDErrorsDQM::updateCabling ( const edm::EventSetup eventSetup)
private

Definition at line 58 of file SiStripFEDErrorsDQM.cc.

References cabling_, cablingCacheId_, edm::EventSetup::get(), and edm::ESHandle< class >::product().

Referenced by analyze().

59 {
60  uint32_t currentCacheId = iSetup.get<SiStripFedCablingRcd>().cacheIdentifier();
61  if (cablingCacheId_ != currentCacheId) {
63  iSetup.get<SiStripFedCablingRcd>().get(cablingHandle);
64  cabling_ = cablingHandle.product();
65  cablingCacheId_ = currentCacheId;
66  }
67 }
T const * product() const
Definition: ESHandle.h:86
const SiStripFedCabling * cabling_

Member Data Documentation

const SiStripFedCabling* SiStripFEDErrorsDQM::cabling_
private

Definition at line 79 of file SiStripFEDErrorsDQM.h.

Referenced by readBadAPVs(), readHistogram(), and updateCabling().

uint32_t SiStripFEDErrorsDQM::cablingCacheId_
private

Definition at line 78 of file SiStripFEDErrorsDQM.h.

Referenced by updateCabling().

unsigned int SiStripFEDErrorsDQM::debug_
private

Definition at line 82 of file SiStripFEDErrorsDQM.h.

Referenced by readBadAPVs(), and readHistogram().

std::map<uint32_t, std::vector<unsigned int> > SiStripFEDErrorsDQM::detIdErrors_
private

Definition at line 83 of file SiStripFEDErrorsDQM.h.

Referenced by addBadStrips(), and addErrors().

edm::FileInPath SiStripFEDErrorsDQM::fp_
private

Definition at line 76 of file SiStripFEDErrorsDQM.h.

Referenced by readBadAPVs().

edm::ParameterSet SiStripFEDErrorsDQM::iConfig_
private

Definition at line 75 of file SiStripFEDErrorsDQM.h.

double SiStripFEDErrorsDQM::threshold_
private

Definition at line 81 of file SiStripFEDErrorsDQM.h.

Referenced by readHistogram().