CMS 3D CMS Logo

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