]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSreconstruction.cxx
Correct dependence for the CINT dictionaries
[u/mrichter/AliRoot.git] / ITS / AliITSreconstruction.cxx
index ae7efa1d9b889880b8a7e60424d3e5592f4444ca..88167646502e5047bd4081f696433ceada1de712 100644 (file)
  
 /*
 $Log$
+Revision 1.4  2002/05/10 22:31:30  nilsen
+Changes by Massimo Masera to allow Recpoints and Clusters to be written
+to separate files.
+
+Revision 1.3  2002/02/06 13:52:27  barbera
+gAlice deletion corrected (from M. Masera)
+
+Revision 1.2  2002/01/31 18:52:09  nilsen
+Minor change to allow the use of files that are already open. grun.C macro
+that also does ITS digitizationa and Reconstruction all in one go.
+
+Revision 1.1  2002/01/30 22:20:22  nilsen
+New TTask based method to do Digits To clusters. Works with files of multiple
+events in the file. Macro added to show how to use. Also the changes made
+in the nessesary complilation files.
+
 */
 #include <TROOT.h>
 #include <TFile.h>
@@ -50,6 +66,7 @@ AliITSreconstruction::AliITSreconstruction(){
 
     fFilename = "";
     fFile     = 0;
+    fFile2    = 0;
     fITS      = 0;
     fDet[0] = fDet[1] = fDet[2] = kTRUE;
     fInit     = kFALSE;
@@ -59,27 +76,33 @@ AliITSreconstruction::AliITSreconstruction(const char* filename){
     // Standard constructor.
     // Inputs:
     //  const char* filename    filename containing the digits to be
-    //                          reconstructed
+    //                          reconstructed. If filename = 0 (nil)
+    //                          then no file is opened but a file is
+    //                          assumed to already be opened. This 
+    //                          already opened file will be used.
     // Outputs:
     //   none.
     // Return:
     //    A standardly constructed AliITSreconstruction class.
 
     fFilename = filename;
-
-    fFile = (TFile*)gROOT->GetListOfFiles()->FindObject(fFilename.Data());
-    if(fFile) fFile->Close();
-    fFile = new TFile(fFilename.Data(),"UPDATE");
-    //
-    if(gAlice) delete gAlice;
-    gAlice = (AliRun*)fFile->Get("gAlice");
-    if(!gAlice) {
-       cout << "gAlice not found on file. Aborting." << endl;
-       fInit = kFALSE;
-       return;
-    } // end if !gAlice
-
-    Init();
+    fFile2 = 0;
+    fFile = 0;
+    if(filename){
+       fFile = (TFile*)gROOT->GetListOfFiles()->FindObject(fFilename.Data());
+       if(fFile) fFile->Close();
+       fFile = new TFile(fFilename.Data(),"UPDATE");
+    if(gAlice) {
+      delete gAlice;
+      gAlice = 0;
+    }
+       gAlice = (AliRun*)fFile->Get("gAlice");
+       if(!gAlice) {
+           cout << "gAlice not found on file. Aborting." << endl;
+           fInit = kFALSE;
+           return;
+       } // end if !gAlice
+    } // end if !filename.
 }
 //______________________________________________________________________
 AliITSreconstruction::~AliITSreconstruction(){
@@ -106,7 +129,6 @@ Bool_t AliITSreconstruction::Init(){
     // Return:
     //    kTRUE if no errors initilizing this class occurse else kFALSE
     Int_t nparticles;
-
     fITS = (AliITS*) gAlice->GetDetector("ITS");
     if(!fITS){
        cout << "ITS not found aborting. fITS=" << fITS << endl;
@@ -208,11 +230,33 @@ void AliITSreconstruction::Exec(const Option_t *opt){
        cout << "Initilization Failed, Can't run Exec." << endl;
        return;
     } // end if !fInit
+    TDirectory *curr = gDirectory;
+    if(fFile2)fFile2->cd();
     for(evnt=0;evnt<fEnt;evnt++){
-       nparticles = gAlice->GetEvent(evnt);
-       gAlice->SetEvent(evnt);
-       if(!gAlice->TreeR()) gAlice->MakeTree("R");
-       fITS->MakeBranch("R");
-       fITS->DigitsToRecPoints(evnt,0,lopt);
+      nparticles = gAlice->GetEvent(evnt);
+      gAlice->SetEvent(evnt);
+      if(!gAlice->TreeR()){
+        if(fFile2){
+          gAlice->MakeTree("R",fFile2);
+        }
+        else {
+          gAlice->MakeTree("R");
+        }
+      }
+      fITS->MakeBranch("R");
+      fITS->MakeTreeC();
+      fITS->DigitsToRecPoints(evnt,0,lopt);
     } // end for evnt
+    curr->cd();
+}
+//______________________________________________________________________ 
+void AliITSreconstruction::SetOutputFile(TString filename){
+  // Set a file name for recpoints. Used only if this file is not the file
+  // containing digits. This obj is deleted by AliRun.
+  fFile2 = gAlice->InitTreeFile("R",filename);
 }
+
+
+
+
+