]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLTANALYSIS/JET/fastjet/AliHLTJETFastJetHeader.cxx
Split: HLT/JET -> HLTANALYSIS/JET
[u/mrichter/AliRoot.git] / HLTANALYSIS / JET / fastjet / AliHLTJETFastJetHeader.cxx
1 //-*- Mode: C++ -*-
2 // $Id: AliHLTJETFastJetHeader.cxx  $
3 /**************************************************************************
4  * This file is property of and copyright by the ALICE HLT Project        * 
5  * ALICE Experiment at CERN, All rights reserved.                         *
6  *                                                                        *
7  * Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
8  *                  for The ALICE HLT Project.                            *
9  *                                                                        *
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  **************************************************************************/
18
19 /** @file   AliHLTJETFastJetHeader.cxx
20     @author Jochen Thaeder
21     @date   
22     @brief  Header of the FastJet finder interface
23 */
24
25 // see header file for class documentation
26 // or
27 // refer to README to build package
28 // or
29 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt   
30
31 #include "AliHLTJETJetCuts.h"
32
33 #include "AliHLTJETReaderHeader.h"
34 #include "AliHLTJETFastJetHeader.h"
35
36 using namespace std;
37
38 /** ROOT macro for the implementation of ROOT specific class methods */
39 ClassImp(AliHLTJETFastJetHeader)
40
41 /*
42  * ---------------------------------------------------------------------------------
43  *                            Constructor / Destructor
44  * ---------------------------------------------------------------------------------
45  */
46   
47 // #################################################################################
48 AliHLTJETFastJetHeader::AliHLTJETFastJetHeader() 
49   :
50   AliJetHeader("AliHLTJETFastJetHeader"),
51   fAlgorithm(fastjet::kt_algorithm),
52   fStrategy(fastjet::Best),
53   fRecombScheme(fastjet::BIpt_scheme),
54   fGhostArea(0.05),
55   fActiveAreaRepeats(1),
56   fAreaType(fastjet::active_area), 
57   fPtMin(5.),
58   fJetDefinition(NULL),
59   fGhostedAreaSpec(NULL),
60   fAreaDefinition(NULL),
61   fRangeDefinition(NULL),
62   fReaderHeader(NULL) {
63   // see header file for class documentation
64   // or
65   // refer to README to build package
66   // or
67   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
68   
69   //  SetRapRange(rapmin, rapmax);
70 }
71
72 // #################################################################################
73 AliHLTJETFastJetHeader::~AliHLTJETFastJetHeader() {
74   // see header file for class documentation
75   
76   if ( fJetDefinition ) 
77     delete fJetDefinition;
78   fJetDefinition = NULL;
79
80   if ( fGhostedAreaSpec)
81     delete fGhostedAreaSpec;
82   fGhostedAreaSpec = NULL;
83
84   if ( fAreaDefinition )
85     delete fAreaDefinition;
86   fAreaDefinition = NULL;
87    
88   if ( fRangeDefinition )
89     delete fRangeDefinition;
90   fRangeDefinition = NULL;
91 }
92
93 /*
94  * ---------------------------------------------------------------------------------
95  *                                    Initialize
96  * ---------------------------------------------------------------------------------
97  */
98
99 // #################################################################################
100 Int_t AliHLTJETFastJetHeader::Initialize() {
101   // see header file for class documentation
102   
103   HLTInfo(" -= AliHLTJETFastJetHeader =- " );
104
105   Int_t iResult = 0;
106
107   AliHLTJETReaderHeader*  readerHeader = dynamic_cast<AliHLTJETReaderHeader*>(fReaderHeader);
108
109   if ( !fJetCuts ) {
110     HLTError("No HLT jet cuts set!");
111     return -1;
112   }
113   
114   // -- Set min pt
115   fPtMin = fJetCuts->GetMinEt();
116
117   // -- Set Algorithm
118   AliHLTJETBase::JetAlgorithmType_t GetJetAlgorithm();
119
120   if ( readerHeader->GetJetAlgorithm() == AliHLTJETBase::kKt )
121     fAlgorithm = fastjet::kt_algorithm;
122   else if ( readerHeader->GetJetAlgorithm() == AliHLTJETBase::kAntiKt )
123     fAlgorithm = fastjet::antikt_algorithm;
124   else {
125     HLTError("No algorithm found!");
126     return -1;
127   }
128
129   // -- Create an object that represents your choice of jet algorithm,
130   //    and the associated parameters
131   if ( fJetDefinition ) 
132     delete fJetDefinition;
133   fJetDefinition = new fastjet::JetDefinition(fAlgorithm, readerHeader->GetConeRadius(),
134                                               fRecombScheme, fStrategy);
135
136   // -- Create the object that holds info about ghosts
137   if ( fGhostedAreaSpec ) 
138     delete fGhostedAreaSpec;
139   fGhostedAreaSpec = new fastjet::GhostedAreaSpec(readerHeader->GetFiducialEtaMax(),
140                                                   fActiveAreaRepeats, fGhostArea);
141   
142   // -- Create area definition
143   if ( fAreaDefinition ) 
144     delete fAreaDefinition;
145   // xxx  fAreaDefinition = new fastjet::AreaDefinition(fAreaType, fGhostedAreaSpec);
146   fAreaDefinition = new fastjet::AreaDefinition(fAreaType, (*fGhostedAreaSpec) );
147   
148   // -- Set the rapididty, phi range within which to study the background 
149   if ( fRangeDefinition )
150     delete fRangeDefinition;
151   fRangeDefinition = new fastjet::RangeDefinition( readerHeader->GetFiducialEtaMin()+readerHeader->GetConeRadius(),
152                                                    readerHeader->GetFiducialEtaMax()-readerHeader->GetConeRadius(),
153                                                    readerHeader->GetFiducialPhiMin(),
154                                                    readerHeader->GetFiducialPhiMax() );
155
156   // -- Check initialization
157   if ( !fJetDefinition || !fGhostedAreaSpec || 
158        !fAreaDefinition || !fRangeDefinition ) {
159     HLTError("Initializing FastJet failed!");
160     iResult = kFALSE;
161   }
162
163   // -- Create comment
164   if ( !iResult ) {
165     fComment = "Running FastJet algorithm with the following setup.";
166     fComment+= "\n-Jet definition:\n  ";
167     fComment+= TString(fJetDefinition->description());
168     fComment+= ". \n-Area definition:\n  ";
169     fComment+= TString(fAreaDefinition->description());
170     fComment+= ". \n-Strategy adopted by FastJet:\n  ";
171   }
172   
173   return iResult;
174 }
175
176 /*
177  * ---------------------------------------------------------------------------------
178  *                                      Helper
179  * ---------------------------------------------------------------------------------
180  */
181
182 // #################################################################################
183 void AliHLTJETFastJetHeader::PrintParameters() const {
184   // see header file for class documentation
185
186   HLTInfo( "FastJet algorithm  parameters:" );
187   
188   HLTInfo( "-- Jet Definition --- " );
189 #if 0
190   HLTInfo( "R %f ",fRparam );
191   HLTInfo( "Jet Algorithm %s", fAlgorithm ); 
192   HLTInfo( "Strategy " << fStrategy );  
193   HLTInfo( "Recombination Scheme " << fRecombScheme ); 
194   
195   HLTInfo( "-- Ghosted Area Spec parameters --- " );
196   HLTInfo( "Ghost Eta Max " << fGhostEtaMax );
197   HLTInfo( "Ghost Area " << fGhostArea );
198   HLTInfo( "Active Area Repeats " << fActiveAreaRepeats );
199   
200   HLTInfo( "-- Area Definition parameters --- " );
201   HLTInfo( "Area Type " << fAreaType ); 
202   
203   HLTInfo( "-- Cluster Sequence Area parameters --- " );
204   HLTInfo( "pt min " << fPtMin ); 
205   
206   HLTInfo( "-- Range Definition parameters --- " );
207   HLTInfo( " bkg rapidity range from  " << fRapMin << " to " << fRapMax );
208   HLTInfo( " bkg phi range from " << fPhiMin << " to " << fPhiMax );
209 #endif
210 }