How to open session: use static method AliRunLoader::Open("galice.root","AlicE","update") How to get total number of events in galice.root: use AliRun::GetEventsPerRun() How to avoid using gAlice: detector->GetLoader()->GetRunLoader()->GetAliRun() returns gAlice global pointer. How to retrieve pointer to alice run loader: use pRICH->GetLoader()->GetRunLoader() (all detector classes inherit from AliDetector which has GetLoader()) use method AliRun::GetRunLoader for gAlice (deprecated) How to get pointers to different root trees: TreeE belongs to AliRunLoader, available after AliRunLoader::LoadHeader() TreeK belongs to AliRunLoader, available after AliRunLoader::LoadKinematics() TreeH belongs to AliLoader , available after AliLoader::LoadHits() TreeS belongs to AliLoader , available after AliLoader::LoadSDigits() TreeD belongs to AliLoader , available after AliLoader::LoadDigits() TreeR belongs to AliLoader , available after AliLoader::LoadRecPoints() all methods return 0 on success. How to get event of interest: AliRunLoader::GetEvent(event_number) returns 0 on success How to deal with the stack of particles? - first of all, the stack includes primary as well as secondary particles - pointer to the stack is taken: AliRun::Stack() (global gAlice of type AliRun - deprecated way to do) AliRunLoader::Stack() but before one needs to load event header by AliRunLoader::LoadHeader() otherwise both methods return 0. Moreover loading header gives the information about number of particles only. To retrieve the list of particle one also needs to load kinematics by AliRunLoader::LoadKinematics() - total amount of particles in stack for a given event: AliStack::GetNtrack() AliRun::GetEvent() (after LoadHeader()) - total amount of primary particles in stack for a given event (after LoadHeader()): AliStack::GetNprimary() How to retrieve hits: Hits are stored on primary by primary basis. Hits for the given primary is TClonesArray. To retrieve all hits one needs to do: -initialize the root tree and containers: pRich->GetLoader()->LoadHits(); (AliLoader::LoadHits() returns 0 on success) -read number of entries in TreeH: pRich->GetLoader()->TreeH()->GetEntries() -then for each entry: pRich->GetLoader()->TreeH()->GetEntry(i) How to retrieve sdigits? Sdigits stored in tree S with the branch of TClonesArray, all sdigits in a single TClonesArray So the tree has only one entry. One needs to say: -pRich->GetLoader()->LoadSDigits(); this one open file, get the tree and invoke AliRICH::SetTreeAddress() How to retrieve digits? Digits stored in tree D with the 7 branches of TClonesArray, one per chamber, all digits of a given chamber in a single TClonesArray So the tree has only one entry. -One needs to say: pRich->GetLoader()->LoadDigits(); this one opens file, gets the tree and invoke AliRICH::SetTreeAddress() which in turn corresponds branches of the tree to the digits containers in memory. There are 7 containers, one per chamber, all of them belong to AliRICH. -Then one needs to take the tree entry (only one) to the memory: pRich->GetLoader()->TreeD()->GetEntry(0) -Finally pRich->Digits(chamber_number) returns the pointer to TClonesArray of AliRICHdigit What are the debug methods avail: AliLog::SetGlobalDebugLevel(AliLog::kDebug) How to get info for a given particle number: Header and Kinematics trees must be loaded, then possible to retrieve pointer to Stack of particles Int_t AliRunLoader::LoadHeader(); Int_t AliRunLoader::LoadKinematics() AliStack *AliRunLoader::Stack() TParticle *AliStack::Particle(tid) TParticle::Print() How to deal with AliRunDigitizer: AliRunDigitizer::Exec() just call AliRunDigitizer::Digitize() What are the meanings of different VMC flags: gMC->IsTrackAlive() gMC->IsTrackStop() gMC->IsTrackDisappeared() How to get pad number for a local position: use static TVector AliRICHParam::Loc2Pad(TVector2 position); Why list of chambers belongs to AliRICHParam: How to check if a given stack particle is primary: Stack is TClonesArray of TParticle. TParticle::GetMother(0) returns -1 if it's primary (no mother) How to loop over all possible object: for(Int_t iEventN=0;iEventN < GetLoader()->GetRunLoader()->GetAliRun()->GetEventsPerRun();iEventN++){//events loop for(Int_t iEntryN=0;iEntryN < GetLoader()->TreeH()->GetEntries();iEntryN++){//TreeH loop GetLoader()->TreeH()->GetEntry(iEntryN);//get current entry (prim) for(Int_t iHitN=0;iHitNGetEntries();iHitN++){//hits loop AliVHMPIDHit *pHit=(AliVHMPIDHit*)Hits()->At(iHitN);//get current hit }//hits loop }//TreeH loop }//events loop RICH full simulation-reconstruction sequence hits->sdigit: Responsible method is AliRICH::Hits2SDigits One hit may affect one or more pads. Hit position is taken on the anode wires plane as the most of avalanche is developed there. This position is not directly available, track intersections with entrance and exit of amplification gap are only stored. So the position in the middle of the gap is calculated as average out of pHit->In() and pHit->Out() positions. Then, total charge collected for this hit is calculated by AliRICHParam::Hit2Qdc. Area of disintegration is a list of pads affected by current hit. This is a parameter of Mathienson sdigits->digits: The necessety of sdigits is dictated by the fact that trasport engine transports track by track. It means that it may happen that the same pad is affected by few tracks. But this might be known after the trasport of full event only. Generalized structure of AliReconstruction: Run() { if(there is galice.root) | AliRunLoader::Open(....) | this is done in InitRunLoader() else | if(raw data process requested) | create galice.root on the base of AliRawReader::NextEvent | for(all detectors){ | if(detector not selected to run) skip this detector | reconstructor=get detector's reconstructor | this is done in RunLocalReconstruction() if(detector HasLocalReconstruction) skip this detector | IMPORTANT! if HasLocalReconstruction() returns YES use RunLocalEventReconstruction instead if(run upon raw data) | reconstructor->Reconstruct(fRunLoader, fRawReader); | else | reconstructor->Reconstruct(fRunLoader); | } for(all events){ for(all detectors){ | if(detector not selected to run) skip this detector | reconstructor=get detector's reconstructor | loader=get detector's loader | this is done in RunLocalEventReconstruction() if(raw data process requested and detector HasDigitConversion){ | loader->LoadDigits("update"); | open file and invoke detector->SetTreeAddress(); loader->CleanDigits(); | loader->MakeDigitsContainer(); | create tree reconstructor->Reconstruct(fRawReader,loader->TreeD()); | expected to fill TreeD out of raw reader loader->WriteDigits("overwrite"); | loader->UnloadDigits(); | } | if(detector do not HasLocalReconstruction) skip this detector | IMPORTANT! assumed that this detector is already processed in RunLocalReconstruction() loader->LoadRecPoints("update"); | loader->CleanRecPoints(); | loader->MakeRecPointsContainer(); | if(fRawReader && reconstructor do not HasDigitConversion()){ | reconstructor->Reconstruct(fRawReader, loader->TreeR()); | expected to fill TreeR out of raw reader }else{ | loader->LoadDigits("read"); | reconstructor->Reconstruct(loader->TreeD(),loader->TreeR()); | the only operations inside are pDigTree->GetEntry(0) and pCluTree->Fill(); loader->UnloadDigits(); | } | loader->WriteRecPoints("OVERWRITE"); | loader->UnloadRecPoints(); | }//detectors loop | }//events loop }