CMS 3D CMS Logo

Public Member Functions | Private Attributes

DigiVertexCorrHistogramMaker Class Reference

#include <DigiVertexCorrHistogramMaker.h>

List of all members.

Public Member Functions

void beginRun (const edm::Run &iRun)
void book (const std::string dirname)
void book (const std::string dirname, const std::map< unsigned int, std::string > &labels)
 DigiVertexCorrHistogramMaker ()
 DigiVertexCorrHistogramMaker (const edm::ParameterSet &iConfig)
void fill (const edm::Event &iEvent, const unsigned int nvtx, const std::map< unsigned int, int > &ndigi)
 ~DigiVertexCorrHistogramMaker ()

Private Attributes

std::map< unsigned int, int > m_binmax
std::map< unsigned int,
RunHistogramManager * > 
m_fhm
std::string m_hitname
std::map< unsigned int,
std::string > 
m_labels
const int m_maxnvtx
const int m_nbins
std::map< unsigned int, TH2F * > m_nmultvsnvtx
std::map< unsigned int,
TProfile * > 
m_nmultvsnvtxprof
std::map< unsigned int,
TProfile2D ** > 
m_nmultvsnvtxvsbxprofrun
bool m_runHisto
const int m_scalefact
std::map< unsigned int,
TFileDirectory * > 
m_subdirs

Detailed Description

Definition at line 18 of file DigiVertexCorrHistogramMaker.h.


Constructor & Destructor Documentation

DigiVertexCorrHistogramMaker::DigiVertexCorrHistogramMaker ( )
DigiVertexCorrHistogramMaker::DigiVertexCorrHistogramMaker ( const edm::ParameterSet iConfig)

Definition at line 19 of file DigiVertexCorrHistogramMaker.cc.

References edm::ParameterSet::getUntrackedParameter(), m_binmax, m_labels, and AlCaHLTBitMon_QueryRunRegistry::string.

                                                                                        :
  m_fhm(),
  m_runHisto(iConfig.getUntrackedParameter<bool>("runHisto",false)),
  m_hitname(iConfig.getUntrackedParameter<std::string>("hitName","digi")),
  m_nbins(iConfig.getUntrackedParameter<int>("numberOfBins",500)),
  m_scalefact(iConfig.getUntrackedParameter<int>("scaleFactor",5)),
  m_maxnvtx(iConfig.getUntrackedParameter<int>("maxNvtx",60)),
  m_labels(), m_nmultvsnvtx(), m_nmultvsnvtxprof(), m_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) {
    m_labels[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel");
    m_binmax[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int>("binMax");
  }
  

}
DigiVertexCorrHistogramMaker::~DigiVertexCorrHistogramMaker ( )

Definition at line 41 of file DigiVertexCorrHistogramMaker.cc.

References i, m_fhm, m_labels, m_subdirs, and AlCaHLTBitMon_QueryRunRegistry::string.

                                                            {

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

Member Function Documentation

void DigiVertexCorrHistogramMaker::beginRun ( const edm::Run iRun)

Definition at line 121 of file DigiVertexCorrHistogramMaker.cc.

References i, m_fhm, m_labels, m_nmultvsnvtxvsbxprofrun, m_runHisto, m_subdirs, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by MultiplicityInvestigator::beginRun().

                                                              {

  edm::Service<TFileService> tfserv;


  for(std::map<unsigned int,std::string>::const_iterator lab=m_labels.begin();lab!=m_labels.end();++lab) {
    const int i = lab->first; const std::string slab = lab->second;
    m_fhm[i]->beginRun(iRun,*m_subdirs[i]);
    if(m_runHisto) {
      (*m_nmultvsnvtxvsbxprofrun[i])->GetXaxis()->SetTitle("BX");    (*m_nmultvsnvtxvsbxprofrun[i])->GetYaxis()->SetTitle("Nvertices");
    }
  }

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

Definition at line 62 of file DigiVertexCorrHistogramMaker.cc.

References i, m_binmax, m_fhm, m_hitname, m_labels, m_maxnvtx, m_nbins, m_nmultvsnvtx, m_nmultvsnvtxprof, m_nmultvsnvtxvsbxprofrun, m_runHisto, m_scalefact, m_subdirs, 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: " << m_nbins;
  edm::LogInfo("ScaleFactors") << "y-axis range scale factor: " << m_scalefact;
  edm::LogInfo("MaxNvtx") << "maximum number of vertices: " << m_maxnvtx;
  edm::LogInfo("BinMaxValue") << "Setting bin max values";

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

  }

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

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

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

    m_subdirs[i] = new TFileDirectory(subev.mkdir(slab.c_str()));
    m_fhm[i] = new RunHistogramManager(true);

    if(m_subdirs[i]) {
      sprintf(name,"n%sdigivsnvtx",slab.c_str());
      sprintf(title,"%s %s multiplicity vs Nvtx",slab.c_str(),m_hitname.c_str());
      m_nmultvsnvtx[i] = m_subdirs[i]->make<TH2F>(name,title,m_maxnvtx,-0.5,m_maxnvtx-0.5,m_nbins,0.,(1+m_binmax[i]/(m_scalefact*m_nbins))*m_nbins);
      m_nmultvsnvtx[i]->GetXaxis()->SetTitle("Number of Vertices");    m_nmultvsnvtx[i]->GetYaxis()->SetTitle("Number of Hits");
      sprintf(name,"n%sdigivsnvtxprof",slab.c_str());
      m_nmultvsnvtxprof[i] = m_subdirs[i]->make<TProfile>(name,title,m_maxnvtx,-0.5,m_maxnvtx-0.5);
      m_nmultvsnvtxprof[i]->GetXaxis()->SetTitle("Number of Vertices");    m_nmultvsnvtxprof[i]->GetYaxis()->SetTitle("Number of Hits");

      if(m_runHisto) {
        edm::LogInfo("RunHistos") << "Pseudo-booking run histos " << slab.c_str();
        sprintf(name,"n%sdigivsnvtxvsbxprofrun",slab.c_str());
        sprintf(title,"%s %s multiplicity vs Nvtx vs BX",slab.c_str(),m_hitname.c_str());
        m_nmultvsnvtxvsbxprofrun[i] = m_fhm[i]->makeTProfile2D(name,title,3564,-0.5,3563.5,m_maxnvtx,-0.5,m_maxnvtx-0.5);
      }
      
    }

  }


}
void DigiVertexCorrHistogramMaker::book ( const std::string  dirname,
const std::map< unsigned int, std::string > &  labels 
)
void DigiVertexCorrHistogramMaker::fill ( const edm::Event iEvent,
const unsigned int  nvtx,
const std::map< unsigned int, int > &  ndigi 
)

Definition at line 136 of file DigiVertexCorrHistogramMaker.cc.

References edm::EventBase::bunchCrossing(), HcalObjRepresent::Fill(), i, m_labels, m_nmultvsnvtx, m_nmultvsnvtxprof, and m_nmultvsnvtxvsbxprofrun.

Referenced by MultiplicityInvestigator::analyze().

                                                                                                                              {
  

  edm::Service<TFileService> tfserv;


  for(std::map<unsigned int,int>::const_iterator digi=ndigi.begin();digi!=ndigi.end();digi++) {
    
    if(m_labels.find(digi->first) != m_labels.end()) {
 
      const unsigned int i=digi->first;
      m_nmultvsnvtx[i]->Fill(nvtx,digi->second);
      m_nmultvsnvtxprof[i]->Fill(nvtx,digi->second);

      if(m_nmultvsnvtxvsbxprofrun[i] && *m_nmultvsnvtxvsbxprofrun[i]) (*m_nmultvsnvtxvsbxprofrun[i])->Fill(iEvent.bunchCrossing(),nvtx,digi->second);

    }
    
  }
}

Member Data Documentation

std::map<unsigned int,int> DigiVertexCorrHistogramMaker::m_binmax [private]

Definition at line 39 of file DigiVertexCorrHistogramMaker.h.

Referenced by book(), and DigiVertexCorrHistogramMaker().

std::map<unsigned int,RunHistogramManager*> DigiVertexCorrHistogramMaker::m_fhm [private]

Definition at line 33 of file DigiVertexCorrHistogramMaker.h.

Referenced by beginRun(), book(), and ~DigiVertexCorrHistogramMaker().

Definition at line 35 of file DigiVertexCorrHistogramMaker.h.

Referenced by book().

std::map<unsigned int, std::string> DigiVertexCorrHistogramMaker::m_labels [private]

Definition at line 38 of file DigiVertexCorrHistogramMaker.h.

Referenced by book().

Definition at line 36 of file DigiVertexCorrHistogramMaker.h.

Referenced by book().

std::map<unsigned int,TH2F*> DigiVertexCorrHistogramMaker::m_nmultvsnvtx [private]

Definition at line 42 of file DigiVertexCorrHistogramMaker.h.

Referenced by book(), and fill().

std::map<unsigned int,TProfile*> DigiVertexCorrHistogramMaker::m_nmultvsnvtxprof [private]

Definition at line 43 of file DigiVertexCorrHistogramMaker.h.

Referenced by book(), and fill().

std::map<unsigned int,TProfile2D**> DigiVertexCorrHistogramMaker::m_nmultvsnvtxvsbxprofrun [private]

Definition at line 44 of file DigiVertexCorrHistogramMaker.h.

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

Definition at line 34 of file DigiVertexCorrHistogramMaker.h.

Referenced by beginRun(), and book().

Definition at line 37 of file DigiVertexCorrHistogramMaker.h.

Referenced by book().

std::map<unsigned int,TFileDirectory*> DigiVertexCorrHistogramMaker::m_subdirs [private]

Definition at line 45 of file DigiVertexCorrHistogramMaker.h.

Referenced by beginRun(), book(), and ~DigiVertexCorrHistogramMaker().