-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRooTransverseThrustVar.cxx
90 lines (72 loc) · 3.11 KB
/
RooTransverseThrustVar.cxx
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*****************************************************************************
* Project: RooFit *
* Package: RooFitCore *
* @(#)root/roofitcore:$Id: RooEffProd.cxx 25184 2008-08-20 13:59:55Z wouter $
* Authors: *
* WV, Wouter Verkerke, NIKHEF
* GR, Gerhard Raven, NIKHEF/VU *
* *
* Redistribution and use in source and binary forms, *
* with or without modification, are permitted according to the terms *
* listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
*****************************************************************************/
/////////////////////////////////////////////////////////////////////////////////////
// BEGIN_HTML
// The class RooTransverseThrustVar implements the product of a PDF with an efficiency function.
// The normalization integral of the product is calculated numerically, but the
// event generation is handled by a specialized generator context that implements
// the event generation in a more efficient for cases where the PDF has an internal
// generator that is smarter than accept reject.
// END_HTML
//
#include "RooFit.h"
#include "RooTransverseThrustVar.h"
#include <cmath>
ClassImp(RooTransverseThrustVar)
;
//_____________________________________________________________________________
RooTransverseThrustVar::RooTransverseThrustVar(const char *name, const char *title,
RooAbsReal& phi,
vector<double> jetPx, vector<double> jetPy):
RooAbsReal(name,title),
_phi("phi","phi",this,phi),
_jetPx(jetPx),
_jetPy(jetPy)
{
unsigned int njets= _jetPy.size();
for (unsigned int i = 0; i<njets; i++) {
_jetPt.push_back(sqrt(_jetPx[i]*_jetPx[i] + _jetPy[i]*_jetPy[i]));
}
}
//_____________________________________________________________________________
RooTransverseThrustVar::RooTransverseThrustVar(const RooTransverseThrustVar& other, const char* name) :
RooAbsReal(other, name),
_phi("phi",this,other._phi),
_jetPx(other._jetPx),
_jetPy(other._jetPy),
_jetPt(other._jetPt)
{
// Copy constructor
}
//_____________________________________________________________________________
RooTransverseThrustVar::~RooTransverseThrustVar()
{
// Destructor
}
//_____________________________________________________________________________
Double_t RooTransverseThrustVar::evaluate() const
{
double thrust = 0;
double sumMomentum = 0;
double nx = cos(_phi);
double ny = sin(_phi);
unsigned int njets= _jetPt.size();
if(_jetPt.size() != _jetPx.size()) cout << "pT and pX do not match" << endl;
if(_jetPt.size() != _jetPy.size()) cout << "pT and pY do not match" << endl;
if(_jetPy.size() != _jetPx.size()) cout << "pX and pY do not match" << endl;
for (unsigned int i = 0; i<njets; i++) {
sumMomentum += _jetPt[i];
thrust -= abs(nx*_jetPx[i] + ny*_jetPy[i]);
}
return thrust/sumMomentum;
}