]> git.uio.no Git - u/mrichter/AliRoot.git/blame - JETAN/AliSISConeJetFinder.cxx
Reference to tracks forming the jet added.
[u/mrichter/AliRoot.git] / JETAN / AliSISConeJetFinder.cxx
CommitLineData
2551af9d 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16
17//---------------------------------------------------------------------
18// SISCone (FastJet v2.3.4) finder algorithm interface
19//
20// Author: swensy.jangal@ires.in2p3.fr
21//
22//---------------------------------------------------------------------
23
24#include <Riostream.h>
25#include <TArrayF.h>
26#include <TClonesArray.h>
27#include <TFile.h>
28#include <TH1F.h>
29#include <TH2F.h>
30#include <TLorentzVector.h>
31#include <TRandom.h>
32
33#include "AliHeader.h"
34#include "AliJet.h"
35#include "AliJetKineReader.h"
36#include "AliJetReader.h"
37#include "AliJetReaderHeader.h"
38#include "AliSISConeJetFinder.h"
39#include "AliSISConeJetHeader.h"
40
41#include "fastjet/AreaDefinition.hh"
42#include "fastjet/ClusterSequenceArea.hh"
43#include "fastjet/JetDefinition.hh"
44#include "fastjet/PseudoJet.hh"
45
46// Get info on how fastjet was configured
47#include "fastjet/config.h"
48
49#ifdef ENABLE_PLUGIN_SISCONE
50#include "fastjet/SISConePlugin.hh"
51#endif
52
53#include<sstream> // Needed for internal io
54#include<vector>
55#include <cmath>
56
57using namespace std;
58
59ClassImp(AliSISConeJetFinder)
60
61//____________________________________________________________________________
62
63AliSISConeJetFinder::AliSISConeJetFinder():
64AliJetFinder()
65{
66 // Constructor
67}
68
69//____________________________________________________________________________
70
71AliSISConeJetFinder::~AliSISConeJetFinder()
72{
73 // destructor
74}
75
76//______________________________________________________________________________
77void AliSISConeJetFinder::FindJets()
78{
79
80 Bool_t debug = kFALSE;
81
82 // Pick up siscone header
83 AliSISConeJetHeader *header = (AliSISConeJetHeader*)fHeader;
84
85 // Check if we are reading AOD jets
86 TRefArray *refs = 0;
87 Bool_t fromAod = !strcmp(fReader->ClassName(),"AliJetAODReader");
88 if (fromAod) { refs = fReader->GetReferences(); }
89
90
91//******************************** SISCONE PLUGIN CONFIGURATION
92// Here we look for SISCone parameters in the header and we define our plugin.
93
94 Double_t coneRadius = header->GetConeRadius(); // cone radius
95 Double_t overlapThreshold = header->GetOverlapThreshold(); // overlap parameter
96 Int_t nPassMax = header->GetNPassMax(); // maximum number of passes
97 Double_t ptProtoJetMin = header->GetPtProtojetMin(); // pT min of protojets
98 Double_t caching = header->GetCaching(); // do we record found cones for this set of data?
99
100 if (header->GetSplitMergeScale() == 0) fastjet::SISConePlugin::SplitMergeScale splitMergeScale = fastjet::SISConePlugin::SM_pttilde; // There's only one split merge scale
101
102 fastjet::JetDefinition::Plugin * plugin;
103 plugin = new fastjet::SISConePlugin(coneRadius, overlapThreshold, nPassMax, ptProtoJetMin, caching);
104
105//******************************** READING OF INPUT PARTICLES
106// Here we look for px, py pz and energy of each particle that we gather in a PseudoJet object, and we put all these PseudoJet in a vector of PseudoJets : input_particles.
107
108 TClonesArray *lvArray = fReader->GetMomentumArray();
109 Int_t nIn = lvArray->GetEntries();
110
111 // We check if lvArray is ok
112 if(lvArray == 0)
113 {
114 cout << "Could not get the momentum array" << endl;
115 return;
116 }
117
118 if(nIn == 0)// nIn = Number of particles in the event
119 {
120 if (debug) cout << "entries = 0 ; Event empty !!!" << endl ;
121 return;
122 }
123
124 Int_t nJets = 0; // Number of jets in this event
125 fJets->SetNinput(nIn) ; // fJets = AliJet number of input objects
126 Float_t px,py,pz,en;
127 vector<fastjet::PseudoJet> inputParticles;
128
129 // Load input vectors
130 for(Int_t i = 0; i < nIn; i++)
131 {
132 TLorentzVector *lv = (TLorentzVector*) lvArray->At(i);
133 px = lv->Px();
134 py = lv->Py();
135 pz = lv->Pz();
136 en = lv->Energy();
137
138 fastjet::PseudoJet inputPart(px,py,pz,en);
139 inputPart.set_user_index(i);
140 inputParticles.push_back(inputPart);
141
142 }
143
144//******************************** JETS FINDING
145
146 fastjet::ClusterSequence clustSeq(inputParticles, plugin);
147
148//***************************** JETS EXTRACTION AND CORRECTION
149
150 // Here we extract inclusive jets with pt > ptmin, sorted by pt
151 Double_t ptMin = header->GetMinJetPt();
152 vector<fastjet::PseudoJet> inclusiveJets = clustSeq.inclusive_jets(ptMin);
153 vector<fastjet::PseudoJet> jets = sorted_by_pt(inclusiveJets);
154
155 for (Int_t j = 0; j < jets.size(); j++)
156 {
157 cout<<"********************************** Reconstructed jet(s) (non corrected)"<<endl;
158 cout<<"Jet number "<<j+1<<" : "<<"Rapidity : "<<jets[j].rap()<<" Phi : "<<jets[j].phi()<<" pT : "<<jets[j].perp()<<endl;
159 cout<<"px = "<<jets[j].px()<<endl;
160 cout<<"py = "<<jets[j].py()<<endl;
161 cout<<"pz = "<<jets[j].pz()<<endl;
162 cout<<"e = "<<jets[j].E()<<endl;
163 cout<<"******************"<<endl;
164 cout<<"******************"<<endl;
165 cout<<"******************"<<endl;
166
167 // Go to write AOD info
168 AliAODJet aodjet (jets[j].px(), jets[j].py(), jets[j].pz(), jets[j].E());
169 if(debug) aodjet.Print("");
170 AddJet(aodjet);
171 }
172}
173
174//____________________________________________________________________________
175
176void AliSISConeJetFinder::WriteJHeaderToFile()
177{
178 fHeader->Write();
179}