Hall A ROOT/C++ Analyzer (podd)
Loading...
Searching...
No Matches
TrigBitLoc.cxx
Go to the documentation of this file.
1
2//
3// TrigBitLoc
4//
5// Plugin for DecData generic raw data decoder to process Hall A
6// trigger bits
7//
9
10#include "TrigBitLoc.h"
11#include "THaEvData.h"
12#include "TObjArray.h"
13
14using namespace std;
15
17 DoRegister( BdataLocType( "TrigBitLoc", "bit", 6 ));
18
19//_____________________________________________________________________________
21{
22 // Initialize CrateLoc from given parameters
23
24 // Load name, crate, slot, channel
25 Int_t ret = CrateLocMulti::Configure( params, start );
26 if( ret )
27 return ret;
28
29 // Additional parameters: lower and upper TDC cuts
30 cutlo = GetString( params, start+4 ).Atoi();
31 cuthi = GetString( params, start+5 ).Atoi();
32
33 // The bit number is determined from any trailing digits of the name,
34 // which must be in the range 0-31
35 assert( fName.Length() > 0 ); // else bug in base class Configure()
36 Int_t pos = fName.Length()-1, end = pos;
37 TString e;
38 do {
39 e = fName(pos);
40 } while( e.IsDigit() && pos-- > 0 );
41 if( pos == end ) { // No digits at the end of the name
42 Error( "TrigBitLoc", "Name of trigger bit variable %s must end with bit "
43 "number (0-31). Example: \"bit12\". Fix database.", GetName() );
44 return 50;
45 }
46 e = fName(pos+1,end-pos);
47 Int_t val = e.Atoi();
48 if( val < 0 || val > 31 ) {
49 Error( "TrigBitLoc", "Illegal bit number %d in trigger bit name %s. "
50 "Must be 0-31. Fix database.", val, GetName() );
51 return 50;
52 }
53 bitnum = val;
54
55 return 0;
56}
57
58//_____________________________________________________________________________
60{
61 // Define the global variable for trigger bit test result. This result is
62 // stored in the "data" member of the base class, not in the rdata array, so
63 // here we just do what the base class does.
64
66}
67
68//_____________________________________________________________________________
69void TrigBitLoc::Load( const THaEvData& evdata )
70{
71 // Test hit(s) in our TDC channel for a valid trigger bit and set results
72
73 // Read hit(s) from defined multihit TDC channel
74 CrateLocMulti::Load( evdata );
75
76 // Figure out which triggers got a hit. These are multihit TDCs, so we
77 // need to sort out which hit we want to take by applying cuts.
78 for( UInt_t ihit = 0; ihit < NumHits(); ++ihit ) {
79 if( Get(ihit) > cutlo && Get(ihit) < cuthi ) {
80 data = 1;
81 if( bitloc )
82 *bitloc |= BIT(bitnum);
83 break;
84 }
85 }
86}
87
88//_____________________________________________________________________________
90{
91 // TrigBitLoc uses the optional pointer to set the 'bitloc' address
92
93 bitloc = static_cast<UInt_t*>(ptr);
94 return 0;
95}
96
97//_____________________________________________________________________________
98void TrigBitLoc::Print( Option_t* opt ) const
99{
100 // Print name and all data values
101
103 TString option(opt);
104 if( option.Contains("FULL") ) {
105 cout << "\t cutlo/cuthi = " << cutlo << "/" << cuthi;
106 }
107 PrintMultiData(opt);
108 cout << endl;
109}
110
111//_____________________________________________________________________________
int Int_t
unsigned int UInt_t
#define e(i)
const char Option_t
#define BIT(n)
Option_t Option_t option
Option_t Option_t TPoint TPoint const char mode
TypeSet_t::iterator TypeIter_t
Definition BdataLoc.h:40
static TString & GetString(const TObjArray *params, Int_t pos)
Definition BdataLoc.h:74
UInt_t data
Definition BdataLoc.h:83
virtual Int_t Configure(const TObjArray *params, Int_t start=0)
Definition BdataLoc.cxx:101
virtual Int_t DefineVariables(EMode mode=THaAnalysisObject::kDefine)
Definition BdataLoc.cxx:57
virtual UInt_t Get(UInt_t i=0) const
Definition BdataLoc.h:138
virtual UInt_t NumHits() const
Definition BdataLoc.h:137
void PrintMultiData(Option_t *opt="") const
Definition BdataLoc.cxx:258
virtual void Load(const THaEvData &evt)
Definition BdataLoc.cxx:247
void PrintCrateLocHeader(Option_t *opt="") const
Definition BdataLoc.cxx:204
const char * GetName() const override
TString fName
virtual void Error(const char *method, const char *msgfmt,...) const
Ssiz_t Length() const
Int_t Atoi() const
virtual void Load(const THaEvData &evt)
UInt_t cuthi
Definition TrigBitLoc.h:35
UInt_t bitnum
Definition TrigBitLoc.h:34
virtual void Print(Option_t *opt="") const
UInt_t cutlo
Definition TrigBitLoc.h:35
virtual Int_t Configure(const TObjArray *params, Int_t start=0)
UInt_t * bitloc
Definition TrigBitLoc.h:36
virtual Int_t OptionPtr(void *ptr)
virtual Int_t DefineVariables(EMode mode=THaAnalysisObject::kDefine)
static TypeIter_t fgThisType
Definition TrigBitLoc.h:39
start
end
STL namespace.
ClassImp(TPyArg)