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