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 2133 additions and 1402 deletions
......@@ -9,80 +9,171 @@
/////////////////////////////////////////////////////////////////////
#include "THaEvtTypeHandler.h"
#include "THcScalerEvtHandler.h"
#include "Decoder.h"
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include "TTree.h"
#include "THaRunBase.h"
#include "TString.h"
#include "TTree.h"
#include "hcana/Logger.h"
#include <algorithm>
#include <cstring>
#include <nlohmann/json.hpp>
#include <set>
#include <string>
#include <vector>
class THcHelicity;
class HCScalerLoc;
class THcHelicityScaler : public THaEvtTypeHandler {
class THcHelicityScaler : public hcana::ConfigLogging<THaEvtTypeHandler> {
public:
THcHelicityScaler(const char*, const char*);
virtual ~THcHelicityScaler();
Int_t Analyze(THaEvData *evdata);
Int_t AnalyzeBuffer(UInt_t *rdata, Bool_t onlysync);
Int_t AnalyzeHelicityScaler(UInt_t *p);
virtual EStatus Init( const TDatime& run_time);
virtual Int_t ReadDatabase(const TDatime& date );
virtual Int_t End( THaRunBase* r=0 );
virtual void SetUseFirstEvent(Bool_t b = kFALSE) {fUseFirstEvent = b;}
virtual void SetDelayedType(int evtype);
virtual void SetROC(Int_t roc) {fROC=roc;}
virtual void SetBankID(Int_t bankid) {fBankID=bankid;}
virtual void SetHelicityDetector(THcHelicity *f) {fglHelicityDetector = f;}
virtual Int_t GetNevents() { return fNevents;}
virtual Int_t GetNcycles() { return fNcycles;}
virtual Int_t GetEvNum() { return evNumber;}
virtual Int_t* GetHelicityHistoryP() {return fHelicityHistory;}
THcHelicityScaler(const char*, const char*);
virtual ~THcHelicityScaler();
Int_t Analyze(THaEvData* evdata);
Int_t AnalyzeBuffer(UInt_t* rdata);
Int_t AnalyzeHelicityScaler(UInt_t* p);
virtual EStatus Init(const TDatime& run_time);
virtual Int_t ReadDatabase(const TDatime& date);
virtual Int_t End(THaRunBase* r = 0);
virtual void SetUseFirstEvent(Bool_t b = kFALSE) { fUseFirstEvent = b; }
virtual void SetDelayedType(int evtype);
virtual void SetROC(Int_t roc) { fROC = roc; }
virtual void SetBankID(Int_t bankid) { fBankID = bankid; }
virtual void SetNScalerChannels(Int_t n) { fNScalerChannels = n; }
virtual Int_t GetNevents() { return fNTrigsInBuf; }
virtual Int_t GetNcycles() { return fNTriggers; }
virtual Int_t GetEvNum() { return evNumber; }
virtual Int_t* GetHelicityHistoryP() { return fHelicityHistory; }
virtual Int_t GetReportedSeed() { return fRingSeed_reported; }
virtual Int_t GetReportedActual() { return fRingSeed_actual; }
virtual Bool_t IsSeedGood() { return fNBits >= 30; }
Double_t GetPlusCharge(const std::string& name);
Double_t GetMinusCharge(const std::string& name);
// utility function to write out json helicity file
void WriteJson(const std::string& path) const;
private:
static size_t FindNoCase(const std::string& sdata, const std::string& skey);
Int_t fNumBCMs;
Double_t *fBCM_Gain;
Double_t *fBCM_Offset;
Double_t *fBCM_delta_charge;
Int_t fROC;
UInt_t fBankID;
// Helicity Scaler variables
Int_t fNevents; /* # of helicity scaler reads in last event */
Int_t fNcycles;
Int_t fHelicityHistory[200];
//
Bool_t fUseFirstEvent;
Bool_t fOnlySyncEvents;
Bool_t fOnlyBanks;
Int_t fDelayedType;
Int_t fClockChan;
UInt_t fLastClock;
Int_t fClockOverflows;
std::vector<UInt_t*> fDelayedEvents;
std::set<UInt_t> fRocSet;
THcHelicityScaler(const THcHelicityScaler& fh);
THcHelicityScaler& operator=(const THcHelicityScaler& fh);
UInt_t evcount;
Double_t evcountR;
UInt_t evNumber;
Int_t ifound;
THcHelicity *fglHelicityDetector;
ClassDef(THcHelicityScaler,0) // Scaler Event handler
//------------C.Y. Sep 20, 2020 :: Added Utility Function Prototypes----------------
void AddVars(TString name, TString desc, UInt_t iscal, UInt_t ichan, UInt_t ikind);
void DefVars();
static size_t FindNoCase(const std::string& sdata, const std::string& skey);
std::vector<Decoder::GenScaler*> scalers;
std::vector<HCScalerLoc*> scalerloc;
Int_t RanBit30(Int_t ranseed);
void MakeParms();
UInt_t fBankID;
// Helicity Scaler variables
Int_t fNTrigsInBuf; /* # of helicity scaler reads in last event */
Int_t fNTriggers;
Int_t fFirstCycle;
Int_t fHelicityHistory[200];
//
Bool_t fUseFirstEvent;
Int_t fDelayedType;
Int_t fRingSeed_reported;
Int_t fRingSeed_actual;
Int_t fNBits;
Int_t fNTriggersPlus;
Int_t fNTriggersMinus;
std::vector<Double_t> fHScalers[2];
Int_t fGateCount[2];
std::vector<Double_t> fScalerSums, fAsymmetry, fAsymmetryError;
std::vector<Double_t> fCharge;
Double_t fTime;
Double_t fTimePlus;
Double_t fTimeMinus;
Double_t fTriggerAsymmetry;
//---- C.Y.: 12/14/2020 Variables for quartet-by-quartet asymmetry/error calculations ----
Bool_t fHaveCycle[4];
Int_t fQuartetCount; // keep track of number of quartets
// quartet-by-quartet time asymmetry variables
Double_t fTimeCycle[4];
Double_t fTimeSum;
Double_t fTimeAsymmetry;
Double_t fTimeAsymmetryError;
Double_t fTimeAsymSum;
Double_t fTimeAsymSum2;
// quartet-by-quartet scaler counts asymmetry variables
std::vector<Double_t> fScalCycle[4];
std::vector<Double_t> fScalSum; // reminder: need to initialize
std::vector<Double_t> fScalAsymmetry;
std::vector<Double_t> fScalAsymmetryError;
std::vector<Double_t> fScalAsymSum;
std::vector<Double_t> fScalAsymSum2;
// quartet-by-quartet charge asymmetry variables
std::vector<Double_t> fChargeCycle[4];
std::vector<Double_t> fChargeSum;
std::vector<Double_t> fChargeAsymmetry;
std::vector<Double_t> fChargeAsymmetryError;
std::vector<Double_t> fChargeAsymSum;
std::vector<Double_t> fChargeAsymSum2;
//----------------------
//----C.Y. Nov 26, 2020----
std::vector<Double_t> fScalerChan;
std::vector<UInt_t*> fDelayedEvents;
Int_t fROC;
Int_t fNScalerChannels; // Number of scaler channels/event
Int_t fNumBCMs;
std::vector<Double_t> fBCM_Gain, fBCM_Offset;
std::vector<std::string> fBCM_Name;
//---C.Y. Sep 2020 : Added additional BCM-related variables--
std::vector<Double_t> fBCM_SatOffset;
std::vector<Double_t> fBCM_SatQuadratic;
std::vector<Double_t> fBCM_delta_charge;
Double_t fTotalTime;
Double_t fDeltaTime;
Double_t fPrevTotalTime;
Double_t fbcm_Current_Threshold;
Double_t fClockFreq;
Int_t fbcm_Current_Threshold_Index;
//----C.Y. Sep 20, 2020 : Added additional variables-----
// (required by utility functions and scaler tree output)
UInt_t evcount;
Double_t evcountR;
UInt_t evNumber;
Double_t evNumberR;
Double_t actualHelicityR;
Double_t quartetphaseR;
Int_t Nvars, ifound, fNormIdx, fNormSlot, nscalers;
std::vector<Double_t> dvars;
std::vector<Double_t> dvarsFirst;
TTree* fScalerTree;
Bool_t fOnlySyncEvents;
Bool_t fOnlyBanks;
Int_t fClockChan;
UInt_t fLastClock;
std::set<UInt_t> fRocSet;
std::set<UInt_t> fModuleSet;
//--------------------------------------------------------
// json file with helicity info
nlohmann::json j_helicity;
THcHelicityScaler(const THcHelicityScaler& fh);
THcHelicityScaler& operator=(const THcHelicityScaler& fh);
ClassDef(THcHelicityScaler, 0) // Scaler Event handler
};
#endif
......@@ -263,10 +263,14 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata, Bool_t suppresswarni
fRefIndexMaps[i].hashit = kFALSE;
Bool_t goodreftime=kFALSE;
Int_t reftime = 0;
Int_t prevtime = 0;
Int_t difftime = 0;
for(Int_t ihit=0; ihit<nrefhits; ihit++) {
reftime = evdata.GetData(Decoder::kPulseTime,fRefIndexMaps[i].crate,
fRefIndexMaps[i].slot, fRefIndexMaps[i].channel,ihit);
reftime += 64*timeshift;
if (ihit != 0) difftime=reftime-prevtime;
prevtime = reftime;
if(reftime >= fADC_RefTimeCut) {
goodreftime = kTRUE;
break;
......@@ -274,6 +278,7 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata, Bool_t suppresswarni
}
if(goodreftime || (nrefhits>0 && fADC_RefTimeBest)) {
fRefIndexMaps[i].reftime = reftime;
fRefIndexMaps[i].refdifftime = difftime;
fRefIndexMaps[i].hashit = kTRUE;
}
} else { // Assume this is a TDC
......@@ -285,9 +290,13 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata, Bool_t suppresswarni
// then fTDC_RefTimeCut
Bool_t goodreftime=kFALSE;
Int_t reftime = 0;
Int_t prevtime = 0;
Int_t difftime = 0;
for(Int_t ihit=0; ihit<nrefhits; ihit++) {
reftime = evdata.GetData(fRefIndexMaps[i].crate,fRefIndexMaps[i].slot,
fRefIndexMaps[i].channel,ihit);
if( ihit != 0) difftime=reftime-prevtime;
prevtime=reftime;
if(reftime >= fTDC_RefTimeCut) {
goodreftime = kTRUE;
break;
......@@ -295,6 +304,7 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata, Bool_t suppresswarni
}
if(goodreftime || (nrefhits>0 && fTDC_RefTimeBest)) {
fRefIndexMaps[i].reftime = reftime;
fRefIndexMaps[i].refdifftime = difftime;
fRefIndexMaps[i].hashit = kTRUE;
}
}
......@@ -360,8 +370,12 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata, Bool_t suppresswarni
Int_t nrefhits = evdata.GetNumHits(d->crate,d->slot,d->refchan);
Bool_t goodreftime=kFALSE;
Int_t reftime=0;
Int_t prevtime=0;
Int_t difftime=0;
for(Int_t ihit=0; ihit<nrefhits; ihit++) {
reftime = evdata.GetData(d->crate, d->slot, d->refchan, ihit);
if (ihit != 0 ) difftime=reftime-prevtime;
prevtime = reftime;
if(reftime >= fTDC_RefTimeCut) {
goodreftime = kTRUE;
break;
......@@ -371,6 +385,7 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata, Bool_t suppresswarni
// hits make the RefTimeCut
if(goodreftime || (nrefhits>0 && fTDC_RefTimeBest)) {
rawhit->SetReference(signal, reftime);
rawhit->SetReferenceDiff(signal, difftime);
} else if (!suppresswarnings) {
cout << "HitList(event=" << evdata.GetEvNum() << "): refchan " << d->refchan <<
" missing for (" << d->crate << ", " << d->slot <<
......@@ -381,6 +396,7 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata, Bool_t suppresswarni
if(d->refindex >=0 && d->refindex < fNRefIndex) {
if(fRefIndexMaps[d->refindex].hashit) {
rawhit->SetReference(signal, fRefIndexMaps[d->refindex].reftime);
rawhit->SetReferenceDiff(signal, fRefIndexMaps[d->refindex].refdifftime);
} else {
if(!suppresswarnings) {
cout << "HitList(event=" << evdata.GetEvNum() << "): refindex " << d->refindex <<
......@@ -399,12 +415,17 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata, Bool_t suppresswarni
if (fPSE125) {
if(!fHaveFADCInfo) {
fNSA = fPSE125->GetNSA(d->crate);
fNSB = fPSE125->GetNSB(d->crate);
fNPED = fPSE125->GetNPED(d->crate);
//fNSA = fPSE125->GetNSA(d->crate);
//fNSB = fPSE125->GetNSB(d->crate);
//fNPED = fPSE125->GetNPED(d->crate);
// Hard coding for now so we don't need event typ 125 at the start of run.
fNSA = 26;
fNSB = 3;
fNPED = 4;
fHaveFADCInfo = kTRUE;
}
// Set F250 parameters.
}
//std::cout << fNSA << ", " << fNSB << ", " << fNPED << "\n";
// Set F250 parameters.
rawhit->SetF250Params(fNSA, fNSB, fNPED);
}
......@@ -446,6 +467,8 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata, Bool_t suppresswarni
d->crate, d->slot, d->refchan);
Bool_t goodreftime=kFALSE;
Int_t reftime = 0;
Int_t prevtime = 0;
Int_t difftime = 0;
timeshift=0;
if(fTISlot>0) { // Get the trigger time for this module
if(fTrigTimeShiftMap.find(d->slot)
......@@ -460,6 +483,8 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata, Bool_t suppresswarni
for(Int_t ihit=0; ihit<nrefhits; ihit++) {
reftime = evdata.GetData(Decoder::kPulseTime, d->crate, d->slot, d->refchan, ihit);
reftime += 64*timeshift;
if (ihit != 0) difftime=reftime-prevtime;
prevtime=reftime;
if(reftime >= fADC_RefTimeCut) {
goodreftime=kTRUE;
break;
......@@ -469,6 +494,7 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata, Bool_t suppresswarni
// hits make the RefTimeCut
if(goodreftime || (nrefhits>0 && fADC_RefTimeBest)) {
rawhit->SetReference(signal, reftime);
rawhit->SetReferenceDiff(signal, difftime);
} else if (!suppresswarnings) {
#ifndef SUPPRESSMISSINGADCREFTIMEMESSAGES
cout << "HitList(event=" << evdata.GetEvNum() << "): refchan " << d->refchan <<
......@@ -481,6 +507,7 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata, Bool_t suppresswarni
if(d->refindex >=0 && d->refindex < fNRefIndex) {
if(fRefIndexMaps[d->refindex].hashit) {
rawhit->SetReference(signal, fRefIndexMaps[d->refindex].reftime);
rawhit->SetReferenceDiff(signal, fRefIndexMaps[d->refindex].refdifftime);
} else {
if(!suppresswarnings) {
#ifndef SUPPRESSMISSINGADCREFTIMEMESSAGES
......
......@@ -73,6 +73,7 @@ protected:
Int_t slot;
Int_t channel;
Int_t reftime;
Int_t refdifftime;
};
std::vector<RefIndexMap> fRefIndexMaps;
// Should this be a sparse list instead in case user
......
......@@ -34,6 +34,9 @@ public:
Double_t GetNegADCpeak() const { return fNegADC_Peak; }
Double_t GetPosADCtime() const { return fPosADC_Time; }
Double_t GetNegADCtime() const { return fNegADC_Time; }
Double_t GetPosADCCorrtime() const { return fPosADC_CorrTime; }
Double_t GetNegADCCorrtime() const { return fNegADC_CorrTime; }
Double_t GetCalcPosition() const { return fCalcPosition; }
Int_t GetPosTDC() const { return fPosTDC; }
Int_t GetNegTDC() const { return fNegTDC; }
Double_t GetPosCorrectedTime() const { return fPosCorrectedTime;}
......@@ -46,8 +49,9 @@ public:
Int_t GetPaddleNumber() const { return fPaddleNumber; }
Double_t GetPaddleCenter() const { return fPaddleCenter; }
void SetCorrectedTimes(Double_t pos, Double_t neg, Double_t) {
void SetCorrectedTimes(Double_t pos, Double_t neg) {
fPosCorrectedTime = pos; fNegCorrectedTime = neg;
fHasCorrectedTimes = kFALSE;
}
void SetCorrectedTimes(Double_t pos, Double_t neg,
Double_t postof, Double_t negtof,
......@@ -75,6 +79,15 @@ public:
void SetNegADCtime( Double_t ptime) {
fNegADC_Time =ptime;
}
void SetPosADCCorrtime( Double_t ptime) {
fPosADC_CorrTime =ptime;
}
void SetNegADCCorrtime( Double_t ptime) {
fNegADC_CorrTime =ptime;
}
void SetCalcPosition( Double_t calcpos) {
fCalcPosition =calcpos;
}
protected:
static const Double_t kBig; //!
......@@ -86,6 +99,9 @@ protected:
Double_t fNegADC_Peak; // ADC peak amplitude
Double_t fPosADC_Time; // ADC time
Double_t fNegADC_Time; // ADC time
Double_t fPosADC_CorrTime; // ADC time
Double_t fNegADC_CorrTime; // ADC time
Double_t fCalcPosition; // Position along paddle calculated by time diff
Int_t fPaddleNumber;
Double_t fPosCorrectedTime; // Pulse height corrected time
......
This diff is collapsed.
......@@ -76,11 +76,14 @@ public:
virtual Int_t FineProcess( TClonesArray& tracks );
virtual Int_t End(THaRunBase* run=0);
Double_t DetermineTimePeak(Int_t FillFlag);
void EstimateFocalPlaneTime(void);
void OriginalTrackEffTest(void);
void TrackEffTest(void);
void CalcCluster(void);
virtual Int_t ApplyCorrections( void );
Double_t GetStartTime() const { return fStartTime; }
Double_t GetOffsetTime() const { return fOffsetTime; }
Bool_t IsStartTimeGood() const {return fGoodStartTime;};
Int_t GetNfptimes() const {return fNfptimes;};
Int_t GetScinIndex(Int_t nPlane, Int_t nPaddle);
......@@ -192,12 +195,19 @@ protected:
Bool_t fSHMS;
Bool_t fGoodStartTime;
Double_t fStartTime;
Double_t fADCStartTime;
Double_t fOffsetTime;
Double_t fFPTimeAll;
Int_t fNfptimes;
Bool_t* fPresentP;
Double_t fTimeHist_Peak;
Double_t fTimeHist_Sigma;
Double_t fTimeHist_Hits;
Double_t fTimeHist_StartTime_NumPeaks;
Double_t fTimeHist_StartTime_Peak;
Double_t fTimeHist_StartTime_Sigma;
Double_t fTimeHist_StartTime_Hits;
Double_t fTimeHist_FpTime_NumPeaks;
Double_t fTimeHist_FpTime_Peak;
Double_t fTimeHist_FpTime_Sigma;
Double_t fTimeHist_FpTime_Hits;
Double_t fBeta;
......@@ -207,7 +217,7 @@ protected:
// Potential Hall C parameters. Mostly here for demonstration
Int_t fNPlanes; // Number of planes
UInt_t fMaxScinPerPlane,fMaxHodoScin; // max number of scin/plane; product of the first two
UInt_t fMaxScinPerPlane,fMaxHodoScin,fTotHodScin; // max number of scin/plane; product of the first two
Double_t fStartTimeCenter, fStartTimeSlop, fScinTdcToTime;
Double_t fTofTolerance;
Int_t fCosmicFlag; //
......@@ -216,6 +226,7 @@ protected:
Double_t fScinTdcMin, fScinTdcMax; // min and max TDC values
char** fPlaneNames;
UInt_t* fNPaddle; // Number of paddles per plane
Int_t fTrackBetaIncludeSinglePmtHits;
Double_t *fHodoNegAdcTimeWindowMin;
Double_t *fHodoNegAdcTimeWindowMax;
......@@ -265,6 +276,7 @@ protected:
Int_t fCheckEvent;
Int_t fEventType;
Int_t fEventNum;
Int_t fGoodTrack;
Double_t fScin2XZpos;
......@@ -407,6 +419,10 @@ protected:
std::vector<Int_t > fNClust; // # scins clusters for the plane
std::vector<std::vector<Int_t> > fClustSize; // # scin cluster size
std::vector<std::vector<Double_t> > fClustPos; // # scin cluster position
std::vector<Int_t > fNCluster; // # scins clusters for the plane
std::vector<std::vector<Int_t> > fClusterSize; // # scin cluster size
std::vector<std::vector<Double_t> > fClusterXPos; // # scin cluster position
std::vector<std::vector<Double_t> > fClusterYPos; // # scin cluster position
std::vector<Int_t > fThreeScin; // # scins three clusters for the plane
std::vector<Int_t > fGoodScinHitsX; // # hits in fid x range
// Could combine the above into a structure
......
This diff is collapsed.
......@@ -258,6 +258,10 @@ void THcRawAdcHit::SetRefTime(Int_t refTime) {
fHasRefTime = kTRUE;
}
void THcRawAdcHit::SetRefDiffTime(Int_t refDiffTime) {
fRefDiffTime = refDiffTime;
}
void THcRawAdcHit::SetSample(Int_t data) {
if (fNSamples >= fMaxNSamples) {
// throw std::out_of_range("`THcRawAdcHit::SetSample`: too many samples!");
......@@ -481,6 +485,22 @@ Int_t THcRawAdcHit::GetRefTime() const {
}
}
Bool_t THcRawAdcHit::HasRefTime() const { return fHasRefTime; }
Int_t THcRawAdcHit::GetRefDiffTime() const {
if (fHasRefTime) {
return fRefDiffTime;
}
else {
TString msg = TString::Format(
"`THcRawAdcHit::GetRefTime`: Reference time not available!"
);
throw std::runtime_error(msg.Data());
}
}
Bool_t THcRawAdcHit::HasRefTime() const {
return fHasRefTime;
}
ClassImp(THcRawAdcHit)
......@@ -16,12 +16,14 @@ class THcRawAdcHit : public podd2::HitLogging<TObject> {
void SetData(Int_t data);
void SetSample(Int_t data);
void SetRefTime(Int_t refTime);
void SetRefDiffTime(Int_t refDiffTime);
void SetDataTimePedestalPeak(
Int_t data, Int_t time, Int_t pedestal, Int_t peak
);
Int_t GetRawData(UInt_t iPulse=0) const;
Double_t GetF250_PeakPedestalRatio() {return fPeakPedestalRatio;};
Int_t GetF250_NPedestalSamples() {return fNPedestalSamples;};
Double_t GetAverage(UInt_t iSampleLow, UInt_t iSampleHigh) const;
Int_t GetIntegral(UInt_t iSampleLow, UInt_t iSampleHigh) const;
......@@ -41,6 +43,7 @@ class THcRawAdcHit : public podd2::HitLogging<TObject> {
Int_t GetPulseTimeRaw(UInt_t iPulse=0) const;
Int_t GetSampleRaw(UInt_t iSample=0) const;
Int_t GetRefTime() const;
Int_t GetRefDiffTime() const;
Double_t GetPed() const;
Double_t GetPulseInt(UInt_t iPulse=0) const;
......@@ -82,6 +85,7 @@ class THcRawAdcHit : public podd2::HitLogging<TObject> {
Int_t fPulseTime[fMaxNPulses];
Int_t fSample[fMaxNSamples]; // the big buffer
Int_t fRefTime;
Int_t fRefDiffTime;
Bool_t fHasMulti;
Bool_t fHasRefTime;
......
......@@ -59,6 +59,17 @@ void THcRawDCHit::SetReference(Int_t signal, Int_t reference) {
}
}
void THcRawDCHit::SetReferenceDiff(Int_t signal, Int_t reference) {
if (signal == 0) {
fTdcHit.SetRefDiffTime(reference);
}
else {
throw std::out_of_range(
"`THcRawDCHit::SetReference`: only signal `0` available!"
);
}
}
Int_t THcRawDCHit::GetData(Int_t signal) {
if (signal == 0) {
......@@ -95,6 +106,17 @@ Int_t THcRawDCHit::GetReference(Int_t signal) {
}
}
Int_t THcRawDCHit::GetReferenceDiff(Int_t signal) {
if (signal == 0) {
return fTdcHit.GetRefDiffTime();
}
else {
throw std::out_of_range(
"`THcRawDCHit::GetReference`: only signal `0` available!"
);
}
}
THcRawHit::ESignalType THcRawDCHit::GetSignalType(Int_t signal) {
if (signal == 0) {
......
......@@ -18,10 +18,12 @@ class THcRawDCHit : public THcRawHit {
virtual void SetData(Int_t signal, Int_t data);
virtual void SetReference(Int_t signal, Int_t reference);
virtual void SetReferenceDiff(Int_t signal, Int_t reference);
virtual Int_t GetData(Int_t signal);
virtual Int_t GetRawData(Int_t signal);
virtual Int_t GetReference(Int_t signal);
virtual Int_t GetReferenceDiff(Int_t signal);
virtual ESignalType GetSignalType(Int_t signal);
virtual Int_t GetNSignals();
......
......@@ -29,20 +29,21 @@ public:
// virtual Bool_t operator==( const THcRawHit& ) = 0;
// virtual Bool_t operator!=( const THcRawHit& ) = 0;
virtual void SetData(Int_t signal, Int_t data) {};
virtual void SetSample(Int_t signal, Int_t data) {};
virtual void SetDataTimePedestalPeak(Int_t signal, Int_t data,
Int_t time, Int_t pedestal, Int_t peak) {};
virtual Int_t GetData(Int_t signal) {return 0;}; /* Ref time subtracted */
virtual Int_t GetRawData(Int_t signal) {return 0;} /* Ref time not subtracted */
virtual ESignalType GetSignalType(Int_t signal) {return kUndefined;}
virtual void SetData(Int_t /* signal */, Int_t /* data */) {};
virtual void SetSample(Int_t /* signal */, Int_t /* data */) {};
virtual void SetDataTimePedestalPeak(Int_t /* signal */, Int_t /* data */,
Int_t /* time */, Int_t /* pedestal */, Int_t /* peak */) {};
virtual Int_t GetData(Int_t /* signal */) {return 0;}; /* Ref time subtracted */
virtual Int_t GetRawData(Int_t /* signal */) {return 0;} /* Ref time not subtracted */
virtual ESignalType GetSignalType(Int_t /* signal */) {return kUndefined;}
virtual Int_t GetNSignals() { return 1;}
virtual void SetReference(Int_t signal, Int_t reference) {};
virtual void SetReferenceDiff(Int_t signal, Int_t reference) {};
virtual Bool_t HasReference(Int_t signal) {return kFALSE;};
virtual Int_t GetReference(Int_t signal) {return 0;};
virtual void SetF250Params(Int_t NSA, Int_t NSB, Int_t NPED) {};
virtual void SetF250Params(Int_t /* NSA */, Int_t /* NSB */, Int_t /* NPED */) {};
// Derived objects must be sortable and supply Compare method
// virtual Bool_t IsSortable () const {return kFALSE; }
......
......@@ -105,6 +105,18 @@ void THcRawHodoHit::SetReference(Int_t signal, Int_t reference) {
}
}
void THcRawHodoHit::SetReferenceDiff(Int_t signal, Int_t referenceDiff) {
if (signal < fNAdcSignals) {
fAdcHits[signal].SetRefDiffTime(referenceDiff);
} else if (signal < fNAdcSignals+fNTdcSignals) {
fTdcHits[signal-fNAdcSignals].SetRefDiffTime(referenceDiff);
} else {
throw std::out_of_range(
"`THcRawHodoHit::SetReference`: only signals `2` and `3` available!"
);
}
}
Int_t THcRawHodoHit::GetData(Int_t signal) {
if (0 <= signal && signal < fNAdcSignals) {
......@@ -147,6 +159,17 @@ Int_t THcRawHodoHit::GetReference(Int_t signal) {
}
}
Int_t THcRawHodoHit::GetReferenceDiff(Int_t signal) {
if (fNAdcSignals <= signal && signal < fNAdcSignals+fNTdcSignals) {
return fTdcHits[signal-fNAdcSignals].GetRefDiffTime();
}
else {
throw std::out_of_range(
"`THcRawHodoHit::GetReference`: only signals `2` and `3` available!"
);
}
}
THcRawHit::ESignalType THcRawHodoHit::GetSignalType(Int_t signal) {
if (0 <= signal && signal < fNAdcSignals) {
......
......@@ -25,10 +25,12 @@ class THcRawHodoHit : public THcRawHit {
Int_t signal, Int_t data, Int_t time, Int_t pedestal, Int_t peak
);
virtual void SetReference(Int_t signal, Int_t reference);
virtual void SetReferenceDiff(Int_t signal, Int_t referenceDiff);
virtual Int_t GetData(Int_t signal);
virtual Int_t GetRawData(Int_t signal);
virtual Int_t GetReference(Int_t signal);
virtual Int_t GetReferenceDiff(Int_t signal);
virtual ESignalType GetSignalType(Int_t signal);
virtual Int_t GetNSignals();
......
......@@ -92,6 +92,16 @@ void THcRawShowerHit::SetReference(Int_t signal, Int_t reference) {
}
}
void THcRawShowerHit::SetReferenceDiff(Int_t signal, Int_t reference) {
if (signal < fNAdcSignals) {
fAdcHits[signal].SetRefDiffTime(reference);
} else {
throw std::out_of_range(
"`THcRawHodoHit::SetReference`: only signals `2` and `3` available!"
);
}
}
Int_t THcRawShowerHit::GetData(Int_t signal) {
if (0 <= signal && signal < fNAdcSignals) {
......
......@@ -22,6 +22,7 @@ class THcRawShowerHit : public THcRawHit {
Int_t signal, Int_t data, Int_t time, Int_t pedestal, Int_t peak
);
virtual void SetReference(Int_t signal, Int_t reference);
virtual void SetReferenceDiff(Int_t signal, Int_t reference);
virtual Int_t GetData(Int_t signal);
virtual Int_t GetRawData(Int_t signal);
......
......@@ -95,6 +95,7 @@ THcRawTdcHit& THcRawTdcHit::operator=(const THcRawTdcHit& right) {
fTime[iHit] = right.fTime[iHit];
}
fRefTime = right.fRefTime;
fRefDiffTime = right.fRefDiffTime;
fHasRefTime = right.fHasRefTime;
fNHits = right.fNHits;
}
......@@ -113,6 +114,7 @@ void THcRawTdcHit::Clear(Option_t* opt) {
fTime[iHit] = 0;
}
fRefTime = 0;
fRefDiffTime = 0;
fHasRefTime = kFALSE;
fNHits = 0;
}
......@@ -138,6 +140,10 @@ void THcRawTdcHit::SetRefTime(Int_t refTime) {
fHasRefTime = kTRUE;
}
void THcRawTdcHit::SetRefDiffTime(Int_t refDiffTime) {
fRefDiffTime = refDiffTime;
}
Int_t THcRawTdcHit::GetTimeRaw(UInt_t iHit) const {
if (iHit < fNHits) {
......@@ -177,6 +183,18 @@ Int_t THcRawTdcHit::GetRefTime() const {
}
}
Int_t THcRawTdcHit::GetRefDiffTime() const {
if (fHasRefTime) {
return fRefDiffTime;
}
else {
TString msg = TString::Format(
"`THcRawTdcHit::GetRefDiffTime`: Reference time not available!"
);
throw std::runtime_error(msg.Data());
}
}
Bool_t THcRawTdcHit::HasRefTime() const {
return fHasRefTime;
......
......@@ -14,10 +14,12 @@ class THcRawTdcHit : public TObject {
void SetTime(Int_t time);
void SetRefTime(Int_t refTime);
void SetRefDiffTime(Int_t refDiffTime);
Int_t GetTimeRaw(UInt_t iHit=0) const;
Int_t GetTime(UInt_t iHit=0) const;
Int_t GetRefTime() const;
Int_t GetRefDiffTime() const;
Bool_t HasRefTime() const;
......@@ -30,6 +32,7 @@ class THcRawTdcHit : public TObject {
Int_t fTime[fMaxNHits];
Int_t fRefTime;
Int_t fRefDiffTime;
Bool_t fHasRefTime;
UInt_t fNHits;
......
This diff is collapsed.
......@@ -59,6 +59,8 @@ public:
Int_t fNumBCMs;
Double_t *fBCM_Gain;
Double_t *fBCM_Offset;
Double_t *fBCM_SatOffset;
Double_t *fBCM_SatQuadratic;
Double_t *fBCM_delta_charge;
Double_t fTotalTime;
Double_t fDeltaTime;
......