]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSDigits2RecPoints.C
Moved coordinates
[u/mrichter/AliRoot.git] / ITS / AliITSDigits2RecPoints.C
index ac6a3c83777e588395d68732a9adc349741e7e1d..82633d9a70fbd1530ae8596f0eff67630ca3817e 100644 (file)
@@ -1,56 +1,43 @@
-TFile* AccessFile(TString inFile="galice.root", TString acctype="R");
+#if !defined(__CINT__) || defined(__MAKECINT__)
 
-void AliITSDigits2RecPoints(TString inFile="galice.root", TString outFile="galice.root"){
+#include "Riostream.h"
+#include "TClassTable.h"
+#include "TDatime.h"
+#include "TStopwatch.h"
+#include "AliRun.h"
+#include "AliRunDigitizer.h"
+#include "AliITSDigitizer.h"
+#include "AliITS.h"
+#include "AliITSDetType.h"
+#include "AliITSresponseSDD.h"
+#include "AliITSreconstruction.h"
 
-  TFile *file;
-  if(outFile.Data() == inFile.Data()){
-    file = AccessFile(inFile,"U");
-  }
-  else {
-    file = AccessFile(inFile);
-  }
-  
-  TStopwatch timer;
+#endif
+#define DEBUG
 
-  cout << "Creating reconstructed points from digits for the ITS..." << endl;
-  const char *nulptr=0;
-  AliITSreconstruction *itsr = new AliITSreconstruction(nulptr);
-  if(outFile.Data() != inFile.Data())itsr->SetOutputFile(outFile);
-  timer.Start();
-  itsr->Init();
-  itsr->Exec(); 
-  timer.Stop(); 
-  timer.Print();    
-  delete itsr;
-}
-
-//-------------------------------------------------------------------
-TFile * AccessFile(TString FileName, TString acctype){
+Int_t AliITSDigits2RecPoints(TString filename="galice.root"){
+    // Standard ITS Digits to RecPoints.
 
-  // Function used to open the input file and fetch the AliRun object
+    // Dynamically link some shared libs
+    if (gClassTable->GetID("AliRun") < 0) {
+      gROOT->ProcessLine(".x $(ALICE_ROOT)/macros/loadlibs.C");
+    }else if (gAlice){
+      delete gAlice->GetRunLoader();
+      delete gAlice;
+      gAlice=0;
+     } // end if
 
-  if (gAlice) {delete gAlice; gAlice = 0;}
-  TFile *retfil = 0;
-  TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(FileName);
-  if (file) {file->Close(); delete file; file = 0;}
-  if(acctype.Contains("U")){
-    file = new TFile(FileName,"update");
-  }
-  if(acctype.Contains("N") && !file){
-    file = new TFile(FileName,"recreate");
-  }
-  if(!file) file = new TFile(FileName);   // default readonly
-  if (!file->IsOpen()) {
-       cerr<<"Can't open "<<FileName<<" !" << endl;
-       return retfil;
-  } 
+    TStopwatch timer;
+#ifdef DEBUG
+    cout << "Creating reconstructed points from digits for the ITS..." << endl;
+#endif
+    AliITSreconstruction *itsr = new AliITSreconstruction(filename);
 
-  // Get AliRun object from file or return if not on file
-  //  if (gAlice) {delete gAlice; gAlice = 0;}  
-  gAlice = (AliRun*)file->Get("gAlice");
-  if (!gAlice) {
-       cerr << "AliRun object not found on file"<< endl;
-       return retfil;
-  } 
-  return file;
+    timer.Start();
+    itsr->Init();
+    itsr->Exec(); 
+    timer.Stop(); 
+    timer.Print();
+    delete itsr;
+    return 0;
 }