AliRoot Tips

What you want to know and you never asked AliRoot

-- JuanCastillo - 15 Dec 2008

Useful links

Quick Aliroot Object Guide

  • AliCDBManager: Data base manager. SetRun, SetDefaultStorage.
  • AliRunLoader: Load gAlice (also from file), that:
    • Supports the list of all Alice Detectors (fModules).
    • Supports the list of particles (fParticles).
    • Supports the Trees.
    • Supports the geometry.
    • Supports the event display.

  • AliStack:It is used to compare results of reconstruction with simulation
  • AliGenCocktail: "Cocktail" of generator. You must add generators to it, for example:
   AliGenCocktail *gen  = new AliGenCocktail();
   AliGenPythia *beauty = new AliGenPythia(200);
   AliGenPythia *charm  = new AliGenPythia(200);
   ... //and more configuration or generators

  • TParticle: ROOT "particle" class. See also "TParticlePDG".

The ESD (Event Summary Data)

Info: Offline Reconstruction

To process event information, you should:

  • have an handler to deal with the ESDs (AliESDInputHandler)
  • retrieve an ESD (AliESDEvent)
  • Obtain a track (AliESDtrack)
  • Do something with it (AliExternalTrackParameter)

ALERT! HINT: A raw ESD reconstructed track is equivalent, in principle, to all charged particle, so at one point cuts must be applied, to get rid of detector effects or material budget effects, for example.

Related Objects


It contains all the information needed during the physics analysis:
Documentation AliESDEvent

  • fields to identify the event such as run number, event number, trigger word, version of the reconstruction, etc.;
  • reconstructed ZDC energies and number of participant;
  • primary vertex;
  • T0 estimation of the primary vertex;
  • array of ESD tracks;
  • arrays of HLT tracks both from the conformal mapping and from the Hough transform reconstruction;
  • array of MUON tracks;
  • array of PMD tracks;
  • arrays of reconstructed V 0 vertexes, cascade decays and kinks;
  • indexes of the information from PHOS and EMCAL detectors in the array of the ESD tracks.


Handler of the ESD events. Use it in this way:
Documentation AliESDInputHandler.

  TFile *esdfile = TFile::Open("AliESDs.root"); //ESD file
  AliESDEvent *fESD    = new AliESDEvent();  //ESD
  TTree *tree = (TTree *)esdfile->Get("esdTree");  //ESD tree
  AliESDInputHandler *esdH = new AliESDInputHandler();
  esdH->Init(tree,0);      //initiated with the tree
  for(int i=0; i<  tree->GetEntries() ;++i){
      fESD = esdH->GetEvent();  //now you have the ESD
      Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());


additional info


One of the AliESDEvent TClonesArray. It contains kinematic information. See below for the whole picture.
Documentation: AliESDtrack

Image: esdTree.Tracks branch


External info added to a AliESDtrack
Documentation: AliExternalTrackParameter

Image: esdTree.Tracks.GetTPCInnerParam() branch

Image: esdTree.Tracks.fTPCInnerParam branch

The MC truth (Monte Carlo truth)

To access to the information used for generating the events, you should:

  • have an object to deal with MC information (Documentation: AliMCEventHandler)
  • retrieve a MC event (Documentation: AliMCEvent)
  • Obtain a MC particle (Documentation: AliMCParticle)
  • Do something with it ( for example, you can obtain a TParticle from AliMCParticle )

ALERT! HINT: AliMCParticle is equivalent, in principle, to ALL particles. So you have charged, uncharged, long lived ("stable") and short lived. Everything.

The Analysis task

Your analysis must be, at one point, included in an analysis task.
The analysis task must follow the train requirements, so pleas check TrainTips.

Filtering data

ALERT! NOTE: this tips are for a multiplicity study.

Selecting MC information

By default, AliMCParticle is storing all generated particles. You can be interested in select some of them. First you obtain the associated particle, after that you can retrieve the state information. You can do that writting:

 TParticle   *fFSP;    //Final State Particle
 fFSP = MCpart->Particle(); //MCPart is a AliMCParticle
 if (!fFSP) {
    Printf("ERROR: Could not receive FS particle %d", itrk);
 //final state particles only
  //do something

The stored codes are (souce: Monte Carlo Information

Code Description
0 primaries (neutrino and nucleus)
1 stable (not a resonance) final state particle
3 decay (usually of a resonance)
11 marks the target nucleon
14 particles that underwent intra-nuclear scattering

Selecting refitted tracks

We can ask if the track has been refit backwards (if yes, it means more quality)

      if(track->GetStatus()&AliESDtrack::kTPCrefit){  //good track
        Printf("Track has refit %d and this means %d",track->GetStatus(),track->GetStatus()&AliESDtrack::kTPCrefit);
        Printf("Bad track: refit %d and this means %d",track->GetStatus(),track->GetStatus()&AliESDtrack::kTPCrefit);

Applying track cuts

There's a standart class for it, inside the AliRoot package ANALYSIS. You can find the code here:

One of the ways of using it is asking for the list of good tracks:

   // at the constructor, before you use it
   fEsdTrackCuts = new AliESDtrackCuts("track cut","track cut");
   //list of cutted tracks of the ESD fESD
   TObjArray* list  = fEsdTrackCuts->GetAcceptedTracks(fESD);
   Int_t nGoodTracks = list->GetEntries();
   //loop over cutted tracks
   for (Int_t i=0; i<nGoodTracks; i++){
     AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (list->At(i));

The other way is using it to ask if the track is "good" after the cuts

Uploading your PAR file: user defined annalysis

  • Create a directory with the name of your "future" par package. ( ex: MDHANDLER)
  • Include your stuff on it, and compile it (ex: root[].x MDhandler.cxx+ for a single additional class)
  • Do what is written in : Example: Upload a library:
    • create a subfolder PROOF-INF
    • Create file PROOF-INF/SETUP.C
    • tar -czf MDHANDLER.par MDHANDLER
  • Load your code into runLocal.C. Two ways:
    • load only your library, adding in a line gSystem->Load("MDHANDLER/");
    • load the par file, adding in a line: setupPar("MDHANDLER")

How to solve errors, additional tips

  • Try first with a truncated data file, that is, don't run the whole analysis. Divide and you will win.
  • Be careful. Each new object or function you include may cause a crash of your task. For example, cout is not used, but Printf

If everythig's fine, you may see per ESD file processed a message like this:

  AliMCEventHandler::Notify() Path: /lustre_alpha/alice/sma/v4-10-Release/fulleta_pp/05007/
  AliMCEvenHandler::Init() 126

Or, in the newest versions (after all the printed messages saying your par file has been built, before the end)

  I-AliMCEvent::ConnectTreeK: AliMCEvent#    99    99: Number of particles:   136 (all)    44 (primaries)

Personal Links

Topic attachments
I Attachment Action Size Date Who Comment
ESD_Tracks.pngpng ESD_Tracks.png manage 60.1 K 2008-05-23 - 13:33 JuanCastillo esdTree.Tracks branch
ESD_Tracks_GetTPCInnerParam.pngpng ESD_Tracks_GetTPCInnerParam.png manage 29.8 K 2008-05-23 - 13:51 JuanCastillo esdTree.Tracks.GetTPCInnerParam() branch
ESD_Tracks_fTPCInnerParam.pngpng ESD_Tracks_fTPCInnerParam.png manage 30.4 K 2008-05-23 - 13:53 JuanCastillo esdTree.Tracks.fTPCInnerParam branch
Multiplicity_ESD_5000_e.pngpng Multiplicity_ESD_5000_e.png manage 6.5 K 2008-05-27 - 09:02 JuanCastillo Multiplicity in Log scale -50 ESD files-
Topic revision: r25 - 2009-07-10, JuanCastillo
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback
Imprint (in German)
Privacy Policy (in German)