Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:13:25

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