#include "acquisition.h" acquisition::acquisition() { Int_t a; } acquisition::acquisition(crate *the_crate, Int_t num_events, Int_t num_sequences, Int_t events_per_file, Double_t event_duration, Double_t event_full_scale_range): num_events(num_events), num_sequences(num_sequences), events_per_file(events_per_file), event_duration(event_duration), event_full_scale_range(event_full_scale_range) { the_crate = new crate(); } Int_t acquisition::get_num_events() { return num_events; } Int_t acquisition::get_num_sequences() { return num_sequences; } Int_t acquisition::get_events_per_file() { return events_per_file; } Double_t acquisition::get_event_duration() { return event_duration; } Double_t acquisition::get_event_full_scale_range() { return event_full_scale_range; } crate* acquisition::get_crate() { return the_crate; } void acquisition::start_acquisition() { } void acquisition::stop_acquisition() { } #include "ch_config.h" #include "channel.h" #include "myroot.h" ch_config::ch_config(){ }; ch_config::ch_config(Double_t full_scale_, Double_t offset_, Int_t coupling_, Int_t bandwidth_): full_scale(full_scale_), offset(offset_), coupling(coupling_), bandwidth(bandwidth_) { }; #include "channel.h" void channel::config_channel(Int_t id_, ch_config* channel_config_data_) { id=id_; channel_config_data=channel_config_data_; } #include "crate.h" #include "dig.h" crate::crate() { num_digitizers=0; } crate::crate(Int_t num_digitizers_):num_digitizers(num_digitizers_) { digitizers=new TObjArray(2, 0); }; void crate::add_digitizer(dig* digitizer) { // digitizers->Add((TObject*) digitizer); } #include "dig.h" #include "dig_config.h" dig::dig(Char_t* manufacturer_, Char_t* model_, Char_t* serial_number_, UChar_t bit_res_, UChar_t num_channels_, UChar_t num_triggers_, ULong64_t avail_sequence_samples_, Double_t max_sampling_rate_, Double_t min_sampling_rate_): manufacturer(manufacturer_), model(model_), serial_number(serial_number_), bit_res(bit_res_), num_channels(num_channels_), num_triggers(num_triggers_), avail_sequence_samples(avail_sequence_samples_), max_sampling_rate(max_sampling_rate_), min_sampling_rate(min_sampling_rate_){ channels=new TObjArray(4,0); active_channels=new TObjArray(4,0); config_data=new dig_config(); } dig::dig(Char_t* manufacturer_, Char_t* model_, Char_t* serial_number_, UChar_t bit_res_, UChar_t num_channels_, UChar_t num_triggers_, ULong64_t avail_sequence_samples_, Double_t max_sampling_rate_, Double_t min_sampling_rate_, dig_config* digitizer_configuration_): manufacturer(manufacturer_), model(model_), serial_number(serial_number_), bit_res(bit_res_), num_channels(num_channels_), num_triggers(num_triggers_), avail_sequence_samples(avail_sequence_samples_), max_sampling_rate(max_sampling_rate_), min_sampling_rate(min_sampling_rate_){ channels=new TObjArray(4,0); active_channels=new TObjArray(4,0); config_data=new dig_config(); config_data=digitizer_configuration_; } void dig::set_configuration_data(dig_config* digitizer_configuration) { config_data=digitizer_configuration; } dig_config* dig::get_configuration_data() { return config_data; } void dig::configure() { }; void dig::acquire() { } void dig::readout() { } #include "dig_config.h" #include "channel.h" #include "myroot.h" dig_config::dig_config(){ }; dig_config::dig_config(Double_t sampling_rate_, channel* trig_source_, Int_t trigCoupling_, Int_t trigLevel1_, Int_t trigLevel2_): sampling_rate(sampling_rate_), trig_source(trig_source_), trigCoupling(trigCoupling_), trigLevel1(trigLevel1_), trigLevel2(trigLevel2) { }; #include #include #include #include "testmainframe.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "digitizer.h" #include "bx_event.h" #include "TClonesArray.h" #include #include //#include //ClassImp(TestMainFrame) #include "acquisition.h" #include "ch_config.h" #include "channel.h" using namespace std; enum ETestCommandIdentifiers { M_FILE_OPEN, M_FILE_SAVE, M_FILE_SAVEAS, M_FILE_PRINT, M_FILE_PRINTSETUP, M_FILE_EXIT, M_TEST_DLG, M_TEST_MSGBOX, M_TEST_SLIDER, M_TEST_SHUTTER, M_TEST_DIRLIST, M_TEST_FILELIST, M_TEST_PROGRESS, M_TEST_NUMBERENTRY, M_TEST_NEWMENU, M_VIEW_ENBL_DOCK, M_VIEW_ENBL_HIDE, M_VIEW_DOCK, M_VIEW_UNDOCK, M_HELP_CONTENTS, M_HELP_SEARCH, M_HELP_ABOUT, M_CASCADE_1, M_CASCADE_2, M_CASCADE_3, M_NEW_REMOVEMENU, VId1, HId1, VId2, HId2, VSId1, HSId1, VSId2, HSId2, ColorSel }; Int_t mb_button_id[9] = { kMBYes, kMBNo, kMBOk, kMBApply, kMBRetry, kMBIgnore, kMBCancel, kMBClose, kMBDismiss }; EMsgBoxIcon mb_icon[4] = { kMBIconStop, kMBIconQuestion, kMBIconExclamation, kMBIconAsterisk }; const char *filetypes[] = { "All files", "*", "ROOT files", "*.root", "ROOT macros", "*.C", 0, 0 }; struct shutterData_t { const char *pixmap_name; const char *tip_text; Int_t id; TGButton *button; }; shutterData_t histo_data[] = { { "h1_s.xpm", "TH1", 1001, 0 }, { "h2_s.xpm", "TH2", 1002, 0 }, { "h3_s.xpm", "TH3", 1003, 0 }, { "profile_s.xpm", "TProfile", 1004, 0 }, { 0, 0, 0, 0 } }; shutterData_t function_data[] = { { "f1_s.xpm", "TF1", 2001, 0 }, { "f2_s.xpm", "TF2", 2002, 0 }, { 0, 0, 0, 0 } }; shutterData_t tree_data[] = { { "ntuple_s.xpm", "TNtuple", 3001, 0 }, { "tree_s.xpm", "TTree", 3002, 0 }, { "chain_s.xpm", "TChain", 3003, 0 }, { 0, 0, 0, 0 } }; const char *editortxt = "This is the ROOT text edit widget TGTextEdit. It is not intended as\n" "a full developers editor, but it is relatively complete and can ideally\n" "be used to edit scripts or to present users editable config files, etc.\n\n" "The text edit widget supports standard emacs style ctrl-key navigation\n" "in addition to the arrow keys. By default the widget has under the right\n" "mouse button a popup menu giving access to several built-in functions.\n\n" "Cut, copy and paste between different editor windows and any other\n" "standard X11 text handling application is supported.\n\n" "Text can be selected with the mouse while holding the left button\n" "or with the arrow keys while holding the shift key pressed. Use the\n" "middle mouse button to paste text at the current mouse location.\n" "Mice with scroll-ball are properly supported.\n\n" "This are the currently defined key bindings:\n" "Left Arrow\n" " Move the cursor one character leftwards.\n" " Scroll when cursor is out of frame.\n" "Right Arrow\n" " Move the cursor one character rightwards.\n" " Scroll when cursor is out of frame.\n" "Backspace\n" " Deletes the character on the left side of the text cursor and moves the\n" " cursor one position to the left. If a text has been marked by the user\n" " (e.g. by clicking and dragging) the cursor will be put at the beginning\n" " of the marked text and the marked text will be removed.\n" "Home\n" " Moves the text cursor to the left end of the line. If mark is TRUE text\n" " will be marked towards the first position, if not any marked text will\n" " be unmarked if the cursor is moved.\n" "End\n" " Moves the text cursor to the right end of the line. If mark is TRUE text\n" " will be marked towards the last position, if not any marked text will\n" " be unmarked if the cursor is moved.\n" "Delete\n" " Deletes the character on the right side of the text cursor. If a text\n" " has been marked by the user (e.g. by clicking and dragging) the cursor\n" " will be put at the beginning of the marked text and the marked text will\n" " be removed.\n" "Shift - Left Arrow\n" " Mark text one character leftwards.\n" "Shift - Right Arrow\n" " Mark text one character rightwards.\n" "Control-A\n" " Move the cursor to the beginning of the line.\n" "Control-B\n" " Move the cursor one character leftwards.\n" "Control-C\n" " Copy the marked text to the clipboard.\n" "Control-D\n" " Delete the character to the right of the cursor.\n" "Control-E\n" " Move the cursor to the end of the line.\n" "Control-F\n" " Move the cursor one character rightwards.\n" "Control-H\n" " Delete the character to the left of the cursor.\n" "Control-K\n" " Delete marked text if any or delete all\n" " characters to the right of the cursor.\n" "Control-U\n" " Delete all characters on the line.\n" "Control-V\n" " Paste the clipboard text into line edit.\n" "Control-X\n" " Cut the marked text, copy to clipboard.\n" "Control-Y\n" " Paste the clipboard text into line edit.\n" "\n" "All other keys with valid ASCII codes insert themselves into the line."; class TileFrame; TestMainFrame::TestMainFrame(const TGWindow *p, UInt_t w, UInt_t h) : TGMainFrame(p, w, h) { TGHorizontalFrame *hframe1=new TGHorizontalFrame(this, 400,400); AddFrame(hframe1, new TGLayoutHints(kLHintsExpandX|kLHintsExpandY, 5,5,3,4)); TGGroupFrame * control_frame_440=new TGGroupFrame(this, "440 Board", kVerticalFrame); TGGroupFrame * control_frame_271=new TGGroupFrame(this, "271 Board", kVerticalFrame); control_frame_440->SetTitlePos(TGGroupFrame::kLeft); control_frame_271->SetTitlePos(TGGroupFrame::kLeft); //set up controls for 440 status_440 = new TGTextView(control_frame_440, 100, 100); status_440->AddLine("440 Digitizer Found."); control_frame_440->AddFrame(status_440, new TGLayoutHints (kLHintsExpandX, 10, 10, 10, 1)); control_frame_440->SetTitlePos(TGGroupFrame::kLeft); fEcanvas1=new TRootEmbeddedCanvas ("Ecanvas1", control_frame_440, 100,400); control_frame_440->AddFrame(fEcanvas1, new TGLayoutHints (kLHintsExpandX, 10, 10, 10, 1)); fEcanvas3=new TRootEmbeddedCanvas ("Ecanvas3", control_frame_440, 100,400); control_frame_440->AddFrame(fEcanvas3, new TGLayoutHints (kLHintsExpandX, 10, 10, 10, 1)); //set up controls for 271 status_271 = new TGTextView(control_frame_271, 100, 100); status_271->AddLine("271 Digitizer Found."); control_frame_271->AddFrame(status_271, new TGLayoutHints (kLHintsExpandX, 10, 10, 10, 1)); control_frame_271->SetTitlePos(TGGroupFrame::kLeft); fEcanvas2=new TRootEmbeddedCanvas ("Ecanvas2", control_frame_271, 100,400); control_frame_271->AddFrame(fEcanvas2, new TGLayoutHints (kLHintsExpandX, 10, 10, 10, 1)); fEcanvas4=new TRootEmbeddedCanvas ("Ecanvas4", control_frame_271, 100,400); control_frame_271->AddFrame(fEcanvas4, new TGLayoutHints (kLHintsExpandX, 10, 10, 10, 1)); //fEcanvas5=new TRootEmbeddedCanvas ("Ecanvas5", control_frame_271, 100,400); //control_frame_271->AddFrame(fEcanvas5, new TGLayoutHints (kLHintsExpandX, 10, 10, 10, 1)); //fEcanvas6=new TRootEmbeddedCanvas ("Ecanvas6", control_frame_271, 100,400); //control_frame_271->AddFrame(fEcanvas6, new TGLayoutHints (kLHintsExpandX, 10, 10, 10, 1)); hframe1->AddFrame(control_frame_440, new TGLayoutHints (kLHintsExpandX | kLHintsExpandY, 10, 10, 10, 1)); hframe1->AddFrame(control_frame_271, new TGLayoutHints (kLHintsExpandX | kLHintsExpandY, 10, 10, 10, 1)); TGHorizontalFrame *hframe= new TGHorizontalFrame(this, 200, 40); TGTextButton *Acquire = new TGTextButton(hframe, "&Start Acquisition"); Acquire->Connect("Clicked()", "TestMainFrame", this, "acquire_sequence(Int_t)"); hframe->AddFrame(Acquire, new TGLayoutHints(kLHintsCenterX, 5, 5, 3, 4)); AddFrame(hframe, new TGLayoutHints (kLHintsCenterX,2,2,2,2)); SetWindowName("XENON Acqiris DAQ"); MapSubwindows(); Resize(GetDefaultSize()); MapWindow(); } TestMainFrame::~TestMainFrame() { // Delete all created widgets. // delete fTestButton; // delete fTestText; // delete fStatusFrame; // delete fContainer; // delete fCanvasWindow; // delete fMenuBarLayout; // delete fMenuBarItemLayout; // delete fMenuBarHelpLayout; // delete fMenuFile; // delete fMenuTest; // delete fMenuView; // delete fMenuHelp; // delete fCascadeMenu; // delete fCascade1Menu; // delete fCascade2Menu; // delete fMenuNew1; // delete fMenuNew2; // delete fMenuBar; // delete fMenuDock; } void TestMainFrame::updatewindow(void) { std::cout<<"updating window . . ."; } void TestMainFrame::CloseWindow() { // Got close message for this MainFrame. Terminate the application // or returns from the TApplication event loop (depending on the // argument specified in TApplication::Run()). gApplication->Terminate(0); } Bool_t TestMainFrame::ProcessMessage(Long_t msg, Long_t parm1, Long_t) { } void TestMainFrame::acquire_sequence(Int_t num_sequences) { bool result; // TBrowser *browser = new TBrowser(); Char_t * prim10 = new Char_t[54000]; Char_t * prim11 = new Char_t[54000]; Char_t * prim12 = new Char_t[54000]; Char_t * prim13 = new Char_t[54000]; Short_t * secondary00 = new Short_t[54000]; Short_t * secondary01 = new Short_t[54000]; TObjArray bx_eventlist(0); bx_event *bx = new bx_event; // TFile *f = new TFile("simdata.root", "RECREATE"); TFile *f = TFile::Open("simdata.xml", "recreate"); f->SetCompressionLevel(1.3); ch_config* ch1_config=new ch_config(1, .05, 2, 7); channel *ch1=new channel(); ch1->config_channel(1, ch1_config); dig_config *dc=new dig_config(1.e9, ch1, 10, 20, 30); dig * digitizer1=new dig("Acqiris", "DC271", "Serial Number", 8, 4, 1, 128000, 1.e9, 10); digitizer1->set_configuration_data(dc); crate *b= new crate(2);//=new crate(2); acquisition* a = new acquisition(b, 10000, 1000, 10000, 1.e-8, 1); b->add_digitizer(digitizer1); TTree *tree = new TTree("simtree", "Simulated data tree"); tree->Branch("bx_event_branch", "bx_event", &bx, 32000,1); int i,j,k; digitizer *crate1=new digitizer(); time_t start, finish; double elapsed; start=time(NULL); for (k=1; k<=5; k++) { status_440->AddLine("Acquiring sequence . . . "); status_271->AddLine("Acquiring sequence . . . "); result= crate1->Acquire(); if (result) { status_440->AddLine("Sequence acquired successfully. . . "); status_271->AddLine("Sequence acquired successfully. . ."); } else { status_440->AddLine("Sequence acquisition failed. . . "); status_271->AddLine("Sequence acquisition failed. . ."); return; } //Simulate acquired Data //Double_t random1, random2; //TClonesArray a("bx_event", 128); crate1->Readout(); for (j=0; j<100; j++) { for (i=0; i<500; i++) { prim10[i]=crate1->waveFormArray10[j*500+i]; prim11[i]=crate1->waveFormArray11[j*500+i]; prim12[i]=crate1->waveFormArray12[j*500+i]; prim13[i]=crate1->waveFormArray13[j*500+i]; } for (i=0; i<150; i++) { secondary00[i]=crate1->waveFormArray00[j*150+i]; secondary01[i]=crate1->waveFormArray01[j*150+i]; secondary00[i]=secondary00[i]>>8; //cout << secondary00[i]<< " " << secondary01[i] << endl; //secondary00[i] = 0; //cout << secondary00[i]<< " " << secondary01[i] << endl; } bx->set_event(prim10, prim11, prim12, prim13, secondary00, secondary01); // tree->Fill(); } bx->draw_event(fEcanvas1->GetCanvas(), fEcanvas2->GetCanvas(), fEcanvas3->GetCanvas(), fEcanvas4->GetCanvas()); } finish=time(NULL); elapsed=difftime(finish,start); // for (j=0;j<5; j++) // { // for (i=0;i<65566; i++) // { // random1=gRandom->Rndm(); // random2=gRandom->Rndm(); // prim[i]=(Char_t)64*random1; // secondary[i]=(Short_t)64*random2; // } // bx->set_event(prim, secondary); // tree->Fill(); // } // for (i=10; i<128; i++) // { //new(a[i]) bx_event(512); // a-[i]>set_event(prim,secondary); //tree->Branch("thing", "bx_event", &a[i], 32000,99); // array[i].set_event(prim, secondary); // bx= new bx_event(); //bx->set_event(&crate->waveFormArray1[i*512], &crate->waveFormArray0[i*512]); // bx_eventlist.Add(bx); //} a->Write(); // tree->Write(); f->Close(); std::cout<