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

Progress to making hit maps.

Add ThcSignalHit class
parent 4286abcc
No related branches found
No related tags found
No related merge requests found
...@@ -13,7 +13,7 @@ SRC = src/THcInterface.cxx src/THcParmList.cxx src/THcAnalyzer.cxx \ ...@@ -13,7 +13,7 @@ SRC = src/THcInterface.cxx src/THcParmList.cxx src/THcAnalyzer.cxx \
src/THcDCHit.cxx \ src/THcDCHit.cxx \
src/THcHitList.cxx src/THcDetectorMap.cxx src/THcHodoscope.cxx \ src/THcHitList.cxx src/THcDetectorMap.cxx src/THcHodoscope.cxx \
src/THcHallCSpectrometer.cxx src/THcDriftChamber.cxx \ src/THcHallCSpectrometer.cxx src/THcDriftChamber.cxx \
src/THcScintillatorPlane.cxx src/THcScintillatorPlane.cxx src/THcSignalHit.cxx
# Name of your package. # Name of your package.
# The shared library that will be built will get the name lib$(PACKAGE).so # The shared library that will be built will get the name lib$(PACKAGE).so
......
...@@ -19,5 +19,6 @@ ...@@ -19,5 +19,6 @@
#pragma link C++ class THcDetectorMap+; #pragma link C++ class THcDetectorMap+;
#pragma link C++ class THcHallCSpectrometer+; #pragma link C++ class THcHallCSpectrometer+;
#pragma link C++ class THcScintillatorPlane+; #pragma link C++ class THcScintillatorPlane+;
#pragma link C++ class THcSignalHit+;
#endif #endif
...@@ -114,7 +114,7 @@ THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date ) ...@@ -114,7 +114,7 @@ THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date )
EStatus status; EStatus status;
// This triggers call of ReadDatabase and DefineVariables // This triggers call of ReadDatabase and DefineVariables
if( status = THaNonTrackingDetector::Init( date ) ) if( (status = THaNonTrackingDetector::Init( date )) )
return fStatus=status; return fStatus=status;
for(Int_t ip=0;ip<fNPlanes;ip++) { for(Int_t ip=0;ip<fNPlanes;ip++) {
...@@ -357,11 +357,12 @@ void THcHodoscope::DeleteArrays() ...@@ -357,11 +357,12 @@ void THcHodoscope::DeleteArrays()
//_____________________________________________________________________________ //_____________________________________________________________________________
inline inline
void THcHodoscope::ClearEvent() void THcHodoscope::Clear( Option_t* opt)
{ {
// Reset per-event data. // Reset per-event data.
for(Int_t ip=0;ip<fNPlanes;ip++) {
fTrackProj->Clear(); fPlanes[ip]->Clear(opt);
}
} }
//_____________________________________________________________________________ //_____________________________________________________________________________
......
...@@ -22,6 +22,7 @@ public: ...@@ -22,6 +22,7 @@ public:
THaApparatus* a = NULL ); THaApparatus* a = NULL );
virtual ~THcHodoscope(); virtual ~THcHodoscope();
virtual void Clear( Option_t* opt="" );
virtual Int_t Decode( const THaEvData& ); virtual Int_t Decode( const THaEvData& );
virtual EStatus Init( const TDatime& run_time ); virtual EStatus Init( const TDatime& run_time );
......
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
#include "THcScintillatorPlane.h" #include "THcScintillatorPlane.h"
#include "TClonesArray.h"
#include "THcSignalHit.h"
#include "THcGlobals.h"
#include "THcParmList.h"
#include <cstring> #include <cstring>
#include <cstdio> #include <cstdio>
...@@ -24,13 +28,20 @@ THcScintillatorPlane::THcScintillatorPlane( const char* name, ...@@ -24,13 +28,20 @@ THcScintillatorPlane::THcScintillatorPlane( const char* name,
: THaSubDetector(name,description,parent) : THaSubDetector(name,description,parent)
{ {
// Normal constructor with name and description // 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() THcScintillatorPlane::~THcScintillatorPlane()
{ {
// Destructor // Destructor
delete fPosTDCHits;
delete fNegTDCHits;
delete fPosADCHits;
delete fNegADCHits;
} }
THaAnalysisObject::EStatus THcScintillatorPlane::Init( const TDatime& date ) THaAnalysisObject::EStatus THcScintillatorPlane::Init( const TDatime& date )
...@@ -47,15 +58,9 @@ THaAnalysisObject::EStatus THcScintillatorPlane::Init( const TDatime& date ) ...@@ -47,15 +58,9 @@ THaAnalysisObject::EStatus THcScintillatorPlane::Init( const TDatime& date )
// fOrigin = GetParent()->GetOrigin(); // fOrigin = GetParent()->GetOrigin();
EStatus status; EStatus status;
if( status=THaSubDetector::Init( date ) ) if( (status=THaSubDetector::Init( date )) )
return fStatus = status; return fStatus = status;
// const DataDest tmp[NDEST] = {
// { &fLTNhit, &fLANhit, fLT, fLA },
// { &fRTNhit, &fRANhit, fRT, fRA }
// };
// memcpy( fDataDest, tmp, NDEST*sizeof(DataDest) );
return fStatus = kOK; return fStatus = kOK;
} }
...@@ -67,11 +72,32 @@ Int_t THcScintillatorPlane::ReadDatabase( const TDatime& date ) ...@@ -67,11 +72,32 @@ Int_t THcScintillatorPlane::ReadDatabase( const TDatime& date )
// See what file it looks for // See what file it looks for
static const char* const here = "ReadDatabase()"; static const char* const here = "ReadDatabase()";
const int LEN = 200; char prefix[2];
char buf[LEN]; char parname[100];
Int_t nelem;
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 // Think we will make special methods to pass most
// How generic do we want to make this class? // How generic do we want to make this class?
// The way we get parameter data is going to be pretty specific to // The way we get parameter data is going to be pretty specific to
...@@ -97,12 +123,38 @@ Int_t THcScintillatorPlane::DefineVariables( EMode mode ) ...@@ -97,12 +123,38 @@ Int_t THcScintillatorPlane::DefineVariables( EMode mode )
fIsSetup = ( mode == kDefine ); fIsSetup = ( mode == kDefine );
// Register variables in global list // 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 ) Int_t THcScintillatorPlane::Decode( const THaEvData& evdata )
{ {
// Doesn't actually get called. Use Fill method instead
cout << " Calling THcScintillatorPlane::Decode " << GetName() << endl;
return 0; return 0;
} }
//_____________________________________________________________________________ //_____________________________________________________________________________
......
...@@ -13,8 +13,10 @@ ...@@ -13,8 +13,10 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
#include "THaSubDetector.h" #include "THaSubDetector.h"
#include "TClonesArray.h"
class THaEvData; class THaEvData;
class THaSignalHit;
class THcScintillatorPlane : public THaSubDetector { class THcScintillatorPlane : public THaSubDetector {
...@@ -23,6 +25,7 @@ class THcScintillatorPlane : public THaSubDetector { ...@@ -23,6 +25,7 @@ class THcScintillatorPlane : public THaSubDetector {
THaDetectorBase* parent = NULL); THaDetectorBase* parent = NULL);
virtual ~THcScintillatorPlane(); virtual ~THcScintillatorPlane();
virtual void Clear( Option_t* opt="" );
virtual Int_t Decode( const THaEvData& ); virtual Int_t Decode( const THaEvData& );
virtual EStatus Init( const TDatime& run_time ); virtual EStatus Init( const TDatime& run_time );
...@@ -31,8 +34,15 @@ class THcScintillatorPlane : public THaSubDetector { ...@@ -31,8 +34,15 @@ class THcScintillatorPlane : public THaSubDetector {
Bool_t IsTracking() { return kFALSE; } Bool_t IsTracking() { return kFALSE; }
virtual Bool_t IsPid() { return kFALSE; } virtual Bool_t IsPid() { return kFALSE; }
Double_t fSpacing;
protected: protected:
TClonesArray* fPosTDCHits;
TClonesArray* fNegTDCHits;
TClonesArray* fPosADCHits;
TClonesArray* fNegADCHits;
virtual Int_t ReadDatabase( const TDatime& date ); virtual Int_t ReadDatabase( const TDatime& date );
virtual Int_t DefineVariables( EMode mode = kDefine ); virtual Int_t DefineVariables( EMode mode = kDefine );
......
///////////////////////////////////////////////////////////////////////////////
// //
// THcSignalHit //
// //
// Class representing a single signal value and its wire/paddle number //
// //
///////////////////////////////////////////////////////////////////////////////
#include "THcSignalHit.h"
ClassImp(THcSignalHit)
#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
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