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

Just trying to figure out how to build hodoscope out of planes

parent a0e0b496
No related branches found
No related tags found
No related merge requests found
......@@ -30,10 +30,6 @@ class THcHitList {
void InitHitList(THaDetMap* detmap,
const char *hitclass, Int_t maxhits);
// This is a list of pointers to hit objects
// Instead should we have a list of the actual objects so that we are
// no delting and creating objects all the time.
//
Int_t fNRawHits;
Int_t fNMaxRawHits;
TClonesArray* fRawHitList; // List of raw hits
......
......@@ -43,6 +43,14 @@ THcHodoscope::THcHodoscope( const char* name, const char* description,
Setup(name, description);
}
//_____________________________________________________________________________
THcHodoscope::THcHodoscope( ) :
THaNonTrackingDetector()
{
// Constructor
}
//_____________________________________________________________________________
void THcHodoscope::Setup(const char* name, const char* description)
{
......@@ -78,18 +86,25 @@ void THcHodoscope::Setup(const char* name, const char* description)
strcat(subname, fPlaneNames[i]);
strcpy(desc, description);
strcpy(desc, " Hodoscope Plane ");
strcpy(desc, fPlaneNames[i]);
strcat(desc, " Hodoscope Plane ");
strcat(desc, fPlaneNames[i]);
fPlanes[i] = new THcScintillatorPlane(subname, desc);
cout << "Created Scintillator Plane " << subname << ", " << desc << endl;
}
}
//_____________________________________________________________________________
THcHodoscope::THcHodoscope( ) :
THaNonTrackingDetector()
void THcHodoscope::SetApparatus( THaApparatus* app )
{
// Constructor
// Set the apparatus of this detector as well as the subdetectors
cout << "In THcHodoscope::SetApparatus" << endl;
THaDetector::SetApparatus( app );
for(Int_t i=0;i < fNPlanes;i++) {
fPlanes[i]->SetApparatus( app );
}
return;
}
//_____________________________________________________________________________
......@@ -97,8 +112,18 @@ THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date )
{
static const char* const here = "Init()";
if( THaNonTrackingDetector::Init( date ) )
return fStatus;
cout << "THcHodoscope::Init " << GetName() << endl;
EStatus status;
// This triggers call of ReadDatabase and DefineVariables
if( status = THaNonTrackingDetector::Init( date ) )
return fStatus=status;
for(Int_t ip=0;ip<fNPlanes;ip++) {
if(status = fPlanes[ip]->Init( date )) {
return fStatus=status;
}
}
// Replace with what we need for Hall C
// const DataDest tmp[NDEST] = {
......@@ -161,6 +186,8 @@ Int_t THcHodoscope::ReadDatabase( const TDatime& date )
// Will need to determine which spectrometer in order to construct
// the parameter names (e.g. hscin_1x_nr vs. sscin_1x_nr)
cout << "THcHodoscope::ReadDatabase called " << GetName() << endl;
fNPlanes = 4; // Hardwire for now
fNPaddle = new Int_t [fNPlanes];
......@@ -231,6 +258,8 @@ Int_t THcHodoscope::DefineVariables( EMode mode )
{
// Initialize global variables and lookup table for decoder
cout << "THcHodoscope::DefineVariables called " << GetName() << endl;
if( mode == kDefine && fIsSetup ) return kOK;
fIsSetup = ( mode == kDefine );
......@@ -344,6 +373,12 @@ Int_t THcHodoscope::Decode( const THaEvData& evdata )
// Get the Hall C style hitlist (fRawHitList) for this event
Int_t nhits = THcHitList::DecodeToHitList(evdata);
// Let each plane get its hits
Int_t nexthit = 0;
for(Int_t ip=0;ip<fNPlanes;ip++) {
// nexthit = fPlanes[ip]->Fill(fRawHitList, nhits, nexthit);
}
// fRawHitList is TClones array of THcHodoscopeHit objects
for(Int_t ihit = 0; ihit < fNRawHits ; ihit++) {
THcHodoscopeHit* hit = (THcHodoscopeHit *) fRawHitList->At(ihit);
......
......@@ -24,6 +24,9 @@ public:
virtual Int_t Decode( const THaEvData& );
virtual EStatus Init( const TDatime& run_time );
void SetApparatus( THaApparatus* );
virtual Int_t CoarseProcess( TClonesArray& tracks );
virtual Int_t FineProcess( TClonesArray& tracks );
......
......@@ -8,6 +8,13 @@
#include "THcScintillatorPlane.h"
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
ClassImp(THcScintillatorPlane)
//______________________________________________________________________________
......@@ -26,6 +33,62 @@ THcScintillatorPlane::~THcScintillatorPlane()
// Destructor
}
THaAnalysisObject::EStatus THcScintillatorPlane::Init( const TDatime& date )
{
// Extra initialization for scintillator plane: set up DataDest map
cout << "THcScintillatorPlane::Init called " << GetName() << endl;
if( THaNonTrackingDetector::Init( date ) )
return fStatus;
// const DataDest tmp[NDEST] = {
// { &fLTNhit, &fLANhit, fLT, fLA },
// { &fRTNhit, &fRANhit, fRT, fRA }
// };
// memcpy( fDataDest, tmp, NDEST*sizeof(DataDest) );
return fStatus = kOK;
}
//_____________________________________________________________________________
Int_t THcScintillatorPlane::ReadDatabase( const TDatime& date )
{
static const char* const here = "ReadDatabase()";
const int LEN = 200;
char buf[LEN];
Int_t nelem;
cout << "THcScintillatorPlane::ReadDatabase called " << GetName() << endl;
// Think we will make special methods to pass most
// How generic do we want to make this class?
// The way we get parameter data is going to be pretty specific to
// our parameter file naming conventions. But on the other hand,
// the Hall A analyzer read database is pretty specific.
// Is there any way for this class to know which spectrometer he
// belongs too?
// Create arrays to hold results here
return kOK;
}
//_____________________________________________________________________________
Int_t THcScintillatorPlane::DefineVariables( EMode mode )
{
// Initialize global variables and lookup table for decoder
cout << "THcScintillatorPlane::DefineVariables called " << GetName() << endl;
if( mode == kDefine && fIsSetup ) return kOK;
fIsSetup = ( mode == kDefine );
// Register variables in global list
return kOK;
}
//_____________________________________________________________________________
Int_t THcScintillatorPlane::Decode( const THaEvData& evdata )
{
......
......@@ -22,7 +22,7 @@ class THcScintillatorPlane : public THaNonTrackingDetector {
virtual ~THcScintillatorPlane();
virtual Int_t Decode( const THaEvData& );
virtual EStatus Init( const TDatime& run_time );
virtual Int_t CoarseProcess( TClonesArray& tracks );
virtual Int_t FineProcess( TClonesArray& tracks );
......@@ -31,6 +31,9 @@ class THcScintillatorPlane : public THaNonTrackingDetector {
protected:
virtual Int_t ReadDatabase( const TDatime& date );
virtual Int_t DefineVariables( EMode mode = kDefine );
ClassDef(THcScintillatorPlane,0)
};
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment