Go to the documentation of this file.00001 #ifndef SimDataFormats_GeneratorProducts_HepMCProduct_h
00002 #define SimDataFormats_GeneratorProducts_HepMCProduct_h
00003
00009 #include <TMatrixD.h>
00010
00011 #include <cstddef>
00012 using std::ptrdiff_t;
00013 #include <HepMC/GenEvent.h>
00014 #include <HepMC/SimpleVector.h>
00015
00016 #include "DataFormats/Common/interface/Ref.h"
00017
00018 namespace edm {
00019 class HepMCProduct {
00020 public:
00021 HepMCProduct() :
00022 evt_(0), isVtxGenApplied_(false),
00023 isVtxBoostApplied_(false), isPBoostApplied_(false) {}
00024
00025 explicit HepMCProduct(HepMC::GenEvent *evt);
00026 virtual ~HepMCProduct();
00027
00028 void addHepMCData(HepMC::GenEvent *evt);
00029
00030 void applyVtxGen(HepMC::FourVector *vtxShift) const;
00031
00032 void boostToLab(TMatrixD *lorentz, std::string type) const;
00033
00034 const HepMC::GenEvent &getHepMCData() const;
00035
00036 const HepMC::GenEvent *GetEvent() const { return evt_; }
00037
00038 bool isVtxGenApplied() const { return isVtxGenApplied_; }
00039 bool isVtxBoostApplied() const { return isVtxBoostApplied_; }
00040 bool isPBoostApplied() const { return isPBoostApplied_; }
00041
00042 HepMCProduct(HepMCProduct const &orig);
00043 HepMCProduct &operator = (HepMCProduct const &other);
00044 void swap(HepMCProduct &other);
00045
00046 private:
00047 HepMC::GenEvent *evt_;
00048
00049 mutable bool isVtxGenApplied_ ;
00050 mutable bool isVtxBoostApplied_;
00051 mutable bool isPBoostApplied_;
00052
00053 };
00054
00055
00056 namespace refhelper {
00057 template<>
00058 struct FindTrait<edm::HepMCProduct, HepMC::GenParticle> {
00059 struct Find : public std::binary_function<edm::HepMCProduct const&, int, HepMC::GenParticle const*> {
00060 typedef Find self;
00061 self::result_type operator () (self::first_argument_type iContainer,
00062 self::second_argument_type iBarCode)
00063 { return iContainer.getHepMCData().barcode_to_particle(iBarCode); }
00064 };
00065
00066 typedef Find value;
00067 };
00068
00069 template<>
00070 struct FindTrait<edm::HepMCProduct, HepMC::GenVertex> {
00071 struct Find : public std::binary_function<edm::HepMCProduct const&, int, HepMC::GenVertex const*> {
00072 typedef Find self;
00073
00074 self::result_type operator () (self::first_argument_type iContainer,
00075 self::second_argument_type iBarCode)
00076 { return iContainer.getHepMCData().barcode_to_vertex(iBarCode); }
00077 };
00078
00079 typedef Find value;
00080 };
00081 }
00082 }
00083
00084 #endif // SimDataFormats_GeneratorProducts_HepMCProduct_h