3 // Standalone jet finder
4 // CINT-compatible wrapper for AliFJWrapper, can be used in macros and from the ROOT command line.
5 // Compiled code can use AliFJWrapper directly
9 #include "AliFJWrapper.h"
10 #include "AliEmcalJet.h"
11 #include "AliEmcalJetFinder.h"
16 //________________________________________________________________________
17 AliEmcalJetFinder::AliEmcalJetFinder() :
18 TNamed("EmcalJetFinder","EmcalJetFinder"), fFastjetWrapper(0), fInputVectorIndex(0), fJetCount(0), fJetArray(), fGhostArea(0.005), fRadius(0.4), fJetAlgorithm(0), fRecombScheme(-1), fTrackMaxEta(0.9), fJetMaxEta(0.5), fJetMinPt(0), fJetMinArea(0)
21 fFastjetWrapper = new AliFJWrapper("FJWrapper", "FJWrapper");
24 //________________________________________________________________________
25 AliEmcalJetFinder::AliEmcalJetFinder(const char* name) :
26 TNamed(name, name), fFastjetWrapper(0), fInputVectorIndex(0), fJetCount(0), fJetArray(), fGhostArea(0.005), fRadius(0.4), fJetAlgorithm(0), fRecombScheme(-1), fTrackMaxEta(0.9), fJetMaxEta(0.5), fJetMinPt(0), fJetMinArea(0)
29 fFastjetWrapper = new AliFJWrapper("FJWrapper", "FJWrapper");
32 //________________________________________________________________________
33 AliEmcalJetFinder::~AliEmcalJetFinder()
36 delete fFastjetWrapper;
40 //________________________________________________________________________
41 Bool_t AliEmcalJetFinder::FindJets()
43 // Tidy up and check input
44 for (UInt_t i=0; i<fJetArray.size(); i++) {
50 if(!fInputVectorIndex)
52 AliError("No input vectors added to jet finder!");
56 // Pass settings to fastjet
57 fFastjetWrapper->SetAreaType(fastjet::active_area_explicit_ghosts);
58 fFastjetWrapper->SetGhostArea(fGhostArea);
59 fFastjetWrapper->SetR(fRadius);
60 if(fJetAlgorithm == 0)
61 fFastjetWrapper->SetAlgorithm(fastjet::antikt_algorithm);
62 if(fJetAlgorithm == 1)
63 fFastjetWrapper->SetAlgorithm(fastjet::kt_algorithm);
65 fFastjetWrapper->SetRecombScheme(static_cast<fastjet::RecombinationScheme>(fRecombScheme));
67 fFastjetWrapper->SetMaxRap(fTrackMaxEta);
70 fFastjetWrapper->Run();
72 // Save the found jets as light-weight objects
73 std::vector<fastjet::PseudoJet> fastjets = fFastjetWrapper->GetInclusiveJets();
74 fJetArray.resize(fastjets.size());
76 for (UInt_t i=0; i<fastjets.size(); i++)
79 if (fastjets[i].perp()<fJetMinPt)
81 if (fFastjetWrapper->GetJetArea(i)<fJetMinArea)
83 if (TMath::Abs(fastjets[i].eta())>fJetMaxEta)
86 AliEmcalJet* jet = new AliEmcalJet(fastjets[i].perp(), fastjets[i].eta(), fastjets[i].phi(), fastjets[i].m());
88 // Set the most important properties of the jet
89 Int_t nConstituents(fFastjetWrapper->GetJetConstituents(i).size());
90 jet->SetNumberOfTracks(nConstituents);
91 jet->SetNumberOfClusters(nConstituents);
92 fJetArray[fJetCount] = jet;
96 fJetArray.resize(fJetCount);
98 //fastjets.clear(); // will be done by the destructor at the end of the function
99 fFastjetWrapper->Clear();
100 fInputVectorIndex = 0;
104 //________________________________________________________________________
105 void AliEmcalJetFinder::AddInputVector(Double_t px, Double_t py, Double_t pz)
107 fFastjetWrapper->AddInputVector(px, py, pz, TMath::Sqrt(px*px + py*py + pz*pz), fInputVectorIndex + 100);
111 //________________________________________________________________________
112 void AliEmcalJetFinder::AddInputVector(Double_t px, Double_t py, Double_t pz, Double_t E)
114 fFastjetWrapper->AddInputVector(px, py, pz, E, fInputVectorIndex + 100);
118 //________________________________________________________________________
119 void AliEmcalJetFinder::FillPtHistogram(TH1* histogram)
123 for (std::size_t i=0; i<fJetArray.size(); i++)
125 histogram->Fill(fJetArray[i]->Pt());
129 //________________________________________________________________________
130 void AliEmcalJetFinder::FillPhiHistogram(TH1* histogram)
134 for (std::size_t i=0; i<fJetArray.size(); i++)
136 histogram->Fill(fJetArray[i]->Phi());
140 //________________________________________________________________________
141 void AliEmcalJetFinder::FillEtaHistogram(TH1* histogram)
145 for (std::size_t i=0; i<fJetArray.size(); i++)
147 histogram->Fill(fJetArray[i]->Eta());