Exemple #1
0
void
Digits2Raw()
{
  // AliLog::SetModuleDebugLevel("FMD", 10);
  AliLog::SetModuleDebugLevel("RAW", 1);
  AliRunLoader* runLoader = AliRunLoader::Open("galice.root", "Alice", "read");
  if (!runLoader) {
    AliError("Coulnd't read the file galice.root");
    return;
  }
  
  if  (runLoader->LoadgAlice()) return;
  AliRun* run = runLoader->GetAliRun();
  
  // Get the FMD 
  AliFMD* fmd = static_cast<AliFMD*>(run->GetDetector("FMD"));
  if (!fmd) {
    AliError("Failed to get detector FMD from loader");
    return;
  }
  
  // Get the FMD loader
  AliLoader* loader = runLoader->GetLoader("FMDLoader");
  if (!loader) {
    AliError("Failed to get detector FMD loader from loader");
    return;
  }
  if (runLoader->LoadHeader()) { 
    AliError("Failed to get event header information from loader");
    return;
  }
  TTree* treeE = runLoader->TreeE();
  
  AliCDBManager::Instance()->SetRun(0);
  AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  
  AliFMDParameters::Instance()->Init(kFALSE,
				     (AliFMDParameters::kPulseGain|
				     (AliFMDParameters::kPedestal|
				      AliFMDParameters::kDeadMap|
				      AliFMDParameters::kSampleRate|
				      AliFMDParameters::kAltroMap|
				      AliFMDParameters::kStripRange)));
  AliFMDParameters::Instance()->SetZeroSuppression(1);
  // AliFMDParameters::Instance()->SetPedestal(100);
  // AliFMDParameters::Instance()->SetPedestalWidth(0);
  // AliFMDParameters::Instance()->SetZSPreSamples(0);
  // AliFMDParameters::Instance()->SetZSPostSamples(0);
  
  fmd->Digits2Raw();
}
//_____________________________________________________________________________
Int_t AliTRDdisplayDigits3D(Int_t event = 0, Int_t thresh = 4
                          , Bool_t sdigits = kFALSE) 
{
  //  
  //  TRD digits display
  //
  //  Input parameter:
  //    <event>   : Event number 
  //    <thresh>  : Threshold to suppress the noise
  //    <sdigits> : If kTRUE it will display summable digits, normal digits otherwise.
  //                The signal event is displayed in yellow.
  //

  Char_t *inputFile = "galice.root";

  // Define the objects
  AliTRDv1       *trd;
  AliTRDgeometry *geo;

  TString       evfoldname = AliConfig::GetDefaultEventFolderName();
  AliRunLoader *runLoader  = AliRunLoader::GetRunLoader(evfoldname);
  if (!runLoader) {
    runLoader = AliRunLoader::Open(inputFile
                                  ,AliConfig::GetDefaultEventFolderName()
                                  ,"UPDATE");
  }
  if (!runLoader) {
    printf("Can not open session for file %s.",inputFile);
    return kFALSE;
  }
   
  if (!runLoader->GetAliRun()) {
    runLoader->LoadgAlice();
  }
  gAlice = runLoader->GetAliRun();  
  if (!gAlice) {
    printf("Could not find AliRun object.\n");
    return kFALSE;
  }

  runLoader->GetEvent(event);
  
  AliLoader *loader = runLoader->GetLoader("TRDLoader");
  if (!loader) {
    printf("Can not get TRD loader from Run Loader");
  }
  loader->LoadDigits();
  
  // Get the pointer to the detector object
  trd = (AliTRDv1*) gAlice->GetDetector("TRD");

  // Get the pointer to the geometry object
  if (trd) {
    geo = trd->GetGeometry();
  }
  else {
    printf("Cannot find the geometry\n");
    return 1;
  }

  AliCDBManager *cdbManager  = AliCDBManager::Instance();
  cdbManager->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
  calibration->SetRun(0);

  TCanvas *c1 = new TCanvas("digits","TRD digits display",0,0,700,730);
  TView   *v  = new TView(1);
  v->SetRange(-430,-560,-430,430,560,1710);
  v->SetParallel();
  c1->Clear();
  c1->SetFillColor(1);
  c1->SetTheta(90.0);
  c1->SetPhi(0.0);

  Int_t markerColorSignal = 2;
  Int_t markerColorBgnd   = 7;
  Int_t markerColorMerged = 5;
  Int_t mask              = 10000000;

  // Create the digits manager
  AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager();
  digitsManager->SetSDigits(sdigits);

  // Read the digits from the file
  if (sdigits) {
    digitsManager->ReadDigits(loader->TreeS());
  }
  else {
    if (!loader->TreeD()) {
      printf("mist\n");
      return kFALSE;
    }
    digitsManager->ReadDigits(loader->TreeD());
  }

  Int_t totalsignal = 0;
  Int_t totalbgnd   = 0;
  Int_t totalmerged = 0;
  Int_t timeMax     = calibration->GetNumberOfTimeBins();

  // Loop through all detectors
  for (Int_t idet = 0; idet < geo->Ndet(); idet++) {

    printf("<AliTRDdisplayDigits3D> Loading detector %d\n",idet);
    AliTRDdataArrayI *digits  = digitsManager->GetDigits(idet);
    digits->Expand();

    Int_t isec    = geo->GetSector(idet);
    Int_t icha    = geo->GetChamber(idet);
    Int_t ipla    = geo->GetPlane(idet);
    AliTRDpadPlane *padPlane = new AliTRDpadPlane(ipla,icha);
    Int_t  rowMax = padPlane->GetNrows();
    Int_t  colMax = padPlane->GetNcols();

    Int_t ndigits = digits->GetOverThreshold(thresh);

    if (ndigits > 0) {

      TPolyMarker3D *pmSignal = new TPolyMarker3D(ndigits);
      Int_t isignal = 0;

      for (Int_t time = 0; time < timeMax; time++) {
        for (Int_t  col = 0;  col <  colMax;  col++) {
          for (Int_t  row = 0;  row <  rowMax;  row++) {

            Int_t amp = digits->GetDataUnchecked(row,col,time);

            if (amp > thresh) {
          
              Double_t glb[3];
              Double_t loc[3];

              loc[0] = row;
              loc[1] = col;
              loc[2] = time;
              geo->Local2Global(idet,loc,glb);
              Double_t x = glb[0];
              Double_t y = glb[1];
              Double_t z = glb[2];

              pmSignal->SetPoint(isignal,x,y,z);
              isignal++;
              totalsignal++;

	    }

	  }
        }
      }

      digits->Compress(1,0);

      pmSignal->SetMarkerSize(1); 
      pmSignal->SetMarkerColor(markerColorSignal);
      pmSignal->SetMarkerStyle(1);
      pmSignal->Draw();
   
    }

  }

  delete padPlane;

  TGeometry *geoAlice = gAlice->GetGeometry();
  TNode     *main     = (TNode *) ((geoAlice->GetListOfNodes())->First());
  TIter      next(main->GetListOfNodes());
  TNode     *module   = 0;
  while ((module = (TNode *) next())) {
    Char_t ch[100];
    sprintf(ch,"%s\n",module->GetTitle());
    if ((ch[0] == 'T') && ((ch[1] == 'R') || (ch[1] == 'P'))) {
      module->SetVisibility( 3);
    }
    else {
      module->SetVisibility(-1);
    }
  }
      
  geoAlice->Draw("same");

  c1->Modified(); 
  c1->Update(); 

  return 0;

}
Exemple #3
0
Int_t TOFquickanal(Int_t eventNumber = 0)
{
  /////////////////////////////////////////////////////////////////////////
  //   This macro is a small example of a ROOT macro
  //   illustrating how to read the output of GALICE
  //   and fill some histograms concerning the TOF Hit Tree.
  //
  //     Root > .L TOFquickanal.C   //this loads the macro in memory
  //     Root > TOFquickanal();     //by default process first event
  //     Root > TOFquickanal(2);    //process third event
  //Begin_Html
  /*
    <img src="picts/TOFquickanal.gif">
  */
  //End_Html
  //
  // Author: F. Pierella , Bologna University 12-04-2001
  // Updated to the new I/O by: A. De Caro, C. Zampolli
  /////////////////////////////////////////////////////////////////////////
  
  // Dynamically link some shared libs
  if (gClassTable->GetID("AliRun") < 0) {
    gROOT->LoadMacro("loadlibs.C");
    loadlibs();
  }

  Int_t rc = 0;
  
  AliRunLoader *rl =AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),"update");
  if (!rl) 
    {
      cerr << "Can't load RunLoader from file!\n";
      rc = 1;
      return rc;
    }

  rl->LoadgAlice();
  gAlice=rl->GetAliRun();

  if (!gAlice)
    {
      cerr << "<TOFquickanal> AliRun object not found on file \n";
      rc = 2;
      return rc;
    }

  // Get the pointer to the TOF detector
  AliLoader *tofl = rl->GetLoader("TOFLoader");
  AliTOF * tof = (AliTOF*) gAlice->GetDetector("TOF");
  if (tof == 0x0 || tofl == 0x0) {
    cerr << "<TOFquickanal> Can not find TOF or TOFLoader\n";
    rc = 3;
    return rc;
  }

  //=======> Create histograms
  //---> Time of Flight for Primary Particles (ns)
  TH1F *htofprim = new TH1F("htofprim","Time of Flight for Primary Particles",100,0.,100.);
  //--->Time of Flight for Secondary Particles (ns)
  TH1F *htofsec  = new TH1F("htofsec","Time of Flight for Secondary Particles",100,0.,100.);
  
  //---> r (radius) coordinate of production in the ALICE frame for secondary particles that produce at 
  //     least one TOF-hit (cm) - cylindrical coordinate system assumed, primary plus secondary-
  TH1F *hradius = new TH1F("hradius","r (radius) coordinate at the production vertex for secondary particles with at least one TOF-Hit",50,0.,500.);
  
  //---> Momentum of primary particles that produce (at least) one TOF-hit when the hit
  //     is produced (Gev/c)
  TH1F *htofmom  = new TH1F("htofmom","Momentum of primary particles when the Hit is produced",50,0.,5.);
  
  //---> Momentum of primary particles that produce (at least) one TOF-hit at the production vertex
  //     (Gev/c)
  TH1F *hprodmom  = new TH1F("hprodmom","Momentum of primary particles (with at least one TOF hit) at the production ",50,0.,5.); 
  
  //---> Theta of production for primary particles that produce (at least) one TOF-hit (deg)
  TH1F *hprodthe  = new TH1F("hprodthe","Theta of primary particles (with at least one TOF hit) at the production ",90,0.,180.);
  
  //---> Phi of production for primary particles that produce (at least) one TOF-hit (deg)
  TH1F *hprodphi  = new TH1F("hprodphi","Phi of primary particles (with at least one TOF hit) at the production ",180,-180.,180.);
  
  //---> z Coordinate of the TOF Hit (z beam axis) - primary plus secondary - (cm)
  TH1F *hzcoor = new TH1F("hzcoor","z Coordinate of the TOF Hit",800,-400.,400.);
  
  //---> Incidence Angle of the particle on the pad (or strip) (deg)  - primary plus secondary - 
  TH1F *hincangle = new TH1F("hincangle","Incidence Angle of the particle on the strip",90,0.,180.);
  
  printf ("Processing event %d \n", eventNumber);
  rl->GetEvent(eventNumber);
  
  // Get pointers to Alice detectors and Hits containers
  tofl->LoadHits();
  TTree *TH = tofl->TreeH();
  tof->SetTreeAddress();
  if (!TH) {
    cout << "<TOFquickanal> No hit tree found" << endl;
    rc = 4;
    return rc;
  }
  
  // Import the Kine Tree for the event eventNumber in the file  
  rl->LoadHeader();
  rl->LoadKinematics();
  //AliStack * stack = rl->Stack();
  
  Int_t ntracks = TH->GetEntries();
  cout<<" ntracks = "<<ntracks<<endl;
  
  AliTOFhitT0 *tofHit;
  
  // Start loop on tracks in the hits containers
  for (Int_t track=0; track<ntracks;track++) {
    
    tof->ResetHits();
    TH->GetEvent(track);
    
    for(tofHit=(AliTOFhitT0*)tof->FirstHit(track); tofHit; tofHit=(AliTOFhitT0*)tof->NextHit()) {
      
      Float_t toflight = tofHit->GetTof();
      toflight        *= 1.E+09;  // conversion from s to ns
      Double_t tofmom  = tofHit->GetMom();
      
      Int_t ipart = tofHit->Track();
      TParticle *particle = gAlice->Particle(ipart);
      if (particle->GetFirstMother() < 0) {
	htofprim->Fill(toflight);
	htofmom->Fill(tofmom); 
      } else {
	htofsec->Fill(toflight); 
      }
      
      Double_t zcoor = tofHit->Z();
      hzcoor->Fill(zcoor);
      
      Double_t incangle = tofHit->GetIncA();
      hincangle->Fill(incangle);
      
      Double_t xcoor  = particle->Vx();
      Double_t ycoor  = particle->Vy();
      Double_t radius = TMath::Sqrt(xcoor*xcoor+ycoor*ycoor);
      if (particle->GetFirstMother() >= 0) hradius->Fill(radius);
      
      Double_t prodmom = particle->P();        
      if (prodmom!=0.) {
	Double_t dummy = (particle->Pz())/prodmom;
	Double_t prodthe = TMath::ACos(dummy);
	prodthe *= 57.29578; // conversion from rad to deg
	if (particle->GetFirstMother() < 0) hprodthe->Fill(prodthe);
      } // theta at production vertex
      
      if (particle->GetFirstMother() < 0) {         
	hprodmom->Fill(prodmom);
	Double_t dummypx = particle->Px();
	Double_t dummypy = particle->Py();
	Double_t prodphi = TMath::ATan2(dummypy,dummypx);
	prodphi *= 57.29578; // conversion from rad to deg
	hprodphi->Fill(prodphi);
      } // phi at production vertex
    } // close loop on TOF-hits
  } // close loop on tracks in the hits containers
  
  //Create  canvas, set the view range, show histograms
  TCanvas *c1 = new TCanvas("c1","Alice TOF hits quick analysis",400,10,600,700);
  c1->cd();
  hprodmom->Draw();
  
  TCanvas *c2 = new TCanvas("c2","Alice TOF hits quick analysis",400,10,600,700);
  c2->cd();
  hprodthe->Draw();
  
  TCanvas *c3 = new TCanvas("c3","Alice TOF hits quick analysis",400,10,600,700);
  c3->cd();
  hprodphi->Draw();
  
  TCanvas *c4 = new TCanvas("c4","Alice TOF hits quick analysis",400,10,600,700);
  c4->cd();
  hzcoor->Draw();
  
  TCanvas *c5 = new TCanvas("c5","Alice TOF hits quick analysis",400,10,600,700);
  c5->cd();
  hradius->Draw();
  
  TCanvas *c6 = new TCanvas("c6","Alice TOF hits quick analysis",400,10,600,700);
  c6->cd();
  htofprim->Draw();
  
  TCanvas *c7 = new TCanvas("c7","Alice TOF hits quick analysis",400,10,600,700);
  c7->cd();
  htofsec->Draw();
  
  
  TCanvas *c8 = new TCanvas("c8","Alice TOF hits quick analysis",400,10,600,700);
  c8->cd();
  htofmom->Draw();
  
  TCanvas *c9 = new TCanvas("c9","Alice TOF hits quick analysis",400,10,600,700);
  c9->cd();
  hincangle->Draw();
  
  //tofl->UnloadHits();
  //rl->UnloadHeader();
  //rl->UnloadgAlice();
  //rl->UnloadKinematics();

  return rc;

}
Exemple #4
0
Int_t AliITSHits2SDigits(TString  filename = "galice.root")
 {
    // Standard ITS Hits to SDigits.

    // Dynamically link some shared libs
    if (gClassTable->GetID("AliRun") < 0) {
      gROOT->ProcessLine(".x $(ALICE_ROOT)/macros/loadlibs.C");
    }else if (gAlice){
      delete AliRunLoader::Instance();
      delete gAlice;
      gAlice=0;
     } 

    // Connect the Root Galice file containing Geometry, Kine and Hits

    AliRunLoader* rl = AliRunLoader::Open(filename);
    if (rl == 0x0)
     {
      cerr<<"AliITSHits2SDigits.C : Can not open session RL=NULL"
           << endl;
       return 3;
     }
     
    Int_t retval = rl->LoadgAlice();
    if (retval)
     {
      cerr<<"AliITSHits2SDigits.C : LoadgAlice returned error"
           << endl;
       return 3;
     }
    gAlice=rl->GetAliRun();
    AliITSLoader* gime = (AliITSLoader*) rl->GetLoader("ITSLoader");
    if (gime == 0x0)
     {
      cerr<<"AliITSHits2SDigits.C : can not get ITS loader"
           << endl;
     }
    AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");      
    if (!ITS) {
	cerr<<"AliITSHits2SDigits.C : AliITS object not found on file"
	    << endl;
	return 3;
    }  // end if !ITS
    if(!(ITS->GetITSgeom())){
       cerr << " AliITSgeom not found. Can't digitize without it." << endl;
       return 4;
    } // end if

    TStopwatch timer;
    Int_t evNumber1 = 0;
    Int_t evNumber2 = AliRunLoader::GetNumberOfEvents();
    timer.Start();
    retval = gime->LoadHits();
    if (retval)
     {
      cerr<<"AliITSHits2SDigits.C : ITSLoader::LoadHits returned error"
           << endl;
       return 3;
     }
    retval = gime->LoadSDigits("recreate");
    if (retval)
     {
      cerr<<"AliITSHits2SDigits.C : ITSLoader::LoadSDigits returned error"
           << endl;
       return 3;
     }
    for(Int_t event = evNumber1; event < evNumber2; event++){
       rl->GetEvent(event);
       if(!gime->TreeS()){ 
           cout << "Having to create the SDigits Tree." << endl;
           gime->MakeTree("S");
       } // end 

       ITS->MakeBranch("S");
       ITS->SetTreeAddress();
       cout<<"Making ITS SDigits for event "<<event<<endl;
       ITS->Hits2SDigits();
    } // end for event
    timer.Stop();
    timer.Print();

    delete rl; // sdigfile is closed by deleting gAlice if != hitfile.
    return 0;
}
Exemple #5
0
Int_t RunHLTITS(Int_t nev=1,Int_t run=0) {

  //  gSystem->Load("libAliHLTITS");

  TStopwatch timer;
  timer.Start();

   if (gAlice) {
      delete gAlice->GetRunLoader();
      delete gAlice; 
      gAlice=0;
   }

   AliRunLoader *rl = AliRunLoader::Open("galice.root");
   if (rl == 0x0) {
      cerr<<"Can not open session"<<endl;
      return 1;
   }
   Int_t retval = rl->LoadgAlice();
   if (retval) {
      cerr<<"AliESDtest.C : LoadgAlice returned error"<<endl;
      delete rl;
      return 1;
   }
   retval = rl->LoadHeader();
   if (retval) {
      cerr<<"AliESDtest.C : LoadHeader returned error"<<endl;
      delete rl;
      return 2;
   }
   gAlice=rl->GetAliRun();
       
   AliTracker::SetFieldMap(gAlice->Field());

   AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader");
   if (itsl == 0x0) {
      cerr<<"AliESDtest.C : Can not get the ITS loader"<<endl;
      return 3;
   }
   itsl->LoadRecPoints("read");

   AliITS *dITS = (AliITS*)gAlice->GetDetector("ITS");
   if (!dITS) {
      cerr<<"AliESDtest.C : Can not find the ITS detector !"<<endl;
      return 4;
   }
   //   AliITSgeom *geom = dITS->GetITSgeom();
   AliITSgeom *geom = new AliITSgeom();
   geom->ReadNewFile("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymmFMD.det");

   //An instance of the HLT ITS tracker
   AliHLTITStracker itsTracker(geom);

   TFile *ef=TFile::Open("AliESDs.root");
   if (!ef || !ef->IsOpen()) {cerr<<"Can't AliESDs.root !\n"; return 1;}
   AliESD* event = new AliESD;
   TTree* tree = (TTree*) ef->Get("esdTree");
   if (!tree) {cerr<<"no ESD tree found\n"; return 1;};
   tree->SetBranchAddress("ESD", &event);

   TFile *itsf=TFile::Open("AliESDits.root","RECREATE");
   if ((!itsf)||(!itsf->IsOpen())) {
      cerr<<"Can't AliESDits.root !\n"; return 1;
   }

   Int_t rc=0;
   if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents();
   //The loop over events
   for (Int_t i=0; i<nev; i++) {

     cerr<<"\n\nProcessing event number : "<<i<<endl;
     tree->GetEvent(i);
     rl->GetEvent(i);

     TArrayF v(3);     
     rl->GetHeader()->GenEventHeader()->PrimaryVertex(v);
     Double_t vtx[3]={v[0],v[1],v[2]};
     Double_t cvtx[3]={0.005,0.005,0.010};
     cout<<"MC vertex position: "<<v[2]<<endl;

     AliHLTITSVertexerZ vertexer("null");
     AliESDVertex* vertex = NULL;
     TStopwatch timer2;
     timer2.Start();
     TTree* treeClusters = itsl->TreeR();
     //     vertex = vertexer.FindVertexForCurrentEvent(i);
     //     AliESDVertex *vertex = vertexer.FindVertexForCurrentEvent(geom,treeClusters);
     vertex = new AliESDVertex(vtx,cvtx);
     timer2.Stop();
     timer2.Print();
     if(!vertex){
       cerr<<"Vertex not found"<<endl;
       vertex = new AliESDVertex(vtx,cvtx);
     }
     else {
       vertex->SetTruePos(vtx);  // store also the vertex from MC
     }

     event->SetVertex(vertex);

     Double_t vtxPos[3];
     Double_t vtxErr[3];
     vertex->GetXYZ(vtxPos);
     vertex->GetSigmaXYZ(vtxErr);
     itsTracker.SetVertex(vtxPos,vtxErr);

     TTree *itsTree=itsl->TreeR();
     if (!itsTree) {
       cerr<<"Can't get the ITS cluster tree !\n";
       return 4;
     }     
     itsTracker.LoadClusters(itsTree);
     rc+=itsTracker.Clusters2Tracks(event);
     //     rc+=itsTracker.PropagateBack(event);
     itsTracker.UnloadClusters();

     if (rc==0) {
       TTree* tree = new TTree("esdTree", "Tree with ESD objects");
       tree->Branch("ESD", "AliESD", &event);
       tree->Fill();
       itsf->cd();
       tree->Write();
     } 
     if (rc) {
       cerr<<"Something bad happened...\n";
     }

   }
   delete event;

   itsf->Close();
   ef->Close();

   //   delete rl;

   timer.Stop();
   timer.Print();

   return rc;
}
Exemple #6
0
//----------------------------------------------------------------------
void AliITSDigitPlot(Int_t istart=0,Int_t iend=-1,
                     const char *filename="galice.root"){
    // Macro to plot digits from many events
    // Inputs:
    //   Int_t istart   Starting event number
    //   Int_t iend     Last event number, =-1 all
    // Outputs:
    //   none.
    // Return:
    //   none.
    if (gClassTable->GetID("AliRun") < 0) {
        gROOT->ProcessLine(".x $(ALICE_ROOT)/macros/loadlibs.C");
    }
    if(gAlice){
        delete AliRunLoader::Instance();
        delete gAlice;
        gAlice=0;
    } // end if gAlice

    Int_t nevents=0,nmodules=0,retval=0;
    Int_t i,j,module,dig,ndig,row,column,signal,det;
    AliITS       *its    = 0;
    AliITSgeom   *gm     = 0;
    AliRunLoader *rl     = 0;
    AliITSLoader *ld     = 0;
    TTree        *treeD  = 0;
    TBranch      *br     = 0;
    TClonesArray *digits = 0;
    AliITSdigit  *d      = 0;
    TObjArray    *digDet = 0;
    Char_t *branchname[3] = {"ITSDigitsSPD","ITSDigitsSDD","ITSDigitsSSD"};
    //
    rl = AliRunLoader::Open(filename);
    if(!rl){
        cerr<<"Error, can not open file "<<filename<<endl;
        return;
    } // end if !rl
    retval = rl->LoadgAlice();
    if (retval){
        cerr<<"Error, LoadgAlice returned error"<<endl;
        return;
    }
    gAlice = rl->GetAliRun();
    retval = rl->LoadHeader();
    if (retval){
        cerr<<"Error, LoadHeader returned error"<<endl;
        return;
    } // end if
    ld = (AliITSLoader*) rl->GetLoader("ITSLoader");
    if(!ld){
        cerr<<"Error, ITS loader not found"<<endl;
        return;
    } // end if
    its = (AliITS*) gAlice->GetModule("ITS");
    if(!its){
        cerr <<"Error, No AliDetector ITS found on file"<<endl;
        return;
    } // end if
    gm  = its->GetITSgeom();
    if(!gm){
        cerr <<"Error, AliITSgeom not initilized in module ITS"<<endl;
        return;
    } // end if
    nevents = rl->GetNumberOfEvents();
    if(iend>nevents) iend = nevents;
    if(iend<0)       iend = nevents;
    if(iend<=istart){delete rl; return;}
    nmodules = gm->GetIndexMax();
    ld->GetDigitsDataLoader()->Load("read");
    treeD = ld->TreeD();
    if(!treeD){
        cerr <<"Error, could not get TreeD="<<treeD << endl;
        return;
    } // end if !treeD
    digDet = new TObjArray(3);
    its->SetDefaults();
    for(det=0;det<3;det++){
        digDet->AddAt(new TClonesArray(its->GetDetTypeSim()->
                                        GetDigitClassName(det),1000),det);
        br = treeD->GetBranch(branchname[det]);
        br->SetAddress(&((*digDet)[det]));
    } // end for det

    //
    SetUPHistograms();
    //
    for(i=istart;i<iend;i++){
        rl->GetEvent(i);
        treeD = ld->TreeD();
        for(det=0;det<3;det++){
            ((TClonesArray*)(digDet->At(det)))->Clear();
            br = treeD->GetBranch(branchname[det]);
            br->SetAddress(&((*digDet)[det]));
        } // end for det
        for(module=0;module<nmodules;module++){
            for(j=0;j<3;j++) ((TClonesArray*)(digDet->At(j)))->Clear();
            treeD->GetEvent(module);
            digits = (TClonesArray*) (digDet->At(0)); // SPD only.
            ndig = digits->GetEntriesFast();
            for(dig=0;dig<ndig;dig++){
                d = (AliITSdigit*) digits->At(dig);
                row    = d->GetCoord1();
                column = d->GetCoord1();
                signal = d->GetSignal();
                     //cout <<"event="<<i<< " ndig="<< ndig<< " mod="
                     //<<module<<" row="<<row<<" col="<<column<< " sig="
                     //<<signal<<endl;
                FillHistograms(module,row,column,signal);
            } // end for mod
        } // end for module
    } // end for i
    DisplayHistograms();
    delete digits;
    return;
}