]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCClusterFinderComponent.h
loading beam type from GRP and read configuration object according to it
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCClusterFinderComponent.h
1 // @(#) $Id$
2
3 #ifndef ALIHLTTPCCLUSTERFINDERCOMPONENT_H
4 #define ALIHLTTPCCLUSTERFINDERCOMPONENT_H
5
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   AliHLTTPCClusterFinderComponent.h
11     @author Timm Steinbeck, Matthias Richter, Kenneth Aamodt
12     @date   
13     @brief  The TPC cluster finder component.
14 */
15
16 #include "AliHLTProcessor.h"
17 #include "AliHLTComponentBenchmark.h"
18
19 class AliHLTTPCClusterFinder;
20 class AliHLTTPCDigitReader;
21
22 /**
23  * @class AliHLTTPCClusterFinderComponent
24  * Implementation of the cluster finder component.
25  * The component implements the interface methods of the @ref AliHLTProcessor.
26  * The actual cluster finding algorithm is implemented in @ref AliHLTTPCClusterFinder.
27  * Two components are registered, TPCClusterFinderPacked and TPCClusterFinderDecoder.
28  * TPCClusterFinderDecoder use the AliTPCRawStream class for decoding of the data, while TPCClusterFinderDecoder 
29  * use the AliAltroDecoder for decoding the data.
30  *
31  * TPCClusterFinderDecoder is the fastest of the two, this is due to that the AliAltroDecoder
32  * returns data in a bunch format. A bunch consist of consecutive signals.
33  * TPCClusterFinderPacked first have to read the data one by one, which means that row, pad and
34  * time signals have to be compared between each new digit, which leads to a slower alorithm. 
35  * 
36  *
37  * The clusterfinder is now using the AliTPCTransform instead of the AliHLTTPCTransform for  
38  * transformations from row, pad time -> x,y,z.
39  *
40  * <h2>General properties:</h2>
41  *
42  * Component ID: \b TPCClusterFinderDecoder and TPCClusterFinderPacked <br>
43  * Library: \b libAliHLTTPC
44  * Input Data Types: @ref kAliHLTDataTypeDDLRaw <br>
45  * Output Data Types: @ref AliHLTTPCDefinitions::fgkClustersDataType and/or kAliHLTDataTypeHwAddr16 <br> 
46  *
47  *
48  * Mandatory arguments: <br>
49  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
50  *
51  * Optional arguments: <br>
52  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
53  * \li -deconvolute-time <br>  
54  *      Turns on deconvolution in the time direction.
55  * \li -deconvolute-pad <br>  
56  *      Turns on deconvolution in the pad direction.
57  * \li -timebins <br>  
58  *      Sets the number of timebins (446 for simulated data, and 1024 for real data) Default:1024
59  * \li -first-timebin <br>  
60  *      First timebin taken into consideration when reading the data. 
61  * \li -last-timebin <br>  
62  *      Last timebin taken into consideration when reading the data. 
63  * \li -sorted <br>  
64  *      Switch off unsorted reading of data. Equivalent to the old argument unsorted 0.
65  * \li -active-pads <br>  
66  *      Switch off unsorted reading of data. Equivalent to the old argument unsorted 0.
67  * \li -occupancy-limit <br>  
68  *      Set the occupancy limit for the sorted clusterfinding.
69  *
70  *
71  * Obsolete arguments: <br>
72  * \li occupancy-limit <br>  
73  * \li rawreadermode   <br>  
74  * \li pp-run          <br>  
75  * \li adc-threshold   <br>  
76  * \li oldrcuformat    <br>  
77  * \li unsorted        <br>  
78  * \li nsigma-threshold <br>  
79  *
80  * <h2>Default CDB entries:</h2>
81  * The component has these default CDB entries
82  * \li <tt>GRP/GRP/Data</tt>.               
83  * \li <tt>TPC/Calib/PadTime0</tt>.         
84  * \li <tt>TPC/Calib/Parameters</tt>.       
85  * \li <tt>TPC/Calib/TimeDrift</tt>.        
86  * \li <tt>TPC/Calib/Temperature</tt>.      
87  *
88  * TODO: pad by pad gain calibration also has to be added to the clusterfinder
89  *
90  * And it also needs these below to avoid warnings during initialization and update of calibDB
91  * \li <tt>TPC/Calib/PadGainFactor</tt>.    
92  * \li <tt>TPC/Calib/TimeGain</tt>.
93  * \li <tt>TPC/Calib/GainFactorDedx</tt>.
94  * \li <tt>TPC/Calib/PadNoise</tt>.
95  * \li <tt>TPC/Calib/Pedestals</tt>.
96  * \li <tt>TPC/Calib/ClusterParam</tt>.
97  * \li <tt>TPC/Calib/AltroConfig</tt>.
98  * \li <tt>TPC/Calib/Pulser</tt>.
99  * \li <tt>TPC/Calib/CE</tt>.
100  * \li <tt>TPC/Calib/Raw</tt>.
101  * \li <tt>TPC/Calib/QA</tt>.
102  * \li <tt>TPC/Calib/Mapping</tt>.
103  * \li <tt>TPC/Calib/Goofie</tt>.
104  * \li <tt>TPC/Calib/HighVoltage</tt>.
105  * \li <tt>TPC/Calib/Ref</tt>.
106  *
107  * These entries are used by the AliTPCTransform class to correct for T0, drift and ExB.
108  * @ingroup alihlt_tpc_components
109  */
110 class AliHLTTPCClusterFinderComponent : public AliHLTProcessor
111     {
112     public:
113       /**
114        * Defines for the cluster finder type.
115        * The cluster finders can work on different formats of input data,
116        * the AliHLTTPCDigitReader interface provides a transparent way to
117        * read the data.
118        */
119       enum {
120         /** real data, offline AliAltroRawStream used for data decoding */
121         kClusterFinderPacked,
122         /** Unpacked data of format AliHLTTPCUnpackedRawData */
123         kClusterFinderUnpacked,
124         /** real data, fast AliAltroDecoder used for data decoding */
125         kClusterFinderDecoder,
126         /** real data, offline altro decoder 32 bit format*/
127         kClusterFinder32Bit
128       };
129
130         /**
131          * constructor 
132          * @param mode    input type see e.g. @ref kClusterFinderUnpacked
133          */
134         AliHLTTPCClusterFinderComponent(int mode);
135         /** destructor */
136         virtual ~AliHLTTPCClusterFinderComponent();
137
138         // Public functions to implement AliHLTComponent's interface.
139         // These functions are required for the registration process
140
141   /** interface function, see AliHLTComponent for description */
142   const char* GetComponentID();
143   /** interface function, see AliHLTComponent for description */
144   void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
145   /** interface function, see AliHLTComponent for description */
146   AliHLTComponentDataType GetOutputDataType();
147   /** interface function, see AliHLTComponent for description */
148   int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList);
149   /** interface function, see AliHLTComponent for description */
150   virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
151   /** interface function, see AliHLTComponent for description */
152   AliHLTComponent* Spawn();
153   /** interface function, see @ref AliHLTComponent for description */
154   void GetOCDBObjectDescription( TMap* const targetMap);
155
156     protected:
157         
158         // Protected functions to implement AliHLTComponent's interface.
159         // These functions provide initialization as well as the actual processing
160         // capabilities of the component. 
161
162         int DoInit( int argc, const char** argv );
163         int DoDeinit();
164         int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, 
165                      AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, 
166                      AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks );
167         int Configure(const char* arguments);
168         int ScanConfigurationArgument(int argc, const char** argv);
169         int Reconfigure(const char* cdbEntry, const char* chainId);
170         
171         using AliHLTProcessor::DoEvent;
172
173     private:
174         /** standard constructor prohibited */
175         AliHLTTPCClusterFinderComponent();
176         /** copy constructor prohibited */
177         AliHLTTPCClusterFinderComponent(const AliHLTTPCClusterFinderComponent&);
178         /** assignment operator prohibited */
179         AliHLTTPCClusterFinderComponent& operator=(const AliHLTTPCClusterFinderComponent&);
180         /** the cluster finder object */
181         AliHLTTPCClusterFinder* fClusterFinder;                                      //!transient
182         /** the reader object for data decoding */
183         AliHLTTPCDigitReader* fReader;                                               //!transient
184
185         /** flag to deconvolute in time direction */
186         Bool_t fDeconvTime;                                                          //!transient
187
188         /** flag to deconvolute in pad direction */
189         Bool_t fDeconvPad;                                                           //!transient
190         /** flag to switch on/off deconvolution in pad and time directions (used by sorted clusterfinding method) */
191         bool fClusterDeconv;                                                         //!transient
192         /** Error in xy of cluster */
193         float fXYClusterError;                                                       //!transient
194         /** Error in Z direction of cluster */
195         float fZClusterError; //!transient
196         /**
197          * switch to indicated the reader
198          * use fModeSwitch = 0 for packed inputtype "gkDDLPackedRawDataType"
199          * use fModeSwitch = 1 for unpacked inputtype "gkUnpackedRawDataType"
200          * use fModeSwitch = 2 for packed inputtype "gkDDLPackedRawDataType" with new digit reader
201          * use fModeSwitch = 3 for packed inputtype "gkDDLPackedRawDataType" with 32bit digit reader
202          */
203         Int_t fModeSwitch;                                                            // see above
204       
205         /*
206          * Reads the data the new unsorted way if true
207          *
208          */
209         Int_t fUnsorted;                                                               //!transient
210
211         /*
212          * Patch number to be read, currently given as component argument,
213          * will be changed later.
214          */
215         Int_t fPatch;                                                                  //!transient
216
217         /*
218          * Switch to specify if one ship out a list of active pads (pads conected to a cluster).
219          */
220         Int_t fGetActivePads;                                                          //!transient
221
222         /** First timebin taken into account when reading the data */
223         Int_t fFirstTimeBin;                                                           //!transient
224
225         /** Last timebin taken in to account when reading the data */
226         Int_t fLastTimeBin;                                                            //!transient
227
228         Bool_t fDoMC; // flag to provide MC labels
229         Bool_t fReleaseMemory; // flag to release the memory after each event
230         AliHLTComponentBenchmark fBenchmark; // benchmark
231
232         ClassDef(AliHLTTPCClusterFinderComponent, 0)
233
234 };
235 #endif