CheckRegion.hh
Go to the documentation of this file.00001
00007 #ifndef CHECKREGION_h
00008 #define CHECKREGION_h
00009 #include <stdexcept>
00010 #include "ProcessingCut.hh"
00011 namespace ProcessingCuts{
00012
00017 class CheckRegion : public ProcessingCut{
00018 public:
00019 CheckRegion();
00020 ~CheckRegion() {}
00021
00022 static std::string GetCutName(){ return "CheckRegion";}
00023
00024 bool Process(EventDataPtr event);
00025 int AddDependenciesToModule(BaseModule* mod);
00027 enum variable_t {MIN, MAX, INTEGRAL, NPE, AMPLITUDE};
00028 private:
00029 bool ProcessChannel(ChannelData* chdata);
00030 int channel;
00031 int region;
00032 double minimum;
00033 double maximum;
00034 variable_t variable;
00035 bool default_pass;
00036 };
00037
00039 inline
00040 std::ostream& operator<<(std::ostream& out,
00041 const CheckRegion::variable_t& var){
00042 if(var == CheckRegion::MIN)
00043 return out<<"min";
00044 else if(var == CheckRegion::MAX)
00045 return out<<"max";
00046 else if(var == CheckRegion::INTEGRAL)
00047 return out<<"integral";
00048 else if(var == CheckRegion::NPE)
00049 return out<<"npe";
00050 else if(var == CheckRegion::AMPLITUDE)
00051 return out<<"amplitude";
00052 return out;
00053 }
00055 inline
00056 std::istream& operator>>(std::istream& in, CheckRegion::variable_t& var){
00057 std::string vname;
00058 in>>vname;
00059 if(vname == "min") var = CheckRegion::MIN;
00060 else if (vname == "max") var = CheckRegion::MAX;
00061 else if (vname == "integral") var = CheckRegion::INTEGRAL;
00062 else if (vname == "npe") var = CheckRegion::NPE;
00063 else if (vname == "amplitude") var = CheckRegion::AMPLITUDE;
00064 else{
00065 std::cerr<<"Unknown variable type "<<vname<<std::endl;
00066 throw std::invalid_argument("CheckRegion::variable_t has no entry"+vname);
00067 }
00068 return in;
00069 }
00070 }
00071
00072 #endif