diff --git a/Makefile b/Makefile index f1f95c27ba2cb91e35847629effcfc7c67625121..583996d3c4e14e461d1696e19877bb6e06e36908 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ SRC = src/THcInterface.cxx src/THcParmList.cxx src/THcAnalyzer.cxx \ src/THcDCHit.cxx \ src/THcHitList.cxx src/THcDetectorMap.cxx src/THcHodoscope.cxx \ src/THcHallCSpectrometer.cxx src/THcDriftChamber.cxx \ - src/THcScintillatorPlane.cxx + src/THcScintillatorPlane.cxx src/THcSignalHit.cxx # Name of your package. # The shared library that will be built will get the name lib$(PACKAGE).so diff --git a/src/HallC_LinkDef.h b/src/HallC_LinkDef.h index b939b5157bd2ba4b46ada19cacd19717aecedba3..a8d80d8c6b54d291706a3a61a237af14e73c1e96 100644 --- a/src/HallC_LinkDef.h +++ b/src/HallC_LinkDef.h @@ -19,5 +19,6 @@ #pragma link C++ class THcDetectorMap+; #pragma link C++ class THcHallCSpectrometer+; #pragma link C++ class THcScintillatorPlane+; +#pragma link C++ class THcSignalHit+; #endif diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx index 612f85560a1f322242ca565d624dd5dd7ce14826..24f1c38238f382342a5884baae8631707153ee9f 100644 --- a/src/THcHodoscope.cxx +++ b/src/THcHodoscope.cxx @@ -114,7 +114,7 @@ THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date ) EStatus status; // This triggers call of ReadDatabase and DefineVariables - if( status = THaNonTrackingDetector::Init( date ) ) + if( (status = THaNonTrackingDetector::Init( date )) ) return fStatus=status; for(Int_t ip=0;ip<fNPlanes;ip++) { @@ -357,11 +357,12 @@ void THcHodoscope::DeleteArrays() //_____________________________________________________________________________ inline -void THcHodoscope::ClearEvent() +void THcHodoscope::Clear( Option_t* opt) { // Reset per-event data. - - fTrackProj->Clear(); + for(Int_t ip=0;ip<fNPlanes;ip++) { + fPlanes[ip]->Clear(opt); + } } //_____________________________________________________________________________ diff --git a/src/THcHodoscope.h b/src/THcHodoscope.h index 72703e18d1bcbc23e5039df4034953cc93f534d2..ad10179a36ad4c82491569871596692ac6f9843e 100644 --- a/src/THcHodoscope.h +++ b/src/THcHodoscope.h @@ -22,6 +22,7 @@ public: THaApparatus* a = NULL ); virtual ~THcHodoscope(); + virtual void Clear( Option_t* opt="" ); virtual Int_t Decode( const THaEvData& ); virtual EStatus Init( const TDatime& run_time ); diff --git a/src/THcScintillatorPlane.cxx b/src/THcScintillatorPlane.cxx index 29109c1d19bb2f640feb8a3b52b3604b0e67b12b..096df9f1fc81baf1ebc27e3aac771cccca86213f 100644 --- a/src/THcScintillatorPlane.cxx +++ b/src/THcScintillatorPlane.cxx @@ -7,6 +7,10 @@ ////////////////////////////////////////////////////////////////////////// #include "THcScintillatorPlane.h" +#include "TClonesArray.h" +#include "THcSignalHit.h" +#include "THcGlobals.h" +#include "THcParmList.h" #include <cstring> #include <cstdio> @@ -24,13 +28,20 @@ THcScintillatorPlane::THcScintillatorPlane( const char* name, : THaSubDetector(name,description,parent) { // Normal constructor with name and description - + fPosTDCHits = new TClonesArray("THcSignalHit",16); + fNegTDCHits = new TClonesArray("THcSignalHit",16); + fPosADCHits = new TClonesArray("THcSignalHit",16); + fNegADCHits = new TClonesArray("THcSignalHit",16); } //______________________________________________________________________________ THcScintillatorPlane::~THcScintillatorPlane() { // Destructor + delete fPosTDCHits; + delete fNegTDCHits; + delete fPosADCHits; + delete fNegADCHits; } THaAnalysisObject::EStatus THcScintillatorPlane::Init( const TDatime& date ) @@ -47,15 +58,9 @@ THaAnalysisObject::EStatus THcScintillatorPlane::Init( const TDatime& date ) // fOrigin = GetParent()->GetOrigin(); EStatus status; - if( status=THaSubDetector::Init( date ) ) + if( (status=THaSubDetector::Init( date )) ) return fStatus = status; - // const DataDest tmp[NDEST] = { - // { &fLTNhit, &fLANhit, fLT, fLA }, - // { &fRTNhit, &fRANhit, fRT, fRA } - // }; - // memcpy( fDataDest, tmp, NDEST*sizeof(DataDest) ); - return fStatus = kOK; } @@ -67,11 +72,32 @@ Int_t THcScintillatorPlane::ReadDatabase( const TDatime& date ) // See what file it looks for static const char* const here = "ReadDatabase()"; - const int LEN = 200; - char buf[LEN]; - Int_t nelem; + char prefix[2]; + char parname[100]; + + prefix[0]=tolower(GetParent()->GetPrefix()[0]); + prefix[1]='\0'; + + strcpy(parname,prefix); + strcat(parname,"scin_"); + strcat(parname,GetName()); + Int_t plen=strlen(parname); + + strcat(parname,"_nr"); + cout << " Getting value of " << parname << endl; + fNelem = *(Int_t *)gHcParms->Find(parname)->GetValuePointer(); + + parname[plen]='\0'; + strcat(parname,"_spacing"); + + fSpacing = gHcParms->Find(parname)->GetValue(0); + + // First letter of GetParent()->GetPrefix() tells us what prefix to + // use on parameter names. - cout << "THcScintillatorPlane::ReadDatabase called " << GetName() << endl; + + // Find the number of elements + // 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 @@ -97,12 +123,38 @@ Int_t THcScintillatorPlane::DefineVariables( EMode mode ) fIsSetup = ( mode == kDefine ); // Register variables in global list - return kOK; + RVarDef vars[] = { + {"postdchits", "List of Positive TDC hits", + "fPosTDCHits.THcSignalHit.GetPaddle()"}, + {"negtdchits", "List of Negative TDC hits", + "fNegTDCHits.THcSignalHit.GetPaddle()"}, + {"posadchits", "List of Positive ADC hits", + "fPosADCHits.THcSignalHit.GetPaddle()"}, + {"negadchits", "List of Negative ADC hits", + "fNegADCHits.THcSignalHit.GetPaddle()"}, + { 0 } + }; + + return DefineVarsFromList( vars, mode ); +} + +//_____________________________________________________________________________ +void THcScintillatorPlane::Clear( Option_t* ) +{ + cout << " Calling THcScintillatorPlane::Clear " << GetName() << endl; + // Clears the hit lists + fPosTDCHits->Clear(); + fNegTDCHits->Clear(); + fPosADCHits->Clear(); + fNegADCHits->Clear(); } //_____________________________________________________________________________ Int_t THcScintillatorPlane::Decode( const THaEvData& evdata ) { + // Doesn't actually get called. Use Fill method instead + cout << " Calling THcScintillatorPlane::Decode " << GetName() << endl; + return 0; } //_____________________________________________________________________________ diff --git a/src/THcScintillatorPlane.h b/src/THcScintillatorPlane.h index 8d1bb08659c61efbc74689ac31c24da794b4eec0..9629c3fd1916c6a98d25288a69a568cf6d83bd0d 100644 --- a/src/THcScintillatorPlane.h +++ b/src/THcScintillatorPlane.h @@ -13,8 +13,10 @@ ////////////////////////////////////////////////////////////////////////////// #include "THaSubDetector.h" +#include "TClonesArray.h" class THaEvData; +class THaSignalHit; class THcScintillatorPlane : public THaSubDetector { @@ -23,6 +25,7 @@ class THcScintillatorPlane : public THaSubDetector { THaDetectorBase* parent = NULL); virtual ~THcScintillatorPlane(); + virtual void Clear( Option_t* opt="" ); virtual Int_t Decode( const THaEvData& ); virtual EStatus Init( const TDatime& run_time ); @@ -31,8 +34,15 @@ class THcScintillatorPlane : public THaSubDetector { Bool_t IsTracking() { return kFALSE; } virtual Bool_t IsPid() { return kFALSE; } + Double_t fSpacing; + protected: + TClonesArray* fPosTDCHits; + TClonesArray* fNegTDCHits; + TClonesArray* fPosADCHits; + TClonesArray* fNegADCHits; + virtual Int_t ReadDatabase( const TDatime& date ); virtual Int_t DefineVariables( EMode mode = kDefine ); diff --git a/src/THcSignalHit.cxx b/src/THcSignalHit.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8400419e5bcb4f482433535ab6bc33b4448404dc --- /dev/null +++ b/src/THcSignalHit.cxx @@ -0,0 +1,11 @@ +/////////////////////////////////////////////////////////////////////////////// +// // +// THcSignalHit // +// // +// Class representing a single signal value and its wire/paddle number // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "THcSignalHit.h" + +ClassImp(THcSignalHit) diff --git a/src/THcSignalHit.h b/src/THcSignalHit.h new file mode 100644 index 0000000000000000000000000000000000000000..fed4b892691754dd30674a9970d0dc2d5185a790 --- /dev/null +++ b/src/THcSignalHit.h @@ -0,0 +1,30 @@ +#ifndef ROOT_THcSignalHit +#define ROOT_THcSignalHit + +///////////////////////////////////////////////////////////////////////////// +// // +// THcSignalHit // +// // +///////////////////////////////////////////////////////////////////////////// + +#include "TObject.h" +#include <cstdio> + +class THcSignalHit : public TObject { + + public: + THcSignalHit(Int_t paddle=0, Double_t data=0.0) : + fPaddleNumber(paddle), fData(data) {} + virtual ~THcSignalHit() {} + + Int_t GetPaddleNumber() {return fPaddleNumber;} + Double_t GetData() {return fData;} + + private: + Int_t fPaddleNumber; + Double_t fData; + + ClassDef(THcSignalHit,0) +}; +///////////////////////////////////////////////////////////////// +#endif