#ifdef __CLING__ R__LOAD_LIBRARY(stringex.cpp+) R__LOAD_LIBRARY(AsciiCmdUtilities.cpp+) R__LOAD_LIBRARY(DP5Protocol.cpp+) R__LOAD_LIBRARY(DP5Status.cpp+) R__LOAD_LIBRARY(DppUtilities.cpp+) R__LOAD_LIBRARY(ParsePacket.cpp+) R__LOAD_LIBRARY(SendCommand.cpp+) R__LOAD_LIBRARY(DppLibUsb.cpp+) R__LOAD_LIBRARY(ConsoleHelper.cpp+) R__LOAD_LIBRARY(mca8000usb.cxx+) #endif void rootlogon() { // gSystem->Load("libSerialComm.so"); // gInterpreter->AddIncludePath("./mca8000.h"); const char setred[] = "\033[31m"; const char setgreen[] = "\033[32m"; const char setblue[] = "\033[34m"; const char setblack[] = "\033[39m"; Int_t rvers_need = 53418; MCA8000 * mca = new MCA8000(); // mca->StartGui(); Int_t ndev = mca->OpenDevice(); if (ndev == 1) { printf("%sMCA connected%s\n", setblue, setblack); } else { printf("%sMCA connect failed%s\n", setred, setblack); mca->SetVerbose(3); // simulation run } // start loop: // start acq with preset for n_run_secs Int_t nrun_secs = 5; Int_t ntimes = 3; TDatime dt; TString outfile_name("histos_"); outfile_name+=dt.GetDate(); outfile_name+="_"; outfile_name+=dt.GetTime(); outfile_name+=".root"; TString hname; TString htitle; auto outfile =new TFile(outfile_name, "RECREATE"); do { mca->SetPresetTime(nrun_secs); mca->StartAcq(); gSystem->Sleep(1000* (nrun_secs+2)); if (mca->IsRunning()) { cout << "Still running after: " << nrun_secs+2 << " secs, stop it" << endl; mca->StopAcq(); } mca->FillHistogram(); // auto name // mca->SetHistTitle("myname"); TH1F *hist = mca->GetHistogram(); if (hist){ dt.Set(); hname = "hist_"; hname+=dt.GetDate(); hname+="_"; hname+=dt.GetTime(); htitle = "Spectrum written at: "; htitle+=dt.GetDate(); htitle+=" "; htitle+=dt.GetTime(); hist->SetTitle(htitle); hist->SetName(hname); hist->Print(); hist->Write(); ntimes --; } else { cout << "No hist???" << endl; } } while (ntimes > 0); }