CMS 3D CMS Logo

ConcurrentHadronizerFilter.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 //
4 
5 // class template ConcurrentHadronizerFilter<HAD> provides an EDFilter which uses
6 // the hadronizer type HAD to read in external partons and hadronize them,
7 // and decay the resulting particles, in the CMS framework.
8 
9 #ifndef GeneratorInterface_Core_ConcurrentHadronizerFilter_h
10 #define GeneratorInterface_Core_ConcurrentHadronizerFilter_h
11 
12 #include <memory>
13 #include <string>
14 #include <vector>
15 #include <atomic>
16 
31 #include "CLHEP/Random/RandomEngine.h"
32 
34 
35 // LHE Run
38 
39 // LHE Event
42 
48 
49 namespace edm {
50  namespace gen {
51  struct RunCache {
52  mutable std::atomic<GenRunInfoProduct*> product_{nullptr};
53  ~RunCache() { delete product_.load(); }
54 
55  //This is called from globalEndRunProduce which is known to
56  // be safe as the framework would not be calling any other
57  // methods of this module using this run at that time
58  std::unique_ptr<GenRunInfoProduct> release() const noexcept {
59  auto retValue = product_.load();
60  product_.store(nullptr);
61  return std::unique_ptr<GenRunInfoProduct>(retValue);
62  }
63  };
64  struct LumiSummary {
65  mutable std::unique_ptr<GenLumiInfoProduct> lumiInfo_;
66  mutable std::unique_ptr<GenFilterInfo> filterInfo_;
67  };
68  template <typename HAD, typename DEC>
69  struct StreamCache {
70  StreamCache(ParameterSet const& iPSet) : hadronizer_{iPSet} {}
72  std::unique_ptr<DEC> decayer_;
73  std::unique_ptr<HepMCFilterDriver> filter_;
74  bool initialized_ = false;
75  };
76  } // namespace gen
77 
78  template <class HAD, class DEC>
79  class ConcurrentHadronizerFilter : public global::EDFilter<EndRunProducer,
80  BeginLuminosityBlockProducer,
81  EndLuminosityBlockProducer,
82  RunCache<gen::RunCache>,
83  LuminosityBlockSummaryCache<gen::LumiSummary>,
84  StreamCache<gen::StreamCache<HAD, DEC>>> {
85  public:
86  typedef HAD Hadronizer;
87  typedef DEC Decayer;
88 
89  // The given ParameterSet will be passed to the contained
90  // Hadronizer object.
91  explicit ConcurrentHadronizerFilter(ParameterSet const& ps);
92 
93  std::unique_ptr<gen::StreamCache<HAD, DEC>> beginStream(edm::StreamID) const override;
94  bool filter(StreamID id, Event& e, EventSetup const& es) const override;
95  void streamBeginRun(StreamID, Run const&, EventSetup const&) const override;
96  void streamEndRun(StreamID, Run const&, EventSetup const&) const override;
97  std::shared_ptr<gen::RunCache> globalBeginRun(edm::Run const&, edm::EventSetup const&) const override;
98  void globalEndRun(edm::Run const&, edm::EventSetup const&) const override;
99  void globalEndRunProduce(Run&, EventSetup const&) const override;
100  void streamBeginLuminosityBlock(StreamID, LuminosityBlock const&, EventSetup const&) const override;
101  void globalBeginLuminosityBlockProduce(LuminosityBlock&, EventSetup const&) const override;
102  void streamEndLuminosityBlockSummary(StreamID,
103  LuminosityBlock const&,
104  EventSetup const&,
105  gen::LumiSummary*) const override;
106  std::shared_ptr<gen::LumiSummary> globalBeginLuminosityBlockSummary(edm::LuminosityBlock const&,
107  edm::EventSetup const&) const override;
108  void globalEndLuminosityBlockSummary(edm::LuminosityBlock const&,
109  edm::EventSetup const&,
110  gen::LumiSummary*) const override;
111  void globalEndLuminosityBlockProduce(LuminosityBlock&, EventSetup const&, gen::LumiSummary const*) const override;
112 
113  private:
114  void initLumi(gen::StreamCache<HAD, DEC>* cache, LuminosityBlock const& index, EventSetup const& es) const;
120  unsigned int nAttempts_;
121  mutable std::atomic<gen::StreamCache<HAD, DEC>*> useInLumi_{nullptr};
122  bool const hasFilter_;
123  };
124 
125  //------------------------------------------------------------------------
126  //
127  // Implementation
128 
129  template <class HAD, class DEC>
131  : config_(ps),
132  runInfoProductTag_(),
133  runInfoProductToken_(),
134  eventProductToken_(),
135  counterRunInfoProducts_(0),
136  nAttempts_(1),
137  hasFilter_(ps.exists("HepMCFilter")) {
138  auto ptrThis = this;
139  this->callWhenNewProductsRegistered([ptrThis](BranchDescription const& iBD) {
140  //this is called each time a module registers that it will produce a LHERunInfoProduct
141  if (iBD.unwrappedTypeID() == edm::TypeID(typeid(LHERunInfoProduct)) && iBD.branchType() == InRun) {
142  ++(ptrThis->counterRunInfoProducts_);
143  ptrThis->eventProductToken_ = ptrThis->template consumes<LHEEventProduct>(
144  InputTag((iBD.moduleLabel() == "externalLHEProducer") ? "externalLHEProducer" : "source"));
145  ptrThis->runInfoProductTag_ = InputTag(iBD.moduleLabel(), iBD.productInstanceName(), iBD.processName());
146  ptrThis->runInfoProductToken_ = ptrThis->template consumes<LHERunInfoProduct, InRun>(
147  InputTag(iBD.moduleLabel(), iBD.productInstanceName(), iBD.processName()));
148  }
149  });
150 
151  // TODO:
152  // Put the list of types produced by the filters here.
153  // The current design calls for:
154  // * LHEGeneratorInfo
155  // * LHEEvent
156  // * HepMCProduct
157  // But I can not find the LHEGeneratorInfo class; it might need to
158  // be invented.
159 
160  //initialize setting for multiple hadronization attempts
161  if (ps.exists("nAttempts")) {
162  nAttempts_ = ps.getParameter<unsigned int>("nAttempts");
163  }
164 
165  this->template produces<edm::HepMCProduct>("unsmeared");
166  this->template produces<GenEventInfoProduct>();
167  this->template produces<GenLumiInfoHeader, edm::Transition::BeginLuminosityBlock>();
168  this->template produces<GenLumiInfoProduct, edm::Transition::EndLuminosityBlock>();
169  this->template produces<GenRunInfoProduct, edm::Transition::EndRun>();
170  if (hasFilter_)
171  this->template produces<GenFilterInfo, edm::Transition::EndLuminosityBlock>();
172  }
173 
174  template <class HAD, class DEC>
175  std::unique_ptr<gen::StreamCache<HAD, DEC>> ConcurrentHadronizerFilter<HAD, DEC>::beginStream(edm::StreamID) const {
176  auto cache = std::make_unique<gen::StreamCache<HAD, DEC>>(config_);
177 
178  if (config_.exists("ExternalDecays")) {
179  ParameterSet ps1 = config_.getParameter<ParameterSet>("ExternalDecays");
180  cache->decayer_.reset(new Decayer(ps1));
181  }
182 
183  if (config_.exists("HepMCFilter")) {
184  ParameterSet psfilter = config_.getParameter<ParameterSet>("HepMCFilter");
185  cache->filter_.reset(new HepMCFilterDriver(psfilter));
186  }
187 
188  //We need a hadronizer during globalBeginLumiProduce, doesn't matter which one
189  gen::StreamCache<HAD, DEC>* expected = nullptr;
190  useInLumi_.compare_exchange_strong(expected, cache.get());
191 
192  return cache;
193  }
194 
195  template <class HAD, class DEC>
197  auto cache = this->streamCache(id);
198  RandomEngineSentry<HAD> randomEngineSentry(&cache->hadronizer_, ev.streamID());
199  RandomEngineSentry<DEC> randomEngineSentryDecay(cache->decayer_.get(), ev.streamID());
200 
201  cache->hadronizer_.setEDMEvent(ev);
202 
203  // get LHE stuff and pass to hadronizer!
204  //
206  ev.getByToken(eventProductToken_, product);
207 
208  std::unique_ptr<HepMC::GenEvent> finalEvent;
209  std::unique_ptr<GenEventInfoProduct> finalGenEventInfo;
210 
211  //sum of weights for events passing hadronization
212  double waccept = 0;
213  //number of accepted events
214  unsigned int naccept = 0;
215 
216  for (unsigned int itry = 0; itry < nAttempts_; ++itry) {
217  cache->hadronizer_.setLHEEvent(std::make_unique<lhef::LHEEvent>(cache->hadronizer_.getLHERunInfo(), *product));
218 
219  // cache->hadronizer_.generatePartons();
220  if (!cache->hadronizer_.hadronize())
221  continue;
222 
223  // this is "fake" stuff
224  // in principle, decays are done as part of full event generation,
225  // except for particles that are marked as to be kept stable
226  // but we currently keep in it the design, because we might want
227  // to use such feature for other applications
228  //
229  if (!cache->hadronizer_.decay())
230  continue;
231 
232  std::unique_ptr<HepMC::GenEvent> event(cache->hadronizer_.getGenEvent());
233  if (!event.get())
234  continue;
235 
236  // The external decay driver is being added to the system,
237  // it should be called here
238  //
239  if (cache->decayer_) {
240  auto lheEvent = cache->hadronizer_.getLHEEvent();
241  auto t = cache->decayer_->decay(event.get(), lheEvent.get());
242  if (t != event.get()) {
243  event.reset(t);
244  }
245  cache->hadronizer_.setLHEEvent(std::move(lheEvent));
246  }
247 
248  if (!event.get())
249  continue;
250 
251  // check and perform if there're any unstable particles after
252  // running external decay packges
253  //
254  cache->hadronizer_.resetEvent(std::move(event));
255  if (!cache->hadronizer_.residualDecay())
256  continue;
257 
258  cache->hadronizer_.finalizeEvent();
259 
260  event = cache->hadronizer_.getGenEvent();
261  if (!event.get())
262  continue;
263 
264  event->set_event_number(ev.id().event());
265 
266  std::unique_ptr<GenEventInfoProduct> genEventInfo(cache->hadronizer_.getGenEventInfo());
267  if (!genEventInfo.get()) {
268  // create GenEventInfoProduct from HepMC event in case hadronizer didn't provide one
269  genEventInfo.reset(new GenEventInfoProduct(event.get()));
270  }
271 
272  //if HepMCFilter was specified, test event
273  if (cache->filter_ && !cache->filter_->filter(event.get(), genEventInfo->weight()))
274  continue;
275 
276  waccept += genEventInfo->weight();
277  ++naccept;
278 
279  //keep the LAST accepted event (which is equivalent to choosing randomly from the accepted events)
280  finalEvent = std::move(event);
281  finalGenEventInfo = std::move(genEventInfo);
282  }
283 
284  if (!naccept)
285  return false;
286 
287  //adjust event weights if necessary (in case input event was attempted multiple times)
288  if (nAttempts_ > 1) {
289  double multihadweight = double(naccept) / double(nAttempts_);
290 
291  //adjust weight for GenEventInfoProduct
292  finalGenEventInfo->weights()[0] *= multihadweight;
293 
294  //adjust weight for HepMC GenEvent (used e.g for RIVET)
295  finalEvent->weights()[0] *= multihadweight;
296  }
297 
298  ev.put(std::move(finalGenEventInfo));
299 
300  std::unique_ptr<HepMCProduct> bare_product(new HepMCProduct());
301  bare_product->addHepMCData(finalEvent.release());
302  ev.put(std::move(bare_product), "unsmeared");
303 
304  return true;
305  }
306 
307  template <class HAD, class DEC>
309  // this is run-specific
310 
311  // get LHE stuff and pass to hadronizer!
312 
313  if (counterRunInfoProducts_ > 1)
314  throw edm::Exception(errors::EventCorruption) << "More than one LHERunInfoProduct present";
315 
316  if (counterRunInfoProducts_ == 0)
317  throw edm::Exception(errors::EventCorruption) << "No LHERunInfoProduct present";
318 
319  edm::Handle<LHERunInfoProduct> lheRunInfoProduct;
320  run.getByLabel(runInfoProductTag_, lheRunInfoProduct);
321  //TODO: fix so that this actually works with getByToken commented below...
322  //run.getByToken(runInfoProductToken_, lheRunInfoProduct);
323  auto& hadronizer = this->streamCache(id)->hadronizer_;
324 
325  hadronizer.setLHERunInfo(std::make_unique<lhef::LHERunInfo>(*lheRunInfoProduct));
326  lhef::LHERunInfo* lheRunInfo = hadronizer.getLHERunInfo().get();
327  lheRunInfo->initLumi();
328  }
329 
330  template <class HAD, class DEC>
332  auto rCache = this->runCache(r.index());
333  auto cache = this->streamCache(id);
334 
335  // Retrieve the LHE run info summary and transfer determined
336  // cross-section into the generator run info
337 
338  const lhef::LHERunInfo* lheRunInfo = cache->hadronizer_.getLHERunInfo().get();
339  lhef::LHERunInfo::XSec xsec = lheRunInfo->xsec();
340 
341  GenRunInfoProduct& genRunInfo = cache->hadronizer_.getGenRunInfo();
342  genRunInfo.setInternalXSec(GenRunInfoProduct::XSec(xsec.value(), xsec.error()));
343 
344  // If relevant, record the integrated luminosity for this run
345  // here. To do so, we would need a standard function to invoke on
346  // the contained hadronizer that would report the integrated
347  // luminosity.
348 
349  if (cache->initialized_) {
350  cache->hadronizer_.statistics();
351  if (cache->decayer_)
352  cache->decayer_->statistics();
353  if (cache->filter_)
354  cache->filter_->statistics();
355  lheRunInfo->statistics();
356  }
357  GenRunInfoProduct* expect = nullptr;
358 
359  std::unique_ptr<GenRunInfoProduct> griproduct(new GenRunInfoProduct(genRunInfo));
360  //All the GenRunInfoProducts for all streams shoule be identical, therefore we only
361  // need one
362  if (rCache->product_.compare_exchange_strong(expect, griproduct.get())) {
363  griproduct.release();
364  }
365  }
366 
367  template <class HAD, class DEC>
368  std::shared_ptr<gen::RunCache> ConcurrentHadronizerFilter<HAD, DEC>::globalBeginRun(edm::Run const&,
369  edm::EventSetup const&) const {
370  return std::make_shared<gen::RunCache>();
371  }
372 
373  template <class HAD, class DEC>
375 
376  template <class HAD, class DEC>
378  r.put(this->runCache(r.index())->release());
379  }
380 
381  template <class HAD, class DEC>
383  LuminosityBlock const& lumi,
384  EventSetup const& es) const {
385  if (useInLumi_ != this->streamCache(id)) {
386  initLumi(this->streamCache(id), lumi, es);
387  } else {
388  useInLumi_.store(nullptr);
389  }
390  }
391 
392  template <class HAD, class DEC>
394  LuminosityBlock const& lumi,
395  EventSetup const& es) const {
396  lhef::LHERunInfo* lheRunInfo = cache->hadronizer_.getLHERunInfo().get();
397  lheRunInfo->initLumi();
398 
399  //We need all copies to see same random # for begin lumi
401  auto enginePtr = rng->cloneEngine(lumi.index());
402  cache->hadronizer_.setRandomEngine(enginePtr.get());
403  cache->decayer_->setRandomEngine(enginePtr.get());
404 
405  auto unsetH = [](HAD* h) { h->setRandomEngine(nullptr); };
406  auto unsetD = [](DEC* d) { d->setRandomEngine(nullptr); };
407 
408  std::unique_ptr<HAD, decltype(unsetH)> randomEngineSentry(&cache->hadronizer_, unsetH);
409  std::unique_ptr<DEC, decltype(unsetD)> randomEngineSentryDecay(cache->decayer_.get(), unsetD);
410 
411  cache->hadronizer_.randomizeIndex(lumi, enginePtr.get());
412 
413  if (!cache->hadronizer_.readSettings(1))
415  << "Failed to read settings for the hadronizer " << cache->hadronizer_.classname() << " \n";
416 
417  if (cache->decayer_) {
418  cache->decayer_->init(es);
419  if (!cache->hadronizer_.declareStableParticles(cache->decayer_->operatesOnParticles()))
421  << "Failed to declare stable particles in hadronizer " << cache->hadronizer_.classname()
422  << " for internal parton generation\n";
423  if (!cache->hadronizer_.declareSpecialSettings(cache->decayer_->specialSettings()))
425  << "Failed to declare special settings in hadronizer " << cache->hadronizer_.classname() << "\n";
426  }
427 
428  if (cache->filter_) {
429  cache->filter_->resetStatistics();
430  }
431 
432  if (!cache->hadronizer_.initializeForExternalPartons())
434  << "Failed to initialize hadronizer " << cache->hadronizer_.classname()
435  << " for external parton generation\n";
436 
437  cache->initialized_ = true;
438  }
439 
440  template <class HAD, class DEC>
442  EventSetup const& es) const {
443  //need one of the streams to finish
444  while (useInLumi_.load() == nullptr) {
445  }
446  initLumi(useInLumi_, lumi, es);
447  std::unique_ptr<GenLumiInfoHeader> genLumiInfoHeader(useInLumi_.load()->hadronizer_.getGenLumiInfoHeader());
449  }
450 
451  template <class HAD, class DEC>
453  LuminosityBlock const&,
454  EventSetup const&,
455  gen::LumiSummary* iSummary) const {
456  const lhef::LHERunInfo* lheRunInfo = this->streamCache(id)->hadronizer_.getLHERunInfo().get();
457 
458  std::vector<lhef::LHERunInfo::Process> LHELumiProcess = lheRunInfo->getLumiProcesses();
459  std::vector<GenLumiInfoProduct::ProcessInfo> GenLumiProcess;
460  for (unsigned int i = 0; i < LHELumiProcess.size(); i++) {
461  lhef::LHERunInfo::Process thisProcess = LHELumiProcess[i];
462 
464  temp.setProcess(thisProcess.process());
465  temp.setLheXSec(thisProcess.getLHEXSec().value(), thisProcess.getLHEXSec().error());
466  temp.setNPassPos(thisProcess.nPassPos());
467  temp.setNPassNeg(thisProcess.nPassNeg());
468  temp.setNTotalPos(thisProcess.nTotalPos());
469  temp.setNTotalNeg(thisProcess.nTotalNeg());
470  temp.setTried(thisProcess.tried().n(), thisProcess.tried().sum(), thisProcess.tried().sum2());
471  temp.setSelected(thisProcess.selected().n(), thisProcess.selected().sum(), thisProcess.selected().sum2());
472  temp.setKilled(thisProcess.killed().n(), thisProcess.killed().sum(), thisProcess.killed().sum2());
473  temp.setAccepted(thisProcess.accepted().n(), thisProcess.accepted().sum(), thisProcess.accepted().sum2());
474  temp.setAcceptedBr(thisProcess.acceptedBr().n(), thisProcess.acceptedBr().sum(), thisProcess.acceptedBr().sum2());
475  GenLumiProcess.push_back(temp);
476  }
477  GenLumiInfoProduct genLumiInfo;
478  genLumiInfo.setHEPIDWTUP(lheRunInfo->getHEPRUP()->IDWTUP);
479  genLumiInfo.setProcessInfo(GenLumiProcess);
480 
481  if (iSummary->lumiInfo_) {
482  iSummary->lumiInfo_->setHEPIDWTUP(lheRunInfo->getHEPRUP()->IDWTUP);
483  iSummary->lumiInfo_->mergeProduct(genLumiInfo);
484  } else {
485  iSummary->lumiInfo_ = std::make_unique<GenLumiInfoProduct>(std::move(genLumiInfo));
486  }
487 
488  // produce GenFilterInfo if HepMCFilter is called
489  if (hasFilter_) {
490  auto filter = this->streamCache(id)->filter_.get();
491  GenFilterInfo thisProduct(filter->numEventsPassPos(),
492  filter->numEventsPassNeg(),
493  filter->numEventsTotalPos(),
494  filter->numEventsTotalNeg(),
495  filter->sumpass_w(),
496  filter->sumpass_w2(),
497  filter->sumtotal_w(),
498  filter->sumtotal_w2());
499  if (not iSummary->filterInfo_) {
500  iSummary->filterInfo_ = std::make_unique<GenFilterInfo>(std::move(thisProduct));
501  } else {
502  iSummary->filterInfo_->mergeProduct(thisProduct);
503  }
504  }
505 
506  gen::StreamCache<HAD, DEC>* expected = nullptr;
507  //make it available for beginLuminosityBlockProduce
508  useInLumi_.compare_exchange_strong(expected, this->streamCache(id));
509  }
510 
511  template <class HAD, class DEC>
513  edm::LuminosityBlock const&, edm::EventSetup const&) const {
514  return std::make_shared<gen::LumiSummary>();
515  }
516 
517  template <class HAD, class DEC>
519  edm::EventSetup const&,
520  gen::LumiSummary*) const {}
521 
522  template <class HAD, class DEC>
524  EventSetup const&,
525  gen::LumiSummary const* iSummary) const {
526  //Advance the random number generator so next begin lumi starts with new seed
528  rng->getEngine(lumi.index()).flat();
529 
530  lumi.put(std::move(iSummary->lumiInfo_));
531 
532  // produce GenFilterInfo if HepMCFilter is called
533  if (hasFilter_) {
534  lumi.put(std::move(iSummary->filterInfo_));
535  }
536  }
537 
538 } // namespace edm
539 
540 #endif // GeneratorInterface_Core_ConcurrentHadronizerFilter_h
std::atomic< GenRunInfoProduct * > product_
T getParameter(std::string const &) const
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
Definition: ProducerBase.h:79
EventNumber_t event() const
Definition: EventID.h:41
unsigned int nTotalPos() const
Definition: LHERunInfo.h:122
bool getByLabel(std::string const &label, Handle< PROD > &result) const
Definition: Run.h:280
ConcurrentHadronizerFilter(ParameterSet const &ps)
void setTried(unsigned int n, double sum, double sum2)
void globalEndRun(edm::Run const &, edm::EventSetup const &) const override
unsigned int n() const
Definition: LHERunInfo.h:102
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
BranchType const & branchType() const
EDGetTokenT< LHEEventProduct > eventProductToken_
std::unique_ptr< DEC > decayer_
void setSelected(unsigned int n, double sum, double sum2)
std::unique_ptr< GenLumiInfoProduct > lumiInfo_
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
LuminosityBlockIndex index() const
EDGetTokenT< LHERunInfoProduct > runInfoProductToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
void setKilled(unsigned int n, double sum, double sum2)
bool exists(std::string const &parameterName) const
checks if a parameter exists
PROD const & get(EDGetTokenT< PROD > token) const (false)
void streamBeginLuminosityBlock(StreamID, LuminosityBlock const &, EventSetup const &) const override
XSec xsec() const
Definition: LHERunInfo.cc:199
bool ev
std::string const & processName() const
std::unique_ptr< GenFilterInfo > filterInfo_
void globalEndLuminosityBlockProduce(LuminosityBlock &, EventSetup const &, gen::LumiSummary const *) const override
void setInternalXSec(const XSec &xsec)
const std::vector< Process > & getLumiProcesses() const
Definition: LHERunInfo.h:171
void globalEndRunProduce(Run &, EventSetup const &) const override
XSec getLHEXSec() const
Definition: LHERunInfo.h:118
std::unique_ptr< gen::StreamCache< HAD, DEC > > beginStream(edm::StreamID) const override
void setAccepted(unsigned int n, double sum, double sum2)
std::atomic< gen::StreamCache< HAD, DEC > * > useInLumi_
std::string const & moduleLabel() const
void setAcceptedBr(unsigned int n, double sum, double sum2)
std::string const & productInstanceName() const
void globalEndLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, gen::LumiSummary *) const override
void put(std::unique_ptr< PROD > product)
Put a new product.
std::shared_ptr< gen::RunCache > globalBeginRun(edm::Run const &, edm::EventSetup const &) const override
std::unique_ptr< GenRunInfoProduct > release() const
TypeID unwrappedTypeID() const
RunIndex index() const
Definition: Run.cc:21
void initLumi(gen::StreamCache< HAD, DEC > *cache, LuminosityBlock const &index, EventSetup const &es) const
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
void streamBeginRun(StreamID, Run const &, EventSetup const &) const override
unsigned int nTotalNeg() const
Definition: LHERunInfo.h:123
#define noexcept
double sum2() const
Definition: LHERunInfo.h:104
unsigned int nPassPos() const
Definition: LHERunInfo.h:120
const HEPRUP * getHEPRUP() const
Definition: LHERunInfo.h:52
void globalBeginLuminosityBlockProduce(LuminosityBlock &, EventSetup const &) const override
Counter killed() const
Definition: LHERunInfo.h:127
StreamCache(ParameterSet const &iPSet)
void put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Run.h:108
std::unique_ptr< HepMCFilterDriver > filter_
void setLheXSec(double value, double err)
void setHEPIDWTUP(const int id)
double sum() const
Definition: LHERunInfo.h:103
void streamEndRun(StreamID, Run const &, EventSetup const &) const override
edm::EventID id() const
Definition: EventBase.h:59
HLT enums.
def cache(function)
Definition: utilities.py:3
StreamID streamID() const
Definition: Event.h:95
Counter acceptedBr() const
Definition: LHERunInfo.h:129
Counter accepted() const
Definition: LHERunInfo.h:128
Counter selected() const
Definition: LHERunInfo.h:126
Counter tried() const
Definition: LHERunInfo.h:125
unsigned int nPassNeg() const
Definition: LHERunInfo.h:121
std::shared_ptr< gen::LumiSummary > globalBeginLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &) const override
bool filter(StreamID id, Event &e, EventSetup const &es) const override
void setProcessInfo(const std::vector< ProcessInfo > &processes)
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1
Definition: Run.h:45
void statistics() const
Definition: LHERunInfo.cc:297
void streamEndLuminosityBlockSummary(StreamID, LuminosityBlock const &, EventSetup const &, gen::LumiSummary *) const override