]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/ITS/AliHLTITSClusterFinderComponent.h
Update HFE v2 analyses
[u/mrichter/AliRoot.git] / HLT / ITS / AliHLTITSClusterFinderComponent.h
1 //-*- Mode: C++ -*-
2 // $Id$
3 #ifndef ALIHLTITSCLUSTERFINDERCOMPONENT_H
4 #define ALIHLTITSCLUSTERFINDERCOMPONENT_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   AliHLTITSClusterFinderComponent.cxx
11 /// @author Gaute Ovrebekk <st05886@alf.uib.no>
12 /// @date   
13 /// @brief  Component to run the offline clusterfinder.
14 ///
15
16 #include "AliHLTProcessor.h"
17 #include "AliRawReaderMemory.h"
18 #include "AliITSDetTypeRec.h"
19 #include "AliITSgeom.h"
20 #include "AliITSInitGeometry.h"
21 #include "TClonesArray.h"
22 #include "AliHLTDataTypes.h"
23 #include "TTree.h"
24 #include "AliHLTComponentBenchmark.h"
25 #include "AliITSRecPoint.h"
26
27 class AliHLTITSClusterFinderSPD;
28 class AliHLTITSClusterFinderSSD;
29 class AliHLTITSClusterData;
30 class AliLoader;
31
32 /**
33  * @class AliHLTITSClusterFinderComponent
34  * HLT Component to run the ITS offline clusterfinders.
35  *
36  * <h2>General properties:</h2>
37  *
38  * Component ID: \b ITSClusterFinderSPD or ITSClusterFinderSDD or ITSClusterFinderSSD <br>
39  * Library: \b libAliHLTITS.so                              <br>
40  * Input Data Types:                                        <br> 
41  *    kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSPD or kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSDD or kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSD <br>
42  *      
43  * Output Data Types:                                       <br>
44  *    kAliHLTDataTypeClusters|kAliHLTDataOriginITSSPD or kAliHLTDataTypeClusters|kAliHLTDataOriginITSSDD or kAliHLTDataTypeClusters|kAliHLTDataOriginITSSSD <br>
45  *
46  * <h2>Mandatory arguments:</h2>
47  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
48  *
49  * <h2>Optional arguments:</h2>
50  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
51  *
52  * <h2>Configuration:</h2>
53  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
54  * \li -config1      <i> teststring   </i> <br>
55  *      a configuration argument with one parameter
56  * \li -config2                            <br>
57  *      a configuration argument without parameters
58  *
59  * <h2>Default CDB entries:</h2>
60  * ITS/Calib/SPDNoisy
61  * ITS/Calib/SPDDead
62  * TRIGGER/SPD/PITConditions
63  * ITS/Calib/CalibSDD
64  * ITS/Calib/RespSDD
65  * ITS/Calib/DriftSpeedSDD
66  * ITS/Calib/DDLMapSDD
67  * ITS/Calib/MapsTimeSDD
68  * ITS/Calib/NoiseSSD
69  * ITS/Calib/GainSSD
70  * ITS/Calib/BadChannelsSSD
71  * GRP/CTP/Scalers
72  *
73  * <h2>Performance:</h2>
74  * TODO
75  *
76  * <h2>Memory consumption:</h2>
77  * TODO
78  *
79  * <h2>Output size:</h2>
80  * TODO
81  *
82  * <h2>Pending issues:</h2>
83  * There is a general problem with the streaming of the digit tree. A description
84  * is in the GetEvent function. For many events the hotfix for that caused bug
85  * https://savannah.cern.ch/bugs/?72815
86  * This has been fixed by accessing the AliLoader in the CF component via the
87  * global AliRunLoader. This breaks the idea of components, however it's used in
88  * simulation inside AliRoot only.
89  *
90  * @ingroup alihlt_its_components
91  */
92 class AliHLTITSClusterFinderComponent : public AliHLTProcessor
93 {
94  public:
95   /**
96    * Defines for selecting clusterfinder for SPD, SDD or SSD.
97    */
98   enum {
99     kClusterFinderSPD,
100     kClusterFinderSDD,
101     kClusterFinderSSD,
102     kClusterFinderDigits    
103   };
104   /*
105    * ---------------------------------------------------------------------------------
106    *                            Constructor / Destructor
107    * ---------------------------------------------------------------------------------
108    */
109   
110   /** constructor
111    *  @param mode    input type see e.g. @ref kClusterFinderSPD
112    */
113   AliHLTITSClusterFinderComponent(int mode);
114
115   /** destructor */
116   virtual ~AliHLTITSClusterFinderComponent();
117
118   /*
119    * ---------------------------------------------------------------------------------
120    * Public functions to implement AliHLTComponent's interface.
121    * These functions are required for the registration process
122    * ---------------------------------------------------------------------------------
123    */
124
125   /** interface function, see @ref AliHLTComponent for description */
126   const char* GetComponentID();
127
128   /** interface function, see @ref AliHLTComponent for description */
129    void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
130
131   /** interface function, see @ref AliHLTComponent for description */
132   AliHLTComponentDataType GetOutputDataType();
133
134   /** interface function, see @ref AliHLTComponent for description */
135   virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
136
137   /** interface function, see @ref AliHLTComponent for description */
138   void GetOCDBObjectDescription( TMap* const targetMap);
139
140   /** interface function, see @ref AliHLTComponent for description */
141   AliHLTComponent* Spawn();
142
143  protected:
144         
145   /*
146    * ---------------------------------------------------------------------------------
147    * Protected functions to implement AliHLTComponent's interface.
148    * These functions provide initialization as well as the actual processing
149    * capabilities of the component. 
150    * ---------------------------------------------------------------------------------
151    */
152         
153   /** Initialization */
154   Int_t DoInit( int argc, const char** argv );
155
156   /** DeInitialization */
157   Int_t DoDeinit();
158   
159   /** EventLoop */
160  
161   Int_t DoEvent(
162                 const AliHLTComponentEventData& evtData,
163                 const AliHLTComponentBlockData* blocks,
164                 AliHLTComponentTriggerData& /*trigData*/,
165                 AliHLTUInt8_t* outputPtr,
166                 AliHLTUInt32_t& size,
167                 vector<AliHLTComponentBlockData>& outputBlocks );
168
169   //Int_t DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/);
170
171   int Reconfigure(const char* cdbEntry, const char* chainId);
172
173   using AliHLTProcessor::DoEvent;
174  
175   ///////////////////////////////////////////////////////////////////////////////////
176     
177  private:
178   /** standard constructor prohibited */
179   AliHLTITSClusterFinderComponent();
180   /** copy constructor prohibited */
181   AliHLTITSClusterFinderComponent(const AliHLTITSClusterFinderComponent&);
182   /** assignment operator prohibited */
183   AliHLTITSClusterFinderComponent& operator=(const AliHLTITSClusterFinderComponent&);
184   /**
185    * Configure the component.
186    * Parse a string for the configuration arguments and set the component
187    * properties.
188    */
189   int Configure(const char* arguments);
190
191   void RecPointToSpacePoint(AliHLTUInt8_t* outputPtr,AliHLTUInt32_t& size);
192   void RecpointToOutput(AliHLTITSClusterData *outputClusters, AliITSRecPoint *recpoint, int &clustIdx);
193   /*
194    * ---------------------------------------------------------------------------------
195    *                             Members - private
196    * ---------------------------------------------------------------------------------
197    */
198
199   /**
200    * switch to indicated the ClusterFinder
201    * use fModeSwitch = 0 for SPD
202    * use fModeSwitch = 1 for SDD
203    * use fModeSwitch = 2 for SSD
204    * use fModeSwitch = 3 for ClusterFinding on Digits (Full ITS)
205    */
206   Int_t fModeSwitch;      // !
207   AliHLTComponentDataType fInputDataType; // !
208   AliHLTComponentDataType fOutputDataType; // !
209   
210   Bool_t fUseOfflineFinder; // flag to use the offline clusterfinder
211   Int_t fNModules;             // total number of modules
212   Int_t fId;                   // ddl offset
213   Int_t fNddl;                 // number of ddl's
214   
215   /** the reader object for data decoding */
216
217   AliRawReaderMemory* fRawReader;                             //!transient
218   AliITSDetTypeRec* fDettype;                                 //!transient
219   AliITSgeom* fgeom;                                          //!transient
220   AliITSInitGeometry* fgeomInit;                              //!transient
221  
222   AliHLTITSClusterFinderSPD *fSPD;                            //!transient
223   AliHLTITSClusterFinderSSD *fSSD;                            //!transient
224
225   TTree *tD;                                                  //!transient
226   TTree *tR;                                                  //!transient
227
228   Int_t fSPDNModules;                                         //!transient 
229   Int_t fSDDNModules;                                         //!transient
230   Int_t fSSDNModules;                                         //!transient 
231   
232   Int_t fFirstModule;                                         //!transient    
233   Int_t fLastModule;                                          //!transient
234   Int_t fnClusters;                                           //!transient
235
236   std::vector<AliITSRecPoint> fclusters;                      //!transient
237
238   AliHLTComponentBenchmark fBenchmark;// benchmark
239
240   unsigned long fOutputSizeOffset; //! const offset for output size estimation
241   // 2011-01-27: the transport of digits via the AliLoaderPublisher is
242   // not working stably at the moment. In particular the size of the
243   // streamed digit tree seems not to be correlated with the content
244   // furthermore the CF implements a hotfix accessing the root file
245   // directly. The variable fInputMultiplierDigits will be used for a
246   // dynamic adaption of the buffer size. The component will then return
247   // -ENOSPC and AliHLTTask carries out the event processing once again
248   // with adjusted buffer size
249   float fInputMultiplierDigits; //! variable input multiplier for CF type digits
250   AliLoader* fpLoader; //! ITS loader for getting digit tree
251
252   ClassDef(AliHLTITSClusterFinderComponent, 0)
253     
254 };
255 #endif