#include "PHASIC++/Selectors/Selector.H" namespace ATOOLS { template class Variable_Base; class Order_Base; } namespace PHASIC { class Variable_Selector : public Selector_Base { ATOOLS::Variable_Base *p_variable; std::vector m_orders; std::vector > m_bounds; std::vector > m_moms; std::vector m_cfl; std::vector > m_nfl; std::vector m_ffl; std::string m_omode; int m_imode; bool Trigger(const ATOOLS::Selector_List &sl,size_t &l,size_t &u, ATOOLS::Vec4D_Vector &moms,const size_t &f, const size_t &n,const size_t &m,const size_t &id); public: // constructor Variable_Selector(Process_Base* const proc, const int& imode, const std::string& name); // destructor ~Variable_Selector(); // member functions void BuildCuts(Cut_Data *cuts); void SetRange(int id,ATOOLS::Flavour_Vector pfl, ATOOLS::Flavour_Vector fl, std::vector > &bounds); bool Trigger(ATOOLS::Selector_List &sl); bool Trigger(ATOOLS::Selector_List &sl,const int id); };// end of class Variable_Selector }// end of namespace PHASIC #include "PHASIC++/Process/Process_Base.H" #include "PHASIC++/Main/Process_Integrator.H" #include "ATOOLS/Math/Variable.H" #include "ATOOLS/Phys/Ordering.H" #include "ATOOLS/Org/MyStrStream.H" #include "ATOOLS/Org/Exception.H" #include "ATOOLS/Org/Data_Reader.H" #include #define DEBUG__Variable_Selector using namespace PHASIC; using namespace ATOOLS; Variable_Selector::Variable_Selector(Process_Base* const proc, const int& imode, const std::string& name) : Selector_Base("Variable("+name+")",proc) { m_imode=imode; size_t pos(name.find('|')); while (pos pfl,std::vector fl, std::vector > &bounds) { m_cfl.push_back(Flavour_Vector()); m_nfl.push_back(std::vector()); if (id>=m_cfl.size()) THROW(fatal_error,"Invalid call"); for (size_t i(0);i(m_cfl[id].size())); m_bounds=bounds; m_name="Variable_Selector_"+ToString(m_imode)+"_"; for (size_t j(0);jName()<<"_{"<j) msg_Debugging()<<"["<j) msg_Debugging()<<"["< "< {"; if (m_moms[id][j].size()>0) msg_Debugging()<ChangeName(m_name); } bool Variable_Selector::Trigger (const Selector_List &sl,size_t &l,size_t &u,std::vector &moms, const size_t &f,const size_t &n,const size_t &m,const size_t &id) { msg_Indent(); if (f==m_cfl[id].size()) { if (m_ffl.empty()) u=l; else if (u>=m_ffl.size() || l!=m_ffl[u]) { ++l; return true; } if (u>=m_bounds.size()) return true; double v((*p_variable)(&moms.front(),moms.size())); #ifdef DEBUG__Variable_Selector msg_Debugging()<Name() <<"="<m_bounds[u].second); ++l; ++u; return !m_sel_log->Hit(res); } if (n==m_nfl[id][f]) return Trigger(sl,l,u,moms,f+1,0,0,id); moms.push_back(Vec4D()); for (size_t k(m);k "< moms; bool hit(Trigger(sl,l,u,moms,0,0,0,0)); #ifdef DEBUG__Variable_Selector msg_Debugging()<<"}\n"; #endif return hit; } bool Variable_Selector::Trigger(Selector_List &sl) { return Trigger(sl,p_sub?(p_sub->IsReal()?0:p_sub->m_idx+1):0); } DECLARE_GETTER(Variable_Selector,"VariableSelector",Selector_Base,Selector_Key); Selector_Base *ATOOLS::Getter:: operator()(const Selector_Key &key) const { #ifdef DEBUG__Variable_Selector msg_Debugging()<<"Getter::operator(): {\n"; #endif auto s = key.m_settings["VariableSelector"]; s.DeclareVectorSettingsWithEmptyDefault({ "Flavs" }); s.DeclareMatrixSettingsWithEmptyDefault({ "Ranges" }); const auto flavs = s["Flavs"].GetVector(); if (flavs.empty()) THROW(critical_error,"Missing \"Flav\" specification in variable selector"); Flavour_Vector cflavs(flavs.size()); for (size_t j(0);j(); if (bounds.empty()) THROW(critical_error,"Missing \"Ranges\" specification in variable selector"); std::vector > cbounds; for (const auto single_bounds : bounds) { if (single_bounds.size() != 2) THROW(critical_error,"Ranges need to have two entries."); cbounds.push_back(std::make_pair(single_bounds[0], single_bounds[1])); } auto name = s["Variable"].SetDefault("").Get(); const auto orderings = s["Ordering"].SetDefault("").Get(); name += "|" + orderings; const auto imode = s["Mode"].SetDefault(0).Get(); Variable_Selector *vs( new Variable_Selector(key.p_proc, imode, name)); vs->SetRange(0,key.p_proc->Flavours(),cflavs,cbounds); NLO_subevtlist *subs(key.p_proc->GetSubevtList()); if (subs) { for (size_t i(0);isize()-1;++i) { Flavour_Vector fls((*subs)[i]->p_fl, &(*subs)[i]->p_fl[(*subs)[i]->m_n]); vs->SetRange((*subs)[i]->m_idx+1,fls,cflavs,cbounds); } } #ifdef DEBUG__Variable_Selector msg_Debugging()<<"}\n"; #endif return vs; } void ATOOLS::Getter:: PrintInfo(std::ostream &str,const size_t width) const { str<<"variable selector"; }