#include <IdChannel.h>
Public Member Functions | |
channel (Detector_t det=kAnyDetector, SlowFast_t type=kAnySlowFast) | |
Construct using a Detector_t and SlowFast_t enum. Also acts as a default constructor, which produces a channel ID that matches all other channel IDs. | |
channel (const std::string &detector, const std::string &type) | |
Constructs a channel ID using a pair of strings for the detector and filtering type. | |
channel (const std::string &channel) | |
Constructs a channel ID using a string containing both detector name and the timing filter type. | |
virtual | ~channel () |
void | Reset () |
Detector_t | Detector () const |
Get the detector enum for this channel. | |
void | Detector (const Detector_t &d) |
SlowFast_t | SlowFast () const |
Get the SlowFast enum for this channel. | |
void | SlowFast (const SlowFast_t &d) |
channel & | operator= (const std::string &rhs) |
channel & | operator= (const char *rhs) |
bool | operator== (const channel &rhs) const |
Returns true if this channel is the same as another. | |
bool | operator!= (const channel &rhs) const |
Returns true if this channel is not the same as another. | |
bool | matches (const channel &rhs) const |
Check if this channel is the same as another or has it's fields set to 'any'. | |
bool | operator< (const channel &rhs) const |
not intuitively meaningful but maybe useful for sorting | |
bool | operator> (const channel &rhs) const |
not intuitively meaningful but maybe useful for sorting | |
std::string | str () const |
Returns the channel as a string. | |
bool | isValid () |
Check there there have been no errors creating this channel ID. | |
bool | isWildCardDetector () const |
Check if the Detector_t is a wildcard. | |
bool | isWildCardSlowFast () const |
Check if the SlowFast_t is a wildcard. | |
bool | isWildCard () const |
bool | isFast () const |
Check if this channel ID is for a fast channel. | |
bool | isSlow () const |
Check if this channel ID is for a slow channel. | |
channel | GetCorrespondingFastSlow () const |
void | Debug () const |
Print the individual components of the ID. | |
Static Public Member Functions | |
static std::string | GetDetectorString (Detector_t det) |
Convert a Detector_t enum into the corresponding string. | |
static Detector_t | GetDetectorEnum (const std::string &det) |
static std::string | GetSlowFastString (SlowFast_t sf) |
Convert a SlowFast_t enum into the corresponding string. | |
static SlowFast_t | GetSlowFastEnum (const std::string &sf) |
Private Member Functions | |
ClassDef (IDs::channel, 1) | |
Private Attributes | |
Detector_t | fDetector |
The detector that produced this channel. | |
SlowFast_t | fSlowFast |
The type of timing filter used, if any, on this channel. |
Class to identify a channel. A channel is one stream of data from one part of a detector, for example: / SiR1_1-F, Ge-F, or ScVe. Within a run, a channel corresponds to a fixed midas bank, but between runs this mapping may change.
Definition at line 46 of file IdChannel.h.
IDs::channel::channel | ( | Detector_t | det = kAnyDetector , |
|
SlowFast_t | type = kAnySlowFast | |||
) | [inline] |
Construct using a Detector_t and SlowFast_t enum. Also acts as a default constructor, which produces a channel ID that matches all other channel IDs.
det | The detector's name | |
type | The type of timing filter |
Definition at line 180 of file IdChannel.h.
Referenced by GetCorrespondingFastSlow().
IDs::channel::channel | ( | const std::string & | detector, | |
const std::string & | type | |||
) | [inline] |
Constructs a channel ID using a pair of strings for the detector and filtering type.
det | The detector's name | |
type | The type of timing filter |
Definition at line 183 of file IdChannel.h.
References fDetector, fSlowFast, GetDetectorEnum(), and GetSlowFastEnum().
00183 :fDetector(),fSlowFast(kAnySlowFast){ 00184 fDetector=GetDetectorEnum(detector); 00185 fSlowFast=GetSlowFastEnum(type); 00186 }
IDs::channel::channel | ( | const std::string & | channel | ) | [inline] |
Constructs a channel ID using a string containing both detector name and the timing filter type.
This is treated in the same way as operator=(const std::string&)
Definition at line 188 of file IdChannel.h.
00188 :fDetector(),fSlowFast(kAnySlowFast){ 00189 *this=channel; 00190 }
virtual IDs::channel::~channel | ( | ) | [inline, virtual] |
Definition at line 67 of file IdChannel.h.
IDs::channel::ClassDef | ( | IDs::channel | , | |
1 | ||||
) | [private] |
void IDs::channel::Debug | ( | ) | const |
Print the individual components of the ID.
Definition at line 125 of file IdChannel.cpp.
References Detector(), GetDetectorString(), GetSlowFastString(), and SlowFast().
Referenced by IDs::source::Debug().
00125 { 00126 std::cout<<"Detector: "<<GetDetectorString(Detector())<<std::endl; 00127 std::cout<<"Slow/fast: "<<GetSlowFastString(SlowFast())<<std::endl; 00128 }
void IDs::channel::Detector | ( | const Detector_t & | d | ) | [inline] |
Detector_t IDs::channel::Detector | ( | ) | const [inline] |
Get the detector enum for this channel.
Definition at line 72 of file IdChannel.h.
References fDetector.
Referenced by MakeDetectorPulses::BeforeFirstEntry(), Debug(), and PulseCandidateFinder::FindPulseCandidates().
00072 {return fDetector;};
IDs::channel IDs::channel::GetCorrespondingFastSlow | ( | ) | const |
If this is a fast channel return the corresponding slow one else if it's a slow channel return the corresponding fast one else return the same ID
Definition at line 109 of file IdChannel.cpp.
References channel(), fDetector, fSlowFast, IDs::kAnySlowFast, IDs::kErrorSlowFast, IDs::kFast, IDs::kNotApplicable, and IDs::kSlow.
Referenced by MakeDetectorPulses::BeforeFirstEntry(), and PlotTDPs::BeforeFirstEntry().
00109 { 00110 switch(fSlowFast){ 00111 case kFast: return IDs::channel(fDetector,kSlow); break; 00112 case kSlow: return IDs::channel(fDetector,kFast); break; 00113 case kNotApplicable: 00114 case kAnySlowFast: 00115 case kErrorSlowFast:return *this; break; 00116 } 00117 return *this; 00118 }
IDs::Detector_t IDs::channel::GetDetectorEnum | ( | const std::string & | det | ) | [static] |
Get the Detector_t for a given string. returns kErrorDetector if the given string doesn't match any known value
Definition at line 48 of file IdChannel.cpp.
References modules::parser::iequals(), and IDs::num_detector_enums.
Referenced by channel(), and operator=().
00048 { 00049 const char* names[1+IDs::num_detector_enums]={ 00050 "*" , // 0 00051 "Ge" , "LiquidSc" , "NDet" , "NDet2" , "ScGe" ,// 1-5 00052 "ScL" , "ScR" , "ScVe" , "SiL1-1" , "SiL1-2" ,// 6-10 00053 "SiL1-3" , "SiL1-4" , "SiL2" , "SiR1-1" , "SiR1-2" ,// 11-15 00054 "SiR1-3" , "SiR1-4" , "SiR1-sum" , "SiR2" , "muSc" ,// 16-20 00055 "muScA" }; // 21 00056 for (int i=0;i<=IDs::num_detector_enums;i++){ 00057 if(modules::parser::iequals(det,names[i])) return (Detector_t)i; 00058 } 00059 std::cout<<"Unknown detector name given to IDs::channel: '"<<det<<"'"<<std::endl; 00060 throw Except::InvalidDetector(det.c_str()); 00061 }
std::string IDs::channel::GetDetectorString | ( | Detector_t | det | ) | [static] |
Convert a Detector_t enum into the corresponding string.
Definition at line 18 of file IdChannel.cpp.
References IDs::kAnyDetector, IDs::kErrorDetector, IDs::kGe, IDs::kLiquidSc, IDs::kMuSc, IDs::kMuScA, IDs::kNDet, IDs::kNDet2, IDs::kScGe, IDs::kScL, IDs::kScR, IDs::kScVe, IDs::kSiL1_1, IDs::kSiL1_2, IDs::kSiL1_3, IDs::kSiL1_4, IDs::kSiL2, IDs::kSiR1_1, IDs::kSiR1_2, IDs::kSiR1_3, IDs::kSiR1_4, IDs::kSiR1_sum, and IDs::kSiR2.
Referenced by MakeDetectorPulses::BeforeFirstEntry(), and Debug().
00018 { 00019 std::string output; 00020 switch(det){ 00021 case kErrorDetector : output="Unknown"; break ; 00022 case kAnyDetector : output="*" ; break ; 00023 case kGe : output="Ge" ; break ; 00024 case kLiquidSc : output="LiquidSc" ; break ; 00025 case kNDet : output="NDet" ; break ; 00026 case kNDet2 : output="NDet2" ; break ; 00027 case kScGe : output="ScGe" ; break ; 00028 case kScL : output="ScL" ; break ; 00029 case kScR : output="ScR" ; break ; 00030 case kScVe : output="ScVe" ; break ; 00031 case kSiL1_1 : output="SiL1-1" ; break ; 00032 case kSiL1_2 : output="SiL1-2" ; break ; 00033 case kSiL1_3 : output="SiL1-3" ; break ; 00034 case kSiL1_4 : output="SiL1-4" ; break ; 00035 case kSiL2 : output="SiL2" ; break ; 00036 case kSiR1_1 : output="SiR1-1" ; break ; 00037 case kSiR1_2 : output="SiR1-2" ; break ; 00038 case kSiR1_3 : output="SiR1-3" ; break ; 00039 case kSiR1_4 : output="SiR1-4" ; break ; 00040 case kSiR1_sum : output="SiR1-sum" ; break ; 00041 case kSiR2 : output="SiR2" ; break ; 00042 case kMuSc : output="muSc" ; break ; 00043 case kMuScA : output="muScA" ; break ; 00044 } 00045 return output; 00046 }
IDs::SlowFast_t IDs::channel::GetSlowFastEnum | ( | const std::string & | sf | ) | [static] |
Get the SlowFast_t for a given string. Returns kErrorSlowFast if the given string doesn't match any known value
Definition at line 102 of file IdChannel.cpp.
References modules::parser::iequals(), IDs::kAnySlowFast, IDs::kFast, IDs::kNotApplicable, and IDs::kSlow.
Referenced by channel(), and operator=().
00102 { 00103 if(modules::parser::iequals(type,"-S") || type=="slow") return kSlow; 00104 else if(modules::parser::iequals(type,"-F")|| type=="fast") return kFast; 00105 else if(type=="-*"|| type=="any") return kAnySlowFast; 00106 return kNotApplicable; 00107 }
std::string IDs::channel::GetSlowFastString | ( | SlowFast_t | sf | ) | [static] |
Convert a SlowFast_t enum into the corresponding string.
Definition at line 90 of file IdChannel.cpp.
References IDs::kAnySlowFast, IDs::kErrorSlowFast, IDs::kFast, IDs::kNotApplicable, and IDs::kSlow.
Referenced by Debug().
00090 { 00091 std::string output; 00092 switch(sf){ 00093 case kAnySlowFast : output+="-*" ; break ; 00094 case kSlow : output+="-S" ; break ; 00095 case kFast : output+="-F" ; break ; 00096 case kNotApplicable : break; 00097 case kErrorSlowFast: output+="-Unknown" ;break ; 00098 } 00099 return output; 00100 }
bool IDs::channel::isFast | ( | ) | const [inline] |
Check if this channel ID is for a fast channel.
Definition at line 128 of file IdChannel.h.
References fSlowFast, and IDs::kFast.
Referenced by PulseCandidateFinder::FindPulseCandidates(), IDs::source::isFast(), and MakeDetectorPulses::MakeGenerator().
bool IDs::channel::isSlow | ( | ) | const [inline] |
Check if this channel ID is for a slow channel.
Definition at line 130 of file IdChannel.h.
References fSlowFast, and IDs::kSlow.
Referenced by PulseCandidateFinder::FindPulseCandidates(), and IDs::source::isSlow().
bool IDs::channel::isValid | ( | ) | [inline] |
Check there there have been no errors creating this channel ID.
Definition at line 114 of file IdChannel.h.
References fDetector, fSlowFast, IDs::kErrorDetector, and IDs::kErrorSlowFast.
Referenced by PulseCandidateFinder::FindPulseCandidates().
00114 {return (fDetector!=kErrorDetector) && (fSlowFast != kErrorSlowFast);};
bool IDs::channel::isWildCard | ( | ) | const [inline] |
Check if this channel ID is a wildcard (either Detector_t or SlowFast_t is kAny...). User must interrogate further to find out which.
Definition at line 125 of file IdChannel.h.
References isWildCardDetector(), and isWildCardSlowFast().
Referenced by IDs::source::isWildCardChannel().
00125 {return isWildCardDetector() || isWildCardSlowFast();}
bool IDs::channel::isWildCardDetector | ( | ) | const [inline] |
Check if the Detector_t is a wildcard.
Definition at line 117 of file IdChannel.h.
References fDetector, and IDs::kAnyDetector.
Referenced by isWildCard(), and matches().
00117 {return fDetector == kAnyDetector;}
bool IDs::channel::isWildCardSlowFast | ( | ) | const [inline] |
Check if the SlowFast_t is a wildcard.
Definition at line 120 of file IdChannel.h.
References fSlowFast, and IDs::kAnySlowFast.
Referenced by isWildCard(), and matches().
00120 {return fSlowFast == kAnySlowFast;}
bool IDs::channel::matches | ( | const channel & | rhs | ) | const [inline] |
Check if this channel is the same as another or has it's fields set to 'any'.
Return true if for both the Detector and SlowFast parts, either the rhs is the same as this one, or if either this or rhs has a corresponding Any flag set
Definition at line 167 of file IdChannel.h.
References fDetector, fSlowFast, isWildCardDetector(), and isWildCardSlowFast().
Referenced by IDs::source::matches().
00167 { 00168 return (isWildCardDetector() || rhs.isWildCardDetector() || fDetector==rhs.fDetector) 00169 && (isWildCardSlowFast() || rhs.isWildCardSlowFast() || fSlowFast==rhs.fSlowFast) ; 00170 }
bool IDs::channel::operator!= | ( | const channel & | rhs | ) | const [inline] |
Returns true if this channel is not the same as another.
Definition at line 97 of file IdChannel.h.
References operator==().
00097 {return !(this->operator==(rhs));};
bool IDs::channel::operator< | ( | const channel & | rhs | ) | const [inline] |
channel& IDs::channel::operator= | ( | const char * | rhs | ) | [inline] |
Set the value of this channel ID using just a single string. The string can be a complete channel specification, including the SlowFast type Like the inverse opteration to .str() Sets kErrorDetector or kErrorSlowFast if there is a problem decoding the string
Definition at line 91 of file IdChannel.h.
IDs::channel & IDs::channel::operator= | ( | const std::string & | rhs | ) |
Set the value of this channel ID using just a single string. The string can be a complete channel specification, including the SlowFast type Like the inverse opteration to .str() Sets kErrorDetector or kErrorSlowFast if there is a problem decoding the string
Definition at line 63 of file IdChannel.cpp.
References fDetector, fSlowFast, GetDetectorEnum(), GetSlowFastEnum(), modules::parser::iequals(), and IDs::kNotApplicable.
00063 { 00064 // Search for a fast slow string at the end of the end of the string 00065 static const int num_strs=3; 00066 static const char fast_slow_strs[num_strs]={'*','F','S'}; 00067 int i=0; 00068 size_t sz = rhs.size(); 00069 for(i=0;i<num_strs ; i++){ 00070 if(modules::parser::iequals(rhs[sz-1],fast_slow_strs[i])){ 00071 if(modules::parser::iequals(rhs[sz-2],'-')){ 00072 break; 00073 } 00074 } 00075 } 00076 // Have we found a map 00077 size_t boundary=std::string::npos; 00078 if(i< num_strs){ 00079 boundary=sz-2; 00080 std::string fs=rhs.substr(boundary); 00081 fSlowFast=GetSlowFastEnum(fs); 00082 }else fSlowFast=kNotApplicable; 00083 00084 // Use what's left to make the channel part 00085 fDetector=GetDetectorEnum(rhs.substr(0,boundary)); 00086 00087 return *this; 00088 }
bool IDs::channel::operator== | ( | const channel & | rhs | ) | const [inline] |
Returns true if this channel is the same as another.
Definition at line 163 of file IdChannel.h.
References fDetector, and fSlowFast.
Referenced by operator!=().
bool IDs::channel::operator> | ( | const channel & | rhs | ) | const [inline] |
void IDs::channel::Reset | ( | ) | [inline] |
Definition at line 69 of file IdChannel.h.
References fDetector, fSlowFast, IDs::kAnyDetector, and IDs::kAnySlowFast.
Referenced by IDs::source::Reset().
00069 {fDetector=kAnyDetector; fSlowFast=kAnySlowFast;};
void IDs::channel::SlowFast | ( | const SlowFast_t & | d | ) | [inline] |
SlowFast_t IDs::channel::SlowFast | ( | ) | const [inline] |
Get the SlowFast enum for this channel.
Definition at line 76 of file IdChannel.h.
References fSlowFast.
Referenced by PlotTDPs::BeforeFirstEntry(), and Debug().
00076 {return fSlowFast;};
std::string IDs::channel::str | ( | ) | const |
Returns the channel as a string.
Definition at line 12 of file IdChannel.cpp.
Referenced by SetupNavigator::GetBank(), SetupNavigator::GetEnergyCalibrationConstants(), SetupNavigator::GetNoise(), SetupNavigator::GetPedestal(), TTemplate::MakeName(), MakeAnalysedPulses::ProcessEntry(), GeSpectrum::ProcessEntry(), IntegralRatioAPGenerator::ProcessPulses(), IDs::source::str(), and TTemplate::TTemplate().
00012 { 00013 std::string output=GetDetectorString(this->fDetector); 00014 output+=GetSlowFastString(this->fSlowFast); 00015 return output; 00016 }
Detector_t IDs::channel::fDetector [private] |
The detector that produced this channel.
Definition at line 156 of file IdChannel.h.
Referenced by channel(), Detector(), GetCorrespondingFastSlow(), isValid(), isWildCardDetector(), matches(), operator<(), operator=(), operator==(), operator>(), and Reset().
SlowFast_t IDs::channel::fSlowFast [private] |
The type of timing filter used, if any, on this channel.
Definition at line 158 of file IdChannel.h.
Referenced by channel(), GetCorrespondingFastSlow(), isFast(), isSlow(), isValid(), isWildCardSlowFast(), matches(), operator<(), operator=(), operator==(), operator>(), Reset(), and SlowFast().