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