JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
GreenMonster Class Reference

#include <GreenMonster.h>

Public Member Functions

 GreenMonster ()
 
 ~GreenMonster ()
 
void CheckScan ()
 
void Open ()
 
void Close ()
 
void SCNSetStatus (Int_t)
 
void SCNSetValue (Int_t, Int_t)
 
void PrintScanInfo ()
 

Private Member Functions

void SCNUpdateStatus (Int_t)
 
Bool_t SCNCheckStatus ()
 
void SCNCheckValues ()
 

Private Attributes

Bool_t fVerbose
 
Bool_t fUseCrate [5]
 
TString * fCrateNames [5]
 
Int_t fCrateNumbers [5]
 
Int_t fSCN_TABID
 
Int_t statusSCN
 
Int_t setpoint1SCN
 
Int_t setpoint2SCN
 

Detailed Description

Definition at line 69 of file GreenMonster.h.

Constructor & Destructor Documentation

◆ GreenMonster()

GreenMonster::GreenMonster ( )

Definition at line 6 of file GreenMonster.cc.

6 :fVerbose(kTRUE)
7{
8 fUseCrate[0]= kFALSE;
9 fCrateNames[0] = new TString("Qweak Injector");
10 fCrateNumbers[0] = Crate_CountingHouse;//injector crate
11
12 fUseCrate[1]= kFALSE;
13 fCrateNames[1] = new TString("Injector");
15
16 fUseCrate[2]= kFALSE;
17 fCrateNames[2] = new TString("Left Spect");
19
20 fUseCrate[3]= kFALSE;
21 fCrateNames[3] = new TString("Right Spect");
23
24
25 fUseCrate[4]= kTRUE;
26 fCrateNames[4] = new TString("Qw VME TS");
28
29
30}
#define Crate_Injector
Definition GreenSock.h:25
#define Crate_RightSpect
Definition GreenSock.h:22
#define Crate_CountingHouse
Definition GreenSock.h:16
#define Crate_LeftSpect
Definition GreenSock.h:19
#define Crate_Qwvmets
Definition GreenSock.h:28
Int_t fCrateNumbers[5]
Bool_t fUseCrate[5]
TString * fCrateNames[5]

References Crate_CountingHouse, Crate_Injector, Crate_LeftSpect, Crate_Qwvmets, Crate_RightSpect, fCrateNames, fCrateNumbers, fUseCrate, and fVerbose.

◆ ~GreenMonster()

GreenMonster::~GreenMonster ( )

Definition at line 32 of file GreenMonster.cc.

32 {
33};

Member Function Documentation

◆ CheckScan()

void GreenMonster::CheckScan ( )

Definition at line 43 of file GreenMonster.cc.

43 {
44 SCNCheckStatus(); // this call is actually an important initialization!
45 SCNCheckValues(); // this call is actually an important initialization!
46};
void SCNCheckValues()
Bool_t SCNCheckStatus()

References SCNCheckStatus(), and SCNCheckValues().

+ Here is the call graph for this function:

◆ Close()

void GreenMonster::Close ( )

Definition at line 39 of file GreenMonster.cc.

39 {
40 // cfSockCliClose();
41};

◆ Open()

void GreenMonster::Open ( )

Definition at line 35 of file GreenMonster.cc.

35 {
36 // cfSockCliOpen(Crate_CountingHouse, 0);
37};

◆ PrintScanInfo()

void GreenMonster::PrintScanInfo ( )
inline

Definition at line 82 of file GreenMonster.h.

82 {
83 switch (statusSCN)
84 {
85 case SCN_INT_CLN:
86 {
87 std::cout << "Scan Status is CLEAN" << std::endl;
88 break;
89 }
90 case SCN_INT_NOT:
91 {
92 std::cout << "Scan Status is NOT_CLEAN" << std::endl;
93 break;
94 }
95 default:
96 std::cout << "ERROR: Unrecognized SCAN status flag" << std::endl;
97 }
98 std::cout << "Scan data 1: " << setpoint1SCN << std::endl;
99 std::cout << "Scan data 2: " << setpoint2SCN << std::endl;
100 }
#define SCN_INT_NOT
#define SCN_INT_CLN

References SCN_INT_CLN, SCN_INT_NOT, setpoint1SCN, setpoint2SCN, and statusSCN.

◆ SCNCheckStatus()

Bool_t GreenMonster::SCNCheckStatus ( )
private

Definition at line 75 of file GreenMonster.cc.

75 {
76 struct greenRequest gRequest;
77 int command, par1, par2, command_type;
78 char *msgReq = "SCN status check";
79 char *reply = "Y";
80 Int_t iclean;
81
82 // printf("SCN Status =");
83 command_type = COMMAND_SCAN; gRequest.command_type = command_type;
84 command = SCAN_GET_STATUS; gRequest.command = command;
85 par1 = 0; gRequest.par1 = par1;
86 par2 = 0; gRequest.par2 = par2;
87 strcpy(gRequest.message,msgReq); gRequest.reply = reply;
88 if (GreenSockCommand(Crate_Qwvmets,&gRequest) == SOCK_OK) {
89 command = gRequest.command;
90 par1 = gRequest.par1;
91 par2 = gRequest.par2;
92 iclean=par1;
93 if (iclean != SCN_INT_CLN && iclean != SCN_INT_NOT) {
94 printf("UNKNOWN REPLY FOR SCN STATUS: %d ",iclean);
95 return kFALSE;
96 }
97 } else {
98 printf("ERROR accessing socket!");
99 return kFALSE;
100 }
101
102 // printf("% d %d\n",par1,par2);
103
104 SCNUpdateStatus(iclean);
105 return kTRUE;
106}
int GreenSockCommand(int crate_number, struct greenRequest *gRequest)
Definition cfSockCli.c:334
#define SOCK_OK
Definition cfSock.h:16
#define COMMAND_SCAN
#define SCAN_GET_STATUS
void SCNUpdateStatus(Int_t)

References greenRequest::command, COMMAND_SCAN, greenRequest::command_type, Crate_Qwvmets, GreenSockCommand(), greenRequest::message, greenRequest::par1, greenRequest::par2, greenRequest::reply, SCAN_GET_STATUS, SCN_INT_CLN, SCN_INT_NOT, SCNUpdateStatus(), and SOCK_OK.

Referenced by CheckScan(), and SCNSetStatus().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SCNCheckValues()

void GreenMonster::SCNCheckValues ( )
private

Definition at line 164 of file GreenMonster.cc.

164 {
165 struct greenRequest gRequest;
166 int command, par1, par2, command_type;
167 char *msgReq = "Check SCN Data Value";
168 char *reply = "Y";
169 char buff[10];
170 int value;
171
172 //
173 command_type = COMMAND_SCAN; gRequest.command_type = command_type;
174 command = SCAN_GET_DATA; gRequest.command = command;
175 par1 = 1; gRequest.par1 = par1;
176 par2 = 0; gRequest.par2 = par2;
177 strcpy(gRequest.message,msgReq); gRequest.reply = reply;
178 if (GreenSockCommand(Crate_Qwvmets,&gRequest) == SOCK_OK) {
179 command = gRequest.command;
180 par1 = gRequest.par1;
181 par2 = gRequest.par2;
182 value = par2;
183 } else {
184 printf("ERROR accessing socket!");
185 return;
186 }
187
188 //
189 // get value from tent
190 //
191 setpoint1SCN=value;
192
193 // repeat for second data word
194
195 command_type = COMMAND_SCAN; gRequest.command_type = command_type;
196 command = SCAN_GET_DATA; gRequest.command = command;
197 par1 = 2; gRequest.par1 = par1;
198 par2 = 0; gRequest.par2 = par2;
199 strcpy(gRequest.message,msgReq); gRequest.reply = reply;
200 if (GreenSockCommand(Crate_Qwvmets,&gRequest) == SOCK_OK) {
201 command = gRequest.command;
202 par1 = gRequest.par1;
203 par2 = gRequest.par2;
204 value = par2;
205 } else {
206 printf("ERROR accessing socket!");
207 return;
208 }
209
210 //
211 // get value from tent
212 //
213 setpoint2SCN=value;
214
215 return;
216}
#define SCAN_GET_DATA

References greenRequest::command, COMMAND_SCAN, greenRequest::command_type, Crate_Qwvmets, GreenSockCommand(), greenRequest::message, greenRequest::par1, greenRequest::par2, greenRequest::reply, SCAN_GET_DATA, setpoint1SCN, setpoint2SCN, and SOCK_OK.

Referenced by CheckScan().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SCNSetStatus()

void GreenMonster::SCNSetStatus ( Int_t status)

Definition at line 108 of file GreenMonster.cc.

108 {
109 struct greenRequest gRequest;
110 int command, par1, par2, command_type;
111 char *msgReq = "SCN Status Change";
112 char *reply = "Y";
113
114 command_type = COMMAND_SCAN; gRequest.command_type = command_type;
115 command = SCAN_SET_STATUS; gRequest.command = command;
116 par1 = status; gRequest.par1 = par1;
117 par2 = 0; gRequest.par2 = par2;
118
119 if (fVerbose) std::cout << "Setting SCN status: " << par1 << std::endl;
120 strcpy(gRequest.message,msgReq); gRequest.reply = reply;
121
122 if (GreenSockCommand(Crate_Qwvmets,&gRequest) == SOCK_OK) {
123 if (fVerbose) printf("SCAN status change call is complete\n");
124 } else {
125 printf("ERROR accessing socket!");
126 return;
127 }
128 // check scan status
130}
#define SCAN_SET_STATUS

References greenRequest::command, COMMAND_SCAN, greenRequest::command_type, Crate_Qwvmets, fVerbose, GreenSockCommand(), greenRequest::message, greenRequest::par1, greenRequest::par2, greenRequest::reply, SCAN_SET_STATUS, SCNCheckStatus(), and SOCK_OK.

+ Here is the call graph for this function:

◆ SCNSetValue()

void GreenMonster::SCNSetValue ( Int_t which,
Int_t value )

Definition at line 134 of file GreenMonster.cc.

134 {
135 struct greenRequest gRequest;
136 int command, par1, par2, command_type;
137 char *msgReq = "Set SCN Data Value";
138 char *reply = "Y";
139
140 if (which==1) setpoint1SCN=value;
141 else if (which==2) setpoint2SCN=value;
142
143 if (fVerbose) std::cout << " writing new SCAN set point " << value
144 << " to data" << which <<std::endl;
145 //
146 // send set message for obj, value
147 //
148 command_type = COMMAND_SCAN; gRequest.command_type = command_type;
149 command = SCAN_SET_DATA; gRequest.command = command;
150 par1 = which; gRequest.par1 = par1;
151 par2 = value; gRequest.par2 = par2;
152 strcpy(gRequest.message,msgReq); gRequest.reply = reply;
153 if (GreenSockCommand(Crate_Qwvmets,&gRequest) == SOCK_OK) {
154 command = gRequest.command;
155 par1 = gRequest.par1;
156 par2 = gRequest.par2;
157 } else {
158 printf("ERROR accessing socket!");
159 return;
160 }
161 return;
162}
#define SCAN_SET_DATA

References greenRequest::command, COMMAND_SCAN, greenRequest::command_type, Crate_Qwvmets, fVerbose, GreenSockCommand(), greenRequest::message, greenRequest::par1, greenRequest::par2, greenRequest::reply, SCAN_SET_DATA, setpoint1SCN, setpoint2SCN, and SOCK_OK.

+ Here is the call graph for this function:

◆ SCNUpdateStatus()

void GreenMonster::SCNUpdateStatus ( Int_t id)
private

Definition at line 50 of file GreenMonster.cc.

50 {
51
52 switch (id)
53 {
54 case SCN_INT_CLN:
55 {
56 // fStateRBtSCN[SCN_RADIO_NOT_BT]->SetState(kButtonUp);
57 // fStateRBtSCN[SCN_RADIO_CLN_BT]->SetState(kButtonDown);
58 statusSCN=id;
59 break;
60 }
61 case SCN_INT_NOT:
62 {
63 // fStateRBtSCN[SCN_RADIO_CLN_BT]->SetState(kButtonUp);
64 // fStateRBtSCN[SCN_RADIO_NOT_BT]->SetState(kButtonDown);
65 statusSCN=id;
66 break;
67 }
68 default:
69 std::cout << "ERROR: Unrecognized SCAN status flag" << std::endl;
70 }
71 return;
72}

References SCN_INT_CLN, SCN_INT_NOT, and statusSCN.

Referenced by SCNCheckStatus().

+ Here is the caller graph for this function:

Field Documentation

◆ fCrateNames

TString* GreenMonster::fCrateNames[5]
private

Definition at line 106 of file GreenMonster.h.

Referenced by GreenMonster().

◆ fCrateNumbers

Int_t GreenMonster::fCrateNumbers[5]
private

Definition at line 107 of file GreenMonster.h.

Referenced by GreenMonster().

◆ fSCN_TABID

Int_t GreenMonster::fSCN_TABID
private

Definition at line 110 of file GreenMonster.h.

◆ fUseCrate

Bool_t GreenMonster::fUseCrate[5]
private

Definition at line 105 of file GreenMonster.h.

Referenced by GreenMonster().

◆ fVerbose

Bool_t GreenMonster::fVerbose
private

Definition at line 103 of file GreenMonster.h.

Referenced by GreenMonster(), SCNSetStatus(), and SCNSetValue().

◆ setpoint1SCN

Int_t GreenMonster::setpoint1SCN
private

Definition at line 113 of file GreenMonster.h.

Referenced by PrintScanInfo(), SCNCheckValues(), and SCNSetValue().

◆ setpoint2SCN

Int_t GreenMonster::setpoint2SCN
private

Definition at line 114 of file GreenMonster.h.

Referenced by PrintScanInfo(), SCNCheckValues(), and SCNSetValue().

◆ statusSCN

Int_t GreenMonster::statusSCN
private

Definition at line 112 of file GreenMonster.h.

Referenced by PrintScanInfo(), and SCNUpdateStatus().


The documentation for this class was generated from the following files: