00001 #ifndef DCHIT_H 00002 #define DCHIT_H 00003 #include <cmath> 00004 #include "TObject.h" 00005 class UberHit; 00006 00007 class DCHit : public TObject 00008 { 00009 public: 00010 DCHit(); 00011 DCHit(const DCHit &d); 00012 DCHit(float zp, float tp, float s, float time); 00013 DCHit(UberHit *uh); 00014 00015 ~DCHit(); 00016 00017 float GetZpos() const {return zpos;} 00018 float GetTpos() const {return tpos;} 00019 float GetPH() const {return pulseheight;} 00020 float GetTime() const {return time;} 00021 00022 void Print(Option_t* option="") const; 00023 void Draw(Option_t* option=""); 00024 void SetData(const char* cx, const char *cy, const char* cz=""); 00025 void GetData(float &x, float &y, float &z) {x=drawx;y=drawy;z=drawz;} 00026 00027 bool operator < (const DCHit &dc) const { 00028 if(zpos<dc.GetZpos()){ 00029 return true; 00030 } 00031 else if(zpos==dc.GetZpos()){ 00032 if(pulseheight>dc.GetPH()){ 00033 return true; 00034 } 00035 else if(pulseheight==dc.GetPH()){ 00036 if(tpos<dc.GetTpos()){ 00037 return true; 00038 } 00039 } 00040 } 00041 return false; 00042 } 00043 00044 DCHit operator - (const DCHit &dc) const { 00045 DCHit newhit; 00046 newhit.zpos=zpos-dc.zpos; 00047 newhit.tpos=tpos-dc.tpos; 00048 if(pulseheight+dc.pulseheight!=0){ 00049 newhit.pulseheight=2*((pulseheight-dc.pulseheight)/ 00050 (pulseheight+dc.pulseheight)); 00051 } 00052 else{ 00053 newhit.pulseheight=0.; 00054 } 00055 00056 newhit.time=time-dc.time; 00057 newhit.drawx=drawx-dc.drawx; 00058 newhit.drawy=drawy-dc.drawy; 00059 if(drawz+dc.drawz!=0){ 00060 newhit.drawz=2*(drawz-dc.drawz)/(drawz+dc.drawz); 00061 } 00062 else{ 00063 newhit.drawz=0.; 00064 } 00065 return newhit; 00066 } 00067 00068 DCHit operator + (const DCHit &dc) const { 00069 DCHit newhit; 00070 newhit.zpos=zpos+dc.zpos; 00071 newhit.tpos=tpos+dc.tpos; 00072 newhit.pulseheight=(pulseheight+dc.pulseheight); 00073 if(pulseheight+dc.pulseheight!=0){ 00074 newhit.time=((pulseheight*time+dc.pulseheight*dc.time)/ 00075 (pulseheight+dc.pulseheight)); 00076 } 00077 else{ 00078 newhit.time=0; 00079 } 00080 //note, get data will work the same way for the new DCHit as it did 00081 //for the first dchit (not the added one) 00082 newhit.drawx=drawx+dc.drawx; 00083 newhit.drawy=drawy+dc.drawy; 00084 //this is going to get you into trouble. Need a better way to 00085 //set what data is going to be assigned to these variables. 00086 newhit.drawz=(drawz+dc.drawz); 00087 return newhit; 00088 } 00089 00090 float abs() {return sqrt(GetZpos()*GetZpos()+GetTpos()*GetTpos());} 00091 00092 bool operator== (const DCHit &dc) const { 00093 if((zpos==dc.zpos)&& 00094 (tpos==dc.tpos)&& 00095 (pulseheight==dc.pulseheight)&& 00096 (time==dc.time)) return true; 00097 return false; 00098 } 00099 00100 00101 private: 00102 float zpos; 00103 float tpos; 00104 float pulseheight; 00105 float time; 00106 00107 float drawx; 00108 float drawy; 00109 float drawz; 00110 00111 ClassDef(DCHit,1) 00112 }; 00113 #endif //DCHIT_H
1.3.9.1