1 #ifndef Mixing_Base_PileUp_h 2 #define Mixing_Base_PileUp_h 23 class HepRandomEngine;
27 class SecondaryEventProvider;
33 : sourcename_(sourcename), averageNumber_(averageNumber), histo_(histo.
release()), playback_(playback) {}
46 void readPileUp(
edm::EventID const& signal, std::vector<edm::SecondaryEventIDAndFileInfo>& ids,
T eventOperator,
int const NumPU,
StreamID const&);
49 void playPileUp(std::vector<edm::SecondaryEventIDAndFileInfo>::const_iterator
begin, std::vector<edm::SecondaryEventIDAndFileInfo>::const_iterator
end, std::vector<edm::SecondaryEventIDAndFileInfo>& ids,
T eventOperator);
52 void playOldFormatPileUp(std::vector<edm::EventID>::const_iterator begin, std::vector<edm::EventID>::const_iterator end, std::vector<edm::SecondaryEventIDAndFileInfo>& ids,
T eventOperator);
57 if(Source_type_ !=
"cosmics") {
58 return none_ ?
false : averageNumber_>0.;
61 return ( BX >= minBunch_cosmics_ && BX <= maxBunch_cosmics_);
65 input_->dropUnwantedBranches(wantedBranches);
80 void CalculatePileup(
int MinBunch,
int MaxBunch, std::vector<int>& PileupSelection, std::vector<float>& TrueNumInteractions,
StreamID const&);
86 const unsigned int &
input()
const{
return inputType_;}
91 std::unique_ptr<CLHEP::RandPoissonQ>
const& poissonDistribution(
StreamID const& streamID);
92 std::unique_ptr<CLHEP::RandPoisson>
const& poissonDistr_OOT(
StreamID const& streamID);
122 std::unique_ptr<VectorInputSource>
const input_;
151 std::vector<edm::SecondaryEventIDAndFileInfo>&
ids_;
155 RecordEventID(std::vector<edm::SecondaryEventIDAndFileInfo>& ids,
T& eventOperator)
156 : ids_(ids), eventOperator_(eventOperator), eventCount(0) {
159 ids_.emplace_back(eventPrincipal.
id(), fileNameHash);
160 eventOperator_(eventPrincipal, ++eventCount);
176 PileUp::readPileUp(
edm::EventID const& signal, std::vector<edm::SecondaryEventIDAndFileInfo>& ids,
T eventOperator,
177 int const pileEventCnt,
StreamID const& streamID) {
181 ids.reserve(pileEventCnt);
184 CLHEP::HepRandomEngine* engine = (sequential_ ?
nullptr :
randomEngine(streamID));
185 read = input_->loopOverEvents(*eventPrincipal_, fileNameHash_, pileEventCnt, recorder, engine, &signal);
186 if (read != pileEventCnt)
187 edm::LogWarning(
"PileUp") <<
"Could not read enough pileup events: only " << read <<
" out of " << pileEventCnt <<
" requested.";
192 PileUp::playPileUp(std::vector<edm::SecondaryEventIDAndFileInfo>::const_iterator
begin, std::vector<edm::SecondaryEventIDAndFileInfo>::const_iterator
end, std::vector<edm::SecondaryEventIDAndFileInfo>& ids,
T eventOperator) {
195 input_->loopSpecified(*eventPrincipal_, fileNameHash_, begin, end, recorder);
200 PileUp::playOldFormatPileUp(std::vector<edm::EventID>::const_iterator
begin, std::vector<edm::EventID>::const_iterator
end, std::vector<edm::SecondaryEventIDAndFileInfo>& ids,
T eventOperator) {
203 input_->loopSpecified(*eventPrincipal_, fileNameHash_, begin, end, recorder);
CLHEP::HepRandomEngine * randomEngine
const unsigned int & input() const
std::unique_ptr< SecondaryEventProvider > provider_
void operator()(EventPrincipal const &eventPrincipal, size_t fileNameHash)
std::shared_ptr< ProcessConfiguration > processConfiguration_
std::shared_ptr< TH1F > histo_
void dropUnwantedBranches(std::vector< std::string > const &wantedBranches)
EventID const & id() const
def setup(process, global_tag, zero_tesla=False)
std::shared_ptr< TH1F > histo_
bool probFunctionDistribution_
RecordEventID(std::vector< edm::SecondaryEventIDAndFileInfo > &ids, T &eventOperator)
double averageNumber() const
std::unique_ptr< VectorInputSource > const input_
void input(unsigned int s)
std::unique_ptr< CLHEP::RandPoisson > PoissonDistr_OOT_
CLHEP::HepRandomEngine * randomEngine_
std::shared_ptr< LuminosityBlockPrincipal > lumiPrincipal_
std::vector< edm::SecondaryEventIDAndFileInfo > & ids_
std::shared_ptr< ProductRegistry > productRegistry_
std::unique_ptr< CLHEP::RandPoissonQ > PoissonDistribution_
std::shared_ptr< ProcessContext > processContext_
std::unique_ptr< EventPrincipal > eventPrincipal_
std::shared_ptr< RunPrincipal > runPrincipal_
std::shared_ptr< StreamContext > streamContext_
PileUpConfig(std::string sourcename, double averageNumber, std::unique_ptr< TH1F > &histo, const bool playback)