From 892e0811f000ccffaaf6e610f07c44be6ccf6eb4 Mon Sep 17 00:00:00 2001 From: "Stephen A. Wood" <saw@jlab.org> Date: Wed, 4 Nov 2015 11:39:59 -0500 Subject: [PATCH] Add FADC option for THcShowerPlane --- src/THcShowerPlane.cxx | 51 +++++++++++++++++++++++++++++++++--------- src/THcShowerPlane.h | 7 ++++++ 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/src/THcShowerPlane.cxx b/src/THcShowerPlane.cxx index 208834e..5bf1552 100644 --- a/src/THcShowerPlane.cxx +++ b/src/THcShowerPlane.cxx @@ -88,7 +88,29 @@ THaAnalysisObject::EStatus THcShowerPlane::Init( const TDatime& date ) //_____________________________________________________________________________ Int_t THcShowerPlane::ReadDatabase( const TDatime& date ) { - // Retrieve parameters we need from parent class + + // Retrieve FADC parameters. In principle may want different dynamic + // pedestal and integration range for preshower and shower, but for now + // use same parameters + char prefix[2]; + prefix[0]=tolower(GetParent()->GetPrefix()[0]); + prefix[1]='\0'; + fUsingFADC=0; + fPedSampLow=0; + fPedSampHigh=9; + fDataSampLow=23; + fDataSampHigh=49; + DBRequest list[]={ + {"cal_using_fadc", &fUsingFADC, kInt, 0, 1}, + {"cal_ped_sample_low", &fPedSampLow, kInt, 0, 1}, + {"cal_ped_sample_high", &fPedSampHigh, kInt, 0, 1}, + {"cal_data_sample_low", &fDataSampLow, kInt, 0, 1}, + {"cal_data_sample_high", &fDataSampHigh, kInt, 0, 1}, + {0} + }; + gHcParms->LoadParmValues((DBRequest*)&list, prefix); + + // Retrieve more parameters we need from parent class // THcShower* fParent; @@ -301,20 +323,27 @@ Int_t THcShowerPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) } // Should probably check that counter # is in range - fA_Pos[hit->fCounter-1] = hit->GetData(0); - fA_Neg[hit->fCounter-1] = hit->GetData(1); + if(fUsingFADC) { + fA_Pos[hit->fCounter-1] = hit->GetData(0,fPedSampLow,fPedSampHigh, + fDataSampLow,fDataSampHigh); + fA_Neg[hit->fCounter-1] = hit->GetData(1,fPedSampLow,fPedSampHigh, + fDataSampLow,fDataSampHigh); + } else { + fA_Pos[hit->fCounter-1] = hit->GetData(0); + fA_Neg[hit->fCounter-1] = hit->GetData(1); + } // Sparsify positive side hits, fill the hit list, compute the // energy depostion from positive side for the counter. Double_t thresh_pos = fPosThresh[hit->fCounter -1]; - if(hit->GetData(0) > thresh_pos) { + if(fA_Pos[hit->fCounter-1] > thresh_pos) { THcSignalHit *sighit = (THcSignalHit*) fPosADCHits->ConstructedAt(nPosADCHits++); - sighit->Set(hit->fCounter, hit->GetData(0)); + sighit->Set(hit->fCounter, fA_Pos[hit->fCounter-1]); - fA_Pos_p[hit->fCounter-1] = hit->GetData(0) - fPosPed[hit->fCounter -1]; + fA_Pos_p[hit->fCounter-1] = fA_Pos[hit->fCounter-1] - fPosPed[hit->fCounter -1]; fEpos[hit->fCounter-1] += fA_Pos_p[hit->fCounter-1]* fParent->GetGain(hit->fCounter-1,fLayerNum-1,0); @@ -324,13 +353,13 @@ Int_t THcShowerPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) // energy depostion from negative side for the counter. Double_t thresh_neg = fNegThresh[hit->fCounter -1]; - if(hit->GetData(1) > thresh_neg) { + if(fA_Neg[hit->fCounter-1] > thresh_neg) { THcSignalHit *sighit = (THcSignalHit*) fNegADCHits->ConstructedAt(nNegADCHits++); - sighit->Set(hit->fCounter, hit->GetData(1)); + sighit->Set(hit->fCounter, fA_Neg[hit->fCounter-1]); - fA_Neg_p[hit->fCounter-1] = hit->GetData(1) - fNegPed[hit->fCounter -1]; + fA_Neg_p[hit->fCounter-1] = fA_Neg[hit->fCounter-1] - fNegPed[hit->fCounter -1]; fEneg[hit->fCounter-1] += fA_Neg_p[hit->fCounter-1]* fParent->GetGain(hit->fCounter-1,fLayerNum-1,1); @@ -369,8 +398,8 @@ Int_t THcShowerPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) break; } - if(hit->GetData(0) > fPosThresh[hit->fCounter -1] || - hit->GetData(1) > fNegThresh[hit->fCounter -1]) { + if(fA_Pos[hit->fCounter-1] > fPosThresh[hit->fCounter -1] || + fA_Neg[hit->fCounter-1] > fNegThresh[hit->fCounter -1]) { cout << " plane = " << hit->fPlane << " counter = " << hit->fCounter << " Emean = " << fEmean[hit->fCounter-1] diff --git a/src/THcShowerPlane.h b/src/THcShowerPlane.h index 41fecdf..313c3cf 100644 --- a/src/THcShowerPlane.h +++ b/src/THcShowerPlane.h @@ -108,6 +108,13 @@ public: protected: + // Flash ADC parameters + Int_t fUsingFADC; // != 0 if using FADC in sample mode + Int_t fPedSampLow; // Sample range for + Int_t fPedSampHigh; // dynamic pedestal + Int_t fDataSampLow; // Sample range for + Int_t fDataSampHigh; // sample integration + Double_t* fA_Pos; // [fNelem] ADC amplitudes of blocks Double_t* fA_Neg; // [fNelem] ADC amplitudes of blocks Double_t* fA_Pos_p; // [fNelem] pedestal subtracted ADC amplitudes -- GitLab