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