4 //**************************************************************************
5 //* This file is property of and copyright by the ALICE HLT Project *
6 //* ALICE Experiment at CERN, All rights reserved. *
8 //* Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
9 //* for The ALICE HLT Project. *
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 //**************************************************************************
20 /** @file AliHLTJETConeJetComponent.cxx
21 @author Jochen Thaeder <thaeder@kip.uni-heidelberg.de>
23 @brief Component to run the ConeJet jetfinder
30 #include "AliHLTJETConeJetComponent.h"
33 #include "TObjString.h"
37 /** ROOT macro for the implementation of ROOT specific class methods */
38 ClassImp(AliHLTJETConeJetComponent)
41 * ---------------------------------------------------------------------------------
42 * Constructor / Destructor
43 * ---------------------------------------------------------------------------------
46 // #################################################################################
47 AliHLTJETConeJetComponent::AliHLTJETConeJetComponent() :
52 fJetReaderHeader(NULL),
56 // see header file for class documentation
58 // refer to README to build package
60 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
64 // #################################################################################
65 AliHLTJETConeJetComponent::~AliHLTJETConeJetComponent() {
66 // see header file for class documentation
70 * ---------------------------------------------------------------------------------
71 * Public functions to implement AliHLTComponent's interface.
72 * These functions are required for the registration process
73 * ---------------------------------------------------------------------------------
76 // #################################################################################
77 const Char_t* AliHLTJETConeJetComponent::GetComponentID() {
78 // see header file for class documentation
79 return "JETConeJetFinder";
82 // #################################################################################
83 void AliHLTJETConeJetComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
84 // see header file for class documentation
86 list.push_back( kAliHLTDataTypeMCObject|kAliHLTDataOriginHLT );
87 list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginOffline );
88 list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginHLT );
91 // #################################################################################
92 AliHLTComponentDataType AliHLTJETConeJetComponent::GetOutputDataType() {
93 // see header file for class documentation
94 return (kAliHLTDataTypeJet|kAliHLTDataOriginHLT);
97 // #################################################################################
98 void AliHLTJETConeJetComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) {
99 // see header file for class documentation
102 inputMultiplier = 0.3;
105 // #################################################################################
106 AliHLTComponent* AliHLTJETConeJetComponent::Spawn() {
107 // see header file for class documentation
108 return new AliHLTJETConeJetComponent();
112 * ---------------------------------------------------------------------------------
113 * Protected functions to implement AliHLTComponent's interface.
114 * These functions provide initialization as well as the actual processing
115 * capabilities of the component.
116 * ---------------------------------------------------------------------------------
119 // #################################################################################
120 Int_t AliHLTJETConeJetComponent::DoInit( Int_t argc, const Char_t** argv ) {
121 // see header file for class documentation
123 if ( fJetFinder || fJetHeader || fJetReader || fJetReaderHeader ||
124 fTrackCuts || fSeedCuts || fJetCuts || fJets )
127 // ---------------------------------------------------------------------
129 // ---------------------------------------------------------------------
131 TString comment = "HLT Fast Fixed Seeded Cone finder ";
133 AliHLTJETBase::JetAlgorithmType_t algorithm = AliHLTJETBase::kFFSCSquareCell;
134 Bool_t leading = kFALSE;
135 Float_t coneRadius = 0.4;
136 Float_t trackCutMinPt = 1.0;
137 Float_t seedCutMinPt = 5.0;
138 Float_t jetCutMinEt = 15.0;
140 // ---------------------------------------------------------------------
142 // ---------------------------------------------------------------------
145 Int_t bMissingParam=0;
149 // -- Loop over all arguments
150 for ( Int_t iter = 0; iter<argc && iResult>=0; iter++) {
153 if (argument.IsNull())
157 if ( !argument.CompareTo("-algorithm") ) {
158 if ((bMissingParam=(++iter>=argc))) break;
160 TString parameter(argv[iter]);
161 parameter.Remove(TString::kLeading, ' ');
163 if ( !parameter.CompareTo("FSCSquareCell") ) {
164 algorithm = AliHLTJETBase::kFFSCSquareCell;
167 comment += parameter;
170 else if ( !parameter.CompareTo("FSCRadiusCell") ) {
171 algorithm = AliHLTJETBase::kFFSCRadiusCell;
174 comment += parameter;
178 HLTError("Wrong parameter %s for argument %s.", parameter.Data(), argument.Data());
184 else if ( !argument.CompareTo("-leading") ) {
185 if ((bMissingParam=(++iter>=argc))) break;
187 TString parameter(argv[iter]);
188 parameter.Remove(TString::kLeading, ' ');
190 if ( !parameter.CompareTo("0") ) {
194 comment += parameter;
197 else if ( !parameter.CompareTo("1") ) {
201 comment += parameter;
205 HLTError("Wrong parameter %s for argument %s.", parameter.Data(), argument.Data());
211 else if ( !argument.CompareTo("-coneRadius") ) {
212 if ((bMissingParam=(++iter>=argc))) break;
214 TString parameter(argv[iter]);
215 parameter.Remove(TString::kLeading, ' ');
217 if ( parameter.IsFloat() ) {
218 coneRadius = parameter.Atof();
221 comment += parameter;
225 HLTError("Wrong parameter %s for argument %s.", parameter.Data(), argument.Data());
231 else if ( !argument.CompareTo("-trackCutMinPt") ) {
232 if ((bMissingParam=(++iter>=argc))) break;
234 TString parameter(argv[iter]);
235 parameter.Remove(TString::kLeading, ' ');
237 if ( parameter.IsFloat() ) {
238 trackCutMinPt = parameter.Atof();
241 comment += parameter;
245 HLTError("Wrong parameter %s for argument %s.", parameter.Data(), argument.Data());
251 else if ( !argument.CompareTo("-seedCutMinPt") ) {
252 if ((bMissingParam=(++iter>=argc))) break;
254 TString parameter(argv[iter]);
255 parameter.Remove(TString::kLeading, ' ');
257 if ( parameter.IsFloat() ) {
258 seedCutMinPt = parameter.Atof();
261 comment += parameter;
265 HLTError("Wrong parameter %s for argument %s.", parameter.Data(), argument.Data());
271 else if ( !argument.CompareTo("-jetCutMinEt") ) {
272 if ((bMissingParam=(++iter>=argc))) break;
274 TString parameter(argv[iter]);
275 parameter.Remove(TString::kLeading, ' ');
277 if ( parameter.IsFloat() ) {
278 jetCutMinEt = parameter.Atof();
281 comment += parameter;
285 HLTError("Wrong parameter %s for argument %s.", parameter.Data(), argument.Data());
290 // -- Argument not known
292 HLTError("Unknown argument %s.", argument.Data());
295 } // for ( Int iter = 0; iter<argc && iResult>=0; iter++) {
297 // -- Check if parameter is missing
298 if ( bMissingParam ) {
299 HLTError("Missing parameter for argument %s.", argument.Data());
306 // ---------------------------------------------------------------------
308 // ---------------------------------------------------------------------
309 if ( ! (fTrackCuts = new AliHLTJETTrackCuts()) ) {
310 HLTError("Error instantiating track cuts");
314 fTrackCuts->SetChargedOnly( kTRUE );
315 fTrackCuts->SetMinPt( trackCutMinPt );
317 // ---------------------------------------------------------------------
319 // ---------------------------------------------------------------------
320 if ( ! (fSeedCuts = new AliHLTJETConeSeedCuts()) ) {
321 HLTError("Error instantiating seed cuts");
325 fSeedCuts->SetMinPt( seedCutMinPt );
327 // ---------------------------------------------------------------------
329 // ---------------------------------------------------------------------
330 if ( ! (fJetCuts = new AliHLTJETJetCuts()) ) {
331 HLTError("Error instantiating jet cuts");
335 fJetCuts->SetMinEt( jetCutMinEt );
337 // ---------------------------------------------------------------------
338 // -- Jet Reader Header
339 // ---------------------------------------------------------------------
340 if ( ! (fJetReaderHeader = new AliHLTJETReaderHeader()) ) {
341 HLTError("Error instantiating jet reader header");
346 fJetReaderHeader->SetJetAlgorithm( algorithm );
348 // Set prt to track cuts
349 fJetReaderHeader->SetTrackCuts( fTrackCuts );
350 fJetReaderHeader->SetSeedCuts( fSeedCuts );
352 // Set Eta min/max and Phi min/max
353 fJetReaderHeader->SetFiducialEta( -0.9, 0.9) ;
354 fJetReaderHeader->SetFiducialPhi( 0.0, TMath::TwoPi() ) ;
357 fJetReaderHeader->SetGridEtaBinning( 0.05 );
358 fJetReaderHeader->SetGridPhiBinning( 0.05 );
361 fJetReaderHeader->SetConeRadius(coneRadius);
363 // ---------------------------------------------------------------------
365 // ---------------------------------------------------------------------
366 if ( ! (fJetReader = new AliHLTJETReader()) ) {
367 HLTError("Error instantiating jet reader");
371 fJetReader->SetReaderHeader(fJetReaderHeader);
373 // ---------------------------------------------------------------------
375 // ---------------------------------------------------------------------
376 if ( ! (fJets = new AliHLTJets()) ) {
377 HLTError("Error instantiating jet container");
381 fJets->SetComment(comment);
383 // ---------------------------------------------------------------------
385 // ---------------------------------------------------------------------
386 if ( ! (fJetHeader = new AliHLTJETConeHeader()) ) {
387 HLTError("Error instantiating cone jet header");
391 fJetHeader->SetJetCuts(fJetCuts);
392 fJetHeader->SetUseLeading(leading);
394 // ---------------------------------------------------------------------
396 // ---------------------------------------------------------------------
397 if ( ! (fJetFinder = new AliHLTJETConeFinder()) ) {
398 HLTError("Error instantiating jet finder");
402 fJetFinder->SetJetHeader(fJetHeader);
403 fJetFinder->SetJetReader(fJetReader);
404 fJetFinder->SetOutputJets(fJets);
406 // ---------------------------------------------------------------------
407 // -- Initialize Jet Finder
408 // ---------------------------------------------------------------------
409 if ( (fJetFinder->Initialize()) ) {
410 HLTError("Error initializing cone jet finder");
417 // #################################################################################
418 Int_t AliHLTJETConeJetComponent::DoDeinit() {
419 // see header file for class documentation
433 if ( fJetReaderHeader )
434 delete fJetReaderHeader;
435 fJetReaderHeader = NULL;
456 // #################################################################################
457 Int_t AliHLTJETConeJetComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/,
458 AliHLTComponentTriggerData& /*trigData*/ ) {
459 // see header file for class documentation
463 const TObject* iter = NULL;
467 if ( GetFirstInputObject(kAliHLTDataTypeSOR) && !iResult ) {
468 HLTInfo("On-line SOR Event");
471 // -- ADD MC Object -- On-line
472 // ------------------------------
473 for ( iter=GetFirstInputObject(kAliHLTDataTypeMCObject|kAliHLTDataOriginHLT);
474 iter != NULL && !iResult; iter=GetNextInputObject() ) {
476 // -- Set automatic MC usage, --> needed in off-line
477 fJetReaderHeader->SetUseMC(kTRUE);
479 // -- Set input event
480 fJetReader->SetInputEvent( NULL, NULL, const_cast<TObject*>(iter) );
482 // -- Fill grid with MC
483 if ( ! fJetReader->FillGridHLTMC() ) {
484 HLTError("Error filling grid.");
485 iResult = -EINPROGRESS;
490 if ( ! fJetFinder->ProcessHLTEvent() ) {
491 HLTError("Error processing cone event.");
492 iResult = -EINPROGRESS;
498 PushBack(fJets, kAliHLTDataTypeJet|kAliHLTDataOriginHLT, GetSpecification());
502 // -- ADD ESD Object -- Off-line
503 // -------------------------------
504 for ( iter=GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginOffline);
505 iter != NULL && !iResult; iter=GetNextInputObject() ) {
507 // -- Set automatic MC usage, --> needed in off-line
508 fJetReaderHeader->SetUseMC(kFALSE);
510 // -- Set input event
511 fJetReader->SetInputEvent( const_cast<TObject*>(iter), NULL, NULL );
513 // -- Fill grid with ESD
514 if ( ! fJetReader->FillGridESD() ) {
515 HLTError("Error filling grid.");
521 if ( ! fJetFinder->ProcessHLTEvent() ) {
522 HLTError("Error processing cone event.");
523 iResult = -EINPROGRESS;
529 PushBack(fJets, kAliHLTDataTypeJet|kAliHLTDataOriginHLT, GetSpecification());
533 // -- ADD ESD Object -- On-line
534 // ------------------------------
535 for ( iter=GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginHLT);
536 iter != NULL && !iResult; iter=GetNextInputObject() ) {
538 // -- Set automatic MC usage, --> needed in off-line
539 fJetReaderHeader->SetUseMC(kFALSE);
541 // -- Set input event
542 fJetReader->SetInputEvent( const_cast<TObject*>(iter), NULL, NULL );
544 // -- Fill grid with ESD
545 if ( ! fJetReader->FillGridESD() ) {
546 HLTError("Error filling grid.");
552 if ( ! fJetFinder->ProcessHLTEvent() ) {
553 HLTError("Error processing cone event.");
554 iResult = -EINPROGRESS;
560 PushBack(fJets, kAliHLTDataTypeJet|kAliHLTDataOriginHLT, GetSpecification());