CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

SiStripMonitorQuality Class Reference

#include <SiStripMonitorQuality.h>

Inheritance diagram for SiStripMonitorQuality:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void beginRun (edm::Run const &run, edm::EventSetup const &eSetup)
virtual void endJob ()
virtual void endRun (edm::Run const &run, edm::EventSetup const &eSetup)
 SiStripMonitorQuality (const edm::ParameterSet &)
 ~SiStripMonitorQuality ()

Private Member Functions

MonitorElementgetQualityME (uint32_t idet)

Private Attributes

edm::ParameterSet conf_
std::string dataLabel_
edm::ESHandle< SiStripDetCablingdetCabling_
DQMStoredqmStore_
unsigned long long m_cacheID_
std::map< uint32_t,
MonitorElement * > 
QualityMEs
edm::ESHandle< SiStripQualitystripQuality_

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 45 of file SiStripMonitorQuality.h.


Constructor & Destructor Documentation

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

Definition at line 44 of file SiStripMonitorQuality.cc.

                                                                          :
  dqmStore_(edm::Service<DQMStore>().operator->()),
  conf_(iConfig),
  m_cacheID_(0)


{
  edm::LogInfo("SiStripMonitorQuality") <<"SiStripMonitorQuality  " 
                                          << " Constructing....... ";     
}
SiStripMonitorQuality::~SiStripMonitorQuality ( )

Definition at line 56 of file SiStripMonitorQuality.cc.

{
  edm::LogInfo("SiStripMonitorQuality") <<"SiStripMonitorQuality  " 
                                          << " Destructing....... ";     
}

Member Function Documentation

void SiStripMonitorQuality::analyze ( const edm::Event iEvent,
const edm::EventSetup eSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 74 of file SiStripMonitorQuality.cc.

References conf_, detCabling_, cond::rpcobgas::detid, MonitorElement::Fill(), edm::EventSetup::get(), MonitorElement::getNbinsX(), edm::ParameterSet::getParameter(), getQualityME(), m_cacheID_, stripQuality_, and relativeConstraints::value.

{
  unsigned long long cacheID = eSetup.get<SiStripQualityRcd>().cacheIdentifier();  
  if (m_cacheID_ == cacheID) return;
  
  m_cacheID_ = cacheID;       

  std::string quality_label = conf_.getParameter<std::string>("StripQualityLabel");
  eSetup.get<SiStripQualityRcd>().get(quality_label,stripQuality_);
  eSetup.get<SiStripDetCablingRcd>().get( detCabling_ );
  
  edm::LogInfo("SiStripMonitorQuality") << "SiStripMonitorQuality::analyze: "<<
    " Reading SiStripQuality "<< std::endl;

  SiStripBadStrip::RegistryIterator rbegin = stripQuality_->getRegistryVectorBegin();
  SiStripBadStrip::RegistryIterator rend   = stripQuality_->getRegistryVectorEnd();
  uint32_t detid;
    
  if (rbegin==rend) return;

  for (SiStripBadStrip::RegistryIterator rp=rbegin; rp != rend; ++rp) {
    
    detid = rp->detid;
    // Check consistency in DetId
    if (detid == 0 || detid == 0xFFFFFFFF){
      edm::LogError("SiStripMonitorQuality") <<"SiStripMonitorQuality::analyze : " 
                                               << "Wrong DetId !!!!!! " <<  detid << " Neglecting !!!!!! ";
      continue;
    }
    // check if the detid is connected in cabling
    if (!detCabling_->IsConnected(detid)) {
      edm::LogError("SiStripMonitorQuality") <<"SiStripMonitorQuality::analyze : " 
                                           << " DetId " <<  detid << " not connected,  Neglecting !!!!!! ";
      continue;
    }
    MonitorElement* me = getQualityME(detid);
    SiStripBadStrip::Range range = SiStripBadStrip::Range( stripQuality_->getDataVectorBegin()+rp->ibegin , 
                                                           stripQuality_->getDataVectorBegin()+rp->iend );
    SiStripBadStrip::ContainerIterator it=range.first;
    for(;it!=range.second;++it){
      unsigned int value=(*it);
      short str_start = stripQuality_->decode(value).firstStrip;
      short str_end   = str_start + stripQuality_->decode(value).range;
      for ( short isr = str_start; isr < str_end + 1; isr++) {        
        if (isr <= (me->getNbinsX()-1)) me->Fill(isr+1, 1.0);
      }
    }
  }
}
void SiStripMonitorQuality::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 64 of file SiStripMonitorQuality.cc.

                                     {
}
void SiStripMonitorQuality::beginRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 69 of file SiStripMonitorQuality.cc.

                                                                                  {
}
void SiStripMonitorQuality::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 137 of file SiStripMonitorQuality.cc.

                                      {
  edm::LogInfo("SiStripMonitorQuality") <<"SiStripMonitorQuality::EndJob: " 
                                          << " Finishing!! ";        
}
void SiStripMonitorQuality::endRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 126 of file SiStripMonitorQuality.cc.

References conf_, dqmStore_, edm::ParameterSet::getParameter(), dumpDBToFile_GT_ttrig_cfg::outputFileName, DQMStore::save(), and DQMStore::showDirStructure().

                                                                                 {
  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
  std::string outputFileName = conf_.getParameter<std::string>("OutputFileName");
  if (outputMEsInRootFile) {    
    dqmStore_->showDirStructure();
    dqmStore_->save(outputFileName);
  }
}
MonitorElement * SiStripMonitorQuality::getQualityME ( uint32_t  idet) [private]

Definition at line 144 of file SiStripMonitorQuality.cc.

References DQMStore::book1D(), SiStripHistoId::createHistoId(), detCabling_, dqmStore_, pos, QualityMEs, MonitorElement::Reset(), MonitorElement::setAxisTitle(), SiStripFolderOrganizer::setDetectorFolder(), and DQMStore::tag().

Referenced by analyze().

                                                                {

  std::map<uint32_t, MonitorElement* >::iterator pos = QualityMEs.find(idet);
  MonitorElement* det_me;
  if (pos != QualityMEs.end()) {
    det_me = pos->second;
    det_me->Reset();
  } else {
    int nStrip =  detCabling_->nApvPairs(idet) * 256;

    // use SistripHistoId for producing histogram id (and title)
    SiStripHistoId hidmanager;
    // create SiStripFolderOrganizer
    SiStripFolderOrganizer folder_organizer;
    // set appropriate folder using SiStripFolderOrganizer
    folder_organizer.setDetectorFolder(idet); // pass the detid to this method

    std::string hid;
    hid = hidmanager.createHistoId("StripQualityFromCondDB","det", idet);
    
    det_me = dqmStore_->book1D(hid, hid, nStrip,0.5,nStrip+0.5);
    dqmStore_->tag(det_me, idet);
    det_me->setAxisTitle("Strip Number",1);
    det_me->setAxisTitle("Quality Flag from CondDB ",2);
    QualityMEs.insert( std::make_pair(idet, det_me));
  }
  return det_me;
}

Member Data Documentation

Definition at line 63 of file SiStripMonitorQuality.h.

Referenced by analyze(), and endRun().

std::string SiStripMonitorQuality::dataLabel_ [private]

Definition at line 68 of file SiStripMonitorQuality.h.

Definition at line 64 of file SiStripMonitorQuality.h.

Referenced by analyze(), and getQualityME().

Definition at line 62 of file SiStripMonitorQuality.h.

Referenced by endRun(), and getQualityME().

unsigned long long SiStripMonitorQuality::m_cacheID_ [private]

Definition at line 70 of file SiStripMonitorQuality.h.

Referenced by analyze().

std::map<uint32_t, MonitorElement*> SiStripMonitorQuality::QualityMEs [private]

Definition at line 67 of file SiStripMonitorQuality.h.

Referenced by getQualityME().

Definition at line 65 of file SiStripMonitorQuality.h.

Referenced by analyze().