Adding rho's depenence on trigger track (M. Verweij)
[u/mrichter/AliRoot.git] / JETAN / AliPxconeJetFinder.cxx
CommitLineData
99e5fe42 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//---------------------------------------------------------------------
19// Pxcone Jet finder
20// manages the search for jets
21// Author: jgcn@mda.cinvestav.mx
22//---------------------------------------------------------------------
23
24#include <Riostream.h>
25#include <TLorentzVector.h>
83a444b1 26#include <TFile.h>
99e5fe42 27#include "AliPxconeJetFinder.h"
28#include "AliPxconeJetHeader.h"
29#include "AliJetReader.h"
99e5fe42 30
31ClassImp(AliPxconeJetFinder)
32
33////////////////////////////////////////////////////////////////////////
34
1b7d5d7e 35AliPxconeJetFinder::AliPxconeJetFinder():
36 fHeader(0)
99e5fe42 37{
38 //
39 // Constructor
40 //
99e5fe42 41}
42
43////////////////////////////////////////////////////////////////////////
44
45AliPxconeJetFinder::~AliPxconeJetFinder()
46
47{
48 //
49 // destructor
50 //
51
52 // reset and delete header
53}
54
55////////////////////////////////////////////////////////////////////////
56
57#ifndef WIN32
58# define pxcone pxcone_
59# define type_of_call
60
61#else
62# define pxcone PXCONE
63# define type_of_call _stdcall
64#endif
65
66extern "C" void type_of_call
67pxcone_(int* mode, int* ntrak, int* dim, double* ptrak,
68 double* coner, double* epslon, double* ovlim,
69 int * maxjet, int* njet, double* pjet, int* ipass,
70 int* ijmul, int* ierr);
71
72void AliPxconeJetFinder::FindJets()
73
74{
75 // get number of entries
76 // Int_t ne=fReader->GetNEvents();
77 // loops over entries (check user request for number of events)
78 // (this info should be stored in reader-header)
79
80 // test with one event
81 TClonesArray *lvArray = fReader->GetMomentumArray();
82 Int_t nIn = lvArray->GetEntries();
83
84 // local arrays for input
85 const Int_t kNmaxVec = 30000;
86 if (nIn > kNmaxVec) {
87 cout << " AliPxconeJetFinder::FindJets: Too many input vectors."
88 << endl;
89 cout << " Using only the first " << kNmaxVec << endl;
90 nIn = kNmaxVec;
91 }
92
93 Double_t pIn[kNmaxVec][4];
94 Double_t pJet[kNmaxVec][5];
95 int ipass[kNmaxVec];
96 int ijmul[kNmaxVec];
97 Int_t ierr;
98
99 // load input vectors
100 for (Int_t i=0; i<nIn;i++){
101 TLorentzVector *lv = (TLorentzVector*) lvArray->At(i);
102 pIn[i][0]= lv->Px();
103 pIn[i][1]= lv->Py();
104 pIn[i][2]= lv->Pz();
105 pIn[i][3]= lv->E();
106 }
107 fJets->SetNinput(nIn);
108
109 // run the algorithm. Get parameters from header
110 Int_t dim=4;
111 Int_t mode=fHeader->GetMode();
112 Double_t radius=fHeader->GetRadius();
113 Double_t minpt=fHeader->GetMinPt();
114 Double_t ov=fHeader->GetOverlap();
115 Int_t nj;
116 pxcone(&mode,&nIn,&dim,&pIn[0][0],&radius,&minpt,&ov,&nIn,&nj,
117 &pJet[0][0],&ipass[0],&ijmul[0],&ierr);
118
119 // download jets
120 fJets->SetInJet(ipass);
121 for(Int_t i=0; i<nj; i++)
122 fJets->AddJet(pJet[i][0],pJet[i][1],
123 pJet[i][2],pJet[i][3]);
124 fJets->SetMultiplicities(ijmul);
125}
126
127////////////////////////////////////////////////////////////////////////
128
446dbc09 129void AliPxconeJetFinder::WriteJHeaderToFile() const
99e5fe42 130{
131// Write Header to file
132
133 fOut->cd();
134 fHeader->Write();
135}
136
137////////////////////////////////////////////////////////////////////////
138
139void AliPxconeJetFinder::Reset()
140{
141// Reset jet list
142 fJets->ClearJets();
143}
144