| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

DetectorId.cc

Go to the documentation of this file.
00001 #include "Conventions/DetectorId.h"
00002 #include <cctype>
00003 #include <string>
00004 #include <cstring>
00005 #include <algorithm>
00006 using namespace std;
00007 
00008 
00009 static const char* names[] = {
00010     "Unknown",
00011     "AD1",
00012     "AD2",
00013     "AD3",
00014     "AD4",
00015     "IWS",
00016     "OWS",
00017     "RPC",
00018     "All"
00019 };
00020 
00021 const char* DetectorId::AsString(DetectorId_t id)
00022 {
00023 
00024     if (id < 0 || id > kAll) return names[0];
00025     return names[id];
00026 }
00027 
00028 DetectorId::DetectorId_t DetectorId::FromString0(const char* str)
00029 {
00030     string s = str;
00031     transform(s.begin(),s.end(),s.begin(),::toupper);
00032 
00033     for (int ind=1; names[ind]; ++ind) {
00034         if (s == names[ind]) return (DetectorId::DetectorId_t)ind;
00035     }
00036     return kUnknown;
00037    // not working for "All"
00038 }
00039 
00040 
00041 DetectorId::DetectorId_t DetectorId::FromString(const char* str)
00042 {
00043   if(strncasecmp("Unknown",str,7)==0) return kUnknown ;
00044   if(strncasecmp("AD1",str,3)==0) return kAD1;
00045   if(strncasecmp("AD2",str,3)==0) return kAD2;
00046   if(strncasecmp("AD3",str,3)==0) return kAD3;
00047   if(strncasecmp("AD4",str,3)==0) return kAD4;
00048   if(strncasecmp("IWS",str,3)==0) return kIWS;
00049   if(strncasecmp("OWS",str,3)==0) return kOWS;
00050   if(strncasecmp("RPC",str,3)==0) return kRPC;
00051   if(strncasecmp("All",str,3)==0) return kAll;
00052   return kUnknown ;
00053 }
00054 
00055 
00056 bool DetectorId::isAD(DetectorId_t id)
00057 {
00058   return (id == kAD1 || id == kAD2 || id == kAD3 || id == kAD4);
00059 }
00060 
00061 bool DetectorId::isWaterShield(DetectorId_t id)
00062 {
00063   return (id == kIWS || id == kOWS);
00064 }
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:14:47 2011 for Conventions by doxygen 1.4.7