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
const int _norbbin
RunHistogramManager _rhm
const bool _runHisto
int _scalefact
std::map< unsigned int,
TFileDirectory * > 
_subdirs

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), _norbbin(3600), _scalefact(), _runHisto(true), _binmax(), _labels(), _nmultvsorbrun(), _nmult() { }
DigiInvestigatorHistogramMaker::DigiInvestigatorHistogramMaker ( const edm::ParameterSet iConfig)

Definition at line 15 of file DigiInvestigatorHistogramMaker.cc.

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

                                                                                            :
  _hitname(iConfig.getUntrackedParameter<std::string>("hitName","digi")),
  _nbins(iConfig.getUntrackedParameter<int>("numberOfBins",500)),
  _norbbin(iConfig.getUntrackedParameter<int>("orbitNbin",3600)),
  _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 36 of file DigiInvestigatorHistogramMaker.cc.

References _labels, _subdirs, and i.

                                                                {

  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 110 of file DigiInvestigatorHistogramMaker.cc.

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

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 56 of file DigiInvestigatorHistogramMaker.cc.

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

                                                                 {

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

  SiStripTKNumbers trnumb;
  
  edm::LogInfo("NumberOfBins") << "Number of Bins: " << _nbins;
  edm::LogInfo("NumberOfOrbitBins") << "Number of Orbit Bins: " << _norbbin;
  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.,_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,_norbbin,0.5,11223*_norbbin+0.5);
      }

    }

  }


}
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 144 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 35 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 41 of file DigiInvestigatorHistogramMaker.h.

Referenced by book(), and fill().

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

Definition at line 40 of file DigiInvestigatorHistogramMaker.h.

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

Definition at line 32 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

Definition at line 39 of file DigiInvestigatorHistogramMaker.h.

Referenced by beginRun(), and book().

Definition at line 34 of file DigiInvestigatorHistogramMaker.h.

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

Definition at line 33 of file DigiInvestigatorHistogramMaker.h.

Referenced by book().

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

Definition at line 42 of file DigiInvestigatorHistogramMaker.h.

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