CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

SiStripQualityHistory Class Reference

#include <DPGAnalysis/SiStripTools/plugins/SiStripQualityHistory.cc>

Inheritance diagram for SiStripQualityHistory:
edm::EDAnalyzer edm::EDConsumerBase

List of all members.

Public Types

enum  { Module, Fiber, APV, Strip }

Public Member Functions

 SiStripQualityHistory (const edm::ParameterSet &)
 ~SiStripQualityHistory ()

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
virtual void beginJob ()
virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
virtual void endJob ()

Private Attributes

std::map< std::string, TH1F * > _history
const unsigned int _mode
const std::vector
< edm::ParameterSet
_monitoredssq
std::map< std::string,
TProfile ** > 
m_badmodrun
const unsigned int m_LSfrac
const unsigned int m_maxLS
RunHistogramManager m_rhm
const bool m_run

Detailed Description

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

Implementation: <Notes on="" implementation>="">

Definition at line 57 of file SiStripQualityHistory.cc.


Member Enumeration Documentation

anonymous enum
Enumerator:
Module 
Fiber 
APV 
Strip 

Definition at line 62 of file SiStripQualityHistory.cc.


Constructor & Destructor Documentation

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

Definition at line 95 of file SiStripQualityHistory.cc.

References _history, _monitoredssq, m_badmodrun, m_LSfrac, m_maxLS, m_rhm, m_run, RunHistogramManager::makeTProfile(), mergeVDriftHistosByStation::name, and AlCaHLTBitMon_QueryRunRegistry::string.

                                                                          :
  m_rhm(),
  _monitoredssq(iConfig.getParameter<std::vector<edm::ParameterSet> >("monitoredSiStripQuality")),
  _mode(iConfig.getUntrackedParameter<unsigned int>("granularityMode",Module)),
  m_run(iConfig.getParameter<bool>("runProcess")),
  m_maxLS(iConfig.getUntrackedParameter<unsigned int>("maxLSBeforeRebin",100)),
  m_LSfrac(iConfig.getUntrackedParameter<unsigned int>("startingLSFraction",4)),
  _history(),m_badmodrun()
{
   //now do what ever initialization is needed

  edm::Service<TFileService> tfserv;

  for(std::vector<edm::ParameterSet>::const_iterator ps=_monitoredssq.begin();ps!=_monitoredssq.end();++ps) {
    
    std::string name = ps->getParameter<std::string>("name");
    //    _history[name] = tfserv->make<TGraph>();
    //    _history[name]->SetName(name.c_str());     _history[name]->SetTitle(name.c_str()); 

    if(m_run) _history[name] = tfserv->make<TH1F>(name.c_str(),name.c_str(),10,0,10);

    char hrunname[400];
    sprintf(hrunname,"badmodrun_%s",name.c_str());
    char hruntitle[400];
    sprintf(hruntitle,"Number of bad modules %s",name.c_str());
    m_badmodrun[name] = m_rhm.makeTProfile(hrunname,hruntitle,m_LSfrac*m_maxLS,0,m_maxLS*262144);
  }

}
SiStripQualityHistory::~SiStripQualityHistory ( )

Definition at line 126 of file SiStripQualityHistory.cc.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

void SiStripQualityHistory::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [override, private, virtual]

Implements edm::EDAnalyzer.

Definition at line 141 of file SiStripQualityHistory.cc.

References _mode, _monitoredssq, APV, data, Fiber, HcalObjRepresent::Fill(), edm::EventSetup::get(), diffTwoXMLs::label, LogDebug, m_badmodrun, Module, mergeVDriftHistosByStation::name, edm::EventBase::orbitNumber(), AlCaHLTBitMon_QueryRunRegistry::string, and Strip.

{
  //  edm::LogInfo("EventProcessing") << "event being processed";

  for(std::vector<edm::ParameterSet>::const_iterator ps=_monitoredssq.begin();ps!=_monitoredssq.end();++ps) {
    
    std::string name = ps->getParameter<std::string>("name");
    std::string label = ps->getParameter<std::string>("ssqLabel");
    
    
    
    edm::ESHandle<SiStripQuality> ssq;
    iSetup.get<SiStripQualityRcd>().get(label,ssq);
    
    std::vector<SiStripQuality::BadComponent> bads = ssq->getBadComponentList();
    
    LogDebug("BadComponents") << bads.size() << " bad components found";
    
    int nbad=0;
    
    if(_mode==Module || _mode==Fiber || _mode==APV) {
      for(std::vector<SiStripQuality::BadComponent>::const_iterator bc=bads.begin();bc!=bads.end();++bc) {
        
        if(_mode==Module) {
          if(bc->BadModule) ++nbad;
        }
        else if(_mode == Fiber) {
          for(int fiber=1;fiber<5;fiber*=2) {
            if((bc->BadFibers & fiber)>0) ++nbad;
          }
        }
        else if(_mode ==APV) {
          for(int apv=1;apv<33;apv*=2) {
            if((bc->BadApvs & apv)>0) ++nbad;
          }
        }
      }
    }
    else if(_mode==Strip) {
      SiStripBadStrip::ContainerIterator dbegin = ssq->getDataVectorBegin();
      SiStripBadStrip::ContainerIterator dend = ssq->getDataVectorEnd();
      for(SiStripBadStrip::ContainerIterator data = dbegin; data < dend; ++data) {
        nbad += ssq->decode(*data).range;
      }

    }

    if(m_badmodrun.find(name)!=m_badmodrun.end() && m_badmodrun[name] && *m_badmodrun[name]) {
      (*m_badmodrun[name])->Fill(iEvent.orbitNumber(),nbad);
    }
    
  }
}
void SiStripQualityHistory::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 264 of file SiStripQualityHistory.cc.

{}
void SiStripQualityHistory::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
) [override, private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 196 of file SiStripQualityHistory.cc.

References _history, _mode, _monitoredssq, APV, RunHistogramManager::beginRun(), data, Fiber, edm::EventSetup::get(), diffTwoXMLs::label, LogDebug, m_badmodrun, m_rhm, m_run, Module, mergeVDriftHistosByStation::name, edm::RunBase::run(), AlCaHLTBitMon_QueryRunRegistry::string, and Strip.

{

  m_rhm.beginRun(iRun);
  
  // loop on all the SiStripQuality objects to be monitored

  for(std::vector<edm::ParameterSet>::const_iterator ps=_monitoredssq.begin();ps!=_monitoredssq.end();++ps) {
    
    std::string name = ps->getParameter<std::string>("name");
    std::string label = ps->getParameter<std::string>("ssqLabel");
    
    if(m_badmodrun.find(name)!=m_badmodrun.end()) {
      if(m_badmodrun[name] && *m_badmodrun[name]) {
        (*m_badmodrun[name])->SetBit(TH1::kCanRebin);
        (*m_badmodrun[name])->GetXaxis()->SetTitle("time [Orb#]"); (*m_badmodrun[name])->GetYaxis()->SetTitle("bad components"); 
      }
    }
    
    if(m_run) {

      edm::ESHandle<SiStripQuality> ssq;
      iSetup.get<SiStripQualityRcd>().get(label,ssq);
      
      std::vector<SiStripQuality::BadComponent> bads = ssq->getBadComponentList();
      
      LogDebug("BadComponents") << bads.size() << " bad components found";
      
      int nbad=0;
      
      if(_mode==Module || _mode==Fiber || _mode==APV) {
        for(std::vector<SiStripQuality::BadComponent>::const_iterator bc=bads.begin();bc!=bads.end();++bc) {
          
          if(_mode==Module) {
            if(bc->BadModule) ++nbad;
          }
          else if(_mode == Fiber) {
            for(int fiber=1;fiber<5;fiber*=2) {
              if((bc->BadFibers & fiber)>0) ++nbad;
            }
          }
          else if(_mode ==APV) {
            for(int apv=1;apv<33;apv*=2) {
              if((bc->BadApvs & apv)>0) ++nbad;
            }
          }
        }
      }
      else if(_mode==Strip) {
        SiStripBadStrip::ContainerIterator dbegin = ssq->getDataVectorBegin();
        SiStripBadStrip::ContainerIterator dend = ssq->getDataVectorEnd();
        for(SiStripBadStrip::ContainerIterator data = dbegin; data < dend; ++data) {
          nbad += ssq->decode(*data).range;
        }
      }
      
      //    _history[name]->SetPoint(_history[name]->GetN(),iRun.run(),nbad);
      char runname[100];
      sprintf(runname,"%d",iRun.run());
      LogDebug("AnalyzedRun") << name << " " << runname << " " << nbad;
      _history[name]->Fill(runname,nbad);
    }    
  }
  
}
void SiStripQualityHistory::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 269 of file SiStripQualityHistory.cc.

{
  /*
  for(std::vector<edm::ParameterSet>::const_iterator ps=_monitoredssq.begin();ps!=_monitoredssq.end();++ps) {
    
    std::string name = ps->getParameter<std::string>("name");
    _history[name]->Write();

  }
  */
}

Member Data Documentation

std::map<std::string,TH1F*> SiStripQualityHistory::_history [private]

Definition at line 79 of file SiStripQualityHistory.cc.

Referenced by beginRun(), and SiStripQualityHistory().

const unsigned int SiStripQualityHistory::_mode [private]

Definition at line 74 of file SiStripQualityHistory.cc.

Referenced by analyze(), and beginRun().

Definition at line 73 of file SiStripQualityHistory.cc.

Referenced by analyze(), beginRun(), and SiStripQualityHistory().

std::map<std::string,TProfile**> SiStripQualityHistory::m_badmodrun [private]

Definition at line 80 of file SiStripQualityHistory.cc.

Referenced by analyze(), beginRun(), and SiStripQualityHistory().

const unsigned int SiStripQualityHistory::m_LSfrac [private]

Definition at line 77 of file SiStripQualityHistory.cc.

Referenced by SiStripQualityHistory().

const unsigned int SiStripQualityHistory::m_maxLS [private]

Definition at line 76 of file SiStripQualityHistory.cc.

Referenced by SiStripQualityHistory().

Definition at line 72 of file SiStripQualityHistory.cc.

Referenced by beginRun(), and SiStripQualityHistory().

const bool SiStripQualityHistory::m_run [private]

Definition at line 75 of file SiStripQualityHistory.cc.

Referenced by beginRun(), and SiStripQualityHistory().