CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
FFTJetPileupEstimator Class Reference

#include <RecoJets/FFTJetProducers/plugins/FFTJetPileupEstimator.cc>

Inheritance diagram for FFTJetPileupEstimator:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 FFTJetPileupEstimator (const edm::ParameterSet &)
 
 ~FFTJetPileupEstimator ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Protected Member Functions

void beginJob ()
 
void endJob ()
 
void produce (edm::Event &, const edm::EventSetup &)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Private Member Functions

template<class Ptr >
void checkConfig (const Ptr &ptr, const char *message)
 
 FFTJetPileupEstimator ()
 
 FFTJetPileupEstimator (const FFTJetPileupEstimator &)
 
FFTJetPileupEstimatoroperator= (const FFTJetPileupEstimator &)
 

Private Attributes

std::auto_ptr
< fftjet::Functor1< double,
double > > 
calibrationCurve
 
double cdfvalue
 
unsigned filterNumber
 
edm::InputTag inputLabel
 
std::string outputLabel
 
double ptToDensityFactor
 
std::auto_ptr
< fftjet::Functor1< double,
double > > 
uncertaintyCurve
 
std::vector< double > uncertaintyZones
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Description: estimates the actual pileup

Implementation: [Notes on implementation]

Definition at line 43 of file FFTJetPileupEstimator.cc.

Constructor & Destructor Documentation

FFTJetPileupEstimator::FFTJetPileupEstimator ( const edm::ParameterSet ps)
explicit

Definition at line 80 of file FFTJetPileupEstimator.cc.

References calibrationCurve, checkConfig(), fftjetcms::fftjet_Function_parser(), edm::ParameterSet::getParameter(), outputLabel, and uncertaintyCurve.

82  init_param(std::string, outputLabel),
83  init_param(double, cdfvalue),
85  init_param(unsigned, filterNumber),
86  init_param(std::vector<double>, uncertaintyZones)
87 {
89  ps.getParameter<edm::ParameterSet>("calibrationCurve"));
90  checkConfig(calibrationCurve, "bad calibration curve definition");
91 
93  ps.getParameter<edm::ParameterSet>("uncertaintyCurve"));
94  checkConfig(uncertaintyCurve, "bad uncertainty curve definition");
95 
96  produces<reco::FFTJetPileupSummary>(outputLabel);
97 }
T getParameter(std::string const &) const
std::auto_ptr< fftjet::Functor1< double, double > > calibrationCurve
std::auto_ptr< fftjet::Functor1< double, double > > fftjet_Function_parser(const edm::ParameterSet &ps)
std::vector< double > uncertaintyZones
std::auto_ptr< fftjet::Functor1< double, double > > uncertaintyCurve
#define init_param(type, varname)
void checkConfig(const Ptr &ptr, const char *message)
FFTJetPileupEstimator::~FFTJetPileupEstimator ( )

Definition at line 100 of file FFTJetPileupEstimator.cc.

101 {
102 }
FFTJetPileupEstimator::FFTJetPileupEstimator ( )
private
FFTJetPileupEstimator::FFTJetPileupEstimator ( const FFTJetPileupEstimator )
private

Member Function Documentation

void FFTJetPileupEstimator::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDProducer.

Definition at line 171 of file FFTJetPileupEstimator.cc.

172 {
173 }
template<class Ptr >
void FFTJetPileupEstimator::checkConfig ( const Ptr &  ptr,
const char *  message 
)
inlineprivate

Definition at line 61 of file FFTJetPileupEstimator.cc.

References NULL.

Referenced by FFTJetPileupEstimator().

62  {
63  if (ptr.get() == NULL)
64  throw cms::Exception("FFTJetBadConfig") << message << std::endl;
65  }
#define NULL
Definition: scimark2.h:8
void FFTJetPileupEstimator::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDProducer.

Definition at line 176 of file FFTJetPileupEstimator.cc.

177 {
178 }
FFTJetPileupEstimator& FFTJetPileupEstimator::operator= ( const FFTJetPileupEstimator )
private
void FFTJetPileupEstimator::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
protectedvirtual

Implements edm::EDProducer.

Definition at line 109 of file FFTJetPileupEstimator.cc.

References cdfvalue, edm::hlt::Exception, filterNumber, edm::Event::getByLabel(), h, i, LaserDQM_cfg::input, inputLabel, outputLabel, ptToDensityFactor, edm::Event::put(), edmLumisInFiles::summary, and uncertaintyZones.

111 {
113  iEvent.getByLabel(inputLabel, input);
114 
115  const TH2D& h(*input);
116  const unsigned nScales = h.GetXaxis()->GetNbins();
117  const unsigned nCdfvalues = h.GetYaxis()->GetNbins();
118 
119  const unsigned fixedCdfvalueBin = static_cast<unsigned>(
120  std::floor(cdfvalue*nCdfvalues));
121  if (fixedCdfvalueBin >= nCdfvalues)
122  {
123  throw cms::Exception("FFTJetBadConfig")
124  << "Bad cdf value" << std::endl;
125  }
126  if (filterNumber >= nScales)
127  {
128  throw cms::Exception("FFTJetBadConfig")
129  << "Bad filter number" << std::endl;
130  }
131 
132  // Simple fixed-point pile-up estimate
133  const double curve = h.GetBinContent(filterNumber+1U,
134  fixedCdfvalueBin+1U);
135  const double pileupRho = ptToDensityFactor*(*calibrationCurve)(curve);
136  const double rhoUncert = ptToDensityFactor*(*uncertaintyCurve)(curve);
137 
138  // Determine the uncertainty zone of the estimate. The "curve"
139  // has to be above or equal to uncertaintyZones[i] but below
140  // uncertaintyZones[i + 1] (the second condition is also satisfied
141  // by i == uncertaintyZones.size() - 1). Of course, it is assumed
142  // that the vector of zones is configured appropriately -- the zone
143  // boundaries must be presented in the increasing order.
144  int uncertaintyCode = -1;
145  if (!uncertaintyZones.empty())
146  {
147  const unsigned nZones = uncertaintyZones.size();
148  for (unsigned i = 0; i < nZones; ++i)
149  if (curve >= uncertaintyZones[i])
150  {
151  if (i == nZones - 1U)
152  {
153  uncertaintyCode = i;
154  break;
155  }
156  else if (curve < uncertaintyZones[i + 1])
157  {
158  uncertaintyCode = i;
159  break;
160  }
161  }
162  }
163 
164  std::auto_ptr<reco::FFTJetPileupSummary> summary(
165  new reco::FFTJetPileupSummary(curve, pileupRho,
166  rhoUncert, uncertaintyCode));
167  iEvent.put(summary, outputLabel);
168 }
int i
Definition: DBlmapReader.cc:9
Summary info for pile-up determined by Gaussian filtering.
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
std::vector< double > uncertaintyZones
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

Member Data Documentation

std::auto_ptr<fftjet::Functor1<double,double> > FFTJetPileupEstimator::calibrationCurve
private

Definition at line 73 of file FFTJetPileupEstimator.cc.

Referenced by FFTJetPileupEstimator().

double FFTJetPileupEstimator::cdfvalue
private

Definition at line 69 of file FFTJetPileupEstimator.cc.

Referenced by produce().

unsigned FFTJetPileupEstimator::filterNumber
private

Definition at line 71 of file FFTJetPileupEstimator.cc.

Referenced by produce().

edm::InputTag FFTJetPileupEstimator::inputLabel
private

Definition at line 67 of file FFTJetPileupEstimator.cc.

Referenced by produce().

std::string FFTJetPileupEstimator::outputLabel
private

Definition at line 68 of file FFTJetPileupEstimator.cc.

Referenced by FFTJetPileupEstimator(), and produce().

double FFTJetPileupEstimator::ptToDensityFactor
private

Definition at line 70 of file FFTJetPileupEstimator.cc.

Referenced by produce().

std::auto_ptr<fftjet::Functor1<double,double> > FFTJetPileupEstimator::uncertaintyCurve
private

Definition at line 74 of file FFTJetPileupEstimator.cc.

Referenced by FFTJetPileupEstimator().

std::vector<double> FFTJetPileupEstimator::uncertaintyZones
private

Definition at line 72 of file FFTJetPileupEstimator.cc.

Referenced by produce().