Hall A ROOT/C++ Analyzer (podd)
Loading...
Searching...
No Matches
FadcShower.cxx
Go to the documentation of this file.
1
2// //
3// HallA::FadcShower //
4// Generic shower detector with FADC frontends //
5// //
7
8#include "FadcShower.h"
9#include "FADCData.h"
10#include "THaDetMap.h"
11#include "THaEvData.h"
12
13using namespace std;
14
15namespace HallA {
16
17//_____________________________________________________________________________
18FadcShower::FadcShower( const char* name, const char* description,
19 THaApparatus* a )
20 : THaShower(name, description, a), fFADCData(nullptr)
21{
22 // Constructor
23}
24
25//_____________________________________________________________________________
26FadcShower::FadcShower() : THaShower(), fFADCData(nullptr)
27{
28 // Default constructor (for ROOT RTTI)
29}
30
31//_____________________________________________________________________________
33{
34 // Destructor. Remove variables from global list.
35
37}
38
39//_____________________________________________________________________________
41{
43 if( ret )
44 return ret;
45
47}
48
49//_____________________________________________________________________________
51{
52 // Read this detector's parameters from the database
53
55 if( err )
56 return err;
57
58 // Set up a new FADC object, initialized from the database
59 auto ret = MakeFADCData(date, this);
60 if( ret.second )
61 return ret.second;
62
63 // Keep a pointer for convenient access
64 fFADCData = ret.first.get();
65
66 // Move data object into the detector data array
67 fDetectorData.emplace_back(std::move(ret.first));
68
69 return kOK;
70}
71
72//_____________________________________________________________________________
74 const DigitizerHitInfo_t& hitinfo )
75{
76 // Callback from Decoder for loading the data for the 'hitinfo' channel.
77 // This routine supports FADC modules and returns the pulse amplitude integral.
78 // Additional info is retrieved from the FADC modules in StoreHit later.
79
81 return FADCData::LoadFADCData(hitinfo);
82
83 // Fallback for legacy modules not recognized above.
84 return THaShower::LoadData(evdata, hitinfo);
85}
86
87//_____________________________________________________________________________
89{
90 // Put decoded frontend data into fDetectorData. Called from Decode().
91
92 // Call StoreHit for the FADC modules first to get updated pedestals
93 fFADCData->StoreHit(hitinfo, data);
94 const auto& FDAT = fFADCData->GetData(hitinfo);
95 if( FDAT.fPedq == 0 )
96 fADCData->GetCalib(hitinfo).ped = FDAT.fPedestal;
97
98 // Now fill the PMTData in fDetectorData
99 return THaShower::StoreHit(hitinfo, data);
100}
101
102} // namespace HallA
103
104//_____________________________________________________________________________
#define kOK
Definition BdataLoc.cxx:40
int Int_t
unsigned int UInt_t
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char mode
char name[80]
Int_t StoreHit(const DigitizerHitInfo_t &hitinfo, UInt_t data) override
Definition FADCData.cxx:138
static OptUInt_t LoadFADCData(const DigitizerHitInfo_t &hitinfo)
Definition FADCData.cxx:125
FADCData_t & GetData(size_t i)
Definition FADCData.h:81
Int_t DefineVariables(EMode mode=kDefine) override
FADCData * fFADCData
Definition FadcShower.h:32
OptUInt_t LoadData(const THaEvData &evdata, const DigitizerHitInfo_t &hitinfo) override
Int_t StoreHit(const DigitizerHitInfo_t &hitinfo, UInt_t data) override
Int_t ReadDatabase(const TDatime &date) override
~FadcShower() override
ADCCalib_t & GetCalib(size_t i)
Int_t DefineVariables(THaAnalysisObject::EMode mode=THaAnalysisObject::kDefine, const char *key_prefix="", const char *comment_subst="")
Decoder::Module *Decoder::ChannelType type
Definition THaDetMap.h:197
virtual OptUInt_t LoadData(const THaEvData &evdata, const DigitizerHitInfo_t &hitinfo)
VecDetData_t fDetectorData
virtual Int_t StoreHit(const DigitizerHitInfo_t &hitinfo, UInt_t data)
virtual Int_t DefineVariables(EMode mode=kDefine)
ShowerADCData * fADCData
Definition THaShower.h:78
virtual Int_t ReadDatabase(const TDatime &date)
Definition THaShower.cxx:59
pair< unique_ptr< FADCData >, Int_t > MakeFADCData(const TDatime &date, THaDetectorBase *det)
Definition FADCData.cxx:27
STL namespace.
TArc a
ClassImp(TPyArg)