CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TPN.cc
Go to the documentation of this file.
1 /*
2  * \class TPN
3  *
4  * \author: Julie Malcles - CEA/Saclay
5  */
6 
10 #include <TMath.h>
11 
12 using namespace std;
13 
14 //ClassImp(TPN)
15 
16 // Default Constructor...
17 TPN::TPN(int iPN) {
18  init();
19  _nPN = iPN;
20 }
21 
22 // Destructor
24 
25 void TPN::init() {
26  for (int j = 0; j < nOutVar; j++) {
27  cuts[0][j] = 0.0;
28  cuts[1][j] = 10.0e9;
29  mom[j] = new TMom();
30  }
31 }
32 
33 void TPN::addEntry(double pn, double pn0, double pn1) {
34  double val[nOutVar];
35 
36  if (_nPN == 0)
37  val[iPN] = pn0;
38  else
39  val[iPN] = pn1;
40 
41  if (pn != 0)
42  val[iPNoPN] = val[iPN] / pn;
43  else
44  val[iPNoPN] = 0;
45 
46  if (pn0 != 0)
47  val[iPNoPN0] = val[iPN] / pn0;
48  else
49  val[iPNoPN0] = 0;
50 
51  if (pn1 != 0)
52  val[iPNoPN1] = val[iPN] / pn1;
53  else
54  val[iPNoPN1] = 0;
55 
56  for (int ivar = 0; ivar < nOutVar; ivar++) {
57  mom[ivar]->addEntry(val[ivar]);
58  }
59 }
60 
61 void TPN::setCut(int ivar, double mean, double sig) {
62  cuts[0][ivar] = mean - 2.0 * sig;
63  cuts[1][ivar] = mean + 2.0 * sig;
64  if (cuts[0][ivar] < 0)
65  cuts[0][ivar] = 0.0;
66 
67  mom[ivar]->setCut(cuts[0][ivar], cuts[1][ivar]);
68 }
69 
70 void TPN::setPNCut(double mean, double sig) { setCut(TPN::iPN, mean, sig); }
71 void TPN::setPNoPNCut(double mean, double sig) { setCut(TPN::iPNoPN, mean, sig); }
72 void TPN::setPNoPN0Cut(double mean, double sig) { setCut(TPN::iPNoPN0, mean, sig); }
73 void TPN::setPNoPN1Cut(double mean, double sig) { setCut(TPN::iPNoPN1, mean, sig); }
74 
75 std::vector<double> TPN::get(int ivar) {
76  std::vector<double> res;
77 
78  if (ivar < nOutVar) {
79  res.push_back(mom[ivar]->getMean());
80  res.push_back(mom[ivar]->getRMS());
81  res.push_back(mom[ivar]->getM3());
82  res.push_back(mom[ivar]->getNevt());
83  res.push_back(mom[ivar]->getMin());
84  res.push_back(mom[ivar]->getMax());
85  }
86 
87  return res;
88 }
89 
90 std::vector<double> TPN::getPN() {
91  vector<double> x = get(TPN::iPN);
92  return x;
93 }
94 std::vector<double> TPN::getPNoPN() {
95  vector<double> x = get(TPN::iPNoPN);
96  return x;
97 }
98 std::vector<double> TPN::getPNoPN0() {
99  vector<double> x = get(TPN::iPNoPN0);
100  return x;
101 }
102 std::vector<double> TPN::getPNoPN1() {
103  vector<double> x = get(TPN::iPNoPN1);
104  return x;
105 }
TPN(int iPN=0)
Definition: TPN.cc:17
std::vector< double > getPN()
Definition: TPN.cc:90
Definition: TPN.h:10
void addEntry(double, double, double)
Definition: TPN.cc:33
std::vector< double > getPNoPN1()
Definition: TPN.cc:102
void setPNoPN0Cut(double, double)
Definition: TPN.cc:72
void setPNCut(double, double)
Definition: TPN.cc:70
int init
Definition: HydjetWrapper.h:64
Definition: TMom.h:7
std::vector< double > getPNoPN0()
Definition: TPN.cc:98
TkSoA const *__restrict__ CAHitNtupletGeneratorKernelsGPU::QualityCuts cuts
std::vector< double > get(int)
Definition: TPN.cc:75
void setPNoPNCut(double, double)
Definition: TPN.cc:71
void setCut(int, double, double)
Definition: TPN.cc:61
void init()
Definition: TPN.cc:25
virtual ~TPN()
Definition: TPN.cc:23
void setPNoPN1Cut(double, double)
Definition: TPN.cc:73
std::vector< double > getPNoPN()
Definition: TPN.cc:94