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:
51  HepMC::GenEvent *evt_;
52 
56 
57  };
58 
59  // This allows edm::Refs to work with HepMCProduct
60  namespace refhelper {
61  template<>
63  struct Find : public std::binary_function<edm::HepMCProduct const&, int, HepMC::GenParticle const*> {
64  typedef Find self;
65  self::result_type operator () (self::first_argument_type iContainer,
66  self::second_argument_type iBarCode)
67  { return iContainer.getHepMCData().barcode_to_particle(iBarCode); }
68  };
69 
70  typedef Find value;
71  };
72 
73  template<>
74  struct FindTrait<edm::HepMCProduct, HepMC::GenVertex> {
75  struct Find : public std::binary_function<edm::HepMCProduct const&, int, HepMC::GenVertex const*> {
76  typedef Find self;
77 
78  self::result_type operator () (self::first_argument_type iContainer,
79  self::second_argument_type iBarCode)
80  { return iContainer.getHepMCData().barcode_to_vertex(iBarCode); }
81  };
82 
83  typedef Find value;
84  };
85  } // namespace refhelper
86 } // namespace edm
87 
88 #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:51
#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.