/*
$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.
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");
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;}
/*
$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
#include <iostream.h>
#include "TTree.h"
+#include "TROOT.h"
#include "AliStream.h"
}
////////////////////////////////////////////////////////////////////////
-void AliStream::AddFile(char *fileName)
+void AliStream::AddFile(const char *fileName)
{
// stores the name of the file
TObjString *name = new TObjString(fileName);
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.
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();
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)