From 54823e0bbbe217c0d9c3402360cd6847fd95cdcd Mon Sep 17 00:00:00 2001 From: "Stephen A. Wood" <saw@jlab.org> Date: Thu, 1 Nov 2012 16:49:25 -0400 Subject: [PATCH] Complete Aerogel hit map code and example. --- examples/PARAM/general.param | 2 + examples/hodtest.C | 1 + examples/output.def | 1 + src/THcAerogel.cxx | 78 +++++++++++++++++++++++++----------- src/THcAerogel.h | 7 ++++ 5 files changed, 66 insertions(+), 23 deletions(-) diff --git a/examples/PARAM/general.param b/examples/PARAM/general.param index 4dae5e1..6cb0731 100644 --- a/examples/PARAM/general.param +++ b/examples/PARAM/general.param @@ -23,3 +23,5 @@ raddeg=3.14159265/180 #include "PARAM/shodo.pos" #include "PARAM/scal.pos" #include "PARAM/hhodo.param" +#include "PARAM/haero.param" + diff --git a/examples/hodtest.C b/examples/hodtest.C index 977b1e4..ea02785 100644 --- a/examples/hodtest.C +++ b/examples/hodtest.C @@ -35,6 +35,7 @@ HMS->AddDetector( new THcHodoscope("hod", "Hodoscope" )); HMS->AddDetector( new THcShower("Cal", "Shower" )); HMS->AddDetector( new THcDriftChamber("dc", "Drift Chambers" )); + HMS->AddDetector( new THcAerogel("aero", "Aerogel Cerenkov" )); // Set up the analyzer - we use the standard one, // but this could be an experiment-specific one as well. diff --git a/examples/output.def b/examples/output.def index 4de4132..c351efd 100644 --- a/examples/output.def +++ b/examples/output.def @@ -3,6 +3,7 @@ block H.dc.* block H.hod.* block H.Cal.* +block H.aero.* block g.evtyp # TDC hits per paddle diff --git a/src/THcAerogel.cxx b/src/THcAerogel.cxx index 461c86f..70b876f 100644 --- a/src/THcAerogel.cxx +++ b/src/THcAerogel.cxx @@ -10,12 +10,15 @@ /////////////////////////////////////////////////////////////////////////////// #include "THcAerogel.h" +#include "TClonesArray.h" +#include "THcSignalHit.h" #include "THaEvData.h" #include "THaDetMap.h" #include "THcDetectorMap.h" #include "THcGlobals.h" #include "THaCutList.h" #include "THcParmList.h" +#include "THcHitList.h" #include "VarDef.h" #include "VarType.h" #include "THaTrack.h" @@ -36,7 +39,12 @@ THcAerogel::THcAerogel( const char* name, const char* description, THaApparatus* apparatus ) : THaNonTrackingDetector(name,description,apparatus) { - // Constructor + // 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); + // fTrackProj = new TClonesArray( "THaTrackProj", 5 ); } @@ -47,31 +55,12 @@ THcAerogel::THcAerogel( ) : // Constructor } -//_____________________________________________________________________________ -void THcAerogel::Setup(const char* name, const char* description) -{ - - - // Do we need this for the Aerogel? It is just one plane. - - // static const char* const here = "Setup()"; - // static const char* const message = - // "Must construct %s detector with valid name! Object construction failed."; - - cout << "In THcAerogel::Setup()" << endl; - // Base class constructor failed? - if( IsZombie()) return; - - fDebug = 1; // Keep this at one while we're working on the code -} - //_____________________________________________________________________________ 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 @@ -159,8 +148,11 @@ Int_t THcAerogel::DefineVariables( EMode mode ) inline void THcAerogel::Clear(Option_t* opt) { - // Reset per-event data. - // fTrackProj->Clear(); + // Clears the hit lists + fPosTDCHits->Clear(); + fNegTDCHits->Clear(); + fPosADCHits->Clear(); + fNegADCHits->Clear(); } //_____________________________________________________________________________ @@ -184,7 +176,47 @@ Int_t THcAerogel::Decode( const THaEvData& evdata ) fAnalyzePedestals = 0; // Don't analyze pedestals next event } - return nhits; + Int_t nPosTDCHits=0; + Int_t nNegTDCHits=0; + Int_t nPosADCHits=0; + Int_t nNegADCHits=0; + fPosTDCHits->Clear(); + fNegTDCHits->Clear(); + fPosADCHits->Clear(); + fNegADCHits->Clear(); + + + Int_t ihit = 0; + while(ihit < nhits) { + THcAerogelHit* hit = (THcAerogelHit *) fRawHitList->At(ihit); + + // TDC positive hit + if(hit->fTDC_pos > 0) { + THcSignalHit *sighit = (THcSignalHit*) fPosTDCHits->ConstructedAt(nPosTDCHits++); + sighit->Set(hit->fCounter, hit->fTDC_pos); + } + + // TDC negative hit + if(hit->fTDC_neg > 0) { + THcSignalHit *sighit = (THcSignalHit*) fNegTDCHits->ConstructedAt(nNegTDCHits++); + sighit->Set(hit->fCounter, hit->fTDC_neg); + } + + // ADC positive hit + if(hit->fADC_pos > 0) { + THcSignalHit *sighit = (THcSignalHit*) fPosADCHits->ConstructedAt(nPosADCHits++); + sighit->Set(hit->fCounter, hit->fADC_pos); + } + + // ADC negative hit + if(hit->fADC_neg > 0) { + THcSignalHit *sighit = (THcSignalHit*) fNegADCHits->ConstructedAt(nNegADCHits++); + sighit->Set(hit->fCounter, hit->fADC_neg); + } + + ihit++; + } + return ihit; } //_____________________________________________________________________________ diff --git a/src/THcAerogel.h b/src/THcAerogel.h index 83653c4..6a7aa6e 100644 --- a/src/THcAerogel.h +++ b/src/THcAerogel.h @@ -41,6 +41,13 @@ class THcAerogel : public THaNonTrackingDetector, public THcHitList { Double_t* fPosGain; Double_t* fNegGain; + // Hits + TClonesArray* fPosTDCHits; + TClonesArray* fNegTDCHits; + TClonesArray* fPosADCHits; + TClonesArray* fNegADCHits; + + // Pedestals Int_t fNPedestalEvents; Int_t fMinPeds; Int_t *fPosPedSum; /* Accumulators for pedestals */ -- GitLab