]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/OfflineInterface/AliHLTMUONDigitPublisherComponent.h
cd4fc6a682d0a59e505cb2c652cac48e04c8459b
[u/mrichter/AliRoot.git] / HLT / MUON / OfflineInterface / AliHLTMUONDigitPublisherComponent.h
1 #ifndef ALIHLTMUONDIGITPUBLISHERCOMPONENT_H
2 #define ALIHLTMUONDIGITPUBLISHERCOMPONENT_H
3 /* This file is property of and copyright by the ALICE HLT Project        *
4  * ALICE Experiment at CERN, All rights reserved.                         *
5  * See cxx source for full Copyright notice                               */
6
7 /* $Id: AliHLTMUONDigitPublisherComponent.h 26179 2008-05-29 22:27:27Z aszostak $ */
8
9 ///
10 /// @file   AliHLTMUONDigitPublisherComponent.h
11 /// @author Artur Szostak <artursz@iafrica.com>
12 /// @date   29 May 2008
13 /// @brief  Declaration of a component to publish MUON data from digits.
14 ///
15
16 #include "AliHLTOfflineDataSource.h"
17 #include "TArrayI.h"
18
19 #if __GNUC__ && __GNUC__ < 3
20 #define std
21 #endif
22
23 class AliMUONVDigitStore;
24 class AliMUONVTriggerStore;
25 class AliMpExMap;
26 class AliMUONMCDataInterface;
27 class AliMUONDataInterface;
28
29 /**
30  * @class AliHLTMUONDigitPublisherComponent
31  * The component is used to convert simulated or reconstructed digits into DDL
32  * raw data streams on the fly and publish them. This is useful for running
33  * dHLT simulations on digit data where the raw data files are not available.
34  * The component is also used during dHLT simulation under AliSimulation where
35  * we do not have access to a rawReader.<br>
36  *
37  * Component ID: \b MUONDigitPublisher <br>
38  * Library: \b libAliHLTMUON.so  <br>
39  *
40  * Manditory arguments:<br>
41  * \li -ddl <number> <br>
42  *       Specifies which DDL to generate raw data for. <number> should be in the
43  *       range [1..22], where 1..20 are for tracker DDLs and 21 or 22 is for the
44  *       dimuon trigger.<br>
45  *
46  * Optional arguments:<br>
47  * \li -ddlid <br>
48  *       This is an alternative to using -ddl which allows specifying a DDL in
49  *       terms of the DDL equipment IDs.<br>
50  * \li -makescalars <br>
51  *       If set then the scalar events will be generated for the trigger DDLs.
52  *       (default is not to generate the scalars)<br>
53  * \li -simdata <br>
54  *       Indicates that the simulated digits should be used. (default option)<br>
55  * \li -recdata <br>
56  *       Indicates that the reconstructed digits tree should be used.<br>
57  * \li -firstevent <number> <br>
58  *      Indicates the first event number to fetch from AliRoot. The default is to
59  *      start from zero and increment the event number after every GetEvent call.
60  *      This mode causes the component to ignore the event number passed to it by
61  *      the system and rather use an internal counter. This mode can be overriden
62  *      with the -event_number_literal flag. <br>
63  * \li -event_number_literal <br>
64  *      This flag indicates to use the event numbers as literal indices into the
65  *      AliRoot trees. This option will cause the component to ignore the -firstevent
66  *      flag. <br>
67  *
68  * @ingroup alihlt_dimuon_component
69  */
70 class AliHLTMUONDigitPublisherComponent : public AliHLTOfflineDataSource
71 {
72 public:
73         AliHLTMUONDigitPublisherComponent();
74         virtual ~AliHLTMUONDigitPublisherComponent();
75
76         // Public functions to implement AliHLTComponent's interface.
77         // These functions are required for the component registration process.
78
79         virtual const char* GetComponentID();
80         virtual AliHLTComponentDataType GetOutputDataType();
81         virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
82         virtual AliHLTComponent* Spawn();
83         
84 protected:
85         
86         // Protected functions to implement AliHLTComponent's interface.
87         // These functions provide initialization as well as the actual processing
88         // capabilities of the component.
89         
90         virtual int DoInit(int argc, const char** argv);
91         virtual int DoDeinit();
92         
93         virtual int GetEvent(
94                         const AliHLTComponentEventData& evtData,
95                         AliHLTComponentTriggerData& trigData,
96                         AliHLTUInt8_t* outputPtr,
97                         AliHLTUInt32_t& size,
98                         vector<AliHLTComponentBlockData>& outputBlocks
99                 );
100         
101         using AliHLTOfflineDataSource::GetEvent;
102         
103 private:
104
105         // Do not allow copying of this class.
106         AliHLTMUONDigitPublisherComponent(const AliHLTMUONDigitPublisherComponent& /*obj*/);
107         AliHLTMUONDigitPublisherComponent& operator = (const AliHLTMUONDigitPublisherComponent& /*obj*/);
108         
109         int ParseChamberString(const char* str);
110         int ParseDetElemString(const char* str);
111         
112         /////////////////////////////////////////////////////////////////////////////////////////
113         // Methods copied from AliMUONRawWriter.
114         //TODO: This is not ideal. We should have AliMUONRawWriter re-factored so that
115         // we can have raw data generated into a memory resident buffer, rather than
116         // always written to a file on disk, as it is now. But this will take some time
117         // since people need to be convinced of this fact.
118         void Digits2BusPatchMap(
119                         const AliMUONVDigitStore& digitStore,
120                         AliMpExMap& busPatchMap, Int_t iDDL
121                 );
122         
123         int WriteTrackerDDL(
124                         const AliMUONVDigitStore* digitStore, Int_t iDDL,
125                         AliHLTUInt8_t* outBuffer, AliHLTUInt32_t& outBufferSize
126                 );
127         
128         int WriteTriggerDDL(
129                         const AliMUONVTriggerStore* triggerStore, Int_t iDDL,
130                         AliHLTUInt8_t* outBuffer, AliHLTUInt32_t& outBufferSize,
131                         bool scalarEvent = false
132                 );
133         
134         static void LocalWordPacking(UInt_t &word, UInt_t locId, UInt_t locDec,
135                                 UInt_t trigY, UInt_t posY, UInt_t posX,
136                                 UInt_t sdevX, UInt_t devX);
137         
138         /////////////////////////////////////////////////////////////////////////////////////////
139         
140         AliHLTInt32_t fDDL;  ///< DDL number in the range [0..21]. Set to -1 for invalid/unspecified value.
141         
142         Int_t fCurrentEventIndex;  ///< The current event index that is to be loaded.
143                                    //  -1 indicates that we should rather use the event
144                                    // numbers as given by the system.
145         
146         bool fMakeScalars;  ///< Flag indicating if the scalars should be generated for the trigger DDLs.
147         
148         AliMUONMCDataInterface* fMCDataInterface; ///< Access to MUON MC-related data.
149         AliMUONDataInterface* fDataInterface; ///< Access to MUON data.
150         
151         TArrayI fChamberExclusionList;  //! Exclusion list for tracking chambers.
152         TArrayI fDetElemExclusionList;  //! Exclusion list for tracking detector elements.
153         
154         ClassDef(AliHLTMUONDigitPublisherComponent, 0)  // dHLT component for publishing DDL streams from digits on the fly.
155 };
156
157 #endif // ALIHLTMUONDIGITPUBLISHERCOMPONENT_H