diff --git a/examples/PARAM/general.param b/examples/PARAM/general.param index 4dae5e1eed515ac290c5986e2913317524714ab0..6cb073152d683f652ff507a85b5e20ea7eb4b45a 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 977b1e4b13880a83ded7f7946b4c546288b7c661..ea02785a080c25fa62b804eca09d9341e4b362fe 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 4de41329540a8ecd7b1912c6afcc882c3070c2a3..c351efdbae4a030b810af1cefd78cb3530ec0651 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 461c86f9fa272cc32cf370f4e39a21b3dbc6b811..70b876f14b0702e58786e78d86cc791c9816a89a 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 83653c4a2b64bd680d291580b06a89bf246656d8..6a7aa6e67b7a8dd8c0a2afbaf0ad9c87eb77c429 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 */