00001 #include <cstdio>
00002 #include "TObject.h"
00003 #include "TClonesArray.h"
00004 #include "MessageService/MsgService.h"
00005 #include "CalDetSI/Helpers.h"
00006 #include "CalDetDST/UberHit.h"
00007 #include "CalDetDST/UberCosmicHit.h"
00008 #include "CalDetDST/UberEvent.h"
00009
00010 ClassImp(UberEvent)
00011
00012
00013 CVSID("$Id: UberEvent.cxx,v 1.4 2003/09/03 09:06:19 vahle Exp $");
00014 using namespace std;
00015
00016 TClonesArray *UberEvent::fghitlist = 0;
00017 TClonesArray *UberEvent::fgcoshitlist = 0;
00018
00019 UberEvent::UberEvent():
00020 snarlno(0),
00021 triggerword(0),
00022 triggertime(0.),
00023 nhits(0),
00024 nhitplanes(0),
00025 nhitstrips(0),
00026 ndeadplanes(0),
00027 mindeadplaneno(CalDetConstants::PLANECONST),
00028 sigcorrconv(0.),
00029 totmip(0.),
00030 maxadc(0),
00031 maxnpe(0.),
00032 maxmip(0.),
00033 maxtime(0.),
00034 p0totmip(0.),
00035 p1totmip(0.),
00036 p0stripmaxmip(CalDetConstants::STRIPCONST),
00037 p0maxmiptstamp(0.),
00038 p1stripmaxmip(CalDetConstants::STRIPCONST),
00039 p1maxmiptstamp(0.),
00040 mipweighaveplane(0.),
00041 mipweighcentereven(0.),
00042 mipweighcenterodd(0.),
00043 mipweighrad(0.),
00044 showermax(0),
00045 mipshowermax(0.),
00046 toftime(0.),
00047 fhitindex(0),
00048 fcoshitindex(0)
00049
00050 {
00051
00052 MSG("UberEvent",Msg::kDebug)<<"In UberEvent creator"<<endl;
00053 for(int i=0;i<CalDetConstants::KOVCONST;i++){
00054 ceradc[i]=0;
00055 certime[i]=0.;
00056 }
00057 for(int i=0;i<CalDetConstants::TOFCONST;i++){
00058 toftdc[i]=0;
00059 tofadc[i]=0;
00060 tofhittime[i]=0.;
00061 }
00062 if(!fghitlist){
00063 fghitlist = new TClonesArray("UberHit",1440);
00064 }
00065 hitlist = fghitlist;
00066
00067 if(!fgcoshitlist){
00068 fgcoshitlist = new TClonesArray("UberCosmicHit",96);
00069 }
00070 coshitlist = fgcoshitlist;
00071
00072 }
00073
00074 UberEvent::~UberEvent()
00075 {
00076 hitlist->Clear();
00077
00078 }
00079
00080 void UberEvent::ResetEvent()
00081 {
00082 MSG("UberEvent",Msg::kDebug)<<"In UberEvent ResetEvent"<<endl;
00083 hitlist->Clear();
00084 fhitindex=0;
00085 coshitlist->Clear();
00086 fcoshitindex=0;
00087
00088 fhitindex=0;
00089 snarlno=0;
00090 triggerword=0;
00091 triggertime=0.;
00092 nhits=0;
00093 nhitplanes=0;
00094 nhitstrips=0;
00095 ndeadplanes=0;
00096 mindeadplaneno=CalDetConstants::PLANECONST;
00097 sigcorrconv =0.;
00098 totmip=0;
00099 maxadc=0;
00100 maxnpe=0;
00101 maxmip=0;
00102 maxtime=0;
00103 p0totmip=0;
00104 p1totmip=0;
00105 p0stripmaxmip=CalDetConstants::STRIPCONST;
00106 p0maxmiptstamp=0.;
00107 p1stripmaxmip=CalDetConstants::STRIPCONST;
00108 p1maxmiptstamp=0.;
00109 mipweighaveplane=0.;
00110 mipweighcentereven=0.;
00111 mipweighcenterodd=0.;
00112 mipweighrad=0.;
00113 showermax=0;
00114 mipshowermax = 0.;
00115 for(int i=0;i<CalDetConstants::KOVCONST;i++){
00116 ceradc[i]=0;
00117 certime[i]=0.;
00118 }
00119 for(int i=0;i<CalDetConstants::TOFCONST;i++){
00120 toftdc[i]=0;
00121 tofadc[i]=0;
00122 tofhittime[i]=0.;
00123 }
00124 toftime=0;
00125 }
00126
00127 void UberEvent::AddNextHit(UShort_t p, UShort_t s)
00128 {
00129 MSG("UberEvent",Msg::kDebug)<<"In UberEvent AddNextHit"<<endl;
00130 new((*hitlist)[fhitindex]) UberHit();
00131 UberHit *uh = static_cast<UberHit *>((*hitlist)[fhitindex]);
00132 uh->SetPlaneStrip(p,s);
00133 fhitindex++;
00134 return;
00135
00136 }
00137
00138 void UberEvent::AddNextHitValues(StripEnd::StripEnd_t se,
00139 Int_t adc, Float_t siglin,Float_t npe,
00140 Float_t mip, Float_t time, Int_t agg)
00141 {
00142 MSG("UberEvent",Msg::kDebug)<<"In UberEvent AddnextHitValues"<<endl;
00143 UberHit *uh = static_cast<UberHit *>((*hitlist)[fhitindex-1]);
00144 uh->AddValues(se, adc, siglin, npe, mip, time, agg);
00145 return;
00146 }
00147
00148 void UberEvent::AddNextCosmicHit(UShort_t p, UShort_t s)
00149 {
00150 MSG("UberEvent",Msg::kDebug)<<"In UberEvent AddNextHit"<<endl;
00151 new((*coshitlist)[fcoshitindex]) UberCosmicHit();
00152 UberCosmicHit *uch = static_cast<UberCosmicHit *>((*coshitlist)[fcoshitindex]);
00153 uch->SetPlaneStrip(p,s);
00154 fcoshitindex++;
00155 return;
00156
00157 }
00158
00159 void UberEvent::AddNextCosmicHitValues(StripEnd::StripEnd_t se,
00160 Int_t adc, Float_t time, Int_t agg)
00161 {
00162 MSG("UberEvent",Msg::kDebug)<<"In UberEvent AddnextCosmicHitValues"<<endl;
00163 UberCosmicHit *uch = static_cast<UberCosmicHit *>((*coshitlist)[fcoshitindex-1]);
00164 uch->AddValues(se, adc, time, agg);
00165 return;
00166 }
00167
00168 void UberEvent::Print(Option_t* ) const
00169 {
00170
00171 int i=0;
00172 TObject *obj = 0;
00173 while((obj = hitlist->At(i))){
00174 UberHit *uh = static_cast<UberHit *>(obj);
00175 cout<<"HIT "<<i<<endl;
00176 uh->Print();
00177 i++;
00178 }
00179
00180 }
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195