CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
17 // Default Constructor...
18 TPN::TPN(int iPN)
19 {
20  init();
21  _nPN=iPN;
22 }
23 
24 
25 // Destructor
27 {
28 }
29 
30 void TPN::init()
31 {
32 
33  for(int j=0;j<nOutVar;j++){
34  cuts[0][j]=0.0;
35  cuts[1][j]=10.0e9;
36  mom[j]=new TMom();
37  }
38 }
39 
40 void TPN::addEntry(double pn, double pn0, double pn1)
41 {
42 
43  double val[nOutVar];
44 
45  if(_nPN==0) val[iPN]=pn0;
46  else val[iPN]=pn1;
47 
48  if(pn!=0) val[iPNoPN]=val[iPN]/pn;
49  else val[iPNoPN]=0;
50 
51  if(pn0!=0) val[iPNoPN0]=val[iPN]/pn0;
52  else val[iPNoPN0]=0;
53 
54  if(pn1!=0) val[iPNoPN1]=val[iPN]/pn1;
55  else val[iPNoPN1]=0;
56 
57  for(int ivar=0;ivar<nOutVar;ivar++){
58  mom[ivar]->addEntry(val[ivar]);
59  }
60 
61 }
62 
63 void TPN::setCut(int ivar, double mean, double sig){
64 
65  cuts[0][ivar]=mean-2.0*sig;
66  cuts[1][ivar]=mean+2.0*sig;
67  if(cuts[0][ivar]<0)cuts[0][ivar]=0.0 ;
68 
69  mom[ivar]->setCut(cuts[0][ivar],cuts[1][ivar]);
70 }
71 
72 void TPN::setPNCut(double mean, double sig){setCut(TPN::iPN,mean,sig);}
73 void TPN::setPNoPNCut(double mean, double sig){setCut(TPN::iPNoPN,mean,sig);}
74 void TPN::setPNoPN0Cut(double mean, double sig){setCut(TPN::iPNoPN0,mean,sig);}
75 void TPN::setPNoPN1Cut(double mean, double sig){setCut(TPN::iPNoPN1,mean,sig);}
76 
77 
78 std::vector<double> TPN::get(int ivar){
79 
80  std::vector<double> res;
81 
82  if(ivar<nOutVar){
83 
84  res.push_back(mom[ivar]->getMean());
85  res.push_back(mom[ivar]->getRMS());
86  res.push_back(mom[ivar]->getM3());
87  res.push_back(mom[ivar]->getNevt());
88  res.push_back(mom[ivar]->getMin());
89  res.push_back(mom[ivar]->getMax());
90  }
91 
92  return res;
93 
94 }
95 
96 std::vector<double> TPN::getPN(){vector <double> x= get(TPN::iPN); return x;}
97 std::vector<double> TPN::getPNoPN(){vector <double> x= get(TPN::iPNoPN); return x;}
98 std::vector<double> TPN::getPNoPN0(){vector <double> x= get(TPN::iPNoPN0); return x;}
99 std::vector<double> TPN::getPNoPN1(){vector <double> x= get(TPN::iPNoPN1); return x;}
100 
TPN(int iPN=0)
Definition: TPN.cc:18
std::vector< double > getPN()
Definition: TPN.cc:96
Definition: TPN.h:13
void addEntry(double, double, double)
Definition: TPN.cc:40
std::vector< double > getPNoPN1()
Definition: TPN.cc:99
void setPNoPN0Cut(double, double)
Definition: TPN.cc:74
void setPNCut(double, double)
Definition: TPN.cc:72
int init
Definition: HydjetWrapper.h:67
Definition: TMom.h:7
std::vector< double > getPNoPN0()
Definition: TPN.cc:98
T x() const
Cartesian x coordinate.
std::vector< double > get(int)
Definition: TPN.cc:78
void setPNoPNCut(double, double)
Definition: TPN.cc:73
int j
Definition: DBlmapReader.cc:9
void setCut(int, double, double)
Definition: TPN.cc:63
void init()
Definition: TPN.cc:30
virtual ~TPN()
Definition: TPN.cc:26
void setPNoPN1Cut(double, double)
Definition: TPN.cc:75
std::vector< double > getPNoPN()
Definition: TPN.cc:97