Skip to content
Snippets Groups Projects
Commit 7878074b authored by Jure Bericic's avatar Jure Bericic
Browse files

Added capability to set F250 parameters from PSE125.

PSE125 holds information about setting of F250 modules. Now this
information is used to set `fNPedestalSamples` and `fNPeakSamples`
parameters of `THcRawAdcHit`.

This is done through `THcHitList`, since it has information about
which crate and module each channel is in. Currently, the information
is set for each event, because of the hitlist and analyzer design.

I added the neccessary support for these changes to all raw hit
classes.
parent 2393326d
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
#include "TError.h" #include "TError.h"
#include "TClass.h" #include "TClass.h"
#include "THcConfigEvtHandler.h"
#include "THaGlobals.h"
#include "TList.h"
using namespace std; using namespace std;
THcHitList::THcHitList() THcHitList::THcHitList()
...@@ -17,6 +21,7 @@ THcHitList::THcHitList() ...@@ -17,6 +21,7 @@ THcHitList::THcHitList()
// Normal constructor. // Normal constructor.
fRawHitList = NULL; fRawHitList = NULL;
fPSE125 = NULL;
} }
...@@ -101,6 +106,10 @@ void THcHitList::InitHitList(THaDetMap* detmap, ...@@ -101,6 +106,10 @@ void THcHitList::InitHitList(THaDetMap* detmap,
} }
} }
fPSE125 = static_cast<THcConfigEvtHandler*>(gHaEvtHandlers->FindObject("HC"));
if (!fPSE125) {
cout << "THcHitList::InitHitList : Prestart event 125 not found." << endl;
}
} }
Int_t THcHitList::DecodeToHitList( const THaEvData& evdata ) { Int_t THcHitList::DecodeToHitList( const THaEvData& evdata ) {
...@@ -112,6 +121,7 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata ) { ...@@ -112,6 +121,7 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata ) {
// hits for multihit tdcs. // hits for multihit tdcs.
// The hit list is sorted (by plane, counter) after filling. // The hit list is sorted (by plane, counter) after filling.
// cout << " Clearing TClonesArray " << endl; // cout << " Clearing TClonesArray " << endl;
fRawHitList->Clear( ); fRawHitList->Clear( );
fNRawHits = 0; fNRawHits = 0;
...@@ -212,6 +222,15 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata ) { ...@@ -212,6 +222,15 @@ Int_t THcHitList::DecodeToHitList( const THaEvData& evdata ) {
} }
} }
} else { // This is a Flash ADC } else { // This is a Flash ADC
if (fPSE125) { // Set F250 parameters.
rawhit->SetF250Params(
fPSE125->GetNSA(d->crate),
fPSE125->GetNSB(d->crate),
fPSE125->GetNPED(d->crate)
);
}
// Copy the samples // Copy the samples
Int_t nsamples=evdata.GetNumEvents(Decoder::kSampleADC, d->crate, d->slot, chan); Int_t nsamples=evdata.GetNumEvents(Decoder::kSampleADC, d->crate, d->slot, chan);
......
...@@ -18,6 +18,7 @@ using namespace std; ...@@ -18,6 +18,7 @@ using namespace std;
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
//class THaDetMap; //class THaDetMap;
class THcConfigEvtHandler;
class THcHitList { class THcHitList {
...@@ -58,6 +59,8 @@ protected: ...@@ -58,6 +59,8 @@ protected:
UInt_t fNSignals; UInt_t fNSignals;
THcRawHit::ESignalType *fSignalTypes; THcRawHit::ESignalType *fSignalTypes;
THcConfigEvtHandler* fPSE125;
ClassDef(THcHitList,0); // List of raw hits sorted by plane, counter ClassDef(THcHitList,0); // List of raw hits sorted by plane, counter
}; };
#endif #endif
...@@ -167,6 +167,14 @@ Returns 0 if no signal pedestal is set. ...@@ -167,6 +167,14 @@ Returns 0 if no signal pedestal is set.
\brief Gets pedestal subtracted integral of samples. In channels. \brief Gets pedestal subtracted integral of samples. In channels.
*/ */
/**
\fn void THcRawAdcHit::SetF250Params(Int_t NSA, Int_t NSB, Int_t NPED)
\brief Sets F250 parameters used for pedestal subtraction.
\param [in] NSA NSA parameter of F250 modules.
\param [in] NSB NSB parameter of F250 modules.
\param [in] NPED NPED parameter of F250 modules.
*/
// TODO: Disallow using both SetData and SetDataTimePedestalPeak. // TODO: Disallow using both SetData and SetDataTimePedestalPeak.
...@@ -450,4 +458,11 @@ Double_t THcRawAdcHit::GetSampleInt() const { ...@@ -450,4 +458,11 @@ Double_t THcRawAdcHit::GetSampleInt() const {
} }
void THcRawAdcHit::SetF250Params(Int_t NSA, Int_t NSB, Int_t NPED) {
fNPedestalSamples = NPED;
fNPeakSamples = NSA + NSB;
fPeakPedestalRatio = 1.0*fNPeakSamples/fNPedestalSamples;
}
ClassImp(THcRawAdcHit) ClassImp(THcRawAdcHit)
...@@ -46,6 +46,8 @@ class THcRawAdcHit : public TObject { ...@@ -46,6 +46,8 @@ class THcRawAdcHit : public TObject {
Int_t GetSampleIntRaw() const; Int_t GetSampleIntRaw() const;
Double_t GetSampleInt() const; Double_t GetSampleInt() const;
void SetF250Params(Int_t NSA, Int_t NSB, Int_t NPED);
protected: protected:
static const UInt_t fMaxNPulses = 4; static const UInt_t fMaxNPulses = 4;
static const UInt_t fMaxNSamples = 511; static const UInt_t fMaxNSamples = 511;
......
...@@ -42,6 +42,8 @@ public: ...@@ -42,6 +42,8 @@ public:
virtual Bool_t HasReference(Int_t signal) {return kFALSE;}; virtual Bool_t HasReference(Int_t signal) {return kFALSE;};
virtual Int_t GetReference(Int_t signal) {return 0;}; virtual Int_t GetReference(Int_t signal) {return 0;};
virtual void SetF250Params(Int_t NSA, Int_t NSB, Int_t NPED) {};
// Derived objects must be sortable and supply Compare method // Derived objects must be sortable and supply Compare method
// virtual Bool_t IsSortable () const {return kFALSE; } // virtual Bool_t IsSortable () const {return kFALSE; }
// virtual Int_t Compare(const TObject* obj) const {return 0;} // virtual Int_t Compare(const TObject* obj) const {return 0;}
......
...@@ -198,4 +198,11 @@ THcRawTdcHit& THcRawHodoHit::GetRawTdcHitNeg() { ...@@ -198,4 +198,11 @@ THcRawTdcHit& THcRawHodoHit::GetRawTdcHitNeg() {
} }
void THcRawHodoHit::SetF250Params(Int_t NSA, Int_t NSB, Int_t NPED) {
for (Int_t iAdcSig=0; iAdcSig<fNAdcSignals; ++iAdcSig) {
fAdcHits[iAdcSig].SetF250Params(NSA, NSB, NPED);
}
}
ClassImp(THcRawHodoHit) ClassImp(THcRawHodoHit)
...@@ -39,6 +39,8 @@ class THcRawHodoHit : public THcRawHit { ...@@ -39,6 +39,8 @@ class THcRawHodoHit : public THcRawHit {
THcRawTdcHit& GetRawTdcHitPos(); THcRawTdcHit& GetRawTdcHitPos();
THcRawTdcHit& GetRawTdcHitNeg(); THcRawTdcHit& GetRawTdcHitNeg();
void SetF250Params(Int_t NSA, Int_t NSB, Int_t NPED);
protected: protected:
static const Int_t fNAdcSignals = 2; static const Int_t fNAdcSignals = 2;
static const Int_t fNTdcSignals = 2; static const Int_t fNTdcSignals = 2;
......
...@@ -142,4 +142,11 @@ THcRawAdcHit& THcRawShowerHit::GetRawAdcHitNeg() { ...@@ -142,4 +142,11 @@ THcRawAdcHit& THcRawShowerHit::GetRawAdcHitNeg() {
} }
void THcRawShowerHit::SetF250Params(Int_t NSA, Int_t NSB, Int_t NPED) {
for (Int_t iAdcSig=0; iAdcSig<fNAdcSignals; ++iAdcSig) {
fAdcHits[iAdcSig].SetF250Params(NSA, NSB, NPED);
}
}
ClassImp(THcRawShowerHit) ClassImp(THcRawShowerHit)
...@@ -31,6 +31,8 @@ class THcRawShowerHit : public THcRawHit { ...@@ -31,6 +31,8 @@ class THcRawShowerHit : public THcRawHit {
THcRawAdcHit& GetRawAdcHitPos(); THcRawAdcHit& GetRawAdcHitPos();
THcRawAdcHit& GetRawAdcHitNeg(); THcRawAdcHit& GetRawAdcHitNeg();
void SetF250Params(Int_t NSA, Int_t NSB, Int_t NPED);
protected: protected:
static const Int_t fNAdcSignals = 2; static const Int_t fNAdcSignals = 2;
......
...@@ -121,6 +121,11 @@ It supports rich data from flash 250 ADC modules. ...@@ -121,6 +121,11 @@ It supports rich data from flash 250 ADC modules.
\brief Gets reference to THcRawTdcHit. \brief Gets reference to THcRawTdcHit.
*/ */
/**
\fn void THcTrigRawHit::SetF250Params(Int_t NSA, Int_t NSB, Int_t NPED)
\brief See THcRawAdcHit::SetF250Params.
*/
// TODO: Check if signal matches plane. // TODO: Check if signal matches plane.
#include "THcTrigRawHit.h" #include "THcTrigRawHit.h"
...@@ -307,4 +312,11 @@ THcRawTdcHit& THcTrigRawHit::GetRawTdcHit() { ...@@ -307,4 +312,11 @@ THcRawTdcHit& THcTrigRawHit::GetRawTdcHit() {
} }
void THcTrigRawHit::SetF250Params(Int_t NSA, Int_t NSB, Int_t NPED) {
for (Int_t iAdcSig=0; iAdcSig<fNAdcSignals; ++iAdcSig) {
fAdcHits[iAdcSig].SetF250Params(NSA, NSB, NPED);
}
}
ClassImp(THcTrigRawHit) ClassImp(THcTrigRawHit)
...@@ -33,6 +33,8 @@ class THcTrigRawHit : public THcRawHit { ...@@ -33,6 +33,8 @@ class THcTrigRawHit : public THcRawHit {
THcRawAdcHit& GetRawAdcHit(); THcRawAdcHit& GetRawAdcHit();
THcRawTdcHit& GetRawTdcHit(); THcRawTdcHit& GetRawTdcHit();
void SetF250Params(Int_t NSA, Int_t NSB, Int_t NPED);
protected: protected:
static const Int_t fNAdcSignals = 1; static const Int_t fNAdcSignals = 1;
static const Int_t fNTdcSignals = 1; static const Int_t fNTdcSignals = 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment