Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • jlab/hallc/analyzer_software/hcana
  • whit/hcana
2 results
Show changes
Showing with 116 additions and 908 deletions
...@@ -36,6 +36,7 @@ THcShower::THcShower( const char* name, const char* description, ...@@ -36,6 +36,7 @@ THcShower::THcShower( const char* name, const char* description,
hcana::ConfigLogging<THaNonTrackingDetector>(name,description,apparatus), hcana::ConfigLogging<THaNonTrackingDetector>(name,description,apparatus),
fPosAdcTimeWindowMin(0), fNegAdcTimeWindowMin(0), fPosAdcTimeWindowMin(0), fNegAdcTimeWindowMin(0),
fPosAdcTimeWindowMax(0), fNegAdcTimeWindowMax(0), fPosAdcTimeWindowMax(0), fNegAdcTimeWindowMax(0),
fPedPosDefault(0),fPedNegDefault(0),
fShPosPedLimit(0), fShNegPedLimit(0), fPosGain(0), fNegGain(0), fShPosPedLimit(0), fShNegPedLimit(0), fPosGain(0), fNegGain(0),
fClusterList(0), fLayerNames(0), fLayerZPos(0), BlockThick(0), fClusterList(0), fLayerNames(0), fLayerZPos(0), BlockThick(0),
fNBlocks(0), fXPos(0), fYPos(0), fZPos(0), fPlanes(0), fArray(0) fNBlocks(0), fXPos(0), fYPos(0), fZPos(0), fPlanes(0), fArray(0)
...@@ -53,6 +54,7 @@ THcShower::THcShower( ) : ...@@ -53,6 +54,7 @@ THcShower::THcShower( ) :
hcana::ConfigLogging<THaNonTrackingDetector>(), hcana::ConfigLogging<THaNonTrackingDetector>(),
fPosAdcTimeWindowMin(0), fNegAdcTimeWindowMin(0), fPosAdcTimeWindowMin(0), fNegAdcTimeWindowMin(0),
fPosAdcTimeWindowMax(0), fNegAdcTimeWindowMax(0), fPosAdcTimeWindowMax(0), fNegAdcTimeWindowMax(0),
fPedPosDefault(0),fPedNegDefault(0),
fShPosPedLimit(0), fShNegPedLimit(0), fPosGain(0), fNegGain(0), fShPosPedLimit(0), fShNegPedLimit(0), fPosGain(0), fNegGain(0),
fClusterList(0), fLayerNames(0), fLayerZPos(0), BlockThick(0), fClusterList(0), fLayerNames(0), fLayerZPos(0), BlockThick(0),
fNBlocks(0), fXPos(0), fYPos(0), fZPos(0), fPlanes(0), fArray(0) fNBlocks(0), fXPos(0), fYPos(0), fZPos(0), fPlanes(0), fArray(0)
...@@ -388,6 +390,8 @@ Int_t THcShower::ReadDatabase( const TDatime& date ) ...@@ -388,6 +390,8 @@ Int_t THcShower::ReadDatabase( const TDatime& date )
fNegAdcTimeWindowMin = new Double_t [fNTotBlocks]; fNegAdcTimeWindowMin = new Double_t [fNTotBlocks];
fPosAdcTimeWindowMax = new Double_t [fNTotBlocks]; fPosAdcTimeWindowMax = new Double_t [fNTotBlocks];
fNegAdcTimeWindowMax = new Double_t [fNTotBlocks]; fNegAdcTimeWindowMax = new Double_t [fNTotBlocks];
fPedPosDefault = new Int_t [fNTotBlocks];
fPedNegDefault = new Int_t [fNTotBlocks];
DBRequest list[]={ DBRequest list[]={
{"cal_pos_cal_const", hcal_pos_cal_const, kDouble, fNTotBlocks}, {"cal_pos_cal_const", hcal_pos_cal_const, kDouble, fNTotBlocks},
...@@ -400,6 +404,8 @@ Int_t THcShower::ReadDatabase( const TDatime& date ) ...@@ -400,6 +404,8 @@ Int_t THcShower::ReadDatabase( const TDatime& date )
{"cal_neg_AdcTimeWindowMin", fNegAdcTimeWindowMin, kDouble, static_cast<UInt_t>(fNTotBlocks),1}, {"cal_neg_AdcTimeWindowMin", fNegAdcTimeWindowMin, kDouble, static_cast<UInt_t>(fNTotBlocks),1},
{"cal_pos_AdcTimeWindowMax", fPosAdcTimeWindowMax, kDouble, static_cast<UInt_t>(fNTotBlocks),1}, {"cal_pos_AdcTimeWindowMax", fPosAdcTimeWindowMax, kDouble, static_cast<UInt_t>(fNTotBlocks),1},
{"cal_neg_AdcTimeWindowMax", fNegAdcTimeWindowMax, kDouble, static_cast<UInt_t>(fNTotBlocks),1}, {"cal_neg_AdcTimeWindowMax", fNegAdcTimeWindowMax, kDouble, static_cast<UInt_t>(fNTotBlocks),1},
{"cal_PedNegDefault", fPedNegDefault, kInt, static_cast<UInt_t>(fNTotBlocks),1},
{"cal_PedPosDefault", fPedNegDefault, kInt, static_cast<UInt_t>(fNTotBlocks),1},
{"cal_min_peds", &fShMinPeds, kInt,0,1}, {"cal_min_peds", &fShMinPeds, kInt,0,1},
{0} {0}
}; };
...@@ -410,6 +416,8 @@ Int_t THcShower::ReadDatabase( const TDatime& date ) ...@@ -410,6 +416,8 @@ Int_t THcShower::ReadDatabase( const TDatime& date )
fNegAdcTimeWindowMin[ip] = -1000.; fNegAdcTimeWindowMin[ip] = -1000.;
fPosAdcTimeWindowMax[ip] = 1000.; fPosAdcTimeWindowMax[ip] = 1000.;
fNegAdcTimeWindowMax[ip] = 1000.; fNegAdcTimeWindowMax[ip] = 1000.;
fPedNegDefault[ip] = 0;
fPedPosDefault[ip] = 0;
} }
gHcParms->LoadParmValues((DBRequest*)&list, prefix); gHcParms->LoadParmValues((DBRequest*)&list, prefix);
...@@ -617,6 +625,8 @@ void THcShower::DeleteArrays() ...@@ -617,6 +625,8 @@ void THcShower::DeleteArrays()
delete [] fNegAdcTimeWindowMin; fNegAdcTimeWindowMin = 0; delete [] fNegAdcTimeWindowMin; fNegAdcTimeWindowMin = 0;
delete [] fPosAdcTimeWindowMax; fPosAdcTimeWindowMax = 0; delete [] fPosAdcTimeWindowMax; fPosAdcTimeWindowMax = 0;
delete [] fNegAdcTimeWindowMax; fNegAdcTimeWindowMax = 0; delete [] fNegAdcTimeWindowMax; fNegAdcTimeWindowMax = 0;
delete [] fPedNegDefault; fPedNegDefault = 0;
delete [] fPedPosDefault; fPedPosDefault = 0;
delete [] fShPosPedLimit; fShPosPedLimit = 0; delete [] fShPosPedLimit; fShPosPedLimit = 0;
delete [] fShNegPedLimit; fShNegPedLimit = 0; delete [] fShNegPedLimit; fShNegPedLimit = 0;
delete [] fPosGain; fPosGain = 0; delete [] fPosGain; fPosGain = 0;
......
...@@ -73,6 +73,17 @@ public: ...@@ -73,6 +73,17 @@ public:
return ( Side == 0 ? fPosGain[nelem] : fNegGain[nelem]); return ( Side == 0 ? fPosGain[nelem] : fNegGain[nelem]);
} }
Double_t GetPedDefault(Int_t NBlock, Int_t NLayer, Int_t Side) {
if (Side!=0&&Side!=1) {
cout << "*** Wrong Side in GetPedDefault:" << Side << " ***" << endl;
return -1;
}
Int_t nelem = 0;
for (Int_t i=0; i<NLayer; i++) nelem += fNBlocks[i];
nelem += NBlock;
return ( Side == 0 ? fPedPosDefault[nelem] : fPedNegDefault[nelem] );
}
Double_t GetWindowMin(Int_t NBlock, Int_t NLayer, Int_t Side) { Double_t GetWindowMin(Int_t NBlock, Int_t NLayer, Int_t Side) {
if (Side!=0&&Side!=1) { if (Side!=0&&Side!=1) {
cout << "*** Wrong Side in GetWindowMin:" << Side << " ***" << endl; cout << "*** Wrong Side in GetWindowMin:" << Side << " ***" << endl;
...@@ -189,7 +200,9 @@ protected: ...@@ -189,7 +200,9 @@ protected:
Double_t* fNegAdcTimeWindowMin; Double_t* fNegAdcTimeWindowMin;
Double_t* fPosAdcTimeWindowMax; Double_t* fPosAdcTimeWindowMax;
Double_t* fNegAdcTimeWindowMax; Double_t* fNegAdcTimeWindowMax;
Double_t fAdcTdcOffset; Int_t* fPedPosDefault;
Int_t* fPedNegDefault;
Double_t fAdcTdcOffset;
Int_t fAnalyzePedestals; // Flag for pedestal analysis. Int_t fAnalyzePedestals; // Flag for pedestal analysis.
......
...@@ -105,6 +105,7 @@ THcShowerArray::~THcShowerArray() ...@@ -105,6 +105,7 @@ THcShowerArray::~THcShowerArray()
delete [] fAdcTimeWindowMin; fAdcTimeWindowMin = 0; delete [] fAdcTimeWindowMin; fAdcTimeWindowMin = 0;
delete [] fAdcTimeWindowMax; fAdcTimeWindowMax = 0; delete [] fAdcTimeWindowMax; fAdcTimeWindowMax = 0;
delete [] fPedDefault; fPedDefault = 0;
} }
//_____________________________________________________________________________ //_____________________________________________________________________________
...@@ -280,6 +281,7 @@ Int_t THcShowerArray::ReadDatabase( const TDatime& date ) ...@@ -280,6 +281,7 @@ Int_t THcShowerArray::ReadDatabase( const TDatime& date )
fAdcTimeWindowMin = new Double_t [fNelem]; fAdcTimeWindowMin = new Double_t [fNelem];
fAdcTimeWindowMax = new Double_t [fNelem]; fAdcTimeWindowMax = new Double_t [fNelem];
fPedDefault = new Int_t [fNelem];
DBRequest list1[]={ DBRequest list1[]={
{"cal_arr_ped_limit", fPedLimit, kInt, static_cast<UInt_t>(fNelem),1}, {"cal_arr_ped_limit", fPedLimit, kInt, static_cast<UInt_t>(fNelem),1},
...@@ -287,12 +289,14 @@ Int_t THcShowerArray::ReadDatabase( const TDatime& date ) ...@@ -287,12 +289,14 @@ Int_t THcShowerArray::ReadDatabase( const TDatime& date )
{"cal_arr_gain_cor", cal_arr_gain_cor, kDouble, static_cast<UInt_t>(fNelem)}, {"cal_arr_gain_cor", cal_arr_gain_cor, kDouble, static_cast<UInt_t>(fNelem)},
{"cal_arr_AdcTimeWindowMin", fAdcTimeWindowMin, kDouble, static_cast<UInt_t>(fNelem),1}, {"cal_arr_AdcTimeWindowMin", fAdcTimeWindowMin, kDouble, static_cast<UInt_t>(fNelem),1},
{"cal_arr_AdcTimeWindowMax", fAdcTimeWindowMax, kDouble, static_cast<UInt_t>(fNelem),1}, {"cal_arr_AdcTimeWindowMax", fAdcTimeWindowMax, kDouble, static_cast<UInt_t>(fNelem),1},
{"cal_arr_PedDefault", fPedDefault, kInt, static_cast<UInt_t>(fNelem),1},
{0} {0}
}; };
for(Int_t ip=0;ip<fNelem;ip++) { for(Int_t ip=0;ip<fNelem;ip++) {
fAdcTimeWindowMin[ip] = -1000.; fAdcTimeWindowMin[ip] = -1000.;
fAdcTimeWindowMax[ip] = 1000.; fAdcTimeWindowMax[ip] = 1000.;
fPedDefault[ip] = 0;
} }
gHcParms->LoadParmValues((DBRequest*)&list1, prefix); gHcParms->LoadParmValues((DBRequest*)&list1, prefix);
...@@ -873,6 +877,8 @@ void THcShowerArray::FillADC_DynamicPedestal() ...@@ -873,6 +877,8 @@ void THcShowerArray::FillADC_DynamicPedestal()
{ {
Double_t StartTime = 0.0; Double_t StartTime = 0.0;
if( fglHod ) StartTime = fglHod->GetStartTime(); if( fglHod ) StartTime = fglHod->GetStartTime();
Double_t OffsetTime = 0.0;
if( fglHod ) OffsetTime = fglHod->GetOffsetTime();
for (Int_t ielem=0;ielem<frAdcPulseInt->GetEntries();ielem++) { for (Int_t ielem=0;ielem<frAdcPulseInt->GetEntries();ielem++) {
Int_t npad = ((THcSignalHit*) frAdcPulseInt->ConstructedAt(ielem))->GetPaddleNumber() - 1; Int_t npad = ((THcSignalHit*) frAdcPulseInt->ConstructedAt(ielem))->GetPaddleNumber() - 1;
...@@ -881,15 +887,10 @@ void THcShowerArray::FillADC_DynamicPedestal() ...@@ -881,15 +887,10 @@ void THcShowerArray::FillADC_DynamicPedestal()
Double_t pulseInt = ((THcSignalHit*) frAdcPulseInt->ConstructedAt(ielem))->GetData(); Double_t pulseInt = ((THcSignalHit*) frAdcPulseInt->ConstructedAt(ielem))->GetData();
Double_t pulseAmp = ((THcSignalHit*) frAdcPulseAmp->ConstructedAt(ielem))->GetData(); Double_t pulseAmp = ((THcSignalHit*) frAdcPulseAmp->ConstructedAt(ielem))->GetData();
Double_t pulseTime = ((THcSignalHit*) frAdcPulseTime->ConstructedAt(ielem))->GetData(); Double_t pulseTime = ((THcSignalHit*) frAdcPulseTime->ConstructedAt(ielem))->GetData();
Double_t adctdcdiffTime = StartTime-pulseTime; Double_t adctdcdiffTime = StartTime-pulseTime+OffsetTime;
Bool_t errorflag = ((THcSignalHit*) frAdcErrorFlag->ConstructedAt(ielem))->GetData();
Bool_t pulseTimeCut = (adctdcdiffTime > fAdcTimeWindowMin[npad]) && (adctdcdiffTime < fAdcTimeWindowMax[npad]); Bool_t pulseTimeCut = (adctdcdiffTime > fAdcTimeWindowMin[npad]) && (adctdcdiffTime < fAdcTimeWindowMax[npad]);
if (!errorflag)
{
fGoodAdcMult.at(npad) += 1; fGoodAdcMult.at(npad) += 1;
} if (pulseTimeCut) {
if (!errorflag && pulseTimeCut) {
fTotNumAdcHits++; fTotNumAdcHits++;
fGoodAdcPulseIntRaw.at(npad) = pulseIntRaw; fGoodAdcPulseIntRaw.at(npad) = pulseIntRaw;
...@@ -982,6 +983,24 @@ Int_t THcShowerArray::ProcessHits(TClonesArray* rawhits, Int_t nexthit) ...@@ -982,6 +983,24 @@ Int_t THcShowerArray::ProcessHits(TClonesArray* rawhits, Int_t nexthit)
} else { } else {
((THcSignalHit*) frAdcErrorFlag->ConstructedAt(nrAdcHits))->Set(padnum,1); ((THcSignalHit*) frAdcErrorFlag->ConstructedAt(nrAdcHits))->Set(padnum,1);
} }
if (rawAdcHit.GetPulseAmpRaw(thit) <= 0) {
Double_t PeakPedRatio= rawAdcHit.GetF250_PeakPedestalRatio();
Int_t NPedSamples= rawAdcHit.GetF250_NPedestalSamples();
Double_t AdcToC = rawAdcHit.GetAdcTopC();
Double_t AdcToV = rawAdcHit.GetAdcTomV();
if (fPedDefault[padnum-1] !=0) {
Double_t tPulseInt = AdcToC*(rawAdcHit.GetPulseIntRaw(thit) - fPedDefault[padnum-1]*PeakPedRatio);
((THcSignalHit*) frAdcPulseInt->ConstructedAt(nrAdcHits))->Set(padnum, tPulseInt);
((THcSignalHit*) frAdcPedRaw->ConstructedAt(nrAdcHits))->Set(padnum, fPedDefault[padnum-1]);
((THcSignalHit*) frAdcPed->ConstructedAt(nrAdcHits))->Set(padnum, float(fPedDefault[padnum-1])/float(NPedSamples)*AdcToV);
}
((THcSignalHit*) frAdcPulseAmp->ConstructedAt(nrAdcHits))->Set(padnum, 0.);
}
++nrAdcHits; ++nrAdcHits;
} }
ihit++; ihit++;
......
...@@ -150,6 +150,7 @@ protected: ...@@ -150,6 +150,7 @@ protected:
static const Int_t kADCSampIntDynPed=3; static const Int_t kADCSampIntDynPed=3;
Double_t *fAdcTimeWindowMin ; Double_t *fAdcTimeWindowMin ;
Double_t *fAdcTimeWindowMax ; Double_t *fAdcTimeWindowMax ;
Int_t *fPedDefault ;
Double_t fAdcThreshold ; Double_t fAdcThreshold ;
Double_t fAdcTdcOffset; Double_t fAdcTdcOffset;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <iterator> #include <iterator>
#include <iostream> #include <iostream>
#include <memory> #include <memory>
#include <vector>
#include "TMath.h" #include "TMath.h"
using namespace std; using namespace std;
......
This diff is collapsed.
...@@ -29,7 +29,7 @@ public: ...@@ -29,7 +29,7 @@ public:
}; };
void SetXY(Double_t x, Double_t y) {fX = x; fY = y;}; void SetXY(Double_t x, Double_t y) {fX = x; fY = y;};
void Clear(Option_t* opt="") {fNHits=0; fNCombos=0; fHits.clear();}; void Clear(Option_t* /* opt */ ="") {fNHits=0; fNCombos=0; fHits.clear();};
void AddHit(THcDCHit* hit) { void AddHit(THcDCHit* hit) {
Hit newhit; Hit newhit;
newhit.dchit = hit; newhit.dchit = hit;
......
This diff is collapsed.
...@@ -82,6 +82,7 @@ class THcTrigDet : public THaDetector, public THcHitList { ...@@ -82,6 +82,7 @@ class THcTrigDet : public THaDetector, public THcHitList {
Int_t fTdcMultiplicity[fMaxTdcChannels]; Int_t fTdcMultiplicity[fMaxTdcChannels];
Int_t fAdcMultiplicity[fMaxAdcChannels]; Int_t fAdcMultiplicity[fMaxAdcChannels];
Double_t fTdcRefTime;
TString fSpectName; TString fSpectName;
std::vector<Int_t> eventtypes; std::vector<Int_t> eventtypes;
......
This diff is collapsed.
...@@ -15,7 +15,7 @@ namespace hallc { ...@@ -15,7 +15,7 @@ namespace hallc {
static const UInt_t MaxNSamples = 511; static const UInt_t MaxNSamples = 511;
// From THcRawAdcHit.h // From THcRawAdcHit.h
PulseWaveForm() {} PulseWaveForm() {}
PulseWaveForm(Int_t* buf, Int_t size = MaxNSamples) { std::copy_n(buf, MaxNSamples, std::begin(_buffer)); } PulseWaveForm(Int_t* buf, Int_t size = MaxNSamples) { std::copy_n(buf, size, std::begin(_buffer)); }
virtual ~PulseWaveForm() {} virtual ~PulseWaveForm() {}
void ZeroBuffer() { std::fill(std::begin(_buffer), std::end(_buffer), 0); } void ZeroBuffer() { std::fill(std::begin(_buffer), std::end(_buffer), 0); }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.