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