9 #ifndef gen_GeneratorFilter_h
10 #define gen_GeneratorFilter_h
39 EndLuminosityBlockProducer,
40 one::WatchLuminosityBlocks,
70 template <
class HAD,
class DEC>
75 nEventsInLumiBlock_(0)
86 std::vector<std::string>
const& sharedResources =
hadronizer_.sharedResources();
87 for(
auto const& resource : sharedResources) {
88 usesResource(resource);
91 if ( ps.
exists(
"ExternalDecays") )
97 std::vector<std::string>
const& sharedResourcesDec = decayer_->sharedResources();
98 for(
auto const& resource : sharedResourcesDec) {
99 usesResource(resource);
104 if(sharedResources.empty() && (!
decayer_ ||
decayer_->sharedResources().empty())) {
108 produces<edm::HepMCProduct>(
"unsmeared");
109 produces<GenEventInfoProduct>();
110 produces<GenLumiInfoProduct, edm::InLumi>();
111 produces<GenRunInfoProduct, edm::InRun>();
115 template <
class HAD,
class DEC>
117 {
if ( decayer_ )
delete decayer_;}
119 template <
class HAD,
class DEC>
128 bool passEvtGenSelector =
false;
129 std::auto_ptr<HepMC::GenEvent>
event(0);
131 while(!passEvtGenSelector)
134 hadronizer_.setEDMEvent(ev);
136 if ( !hadronizer_.generatePartonsAndHadronize() )
return false;
144 if ( !hadronizer_.decay() )
return false;
146 event = std::auto_ptr<HepMC::GenEvent>(hadronizer_.getGenEvent());
147 if ( !event.get() )
return false;
154 event.reset( decayer_->decay( event.get() ) );
156 if ( !event.get() )
return false;
158 passEvtGenSelector = hadronizer_.select( event.get() );
166 hadronizer_.resetEvent( event.release() );
171 if ( !hadronizer_.residualDecay() )
return false;
173 hadronizer_.finalizeEvent();
175 event.reset( hadronizer_.getGenEvent() );
176 if ( !event.get() )
return false;
178 event->set_event_number( ev.
id().
event() );
183 std::auto_ptr<GenEventInfoProduct> genEventInfo(hadronizer_.getGenEventInfo());
184 if (!genEventInfo.get())
189 ev.
put(genEventInfo);
191 std::auto_ptr<HepMCProduct> bare_product(
new HepMCProduct());
192 bare_product->addHepMCData( event.release() );
193 ev.
put(bare_product,
"unsmeared");
194 nEventsInLumiBlock_ ++;
198 template <
class HAD,
class DEC>
207 hadronizer_.statistics();
209 if ( decayer_ ) decayer_->statistics();
211 std::auto_ptr<GenRunInfoProduct> griproduct(
new GenRunInfoProduct(hadronizer_.getGenRunInfo()));
215 template <
class HAD,
class DEC>
219 nEventsInLumiBlock_ = 0;
223 if ( !hadronizer_.readSettings(0) )
225 <<
"Failed to read settings for the hadronizer "
226 << hadronizer_.classname() <<
" \n";
231 if ( !hadronizer_.declareStableParticles( decayer_->operatesOnParticles() ) )
233 <<
"Failed to declare stable particles in hadronizer "
234 << hadronizer_.classname()
236 if ( !hadronizer_.declareSpecialSettings( decayer_->specialSettings() ) )
238 <<
"Failed to declare special settings in hadronizer "
239 << hadronizer_.classname()
243 if ( !hadronizer_.initializeForInternalPartons() )
245 <<
"Failed to initialize hadronizer "
246 << hadronizer_.classname()
247 <<
" for internal parton generation\n";
250 template <
class HAD,
class DEC>
255 template <
class HAD,
class DEC>
259 hadronizer_.statistics();
260 if ( decayer_ ) decayer_->statistics();
263 std::vector<GenLumiInfoProduct::ProcessInfo> GenLumiProcess;
272 temp.
setTried(nEventsInLumiBlock_, nEventsInLumiBlock_, nEventsInLumiBlock_);
273 temp.
setSelected(nEventsInLumiBlock_, nEventsInLumiBlock_, nEventsInLumiBlock_);
274 temp.
setKilled(nEventsInLumiBlock_, nEventsInLumiBlock_, nEventsInLumiBlock_);
277 GenLumiProcess.push_back(temp);
280 genLumiInfo->setHEPIDWTUP(-1);
281 genLumiInfo->setProcessInfo( GenLumiProcess );
282 lumi.
put(genLumiInfo);
284 nEventsInLumiBlock_ = 0;
289 #endif // gen_GeneratorFilter_h
void setNPassNeg(unsigned int n)
T getParameter(std::string const &) const
EventNumber_t event() const
void setTried(unsigned int n, double sum, double sum2)
virtual void endLuminosityBlock(LuminosityBlock const &, EventSetup const &) override
void setNTotalNeg(unsigned int n)
void setSelected(unsigned int n, double sum, double sum2)
virtual bool filter(Event &e, EventSetup const &es) override
LuminosityBlockIndex index() const
void setKilled(unsigned int n, double sum, double sum2)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
GeneratorFilter(ParameterSet const &ps)
void setAccepted(unsigned int n, double sum, double sum2)
void setAcceptedBr(unsigned int n, double sum, double sum2)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
void setNTotalPos(unsigned int n)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
unsigned int nEventsInLumiBlock_
virtual void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &) override
virtual ~GeneratorFilter()
virtual void endRunProduce(Run &, EventSetup const &) override
void setLheXSec(double value, double err)
const XSec & internalXSec() const
StreamID streamID() const
void put(std::auto_ptr< PROD > product)
Put a new product.
virtual void endLuminosityBlockProduce(LuminosityBlock &, EventSetup const &) override
void setNPassPos(unsigned int n)
std::string uniqueSharedResourceName()
void put(std::auto_ptr< PROD > product)
Put a new product.