Skip to content
Snippets Groups Projects
Commit e7738912 authored by Stephen A. Wood's avatar Stephen A. Wood
Browse files

Add reference time to hitlist

  Base class THcRawHit has null GetReference method.  Returns
  zero.
  THcRawDCHit will get the reference time if it was specified in the map file.
  It is up to the detector class to use the reference time to subtract off
  pipeline TDC jitter.
parent a009368a
No related branches found
No related tags found
No related merge requests found
......@@ -313,13 +313,14 @@ Int_t THcDriftChamberPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit)
Int_t wireNum = hit->fCounter;
THcDCWire* wire = GetWire(wireNum);
Int_t wire_last = -1;
Int_t reftime = hit->GetReference(0);
for(UInt_t mhit=0; mhit<hit->fNHits; mhit++) {
fNRawhits++;
/* Sort into early, late and ontime */
Int_t rawtdc = hit->fTDC[mhit];
if(rawtdc < fTdcWinMin) {
if((rawtdc-reftime) < fTdcWinMin) {
// Increment early counter (Actually late because TDC is backward)
} else if (rawtdc > fTdcWinMax) {
} else if ((rawtdc-reftime) > fTdcWinMax) {
// Increment late count
} else {
// A good hit
......@@ -330,7 +331,7 @@ Int_t THcDriftChamberPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit)
// cout << "Extra hit " << fPlaneNum << " " << wireNum << " " << rawtdc << endl;
} else {
Double_t time = -StartTime // (comes from h_trans_scin
- rawtdc*fNSperChan + fPlaneTimeZero;
- (rawtdc-reftime)*fNSperChan + fPlaneTimeZero;
// How do we get this start time from the hodoscope to here
// (or at least have it ready by coarse process)
new( (*fHits)[nextHit++] ) THcDCHit(wire, rawtdc, time, this);
......
......@@ -103,6 +103,13 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata ) {
// cout << "Signal " << signal << "=" << data << endl;
rawhit->SetData(signal,data);
}
// Get the reference time. Only take the first hit
if(d->refchan >= 0) {
if( evdata.GetNumHits(d->crate,d->slot,d->refchan) > 0) {
Int_t reftime = evdata.GetData(d->crate, d->slot, d->refchan, 0);
rawhit->SetReference(signal, reftime);
}
}
}
}
fRawHitList->Sort(fNRawHits);
......
......@@ -34,6 +34,20 @@ Int_t THcRawDCHit::GetData(Int_t signal, UInt_t ihit) {
}
}
// Set the reference time
void THcRawDCHit::SetReference(Int_t signal, Int_t reference) {
fReferenceTime = reference;
fHasRef = kTRUE;
}
// Get the reference time
Int_t THcRawDCHit::GetReference(Int_t signal) {
if(fHasRef) {
return(fReferenceTime);
} else {
return(0);
}
}
Int_t THcRawDCHit::Compare(const TObject* obj) const
{
......
......@@ -20,8 +20,11 @@ public:
virtual void Clear( Option_t* opt="" ) { fNHits=0; }
void SetData(Int_t signal, Int_t data);
void SetReference(Int_t signal, Int_t reference);
Int_t GetData(Int_t signal);
Int_t GetData(Int_t signal, UInt_t ihit);
Int_t GetReference(Int_t signal);
virtual Bool_t IsSortable () const {return kTRUE; }
virtual Int_t Compare(const TObject* obj) const;
......@@ -30,6 +33,7 @@ public:
protected:
UInt_t fNHits;
Int_t fTDC[MAXHITS];
Int_t fReferenceTime;
private:
......
......@@ -11,8 +11,8 @@
class THcRawHit : public TObject {
public:
THcRawHit(Int_t plane=0, Int_t counter=0) :
fPlane(plane), fCounter(counter) {};
THcRawHit(Int_t plane=0, Int_t counter=0) :
fPlane(plane), fCounter(counter), fHasRef(kFALSE) {};
THcRawHit( const THcRawHit& rhs ) : TObject(rhs) {}
THcRawHit& operator=( const THcRawHit& rhs )
{ TObject::operator=(rhs); return *this; };
......@@ -27,6 +27,9 @@ public:
virtual void SetData(Int_t signal, Int_t data) {};
virtual Int_t GetData(Int_t signal) {return 0;};
virtual void SetReference(Int_t signal, Int_t reference) {};
virtual Bool_t HasReference(Int_t signal) {return fHasRef;};
virtual Int_t GetReference(Int_t signal) {return 0;};
// Derived objects must be sortable and supply Compare method
// virtual Bool_t IsSortable () const {return kFALSE; }
......@@ -36,6 +39,7 @@ public:
Int_t fPlane;
Int_t fCounter;
Bool_t fHasRef;
private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment