]> git.uio.no Git - u/mrichter/AliRoot.git/blame - JETAN/AliLeading.cxx
SetInput call corrected for generated jets.
[u/mrichter/AliRoot.git] / JETAN / AliLeading.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// Class to find and store the leading particle in event and
18// store its correlation to associated particles
19// Author: jgcn@mda.cinvestav.mx
20//---------------------------------------------------------------------
21
22#include <Riostream.h>
23#include <TMath.h>
24#include <TClonesArray.h>
25#include <TLorentzVector.h>
26
27#include "AliLeading.h"
1d9fb3a1 28#include "AliJetReader.h"
29#include "AliJetReaderHeader.h"
99e5fe42 30
31ClassImp(AliLeading)
32
33////////////////////////////////////////////////////////////////////////
34
35AliLeading::AliLeading()
36{
37 //
38 // Constructor
39 //
0ea82296 40 fNassoc = 0;
99e5fe42 41 fLeading = new TLorentzVector(0.,0.,0.,0.);
0ea82296 42 fLow = -TMath::Pi()/2.0;
43 fnBin = 45;
44 fCorr = TArrayI(fnBin);
99e5fe42 45}
46
47////////////////////////////////////////////////////////////////////////
48
49AliLeading::~AliLeading()
50{
51 //
52 // Destructor
53 //
54 delete fLeading;
55}
56
57////////////////////////////////////////////////////////////////////////
58
59void AliLeading::FindLeading(AliJetReader *reader)
60
61{
62 //
63 // find leading particle in the array of lorentz vectors
64 // lvArray and fill the correlation histogram
65 //
1d9fb3a1 66
67
68 AliJetReaderHeader* header = reader->GetReaderHeader();
69
99e5fe42 70 TClonesArray* lvArray = reader->GetMomentumArray();
71 Int_t nIn = lvArray->GetEntries();
72 fNassoc = nIn-1;
73
74 if (fNassoc < 0) return;
75
76 // find max
77 Double_t ptMax = 0.0;
78 Int_t idxMax = -1;
1d9fb3a1 79 for (Int_t i = 0; i < nIn; i++){
80 TLorentzVector *lv = (TLorentzVector*) lvArray->At(i);
81 if (lv->Pt() > ptMax &&
82 lv->Eta() > header->GetFiducialEtaMin() &&
83 lv->Eta() < header->GetFiducialEtaMax())
84 {
85 ptMax = lv->Pt();
86 idxMax = i;
87 }
99e5fe42 88 }
1d9fb3a1 89
0ea82296 90 if (idxMax == -1) return;
91
99e5fe42 92 // fill correlation array
93 fLeading = (TLorentzVector*) lvArray->At(idxMax);
1d9fb3a1 94 for (Int_t i = 0; i < nIn; i++) {
95 if (i == idxMax) continue;
96 TLorentzVector *lv = (TLorentzVector*) lvArray->At(i);
97 Double_t dphi = fLeading->DeltaPhi(*lv);
98 if (dphi < fLow) dphi = 2.0 * TMath::Pi() + dphi;
99 // find bin and fill array
100
101 Int_t iBin = (Int_t) TMath::Floor((dphi - fLow)
102 *((Double_t) fnBin) / (2.0 * TMath::Pi()));
103 fCorr.AddAt(fCorr.At(iBin)+1,iBin);
99e5fe42 104 }
105}
106
107////////////////////////////////////////////////////////////////////////
108
109void AliLeading::Reset()
110
111{
112// Reset leding particle information
1d9fb3a1 113 fLeading->SetPxPyPzE(0., 0., 0., 0.);
99e5fe42 114 fNassoc=0;
115 fCorr.Reset();
116}
117
118////////////////////////////////////////////////////////////////////////
119
120void AliLeading::PrintLeading()
121
122{
123// Print leading particle information
124 if (fNassoc<0) {
125 cout << " No leading particle in this event" << endl;
126 return;
127 }
128 cout << " Leading particle: " << endl;
129 cout << " (px,py,pz,e) = (" << fLeading->Px() << ","
130 << fLeading->Py() << "," << fLeading->Pz() << ","
131 << fLeading->E() << ")" << endl;
132 cout << " (pt,eta,phi) = (" << fLeading->Pt() << ","
133 << fLeading->Eta() << "," << fLeading->Phi() << ")" << endl;
134 cout << " " << fNassoc << " associated particles." << endl;
135}