CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ConversionPostprocessing Class Reference

#include <ConversionPostprocessing.h>

Inheritance diagram for ConversionPostprocessing:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
 ConversionPostprocessing (const edm::ParameterSet &pset)
virtual void endJob ()
virtual void endLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
virtual void endRun (const edm::Run &, const edm::EventSetup &)
virtual ~ConversionPostprocessing ()

Private Member Functions

void dividePlots (MonitorElement *dividend, MonitorElement *numerator, MonitorElement *denominator, std::string type)
void dividePlots (MonitorElement *dividend, MonitorElement *numerator, double denominator)
virtual void runPostprocessing ()

Private Attributes

bool batch_
MonitorElementconvEffEtaTwoTracks_
MonitorElementconvEffEtaTwoTracksAndVtxProbGT0005_
MonitorElementconvEffEtaTwoTracksAndVtxProbGT0_
MonitorElementconvEffEtTwoTracks_
MonitorElementconvEffPhiTwoTracks_
MonitorElementconvEffRTwoTracks_
MonitorElementconvEffRTwoTracksAndVtxProbGT0005_
MonitorElementconvEffRTwoTracksAndVtxProbGT0_
MonitorElementconvEffZTwoTracks_
MonitorElementconvFakeRateEtaTwoTracks_
MonitorElementconvFakeRateEtTwoTracks_
MonitorElementconvFakeRatePhiTwoTracks_
MonitorElementconvFakeRateRTwoTracks_
MonitorElementconvFakeRateZTwoTracks_
std::stringstream currentFolder_
DQMStoredbe_
int etaBin
int etaBin2
double etaMax
double etaMin
int etBin
double etMax
double etMin
std::string inputFileName_
std::string outputFileName_
edm::ParameterSet parameters_
int phiBin
double phiMax
double phiMin
int rBin
double rMax
double rMin
bool standAlone_
int verbosity_
int zBin
double zMax
double zMin

Detailed Description

$Id: ConversionPostprocessing

Date:
2012/10/09 15:20:54

author: Nancy Marinelli, U. of Notre Dame, US

$Id: ConversionPostprocessing

Date:
2011/05/20 13:55:42

authors: Nancy Marinelli, U. of Notre Dame, US

Definition at line 53 of file ConversionPostprocessing.h.


Constructor & Destructor Documentation

ConversionPostprocessing::ConversionPostprocessing ( const edm::ParameterSet pset) [explicit]

Definition at line 24 of file ConversionPostprocessing.cc.

References dbe_, jptDQMConfig_cff::etaMax, jptDQMConfig_cff::etaMin, jptDQMConfig_cff::etMax, reco::tau::qcuts::etMin(), edm::ParameterSet::getParameter(), cppFunctionSkipper::operator, jptDQMConfig_cff::phiMax, jptDQMConfig_cff::phiMin, and DQMStore::setVerbose().

{

  dbe_ = 0;
  dbe_ = edm::Service<DQMStore>().operator->();
  dbe_->setVerbose(0);
  parameters_ = pset;


  standAlone_ = pset.getParameter<bool>("standAlone");
  batch_ = pset.getParameter<bool>("batch");
  outputFileName_ = pset.getParameter<string>("OutputFileName");
  inputFileName_  = pset.getParameter<std::string>("InputFileName");


  etMin = parameters_.getParameter<double>("etMin");
  etMax = parameters_.getParameter<double>("etMax");
  etBin = parameters_.getParameter<int>("etBin");

  etaMin = parameters_.getParameter<double>("etaMin");
  etaMax = parameters_.getParameter<double>("etaMax");
  etaBin = parameters_.getParameter<int>("etaBin");
  etaBin2 = parameters_.getParameter<int>("etaBin2");

  phiMin = parameters_.getParameter<double>("phiMin");
  phiMax = parameters_.getParameter<double>("phiMax");
  phiBin = parameters_.getParameter<int>("phiBin");

  rMin = parameters_.getParameter<double>("rMin");
  rMax = parameters_.getParameter<double>("rMax");
  rBin = parameters_.getParameter<int>("rBin");

  zMin = parameters_.getParameter<double>("zMin");
  zMax = parameters_.getParameter<double>("zMax");
  zBin = parameters_.getParameter<int>("zBin");



}
ConversionPostprocessing::~ConversionPostprocessing ( ) [virtual]

Definition at line 66 of file ConversionPostprocessing.cc.

{}

Member Function Documentation

void ConversionPostprocessing::analyze ( const edm::Event e,
const edm::EventSetup esup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 74 of file ConversionPostprocessing.cc.

{}
void ConversionPostprocessing::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 69 of file ConversionPostprocessing.cc.

{

}
void ConversionPostprocessing::dividePlots ( MonitorElement dividend,
MonitorElement numerator,
double  denominator 
) [private]

Definition at line 205 of file ConversionPostprocessing.cc.

References MonitorElement::getBinContent(), MonitorElement::getNbinsX(), j, MonitorElement::setBinContent(), MonitorElement::setBinError(), mathSSE::sqrt(), and relativeConstraints::value.

                                                                                                                  {
  double value,err;

  //quick fix to avoid seg. faults due to null pointers.
  if (dividend==0 || numerator==0 )return;

  for (int j=1; j<=numerator->getNbinsX(); j++){
    if (denominator!=0){
      value = ((double) numerator->getBinContent(j))/denominator;
      err = sqrt( value*(1-value) / denominator);
      dividend->setBinContent(j, value);
      dividend->setBinError(j,err);
    }
    else {
      dividend->setBinContent(j, 0);
    }
  }

}
void ConversionPostprocessing::dividePlots ( MonitorElement dividend,
MonitorElement numerator,
MonitorElement denominator,
std::string  type 
) [private]

Definition at line 176 of file ConversionPostprocessing.cc.

References MonitorElement::getBinContent(), MonitorElement::getNbinsX(), j, MonitorElement::setBinContent(), MonitorElement::setBinError(), mathSSE::sqrt(), and relativeConstraints::value.

                                                                                                                                            {
  double value,err;
  
  //quick fix to avoid seg. faults due to null pointers.
  if (dividend==0 || numerator==0 || denominator==0)return;

  for (int j=1; j<=numerator->getNbinsX(); j++){

    if (denominator->getBinContent(j)!=0){
      if (type=="effic")
        value = ((double) numerator->getBinContent(j))/((double) denominator->getBinContent(j));
      else if (type=="fakerate")
        value = 1-((double) numerator->getBinContent(j))/((double) denominator->getBinContent(j));
      else return;
      err = sqrt( value*(1-value) / ((double) denominator->getBinContent(j)) );
      dividend->setBinContent(j, value);
      if ( err !=0 ) dividend->setBinError(j,err);
    }
    else {
      dividend->setBinContent(j, 0);
      dividend->setBinError(j,0);
    }

  }


}
void ConversionPostprocessing::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 78 of file ConversionPostprocessing.cc.

void ConversionPostprocessing::endLuminosityBlock ( const edm::LuminosityBlock lumi,
const edm::EventSetup setup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 168 of file ConversionPostprocessing.cc.

{


}
void ConversionPostprocessing::endRun ( const edm::Run run,
const edm::EventSetup setup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 84 of file ConversionPostprocessing.cc.

void ConversionPostprocessing::runPostprocessing ( ) [private, virtual]

Definition at line 92 of file ConversionPostprocessing.cc.

References DQMStore::book1D(), dbe_, jptDQMConfig_cff::etaMax, jptDQMConfig_cff::etaMin, jptDQMConfig_cff::etMax, reco::tau::qcuts::etMin(), DQMStore::get(), DQMStore::open(), jptDQMConfig_cff::phiMax, jptDQMConfig_cff::phiMin, DQMStore::save(), and DQMStore::setCurrentFolder().

{



  std::string simInfoPathName = "EgammaV/ConversionValidator/SimulationInfo/";
  std::string convPathName    = "EgammaV/ConversionValidator/ConversionInfo/";
  std::string effPathName     = "EgammaV/ConversionValidator/EfficienciesAndFakeRate/";


  if(batch_)  dbe_->open(inputFileName_);

  dbe_->setCurrentFolder(effPathName);
  // Conversion reconstruction efficiency
  std::string histname = "convEffVsEtaTwoTracks";
  convEffEtaTwoTracks_ =  dbe_->book1D(histname,histname,etaBin2,etaMin, etaMax);

  histname = "convEffVsPhiTwoTracks";
  convEffPhiTwoTracks_ =  dbe_->book1D(histname,histname,phiBin,phiMin,phiMax);

  histname = "convEffVsRTwoTracks";
  convEffRTwoTracks_ =  dbe_->book1D(histname,histname,rBin,rMin, rMax);

  histname = "convEffVsZTwoTracks";
  convEffZTwoTracks_ =  dbe_->book1D(histname,histname,zBin,zMin,zMax);

  histname = "convEffVsEtTwoTracks";
  convEffEtTwoTracks_ =  dbe_->book1D(histname,histname,etBin,etMin, etMax);
  //
  histname = "convEffVsEtaTwoTracksAndVtxProbGT0";
  convEffEtaTwoTracksAndVtxProbGT0_ =  dbe_->book1D(histname,histname,etaBin2,etaMin, etaMax);
  histname = "convEffVsEtaTwoTracksAndVtxProbGT0005";
  convEffEtaTwoTracksAndVtxProbGT0005_ =  dbe_->book1D(histname,histname,etaBin2,etaMin, etaMax);
  histname = "convEffVsRTwoTracksAndVtxProbGT0";
  convEffRTwoTracksAndVtxProbGT0_ =  dbe_->book1D(histname,histname,rBin,rMin,rMax);
  histname = "convEffVsRTwoTracksAndVtxProbGT0005";
  convEffRTwoTracksAndVtxProbGT0005_ =  dbe_->book1D(histname,histname,rBin,rMin,rMax);
  //
  // Fake rate
  histname = "convFakeRateVsEtaTwoTracks";
  convFakeRateEtaTwoTracks_ =  dbe_->book1D(histname,histname,etaBin2,etaMin, etaMax);
  histname = "convFakeRateVsPhiTwoTracks";
  convFakeRatePhiTwoTracks_ =  dbe_->book1D(histname,histname,phiBin,phiMin,phiMax);
  histname = "convFakeRateVsRTwoTracks";
  convFakeRateRTwoTracks_ =  dbe_->book1D(histname,histname,rBin,rMin, rMax);
  histname = "convFakeRateVsZTwoTracks";
  convFakeRateZTwoTracks_ =  dbe_->book1D(histname,histname,zBin,zMin,zMax);
  histname = "convFakeRateVsEtTwoTracks";
  convFakeRateEtTwoTracks_ =  dbe_->book1D(histname,histname,etBin,etMin, etMax);

  // efficiencies
  dividePlots(dbe_->get(effPathName+"convEffVsEtaTwoTracks"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksEta"),dbe_->get(simInfoPathName+"h_VisSimConvEta"),"effic");
  dividePlots(dbe_->get(effPathName+"convEffVsPhiTwoTracks"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksPhi"),dbe_->get(simInfoPathName+"h_VisSimConvPhi"),"effic");
  dividePlots(dbe_->get(effPathName+"convEffVsRTwoTracks"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksR"),dbe_->get(simInfoPathName+"h_VisSimConvR"),"effic");
  dividePlots(dbe_->get(effPathName+"convEffVsZTwoTracks"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksZ"),dbe_->get(simInfoPathName+"h_VisSimConvZ"),"effic");
  dividePlots(dbe_->get(effPathName+"convEffVsEtTwoTracks"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksEt"),dbe_->get(simInfoPathName+"h_VisSimConvEt"),"effic");
  dividePlots(dbe_->get(effPathName+"convEffVsEtaTwoTracksAndVtxProbGT0"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksEtaAndVtxPGT0"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksEta"),"effic");
  dividePlots(dbe_->get(effPathName+"convEffVsEtaTwoTracksAndVtxProbGT0005"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksEtaAndVtxPGT0005"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksEta"),"effic");
  dividePlots(dbe_->get(effPathName+"convEffVsRTwoTracksAndVtxProbGT0"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksRAndVtxPGT0"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksR"),"effic");
  dividePlots(dbe_->get(effPathName+"convEffVsRTwoTracksAndVtxProbGT0005"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksRAndVtxPGT0005"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksR"),"effic");


  // fake rate
  dividePlots(dbe_->get(effPathName+"convFakeRateVsEtaTwoTracks"),dbe_->get(convPathName+"convEtaAss2"),dbe_->get(convPathName+"convEta2"),"fakerate");
  dividePlots(dbe_->get(effPathName+"convFakeRateVsPhiTwoTracks"),dbe_->get(convPathName+"convPhiAss"),dbe_->get(convPathName+"convPhi"),"fakerate");
  dividePlots(dbe_->get(effPathName+"convFakeRateVsRTwoTracks"),dbe_->get(convPathName+"convRAss"),dbe_->get(convPathName+"convR"),"fakerate");
  dividePlots(dbe_->get(effPathName+"convFakeRateVsZTwoTracks"),dbe_->get(convPathName+"convZAss"),dbe_->get(convPathName+"convZ"),"fakerate");
  dividePlots(dbe_->get(effPathName+"convFakeRateVsEtTwoTracks"),dbe_->get(convPathName+"convPtAss"),dbe_->get(convPathName+"convPt"),"fakerate");



  if(standAlone_) dbe_->save(outputFileName_);
  else if(batch_) dbe_->save(inputFileName_);
}

Member Data Documentation

Definition at line 84 of file ConversionPostprocessing.h.

Definition at line 110 of file ConversionPostprocessing.h.

Definition at line 117 of file ConversionPostprocessing.h.

Definition at line 116 of file ConversionPostprocessing.h.

Definition at line 114 of file ConversionPostprocessing.h.

Definition at line 111 of file ConversionPostprocessing.h.

Definition at line 112 of file ConversionPostprocessing.h.

Definition at line 119 of file ConversionPostprocessing.h.

Definition at line 118 of file ConversionPostprocessing.h.

Definition at line 113 of file ConversionPostprocessing.h.

Definition at line 122 of file ConversionPostprocessing.h.

Definition at line 126 of file ConversionPostprocessing.h.

Definition at line 123 of file ConversionPostprocessing.h.

Definition at line 124 of file ConversionPostprocessing.h.

Definition at line 125 of file ConversionPostprocessing.h.

std::stringstream ConversionPostprocessing::currentFolder_ [private]

Definition at line 88 of file ConversionPostprocessing.h.

Definition at line 78 of file ConversionPostprocessing.h.

Definition at line 96 of file ConversionPostprocessing.h.

Definition at line 97 of file ConversionPostprocessing.h.

Definition at line 95 of file ConversionPostprocessing.h.

Definition at line 94 of file ConversionPostprocessing.h.

Definition at line 93 of file ConversionPostprocessing.h.

Definition at line 92 of file ConversionPostprocessing.h.

Definition at line 91 of file ConversionPostprocessing.h.

Definition at line 86 of file ConversionPostprocessing.h.

Definition at line 85 of file ConversionPostprocessing.h.

Definition at line 81 of file ConversionPostprocessing.h.

Definition at line 100 of file ConversionPostprocessing.h.

Definition at line 99 of file ConversionPostprocessing.h.

Definition at line 98 of file ConversionPostprocessing.h.

Definition at line 103 of file ConversionPostprocessing.h.

Definition at line 102 of file ConversionPostprocessing.h.

Definition at line 101 of file ConversionPostprocessing.h.

Definition at line 83 of file ConversionPostprocessing.h.

Definition at line 79 of file ConversionPostprocessing.h.

Definition at line 106 of file ConversionPostprocessing.h.

Definition at line 105 of file ConversionPostprocessing.h.

Definition at line 104 of file ConversionPostprocessing.h.