Fork me on GitHub

source: git/modules/JetPileUpSubtractor.cc@ f229d8a

ImprovedOutputFile Timing dual_readout llp
Last change on this file since f229d8a was d7d2da3, checked in by pavel <pavel@…>, 12 years ago

move branches/ModularDelphes to trunk

  • Property mode set to 100644
File size: 2.6 KB
Line 
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
36using namespace std;
37
38//------------------------------------------------------------------------------
39
40JetPileUpSubtractor::JetPileUpSubtractor() :
41 fItJetInputArray(0)
42{
43
44}
45
46//------------------------------------------------------------------------------
47
48JetPileUpSubtractor::~JetPileUpSubtractor()
49{
50
51}
52
53//------------------------------------------------------------------------------
54
55void 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
74void JetPileUpSubtractor::Finish()
75{
76 if(fItJetInputArray) delete fItJetInputArray;
77}
78
79//------------------------------------------------------------------------------
80
81void 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//------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.