]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliRunDigitizer.h
Update the mult corr histograms
[u/mrichter/AliRoot.git] / STEER / AliRunDigitizer.h
index 3083f5947b13cef51f1bf2db4108549e4a87ec21..dcc9544e771e95e12e30403b78fc8e89b24ec35a 100644 (file)
 ////////////////////////////////////////////////////////////////////////
 //
 //  Manager Class for Merging/Digitization   
-//                  
+//  This handles Merging and Digitisation of AliRoot events                
 //  Author: Jiri Chudoba (CERN)
 //
 ////////////////////////////////////////////////////////////////////////
 
 // --- ROOT system ---
-#include "TNamed.h"
-#include "TObjString.h"
+
 #include "TArrayI.h"
+#include "TTask.h"
 #include "TClonesArray.h"
-#include "TTree.h"
-#include "TParticle.h"
-
-#define MAXDETECTORS 20
-#define MAXSTREAMSTOMERGE  4
+class TFile;
+class TParticle;
+class TTree;
 
 // --- AliRoot header files ---
 
+#include "AliStream.h" 
 class AliDigitizer;
 class AliMergeCombi;
+class AliRunLoader;
 
-class AliRunDigitizer: public TNamed {
+#define MAXSTREAMSTOMERGE 4
+
+class AliRunDigitizer: public TTask {
 
 public:
   AliRunDigitizer();
-  AliRunDigitizer(Int_t nInputStream, Int_t sperb);
+  AliRunDigitizer(Int_t nInputStreams, Int_t sperb=1);
+  AliRunDigitizer(const AliRunDigitizer& dig);
+  AliRunDigitizer& operator=(const AliRunDigitizer& dig)
+    {dig.Copy(*this); return (*this);}
   virtual ~AliRunDigitizer();
+
+  void      ExecuteTask(Option_t* option = 0);
+  void      Exec(Option_t *option) {this->Digitize(option);}
+  void      Digitize(Option_t* option = 0);
   void      AddDigitizer(AliDigitizer *digitizer);
-  void      SetOutputFile(TString fn) {fOutputFileName = fn;}
-  TString   GetOutputFile() {return fOutputFileName;}
+
+  void      SetOutputFile(TString fn);
+  TString   GetOutputFile() const {return fOutputFileName;}
+  
   void      SetOutputDir(TString dn) {fOutputDirName = dn;}
-  TString   GetOutputDir() {return fOutputDirName;}
-  void      SetInputStream(Int_t stream, char *inputName);
+  TString   GetOutputDir() const {return fOutputDirName;}
+  
+  void      SetInputStream(Int_t stream, const char *inputName, TString foldername = "");
+  
   void      SetFirstOutputEventNr(Int_t i) {fEvent = i;}
   void      SetNrOfEventsToWrite(Int_t i) {fNrOfEventsToWrite = i;}
   void      SetCopyTreesFromInput(Int_t i) {fCopyTreesFromInput = i;}
-  Int_t     GetCopyTreesFromInput() {return fCopyTreesFromInput;}
-  Int_t     GetOutputEventNr() {return fEvent;}
+  Int_t     GetCopyTreesFromInput() const {return fCopyTreesFromInput;}
+  Int_t     GetOutputEventNr() const {return fEvent;}
   void      SetCombinationFileName(TString fn) {fCombinationFileName = fn;} 
-  TString   GetCombinationFileName() {return fCombinationFileName;}
-  Int_t     GetNinputs() const {return fNinputs;}
+  TString   GetCombinationFileName() const {return fCombinationFileName;}
   Int_t     GetMask(Int_t i) const {return fkMASK[i];}
-  TTree*    GetInputTreeS(Int_t i) const {return fArrayTreeS[i];}
-  TTree*    GetInputTreeH(Int_t i) const {return fArrayTreeH[i];}
-  TTree*    GetInputTreeTPCS(Int_t i) const {return fArrayTreeTPCS[i];}
-  TTree*    GetTreeD() const {return fTreeD;}
-  void      Digitize();
 
+
+  Int_t     GetNinputs() const {return fNinputs;}
+  const TString& GetInputFolderName(Int_t i) const;
+  const char* GetOutputFolderName();
+
+
+    
 // Nr of particles in all input files for a given event
 //     (as numbered in the output file)
-  Int_t GetNParticles(Int_t event);
+  Int_t GetNParticles(Int_t event) const;
 
 // Nr of particles in input file input for a given event
 //     (as numbered in this input file)
-  Int_t GetNParticles(Int_t event, Int_t input);
+  Int_t GetNParticles(Int_t event, Int_t input) const;
 
 // return pointer to an int array with input event numbers which were
 // merged in the output event event
-  Int_t* GetInputEventNumbers(Int_t event);
+  Int_t* GetInputEventNumbers(Int_t event) const;
 
 // return an event number of an eventInput from input file input
 // which was merged to create output event event
-  Int_t GetInputEventNumber(Int_t event, Int_t input);
+  Int_t GetInputEventNumber(Int_t event, Int_t input) const;
   
+  AliStream * GetInputStream(Int_t index) const { return dynamic_cast<AliStream *>(fInputStreams->At(index)) ; }
 // return pointer to particle with index i (index with mask)
-  TParticle* GetParticle(Int_t i, Int_t event);
+  TParticle* GetParticle(Int_t i, Int_t event) const;
 
 // return pointer to particle with index i in the input file input
 // (index without mask)
-  TParticle* GetParticle(Int_t i, Int_t input, Int_t event);
+  TParticle* GetParticle(Int_t i, Int_t input, Int_t event) const;
 
-  
-  Int_t     GetDebug() const {return fDebug;}
-  void      SetDebug(Int_t level) {fDebug = level;}
+// return TString with input file name  
+  TString GetInputFileName(Int_t input, Int_t order) const;
   
 private:
-  AliDigitizer *    fDigitizers[MAXDETECTORS];  //! pointers to registered
-                                                //  digitizers
-// the constant 20 corresponds to  MAXDETECTORS = 20 - could be done better
-  Int_t             fNDigitizers;         //! nr. of registered digitizers
+  void Copy(TObject& dig) const;
+  Bool_t            ConnectInputTrees();
+  Bool_t            InitGlobal();
+  Bool_t            InitOutputGlobal();
+  void              InitEvent();
+  void              FinishEvent();
+  void              FinishGlobal();
+
   Int_t             fkMASK[MAXSTREAMSTOMERGE];  //! masks for track ids from
                                               //  different source files
   Int_t             fkMASKSTEP;           // step to increase MASK for
                                           // each input file
   TString           fOutputFileName;      // output file name
   TString           fOutputDirName;       // output dir name
-  TFile *           fOutput;              //! pointer to the output file
+
   Int_t             fEvent;               // output event nr.
   Int_t             fNrOfEventsToWrite;   // Nr of events to write
   Int_t             fNrOfEventsWritten;   // Nr of events written
   Int_t             fCopyTreesFromInput;  // from which input file the trees
                                           // should be copied, -1 for no copies
-  TTree *           fTreeD;               //! output TreeD
   Int_t             fNinputs;             // nr of input streams - can be taken from the TClonesArray dimension
   Int_t             fNinputsGiven;        // nr of input streams given by user
-  TClonesArray *    fInputStreams;        // input streams
-  TClonesArray *    fInputFiles;          // current input files
-  TTree *           fArrayTreeS[MAXSTREAMSTOMERGE];   //! array with p. to TreeS
-  TTree *           fArrayTreeTPCS[MAXSTREAMSTOMERGE];   //! array with p. to TreeD_75x40_100x60_x (TPC Sdigits)
-  TTree *           fArrayTreeH[MAXSTREAMSTOMERGE];   //! array with p. to TreeH
+  TClonesArray *    fInputStreams;        // input signal streams
+
+//  AliStream*        fOutputStream;
+  AliRunLoader*     fOutRunLoader;        //!
+  Bool_t            fOutputInitialized;   //indicates if outout was initialized 
+                                          // 
   AliMergeCombi *   fCombi;               // pointer to the combination object
   TArrayI           fCombination;         //! combination of events from
   TString           fCombinationFileName; // fn with combinations (used
                                           // with type 2 of comb.)
-  Bool_t            ConnectInputTrees();
-  Bool_t            InitGlobal();
-  Bool_t            InitOutputGlobal();
-  void              InitEvent();
-  void              FinishEvent();
-  void              FinishGlobal();
-  Int_t             fDebug;                //! specifies debug level, 0 is min
+
+  AliRunLoader*     GetOutRunLoader();
   
-  ClassDef(AliRunDigitizer,1)
+  static const TString fgkDefOutFolderName;//default name for output foler 
+  static const TString fgkBaseInFolderName;//default name for input foler
+  ClassDef(AliRunDigitizer,6)
 };
 
 #endif // ALIRUNDIGITIZER_H