CMS 3D CMS Logo

Public Member Functions | Private Attributes

DigiPileupCorrHistogramMaker Class Reference

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

Private Attributes

std::map< unsigned int, int > m_binmax
std::string m_hitname
std::map< unsigned int,
std::string > 
m_labels
const int m_nbins
std::map< unsigned int, TH2F * > m_nmultvsmclumi
std::map< unsigned int,
TProfile * > 
m_nmultvsmclumiprof
std::map< unsigned int, TH2F * > m_nmultvsmcnvtx
std::map< unsigned int,
TProfile * > 
m_nmultvsmcnvtxprof
const edm::InputTag m_pileupcollection
const int m_scalefact
std::map< unsigned int,
TFileDirectory * > 
m_subdirs
bool m_useVisibleVertices

Detailed Description

Definition at line 17 of file DigiPileupCorrHistogramMaker.h.


Constructor & Destructor Documentation

DigiPileupCorrHistogramMaker::DigiPileupCorrHistogramMaker ( )
DigiPileupCorrHistogramMaker::DigiPileupCorrHistogramMaker ( const edm::ParameterSet iConfig)

Definition at line 20 of file DigiPileupCorrHistogramMaker.cc.

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

                                                                                        :
  m_pileupcollection(iConfig.getParameter<edm::InputTag>("pileupSummaryCollection")),
  m_useVisibleVertices(iConfig.getParameter<bool>("useVisibleVertices")),
  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_nmultvsmclumi(), m_nmultvsmclumiprof(), m_nmultvsmcnvtx(), m_nmultvsmcnvtxprof(), 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");
  }
  

}
DigiPileupCorrHistogramMaker::~DigiPileupCorrHistogramMaker ( )

Definition at line 41 of file DigiPileupCorrHistogramMaker.cc.

References i, 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];
  }
  
}

Member Function Documentation

void DigiPileupCorrHistogramMaker::beginRun ( const unsigned int  nrun)

Definition at line 119 of file DigiPileupCorrHistogramMaker.cc.

                                                                   {


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

Definition at line 61 of file DigiPileupCorrHistogramMaker.cc.

References i, m_binmax, m_hitname, m_labels, m_nbins, m_nmultvsmclumi, m_nmultvsmclumiprof, m_nmultvsmcnvtx, m_nmultvsmcnvtxprof, 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("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()));

    if(m_subdirs[i]) {
      sprintf(name,"n%sdigivsmclumi",slab.c_str());
      sprintf(title,"%s %s multiplicity ave pileup interactions",slab.c_str(),m_hitname.c_str());
      m_nmultvsmclumi[i] = m_subdirs[i]->make<TH2F>(name,title,200,0.,50.,m_nbins,0.,m_binmax[i]/(m_scalefact*m_nbins)*m_nbins);
      m_nmultvsmclumi[i]->GetXaxis()->SetTitle("Average Pileup Interactions"); m_nmultvsmclumi[i]->GetYaxis()->SetTitle("Number of Hits");
      sprintf(name,"n%sdigivsmclumiprof",slab.c_str());
      m_nmultvsmclumiprof[i] = m_subdirs[i]->make<TProfile>(name,title,200,0.,50.);
      m_nmultvsmclumiprof[i]->GetXaxis()->SetTitle("Average Pileup Interactions");    m_nmultvsmclumiprof[i]->GetYaxis()->SetTitle("Number of Hits");

      sprintf(name,"n%sdigivsmcnvtx",slab.c_str());
      sprintf(title,"%s %s multiplicity vs pileup interactions",slab.c_str(),m_hitname.c_str());
      m_nmultvsmcnvtx[i] = m_subdirs[i]->make<TH2F>(name,title,60,-0.5,59.5,m_nbins,0.,m_binmax[i]/(m_scalefact*m_nbins)*m_nbins);
      m_nmultvsmcnvtx[i]->GetXaxis()->SetTitle("Pileup Interactions"); m_nmultvsmcnvtx[i]->GetYaxis()->SetTitle("Number of Hits");
      sprintf(name,"n%sdigivsmcnvtxprof",slab.c_str());
      m_nmultvsmcnvtxprof[i] = m_subdirs[i]->make<TProfile>(name,title,60,-0.5,59.5);
      m_nmultvsmcnvtxprof[i]->GetXaxis()->SetTitle("Pileup Interactions");    m_nmultvsmcnvtxprof[i]->GetYaxis()->SetTitle("Number of Hits");
      
    }

  }


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

Definition at line 124 of file DigiPileupCorrHistogramMaker.cc.

References edm::Event::getByLabel(), i, m_labels, m_nmultvsmclumi, m_nmultvsmclumiprof, m_nmultvsmcnvtx, m_nmultvsmcnvtxprof, m_pileupcollection, and m_useVisibleVertices.

Referenced by MultiplicityInvestigator::analyze().

                                                                                                     {
  
  edm::Handle<std::vector<PileupSummaryInfo> > pileupinfos;
  iEvent.getByLabel(m_pileupcollection,pileupinfos);
  
  // look for the intime PileupSummaryInfo
  
  std::vector<PileupSummaryInfo>::const_iterator pileupinfo;
  
  for(pileupinfo = pileupinfos->begin(); pileupinfo != pileupinfos->end() ; ++pileupinfo) {
    
    if(pileupinfo->getBunchCrossing()==0) break;
    
  }
  
  if(pileupinfo->getBunchCrossing()!=0) {
    
    edm::LogError("NoInTimePileUpInfo") << "Cannot find the in-time pileup info " << pileupinfo->getBunchCrossing();
    
  }
  else {
    
    int npileup = pileupinfo->getPU_NumInteractions();

    if(m_useVisibleVertices) npileup = pileupinfo->getPU_zpositions().size();

    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_nmultvsmcnvtx[i]->Fill(npileup,digi->second);
        m_nmultvsmcnvtxprof[i]->Fill(npileup,digi->second);
        m_nmultvsmclumi[i]->Fill(pileupinfo->getTrueNumInteractions(),digi->second);
        m_nmultvsmclumiprof[i]->Fill(pileupinfo->getTrueNumInteractions(),digi->second);
      }
    }
  }
}

Member Data Documentation

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

Definition at line 37 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and DigiPileupCorrHistogramMaker().

Definition at line 34 of file DigiPileupCorrHistogramMaker.h.

Referenced by book().

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

Definition at line 35 of file DigiPileupCorrHistogramMaker.h.

Referenced by book().

std::map<unsigned int,TH2F*> DigiPileupCorrHistogramMaker::m_nmultvsmclumi [private]

Definition at line 40 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

std::map<unsigned int,TProfile*> DigiPileupCorrHistogramMaker::m_nmultvsmclumiprof [private]

Definition at line 41 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

std::map<unsigned int,TH2F*> DigiPileupCorrHistogramMaker::m_nmultvsmcnvtx [private]

Definition at line 42 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

std::map<unsigned int,TProfile*> DigiPileupCorrHistogramMaker::m_nmultvsmcnvtxprof [private]

Definition at line 43 of file DigiPileupCorrHistogramMaker.h.

Referenced by book(), and fill().

Definition at line 32 of file DigiPileupCorrHistogramMaker.h.

Referenced by fill().

Definition at line 36 of file DigiPileupCorrHistogramMaker.h.

Referenced by book().

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

Definition at line 44 of file DigiPileupCorrHistogramMaker.h.

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

Definition at line 33 of file DigiPileupCorrHistogramMaker.h.

Referenced by fill().