/**************************************************************************/ /* Header files section needs cleanup */ /**************************************************************************/ #include #include #include #include "sls/ZmqSocket.h" #include "sls/tiffIO.h" #include #include #include /* exit() */ #include /* memset(), memcpy() */ #include /* uname() */ #include #include /* socket(), bind(), listen(), accept() */ #include #include #include #include #include #include #include /* fork(), write(), close() */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //json header in zmq stream #include #define NTHREADS 2 #include #include #include // time_t using namespace std; using namespace std::chrono; using namespace sls; #include "TCanvas.h" #include "TH1F.h" #include "TF1.h" #include "TH2F.h" #include "TMath.h" #include "TFile.h" #include "TStyle.h" #include "TSystem.h" #include "TTimer.h" #include "TProfile.h" #include "TColor.h" #include #include #include #include #include #include #include #include #include #include #include #include #include "sls/ansi.h" #define SLS_DETECTOR_JSON_HEADER_VERSION 0x4 #define PI 3.14159265 #define FALSE 0 #define OFFSET 0 #define NBIN 500 #define MIN_POS -500.5 // 400.5 #define MAX_POS 3499.5 //-100.5 #define NCH 524288 // #define NCH 262144 in case of half_frames char serverip[256]; int portnum; FILE * sfilefd; short* hchptr; // photon counted map "histogram" int value; float factor=1.84; int npacket=0; int totalnpacket=0; float vgamma; struct sockaddr_in serveraddr; struct sockaddr_in clientaddr; struct in_addr inadr; struct hostent *server; int i=0; int ipx=0; bool haveconnection; TStyle *gStyle; TApplication* rootapp; TCanvas *A2; TCanvas *A3; TCanvas *A4; TCanvas *A5; TCanvas *A6; TH1I **hchip; TH2F **h4500chip; short image_data[NCH*2]; short imaged[NCH*2]; float fpeded[NCH*2]; float fpedeG2d[NCH*2]; float fpedeG1d[NCH*2]; short ipeded[NCH*2]; short pcimaged[NCH*2]; float fgaind[NCH*2]; float adcpedecorr,adcpedecorrold; bool gain_flag; bool bw_flag; bool fill2Ds; bool show2Ds; bool fill1Ds; bool pede_flag; bool dophotonmap; int nx, ny; int nframes; int goout; int framesinstream; int ifp; float threshold; int phene; int adcvalue; int gain; int ichip; int frameIndex_old; char pedefilename[128]; int framenum,bunchid; TH2F* his1000; TH2F* his2000; TH2F* his3000; TH2F* his4500; TH1I* hproj; TH1I* hchcum; using namespace std; void printhelp(void); void processifp(int ifp); void historeset(void); void SetRanges(void); void startsocket(void); void stopsocket(void); void axisreset(void); int kbhit(void); void myloop(void); void loadpede(void); void loadallpede(void); void loadgain(void); void nonblock(int state); void LoadPaletteFalse(void); void LoadPaletteBW(float); void Plot1DHistos(void); void Plot2DHistos(void); void savepede(void); void readpede(void); int findinterpoindex(int startindex); int findclumax(int startindex); void tryconnect(void) ; #define NB_ENABLE 1 #define NB_DISABLE 0 char c; int HDraw_every; float oldh0xfirst,oldh0xlast; int idx; int GXPoffset,G1Poffset,G2Poffset; int ix,iy; int adcmin,adcmax; int pmmin,pmmax; //min/mnx for the photon map bool fixranges; sls::ZmqSocket *zmqSocket= NULL;