Line data Source code
1 : #ifndef AliHLTMUONDECISIONCOMPONENT_H
2 : #define AliHLTMUONDECISIONCOMPONENT_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: $
8 :
9 : ///
10 : /// @file AliHLTMUONDecisionComponent.h
11 : /// @author Artur Szostak <artursz@iafrica.com>
12 : /// @date 30 April 2008
13 : /// @brief Declares the decision component for dimuon HLT triggering.
14 : ///
15 :
16 : #include "AliHLTMUONProcessor.h"
17 : #include "AliHLTMUONDataTypes.h"
18 :
19 : #if __GNUC__ && __GNUC__ < 3
20 : #define std
21 : #endif
22 :
23 : extern "C" struct AliHLTMUONTrackStruct;
24 : extern "C" struct AliHLTMUONMansoTrackStruct;
25 : extern "C" struct AliHLTMUONTrackDecisionStruct;
26 : extern "C" struct AliHLTMUONPairDecisionStruct;
27 : extern "C" struct AliHLTMUONSinglesDecisionBlockStruct;
28 : extern "C" struct AliHLTMUONPairsDecisionBlockStruct;
29 :
30 :
31 : /**
32 : * @class AliHLTMUONDecisionComponent
33 : * @brief Dimuon HLT trigger decision component.
34 : *
35 : * This class implements the dimuon HLT trigger decision component.
36 : * The dimuon trigger decision is generated by first applying two pT cuts to the
37 : * single tracks: a low cut for the J/psi family and a high cut for the upsilon
38 : * family. From the tracks that pass the cuts, we count them and build up some
39 : * statistics like the number of tracks passing the low or high pT cut.
40 : * The algorithm then looks at pairs of tracks and similarly counts the number
41 : * like sign or unlike sign pairs where both tracks passed the low or high pT cut
42 : * or pairs that did not pass any cuts.
43 : * At this point the invariant mass of the pairs is calculated and two mass cuts
44 : * are applied. The number of pairs that pass the low or high mass cut are then
45 : * counted. The results are encoded into two data blocks, one for trigger decisions
46 : * for single tracks and another for the track pairs.
47 : *
48 : * <h2>General properties:</h2>
49 : *
50 : * Component ID: \b MUONDecisionComponent <br>
51 : * Library: \b libAliHLTMUON.so <br>
52 : * Input Data Types: \li AliHLTMUONConstants::MansoTracksBlockDataType() = "MANTRACK:MUON" <br>
53 : * \li AliHLTMUONConstants::TracksBlockDataType() = "TRACKS :MUON" <br>
54 : * Output Data Types: \li AliHLTMUONConstants::SinglesDecisionBlockDataType() = "DECIDSIN:MUON"
55 : * \li AliHLTMUONConstants::PairsDecisionBlockDataType() = "DECIDPAR:MUON" <br>
56 : *
57 : * <h2>Mandatory arguments:</h2>
58 : * None.
59 : *
60 : * <h2>Optional arguments:</h2>
61 : * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
62 : * \li -lowptcut <i>value</i> <br>
63 : * Sets the low pT cut value to use when applying the decision. The <i>value</i>
64 : * should be a floating point number and has units GeV/c. If this parameter is
65 : * specified then it will not be loaded from CDB. <br>
66 : * \li -highptcut <i>value</i> <br>
67 : * Sets the high pT cut value to use when applying the decision. The <i>value</i>
68 : * should be a floating point number and has units GeV/c. If this parameter is
69 : * specified then it will not be loaded from CDB. <br>
70 : * \li -lowmasscut <i>value</i> <br>
71 : * Sets the low invariant mass cut value to use when applying the decision.
72 : * The <i>value</i> should be a floating point number and has units GeV/c^2.
73 : * If this parameter is specified then it will not be loaded from CDB. <br>
74 : * \li -highmasscut <i>value</i> <br>
75 : * Sets the high invariant mass cut value to use when applying the decision.
76 : * The <i>value</i> should be a floating point number and has units GeV/c^2.
77 : * If this parameter is specified then it will not be loaded from CDB. <br>
78 : * \li -no_singles_detail <br>
79 : * If specified the detailed decision information for tracks is not added to
80 : * the output. Only the scalar values are then present in the output data block
81 : * for decisions on single tracks. <br>
82 : * \li -no_pairs_detail <br>
83 : * If specified the detailed decision information for track pairs is not added
84 : * to the output. Only the scalar values are then present in the output data
85 : * block for decisions for track pairs. <br>
86 : * \li -warn_on_unexpected_block <br>
87 : * This will cause the component to generate warnings when it receives data block
88 : * types it does not know how to handle. Without this option the component only
89 : * generates debug messages when they are compiled in. <br>
90 : * \li -cdbpath <i>path</i> <br>
91 : * This allows one to override the path to use for the CDB location.
92 : * <i>path</i> must be a valid CDB URI. By default the HLT system framework
93 : * sets the CDB path. <br>
94 : * \li -run <i>number</i> <br>
95 : * This allows one to override the run number to use. <i>number</i> must be
96 : * a positive integer number. By default the HLT system framework sets the
97 : * run number. <br>
98 : * \li -delaysetup <br>
99 : * If indicated then part of the initialisation of the component is forcefully
100 : * delayed to the first event received, i.e. the Start-of-Run event. <br>
101 : * \li -dumponerror <br>
102 : * This flag will cause the component to dump the data blocks it received if
103 : * an error occurs during the processing of an event. <br>
104 : * \li -dumppath <i>path</i> <br>
105 : * Allows one to specify the path in which to dump the received data blocks
106 : * if an error occurs. <br>
107 : *
108 : * <h2>Standard configuration:</h2>
109 : * The configuration is taken from the CDB by default. It can be overridden with
110 : * the command line arguments.
111 : *
112 : * <h2>Default CDB entries:</h2>
113 : * HLT/ConfigMUON/DecisionComponent - Contains a TMap with the cut parameters.
114 : *
115 : * <h2>Performance:</h2>
116 : * For worst case numbers of tracks the decision component requires less than a
117 : * millisecond to process an event.
118 : *
119 : * <h2>Memory consumption:</h2>
120 : * This is a linear function of the input data size, but only a fraction. Thus the
121 : * memory usage is minimal. It should be under 1 MBytes.
122 : *
123 : * <h2>Output size:</h2>
124 : * This will depend linearly on the number of tracks found. But for nominal
125 : * multiplicities this should be less than 16 kBytes.
126 : *
127 : * @ingroup alihlt_muon_components
128 : */
129 : class AliHLTMUONDecisionComponent : public AliHLTMUONProcessor
130 : {
131 : public:
132 : AliHLTMUONDecisionComponent();
133 : virtual ~AliHLTMUONDecisionComponent();
134 :
135 : // Public functions to implement the AliHLTProcessor interface.
136 : // These functions are required for the registration process.
137 : virtual const char* GetComponentID();
138 : virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list);
139 : virtual AliHLTComponentDataType GetOutputDataType();
140 : virtual int GetOutputDataTypes(AliHLTComponentDataTypeList& list);
141 : virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
142 : virtual AliHLTComponent* Spawn();
143 :
144 : protected:
145 :
146 : // Protected functions to implement the AliHLTProcessor interface.
147 : // These functions provide initialization as well as the actual processing
148 : // capabilities of the component.
149 : virtual int DoInit(int argc, const char** argv);
150 : virtual int DoDeinit();
151 : virtual int Reconfigure(const char* cdbEntry, const char* componentId);
152 : virtual int ReadPreprocessorValues(const char* modules);
153 : virtual int DoEvent(
154 : const AliHLTComponentEventData& evtData,
155 : const AliHLTComponentBlockData* blocks,
156 : AliHLTComponentTriggerData& trigData,
157 : AliHLTUInt8_t* outputPtr,
158 : AliHLTUInt32_t& size,
159 : AliHLTComponentBlockDataList& outputBlocks
160 : );
161 :
162 : using AliHLTProcessor::DoEvent;
163 :
164 : private:
165 :
166 : // Do not allow copying of this class.
167 : AliHLTMUONDecisionComponent(const AliHLTMUONDecisionComponent& /*obj*/);
168 : AliHLTMUONDecisionComponent& operator = (const AliHLTMUONDecisionComponent& /*obj*/);
169 :
170 : /**
171 : * Reads the cut parameters from the CDB.
172 : * \param setLowPtCut Indicates if the low pT cut should be set (default true).
173 : * \param setHighPtCut Indicates if the high pT cut should be set (default true).
174 : * \param setLowMassCut Indicates if the low invariant mass cut should be set (default true).
175 : * \param setHighMassCut Indicates if the high invariant mass cut should be set (default true).
176 : * \return 0 is returned on success and a non-zero value to indicate failure.
177 : */
178 : int ReadConfigFromCDB(
179 : bool setLowPtCut = true, bool setHighPtCut = true,
180 : bool setLowMassCut = true, bool setHighMassCut = true
181 : );
182 :
183 : /// Internal track information structure for the fTracks buffer.
184 : struct AliTrackInfo
185 : {
186 : AliHLTInt32_t fId; /// Track ID.
187 : AliHLTFloat32_t fPx, fPy, fPz; /// Momentum vector.
188 : AliHLTMUONParticleSign fSign; /// The particle's charge sign.
189 : };
190 :
191 : /**
192 : * Creates a new element in fTracks and returns it.
193 : * NULL is returned if no more memory could be allocated.
194 : */
195 : AliTrackInfo* NewTrack();
196 :
197 : /// Adds Manso track information to the list of tracks to process.
198 : int AddTrack(const AliHLTMUONMansoTrackStruct* track);
199 :
200 : /// Adds track information from the full tracker component to the list of tracks to process.
201 : int AddTrack(const AliHLTMUONTrackStruct* track);
202 :
203 : int ApplyTriggerAlgorithm(
204 : AliHLTMUONSinglesDecisionBlockStruct& singlesHeader,
205 : AliHLTMUONTrackDecisionStruct* singlesDecision,
206 : AliHLTMUONPairsDecisionBlockStruct& pairsHeader,
207 : AliHLTMUONPairDecisionStruct* pairsDecision
208 : );
209 :
210 : AliHLTUInt32_t fMaxTracks; /// The maximum number of elements that can be stored in fTracks.
211 : AliHLTUInt32_t fTrackCount; /// The current number of elements stored in fTracks.
212 : AliTrackInfo* fTracks; /// Pointers to the Manso track structures in input data blocks.
213 : AliHLTFloat32_t fLowPtCut; /// The low pT cut value to apply to tracks. [GeV/c]
214 : AliHLTFloat32_t fHighPtCut; /// The high pT cut value to apply to tracks. [GeV/c]
215 : AliHLTFloat32_t fLowMassCut; /// The low invariant mass cut value to apply to tracks. [GeV/c^2]
216 : AliHLTFloat32_t fHighMassCut; /// The high invariant mass cut value to apply to tracks. [GeV/c^2]
217 : bool fWarnForUnexpecedBlock; /// Flag indicating if we should log a warning if we got a block of an unexpected type.
218 : bool fLowPtCutSet; ///< Indicates if the low pT cut parameter was set on the command line.
219 : bool fHighPtCutSet; ///< Indicates if the high pT cut parameter was set on the command line.
220 : bool fLowMassCutSet; ///< Indicates if the low invariant mass cut parameter was set on the command line.
221 : bool fHighMassCutSet; ///< Indicates if the high invariant mass cut parameter was set on the command line.
222 : bool fFillSinglesDetail; ///< If true then detailed trigger decision information for single tracks is generated.
223 : bool fFillPairsDetail; ///< If true then detailed trigger decision information for track pairs is generated.
224 :
225 6 : ClassDef(AliHLTMUONDecisionComponent, 0); // Trigger decision component for the dimuon HLT.
226 : };
227 :
228 : #endif // AliHLTMUONDECISIONCOMPONENT_H
|