]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCFileHandler.h
When Pt is bad defined (ex. no field), the multiple scattering effect is calculated...
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCFileHandler.h
1 // @(#) $Id$
2 // Original: AliHLTFileHandler.h,v 1.19 2004/06/11 16:06:33 loizides 
3
4 #ifndef ALIHLTTPCFILEHANDLER_H
5 #define ALIHLTTPCFILEHANDLER_H
6 //* This file is property of and copyright by the ALICE HLT Project        * 
7 //* ALICE Experiment at CERN, All rights reserved.                         *
8 //* See cxx source for full Copyright notice                               *
9
10 /** @file   AliHLTTPCFileHandler.h
11     @author U. Frankenfeld, A. Vestbo, C. Loizides, maintained by
12             Matthias Richter
13     @date   
14     @brief  file input for the TPC tracking code before migration to the
15             HLT component framework
16 */
17
18 #include "AliHLTTPCMemHandler.h"
19
20 class TClonesArray;
21
22 class AliSimDigits;
23 class AliTPCParam;
24 #include <AliRunLoader.h>
25
26 class TObject;
27 class TFile;
28 class TTree;
29
30 class AliHLTTPCSpacePointData;
31 class AliHLTTPCDigitRowData;
32 class AliHLTTPCTrackSegmentData;
33 class AliHLTTPCTrackArray;
34
35 /**
36  * @class AliHLTTPCFileHandler
37  * This is the input interface class for the TPC tracking code before conversion to
38  * the HLT component framework.
39  * 
40  * @ingroup alihlt_tpc
41  */
42 class AliHLTTPCFileHandler:public AliHLTTPCMemHandler {
43
44  public:
45   /** standard constructor */
46   AliHLTTPCFileHandler(Bool_t b=kFALSE);
47   /** destructor */
48   virtual ~AliHLTTPCFileHandler();
49
50   void FreeDigitsTree();
51   static void CleanStaticIndex();
52   static Int_t SaveStaticIndex(Char_t *prefix=0,Int_t event=0);
53   static Int_t LoadStaticIndex(Char_t *prefix=0,Int_t event=0);
54
55   Bool_t SetAliInput(Char_t *name);
56   Bool_t SetAliInput(AliRunLoader *runLoader);
57   void CloseAliInput(); 
58   Bool_t IsDigit(Int_t event);
59   
60   Bool_t SetMCOutput(Char_t *name);
61   Bool_t SetMCOutput(FILE *file);
62   void CloseMCOutput();
63
64   //Digit IO
65
66   /**
67    * Write AliDigits from AliRoot file to binary file.
68    * @param event      event no
69    * @param altro      use @ref AliDigits2Memory if kFALSE and @ref
70    *                   AliDigits2Memory if kTRUE
71    *
72    * Calls the @ref AliHLTTPCMemHandler::Memory2BinaryFile to write the file.
73    */
74   Bool_t AliDigits2BinaryFile(Int_t event=0,Bool_t altro=kFALSE);
75
76   /**
77    * Convert AliDigits from AliRoot file to HLT Digit data in memory.
78    * Read and convert/write digits to memory buffer. If no target buffer available,
79    * an appropriate buffer is allocated.<br>
80    * If the variable pTgtSize is prvided, the total size of the result array is
81    * returned. \b Note: the total size differs as the @ref AliHLTTPCDigitRowData
82    * structs are variable in size depending on the no of digits for that particular
83    * row.
84    * @param nrow       [OUT] number of rows
85    * @param event      the event no
86    * @param tgtBuffer  target buffer (optional)
87    * @param pTgtSize   size of target buffer (optional)
88    * @return pointer to array, size in nrow <br>
89    *         NULL in case of failure, required size in pTgtSize
90    */
91   //TODO: Check that the following change works. It should, but just double check.
92   AliHLTTPCDigitRowData *AliDigits2Memory(UInt_t & nrow,Int_t event, Byte_t* tgtBuffer, UInt_t* pTgtSize=NULL);
93
94   AliHLTTPCDigitRowData *AliDigits2Memory(UInt_t & nrow,Int_t event=0)
95   {
96     return AliDigits2Memory(nrow, event, NULL, NULL);
97   }
98
99   /**
100    * Convert and filter AliDigits from AliRoot file to HLT Digit data in memory.
101    * This functions is the same as @ref AliDigits2Memory but in addition it
102    * filters out single timebins, which is noise. The timebins which
103    * are removed are timebins which have the 4 zero neighbours; 
104    * (pad-1,time),(pad+1,time),(pad,time-1),(pad,time+1).
105    *
106    * This is legacy code, the two functions contain big portions of identical code
107    * will be merged.
108    * See @ref AliDigits2Memory for detailed description.
109    */
110   AliHLTTPCDigitRowData *AliAltroDigits2Memory(UInt_t & nrow,Int_t event=0,Bool_t eventmerge=kFALSE); 
111
112   /**
113    * Convert AliDigits from AliRoot file to Altro data format in memory.
114    */
115   int AliDigits2Altro(Int_t event, Byte_t* tgtBuffer, UInt_t size);
116
117   /**
118    * Write AliDigits from AliRoot file to binary file.
119    * @param event      event no
120    * @param altro      use @ref AliDigits2Memory if kFALSE and @ref
121    *                   AliDigits2Memory if kTRUE
122    *
123    * \b Note: pretty much the same as @ref AliDigits2BinaryFile.
124    * Calls the @ref AliHLTTPCMemHandler::Memory2CompBinary to write the file.
125    */
126   Bool_t AliDigits2CompBinary(Int_t event=0,Bool_t altro=kFALSE);  
127
128   /**
129    * Write the data stored in rowPt, into a new AliROOT file.
130    * The data is stored in the AliROOT format 
131    * This is specially a nice thing if you have modified data, and wants to run it  
132    * through the offline reconstruction chain.
133    * The arguments is a pointer to the data, and the name of the new AliROOT file.
134    * Remember to pass the original AliROOT file (the one that contains the original
135    * simulated data) to this object, in order to retrieve the MC id's of the digits.
136   */
137   void AliDigits2RootFile(AliHLTTPCDigitRowData *rowPt,Char_t *newDigitsfile);
138
139   //Point IO
140   Bool_t AliPoints2Binary(Int_t eventn=0);
141   AliHLTTPCSpacePointData *AliPoints2Memory(UInt_t & npoint,Int_t eventn=0);//Allocates Memory
142
143  protected:
144   AliRunLoader *fInAli;//!
145   Bool_t fUseRunLoader; //use runloader
146
147   AliTPCParam *fParam;//!
148   AliSimDigits *fDigits;//!
149
150   TTree *fDigitsTree;//!
151   FILE *fMC;//!
152
153   Bool_t fIndexCreated;   //is index created
154   Int_t  fIndex[fgkNSlice][fgkNRow]; //stores index over digitstree 
155                           //for faster access w/o ASVVERSION
156   Bool_t fUseStaticIndex; //take static index
157   static Bool_t fgStaticIndexCreated;   //global index created
158   static Int_t  fgStaticIndex[fgkNSlice][fgkNRow]; //global index
159
160   virtual Bool_t SetAliInput();
161   Bool_t GetDigitsTree(Int_t event);
162   Bool_t CreateIndex();  //create the index
163
164  private:
165   /** copy constructor prohibited */
166   AliHLTTPCFileHandler(const AliHLTTPCFileHandler&);
167   /** assignment operator prohibited */
168   AliHLTTPCFileHandler& operator=(const AliHLTTPCFileHandler&);
169
170   ClassDef(AliHLTTPCFileHandler,2)   //HLT TPC Filehandler IO class
171 };
172
173 #endif