Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Df250BORConfig.h
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: Df250BORConfig.h
4 // Created: Tue Jan 26 13:04:46 EST 2016
5 // Creator: davidl (on Darwin harriet.jlab.org 13.4.0 i386)
6 //
7 
8 #ifndef _Df250BORConfig_
9 #define _Df250BORConfig_
10 
11 #include <JANA/JObject.h>
12 
13 #include <DAQ/bor_roc.h>
14 
15 // This class inherits both from JObject and f250config. The former
16 // so that it can be incorporated easily into the JANA framework.
17 // The latter so we can use the data struct defined in bor_roc.h.
18 // The file bor_roc.h exists in 2 places:
19 //
20 // 1. in the DAQ library of sim-recon
21 // 2. in the vme/src/rcm/monitor directory in the online
22 //
23 
24 
25 class Df250BORConfig:public jana::JObject, public f250config{
26  public:
28 
30  virtual ~Df250BORConfig(){}
31 
32  uint32_t NSA; // extracted from adc_nsa
33  uint32_t NSA_trig; // extracted from adc_nsa
34  int32_t NSB; // extracted from adc_nsb
35  uint32_t NPED; // extracted from config7
36  uint32_t MaxPed; // extracted from config7
37  uint32_t NSAT; // extracted from adc_config[0]
38 
39  /// Extract values as read from config registers
40  /// and fill in the derived members defined above.
41  /// This is called from DEVIOWorkerThread::ParseBORbank
42  void FillDerived(void){
43 
44  NSA = (adc_nsa>> 0) & 0x1FF;
45  NSA_trig = (adc_nsa>> 9) & 0x3F;
46  NSB = (adc_nsb>> 0) & 0x07;
47  if(adc_nsb&0x08) NSB = -NSB;
48  NPED = ((config7>>10) & 0xF) +1;
49  MaxPed = (config7>> 0) & 0x3FF;
50  NSAT = ((adc_config[0]>>10)&0x3) + 1;
51  }
52 
53  // This method is used primarily for pretty printing
54  // the second argument to AddString is printf style format
55  void toStrings(vector<pair<string,string> > &items)const{
56  AddString(items, "rocid" , "%d", rocid);
57  AddString(items, "slot" , "%d", slot);
58  AddString(items, "version" , "0x%x", version);
59  AddString(items, "ctrl1" , "0x%x", ctrl1);
60  AddString(items, "ctrl2" , "0x%x", ctrl2);
61  AddString(items, "blk_level" , "%d", blk_level);
62  AddString(items, "ptw" , "%d", adc_ptw);
63  AddString(items, "pl" , "%d", adc_pl);
64  AddString(items, "NSB" , "%d", NSB);
65  AddString(items, "NSA" , "%d", NSA);
66  AddString(items, "NSA_trig" , "%d", NSA_trig);
67  AddString(items, "NPED" , "%d", NPED);
68  AddString(items, "MaxPed" , "%d", MaxPed);
69  AddString(items, "NSAT" , "%d", NSAT);
70  }
71 
72 };
73 
74 #endif // _Df250BORConfig_
uint32_t version
Definition: bor_roc.h:75
virtual ~Df250BORConfig()
uint32_t config7
Definition: bor_roc.h:94
void FillDerived(void)
Extract values as read from config registers and fill in the derived members defined above...
uint32_t blk_level
Definition: bor_roc.h:78
uint32_t adc_ptw
Definition: bor_roc.h:87
uint32_t ctrl1
Definition: bor_roc.h:76
uint32_t adc_config[4]
Definition: bor_roc.h:86
uint32_t slot
Definition: bor_roc.h:71
uint32_t adc_pl
Definition: bor_roc.h:88
uint32_t adc_nsa
Definition: bor_roc.h:90
void toStrings(vector< pair< string, string > > &items) const
uint32_t adc_nsb
Definition: bor_roc.h:89
uint32_t rocid
Definition: bor_roc.h:70
uint32_t NSA_trig
JOBJECT_PUBLIC(Df250BORConfig)
uint32_t ctrl2
Definition: bor_roc.h:77