]>
Commit | Line | Data |
---|---|---|
5b5bad1d | 1 | // $Id$ |
192fc3f4 | 2 | // |
f09b22c5 | 3 | // Calculation of rho from a collection of jets. |
4 | // If scale function is given the scaled rho will be exported | |
5 | // with the name as "fRhoName".apppend("_Scaled"). | |
192fc3f4 | 6 | // |
7 | // Authors: R.Reed, S.Aiola | |
8 | ||
5b5bad1d | 9 | #include "AliAnalysisTaskRho.h" |
10 | ||
020052e4 | 11 | #include <TClonesArray.h> |
c60e0a21 | 12 | #include <TMath.h> |
020052e4 | 13 | |
020052e4 | 14 | #include "AliAnalysisManager.h" |
020052e4 | 15 | #include "AliEmcalJet.h" |
297edd60 | 16 | #include "AliLog.h" |
17 | #include "AliRhoParameter.h" | |
020052e4 | 18 | |
020052e4 | 19 | ClassImp(AliAnalysisTaskRho) |
20 | ||
21 | //________________________________________________________________________ | |
22 | AliAnalysisTaskRho::AliAnalysisTaskRho() : | |
a487deae | 23 | AliAnalysisTaskRhoBase("AliAnalysisTaskRho"), |
24 | fNExclLeadJets(0) | |
020052e4 | 25 | { |
6a12db52 | 26 | // Constructor. |
020052e4 | 27 | } |
28 | ||
5d845887 | 29 | //________________________________________________________________________ |
30 | AliAnalysisTaskRho::AliAnalysisTaskRho(const char *name, Bool_t histo) : | |
a487deae | 31 | AliAnalysisTaskRhoBase(name, histo), |
32 | fNExclLeadJets(0) | |
5d845887 | 33 | { |
6a12db52 | 34 | // Constructor. |
5d845887 | 35 | } |
36 | ||
020052e4 | 37 | //________________________________________________________________________ |
a487deae | 38 | Bool_t AliAnalysisTaskRho::Run() |
020052e4 | 39 | { |
a487deae | 40 | // Run the analysis. |
020052e4 | 41 | |
a5621834 | 42 | fRho->SetVal(0); |
43 | if (fRhoScaled) | |
44 | fRhoScaled->SetVal(0); | |
45 | ||
e44e8726 | 46 | if (!fJets) |
a487deae | 47 | return kFALSE; |
020052e4 | 48 | |
f09b22c5 | 49 | const Int_t Njets = fJets->GetEntries(); |
020052e4 | 50 | |
f09b22c5 | 51 | Int_t maxJetIds[] = {-1, -1}; |
52 | Float_t maxJetPts[] = { 0, 0}; | |
c60e0a21 | 53 | |
c60e0a21 | 54 | if (fNExclLeadJets > 0) { |
f09b22c5 | 55 | for (Int_t ij = 0; ij < Njets; ++ij) { |
56 | AliEmcalJet *jet = static_cast<AliEmcalJet*>(fJets->At(ij)); | |
c60e0a21 | 57 | if (!jet) { |
f09b22c5 | 58 | AliError(Form("%s: Could not receive jet %d", GetName(), ij)); |
c60e0a21 | 59 | continue; |
60 | } | |
ed777bb8 | 61 | |
a487deae | 62 | if (!AcceptJet(jet)) |
ed777bb8 | 63 | continue; |
64 | ||
c60e0a21 | 65 | if (jet->Pt() > maxJetPts[0]) { |
66 | maxJetPts[1] = maxJetPts[0]; | |
5b5bad1d | 67 | maxJetIds[1] = maxJetIds[0]; |
c60e0a21 | 68 | maxJetPts[0] = jet->Pt(); |
69 | maxJetIds[0] = ij; | |
f09b22c5 | 70 | } else if (jet->Pt() > maxJetPts[1]) { |
c60e0a21 | 71 | maxJetPts[1] = jet->Pt(); |
72 | maxJetIds[1] = ij; | |
73 | } | |
74 | } | |
75 | if (fNExclLeadJets < 2) { | |
76 | maxJetIds[1] = -1; | |
a487deae | 77 | maxJetPts[1] = 0; |
c60e0a21 | 78 | } |
79 | } | |
80 | ||
81 | static Double_t rhovec[999]; | |
020052e4 | 82 | Int_t NjetAcc = 0; |
83 | ||
c60e0a21 | 84 | // push all jets within selected acceptance into stack |
020052e4 | 85 | for (Int_t iJets = 0; iJets < Njets; ++iJets) { |
f09b22c5 | 86 | |
c60e0a21 | 87 | // exlcuding lead jets |
88 | if (iJets == maxJetIds[0] || iJets == maxJetIds[1]) | |
89 | continue; | |
90 | ||
f09b22c5 | 91 | AliEmcalJet *jet = static_cast<AliEmcalJet*>(fJets->At(iJets)); |
ed777bb8 | 92 | if (!jet) { |
93 | AliError(Form("%s: Could not receive jet %d", GetName(), iJets)); | |
94 | continue; | |
95 | } | |
c60e0a21 | 96 | |
a487deae | 97 | if (!AcceptJet(jet)) |
020052e4 | 98 | continue; |
c60e0a21 | 99 | |
100 | rhovec[NjetAcc] = jet->Pt() / jet->Area(); | |
f09b22c5 | 101 | ++NjetAcc; |
020052e4 | 102 | } |
192fc3f4 | 103 | |
f09b22c5 | 104 | if (NjetAcc > 0) { |
020052e4 | 105 | //find median value |
a487deae | 106 | Double_t rho = TMath::Median(NjetAcc, rhovec); |
107 | fRho->SetVal(rho); | |
108 | ||
f09b22c5 | 109 | if (fRhoScaled) { |
a487deae | 110 | Double_t rhoScaled = rho * GetScaleFactor(fCent); |
f09b22c5 | 111 | fRhoScaled->SetVal(rhoScaled); |
112 | } | |
f09b22c5 | 113 | } |
020052e4 | 114 | |
a487deae | 115 | return kTRUE; |
116 | } |