]> git.uio.no Git - u/mrichter/AliRoot.git/blame - JETAN/AliLeading.cxx
Modifications needed to do the following:
[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{
99e5fe42 37 // Constructor
0ea82296 38 fNassoc = 0;
99e5fe42 39 fLeading = new TLorentzVector(0.,0.,0.,0.);
0ea82296 40 fLow = -TMath::Pi()/2.0;
41 fnBin = 45;
42 fCorr = TArrayI(fnBin);
bb828f00 43 fFound = kFALSE;
99e5fe42 44}
45
46////////////////////////////////////////////////////////////////////////
47
48AliLeading::~AliLeading()
49{
99e5fe42 50 // Destructor
99e5fe42 51 delete fLeading;
52}
53
54////////////////////////////////////////////////////////////////////////
55
56void AliLeading::FindLeading(AliJetReader *reader)
99e5fe42 57{
99e5fe42 58 // find leading particle in the array of lorentz vectors
59 // lvArray and fill the correlation histogram
83a444b1 60
1d9fb3a1 61 AliJetReaderHeader* header = reader->GetReaderHeader();
83a444b1 62
99e5fe42 63 TClonesArray* lvArray = reader->GetMomentumArray();
64 Int_t nIn = lvArray->GetEntries();
83a444b1 65
99e5fe42 66 // find max
67 Double_t ptMax = 0.0;
68 Int_t idxMax = -1;
1d9fb3a1 69 for (Int_t i = 0; i < nIn; i++){
83a444b1 70 TLorentzVector *lv = (TLorentzVector*) lvArray->At(i);
71 if ((reader->GetCutFlag(i) == 1) &&
72 lv->Pt() > ptMax &&
73 lv->Eta() > header->GetFiducialEtaMin() &&
74 lv->Eta() < header->GetFiducialEtaMax()){
75 ptMax = lv->Pt();
76 idxMax = i;
77 }
99e5fe42 78 }
1d9fb3a1 79
bb828f00 80 if (idxMax == -1) {
83a444b1 81 fFound = kFALSE;
82 Reset();
83 return;
bb828f00 84 }
0ea82296 85
99e5fe42 86 // fill correlation array
87 fLeading = (TLorentzVector*) lvArray->At(idxMax);
bb828f00 88 fFound = kTRUE;
89
83a444b1 90 fNassoc = 0;
1d9fb3a1 91 for (Int_t i = 0; i < nIn; i++) {
83a444b1 92 if (i == idxMax) continue;
93 TLorentzVector *lv = (TLorentzVector*) lvArray->At(i);
94 if ( (reader->GetCutFlag(i) == 1) &&
95 lv->Eta() > header->GetFiducialEtaMin() &&
96 lv->Eta() < header->GetFiducialEtaMax()) {
1d9fb3a1 97 Double_t dphi = fLeading->DeltaPhi(*lv);
98 if (dphi < fLow) dphi = 2.0 * TMath::Pi() + dphi;
99 // find bin and fill array
bb828f00 100 Int_t iBin = (Int_t)
83a444b1 101 TMath::Floor((dphi - fLow)
102 *((Double_t) fnBin) / (2.0 * TMath::Pi()));
1d9fb3a1 103 fCorr.AddAt(fCorr.At(iBin)+1,iBin);
83a444b1 104 fNassoc++;
105 }
99e5fe42 106 }
107}
108
109////////////////////////////////////////////////////////////////////////
110
111void AliLeading::Reset()
112
113{
bb828f00 114// Reset leading particle information
1d9fb3a1 115 fLeading->SetPxPyPzE(0., 0., 0., 0.);
99e5fe42 116 fNassoc=0;
117 fCorr.Reset();
118}
119
120////////////////////////////////////////////////////////////////////////
121
122void AliLeading::PrintLeading()
99e5fe42 123{
124// Print leading particle information
125 if (fNassoc<0) {
126 cout << " No leading particle in this event" << endl;
127 return;
128 }
129 cout << " Leading particle: " << endl;
130 cout << " (px,py,pz,e) = (" << fLeading->Px() << ","
131 << fLeading->Py() << "," << fLeading->Pz() << ","
132 << fLeading->E() << ")" << endl;
133 cout << " (pt,eta,phi) = (" << fLeading->Pt() << ","
134 << fLeading->Eta() << "," << fLeading->Phi() << ")" << endl;
135 cout << " " << fNassoc << " associated particles." << endl;
136}
83a444b1 137
138////////////////////////////////////////////////////////////////////////
139
140Double_t AliLeading::GetE()
141{
142 return fLeading->E();
143}
144
145////////////////////////////////////////////////////////////////////////
146
147Double_t AliLeading::GetPt()
148{
149 return fLeading->Pt();
150}
151
152////////////////////////////////////////////////////////////////////////
153
154Double_t AliLeading::GetEta()
155{
156 return fLeading->Eta();
157}
158
159////////////////////////////////////////////////////////////////////////
160
161Double_t AliLeading::GetPhi()
162{
163 // get phi of leading
164 return ( (fLeading->Phi() < 0) ?
165 (fLeading->Phi()) + 2. * TMath::Pi() :
166 fLeading->Phi());
167}
168