00001 #ifndef UtilStrip_h
00002 #define UtilStrip_h
00003
00004 #include <vector>
00005 #include <set>
00006
00007 class AtmosStrip;
00008 class SetStrip;
00009 class DStrip;
00010 class StripDList;
00011 class StripCluster;
00012
00013 namespace UtilStrip {
00014 std::vector<int> GangedStrips(int strip, int end);
00015 std::vector<int> GangedStripsEast(int strip);
00016 std::vector<int> GangedStripsWest(int strip);
00017 std::vector<int> GangedStripsNegative(int strip);
00018 std::vector<int> GangedStripsPositive(int strip);
00019
00020 double SumEnergy(std::set<SetStrip>);
00021 int NStrips(std::set<SetStrip>);
00022 int NDigits(std::set<SetStrip>);
00023 }
00024
00025 inline std::vector<int> UtilStrip::GangedStrips(int strip, int end) {
00026 if(end==0) return UtilStrip::GangedStripsNegative(strip);
00027 else return UtilStrip::GangedStripsPositive(strip);
00028 }
00029
00030 inline std::vector<int> UtilStrip::GangedStripsEast(int strip) {
00031 return UtilStrip::GangedStripsNegative(strip);
00032 }
00033
00034 inline std::vector<int> UtilStrip::GangedStripsWest(int strip) {
00035 return UtilStrip::GangedStripsPositive(strip);
00036 }
00037
00038 class SetStrip {
00039 public:
00040 SetStrip(int i, double d, bool b) {TCIndex=i;Energy=d;DoubleEnded=b;}
00041 SetStrip(int i, const AtmosStrip *strip);
00042
00043 unsigned int TCIndex;
00044 double Energy;
00045 bool DoubleEnded;
00046
00047
00048 friend bool operator<(const SetStrip &s1, const SetStrip &s2) {
00049 return (s1.TCIndex < s2.TCIndex);
00050 }
00051 friend bool operator==(const SetStrip &s1, const SetStrip &s2) {
00052 return (s1.TCIndex == s2.TCIndex);
00053 }
00054 friend bool operator!=(const SetStrip &s1, const SetStrip &s2) {
00055 return (s1.TCIndex != s2.TCIndex);
00056 }
00057 friend bool operator>(const SetStrip &s1, const SetStrip &s2) {
00058 return (s1.TCIndex > s2.TCIndex);
00059 }
00060 };
00061
00062 class StripCluster {
00063 public:
00064 StripCluster() {Clear();}
00065 void Clear();
00066
00067 void AddStripDList(const StripDList &sdl);
00068
00069 std::set<SetStrip> Strips;
00070
00071
00072 unsigned int NStrips;
00073 double SumU, SumV, SumZ, SumSqU, SumSqV, SumSqZ;
00074
00075 double CentU() {return SumU/(double)NStrips;}
00076 double CentV() {return SumV/(double)NStrips;}
00077 double CentZ() {return SumZ/(double)NStrips;}
00078
00079 double RMSU();
00080 double RMSV();
00081 double RMSZ();
00082
00083
00084 double SumPE;
00085 double WSumU, WSumV, WSumZ, WSumSqU, WSumSqV, WSumSqZ;
00086
00087 double WCentU() {return WSumU/SumPE;}
00088 double WCentV() {return WSumV/SumPE;}
00089 double WCentZ() {return WSumZ/SumPE;}
00090
00091 double WRMSU();
00092 double WRMSV();
00093 double WRMSZ();
00094
00095
00096 friend bool operator<(const StripCluster &scl1, const StripCluster &scl2)
00097 {return(scl1.NStrips > scl2.NStrips);}
00098
00099
00100 };
00101
00102 class StripDList {
00103 public:
00104 StripDList(int i);
00105
00106 unsigned int TCIndex;
00107
00108 bool SetInCluster();
00109 bool InCluster;
00110 unsigned int ClusterCount;
00111
00112 double U, V, Z;
00113
00114 double PE;
00115
00116 std::vector<DStrip> VecDStrip;
00117 friend bool operator< (const StripDList &sdl1, const StripDList &sdl2);
00118 friend bool operator==(const StripDList &sdl1, const StripDList &sdl2);
00119 friend bool operator!=(const StripDList &sdl1, const StripDList &sdl2);
00120 };
00121
00122 class DStrip {
00123 public:
00124 DStrip(unsigned int i, double d) {
00125 Disp = d;
00126 TCIndex = i;
00127 }
00128
00129 unsigned int TCIndex;
00130 double Disp;
00131
00132 friend bool operator<(const DStrip &ds1, const DStrip &ds2)
00133 {return(ds1.Disp < ds2.Disp);}
00134 friend bool operator==(const DStrip &ds1, const DStrip &ds2)
00135 {return(ds1.TCIndex == ds2.TCIndex);}
00136 friend bool operator!=(const DStrip &ds1, const DStrip &ds2)
00137 {return(ds1.TCIndex != ds2.TCIndex);}
00138 };
00139
00140 #endif