Definition at line 22 of file PileUp.h.
edm::PileUp::PileUp |
( |
ParameterSet const & |
pset, |
|
|
int const |
minb, |
|
|
int const |
maxb, |
|
|
double |
averageNumber, |
|
|
TH1F *const |
histo, |
|
|
const bool |
playback |
|
) |
| |
|
explicit |
Definition at line 22 of file PileUp.cc.
References averageNumber_, edm::hlt::Exception, fixed_, fixed_OOT_, edm::RandomNumberGenerator::getEngine(), edm::ParameterSet::getUntrackedParameter(), histoDistribution_, intFixed_OOT_, edm::Service< T >::isAvailable(), manage_OOT_, none_, playback_, poisson_, poisson_OOT_, poissonDistr_OOT_, poissonDistribution_, probFunctionDistribution_, seed_, and type_.
23 type_(
pset.getParameter<std::string>(
"type")),
45 <<
"PileUp requires the RandomNumberGeneratorService\n"
46 "which is not present in the configuration file. You must add the service\n"
47 "in the configuration file or remove the modules that require it.";
50 CLHEP::HepRandomEngine& engine = rng->
getEngine();
55 gRandom->SetSeed(
seed_);
56 LogInfo(
"MixingModule") <<
" Change seed for " <<
type_ <<
" mode. The seed is set to " <<
seed_;
61 throw cms::Exception(
"Illegal parameter value",
"PileUp::PileUp(ParameterSet const& pset)")
62 <<
"'type' parameter (a string) has a value of '" <<
type_ <<
"'.\n"
63 <<
"Legal values are 'poisson', 'fixed', or 'none'\n";
71 <<
" manage_OOT option not allowed with playback ";
73 std::string OOT_type =
pset.getUntrackedParameter<std::string>(
"OOT_type");
75 if(OOT_type ==
"Poisson" || OOT_type ==
"poisson") {
79 else if(OOT_type ==
"Fixed" || OOT_type ==
"fixed") {
84 throw cms::Exception(
"Illegal parameter value",
"PileUp::PileUp(ParameterSet const& pset)")
85 <<
" Fixed out-of-time pileup requested, but no fixed value given ";
89 throw cms::Exception(
"Illegal parameter value",
"PileUp::PileUp(ParameterSet const& pset)")
90 <<
"'OOT_type' parameter (a string) has a value of '" << OOT_type <<
"'.\n"
91 <<
"Legal values are 'poisson' or 'fixed'\n";
93 edm::LogInfo(
"MixingModule") <<
" Out-of-time pileup will be generated with a " << OOT_type <<
" distribution. " ;
T getUntrackedParameter(std::string const &, T const &) const
bool const histoDistribution_
VectorInputSource *const input_
bool const probFunctionDistribution_
double averageNumber() const
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
CLHEP::RandPoisson * poissonDistr_OOT_
double const averageNumber_
CLHEP::RandPoissonQ * poissonDistribution_
Definition at line 103 of file PileUp.cc.
References filterCSVwithJSON::copy, dbtoweb::file, fixed_, histo_, histoDistribution_, i, input_, intAverage_, intFixed_OOT_, j, LogDebug, manage_OOT_, maxBunch_, minBunch_, n, nint(), none_, playback_, poisson_, poisson_OOT_, poissonDistr_OOT_, poissonDistribution_, probFunctionDistribution_, edm::VectorInputSource::readManyRandom(), edm::VectorInputSource::readManySequential(), edm::VectorInputSource::readManySpecified(), sequential_, and findQualityFiles::size.
108 std::vector<int>
nint;
113 int nzero_crossing = -1;
123 double d =
histo_->GetRandom();
125 nzero_crossing = int(d);
156 double d =
histo_->GetRandom();
158 nint.push_back(
int(d) );
171 eventVector.reserve(n);
174 oneResult.reserve(n);
175 std::vector<edm::EventID> oneResultPlayback;
176 oneResultPlayback.reserve(n);
182 for (
int j=0;
j<(int)oneResult.size();
j++){
183 oneResultPlayback.push_back(oneResult[
j]->
id());
189 for (
int j=0;
j<(int)oneResult.size();
j++){
190 oneResultPlayback.push_back(oneResult[
j]->
id());
194 LogDebug(
"readPileup") <<
"READ: " << oneResult.size();
195 std::copy(oneResult.begin(), oneResult.end(), std::back_inserter(eventVector));
196 n -= oneResult.size();
198 result.push_back(eventVector);
bool const histoDistribution_
VectorInputSource *const input_
bool const probFunctionDistribution_
VectorInputSource::EventPrincipalVector EventPrincipalVector
CLHEP::RandPoisson * poissonDistr_OOT_
int nint(float a)
Return the nearest integer - analogous to the FORTRAN intrinsic NINT.
CLHEP::RandPoissonQ * poissonDistribution_
tuple size
Write out results.