Skip to content

Commit

Permalink
rebasing gen filter to CMSSW_10_2_X
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel authored and daniel committed Aug 24, 2019
1 parent 0fec4de commit ec7effe
Show file tree
Hide file tree
Showing 3 changed files with 276 additions and 299 deletions.
148 changes: 67 additions & 81 deletions GeneratorInterface/Core/interface/EmbeddingHepMCFilter.h
Original file line number Diff line number Diff line change
@@ -1,94 +1,80 @@
#ifndef __EMBEDDINGHEPMCFILTER__
#define __EMBEDDINGHEPMCFILTER__


#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "GeneratorInterface/Core/interface/BaseHepMCFilter.h"
#include "DataFormats/Candidate/interface/Candidate.h"

class EmbeddingHepMCFilter : public BaseHepMCFilter{

private:

const int tauon_neutrino_PDGID_ = 16;
const int tauonPDGID_ = 15;
const int muon_neutrino_PDGID_ = 14;
const int muonPDGID_ = 13;
const int electron_neutrino_PDGID_ = 12;
const int electronPDGID_ = 11;
const int ZPDGID_ = 23;

enum class TauDecayMode : int
{
Unfilled = -1,
Muon = 0,
Electron = 1,
Hadronic = 2
};

std::string return_mode(TauDecayMode mode)
{
if (mode == TauDecayMode::Muon) return "Mu";
else if (mode == TauDecayMode::Electron) return "El";
else if (mode == TauDecayMode::Hadronic) return "Had";
else return "Undefined";
}


struct DecayChannel
{
TauDecayMode first = TauDecayMode::Unfilled;
TauDecayMode second = TauDecayMode::Unfilled;

void fill(TauDecayMode mode)
{
if (first == TauDecayMode::Unfilled) first = mode;
else if (second == TauDecayMode::Unfilled) second = mode;
};
void reset()
{
first = TauDecayMode::Unfilled;
second = TauDecayMode::Unfilled;
}
void reverse()
{
TauDecayMode tmp = first;
first = second;
second = tmp;
}
};

DecayChannel ee,mm,hh,em,eh,mh;


struct CutsContainer
{
double pt1 = -1.;
double pt2 = -1.;
double eta1 = -1.; // since we use abs eta values the -1 as default is OK
double eta2 = -1.;
DecayChannel decaychannel;
};


std::vector<CutsContainer> cuts_;
DecayChannel DecayChannel_;
class EmbeddingHepMCFilter : public BaseHepMCFilter {
private:
const int tauon_neutrino_PDGID_ = 16;
const int tauonPDGID_ = 15;
const int muon_neutrino_PDGID_ = 14;
const int muonPDGID_ = 13;
const int electron_neutrino_PDGID_ = 12;
const int electronPDGID_ = 11;
int ZPDGID_ = 23;

enum class TauDecayMode : int { Unfilled = -1, Muon = 0, Electron = 1, Hadronic = 2 };

std::string return_mode(TauDecayMode mode) {
if (mode == TauDecayMode::Muon)
return "Mu";
else if (mode == TauDecayMode::Electron)
return "El";
else if (mode == TauDecayMode::Hadronic)
return "Had";
else
return "Undefined";
}

struct DecayChannel {
TauDecayMode first = TauDecayMode::Unfilled;
TauDecayMode second = TauDecayMode::Unfilled;

void fill(TauDecayMode mode) {
if (first == TauDecayMode::Unfilled)
first = mode;
else if (second == TauDecayMode::Unfilled)
second = mode;
};
void reset() {
first = TauDecayMode::Unfilled;
second = TauDecayMode::Unfilled;
}
void reverse() {
TauDecayMode tmp = first;
first = second;
second = tmp;
}
};

DecayChannel ee, mm, hh, em, eh, mh;

struct CutsContainer {
double pt1 = -1.;
double pt2 = -1.;
double eta1 = -1.; // since we use abs eta values the -1 as default is OK
double eta2 = -1.;
DecayChannel decaychannel;
};

std::vector<CutsContainer> cuts_;
DecayChannel DecayChannel_;

virtual void fill_cut(std::string cut_string, EmbeddingHepMCFilter::DecayChannel &dc, CutsContainer &cut);
virtual void fill_cuts(std::string cut_string, EmbeddingHepMCFilter::DecayChannel &dc);

virtual void decay_and_sump4Vis(HepMC::GenParticle *particle, reco::Candidate::LorentzVector &p4Vis);
virtual void sort_by_convention(std::vector<reco::Candidate::LorentzVector> &p4VisPair);
virtual bool apply_cuts(std::vector<reco::Candidate::LorentzVector> &p4VisPair);

virtual void fill_cut(std::string cut_string, EmbeddingHepMCFilter::DecayChannel &dc, CutsContainer &cut);
virtual void fill_cuts(std::string cut_string, EmbeddingHepMCFilter::DecayChannel &dc);
public:
explicit EmbeddingHepMCFilter(const edm::ParameterSet &);
~EmbeddingHepMCFilter() override;

virtual void decay_and_sump4Vis(HepMC::GenParticle* particle, reco::Candidate::LorentzVector &p4Vis);
virtual void sort_by_convention(std::vector<reco::Candidate::LorentzVector> &p4VisPair);
virtual bool apply_cuts(std::vector<reco::Candidate::LorentzVector> &p4VisPair);

public:

explicit EmbeddingHepMCFilter(const edm::ParameterSet &);
~EmbeddingHepMCFilter() override;

bool filter(const HepMC::GenEvent* evt) override;

bool filter(const HepMC::GenEvent *evt) override;
};

#endif
Loading

0 comments on commit ec7effe

Please sign in to comment.