]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliRunDigitizer.cxx
Replacing Header with Id
[u/mrichter/AliRoot.git] / STEER / AliRunDigitizer.cxx
index fdd66538eff76e425de2e6f430af91b0b4aef9f6..f263d0c317ee597c8abf2598b965c90dc93a324a 100644 (file)
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/
 
-/*
-$Log$
-Revision 1.3  2001/07/30 14:04:18  jchudoba
-correct bug in the initialization
-
-Revision 1.2  2001/07/28 10:44:32  hristov
-Loop variable declared once; typos corrected
-
-Revision 1.1  2001/07/27 12:59:00  jchudoba
-Manager class for merging/digitization
-
-*/
+/* $Id$ */
 
 ////////////////////////////////////////////////////////////////////////
 //
@@ -46,7 +35,7 @@ Manager class for merging/digitization
 // and the I/O configured (you have to specify input files 
 // and an output file). The manager connects appropriate trees from 
 // the input files according a combination returned by AliMergeCombi 
-// classcreates. It creates TreeD in the output and runs once per 
+// class. It creates TreeD in the output and runs once per 
 // event Digitize method of all existing AliDetDigitizers 
 // (without any option). AliDetDigitizers ask manager
 // for a TTree with input (manager->GetInputTreeS(Int_t i),
@@ -56,7 +45,10 @@ Manager class for merging/digitization
 // manager->SetFirstOutputEventNr(Int_t) method. The particle numbers
 // in the output are shifted by MASK, which is taken from manager.
 //
-// Single input file is permitted. Maximum MAXSTREAMSTOMERGE can be merged.
+// The default output is to the signal file (stream 0). This can be 
+// changed with the SetOutputFile(TString fn)  method.
+//
+// Single input file is permitted. Maximum kMaxStreamsToMerge can be merged.
 // Input from the memory (on-the-fly merging) is not yet 
 // supported, as well as access to the input data by invoking methods
 // on the output data.
@@ -65,132 +57,205 @@ Manager class for merging/digitization
 // same geometry in all input files), gAlice is taken from the first 
 // input file on the first stream.
 //
-// Example with MUON digitizer:
+// Example with MUON digitizer, no merging, just digitization
+//
+//  AliRunDigitizer * manager = new AliRunDigitizer(1,1);
+//  manager->SetInputStream(0,"galice.root");
+//  AliMUONDigitizer *dMUON  = new AliMUONDigitizer(manager);
+//  manager->Exec("");
+//
+// Example with MUON digitizer, merge all events from 
+//   galice.root (signal) file with events from bgr.root 
+//   (background) file. Number of merged events is
+//   min(number of events in galice.root, number of events in bgr.root)
+//
+//  AliRunDigitizer * manager = new AliRunDigitizer(2,1);
+//  manager->SetInputStream(0,"galice.root");
+//  manager->SetInputStream(1,"bgr.root");
+//  AliMUONDigitizer *dMUON  = new AliMUONDigitizer(manager);
+//  manager->Exec("");
+//
+// Example with MUON digitizer, save digits in a new file digits.root,
+//   process only 1 event
 //
 //  AliRunDigitizer * manager = new AliRunDigitizer(2,1);
-//  manager->SetInputStream(0,"1track_10events_phi45_60.root");
-//  manager->SetInputStream(1,"1track_10events_phi120_135.root");
-//  manager->SetOutputDir("/tmp");
+//  manager->SetInputStream(0,"galice.root");
+//  manager->SetInputStream(1,"bgr.root");
 //  manager->SetOutputFile("digits.root");
 //  AliMUONDigitizer *dMUON  = new AliMUONDigitizer(manager);
 //  manager->SetNrOfEventsToWrite(1);
-//  manager->Digitize();
+//  manager->Exec("");
 //
 //////////////////////////////////////////////////////////////////////// 
 
 // system includes
 
-#include <iostream.h>
+#include <Riostream.h>
 
 // ROOT includes
 
 #include "TFile.h"
+#include "TList.h"
 #include "TTree.h"
 
 // AliROOT includes
 
-#include "AliRunDigitizer.h"
 #include "AliDigitizer.h"
+#include "AliMergeCombi.h"
 #include "AliRun.h"
-#include "AliHeader.h"
-#include "TParticle.h"
+#include "AliRunDigitizer.h"
 #include "AliStream.h"
-#include "AliMergeCombi.h"
 
 ClassImp(AliRunDigitizer)
 
-////////////////////////////////////////////////////////////////////////
+//_______________________________________________________________________
+AliRunDigitizer::AliRunDigitizer():
+  fkMASKSTEP(0),
+  fOutputFileName(0),
+  fOutputDirName(0),
+  fOutput(0),
+  fEvent(0),
+  fNrOfEventsToWrite(0),
+  fNrOfEventsWritten(0),
+  fCopyTreesFromInput(0),
+  fTreeD(0),
+  fTreeDTPC(0),
+  fTreeDTRD(0),
+  fTreeR(0),
+  fNinputs(0),
+  fNinputsGiven(0),
+  fInputStreams(0),
+  fTreeDTPCBaseName(0),
+  fTreeTPCSBaseName(0),
+  fCombi(0),
+  fCombination(0),
+  fCombinationFileName(0),
+  fDebug(0)
+{
+  //
+  // default ctor, where no new objects can be created
+  // do not use this ctor, it is supplied only for root needs
+  //
+  for (Int_t i=0;i<kMaxStreamsToMerge;i++) {
+    fArrayTreeS[i]=fArrayTreeH[i]=fArrayTreeTPCS[i]=fArrayTreeTRDS[i]=NULL;
+    fInputFiles[i]=0;
+  }
+}
 
-AliRunDigitizer::AliRunDigitizer() : TNamed("AliRunDigitizer","")
+//_______________________________________________________________________
+AliRunDigitizer::AliRunDigitizer(const AliRunDigitizer& dig):
+  TTask(dig),
+  fkMASKSTEP(0),
+  fOutputFileName(0),
+  fOutputDirName(0),
+  fOutput(0),
+  fEvent(0),
+  fNrOfEventsToWrite(0),
+  fNrOfEventsWritten(0),
+  fCopyTreesFromInput(0),
+  fTreeD(0),
+  fTreeDTPC(0),
+  fTreeDTRD(0),
+  fTreeR(0),
+  fNinputs(0),
+  fNinputsGiven(0),
+  fInputStreams(0),
+  fTreeDTPCBaseName(0),
+  fTreeTPCSBaseName(0),
+  fCombi(0),
+  fCombination(0),
+  fCombinationFileName(0),
+  fDebug(0)
 {
-// default ctor
-  cerr<<"Don't use"<<endl;
-  fCombi = 0;
-  fInputFiles = 0;
-  fNDigitizers = 0;
-  fNinputs = 0;
-  fInputStreams = 0;
+  //
+  // Copy ctor
+  //
+  dig.Copy(*this);
 }
 
-////////////////////////////////////////////////////////////////////////
-AliRunDigitizer::AliRunDigitizer(Int_t nInputStreams, Int_t sperb) : TNamed("AliRunDigitizer","")
+//_______________________________________________________________________
+void AliRunDigitizer::Copy(AliRunDigitizer&) const
+{
+  Fatal("Copy","Not installed\n");
+}
+
+
+//_______________________________________________________________________
+AliRunDigitizer::AliRunDigitizer(Int_t nInputStreams, Int_t sperb):
+  TTask("AliRunDigitizer","The manager for Merging"),
+  fkMASKSTEP(10000000),
+  fOutputFileName(""),
+  fOutputDirName("."),
+  fOutput(0),
+  fEvent(0),
+  fNrOfEventsToWrite(-1),
+  fNrOfEventsWritten(0),
+  fCopyTreesFromInput(-1),
+  fTreeD(0),
+  fTreeDTPC(0),
+  fTreeDTRD(0),
+  fTreeR(0),
+  fNinputs(nInputStreams),
+  fNinputsGiven(0),
+  fInputStreams(new TClonesArray("AliStream",nInputStreams)),
+  fTreeDTPCBaseName("TreeD_75x40_100x60_150x60_"),
+  fTreeTPCSBaseName("TreeS_75x40_100x60_150x60_"),
+  fCombi(new AliMergeCombi(nInputStreams,sperb)),
+  fCombination(kMaxStreamsToMerge),
+  fCombinationFileName(0),
+  fDebug(0)
 {
-// default ctor
+  //
+  // ctor which should be used to create a manager for merging/digitization
+  //
   if (nInputStreams == 0) {
     Error("AliRunDigitizer","Specify nr of input streams");
     return;
   }
-  Int_t i;
-  for (i=0;i<MAXDETECTORS;i++) fDigitizers[i]=0;
-  fNDigitizers = 0;
-  fNinputs = nInputStreams;
-  fOutputFileName = "digits.root";
-  fOutputDirName = "/tmp/";
-  fCombination.Set(MAXSTREAMSTOMERGE);
-  for (i=0;i<MAXSTREAMSTOMERGE;i++) {
-    fArrayTreeS[i]=fArrayTreeH[i]=fArrayTreeTPCS[i]=NULL;
+  for (Int_t i=0;i<kMaxStreamsToMerge;i++) {
+    fArrayTreeS[i]=fArrayTreeH[i]=fArrayTreeTPCS[i]=fArrayTreeTRDS[i]=NULL;
     fCombination[i]=-1;
   }
-  fkMASKSTEP = 10000000;
   fkMASK[0] = 0;
-  for (i=1;i<MAXSTREAMSTOMERGE;i++) {
+  for (Int_t i=1;i<kMaxStreamsToMerge;i++) {
     fkMASK[i] = fkMASK[i-1] + fkMASKSTEP;
   }
-  fInputStreams = new TClonesArray("AliStream",nInputStreams);
+
   TClonesArray &lInputStreams = *fInputStreams;
-  for (i=0;i<nInputStreams;i++) {
-    new(lInputStreams[i]) AliStream();
-  }
-  fInputFiles = new TClonesArray("TFile",1);
-  fOutput = 0;
-  fEvent = 0;
-  fNrOfEventsToWrite = 0;
-  fNrOfEventsWritten = 0;
-  fCopyTreesFromInput = -1;
-  fCombi = new AliMergeCombi(nInputStreams,sperb);
-  fDebug = 3;
-  if (GetDebug()>2) 
-    cerr<<"AliRunDigitizer::AliRunDigitizer() called"<<endl;
-}
+// the first Input is open RW to be output as well
+  new(lInputStreams[0]) AliStream("UPDATE");
+  for (Int_t i=1;i<nInputStreams;i++) {
+    new(lInputStreams[i]) AliStream("READ");
+  }
 
-////////////////////////////////////////////////////////////////////////
+  for (Int_t i=0; i<kMaxStreamsToMerge; i++) fInputFiles[i]=0;
+}
 
+//_______________________________________________________________________
 AliRunDigitizer::~AliRunDigitizer() {
 // dtor
 
-  if (fInputFiles) {
-    delete fInputFiles;
-    fInputFiles = 0;
-  }
-  if (fInputStreams) {
+// do not delete subtasks, let the creator delete them
+  if (GetListOfTasks()) 
+    GetListOfTasks()->Clear("nodelete");
+  
     delete fInputStreams;
-    fInputStreams = 0;
-  }
-  if (fCombi) {
     delete fCombi;
-    fCombi = 0;
-  }
-
 }
 
-////////////////////////////////////////////////////////////////////////
+//_______________________________________________________________________
 void AliRunDigitizer::AddDigitizer(AliDigitizer *digitizer)
 {
 // add digitizer to the list of active digitizers
-
-  if (fNDigitizers >= MAXDETECTORS) {
-    cerr<<"Too many detectors to digitize. Increase value of MAXDETECTORS"
-       <<" constant in AliRunDigitizer.h and recompile or decrease the"
-       <<" the number of detectors"<<endl;
-  } else {
-    fDigitizers[fNDigitizers++] = digitizer;
-  }
+  this->Add(digitizer);
 }
 
-////////////////////////////////////////////////////////////////////////
-
-void AliRunDigitizer::SetInputStream(Int_t i, char *inputFile)
+//_______________________________________________________________________
+void AliRunDigitizer::SetInputStream(Int_t i, const char *inputFile)
 {
+  //
+  // Sets the name of the input file
+  //
   if (i > fInputStreams->GetLast()) {
     Error("SetInputStream","Input stream number too high");
     return;
@@ -198,38 +263,40 @@ void AliRunDigitizer::SetInputStream(Int_t i, char *inputFile)
   static_cast<AliStream*>(fInputStreams->At(i))->AddFile(inputFile);
 }
 
-////////////////////////////////////////////////////////////////////////
-void AliRunDigitizer::Digitize()
+//_______________________________________________________________________
+void AliRunDigitizer::Digitize(Option_t* option)
 {
 // get a new combination of inputs, connect input trees and loop 
 // over all digitizers
 
-  if (!InitGlobal()) {
-    cerr<<"False from InitGlobal"<<endl;
-    return;
-  }
 // take gAlice from the first input file. It is needed to access
 //  geometry data
-  if (!static_cast<AliStream*>(fInputStreams->At(0))->ImportgAlice()) {
-    cerr<<"gAlice object not found in the first file of "
-       <<"the 1st stream"<<endl;
+// If gAlice is already in memory, use it
+  if (!gAlice) {
+    if (!static_cast<AliStream*>(fInputStreams->At(0))->ImportgAlice()) {
+      cerr<<"gAlice object not found in the first file of "
+         <<"the 1st stream"<<endl;
+      return;
+    }
+  }
+  if (!InitGlobal()) {
+    cerr<<"False from InitGlobal"<<endl;
     return;
   }
   Int_t eventsCreated = 0;
-  while (eventsCreated++ < fNrOfEventsToWrite) {
-//    if (GetDebug()>2) PrintCombination();
-    ConnectInputTrees();
+// loop until there is anything on the input in case fNrOfEventsToWrite < 0
+  while ((eventsCreated++ < fNrOfEventsToWrite) || (fNrOfEventsToWrite < 0)) {
+    if (!ConnectInputTrees()) break;
     InitEvent();
 // loop over all registered digitizers and let them do the work
-    for (Int_t i=0;i<fNDigitizers; i++) {
-      fDigitizers[i]->Digitize();
-    }
+    ExecuteTasks(option);
+    CleanTasks();
     FinishEvent();
   }
   FinishGlobal();
 }
 
-////////////////////////////////////////////////////////////////////////
+//_______________________________________________________________________
 Bool_t AliRunDigitizer::ConnectInputTrees()
 {
 // fill arrays fArrayTreeS, fArrayTreeH and fArrayTreeTPCS with 
@@ -237,23 +304,43 @@ Bool_t AliRunDigitizer::ConnectInputTrees()
 // null pointers can be in the output, AliDigitizer has to check it
 
   TTree *tree;
-  char treeName[20];
+  char treeName[50];
   Int_t serialNr;
-  Int_t eventNr[MAXSTREAMSTOMERGE], delta[MAXSTREAMSTOMERGE];
+  Int_t eventNr[kMaxStreamsToMerge], delta[kMaxStreamsToMerge];
   fCombi->Combination(eventNr, delta);
   for (Int_t i=0;i<fNinputs;i++) {
     if (delta[i] == 1) {
       AliStream *iStream = static_cast<AliStream*>(fInputStreams->At(i));
       if (!iStream->NextEventInStream(serialNr)) return kFALSE;
+      fInputFiles[i]=iStream->CurrentFile();
       sprintf(treeName,"TreeS%d",serialNr);
       tree = static_cast<TTree*>(iStream->CurrentFile()->Get(treeName));
+      if (fArrayTreeS[i]) {
+       delete fArrayTreeS[i];
+       fArrayTreeS[i] = 0;
+      }
       fArrayTreeS[i] = tree;
       sprintf(treeName,"TreeH%d",serialNr);
       tree = static_cast<TTree*>(iStream->CurrentFile()->Get(treeName));
+      if (fArrayTreeH[i]) {
+       delete fArrayTreeH[i];
+       fArrayTreeH[i] = 0;
+      }
       fArrayTreeH[i] = tree;
-      sprintf(treeName,"TreeS_75x40_100x60_%d",serialNr);
+      sprintf(treeName,"%s%d",fTreeTPCSBaseName,serialNr);
       tree = static_cast<TTree*>(iStream->CurrentFile()->Get(treeName));
+      if (fArrayTreeTPCS[i]) {
+       delete fArrayTreeTPCS[i];
+       fArrayTreeTPCS[i] = 0;
+      }
       fArrayTreeTPCS[i] = tree;
+      sprintf(treeName,"TreeS%d_TRD",serialNr);
+      tree = static_cast<TTree*>(iStream->CurrentFile()->Get(treeName));
+      if (fArrayTreeTRDS[i]) {
+       delete fArrayTreeTRDS[i];
+       fArrayTreeTRDS[i] = 0;
+      }
+      fArrayTreeTRDS[i] = tree;
     } else if (delta[i] != 0) {
       Error("ConnectInputTrees","Only delta 0 or 1 is implemented");
       return kFALSE;
@@ -262,29 +349,37 @@ Bool_t AliRunDigitizer::ConnectInputTrees()
   return kTRUE;
 }
 
-////////////////////////////////////////////////////////////////////////
+//_______________________________________________________________________
 Bool_t AliRunDigitizer::InitGlobal()
 {
 // called once before Digitize() is called, initialize digitizers and output
 
-  if (!InitOutputGlobal()) return kFALSE;
-  for (Int_t i=0;i<fNDigitizers; i++) {
-    if (!fDigitizers[i]->Init()) return kFALSE;
-  }
+  TList* subTasks = GetListOfTasks();
+  if (subTasks) {
+    subTasks->ForEach(AliDigitizer,Init)();
+  }  
   return kTRUE;
 }
 
-////////////////////////////////////////////////////////////////////////
+//_______________________________________________________________________
+void AliRunDigitizer::SetOutputFile(TString fn)
+{
+  // the output will be to separate file, not to the signal file
+  fOutputFileName = fn;
+  (static_cast<AliStream*>(fInputStreams->At(0)))->ChangeMode("READ");
+  InitOutputGlobal();
+}
+
+//_______________________________________________________________________
 Bool_t AliRunDigitizer::InitOutputGlobal()
 {
-// Creates the output file, called once by InitGlobal()
+// Creates the output file, called by InitEvent()
 
   TString fn;
   fn = fOutputDirName + '/' + fOutputFileName;
-  fOutput = new TFile(fn,"recreate");
+  fOutput = new TFile(fn,"update");
   if (GetDebug()>2) {
-    cerr<<"file "<<fn.Data()<<" was opened"<<endl;
-    cerr<<"fOutput = "<<fOutput<<endl;
+    cerr<<"AliRunDigitizer::InitOutputGlobal(): file "<<fn.Data()<<" was opened"<<endl;
   }
   if (fOutput) return kTRUE;
   Error("InitOutputGlobal","Could not create output file.");
@@ -292,7 +387,7 @@ Bool_t AliRunDigitizer::InitOutputGlobal()
 }
 
 
-////////////////////////////////////////////////////////////////////////
+//_______________________________________________________________________
 void AliRunDigitizer::InitEvent()
 {
 // Creates TreeDxx in the output file, called from Digitize() once for 
@@ -300,26 +395,60 @@ void AliRunDigitizer::InitEvent()
 
   if (GetDebug()>2) 
     cerr<<"AliRunDigitizer::InitEvent: fEvent = "<<fEvent<<endl;
+
+// if fOutputFileName was not given, write output to signal file
+  if (fOutputFileName == "") {
+    fOutput = (static_cast<AliStream*>(fInputStreams->At(0)))->CurrentFile();
+  }
   fOutput->cd();
-  char hname[30];
-  sprintf(hname,"TreeD%d",fEvent);
-  fTreeD = new TTree(hname,"Digits");
-  fTreeD->Write();   // Do I have to write it here???
+  char treeName[30];
+  sprintf(treeName,"TreeD%d",fEvent);
+  fTreeD = static_cast<TTree*>(fOutput->Get(treeName));
+  if (!fTreeD) {
+    fTreeD = new TTree(treeName,"Digits");
+    fTreeD->Write(0,TObject::kOverwrite);
+  }
+
+// tree for ITS fast points
+  sprintf(treeName,"TreeR%d",fEvent);
+  fTreeR = static_cast<TTree*>(fOutput->Get(treeName));
+  if (!fTreeR) {
+    fTreeR = new TTree(treeName,"Reconstruction");
+    fTreeR->Write(0,TObject::kOverwrite);
+  }
+
+// special tree for TPC
+  sprintf(treeName,"%s%d",fTreeDTPCBaseName,fEvent);
+  fTreeDTPC = static_cast<TTree*>(fOutput->Get(treeName));
+  if (!fTreeDTPC) {
+    fTreeDTPC = new TTree(treeName,"TPC_Digits");
+    fTreeDTPC->Write(0,TObject::kOverwrite);
+  }
+
+// special tree for TRD
+  sprintf(treeName,"TreeD%d_TRD",fEvent);
+  fTreeDTRD = static_cast<TTree*>(fOutput->Get(treeName));
+  if (!fTreeDTRD) {
+    fTreeDTRD = new TTree(treeName,"TRD_Digits");
+    fTreeDTRD->Write(0,TObject::kOverwrite);
+  }
+
 }
 
-////////////////////////////////////////////////////////////////////////
+//_______________________________________________________________________
 void AliRunDigitizer::FinishEvent()
 {
 // called at the end of loop over digitizers
 
+  Int_t i;
   fOutput->cd();
   if (fCopyTreesFromInput > -1) {
     char treeName[20];
-    Int_t i = fCopyTreesFromInput; 
+    i = fCopyTreesFromInput; 
     sprintf(treeName,"TreeK%d",fCombination[i]);
-    ((TFile*)fInputFiles->At(i))->Get(treeName)->Clone()->Write();
+    fInputFiles[i]->Get(treeName)->Clone()->Write();
     sprintf(treeName,"TreeH%d",fCombination[i]);
-    ((TFile*)fInputFiles->At(i))->Get(treeName)->Clone()->Write();
+    fInputFiles[i]->Get(treeName)->Clone()->Write();
   }
   fEvent++;
   fNrOfEventsWritten++;
@@ -327,26 +456,38 @@ void AliRunDigitizer::FinishEvent()
     delete fTreeD;
     fTreeD = 0;
   }
+  if (fTreeR) {
+    delete fTreeR;
+    fTreeR = 0;
+  }
+  if (fTreeDTPC) {
+    delete fTreeDTPC;
+    fTreeDTPC = 0;
+  }
+  if (fTreeDTRD) {
+    delete fTreeDTRD;
+    fTreeDTRD = 0;
+  }
 }
-////////////////////////////////////////////////////////////////////////
+
+//_______________________________________________________________________
 void AliRunDigitizer::FinishGlobal()
 {
 // called at the end of Exec
 // save unique objects to the output file
 
   fOutput->cd();
-  this->Write();
+  this->Write(0,TObject::kOverwrite);
   if (fCopyTreesFromInput > -1) {
-    ((TFile*)fInputFiles->At(fCopyTreesFromInput))->Get("TE")
-      ->Clone()->Write();
+    fInputFiles[fCopyTreesFromInput]->Get("TE")->Clone()->Write();
     gAlice->Write();
   }
-  fOutput->Close();
+  fOutput->Write();
 }
 
 
-////////////////////////////////////////////////////////////////////////
-Int_t  AliRunDigitizer::GetNParticles(Int_t event)
+//_______________________________________________________________________
+Int_t  AliRunDigitizer::GetNParticles(Int_t event) const
 {
 // return number of particles in all input files for a given
 // event (as numbered in the output file)
@@ -362,13 +503,18 @@ Int_t  AliRunDigitizer::GetNParticles(Int_t event)
   return sum;
 }
 
-////////////////////////////////////////////////////////////////////////
-Int_t  AliRunDigitizer::GetNParticles(Int_t event, Int_t input)
+//_______________________________________________________________________
+Int_t  AliRunDigitizer::GetNParticles(Int_t /* event */, Int_t /* input */) const
 {
 // return number of particles in input file input for a given
 // event (as numbered in this input file)
 // return -1 if some error
 
+// Must be revised in the version with AliStream
+
+  return -1;
+
+/*
   TFile *file = ConnectInputFile(input);
   if (!file) {
     Error("GetNParticles","Cannot open input file");
@@ -393,23 +539,25 @@ Int_t  AliRunDigitizer::GetNParticles(Int_t event, Int_t input)
     cerr<<"Nsecondary: "<<header->GetNsecondary()<<endl;
   }
   return header->GetNprimary() + header->GetNsecondary();
+*/
 }
 
-////////////////////////////////////////////////////////////////////////
-Int_t* AliRunDigitizer::GetInputEventNumbers(Int_t event)
+//_______________________________________________________________________
+Int_t* AliRunDigitizer::GetInputEventNumbers(Int_t event) const
 {
 // return pointer to an int array with input event numbers which were
 // merged in the output event event
 
 // simplified for now, implement later
-  Int_t a[MAXSTREAMSTOMERGE];
+  Int_t * a = new Int_t[kMaxStreamsToMerge];
   for (Int_t i = 0; i < fNinputs; i++) {
     a[i] = event;
   }
   return a;
 }
-////////////////////////////////////////////////////////////////////////
-Int_t AliRunDigitizer::GetInputEventNumber(Int_t event, Int_t input)
+
+//_______________________________________________________________________
+Int_t AliRunDigitizer::GetInputEventNumber(Int_t event, Int_t /* input */) const
 {
 // return an event number of an eventInput from input file input
 // which was merged to create output event event
@@ -417,8 +565,9 @@ Int_t AliRunDigitizer::GetInputEventNumber(Int_t event, Int_t input)
 // simplified for now, implement later
   return event;
 }
-////////////////////////////////////////////////////////////////////////
-TParticle* AliRunDigitizer::GetParticle(Int_t i, Int_t event)
+
+//_______________________________________________________________________
+TParticle* AliRunDigitizer::GetParticle(Int_t i, Int_t event) const
 {
 // return pointer to particle with index i (index with mask)
 
@@ -427,14 +576,19 @@ TParticle* AliRunDigitizer::GetParticle(Int_t i, Int_t event)
   return GetParticle(i,input,GetInputEventNumber(event,input));
 }
 
-////////////////////////////////////////////////////////////////////////
-TParticle* AliRunDigitizer::GetParticle(Int_t i, Int_t input, Int_t event)
+//_______________________________________________________________________
+TParticle* AliRunDigitizer::GetParticle(Int_t /* i */, Int_t /* input */, 
+                                        Int_t /* event */) const
 {
 // return pointer to particle with index i in the input file input
 // (index without mask)
 // event is the event number in the file input
 // return 0 i fit does not exist
 
+// Must be revised in the version with AliStream
+
+  return 0;
+/*
   TFile *file = ConnectInputFile(input);
   if (!file) {
     Error("GetParticle","Cannot open input file");
@@ -480,6 +634,31 @@ TParticle* AliRunDigitizer::GetParticle(Int_t i, Int_t input, Int_t event)
   if (bytesRead)
     return particleBuffer;
   return  0;
+*/
 }
-////////////////////////////////////////////////////////////////////////
 
+//_______________________________________________________________________
+void AliRunDigitizer::ExecuteTask(Option_t* option)
+{
+// overwrite ExecuteTask to do Digitize only
+
+  if (!IsActive()) return;
+  Digitize(option);
+  fHasExecuted = kTRUE;
+  return;
+}
+
+//_______________________________________________________________________
+TString AliRunDigitizer::GetInputFileName(const Int_t input, const Int_t order) const 
+{
+// returns file name of the order-th file in the input stream input
+// returns empty string if such file does not exist
+// first input stream is 0
+// first file in the input stream is 0
+  TString fileName("");
+  if (input >= fNinputs) return fileName;
+  AliStream * stream = static_cast<AliStream*>(fInputStreams->At(input));
+  if (order > stream->GetNInputFiles()) return fileName;
+  fileName = stream->GetFileName(order);
+  return fileName;
+}