]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/util/AliHLTJets.cxx
attaching file writer to the StreamerInfo component
[u/mrichter/AliRoot.git] / HLT / BASE / util / AliHLTJets.cxx
CommitLineData
7aac8168 1//-*- Mode: C++ -*-
2// $Id: AliHLTJets.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 AliHLTJets.h
20 @author Jochen Thaeder
21 @date
22 @brief Container holding produced Jets
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#if __GNUC__>= 3
32 using namespace std;
33#endif
34
35#include "TLorentzVector.h"
36
37#include "AliHLTJets.h"
38
39/** ROOT macro for the implementation of ROOT specific class methods */
40ClassImp(AliHLTJets)
41
42/*
43 * ---------------------------------------------------------------------------------
44 * Constructor / Destructor
45 * ---------------------------------------------------------------------------------
46 */
47
48//##################################################################################
49AliHLTJets::AliHLTJets() :
50 fComment(""),
51 fCurrentJetIndex(-1),
52 fNAODJets(0),
53 fAODJets(new TClonesArray( "AliAODJet", 50 )) {
54 // see header file for class documentation
55 // or
56 // refer to README to build package
57 // or
58 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
59
60}
61
62//##################################################################################
63AliHLTJets::~AliHLTJets() {
64 // see header file for class documentation
65
66 if ( fAODJets ){
67 fAODJets->Clear();
68 delete fAODJets;
69 }
70 fAODJets = NULL;
71}
72
73/*
74 * ---------------------------------------------------------------------------------
75 * Initialize / Reset
76 * ---------------------------------------------------------------------------------
77 */
78
79//##################################################################################
80void AliHLTJets::Reset() {
81 // see header file for class documentation
82
83 fAODJets->Clear();
84 fNAODJets = 0;
85
86 return;
87}
88
89// #################################################################################
90void AliHLTJets::ResetEvent() {
91 // see header file for class documentation
92
93 fCurrentJetIndex = -1;
94
95 return;
96}
97
98/*
99 * ---------------------------------------------------------------------------------
100 * Getter
101 * ---------------------------------------------------------------------------------
102 */
103
104//##################################################################################
105AliAODJet* AliHLTJets::GetJet( Int_t iter ) const {
106 // see header file for class documentation
107
108 if ( iter > fNAODJets )
109 return NULL;
110 else
111 return reinterpret_cast<AliAODJet*>((*fAODJets)[iter]);
112}
113
114//##################################################################################
115AliAODJet* AliHLTJets::NextJet() {
116 // see header file for class documentation
117
118 fCurrentJetIndex++;
119 return GetJet( fCurrentJetIndex );
120}
121
122/*
123 * ---------------------------------------------------------------------------------
124 * Setter
125 * ---------------------------------------------------------------------------------
126 */
127
128//##################################################################################
129void AliHLTJets::AddJet( Float_t eta, Float_t phi, Float_t pt, Float_t et ) {
130 // see header file for class documentation
131
132 if ( pt == 0. ) {
133 HLTError("Jet Pt=0, eta=%f, phi=%f", eta, phi);
134 return;
135 }
136
137 // -- create TLorentzVector
138 TLorentzVector v;
139 v.SetPtEtaPhiE( pt, eta, phi, et );
140
141 // -- add AliAODJet
142 new ((*fAODJets)[fNAODJets]) AliAODJet(v);
143 fNAODJets++;
144
145 return;
146}
147
148//##################################################################################
149void AliHLTJets::AddJet( AliAODJet* jet ) {
150 // see header file for class documentation
151
152 if ( jet->Pt() == 0. ) {
153 HLTError("Jet Pt=0, eta=%f, phi=%f", jet->Eta(), jet->Phi());
154 return;
155 }
156
157 // -- create TLorentzVector
158 TLorentzVector v;
159 v.SetPtEtaPhiE( jet->Pt(), jet->Eta(), jet->Phi(), jet->E() );
160
161 // -- add AliAODJet
162 new ((*fAODJets)[fNAODJets]) AliAODJet(v);
163 fNAODJets++;
164
165 return;
166}
6ce099ba 167
168/*
169 * ---------------------------------------------------------------------------------
170 * Helper
171 * ---------------------------------------------------------------------------------
172 */
173
174/** Sort Jets with decreasing Et */
175void AliHLTJets::Sort() {
176 // see header file for class documentation
177
178 fAODJets->Sort();
179 ResetEvent();
180
181 return;
182}