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

Decoding of Hodoscope hits now works.

parent 192d0d31
No related branches found
No related tags found
No related merge requests found
......@@ -43,7 +43,7 @@ void THcHitList::InitHitList(THaDetMap* detmap,
Int_t THcHitList::DecodeToHitList( const THaEvData& evdata ) {
THcRawHit* rawhit;
cout << " Clearing TClonesArray " << endl;
// cout << " Clearing TClonesArray " << endl;
fRawHitList->Clear("C");
fNRawHits = 0;
......@@ -51,6 +51,7 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata ) {
THaDetMap::Module* d = fdMap->GetModule(i);
// Loop over all channels that have a hit.
// cout << "Crate/Slot: " << d->crate << "/" << d->slot << endl;
for ( Int_t j=0; j < evdata.GetNumChan( d->crate, d->slot); j++) {
Int_t chan = evdata.GetNextChan( d->crate, d->slot, j );
......@@ -61,7 +62,8 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata ) {
Int_t plane = d->plane;
Int_t signal = d->signal;
Int_t counter = d->reverse ? d->first + d->hi - chan : d->first + chan - d->lo;
//cout << d->crate << " " << d->slot << " " << chan << " " << plane << " "
// << counter << " " << signal << endl;
// Search hit list for plane and counter
// We could do sorting
Int_t thishit = 0;
......@@ -69,13 +71,15 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata ) {
rawhit = (THcRawHit*) (*fRawHitList)[thishit];
if (plane == rawhit->fPlane
&& counter == rawhit->fCounter) {
// cout << "Found as " << thishit << "/" << fNRawHits << endl;
break;
}
thishit++;
}
if(thishit == fNRawHits) {
fNRawHits++;
rawhit = (THcRawHit*) (*fRawHitList)[thishit];
fNRawHits++;
rawhit->fPlane = plane;
rawhit->fCounter = counter;
}
......@@ -85,6 +89,7 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata ) {
Int_t nMHits = evdata.GetNumHits(d->crate, d->slot, chan);
for (Int_t mhit = 0; mhit < nMHits; mhit++) {
Int_t data = evdata.GetData( d->crate, d->slot, chan, mhit);
// cout << "Signal " << signal << "=" << data << endl;
rawhit->SetData(signal,data);
}
}
......
......@@ -138,6 +138,7 @@ Int_t THcHodoscope::ReadDatabase( const TDatime& date )
iplane = 0;
p = (Double_t *)gHcParms->Find("hscin_1x_center")->GetValuePointer();
fCenter[iplane] = new Double_t [fNPaddle[iplane]];
// Print out some parameters just to demonstrate that it works
cout << iplane;
for(Int_t i=0;i<fNPaddle[iplane];i++) {
fCenter[iplane][i] = p[i];
......@@ -295,9 +296,11 @@ Int_t THcHodoscope::Decode( const THaEvData& evdata )
// fRawHitList is TClones array of THcHodoscopeHit objects
for(Int_t ihit = 0; ihit < fNRawHits ; ihit++) {
THcHodoscopeHit* hit = (THcHodoscopeHit *) fRawHitList->At(ihit);
cout << ihit << ": " << hit->fADC_pos << " " << hit->fADC_neg << " "
<< hit->fTDC_pos << " " << hit->fTDC_pos << endl;
cout << ihit << " : " << hit->fPlane << ":" << hit->fCounter << " : "
<< hit->fADC_pos << " " << hit->fADC_neg << " " << hit->fTDC_pos
<< " " << hit->fTDC_neg << endl;
}
cout << endl;
return nhits;
}
......
......@@ -14,26 +14,26 @@ using namespace std;
void THcHodoscopeHit::SetData(Int_t signal, Int_t data) {
if(signal==1) {
if(signal==0) {
fADC_pos = data;
} else if (signal==2) {
fADC_neg = data;
} else if(signal==3) {
fADC_pos = data;
} else if (signal==4) {
} else if (signal==1) {
fADC_neg = data;
} else if(signal==2) {
fTDC_pos = data;
} else if (signal==3) {
fTDC_neg = data;
}
}
Int_t THcHodoscopeHit::GetData(Int_t signal) {
if(signal==1) {
return(fADC_pos);
} else if (signal==2) {
return(fADC_neg);
} else if(signal==3) {
if(signal==0) {
return(fADC_pos);
} else if (signal==4) {
} else if (signal==1) {
return(fADC_neg);
} else if(signal==2) {
return(fTDC_pos);
} else if (signal==3) {
return(fTDC_neg);
}
return(-1); // Actually should throw exception
}
......
......@@ -37,7 +37,7 @@ public:
private:
ClassDef(THcRawHit,2) // Track ID abstract base class
ClassDef(THcRawHit,0) // Track ID abstract base class
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment