17 #include "THaApparatus.h"
33 const
char* description,
35 THaDetectorBase* parent )
36 : THaSubDetector(name,description,parent), fTTDConv(0)
78 return fStatus = kInitError;
85 if( (status=THaSubDetector::Init( date )) )
86 return fStatus = status;
108 prefix[0]=tolower(GetParent()->GetPrefix()[0]);
111 {
"driftbins", &NumDriftMapBins, kInt},
112 {
"drift1stbin", &DriftMapFirstBin, kDouble},
113 {
"driftbinsz", &DriftMapBinSize, kDouble},
129 {
Form(
"wc%sfract",
GetName()),DriftMap,kDouble,NumDriftMapBins},
138 fParent = (
THcDC*) GetParent();
202 Double_t hzchi = -cosalpha*sinbeta + sinalpha*cosbeta*singamma;
203 Double_t hzpsi = sinalpha*sinbeta + cosalpha*cosbeta*singamma;
204 Double_t hxchi = -cosalpha*cosbeta - sinalpha*sinbeta*singamma;
205 Double_t hxpsi = sinalpha*cosbeta - cosalpha*sinbeta*singamma;
213 if(cosalpha <= 0.707) {
221 Double_t sumsqupsi = hzpsi*hzpsi+hxpsi*hxpsi+hypsi*hypsi;
222 Double_t sumsquchi = hzchi*hzchi+hxchi*hxchi+hychi*hychi;
223 Double_t sumcross = hzpsi*hzchi + hxpsi*hxchi + hypsi*hychi;
224 Double_t denom1 = sumsqupsi*sumsquchi-sumcross*sumcross;
225 fPsi0 = (-z0*hzpsi*sumsquchi
226 +z0*hzchi*sumcross) / denom1;
227 Double_t hchi0 = (-z0*hzchi*sumsqupsi
228 +z0*hzpsi*sumcross) / denom1;
232 if(z0 < 0.0) hphi0 = -hphi0;
234 Double_t denom2 = stubxpsi*stubychi - stubxchi*stubypsi;
240 fStubCoef[3] = hphi0*fStubCoef[1];
243 fYsp = -hxchi/denom2;
251 fPlaneCoef[4]= hychi;
252 fPlaneCoef[5]=-hxchi;
253 fPlaneCoef[6]= hzchi*hypsi - hychi*hzpsi;
254 fPlaneCoef[7]=-hzchi*hxpsi + hxchi*hzpsi;
255 fPlaneCoef[8]= hychi*hxpsi - hxchi*hypsi;
259 NumDriftMapBins,DriftMap);
265 for (
int i=0; i<nWires; i++) {
272 THaApparatus*
app = GetApparatus();
273 const char* nm =
"hod";
275 !(
fglHod = dynamic_cast<THcHodoscope*>(app->GetDetector(nm))) ) {
276 static const char*
const here =
"ReadDatabase()";
277 Warning(Here(here),
"Hodoscope \"%s\" not found. "
278 "Event-by-event time offsets will NOT be used!!",nm);
290 if( mode == kDefine && fIsSetup )
return kOK;
291 fIsSetup = ( mode == kDefine );
295 {
"raw.wirenum",
"List of TDC wire number of all hits in DC",
296 "fRawHits.THcDCHit.GetWireNum()"},
297 {
"wirenum",
"List of TDC wire number (select first hit in TDc window",
298 "fHits.THcDCHit.GetWireNum()"},
299 {
"rawnorefcorrtdc",
"Raw TDC Values",
300 "fHits.THcDCHit.GetRawNoRefCorrTime()"},
301 {
"rawtdc",
"Raw TDC with reference time subtracted Values",
302 "fHits.THcDCHit.GetRawTime()"},
303 {
"time",
"Drift times",
304 "fHits.THcDCHit.GetTime()"},
305 {
"dist",
"Drift distancess",
306 "fHits.THcDCHit.GetDist()"},
308 "fHits.THcDCHit.GetPos()"},
309 {
"nhit",
"Number of hits",
"GetNHits()"},
310 {
"RefTime",
"TDC reference time",
"fTdcRefTime"},
314 return DefineVarsFromList( vars, mode );
331 cout <<
" Calling THcDriftChamberPlane::Decode " <<
GetName() << endl;
348 return(wire_num_calc);
369 Int_t ihit = nexthit;
371 Int_t nextRawHit = 0;
372 while(ihit < nrawhits) {
387 new( (*fRawHits)[nextRawHit++] )
THcDCHit(wire, rawnorefcorrtdc,rawtdc, time,
this);
393 if (First_Hit_In_Window) {
394 new( (*fFirstPassHits)[nextHit++] )
THcDCHit(wire, rawnorefcorrtdc,rawtdc, time,
this);
395 First_Hit_In_Window =
kFALSE;
408 if (StartTime == -1000) StartTime = 0.0;
418 new( (*fHits)[nextHit++] )
THcDCHit(tempWire, tempRawNoRefCorrtime, tempRawtime, temptime,
this);
448 }
else if (wirenum >= 51 && wirenum <= 64) {
456 }
else if (wirenum >=33 && wirenum<=46) {
483 }
else if (wirenum >= 41 && wirenum <= 63) {
485 }
else if (wirenum >=64 && wirenum <=69) {
493 }
else if (wirenum >=39 && wirenum<=44) {
495 }
else if (wirenum>=45 && wirenum<=67) {
Drift chamber wire hit info.
virtual EStatus Init(const TDatime &run_time)
Int_t GetTimeRaw(UInt_t iHit=0) const
Gets raw TDC time. In channels.
std::string GetName(const std::string &scope_name)
Double_t GetSigma(Int_t plane) const
THcDCWire * GetWire(Int_t i) const
Int_t GetReadoutLR(Int_t plane) const
Int_t GetNWires(Int_t plane) const
Class for a a single Hall C horizontal drift chamber plane.
THcDCWire * GetWire() const
Int_t GetTdcWinMax(Int_t plane) const
THcRawTdcHit & GetRawTdcHit()
Int_t GetTdcWinMin(Int_t plane) const
Int_t GetWireOrder(Int_t plane) const
virtual void Clear(Option_t *opt="")
UInt_t GetNHits() const
Gets the number of set hits.
Drift time to distance conversion via lookup table.
Analyze a package of horizontal drift chambers.
double beta(double x, double y)
virtual Int_t DefineVariables(EMode mode=kDefine)
Double_t GetCenter(Int_t plane) const
Double_t GetNSperChan() const
double pow(double, double)
Double_t GetGammaAngle(Int_t plane) const
Double_t GetPlaneTimeZero(Int_t plane) const
Double_t GetBetaAngle(Int_t plane) const
virtual void Clear(Option_t *option="")
Int_t GetDriftTimeSign(Int_t plane) const
void SetTime(Double_t time)
Class representing a drift chamber wire.
Int_t GetNChamber(Int_t plane) const
virtual Int_t Decode(const THaEvData &)
Bool_t HasRefTime() const
Queries whether reference time has been set.
Double_t GetCentralWire(Int_t plane) const
char * Form(const char *fmt,...)
virtual Int_t GetReadoutSide(Int_t wirenum)
Double_t GetStartTime() const
virtual ~THcDriftChamberPlane()
virtual Int_t CoarseProcess(TClonesArray &tracks)
Int_t GetRawNoRefCorrTime() const
void Warning(const char *location, const char *msgfmt,...)
Class representing for drift chamber wire (or other device with a single multihit TDC channel per det...
Int_t LoadParmValues(const DBRequest *list, const char *prefix="")
Retrieve parameter values from the parameter cache.
Int_t GetTime(UInt_t iHit=0) const
Gets TDC time. In channels.
virtual Int_t ProcessHits(TClonesArray *rawhits, Int_t nexthit)
Double_t CalcWireFromPos(Double_t pos)
virtual Int_t ReadDatabase(const TDatime &date)
Double_t GetCentralTime(Int_t plane) const
virtual Int_t FineProcess(TClonesArray &tracks)
virtual Int_t SubtractStartTime()
Int_t GetRefTime() const
Gets reference time. In channels.
virtual Double_t ConvertTimeToDist()
Int_t GetReadoutTB(Int_t plane) const
ClassImp(THcDriftChamberPlane) THcDriftChamberPlane
R__EXTERN class THcParmList * gHcParms
TClonesArray * fFirstPassHits
Double_t Sqrt(Double_t x)
TObject * At(Int_t idx) const
Double_t GetAlphaAngle(Int_t plane) const
Double_t GetTOffset() const
THcDCTimeToDistConv * fTTDConv
Double_t GetZPos(Int_t plane) const
Double_t GetPitch(Int_t plane) const