]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDInput.h
During simulation: fill STU region w/ non null time sums
[u/mrichter/AliRoot.git] / FMD / AliFMDInput.h
index 8a931bcdd5091c5b326b4aff1aec6266156975c1..8ce786e48b2aa965780367c807101163db5f72e7 100644 (file)
@@ -54,6 +54,7 @@ class TTree;
 class TGeoManager;
 class TParticle;
 class TChain;
+class TSystemDirectory;
 
 //___________________________________________________________________
 /** @class AliFMDInput 
@@ -114,7 +115,6 @@ public:
     kESD,             // Load ESD's
     kRaw,             // Read raw data 
     kGeometry,        // Not really a tree 
-    kTracks,         // Hits and tracs - for BG study  
     kTrackRefs,       // Track references - also for BG study
     kRawCalib,        // Read raws and calibrate them
     kUser
@@ -135,6 +135,37 @@ public:
   virtual void   RemoveLoad(ETrees tree)  { CLRBIT(fTreeMask, tree); }
   /** @return # of available events */
   virtual Int_t  NEvents() const;
+  /** @return true if passed tree is loaded */
+  virtual Bool_t IsLoaded(ETrees tree)const { return TESTBIT(fTreeMask, tree); }
+  /** 
+   * Set the trees to load.  
+   * 
+   * @param mask Bit mask of trees to load.  Should be constructed
+   * like for example 
+   *
+   * @code 
+   * UInt_t mask = ((1 << AliFMDInput::kHits) | 
+   *                (1 << AliFMDInput::kDigits) | 
+   *                (1 << AliFMDInput::kSDigits));
+   * @endcode
+   */
+  virtual void SetLoads(UInt_t mask);
+  /** 
+   * Set the trees to load. 
+   * 
+   * @param mask A comma or space separated list of trees to load.
+   * The case is not important, and a short from of the tree name can
+   * be used.  
+   */
+  virtual void SetLoads(const char* mask);
+  /** 
+   * Get a string that represents the loaded trees 
+   * 
+   * @param dataOnly If true, then only show data 
+   * 
+   * @return String representing the loaded trees. 
+   */
+  virtual const char* LoadedString(Bool_t dataOnly=false) const;
 
   /** Initialize the class.  If a user class overloads this member
       function, then this @e must be explicitly called
@@ -159,7 +190,7 @@ public:
   virtual Bool_t Finish() { return kTRUE; }
   /** Run a full job. 
       @return @c false on error  */
-  virtual Bool_t Run();
+  virtual Bool_t Run(UInt_t maxEvents=0);
 
   /** Loop over all hits, and call ProcessHit with that hit, and
       optionally the corresponding kinematics track. 
@@ -173,6 +204,10 @@ public:
       that track
       @return @c false on error  */
   virtual Bool_t ProcessTracks();
+  /** Loop over all tracks, and call ProcessTrack with each hit for
+      that track
+      @return @c false on error  */
+  virtual Bool_t ProcessStack();
   /** Loop over all digits, and call ProcessDigit for each digit.
       @return @c false on error  */
   virtual Bool_t ProcessDigits();
@@ -218,6 +253,11 @@ public:
       @param h Associated Hit
       @return  @c false on error   */
   virtual Bool_t ProcessTrack(Int_t i, TParticle* p, AliFMDHit* h);
+  /** Process stack particle 
+      @param i Track number 
+      @param p Track  
+      @return  @c false on error   */
+  virtual Bool_t ProcessParticle(Int_t i , TParticle* p);
   /** Process one digit.  Users should over this to process each
       digit. 
       @param digit Digit
@@ -274,7 +314,16 @@ public:
   /** Set the raw data input 
       @param file File name - if empty, assume simulated raw. */
   void SetRawFile(const char* file) { if (file) fRawFile = file; }
-     
+  void SetInputDir(const char* dir) { fInputDir = (dir && dir[0] != '\0') 
+      ? dir : "."; }
+  /** 
+   * Parse a string as a load option
+   * 
+   * @param what String to pass
+   * 
+   * @return Load option value, or 0 in case of error
+   */
+  static ETrees ParseLoad(const char* what);     
 protected:
   /** Copy ctor 
       @param o Object to copy from  */
@@ -309,8 +358,10 @@ protected:
       fGeoManager(0),
       fTreeMask(0),
       fRawFile(""),      
+      fInputDir("."),
       fIsInit(kFALSE),
-      fEventCount(0)
+      fEventCount(0),
+      fNEvents(-1)
   {}
   /** Assignement operator 
       @return  REference to this */
@@ -327,6 +378,36 @@ protected:
    */
   virtual Float_t GetSignal(UShort_t d, Char_t r, UShort_t s, UShort_t t);
 
+  static const char* TreeName(ETrees tree, bool shortest=false);
+
+  /** 
+   * Make a chain of specified data 
+   * 
+   * @param what       What data to chain.  Possible values are 
+   *                   - ESD Event summary data (AliESD)
+   *                   - MC  Simulation data (galice)
+   * @param datadir    Data directory to scan 
+   * @param recursive  Whether to recurse into sub-directories 
+   * 
+   * @return Pointer to newly create chain, or null
+   */
+  static TChain* MakeChain(const char* what, const char* datadir, 
+                          bool recursive=false);
+  /** 
+   * Scan a directory (optionally recursive) for data files to add to
+   * the chain.  Only ROOT files, and files which name contain the
+   * passed pattern are considered.
+   * 
+   * @param dir        Directory to scan
+   * @param chain      Chain to add data to 
+   * @param pattern    Pattern that the file name must contain
+   * @param recursive  Whether to scan recursively 
+   */
+  static void ScanDirectory(TSystemDirectory* dir, 
+                           const TString& olddir, 
+                           TChain* chain, 
+                           const char* pattern, bool recursive);
+
   TString          fGAliceFile; // File name of gAlice file
   AliRunLoader*    fLoader;     // Loader of FMD data 
   AliRun*          fRun;        // Run information
@@ -356,8 +437,11 @@ protected:
   TGeoManager*     fGeoManager; // Geometry manager
   Int_t            fTreeMask;   // Which tree's to load
   TString          fRawFile;    // Raw input file
+  TString          fInputDir;   // Input directory
   Bool_t           fIsInit;     // Have we been initialized 
   Int_t            fEventCount; // Event counter 
+  Int_t            fNEvents;    // The maximum number of events
+  static const ETrees fgkAllLoads[kUser+1]; // List of all possible loads
   ClassDef(AliFMDInput,0)  //Hits for detector FMD
 };
 
@@ -366,6 +450,7 @@ inline Bool_t AliFMDInput::ProcessTrackRef(AliTrackReference*,
                                           TParticle*) { return kTRUE; }
 inline Bool_t AliFMDInput::ProcessTrack(Int_t,TParticle*,
                                        AliFMDHit*) { return kTRUE; }
+inline Bool_t AliFMDInput::ProcessParticle(Int_t,TParticle*) { return kTRUE; }
 inline Bool_t AliFMDInput::ProcessDigit(AliFMDDigit*) { return kTRUE; }
 inline Bool_t AliFMDInput::ProcessSDigit(AliFMDSDigit*) { return kTRUE; }
 inline Bool_t AliFMDInput::ProcessRawDigit(AliFMDDigit*) { return kTRUE; }