Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-20 23:57:15

0001 #ifndef SimDataFormats_GeneratorProducts_HepMC3Product_h
0002 #define SimDataFormats_GeneratorProducts_HepMC3Product_h
0003 
0004 /** \class HepMC3Product
0005  *
0006  *  \author Joanna Weng, Filip Moortgat, Mikhail Kirsanov
0007  */
0008 
0009 #include "DataFormats/Common/interface/Ref.h"
0010 #include <TMatrixD.h>
0011 #include <HepMC3/GenEvent.h>
0012 #include <cstddef>
0013 
0014 namespace HepMC3 {
0015   class FourVector;
0016   class GenParticle;
0017   class GenVertex;
0018 }  // namespace HepMC3
0019 
0020 namespace edm {
0021   class HepMC3Product {
0022   public:
0023     HepMC3Product() : evt_(nullptr), isVtxGenApplied_(false), isVtxBoostApplied_(false), isPBoostApplied_(false) {}
0024 
0025     explicit HepMC3Product(HepMC3::GenEvent *evt);
0026     virtual ~HepMC3Product();
0027 
0028     void addHepMCData(HepMC3::GenEvent *evt);
0029 
0030     void applyVtxGen(HepMC3::FourVector const *vtxShift) { applyVtxGen(*vtxShift); }
0031     void applyVtxGen(HepMC3::FourVector const &vtxShift);
0032 
0033     void boostToLab(TMatrixD const *lorentz, std::string const &type);
0034 
0035     const HepMC3::GenEvent &getHepMCData() const;
0036 
0037     const HepMC3::GenEvent *GetEvent() const { return evt_; }
0038 
0039     bool isVtxGenApplied() const { return isVtxGenApplied_; }
0040     bool isVtxBoostApplied() const { return isVtxBoostApplied_; }
0041     bool isPBoostApplied() const { return isPBoostApplied_; }
0042 
0043     HepMC3Product(HepMC3Product const &orig);
0044     HepMC3Product &operator=(HepMC3Product const &other);
0045     HepMC3Product(HepMC3Product &&orig);
0046     HepMC3Product &operator=(HepMC3Product &&other);
0047     void swap(HepMC3Product &other);
0048 
0049   private:
0050     HepMC3::GenEvent *evt_;
0051 
0052     bool isVtxGenApplied_;
0053     bool isVtxBoostApplied_;
0054     bool isPBoostApplied_;
0055   };
0056 
0057   // This allows edm::Refs to work with HepMC3Product
0058   namespace refhelper {
0059     template <>
0060     struct FindTrait<edm::HepMC3Product, HepMC3::GenParticle> {
0061       struct Find {
0062         using first_argument_type = edm::HepMC3Product const &;
0063         using second_argument_type = int;
0064         using result_type = HepMC3::GenParticle const *;
0065 
0066         result_type operator()(first_argument_type iContainer, second_argument_type iBarCode) {
0067           //return iContainer.getHepMCData().barcode_to_particle(iBarCode);
0068           return nullptr;
0069         }
0070       };
0071 
0072       typedef Find value;
0073     };
0074 
0075     template <>
0076     struct FindTrait<edm::HepMC3Product, HepMC3::GenVertex> {
0077       struct Find {
0078         using first_argument_type = edm::HepMC3Product const &;
0079         using second_argument_type = int;
0080         using result_type = HepMC3::GenVertex const *;
0081 
0082         result_type operator()(first_argument_type iContainer, second_argument_type iBarCode) {
0083           //return iContainer.getHepMCData().barcode_to_vertex(iBarCode);
0084           return nullptr;
0085         }
0086       };
0087 
0088       typedef Find value;
0089     };
0090   }  // namespace refhelper
0091 }  // namespace edm
0092 
0093 #endif  // SimDataFormats_GeneratorProducts_HepMC3Product_h