CMS 3D CMS Logo

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 }
init
int init
Definition: HydjetWrapper.h:64
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
cuts
const TkSoA *__restrict__ CAHitNtupletGeneratorKernelsGPU::QualityCuts cuts
Definition: CAHitNtupletGeneratorKernelsImpl.h:338
TPN::getPNoPN0
std::vector< double > getPNoPN0()
Definition: TPN.cc:98
TPN::getPN
std::vector< double > getPN()
Definition: TPN.cc:90
TPN::iPNoPN0
Definition: TPN.h:10
TPN::setPNoPN1Cut
void setPNoPN1Cut(double, double)
Definition: TPN.cc:73
TPN::getPNoPN
std::vector< double > getPNoPN()
Definition: TPN.cc:94
TPN::iPNoPN
Definition: TPN.h:10
TPN::TPN
TPN(int iPN=0)
Definition: TPN.cc:17
TPN::~TPN
virtual ~TPN()
Definition: TPN.cc:23
TPN::init
void init()
Definition: TPN.cc:25
TMom
Definition: TMom.h:7
TPN::addEntry
void addEntry(double, double, double)
Definition: TPN.cc:33
TPN::setCut
void setCut(int, double, double)
Definition: TPN.cc:61
get
#define get
res
Definition: Electron.h:6
TPN::iPN
Definition: TPN.h:10
TPN::setPNoPN0Cut
void setPNoPN0Cut(double, double)
Definition: TPN.cc:72
TMarkov.h
heppy_batch.val
val
Definition: heppy_batch.py:351
std
Definition: JetResolutionObject.h:76
TMom.h
TPN::setPNCut
void setPNCut(double, double)
Definition: TPN.cc:70
TPN.h
TPN::iPNoPN1
Definition: TPN.h:10
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TPN::getPNoPN1
std::vector< double > getPNoPN1()
Definition: TPN.cc:102
TPN::get
std::vector< double > get(int)
Definition: TPN.cc:75
TPN::setPNoPNCut
void setPNoPNCut(double, double)
Definition: TPN.cc:71