1 |
|
---|
2 | /** \class JetPileUpSubtractor
|
---|
3 | *
|
---|
4 | * Subtract pile-up contribution from jets using the fastjet area method
|
---|
5 | *
|
---|
6 | * $Date: 2012-11-18 15:57:08 +0100 (Sun, 18 Nov 2012) $
|
---|
7 | * $Revision: 814 $
|
---|
8 | *
|
---|
9 | * \author M. Selvaggi - UCL, Louvain-la-Neuve
|
---|
10 | *
|
---|
11 | */
|
---|
12 |
|
---|
13 | #include "modules/JetPileUpSubtractor.h"
|
---|
14 |
|
---|
15 | #include "classes/DelphesClasses.h"
|
---|
16 | #include "classes/DelphesFactory.h"
|
---|
17 | #include "classes/DelphesFormula.h"
|
---|
18 |
|
---|
19 | #include "ExRootAnalysis/ExRootResult.h"
|
---|
20 | #include "ExRootAnalysis/ExRootFilter.h"
|
---|
21 | #include "ExRootAnalysis/ExRootClassifier.h"
|
---|
22 |
|
---|
23 | #include "TMath.h"
|
---|
24 | #include "TString.h"
|
---|
25 | #include "TFormula.h"
|
---|
26 | #include "TRandom3.h"
|
---|
27 | #include "TObjArray.h"
|
---|
28 | #include "TDatabasePDG.h"
|
---|
29 | #include "TLorentzVector.h"
|
---|
30 |
|
---|
31 | #include <algorithm>
|
---|
32 | #include <stdexcept>
|
---|
33 | #include <iostream>
|
---|
34 | #include <sstream>
|
---|
35 |
|
---|
36 | using namespace std;
|
---|
37 |
|
---|
38 | //------------------------------------------------------------------------------
|
---|
39 |
|
---|
40 | JetPileUpSubtractor::JetPileUpSubtractor() :
|
---|
41 | fItJetInputArray(0)
|
---|
42 | {
|
---|
43 |
|
---|
44 | }
|
---|
45 |
|
---|
46 | //------------------------------------------------------------------------------
|
---|
47 |
|
---|
48 | JetPileUpSubtractor::~JetPileUpSubtractor()
|
---|
49 | {
|
---|
50 |
|
---|
51 | }
|
---|
52 |
|
---|
53 | //------------------------------------------------------------------------------
|
---|
54 |
|
---|
55 | void JetPileUpSubtractor::Init()
|
---|
56 | {
|
---|
57 | fJetPTMin = GetDouble("JetPTMin", 20.0);
|
---|
58 |
|
---|
59 | // import input array(s)
|
---|
60 |
|
---|
61 | fJetInputArray = ImportArray(GetString("JetInputArray", "FastJetFinder/jets"));
|
---|
62 | fItJetInputArray = fJetInputArray->MakeIterator();
|
---|
63 |
|
---|
64 | fRhoInputArray = ImportArray(GetString("RhoInputArray", "Rho/rho"));
|
---|
65 |
|
---|
66 | // create output array(s)
|
---|
67 |
|
---|
68 | fOutputArray = ExportArray(GetString("OutputArray", "jets"));
|
---|
69 |
|
---|
70 | }
|
---|
71 |
|
---|
72 | //------------------------------------------------------------------------------
|
---|
73 |
|
---|
74 | void JetPileUpSubtractor::Finish()
|
---|
75 | {
|
---|
76 | if(fItJetInputArray) delete fItJetInputArray;
|
---|
77 | }
|
---|
78 |
|
---|
79 | //------------------------------------------------------------------------------
|
---|
80 |
|
---|
81 | void JetPileUpSubtractor::Process()
|
---|
82 | {
|
---|
83 | Candidate *candidate;
|
---|
84 | TLorentzVector momentum, area;
|
---|
85 | Double_t rho = 0.0;
|
---|
86 |
|
---|
87 | if(fRhoInputArray && fRhoInputArray->GetEntriesFast() > 0)
|
---|
88 | {
|
---|
89 | candidate = static_cast<Candidate*>(fRhoInputArray->At(0));
|
---|
90 | rho = candidate->Momentum.Pt();
|
---|
91 | }
|
---|
92 |
|
---|
93 | // loop over all input candidates
|
---|
94 | fItJetInputArray->Reset();
|
---|
95 | while((candidate = static_cast<Candidate*>(fItJetInputArray->Next())))
|
---|
96 | {
|
---|
97 | momentum = candidate->Momentum;
|
---|
98 | area = candidate->Area;
|
---|
99 |
|
---|
100 | // apply pile-up correction
|
---|
101 | if(momentum.Pt() <= rho * area.Pt()) continue;
|
---|
102 |
|
---|
103 | momentum -= rho * area;
|
---|
104 |
|
---|
105 | if(momentum.Pt() <= fJetPTMin) continue;
|
---|
106 |
|
---|
107 | candidate = static_cast<Candidate*>(candidate->Clone());
|
---|
108 | candidate->Momentum = momentum;
|
---|
109 |
|
---|
110 | fOutputArray->Add(candidate);
|
---|
111 | }
|
---|
112 | }
|
---|
113 |
|
---|
114 | //------------------------------------------------------------------------------
|
---|