CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
edm::GeneratorFilter< HAD, DEC > Class Template Reference

#include <GeneratorFilter.h>

Inheritance diagram for edm::GeneratorFilter< HAD, DEC >:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

Public Types

typedef DEC Decayer
 
typedef HAD Hadronizer
 
- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
typedef WorkerT< EDFilterWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

virtual bool beginLuminosityBlock (LuminosityBlock &, EventSetup const &)
 
virtual bool beginRun (Run &, EventSetup const &)
 
virtual void endJob ()
 
virtual bool endLuminosityBlock (LuminosityBlock &, EventSetup const &)
 
virtual bool endRun (Run &, EventSetup const &)
 
virtual bool filter (Event &e, EventSetup const &es)
 
 GeneratorFilter (ParameterSet const &ps)
 
virtual void respondToCloseInputFile (FileBlock const &fb)
 
virtual void respondToCloseOutputFiles (FileBlock const &fb)
 
virtual void respondToOpenInputFile (FileBlock const &fb)
 
virtual void respondToOpenOutputFiles (FileBlock const &fb)
 
virtual ~GeneratorFilter ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

Decayerdecayer_
 
Hadronizer hadronizer_
 
unsigned int nEventsInLumiBlock_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDFilter
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

template<class HAD, class DEC>
class edm::GeneratorFilter< HAD, DEC >

Definition at line 35 of file GeneratorFilter.h.

Member Typedef Documentation

template<class HAD , class DEC >
typedef DEC edm::GeneratorFilter< HAD, DEC >::Decayer

Definition at line 39 of file GeneratorFilter.h.

template<class HAD , class DEC >
typedef HAD edm::GeneratorFilter< HAD, DEC >::Hadronizer

Definition at line 38 of file GeneratorFilter.h.

Constructor & Destructor Documentation

template<class HAD , class DEC >
edm::GeneratorFilter< HAD, DEC >::GeneratorFilter ( ParameterSet const &  ps)
explicit

Definition at line 70 of file GeneratorFilter.h.

References edm::GeneratorFilter< HAD, DEC >::decayer_, edm::ParameterSet::exists(), and edm::ParameterSet::getParameter().

70  :
71  EDFilter(),
72  hadronizer_(ps),
73  decayer_(0),
75  {
76  // TODO:
77  // Put the list of types produced by the filters here.
78  // The current design calls for:
79  // * GenRunInfoProduct
80  // * HepMCProduct
81  //
82  // other maybe added as needs be
83  //
84 
85  if ( ps.exists("ExternalDecays") )
86  {
87  //decayer_ = new gen::ExternalDecayDriver(ps.getParameter<ParameterSet>("ExternalDecays"));
88  ParameterSet ps1 = ps.getParameter<ParameterSet>("ExternalDecays");
89  decayer_ = new Decayer(ps1);
90  }
91 
92  produces<edm::HepMCProduct>();
93  produces<GenEventInfoProduct>();
94  produces<GenLumiInfoProduct, edm::InLumi>();
95  produces<GenRunInfoProduct, edm::InRun>();
96 
97  }
unsigned int nEventsInLumiBlock_
template<class HAD , class DEC >
edm::GeneratorFilter< HAD, DEC >::~GeneratorFilter ( )
virtual

Definition at line 100 of file GeneratorFilter.h.

101  { if ( decayer_ ) delete decayer_;}

Member Function Documentation

template<class HAD , class DEC >
bool edm::GeneratorFilter< HAD, DEC >::beginLuminosityBlock ( LuminosityBlock ,
EventSetup const &  es 
)
virtual

Reimplemented from edm::EDFilter.

Definition at line 214 of file GeneratorFilter.h.

References edm::errors::Configuration, and edm::hlt::Exception.

215  {
217 
218  if ( !hadronizer_.readSettings(0) )
220  << "Failed to read settings for the hadronizer "
221  << hadronizer_.classname() << " \n";
222 
223  if ( decayer_ )
224  {
225  decayer_->init(es);
226  if ( !hadronizer_.declareStableParticles( decayer_->operatesOnParticles() ) )
228  << "Failed to declare stable particles in hadronizer "
229  << hadronizer_.classname()
230  << "\n";
231  if ( !hadronizer_.declareSpecialSettings( decayer_->specialSettings() ) )
233  << "Failed to declare special settings in hadronizer "
234  << hadronizer_.classname()
235  << "\n";
236  }
237 
238  if ( !hadronizer_.initializeForInternalPartons() )
240  << "Failed to initialize hadronizer "
241  << hadronizer_.classname()
242  << " for internal parton generation\n";
243 
244  return true;
245 
246  }
unsigned int nEventsInLumiBlock_
template<class HAD , class DEC >
bool edm::GeneratorFilter< HAD, DEC >::beginRun ( Run ,
EventSetup const &  es 
)
virtual

Reimplemented from edm::EDFilter.

Definition at line 186 of file GeneratorFilter.h.

187  {
188 
189  return true;
190 
191  }
template<class HAD , class DEC >
void edm::GeneratorFilter< HAD, DEC >::endJob ( void  )
virtual

Reimplemented from edm::EDFilter.

Definition at line 181 of file GeneratorFilter.h.

182  { }
template<class HAD , class DEC >
bool edm::GeneratorFilter< HAD, DEC >::endLuminosityBlock ( LuminosityBlock lumi,
EventSetup const &   
)
virtual

Reimplemented from edm::EDFilter.

Definition at line 250 of file GeneratorFilter.h.

References GenRunInfoProduct::XSec::error(), GenRunInfoProduct::internalXSec(), edm::LuminosityBlock::put(), GenLumiInfoProduct::ProcessInfo::setAccepted(), GenLumiInfoProduct::ProcessInfo::setAcceptedBr(), GenLumiInfoProduct::ProcessInfo::setKilled(), GenLumiInfoProduct::ProcessInfo::setLheXSec(), GenLumiInfoProduct::ProcessInfo::setNPassNeg(), GenLumiInfoProduct::ProcessInfo::setNPassPos(), GenLumiInfoProduct::ProcessInfo::setNTotalNeg(), GenLumiInfoProduct::ProcessInfo::setNTotalPos(), GenLumiInfoProduct::ProcessInfo::setProcess(), GenLumiInfoProduct::ProcessInfo::setSelected(), GenLumiInfoProduct::ProcessInfo::setTried(), groupFilesInBlocks::temp, and GenRunInfoProduct::XSec::value().

251  {
252 
253  hadronizer_.statistics();
254  if ( decayer_ ) decayer_->statistics();
255 
256  GenRunInfoProduct genRunInfo = GenRunInfoProduct(hadronizer_.getGenRunInfo());
257  std::vector<GenLumiInfoProduct::ProcessInfo> GenLumiProcess;
258  GenRunInfoProduct::XSec xsec = genRunInfo.internalXSec();
260  temp.setProcess(0);
261  temp.setLheXSec(xsec.value(), xsec.error()); // Pythia gives error of -1
263  temp.setNPassNeg(0);
265  temp.setNTotalNeg(0);
269  temp.setAccepted(0,-1,-1);
270  temp.setAcceptedBr(0,-1,-1);
271  GenLumiProcess.push_back(temp);
272 
273  std::auto_ptr<GenLumiInfoProduct> genLumiInfo(new GenLumiInfoProduct());
274  genLumiInfo->setHEPIDWTUP(-1);
275  genLumiInfo->setProcessInfo( GenLumiProcess );
276  lumi.put(genLumiInfo);
277 
279 
280  return true;
281  }
void setTried(unsigned int n, double sum, double sum2)
void setSelected(unsigned int n, double sum, double sum2)
void setKilled(unsigned int n, double sum, double sum2)
void setAccepted(unsigned int n, double sum, double sum2)
void setAcceptedBr(unsigned int n, double sum, double sum2)
unsigned int nEventsInLumiBlock_
void setLheXSec(double value, double err)
const XSec & internalXSec() const
template<class HAD , class DEC >
bool edm::GeneratorFilter< HAD, DEC >::endRun ( Run r,
EventSetup const &   
)
virtual

Reimplemented from edm::EDFilter.

Definition at line 195 of file GeneratorFilter.h.

References edm::Run::put().

196  {
197  // If relevant, record the integrated luminosity for this run
198  // here. To do so, we would need a standard function to invoke on
199  // the contained hadronizer that would report the integrated
200  // luminosity.
201 
202  hadronizer_.statistics();
203 
204  if ( decayer_ ) decayer_->statistics();
205 
206  std::auto_ptr<GenRunInfoProduct> griproduct(new GenRunInfoProduct(hadronizer_.getGenRunInfo()));
207  r.put(griproduct);
208 
209  return true;
210  }
template<class HAD , class DEC >
bool edm::GeneratorFilter< HAD, DEC >::filter ( Event e,
EventSetup const &  es 
)
virtual

Implements edm::EDFilter.

Definition at line 105 of file GeneratorFilter.h.

References edm::EventID::event(), event(), edm::EventBase::id(), and edm::Event::put().

106  {
107  //added for selecting/filtering gen events, in the case of hadronizer+externalDecayer
108 
109  bool passEvtGenSelector = false;
110  std::auto_ptr<HepMC::GenEvent> event(0);
111 
112  while(!passEvtGenSelector)
113  {
114  event.reset();
115  hadronizer_.setEDMEvent(ev);
116 
117  if ( !hadronizer_.generatePartonsAndHadronize() ) return false;
118 
119  // this is "fake" stuff
120  // in principle, decays are done as part of full event generation,
121  // except for particles that are marked as to be kept stable
122  // but we currently keep in it the design, because we might want
123  // to use such feature for other applications
124  //
125  if ( !hadronizer_.decay() ) return false;
126 
127  event = std::auto_ptr<HepMC::GenEvent>(hadronizer_.getGenEvent());
128  if ( !event.get() ) return false;
129 
130  // The external decay driver is being added to the system,
131  // it should be called here
132  //
133  if ( decayer_ )
134  {
135  event.reset( decayer_->decay( event.get() ) );
136  }
137  if ( !event.get() ) return false;
138 
139  passEvtGenSelector = hadronizer_.select( event.get() );
140 
141  }
142  // check and perform if there're any unstable particles after
143  // running external decay packages
144  //
145  // fisrt of all, put back modified event tree (after external decay)
146  //
147  hadronizer_.resetEvent( event.release() );
148 
149  //
150  // now run residual decays
151  //
152  if ( !hadronizer_.residualDecay() ) return false;
153 
154  hadronizer_.finalizeEvent();
155 
156  event.reset( hadronizer_.getGenEvent() );
157  if ( !event.get() ) return false;
158 
159  event->set_event_number( ev.id().event() );
160 
161  //
162  // tutto bene - finally, form up EDM products !
163  //
164  std::auto_ptr<GenEventInfoProduct> genEventInfo(hadronizer_.getGenEventInfo());
165  if (!genEventInfo.get())
166  {
167  // create GenEventInfoProduct from HepMC event in case hadronizer didn't provide one
168  genEventInfo.reset(new GenEventInfoProduct(event.get()));
169  }
170  ev.put(genEventInfo);
171 
172  std::auto_ptr<HepMCProduct> bare_product(new HepMCProduct());
173  bare_product->addHepMCData( event.release() );
174  ev.put(bare_product);
176  return true;
177  }
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_
template<class HAD , class DEC >
void edm::GeneratorFilter< HAD, DEC >::respondToCloseInputFile ( FileBlock const &  fb)
virtual

Reimplemented from edm::EDFilter.

Definition at line 290 of file GeneratorFilter.h.

291  { }
template<class HAD , class DEC >
void edm::GeneratorFilter< HAD, DEC >::respondToCloseOutputFiles ( FileBlock const &  fb)
virtual

Reimplemented from edm::EDFilter.

Definition at line 300 of file GeneratorFilter.h.

301  { }
template<class HAD , class DEC >
void edm::GeneratorFilter< HAD, DEC >::respondToOpenInputFile ( FileBlock const &  fb)
virtual

Reimplemented from edm::EDFilter.

Definition at line 285 of file GeneratorFilter.h.

286  { }
template<class HAD , class DEC >
void edm::GeneratorFilter< HAD, DEC >::respondToOpenOutputFiles ( FileBlock const &  fb)
virtual

Reimplemented from edm::EDFilter.

Definition at line 295 of file GeneratorFilter.h.

296  { }

Member Data Documentation

template<class HAD , class DEC >
Decayer* edm::GeneratorFilter< HAD, DEC >::decayer_
private

Definition at line 61 of file GeneratorFilter.h.

Referenced by edm::GeneratorFilter< HAD, DEC >::GeneratorFilter().

template<class HAD , class DEC >
Hadronizer edm::GeneratorFilter< HAD, DEC >::hadronizer_
private

Definition at line 59 of file GeneratorFilter.h.

template<class HAD , class DEC >
unsigned int edm::GeneratorFilter< HAD, DEC >::nEventsInLumiBlock_
private

Definition at line 62 of file GeneratorFilter.h.