00001 #ifndef HepMCProduct_HepMCProduct_h
00002 #define HepMCProduct_HepMCProduct_h
00003
00009 #include "HepMC/GenEvent.h"
00010 #include "HepMC/SimpleVector.h"
00011
00012 #include "DataFormats/Common/interface/Ref.h"
00013
00014 #include "TMatrixD.h"
00015
00016 namespace edm {
00017
00018
00019
00020 class HepMCProduct {
00021 public:
00022 HepMCProduct() : evt_( 0 ), isVtxGenApplied_ ( false ),
00023 isVtxBoostApplied_ ( false ),
00024 isPBoostApplied_ ( false ) { };
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
00035 const HepMC::GenEvent& getHepMCData() const ;
00036
00037 const HepMC::GenEvent * GetEvent() const {
00038 return evt_;
00039 }
00040
00041 bool isVtxGenApplied() const { return isVtxGenApplied_ ; }
00042 bool isVtxBoostApplied() const { return isVtxBoostApplied_; }
00043 bool isPBoostApplied() const { return isPBoostApplied_; }
00044
00045 HepMCProduct(HepMCProduct const& x);
00046 void swap(HepMCProduct & other);
00047 HepMCProduct& operator=(HepMCProduct const& other);
00048
00049 private:
00050
00051 HepMC::GenEvent * evt_;
00052 mutable bool isVtxGenApplied_ ;
00053 mutable bool isVtxBoostApplied_;
00054 mutable bool isPBoostApplied_;
00055
00056 };
00057
00058
00059 namespace refhelper {
00060
00061 template<>
00062 struct FindTrait<edm::HepMCProduct, HepMC::GenParticle> {
00063 struct Find : public std::binary_function<edm::HepMCProduct const&, int, HepMC::GenParticle const*> {
00064 typedef Find self;
00065 self::result_type operator()(self::first_argument_type iContainer,
00066 self::second_argument_type iBarCode) {
00067 return iContainer.getHepMCData().barcode_to_particle(iBarCode);
00068 }
00069 };
00070 typedef Find value;
00071 };
00072
00073 template<>
00074 struct FindTrait<edm::HepMCProduct, HepMC::GenVertex> {
00075 struct Find : public std::binary_function<edm::HepMCProduct const&, int, HepMC::GenVertex const*> {
00076 typedef Find self;
00077 self::result_type operator()(self::first_argument_type iContainer,
00078 self::second_argument_type iBarCode) {
00079 return iContainer.getHepMCData().barcode_to_vertex(iBarCode);
00080 }
00081 };
00082 typedef Find value;
00083 };
00084
00085 }
00086
00087 }
00088 #endif