#define RESET "\033[0m" #define BLACK "\033[30m" /* Black */ #define RED "\033[31m" /* Red */ #define GREEN "\033[32m" /* Green */ #define YELLOW "\033[33m" /* Yellow */ #define BLUE "\033[34m" /* Blue */ #define MAGENTA "\033[35m" /* Magenta */ #define CYAN "\033[36m" /* Cyan */ #define WHITE "\033[37m" /* White */ #define BOLDBLACK "\033[1m\033[30m" /* Bold Black */ #define BOLDRED "\033[1m\033[31m" /* Bold Red */ #define BOLDGREEN "\033[1m\033[32m" /* Bold Green */ #define BOLDYELLOW "\033[1m\033[33m" /* Bold Yellow */ #define BOLDBLUE "\033[1m\033[34m" /* Bold Blue */ #define BOLDMAGENTA "\033[1m\033[35m" /* Bold Magenta */ #define BOLDCYAN "\033[1m\033[36m" /* Bold Cyan */ #define BOLDWHITE "\033[1m\033[37m" /* Bold White */ #include "RootHeader.h" #include "Riostream.h" #include "signal.h" #include "Bytes.h" #include "VMERemote.h" #include "TProfile.h" #include #define MAXCH 16 #define DETECTOR "trig" using namespace std; /* * VMERemote * */ class VMERemote : public TObject { public: VMERemote(const char *pHost, int port) { host = pHost; this->port = port; // Socket = new TSocket(host, port, 32768); Socket = new TSocket(host, port, 32900); if(!Socket->IsValid()) { printf("Failed to connected to host: %s\n", pHost); } else printf("Successfully connected to host: %s\n" , pHost); /* set board type */ BoardType = 5; } /********/ Bool_t Reconnect() { if(Socket) { Socket->Close("force"); }; // Socket = Socket = new TSocket(host, port, 32768); Socket = new TSocket(host, port, 32900); return (Socket->IsValid()); } /********/ Bool_t WriteVME_SC(unsigned int addr, unsigned int val, unsigned int Status = 0, unsigned int Slot = 0) { if(!Socket->IsValid()) { printf("WriteVME_SC FAILED\n"); return kFALSE; } Cmd_Write_SC *pCmd_Write32; OutgoingMsg.Length = HTONL(REMOTE_MSG_SIZE(Cmd_Write_SC)-4); OutgoingMsg.BoardType = HTONL(BoardType); OutgoingMsg.MsgType = HTONL(REMOTE_CMD_WRITE_SC); pCmd_Write32 = (Cmd_Write_SC *)OutgoingMsg.Msg; pCmd_Write32->ID = HTONL(Slot); pCmd_Write32->Status = HTONL(Status); pCmd_Write32->Address = HTONL(addr); pCmd_Write32->Value = HTONL(val); Socket->SendRaw(&OutgoingMsg, REMOTE_MSG_SIZE(Cmd_Write_SC)); cout << " REMOTE_MSG_SIZE = " << REMOTE_MSG_SIZE(Cmd_Write_SC) << endl; cout << " Outgoing: Length = " << OutgoingMsg.Length << " " << REMOTE_MSG_SIZE(Cmd_Write_SC)-4 << " Board Type = " << OutgoingMsg.BoardType << " " << BoardType << " MsgType = " << OutgoingMsg.MsgType << " " << REMOTE_CMD_WRITE_SC << " Slot = " << pCmd_Write32->ID << " " << Slot << " Status = " << pCmd_Write32->Status << " " << Status << " Address = " << pCmd_Write32->Address << " " << addr << " Value = " << pCmd_Write32->Value << " " << val << endl; // Close(); return kTRUE; } /********/ Bool_t ReadVME32(unsigned int addr, unsigned int *val, unsigned int Status = 0) { if(!Socket->IsValid()) { printf("ReadVME32 FAILED\n"); return kFALSE; } Cmd_Read32 *pCmd_Read32; OutgoingMsg.Length = HTONL(REMOTE_MSG_SIZE(Cmd_Read32)-4); OutgoingMsg.BoardType = HTONL(BoardType); OutgoingMsg.MsgType = HTONL(REMOTE_CMD_READ32); pCmd_Read32 = (Cmd_Read32 *)OutgoingMsg.Msg; pCmd_Read32->Address = HTONL(addr); Socket->SendRaw(&OutgoingMsg, REMOTE_MSG_SIZE(Cmd_Read32)); if( (Socket->RecvRaw(&IncomingMsg.Length, 4) == 4) && (NTOHL(IncomingMsg.Length) <= sizeof(RemoteMsgStruct)) && (Socket->RecvRaw(&IncomingMsg.BoardType, NTOHL(IncomingMsg.Length)) == (int)NTOHL(IncomingMsg.Length)) ) { IncomingMsg.Length = NTOHL(IncomingMsg.Length); IncomingMsg.BoardType = NTOHL(IncomingMsg.BoardType); IncomingMsg.MsgType = NTOHL(IncomingMsg.MsgType); unsigned int *p = (unsigned int *)IncomingMsg.Msg; // if(IncomingMsg.MsgType == CMD_RSP(REMOTE_CMD_READ32)) // { *val = HTONL(*p); return kTRUE; // } } // Close(); return kFALSE; } Bool_t ReadVME_TS(unsigned int *val, unsigned int Status = 0 ) { if(!Socket->IsValid()) { printf("ReadVME_TS FAILED\n"); return kFALSE; } Cmd_Read_TS *pCmd_Read_TS; pCmd_Read_TS = (Cmd_Read_TS *)OutgoingMsg.Msg; OutgoingMsg.Length = HTONL(REMOTE_MSG_SIZE(Cmd_Read_TS)-4); OutgoingMsg.BoardType = HTONL(BoardType); OutgoingMsg.MsgType = HTONL(REMOTE_CMD_READ_TS); pCmd_Read_TS->Status = HTONL(Status); Socket->SendRaw(&OutgoingMsg, REMOTE_MSG_SIZE(Cmd_Read_TS)); cout << endl; cout << "=========" << endl; cout << "ReadVME_TS SEND request. Length = " << REMOTE_MSG_SIZE(Cmd_Read_TS) << endl; if( (Socket->RecvRaw(&IncomingMsg.Length, 4) == 4) && (NTOHL(IncomingMsg.Length) <= sizeof(RemoteMsgStruct))) { Socket->RecvRaw(&IncomingMsg.BoardType, NTOHL(IncomingMsg.Length)); cout << endl; cout << "ReadVME_TS receive Scalers " << endl; IncomingMsg.Length = NTOHL(IncomingMsg.Length); IncomingMsg.BoardType = NTOHL(IncomingMsg.BoardType); IncomingMsg.MsgType = NTOHL(IncomingMsg.MsgType); cout << "Length = " << IncomingMsg.Length << " Board = " << IncomingMsg.BoardType << " Type = " << IncomingMsg.MsgType << endl; Cmd_Read_TS *p = (Cmd_Read_TS *)IncomingMsg.Msg; int status = 0; status = NTOHL(p->Status); cout << "Incoming SATUS: " << status << endl; if(status < 0) return kFALSE; for(unsigned int sc = 0; sc < 66; sc++){ val[sc] = NTOHL(p->Value[sc]); cout << val[sc] << " "; } cout << endl; return kTRUE; } return kFALSE; } Bool_t ReadVME_TD(unsigned int *val, unsigned int Status = 0 ) { if(!Socket->IsValid()) { printf("ReadVME_TS FAILED\n"); return kFALSE; } int debug_td = 0; Cmd_Read_TD *pCmd_Read_TD; pCmd_Read_TD = (Cmd_Read_TD *)OutgoingMsg.Msg; OutgoingMsg.Length = HTONL(REMOTE_MSG_SIZE(Cmd_Read_TD)-4); OutgoingMsg.BoardType = HTONL(BoardType); OutgoingMsg.MsgType = HTONL(REMOTE_CMD_READ_TD); pCmd_Read_TD->Status = HTONL(Status); Socket->SendRaw(&OutgoingMsg, REMOTE_MSG_SIZE(Cmd_Read_TD)); cout << endl; cout << "===========" << endl; cout << "ReadVME_TD SEND request. Length = " << REMOTE_MSG_SIZE(Cmd_Read_TD) << endl; if( (Socket->RecvRaw(&IncomingMsg.Length, 4) == 4) && (NTOHL(IncomingMsg.Length) <= sizeof(RemoteMsgStruct))) { Socket->RecvRaw(&IncomingMsg.BoardType, NTOHL(IncomingMsg.Length)); cout << "ReadVME_TD receive Scalers " << endl; IncomingMsg.Length = NTOHL(IncomingMsg.Length); IncomingMsg.BoardType = NTOHL(IncomingMsg.BoardType); IncomingMsg.MsgType = NTOHL(IncomingMsg.MsgType); cout << "Length = " << IncomingMsg.Length << " Board = " << IncomingMsg.BoardType << " Type = " << IncomingMsg.MsgType << endl; Cmd_Read_TD *p = (Cmd_Read_TD *)IncomingMsg.Msg; int status = 0; status = NTOHL(p->Status); cout << "Incoming SATUS: " << status << endl; if(status < 0) return kFALSE; for(unsigned int sc = 0; sc < 99; sc++){ if(debug_td) if( (sc % 11) == 0) cout << endl; val[sc] = NTOHL(p->Value[sc]); if(debug_td) cout << val[sc] << " "; } if(debug_td) cout << endl; return kTRUE; } return kFALSE; } Bool_t ReadVME_SC_ALL(unsigned int *val, unsigned int Status = 0, unsigned int sl_first = 0, unsigned int sl_last = 0 ) { if(!Socket->IsValid()) { printf("ReadVME_SC_ALL FAILED\n"); return kFALSE; } Cmd_Read_SC_ALL *pCmd_Read_SC_ALL; pCmd_Read_SC_ALL = (Cmd_Read_SC_ALL *)OutgoingMsg.Msg; OutgoingMsg.Length = HTONL(REMOTE_MSG_SIZE(Cmd_Read_SC_ALL)-4); OutgoingMsg.BoardType = HTONL(BoardType); OutgoingMsg.MsgType = HTONL(REMOTE_CMD_READ_SC_ALL); pCmd_Read_SC_ALL->IDF = HTONL(sl_first); pCmd_Read_SC_ALL->IDL = HTONL(sl_last); pCmd_Read_SC_ALL->Status = HTONL(Status); Socket->SendRaw(&OutgoingMsg, REMOTE_MSG_SIZE(Cmd_Read_SC_ALL)); cout << "ReadVME_SC_ALL SEND request. Length = " << REMOTE_MSG_SIZE(Cmd_Read_SC_ALL) << endl; if( (Socket->RecvRaw(&IncomingMsg.Length, 4) == 4) && (NTOHL(IncomingMsg.Length) <= sizeof(RemoteMsgStruct))) { Socket->RecvRaw(&IncomingMsg.BoardType, NTOHL(IncomingMsg.Length)); cout << "ReadVME_SC_ALL receive Scalers " << endl; IncomingMsg.Length = NTOHL(IncomingMsg.Length); IncomingMsg.BoardType = NTOHL(IncomingMsg.BoardType); IncomingMsg.MsgType = NTOHL(IncomingMsg.MsgType); cout << " Length = " << IncomingMsg.Length << " Board = " << IncomingMsg.BoardType << " Type = " << IncomingMsg.MsgType << endl; Cmd_Read_SC_ALL *p = (Cmd_Read_SC_ALL *)IncomingMsg.Msg; int status = 0; int slotf = NTOHL(p->IDF); int slotl = NTOHL(p->IDL); status = NTOHL(p->Status); cout << " Incoming SLOT FIRST: "<< slotf << " LAST: " << slotl << " Incoming SATUS: " << status << endl; if(status < 0) return kFALSE; for(unsigned int bd = 0; bd < 16; bd++){ int bd_slot; if(bd < 8) bd_slot = bd + 3; else bd_slot = bd + 5; cout << " FADC in slot " << bd_slot << endl; for(unsigned int ch = 0; ch < 17; ch++){ val[bd*17 + ch] = NTOHL(p->Value[bd*17 + ch]); cout << val[bd*17 + ch] << " "; } cout << endl; } return kTRUE; } return kFALSE; } Bool_t ReadVME_SC(unsigned int *val, unsigned int Status = 0, unsigned int Slot = 0 ) { if(!Socket->IsValid()) { printf("ReadVMESC FAILED\n"); return kFALSE; } // unsigned int fadc_id = 16; Cmd_Read_SC *pCmd_Read_SC; pCmd_Read_SC = (Cmd_Read_SC *)OutgoingMsg.Msg; OutgoingMsg.Length = HTONL(REMOTE_MSG_SIZE(Cmd_Read_SC)-4); OutgoingMsg.BoardType = HTONL(BoardType); OutgoingMsg.MsgType = HTONL(REMOTE_CMD_READ_SC); cout<< "SLOT :"<ID = HTONL(Slot); pCmd_Read_SC->Status = HTONL(Status); Socket->SendRaw(&OutgoingMsg, REMOTE_MSG_SIZE(Cmd_Read_SC)); cout << " ReadVME_SC SEND request. Length = " << REMOTE_MSG_SIZE(Cmd_Read_SC) << endl; if( (Socket->RecvRaw(&IncomingMsg.Length, 4) == 4) && (NTOHL(IncomingMsg.Length) <= sizeof(RemoteMsgStruct))) { // cout << " TEST = " << NTOHL(IncomingMsg.Length) << endl; Socket->RecvRaw(&IncomingMsg.BoardType, NTOHL(IncomingMsg.Length)); // cout << " TEST = " << RecvRaw(&IncomingMsg.BoardType, NTOHL(IncomingMsg.Length)) << endl; // (RecvRaw(&IncomingMsg.BoardType, NTOHL(IncomingMsg.Length)) == (int)NTOHL(IncomingMsg.Length)) ) // { cout << " ReadVME_SC receive Scalers " << endl; IncomingMsg.Length = NTOHL(IncomingMsg.Length); IncomingMsg.BoardType = NTOHL(IncomingMsg.BoardType); IncomingMsg.MsgType = NTOHL(IncomingMsg.MsgType); cout << " Length = " << IncomingMsg.Length << " Board = " << IncomingMsg.BoardType << " Type = " << IncomingMsg.MsgType << endl; Cmd_Read_SC *p = (Cmd_Read_SC *)IncomingMsg.Msg; int status =0; int fslot = NTOHL(p->ID); status = NTOHL(p->Status); cout << " Incoming SLOT: "<< fslot <<" Incoming SATUS: " << status << endl; if(status < 0) return kFALSE; for(unsigned int ch = 0; ch < 17; ch++){ val[ch] = NTOHL(p->Value[ch]); cout << val[ch] << " "; } cout << endl; return kTRUE; } // Close(); return kFALSE; } TSocket *Socket; /* socket for connection */ const char *host; int port; int BoardType; private: RemoteMsgStruct IncomingMsg; RemoteMsgStruct OutgoingMsg; }; class My_test : public TGMainFrame{ public: My_test(const TGWindow *p) : TGMainFrame(p, 900, 600){ FILE *fd; char rname[20] = "roctrig1"; SetCleanup(kDeepCleanup); // Check if client program is already running somewhere CHECK_CLIENT_RUNNING(DETECTOR) // Determine port number sprintf(fname,"%s/%s.gui", fGUI_dir, rname); if((fd = fopen(fname,"r")) == NULL){ printf(BOLDRED "\n Can't open config file >%s<\n\n" RESET, fname); printf("\n Try to connect using the default port 9090 \n"); Port = 9090; } else { fgets(str_tmp, 255, fd); sscanf (str_tmp, "%d\n", &Port); printf(BOLDBLUE "\n get Port = %d for %s from file >%s<\n\n" RESET,Port, rname, fname); fclose(fd); } pClient = new VMERemote(rname, Port); int nch = 16; Float_t x_min = -0.5, x_max = 15.5, y_min = -10, y_max = 10000000; hfadc[0] = new TProfile("TS GTP", "TS GTP", nch, x_min, x_max, y_min, y_max,""); hfadc[0]->GetXaxis()->SetTitle(" GTP input"); hfadc[0]->GetYaxis()->SetTitle(" Rate (Hz) "); hfadc[0]->SetLabelSize(0.075,"xy"); hfadc[0]->SetTitleSize(0.075,"xy"); hfadc[0]->SetTitleOffset(1.1,"xy"); nch = 16; x_min = 0.5, x_max = 16.5, y_min = -10, y_max = 10000000; hfadc[1] = new TProfile("TS FP", "TS FP", nch, x_min, x_max, y_min, y_max,""); hfadc[1]->GetXaxis()->SetTitle(" FP input"); hfadc[1]->GetYaxis()->SetTitle(" Rate (Hz) "); hfadc[1]->SetLabelSize(0.075,"xy"); hfadc[1]->SetTitleSize(0.075,"xy"); hfadc[1]->SetTitleOffset(1.1,"xy"); hbusy_bcal = new TProfile("BCAL", "BCAL", 16, 0.5, 16.5, -10, 10," "); // hbusy_bcal->GetXaxis()->SetLabelSize(0); hbusy_bcal->GetXaxis()->SetTitle(" Crate "); hbusy_bcal->GetYaxis()->SetTitle(" Busy "); hbusy_bcal->SetLabelSize(0.075,"xy"); hbusy_bcal->SetTitleSize(0.075,"xy"); hbusy_bcal->SetTitleOffset(1.1,"x"); hbusy_bcal->SetTitleOffset(0.7,"y"); hbusy_fcal = new TProfile("FCAL and TOF", "FCAL and TOF", 18, 0.5, 18.5, -10, 10," "); hbusy_fcal->GetXaxis()->SetTitle(" Crate "); hbusy_fcal->GetYaxis()->SetTitle(" Busy "); hbusy_fcal->SetLabelSize(0.075,"xy"); hbusy_fcal->SetTitleSize(0.075,"xy"); hbusy_fcal->SetTitleOffset(1.1,"x"); hbusy_fcal->SetTitleOffset(0.7,"y"); hbusy_cdc = new TProfile("CDC", "CDC", 6, 0.5, 6.5, -10, 10," "); hbusy_cdc->GetXaxis()->SetTitle(" Crate "); hbusy_cdc->GetYaxis()->SetTitle(" Busy "); hbusy_cdc->SetLabelSize(0.075,"xy"); hbusy_cdc->SetTitleSize(0.075,"xy"); hbusy_cdc->SetTitleOffset(1.1,"xy"); hbusy_fdc = new TProfile("FDC", "FDC", 17, 0.5, 17.5, -10, 10," "); hbusy_fdc->GetXaxis()->SetTitle(" Crate "); hbusy_fdc->GetYaxis()->SetTitle(" Busy "); hbusy_fdc->SetLabelSize(0.075,"xy"); hbusy_fdc->SetTitleSize(0.075,"xy"); hbusy_fdc->SetTitleOffset(1.1,"x"); hbusy_fdc->SetTitleOffset(0.8,"y"); hbusy_other = new TProfile("Others", "Others", 11, 0.5, 11.5, -10, 10," "); hbusy_other->GetXaxis()->SetTitle(" Crate "); hbusy_other->GetYaxis()->SetTitle(" Busy "); hbusy_other->SetLabelSize(0.075,"xy"); hbusy_other->SetTitleSize(0.075,"xy"); hbusy_other->SetTitleOffset(1.1,"x"); hbusy_other->SetTitleOffset(0.9,"y"); gStyle->SetOptStat(0); gStyle->SetLineWidth(1.5); gStyle->SetTextSize(1.5); gStyle->SetTitleFont(30,"xy"); gStyle->SetLabelFont(30,"xy"); AddFrame(pFrameTop = new TGVerticalFrame(this), new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); //| kLHintsCenterY pFrameTop->AddFrame(pFrameTimer = new TGHorizontalFrame(pFrameTop), new TGLayoutHints(kLHintsExpandX | kLHintsTop, 0, 0, 40, 40 )); pFrameTimer->AddFrame(fTStartButton = new TGTextButton(pFrameTimer, " &Exit ", 515), new TGLayoutHints( kLHintsRight | kLHintsTop, 0, 20, 0, 0)); pFrameTimer->AddFrame(pLabelTimer1 = new TGLabel(pFrameTimer, new TGString("Update Timer (sec): ")), new TGLayoutHints(kLHintsLeft, 20, 2, 2, 0)); pFrameTimer->AddFrame(pValueTimer = new TGNumberEntry(pFrameTimer, 0, 5, 500, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAAnyNumber, TGNumberFormat::kNELLimitMinMax, 1, 20), new TGLayoutHints(kLHintsLeft, 0, 20, 0, 0)); pFrameTimer->AddFrame(fExitButton = new TGTextButton(pFrameTimer, " &Start ", 510), new TGLayoutHints( kLHintsLeft | kLHintsTop, 0, 20, 0, 0)); pFrameTimer->AddFrame(fTResetButton = new TGTextButton(pFrameTimer, " &Stop ", 511), new TGLayoutHints( kLHintsLeft | kLHintsTop, 0, 20, 0, 0)); pFrameTimer->AddFrame(fTStopButton = new TGTextButton(pFrameTimer, " &Reset ", 512), new TGLayoutHints( kLHintsLeft | kLHintsTop, 0, 20, 0, 0)); pValueTimer->SetIntNumber(1); pValueTimer->SetWidth(50); pFrameTop->AddFrame(fF1 = new TGCompositeFrame(pFrameTop, 100,200,kHorizontalFrame), new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 5, 5, 0, 0)); for(int frame = 0; frame < 2; frame++){ char tmp[20]; sprintf(tmp,"TS_%d",frame + 1); fF1->AddFrame(fEcanvas[frame] = new TRootEmbeddedCanvas("tmp",fF1,100,200), new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY , 20, 0, 0, 10)); } fF1->AddFrame(pFrameRight = new TGVerticalFrame(fF1), new TGLayoutHints(kLHintsExpandX | kLHintsCenterY | kLHintsRight, 0, 0, 0, 0 )); pFrameRight->AddFrame(pFrameLabelGTP = new TGHorizontalFrame(pFrameRight), new TGLayoutHints(kLHintsExpandX | kLHintsCenterY | kLHintsRight, 0, 0, 0, 0 )); pFrameLabelGTP->AddFrame(pLabelGTP = new TGLabel(pFrameLabelGTP, new TGString(" GTP Rate (Hz)")), new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 20, 30, 10, 10)); for(int label = 0; label < 4; label++){ char tmp[20]; sprintf(tmp," Lane %d ", label); pFrameRight->AddFrame(pFrameLabel[label] = new TGHorizontalFrame(pFrameRight), new TGLayoutHints(kLHintsExpandX | kLHintsCenterY | kLHintsRight, 0, 0, 0, 0 )); pFrameLabel[label]->AddFrame(pLabelRate = new TGLabel(pFrameLabel[label], new TGString(tmp)), new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 20, 30, 0, 0)); tbuf_rate[label] = new TGTextBuffer(10); tbuf_rate[label]->AddText(0,"0.0"); tent_rate[label] = new TGTextEntry(pFrameLabel[label], tbuf_rate[label]); tent_rate[label]->Resize(100,tent_rate[label]->GetDefaultHeight()); pFrameLabel[label]->AddFrame(tent_rate[label], new TGLayoutHints(kLHintsExpandY | kLHintsCenterY | kLHintsLeft, 10, 0, 10, 10)); } pFrameRight->AddFrame(pFrameLabelTS = new TGHorizontalFrame(pFrameRight), new TGLayoutHints(kLHintsExpandX | kLHintsCenterY | kLHintsRight, 0, 0, 0, 0 )); pFrameLabelTS->AddFrame(pLabelTS = new TGLabel(pFrameLabelTS, new TGString(" TS livetime ( % )")), new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 20, 30, 0, 0)); tbuf_rate_lt = new TGTextBuffer(10); tbuf_rate_lt->AddText(0,"0.0"); tent_rate_lt = new TGTextEntry(pFrameLabelTS, tbuf_rate_lt); tent_rate_lt->Resize(100,tent_rate_lt->GetDefaultHeight()); pFrameLabelTS->AddFrame(tent_rate_lt, new TGLayoutHints(kLHintsExpandY | kLHintsCenterY | kLHintsLeft, 10, 0, 10, 10)); // gStyle->SetOptStat(0); gStyle->SetTitleFontSize(0.08); for(int frame = 0; frame < 2; frame++){ fCanvas[frame] = fEcanvas[frame]->GetCanvas(); fCanvas[frame]->cd(); hfadc[frame]->GetXaxis()->SetNdivisions(508,-1); hfadc[frame]->Draw(); gPad->SetBottomMargin(0.16); gPad->SetLeftMargin(0.16); } // TD scalers pFrameTop->AddFrame(fF2 = new TGCompositeFrame(pFrameTop, 100,200,kHorizontalFrame), new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 5, 5, 10, 0)); for(int frame = 0; frame < 2; frame++){ char tmp[20]; sprintf(tmp,"TD_%d",frame + 1); fF2->AddFrame(fTDcanvas[frame] = new TRootEmbeddedCanvas("tmp",fF2,100,200), new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY , 20, 0, 0, 10)); } pFrameTop->AddFrame(fF3 = new TGCompositeFrame(pFrameTop, 100,200,kHorizontalFrame), new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 5, 5, 10, 0)); #if 0 for(int frame = 2; frame < 5; frame++){ char tmp[20]; sprintf(tmp,"TD_%d",frame + 1); fF3->AddFrame(fTDcanvas[frame] = new TRootEmbeddedCanvas("tmp",fF3,100,200), new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY , 20, 0, 0, 10)); } #endif fF3->AddFrame(fTDcanvas[2] = new TRootEmbeddedCanvas("TD_2",fF3,100,200), new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY , 20, 80, 0, 10)); fF3->AddFrame(fTDcanvas[3] = new TRootEmbeddedCanvas("TD_3",fF3,100,200), new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY , -60, 0, 0, 10)); fF3->AddFrame(fTDcanvas[4] = new TRootEmbeddedCanvas("TD_4",fF3,100,200), new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY , 20, 0, 0, 10)); fCanvas_bcal = fTDcanvas[0]->GetCanvas(); fCanvas_bcal->cd(); hbusy_bcal->GetXaxis()->SetNdivisions(508,-1); hbusy_bcal->Draw(); gPad->SetBottomMargin(0.16); gPad->SetLeftMargin(0.12); gPad->SetRightMargin(0.05); fCanvas_fcal = fTDcanvas[1]->GetCanvas(); fCanvas_fcal->cd(); hbusy_fcal->GetXaxis()->SetNdivisions(508,-1); hbusy_fcal->Draw(); gPad->SetBottomMargin(0.16); gPad->SetLeftMargin(0.12); gPad->SetRightMargin(0.05); fCanvas_cdc = fTDcanvas[2]->GetCanvas(); fCanvas_cdc->cd(); hbusy_cdc->GetXaxis()->SetNdivisions(508,-1); hbusy_cdc->Draw(); gPad->SetBottomMargin(0.16); gPad->SetLeftMargin(0.16); gPad->SetRightMargin(0.05); fCanvas_fdc = fTDcanvas[3]->GetCanvas(); fCanvas_fdc->cd(); hbusy_fdc->GetXaxis()->SetNdivisions(508,-1); hbusy_fdc->Draw(); gPad->SetBottomMargin(0.16); gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.05); fCanvas_other = fTDcanvas[4]->GetCanvas(); fCanvas_other->cd(); hbusy_other->GetXaxis()->SetNdivisions(508,-1); hbusy_other->Draw(); gPad->SetBottomMargin(0.16); gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.05); pValueTimer->Associate(this); fTStartButton->Associate(this); fTStopButton->Associate(this); fTResetButton->Associate(this); fExitButton->Associate(this); my_timer = new TTimer(this, 10, kTRUE); MapSubwindows(); Resize(GetDefaultSize()); Resize(900,800); MapWindow(); }; /*******/ Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t){ cout << " I am here " << GET_MSG(msg) << endl; switch (GET_MSG(msg)) { case kC_COMMAND: { switch (GET_SUBMSG(msg)) { case kCM_BUTTON: { switch (parm1) { case 510: { cout << " Clicked Start Timer Button: Activate Timer " << " " << pValueTimer->GetIntNumber() << " s " << endl; my_timer->Stop(); // SASCHA my_timer->Start(1000*pValueTimer->GetIntNumber(),kFALSE); // my_timer->Start(100*pValueTimer->GetIntNumber(),kFALSE); break; } case 511: { cout << " Clicked Stop Timer Button " << endl; my_timer->Stop(); break; } case 512: { cout << " Clicked Reset Button. Reset Plots " << endl; hctp_ps_nleft->Reset(); hctp_ps_nright->Reset(); hctp_psc_nleft->Reset(); hctp_psc_nright->Reset(); hctp_en->Reset(); break; } case 515: { cout << " Exit " << endl; sprintf(fname,"%s/%s_client.log", fGUI_dir, dname); if((remove(fname)) == 0) printf(" Log file deleted successfully \n\n"); else printf(" Error: unable to delete log file \n\n"); gApplication->Terminate(); break; } break; } break; } } break; } case kC_TEXTENTRY: { switch(GET_SUBMSG(msg)) { case kTE_TEXTCHANGED: { switch(parm1) { case 500: { cout << " Timer rate will be set after pressing Start button : " << pValueTimer->GetIntNumber() << endl; break; } } break; } break; } break; } } return kTRUE; }; int read_ts_sc(VMERemote *pClient_tmp, float ts_tmp[66], unsigned int ts_sc_prev[66]){ unsigned int ts_sc_all[66]; unsigned int live_time; unsigned int busy_time; unsigned int status = 0; memset(ts_sc_all, 0, sizeof(ts_sc_all)); if( pClient_tmp->ReadVME_TS(&ts_sc_all[0], status) ){ live_time = ts_sc_all[64]; busy_time = ts_sc_all[65]; if( (ts_sc_prev[64] > live_time) || (ts_sc_prev[65] > busy_time) ){ ts_sc_prev[64] = ts_sc_prev[65] = 0; } ts_tmp[64] = 0.; ts_tmp[65] = 0.; for(int sc = 0; sc < 64; sc++){ ts_tmp[sc] = 0.; if(ts_sc_prev[sc] > ts_sc_all[sc]) ts_sc_prev[sc] = 0; } float tot_time = (live_time - ts_sc_prev[64] + busy_time - ts_sc_prev[65])*7.68e-6; if(tot_time > 0){ for(int sc = 0; sc < 64; sc++){ ts_tmp[sc] = (float) (ts_sc_all[sc] - ts_sc_prev[sc])/ tot_time; ts_sc_prev[sc] = ts_sc_all[sc]; } ts_tmp[64] = (float) (live_time - ts_sc_prev[64])*7.68e-6/ tot_time; } ts_sc_prev[64] = live_time; ts_sc_prev[65] = busy_time; } else { cout << " : Error reading scalers from server: " << (pClient_tmp->Socket->GetInetAddress()).GetHostName()<<" : "<< (pClient_tmp->Socket->GetInetAddress()).GetHostAddress()<< endl; //** need to reconnect here? if(!pClient_tmp->Reconnect()) cout << "-->> ERROR : Cannot reconnect to server: " << (pClient_tmp->Socket->GetInetAddress()).GetHostName()<<" : "<< (pClient_tmp->Socket->GetInetAddress()).GetHostAddress()<< endl; else{ cout << "**>> Connection to server restored: " << (pClient_tmp->Socket->GetInetAddress()).GetHostName()<<" : "<< (pClient_tmp->Socket->GetInetAddress()).GetHostAddress()<< endl; } } return 0; } int read_td_sc(VMERemote *pClient_tmp, float td_tmp[99], unsigned int td_sc_prev[99]){ /* Fiber 1 - 8: 1 - 8 Loopback: 9 Livetime: 10 Busytime: 11 */ unsigned int td_sc_all[99]; unsigned int live_time_bd; unsigned int busy_time_bd; unsigned int status = 0; int debug_td = 0; memset(td_sc_all, 0, sizeof(td_sc_all)); if( pClient_tmp->ReadVME_TD(&td_sc_all[0], status) ){ for(int td_bd = 0; td_bd < 9; td_bd++){ if(debug_td) cout << " Board = " << td_bd << endl; int index_lt = td_bd*11 + 9; int index_dt = td_bd*11 + 10; live_time_bd = td_sc_all[index_lt]; busy_time_bd = td_sc_all[index_dt]; if( (td_sc_prev[index_lt] > live_time_bd) || (td_sc_prev[index_dt] > busy_time_bd) ){ td_sc_prev[index_lt] = td_sc_prev[index_dt] = 0; } td_tmp[index_lt] = 0.; td_tmp[index_dt] = 0.; for(int sc = 0; sc < 8; sc++){ int index_sc = td_bd*11 + sc; td_tmp[index_sc] = 0.; if(td_sc_prev[index_sc] > td_sc_all[index_sc]) td_sc_prev[index_sc] = 0; } // float tot_time = (live_time_bd - td_sc_prev[index_lt] + busy_time_bd - td_sc_prev[index_dt])*7.68e-6; float tot_time = (live_time_bd - td_sc_prev[index_lt] + busy_time_bd - td_sc_prev[index_dt]); if(debug_td) cout << tot_time << " " << live_time_bd << " " << td_sc_prev[index_lt] << " " << busy_time_bd << " " << td_sc_prev[index_dt] << endl; if(tot_time > 0){ for(int sc = 0; sc < 8; sc++){ int index_sc = td_bd*11 + sc; td_tmp[index_sc] = (float) (td_sc_all[index_sc] - td_sc_prev[index_sc])/ tot_time; if(debug_td) cout << " " << td_sc_all[index_sc] << " P " << td_sc_prev[index_sc] << " FR = " << td_tmp[index_sc]; td_sc_prev[index_sc] = td_sc_all[index_sc]; } if(debug_td) cout << endl; // td_tmp[index_dt] = (float) (busy_time_bd - td_sc_prev[index_dt])*7.68e-6/ tot_time; td_tmp[index_dt] = (float) (busy_time_bd - td_sc_prev[index_dt])/ tot_time; if(debug_td) cout << " Deadtime fraction = " << td_tmp[index_dt] << " Index dt = " << index_dt << endl; } td_sc_prev[index_lt] = live_time_bd; td_sc_prev[index_dt] = busy_time_bd; } } else { cout << " : Error reading scalers from server: " << (pClient_tmp->Socket->GetInetAddress()).GetHostName()<<" : "<< (pClient_tmp->Socket->GetInetAddress()).GetHostAddress()<< endl; //** need to reconnect here? if(!pClient_tmp->Reconnect()) cout << "-->> ERROR : Cannot reconnect to server: " << (pClient_tmp->Socket->GetInetAddress()).GetHostName()<<" : "<< (pClient_tmp->Socket->GetInetAddress()).GetHostAddress()<< endl; else{ cout << "**>> Connection to server restored: " << (pClient_tmp->Socket->GetInetAddress()).GetHostName()<<" : "<< (pClient_tmp->Socket->GetInetAddress()).GetHostAddress()<< endl; } } return 0; } int read_fadc_sc(VMERemote *pClient_tmp, unsigned int slot_min, unsigned int slot_max, float rate_tmp[256], int fadc_time_prev[16][16], int fadc_sc_prev[16][256], int crate){ Float_t time = 0.; int fadc_time; unsigned int sc_all[272]; memset(sc_all, 0, sizeof(sc_all)); // cout << " I am here ==== " << " Slot min = " << slot_min << " Slot_max = " // << slot_max << "pClient " << pClient_tmp << endl; if( pClient_tmp->ReadVME_SC_ALL(&sc_all[0], 0, slot_min, slot_max) ){ for(int bd = 0; bd < 16; bd++){ int time_cnt = 17*bd + 16; fadc_time = sc_all[time_cnt]; time = ((Float_t) (fadc_time - fadc_time_prev[crate][bd]))*2048/1.e9; // time = ((Float_t) sc_all[time_cnt])*2048/1.e9; /* time in sec between scalers readout (one count of scaler timer(last channel from scaler readout) is 2048ns */ // cout << " Board = " << bd << " FADC time prev = " << fadc_time_prev[crate][bd] << " FADC time = " << fadc_time << endl; // cout << " Board = " << bd << " Timer = " << time <<" sec" << endl << endl; if(time > 0) { for(int ch = 0; ch < MAXCH; ch++) { int ch_ind = 17*bd + ch; int rate_ind = 16*bd + ch; if( (sc_all[ch_ind] - fadc_sc_prev[crate][rate_ind]) <= 0){ rate_tmp[rate_ind] = 0; } else rate_tmp[rate_ind] = (sc_all[ch_ind] - fadc_sc_prev[crate][rate_ind]) /time; /*rate in Hz */ // cout << " CH " << ch_ind << " " << sc_all[ch_ind] << " " << rate[ch] << " Hz/s "; fadc_sc_prev[crate][rate_ind] = sc_all[ch_ind]; } } else { int my_slot; if(bd < 8) my_slot = bd + 3; else my_slot = bd + 5; // cout << "-->> ERROR: Slot: " << my_slot << " Timer channel(16) returns zero: Don't update Scalers rate " << endl; } // time fadc_time_prev[crate][bd] = fadc_time; } // loop over boards } else { cout << " : Error reading scalers from server: " << (pClient_tmp->Socket->GetInetAddress()).GetHostName()<<" : "<< (pClient_tmp->Socket->GetInetAddress()).GetHostAddress()<< endl; //** need to reconnect here? if(!pClient_tmp->Reconnect()) cout << "-->> ERROR : Cannot reconnect to server: " << (pClient_tmp->Socket->GetInetAddress()).GetHostName()<<" : "<< (pClient_tmp->Socket->GetInetAddress()).GetHostAddress()<< endl; else{ cout << "**>> Connection to server restored: " << (pClient_tmp->Socket->GetInetAddress()).GetHostName()<<" : "<< (pClient_tmp->Socket->GetInetAddress()).GetHostAddress()<< endl; } } return 0; } int read_ctp_sc(VMERemote *pClient_tmp, float ctp_rate[7], unsigned long long &ctp_time_prev){ unsigned int ctp_sc[17]; unsigned long long ctp_time; int debug_ctp = 0; memset(ctp_sc,0,sizeof(ctp_sc)); if( pClient_tmp->ReadVME_SC(&ctp_sc[0], 10, 3) ) { cout << " Timestamp: " << std::hex << ctp_sc[0] << " " << ctp_sc[1] << std::dec << endl; cout << "Left Arm Counter: " << ctp_sc[2] << endl; cout << "Right Arm Counter: " << ctp_sc[3] << endl; cout << "Coinc Counter: " << ctp_sc[4] << endl; int hit_right = ctp_sc[5]; int hit_left = ctp_sc[6]; cout << "Hit channel (R) : " << hit_right << " (L) : " << hit_left << endl; ctp_time = (((uint64_t) ctp_sc[0] <<32 ) | ctp_sc[1] ); Float_t ctp_time_stamp = ((Float_t) (ctp_time - ctp_time_prev))*4./1.e9; if(debug_ctp){ cout << std::hex << " OLD TIME = " << ctp_time_prev << " NEW TIME = " << ctp_time << std::dec << endl; cout << " TIME DIFFERENCE = " << ctp_time_stamp << endl; } if( ctp_time != ctp_time_prev ){ ctp_rate[2] = ctp_sc[2] / ctp_time_stamp; ctp_rate[3] = ctp_sc[3] / ctp_time_stamp; ctp_rate[4] = ctp_sc[4] / ctp_time_stamp; ctp_rate[5] = ctp_sc[5]; ctp_rate[6] = ctp_sc[6]; } else { ctp_rate[2] = 0; ctp_rate[3] = 0; ctp_rate[4] = 0; ctp_rate[5] = 0; ctp_rate[6] = 0; } cout << " ------------------- " << endl; cout << " RATE FOR HIGH-GRAN COUNTERS = " << ctp_rate[4] << endl; cout << " ------------------- " << endl; ctp_time_prev = ctp_time; } return 0; } /*******/ virtual Bool_t HandleTimer(TTimer *t) { // static unsigned long long ctp_time_prev_ps; // static unsigned long long ctp_time_prev_psc; static unsigned int ts_sc_prev[66]; static unsigned int td_sc_prev[99]; memset(ts_rate, 0, sizeof(ts_rate)); memset(td_busy, 0, sizeof(td_busy)); read_td_sc(pClient, td_busy, td_sc_prev); // UpdatePlot(); #if 1 read_ts_sc(pClient, ts_rate, ts_sc_prev); cout << " ===== Print Scalers ==== " << endl; for(int ii = 0; ii < 32; ii++){ cout << " " << ts_rate[ii]; } cout << endl; for(int ii = 32; ii < 65; ii++){ cout << " " << ts_rate[ii]; } cout << endl; UpdatePlot(); // Print rate for(int lane = 0; lane < 4; lane++){ tbuf_rate[lane]->Clear(); char buffer[20]; sprintf(buffer,"%7.1f",ts_rate[lane]); tbuf_rate[lane]->AddText(0, buffer); tent_rate[lane]->SetCursorPosition(tent_rate[lane]->GetCursorPosition()); tent_rate[lane]->Deselect(); fClient->NeedRedraw(tent_rate[lane]); } tbuf_rate_lt->Clear(); char buffer[20]; sprintf(buffer,"%7.1f",ts_rate[64]*100.); tbuf_rate_lt->AddText(0, buffer); tent_rate_lt->SetCursorPosition(tent_rate_lt->GetCursorPosition()); tent_rate_lt->Deselect(); fClient->NeedRedraw(tent_rate_lt); #endif cout << " Timer " << endl; return kTRUE; }; void UpdatePlot(){ // Update TD busy plots int debug_td = 0; hbusy_bcal->Reset(); hbusy_fcal->Reset(); hbusy_cdc->Reset(); hbusy_fdc->Reset(); hbusy_other->Reset(); // BCAL for(int bcal_bd = 0; bcal_bd < 2; bcal_bd++){ if(debug_td) cout << " BCAL board in slot " << bcal_bd + 7 << endl; for(int sc = 0; sc < 6; sc++){ int index_sc = (bcal_bd + 4)*11 + sc; int histo_bin = bcal_bd*6 + sc + 1; hbusy_bcal->Fill( (Float_t) histo_bin, td_busy[index_sc]); if(debug_td) cout << " " << td_busy[index_sc]; } if(debug_td) cout << endl; } hbusy_bcal->Fill( (Float_t) 15, td_busy[54]); hbusy_bcal->Fill( (Float_t) 16, td_busy[65]); // FCAL and TOF for(int fcal_bd = 0; fcal_bd < 2; fcal_bd++){ if(debug_td) cout << " FCAL board in slot " << fcal_bd + 9 << endl; for(int sc = 0; sc < 6; sc++){ int index_sc = (fcal_bd + 6)*11 + sc; int histo_bin = fcal_bd*6 + sc + 1; hbusy_fcal->Fill( (Float_t) histo_bin, td_busy[index_sc]); if(debug_td) cout << " " << td_busy[index_sc]; } if(debug_td) cout << endl; } // TOF hbusy_fcal->Fill( (Float_t) 14, td_busy[72]); hbusy_fcal->Fill( (Float_t) 15, td_busy[73]); hbusy_fcal->Fill( (Float_t) 17, td_busy[76]); hbusy_fcal->Fill( (Float_t) 18, td_busy[87]); // CDC if(debug_td) cout << " CDC board in slot " << 4 << endl; for(int sc = 0; sc < 4; sc++){ int index_sc = 11 + sc; int histo_bin = sc + 1; hbusy_cdc->Fill( (Float_t) histo_bin, td_busy[index_sc]); if(debug_td) cout << " " << td_busy[index_sc]; } if(debug_td) cout << endl; hbusy_cdc->Fill( (Float_t) 6, td_busy[21]); // FDC for(int fdc_bd = 0; fdc_bd < 2; fdc_bd++){ if(debug_td) cout << " FDC board in slot " << fdc_bd + 5 << endl; for(int sc = 0; sc < 7; sc++){ int index_sc = (fdc_bd + 2)*11 + sc; int histo_bin = fdc_bd*7 + sc + 1; hbusy_fdc->Fill( (Float_t) histo_bin, td_busy[index_sc]); if(debug_td) cout << " " << td_busy[index_sc]; } if(debug_td) cout << endl; } hbusy_fdc->Fill( (Float_t) 15, td_busy[32]); hbusy_fdc->Fill( (Float_t) 16, td_busy[43]); // OTHERS if(debug_td) cout << " TD board in slot " << 3 << endl; for(int sc = 0; sc < 7; sc++){ int index_sc = sc; int histo_bin = sc + 1; hbusy_other->Fill( (Float_t) histo_bin, td_busy[index_sc]); if(debug_td) cout << " " << td_busy[index_sc]; } if(debug_td) cout << endl; hbusy_other->Fill( (Float_t) 8, td_busy[88]); hbusy_other->Fill( (Float_t) 15, td_busy[10]); hbusy_other->Fill( (Float_t) 16, td_busy[98]); fCanvas_bcal->cd(); hbusy_bcal->Draw("histo"); fCanvas_bcal->Update(); fCanvas_fcal->cd(); hbusy_fcal->Draw("histo"); fCanvas_fcal->Update(); fCanvas_cdc->cd(); hbusy_cdc->Draw("histo"); fCanvas_cdc->Update(); fCanvas_fdc->cd(); hbusy_fdc->Draw("histo"); fCanvas_fdc->Update(); fCanvas_other->cd(); hbusy_other->Draw("histo"); fCanvas_other->Update(); hfadc[0]->Reset(); hfadc[1]->Reset(); for(int ch = 0; ch < 32; ch++){ hfadc[0]->Fill( (Float_t) ch, ts_rate[ch]); cout << " " << ts_rate[ch]; } cout << endl; for(int ch = 32; ch < 64; ch++){ hfadc[1]->Fill( (Float_t) ch - 31, ts_rate[ch]); cout << " " << ts_rate[ch]; } cout << endl; for(int plot = 0; plot < 2; plot++){ fCanvas[plot]->cd(); hfadc[plot]->Draw("histo"); fCanvas[plot]->Update(); } } private: TGVerticalFrame *pFrameTop; TGHorizontalFrame *pFrameBot; TGVerticalFrame *pFrameLeft; TGVerticalFrame *pFrameRight; TGHorizontalFrame *pFrameLabelGTP; TGHorizontalFrame *pFrameLabelTS; TGHorizontalFrame *pFrameLabel[4]; TGHorizontalFrame *pFrameTimer; TGLabel *pLabelHost; TGLabel *pLabelTimer1; TGLabel *pLabelRate; TGLabel *pLabelGTP; TGLabel *pLabelTS; TGNumberEntry *pValueTimer; TGTextButton *fTStartButton, *fTStopButton, *fTResetButton, *fExitButton; TProfile *hfadc[4]; TProfile *hbusy_bcal, *hbusy_fcal, *hbusy_cdc, *hbusy_fdc, *hbusy_other; TH1F *hctp_ps_nleft, *hctp_ps_nright; TH1F *hctp_psc_nleft, *hctp_psc_nright; TH1F *hctp_en; TProfile *hctp_ps, *hctp_psc; TProfile *hctp; TH1F *hctp_nleft, *hctp_nright; TCanvas *fCanvas[2]; TCanvas *fCanvas_bcal, *fCanvas_fcal, *fCanvas_cdc, *fCanvas_fdc, *fCanvas_other; TRootEmbeddedCanvas *fEcanvas[2]; TRootEmbeddedCanvas *fTDcanvas[5]; TGCompositeFrame *fF1; TGCompositeFrame *fF2; TGCompositeFrame *fF3; TTimer *my_timer; TGTextBuffer *tbuf_host, *tbuf_rate[4], *tbuf_rate1, *tbuf_rate_lt; TGTextEntry *tent_host, *tent_rate[4], *tent_rate1, *tent_rate_lt; Float_t ts_rate[66]; /* Rate of TS scalers */ Float_t td_busy[99]; /* Busy counters from TD */ Float_t ctp_rate_ps[7]; Float_t ctp_rate_psc[7]; VMERemote *pClient; int Port; // Port string Host; // Host }; /***************************************************/ /***************************************************/ int main(int argc, char* argv[]) { int cargc = 1; TApplication App("Diagnostic GUI", &cargc, argv); // signal(SIGILL, SIG_DFL); // signal(SIGSEGV, SIG_DFL); // signal(SIGBUS, SIG_DFL); if (signal(SIGINT, sig_handler) == SIG_ERR) printf("\ncan't catch SIGINT\n"); if (signal(SIGTERM, sig_handler) == SIG_ERR) printf("\ncan't catch SIGTERM\n"); if(gROOT->IsBatch()) { fprintf(stderr, "%s: cannot run in batch mode\n", argv[0]); return 1; } My_test *a = new My_test(gClient->GetRoot()); a->SetWindowName("BCAL FADC scalers"); /* example to set the same threshold for all channels */ // if(a->pClient->WriteVME_SC(0, 150, 5, 16)) /* send default thresholds 150mv for all channels in slot 16*/ // for(int i=0;i<16;i++) a->SetGUIThreshold(i,150); App.Run(); return 0; }