]>
Commit | Line | Data |
---|---|---|
33daad3d | 1 | //-*- Mode: C++ -*- |
2 | // $Id: $ | |
3 | ||
4 | //************************************************************************** | |
5 | //* This file is property of and copyright by the ALICE HLT Project * | |
6 | //* ALICE Experiment at CERN, All rights reserved. * | |
7 | //* * | |
8 | //* Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> * | |
9 | //* for The ALICE HLT Project. * | |
10 | //* * | |
11 | //* Permission to use, copy, modify and distribute this software and its * | |
12 | //* documentation strictly for non-commercial purposes is hereby granted * | |
13 | //* without fee, provided that the above copyright notice appears in all * | |
14 | //* copies and that both the copyright notice and this permission notice * | |
15 | //* appear in the supporting documentation. The authors make no claims * | |
16 | //* about the suitability of this software for any purpose. It is * | |
17 | //* provided "as is" without express or implied warranty. * | |
18 | //************************************************************************** | |
19 | ||
20 | /** @file AliHLTJETFastJetComponent.cxx | |
21 | @author Jochen Thaeder <thaeder@kip.uni-heidelberg.de> | |
22 | @date | |
23 | @brief Component to run the FastJet jetfinder | |
24 | */ | |
25 | ||
26 | #if __GNUC__>= 3 | |
27 | using namespace std; | |
28 | #endif | |
29 | ||
30 | #include <cstdlib> | |
31 | #include <cerrno> | |
32 | #include <sys/time.h> | |
33 | ||
34 | #include "AliHLTJETFastJetComponent.h" | |
35 | ||
36 | //#include "AliJetESDReader.h" | |
37 | //#include "AliJetESDReaderHeader.h" | |
38 | ||
39 | #include "AliCDBEntry.h" | |
40 | #include "AliCDBManager.h" | |
41 | ||
42 | #include "AliMCEvent.h" | |
43 | #include "AliHeader.h" | |
e0677301 | 44 | #include "AliStack.h" |
33daad3d | 45 | |
46 | #include "TString.h" | |
47 | #include "TObjString.h" | |
48 | ||
49 | /** ROOT macro for the implementation of ROOT specific class methods */ | |
50 | ClassImp(AliHLTJETFastJetComponent) | |
51 | ||
52 | /* | |
53 | * --------------------------------------------------------------------------------- | |
54 | * Constructor / Destructor | |
55 | * --------------------------------------------------------------------------------- | |
56 | */ | |
57 | ||
58 | // ################################################################################# | |
59 | AliHLTJETFastJetComponent::AliHLTJETFastJetComponent() | |
60 | : | |
61 | fJetFinder(NULL), | |
62 | fJetHeader(NULL), | |
63 | fJetReader(NULL), | |
64 | fJetReaderHeader(NULL) { | |
65 | // see header file for class documentation | |
66 | // or | |
67 | // refer to README to build package | |
68 | // or | |
69 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
70 | } | |
71 | ||
72 | // ################################################################################# | |
73 | AliHLTJETFastJetComponent::~AliHLTJETFastJetComponent() { | |
74 | // see header file for class documentation | |
75 | } | |
76 | ||
77 | /* | |
78 | * --------------------------------------------------------------------------------- | |
79 | * Public functions to implement AliHLTComponent's interface. | |
80 | * These functions are required for the registration process | |
81 | * --------------------------------------------------------------------------------- | |
82 | */ | |
83 | ||
84 | // ################################################################################# | |
85 | const Char_t* AliHLTJETFastJetComponent::GetComponentID() { | |
86 | // see header file for class documentation | |
87 | return "JETFastJetFinder"; | |
88 | } | |
89 | ||
90 | // ################################################################################# | |
91 | void AliHLTJETFastJetComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) { | |
92 | // see header file for class documentation | |
93 | list.clear(); | |
94 | list.push_back( kAliHLTDataTypeMCObject|kAliHLTDataOriginOffline ); | |
95 | list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginOffline ); | |
96 | list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginHLT ); | |
97 | } | |
98 | ||
99 | // ################################################################################# | |
100 | AliHLTComponentDataType AliHLTJETFastJetComponent::GetOutputDataType() { | |
101 | // see header file for class documentation | |
102 | return (kAliHLTDataTypeESDObject| kAliHLTDataOriginHLT); | |
103 | } | |
104 | ||
105 | // ################################################################################# | |
106 | void AliHLTJETFastJetComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) { | |
107 | // see header file for class documentation | |
108 | ||
109 | constBase = 0; | |
110 | inputMultiplier = 0.3; | |
111 | } | |
112 | ||
113 | // ################################################################################# | |
114 | AliHLTComponent* AliHLTJETFastJetComponent::Spawn() { | |
115 | // see header file for class documentation | |
116 | return new AliHLTJETFastJetComponent(); | |
117 | } | |
118 | ||
119 | /* | |
120 | * --------------------------------------------------------------------------------- | |
121 | * Protected functions to implement AliHLTComponent's interface. | |
122 | * These functions provide initialization as well as the actual processing | |
123 | * capabilities of the component. | |
124 | * --------------------------------------------------------------------------------- | |
125 | */ | |
126 | ||
127 | // ################################################################################# | |
128 | Int_t AliHLTJETFastJetComponent::DoInit( Int_t /*argc*/, const Char_t** /*argv*/ ) { | |
129 | // see header file for class documentation | |
130 | ||
131 | if ( fJetFinder || fJetReader || fJetHeader || fJetReader ) | |
e0677301 | 132 | return -EINPROGRESS; |
33daad3d | 133 | |
33daad3d | 134 | |
e0677301 | 135 | // -- Jet Reader Header |
136 | // ------------------------------------------- | |
137 | if ( ! (fJetReaderHeader = new AliJetKineReaderHeader()) ) { | |
138 | HLTError("Error initializing Jet Reader Header"); | |
139 | return -EINPROGRESS; | |
140 | } | |
141 | ||
33daad3d | 142 | fJetReaderHeader->SetComment("MC full Kinematics"); |
143 | fJetReaderHeader->SetFastSimTPC(kFALSE); | |
144 | fJetReaderHeader->SetFastSimEMCAL(kFALSE); | |
145 | fJetReaderHeader->SetPtCut(0.); | |
e0677301 | 146 | |
147 | // -- Jet Reader | |
148 | // ------------------------------------------- | |
149 | if ( ! (fJetReader = new AliJetKineReader()) ) { | |
150 | HLTError("Error initializing Jet Reader"); | |
151 | return -EINPROGRESS; | |
152 | } | |
153 | ||
33daad3d | 154 | fJetReader->SetReaderHeader(fJetReaderHeader); |
155 | ||
e0677301 | 156 | // -- Jet Header |
157 | // ------------------------------------------- | |
158 | if ( ! (fJetHeader = new AliFastJetHeader()) ) { | |
159 | HLTError("Error initializing Jet Header"); | |
160 | return -EINPROGRESS; | |
161 | } | |
162 | ||
163 | fJetHeader->SetRparam(0.7); | |
164 | ||
165 | // -- Jet Finder | |
166 | // ------------------------------------------- | |
167 | if ( ! (fJetFinder = new AliFastJetFinder()) ) { | |
168 | HLTError("Error initializing Jet Finder"); | |
169 | return -EINPROGRESS; | |
170 | } | |
171 | ||
172 | fJetFinder->SetJetHeader(fJetHeader); | |
173 | fJetFinder->SetJetReader(fJetReader); | |
174 | fJetFinder->SetOutputFile("jets.root"); | |
175 | ||
176 | // -- Initialize Jet Finder | |
177 | // ------------------------------------------- | |
178 | fJetFinder->Init(); | |
179 | ||
180 | ||
181 | #if 0 | |
33daad3d | 182 | fJetReaderHeader = new AliJetESDReaderHeader(); |
183 | fJetReaderHeader->SetComment("Testing"); | |
184 | fJetReaderHeader->SetFirstEvent(0); | |
185 | fJetReaderHeader->SetLastEvent(4); | |
33daad3d | 186 | fJetReader = new AliJetESDReader(); |
187 | fJetReader->SetReaderHeader(fJetReaderHeader); | |
188 | #endif | |
33daad3d | 189 | |
190 | return 0; | |
191 | } | |
192 | ||
193 | // ################################################################################# | |
194 | Int_t AliHLTJETFastJetComponent::DoDeinit() { | |
195 | // see header file for class documentation | |
196 | ||
33daad3d | 197 | if ( fJetFinder ) |
198 | delete fJetFinder; | |
199 | fJetFinder = NULL; | |
200 | ||
201 | if ( fJetHeader ) | |
202 | delete fJetHeader; | |
203 | fJetHeader = NULL; | |
e0677301 | 204 | |
33daad3d | 205 | if ( fJetReader ) |
206 | delete fJetReader; | |
207 | fJetReader = NULL; | |
e0677301 | 208 | |
33daad3d | 209 | if ( fJetReaderHeader ) |
210 | delete fJetReaderHeader; | |
211 | fJetReaderHeader = NULL; | |
e0677301 | 212 | |
33daad3d | 213 | return 0; |
214 | } | |
215 | ||
216 | // ################################################################################# | |
217 | Int_t AliHLTJETFastJetComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, | |
218 | AliHLTComponentTriggerData& /*trigData*/ ) { | |
219 | // see header file for class documentation | |
220 | ||
221 | const TObject* iter = NULL; | |
222 | ||
223 | for ( iter=GetFirstInputObject(kAliHLTDataTypeMCObject|kAliHLTDataOriginOffline); iter != NULL; iter=GetNextInputObject() ) { | |
224 | ||
225 | // ADD MC Object | |
226 | ||
e0677301 | 227 | // -- Set Input Event |
228 | fJetFinder->GetReader()->SetInputEvent( NULL, NULL, const_cast<TObject*>(iter) ); | |
229 | ||
33daad3d | 230 | AliMCEvent* foo = ( AliMCEvent* ) iter; |
231 | cout << foo->GetNumberOfTracks() << " -- " | |
e0677301 | 232 | << foo->Stack() << " -- " |
233 | << foo->Header()->Stack() << " -- " | |
234 | << foo->Header() << endl; | |
235 | ||
236 | AliStack* stack = foo->Stack(); | |
237 | cout << "N tracks" << stack->GetNtrack() << endl; | |
238 | ||
239 | for (Int_t iterStack = 0; iterStack < stack->GetNtrack(); iterStack++) { | |
240 | cout << iterStack << " -- " << stack->Particle(iterStack) << endl; | |
241 | ||
242 | } | |
243 | // -- Process Event | |
244 | // fJetFinder->ProcessEvent(); | |
245 | } | |
246 | ||
247 | ||
248 | if ( GetFirstInputObject(kAliHLTDataTypeEOR) ) { | |
249 | //fJetFinder->FinishRun(); | |
33daad3d | 250 | } |
251 | ||
e0677301 | 252 | |
253 | ||
33daad3d | 254 | for ( iter=GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginOffline); iter != NULL; iter=GetNextInputObject() ) { |
255 | // ADD ESD Object -- Offline | |
256 | ||
257 | printf (" --- ESD-Offline --- \n"); | |
258 | } | |
259 | ||
260 | for ( iter=GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginHLT); iter != NULL; iter=GetNextInputObject() ) { | |
261 | // ADD ESD Object -- HLT | |
262 | printf (" --- ESD-HLT --- \n"); | |
263 | } | |
264 | ||
265 | ||
266 | // ** PushBack ** \\ | |
e0677301 | 267 | |
33daad3d | 268 | |
269 | return 0; | |
270 | } |