Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hcana
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jlab
hallc
analyzer_software
hcana
Commits
e7ebcd0a
Commit
e7ebcd0a
authored
8 years ago
by
Jure Bericic
Browse files
Options
Downloads
Patches
Plain Diff
Modified trigger classes for F250 data.
Modified THcTrigRawHit. Modified THcTrigDet. Updated documentation.
parent
79eb68d2
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/THcTrigDet.cxx
+93
-25
93 additions, 25 deletions
src/THcTrigDet.cxx
src/THcTrigDet.h
+6
-2
6 additions, 2 deletions
src/THcTrigDet.h
src/THcTrigRawHit.cxx
+474
-47
474 additions, 47 deletions
src/THcTrigRawHit.cxx
src/THcTrigRawHit.h
+37
-13
37 additions, 13 deletions
src/THcTrigRawHit.h
with
610 additions
and
87 deletions
src/THcTrigDet.cxx
+
93
−
25
View file @
e7ebcd0a
...
...
@@ -8,9 +8,38 @@ This class behaves as a detector, but it does not correspond to any physical
detector in the hall. Its purpose is to gather all the trigger related data
comming from a specific source, like HMS.
Use only with THcTrigApp class.
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.
# Defined variables
For ADC channels it defines:
- ADC value: `var_adc`
- pedestal: `var_adcPed`
- multiplicity: `var_adcMult`
For TDC channels it defines:
- TDC value: `var_tdc`
- multiplicity: `var_tdcMult`
# Parameter file variables
The names and number of channels is defined in a parameter file. The detector
looks for next variables:
- `prefix_numAdc = number_of_ADC_channels`
- `prefix_numTdc = number_of_TDC_channels`
- `prefix_adcNames = "varName1 varName2 ... varNameNumAdc"`
- `prefix_tdcNames = "varName1 varName2 ... varNameNumTdc"`
# Map file information
Note: not yet finalized!
ADC channels must be assigned plane `1` and signal `0` while TDC channels must
be assigned plane `2` and signal `1`.
Each channel within a plane must be assigned a consecutive "bar" number, which
is then used to get the correct variable name from parameter file.
Use only with THcTrigApp class.
*/
/**
...
...
@@ -45,7 +74,7 @@ Note: not yet finalized!
\brief Clears variables before next event.
\param[in] opt Maybe used in base clas...
\param[in] opt Maybe used in base clas...
Not sure.
*/
/**
...
...
@@ -56,6 +85,8 @@ Note: not yet finalized!
\param[in] evData Raw data to decode.
*/
//TODO: Check if fNumAdc < fMaxAdcChannels && fNumTdc < fMaxTdcChannels.
#include
"THcTrigDet.h"
#include
<algorithm>
...
...
@@ -84,7 +115,8 @@ THcTrigDet::THcTrigDet(
THaDetector
(
name
,
description
,
app
),
THcHitList
(),
fKwPrefix
(
""
),
fNumAdc
(
0
),
fNumTdc
(
0
),
fAdcNames
(),
fTdcNames
(),
fAdcVals
(),
fTdcVals
()
fAdcVal
(),
fAdcPedestal
(),
fAdcMultiplicity
(),
fTdcVal
(),
fTdcMultiplicity
()
{}
...
...
@@ -96,8 +128,8 @@ THaAnalysisObject::EStatus THcTrigDet::Init(const TDatime& date) {
Setup
(
GetName
(),
GetTitle
());
// Initialize all variables.
for
(
int
i
=
0
;
i
<
fMaxAdcChannels
;
++
i
)
fAdcVal
s
[
i
]
=
-
1.0
;
for
(
int
i
=
0
;
i
<
fMaxTdcChannels
;
++
i
)
fTdcVal
s
[
i
]
=
-
1.0
;
for
(
int
i
=
0
;
i
<
fMaxAdcChannels
;
++
i
)
fAdcVal
[
i
]
=
-
1.0
;
for
(
int
i
=
0
;
i
<
fMaxTdcChannels
;
++
i
)
fTdcVal
[
i
]
=
-
1.0
;
// Call initializer for base class.
// This also calls `ReadDatabase` and `DefineVariables`.
...
...
@@ -125,9 +157,11 @@ THaAnalysisObject::EStatus THcTrigDet::Init(const TDatime& date) {
void
THcTrigDet
::
Clear
(
Option_t
*
opt
)
{
THaAnalysisObject
::
Clear
(
opt
);
// Reset all data.
for
(
int
i
=
0
;
i
<
fNumAdc
;
++
i
)
fAdcVal
s
[
i
]
=
0.0
;
for
(
int
i
=
0
;
i
<
fNumTdc
;
++
i
)
fTdcVal
s
[
i
]
=
0.0
;
for
(
int
i
=
0
;
i
<
fNumAdc
;
++
i
)
fAdcVal
[
i
]
=
0.0
;
for
(
int
i
=
0
;
i
<
fNumTdc
;
++
i
)
fTdcVal
[
i
]
=
0.0
;
}
...
...
@@ -140,8 +174,15 @@ Int_t THcTrigDet::Decode(const THaEvData& evData) {
while
(
iHit
<
numHits
)
{
THcTrigRawHit
*
hit
=
dynamic_cast
<
THcTrigRawHit
*>
(
fRawHitList
->
At
(
iHit
));
if
(
hit
->
fPlane
==
1
)
fAdcVals
[
hit
->
fCounter
-
1
]
=
hit
->
GetData
(
0
);
else
if
(
hit
->
fPlane
==
2
)
fTdcVals
[
hit
->
fCounter
-
1
]
=
hit
->
GetData
(
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
);
}
else
if
(
hit
->
fPlane
==
2
)
{
fTdcVal
[
hit
->
fCounter
-
1
]
=
hit
->
GetData
(
1
,
0
);
fTdcMultiplicity
[
hit
->
fCounter
-
1
]
=
hit
->
GetMultiplicity
(
1
);
}
else
{
throw
std
::
out_of_range
(
"`THcTrigDet::Decode`: only planes `1` and `2` available!"
...
...
@@ -189,28 +230,55 @@ Int_t THcTrigDet::DefineVariables(THaAnalysisObject::EMode mode) {
std
::
vector
<
RVarDef
>
vars
;
// Push the variable names for ADC channels.
std
::
vector
<
TString
>
varTitlesAdc
(
fNumAdc
);
std
::
vector
<
TString
>
varNamesAdc
(
fNumAdc
);
//Push the variable names for ADC channels.
std
::
vector
<
TString
>
adcValTitle
(
fNumAdc
),
adcValVar
(
fNumAdc
);
std
::
vector
<
TString
>
adcPedestalTitle
(
fNumAdc
),
adcPedestalVar
(
fNumAdc
);
std
::
vector
<
TString
>
adcMultiplicityTitle
(
fNumAdc
),
adcMultiplicityVar
(
fNumAdc
);
for
(
int
i
=
0
;
i
<
fNumAdc
;
++
i
)
{
varNamesAdc
.
at
(
i
)
=
TString
::
Format
(
"fAdcVals[%d]"
,
i
);
varTitlesAdc
.
at
(
i
)
=
fAdcNames
.
at
(
i
)
+
"_adc"
;
adcValTitle
.
at
(
i
)
=
fAdcNames
.
at
(
i
)
+
"_adc"
;
adcValVar
.
at
(
i
)
=
TString
::
Format
(
"fAdcVal[%d]"
,
i
);
vars
.
push_back
({
adcValTitle
.
at
(
i
).
Data
(),
adcValTitle
.
at
(
i
).
Data
(),
adcValVar
.
at
(
i
).
Data
()
});
adcPedestalTitle
.
at
(
i
)
=
fAdcNames
.
at
(
i
)
+
"_adcPed"
;
adcPedestalVar
.
at
(
i
)
=
TString
::
Format
(
"fAdcPedestal[%d]"
,
i
);
vars
.
push_back
({
adcPedestalTitle
.
at
(
i
).
Data
(),
adcPedestalTitle
.
at
(
i
).
Data
(),
adcPedestalVar
.
at
(
i
).
Data
()
});
adcMultiplicityTitle
.
at
(
i
)
=
fAdcNames
.
at
(
i
)
+
"_adcMult"
;
adcMultiplicityVar
.
at
(
i
)
=
TString
::
Format
(
"fAdcMultiplicity[%d]"
,
i
);
vars
.
push_back
({
var
Title
sAdc
.
at
(
i
).
Data
(),
var
Title
sAdc
.
at
(
i
).
Data
(),
varNamesAdc
.
at
(
i
).
Data
()
adcMultiplicity
Title
.
at
(
i
).
Data
(),
adcMultiplicity
Title
.
at
(
i
).
Data
(),
adcMultiplicityVar
.
at
(
i
).
Data
()
});
}
// Push the variable names for TDC channels.
std
::
vector
<
TString
>
varTitlesTdc
(
fNumTdc
);
std
::
vector
<
TString
>
varNamesTdc
(
fNumTdc
);
std
::
vector
<
TString
>
tdcValTitle
(
fNumTdc
),
tdcValVar
(
fNumTdc
);
std
::
vector
<
TString
>
tdcMultiplicityTitle
(
fNumTdc
),
tdcMultiplicityVar
(
fNumTdc
);
for
(
int
i
=
0
;
i
<
fNumTdc
;
++
i
)
{
varNamesTdc
.
at
(
i
)
=
TString
::
Format
(
"fTdcVals[%d]"
,
i
);
varTitlesTdc
.
at
(
i
)
=
fTdcNames
.
at
(
i
)
+
"_tdc"
;
tdcValTitle
.
at
(
i
)
=
fTdcNames
.
at
(
i
)
+
"_tdc"
;
tdcValVar
.
at
(
i
)
=
TString
::
Format
(
"fTdcVal[%d]"
,
i
);
vars
.
push_back
({
tdcValTitle
.
at
(
i
).
Data
(),
tdcValTitle
.
at
(
i
).
Data
(),
tdcValVar
.
at
(
i
).
Data
()
});
tdcMultiplicityTitle
.
at
(
i
)
=
fTdcNames
.
at
(
i
)
+
"_tdcMult"
;
tdcMultiplicityVar
.
at
(
i
)
=
TString
::
Format
(
"fTdcMultiplicity[%d]"
,
i
);
vars
.
push_back
({
var
Title
sTdc
.
at
(
i
).
Data
(),
var
Title
sTdc
.
at
(
i
).
Data
(),
varNamesTdc
.
at
(
i
).
Data
()
tdcMultiplicity
Title
.
at
(
i
).
Data
(),
tdcMultiplicity
Title
.
at
(
i
).
Data
(),
tdcMultiplicityVar
.
at
(
i
).
Data
()
});
}
...
...
This diff is collapsed.
Click to expand it.
src/THcTrigDet.h
+
6
−
2
View file @
e7ebcd0a
...
...
@@ -42,8 +42,12 @@ class THcTrigDet : public THaDetector, public THcHitList {
static
const
int
fMaxAdcChannels
=
100
;
static
const
int
fMaxTdcChannels
=
100
;
Double_t
fAdcVals
[
fMaxAdcChannels
];
Double_t
fTdcVals
[
fMaxTdcChannels
];
Int_t
fAdcVal
[
fMaxAdcChannels
];
Int_t
fAdcPedestal
[
fMaxAdcChannels
];
Int_t
fAdcMultiplicity
[
fMaxAdcChannels
];
Int_t
fTdcVal
[
fMaxTdcChannels
];
Int_t
fTdcMultiplicity
[
fMaxTdcChannels
];
private:
THcTrigDet
();
...
...
This diff is collapsed.
Click to expand it.
src/THcTrigRawHit.cxx
+
474
−
47
View file @
e7ebcd0a
...
...
@@ -4,23 +4,234 @@
\brief Class representing a single raw hit for the THcTrigDet.
Contains plane, counter and an ADC or a TDC value.
- `signal 0` is ADC
- `signal 1` is TDC
Note: not yet finalized!
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.
*/
/**
\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.
*/
/**
\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.
*/
/**
\fn void THcTrigRawHit::SetSample(Int_t signal, Int_t data)
\brief Sets next waveform sample value.
\param[in] signal ADC or TDC.
\param[in] data Sample value to be set.
*/
/**
\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] 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.
*/
/**
\fn void THcTrigRawHit::SetReference(Int_t signal, Int_t reference)
\brief Sets reference time.
\param[in] signal ADC or TDC.
\param[in] reference Reference time to be set.
*/
/**
\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)
*/
/**
\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.
*/
/**
\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::GetAdcPeak(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 THcRawHit::ESignalType THcTrigRawHit::GetSignalType(Int_t signal)
\brief Returns the signal type.
\param[in] signal ADC or TDC.
*/
/**
\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::GetMultiplicity(Int_t signal)
\brief Gets the number of hits for this event.
\param[in] signal ADC or TDC.
*/
/**
\fn Bool_t THcTrigRawHit::HasMulti(Int_t signal)
\brief Checks if rich data is available.
\param[in] signal ADC or TDC.
*/
/**
\fn Bool_t THcTrigRawHit::HasReference(Int_t signal)
\brief Checks if reference time is available.
\param[in] signal ADC or TDC.
*/
// TODO: Check if signal matches plane.
#include
"THcTrigRawHit.h"
#include
<string>
#include
<stdexcept>
#include
"TObject.h"
#include
"TString.h"
THcTrigRawHit
::
THcTrigRawHit
(
Int_t
plane
,
Int_t
counter
)
:
THcRawHit
(
plane
,
counter
),
fAdcVal
(),
fTdcVal
(),
fNumAdcSamples
(
0
),
fNumTdcSamples
(
0
),
fAdcReferenceTime
(
0
),
fTdcReferenceTime
(
0
),
fHasAdcRef
(
kFALSE
),
fHasTdcRef
(
kFALSE
)
fAdc
(),
fAdcTime
(),
fAdcPedestal
(),
fAdcPeak
(),
fAdcSamples
(),
fTdc
(),
fReferenceTime
(),
fHasReference
(),
fHasMulti
(),
fNRawHits
(),
fNRawSamples
(
0
)
{}
...
...
@@ -28,16 +239,27 @@ THcTrigRawHit& THcTrigRawHit::operator=(const THcTrigRawHit& right) {
// Call base class assignment operator.
THcRawHit
::
operator
=
(
right
);
for
(
UInt_t
i
=
0
;
i
<
fNumAdcSamples
;
++
i
)
fAdcVal
[
i
]
=
right
.
fAdcVal
[
i
];
for
(
UInt_t
i
=
0
;
i
<
fNumTdcSamples
;
++
i
)
fTdcVal
[
i
]
=
right
.
fTdcVal
[
i
];
fNumAdcSamples
=
right
.
fNumAdcSamples
;
fNumTdcSamples
=
right
.
fNumTdcSamples
;
fAdcReferenceTime
=
right
.
fAdcReferenceTime
;
fTdcReferenceTime
=
right
.
fTdcReferenceTime
;
fHasAdcRef
=
right
.
fHasAdcRef
;
fHasTdcRef
=
right
.
fHasTdcRef
;
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
];
fAdcPeak
[
i
]
=
right
.
fAdcPeak
[
i
];
}
for
(
UInt_t
i
=
0
;
i
<
fMaxNSamplesAdc
;
++
i
)
{
fAdcSamples
[
i
]
=
right
.
fAdcSamples
[
i
];
}
for
(
UInt_t
i
=
0
;
i
<
fMaxNHitsTdc
;
++
i
)
{
fTdc
[
i
]
=
right
.
fTdc
[
i
];
}
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
;
}
...
...
@@ -47,69 +269,274 @@ THcTrigRawHit::~THcTrigRawHit() {}
void
THcTrigRawHit
::
Clear
(
Option_t
*
opt
)
{
fNumAdcSamples
=
0
;
fNumTdcSamples
=
0
;
fHasAdcRef
=
kFALSE
;
fHasTdcRef
=
kFALSE
;
TObject
::
Clear
(
opt
);
for
(
UInt_t
i
=
0
;
i
<
fNPlanes
;
++
i
)
{
fHasReference
[
i
]
=
kFALSE
;
fHasReference
[
i
]
=
kFALSE
;
fNRawHits
[
i
]
=
0
;
}
fNRawSamples
=
0
;
}
void
THcTrigRawHit
::
SetData
(
Int_t
signal
,
Int_t
data
)
{
// TODO: check if signal matches plane.
// Signal 0 is ADC.
// Signal 0 is ADC; signal 1 is TDC.
if
(
signal
==
0
)
{
if
(
fN
umAdcSamples
>=
fMaxAdcSamples
)
{
if
(
fN
RawHits
[
signal
]
>=
fMaxNPulsesAdc
)
{
throw
std
::
out_of_range
(
"`THcTrigRawHit::SetData`: too many
sampl
es for ADC signal!"
"`THcTrigRawHit::SetData`: too many
puls
es for ADC signal!"
);
}
fAdc
Val
[
fNumAdcSamples
]
=
data
;
++
fN
umAdcSamples
;
fAdc
[
fNRawHits
[
signal
]
]
=
data
;
++
fN
RawHits
[
signal
]
;
}
// Signal 1 is TDC.
else
if
(
signal
==
1
)
{
if
(
fN
umTdcSamples
>=
fMaxTdcSamples
)
{
if
(
fN
RawHits
[
signal
]
>=
fMaxNHitsTdc
)
{
throw
std
::
out_of_range
(
"`THcTrigRawHit::SetData`: too many
sample
s for TDC signal!"
"`THcTrigRawHit::SetData`: too many
hit
s for TDC signal!"
);
}
fTdc
Val
[
fNumTdcSamples
]
=
data
;
++
fN
umTdcSamples
;
fTdc
[
fNRawHits
[
signal
]
]
=
data
;
++
fN
RawHits
[
signal
]
;
}
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
::
SetReference
(
Int_t
signal
,
Int_t
reference
)
{
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
;
}
else
throw
std
::
out_of_range
(
"`THcTrigRawHit::SetSample`: only signal `0` (ADC) support samples!"
);
}
if
(
signal
==
0
)
fAdcReferenceTime
=
reference
;
else
if
(
signal
==
1
)
fTdcReferenceTime
=
reference
;
else
throw
std
::
out_of_range
(
"`THcTrigRawHit::SetReference`: only signals `0` and `1` available!"
);
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
;
fAdcPeak
[
fNRawHits
[
signal
]]
=
peak
;
fHasMulti
[
signal
]
=
kTRUE
;
++
fNRawHits
[
signal
];
}
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
||
signal
==
1
)
{
fReferenceTime
[
signal
]
=
reference
;
fHasReference
[
signal
]
=
kTRUE
;
}
else
{
throw
std
::
out_of_range
(
"`THcTrigRawHit::SetReference`: only signals `0` and `1` available!"
);
}
}
Int_t
THcTrigRawHit
::
GetData
(
Int_t
signal
)
{
// TODO: expand this. Maybe add new methods.
// For now only returns first value.
if
(
signal
==
0
)
return
fAdcVal
[
0
];
else
if
(
signal
==
1
)
return
fTdcVal
[
0
];
else
throw
std
::
out_of_range
(
"`THcTrigRawHit::GetData`: only signals `0` and `1` available!"
);
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
());
}
else
if
(
iHit
>=
fNRawHits
[
signal
]
&&
iHit
==
0
)
{
value
=
0
;
}
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
(
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
());
}
else
if
(
iHit
>=
fNRawHits
[
signal
]
&&
iHit
==
0
)
{
value
=
0
;
}
else
{
if
(
fHasMulti
[
0
])
value
=
fAdcPedestal
[
iHit
];
else
value
=
0
;
}
return
value
;
}
Int_t
THcTrigRawHit
::
GetAdcPeak
(
UInt_t
iHit
)
{
Int_t
value
=
0
;
Int_t
signal
=
0
;
if
(
iHit
>=
fNRawHits
[
signal
]
&&
iHit
!=
0
)
{
TString
msg
=
TString
::
Format
(
"`THcTrigRawHit::GetAdcPeak`: 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
;
}
else
{
if
(
fHasMulti
[
0
])
value
=
fAdcPeak
[
iHit
];
else
value
=
0
;
}
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
;
else
{
throw
std
::
out_of_range
(
"`THcTrigRawHit::GetSignalType`: only signals `0` and `1` available!"
);
}
}
Int_t
THcTrigRawHit
::
GetReference
(
Int_t
signal
)
{
// Reference time.
if
(
signal
==
0
)
return
fAdcReferenceTime
;
else
if
(
signal
==
1
)
return
fTdcReferenceTime
;
else
throw
std
::
out_of_range
(
"`THcTrigRawHit::GetReference`: only signals `0` and `1` available!"
);
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
::
GetMultiplicity
(
Int_t
signal
)
{
if
(
signal
==
0
||
signal
==
1
)
{
return
fNRawHits
[
signal
];
}
else
{
throw
std
::
out_of_range
(
"`THcTrigRawHit::GetMultiplicity`: only signals `0` and `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!"
);
}
}
Bool_t
THcTrigRawHit
::
HasReference
(
Int_t
signal
)
{
// Reference time.
if
(
signal
==
0
)
return
fHasAdcRef
;
else
if
(
signal
==
1
)
return
fHasTdcRef
;
else
throw
std
::
out_of_range
(
"`THcTrigRawHit::HasReference`: only signals `0` and `1` available!"
);
if
(
signal
==
0
||
signal
==
1
)
{
return
fHasReference
[
signal
];
}
else
{
throw
std
::
out_of_range
(
"`THcTrigRawHit::HasReference`: only signals `0` and `1` available!"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/THcTrigRawHit.h
+
37
−
13
View file @
e7ebcd0a
...
...
@@ -14,25 +14,49 @@ class THcTrigRawHit : public THcRawHit {
virtual
void
Clear
(
Option_t
*
opt
=
""
);
void
SetData
(
Int_t
signal
,
Int_t
data
);
void
SetSample
(
Int_t
signal
,
Int_t
data
);
void
SetDataTimePedestalPeak
(
Int_t
signal
,
Int_t
data
,
Int_t
time
,
Int_t
pedestal
,
Int_t
peak
);
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
GetAdcPeak
(
UInt_t
iHit
);
Int_t
GetNSignals
();
ESignalType
GetSignalType
(
Int_t
signal
);
Int_t
GetReference
(
Int_t
signal
);
Int_t
GetMultiplicity
(
Int_t
signal
);
Bool_t
HasMulti
(
Int_t
signal
);
Bool_t
HasReference
(
Int_t
signal
);
protected:
static
const
Int_t
fMaxAdcSamples
=
160
;
static
const
Int_t
fMaxTdcSamples
=
16
;
static
const
Int_t
fNumPlanes
=
2
;
Int_t
fAdcVal
[
fMaxAdcSamples
];
Int_t
fTdcVal
[
fMaxTdcSamples
];
UInt_t
fNumAdcSamples
;
UInt_t
fNumTdcSamples
;
Int_t
fAdcReferenceTime
;
Int_t
fTdcReferenceTime
;
Bool_t
fHasAdcRef
;
Bool_t
fHasTdcRef
;
static
const
Int_t
fMaxNPulsesAdc
=
4
;
static
const
Int_t
fMaxNSamplesAdc
=
160
;
static
const
Int_t
fMaxNHitsTdc
=
16
;
static
const
Int_t
fNPlanes
=
2
;
Int_t
fAdc
[
fMaxNPulsesAdc
];
Int_t
fAdcTime
[
fMaxNPulsesAdc
];
Int_t
fAdcPedestal
[
fMaxNPulsesAdc
];
Int_t
fAdcPeak
[
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
];
UInt_t
fNRawSamples
;
private:
ClassDef
(
THcTrigRawHit
,
0
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment