Berkeley Nuclear Data Software
DigiState.h
Go to the documentation of this file.
1 //include gaurd
2 #ifndef _DIGI_STATE_H_
3 #define _DIGI_STATE_H_
4 
5 #include "CAENDigitizer.h"
6 #include "CAENDigitizerType.h"
7 
8 #include <map>
9 #include <vector>
10 class DigiState
11 {
12 public:
13  DigiState();
14 
15  int connect();
16  int disconnect();
17  int setConInfo(CAEN_DGTZ_ConnectionType a_linkType,
18  uint32_t a_vmeAddress=0,
19  int a_linkNum = 0,
20  int a_connetNode = 0
21  );
22  int startAcquisition();
23  int stopAcquisition();
24  int getAndPrintTemps();
26 
27 
34  int setDPPAcquisitionMode(CAEN_DGTZ_DPP_AcqMode_t a_DPP_AcqMode);
38  int setChannelRecordLength(uint32_t a_length,int a_ch);
39 
42  int setDCOffset(int a_ch,
43  uint32_t a_DCOffset
44  );
46  int setPreTrigSize(int a_ch,
47  uint32_t a_preTrigSize
48  );
50  int setPosPolarity(int a_ch,
51  bool a_posPolarity
52  );
53 
54  int allChOff();
55 
56  int setChStatus(int a_ch,
57  bool a_onOff
58  );
59  int readoutBoard();
62  int fetchReadoutChunk(int a_ch,
63  std::vector<int16_t>& a_chargeShort,
64  std::vector<int16_t>& a_chargeLong,
65  std::vector<uint32_t>& a_extras,
66  std::vector<uint32_t>& a_timeTag,
67  std::vector<uint16_t>& a_wfData
68  );
70  int clearData();
71  //change from default setting for dpp parameter data structure see
72  //DigitizerType.h line 1225
73  int setThreshold(int a_ch,int a_thr );
74  int setSelfTrigger(int a_ch,int a_selft);
75  int setChargeSensitivity(int a_ch,int a_csens);
76  int setShortGate(int a_ch,int a_sgate);
77  int setLongGate(int a_ch,int a_lgate);
78  int setPreGateWidth(int a_ch,int a_pgate);
79  int setTrigValWin(int a_ch,int a_tvaw );
80  int setNumBaseSample(int a_ch,int a_nsbl);
81  //cfd = 1; led = 0;
82  int setDiscrMode(int a_ch,int a_discr);
83  /*CFD fraction: 0->25%; 1->50%; 2->75%; 3->100% */
84  int setCFDFrac (int a_ch,int a_cfdf );
85  /*CFD delay (N*2ns for x730 and N*4ns for x725) */
86  int setCFDDelay (int a_ch,int a_cfdd );
88  int writeGenericRegister(uint32_t a_dppReg,uint32_t a_dppRegVal);
89 
90  int writeRegisterWithMask(uint32_t a_dppReg,
91  uint32_t a_dppRegVal,
92  uint32_t a_mask
93  );
95  std::vector<CAEN_DGTZ_DPP_PSD_Event_t> getStoredEvents(int a_ch);
96  ~DigiState();
97 private:
99  int setupDefaultDPPPSDParams();
101  int programDigitizer();
103  int setupDPPPSDEventStrucutures();
105  int deleteDPPPSDEventStrucutures();
106 
107  int tempStabilizationLoop();
108 
112  std::map<int, std::vector<CAEN_DGTZ_DPP_PSD_Event_t> > m_eventInfo;
113  std::map<int,std::vector<uint16_t> > m_waveforms;
114  //flags for identifying state
115  bool m_conAtmptd;
116  bool m_connected;
117  bool m_conInfo;
118  bool m_programmed;
119  bool m_memoryAllocated;
120  bool m_isRunning;
121  bool m_incExtras;
122  //for keeping track of connection info
123  int m_handle;
124  int m_linkNum;
125  int m_connetNode;
126  uint32_t m_vmeAddress;
128  char* m_buffer;
130  uint32_t m_recordLength;
132  std::map<uint8_t,uint32_t> m_chRecordLength;
133 
134  std::map<uint8_t, uint32_t> m_DCOffset;
135 
136  std::map<uint8_t, uint32_t> m_preTrigSize;
137 
138  std::map<uint8_t, CAEN_DGTZ_PulsePolarity_t> m_posPolarity;
140  uint32_t m_channelMask;
142  int m_eventAggr;
143  // std::map<uint32_t,uint32_t> m_genericRegisterWrites;
144  std::vector<std::pair<uint32_t,uint32_t > > m_genericRegisterWrites;
145 
147  CAEN_DGTZ_ConnectionType m_ConnectionType;
148  CAEN_DGTZ_BoardModel_t m_BoardModel;
149  CAEN_DGTZ_DPP_PSD_Event_t** m_DPP_PSD_Event;
150  CAEN_DGTZ_DPP_PSD_Params_t m_DPP_PSD_Params;
151  CAEN_DGTZ_PulsePolarity_t m_PulsePolarity;
152  CAEN_DGTZ_AcquisitionMode_t m_AcquisitionMode;
153  CAEN_DGTZ_BoardInfo_t m_BoardInfo;
154  CAEN_DGTZ_DPP_PSD_Waveforms_t* m_DPP_PSD_Waveforms;
155  CAEN_DGTZ_DPPFirmware_t m_DPPFirmware;
156  CAEN_DGTZ_IOLevel_t m_IOLevel;
157  CAEN_DGTZ_TriggerMode_t m_extTriggerMode;
158  //any reason to only write out time or energy?
159  CAEN_DGTZ_DPP_SaveParam_t m_DPP_SaveParam;
160  CAEN_DGTZ_DPP_AcqMode_t m_DPP_AcqMode;
161  CAEN_DGTZ_AcqMode_t m_DGTZ_AcqMode;
162  CAEN_DGTZ_RunSyncMode_t m_RunSyncMode;
163  //not currently used
164  /*
165  CAEN_DGTZ_BoardFormFactor_t m_BoardFormFactor;
166  CAEN_DGTZ_BoardFamilyCode_t m_BoardFamilyCode;
167  CAEN_DGTZ_DPP_PARAMETER_t m_DPP_PARAMETER;
168  CAEN_DGTZ_FrontPanelIOModes m_FrontPanelIOModes;
169  CAEN_DGTZ_OutputSignalMode_t m_OutputSignalMode;
170  CAEN_DGTZ_ZS_Mode_t m_ZS_Mode;
171  CAEN_DGTZ_EnaDis_t m_EnaDis;
172  CAEN_DGTZ_IRQState_t m_IRQState;
173  CAEN_DGTZ_ReadMode_t m_ReadMode;
174  CAEN_DGTZ_DPP_AcqMode_t m_DPP_AcqMode;
175  CAEN_DGTZ_DPP_CI_GPO_SEL_t m_DPP_CI_GPO_SEL;
176  CAEN_DGTZ_DPP_Channel_t m_DPP_Channel;
177  // CAEN_DGTZ_DPP_VirtualProbe_t m_DPP_VirtualProbe;
178  // CAEN_DGTZ_DPP_PHA_DigitalProbe_t m_DPP_PHA_DigitalProbe;
179  // CAEN_DGTZ_DPP_PHA_VirtualProbe1_t m_DPP_PHA_VirtualProbe1;
180  // CAEN_DGTZ_DPP_PHA_VirtualProbe2_t m_DPP_PHA_VirtualProbe2;
181  // CAEN_DGTZ_DPP_CI_VirtualProbe_t m_DPP_CI_VirtualProbe;
182  // CAEN_DGTZ_DPP_CI_DigitalProbe1_t m_DPP_CI_DigitalProbe1;
183  // CAEN_DGTZ_DPP_CI_DigitalProbe2_t m_DPP_CI_DigitalProbe2;
184  // CAEN_DGTZ_DPP_PSD_VirtualProbe_t m_DPP_PSD_VirtualProbe;
185  // CAEN_DGTZ_DPP_PSD_DigitalProbe1_t m_DPP_PSD_DigitalProbe1;
186  // CAEN_DGTZ_DPP_PSD_DigitalProbe2_t m_DPP_PSD_DigitalProbe2;
187 
188 
189 
190  CAEN_DGTZ_DRS4Frequency_t m_DRS4Frequency;
191  CAEN_DGTZ_SAMFrequency_t m_SAMFrequency;
192  CAEN_DGTZ_TriggerPolarity_t m_TriggerPolarity;
193  CAEN_DGTZ_SAMPulseSourceType_t m_SAMPulseSourceType;
194  CAEN_DGTZ_TrigerLogic_t m_TrigerLogic;
195  CAEN_DGTZ_EventInfo_t m_EventInfo;
196  CAEN_DGTZ_X742_GROUP_t m_X742_GROUP;
197  CAEN_DGTZ_X743_GROUP_t m_X743_GROUP;
198  CAEN_DGTZ_UINT16_EVENT_t m_UINT16_EVENT;
199  CAEN_DGTZ_UINT8_EVENT_t m_UINT8_EVENT;
200  CAEN_DGTZ_X742_EVENT_t m_X742_EVENT;
201  CAEN_DGTZ_X743_EVENT_t m_X743_EVENT;
202  CAEN_DGTZ_DPP_PHA_Event_t m_DPP_PHA_Event;
203  CAEN_DGTZ_DPP_CI_Event_t m_DPP_CI_Event;
204  CAEN_DGTZ_DPP_QDC_Event_t m_DPP_QDC_Event;
205  CAEN_DGTZ_751_ZLE_Event_t m_751_ZLE_Event;
206  CAEN_DGTZ_730_ZLE_Waveforms_t m_730_ZLE_Waveforms;
207  CAEN_DGTZ_730_ZLE_Channel_t m_730_ZLE_Channel;
208  CAEN_DGTZ_730_ZLE_Event_t m_730_ZLE_Event;
209  CAEN_DGTZ_730_DAW_Waveforms_t m_730_DAW_Waveforms;
210  CAEN_DGTZ_730_DAW_Channel_t m_730_DAW_Channel;
211  CAEN_DGTZ_730_DAW_Event_t m_730_DAW_Event;
212  CAEN_DGTZ_DPP_X743_Event_t m_DPP_X743_Event;
213  CAEN_DGTZ_DPP_PHA_Waveforms_t m_DPP_PHA_Waveforms;
214  CAEN_DGTZ_751_ZLE_Waveforms_t m_751_ZLE_Waveforms;
215  CAEN_DGTZ_DPP_QDC_Waveforms_t m_DPP_QDC_Waveforms;
216  CAEN_DGTZ_DPP_PUR_t m_DPP_PUR;
217  CAEN_DGTZ_DPP_Discrimination_t m_DPP_Discrimination;
218  CAEN_DGTZ_DPP_TriggerMode_t m_DPP_TriggerMode;
219  //doesn't seem to be in implementation of Digitizer.h? Depricated?
220  // CAEN_DGTZ_DPP_TriggerConfig_t m_DPP_TriggerConfig;
221  CAEN_DGTZ_DPP_PHA_Params_t m_DPP_PHA_Params;
222  CAEN_DGTZ_DPP_CI_Params_t m_DPP_CI_Params;
223  CAEN_DGTZ_751_ZLE_Params_t m_751_ZLE_Params;
224  CAEN_DGTZ_DPP_X743_Params_t m_DPP_X743_Params;
225  CAEN_DGTZ_DPP_QDC_Params_t m_DPP_QDC_Params;
226  CAEN_DGTZ_DRS4Correction_t m_DRS4Correction;
227  CAEN_DGTZ_SAMCorrection_t m_SAMCorrection;
228  CAEN_DGTZ_SAM_CORRECTION_LEVEL_t m_SAM_CORRECTION_LEVEL;
229  */
230 };
231 
232 #endif
Definition: DigiState.h:11
int setConInfo(CAEN_DGTZ_ConnectionType a_linkType, uint32_t a_vmeAddress=0, int a_linkNum=0, int a_connetNode=0)
Definition: DigiState.cpp:131
int startAcquisition()
Definition: DigiState.cpp:220
int setShortGate(int a_ch, int a_sgate)
Definition: DigiState.cpp:573
int writeGenericRegister(uint32_t a_dppReg, uint32_t a_dppRegVal)
used to set generic registers in the DPP psd firmware
Definition: DigiState.cpp:760
int connect()
Definition: DigiState.cpp:37
int testSoftTriggeredReadout()
Definition: DigiState.cpp:265
int writeRegisterWithMask(uint32_t a_dppReg, uint32_t a_dppRegVal, uint32_t a_mask)
Definition: DigiState.cpp:774
int setPosPolarity(int a_ch, bool a_posPolarity)
set the polarity of the aniticipated pulses 0 = negative
Definition: DigiState.cpp:392
int setDCOffset(int a_ch, uint32_t a_DCOffset)
Definition: DigiState.cpp:333
int setTrigValWin(int a_ch, int a_tvaw)
Definition: DigiState.cpp:642
int setPreTrigSize(int a_ch, uint32_t a_preTrigSize)
set the number of samples before the trigger
Definition: DigiState.cpp:365
int stopAcquisition()
Definition: DigiState.cpp:247
int allChOff()
Definition: DigiState.cpp:428
int setThreshold(int a_ch, int a_thr)
Definition: DigiState.cpp:504
int setSelfTrigger(int a_ch, int a_selft)
Definition: DigiState.cpp:527
int getAndPrintTemps()
Definition: DigiState.cpp:1249
int setChargeSensitivity(int a_ch, int a_csens)
Definition: DigiState.cpp:550
int setPreGateWidth(int a_ch, int a_pgate)
Definition: DigiState.cpp:619
int setChannelRecordLength(uint32_t a_length, int a_ch)
Definition: DigiState.cpp:312
int setDPPAcquisitionMode(CAEN_DGTZ_DPP_AcqMode_t a_DPP_AcqMode)
Definition: DigiState.cpp:303
int setCFDFrac(int a_ch, int a_cfdf)
Definition: DigiState.cpp:713
DigiState()
Definition: DigiState.cpp:11
int disconnect()
Definition: DigiState.cpp:149
std::vector< CAEN_DGTZ_DPP_PSD_Event_t > getStoredEvents(int a_ch)
this returns channel independent collection of CAEN_DGTZ_DPP_PSD_Event_t
Definition: DigiState.cpp:813
int clearData()
this function dumps the internal arrays storing events and waveforms
Definition: DigiState.cpp:488
int setDiscrMode(int a_ch, int a_discr)
Definition: DigiState.cpp:689
int setNumBaseSample(int a_ch, int a_nsbl)
Definition: DigiState.cpp:665
int readoutBoard()
Definition: DigiState.cpp:1177
int setLongGate(int a_ch, int a_lgate)
Definition: DigiState.cpp:596
~DigiState()
Definition: DigiState.cpp:1312
int fetchReadoutChunk(int a_ch, std::vector< int16_t > &a_chargeShort, std::vector< int16_t > &a_chargeLong, std::vector< uint32_t > &a_extras, std::vector< uint32_t > &a_timeTag, std::vector< uint16_t > &a_wfData)
Definition: DigiState.cpp:454
int setChStatus(int a_ch, bool a_onOff)
Definition: DigiState.cpp:434
int setCFDDelay(int a_ch, int a_cfdd)
Definition: DigiState.cpp:737