100 likes | 223 Views
P.Hristov Off-line Week March 10, 2004 CERN. Code&Semantic Observations. Simulation classes Generation of particles Hits Track references Summable digits Digits AliSimulation Reconstruction classes Clusters/RecPoints Tracks Vertex PID ESD AliReconstruction. IO classes Loaders
E N D
P.Hristov Off-line Week March 10, 2004 CERN Code&Semantic Observations
Simulation classes Generation of particles Hits Track references Summable digits Digits AliSimulation Reconstruction classes Clusters/RecPoints Tracks Vertex PID ESD AliReconstruction IO classes Loaders AliStream Classes, related to “conditions” Geometry Magnetic field Configuration Event headers General/service classes AliRun … Obsolete classes? STEER
STEER I • AliRun: delete gAlice->GetRunLoader(); delete gAlice; AliRunLoader rl = AliRunLoader::Open(“galice.root”); gAlice = rl->GetAliRun(); • => Something is wrong, we should instantiate AliRun only when it is needed, and can be initiated correctly. Do we need the global pointer gAlice? • Many shortcut methods can be removed • Obsolete parts of the code (Tree2Tree, etc.) • What should be the main function of AliRun?
STEER II • AliModule & AliDetector • Used in simulation & reconstruction => could we separate the two main use cases? • Do we need both? • What would be the relation with AliReconstructor class (see the talk of Thomas)? • AliMC & AliStack • Could AliMC be singleton which is not accessed via AliRun? • Could we make more clean distinction of responsibilities between AliMC and AliStack? • Could we avoid the mapping in AliStack?
STEER III: AliStream AliRunDigitizer AliRunDigitizer AliStream AliStream AliStream AliStream galice.root AliRunLoader galice.root with sdigits galice.root with sdigits galice.root with sdigits sdigits sdigits sdigits Do we really need this functionality?
STEER IV • Could we fix the interfaces using pure virtual classes? • Missing base classes: • Calibration • Alignment • What else? • Could we revise the “dependences” (inheritance, usage, composition, aggregation, etc.)?
Tasks • Features: • Recursive call of subtask tree via ExecuteTask/Exec/TTask::ExecuteTasks • Browsing & debugging • Main issues: • Access by name should be avoided • Object ownership: strict discipline in Add/CleanTasks/Clear needed • Conversion to tasks: only partially done
Tasks II • Advantages • Uniform implementation of methods • Recursive behavior • Dynamic creation of task trees • Possibility to present/browse/debug • Concerns • More suitable for interactive jobs • Needs fully implemented task chains • Gives easy access by name => possible misusage • Simplicity: do we need this functionality? • How should we continue?
Pointers • Usage of pointers as data members: question of composition vs aggregation. If the object-data member has to be deleted in the destructor, one better uses it directly • Exceptions: if the size of (simple) container is variable or too big, use “new” • Root containers: set correctly object ownership • If you use pointers as data members, you must initialize them • Do not delete objects if you are not the owner • New/delete: avoid memory leaks
Pointers II • f->GetA()->GetB()->GetC()->Do(); usually occurs if the class responsibilities are not well defined • Could we improve such cases? • Transient pointers: do not forget to indicate by exclamation mark “//!” that given pointer should not be stored