-
Notifications
You must be signed in to change notification settings - Fork 0
/
JetBin.cc
70 lines (62 loc) · 2.37 KB
/
JetBin.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//
// Class for jet bins
//
// first version: Hartmut Stadie 2010/05/10
// $Id: JetBin.cc,v 1.8 2012/02/06 22:29:37 kirschen Exp $
//
#include "JetBin.h"
#include "Jet.h"
#include "CorFactors.h"
void JetBin::addJet(float Et, float EmEt, float HadEt ,float OutEt, float E,
float eta,float phi, float phiphi, float etaeta,
float genPt, float dR, const CorFactors& corFactors)
{
//std::cout << "jet added for par eta bin:" << f_.parIndex() << std::endl;
sumMess_.pt += Et;
sumMess_.EMF += EmEt;
sumMess_.HadF += HadEt;
sumMess_.OutF += OutEt;
sumMess_.E += E;
sumMess_.eta += eta;
//sumMess_.phi += phi;
sumMess_.phiphi += phiphi;
sumMess_.etaeta += etaeta;
sumPt2_ += Et * Et;
sumGenPt_ += genPt;
sumGenPt2_ += genPt * genPt;
sumdR_ += dR;
sumL1_ += corFactors.getL1() * Et;
sumL2_ += corFactors.getL2() * Et;
sumL3_ += corFactors.getL3() * corFactors.getL2() * Et;
sumLres_ += corFactors.getLRes() * corFactors.getL3() * corFactors.getL2() * Et;
sumL4_ += corFactors.getL4() * corFactors.getLRes() * corFactors.getL3() * corFactors.getL2() * Et;
sumL5_ += corFactors.getL5() * corFactors.getL4() * corFactors.getLRes() * corFactors.getL3() * corFactors.getL2() * Et;
sumJPT_ += corFactors.getJPT() * Et;
sumJPTL2L3_ += corFactors.getJPTL2L3() * Et;
++njets_;
}
void JetBin::addJet(const Jet* jet) {
addJet(jet->pt(),jet->EmEt(),jet->HadEt(),jet->OutEt(),jet->E(),jet->eta(),
jet->phi(),jet->momentPhiPhi(), jet->momentEtaEta(), jet->genPt(),
jet->dR(), jet->corFactors());
}
Jet* JetBin::createJet() const {
if(! njets_) return 0;
float w = 1.0/njets_;
//std::cout << "Jet:" << sumMess_.pt*w << " , " << sumGenPt_ * w
// << ", " << sumL3_ * w << std::endl;
Jet* j = new Jet(sumMess_.pt*w, sumMess_.EMF*w, sumMess_.HadF*w,
sumMess_.OutF*w, sumMess_.E*w,
sumMess_.eta*w, sumMess_.phi*w, sumMess_.phiphi*w,
sumMess_.etaeta*w, Jet::unknown,
0,0,0,0,0,0, //PF-fractions not filled, yet...
sumGenPt_*w, sumdR_*w,
new CorFactors(sumL1_*w,sumL2_/sumMess_.pt,sumL3_/sumL2_,sumLres_/sumL3_,
sumL4_/sumLres_,sumL5_/sumL4_,sumJPT_/sumMess_.pt,
sumJPTL2L3_/sumMess_.pt),
*f_,errf_,*gf_);
float err = sqrt(w*sumPt2_ - j->pt() * j->pt() + w*sumGenPt2_ - j->genPt() * j->genPt());
j->setError(err);
//std::cout << j->pt() << ":" << j->error() << " ; " << err << '\n';
return j;
}