00001 #include <iostream>
00002 #include "TMarker.h"
00003 #include "NueAna/NueAnaTools/DCVertex.h"
00004 #include "NueAna/NueAnaTools/DCEdge.h"
00005 #include "NueAna/NueAnaTools/DCGraph.h"
00006 #include "NueAna/NueAnaTools/DCHit.h"
00007 #include "CalDetDST/UberHit.h"
00008
00009 using namespace std;
00010
00011 ClassImp(DCHit)
00012
00013 template class vector<DCHit>;
00014 template class DCEdge<DCHit>;
00015 template class DCVertex<DCHit>;
00016 template class DCGraph<DCHit>;
00017
00018 DCHit::DCHit():
00019 zpos(0),
00020 tpos(0),
00021 pulseheight(0),
00022 time(0),
00023 drawx(0.),
00024 drawy(0.),
00025 drawz(0.)
00026 {}
00027
00028 DCHit::DCHit(const DCHit &d):
00029 TObject::TObject(),
00030 zpos(d.zpos),
00031 tpos(d.tpos),
00032 pulseheight(d.pulseheight),
00033 time(d.time),
00034 drawx(d.drawx),
00035 drawy(d.drawy),
00036 drawz(d.drawz)
00037 {}
00038
00039 DCHit::DCHit(float zp, float tp, float s, float t):
00040 zpos(zp),
00041 tpos(tp),
00042 pulseheight(s),
00043 time(t),
00044 drawx(0.),
00045 drawy(0.),
00046 drawz(0.)
00047 {}
00048
00049 DCHit::DCHit(UberHit *uh)
00050 {
00051 zpos=uh->GetPlane()*5.94;
00052 tpos=uh->GetStrip()*4.1;
00053 pulseheight=uh->GetPosMIP()+uh->GetNegMIP();
00054 time=((uh->GetPosMIP()*uh->GetPosTime()+
00055 uh->GetNegMIP()*uh->GetNegTime())/
00056 (uh->GetPosMIP()+uh->GetNegMIP()));
00057 drawx=0.;
00058 drawy=0.;
00059 drawz=0.;
00060 }
00061
00062 DCHit::~DCHit()
00063 {}
00064
00065 bool operator< (const DCHit &left, const DCHit &right)
00066 {
00067 if(left.GetZpos()<right.GetZpos()){
00068 return true;
00069 }
00070 else if(left.GetZpos()==right.GetZpos()){
00071 if(left.GetTpos()<right.GetTpos()){
00072 return true;
00073 }
00074 else{
00075 return false;
00076 }
00077 }
00078 else{
00079 return false;
00080 }
00081 return false;
00082 }
00083
00084 void DCHit::Print(Option_t* ) const
00085 {
00086
00087 cout<<"Zpos "<<zpos<<" tpos "<<tpos
00088 <<" PulseHeight "<<pulseheight<<" Time "<<time<<endl;
00089
00090 }
00091
00092
00093 void DCHit::Draw(Option_t* )
00094 {
00095 TMarker *m = new TMarker(1.*zpos,1*tpos,8);
00096 m->Draw();
00097 }
00098
00099 void DCHit::SetData(const char* cx, const char* cy, const char *cz)
00100 {
00101 if((string)(cx)=="zpos"){
00102 drawx=1.*zpos;
00103 }
00104 else if((string)(cx)=="tpos"){
00105 drawx=1.*tpos;
00106 }
00107 else if((string)(cx)=="pulseheight"){
00108 drawx=pulseheight;
00109 }
00110 else if((string)(cx)=="time"){
00111 drawx=time;
00112 }
00113 else{
00114 cout<<"Error in set data, don't know option "<<cx<<endl;
00115 cout<<"Setting cx to zpos"<<endl;
00116 drawx=zpos;
00117 }
00118
00119 if((string)(cy)=="zpos"){
00120 drawy=1.*zpos;
00121 }
00122 else if((string)(cy)=="tpos"){
00123 drawy=1.*tpos;
00124 }
00125 else if((string)(cy)=="pulseheight"){
00126 drawy=pulseheight;
00127 }
00128 else if((string)(cy)=="time"){
00129 drawy=time;
00130 }
00131 else{
00132 cout<<"Error in set data, don't know option "<<cy<<endl;
00133 cout<<"Setting cy to zpos"<<endl;
00134 drawy=zpos;
00135 }
00136
00137 if((string)(cz)=="zpos"){
00138 drawz=1.*zpos;
00139 }
00140 else if((string)(cz)=="tpos"){
00141 drawz=1.*tpos;
00142 }
00143 else if((string)(cz)=="pulseheight"){
00144 drawz=pulseheight;
00145 }
00146 else if((string)(cz)=="time"){
00147 drawz=time;
00148 }
00149 else if((string)(cz)==""){
00150 }
00151 else{
00152 cout<<"Error in set data, don't know option "<<cz<<endl;
00153 cout<<"Setting cz to zpos"<<endl;
00154 drawz=zpos;
00155 }
00156
00157 }
00158