]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Add const to the filename argument
authorjchudoba <jchudoba@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 9 Apr 2002 13:38:47 +0000 (13:38 +0000)
committerjchudoba <jchudoba@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 9 Apr 2002 13:38:47 +0000 (13:38 +0000)
STEER/AliRunDigitizer.cxx
STEER/AliRunDigitizer.h
STEER/AliStream.cxx
STEER/AliStream.h

index 1888f9f617fb9e2fd7d890b9caa68000f6de9406..15c292a95b934f0da2edc81de3359d8a308430b0 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.14  2002/04/04 09:28:04  jchudoba
+Change default names of TPC trees. Use update instead of recreate for the output file. Overwrite the AliRunDigitizer object in the output if it exists.
+
 Revision 1.13  2002/02/13 09:03:32  jchudoba
 Pass option to subtasks. Delete input TTrees. Use gAlice from memory if it is present (user must delete the default one created by aliroot if he/she wants to use gAlice from the input file!). Add new data member to store name of the special TPC TTrees.
 
@@ -232,7 +235,7 @@ void AliRunDigitizer::AddDigitizer(AliDigitizer *digitizer)
   this->Add(digitizer);
 }
 ////////////////////////////////////////////////////////////////////////
-void AliRunDigitizer::SetInputStream(Int_t i, char *inputFile)
+void AliRunDigitizer::SetInputStream(Int_t i, const char *inputFile)
 {
   if (i > fInputStreams->GetLast()) {
     Error("SetInputStream","Input stream number too high");
index 96ebdc54474abc81d60d2500f2f0e8558c95e887..27792eec9da00c5f0df59b4805902dad14c01d3a 100644 (file)
@@ -40,7 +40,7 @@ public:
   TString   GetOutputFile() const {return fOutputFileName;}
   void      SetOutputDir(TString dn) {fOutputDirName = dn;}
   TString   GetOutputDir() const {return fOutputDirName;}
-  void      SetInputStream(Int_t stream, char *inputName);
+  void      SetInputStream(Int_t stream, const char *inputName);
   void      SetFirstOutputEventNr(Int_t i) {fEvent = i;}
   void      SetNrOfEventsToWrite(Int_t i) {fNrOfEventsToWrite = i;}
   void      SetCopyTreesFromInput(Int_t i) {fCopyTreesFromInput = i;}
index 6d66f8db26d84fea8581c0e3982c05d08e25b429..8fa30c95e502520c71c70f1e262f88c70f8accf0 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.4  2001/12/03 07:10:13  jchudoba
+Default ctor cannot create new objects, create dummy default ctor which leaves object in not well defined state - to be used only by root for I/O
+
 Revision 1.3  2001/10/15 17:31:56  jchudoba
 Bug correction
 
@@ -40,6 +43,7 @@ Class to manage input filenames, used by AliRunDigitizer
 #include <iostream.h>
 
 #include "TTree.h"
+#include "TROOT.h"
 
 #include "AliStream.h"
 
@@ -77,7 +81,7 @@ AliStream::~AliStream()
 }
 
 ////////////////////////////////////////////////////////////////////////
-void AliStream::AddFile(char *fileName)
+void AliStream::AddFile(const char *fileName)
 {
 // stores the name of the file
   TObjString *name = new TObjString(fileName);
@@ -127,14 +131,19 @@ Bool_t AliStream::OpenNextFile()
     return kFALSE;
   }
 
+  const char * filename = 
+    static_cast<TObjString*>(fFileNames->At(fCurrentFileIndex))->GetName();
+
+// check if the file was already opened by some other code
+  TFile *f = (TFile *)(gROOT->GetListOfFiles()->FindObject(filename));
+  if (f) f->Close();
+
   if (fCurrentFile) {
     if (fCurrentFile->IsOpen()) {
       fCurrentFile->Close();
     }
   }
 
-  const char * filename = 
-    static_cast<TObjString*>(fFileNames->At(fCurrentFileIndex))->GetName();
   fCurrentFile = TFile::Open(filename,fMode.Data());
   if (!fCurrentFile) {
 // cannot open file specified on input. Do not skip it silently.
index 992a88230be093ad3efa36137b3f248c11ecd637..32e4bc7e91805571e0e61d5b607302c69c87a1c7 100644 (file)
@@ -28,7 +28,7 @@ public:
   AliStream();
   AliStream(Option_t *option);
   virtual ~AliStream();
-  void AddFile(char *fileName);
+  void AddFile(const char *fileName);
   Bool_t NextEventInStream(Int_t &eventNr);
   Bool_t OpenNextFile();
   Bool_t ImportgAlice();
@@ -41,7 +41,7 @@ private:
   Int_t fCurrentFileIndex;
   Int_t fEvents;                //! nr. of events in the current file
   TString fMode;                  // = 0 for READONLY, = 1 for READWRITE
-  TFile *fCurrentFile;
+  TFile *fCurrentFile;          //! pointer to current open file
   TObjArray * fFileNames;
   
   ClassDef(AliStream,1)