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 
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);
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 {
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 {
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 isVtxGenApplied() const
Definition: HepMCProduct.h:39
void swap(HepMCProduct &other)
const HepMC::GenEvent & getHepMCData() const
void addHepMCData(HepMC::GenEvent *evt)
Definition: HepMCProduct.cc:28
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:50
HepMCProduct & operator=(HepMCProduct const &other)
void applyVtxGen(HepMC::FourVector const *vtxShift)
Definition: HepMCProduct.h:30
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:37
void boostToLab(TMatrixD const *lorentz, std::string const &type)
Definition: HepMCProduct.cc:58
bool isPBoostApplied() const
Definition: HepMCProduct.h:41
HLT enums.
result_type operator()(first_argument_type iContainer, second_argument_type iBarCode)
Definition: HepMCProduct.h:81
bool isVtxBoostApplied() const
Definition: HepMCProduct.h:40
result_type operator()(first_argument_type iContainer, second_argument_type iBarCode)
Definition: HepMCProduct.h:66