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