-void AliRun::ResetSDigits()
-{
- //
- // Reset all Detectors digits
- //
- TIter next(fModules);
- AliModule *detector;
- while((detector = dynamic_cast<AliModule*>(next()))) {
- detector->ResetSDigits();
- }
-}
-
-
-//_______________________________________________________________________
-
-void AliRun::ResetPoints()
-{
- //
- // Reset all Detectors points
- //
- TIter next(fModules);
- AliModule *detector;
- while((detector = dynamic_cast<AliModule*>(next()))) {
- detector->ResetPoints();
- }
-}
-//_______________________________________________________________________
-
-void AliRun::InitMC(const char *setup)
-{
- //
- // Initialize ALICE Simulation run
- //
- Announce();
-
- if(fInitDone) {
- AliWarning("Cannot initialise AliRun twice!");
- return;
- }
-
- if (!fMCApp)
- fMCApp=new AliMC(GetName(),GetTitle());
-
- gROOT->LoadMacro(setup);
- gInterpreter->ProcessLine(fConfigFunction.Data());
-
- fRunLoader->CdGAFile();
-
- AliPDG::AddParticlesToPdgDataBase();
-
- fNdets = fModules->GetLast()+1;
-
- TIter next(fModules);
- for(Int_t i=0; i<fNdets; ++i)
- {
- TObject *objfirst, *objlast;
- AliModule *detector=dynamic_cast<AliModule*>(fModules->At(i));
- objlast = gDirectory->GetList()->Last();
-
- // Add Detector histograms in Detector list of histograms
- if (objlast) objfirst = gDirectory->GetList()->After(objlast);
- else objfirst = gDirectory->GetList()->First();
- while (objfirst)
- {
- detector->Histograms()->Add(objfirst);
- objfirst = gDirectory->GetList()->After(objfirst);
- }
- }
-
- fMCApp->Init();
-
- //Must be here because some MCs (G4) adds detectors here and not in Config.C
- InitLoaders();
- fRunLoader->MakeTree("E");
- if (fLego == 0x0)
- {
- fRunLoader->LoadKinematics("RECREATE");
- fRunLoader->LoadTrackRefs("RECREATE");
- fRunLoader->LoadHits("all","RECREATE");
- }
- fInitDone = kTRUE;
- //
- // Save stuff at the beginning of the file to avoid file corruption
- fRunLoader->CdGAFile();
- Write();
- fEventNrInRun = -1; //important - we start Begin event from increasing current number in run
-}
-
-//_______________________________________________________________________
-
-void AliRun::RunMC(Int_t nevent, const char *setup)
-{
- //
- // Main function to be called to process a galice run
- // example
- // Root > gAlice.Run();
- // a positive number of events will cause the finish routine
- // to be called
- //
- fEventsPerRun = nevent;
- // check if initialisation has been done
- if (!fInitDone) InitMC(setup);
-
- // Create the Root Tree with one branch per detector
- //Hits moved to begin event -> now we are crating separate tree for each event
-
- gMC->ProcessRun(nevent);
-
- // End of this run, close files
- if(nevent>0) FinishRun();
-}
-
-//_______________________________________________________________________
-void AliRun::RunReco(const char *selected, Int_t first, Int_t last)
-{
- //
- // Main function to be called to reconstruct Alice event
- //
- Int_t nev = fRunLoader->GetNumberOfEvents();
- AliDebug(1, Form("Found %d events", nev));
- Int_t nFirst = first;
- Int_t nLast = (last < 0)? nev : last;
-
- for (Int_t nevent = nFirst; nevent <= nLast; nevent++) {
- AliDebug(1, Form("Processing event %d", nevent));
- GetEvent(nevent);
- Digits2Reco(selected);
- }
-}
-
-//_______________________________________________________________________
-