2 // $Id: AliHLTJETAnalysisComponent.cxx $
3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Jochen Thaeder <jochen@thaeder.de> *
8 //* for The ALICE HLT Project. *
10 //* Permission to use, copy, modify and distribute this software and its *
11 //* documentation strictly for non-commercial purposes is hereby granted *
12 //* without fee, provided that the above copyright notice appears in all *
13 //* copies and that both the copyright notice and this permission notice *
14 //* appear in the supporting documentation. The authors make no claims *
15 //* about the suitability of this software for any purpose. It is *
16 //* provided "as is" without express or implied warranty. *
17 //**************************************************************************
19 /** @file AliHLTJETAnalysisComponent.cxx
20 @author Jochen Thaeder <jochen@thaeder.de>
21 @brief Component to run the analysis for the jetfinder
29 #include "TObjString.h"
30 #include "TObjArray.h"
32 #include "AliHLTJETAnalysisComponent.h"
36 /** ROOT macro for the implementation of ROOT specific class methods */
37 ClassImp(AliHLTJETAnalysisComponent)
40 * ---------------------------------------------------------------------------------
41 * Constructor / Destructor
42 * ---------------------------------------------------------------------------------
45 // #################################################################################
46 AliHLTJETAnalysisComponent::AliHLTJETAnalysisComponent() :
48 // see header file for class documentation
50 // refer to README to build package
52 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
56 // #################################################################################
57 AliHLTJETAnalysisComponent::~AliHLTJETAnalysisComponent() {
58 // see header file for class documentation
62 * ---------------------------------------------------------------------------------
63 * Public functions to implement AliHLTComponent's interface.
64 * These functions are required for the registration process
65 * ---------------------------------------------------------------------------------
68 // #################################################################################
69 const Char_t* AliHLTJETAnalysisComponent::GetComponentID() {
70 // see header file for class documentation
74 // #################################################################################
75 void AliHLTJETAnalysisComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
76 // see header file for class documentation
78 list.push_back( kAliHLTDataTypeJet|kAliHLTDataOriginHLT );
79 list.push_back( kAliHLTDataTypeJet|kAliHLTDataOriginOffline );
80 list.push_back( kAliHLTDataTypeMCObject|kAliHLTDataOriginOffline );
81 list.push_back( kAliHLTDataTypeMCObject|kAliHLTDataOriginHLT );
84 // #################################################################################
85 AliHLTComponentDataType AliHLTJETAnalysisComponent::GetOutputDataType() {
86 // see header file for class documentation
87 return (kAliHLTDataTypeESDObject|kAliHLTDataOriginHLT); // XXX To Be CHANGED
90 // #################################################################################
91 void AliHLTJETAnalysisComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) {
92 // see header file for class documentation
95 inputMultiplier = 0.3;
98 // #################################################################################
99 AliHLTComponent* AliHLTJETAnalysisComponent::Spawn() {
100 // see header file for class documentation
101 return new AliHLTJETAnalysisComponent();
105 * ---------------------------------------------------------------------------------
106 * Protected functions to implement AliHLTComponent's interface.
107 * These functions provide initialization as well as the actual processing
108 * capabilities of the component.
109 * ---------------------------------------------------------------------------------
112 // #################################################################################
113 Int_t AliHLTJETAnalysisComponent::DoInit( Int_t argc, const Char_t** argv ) {
114 // see header file for class documentation
121 Int_t bMissingParam=0;
124 // -- Loop over all arguments
125 for ( Int_t iter = 0; iter<argc && iResult>=0; iter++) {
128 if (argument.IsNull())
134 if ( !argument.CompareTo("-nevents") ) {
135 if ((bMissingParam=(++iter>=argc))) break;
137 TString parameter(argv[iter]);
138 parameter.Remove(TString::kLeading, ' ');
140 if ( parameter.IsDigit() ) {
141 fNEventsMax = parameter.Atoi() - 1;
144 HLTError("Wrong parameter %s for argument %s.", parameter.Data(), argument.Data());
149 // -- Argument not known
151 HLTError("Unknown argument %s.", argument.Data());
156 } // for ( Int iter = 0; iter<argc && iResult>=0; iter++) {
158 // -- Check if parameter is missing
159 if ( bMissingParam ) {
160 HLTError("Missing parameter for argument %s.", argument.Data());
165 fAnalysisJets = new AliHLTJETAnalysisJets();
166 fAnalysisJets->Initialize();
172 // #################################################################################
173 Int_t AliHLTJETAnalysisComponent::DoDeinit() {
174 // see header file for class documentation
177 delete fAnalysisJets;
178 fAnalysisJets = NULL;
183 // #################################################################################
184 Int_t AliHLTJETAnalysisComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/,
185 AliHLTComponentTriggerData& /*trigData*/ ) {
186 // see header file for class documentation
190 const TObject* iter = NULL;
192 // ------------------------------------------------
194 // ------------------------------------------------
195 if ( IsDataEvent() ) {
197 fAnalysisJets->ResetEvent();
199 // -- Loop over jet objects
200 // ------------------------------
201 for ( iter=GetFirstInputObject(kAliHLTDataTypeJet|kAliHLTDataOriginHLT);
202 iter != NULL && !iResult; iter=GetNextInputObject() ) {
204 fAnalysisJets->SetJetsRec(reinterpret_cast<AliHLTJets*>(const_cast<TObject*>(iter)));
207 // -- ADD MC Object -- On-line
208 // ------------------------------
209 for ( iter=GetFirstInputObject(kAliHLTDataTypeMCObject|kAliHLTDataOriginHLT);
210 iter != NULL && !iResult; iter=GetNextInputObject() ) {
212 fAnalysisJets->SetJetsCmp(reinterpret_cast<AliHLTMCEvent*>(const_cast<TObject*>(iter)),
217 // ------------------
218 iResult = fAnalysisJets->Analyze();
221 // ------------------------------------------------
223 // ------------------------------------------------
225 if ( GetFirstInputBlock(kAliHLTDataTypeEOR) ) {
226 PushBack(fAnalysisJets, kAliHLTDataTypeJet|kAliHLTDataOriginHLT, GetSpecification());