Fork me on GitHub

source: svn/trunk/modules/JetPileUpSubtractor.cc@ 1343

Last change on this file since 1343 was 1317, checked in by Pavel Demin, 11 years ago

fix loop in JetPileUpSubtractor and add rho eta ranges for Isolation

File size: 3.0 KB
RevLine 
[1009]1
2/** \class JetPileUpSubtractor
3 *
[1029]4 * Subtract pile-up contribution from jets using the fastjet area method
[1009]5 *
[1029]6 * $Date: 2012-11-18 15:57:08 +0100 (Sun, 18 Nov 2012) $
7 * $Revision: 814 $
[1009]8 *
[1029]9 * \author M. Selvaggi - UCL, Louvain-la-Neuve
[1009]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
[1029]31#include <algorithm>
[1009]32#include <stdexcept>
33#include <iostream>
34#include <sstream>
35
36using namespace std;
37
38//------------------------------------------------------------------------------
39
40JetPileUpSubtractor::JetPileUpSubtractor() :
[1315]41 fItJetInputArray(0), fItRhoInputArray(0)
[1009]42{
[1029]43
[1009]44}
45
46//------------------------------------------------------------------------------
47
48JetPileUpSubtractor::~JetPileUpSubtractor()
49{
[1029]50
[1009]51}
52
53//------------------------------------------------------------------------------
54
55void JetPileUpSubtractor::Init()
56{
57 fJetPTMin = GetDouble("JetPTMin", 20.0);
[1029]58
[1009]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"));
[1315]65 fItRhoInputArray = fRhoInputArray->MakeIterator();
[1009]66
67 // create output array(s)
68
69 fOutputArray = ExportArray(GetString("OutputArray", "jets"));
70
71}
72
73//------------------------------------------------------------------------------
74
75void JetPileUpSubtractor::Finish()
76{
[1315]77 if(fItRhoInputArray) delete fItRhoInputArray;
[1009]78 if(fItJetInputArray) delete fItJetInputArray;
79}
80
81//------------------------------------------------------------------------------
82
83void JetPileUpSubtractor::Process()
84{
[1317]85 Candidate *candidate, *object;
[1088]86 TLorentzVector momentum, area;
[1315]87 Double_t eta = 0.0;
[1088]88 Double_t rho = 0.0;
[1029]89
[1009]90 // loop over all input candidates
91 fItJetInputArray->Reset();
92 while((candidate = static_cast<Candidate*>(fItJetInputArray->Next())))
93 {
[1088]94 momentum = candidate->Momentum;
[1009]95 area = candidate->Area;
[1315]96 eta = TMath::Abs(momentum.Eta());
[1029]97
[1315]98 // find rho
99 rho = 0.0;
[1317]100 if(fRhoInputArray)
[1315]101 {
[1317]102 fItRhoInputArray->Reset();
103 while((object = static_cast<Candidate*>(fItRhoInputArray->Next())))
[1315]104 {
[1317]105 if(eta >= object->Edges[0] && eta < object->Edges[1])
106 {
107 rho = object->Momentum.Pt();
108 }
[1315]109 }
[1317]110 }
[1315]111
[1009]112 // apply pile-up correction
[1089]113 if(momentum.Pt() <= rho * area.Pt()) continue;
114
115 momentum -= rho * area;
[1317]116
[1088]117 if(momentum.Pt() <= fJetPTMin) continue;
[1029]118
[1009]119 candidate = static_cast<Candidate*>(candidate->Clone());
[1088]120 candidate->Momentum = momentum;
[1029]121
[1009]122 fOutputArray->Add(candidate);
[1029]123 }
[1009]124}
125
126//------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.