CMS 3D CMS Logo

Public Member Functions | Private Attributes

DigiInvestigatorHistogramMaker Class Reference

#include <DigiInvestigatorHistogramMaker.h>

List of all members.

Public Member Functions

void beginRun (const unsigned int nrun)
void book (const std::string dirname)
void book (const std::string dirname, const std::map< unsigned int, std::string > &labels)
 DigiInvestigatorHistogramMaker ()
 DigiInvestigatorHistogramMaker (const edm::ParameterSet &iConfig)
void fill (const unsigned int orbit, const std::map< unsigned int, int > &ndigi)
 ~DigiInvestigatorHistogramMaker ()

Private Attributes

std::map< unsigned int, int > _binmax
std::string _hitname
std::map< unsigned int,
std::string > 
_labels
const int _nbins
std::map< unsigned int, TH1F * > _nmult
std::map< unsigned int,
TProfile ** > 
_nmultvsorbrun
RunHistogramManager _rhm
const bool _runHisto
int _scalefact
std::map< unsigned int,
TFileDirectory * > 
_subdirs
const unsigned int m_LSfrac
const unsigned int m_maxLS

Detailed Description

Definition at line 15 of file DigiInvestigatorHistogramMaker.h.


Constructor & Destructor Documentation

DigiInvestigatorHistogramMaker::DigiInvestigatorHistogramMaker ( )

Definition at line 12 of file DigiInvestigatorHistogramMaker.cc.

                                                              :
  _hitname(), _nbins(500), m_maxLS(100), m_LSfrac(4), _scalefact(), _runHisto(true), _binmax(), _labels(), _nmultvsorbrun(), _nmult() { }
DigiInvestigatorHistogramMaker::DigiInvestigatorHistogramMaker ( const edm::ParameterSet iConfig)

Definition at line 15 of file DigiInvestigatorHistogramMaker.cc.

References _binmax, _labels, edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

                                                                                            :
  _hitname(iConfig.getUntrackedParameter<std::string>("hitName","digi")),
  _nbins(iConfig.getUntrackedParameter<int>("numberOfBins",500)),
  m_maxLS(iConfig.getUntrackedParameter<unsigned int>("maxLSBeforeRebin",100)),
  m_LSfrac(iConfig.getUntrackedParameter<unsigned int>("startingLSFraction",4)),
  _scalefact(iConfig.getUntrackedParameter<int>("scaleFactor",5)),
  _runHisto(iConfig.getUntrackedParameter<bool>("runHisto",true)),
  _labels(), _rhm(), _nmultvsorbrun(), _nmult(), _subdirs() 
{ 

  std::vector<edm::ParameterSet> 
    wantedsubds(iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >("wantedSubDets",std::vector<edm::ParameterSet>()));
  
  for(std::vector<edm::ParameterSet>::iterator ps=wantedsubds.begin();ps!=wantedsubds.end();++ps) {
    _labels[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel");
    _binmax[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int>("binMax");
  }
  

}
DigiInvestigatorHistogramMaker::~DigiInvestigatorHistogramMaker ( )

Definition at line 37 of file DigiInvestigatorHistogramMaker.cc.

References _labels, _subdirs, i, and AlCaHLTBitMon_QueryRunRegistry::string.

                                                                {

  for(std::map<unsigned int,std::string>::const_iterator lab=_labels.begin();lab!=_labels.end();lab++) {
    
    const unsigned int i = lab->first; const std::string slab = lab->second;
    
    delete _subdirs[i];
  }
  
}

Member Function Documentation

void DigiInvestigatorHistogramMaker::beginRun ( const unsigned int  nrun)

Definition at line 112 of file DigiInvestigatorHistogramMaker.cc.

References _labels, _nmultvsorbrun, _rhm, _runHisto, RunHistogramManager::beginRun(), i, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by MultiplicityInvestigator::beginRun().

                                                                     {

  //  char runname[100];
  //  sprintf(runname,"run_%d",nrun);

  edm::Service<TFileService> tfserv;

  //  currdir = &(*tfserv);
  //  _rhm.beginRun(nrun,*currdir);

  _rhm.beginRun(nrun,*tfserv);


  for(std::map<unsigned int,std::string>::const_iterator lab=_labels.begin();lab!=_labels.end();++lab) {

    const int i = lab->first; const std::string slab = lab->second;

    //    char name[200];
    //    char title[500];

    //    TFileDirectory subd =_subdirs[i]->mkdir(runname);

    //    sprintf(name,"n%sdigivsorbrun",slab.c_str());
    //    sprintf(title,"%s %s mean multiplicity vs orbit",slab.c_str(),_hitname.c_str());
    //    _nmultvsorbrun[i] = subd.make<TProfile>(name,title,_norbbin,0.5,11223*_norbbin+0.5);
    if(_runHisto) {
      (*_nmultvsorbrun[i])->GetXaxis()->SetTitle("time [orbit#]");    (*_nmultvsorbrun[i])->GetYaxis()->SetTitle("Hits");
      (*_nmultvsorbrun[i])->SetBit(TH1::kCanRebin);
    }
  }


}
void DigiInvestigatorHistogramMaker::book ( const std::string  dirname)

Definition at line 57 of file DigiInvestigatorHistogramMaker.cc.

References _binmax, _hitname, _labels, _nbins, _nmult, _nmultvsorbrun, _rhm, _runHisto, _scalefact, _subdirs, i, m_LSfrac, m_maxLS, RunHistogramManager::makeTProfile(), TFileDirectory::mkdir(), mergeVDriftHistosByStation::name, SiStripTKNumbers::nstrips(), AlCaHLTBitMon_QueryRunRegistry::string, and indexGen::title.

                                                                 {

  edm::Service<TFileService> tfserv;
  TFileDirectory subev = tfserv->mkdir(dirname);

  SiStripTKNumbers trnumb;
  
  edm::LogInfo("NumberOfBins") << "Number of Bins: " << _nbins;
  edm::LogInfo("NumberOfMaxLS") << "Max number of LS before rebinning: " << m_maxLS;
  edm::LogInfo("StartingLSFrac") << "Fraction of LS in one bin before rebinning: " << m_LSfrac;
  edm::LogInfo("ScaleFactors") << "x-axis range scale factor: " << _scalefact;
  edm::LogInfo("BinMaxValue") << "Setting bin max values";

  for(std::map<unsigned int,std::string>::const_iterator lab=_labels.begin();lab!=_labels.end();lab++) {
    
    const unsigned int i = lab->first; const std::string slab = lab->second;
    
    if(_binmax.find(i)==_binmax.end()) {
      edm::LogVerbatim("NotConfiguredBinMax") << "Bin max for " << lab->second 
                                              << " not configured: " << trnumb.nstrips(i) << " used";
      _binmax[i] = trnumb.nstrips(i);
    }
 
    edm::LogVerbatim("BinMaxValue") << "Bin max for " << lab->second << " is " << _binmax[i];

  }

  for(std::map<unsigned int,std::string>::const_iterator lab=_labels.begin();lab!=_labels.end();++lab) {

    const int i = lab->first; const std::string slab = lab->second;

    char name[200];
    char title[500];

    _subdirs[i] = new TFileDirectory(subev.mkdir(slab.c_str()));

    if(_subdirs[i]) {
      sprintf(name,"n%sdigi",slab.c_str());
      sprintf(title,"%s %s multiplicity",slab.c_str(),_hitname.c_str());
      _nmult[i] = _subdirs[i]->make<TH1F>(name,title,_nbins,0.,(1+_binmax[i]/(_scalefact*_nbins))*_nbins);
      _nmult[i]->GetXaxis()->SetTitle("Number of Hits");    _nmult[i]->GetYaxis()->SetTitle("Events");
      
      if(_runHisto) {
        sprintf(name,"n%sdigivsorbrun",slab.c_str());
        sprintf(title,"%s %s mean multiplicity vs orbit",slab.c_str(),_hitname.c_str());
        _nmultvsorbrun[i] = _rhm.makeTProfile(name,title,m_LSfrac*m_maxLS,0,m_maxLS*262144);
      }

    }

  }


}
void DigiInvestigatorHistogramMaker::book ( const std::string  dirname,
const std::map< unsigned int, std::string > &  labels 
)
void DigiInvestigatorHistogramMaker::fill ( const unsigned int  orbit,
const std::map< unsigned int, int > &  ndigi 
)

Definition at line 146 of file DigiInvestigatorHistogramMaker.cc.

References _labels, _nmult, _nmultvsorbrun, _runHisto, HcalObjRepresent::Fill(), and i.

Referenced by MultiplicityInvestigator::analyze().

                                                                                                         {
  
  for(std::map<unsigned int,int>::const_iterator digi=ndigi.begin();digi!=ndigi.end();digi++) {
    
    if(_labels.find(digi->first) != _labels.end()) {
 
      const unsigned int i=digi->first;
      
      _nmult[i]->Fill(digi->second);
      if(_runHisto) {
        if(_nmultvsorbrun[i] && *_nmultvsorbrun[i]) (*_nmultvsorbrun[i])->Fill(orbit,digi->second);
      }
    }
    
  }
}

Member Data Documentation

std::map<unsigned int,int> DigiInvestigatorHistogramMaker::_binmax [private]

Definition at line 36 of file DigiInvestigatorHistogramMaker.h.

Referenced by book(), and DigiInvestigatorHistogramMaker().

Definition at line 30 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

std::map<unsigned int, std::string> DigiInvestigatorHistogramMaker::_labels [private]

Definition at line 31 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

std::map<unsigned int,TH1F*> DigiInvestigatorHistogramMaker::_nmult [private]

Definition at line 42 of file DigiInvestigatorHistogramMaker.h.

Referenced by book(), and fill().

std::map<unsigned int,TProfile**> DigiInvestigatorHistogramMaker::_nmultvsorbrun [private]

Definition at line 41 of file DigiInvestigatorHistogramMaker.h.

Referenced by beginRun(), book(), and fill().

Definition at line 40 of file DigiInvestigatorHistogramMaker.h.

Referenced by beginRun(), and book().

Definition at line 35 of file DigiInvestigatorHistogramMaker.h.

Referenced by beginRun(), book(), and fill().

Definition at line 34 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

std::map<unsigned int,TFileDirectory*> DigiInvestigatorHistogramMaker::_subdirs [private]

Definition at line 43 of file DigiInvestigatorHistogramMaker.h.

Referenced by book(), and ~DigiInvestigatorHistogramMaker().

const unsigned int DigiInvestigatorHistogramMaker::m_LSfrac [private]

Definition at line 33 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

const unsigned int DigiInvestigatorHistogramMaker::m_maxLS [private]

Definition at line 32 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().