//------------------------------------------------------------------------------ // DAQ application task -- // (C) Devis Contarato 2009, Berkeley Lab -- //------------------------------------------------------------------------------ //______________________________________________________________________________ // {Trace} // [File name] "task_DAQ.h" // [Author] "Devis Contarato" // [Version] "0.5" // [Modified by] "Devis Contarato" // [Last revision] "16 Jan 2009" // [Language] "C++" // [Compiler] "Visual C++ 8.x 9.x" // [Member of] "Cool SEAL" // [Project] "SEAL" // [Description] "DAQ application task" // [Key documentation] // "Visual C++ Reference Help" // {Trace} //______________________________________________________________________________ // Overloading check #ifndef task_DAQ_H #define task_DAQ_H // Standard components //#include #include #include // Root components #include // Application components // Data #include "data_Burst.h" #include "geom_Frame.h" // GUI #include "gui_Form.h" #include "gui_Button.h" #include "gui_CoolButton.h" #include "gui_Numeric.h" #include "gui_Menu.h" #include "gui_Map.h" #include "gui_Check.h" #include "gui_Text.h" #include "gui_Combo.h" #include "gui_Label.h" #include "gui_Icon.h" #include "gui_Const.h" #include "gui_Canvas.h" #include "TH1.h" #include "TH2.h" // ROOT #include "TStyle.h" #include "TFile.h" #include "TTree.h" //______________________________________________________________________________ class task_DAQ: public task_Object { private: ////////////////// // DATA objects // ////////////////// std::vector detector; // Vector with detector description(s) data_Burst* burst_Raw; // Raw data container data_Burst* burst_Image; // Container for processed data image (pedestal, common mode subtracted, etc data_Burst* burst_Pedestal; // Pedestals data_Burst* burst_Pedestal2; // Pedestals^2 data_Burst* burst_Noise; // Noise data_Burst* burst_Mask; // Pixel mask std::vector common_Mode; // Store common mode values for various frames std::vector common_ModeNoise; // Store common mode noise values for various frames ////////////////////////////////////////////// // COMM variables for DAQ run-time settings // ////////////////////////////////////////////// UInt_t trigger_mode, trigger_source, trigger_period; UInt_t driver_number, driver_delay, frames_number, data_source; UInt_t iadc; // counter of number of ADC channels selected UInt_t adc_divider, adc_averages; UInt_t burst_Count, run_Number, event_Number; UInt_t runFlag, endFlag, pedFlag; //////////////////////////////////////////////// // Variables for DATA STORAGE and OUTPUT file // //////////////////////////////////////////////// const char *filepath; char filename[50]; Int_t header[50]; TFile* datafile; TTree* headertree; TTree* datatree; Double_t* img_data; Double_t* ped; Double_t* noi; UInt_t NPixels, nevent, tstamp, nspill; time_t date; clock_t timestamp; long tdate; ///////////////// // GUI objects // ///////////////// gui_CoolButton* btn_Run; // Run button gui_CoolButton* btn_Quit; // Quit button gui_Numeric* num_CurrEvt; // Current event number gui_Numeric* num_Evts; // Number of events gui_Check* chk_Write; // Write data option gui_Check* chk_AutoNumber; // Autonumber option gui_Check* chk_CDS; // CDS option gui_Numeric* num_Compression; // Set ROOT file compression level; default=1, maximum=9 gui_Numeric* num_RunNumber; // Run number gui_Text* txt_File; // File path gui_CoolButton* btn_set_FPGA; // Button for setting FPGA settings gui_CoolButton* btn_clear_Comm; // Button for clear communication gui_Combo* cbox_Trigger; // Trigger mode (software, hardware) gui_Combo* cbox_TrgSource; // Hardware trigger source (internal, external) gui_Numeric* num_Trigger; // Internal hardware trigger frequency gui_Combo* cbox_Driver; // Chip driver selection gui_Combo* cbox_DataSource; // Data source (analog, digital data) gui_Numeric* num_Dly; // Driver delay (check coarse/fine) gui_Numeric* num_Frm; // Number of frames std::vector chk_Adc; // String of check buttons for ADC channel(s) selection gui_Numeric* num_Clk; // Clock divider gui_Numeric* num_Avg; // Number of averages gui_Combo* cbox_AcqMode; // Combo box for data mode (raw,pedestal, ped subtraction) gui_Check *chk_plot1D; // Check button for activating 1D event display plot gui_Check *chk_plot2D; // Check button for activating 2D event display plot gui_Check *chk_plotHisto; // Check button for activating event display histogram gui_Numeric *num_TEAM_Pre; // TEAM1K chip pre-burner settings // Canvas for event display plots //gui_Canvas* gCanvas; // Canvas for 2D map gui_Canvas* gCanvas2; // Canvas for 1D plots gui_Canvas* statCanvas; // Canvas for statistics plots (pedestal, noise) // Plots for event display TH1D* eventPlot; // 1D event display plot = new TH1D("", "", dp_Count* frm_Count, 0, dp_Count*frm_Count); //TH2D* eventMap; // 2D event display plot = new TH2D("", "", col_Count , 0.5, col_Count + 0.5, row_Count, 0.5, row_Count + 0.5); TH1D* distPlot; // Event display histogram gui_Map* map_Event; // Variable for plot rescaling int frm_Count, col_Count, row_Count, dp_Count; // Plots for statistics (pedestal, noise) int stat_Min, stat_Max; TH1D* pedestalPlot; TH2D* pedestalMap; TH1D* noisePlot; TH2D* noiseMap; // Setup/Cleanup functions void gui_Setup(); void gui_Delete(); void data_Setup(); void data_Delete(); // Communication setup void comm_Setup(); void set_FPGA(); // Statistics arrays and event display initialization void stats_Reset(); void plots_Reset(); // Data acquisition/analysis void data_Reset(); // to be called to refit data structures depending on chip selection void data_Acquire(); void data_Invert(); void data_CDS(); void pedestal_Subtract(); void data_CMode(); void data_Display(); void data_Write(); // Statistics (pedestals, noise) void stats_Update(); // Piles up data for subsequent pedestal and noise calculation void stats_Calculate(); // Perform the actual computation of pedestal and noise values void stats_Display(); // Show pedestal and noise map/distributions // Output file void file_Setup(); void file_Fill(); void file_Close(); ///////////////////////////////////////////////////////////////////////////// // GUI objects callback target functions (can be either public or private) // ///////////////////////////////////////////////////////////////////////////// void btn_run_Evn(const int arg); // Handles btn_Run press void btn_quit_Evn(const int arg); // Handles btn_Quit press void btn_FPGA_Evn(const int arg); // Handles btn_set_FPGA press void btn_Comm_Evn(const int arg); // Handles btn_clear_Comm press // Special private memebers task_DAQ(const task_DAQ&) {} const task_DAQ& operator=(const task_DAQ&) {return *this;} public: // Special members task_DAQ(); ~task_DAQ(); // Run! UInt_t run(); // Static handler (Callback can handle static target function as well) static void static_Evn(const int arg); }; // Overloading check #endif