620 likes | 636 Views
G anil R oot U tilities. Luc Legeard (legeard @ ganil.fr). Summary (1).
E N D
Ganil Root Utilities Luc Legeard (legeard @ ganil.fr)
Summary (1) 1) Ganil Acquisition2) ROOT - Generalities - Example of simple histogram - TTree3) GRU a) Generalities b) Standard Analysis - runs, generator, narval c) User Analysis Guser Files d) Usage of GRU in Ganil Acquisition
Summary (2) 4) Vigru5) Other products -Ganil_Tape -Calimero -Spectra Server6) Conclusion
GANIL DAQ general architecture Electronics Main components GUI GUI GUI GUI Experiment description Data Base Global Run Control Core Electrinics Control Core Electronics Control Core Data Flow Narval
GANIL DAQ general architecture Electronics Main components GUI GUI GUI GUI Experiment description Data Base Global Run Control Core Electrinics Control Core Electronics Control Core • Configure Data Flow System • Save/restore a configuration • Commands to global setup, start, stop electronics through Electronics Control Core(s) • Commands to control data flow elements • Monitor DAQ (status, data rate...)? • Handle error messages Data Flow Narval
GANIL DAQ general architecture Electronics Main components GUI GUI GUI GUI Experiment description Data Base • Slow Control : • Describe hardware configuration • Save / restore hardware configurations • Setup boards registers • Monitor boards (temperatures, voltages ..) • Electronics Run Control : • Embedded readout process state machine • Setup the embedded readout processes • Dispatch commands from Global Run Control to the embedded readout processes Global Run Control Core Electronics Control Core Electronics Control Core Data Flow Narval
GANIL DAQ general architecture Electronics Main components GUI GUI GUI GUI Experiment description Data Base • NARVAL • Distributed Data Acquisition System • Readout from front end electronics • Filtering • Event Building • Storage Global Run Control Core Electrinics Control Core Electronics Control Core Data Flow Narval
GANIL DAQ general architecture Electronics Main components GUI GUI GUI GUI Experiment description Data Base Global Run Control Core Electrinics Control Core • Analysis With GRU/vigru • GRU connected on each wanted Narval Actor via the “Watcher” Electronics Control Core Data Flow Narval
ROOT “ROOT is an object-oriented framework aimed at solving the data analysis challenges of high-energy physics.” René Brun http: //root.cern.ch • Documentation • Download • Forum • Support • Freeware • C++ -CINT
ROOT A real success
ROOT French / English Courses John Franckland franckland@ ganil.fr (Ganil) Daniel Cussol cussol@in2p3.fr (LPC Caen) They propose 4 days courses : https: //launchpad.net/formationroot Downloadable pdf documentation
TTree mytree>Draw(“Z:Y:X”) TTree = Data base of Events for ROOT TTree* mytree = new TTree(“MyTree”) Leaves ****************************************** * Row* X * Y * Z * ****************************************** * 0 * 1.102278 * 1.799389 * 4.4528222 * * 1 * 1.8671779 * 0.596621 * 3.8423130 * * 2 * 0.524181 * 1.8685209 * 3.7661390 * * 3 * 0.380611 * 0.9691280 * 1.0840740 * * 4 * 0.5524539 * 0.212309 * 0.350281 * * 5 * 0.184954 * 1.1873049 * 1.4439020 * ... * 22 * 1.2211090 * 0.8143829 * 2.1543269 * * 23 * 1.4131350 * 1.5498369 * 4.3989419 * * 24 * 0.174493 * 1.330937 * 1.8018410 * Events Nota : Leaves can be complex, vectors, structure, root object
GRU • In Wikipedia • GRU or Glavnoye Razvedyvatel'noye Upravleniye is the foreign military intelligence directorate of the General Staff of the Armed Forces of the Russian Federation (formerly the Soviet Army General Staff of the Soviet Union). GRU is the English transliteration of the Russian acronym ГРУ, which stands for "Главное Разведывательное Управление", meaning Main Intelligence Directorate. The official full name translation is II Main Directorate of the General Staff of the Armed Forces of the Russian Federation. Other name, GRU GSh (GRU Generalnovo Shtaba, i.e. "GRU of the General Staff").The GRU is Russia's largest foreign intelligence agency.[1] In 1997 it deployed six times as many agents in foreign countries as the SVR, which is the KGB intelligence successor. It also commanded 25,000 Spetsnaz troops in 1997.[2]
GRU • Main functions of GRU: • Analyse physic Ganil data. • On-line from old and new Acquisition (via network) • Off-line reading raw data files (Runs) • Convert raw data files in ROOT files (TTree) • Standard conversion (one leaf /parameter) • Specific user conversion (sorted in vectors…) • GRU = ROOT and Ganil C++ Libraries
GRU VIGRU Narval Actor via Watcher Input Device Standard Analysis Raw Spectra _______ _______ _______ _______ Spectra Server Runs Tcip requests Spectra Data Base User C++ Code Spectra _______ _______ _______ _______ Random Generator ROOT files (TTrees, histograms) Runs Spy Network GRU Overview
GRU GRUCore Soap Server • Use Cint to get command • Very useful to debug and prepare a acquisition • C++ command (easy script) • But Cint is fragile due to its memory handling • Impossible use interactively with a running thread • Use soap server to get commands. • Less friendly • All usages cases are not treated • But more robust against crash
GRU : installation • Information, Download, Installation : • http://wiki.ganil.fr/gap/wiki/Documentation/Software/Gru • Requirement : • OS : linux, MacOS • Gcc, g++ • ROOT installed • untar package (>tar -xvf GRUv_12_03.tar) >cd GRU >./make_package to built all or >./make_package_ganil to include network specific ganil libraries >source thisgru.sh (source thisgru.csh) // to define $GRUDIR and complement $PATH and $LD_LIBRARY_PATH
GRU : html doc >Run script “make_html_doc” to generate html class documentation >Browse ./htmldoc/index.html
GRU Analysis with GRU (1) standard Analysis Raw Spectra _______ _______ _______ _______ Spectra Server Input Device Source • Principe of standard analysis : • Raw Spectra • Standard conversion Run->TTree Data Base Output Device GDevice *inputdevice = new GDevice(argument); // declaration of Input inputdevice->Open(); // necessary for all devices ( do initialisation) GDevice *outputdevice = new GDevice(argument); // declaration of output outputdevice->Open(); // necessary for all devices ( do initialisation) GAcq *a = new GAcq(inputdevice,outputdevice); // treatment environment a->EventInit(); // event initialisation a->SetSpectraMode(1); //raw histograms a->SetUserMode(1); // init treatment a->SetTTreeMode(1,”MyTree.root”); // validate Run conversion in TTree a->SetScalerMode(1,”MyScaler.root”);// specific TTree for scalers a->SetNetMode(1,9090); a->DoRun( n); // n= nb events (if =0 => all) inputdevice->Close(); outputdevice->Close(); a->SpeSave("histo.root"); // save all declared histogram delete (a); // finish Runs : Root Files Nota : this script can be saved in file { Script…. } and executed in GRU > .x MyScript.C
Analysis with GRU (2) GRU Standard Analysis Raw Spectra _______ _______ _______ _______ - Case of Input = Runs - Standard Root Conversion - No Spectra server Input Device Runs GTape *inputdevice = new GTape(“run1.dat”); inputdevice->SetBufferSize(16384); inputdevice->Open(); GAcq *a = new GAcq(inputdevice); a->EventInit(); // init done with run header a->SetSpectraMode(1); a->SetTTreeMode(1,”MyTree.root”); a->SetScalerMode(1,”MyScaler.root”); a->SetUserMode(1); a->DoRun(); inputdevice->Close(); inputdevice->SetName(“run2.dat”); inputdevice->Open(); a->DoRun(); inputdevice->Close(); Case of multi runs a->SpeSave("histo.root"); delete (a); // finish ROOT files
GRU Analysis with GRU (3) Standard Analysis Raw Spectra _______ _______ _______ _______ Spectra Server Input Device Random Gene Case of random generator: Random generator produces Ebyedat Buffer . The event is defined from an ACTIONS_experiment.CHC_PAR file. Random law can be white noise, gaussian noise or binomial The appearance of a specific parameter is under a probability (default =60%) Can be defined after version GRU 12.3 The first parameter defined in ActionFile has always a probability of 100% ( supposed to be a trigger) Data Base Root Files GGeneBuffer *inputdevice = new GGeneBuffer(“ACTIONS_experiment.CHC_PAR”); // declare Input inputdevice->SetBufferSize(16384); inputdevice->SetRandomLaw(1) ; // 0 Gaussian,1 White Noise, 2 Binomial inputdevice->SetRandomProba(0.5) ; // Probability of parameter of each appearance =50% (default =60%) inputdevice->Open(); GAcq *a = new GAcq(inputdevice); // treatment environment a->EventInit(“experiment”,false); // event initialisation a->SetSpectraMode(1); // raw histograms a->SetUserMode(1); // init treatment a->SetEventUSleep(10000); // allow pause in µs between each event a->SetNetMode(1,9090); a->DoRun( n); // n= nb events (if =0 => all) inputdevice->Close(); a->SpeSave("histo.root"); // save all declared histogram delete (a); // finish
GRU Analysis with GRU (4) Standard Analysis Raw Spectra _______ _______ _______ _______ Spectra Server Input Device Run Case of infinite read of run: When GRU reaches the end of run, it restarts form beginning indefinitely. Like a generator but from a run file. Useful to test a C code closer from a real experiment. Data Base Root Files GTape *inputdevice = new GTape(“run.dat”); inputdevice->SetBufferSize(16384); inputdevice->Open(); GAcq *a = new GAcq(inputdevice); a->SetInfiniteRead(1); a->EventInit(); a->SetSpectraMode(1); a->SetUserMode(1); a->SetNetMode(1,9090); a->DoRun(); // n= nb events (if =0 => all) inputdevice->Close(); a->SpeSave("histo.root"); // save all declared histogram delete (a); // finish
Analysis with GRU (5) GRU Standard Analysis Raw Spectra _______ _______ _______ _______ Spectra Server Input Device • Case of Narval Actor: The input can be any Narval Analysis Actor but it works better with a specific actor ( gnarval_ebyedat_watcher) Data Base ROOT files GNetClientNarval *inputdevice = new GNetClientNarval (“hostname”); inputdevice->SetPort(10202); inputdevice->SetBufferSize(16384); inputdevice->Open(); GAcq *a = new GAcq(inputdevice); // treatment environment a->EventInit(“experiment”); // event initialisation a->SetSpectraMode(1); // raw histograms a->SetUserMode(1); // init treatment a->SetNetMode(1,9090); a->DoRun(); // n= nb events (if =0 => all) inputdevice->Close(); a->SpeSave("histo.root"); // save all declared histogram delete (a); // finish
GRU Analysis with GRU (6) Standard Analysis Raw Spectra _______ _______ _______ _______ • Case User analysis • To analyse data, user has to instance a “GUser” object which inherits for GAcq class • User introduces new spectra and fills them with specific own computing Spectra Server Input Device Source Data Base User C++ Code Spectra _______ _______ _______ gROOT->Reset(); gROOT->ProcessLine(".include /home/acqexp/GRU/GRUcurrent/include"); gROOT->ProcessLine(".L ./GUser_C.so"); // load GUser class GDevice *inputdevice = new GDevice(argument); // declare Input inputdevice->Open(); GUser *a = new GUser(inputdevice); // treatment environment a->EventInit(); // event initialisation a->SetSpectraMode(1); // raw histograms a->SetUserMode(1); // init treatment a->SetTTreeMode(3,”MyTree.root”); // user TTree a->SetNetMode(1,9090); a->DoRun(); // n= nb events (if =0 => all) inputdevice->Close(); a->SpeSave("histo.root"); // save all declared histogram delete (a); // finish ROOT Files
Analysis with GRU (7) • GUser.h file : #ifndef __GUser__ #define __GUser__ #include <sstream> using std::ostream; #include <TObject.h> #include "General.h" #include "GAcq.h" #include "GDevice.h" class GUser : public GAcq{ protected: int fVerbose; // level (0 to 10 ) of verbose default = 0 ( level 10 is good for debug) TH1F * fMy1Dhisto; // pointer on user histogram 1 dimension of floats TH2F* fMy2Dhisto; // pointer on user histogram 2 dimensions of floats Int_t fLabel_voie1, fLabel_voie2; Ushort_t *fVector; public: GUser(GDevice* _fDevIn= NULL, GDevice* _fDevOut= NULL) ; // default constructor of GUser object ~GUser() ; virtual void InitUser(); // init acquisition virtual void InitUserRun(); // init before start virtual void User(); // done by start virtual void EndUserRun(); // stop run virtual void EndUser(); // exit acquisition virtual void InitTTreeUser(); // to define own leaves in case of user TTree ClassDef (GUser ,1); // User Treatment of Data };
GUser.C file : Analysis with GRU (8) #include "GUser.h" #include "TROOT.h" #include <TProfile.h> #include <TRandom.h> ClassImp (GUser); GUser::GUser (GDevice* _fDevIn, GDevice* _fDevOut) { // Constructor / initialisor of Acquisition object // // entry: // - Input Device // - Output Device fDevIn = _fDevIn; fDevOut = _fDevOut; // Declaration of new root histograms fMy1Dhisto = new TH1F(“My1DHisto”, “My1DHisto”,16384,0,16384); fMy2Dhisto = new TH2F(“My2DHisto”, “My2DHisto”,1024,0,16384,1024,0,16384); fVector = new Ushort_t[2]; } GUser::~GUser() { delete (fMy1Dhisto ); delete (fMy2Dhisto ); delete (fVector); }
Analysis with GRU (9) • GUser.C file : void GUser::InitUser() { // Initialisation for global user treatment // choice : allow to switch on different treatments (1 to 6) // called with command SetUserMode (choice) // In this method, we can make histograms (previously declared in GUser.h) GetSpectra()->AddSpectrum(fMy1Dhisto ,"MyFamily"); GetSpectra()->AddSpectrum(fMy2Dhisto ,"MyFamily"); fLabel_voie0=GetEvent()->GetDataParameters()->GetLabel("ADC32_1_7_V0") ; fLabel_voie1=GetEvent()->GetDataParameters()->GetLabel("ADC32_1_7_V1") ; } void GUser::InitUserRun() { // Initialisation for user treatment for each run }
GUser.C file : Analysis with GRU (10) void GUser::User() { // User method for user treatment for each events // event is a vector of a serie of couples UShor_t/Short_t Label/Value ( GetEventArrayLabelValue()) // of variable size GetEventArrayLabelValueSize() and with a max size of GetEventArrayLabelValueSizeMax() // The numbers of couple Label/Value is GetEventArrayLabelValueSize()/2 // GetEventArrayLabelValue_Label(i) return Label number i in vector GetEventArrayLabelValue() // GetEventArrayLabelValue_Value(i) return Value number i in vector GetEventArrayLabelValue() Float_t Coef_Calibration =0,7; Int_t new_value,x ,y,size; x =0; y =0; size = GetEventArrayLabelValueSize()/2; for(Int_t i=0;i< size; i++){ if (GetEventArrayLabelValue_Label(i) == fLabel_voie0){ x = GetEventArrayLabelValue_Value(i); new_value =(Int_t)( x * Coef_Calibration); fMy1DHisto->Fill(new_value); } if (GetEventArrayLabelValue_Label(i) == fLabel_voie1){ y = GetEventArrayLabelValue_Value(i); } } fMy2DHisto->Fill (x,y); fVector[0] = x; fVector[1] = y; } }
Analysis with GRU (11) void GUser::EndUserRun() { // end of run , executed a end of each run } void GUser::EndUser() { // global final end executed a end of runs // must be explicitly called! } void GUser::InitTTreeUser() { // User method for specific initialisation of Ttree. // It can be useful for example multi-hit detections // or to have a TTree with only few parameters (for low compute). // To run this method, you have to select mode 3 in SetTTreeMode // ex : a->SetTTreeMode(3,"/space/MyTTree.root"); // GetTree() return TTree pointer. GetTree()->Branch("mybranche",fVector,”fVector[2]/s"); }
GRU in Ganil Acquistion (1) Menu Général de l'expérience test machine serveur = ganp858 PA..........Définition du contexte de l'Acquisition DA..........Démarrage DAS AG..........Analysis with GRU (C++) RC..........RunControl TK..........Toolkit for RCC, Chainsaw, Narval,... VG..........ViGru XT..........Fenêtre Xterm AB..........Abort de l'acquisition host FI..........Sortir de l'Acquisition GRU Analysis LGA...Launch all GRUCore_X Processes on this computer IGA...Init all GRUCore_X STAA..Start all runs STOA. Stop all runs QGA.. Stop Final all Analysis on this computer KGA...Kill all GRUCores -------------------------------------------------------- CG....Create GRU_X Directory -------------------------------------------------------- -------------------------------------------------------- HE... Help FI... FIN
GRU in Ganil Acquistion (2) Enter alphanumeric word to complete new directory GRU analysis (Enter empty entry to cancel): Do not use capital letter ! (ex: mygru1 to create GRU_mygru1) : test2 -------------------Definition of Analysis Context-------------------------- +--NarvalActor--+ +---GRUcore----+ +-----Vigru-----+ | with Watcher | | Soap Server | | | | | | -Host Name | | | | |----------->| -Port | | | | Host watcher | | | | | | -Name | |SpectraServer | | | | -Port | | -Port | | | | | | | | | | -Buffer Size | | |--------->| | | | | | | | +---------------+ +--------------+ +---------------+ Actor watcher Name (default = localhost): localhost Port watcher number (default = 10202): 10202 Buffer Size (default = 65536): 16384 GRUcore Soap Server Host Name (default = localhost): localhost GRUcore Soap Server Port Number (default = 6603): 6603 Spectra Sever Port (default = 9090): 9090 So if we agree with this : Name of directory : /home/legeard/ganacq_manip/test/GRU/GRU_test2 Host watcher Name : localhost Port watcher number : 10202 Buffer Size : 16384 GRUcore Host Name : localhost GRUcore Soap Port :6603 Spectra Sever : 9090 We can continue (y=[return]), do a correction (n) or cancel (c)?: y
GRU Analysis LGA...Launch all GRUCore_X Processes on this computer IGA...Init all GRUCore_X STAA..Start all runs STOA. Stop all runs QGA.. Stop Final all Analysis on this computer KGA...Kill all GRUCores -------------------------------------------------------- CG....Creat GRU_X Directory -------------------------------------------------------- Gtest2...Go To GRU_test2 Directory -------------------------------------------------------- HE... Help FI... FIN GRU in Ganil Acquistion (3) GRU Analysis in Directory /home/legeard/ganacq_manip/test/GRU/GRU_test2 ED... Edit GUser.C GUser.h EC....Edit GruConfig (if necessary) MK....Do a compilation with local Makefile -------------------------------------------------------- LG... Launch GRUCore_test2 Process on this computer IG....Init GRUCore_test2 STA...Start Run of GRUCore_test2 STO.. Stop Run of GRUCore_test2 QG....Quit Analysis of GRUCore_test2 and do GUser::EndUser() KG....Kill GRUCore_test2 -------------------------------------------------------- VG....Vigru XT....Xterm in directory RM....Delete directory : /home/legeard/ganacq_manip/test/GRU/GRU_test2 HE....Help FI... FIN [GRU_test2]$ GRUCoreInit.conf GRUCoreStart.conf GRUCoreStop.conf GRUCoreFinish.conf GUser.C GUser.h GUserLinkDef.h Makefile GruScript.C GruScript_offline.C
GRU in Ganil Acquistion (4) GRUCoreInit.conf #Define input GRUC GRU localhost:6603 INPUT NARVAL localhost 10202 #Define BufferSize GRUC GRU localhost:6603 INPUT BUFFERSIZE 16384 #Define User code GRUC GRU localhost:6603 INITACQ GUSER #Init event with experiment name GRUC GRU localhost:6603 INITEVENT test3 #Start all Raw Spectra GRUC GRU localhost:6603 SPECTRA ALL #Start Spectra Server GRUC GRU localhost:6603 SPECTRASERVER START 9090 #Init GUser GRUC GRU localhost:6603 INITRUNS 1 [GRU_test2]$ GRUCoreInit.conf GRUCoreStart.conf GRUCoreStop.conf GRUCoreFinish.conf GUser.C GUser.h GUserLinkDef.h Makefile GruScript.C GruScript_offline.C GRUCoreStart.conf #Start GRUC GRU localhost:6603 DORUN START GRUCoreStop.conf #Stop GRUC GRU localhost:6603 DORUN STOP GRUCoreFinish.conf #Quit GRUC GRU localhost:6603 DORUN END
Vigru : Visualisation for Gru Function : display a large number of spectra easily >Load list of alive spectra from remote servers >Display spectrum or a family of spectra >Presentation on multi-pages >Save/retrieve setup >Benefit of root powerful functionalities • Independent application • Client of multiple servers • GRU/GRUcore • Root file (containing spectra) • SoapServer
Vigru : Connection First : connectionto a spectra server 1) menu Setup-> Sources 2) Define a sever: -Select type (network/file) -Define protocol (Gru/Ganil/Soap) -Fill host name/filename + port number -Select [Add Server] -Repeat 2) if several servers 3) Select [OK]
Vigru : Display a spectrum Select pad with mouse’s middle button or with red arrow buttons Select one or several spectra and choose spectra to display in chooser
Vigru : Tabs Add Page (Tab) Remove Page Setting Page
Vigru : Refresh Refresh pad Refresh full page Setting time for auto refresh
vigru : log Apply/remove logarithm One X,Y or Z axis
vigru : statistics Change statistic information on pads
vigru : zoom Sliders bar to apply a zoom to all histograms of page in X or Y axis. Reset zoom on selected pad
vigru : zoom Send selected pad in a full zoom tab
vigru : crosshair & status Validate / invalidate Crosshair and Status bar information
Vigru : file menu Open & Save Configurations Print or make a postscript file Save spectra in root file or in txt format
Configuration Files : XML • <root><RootAssociateFile>/home/legeard/GRU/serv/vigru11.root</RootAssociateFile><ListIdServers>0<ServerIdentity><SourceName>localhost</SourceName><SourceType>GRU</SourceType><Source>NET</Source><Port>9090</Port></ServerIdentity></ListIdServers><Pages>4<Tab>0<TabName>4 Graphs</TabName><npadx>2</npadx><npady>2</npady><GVPad><Option2D>col</Option2D><StatOpt>nemr</StatOpt><Palette>0</Palette><Logx>0</Logx><Logy>0</Logy><Logz>0</Logz><ProcessType>1</ProcessType><ProcessTab>0</ProcessTab><ProcessPad>0</ProcessPad> ………….. • Direct launch if conf file exists : vigru myvigruconf.xml • By default vigru.xml in current directory
Vigru : tools menu Recall button actions but applied on page(s) Peak find
Features : Process A “process” is a copy of spectra form a origin pad to a second pad on which a computation is applied (FFT, Scatter, Projection…list can be completed on demand) - Select a free pad - Select this menu : Process Select the computing to apply and the origin pad Do a refresh page
Vigru Client of SoapServer • Vigru can also display signal or histogram send by small soap server (direct connection). • Useful for debugging hardware (Oscilloscope) • Development of Numexo2 card. • Process used : FFT=> one line spectral analysis • (vigru needs to be compiled with specific Ganil libraries) Electronic card Embedded linux + Soap server Soap
Graphical Cuts GRU/vigru allows “half dynamic cuts” In GUser files // define a cut with arbitrary size TCutG * MyCut= new TCutG("Mycut",1); // add this cut in Data Base GetSpectra()->AddCut(MyCut,(char*)"Cuts"); // The cut is used to condition a histogram Example / if ((MyCut->IsInside(px,py))) MyHisto->Fill(px,py) In Vigru Select a pad where you want to draw a graphical cut 1) Click on chisel button Draw your cut with mouse and finish it with a double click 2) Click again on chisel button (with a red arrow) Select "Mycut" in "Cuts" folder. At this moment, your cut is updated in the server