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  HepMCProduct(HepMCProduct&& orig);
48  void swap(HepMCProduct &other);
49 
50  private:
52 
56 
57  };
58 
59  // This allows edm::Refs to work with HepMCProduct
60  namespace refhelper {
61  template<>
63  struct Find {
67 
68  result_type operator () (first_argument_type iContainer,
69  second_argument_type iBarCode)
70  { return iContainer.getHepMCData().barcode_to_particle(iBarCode); }
71  };
72 
73  typedef Find value;
74  };
75 
76  template<>
77  struct FindTrait<edm::HepMCProduct, HepMC::GenVertex> {
78  struct Find {
81  using result_type = HepMC::GenVertex const*;
82 
83  result_type operator () (first_argument_type iContainer,
84  second_argument_type iBarCode)
85  { return iContainer.getHepMCData().barcode_to_vertex(iBarCode); }
86  };
87 
88  typedef Find value;
89  };
90  } // namespace refhelper
91 } // namespace edm
92 
93 #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)
#define nullptr
void addHepMCData(HepMC::GenEvent *evt)
Definition: HepMCProduct.cc:29
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:51
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.