Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:29:36

0001 #ifndef __EMBEDDINGHEPMCFILTER__
0002 #define __EMBEDDINGHEPMCFILTER__
0003 
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 
0006 #include "GeneratorInterface/Core/interface/BaseHepMCFilter.h"
0007 #include "DataFormats/Candidate/interface/Candidate.h"
0008 
0009 class EmbeddingHepMCFilter : public BaseHepMCFilter {
0010 private:
0011   const int tauon_neutrino_PDGID_ = 16;
0012   const int tauonPDGID_ = 15;
0013   const int muon_neutrino_PDGID_ = 14;
0014   const int muonPDGID_ = 13;
0015   const int electron_neutrino_PDGID_ = 12;
0016   const int electronPDGID_ = 11;
0017   int ZPDGID_ = 23;
0018 
0019   enum class TauDecayMode : int { Unfilled = -1, Muon = 0, Electron = 1, Hadronic = 2 };
0020 
0021   std::string return_mode(TauDecayMode mode) {
0022     if (mode == TauDecayMode::Muon)
0023       return "Mu";
0024     else if (mode == TauDecayMode::Electron)
0025       return "El";
0026     else if (mode == TauDecayMode::Hadronic)
0027       return "Had";
0028     else
0029       return "Undefined";
0030   }
0031 
0032   struct DecayChannel {
0033     TauDecayMode first = TauDecayMode::Unfilled;
0034     TauDecayMode second = TauDecayMode::Unfilled;
0035 
0036     void fill(TauDecayMode mode) {
0037       if (first == TauDecayMode::Unfilled)
0038         first = mode;
0039       else if (second == TauDecayMode::Unfilled)
0040         second = mode;
0041     };
0042     void reset() {
0043       first = TauDecayMode::Unfilled;
0044       second = TauDecayMode::Unfilled;
0045     }
0046     void reverse() {
0047       TauDecayMode tmp = first;
0048       first = second;
0049       second = tmp;
0050     }
0051   };
0052 
0053   DecayChannel ee, mm, hh, em, eh, mh;
0054 
0055   struct CutsContainer {
0056     double pt1 = -1.;
0057     double pt2 = -1.;
0058     double eta1 = -1.;  // since we use abs eta values the -1 as default is OK
0059     double eta2 = -1.;
0060     DecayChannel decaychannel;
0061   };
0062 
0063   std::vector<CutsContainer> cuts_;
0064   DecayChannel DecayChannel_;
0065 
0066   virtual void fill_cut(std::string cut_string, EmbeddingHepMCFilter::DecayChannel &dc, CutsContainer &cut);
0067   virtual void fill_cuts(std::string cut_string, EmbeddingHepMCFilter::DecayChannel &dc);
0068 
0069   virtual void decay_and_sump4Vis(HepMC::GenParticle *particle, reco::Candidate::LorentzVector &p4Vis);
0070   virtual void sort_by_convention(std::vector<reco::Candidate::LorentzVector> &p4VisPair);
0071   virtual bool apply_cuts(std::vector<reco::Candidate::LorentzVector> &p4VisPair);
0072 
0073 public:
0074   explicit EmbeddingHepMCFilter(const edm::ParameterSet &);
0075   ~EmbeddingHepMCFilter() override;
0076 
0077   bool filter(const HepMC::GenEvent *evt) override;
0078 };
0079 
0080 #endif