CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HepMCProduct.h
Go to the documentation of this file.
1 #ifndef SimDataFormats_GeneratorProducts_HepMCProduct_h
2 #define SimDataFormats_GeneratorProducts_HepMCProduct_h
3 
9 #include <TMatrixD.h>
10 
11 #include <cstddef>
12 #include <HepMC/GenEvent.h>
13 #include <HepMC/SimpleVector.h>
14 
16 
17 namespace edm {
18  class HepMCProduct {
19  public:
23 
24  explicit HepMCProduct(HepMC::GenEvent *evt);
25  virtual ~HepMCProduct();
26 
27  void addHepMCData(HepMC::GenEvent *evt);
28 
29  void applyVtxGen(HepMC::FourVector *vtxShift) const;
30 
31  void boostToLab(TMatrixD *lorentz, std::string type) const;
32 
33  const HepMC::GenEvent &getHepMCData() const;
34 
35  const HepMC::GenEvent *GetEvent() const { return evt_; }
36 
37  bool isVtxGenApplied() const { return isVtxGenApplied_; }
38  bool isVtxBoostApplied() const { return isVtxBoostApplied_; }
39  bool isPBoostApplied() const { return isPBoostApplied_; }
40 
41  HepMCProduct(HepMCProduct const &orig);
42  HepMCProduct &operator = (HepMCProduct const &other);
43  void swap(HepMCProduct &other);
44 
45  private:
46  HepMC::GenEvent *evt_;
47 
48  mutable bool isVtxGenApplied_ ;
49  mutable bool isVtxBoostApplied_;
50  mutable bool isPBoostApplied_;
51 
52  };
53 
54  // This allows edm::Refs to work with HepMCProduct
55  namespace refhelper {
56  template<>
58  struct Find : public std::binary_function<edm::HepMCProduct const&, int, HepMC::GenParticle const*> {
59  typedef Find self;
60  self::result_type operator () (self::first_argument_type iContainer,
61  self::second_argument_type iBarCode)
62  { return iContainer.getHepMCData().barcode_to_particle(iBarCode); }
63  };
64 
65  typedef Find value;
66  };
67 
68  template<>
69  struct FindTrait<edm::HepMCProduct, HepMC::GenVertex> {
70  struct Find : public std::binary_function<edm::HepMCProduct const&, int, HepMC::GenVertex const*> {
71  typedef Find self;
72 
73  self::result_type operator () (self::first_argument_type iContainer,
74  self::second_argument_type iBarCode)
75  { return iContainer.getHepMCData().barcode_to_vertex(iBarCode); }
76  };
77 
78  typedef Find value;
79  };
80  } // namespace refhelper
81 } // namespace edm
82 
83 #endif // SimDataFormats_GeneratorProducts_HepMCProduct_h
type
Definition: HCALResponse.h:21
virtual ~HepMCProduct()
Definition: HepMCProduct.cc:27
bool isVtxBoostApplied() const
Definition: HepMCProduct.h:38
void swap(HepMCProduct &other)
void addHepMCData(HepMC::GenEvent *evt)
Definition: HepMCProduct.cc:35
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:46
void applyVtxGen(HepMC::FourVector *vtxShift) const
Definition: HepMCProduct.cc:45
HepMCProduct & operator=(HepMCProduct const &other)
const HepMC::GenEvent & getHepMCData() const
bool isPBoostApplied() const
Definition: HepMCProduct.h:39
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:35
bool isVtxGenApplied() const
Definition: HepMCProduct.h:37
void boostToLab(TMatrixD *lorentz, std::string type) const
Definition: HepMCProduct.cc:70
volatile std::atomic< bool > shutdown_flag false