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

Add the intermediate classes needed for a H

Copy the intermediate classes needed for THcHodoscope.  Many
changes needed.
parent afd41560
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
SRC = src/THcInterface.cxx src/THcParmList.cxx src/THcAnalyzer.cxx \ SRC = src/THcInterface.cxx src/THcParmList.cxx src/THcAnalyzer.cxx \
src/THcHodoscopeHit.cxx src/THcRawHit.cxx \ src/THcHodoscopeHit.cxx src/THcRawHit.cxx \
src/THcDetectorBase.cxx src/THcDetector.cxx src/THcDetectorBase.cxx src/THcDetector.cxx \
src/THcSpectrometerDetector.cxx src/THcNonTrackingDetector.cxx \
src/THcHodoscope.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
......
...@@ -13,5 +13,8 @@ ...@@ -13,5 +13,8 @@
#pragma link C++ class THcHodoscopeHit+; #pragma link C++ class THcHodoscopeHit+;
#pragma link C++ class THcDetectorBase+; #pragma link C++ class THcDetectorBase+;
#pragma link C++ class THcDetector+; #pragma link C++ class THcDetector+;
#pragma link C++ class THcSpectrometerDetector+;
#pragma link C++ class THcNonTrackingDetector+;
#pragma link C++ class THcHodoscope+;
#endif #endif
This diff is collapsed.
#ifndef ROOT_THaHodoscope
#define ROOT_THaHodoscope
///////////////////////////////////////////////////////////////////////////////
// //
// THaHodoscope //
// //
///////////////////////////////////////////////////////////////////////////////
#include "TClonesArray.h"
#include "THaNonTrackingDetector.h"
class THaScCalib;
class THaHodoscope : public THaNonTrackingDetector {
public:
THaHodoscope( const char* name, const char* description = "",
THaApparatus* a = NULL );
virtual ~THaHodoscope();
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 );
virtual Int_t ApplyCorrections( void );
Int_t GetNHits() const { return fNhit; }
const Double_t* GetTimes() const { return fTime; }
const Double_t* GetTuncer() const { return fdTime; }
const Double_t* GetAmplitudes() const { return fAmpl; }
const Double_t* GetYtime() const { return fYt; }
const Double_t* GetYampl() const { return fYa; }
Int_t GetNTracks() const { return fTrackProj->GetLast()+1; }
const TClonesArray* GetTrackHits() const { return fTrackProj; }
friend class THaScCalib;
THaHodoscope(); // for ROOT I/O
protected:
// Calibration
Double_t* fLOff; // [fNelem] TDC offsets for left paddles
Double_t* fROff; // [fNelem] TDC offsets for right paddles
Double_t* fLPed; // [fNelem] ADC pedestals for left paddles
Double_t* fRPed; // [fNelem] ADC pedestals for right paddles
Double_t* fLGain; // [fNelem] ADC gains for left paddles
Double_t* fRGain; // [fNelem] ADC gains for right paddles
Double_t fTdc2T; // linear conversion between TDC and time (s/ch)
Double_t fCn; // speed of light in material (meters/second)
Int_t fNTWalkPar; // number of timewalk correction parameters
Double_t* fTWalkPar; // [fNTWalkPar] time walk correction parameters
Double_t fAdcMIP; // nominal ADC above pedestal for MIP
Double_t* fTrigOff; // [fNelem] Induced offset of trigger time from
// diff between trigger and retiming.
// Visible in coincidence data.
Double_t fAttenuation; // in m^-1: attenuation length of material
Double_t fResolution; // average time resolution per PMT (s)
// Per-event data
Int_t fLTNhit; // Number of Left paddles TDC times
Double_t* fLT; // [fNelem] Array of Left paddles TDC times (channels)
Double_t* fLT_c; // [fNelem] Array of Left PMT corrected TDC times (s)
Int_t fRTNhit; // Number of Right paddles TDC times
Double_t* fRT; // [fNelem] Array of Right paddles TDC times (channels)
Double_t* fRT_c; // [fNelem] Array of Right PMT corrected TDC times (s)
Int_t fLANhit; // Number of Left paddles ADC amplitudes
Double_t* fLA; // [fNelem] Array of Left paddles ADC amplitudes
Double_t* fLA_p; // [fNelem] Array of Left paddles ADC minus ped values
Double_t* fLA_c; // [fNelem] Array of Left paddles corrected ADC ampl-s
Int_t fRANhit; // Number of Right paddles ADC amplitudes
Double_t* fRA; // [fNelem] Array of Right paddles ADC amplitudes
Double_t* fRA_p; // [fNelem] Array of Right paddles ADC minus ped values
Double_t* fRA_c; // [fNelem] Array of Right paddles corrected ADC ampl-s
Int_t fNhit; // Number of paddles with complete TDC hits (l&r)
Int_t* fHitPad; // [fNhit] list of paddles with complete TDC hits
// could be done on a per-hit basis instead
Double_t* fTime; // [fNelem] corrected time for the paddle (s)
Double_t* fdTime; // [fNelem] uncertainty in time (s)
Double_t* fAmpl; // [fNelem] overall amplitude for the paddle
Double_t* fYt; // [fNelem] y-position of hit in paddle from TDC (m)
Double_t* fYa; // [fNelem] y-position of hit in paddle from ADC (m)
TClonesArray* fTrackProj; // projection of track onto scintillator plane
// and estimated match to TOF paddle
// Useful derived quantities
double tan_angle, sin_angle, cos_angle;
static const char NDEST = 2;
struct DataDest {
Int_t* nthit;
Int_t* nahit;
Double_t* tdc;
Double_t* tdc_c;
Double_t* adc;
Double_t* adc_p;
Double_t* adc_c;
Double_t* offset;
Double_t* ped;
Double_t* gain;
} fDataDest[NDEST]; // Lookup table for decoder
void ClearEvent();
void DeleteArrays();
virtual Int_t ReadDatabase( const TDatime& date );
virtual Int_t DefineVariables( EMode mode = kDefine );
enum ESide { kLeft = 0, kRight = 1 };
virtual Double_t TimeWalkCorrection(const Int_t& paddle,
const ESide side);
ClassDef(THaHodoscope,0) // Generic scintillator class
};
////////////////////////////////////////////////////////////////////////////////
#endif
//*-- Author : Ole Hansen 7-Sep-00
//////////////////////////////////////////////////////////////////////////
//
// THaNonTrackingDetector
//
//////////////////////////////////////////////////////////////////////////
#include "THaNonTrackingDetector.h"
ClassImp(THaNonTrackingDetector)
//______________________________________________________________________________
THaNonTrackingDetector::THaNonTrackingDetector( const char* name,
const char* description,
THaApparatus* apparatus )
: THaSpectrometerDetector(name,description,apparatus)
{
// Normal constructor with name and description
}
//______________________________________________________________________________
THaNonTrackingDetector::THaNonTrackingDetector( )
: THaSpectrometerDetector( )
{
// for ROOT I/O only
}
//______________________________________________________________________________
THaNonTrackingDetector::~THaNonTrackingDetector()
{
// Destructor
}
#ifndef ROOT_THaNonTrackingDetector
#define ROOT_THaNonTrackingDetector
//////////////////////////////////////////////////////////////////////////
//
// THaNonTrackingDetector.h
//
// Abstract base class for a generic non-tracking spectrometer detector.
//
// This is a special THaSpectrometerDetector -- any detector that
// is not a tracking detector. This includes PID detectors.
//
//////////////////////////////////////////////////////////////////////////
#include "THaSpectrometerDetector.h"
class TClonesArray;
class THaNonTrackingDetector : public THaSpectrometerDetector {
public:
THaNonTrackingDetector(); // only for ROOT I/O
virtual ~THaNonTrackingDetector();
virtual Int_t CoarseProcess( TClonesArray& tracks ) = 0;
virtual Int_t FineProcess( TClonesArray& tracks ) = 0;
Bool_t IsTracking() { return kFALSE; }
virtual Bool_t IsPid() { return kFALSE; }
protected:
//Only derived classes may construct me for real
THaNonTrackingDetector( const char* name, const char* description,
THaApparatus* a = NULL);
ClassDef(THaNonTrackingDetector,1) //ABC for a non-tracking spectrometer detector
};
#endif
//*-- Author : Ole Hansen 7-Sep-00
//////////////////////////////////////////////////////////////////////////
//
// THaSpectrometerDetector
//
//////////////////////////////////////////////////////////////////////////
#include "THaSpectrometerDetector.h"
#include "THaTrack.h"
#include "TMath.h"
ClassImp(THaSpectrometerDetector)
//______________________________________________________________________________
THaSpectrometerDetector::THaSpectrometerDetector( const char* name,
const char* description,
THaApparatus* apparatus )
: THaDetector(name,description,apparatus)
{
// Constructor
}
//______________________________________________________________________________
THaSpectrometerDetector::THaSpectrometerDetector( )
{
// Constructor for ROOT I/O only
}
//______________________________________________________________________________
THaSpectrometerDetector::~THaSpectrometerDetector()
{
// Destructor
}
//_____________________________________________________________________________
void THaSpectrometerDetector::DefineAxes(Double_t rotation_angle)
{
// define variables used for calculating intercepts of tracks
// with the detector
// right now, we assume that all detectors except VDCs are
// perpendicular to the Transport frame
fXax.SetXYZ( TMath::Cos(rotation_angle), 0.0, TMath::Sin(rotation_angle) );
fYax.SetXYZ( 0.0, 1.0, 0.0 );
fZax = fXax.Cross(fYax);
}
//_____________________________________________________________________________
bool THaSpectrometerDetector::CalcTrackIntercept(THaTrack* theTrack,
Double_t& t, Double_t& xcross,
Double_t& ycross)
{
// projects a given track on to the plane of the detector
// xcross and ycross are the x and y coords of this intersection
// t is the distance from the origin of the track to the given plane.
//
// If a hit is NOT found, then t, xcross, and ycross are unchanged.
TVector3 t0( theTrack->GetX(), theTrack->GetY(), 0.0 );
Double_t norm = TMath::Sqrt(1.0 + theTrack->GetTheta()*theTrack->GetTheta() +
theTrack->GetPhi()*theTrack->GetPhi());
TVector3 t_hat( theTrack->GetTheta()/norm, theTrack->GetPhi()/norm, 1.0/norm );
TVector3 v;
if( !IntersectPlaneWithRay( fXax, fYax, fOrigin, t0, t_hat, t, v ))
return false;
v -= fOrigin;
xcross = v.Dot(fXax);
ycross = v.Dot(fYax);
return true;
}
//_____________________________________________________________________________
bool THaSpectrometerDetector::CheckIntercept(THaTrack *track)
{
Double_t x, y, t;
return CalcTrackIntercept(track, t, x, y);
}
//_____________________________________________________________________________
bool THaSpectrometerDetector::CalcInterceptCoords(THaTrack* track, Double_t& x, Double_t& y)
{
Double_t t;
return CalcTrackIntercept(track, t, x, y);
}
//_____________________________________________________________________________
bool THaSpectrometerDetector::CalcPathLen(THaTrack* track, Double_t& t)
{
Double_t x, y;
return CalcTrackIntercept(track, t, x, y);
}
#ifndef ROOT_THaSpectrometerDetector
#define ROOT_THaSpectrometerDetector
//////////////////////////////////////////////////////////////////////////
//
// THaSpectrometerDetector
//
// Abstract base class for a generic spectrometer detector.
//
// This is a specialized detector class that supports the concept of
// "tracking" and "PID" detectors.
//
//////////////////////////////////////////////////////////////////////////
#include "THaDetector.h"
class THaTrack;
class THaSpectrometerDetector : public THaDetector {
public:
virtual ~THaSpectrometerDetector();
virtual Bool_t IsTracking() = 0;
virtual Bool_t IsPid() = 0;
bool CheckIntercept( THaTrack* track );
bool CalcInterceptCoords( THaTrack* track,
Double_t& x, Double_t& y );
bool CalcPathLen( THaTrack* track, Double_t& t );
THaSpectrometerDetector(); // for ROOT I/O only
protected:
// Geometry data
TVector3 fXax; // X axis of the detector plane
TVector3 fYax; // Y axis of the detector plane
TVector3 fZax; // Normal to the detector plane
virtual void DefineAxes( Double_t rotation_angle );
bool CalcTrackIntercept( THaTrack* track, Double_t& t,
Double_t& ycross, Double_t& xcross);
//Only derived classes may construct me
THaSpectrometerDetector( const char* name, const char* description,
THaApparatus* a = NULL );
ClassDef(THaSpectrometerDetector,1) //ABC for a spectrometer detector
};
#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