All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
include/N3AnaBase/cuts/tof_cut.h
00001 // -*- mode: c++; -*-
00002 // energy_cut.h
00003 
00004 /* Description of the cut:
00005  *
00006  *  This cut propose different ways to check if some
00007  *  energy deposits in the scintillator blocks fall
00008  *  within some range:
00009  *
00010  *  Units:
00011  *
00012  *    Energy is given in keV
00013  *
00014  *  Energy range is defined via:
00015  *
00016  *    MIN == lower bound of the energy interval
00017  *    MAX == upper bound of the energy interval
00018  *
00019  *  Available modes:
00020  *
00021  *    ENERGY_MIN == check if the minimum energy deposit is in range
00022  *    ENERGY_MAX == check if the maximum energy deposit is in range
00023  *    ENERGY_SUM == check if the total energy deposit is in range
00024  *    ENERGY_EACH == check if each energy deposit is in range
00025  *
00026  *  The INVERTED flag check if the value is outside the given range
00027  *
00028  */
00029 
00030 #ifndef __N3AnaBase__energy_cut_h
00031 #define __N3AnaBase__energy_cut_h 1
00032 
00033 #include <cstdlib>
00034 #include <iostream>
00035 #include <string>
00036 #include <sstream>
00037 #include <stdexcept>
00038 
00039 #include <boost/numeric/interval.hpp>
00040 
00041 #include <N3AnaBase/cuts/i_ana_event_cut.h>
00042 #include <N3AnaBase/measurements/tof_tools.h>
00043 
00044 namespace nemo3 {
00045 
00046   class tof_cut : public nemo3::i_ana_event_cut
00047     {
00048     public:
00049       enum mode_t
00050         {
00051           MODE_INVALID    = -1,
00052           MODE_INCLUSIVE  = 0,
00053           MODE_EXCLUSIVE  = 1,//mode externe ?
00054         };
00055 
00056 
00057       static const std::string INTERNAL_ELECTRON_CANDIDATE; // = "tof.internal_electron_candidate";
00058       static const std::string INTERNAL_GAMMA_CANDIDATE;    // = "tof.internal_gamma_candidate";
00059 
00060       static int get_mode_from_label (const std::string & label_);
00061 
00062       static std::string get_label_from_mode (int mode_);
00063 
00064       static bool is_mode_valid (int mode_);
00065 
00066       static std::ostream & print_NENG (std::ostream & out_,
00067                                         int NE_, int NG_,
00068                                         double proba_int_ee_, double proba_ext_ee_,
00069                                         double proba_int_eg_, double proba_ext_eg_);
00070 
00071     private:
00072 
00073       double  __NE;
00074       double  __NG;
00075       double  __NGT;
00076       double  __proba_int_ee;
00077       double  __proba_ext_ee;
00078       double  __proba_int_eg;
00079       double  __proba_ext_eg;
00080       double  __proba_int_gg;
00081       bool    __debug;
00082       int     __mode;
00083       std::string __tracking_name;
00084       tof_tools * __tof_tools;
00085 
00086     public:
00087 
00088       bool is_mode_inclusive () const;
00089 
00090       bool is_mode_exclusive () const;
00091 
00092       tof_cut (bool debug_ = false); // default ctor
00093 
00094       virtual ~tof_cut (); // dtor
00095 
00096       void set (int mode_, int ne_, int ng_, int ngt,
00097                 double proba_int_ee_, double proba_ext_ee_,
00098                 double proba_int_eg_, double proba_ext_eg_,
00099                 double proba_int_gg_);
00100 
00101     public:
00102 
00103       bool is_debug () const;
00104 
00105       void set_debug (bool);
00106 
00107       void dump (std::ostream & out_ = std::clog) const;
00108 
00109     public:
00110       bool accept ();
00111 
00112     protected:
00113       virtual void __prepare_cut ();
00114 
00115     // used by the cuts' factory stuff:
00116     private:
00117       static creator_registration<tof_cut> __CR;
00118 
00119     public:
00120 
00121       static const std::string CUT_ID;
00122 
00123       virtual std::string cut_id () const;
00124 
00125       virtual cut_creator_t cut_creator () const;
00126 
00127       static nemo3::i_ana_event_cut * create (const nemocuts::ICutFactory::cut_properties_t & cut_properties_);
00128 
00129     };
00130 
00131 } // end of namespace nemo3
00132 
00133 #endif /* __N3AnaBase_energy__cut_h */
00134 
00135 // end of tof_cut.h