]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Set to zero new pointers to TPC and TRD special trees in the default ctor. Add const...
authorjchudoba <jchudoba@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 15 Nov 2001 11:07:25 +0000 (11:07 +0000)
committerjchudoba <jchudoba@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 15 Nov 2001 11:07:25 +0000 (11:07 +0000)
STEER/AliRunDigitizer.cxx
STEER/AliRunDigitizer.h

index 44b9658e10a46a0f9ecbbbf0924031513f974b39..7b981d5aa53f0cd044efaaaf52e705adb72ae000 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.9  2001/11/15 09:00:11  jchudoba
+Add special treatment for TPC and TRD, they use different trees than other detectors
+
 Revision 1.8  2001/10/21 18:38:43  hristov
 Several pointers were set to zero in the default constructors to avoid memory management problems
 
@@ -55,7 +58,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),
@@ -68,7 +71,7 @@ Manager class for merging/digitization
 // 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 MAXSTREAMSTOMERGE can be merged.
+// 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.
@@ -123,14 +126,14 @@ AliRunDigitizer::AliRunDigitizer(Int_t nInputStreams, Int_t sperb) : TTask("AliR
   fNinputs = nInputStreams;
   fOutputFileName = "";
   fOutputDirName = ".";
-  fCombination.Set(MAXSTREAMSTOMERGE);
-  for (i=0;i<MAXSTREAMSTOMERGE;i++) {
+  fCombination.Set(kMaxStreamsToMerge);
+  for (i=0;i<kMaxStreamsToMerge;i++) {
     fArrayTreeS[i]=fArrayTreeH[i]=fArrayTreeTPCS[i]=NULL;
     fCombination[i]=-1;
   }
   fkMASKSTEP = 10000000;
   fkMASK[0] = 0;
-  for (i=1;i<MAXSTREAMSTOMERGE;i++) {
+  for (i=1;i<kMaxStreamsToMerge;i++) {
     fkMASK[i] = fkMASK[i-1] + fkMASKSTEP;
   }
   fInputStreams = new TClonesArray("AliStream",nInputStreams);
@@ -147,11 +150,11 @@ AliRunDigitizer::AliRunDigitizer(Int_t nInputStreams, Int_t sperb) : TTask("AliR
   fCopyTreesFromInput = -1;
   fCombi = new AliMergeCombi(nInputStreams,sperb);
   fDebug = 0;
-  if (GetDebug()>2) 
-    cerr<<"AliRunDigitizer::AliRunDigitizer() called"<<endl;
-  //PH
   fTreeD = 0;
-  for (i=0; i<MAXSTREAMSTOMERGE; i++) fInputFiles[i]=0;
+  fTreeDTPC = 0;
+  fTreeDTRD = 0;
+  
+  for (i=0; i<kMaxStreamsToMerge; i++) fInputFiles[i]=0;
 }
 
 ////////////////////////////////////////////////////////////////////////
@@ -225,7 +228,7 @@ Bool_t AliRunDigitizer::ConnectInputTrees()
   TTree *tree;
   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) {
@@ -377,7 +380,7 @@ void AliRunDigitizer::FinishGlobal()
 
 
 ////////////////////////////////////////////////////////////////////////
-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)
@@ -394,7 +397,7 @@ Int_t  AliRunDigitizer::GetNParticles(Int_t event)
 }
 
 ////////////////////////////////////////////////////////////////////////
-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)
@@ -433,20 +436,20 @@ Int_t  AliRunDigitizer::GetNParticles(Int_t event, Int_t input)
 }
 
 ////////////////////////////////////////////////////////////////////////
-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 = new Int_t[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
@@ -455,7 +458,7 @@ Int_t AliRunDigitizer::GetInputEventNumber(Int_t event, Int_t input)
   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)
 
@@ -465,7 +468,7 @@ TParticle* AliRunDigitizer::GetParticle(Int_t i, Int_t event)
 }
 
 ////////////////////////////////////////////////////////////////////////
-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)
index e5a99ee3226919f7d858a6067c9383374dd59798..be25757f31041c96be4083f150a43d8b92b5d08c 100644 (file)
@@ -22,8 +22,7 @@
 #include "TParticle.h"
 #include "TTask.h"
 
-#define MAXDETECTORS 20
-#define MAXSTREAMSTOMERGE  4
+const Int_t kMaxStreamsToMerge = 4;
 
 // --- AliRoot header files ---
 
@@ -37,17 +36,17 @@ public:
   virtual ~AliRunDigitizer();
   void      AddDigitizer(AliDigitizer *digitizer);
   void      SetOutputFile(TString fn);
-  TString   GetOutputFile() {return fOutputFileName;}
+  TString   GetOutputFile() const {return fOutputFileName;}
   void      SetOutputDir(TString dn) {fOutputDirName = dn;}
-  TString   GetOutputDir() {return fOutputDirName;}
+  TString   GetOutputDir() const {return fOutputDirName;}
   void      SetInputStream(Int_t stream, char *inputName);
   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     GetOutputEventNr() const {return fEvent;}
   void      SetCombinationFileName(TString fn) {fCombinationFileName = fn;} 
-  TString   GetCombinationFileName() {return fCombinationFileName;}
+  TString   GetCombinationFileName() const {return fCombinationFileName;}
   Int_t     GetNinputs() const {return fNinputs;}
   Int_t     GetMask(Int_t i) const {return fkMASK[i];}
   TTree*    GetInputTreeS(Int_t i) const {return fArrayTreeS[i];}
@@ -64,33 +63,33 @@ public:
   
 // 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;
   
 // 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;}
   
 private:
-  Int_t             fkMASK[MAXSTREAMSTOMERGE];  //! masks for track ids from
+  Int_t             fkMASK[kMaxStreamsToMerge];  //! masks for track ids from
                                               //  different source files
   Int_t             fkMASKSTEP;           // step to increase MASK for
                                           // each input file
@@ -108,11 +107,11 @@ private:
   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
-  TFile *           fInputFiles[MAXSTREAMSTOMERGE];   //! p. to 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 *           fArrayTreeTRDS[MAXSTREAMSTOMERGE];   //! array with p. to TreeSx_TRD (TRD Sdigits)
-  TTree *           fArrayTreeH[MAXSTREAMSTOMERGE];   //! array with p. to TreeH
+  TFile *           fInputFiles[kMaxStreamsToMerge];   //! p. to current input files
+  TTree *           fArrayTreeS[kMaxStreamsToMerge];   //! array with p. to TreeS
+  TTree *           fArrayTreeTPCS[kMaxStreamsToMerge];   //! array with p. to TreeD_75x40_100x60_x (TPC Sdigits)
+  TTree *           fArrayTreeTRDS[kMaxStreamsToMerge];   //! array with p. to TreeSx_TRD (TRD Sdigits)
+  TTree *           fArrayTreeH[kMaxStreamsToMerge];   //! array with p. to TreeH
   AliMergeCombi *   fCombi;               // pointer to the combination object
   TArrayI           fCombination;         //! combination of events from
   TString           fCombinationFileName; // fn with combinations (used