From 12a6cef39423ccb109c49a24645116609d5ff45c Mon Sep 17 00:00:00 2001 From: Whitney Armstrong <warmstrong@anl.gov> Date: Sat, 9 Feb 2019 18:32:16 -0600 Subject: [PATCH] modified: ../src/THcCherenkov.cxx modified: ../src/THcCherenkov.h modified: ../src/THcCherenkovHit.h modified: ../src/THcHitList.cxx modified: ../src/THcHitList.h modified: ../src/THcRawAdcHit.h modified: ../src/include/hcana/HallC_Data.h --- src/THcCherenkov.cxx | 4 ++++ src/THcCherenkov.h | 1 + src/THcCherenkovHit.h | 4 ---- src/THcHitList.cxx | 13 +++++++---- src/THcHitList.h | 41 +++++++++++++++++++--------------- src/THcRawAdcHit.h | 16 ++++++++----- src/include/hcana/HallC_Data.h | 17 +++++++++++--- 7 files changed, 61 insertions(+), 35 deletions(-) diff --git a/src/THcCherenkov.cxx b/src/THcCherenkov.cxx index 87d9423..b282e5a 100644 --- a/src/THcCherenkov.cxx +++ b/src/THcCherenkov.cxx @@ -414,12 +414,16 @@ Int_t THcCherenkov::Decode(const THaEvData& evdata) { Int_t ihit = 0; UInt_t nrAdcHits = 0; + _waveforms.clear(); while (ihit < fNhits) { THcCherenkovHit* hit = (THcCherenkovHit*)fRawHitList->At(ihit); Int_t npmt = hit->fCounter; THcRawAdcHit& rawAdcHit = hit->GetRawAdcHitPos(); + + _waveforms.push_back({rawAdcHit.GetSampleBuffer()}); + for (UInt_t thit = 0; thit < rawAdcHit.GetNPulses(); thit++) { diff --git a/src/THcCherenkov.h b/src/THcCherenkov.h index 1260607..db17ef4 100644 --- a/src/THcCherenkov.h +++ b/src/THcCherenkov.h @@ -55,6 +55,7 @@ public: static const Int_t MaxNumAdcPulse = 4; THcCherenkov(); // for ROOT I/O + protected: Bool_t* fPresentP; Int_t fAnalyzePedestals; diff --git a/src/THcCherenkovHit.h b/src/THcCherenkovHit.h index bf96962..c586bc4 100644 --- a/src/THcCherenkovHit.h +++ b/src/THcCherenkovHit.h @@ -8,10 +8,6 @@ class THcCherenkovHit : public THcRawHodoHit { public: friend class THcCherenkov; - protected: - - private: - ClassDef(THcCherenkovHit,0); // Raw Cherenkov hit }; diff --git a/src/THcHitList.cxx b/src/THcHitList.cxx index 368d9ce..a972b0b 100644 --- a/src/THcHitList.cxx +++ b/src/THcHitList.cxx @@ -237,7 +237,8 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata, Bool_t suppresswarni Bool_t tdcref_miss = kFALSE; Bool_t adcref_miss = kFALSE; - // Get the indexed reference times for this event + // + /// Get the indexed reference times for this event for(Int_t i=0;i<fNRefIndex;i++) { if(fRefIndexMaps[i].defined) { @@ -299,6 +300,8 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata, Bool_t suppresswarni } } } + + // for ( Int_t i=0; i < fdMap->GetSize(); i++ ) { THaDetMap::Module* d = fdMap->GetModule(i); @@ -391,7 +394,8 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata, Bool_t suppresswarni } } } - } else { // This is a Flash ADC + } else { + // This is a Flash ADC if (fPSE125) { if(!fHaveFADCInfo) { @@ -414,8 +418,9 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata, Bool_t suppresswarni } // Now get the pulse mode data // Pulse area will go into regular SetData, others will use special hit methods - Int_t npulses=evdata.GetNumEvents(Decoder::kPulseIntegral, d->crate, d->slot, chan); - // Assume that the # of pulses for kPulseTime, kPulsePeak and kPulsePedestal are same; + Int_t npulses = evdata.GetNumEvents(Decoder::kPulseIntegral, d->crate, d->slot, chan); + + // Assume that the # of pulses for kPulseTime, kPulsePeak and kPulsePedestal are same; Int_t timeshift=0; if(fTISlot>0) { // Get the trigger time for this module if(fTrigTimeShiftMap.find(d->slot) diff --git a/src/THcHitList.h b/src/THcHitList.h index 6e1855b..3315722 100644 --- a/src/THcHitList.h +++ b/src/THcHitList.h @@ -34,6 +34,13 @@ public: THcHitList(); + /** Populate the hitlist from the raw event data. + * Clears the hit list then, finds all populated channels belonging to the detector and add + * sort it into the hitlist. A given counter in the detector can have + * at most one entry in the hit list. However, the raw "hit" can contain + * multiple signal types (e.g. ADC+, ADC-, TDC+, TDC-), or multiplehits for multihit tdcs. + * The hit list is sorted (by plane, counter) after filling. + */ virtual Int_t DecodeToHitList( const THaEvData& evdata, Bool_t suppress=kFALSE ); void InitHitList(THaDetMap* detmap, const char *hitclass, Int_t maxhits, @@ -44,15 +51,14 @@ public: void MissReport(const char *name); void DisableSlipCorrection() {fDisableSlipCorrection = kTRUE;} - UInt_t fNRawHits; + UInt_t fNRawHits; Int_t fNMaxRawHits; Int_t fTDC_RefTimeCut; Int_t fADC_RefTimeCut; Bool_t fTDC_RefTimeBest; Bool_t fADC_RefTimeBest; - TClonesArray* fRawHitList; // List of raw hits - TClass* fRawHitClass; // Class of raw hit object to use - + TClonesArray* fRawHitList; // List of raw hits + TClass* fRawHitClass; // Class of raw hit object to use THaDetMap* fdMap; protected: @@ -69,24 +75,23 @@ protected: // Should this be a sparse list instead in case user // picks ridiculously large refindexes? - Int_t fNRefIndex; - UInt_t fNSignals; - THcRawHit::ESignalType *fSignalTypes; - - THcConfigEvtHandler* fPSE125; - Bool_t fHaveFADCInfo; - Int_t fNSA; - Int_t fNSB; - Int_t fNPED; + Int_t fNRefIndex; + UInt_t fNSignals; + THcRawHit::ESignalType* fSignalTypes; + THcConfigEvtHandler* fPSE125; + Bool_t fHaveFADCInfo; + Int_t fNSA; + Int_t fNSB; + Int_t fNPED; Int_t fNTDCRef_miss; Int_t fNADCRef_miss; - Decoder::THaCrateMap* fMap; /* The Crate map */ - Int_t fTISlot; - Int_t fTICrate; - Double_t fDisableSlipCorrection; - std::map<Int_t, Int_t> fTrigTimeShiftMap; + Decoder::THaCrateMap* fMap; /* The Crate map */ + Int_t fTISlot; + Int_t fTICrate; + Double_t fDisableSlipCorrection; + std::map<Int_t, Int_t> fTrigTimeShiftMap; std::map<Int_t, Decoder::Fadc250Module*> fFADCSlotMap; ClassDef(THcHitList,0); // List of raw hits sorted by plane, counter diff --git a/src/THcRawAdcHit.h b/src/THcRawAdcHit.h index 4663e12..8d474e7 100644 --- a/src/THcRawAdcHit.h +++ b/src/THcRawAdcHit.h @@ -46,6 +46,9 @@ class THcRawAdcHit : public TObject { Double_t GetPulseAmp(UInt_t iPulse=0) const; Double_t GetPulseTime(UInt_t iPulse=0) const; //Int_t GetSample(UInt_t iSample=0) const; + + Int_t* GetSampleBuffer() { return fSample;} + Int_t GetSampleIntRaw() const; Double_t GetSampleInt() const; @@ -60,11 +63,12 @@ class THcRawAdcHit : public TObject { static const UInt_t fMaxNSamples = 511; // FADC conversion factors - static const Double_t fNAdcChan; // Number of FADC channels in units of ADC channels - static const Double_t fAdcRange; // Dynamic range of FADCs in units of V, // TO-DO: Get fAdcRange from pre-start event - static const Double_t fAdcImpedence; // FADC input impedence in units of Ohms - static const Double_t fAdcTimeSample; // Length of FADC time sample in units of ps - static const Double_t fAdcTimeRes; // FADC time resolution in units of ns + static const Double_t fNAdcChan; // Number of FADC channels in units of ADC channels + static const Double_t fAdcRange; // Dynamic range of FADCs in units of V, // TO-DO: Get + // fAdcRange from pre-start event + static const Double_t fAdcImpedence; // FADC input impedence in units of Ohms + static const Double_t fAdcTimeSample; // Length of FADC time sample in units of ps + static const Double_t fAdcTimeRes; // FADC time resolution in units of ns Int_t fNPedestalSamples; // TODO: Get this from prestart event... Int_t fNPeakSamples; @@ -75,7 +79,7 @@ class THcRawAdcHit : public TObject { Int_t fPulseInt[fMaxNPulses]; Int_t fPulseAmp[fMaxNPulses]; Int_t fPulseTime[fMaxNPulses]; - Int_t fSample[fMaxNSamples]; + Int_t fSample[fMaxNSamples]; // the big buffer Int_t fRefTime; Bool_t fHasMulti; diff --git a/src/include/hcana/HallC_Data.h b/src/include/hcana/HallC_Data.h index dab221a..bbddff2 100644 --- a/src/include/hcana/HallC_Data.h +++ b/src/include/hcana/HallC_Data.h @@ -2,15 +2,26 @@ #define hallc_HallC_Data_HH #include <array> +#include <algorithm> namespace hallc { namespace data { + + /** Stores the digitized pulse data in a fixed size array. + */ struct PulseWaveForm { - std::array<float,200> _buffer; - ClassDef(PulseWaveForm,1) - }; + static const UInt_t MaxNPulses = 4; + static const UInt_t MaxNSamples = 511; + // From THcRawAdcHit.h + PulseWaveForm() {} + PulseWaveForm(Int_t* buf, Int_t size = MaxNSamples) { std::copy_n(buf, MaxNSamples, std::begin(_buffer)); } + virtual ~PulseWaveForm() {} + std::array<Int_t, MaxNSamples> _buffer; + + ClassDef(PulseWaveForm, 1) + }; } } -- GitLab