290 likes | 300 Views
HYDRA Framework. Setup of software environment Using the documentation How to compile a program HYDRA Design Event structure Data container How to write a analysis program How to read the data The DST macro Track Embedding. How to use the documentation. For ROOT classes
E N D
Setup of software environment • Using the documentation • How to compile a program • HYDRA • Design • Event structure • Data container • How to write a analysis program • How to read the data • The DST macro • Track Embedding
How to use the documentation • For ROOT classes http://root.cern.ch tutorials http://root.cern.ch/root/html/tutorials/ http://root.cern.ch/drupal/content/howtos manual http://root.cern.ch/drupal/content/users-guide For HYDRA classes http://www-hades.gsi.de/docs/hydra/classDocumentation/ tutorials and example programs /misc/hadesprojects/analysis_workshop/2012 code version https://subversion.gsi.de/hades/hydra2 https://subversion.gsi.de/hades/hgeant2 https://subversion.gsi.de/hades/pluto Computing http://hades-wiki.gsi.de/cgi-bin/view/Computing
How to setup HYDRA environment (@ GSI) • install a .rootrc file in your homedir. • Use only multiple local .rootrc files if you are sure what you are doing. • READ the ROOT manual for the options to customize your root start up. • Software location: • /misc/hadessoftware/etch32/install/ : several ROOT , HYDRA • /misc/hadessoftware/etch32/hades/ : location to compile HYDRA • /misc/hadessoftware/etch32/admin/ : collection of scripts • Setup your environment run script for a specific HYDRA version: /misc/hadessoftware/etch32/install/hydra2-1.7/defall.sh • The script sets up all variables to run a given ROOT/HYDRA combination • If you need an own development version: copy defall.sh to your place and edit it
Setup the Environment • .rootrc • defall.sh environment script
Load HYDRA into ROOT • Check your setup • type “root” on the terminal. ROOT should start loading all standard HYDRA libs. • The rootlogon.C macro sets the ROOT environment such that you can compile HYDRA macros to libs using the ACLIC compiler of ROOT (in the ROOT interpreter type “.L mymacro.C++”). • READ the ROOT manual for the start options and introduction to CINT. • To load private libraries or PLUTO modify rootlogon.C in your private directory
Howto write an Application • Write a program instead of a macro to run it on the batch farm
How to compile • Setup your environment (see previous topic) • Write your macro (including main function) • Include all needed header files • Check your compilation using ldd to see whether you are loading the libraries from the correct locations
The HYDRA framework • ROOT based object oriented framework • most objects derived from TObject/TNamed: • provides fast binary IO • extended functionality in CINT (Dictinonary) • C++ code can be run without compiling • Browsing of data and Objects with TBrowser • fast evaluation of data with T->Draw() • Histogram classes • Fitting functions • Data input • hld-files (list mode data from experimental data) • root files (already analyzed data) • HGeant output root files for simulation • Data output • hld (filtered) or root • Event loop to analyze the data • List of tasks (programs) which should be executed during event loop • unpacking of raw data • calibration • reconstruction of particles • physics anaysis • Handling of parameters needed for the analysis • via ASCII, ROOT or ORACLE • Calibration,alignment,reconstruction,pid parameters • analysis cuts
General scheme of the analysis Event Generator Simulation Experiment • Generator: PLUTO, UrQMD etc. • Detector simulation: HGEANT • Data objects for the simulation are derived from their corresponding partners of the real data • Digitizer: Simulation of the detector response • The reconstruction after calibrated data Level should see no difference between real and simulated data • First the hits in the individual detectors are reconstructed • The detectors hits are correlated to track candidates • Finally Particle species are assigned to the set of correlated detector hits HldFile RootFile Unpacker Digitizer Calibrater HitReconstruction Correlation PID
HYDRA design HADES HSpectrometer • HADES : THE central Object which owns everything. • HSpectrometer like in reality • consists of several HDetectors (like HMdcDetector) • A Detector consists of several Modules • HDataSource and the derived classes provides reading of input data (HLD, ROOT,RFIO…..) • HRuntimeDb handles up to 2 different ParameterIOs (ASCII,ROOT,OCALE) • HTaskSet • a list of user defined HReconstructor programs HDetector HDataSource: Data IO HRuntimeDb: Parameter handling HParIo: Parameter IO HTaskSet HReconstructor
The data event structure HRecEvent HEventHeader TObjArray HaCategory (like catMdcCal1) TClonesArray Data Object derived from TObject (like HMdcCal1)
HLinearCategory The data container HCategory HMatrixCategory • HLinearCategory for objects of not exactly known number (like particles) or order • HMatrixCategory for objects with given address like sector, module, layer, cell where one address is unique or allow to loop for a given part of the data (for example sector…) • Categories own a TClonesArray where the data are stored. • A TClonesArray is a collection of Objects of same type • The Categories are optimized for performance: • Objects are never deleted when the event is cleared, they are created in the same memory. • Objects can be retrieved via • TObject* HCategory::getObject(HLocation& loc) • TObject* HCategory::getObject(Int_t index) • One can loop over the category using the iterators • Categories be switched on/off for writing to the output file by setting: • HCategory::setPersistency(Bool_t persistent)
How to analyze data • Derive a new Class from HReconstructor • Overwrite the virtual functions • HReconstructor::init() : • called during Hades::init() • get Pointers to needed Parameter containers • get Pointers to needed input data categories • create your output data categories • create your objects which should stay for the time of analysis (create histograms etc…) • HReconstructor::reinit() : • called after Hades::init() • get access to initialyzed parameter containers • HReconstructor::execute() : • called by Hades::eventLoop() • perform the operation on the data (filling histograms etc….) • HReconstructor::finalize() : • called after last event • perform operations which should happen after all analysis (write Histograms to file etc…) • Add your Class to the TaskList in your macro: • for example : gHades->getTaskset(”real”)->add(new MyClass())
How the Categories are storedto the ROOT file • Writing a ROOT outputfile: • In normal case the categories are written splitted to the output HTree (derived from TTree) • Objects (like HMdcCal1) will not be visible as one Object in TBrowser, but all data members will be visible as Leaves • The single variables are mapped to branches each owning a basket • The Event structure as present in memory during the analysis is not preserved • The mapping to the Tree is performed by Hades automatically • The filling of the Tree is performed in the eventLoop() of Hades • Reading an Hydra outputfile: • Simple analysis tasks can be performed opening the file with ROOT and using the T->Draw() in CINT • Problem: No Correlations between objects from different categories can be correctly plotted since the event structure is not preserved • For a full analysis the event structure has to be restored • use HRootSource to read and restore the event structure
Reading a HYDRA root file • fast way of writing a macro without creating a class • penalty: performance is worse compared to a class derived from HReconstructor
Efficiency calculation ROOT file (simulation) Embedding DST: Reconstructor task for efficiency Ntuple Efficiency Matrix • Simulated tracks are transported through HGEANT • REAL events are read from Hld file • Merging of real/simulated data on CAL/HIT level (depending on detector) • Output is stored in simulation like Dataobjects • Simulated tracks carry HGEANT track numbers (>1) • Real tracks carry dummy track number (-500) • See http://hades-wiki.gsi.de/cgi-bin/view/SimAna/TrackEmbedding Macro Hld file