diff --git a/Makefile b/Makefile index 735a3c9235c9200abdde845cec18d7dc5bb943fe..7b893ea6c97e972ab97d6929f3a8fd62c3cf68e4 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,8 @@ SRC = src/THcInterface.cxx src/THcParmList.cxx src/THcAnalyzer.cxx \ src/THcDriftChamber.cxx src/THcDriftChamberPlane.cxx \ src/THcDCHit.cxx \ src/THcShower.cxx src/THcShowerPlane.cxx \ - src/THcShowerHit.cxx + src/THcShowerHit.cxx \ + src/THcAerogel.cxx src/THcAerogelHit.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 01a64a358eb03c3a468a2299591d5b9e3ef78b1e..50b203cec8ed6cfe981476e7313766a1fa5acdb2 100644 --- a/src/HallC_LinkDef.h +++ b/src/HallC_LinkDef.h @@ -24,5 +24,7 @@ #pragma link C++ class THcShower+; #pragma link C++ class THcShowerPlane+; #pragma link C++ class THcShowerHit+; +#pragma link C++ class THcAerogel; +#pragma link C++ class THcAerogelHit; #endif diff --git a/src/THcAerogel.cxx b/src/THcAerogel.cxx new file mode 100644 index 0000000000000000000000000000000000000000..da522cebeed9dc24f746f0680253c283b8bbb9f5 --- /dev/null +++ b/src/THcAerogel.cxx @@ -0,0 +1,162 @@ +/////////////////////////////////////////////////////////////////////////////// +// // +// THcAerogel // +// // +// Class for an Aerogel detector consisting of pairs of PMT's // +// attached to a diffuser box // +// Will have a fixed number of pairs, but need to later make this // +// configurable. //T +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "THcAerogel.h" +#include "THaEvData.h" +#include "THaDetMap.h" +#include "THcDetectorMap.h" +#include "THcGlobals.h" +#include "THaCutList.h" +#include "THcParmList.h" +#include "VarDef.h" +#include "VarType.h" +#include "THaTrack.h" +#include "TClonesArray.h" +#include "TMath.h" + +#include "THaTrackProj.h" + +#include <cstring> +#include <cstdio> +#include <cstdlib> +#include <iostream> + +using namespace std; + +//_____________________________________________________________________________ +THcAerogel::THcAerogel( const char* name, const char* description, + THaApparatus* apparatus ) : + THaNonTrackingDetector(name,description,apparatus) +{ + // Constructor +// fTrackProj = new TClonesArray( "THaTrackProj", 5 ); +} + +//_____________________________________________________________________________ +THcAerogel::THcAerogel( ) : + THaNonTrackingDetector() +{ + // Constructor +} + + +//_____________________________________________________________________________ +THaAnalysisObject::EStatus THcAerogel::Init( const TDatime& date ) +{ + static const char* const here = "Init()"; + + cout << "THcAerogel::Init " << GetName() << endl; + Setup(GetName(), GetTitle()); + + // Should probably put this in ReadDatabase as we will know the + // maximum number of hits after setting up the detector map + + THcHitList::InitHitList(fDetMap, "THcAerogelHit", 100); + + EStatus status; + if( (status = THaNonTrackingDetector::Init( date )) ) + return fStatus=status; + + for(Int_t ip=0;ip<fNLayers;ip++) { + if((status = fPlanes[ip]->Init( date ))) { + return fStatus=status; + } + } + // Will need to determine which apparatus it belongs to and use the + // appropriate detector ID in the FillMap call + if( gHcDetectorMap->FillMap(fDetMap, "HCAL") < 0 ) { + Error( Here(here), "Error filling detectormap for %s.", + "HCAL"); + return kInitError; + } + + return fStatus = kOK; +} + +//_____________________________________________________________________________ +inline +void THcAerogel::Clear(Option_t* opt) +{ +// Reset per-event data. + for(Int_t ip=0;ip<fNLayers;ip++) { + fPlanes[ip]->Clear(opt); + } + // fTrackProj->Clear(); +} + +//_____________________________________________________________________________ +Int_t THcAerogel::Decode( const THaEvData& evdata ) +{ + // Get the Hall C style hitlist (fRawHitList) for this event + Int_t nhits = THcHitList::DecodeToHitList(evdata); + +if(gHaCuts->Result("Pedestal_event")) { + Int_t nexthit = 0; + for(Int_t ip=0;ip<fNLayers;ip++) { + nexthit = fPlanes[ip]->AccumulatePedestals(fRawHitList, nexthit); +//cout << "nexthit = " << nexthit << endl; + } + fAnalyzePedestals = 1; // Analyze pedestals first normal events + return(0); + } + + if(fAnalyzePedestals) { + for(Int_t ip=0;ip<fNLayers;ip++) { + fPlanes[ip]->CalculatePedestals(); + } + fAnalyzePedestals = 0; // Don't analyze pedestals next event + } + + + + Int_t nexthit = 0; + for(Int_t ip=0;ip<fNLayers;ip++) { + nexthit = fPlanes[ip]->ProcessHits(fRawHitList, nexthit); + } +/* +// fRawHitList is TClones array of THcAerogelHit objects + for(Int_t ihit = 0; ihit < fNRawHits ; ihit++) { + THcAerogelHit* hit = (THcAerogelHit *) fRawHitList->At(ihit); + cout << ihit << " : " << hit->fPlane << ":" << hit->fCounter << " : " + << hit->fADC_pos << " " << hit->fADC_neg << " " << endl; + } + cout << endl; +*/ + return nhits; +} + +//_____________________________________________________________________________ +Int_t THcAerogel::ApplyCorrections( void ) +{ + return(0); +} + +//_____________________________________________________________________________ +Int_t THcAerogel::CoarseProcess( TClonesArray& ) //tracks +{ + + ApplyCorrections(); + + return 0; +} + +//_____________________________________________________________________________ +Int_t THcAerogel::FineProcess( TClonesArray& tracks ) +{ + + return 0; +} + + + +ClassImp(THcAerogel) +//////////////////////////////////////////////////////////////////////////////// + diff --git a/src/THcAerogel.h b/src/THcAerogel.h new file mode 100644 index 0000000000000000000000000000000000000000..f34e9a408cf4a4d541921b4cf097ffeb19c7a27d --- /dev/null +++ b/src/THcAerogel.h @@ -0,0 +1,35 @@ +#ifndef ROOT_THcHodoscope +#define ROOT_THcHodoscope + +/////////////////////////////////////////////////////////////////////////////// +// // +// THcHodoscope // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "TClonesArray.h" +#include "THaNonTrackingDetector.h" +#include "THcHitList.h" +#include "THcAerogelHit.h" + +class THcHodoscope : public THaNonTrackingDetector, public THcHitList { + + public: + THcHodoscope( const char* name, const char* description = "", + THaApparatus* a = NULL ); + virtual ~THcHodoscope(); + + virtual void Clear( Option_t* opt="" ); + 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 ); + + protected: + + ClassDef(THcHodoscope,0) // Generic hodoscope class +}; + +#endif diff --git a/src/THcAerogelHit.cxx b/src/THcAerogelHit.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4ead9c573035682818a09350d759ab81bdc0c109 --- /dev/null +++ b/src/THcAerogelHit.cxx @@ -0,0 +1,17 @@ +/////////////////////////////////////////////////////////////////////////////// +// // +// THcAerogelHit // +// // +// Class representing a single raw hit for a pair of aerogel tubes // +// // +// Contains plane, counter and pos/neg adc // +// // +// Assumes Aerogel design where Aerogel PMT's are in pairs and only have // +// ADCs. // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "THcAerogelHit.h" + +////////////////////////////////////////////////////////////////////////// +ClassImp(THcAerogelHit) diff --git a/src/THcAerogelHit.h b/src/THcAerogelHit.h new file mode 100644 index 0000000000000000000000000000000000000000..6dda5413cdad70baeb654432f87733455341e08b --- /dev/null +++ b/src/THcAerogelHit.h @@ -0,0 +1,18 @@ +#ifndef ROOT_THcAerogelHit +#define ROOT_THcAerogelHit + +#include "THcShowerHit.h" + +class THcAerogelHit : public THcShowerHit { + + public: + + protected: + + private: + + ClassDef(THcAerogelHit,0); // Aerogel hit class +}; + +#endif +