10
Off-line week, 10/03/2004 P.Hristov 1 Code&Semantic Observations P.Hristov Off-line Week March 10, 2004 CERN

Code&Semantic Observations

  • Upload
    eshana

  • View
    31

  • Download
    0

Embed Size (px)

DESCRIPTION

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 - PowerPoint PPT Presentation

Citation preview

Page 1: Code&Semantic Observations

Off-line week, 10/03/2004 P.Hristov 1

Code&Semantic Observations

P.HristovOff-line Week

March 10, 2004CERN

Page 2: Code&Semantic Observations

Off-line week, 10/03/2004 P.Hristov 2

STEER• 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?

Page 3: Code&Semantic Observations

Off-line week, 10/03/2004 P.Hristov 3

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?

Page 4: Code&Semantic Observations

Off-line week, 10/03/2004 P.Hristov 4

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?

Page 5: Code&Semantic Observations

Off-line week, 10/03/2004 P.Hristov 5

STEER III: AliStream

AliRunDigitizer

AliStream

galice.rootwith sdigitsgalice.rootwith sdigitsgalice.rootwith sdigits

AliStream

AliRunDigitizer

AliStream AliStream

sdigitssdigits

sdigits

galice.rootAliRunLoader

Do we really need this functionality?

Page 6: Code&Semantic Observations

Off-line week, 10/03/2004 P.Hristov 6

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.)?

Page 7: Code&Semantic Observations

Off-line week, 10/03/2004 P.Hristov 7

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

Page 8: Code&Semantic Observations

Off-line week, 10/03/2004 P.Hristov 8

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?

Page 9: Code&Semantic Observations

Off-line week, 10/03/2004 P.Hristov 9

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

Page 10: Code&Semantic Observations

Off-line week, 10/03/2004 P.Hristov 10

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