]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/AliEmcalJetFinder.cxx
DiJet analysis updates (Marta)
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / AliEmcalJetFinder.cxx
CommitLineData
14ca6380 1// $Id$
2//
3// Standalone jet finder
4//
5// Authors: R.Haake
6
14ca6380 7#include "AliFJWrapper.h"
8#include "AliEmcalJet.h"
9#include "AliEmcalJetFinder.h"
10#include "AliLog.h"
11#include <vector>
12#include "TH1.h"
13
14//________________________________________________________________________
15AliEmcalJetFinder::AliEmcalJetFinder() :
16 TNamed("EmcalJetFinder","EmcalJetFinder"), fFastjetWrapper(0), fInputVectorIndex(0), fJetCount(0), fJetArray(), fGhostArea(0.005), fRadius(0.4), fJetAlgorithm(0), fTrackMaxEta(0.9), fJetMaxEta(0.5), fJetMinPt(0), fJetMinArea(0)
17{
18 // Constructor
19 fFastjetWrapper = new AliFJWrapper("FJWrapper", "FJWrapper");
20}
21
22//________________________________________________________________________
23AliEmcalJetFinder::AliEmcalJetFinder(const char* name) :
24 TNamed(name, name), fFastjetWrapper(0), fInputVectorIndex(0), fJetCount(0), fJetArray(), fGhostArea(0.005), fRadius(0.4), fJetAlgorithm(0), fTrackMaxEta(0.9), fJetMaxEta(0.5), fJetMinPt(0), fJetMinArea(0)
25{
26 // Constructor
27 fFastjetWrapper = new AliFJWrapper("FJWrapper", "FJWrapper");
28}
29
30//________________________________________________________________________
31AliEmcalJetFinder::~AliEmcalJetFinder()
32{
33 if(fFastjetWrapper)
34 delete fFastjetWrapper;
35}
36
37
38//________________________________________________________________________
39Bool_t AliEmcalJetFinder::FindJets()
40{
41 // Tidy up and check input
42 fJetArray.clear();
43 fJetCount = 0;
44 if(!fInputVectorIndex)
45 {
46 AliError("No input vectors added to jet finder!");
47 return kFALSE;
48 }
49
50 // Pass settings to fastjet
51 fFastjetWrapper->SetAreaType(fastjet::active_area_explicit_ghosts);
52 fFastjetWrapper->SetGhostArea(fGhostArea);
53 fFastjetWrapper->SetR(fRadius);
54 if(fJetAlgorithm == 0)
55 fFastjetWrapper->SetAlgorithm(fastjet::antikt_algorithm);
56 if(fJetAlgorithm == 1)
57 fFastjetWrapper->SetAlgorithm(fastjet::kt_algorithm);
58
59 fFastjetWrapper->SetMaxRap(fTrackMaxEta);
60
61 // Run jet finding
62 fFastjetWrapper->Run();
63
64 // Save the found jets as light-weight objects
65 std::vector<fastjet::PseudoJet> fastjets = fFastjetWrapper->GetInclusiveJets();
66 fJetArray.resize(fastjets.size());
67
68 for (UInt_t i=0; i<fastjets.size(); i++)
69 {
70 // Apply jet cuts
71 if (fastjets[i].perp()<fJetMinPt)
72 continue;
73 if (fFastjetWrapper->GetJetArea(i)<fJetMinArea)
74 continue;
75 if (TMath::Abs(fastjets[i].eta())>fJetMaxEta)
76 continue;
77
78 AliEmcalJet* jet = new AliEmcalJet(fastjets[i].perp(), fastjets[i].eta(), fastjets[i].phi(), fastjets[i].m());
79
80 // Set the most important properties of the jet
81 Int_t nConstituents(fFastjetWrapper->GetJetConstituents(i).size());
82 jet->SetNumberOfTracks(nConstituents);
83 jet->SetNumberOfClusters(nConstituents);
84 fJetArray[fJetCount] = jet;
85 fJetCount++;
86 }
87
88 fJetArray.resize(fJetCount);
89
90 fFastjetWrapper->Clear();
91 fInputVectorIndex = 0;
92 return kTRUE;
93}
94
95//________________________________________________________________________
96void AliEmcalJetFinder::AddInputVector(Double_t px, Double_t py, Double_t pz)
97{
98 fFastjetWrapper->AddInputVector(px, py, pz, TMath::Sqrt(px*px + py*py + pz*pz), fInputVectorIndex + 100);
99 fInputVectorIndex++;
100}
101
102//________________________________________________________________________
103void AliEmcalJetFinder::FillPtHistogram(TH1* histogram)
104{
105 if(!histogram)
106 return;
107 for (Int_t i=0; i<fJetArray.size(); i++)
108 {
109 histogram->Fill(fJetArray[i]->Pt());
110 }
111}
112
113//________________________________________________________________________
114void AliEmcalJetFinder::FillPhiHistogram(TH1* histogram)
115{
116 if(!histogram)
117 return;
118 for (Int_t i=0; i<fJetArray.size(); i++)
119 {
120 histogram->Fill(fJetArray[i]->Phi());
121 }
122}
123
124//________________________________________________________________________
125void AliEmcalJetFinder::FillEtaHistogram(TH1* histogram)
126{
127 if(!histogram)
128 return;
129 for (Int_t i=0; i<fJetArray.size(); i++)
130 {
131 histogram->Fill(fJetArray[i]->Eta());
132 }
133}