Hall A ROOT/C++ Analyzer (podd)
Loading...
Searching...
No Matches
CodaRawDecoder.cxx
Go to the documentation of this file.
1
2//
3// Podd::CodaRawDecoder
4//
5// Version of Decoder::CodaDecoder raw event data decoder that
6// exports Podd global variables for basic event data
7//
8// Ole Hansen, August 2018
9//
11
12#include "CodaRawDecoder.h"
13#include "THaAnalysisObject.h"
14#include "THaVarList.h"
15#include "THaGlobals.h"
16
17using namespace std;
18
19namespace Podd {
20
21//_____________________________________________________________________________
23{
24 const char* const here = "CodaRawDecoder::CodaRawDecoder";
25
26 // Register standard global variables for event header data
27 if( gHaVars ) {
28 VarDef vars[] = {
29 { "runnum", "Run number", kUInt, 0, &run_num },
30 { "runtype", "CODA run type", kUInt, 0, &run_type },
31 { "runtime", "CODA run time", kULong, 0, &fRunTime },
32 { "evnum", "Event number", kUInt, 0, &event_num },
33 { "evtyp", "Event type", kUInt, 0, &event_type },
34 { "evlen", "Event length", kUInt, 0, &event_length },
35 { "evtime", "Event time", kULong, 0, &evt_time },
36 { "datatype", "Data type", kUInt, 0, &data_type },
37 { "trigbits", "Trigger bits", kUInt, 0, &trigger_bits },
38 { nullptr }
39 };
40 TString prefix("g");
41 // Prevent global variable clash if there are several instances of us
42 if( fInstance > 1 )
43 prefix.Append(Form("%d",fInstance));
44 prefix.Append(".");
45 gHaVars->DefineVariables( vars, prefix, here );
46 } else
47 Warning(here,"No global variable list found. Variables not registered.");
48}
49
50//_____________________________________________________________________________
52{
53 // Destructor. Unregister global variables
54
55 if( gHaVars ) {
56 TString prefix("g");
57 if( fInstance > 1 )
58 prefix.Append(Form("%d",fInstance));
59 prefix.Append(".*");
60 gHaVars->RemoveRegexp( prefix );
61 }
62}
63
64//_____________________________________________________________________________
65
66} // namespace Podd
67
R__EXTERN class THaVarList * gHaVars
Definition THaGlobals.h:11
static const char *const here
Definition THaVar.cxx:64
char * Form(const char *fmt,...)
UInt_t data_type
Definition THaEvData.h:207
UInt_t run_num
Definition THaEvData.h:206
UInt_t run_type
Definition THaEvData.h:207
ULong64_t fRunTime
Definition THaEvData.h:209
UInt_t event_type
Definition THaEvData.h:206
ULong64_t evt_time
Definition THaEvData.h:210
UInt_t fInstance
Definition THaEvData.h:218
UInt_t trigger_bits
Definition THaEvData.h:207
UInt_t event_length
Definition THaEvData.h:206
UInt_t event_num
Definition THaEvData.h:206
virtual Int_t RemoveRegexp(const char *expr, Bool_t wildcard=true)
virtual Int_t DefineVariables(const VarDef *list, const char *prefix="", const char *caller="")
virtual void Warning(const char *method, const char *msgfmt,...) const
TString & Append(char c, Ssiz_t rep=1)
STL namespace.
ClassImp(TPyArg)