40 #include "CLHEP/Random/RandomEngine.h" 41 #include "HepMC/GenEvent.h" 42 #include "HepMC/HeavyIon.h" 59 void endJob()
override ;
87 par_ = iConfig.
getParameter<vector<double> >(
"parameters");
112 CLHEP::HepRandomEngine& engine = rng_->getEngine(iEvent.
streamID());
118 const HepMC::HeavyIon*
hi = evt->heavy_ion();
119 if(!hi)
return false;
121 double b = hi->impact_parameter();
122 double bound = fBias_->Eval(b);
123 double rand = engine.flat();
124 if(rand > bound)
return false;
135 fBias_ =
new TF1(
"fBias",func_.data(),0,20);
137 for(
size_t ip = 0; ip < par_.size(); ++ip){
138 fBias_->SetParameter(ip,par_[ip]);
141 double maxpoint = fBias_->GetMaximum(-0.1,20);
142 if(maxpoint < 0.9)
throw cms::Exception(
"HeavyIonCentralityBias")<<
"Input bias function is not optimized. Peak value is "<<maxpoint<<
" which is required to be close to 1. Please fix the parameters before production."<<endl;
T getParameter(std::string const &) const
HiCentralityBiasFilter(const edm::ParameterSet &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::Service< edm::RandomNumberGenerator > rng_
#define DEFINE_FWK_MODULE(type)
~HiCentralityBiasFilter() override
edm::EDGetTokenT< edm::HepMCProduct > hepmcSrc_
const HepMC::GenEvent * GetEvent() const
StreamID streamID() const
bool filter(edm::Event &, const edm::EventSetup &) override