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 2145 additions and 1377 deletions
......@@ -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; }
......
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.
This diff is collapsed.
This diff is collapsed.