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