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 10 of file TAPD.h.

Constructor & Destructor Documentation

TAPD::TAPD ( )

Definition at line 19 of file TAPD.cc.

References init.

19 { init(); }
void init()
Definition: TAPD.cc:24
TAPD::~TAPD ( )
virtual

Definition at line 22 of file TAPD.cc.

22 {}

Member Function Documentation

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

Definition at line 42 of file TAPD.cc.

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

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

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

Definition at line 38 of file TAPD.cc.

38  {
39  addEntry(apd, pn, pn0, pn1, time, 0.0, 0.0);
40 }
void addEntry(double, double, double, double, double, double, double)
Definition: TAPD.cc:42
std::vector< double > TAPD::get ( int  ivar)

Definition at line 199 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().

199  {
200  std::vector<double> res;
201 
202  if (ivar < nOutVar) {
203  res.push_back(mom[ivar]->getMean());
204  res.push_back(mom[ivar]->getRMS());
205  res.push_back(mom[ivar]->getM3());
206  res.push_back(mom[ivar]->getNevt());
207  res.push_back(mom[ivar]->getMin());
208  res.push_back(mom[ivar]->getMax());
209  }
210 
211  // std::cout << "In get: ivar="<< ivar << ", mean="<< mom[ivar]->getMean()<<" res size="<< res.size()<< std::endl;
212 
213  return res;
214 }
TMom * mom[nOutVar]
Definition: TAPD.h:15
Definition: Electron.h:6
std::vector< double > TAPD::getAPD ( )

Definition at line 216 of file TAPD.cc.

References iAPD.

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

216  {
217  std::vector<double> x = get(TAPD::iAPD);
218  return x;
219 }
std::vector< double > TAPD::getAPDoAPD0 ( )

Definition at line 236 of file TAPD.cc.

References iAPDoAPD0.

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

236  {
237  std::vector<double> x = get(TAPD::iAPDoAPD0);
238  // std::cout<< "In GetAPDoAPD0: x[0]="<< x.at(0) << std::endl;
239  return x;
240 }
std::vector< double > TAPD::getAPDoAPD1 ( )

Definition at line 241 of file TAPD.cc.

References iAPDoAPD1.

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

241  {
242  std::vector<double> x = get(TAPD::iAPDoAPD1);
243  return x;
244 }
std::vector< double > TAPD::getAPDoPN ( )

Definition at line 220 of file TAPD.cc.

References iAPDoPN.

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

220  {
221  std::vector<double> x = get(TAPD::iAPDoPN);
222  return x;
223 }
std::vector< double > TAPD::getAPDoPN0 ( )

Definition at line 224 of file TAPD.cc.

References iAPDoPN0.

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

224  {
225  std::vector<double> x = get(TAPD::iAPDoPN0);
226  return x;
227 }
std::vector< double > TAPD::getAPDoPN1 ( )

Definition at line 228 of file TAPD.cc.

References iAPDoPN1.

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

228  {
229  std::vector<double> x = get(TAPD::iAPDoPN1);
230  return x;
231 }
std::vector< double > TAPD::getTime ( )

Definition at line 232 of file TAPD.cc.

References iTime.

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

232  {
233  std::vector<double> x = get(TAPD::iTime);
234  return x;
235 }
void TAPD::init ( )

Definition at line 24 of file TAPD.cc.

References dqmiolumiharvest::j.

24  {
25  for (int j = 0; j < nOutVar; j++) {
26  _apdcuts[0][j].clear();
27  _apdcuts[1][j].clear();
28  _cutvars[j].clear();
29 
30  _apdcuts[0][j].push_back(0.0);
31  _apdcuts[1][j].push_back(10.0e6);
32  _cutvars[j].push_back(j);
33 
34  mom[j] = new TMom();
35  }
36 }
std::vector< double > _apdcuts[2][nOutVar]
Definition: TAPD.h:12
TMom * mom[nOutVar]
Definition: TAPD.h:15
Definition: TMom.h:7
std::vector< int > _cutvars[nOutVar]
Definition: TAPD.h:13
void TAPD::set2DAPDCut ( const std::vector< double > &  lowCut,
const std::vector< double > &  highCut 
)

Definition at line 160 of file TAPD.cc.

References iAPD.

160  {
161  set2DCut(TAPD::iAPD, lowCut, highCut);
162 }
void set2DCut(int, const std::vector< double > &, const std::vector< double > &)
Definition: TAPD.cc:151
void TAPD::set2DAPDoAPD0Cut ( const std::vector< double > &  lowCut,
const std::vector< double > &  highCut 
)

Definition at line 173 of file TAPD.cc.

References iAPD, iAPDoAPD0, and iTime.

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

173  {
174  assert(lowCut.size() == 2);
175  assert(highCut.size() == 2);
176  std::vector<int> cutVars;
177  cutVars.push_back(TAPD::iAPD);
178  cutVars.push_back(TAPD::iTime);
179  setCut(TAPD::iAPDoAPD0, cutVars, lowCut, highCut);
180 }
void setCut(int, double, double)
Definition: TAPD.cc:90
void TAPD::set2DAPDoAPD1Cut ( const std::vector< double > &  lowCut,
const std::vector< double > &  highCut 
)

Definition at line 181 of file TAPD.cc.

References iAPD, iAPDoAPD1, and iTime.

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

181  {
182  assert(lowCut.size() == 2);
183  assert(highCut.size() == 2);
184  std::vector<int> cutVars;
185  cutVars.push_back(TAPD::iAPD);
186  cutVars.push_back(TAPD::iTime);
187  setCut(TAPD::iAPDoAPD1, cutVars, lowCut, highCut);
188 }
void setCut(int, double, double)
Definition: TAPD.cc:90
void TAPD::set2DAPDoPN0Cut ( const std::vector< double > &  lowCut,
const std::vector< double > &  highCut 
)

Definition at line 166 of file TAPD.cc.

References iAPDoPN0.

166  {
167  set2DCut(TAPD::iAPDoPN0, lowCut, highCut);
168 }
void set2DCut(int, const std::vector< double > &, const std::vector< double > &)
Definition: TAPD.cc:151
void TAPD::set2DAPDoPN1Cut ( const std::vector< double > &  lowCut,
const std::vector< double > &  highCut 
)

Definition at line 169 of file TAPD.cc.

References iAPDoPN1.

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

Definition at line 163 of file TAPD.cc.

References iAPDoPN.

163  {
164  set2DCut(TAPD::iAPDoPN, lowCut, highCut);
165 }
void set2DCut(int, const std::vector< double > &, const std::vector< double > &)
Definition: TAPD.cc:151
void TAPD::set2DCut ( int  ivar,
const std::vector< double > &  lowCut,
const std::vector< double > &  highCut 
)

Definition at line 151 of file TAPD.cc.

References iTime.

151  {
152  assert(lowCut.size() == 2);
153  assert(highCut.size() == 2);
154  std::vector<int> cutVars;
155  cutVars.push_back(ivar);
156  cutVars.push_back(TAPD::iTime);
157  setCut(ivar, cutVars, lowCut, highCut);
158 }
void setCut(int, double, double)
Definition: TAPD.cc:90
void TAPD::set2DTimeCut ( const std::vector< double > &  lowCut,
const std::vector< double > &  highCut 
)

Definition at line 190 of file TAPD.cc.

References iAPD, and iTime.

190  {
191  assert(lowCut.size() == 2);
192  assert(highCut.size() == 2);
193  std::vector<int> cutVars;
194  cutVars.push_back(TAPD::iAPD);
195  cutVars.push_back(TAPD::iTime);
196  setCut(TAPD::iTime, cutVars, lowCut, highCut);
197 }
void setCut(int, double, double)
Definition: TAPD.cc:90
void TAPD::setAPDCut ( double  mean,
double  sig 
)

Definition at line 141 of file TAPD.cc.

References iAPD.

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

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

Definition at line 143 of file TAPD.cc.

References iAPDoPN0.

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

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

Definition at line 144 of file TAPD.cc.

References iAPDoPN1.

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

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

Definition at line 142 of file TAPD.cc.

References iAPDoPN.

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

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

Definition at line 90 of file TAPD.cc.

References LaserClient_cfi::high, and LaserClient_cfi::low.

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

Definition at line 110 of file TAPD.cc.

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

Definition at line 145 of file TAPD.cc.

References iTime.

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

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

Member Data Documentation

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

Definition at line 12 of file TAPD.h.

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

Definition at line 13 of file TAPD.h.

TMom* TAPD::mom[nOutVar]

Definition at line 15 of file TAPD.h.