source: fact/BIASctrl/Crate.h@ 10518

Last change on this file since 10518 was 10118, checked in by ogrimm, 14 years ago
Adapted various programs to new PixelMap class
File size: 1.7 KB
Line 
1#ifndef HV_H_SEEN
2#define HV_H_SEEN
3
4#include <termios.h> // POSIX terminal control definitions
5#include <fcntl.h> // File control definitions => fcntl() in fcn OpenPort()
6#include <errno.h>
7#include <stdio.h>
8#include <unistd.h>
9#include <sys/ioctl.h>
10#include <string>
11#include <vector>
12#include <map>
13
14#include "dis.hxx"
15
16#define MAX_NUM_BOARDS 13 // Maximum number of boards per crate
17#define NUM_CHANNELS 32 // Channels per bias board
18#define BAUDRATE B115200
19const float RESISTOR = 1000; // Resistance in Ohm for voltage correction
20const int MAX_ERR_COUNT = 10; // Maximum number of errors before reporting stopped
21class User;
22
23class Crate {
24
25 class User *m;
26 int CrateNumber;
27 int fDescriptor;
28 FILE *File;
29 DimService *NameService;
30 DimService *BiasVolt;
31 DimService *BiasDAC;
32 DimService *BiasCurrent;
33
34 int DAC[MAX_NUM_BOARDS][NUM_CHANNELS]; // Voltage in DAC units
35 double Volt[MAX_NUM_BOARDS][NUM_CHANNELS]; // Voltage in Volt
36 float Current[MAX_NUM_BOARDS][NUM_CHANNELS];
37
38 std::vector<unsigned char> Communicate(std::string);
39 void ClearVoltageArrays();
40
41 public:
42 Crate(std::string, int, class User *);
43 ~Crate();
44
45 char *Name;
46
47 bool OC[MAX_NUM_BOARDS][NUM_CHANNELS];
48 bool Present[MAX_NUM_BOARDS][NUM_CHANNELS];
49 bool ResetHit;
50 bool WrapOK;
51 int WrapCount;
52 int ErrorCount;
53
54 float RefCurrent[MAX_NUM_BOARDS][NUM_CHANNELS];
55 double RefVolt[MAX_NUM_BOARDS][NUM_CHANNELS];
56
57 bool InitOK;
58
59 int SetChannels(std::map<unsigned int, double>);
60 int ReadAll();
61 int SystemReset();
62 int GlobalSet(double);
63 bool Synch();
64 double GetVoltage(unsigned int);
65 unsigned int GetDAC(unsigned int);
66 float GetCurrent(unsigned int);
67 void UpdateDIM();
68 void SetRefCurrent();
69 void AdaptVoltages();
70};
71
72#endif
Note: See TracBrowser for help on using the repository browser.