00001 #ifndef SCTCONF_CONFUTILITIES_H
00002 #define SCTCONF_CONFUTILITIES_H
00003
00004 #include "ConfigurationException.h"
00005
00006 namespace SctConfiguration {
00007
00009 enum EndcapType {ENDCAP_OUTER, ENDCAP_MIDDLE, ENDCAP_SHORT_MIDDLE, ENDCAP_INNER, ENDCAP_UNKNOWN};
00010
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00052
00054 EndcapType sillyEndcapDiskAndNumber(const int disk, const unsigned number) {
00055 std::ostringstream os;
00056 os <<"Disk "<<disk<<" and number "<<number
00057 <<" are just plain silly. Error detected in "
00058 <<__FILE__<<" at line " << __LINE__;
00059 throw ConfigurationException(os.str());
00060
00061
00062 return ENDCAP_UNKNOWN;
00063 };
00064
00065
00066 EndcapType getEndcapType(const int disk, const unsigned number) {
00067
00068 if(number < 0) return sillyEndcapDiskAndNumber(disk, number);
00069
00070 if(number < 13) return ENDCAP_OUTER;
00071
00072 if(number < 23) {
00073 if( disk == 8 || disk == -8) return ENDCAP_SHORT_MIDDLE;
00074 return ENDCAP_MIDDLE;
00075 }
00076
00077 if(number < 33) return ENDCAP_INNER;
00078
00079 return sillyEndcapDiskAndNumber(disk, number);
00080
00081 }
00082
00083 }
00084
00085 #endif