CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 using std::ptrdiff_t;
13 #include <HepMC/GenEvent.h>
14 #include <HepMC/SimpleVector.h>
15 
17 
18 namespace edm {
19  class HepMCProduct {
20  public:
24 
25  explicit HepMCProduct(HepMC::GenEvent *evt);
26  virtual ~HepMCProduct();
27 
28  void addHepMCData(HepMC::GenEvent *evt);
29 
30  void applyVtxGen(HepMC::FourVector *vtxShift) const;
31 
32  void boostToLab(TMatrixD *lorentz, std::string type) const;
33 
34  const HepMC::GenEvent &getHepMCData() const;
35 
36  const HepMC::GenEvent *GetEvent() const { return evt_; }
37 
38  bool isVtxGenApplied() const { return isVtxGenApplied_; }
39  bool isVtxBoostApplied() const { return isVtxBoostApplied_; }
40  bool isPBoostApplied() const { return isPBoostApplied_; }
41 
42  HepMCProduct(HepMCProduct const &orig);
43  HepMCProduct &operator = (HepMCProduct const &other);
44  void swap(HepMCProduct &other);
45 
46  private:
47  HepMC::GenEvent *evt_;
48 
49  mutable bool isVtxGenApplied_ ;
50  mutable bool isVtxBoostApplied_;
51  mutable bool isPBoostApplied_;
52 
53  };
54 
55  // This allows edm::Refs to work with HepMCProduct
56  namespace refhelper {
57  template<>
59  struct Find : public std::binary_function<edm::HepMCProduct const&, int, HepMC::GenParticle const*> {
60  typedef Find self;
61  self::result_type operator () (self::first_argument_type iContainer,
62  self::second_argument_type iBarCode)
63  { return iContainer.getHepMCData().barcode_to_particle(iBarCode); }
64  };
65 
66  typedef Find value;
67  };
68 
69  template<>
70  struct FindTrait<edm::HepMCProduct, HepMC::GenVertex> {
71  struct Find : public std::binary_function<edm::HepMCProduct const&, int, HepMC::GenVertex const*> {
72  typedef Find self;
73 
74  self::result_type operator () (self::first_argument_type iContainer,
75  self::second_argument_type iBarCode)
76  { return iContainer.getHepMCData().barcode_to_vertex(iBarCode); }
77  };
78 
79  typedef Find value;
80  };
81  } // namespace refhelper
82 } // namespace edm
83 
84 #endif // SimDataFormats_GeneratorProducts_HepMCProduct_h
type
Definition: HCALResponse.h:22
virtual ~HepMCProduct()
Definition: HepMCProduct.cc:27
bool isVtxBoostApplied() const
Definition: HepMCProduct.h:39
void swap(HepMCProduct &other)
void addHepMCData(HepMC::GenEvent *evt)
Definition: HepMCProduct.cc:35
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:47
void applyVtxGen(HepMC::FourVector *vtxShift) const
Definition: HepMCProduct.cc:45
HepMCProduct & operator=(HepMCProduct const &other)
const HepMC::GenEvent & getHepMCData() const
bool isPBoostApplied() const
Definition: HepMCProduct.h:40
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:36
bool isVtxGenApplied() const
Definition: HepMCProduct.h:38
void boostToLab(TMatrixD *lorentz, std::string type) const
Definition: HepMCProduct.cc:70