Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-03 04:18:17

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 <HepMC3/Data/GenEventData.h>
0013 #include <cstddef>
0014 
0015 namespace HepMC3 {
0016   class FourVector;
0017   class GenParticle;
0018   class GenVertex;
0019 }  // namespace HepMC3
0020 
0021 namespace edm {
0022   class HepMC3Product {
0023   public:
0024     HepMC3Product() : isVtxGenApplied_(false), isVtxBoostApplied_(false), isPBoostApplied_(false) {}
0025 
0026     explicit HepMC3Product(HepMC3::GenEvent *evt);
0027     ~HepMC3Product();
0028 
0029     void addHepMCData(HepMC3::GenEvent *evt);
0030 
0031     void applyVtxGen(HepMC3::FourVector const *vtxShift) { applyVtxGen(*vtxShift); }
0032     void applyVtxGen(HepMC3::FourVector const &vtxShift);
0033 
0034     void boostToLab(TMatrixD const *lorentz, std::string const &type);
0035 
0036     const HepMC3::GenEventData *GetEvent() const { return &evt_; }
0037 
0038     bool isVtxGenApplied() const { return isVtxGenApplied_; }
0039     bool isVtxBoostApplied() const { return isVtxBoostApplied_; }
0040     bool isPBoostApplied() const { return isPBoostApplied_; }
0041 
0042   private:
0043     HepMC3::GenEventData evt_;
0044 
0045     bool isVtxGenApplied_;
0046     bool isVtxBoostApplied_;
0047     bool isPBoostApplied_;
0048   };
0049 
0050   // This allows edm::Refs to work with HepMC3Product
0051   namespace refhelper {
0052     template <>
0053     struct FindTrait<edm::HepMC3Product, HepMC3::GenParticle> {
0054       struct Find {
0055         using first_argument_type = edm::HepMC3Product const &;
0056         using second_argument_type = int;
0057         using result_type = HepMC3::GenParticle const *;
0058 
0059         result_type operator()(first_argument_type iContainer, second_argument_type iBarCode) {
0060           //return iContainer.getHepMCData().barcode_to_particle(iBarCode);
0061           return nullptr;
0062         }
0063       };
0064 
0065       typedef Find value;
0066     };
0067 
0068     template <>
0069     struct FindTrait<edm::HepMC3Product, HepMC3::GenVertex> {
0070       struct Find {
0071         using first_argument_type = edm::HepMC3Product const &;
0072         using second_argument_type = int;
0073         using result_type = HepMC3::GenVertex const *;
0074 
0075         result_type operator()(first_argument_type iContainer, second_argument_type iBarCode) {
0076           //return iContainer.getHepMCData().barcode_to_vertex(iBarCode);
0077           return nullptr;
0078         }
0079       };
0080 
0081       typedef Find value;
0082     };
0083   }  // namespace refhelper
0084 }  // namespace edm
0085 
0086 #endif  // SimDataFormats_GeneratorProducts_HepMC3Product_h