]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/JET/AliHLTJETFastJetComponent.cxx
First Checkin for JET library in the HLT
[u/mrichter/AliRoot.git] / HLT / JET / AliHLTJETFastJetComponent.cxx
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"
44
45 #include "TString.h"
46 #include "TObjString.h"
47
48 /** ROOT macro for the implementation of ROOT specific class methods */
49 ClassImp(AliHLTJETFastJetComponent)
50
51 /*
52  * ---------------------------------------------------------------------------------
53  *                            Constructor / Destructor
54  * ---------------------------------------------------------------------------------
55  */
56
57 // #################################################################################
58 AliHLTJETFastJetComponent::AliHLTJETFastJetComponent() 
59   :
60   fJetFinder(NULL),
61   fJetHeader(NULL),
62   fJetReader(NULL),
63   fJetReaderHeader(NULL) {
64   // see header file for class documentation
65   // or
66   // refer to README to build package
67   // or
68   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
69 }
70
71 // #################################################################################
72 AliHLTJETFastJetComponent::~AliHLTJETFastJetComponent() {
73   // see header file for class documentation
74 }
75
76 /*
77  * ---------------------------------------------------------------------------------
78  * Public functions to implement AliHLTComponent's interface.
79  * These functions are required for the registration process
80  * ---------------------------------------------------------------------------------
81  */
82
83 // #################################################################################
84 const Char_t* AliHLTJETFastJetComponent::GetComponentID() {
85   // see header file for class documentation
86   return "JETFastJetFinder";
87 }
88
89 // #################################################################################
90 void AliHLTJETFastJetComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
91   // see header file for class documentation
92   list.clear(); 
93   list.push_back( kAliHLTDataTypeMCObject|kAliHLTDataOriginOffline );
94   list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginOffline );
95   list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginHLT );
96 }
97
98 // #################################################################################
99 AliHLTComponentDataType AliHLTJETFastJetComponent::GetOutputDataType() {
100   // see header file for class documentation
101   return (kAliHLTDataTypeESDObject| kAliHLTDataOriginHLT);
102 }
103
104 // #################################################################################
105 void AliHLTJETFastJetComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) {
106   // see header file for class documentation
107
108   constBase = 0;
109   inputMultiplier = 0.3;
110 }
111
112 // #################################################################################
113 AliHLTComponent* AliHLTJETFastJetComponent::Spawn() {
114   // see header file for class documentation
115   return new AliHLTJETFastJetComponent();
116 }
117
118 /*
119  * ---------------------------------------------------------------------------------
120  * Protected functions to implement AliHLTComponent's interface.
121  * These functions provide initialization as well as the actual processing
122  * capabilities of the component. 
123  * ---------------------------------------------------------------------------------
124  */
125
126 // #################################################################################
127 Int_t AliHLTJETFastJetComponent::DoInit( Int_t /*argc*/, const Char_t** /*argv*/ ) {
128   // see header file for class documentation
129
130   if ( fJetFinder || fJetReader || fJetHeader || fJetReader )
131     return EINPROGRESS;
132
133 #ifdef HAVE_FASTJET
134   printf("HAVE FASTJET");
135 #else
136   printf("NO FASTJET");
137 #endif
138
139 #if 1
140   fJetReaderHeader = new AliJetKineReaderHeader();
141   fJetReaderHeader->SetComment("MC full Kinematics");
142   fJetReaderHeader->SetFastSimTPC(kFALSE);
143   fJetReaderHeader->SetFastSimEMCAL(kFALSE);
144   fJetReaderHeader->SetPtCut(0.);
145   
146   // Define reader and set its header
147   fJetReader = new AliJetKineReader();
148   fJetReader->SetReaderHeader(fJetReaderHeader);
149
150 #else
151   fJetReaderHeader = new AliJetESDReaderHeader();
152   fJetReaderHeader->SetComment("Testing");
153   fJetReaderHeader->SetFirstEvent(0);
154   fJetReaderHeader->SetLastEvent(4);
155   
156   fJetReader = new AliJetESDReader();
157   fJetReader->SetReaderHeader(fJetReaderHeader);
158 #endif
159
160   fJetHeader = new AliFastJetHeader();
161   fJetHeader->SetRparam(0.7);
162  
163   fJetFinder = new AliFastJetFinder();
164   fJetFinder->SetJetHeader(fJetHeader);
165   fJetFinder->SetJetReader(fJetReader);
166   fJetFinder->SetOutputFile("jets.root");
167   
168   return 0;
169 }
170
171 // #################################################################################
172 Int_t AliHLTJETFastJetComponent::DoDeinit() {
173   // see header file for class documentation
174
175   /*
176   if ( fJetFinder )
177     delete fJetFinder;
178   fJetFinder = NULL;
179
180   if ( fJetHeader )
181     delete fJetHeader;
182   fJetHeader = NULL;
183   */
184   /*
185   if ( fJetReader )
186     delete fJetReader;
187   fJetReader = NULL;
188
189   if ( fJetReaderHeader )
190     delete fJetReaderHeader;
191   fJetReaderHeader = NULL;
192   */
193   return 0;
194 }
195
196 // #################################################################################
197 Int_t AliHLTJETFastJetComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/,
198                                           AliHLTComponentTriggerData& /*trigData*/ ) {
199   // see header file for class documentation
200
201   const TObject* iter = NULL;
202   
203   for ( iter=GetFirstInputObject(kAliHLTDataTypeMCObject|kAliHLTDataOriginOffline); iter != NULL; iter=GetNextInputObject() ) {
204
205     // ADD MC Object
206     
207     AliMCEvent* foo = ( AliMCEvent* ) iter;
208     cout << foo->GetNumberOfTracks() << " -- "
209          << foo->Stack() << " -- "
210          << foo->Header()->Stack() << " -- "
211          << foo->Header() << endl;
212     
213        printf ("  ---   MC  ---  \n");
214   }
215
216   for ( iter=GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginOffline); iter != NULL; iter=GetNextInputObject() ) {
217     // ADD ESD Object -- Offline
218
219     printf ("  ---   ESD-Offline  ---  \n");
220   }
221
222   for ( iter=GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginHLT); iter != NULL; iter=GetNextInputObject() ) {
223     // ADD ESD Object -- HLT
224     printf ("  ---   ESD-HLT  ---  \n");
225   }
226
227  
228   // ** PushBack ** \\
229   // ----------- ** \\
230   // ** PushBack ** \\
231
232   return 0;
233 }