# Presentation: 660102

##  The Interface to Geant3The AliRoot Environment

**Federico Carminati**

## ALICE Situation beg. ‘98

**Alice started later than the others**
**Smaller collaboration - must reuse code**
**Software and Physics one single group**
**ALICE TDR’s were starting**
**Multi-****million choices, minimise the legacy code**
**IT/LCB/R&D was (is) not ready**
**Existing framework FORTRAN + ZEBRA +PAW**
**Users were not (yet all) speaking OO**
**Split into “dinosaurs”, “prophets” and “lost users”**

- FNAL Root WorkShop

- 23/3/99

## The LHC Computing Challenge

**Train and Involve the User Community**

**Design the New Software Framework**

- and

- and

**Design the Detectors and Prepare the Code Now**

- FNAL Root WorkShop

- 23/3/99

## Simulation is important!

**LHC: new energies and particle densities**
**Cannot rely on experience or on theory**
**We cannot reproduce the conditions in test beams**
**We have to understand the detector to**
**understand what we see**
**estimate what we do not see**
**We need a simulation that is**
**reliable**
**predictive, i.e. based as much as possible on physics principles**

- FNAL Root WorkShop

- 23/3/99

## The Bleeding Edgeof Technology

- FNAL Root WorkShop

- 23/3/99

## Physics

- gamma-A

- mu-A

- Cherenkov

- TR

- Synchrotron

- FNAL Root WorkShop

- 23/3/99

## GEANT 3.21

**Unmaintained**
**Apart from ****me**** and ****P.Nevsky**** (STAR) ...**
**Old physics**
**Parametrisation (GHEISHA 1985-1990)**
**Old version of FLUKA (1992)**
**Old geometrical modeller**
**Solid and well tested (do not use “MANY”!)**
**Single precision geometry**
**“****Old fashion****” FORTRAN environment**

- FNAL Root WorkShop

- 23/3/99

## GEANT 4

**CERN IT flagship project**
**OO distributed development by 40 people**
**Released 1/1/1999**
**Basically untested for physics**
**Microscopic simulation only in 6-8 months (?)**
**Geometry not much better than G3.21**
**In fact worst, and buggy**
**Structure of the project very uncertain**
**Support provided at the *****discretion***** of the partners**

- FNAL Root WorkShop

- 23/3/99

## FLUKA

**Physics-wise the best of them all**
**all the components shown, microscopic all the way**
**virtually infinite set of validations**
**full set of biasing tools**
**Very primitive UI**
**input via formatted records, output via tables**
**Good but limited geometry**
**Boolean operations**
**flat structure, no instantiation**
**difficult to use**

- FNAL Root WorkShop

- 23/3/99

## Are we in trouble?

**Using GEANT 3.21**
**Stay with FORTRAN, shaky physics and geometry**
**Using GEANT 4**
***Fresh from the oven:***** can we trust it yet?**
**Using FLUKA**
**Difficult to use, limited geometry**

- Yes, we are in trouble!

- FNAL Root WorkShop

- 23/3/99

## ALICE’s choice

**Adopt the ROOT OO framework**
**Use GEANT 3.21 initially**
**Allow use of FORTRAN and C++**
**Allow to start with “wrapping” and “bad design”**
***Impose***** a single framework**
**Provide central support, documentation and distribution**
**Train users in the framework**

- FNAL Root WorkShop

- 23/3/99

## The Initial Framework

- New Transport
- Engine

- FNAL Root WorkShop

- 23/3/99

## AliRoot evolution schema

- FNAL Root WorkShop

- 23/3/99

## The AliRoot framework

**ALICE Algorithms****ROOT data structures**

- FNAL Root WorkShop

- 23/3/99

## The AliRoot Framework

**We follow a *****minimum resistance path***
**Use ROOT containers**
**Forbid the use of templates**
**Do not use STL**
**Completely rely on CINT**
**Do not use CLHEP**
**Do not use LHC++**
**Do not support other components**
_**Not**_** worried by all-out modularity**

- FNAL Root WorkShop

- 23/3/99

## Framework questions

**Everybody would like a framework that**
**Is totally modular (whatever that means)**
**Preserves the functionality of all the components**
**Hides the details of the different components**
**Is completely coherent**
**My suggestion**

- Write a letter to Santa Klaus

- (

- FNAL Root WorkShop

- 23/3/99

## Modularity I

- FNAL Root WorkShop

- 23/3/99

## Modularity II

**User Module**

**User Module**

**User Module**

**User Module**

**User Module**

**User Module**

**I/O**

**containers**

**containers**

**containers**

**containers**

- FNAL Root WorkShop

- 23/3/99

## Modularity III

**I/O, UI and containers**

- )

- FNAL Root WorkShop

- 23/3/99

## The AliRoot framework

**The GEANT user routines in C++**
**The event control is in ROOT**
**Kumacs no longer used**
**Full power of ROOT interactive interpreter**
**No need for data card file any more**
**No difference between interactive and batch**
**Full interactive access to GEANT functionality**
**GEANT is an object (TGeant3) derived from an abstract class (AliMC)**

- FNAL Root WorkShop

- 23/3/99

## The AliRoot framework

**Dependency on CERNLIB minimised **
**All libraries are shared**
**A detector version derives from the generic detector**
**AliDetector->AliTPC->AliTPCv0**
**Independent from GEANT sets and dets**
**Reconstruction/Analysis are naturally developing in the same framework**

- FNAL Root WorkShop

- 23/3/99

## Old schema

- FNAL Root WorkShop

- 23/3/99

## New schema

- GUSTEP

- FNAL Root WorkShop

- 23/3/99

## The MC class

- MC Virtual
- GetPosition

- MC->GetPosition(Float_t *x)

- FNAL Root WorkShop

- 23/3/99

## I/O Schema

**Header Tree**

**Hit Tree**

**Kine Tree**

**Digi Tree**

- 1 *entry/*run

- 1 *entry/*event

- 1 *entry/*track

- 1 *entry/*event

- FNAL Root WorkShop

- 23/3/99

## Comparison new/old

**Time per event**
**Old ****	****710’/event (=11h:50m)**
**New ****	****435’/event (=7h:15m)**
** ****Source**
**Old ****	****34 kLOC C++, 59.5 kLOC FORTRAN**
**New ****	****57.5kLOC C++, 2 k LOC FORTRAN**
**Space**
**Old****	****galint executable 11MB**
**New****	****AliRoot executable 438kB**

- FNAL Root WorkShop

- 23/3/99

## Comparison new/old

**Time to link**
**Old****	****40”**
**New****	****<1”**
**Libraries needed**
**Old****	****ROOT+geant321+cernlib (50MB)**
**New****	****ROOT+geant321 shared+μ-cernlib (30MB)**
**Documentation**
**Old****	****Web page (by hand!)**
**New ****	****in the **_**[code](file:///D:/aliroot_html/Welcome.html)**_** and automatically extracted**

- FNAL Root WorkShop

- 23/3/99

## Migration Strategy

**New framework is simpler and clearer **
**But not everybody speaks C++ yet**
**Next steps**
**Every Project nominate an Off-line coordinator**
**At least this person come at CERN and spend one week with us to get familiar with the system**
**At least one (different) person per project involved in Software follow the AliRoot training**
**We have tried the above “on the field” and it works very well**

- FNAL Root WorkShop

- 23/3/99

## Where can we go from here

- New Transport
- Engine

**FLUKA**

- FNAL Root WorkShop

- 23/3/99

## What will we gain?

**The best MC we can possibly have today**
**A solid simulation framework**
**where we can insert G4 at the appropriate moment**
**The end of the era of two geometries - two runs for every important result**

- FNAL Root WorkShop

- 23/3/99

## Conclusions

**Thanks to ROOT we have a coherent and modular framework**
**Different MC’s and I/O packages have been interfaced with the system**
**The ALICE **_**production**_** code is in C++**
**Migration is not a major problem**
**Users are happy with a simple environment and a strong central support**

- FNAL Root WorkShop

- 23/3/99

## BRL - Cad

- FNAL Root WorkShop

- 23/3/99

## Irit

- FNAL Root WorkShop

- 23/3/99

## C.G.A.L.

- FNAL Root WorkShop

- 23/3/99