Package: maddaq
MadDAQ data analysisThis is a collection of data analysis examplesPythonData can also be analyzed with python. The philosophy is the same as in C++. There is aMadDAQDataclass to navigate the data and aMadDAQModuleclass that contains the data of a given module.MadDAQDataMadDAQDatawill get all the information abou the run type, etc.If the daa file comes from a ScanRun,MadDAQDatawill provide a ScanManager via thescan_managermethod and will tell if this is this kind of run with thehas_scanmethod. In principle, the user does not neet to care about the ScanManager unless there is need of getting information about the number of ScanVariables and their definition.The most important role of  it will help creating the iterators that help navigating the data.MadDAQDatais itself an iterator that will yield all the events of all the modules ordered by time.create_module_ierator(mid)will return an iterator yielding the data from modiel with IDmid.create_iterator_at_time(T, [mod_ids])will return an iterator that starts iteratinig at the given daq_time. The data will be restricted to the modules given in the list. If the list is empty, all the modules will provide data.create_iterator_at_event(ievt, [mod_ids])will create an iterator that starts at the given event number.ScanManageris itself an iterator of ScanPoints. Tnis will be retrived via theMadDAQData.scan_managermethod.create_iterator_at_scan_point(ipoint, [mod_ids])will create an iterator taht gives all the events in that ScanPoint.An example of use:# We open here the filemaddaq=MadDAQData(fname)#  Go through all the enventsforevtinmaddaq:# evt contains the data of the event....analyzetheevent...If we want to analyze the data of a ScanRun:# We open here the filemaddaq=MadDAQData(fname)# loop over the scan pointsforipoint,scPinenumerate(maddaq.scan_iter()):point_values.append(scP.values[11])# loop on all the events of the ScanPoint for module midforevtinmaddaq.create_iterator_at_scanpoint(ipoint,mid):# evt contains the data of the event...analyzethedata...MadDAQModuleMadDAQModulecontains all the information relative to a module. The main role of this object is to analyze the module data.Python examples.There are a number or examples to read data with Python.Command line programsgetSpectrum to make a very rough analysis and show the energy distribution.show_data to see the raw data in the file.getFileInfo to get information about the data file (date, no. of events, etc.)fit-utils.pySome utilities to fit different distributions.read_data.pyShows how to iterate on the dataanalyze_data.pyReads all events in a file and tries to fit something.data_spectral_analysis.pyMakes an spectral analysis of the calibation data.hold_delay_scan.pyExample of a ScanRun analysis. Thsi particular one to check the signal variation with Hold Delay parameter.test_channel_scan.pyAnalysis of a channel scan.show_data.pyUseful to spy the data in a file. Also an interesting example of different iterators.Vdaq data formatVdaq stores the data using the HDF5 library.
The data in the output file is organized in different blocks:
+/header
+/modules
+/scanThe header is described elsewhere.The header has an attribute with the definition of the run. The run description contains the type of run, the run number the number of events and the timeThe header contains 2 groups/header/modulesThis is a list with the module descriptions. They are encoded as 0xnn0tiii with
+nn = number of chips
+t  = data type
+iii = module identifier/header/run_recordsContains the start of run and end of run records.The moduleThe module group has one subgroup per module named with the module ID/modules/iiiwhere iii is the module ID.The module group has thedatagroup where the user defined data format resides and theconfigurationarray that contains an array of integers with the configurations values returned by GenModule::write_config(). Finally, there is the pedestal group that contains:/modules/iii/pedestals/pedestal - the pedestals
/modules/iii/pedestals/noise    - the noiseThe scanThe scan block has two records, one that defines the scan (/scan/def) and the second that tells when Vdaq changed to the new scan point and the values of the variables./scan/def/nevt      - number of events per scanpoint
/scan/def/nvar      - number o variables to scan
/scan/def/variables - The variable descriptions (type, from, to)