OO Implementation for the LHCb Rich Niko Neufeld Dietrich Liko
LHCb Software Week Tuesday, February 02, 2016 Introduction n Study of OO Implementation of a Reconstruction program n Based on Standalone Program by Roger Forty et al. n Present a comparison n Review Object Oriented features
LHCb Software Week Tuesday, February 02, 2016 Objective n Results of the FORTRAN u Physics u Resources n To be better then FORTRAN u Object Orientation F Modularity F Interfaces
LHCb Software Week Tuesday, February 02, 2016 UML Process n Specification using UML u Use cases n Development using UML case tool u Rational Rose n Iterative Development u Several internal iterations UML Unified Modeling Language by Booch, Jacobson & Rumbaugh
LHCb Software Week Tuesday, February 02, 2016 Program Specification n Technical Proposal n LHCb Note n FORTRAN Program n Summary with all information n Partial capture in use cases
LHCb Software Week Tuesday, February 02, 2016 One page on physics n Cherenkov Effect n Emission of Photons u Aerogel & Gas Radiator n Reflection of Photons n Observation of Photons u Quantum Efficiency u Detector Geometry
LHCb Software Week Tuesday, February 02, 2016 One page on algorithm n Local Likelihood n Global Likelihood u Very effective u CPU intensive n Other Algorithm possible u Average emission angle
LHCb Software Week Tuesday, February 02, 2016 Framework n OO Framework to implement reconstruction algorithms n Simulation also possible n Here the Global Likelihood will be implemented n Benchmark for usability
LHCb Software Week Tuesday, February 02, 2016 Use Cases n Question a Physicist might ask... u to a particle... u to a pixel... n Global Likelihood
LHCb Software Week Tuesday, February 02, 2016 Use cases
LHCb Software Week Tuesday, February 02, 2016 Detector
LHCb Software Week Tuesday, February 02, 2016 Detector Rich Radiator Reflector Detector Simplified UML Class Diagram Static relations of Classes
LHCb Software Week Tuesday, February 02, 2016 Event Track Pixel Track Extrapolation Track Segment Photon I should be called DetectorElement !
LHCb Software Week Tuesday, February 02, 2016 Other Entities PhotonSpectrum PixelID GeneratedPhoton
LHCb Software Week Tuesday, February 02, 2016 Lifetime n Present for all Events u Rich, Radiator, Reflector, Detector n Present for one Event u Tracks, TrackExtrapolations, Pixel, Photons n Temporary u Photon Spectrum, PixelID, Single Photon
LHCb Software Week Tuesday, February 02, 2016 Pixel id tube RecPixel signal globalPosition localPosition size Photon Detector But I am smart! Example trivial expensive calculations context questions The PhotonDetector does all the work for me ! I am not so smart...
LHCb Software Week Tuesday, February 02, 2016 Architecture Interface Detector Event Strategy Algorithm
LHCb Software Week Tuesday, February 02, 2016 Standalone Program n Minimal Environment n Contains its own Transient Event Model n Parameter Files n Histograms from CLHEP n Only for this test!
LHCb Software Week Tuesday, February 02, 2016
LHCb Software Week Tuesday, February 02, 2016
LHCb Software Week Tuesday, February 02, 2016
LHCb Software Week Tuesday, February 02, 2016 Optimisations n Since last presentation u two weeks ago u Program about a factor 2 slower n Profiling and Debugging u Allocation of STL container u operator[] u Algorithmic improvements
LHCb Software Week Tuesday, February 02, 2016 Technical Proposal 500 Events B background “Clean”
LHCb Software Week Tuesday, February 02, 2016 Results Difference in particle population, in particular for X particles: Different sample, small differences in the modeling of the inner edges Migration to Reduced Efficiency Reduced Purity 500 Events B background “Clean”
LHCb Software Week Tuesday, February 02, 2016 CPU Comparison 500 Mhz Pentium III G G Sec/Event Events B Background “Clean”
LHCb Software Week Tuesday, February 02, 2016 Kuck & Associates, Inc. n Commercial C++ compiler u Standard compliant u Templates u Patented optimization techniques u Precompiled headers u n Time-locked trial version for RH6.1
LHCb Software Week Tuesday, February 02, 2016 CPU Comparison 500 Mhz Pentium III G G Sec/Event KCC Events B Background “Clean”
LHCb Software Week Tuesday, February 02, 2016 Summary n Outlined the development process n Show physics results n Show CPU comparisons n Why an OO program should be better ?
LHCb Software Week Tuesday, February 02, 2016 Track Segment Length length Aerogel Radiator Track
LHCb Software Week Tuesday, February 02, 2016 FORTRAN REAL FUNCTION DIST(POS,DIR) C A line is given by POS and DIS REAL POS(3), DIR(3) C Radiator wall is described by its z position REAL ZPOS(2) COMMON /RADIATOR/ ZPOS DIST = ACOS(DIR(3),VMOD(DIR,3))*(ZPOS(2)-ZPOS(1)) END
LHCb Software Week Tuesday, February 02, 2016 FORTRAN n Does what it should n Math is simple n Probably more complicated in praxis u walls not normal to z u more then one radiator n Some variables which are interpreted in the context n But your program works soon!
LHCb Software Week Tuesday, February 02, 2016 Sometimes later... u … you want to improve the program F More realistic tracks F More realistic radiators u But assumptions are not isolated F There will be other places which depend on these variables u You have to find all uses of the variables F In your program at n places F In other people programs at unknown places
LHCb Software Week Tuesday, February 02, 2016 Object Based n Assume two classes present u Plane u Ray (can intersect with plane) n My program has... u class Algorithm u dist method
LHCb Software Week Tuesday, February 02, 2016 Object Based class Algorithm { Plane Radiator[2]; virtual double dist(const Ray & track) const; } double Algorithm::dist(const Ray & track) const { return Radiator[1].intersect(track) - Radiator[0].intersect(track); }
LHCb Software Week Tuesday, February 02, 2016 Object Based n More compact n Probably more general n Math is done by somebody else But main critic remains If you want to improve the program, you have to find... n places in your own program unknown places in other programs
LHCb Software Week Tuesday, February 02, 2016 Object Oriented class Track { public: virtual double dist() const; virtual double intersect(const Plane & plane) const; virtual double intersect(……) const; private: Radiator * radiator_; } class Radiator { public: virtual double dist(const Track & track) const; }
LHCb Software Week Tuesday, February 02, 2016 Sequence Diagram RadiatorTrack dist intersect return dist Simplified UML Sequence Diagram dynamic relation of classes
LHCb Software Week Tuesday, February 02, 2016 Object Oriented n If one changes the Radiator... u One place to do the modifications n If one changes the Track... u Another single place to do the change n Implementation is hidden behind the interface n No dependency on the implementation details Visitor Pattern
LHCb Software Week Tuesday, February 02, 2016 Summarize n FORTRAN u does the job u difficult to maintain n Object Based C++ u does the job probably better u still difficult to maintain n Object Oriented C++ u dependencies are reduced
LHCb Software Week Tuesday, February 02, 2016 Our Program does not depend on... n Track implementation n Pixel implementation n General Detector Geometry n Photon radiation process n Mirror choice n Type of Photon Detector n Photon Detector Assembly Details n Reconstruction Strategy n …..
LHCb Software Week Tuesday, February 02, 2016 Integration to GAUDI n Algorithm is interfaced n Package is nearly ready n Release next week n Detailed documentation from the Rose Model available n We plan to include some “hand written” documentation for the release
LHCb Software Week Tuesday, February 02, 2016 Future in GAUDI n Next steps … u Detector Description u Other Algorithms u Photon Detector Implementation n Not addressed u Structure of a general LHCb reconstruction program
LHCb Software Week Tuesday, February 02, 2016 Final Summary n UML process for software development n Standalone program has similar performance as the TP n Pleasant surprise: you can do a lot OO for reconstruction applications n There is the promise for a program that will be easier to maintain n You can try it yourself in GAUDI