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