CMS 3D CMS Logo

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 const* vtxShift) {
30  applyVtxGen(*vtxShift);
31  }
32  void applyVtxGen(HepMC::FourVector const& vtxShift);
33 
34  void boostToLab(TMatrixD const* lorentz, std::string const& type);
35 
36  const HepMC::GenEvent &getHepMCData() const;
37 
38  const HepMC::GenEvent *GetEvent() const { return evt_; }
39 
40  bool isVtxGenApplied() const { return isVtxGenApplied_; }
41  bool isVtxBoostApplied() const { return isVtxBoostApplied_; }
42  bool isPBoostApplied() const { return isPBoostApplied_; }
43 
44  HepMCProduct(HepMCProduct const &orig);
46  void swap(HepMCProduct &other);
47 
48  private:
49  HepMC::GenEvent *evt_;
50 
54 
55  };
56 
57  // This allows edm::Refs to work with HepMCProduct
58  namespace refhelper {
59  template<>
61  struct Find : public std::binary_function<edm::HepMCProduct const&, int, HepMC::GenParticle const*> {
62  typedef Find self;
63  self::result_type operator () (self::first_argument_type iContainer,
64  self::second_argument_type iBarCode)
65  { return iContainer.getHepMCData().barcode_to_particle(iBarCode); }
66  };
67 
68  typedef Find value;
69  };
70 
71  template<>
72  struct FindTrait<edm::HepMCProduct, HepMC::GenVertex> {
73  struct Find : public std::binary_function<edm::HepMCProduct const&, int, HepMC::GenVertex const*> {
74  typedef Find self;
75 
76  self::result_type operator () (self::first_argument_type iContainer,
77  self::second_argument_type iBarCode)
78  { return iContainer.getHepMCData().barcode_to_vertex(iBarCode); }
79  };
80 
81  typedef Find value;
82  };
83  } // namespace refhelper
84 } // namespace edm
85 
86 #endif // SimDataFormats_GeneratorProducts_HepMCProduct_h
type
Definition: HCALResponse.h:21
virtual ~HepMCProduct()
Definition: HepMCProduct.cc:21
bool isVtxBoostApplied() const
Definition: HepMCProduct.h:41
void swap(HepMCProduct &other)
void addHepMCData(HepMC::GenEvent *evt)
Definition: HepMCProduct.cc:29
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:49
#define nullptr
HepMCProduct & operator=(HepMCProduct const &other)
const HepMC::GenEvent & getHepMCData() const
void applyVtxGen(HepMC::FourVector const *vtxShift)
Definition: HepMCProduct.h:29
bool isPBoostApplied() const
Definition: HepMCProduct.h:42
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38
void boostToLab(TMatrixD const *lorentz, std::string const &type)
Definition: HepMCProduct.cc:64
bool isVtxGenApplied() const
Definition: HepMCProduct.h:40
HLT enums.