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

Trig stack update for f250.

`THcTrigRawHit` now uses raw ADC and TDC classes.
Added new leaves to the `THcTrigDet` Root output.
parent 8e11a514
No related branches found
No related tags found
No related merge requests found
......@@ -11,15 +11,23 @@ comming from a specific source, like HMS.
Can hold up to 100 ADC and TDC channels, though the limit can be changed if
needed. It just seemed like a reasonable starting value.
Only outputs the first hit for each channel to the Root tree leaf.
# Defined variables
For ADC channels it defines:
- ADC value: `var_adc`
- pedestal: `var_adcPed`
- raw pedestal: `var_adcPedRaw`
- raw pulse integral: `var_adcPulseIntRaw`
- raw pulse amplitude: `var_adcPulseAmpRaw`
- raw pulse time: `var_adcPulseTimeRaw`
- single sample pedestal value: `var_adcPed`
- pedestal subtracted pulse integral: `var_adcPulseInt`
- pedestal subtracted pulse amplitude: `var_adcPulseAmp`
- multiplicity: `var_adcMult`
For TDC channels it defines:
- TDC value: `var_tdc`
- raw TDC time: `var_tdcTimeRaw`
- refence time subtracted TDC time: `var_tdcTime`
- multiplicity: `var_tdcMult`
# Parameter file variables
......@@ -102,6 +110,8 @@ Use only with THcTrigApp class.
#include "THcDetectorMap.h"
#include "THcGlobals.h"
#include "THcParmList.h"
#include "THcRawAdcHit.h"
#include "THcRawTdcHit.h"
#include "THcTrigApp.h"
#include "THcTrigRawHit.h"
......@@ -115,8 +125,10 @@ THcTrigDet::THcTrigDet(
THaDetector(name, description, app), THcHitList(),
fKwPrefix(""),
fNumAdc(0), fNumTdc(0), fAdcNames(), fTdcNames(),
fAdcVal(), fAdcPedestal(), fAdcMultiplicity(),
fTdcVal(), fTdcMultiplicity()
fTdcTimeRaw(), fTdcTime(),
fAdcPedRaw(), fAdcPulseIntRaw(), fAdcPulseAmpRaw(), fAdcPulseTimeRaw(),
fAdcPed(), fAdcPulseInt(), fAdcPulseAmp(),
fTdcMultiplicity(), fAdcMultiplicity()
{}
......@@ -128,8 +140,21 @@ THaAnalysisObject::EStatus THcTrigDet::Init(const TDatime& date) {
Setup(GetName(), GetTitle());
// Initialize all variables.
for (int i=0; i<fMaxAdcChannels; ++i) fAdcVal[i] = -1.0;
for (int i=0; i<fMaxTdcChannels; ++i) fTdcVal[i] = -1.0;
for (int i=0; i<fMaxAdcChannels; ++i) {
fAdcPedRaw[i] = 0;
fAdcPulseIntRaw[i] = 0;
fAdcPulseAmpRaw[i] = 0;
fAdcPulseTimeRaw[i] = 0;
fAdcPed[i] = 0.0;
fAdcPulseInt[i] = 0.0;
fAdcPulseAmp[i] = 0.0;
fAdcMultiplicity[i] = 0;
};
for (int i=0; i<fMaxTdcChannels; ++i) {
fTdcTimeRaw[i] = 0;
fTdcTime[i] = 0.0;
fTdcMultiplicity[i] = 0;
};
// Call initializer for base class.
// This also calls `ReadDatabase` and `DefineVariables`.
......@@ -160,8 +185,21 @@ void THcTrigDet::Clear(Option_t* opt) {
THaAnalysisObject::Clear(opt);
// Reset all data.
for (int i=0; i<fNumAdc; ++i) fAdcVal[i] = 0.0;
for (int i=0; i<fNumTdc; ++i) fTdcVal[i] = 0.0;
for (int i=0; i<fNumAdc; ++i) {
fAdcPedRaw[i] = 0;
fAdcPulseIntRaw[i] = 0;
fAdcPulseAmpRaw[i] = 0;
fAdcPulseTimeRaw[i] = 0;
fAdcPed[i] = 0.0;
fAdcPulseInt[i] = 0.0;
fAdcPulseAmp[i] = 0.0;
fAdcMultiplicity[i] = 0;
};
for (int i=0; i<fNumTdc; ++i) {
fTdcTimeRaw[i] = 0;
fTdcTime[i] = 0.0;
fTdcMultiplicity[i] = 0;
};
}
......@@ -174,14 +212,28 @@ Int_t THcTrigDet::Decode(const THaEvData& evData) {
while (iHit < numHits) {
THcTrigRawHit* hit = dynamic_cast<THcTrigRawHit*>(fRawHitList->At(iHit));
Int_t cnt = hit->fCounter-1;
if (hit->fPlane == 1) {
fAdcVal[hit->fCounter-1] = hit->GetData(0, 0);
fAdcPedestal[hit->fCounter-1] = hit->GetAdcPedestal(0);
fAdcMultiplicity[hit->fCounter-1] = hit->GetMultiplicity(0);
THcRawAdcHit rawAdcHit = hit->GetRawAdcHit();
fAdcPedRaw[cnt] = rawAdcHit.GetPedRaw();
fAdcPulseIntRaw[cnt] = rawAdcHit.GetPulseIntRaw();
fAdcPulseAmpRaw[cnt] = rawAdcHit.GetPulseAmpRaw();
fAdcPulseTimeRaw[cnt] = rawAdcHit.GetPulseTimeRaw();
fAdcPed[cnt] = rawAdcHit.GetPed();
fAdcPulseInt[cnt] = rawAdcHit.GetPulseInt();
fAdcPulseAmp[cnt] = rawAdcHit.GetPulseAmp();
fAdcMultiplicity[cnt] = rawAdcHit.GetNPulses();
}
else if (hit->fPlane == 2) {
fTdcVal[hit->fCounter-1] = hit->GetData(1, 0);
fTdcMultiplicity[hit->fCounter-1] = hit->GetMultiplicity(1);
THcRawTdcHit rawTdcHit = hit->GetRawTdcHit();
fTdcTimeRaw[cnt] = rawTdcHit.GetTimeRaw();
fTdcTime[cnt] = rawTdcHit.GetTime();
fTdcMultiplicity[cnt] = rawTdcHit.GetNHits();
}
else {
throw std::out_of_range(
......@@ -231,60 +283,121 @@ Int_t THcTrigDet::DefineVariables(THaAnalysisObject::EMode mode) {
std::vector<RVarDef> vars;
//Push the variable names for ADC channels.
std::vector<TString> adcValTitle(fNumAdc), adcValVar(fNumAdc);
std::vector<TString> adcPedestalTitle(fNumAdc), adcPedestalVar(fNumAdc);
std::vector<TString> adcPedRawTitle(fNumAdc), adcPedRawVar(fNumAdc);
std::vector<TString> adcPulseIntRawTitle(fNumAdc), adcPulseIntRawVar(fNumAdc);
std::vector<TString> adcPulseAmpRawTitle(fNumAdc), adcPulseAmpRawVar(fNumAdc);
std::vector<TString> adcPulseTimeRawTitle(fNumAdc), adcPulseTimeRawVar(fNumAdc);
std::vector<TString> adcPedTitle(fNumAdc), adcPedVar(fNumAdc);
std::vector<TString> adcPulseIntTitle(fNumAdc), adcPulseIntVar(fNumAdc);
std::vector<TString> adcPulseAmpTitle(fNumAdc), adcPulseAmpVar(fNumAdc);
std::vector<TString> adcMultiplicityTitle(fNumAdc), adcMultiplicityVar(fNumAdc);
for (int i=0; i<fNumAdc; ++i) {
adcValTitle.at(i) = fAdcNames.at(i) + "_adc";
adcValVar.at(i) = TString::Format("fAdcVal[%d]", i);
adcPedRawTitle.at(i) = fAdcNames.at(i) + "_adcPedRaw";
adcPedRawVar.at(i) = TString::Format("fAdcPedRaw[%d]", i);
RVarDef entry1 {
adcValTitle.at(i).Data(),
adcValTitle.at(i).Data(),
adcValVar.at(i).Data()
adcPedRawTitle.at(i).Data(),
adcPedRawTitle.at(i).Data(),
adcPedRawVar.at(i).Data()
};
vars.push_back(entry1);
adcPedestalTitle.at(i) = fAdcNames.at(i) + "_adcPed";
adcPedestalVar.at(i) = TString::Format("fAdcPedestal[%d]", i);
adcPulseIntRawTitle.at(i) = fAdcNames.at(i) + "_adcPulseIntRaw";
adcPulseIntRawVar.at(i) = TString::Format("fAdcPulseIntRaw[%d]", i);
RVarDef entry2 {
adcPedestalTitle.at(i).Data(),
adcPedestalTitle.at(i).Data(),
adcPedestalVar.at(i).Data()
adcPulseIntRawTitle.at(i).Data(),
adcPulseIntRawTitle.at(i).Data(),
adcPulseIntRawVar.at(i).Data()
};
vars.push_back(entry2);
adcMultiplicityTitle.at(i) = fAdcNames.at(i) + "_adcMult";
adcMultiplicityVar.at(i) = TString::Format("fAdcMultiplicity[%d]", i);
adcPulseAmpRawTitle.at(i) = fAdcNames.at(i) + "_adcPulseAmpRaw";
adcPulseAmpRawVar.at(i) = TString::Format("fAdcPulseAmpRaw[%d]", i);
RVarDef entry3 {
adcPulseAmpRawTitle.at(i).Data(),
adcPulseAmpRawTitle.at(i).Data(),
adcPulseAmpRawVar.at(i).Data()
};
vars.push_back(entry3);
adcPulseTimeRawTitle.at(i) = fAdcNames.at(i) + "_adcPulseTimeRaw";
adcPulseTimeRawVar.at(i) = TString::Format("fAdcPulseTimeRaw[%d]", i);
RVarDef entry4 {
adcPulseTimeRawTitle.at(i).Data(),
adcPulseTimeRawTitle.at(i).Data(),
adcPulseTimeRawVar.at(i).Data()
};
vars.push_back(entry4);
adcPedTitle.at(i) = fAdcNames.at(i) + "_adcPed";
adcPedVar.at(i) = TString::Format("fAdcPed[%d]", i);
RVarDef entry5 {
adcPedTitle.at(i).Data(),
adcPedTitle.at(i).Data(),
adcPedVar.at(i).Data()
};
vars.push_back(entry5);
adcPulseIntTitle.at(i) = fAdcNames.at(i) + "_adcPulseInt";
adcPulseIntVar.at(i) = TString::Format("fAdcPulseInt[%d]", i);
RVarDef entry6 {
adcPulseIntTitle.at(i).Data(),
adcPulseIntTitle.at(i).Data(),
adcPulseIntVar.at(i).Data()
};
vars.push_back(entry6);
adcPulseAmpTitle.at(i) = fAdcNames.at(i) + "_adcPulseAmp";
adcPulseAmpVar.at(i) = TString::Format("fAdcPulseAmp[%d]", i);
RVarDef entry7 {
adcPulseAmpTitle.at(i).Data(),
adcPulseAmpTitle.at(i).Data(),
adcPulseAmpVar.at(i).Data()
};
vars.push_back(entry7);
adcMultiplicityTitle.at(i) = fAdcNames.at(i) + "_adcMultiplicity";
adcMultiplicityVar.at(i) = TString::Format("fAdcMultiplicity[%d]", i);
RVarDef entry8 {
adcMultiplicityTitle.at(i).Data(),
adcMultiplicityTitle.at(i).Data(),
adcMultiplicityVar.at(i).Data()
};
vars.push_back(entry3);
vars.push_back(entry8);
}
// Push the variable names for TDC channels.
std::vector<TString> tdcValTitle(fNumTdc), tdcValVar(fNumTdc);
std::vector<TString> tdcTimeRawTitle(fNumTdc), tdcTimeRawVar(fNumTdc);
std::vector<TString> tdcTimeTitle(fNumTdc), tdcTimeVar(fNumTdc);
std::vector<TString> tdcMultiplicityTitle(fNumTdc), tdcMultiplicityVar(fNumTdc);
for (int i=0; i<fNumTdc; ++i) {
tdcValTitle.at(i) = fTdcNames.at(i) + "_tdc";
tdcValVar.at(i) = TString::Format("fTdcVal[%d]", i);
tdcTimeRawTitle.at(i) = fTdcNames.at(i) + "_tdcTimeRaw";
tdcTimeRawVar.at(i) = TString::Format("fTdcTimeRaw[%d]", i);
RVarDef entry1 {
tdcValTitle.at(i).Data(),
tdcValTitle.at(i).Data(),
tdcValVar.at(i).Data()
tdcTimeRawTitle.at(i).Data(),
tdcTimeRawTitle.at(i).Data(),
tdcTimeRawVar.at(i).Data()
};
vars.push_back(entry1);
tdcMultiplicityTitle.at(i) = fTdcNames.at(i) + "_tdcMult";
tdcMultiplicityVar.at(i) = TString::Format("fTdcMultiplicity[%d]", i);
tdcTimeTitle.at(i) = fTdcNames.at(i) + "_tdcTime";
tdcTimeVar.at(i) = TString::Format("fTdcTime[%d]", i);
RVarDef entry2 {
tdcTimeTitle.at(i).Data(),
tdcTimeTitle.at(i).Data(),
tdcTimeVar.at(i).Data()
};
vars.push_back(entry2);
tdcMultiplicityTitle.at(i) = fTdcNames.at(i) + "_tdcMultiplicity";
tdcMultiplicityVar.at(i) = TString::Format("fTdcMultiplicity[%d]", i);
RVarDef entry3 {
tdcMultiplicityTitle.at(i).Data(),
tdcMultiplicityTitle.at(i).Data(),
tdcMultiplicityVar.at(i).Data()
};
vars.push_back(entry2);
vars.push_back(entry3);
}
RVarDef end {0};
......
......@@ -42,12 +42,20 @@ class THcTrigDet : public THaDetector, public THcHitList {
static const int fMaxAdcChannels = 100;
static const int fMaxTdcChannels = 100;
Int_t fAdcVal[fMaxAdcChannels];
Int_t fAdcPedestal[fMaxAdcChannels];
Int_t fAdcMultiplicity[fMaxAdcChannels];
Int_t fTdcTimeRaw[fMaxTdcChannels];
Double_t fTdcTime[fMaxTdcChannels];
Int_t fAdcPedRaw[fMaxAdcChannels];
Int_t fAdcPulseIntRaw[fMaxAdcChannels];
Int_t fAdcPulseAmpRaw[fMaxAdcChannels];
Int_t fAdcPulseTimeRaw[fMaxAdcChannels];
Double_t fAdcPed[fMaxAdcChannels];
Double_t fAdcPulseInt[fMaxAdcChannels];
Double_t fAdcPulseAmp[fMaxAdcChannels];
Int_t fTdcVal[fMaxTdcChannels];
Int_t fTdcMultiplicity[fMaxTdcChannels];
Int_t fAdcMultiplicity[fMaxAdcChannels];
private:
THcTrigDet();
......
/**
\class THcTrigRawHit
\ingroup DetSupport
\brief Class representing a single raw hit for the THcTrigDet.
- `signal 0` is ADC
......@@ -12,9 +11,7 @@ It supports rich data from flash 250 ADC modules.
/**
\fn THcTrigRawHit::THcTrigRawHit(Int_t plane=0, Int_t counter=0)
\brief A constructor.
\param[in] plane Internal plane number of the hit. Should be `1` for ADC and
`2` for TDC.
\param[in] counter Internal bar number of the hit.
......@@ -22,197 +19,106 @@ It supports rich data from flash 250 ADC modules.
/**
\fn THcTrigRawHit& THcTrigRawHit::operator=(const THcTrigRawHit& right)
\brief Assignment operator.
\param[in] right Raw hit to be assigned.
*/
/**
\fn THcTrigRawHit::~THcTrigRawHit()
\brief A destructor.
*/
/**
\fn void THcTrigRawHit::Clear(Option_t* opt="")
\brief Clears variables before next event.
\param[in] opt Maybe used in base clas... Not sure.
\param[in] opt Maybe used in base class... Not sure.
*/
/**
\fn void THcTrigRawHit::SetData(Int_t signal, Int_t data)
\brief Sets next data value.
\param[in] signal ADC or TDC.
\param[in] data Value to be set.
\throw std::out_of_range Tried to set wrong signal.
*/
/**
\fn void THcTrigRawHit::SetSample(Int_t signal, Int_t data)
\brief Sets next waveform sample value.
\param[in] signal ADC or TDC.
\param[in] signal ADC.
\param[in] data Sample value to be set.
\throw std::out_of_range Tried to set wrong signal.
*/
/**
\fn void THcTrigRawHit::SetDataTimePedestalPeak(
Int_t signal, Int_t data, Int_t time, Int_t pedestal, Int_t peak)
\brief Sets multiple bits of data from flash 250 ADC modules.
\param[in] signal Usually ADC.
\param[in] signal ADC.
\param[in] data ADC sum value to be set.
\param[in] time Time of the peak.
\param[in] pedestal Pedestal value.
\param[in] peak Sample ADC value at peak.
\throw std::out_of_range Tried to set wrong signal.
*/
/**
\fn void THcTrigRawHit::SetReference(Int_t signal, Int_t reference)
\brief Sets reference time.
\param[in] signal ADC or TDC.
\param[in] signal TDC.
\param[in] reference Reference time to be set.
\throw std::out_of_range Tried to set wrong signal.
*/
/**
\fn Int_t THcTrigRawHit::GetData(Int_t signal)
\brief Gets data for first hit of signal.
\param[in] signal ADC or TDC.
Read also GetData(Int_t signal, UInt_t iHit).
*/
/**
\fn Int_t THcTrigRawHit::GetData(Int_t signal, UInt_t iHit)
\brief Gets data for specific hit of signal.
\param[in] signal ADC or TDC.
\param[in] iHit Sequential number of wanted hit.
If the signal is TDC, the returned value is corrected for reference time, if
available.
Read also GetRawData(Int_t signal, UInt_t iHit)
\throw std::out_of_range Tried to get wrong signal.
*/
/**
\fn Int_t THcTrigRawHit::GetRawData(Int_t signal)
\brief Gets raw data for first hit of signal.
\param[in] signal ADC or TDC.
Read also GetRawData(Int_t signal, UInt_t iHit).
*/
/**
\fn Int_t THcTrigRawHit::GetRawData(Int_t signal, UInt_t iHit)
\brief Gets raw data for specific hit of signal.
\param[in] signal ADC or TDC.
\param[in] iHit Sequential number of wanted hit.
If requesting the first hit where it does not exist, `0` is returned.
\throw std::out_of_range Tried to get wrong signal.
*/
/**
\fn Int_t THcTrigRawHit::GetAdcTime(UInt_t iHit)
\brief Gets reference time subtracted time of ADC peak.
\param[in] iHit Sequential number of wanted hit.
If requesting the first hit where it does not exist or if time is not
available, `0` is returned.
*/
/**
\fn Int_t THcTrigRawHit::GetAdcPedestal(UInt_t iHit)
\brief Gets the ADC pedestal value.
\param[in] iHit Sequential number of wanted hit.
The pedestal value is usually a sum of `N` samples, where `N` is defined in
ADC module settings.
If requesting the first hit where it does not exist or if pedestal is not
available, `0` is returned.
*/
/**
\fn Int_t THcTrigRawHit::GetAdcPulse(UInt_t iHit)
\brief Gets the position of ADC peak.
\param[in] iHit Sequential number of wanted hit.
If requesting the first hit where it does not exist or if peak is not
available, `0` is returned.
*/
/**
\fn Int_t THcTrigRawHit::GetNSignals()
\brief Returns number of signal handled by this class, i.e., `2`.
\fn Int_t THcTrigRawHit::GetReference(Int_t signal)
\brief Returns reference time.
\param[in] signal TDC.
\throw std::out_of_range Tried to get wrong signal.
*/
/**
\fn THcRawHit::ESignalType THcTrigRawHit::GetSignalType(Int_t signal)
\brief Returns the signal type.
\param[in] signal ADC or TDC.
\throw std::out_of_range Tried to get wrong signal.
*/
/**
\fn Int_t THcTrigRawHit::GetReference(Int_t signal)
\brief Returns reference time.
\param[in] signal ADC or TDC.
Returns `0` if reference time is not available.
\fn Int_t THcTrigRawHit::GetNSignals()
\brief Returns number of signal handled by this class, i.e., `2`.
*/
/**
\fn Int_t THcTrigRawHit::GetMultiplicity(Int_t signal)
\brief Gets the number of hits for this event.
\param[in] signal ADC or TDC.
\fn Bool_t THcTrigRawHit::HasReference(Int_t signal)
\brief Checks if reference time is available.
\param[in] signal TDC.
\throw std::out_of_range Tried to get wrong signal.
*/
/**
\fn Bool_t THcTrigRawHit::HasMulti(Int_t signal)
\brief Checks if rich data is available.
\param[in] signal ADC or TDC.
\fn THcRawAdcHit& THcTrigRawHit::GetRawAdcHit()
\brief Gets reference to THcRawAdcHit.
*/
/**
\fn Bool_t THcTrigRawHit::HasReference(Int_t signal)
\brief Checks if reference time is available.
\param[in] signal ADC or TDC.
\fn THcRawTdcHit& THcTrigRawHit::GetRawTdcHit()
\brief Gets reference to THcRawTdcHit.
*/
// TODO: Check if signal matches plane.
......@@ -229,11 +135,7 @@ Returns `0` if reference time is not available.
THcTrigRawHit::THcTrigRawHit(
Int_t plane, Int_t counter
) :
THcRawHit(plane, counter),
fAdc(), fAdcTime(), fAdcPedestal(), fAdcPulse(), fAdcSamples(), fTdc(),
fReferenceTime(), fHasReference(), fHasMulti(), fNRawHits(), fNRawSamples(0)
{}
) : THcRawHit(plane, counter), fAdcHits(), fTdcHits() {}
THcTrigRawHit& THcTrigRawHit::operator=(const THcTrigRawHit& right) {
......@@ -241,25 +143,12 @@ THcTrigRawHit& THcTrigRawHit::operator=(const THcTrigRawHit& right) {
THcRawHit::operator=(right);
if (this != &right) {
for (UInt_t i=0; i<fMaxNPulsesAdc; ++i) {
fAdc[i] = right.fAdc[i];
fAdcTime[i] = right.fAdcTime[i];
fAdcPedestal[i] = right.fAdcPedestal[i];
fAdcPulse[i] = right.fAdcPulse[i];
}
for (UInt_t i=0; i<fMaxNSamplesAdc; ++i) {
fAdcSamples[i] = right.fAdcSamples[i];
for (Int_t iAdcSig=0; iAdcSig<fNAdcSignals; ++iAdcSig) {
fAdcHits[iAdcSig] = right.fAdcHits[iAdcSig];
}
for (UInt_t i=0; i<fMaxNHitsTdc; ++i) {
fTdc[i] = right.fTdc[i];
for (Int_t iTdcSig=0; iTdcSig<fNTdcSignals; ++iTdcSig) {
fTdcHits[iTdcSig] = right.fTdcHits[iTdcSig];
}
for (UInt_t i=0; i<fNPlanes; ++i) {
fReferenceTime[i] = right.fReferenceTime[i];
fHasReference[i] = right.fHasReference[i];
fHasMulti[i] = right.fHasMulti[i];
fNRawHits[i] = right.fNRawHits[i];
}
fNRawSamples = right.fNRawSamples;
}
return *this;
......@@ -270,228 +159,119 @@ THcTrigRawHit::~THcTrigRawHit() {}
void THcTrigRawHit::Clear(Option_t* opt) {
TObject::Clear(opt);
THcRawHit::Clear(opt);
for (UInt_t i=0; i<fNPlanes; ++i) {
fHasReference[i] = kFALSE;
fHasMulti[i] = kFALSE;
fNRawHits[i] = 0;
for (Int_t iAdcSig=0; iAdcSig<fNAdcSignals; ++iAdcSig) {
fAdcHits[iAdcSig].Clear();
}
for (Int_t iTdcSig=0; iTdcSig<fNTdcSignals; ++iTdcSig) {
fTdcHits[iTdcSig].Clear();
}
fNRawSamples = 0;
}
void THcTrigRawHit::SetData(Int_t signal, Int_t data) {
// Signal 0 is ADC; signal 1 is TDC.
if (signal == 0) {
if (fNRawHits[signal] >= fMaxNPulsesAdc) {
throw std::out_of_range(
"`THcTrigRawHit::SetData`: too many pulses for ADC signal!"
);
}
fAdc[fNRawHits[signal]] = data;
++fNRawHits[signal];
if (0 <= signal && signal < fNAdcSignals) {
fAdcHits[signal].SetData(data);
}
// Signal 1 is TDC.
else if (signal == 1) {
if (fNRawHits[signal] >= fMaxNHitsTdc) {
throw std::out_of_range(
"`THcTrigRawHit::SetData`: too many hits for TDC signal!"
);
}
fTdc[fNRawHits[signal]] = data;
++fNRawHits[signal];
else if (fNAdcSignals <= signal && signal < fNAdcSignals+fNTdcSignals) {
fTdcHits[signal-fNAdcSignals].SetTime(data);
}
else {
throw std::out_of_range(
"`THcTrigRawHit::SetData`: only signals `0` and `1` available!"
);
}
else throw std::out_of_range(
"`THcTrigRawHit::SetData`: only signals `0` (ADC) and `1` (TDC) available!"
);
}
void THcTrigRawHit::SetSample(Int_t signal, Int_t data) {
if (signal == 0) {
if (fNRawSamples >= fMaxNSamplesAdc) {
throw std::out_of_range(
"`THcTrigRawHit::SetData`: too many samples for ADC signal!"
);
}
fAdcSamples[fNRawSamples] = data;
++fNRawSamples;
if (0 <= signal && signal < fNAdcSignals) {
fAdcHits[signal].SetSample(data);
}
else {
throw std::out_of_range(
"`THcTrigRawHit::SetSample`: only signal `0` available!"
);
}
else throw std::out_of_range(
"`THcTrigRawHit::SetSample`: only signal `0` (ADC) support samples!"
);
}
void THcTrigRawHit::SetDataTimePedestalPeak(
Int_t signal, Int_t data, Int_t time, Int_t pedestal, Int_t peak
) {
if (signal == 0) {
if (fNRawHits[signal] >= fMaxNPulsesAdc) {
throw std::out_of_range(
"`THcTrigRawHit::SetData`: too many pulses for ADC signal!"
);
}
fAdc[fNRawHits[signal]] = data;
fAdcTime[fNRawHits[signal]] = time;
fAdcPedestal[fNRawHits[signal]] = pedestal;
fAdcPulse[fNRawHits[signal]] = peak;
fHasMulti[signal] = kTRUE;
++fNRawHits[signal];
if (0 <= signal && signal < fNAdcSignals) {
fAdcHits[signal].SetDataTimePedestalPeak(data, time, pedestal, peak);
}
else {
throw std::out_of_range(
"`THcTrigRawHit::SetDataTimePedestalPeak`: only signal `0` available!"
);
}
else throw std::out_of_range(
"`THcTrigRawHit::SetDataTimePedestalPeak`: only signal `0` (ADC) support rich data!"
);
}
void THcTrigRawHit::SetReference(Int_t signal, Int_t reference) {
if (signal == 0) {
std::cerr
<< "Warning:"
<< " `THcTrigRawHit::SetReference`:"
<< " signal 0 (ADC) should not have reference time!"
<< " Check map file!"
<< std::endl;
}
else if (signal == 1) {
fReferenceTime[signal] = reference;
fHasReference[signal] = kTRUE;
if (fNAdcSignals <= signal && signal < fNAdcSignals+fNTdcSignals) {
fTdcHits[signal-fNAdcSignals].SetRefTime(reference);
}
else {
throw std::out_of_range(
"`THcTrigRawHit::SetReference`: only signals `0` and `1` available!"
"`THcTrigRawHit::SetReference`: only signal `1` available!"
);
}
}
Int_t THcTrigRawHit::GetData(Int_t signal) {
return GetData(signal, 0);
}
Int_t THcTrigRawHit::GetData(Int_t signal, UInt_t iHit) {
Int_t value = GetRawData(signal, iHit);
if (signal == 1 && fHasReference[signal]) value -= fReferenceTime[signal];
return value;
}
Int_t THcTrigRawHit::GetRawData(Int_t signal) {
return GetRawData(signal, 0);
}
Int_t THcTrigRawHit::GetRawData(Int_t signal, UInt_t iHit) {
Int_t value = 0;
if (iHit >= fNRawHits[signal] && iHit != 0) {
TString msg = TString::Format(
"`THcTrigRawHit::GetRawData`: requested hit %d for signal %d where only %d hit available!",
iHit, signal, fNRawHits[signal]
);
throw std::out_of_range(msg.Data());
if (0 <= signal && signal < fNAdcSignals) {
return fAdcHits[signal].GetPulseInt();
}
else if (iHit >= fNRawHits[signal] && iHit == 0) {
value = 0;
else if (fNAdcSignals <= signal && signal < fNAdcSignals+fNTdcSignals) {
return fTdcHits[signal-fNAdcSignals].GetTime();
}
else {
if (signal == 0) value = fAdc[iHit];
else if (signal == 1) value = fTdc[iHit];
else {
throw std::out_of_range(
"`THcTrigRawHit::GetRawData`: only signals `0` and `1` available!"
);
}
}
return value;
}
Int_t THcTrigRawHit::GetAdcTime(UInt_t iHit) {
Int_t value = 0;
Int_t signal = 0;
if (iHit >= fNRawHits[signal] && iHit != 0) {
TString msg = TString::Format(
"`THcTrigRawHit::GetAdcTime`: requested hit %d for signal %d where only %d hit available!",
iHit, signal, fNRawHits[signal]
throw std::out_of_range(
"`THcTrigRawHit::GetData`: only signals `0` and `1` available!"
);
throw std::out_of_range(msg.Data());
}
else if (iHit >= fNRawHits[signal] && iHit == 0) {
value = 0;
}
else {
if (fHasMulti[0]) value = fAdcTime[iHit];
else value = 0;
}
if (fHasReference[signal]) value -= fReferenceTime[signal];
return value;
}
Int_t THcTrigRawHit::GetAdcPedestal(UInt_t iHit) {
Int_t value = 0;
Int_t signal = 0;
if (iHit >= fNRawHits[signal] && iHit != 0) {
TString msg = TString::Format(
"`THcTrigRawHit::GetAdcPedestal`: requested hit %d for signal %d where only %d hit available!",
iHit, signal, fNRawHits[signal]
);
throw std::out_of_range(msg.Data());
Int_t THcTrigRawHit::GetRawData(Int_t signal) {
if (0 <= signal && signal < fNAdcSignals) {
return fAdcHits[signal].GetPulseIntRaw();
}
else if (iHit >= fNRawHits[signal] && iHit == 0) {
value = 0;
else if (fNAdcSignals <= signal && signal < fNAdcSignals+fNTdcSignals) {
return fTdcHits[signal-fNAdcSignals].GetTimeRaw();
}
else {
if (fHasMulti[0]) value = fAdcPedestal[iHit];
else value = 0;
throw std::out_of_range(
"`THcTrigRawHit::GetRawData`: only signals `0` and `1` available!"
);
}
return value;
}
Int_t THcTrigRawHit::GetAdcPulse(UInt_t iHit) {
Int_t value = 0;
Int_t signal = 0;
if (iHit >= fNRawHits[signal] && iHit != 0) {
TString msg = TString::Format(
"`THcTrigRawHit::GetAdcPulse`: requested hit %d for signal %d where only %d hit available!",
iHit, signal, fNRawHits[signal]
);
throw std::out_of_range(msg.Data());
}
else if (iHit >= fNRawHits[signal] && iHit == 0) {
value = 0;
Int_t THcTrigRawHit::GetReference(Int_t signal) {
if (fNAdcSignals <= signal && signal < fNAdcSignals+fNTdcSignals) {
return fTdcHits[signal-fNAdcSignals].GetRefTime();
}
else {
if (fHasMulti[0]) value = fAdcPulse[iHit];
else value = 0;
throw std::out_of_range(
"`THcTrigRawHit::GetReference`: only signal `1` available!"
);
}
return value;
}
Int_t THcTrigRawHit::GetNSignals() {
return 2;
}
THcRawHit::ESignalType THcTrigRawHit::GetSignalType(Int_t signal) {
if (signal == 0) return kADC;
else if (signal == 1) return kTDC;
if (0 <= signal && signal < fNAdcSignals) {
return kADC;
}
else if (fNAdcSignals <= signal && signal < fNAdcSignals+fNTdcSignals) {
return kTDC;
}
else {
throw std::out_of_range(
"`THcTrigRawHit::GetSignalType`: only signals `0` and `1` available!"
......@@ -500,52 +280,30 @@ THcRawHit::ESignalType THcTrigRawHit::GetSignalType(Int_t signal) {
}
Int_t THcTrigRawHit::GetReference(Int_t signal) {
if (signal == 0 || signal == 1) {
if (fHasReference[signal]) return fReferenceTime[signal];
else return 0;
}
else {
throw std::out_of_range(
"`THcTrigRawHit::GetReference`: only signals `0` and `1` available!"
);
}
Int_t THcTrigRawHit::GetNSignals() {
return fNAdcSignals + fNTdcSignals;
}
Int_t THcTrigRawHit::GetMultiplicity(Int_t signal) {
if (signal == 0 || signal == 1) {
return fNRawHits[signal];
Bool_t THcTrigRawHit::HasReference(Int_t signal) {
if (fNAdcSignals <= signal && signal < fNAdcSignals+fNTdcSignals) {
return fTdcHits[signal-fNAdcSignals].HasRefTime();
}
else {
throw std::out_of_range(
"`THcTrigRawHit::GetMultiplicity`: only signals `0` and `1` available!"
"`THcTrigRawHit::HasReference`: only signal `1` available!"
);
}
}
Bool_t THcTrigRawHit::HasMulti(Int_t signal) {
if (signal == 0 || signal == 1) {
return fHasMulti[signal];
}
else {
throw std::out_of_range(
"`THcTrigRawHit::HasMulti`: only signals `0` and `1` available!"
);
}
THcRawAdcHit& THcTrigRawHit::GetRawAdcHit() {
return fAdcHits[0];
}
Bool_t THcTrigRawHit::HasReference(Int_t signal) {
if (signal == 0 || signal == 1) {
return fHasReference[signal];
}
else {
throw std::out_of_range(
"`THcTrigRawHit::HasReference`: only signals `0` and `1` available!"
);
}
THcRawTdcHit& THcTrigRawHit::GetRawTdcHit() {
return fTdcHits[0];
}
......
......@@ -3,6 +3,8 @@
#include "THcRawHit.h"
#include "THcRawAdcHit.h"
#include "THcRawTdcHit.h"
class THcTrigRawHit : public THcRawHit {
......@@ -21,42 +23,22 @@ class THcTrigRawHit : public THcRawHit {
void SetReference(Int_t signal, Int_t reference);
Int_t GetData(Int_t signal);
Int_t GetData(Int_t signal, UInt_t iHit);
Int_t GetRawData(Int_t signal);
Int_t GetRawData(Int_t signal, UInt_t iHit);
Int_t GetAdcTime(UInt_t iHit);
Int_t GetAdcPedestal(UInt_t iHit);
Int_t GetAdcPulse(UInt_t iHit);
Int_t GetNSignals();
ESignalType GetSignalType(Int_t signal);
Int_t GetReference(Int_t signal);
Int_t GetMultiplicity(Int_t signal);
ESignalType GetSignalType(Int_t signal);
Int_t GetNSignals();
Bool_t HasMulti(Int_t signal);
Bool_t HasReference(Int_t signal);
THcRawAdcHit& GetRawAdcHit();
THcRawTdcHit& GetRawTdcHit();
protected:
static const UInt_t fMaxNPulsesAdc = 4;
static const UInt_t fMaxNSamplesAdc = 511;
static const UInt_t fMaxNHitsTdc = 16;
static const UInt_t fNPlanes = 2;
Int_t fAdc[fMaxNPulsesAdc];
Int_t fAdcTime[fMaxNPulsesAdc];
Int_t fAdcPedestal[fMaxNPulsesAdc];
Int_t fAdcPulse[fMaxNPulsesAdc];
Int_t fAdcSamples[fMaxNSamplesAdc];
Int_t fTdc[fMaxNHitsTdc];
Int_t fReferenceTime[fNPlanes];
Bool_t fHasReference[fNPlanes];
Bool_t fHasMulti[fNPlanes];
UInt_t fNRawHits[fNPlanes];
static const Int_t fNAdcSignals = 1;
static const Int_t fNTdcSignals = 1;
UInt_t fNRawSamples;
THcRawAdcHit fAdcHits[fNAdcSignals];
THcRawTdcHit fTdcHits[fNTdcSignals];
private:
ClassDef(THcTrigRawHit, 0);
......
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