Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:10:12

0001 #ifndef PHASIC_Selectors_Selector_H
0002 #define PHASIC_Selectors_Selector_H
0003 
0004 #include "PHASIC++/Selectors/Cut_Data.H"
0005 #include "ATOOLS/Math/Vector.H"
0006 #include "ATOOLS/Org/Getter_Function.H"
0007 #include "ATOOLS/Phys/NLO_Subevt.H"
0008 #include "ATOOLS/Phys/Flavour.H"
0009 #include "ATOOLS/Phys/Selector_List.H"
0010 #include "ATOOLS/Org/Message.H"
0011 #include "ATOOLS/Org/Scoped_Settings.H"
0012 
0013 #include <limits>
0014 
0015 namespace ATOOLS {
0016   class Scoped_Settings;
0017 }
0018 
0019 namespace PHASIC {
0020 
0021   class Process_Base;
0022 
0023   class Selector_Log {
0024   private:
0025 
0026     std::string m_name;
0027     long int    m_rejected, m_passed;
0028 
0029   public :
0030 
0031     inline Selector_Log(const std::string &name): 
0032       m_name(name), m_rejected(0), m_passed(0) {}
0033 
0034     void Output();
0035 
0036     inline long int Rejections() const { return m_rejected; }
0037     inline long int Passed() const     { return m_passed;   }
0038 
0039     inline void ChangeName(std::string newname) { m_name=newname; }
0040 
0041     inline int  Hit(bool hit) 
0042     { 
0043       if (hit) { ++m_rejected; return 1; } 
0044       else { ++m_passed; return 0;}
0045     }
0046 
0047   };// end of class Selector_Log
0048 
0049   struct Selector_Key {
0050     std::vector<ATOOLS::Scoped_Settings> GetSelectors() const;
0051     /// add an additional selector that is not specified by the user
0052     void AddSelectorYAML(const std::string&);
0053     ATOOLS::Scoped_Settings m_settings;
0054     Process_Base* p_proc{ NULL };
0055   private:
0056     ATOOLS::Settings m_addedselectors;
0057     std::string m_yaml;
0058   };// end of struct Selector_Key
0059 
0060   class Selector_Base {
0061   protected :
0062 
0063     std::string m_name;
0064     bool        m_on,m_isnlo;
0065 
0066     Selector_Log *m_sel_log;
0067     Process_Base *p_proc;
0068     std::vector<Selector_Base*> m_sels;
0069 
0070     size_t m_nin, m_nout, m_n;
0071     int m_pass;
0072     std::vector<ATOOLS::Weights_Map> m_results;
0073 
0074     ATOOLS::Flavour *p_fl;
0075     ATOOLS::NLO_subevt *p_sub;
0076 
0077     double m_smin,m_smax;
0078 
0079   public :
0080 
0081     Selector_Base(const std::string &name,Process_Base *const proc=NULL);
0082 
0083     virtual ~Selector_Base();
0084 
0085     // member functions
0086     static void ShowSyntax(const int mode);
0087 
0088     virtual bool Trigger(const ATOOLS::Vec4D_Vector &p,
0089                          const ATOOLS::Flavour *fl=NULL, size_t n=0);
0090     virtual bool Trigger(ATOOLS::Selector_List &sl) = 0;
0091 
0092     virtual void BuildCuts(Cut_Data *) = 0;
0093     virtual void AddOnshellCondition(std::string,double);
0094     virtual void Output();
0095 
0096     void ReadInSubSelectors(const Selector_Key &key);
0097 
0098     // inline functions
0099     inline void SetProcess(Process_Base *const proc)
0100     { p_proc=proc; }
0101     inline const PHASIC::Process_Base *const Process(Process_Base *const proc) const
0102     { return p_proc; }
0103 
0104     inline std::string Name() const { return m_name; }
0105 
0106     inline int Pass() const { return m_pass; }
0107 
0108     /// after Trigger(), this can be used to retrieve variations of the result
0109     /// (e.g. when varying the QCUT scale)
0110     const std::vector<ATOOLS::Weights_Map>& Results() const;
0111 
0112   };// end of class Selector_Base
0113 
0114   typedef ATOOLS::Getter_Function
0115   <Selector_Base,Selector_Key> Selector_Getter;
0116 
0117 }
0118 
0119 #endif