]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliStream.cxx
reduce printout
[u/mrichter/AliRoot.git] / STEER / AliStream.cxx
index 8b8aa78a463d4997b76d6a16017a51c171474be1..2d78b1661a5af985b24fbfebe2533b9748078c62 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.4.4.4  2002/12/11 10:00:34  hristov
-Merging with v3-09-04 (P.Skowronski)
+/* $Id$ */
 
-Revision 1.4.4.3  2002/11/22 14:19:50  hristov
-Merging NewIO-01 with v3-09-04 (part one) (P.Skowronski)
+#include <TROOT.h>
+#include <TFile.h>
+#include <TObjString.h>
 
-Revision 1.4.4.2  2002/06/18 10:18:32  hristov
-Important update (P.Skowronski)
-
-Revision 1.4.4.1  2002/05/31 09:37:59  hristov
-First set of changes done by Piotr
-
-Revision 1.5  2002/04/09 13:38:47  jchudoba
-Add const to the filename argument
-
-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
-
-Revision 1.2  2001/10/04 15:58:52  jchudoba
-Option to open the stream in READ or UPDATE mode
-
-Revision 1.1  2001/09/19 06:20:50  jchudoba
-Class to manage input filenames, used by AliRunDigitizer
-
-*/
+#include "AliLoader.h"
+#include "AliRun.h"
+#include "AliStream.h"
 
 ////////////////////////////////////////////////////////////////////////
 //
@@ -52,23 +31,10 @@ Class to manage input filenames, used by AliRunDigitizer
 // - open and close files
 // - return serial event number of the next event in the stream
 // and the TFile pointer for a proper file
+//  Author: Jiri Chudoba (CERN), 2001
 //
 ////////////////////////////////////////////////////////////////////////
 
-#include <Riostream.h>
-
-#include "TTree.h"
-#include "TROOT.h"
-
-#include "AliStream.h"
-#include "AliRun.h"
-
-#include "TObjString.h"
-#include "TArrayI.h"
-#include "TClonesArray.h"
-#include "TFile.h"
-#include "AliLoader.h"
-
 ClassImp(AliStream)
 
 AliStream::AliStream():
@@ -80,8 +46,8 @@ AliStream::AliStream():
   fFileNames(0x0),
   fEventFolderName(0)
 {
-// root requires default ctor, where no new objects can be created
-// do not use this ctor, it is supplied only for root needs
+  // root requires default ctor, where no new objects can be created
+  // do not use this ctor, it is supplied only for root needs
 }
 //_______________________________________________________________________
 
@@ -98,6 +64,23 @@ AliStream::AliStream(const char* foldername,Option_t *option):
 }
 //_______________________________________________________________________
 
+AliStream::AliStream(const AliStream &as):
+  TNamed(as),
+  fLastEventSerialNr(-1),
+  fLastEventNr(0),
+  fCurrentFileIndex(-1),
+  fEvents(0),
+  fMode(0),
+  fFileNames(0x0),
+  fEventFolderName(" ")
+{
+  //
+  // Copy ctor
+  //
+  as.Copy(*this);
+}
+//_______________________________________________________________________
+
 AliStream::~AliStream()
 {
 // default dtor
@@ -106,6 +89,15 @@ AliStream::~AliStream()
 }
 //_______________________________________________________________________
 
+void AliStream::Copy(TObject &) const
+{
+  //
+  // Copy function
+  //
+  Fatal("Copy","Not implemented!");
+}
+//_______________________________________________________________________
+
 void AliStream::AddFile(const char *fileName)
 {
 // stores the name of the file
@@ -138,17 +130,17 @@ Bool_t AliStream::NextEventInStream()
    {
     if (!OpenNextFile()) return kFALSE;
    }
-  Info("NextEventInStream","Trying to get event ",fLastEventSerialNr+1);
+  Info("NextEventInStream","Trying to get event %d",fLastEventSerialNr+1);
   currentloader->GetEvent(++fLastEventSerialNr);
   return kTRUE;
 }
 //_______________________________________________________________________
 
 void AliStream::ChangeMode(Option_t* option)
-// set the mode to READ or UPDATE, reopen file with the new mode
-// only change from UPDATE to READ have sense in the current scheme,
-// other changes are possible but not usefull
 {
+  // set the mode to READ or UPDATE, reopen file with the new mode
+  // only change from UPDATE to READ have sense in the current scheme,
+  // other changes are possible but not usefull
 
   fMode = option;
   AliRunLoader* currentloader = AliRunLoader::GetRunLoader(fEventFolderName);
@@ -162,8 +154,11 @@ void AliStream::ChangeMode(Option_t* option)
 
 Bool_t AliStream::OpenNextFile()
 {
+  //
+  // Opens next file in the list
+  //
   if (++fCurrentFileIndex > fFileNames->GetLast()) {
-    cerr<<"No more files in the stream"<<endl;
+    Error("OpenNextFile", "No more files in the stream") ;
     return kFALSE;
   }
 
@@ -186,7 +181,7 @@ Bool_t AliStream::OpenNextFile()
   if (currentloader == 0x0) 
    {
 // cannot open file specified on input. Do not skip it silently.
-    cerr<<"Cannot open session "<<filename<<endl;
+    Error("OpenNextFile", "Cannot open session ");
     return kFALSE;
    }
    
@@ -215,6 +210,9 @@ Bool_t AliStream::OpenNextFile()
 
 Bool_t AliStream::ImportgAlice()
 {
+  //
+  // Imports gAlice object from file
+  //
   if (fFileNames->GetLast() < 0) return kFALSE;
   
   AliRunLoader* currentloader = AliRunLoader::GetRunLoader(fEventFolderName);
@@ -230,11 +228,11 @@ Bool_t AliStream::ImportgAlice()
 }
 
 //_______________________________________________________________________
-TString AliStream::GetFileName(const Int_t order) const
-// returns name of the order-th file
-// returns empty string if such file does not exist
-// first file in the input stream is 0
+TString AliStream::GetFileName(Int_t order) const
 {
+  // returns name of the order-th file
+  // returns empty string if such file does not exist
+  // first file in the input stream is 0
   TString fileName("");
   if (order > fFileNames->GetLast()) return fileName;
   TObjString *fileNameStored = dynamic_cast<TObjString*>(fFileNames->At(order));