CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Public Attributes
TAPD Class Reference

#include <TAPD.h>

Public Types

enum  outVar {
  iAPD, iAPDoPN, iAPDoPN0, iAPDoPN1,
  iTime, iAPDoAPD0, iAPDoAPD1, nOutVar
}
 

Public Member Functions

void addEntry (double, double, double, double, double, double, double)
 
void addEntry (double, double, double, double, double)
 
std::vector< double > get (int)
 
std::vector< double > getAPD ()
 
std::vector< double > getAPDoAPD0 ()
 
std::vector< double > getAPDoAPD1 ()
 
std::vector< double > getAPDoPN ()
 
std::vector< double > getAPDoPN0 ()
 
std::vector< double > getAPDoPN1 ()
 
std::vector< double > getTime ()
 
void init ()
 
void set2DAPDCut (const std::vector< double > &, const std::vector< double > &)
 
void set2DAPDoAPD0Cut (const std::vector< double > &, const std::vector< double > &)
 
void set2DAPDoAPD1Cut (const std::vector< double > &, const std::vector< double > &)
 
void set2DAPDoPN0Cut (const std::vector< double > &, const std::vector< double > &)
 
void set2DAPDoPN1Cut (const std::vector< double > &, const std::vector< double > &)
 
void set2DAPDoPNCut (const std::vector< double > &, const std::vector< double > &)
 
void set2DCut (int, const std::vector< double > &, const std::vector< double > &)
 
void set2DTimeCut (const std::vector< double > &, const std::vector< double > &)
 
void setAPDCut (double, double)
 
void setAPDoPN0Cut (double, double)
 
void setAPDoPN1Cut (double, double)
 
void setAPDoPNCut (double, double)
 
void setCut (int, double, double)
 
void setCut (int, const std::vector< int > &, const std::vector< double > &, const std::vector< double > &)
 
void setTimeCut (double, double)
 
 TAPD ()
 
virtual ~TAPD ()
 

Public Attributes

std::vector< double > _apdcuts [2][nOutVar]
 
std::vector< int > _cutvars [nOutVar]
 
TMommom [nOutVar]
 

Detailed Description

Definition at line 8 of file TAPD.h.

Member Enumeration Documentation

Enumerator
iAPD 
iAPDoPN 
iAPDoPN0 
iAPDoPN1 
iTime 
iAPDoAPD0 
iAPDoAPD1 
nOutVar 

Definition at line 14 of file TAPD.h.

Constructor & Destructor Documentation

TAPD::TAPD ( )

Definition at line 20 of file TAPD.cc.

References init.

21 {
22  init();
23 }
void init()
Definition: TAPD.cc:31
TAPD::~TAPD ( )
virtual

Definition at line 27 of file TAPD.cc.

28 {
29 }

Member Function Documentation

void TAPD::addEntry ( double  apd,
double  pn,
double  pn0,
double  pn1,
double  time,
double  apd0,
double  apd1 
)

Definition at line 53 of file TAPD.cc.

References protons_cff::time, and heppy_batch::val.

Referenced by EcalLaserAnalyzer2::endJob(), and EcalLaserAnalyzer::endJob().

54 {
55 
56  double val[nOutVar];
57  std::vector <double> valcuts[nOutVar];
58 
59  val[iAPD]=apd;
60  if(pn!=0) val[iAPDoPN]=apd/pn;
61  else val[iAPDoPN]=0.0;
62  if(pn0!=0) val[iAPDoPN0]=apd/pn0;
63  else val[iAPDoPN0]=0.0;
64  if(pn1!=0) val[iAPDoPN1]=apd/pn1;
65  else val[iAPDoPN1]=0.0;
66  val[iTime]=time;
67  if(apd0!=0.)val[iAPDoAPD0]=apd/apd0;
68  else val[iAPDoAPD0]=0.0;
69  if(apd1!=0.)val[iAPDoAPD1]=apd/apd1;
70  else val[iAPDoAPD1]=0.0;
71 
72 
73 
74  for(int ivar=0;ivar<nOutVar;ivar++){
75  int dimcut=_cutvars[ivar].size();
76  for(int ic=0;ic<dimcut;ic++){
77  assert(_cutvars[ivar].at(ic)<nOutVar);
78  valcuts[ivar].push_back(val[_cutvars[ivar].at(ic)]);
79  }
80  }
81 
82  for(int ivar=0;ivar<nOutVar;ivar++){
83  mom[ivar]->addEntry(val[ivar],valcuts[ivar]);
84  // std::cout << "addEntry: val[ivar=" << ivar <<"] = "<<val[ivar]<< std::endl;
85 
86  for(size_t ic=0;ic<_cutvars[ivar].size();ic++){
87  // std::cout << "addEntry: valcuts[ivar="<< ivar <<"][ic="<<ic<<"] = "<<valcuts[ivar].at(ic)<< std::endl;
88  for(size_t iv=0;iv<_cutvars[ivar].size();iv++){
89  // std::cout <<"low cut:"<<_apdcuts[0][ivar].at(iv)<<", high cut:"<<_apdcuts[1][ivar].at(iv)<<", cutvar: "<<_cutvars[ivar].at(iv)<< std::endl;
90  }
91  }
92  }
93 
94 }
void addEntry(double val)
Definition: TMom.cc:110
TMom * mom[nOutVar]
Definition: TAPD.h:19
std::vector< int > _cutvars[nOutVar]
Definition: TAPD.h:17
void TAPD::addEntry ( double  apd,
double  pn,
double  pn0,
double  pn1,
double  time 
)

Definition at line 48 of file TAPD.cc.

References revisionDML::addEntry().

49 {
50  addEntry(apd, pn, pn0, pn1, time, 0.0, 0.0);
51 }
void addEntry(double, double, double, double, double, double, double)
Definition: TAPD.cc:53
std::vector< double > TAPD::get ( int  ivar)

Definition at line 214 of file TAPD.cc.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), data_sources.json_list::as_dicts(), data_sources.json_list::as_table(), rrapi.RRApi::columns(), util.rrapi.RRApi::columns(), util.rrapi.RRApi::count(), rrapi.RRApi::count(), util.rrapi.RRApi::data(), rrapi.RRApi::data(), data_sources.json_list::first(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), data_sources.json_list::indices(), data_sources.json_list::last(), util.rrapi.RRApi::report(), rrapi.RRApi::report(), rrapi.RRApi::reports(), util.rrapi.RRApi::reports(), rrapi.RRApi::tables(), util.rrapi.RRApi::tables(), rrapi.RRApi::tags(), util.rrapi.RRApi::tags(), rrapi.RRApi::templates(), util.rrapi.RRApi::templates(), util.rrapi.RRApi::workspaces(), and rrapi.RRApi::workspaces().

214  {
215 
216  std::vector<double> res;
217 
218  if(ivar<nOutVar){
219 
220  res.push_back(mom[ivar]->getMean());
221  res.push_back(mom[ivar]->getRMS());
222  res.push_back(mom[ivar]->getM3());
223  res.push_back(mom[ivar]->getNevt());
224  res.push_back(mom[ivar]->getMin());
225  res.push_back(mom[ivar]->getMax());
226 
227  }
228 
229  // std::cout << "In get: ivar="<< ivar << ", mean="<< mom[ivar]->getMean()<<" res size="<< res.size()<< std::endl;
230 
231  return res;
232 
233 }
TMom * mom[nOutVar]
Definition: TAPD.h:19
Definition: Electron.h:6
std::vector< double > TAPD::getAPD ( )

Definition at line 235 of file TAPD.cc.

References iAPD.

Referenced by EcalLaserAnalyzer2::endJob(), and EcalLaserAnalyzer::endJob().

235 {std::vector<double> x=get(TAPD::iAPD); return x;}
std::vector< double > TAPD::getAPDoAPD0 ( )

Definition at line 240 of file TAPD.cc.

References iAPDoAPD0.

Referenced by EcalLaserAnalyzer2::endJob(), and EcalLaserAnalyzer::endJob().

240  {
241 std::vector<double> x=get(TAPD::iAPDoAPD0);
242 // std::cout<< "In GetAPDoAPD0: x[0]="<< x.at(0) << std::endl;
243  return x;
244 }
std::vector< double > TAPD::getAPDoAPD1 ( )

Definition at line 245 of file TAPD.cc.

References iAPDoAPD1.

Referenced by EcalLaserAnalyzer2::endJob(), and EcalLaserAnalyzer::endJob().

245 {std::vector<double> x=get(TAPD::iAPDoAPD1); return x;}
std::vector< double > TAPD::getAPDoPN ( )

Definition at line 236 of file TAPD.cc.

References iAPDoPN.

Referenced by EcalLaserAnalyzer2::endJob(), and EcalLaserAnalyzer::endJob().

236 {std::vector<double> x=get(TAPD::iAPDoPN); return x;}
std::vector< double > TAPD::getAPDoPN0 ( )

Definition at line 237 of file TAPD.cc.

References iAPDoPN0.

Referenced by EcalLaserAnalyzer2::endJob(), and EcalLaserAnalyzer::endJob().

237 {std::vector<double> x=get(TAPD::iAPDoPN0); return x;}
std::vector< double > TAPD::getAPDoPN1 ( )

Definition at line 238 of file TAPD.cc.

References iAPDoPN1.

Referenced by EcalLaserAnalyzer2::endJob(), and EcalLaserAnalyzer::endJob().

238 {std::vector<double> x=get(TAPD::iAPDoPN1); return x;}
std::vector< double > TAPD::getTime ( )

Definition at line 239 of file TAPD.cc.

References iTime.

Referenced by EcalLaserAnalyzer2::endJob(), and EcalLaserAnalyzer::endJob().

239 {std::vector<double> x=get(TAPD::iTime); return x;}
void TAPD::init ( )

Definition at line 31 of file TAPD.cc.

32 {
33 
34  for(int j=0;j<nOutVar;j++){
35 
36  _apdcuts[0][j].clear();
37  _apdcuts[1][j].clear();
38  _cutvars[j].clear();
39 
40  _apdcuts[0][j].push_back(0.0);
41  _apdcuts[1][j].push_back(10.0e6);
42  _cutvars[j].push_back(j);
43 
44  mom[j]=new TMom();
45  }
46 }
std::vector< double > _apdcuts[2][nOutVar]
Definition: TAPD.h:16
TMom * mom[nOutVar]
Definition: TAPD.h:19
Definition: TMom.h:7
std::vector< int > _cutvars[nOutVar]
Definition: TAPD.h:17
void TAPD::set2DAPDCut ( const std::vector< double > &  lowCut,
const std::vector< double > &  highCut 
)

Definition at line 169 of file TAPD.cc.

References iAPD.

169  {
170  set2DCut(TAPD::iAPD, lowCut, highCut);
171 }
void set2DCut(int, const std::vector< double > &, const std::vector< double > &)
Definition: TAPD.cc:157
void TAPD::set2DAPDoAPD0Cut ( const std::vector< double > &  lowCut,
const std::vector< double > &  highCut 
)

Definition at line 183 of file TAPD.cc.

References iAPD, iAPDoAPD0, and iTime.

Referenced by EcalLaserAnalyzer2::endJob(), and EcalLaserAnalyzer::endJob().

183  {
184 
185  assert (lowCut.size()==2);
186  assert (highCut.size()==2);
187  std::vector<int> cutVars;
188  cutVars.push_back(TAPD::iAPD);
189  cutVars.push_back(TAPD::iTime);
190  setCut(TAPD::iAPDoAPD0, cutVars, lowCut, highCut);
191 }
void setCut(int, double, double)
Definition: TAPD.cc:96
void TAPD::set2DAPDoAPD1Cut ( const std::vector< double > &  lowCut,
const std::vector< double > &  highCut 
)

Definition at line 192 of file TAPD.cc.

References iAPD, iAPDoAPD1, and iTime.

Referenced by EcalLaserAnalyzer2::endJob(), and EcalLaserAnalyzer::endJob().

192  {
193 
194  assert (lowCut.size()==2);
195  assert (highCut.size()==2);
196  std::vector<int> cutVars;
197  cutVars.push_back(TAPD::iAPD);
198  cutVars.push_back(TAPD::iTime);
199  setCut(TAPD::iAPDoAPD1, cutVars, lowCut, highCut);
200 }
void setCut(int, double, double)
Definition: TAPD.cc:96
void TAPD::set2DAPDoPN0Cut ( const std::vector< double > &  lowCut,
const std::vector< double > &  highCut 
)

Definition at line 175 of file TAPD.cc.

References iAPDoPN0.

175  {
176  set2DCut(TAPD::iAPDoPN0, lowCut, highCut);
177 }
void set2DCut(int, const std::vector< double > &, const std::vector< double > &)
Definition: TAPD.cc:157
void TAPD::set2DAPDoPN1Cut ( const std::vector< double > &  lowCut,
const std::vector< double > &  highCut 
)

Definition at line 178 of file TAPD.cc.

References iAPDoPN1.

178  {
179  set2DCut(TAPD::iAPDoPN1, lowCut, highCut);
180 }
void set2DCut(int, const std::vector< double > &, const std::vector< double > &)
Definition: TAPD.cc:157
void TAPD::set2DAPDoPNCut ( const std::vector< double > &  lowCut,
const std::vector< double > &  highCut 
)

Definition at line 172 of file TAPD.cc.

References iAPDoPN.

172  {
173  set2DCut(TAPD::iAPDoPN, lowCut, highCut);
174 }
void set2DCut(int, const std::vector< double > &, const std::vector< double > &)
Definition: TAPD.cc:157
void TAPD::set2DCut ( int  ivar,
const std::vector< double > &  lowCut,
const std::vector< double > &  highCut 
)

Definition at line 157 of file TAPD.cc.

References iTime.

157  {
158 
159  assert (lowCut.size()==2);
160  assert (highCut.size()==2);
161  std::vector<int> cutVars;
162  cutVars.push_back(ivar);
163  cutVars.push_back(TAPD::iTime);
164  setCut(ivar, cutVars, lowCut, highCut);
165 
166 }
void setCut(int, double, double)
Definition: TAPD.cc:96
void TAPD::set2DTimeCut ( const std::vector< double > &  lowCut,
const std::vector< double > &  highCut 
)

Definition at line 202 of file TAPD.cc.

References iAPD, and iTime.

202  {
203 
204  assert (lowCut.size()==2);
205  assert (highCut.size()==2);
206  std::vector<int> cutVars;
207  cutVars.push_back(TAPD::iAPD);
208  cutVars.push_back(TAPD::iTime);
209  setCut(TAPD::iTime, cutVars, lowCut, highCut);
210 }
void setCut(int, double, double)
Definition: TAPD.cc:96
void TAPD::setAPDCut ( double  mean,
double  sig 
)

Definition at line 147 of file TAPD.cc.

References iAPD.

Referenced by EcalLaserAnalyzer2::endJob(), and EcalLaserAnalyzer::endJob().

147 {setCut(TAPD::iAPD,mean,sig);}
void setCut(int, double, double)
Definition: TAPD.cc:96
void TAPD::setAPDoPN0Cut ( double  mean,
double  sig 
)

Definition at line 149 of file TAPD.cc.

References iAPDoPN0.

Referenced by EcalLaserAnalyzer2::endJob(), and EcalLaserAnalyzer::endJob().

149 {setCut(TAPD::iAPDoPN0,mean,sig);}
void setCut(int, double, double)
Definition: TAPD.cc:96
void TAPD::setAPDoPN1Cut ( double  mean,
double  sig 
)

Definition at line 150 of file TAPD.cc.

References iAPDoPN1.

Referenced by EcalLaserAnalyzer2::endJob(), and EcalLaserAnalyzer::endJob().

150 {setCut(TAPD::iAPDoPN1,mean,sig);}
void setCut(int, double, double)
Definition: TAPD.cc:96
void TAPD::setAPDoPNCut ( double  mean,
double  sig 
)

Definition at line 148 of file TAPD.cc.

References iAPDoPN.

Referenced by EcalLaserAnalyzer2::endJob(), and EcalLaserAnalyzer::endJob().

148 {setCut(TAPD::iAPDoPN,mean,sig);}
void setCut(int, double, double)
Definition: TAPD.cc:96
void TAPD::setCut ( int  ivar,
double  mean,
double  sig 
)

Definition at line 96 of file TAPD.cc.

96  {
97 
98  assert(ivar<nOutVar);
99 
100  std::vector <int>cutvar;
101  cutvar.push_back(ivar);
102 
103  std::vector <double>lowcut;
104  std::vector <double>highcut;
105 
106  double low=mean-2.0*sig;
107  if (low<0) low=0.0;
108  double high=mean+2.0*sig;
109 
110  lowcut.push_back(low);
111  highcut.push_back(high);
112 
113  setCut(ivar,cutvar,lowcut,highcut);
114 
115 }
void setCut(int, double, double)
Definition: TAPD.cc:96
void TAPD::setCut ( int  ivar,
const std::vector< int > &  cutVars,
const std::vector< double > &  lowCut,
const std::vector< double > &  highCut 
)

Definition at line 117 of file TAPD.cc.

117  {
118 
119  assert(ivar<nOutVar);
120  int cutdim=cutVars.size();
121  assert(cutdim<nOutVar);
122  assert(cutdim==(int)lowCut.size());
123  assert(cutdim==(int)highCut.size());
124 
125  _apdcuts[0][ivar].clear();
126  _apdcuts[1][ivar].clear();
127  _cutvars[ivar].clear();
128 
129  for (int ic=0;ic<cutdim;ic++){
130 
131  // FINISH THIS
132  if(lowCut.at(ic)>0){
133  _apdcuts[0][ivar].push_back(lowCut.at(ic));
134  }else _apdcuts[0][ivar].push_back(0.0);
135 
136  _apdcuts[1][ivar].push_back(highCut.at(ic));
137  _cutvars[ivar].push_back(cutVars.at(ic));
138 
139  }
140 
141  mom[ivar]->setCut(_apdcuts[0][ivar],_apdcuts[1][ivar]);
142 }
std::vector< double > _apdcuts[2][nOutVar]
Definition: TAPD.h:16
TMom * mom[nOutVar]
Definition: TAPD.h:19
void setCut(double, double)
Definition: TMom.cc:90
std::vector< int > _cutvars[nOutVar]
Definition: TAPD.h:17
void TAPD::setTimeCut ( double  mean,
double  sig 
)

Definition at line 151 of file TAPD.cc.

References iTime.

Referenced by EcalLaserAnalyzer2::endJob(), and EcalLaserAnalyzer::endJob().

151 {setCut(TAPD::iTime,mean,sig);}
void setCut(int, double, double)
Definition: TAPD.cc:96

Member Data Documentation

std::vector<double> TAPD::_apdcuts[2][nOutVar]

Definition at line 16 of file TAPD.h.

std::vector<int> TAPD::_cutvars[nOutVar]

Definition at line 17 of file TAPD.h.

TMom* TAPD::mom[nOutVar]

Definition at line 19 of file TAPD.h.