Hall A ROOT/C++ Analyzer (podd)
Loading...
Searching...
No Matches
FADCData.h
Go to the documentation of this file.
1
2//
3// HallA::FADCData
4//
5// Support for data from JLab FADC250 modules
6//
8
9#ifndef HALLA_FADCDATA_H
10#define HALLA_FADCDATA_H
11
12#include "DetectorData.h"
13#include "DataType.h" // for Data_t
14#include "OptionalType.h"
15#include "THaAnalysisObject.h" // for enums (EMode etc.)
16#include "THaDetMap.h"
17#include <memory>
18#include <utility>
19
20class TDatime;
21class THaDetectorBase;
22
23namespace HallA {
24
25//_____________________________________________________________________________
27public:
28 //TODO: init/clear to kBig?
29 FADCData_t() : fIntegral(0), fPeak(0), fT(0), fT_c(0),
30 fOverflow(0), fUnderflow(0), fPedq(0), fPedestal(0) {}
31 void clear() {
32 // FIXME: init some of these to kBig?
33 fIntegral = fPeak = fT = fT_c = fPedestal = 0.0;
35 }
36 Data_t fIntegral; // ADC peak integral
37 Data_t fPeak; // ADC peak value
38 Data_t fT; // TDC time (channels)
39 Data_t fT_c; // Offset-corrected TDC time (s)
40 UInt_t fOverflow; // FADC overflow bit
41 UInt_t fUnderflow; // FADC underflow bit
42 UInt_t fPedq; // FADC pedestal quality bit
43 Data_t fPedestal; // Extracted pedestal value
44};
45
46// Calibration
47static const Data_t kDefaultTDCscale = 0.0625;
49public:
50 FADCConfig_t() : nped(1), nsa(1), nsb(1), win(1), tflag(true),
52 void reset() {
53 nped = nsa = nsb = win = 1;
54 tflag = true;
56 }
57 Int_t nped; // Number of samples included in FADC pedestal sum
58 Int_t nsa; // Number of integrated samples after threshold crossing
59 Int_t nsb; // Number of integrated samples before threshold crossing
60 Int_t win; // Total number of samples in FADC window
61 Bool_t tflag; // If true, threshold on
62 Data_t tdcscale; // TDC scaling factor
63};
64
65//_____________________________________________________________________________
67public:
68 FADCData( const char* name, const char* desc, Int_t nelem );
69
70 static OptUInt_t LoadFADCData( const DigitizerHitInfo_t& hitinfo );
71 Int_t StoreHit( const DigitizerHitInfo_t& hitinfo, UInt_t data ) override;
72
73 void Clear( Option_t* ="" ) override;
74 void Reset( Option_t* ="" ) override;
75
76 UInt_t GetSize() const override { return fFADCData.size(); }
78#ifdef NDEBUG
79 FADCData_t& GetData( size_t i ) { return fFADCData[i]; }
80#else
81 FADCData_t& GetData( size_t i ) { return fFADCData.at(i); }
82#endif
84 { return GetData(GetLogicalChannel(hitinfo)); }
85
86 Int_t ReadConfig( FILE* file, const TDatime& date, const char* prefix );
87
88protected:
89 // Configuration for this module or group of modules
90 FADCConfig_t fConfig; // FADC configuration parameters
91
92 // Per-event data
93 std::vector<FADCData_t> fFADCData; // FADC per-event readout data
94
97 const char* key_prefix = "",
98 const char* comment_subst = "" ) override;
99
100 ClassDef(FADCData,1) // FADC raw data
101};
102
103//_____________________________________________________________________________
104// Create and initialize an FADCData object to be used with detector 'det'
105std::pair<std::unique_ptr<FADCData>, Int_t>
106MakeFADCData( const TDatime& date, THaDetectorBase* det );
107
108//_____________________________________________________________________________
109} // namespace HallA
110
111#endif //HALLA_FADCDATA_H
int Int_t
unsigned int UInt_t
Double_t Data_t
Definition DataType.h:13
bool Bool_t
const char Option_t
#define ClassDef(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
char name[80]
UInt_t fUnderflow
Definition FADCData.h:41
Int_t StoreHit(const DigitizerHitInfo_t &hitinfo, UInt_t data) override
Definition FADCData.cxx:138
FADCData_t & GetData(const DigitizerHitInfo_t &hitinfo)
Definition FADCData.h:83
Int_t ReadConfig(FILE *file, const TDatime &date, const char *prefix)
Definition FADCData.cxx:88
FADCConfig_t fConfig
Definition FADCData.h:90
static OptUInt_t LoadFADCData(const DigitizerHitInfo_t &hitinfo)
Definition FADCData.cxx:125
FADCData_t & GetData(size_t i)
Definition FADCData.h:81
UInt_t GetSize() const override
Definition FADCData.h:76
void Clear(Option_t *="") override
Definition FADCData.cxx:67
void Reset(Option_t *="") override
Definition FADCData.cxx:79
std::vector< FADCData_t > fFADCData
Definition FADCData.h:93
FADCConfig_t & GetConfig()
Definition FADCData.h:77
Int_t DefineVariablesImpl(THaAnalysisObject::EMode mode=THaAnalysisObject::kDefine, const char *key_prefix="", const char *comment_subst="") override
Definition FADCData.cxx:204
virtual Int_t GetLogicalChannel(const DigitizerHitInfo_t &hitinfo) const
pair< unique_ptr< FADCData >, Int_t > MakeFADCData(const TDatime &date, THaDetectorBase *det)
Definition FADCData.cxx:27
static const Data_t kDefaultTDCscale
Definition FADCData.h:47