diff --git a/src/THcHitList.h b/src/THcHitList.h index be90264a614912a2c85122ea76367863040ce356..099eb6abd7a7f3bb5b80f11b4314a724e2a156de 100644 --- a/src/THcHitList.h +++ b/src/THcHitList.h @@ -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 diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx index b6769caf625fc7ed0d8f26fd032b5ba2bbd5f39e..c9c9cdf8fc55bcb3e873219add5c5f6cec40a5bf 100644 --- a/src/THcHodoscope.cxx +++ b/src/THcHodoscope.cxx @@ -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); diff --git a/src/THcHodoscope.h b/src/THcHodoscope.h index 88c9483d53469f6dbe16958b21efca19b277d33b..0f02ba56cdaed83264815ac176cd9b935ba8da57 100644 --- a/src/THcHodoscope.h +++ b/src/THcHodoscope.h @@ -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 ); diff --git a/src/THcScintillatorPlane.cxx b/src/THcScintillatorPlane.cxx index 87aeb5f0f4abac104110d7864c658f613e2b6e48..9373b01a648a797f698288aff5036af8824de9d6 100644 --- a/src/THcScintillatorPlane.cxx +++ b/src/THcScintillatorPlane.cxx @@ -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 ) { diff --git a/src/THcScintillatorPlane.h b/src/THcScintillatorPlane.h index 0930c865b853cb513eecb383aea37a3586839b7e..55567928ca5c2c870ecece01e6d4f849d3d17340 100644 --- a/src/THcScintillatorPlane.h +++ b/src/THcScintillatorPlane.h @@ -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