Implementation Pileup code

Pilup code in "EleMETAnalyzer"

@source
 
EleMETAnalyzer::EleMETAnalyzer(const edm::ParameterSet& cfg,WPrimeUtil * wprimeUtil) :
  cuts_(cfg)
{....
pileupLabel_ = cfg.getParameter<string>("pileupTag");
....}

void EleMETAnalyzer::tabulateMe(int cut_index, bool accountMe[], 
            edm::EventBase const& event, int theEle)
{.....
 float weight = wprimeUtil_->getWeight() * wprimeUtil_->getTotalWeight3BX(event,pileupLabel_);
.....}

Pilup code in "WPrimeUtil"

#include "PhysicsTools/Utilities/interface/LumiReWeighting.h"
#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h"
 

void SetLumiWeights(const std::string & MCFile, const std::string & DataFile, 
                      const std::string & MCHist, const std::string & DataHist);
. . . . . . 
void WPrimeUtil::SetLumiWeights(const string & MCFile, const string & DataFile,
                                const string & MCHist, const string & DataHist){
  LumiWeights_ = edm::LumiReWeighting(MCFile, DataFile, MCHist, DataHist);
}
 

definition when 1BX
@header
  float getLumiWeight   (const int   & nInt){ return LumiWeights_.weight   (nInt);}
  int   getPU1BX(const std::vector< PileupSummaryInfo > & PupInfo);
  float getPUWeight1BX(const std::vector< PileupSummaryInfo > & PupInfo);

@source

int WPrimeUtil::getPU1BX(const std::vector< PileupSummaryInfo > & PupInfo){
  std::vector<PileupSummaryInfo>::const_iterator PVI;                       
  for(PVI = PupInfo.begin(); PVI != PupInfo.end(); ++PVI) {               
    if(PVI->getBunchCrossing() == 0){//Only care about in time PU for now 
      return PVI->getPU_NumInteractions();           
    }
  }//Looping over different Bunch Crossings
  return -1;
}

float WPrimeUtil::getPUWeight1BX(const std::vector< PileupSummaryInfo > & PupInfo){
  return LumiWeights_.weight(getPU1BX(PupInfo));
}

definition when 3BX
@header
  float getTotalWeight3BX(edm::EventBase const & event, const std::string& label);
  float getLumiWeight3BX(const float & nInt){ return LumiWeights_.weight3BX(nInt);}
  float getPU3BX(const std::vector< PileupSummaryInfo > & PupInfo);
  float getPUWeight3BX(edm::EventBase const & event, const std::string& label);
  float getPUWeight3BX(const std::vector< PileupSummaryInfo > & PupInfo);

@source

float WPrimeUtil::getTotalWeight3BX(edm::EventBase const & event, const std::string& label){
  return runningOnData() ? getWeight() : getWeight()*getPUWeight3BX(event, label);
}

float WPrimeUtil::getPUWeight3BX(edm::EventBase const & event, const std::string& label){
  std::vector< PileupSummaryInfo > PupInfo = getProduct<std::vector< PileupSummaryInfo > >(event, label);   
  return getPUWeight3BX(PupInfo);
}

float WPrimeUtil::getPU3BX(const std::vector< PileupSummaryInfo > & PupInfo){
  std::vector<PileupSummaryInfo>::const_iterator PVI;
  float sum_nvtx = 0;
  for(PVI = PupInfo.begin(); PVI != PupInfo.end(); ++PVI) {
    float npv = PVI->getPU_NumInteractions();
    sum_nvtx += float(npv);
  }
  return sum_nvtx/3.;//+1, 0, -1 BX
}

float WPrimeUtil::getPUWeight3BX(const std::vector< PileupSummaryInfo > & PupInfo){
  return LumiWeights_.weight3BX( getPU3BX(PupInfo) );
}

Pilup code in "WPrimeFinder"

void WPrimeFinder::getConfiguration(char * cfg_file)
{
.....
  MCPUDistFile_   = cfg.getParameter<string>("MCPUDistFile" );
  MCPUDistHist_   = cfg.getParameter<string>("MCPUDistHist" );
  DataPUDistFile_ = cfg.getParameter<string>("DataPUDistFile" );
  DataPUDistHist_ = cfg.getParameter<string>("DataPUDistHist" );
.....
wprimeUtil->SetLumiWeights(MCPUDistFile_, DataPUDistFile_, MCPUDistHist_, DataPUDistHist_);
.....
}
 

Pilup code in "commonWprime_cfg.py"

.....
    pileupTag  = cms.string('addPileupInfo'),
.....
    #PileUp Inputs
    MCPUDistFile = cms.string('UserCode/CMGWPrimeGroup/root_macros/MCSummer11S4PUDist.root'),
    MCPUDistHist = cms.string('PoissonIntDist'),
    DataPUDistFile = cms.string('UserCode/CMGWPrimeGroup/root_macros/DataPUDist.root'),
    DataPUDistHist = cms.string('pileup'),
.....
 

-- SunghyunChang - 31-Aug-2011

Edit | Attach | Watch | Print version | History: r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r1 - 2011-08-31 - SunghyunChang
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback