3 #include "boost/algorithm/string.hpp" 4 #include "boost/algorithm/string/trim_all.hpp" 25 std::vector<std::string> use_final_states = iConfig.
getParameter<std::vector<std::string> >(
"Final_States");
27 for (std::vector<std::string>::const_iterator final_state = use_final_states.begin(); final_state != use_final_states.end(); ++final_state){
28 if ( (*final_state) ==
"ElEl")
fill_cuts(cut_string_elel,
ee);
29 else if ( (*final_state) ==
"MuMu")
fill_cuts(cut_string_mumu,
mm);
30 else if ( (*final_state) ==
"HadHad")
fill_cuts(cut_string_hadhad,
hh);
31 else if ( (*final_state) ==
"ElMu")
fill_cuts(cut_string_elmu,
em);
32 else if ( (*final_state) ==
"ElHad")
fill_cuts(cut_string_elhad,
eh);
33 else if ( (*final_state) ==
"MuHad")
fill_cuts(cut_string_muhad,
mh);
34 else edm::LogWarning(
"EmbeddingHepMCFilter") << (*final_state) <<
" this decay channel is not supported. Please choose on of (ElEl,MuMu,HadHad,ElMu,ElHad,MuHad)";
49 std::vector<reco::Candidate::LorentzVector> p4VisPair_;
53 for ( HepMC::GenEvent::particle_const_iterator particle = evt->particles_begin(); particle != evt->particles_end(); ++particle )
56 if ((*particle)->production_vertex() !=
nullptr){
57 if ((*particle)->production_vertex()->particles_in_const_begin() != (*particle)->production_vertex()->particles_in_const_end()){
58 mom_id = (*(*particle)->production_vertex()->particles_in_const_begin())->
pdg_id();
65 p4VisPair_.push_back(p4Vis);
69 p4VisPair_.push_back(p4Vis);
73 p4VisPair_.push_back(p4Vis);
80 if (p4VisPair_.size() == 2) {
82 edm::LogInfo(
"EmbeddingHepMCFilter") <<
"Quantities of the visible decay products:" 83 <<
"\tPt's: " <<
" 1st " << p4VisPair_[0].Pt() <<
", 2nd " << p4VisPair_[1].Pt()
84 <<
"\tEta's: " <<
" 1st " << p4VisPair_[0].Eta() <<
", 2nd " << p4VisPair_[1].Eta()
88 edm::LogError(
"EmbeddingHepMCFilter") <<
"Size less non equal two";
98 bool decaymode_known =
false;
99 for (HepMC::GenVertex::particle_iterator daughter = particle->end_vertex()->particles_begin(
HepMC::children);
100 daughter != particle->end_vertex()->particles_end(
HepMC::children); ++daughter)
114 decaymode_known =
true;
119 decaymode_known =
true;
124 decaymode_known =
true;
143 edm::LogVerbatim(
"EmbeddingHepMCFilter") <<
"Changing symmetric channels to Leading_Trailing convention in Pt";
144 edm::LogVerbatim(
"EmbeddingHepMCFilter") <<
"Pt's before: " << p4VisPair[0].Pt() <<
" " << p4VisPair[1].Pt();
146 edm::LogVerbatim(
"EmbeddingHepMCFilter") <<
"Pt's after: " << p4VisPair[0].Pt() <<
" " << p4VisPair[1].Pt();
148 else if (mixed_false_order)
150 edm::LogVerbatim(
"EmbeddingHepMCFilter") <<
"Swapping order of mixed channels";
151 edm::LogVerbatim(
"EmbeddingHepMCFilter") <<
"Pt's before: " << p4VisPair[0].Pt() <<
" " << p4VisPair[1].Pt();
155 edm::LogVerbatim(
"EmbeddingHepMCFilter") <<
"Pt's after: " << p4VisPair[0].Pt() <<
" " << p4VisPair[1].Pt();
162 for (std::vector<CutsContainer>::const_iterator
cut =
cuts_.begin();
cut !=
cuts_.end(); ++
cut)
165 edm::LogInfo(
"EmbeddingHepMCFilter") <<
"Cut pt1 = " <<
cut->pt1 <<
" pt2 = " <<
cut->pt2
166 <<
" abs(eta1) = " <<
cut->eta1 <<
" abs(eta2) = " <<
cut->eta2
170 if((
cut->pt1 == -1. || (p4VisPair[0].Pt() >
cut->pt1)) &&
171 (
cut->pt2 == -1. || (p4VisPair[1].Pt() >
cut->pt2)) &&
174 edm::LogInfo(
"EmbeddingHepMCFilter") <<
"This cut was passed (Stop here and take the event)";
185 boost::trim_fill(cut_string,
"");
186 std::vector<std::string> cut_paths;
187 boost::split(cut_paths, cut_string, boost::is_any_of(
"||"), boost::token_compress_on);
188 for(
unsigned int i=0;
i<cut_paths.size(); ++
i){
192 cuts_.push_back(cut);
203 boost::replace_all(cut_string,
"(",
"");
204 boost::replace_all(cut_string,
")",
"");
205 std::vector<std::string> single_cuts;
206 boost::split(single_cuts, cut_string, boost::is_any_of(
"&&"), boost::token_compress_on);
207 for (
unsigned int i=0;
i<single_cuts.size(); ++
i)
225 if(boost::find_first(single_cuts[
i], pt1_str))
227 boost::erase_first(single_cuts[i], pt1_str);
228 cut.
pt1 = std::stod(single_cuts[i]);
230 else if (boost::find_first(single_cuts[i], pt2_str))
232 boost::erase_first(single_cuts[i], pt2_str);
233 cut.
pt2 = std::stod(single_cuts[i]);
235 else if (boost::find_first(single_cuts[i], eta1_str))
237 boost::erase_first(single_cuts[i], eta1_str);
238 cut.
eta1 = std::stod(single_cuts[i]);
240 else if (boost::find_first(single_cuts[i], eta2_str))
242 boost::erase_first(single_cuts[i], eta2_str);
243 cut.
eta2 = std::stod(single_cuts[i]);
T getParameter(std::string const &) const
bool filter(const HepMC::GenEvent *evt) override
DecayChannel DecayChannel_
~EmbeddingHepMCFilter() override
const int tauon_neutrino_PDGID_
virtual void decay_and_sump4Vis(HepMC::GenParticle *particle, reco::Candidate::LorentzVector &p4Vis)
EmbeddingHepMCFilter(const edm::ParameterSet &)
virtual void fill_cut(std::string cut_string, EmbeddingHepMCFilter::DecayChannel &dc, CutsContainer &cut)
Abs< T >::type abs(const T &t)
std::string return_mode(TauDecayMode mode)
std::vector< CutsContainer > cuts_
const int electron_neutrino_PDGID_
DecayChannel decaychannel
math::XYZTLorentzVector LorentzVector
Lorentz vector.
virtual void sort_by_convention(std::vector< reco::Candidate::LorentzVector > &p4VisPair)
virtual void fill_cuts(std::string cut_string, EmbeddingHepMCFilter::DecayChannel &dc)
void fill(TauDecayMode mode)
const int muon_neutrino_PDGID_
virtual bool apply_cuts(std::vector< reco::Candidate::LorentzVector > &p4VisPair)