ThePEG  1.8.0
LesHouchesEventHandler.h
1 // -*- C++ -*-
2 //
3 // LesHouchesEventHandler.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2011 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 2 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef THEPEG_LesHouchesEventHandler_H
10 #define THEPEG_LesHouchesEventHandler_H
11 //
12 // This is the declaration of the LesHouchesEventHandler class.
13 //
14 
15 #include "ThePEG/Handlers/EventHandler.h"
16 #include "LesHouchesEventHandler.fh"
17 #include "LesHouchesReader.fh"
18 #include "ThePEG/Utilities/CompSelector.h"
19 #include "ThePEG/Utilities/XSecStat.h"
20 
21 namespace ThePEG {
22 
41 
42 public:
43 
47  typedef vector<LesHouchesReaderPtr> ReaderVector;
48 
53 
57  enum WeightOpt {
58  unitweight = 1,
60  varweight = 2,
62  };
63 
64 public:
65 
73  {
75  }
76 
80  virtual ~LesHouchesEventHandler();
82 
83 public:
84 
91  virtual void initialize();
92 
97  virtual void statistics(ostream &) const;
98 
104  virtual CrossSection histogramScale() const;
105 
111  virtual CrossSection integratedXSec() const;
112 
118  virtual CrossSection integratedXSecErr() const;
120 
126  virtual EventPtr generateEvent();
127 
132  virtual tCollPtr performCollision();
133 
138  virtual EventPtr continueEvent();
140 
149  void select(double weight);
150 
155  void accept();
156 
161  void reject(double weight);
162 
166  void increaseMaxXSec(CrossSection maxxsec);
167 
172  void skipEvents();
173 
175 
182 
187  double unitTolerance() const { return theUnitTolerance; }
188 
192  const ReaderVector & readers() const { return theReaders; }
193 
198  const ReaderSelector & selector() const { return theSelector; }
199 
204 
209 
211 
212 public:
213 
220  void persistentOutput(PersistentOStream & os) const;
221 
227  void persistentInput(PersistentIStream & is, int version);
229 
236  static void Init();
237 
238 protected:
239 
246  virtual IBPtr clone() const;
247 
252  virtual IBPtr fullclone() const;
254 
255 protected:
256 
264  virtual void doinit();
265 
270  virtual void doinitrun();
271 
276  virtual void dofinish();
278 
279 protected:
280 
285 
291 
295  void setUnitTolerance(double);
296 
301 
307 
308 private:
309 
314 
320 
325 
331 
336 
341  bool warnPNum;
342 
343 public:
344 
349  class LesHouchesInitError: public InitException {};
350 
355  class LesHouchesPNumException: public InitException {};
358 private:
359 
365 
371 
372 };
373 
374 }
375 
376 // CLASSDOC OFF
377 
378 #include "ThePEG/Utilities/ClassTraits.h"
379 
380 namespace ThePEG {
381 
386 template <>
387 struct BaseClassTrait<LesHouchesEventHandler,1> {
389  typedef EventHandler NthBase;
390 };
391 
394 template <>
395 struct ClassTraits<LesHouchesEventHandler>
396  : public ClassTraitsBase<LesHouchesEventHandler> {
398  static string className() { return "ThePEG::LesHouchesEventHandler"; }
402  static string library() { return "LesHouches.so"; }
403 };
404 
407 }
408 
409 #endif /* THEPEG_LesHouchesEventHandler_H */