CMS 3D CMS Logo

Public Member Functions | Private Attributes

DigiLumiCorrHistogramMaker Class Reference

#include <DigiLumiCorrHistogramMaker.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)
 DigiLumiCorrHistogramMaker ()
 DigiLumiCorrHistogramMaker (const edm::ParameterSet &iConfig)
void fill (const edm::Event &iEvent, const std::map< unsigned int, int > &ndigi)
 ~DigiLumiCorrHistogramMaker ()

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 edm::InputTag m_lumiProducer
const int m_nbins
std::map< unsigned int, TH2F * > m_nmultvslumi
std::map< unsigned int,
TProfile * > 
m_nmultvslumiprof
std::map< unsigned int,
TProfile2D ** > 
m_nmultvslumivsbxprofrun
bool m_runHisto
const int m_scalefact
std::map< unsigned int,
TFileDirectory * > 
m_subdirs

Detailed Description

Definition at line 20 of file DigiLumiCorrHistogramMaker.h.


Constructor & Destructor Documentation

DigiLumiCorrHistogramMaker::DigiLumiCorrHistogramMaker ( )

Definition at line 16 of file DigiLumiCorrHistogramMaker.cc.

DigiLumiCorrHistogramMaker::DigiLumiCorrHistogramMaker ( const edm::ParameterSet iConfig)

Definition at line 20 of file DigiLumiCorrHistogramMaker.cc.

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

                                                                                    :
  m_lumiProducer(iConfig.getParameter<edm::InputTag>("lumiProducer")),
  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_labels(), m_nmultvslumi(), m_nmultvslumiprof(), 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");
  }
  

}
DigiLumiCorrHistogramMaker::~DigiLumiCorrHistogramMaker ( )

Definition at line 42 of file DigiLumiCorrHistogramMaker.cc.

References i, m_fhm, m_labels, and m_subdirs.

                                                        {

  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 DigiLumiCorrHistogramMaker::beginRun ( const edm::Run iRun)

Definition at line 120 of file DigiLumiCorrHistogramMaker.cc.

References i, m_fhm, m_labels, m_nmultvslumivsbxprofrun, m_runHisto, and m_subdirs.

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_nmultvslumivsbxprofrun[i])->GetXaxis()->SetTitle("BX");    
      (*m_nmultvslumivsbxprofrun[i])->GetYaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]");
    }
  }


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

Definition at line 63 of file DigiLumiCorrHistogramMaker.cc.

References i, m_binmax, m_fhm, m_hitname, m_labels, m_nbins, m_nmultvslumi, m_nmultvslumiprof, m_nmultvslumivsbxprofrun, m_runHisto, m_scalefact, m_subdirs, 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: " << m_nbins;
  edm::LogInfo("ScaleFactors") << "y-axis range scale factor: " << m_scalefact;
  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%sdigivslumi",slab.c_str());
      sprintf(title,"%s %s multiplicity vs BX lumi",slab.c_str(),m_hitname.c_str());
      m_nmultvslumi[i] = m_subdirs[i]->make<TH2F>(name,title,250,0.,10.,m_nbins,0.,m_binmax[i]/(m_scalefact*m_nbins)*m_nbins);
      m_nmultvslumi[i]->GetXaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]");    m_nmultvslumi[i]->GetYaxis()->SetTitle("Number of Hits");
      sprintf(name,"n%sdigivslumiprof",slab.c_str());
      m_nmultvslumiprof[i] = m_subdirs[i]->make<TProfile>(name,title,250,0.,10.);
      m_nmultvslumiprof[i]->GetXaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]");    m_nmultvslumiprof[i]->GetYaxis()->SetTitle("Number of Hits");
      
      if(m_runHisto) {
        edm::LogInfo("RunHistos") << "Pseudo-booking run histos " << slab.c_str();
        sprintf(name,"n%sdigivslumivsbxprofrun",slab.c_str());
        sprintf(title,"%s %s multiplicity vs BX lumi vs BX",slab.c_str(),m_hitname.c_str());
        m_nmultvslumivsbxprofrun[i] = m_fhm[i]->makeTProfile2D(name,title,3564,0.5,3563.5,250,0.,10.);
      }
    }

  }


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

Definition at line 137 of file DigiLumiCorrHistogramMaker.cc.

References edm::EventBase::bunchCrossing(), HcalObjRepresent::Fill(), edm::Event::getLuminosityBlock(), i, edm::HandleBase::isValid(), LumiDetails::kOCC1, m_labels, m_lumiProducer, m_nmultvslumi, m_nmultvslumiprof, and m_nmultvslumivsbxprofrun.

Referenced by MultiplicityInvestigator::analyze().

                                                                                                   {
  
  edm::Handle<LumiDetails> ld;
  iEvent.getLuminosityBlock().getByLabel(m_lumiProducer,ld);

  if(ld.isValid()) {
    if(ld->isValid()) {
      float bxlumi = ld->lumiValue(LumiDetails::kOCC1,iEvent.bunchCrossing())*6.37;

      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_nmultvslumi[i]->Fill(bxlumi,digi->second);
          m_nmultvslumiprof[i]->Fill(bxlumi,digi->second);

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

        }
      }
    }
  }
}

Member Data Documentation

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

Definition at line 41 of file DigiLumiCorrHistogramMaker.h.

Referenced by book(), and DigiLumiCorrHistogramMaker().

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

Definition at line 36 of file DigiLumiCorrHistogramMaker.h.

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

Definition at line 38 of file DigiLumiCorrHistogramMaker.h.

Referenced by book().

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

Definition at line 35 of file DigiLumiCorrHistogramMaker.h.

Referenced by fill().

Definition at line 39 of file DigiLumiCorrHistogramMaker.h.

Referenced by book().

std::map<unsigned int,TH2F*> DigiLumiCorrHistogramMaker::m_nmultvslumi [private]

Definition at line 44 of file DigiLumiCorrHistogramMaker.h.

Referenced by book(), and fill().

std::map<unsigned int,TProfile*> DigiLumiCorrHistogramMaker::m_nmultvslumiprof [private]

Definition at line 45 of file DigiLumiCorrHistogramMaker.h.

Referenced by book(), and fill().

std::map<unsigned int,TProfile2D**> DigiLumiCorrHistogramMaker::m_nmultvslumivsbxprofrun [private]

Definition at line 46 of file DigiLumiCorrHistogramMaker.h.

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

Definition at line 37 of file DigiLumiCorrHistogramMaker.h.

Referenced by beginRun(), and book().

Definition at line 40 of file DigiLumiCorrHistogramMaker.h.

Referenced by book().

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

Definition at line 47 of file DigiLumiCorrHistogramMaker.h.

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