CMS 3D CMS Logo

Public Member Functions | Private Attributes

SiStripBadComponentsDQMServiceReader Class Reference

#include <SiStripBadComponentsDQMServiceReader.h>

Inheritance diagram for SiStripBadComponentsDQMServiceReader:
edm::EDAnalyzer

List of all members.

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &)
std::string detIdToString (const DetId &detid)
void printError (std::stringstream &ss, const bool error, const std::string &errorText)
 SiStripBadComponentsDQMServiceReader (const edm::ParameterSet &)
 ~SiStripBadComponentsDQMServiceReader ()

Private Attributes

bool printdebug_

Detailed Description

Definition at line 27 of file SiStripBadComponentsDQMServiceReader.h.


Constructor & Destructor Documentation

SiStripBadComponentsDQMServiceReader::SiStripBadComponentsDQMServiceReader ( const edm::ParameterSet iConfig) [explicit]

Definition at line 14 of file SiStripBadComponentsDQMServiceReader.cc.

                                                                                                          :
  printdebug_(iConfig.getUntrackedParameter<bool>("printDebug",true)){}
SiStripBadComponentsDQMServiceReader::~SiStripBadComponentsDQMServiceReader ( )

Definition at line 17 of file SiStripBadComponentsDQMServiceReader.cc.

{}

Member Function Documentation

void SiStripBadComponentsDQMServiceReader::analyze ( const edm::Event e,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 19 of file SiStripBadComponentsDQMServiceReader.cc.

References cond::rpcobgas::detid, detIdToString(), edm::EventSetup::get(), printdebug_, printError(), and relativeConstraints::value.

{
  uint32_t FedErrorMask = 1;     // bit 0
  uint32_t DigiErrorMask = 2;    // bit 1
  uint32_t ClusterErrorMask = 4; // bit 2

  edm::ESHandle<SiStripBadStrip> SiStripBadStrip_;
  iSetup.get<SiStripBadStripRcd>().get(SiStripBadStrip_);
  edm::LogInfo("SiStripBadComponentsDQMServiceReader") << "[SiStripBadComponentsDQMServiceReader::analyze] End Reading SiStripBadStrip" << std::endl;

  std::vector<uint32_t> detid;
  SiStripBadStrip_->getDetIds(detid);

  std::stringstream ss;

  // ss << " detid" << " \t\t\t" << "FED error" << " \t" << "Digi test failed" << " \t" << "Cluster test failed" << std::endl;

  ss << "subdet  layer   stereo  side \t detId \t\t Errors" << std::endl;

  for (size_t id=0;id<detid.size();id++) {
    SiStripBadStrip::Range range=SiStripBadStrip_->getRange(detid[id]);

    for(int it=0;it<range.second-range.first;it++){
      unsigned int value=(*(range.first+it));
      ss << detIdToString(detid[id]) << "\t" << detid[id] << "\t";

      uint32_t flag = boost::lexical_cast<uint32_t>(SiStripBadStrip_->decode(value).flag);

      printError( ss, ((flag & FedErrorMask) == FedErrorMask), "Fed error, " );
      printError( ss, ((flag & DigiErrorMask) == DigiErrorMask), "Digi error, " );
      printError( ss, ((flag & ClusterErrorMask) == ClusterErrorMask), "Cluster error" );
      ss << std::endl;

      if (printdebug_) {
        ss << " firstBadStrip " <<  SiStripBadStrip_->decode(value).firstStrip << "\t "
           << " NconsecutiveBadStrips " << SiStripBadStrip_->decode(value).range << "\t " // << std::endl;
           << " flag " << SiStripBadStrip_->decode(value).flag << "\t "
           << " packed integer " <<  std::hex << value << std::dec << "\t " << std::endl;
      }
    }
    ss << std::endl;
  }
  edm::LogInfo("SiStripBadComponentsDQMServiceReader") << ss.str();
}
string SiStripBadComponentsDQMServiceReader::detIdToString ( const DetId detid)

Definition at line 74 of file SiStripBadComponentsDQMServiceReader.cc.

References TIBDetId::layer(), TOBDetId::layer(), mergeVDriftHistosByStation::name, DetId::rawId(), TIDDetId::side(), TECDetId::side(), DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.

Referenced by analyze().

{
  std::string detector;
  int layer = 0;
  int stereo = 0;
  int side = -1;

  // Using the operator[] if the element does not exist it is created with the default value. That is 0 for integral types.
  switch (detid.subdetId()) {
  case StripSubdetector::TIB:
    {
      TIBDetId theTIBDetId(detid.rawId());
      detector = "TIB";
      layer = theTIBDetId.layer();
      stereo = theTIBDetId.stereo();
      break;
    }
  case StripSubdetector::TOB:
    {
      TOBDetId theTOBDetId(detid.rawId());
      detector = "TOB";
      layer = theTOBDetId.layer();
      stereo = theTOBDetId.stereo();
      break;
    }
  case StripSubdetector::TEC:
    {
      TECDetId theTECDetId(detid.rawId());
      // is this module in TEC+ or TEC-?
      side = theTECDetId.side();
      detector = "TEC";
      layer = theTECDetId.wheel();
      stereo = theTECDetId.stereo();
      break;
    }
  case StripSubdetector::TID:
    {
      TIDDetId theTIDDetId(detid.rawId());
      // is this module in TID+ or TID-?
      side = theTIDDetId.side();
      detector = "TID";
      layer = theTIDDetId.wheel();
      stereo = theTIDDetId.stereo();
      break;
    }
  }
  std::string name( detector + "\t" + boost::lexical_cast<string>(layer) + "\t" + boost::lexical_cast<string>(stereo) + "\t" );
  if( side == 1 ) {
    name += "-";
  }
  else if ( side == 2 ) {
    name += "+";
  }
//   if( side != -1 ) {
//     name += boost::lexical_cast<string>(side);
//   }

  return name;
}
void SiStripBadComponentsDQMServiceReader::printError ( std::stringstream &  ss,
const bool  error,
const std::string &  errorText 
)

Definition at line 64 of file SiStripBadComponentsDQMServiceReader.cc.

Referenced by analyze().

{
  if( error ) {
    ss << errorText << "\t ";
  }
  else {
    ss << "\t\t ";
  }
}

Member Data Documentation

Definition at line 40 of file SiStripBadComponentsDQMServiceReader.h.

Referenced by analyze().