CMS 3D CMS Logo

Namespaces | Functions
PileUp.cc File Reference
#include "Mixing/Base/interface/PileUp.h"
#include "DataFormats/Provenance/interface/BranchIDListHelper.h"
#include "DataFormats/Provenance/interface/ModuleDescription.h"
#include "DataFormats/Provenance/interface/ThinnedAssociationsHelper.h"
#include "FWCore/Framework/interface/EventPrincipal.h"
#include "FWCore/Framework/interface/LuminosityBlock.h"
#include "FWCore/Framework/interface/Run.h"
#include "FWCore/Framework/src/SignallingProductRegistry.h"
#include "FWCore/Framework/interface/ESRecordsToProxyIndices.h"
#include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
#include "FWCore/ServiceRegistry/interface/ProcessContext.h"
#include "FWCore/Sources/interface/VectorInputSourceDescription.h"
#include "FWCore/Sources/interface/VectorInputSourceFactory.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "FWCore/Utilities/interface/GetPassID.h"
#include "FWCore/Utilities/interface/StreamID.h"
#include "FWCore/Version/interface/GetReleaseVersion.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/Utilities/interface/RandomNumberGenerator.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "Mixing/Base/src/SecondaryEventProvider.h"
#include "CondFormats/DataRecord/interface/MixingRcd.h"
#include "CondFormats/RunInfo/interface/MixingModuleConfig.h"
#include "CLHEP/Random/RandPoissonQ.h"
#include "CLHEP/Random/RandPoisson.h"
#include <algorithm>
#include <memory>
#include "TMath.h"

Go to the source code of this file.

Namespaces

 edm
 HLT enums.
 

Functions

static Double_t GetRandom (TH1 *th1, CLHEP::HepRandomEngine *rng)
 

Function Documentation

◆ GetRandom()

static Double_t GetRandom ( TH1 *  th1,
CLHEP::HepRandomEngine *  rng 
)
static

return a random number distributed according the histogram bin contents.

This routine is derived from root/hist/hist/src/TH1.cxx

Definition at line 48 of file PileUp.cc.

49  {
50  Int_t nbinsx = th1->GetNbinsX();
51  Double_t* fIntegral = th1->GetIntegral();
52  Double_t integral = fIntegral[nbinsx];
53 
54  if (integral == 0)
55  return 0;
56 
57  Double_t r1 = rng->flat();
58  Int_t ibin = TMath::BinarySearch(nbinsx, fIntegral, r1);
59  Double_t x = th1->GetBinLowEdge(ibin + 1);
60  if (r1 > fIntegral[ibin])
61  x += th1->GetBinWidth(ibin + 1) * (r1 - fIntegral[ibin]) / (fIntegral[ibin + 1] - fIntegral[ibin]);
62  return x;

References funct::integral(), diffTwoXMLs::r1, and vertices_cff::x.

Referenced by edm::PileUp::CalculatePileup().

funct::integral
Integral< F, X >::type integral(const F &f)
Definition: Integral.h:70
vertices_cff.x
x
Definition: vertices_cff.py:29
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53