Hall A ROOT/C++ Analyzer (podd)
Loading...
Searching...
No Matches
THaADCHelicity.h
Go to the documentation of this file.
1#ifndef Podd_THaADCHelicity_h_
2#define Podd_THaADCHelicity_h_
3
5//
6// THaADCHelicity
7//
8// Helicity of the beam - from ADC
9//
11
12
13#include "THaHelicityDet.h"
14#include <vector>
15#include <stdexcept>
16
18
19public:
20
21 THaADCHelicity( const char* name, const char* description,
22 THaApparatus* a = nullptr );
23 virtual ~THaADCHelicity();
24
25 virtual void Clear( Option_t* opt = "" );
26 virtual Int_t Decode( const THaEvData& evdata );
27
30 fThreshold(0), fIgnoreGate(false), fInvertGate(false),
31 fNchan(0) {} // For ROOT I/O only
32
33protected:
34 // ADC data for helicity and gate
35 Double_t fADC_hdata; // Helicity ADC raw data
36 Double_t fADC_Gate; // Gate ADC raw data
37 EHelicity fADC_Hel; // Calculated beam helicity from ADC data
38
39 Double_t fThreshold; // Min ADC amplitude required for Hel = Plus
40 Bool_t fIgnoreGate; // Ignore the gate info and always assign helicity
41 Bool_t fInvertGate; // Invert polarity of gate signal, so that 0=active
42
43 // Simplified detector map for the two data channels
44 class ChanDef_t {
45 public:
46 ChanDef_t() : roc(-1), slot(-1), chan(-1) {}
47 ChanDef_t& operator=(const std::vector<int>& rhs) {
48 if( rhs.size() < 3 ) {
49 static const std::string
50 msg("Attempt to assign ChanDef_t with a vector of size < 3");
51 throw std::invalid_argument(msg);
52 }
53 if( rhs[0] < 0 || rhs[1] < 0 || rhs[3] < 0 ) {
54 static const std::string
55 msg("Illegal negative value for chan, slot or channel");
56 throw std::out_of_range(msg);
57 }
58 roc = rhs[0]; slot = rhs[1]; chan = rhs[3];
59 return *this;
60 }
61 UInt_t roc; // ROC to read out
62 UInt_t slot; // Slot of module
63 UInt_t chan; // Channel within module
64 };
65
66 ChanDef_t fAddr[2]; // Definitions of helicity and gate channels
67 UInt_t fNchan; // Number of channels to read out (1 or 2)
68
69 virtual Int_t DefineVariables( EMode mode = kDefine );
70 virtual Int_t ReadDatabase( const TDatime& date );
71
72 ClassDef(THaADCHelicity,1) // Beam helicity from ADC (in time)
73};
74
75#endif
76
#define kDefine
Definition BdataLoc.cxx:38
int Int_t
unsigned int UInt_t
bool Bool_t
double Double_t
const char Option_t
#define ClassDef(name, id)
char name[80]
ChanDef_t & operator=(const std::vector< int > &rhs)
Double_t fThreshold
virtual Int_t DefineVariables(EMode mode=kDefine)
virtual ~THaADCHelicity()
Double_t fADC_hdata
virtual Int_t ReadDatabase(const TDatime &date)
ChanDef_t fAddr[2]
virtual Int_t Decode(const THaEvData &evdata)
virtual void Clear(Option_t *opt="")
EHelicity fADC_Hel
TArc a