CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
PhysicsTools::MVAComputer::DerivContext Struct Reference

#include <MVAComputer.h>

Public Member Functions

int * conf () const
 
 DerivContext ()
 
void eval (const VarProcessor *proc, int *outConf, double *output, int *loop, VarProcessor::LoopCtx &ctx, unsigned int offset, unsigned int out) const
 
unsigned int n () const
 
double output (unsigned int output, std::vector< double > &derivs) const
 
double * values () const
 

Public Attributes

std::vector< int > conf_
 
std::vector< double > deriv_
 
unsigned int n_
 
std::vector< double > values_
 

Detailed Description

Definition at line 155 of file MVAComputer.h.

Constructor & Destructor Documentation

◆ DerivContext()

PhysicsTools::MVAComputer::DerivContext::DerivContext ( )
inline

Definition at line 156 of file MVAComputer.h.

156 : n_(0) {}

Member Function Documentation

◆ conf()

int* PhysicsTools::MVAComputer::DerivContext::conf ( ) const
inline

Definition at line 169 of file MVAComputer.h.

Referenced by eval().

169 { return &conf_.front(); }

◆ eval()

void PhysicsTools::MVAComputer::DerivContext::eval ( const VarProcessor proc,
int *  outConf,
double *  output,
int *  loop,
VarProcessor::LoopCtx ctx,
unsigned int  offset,
unsigned int  out 
) const

◆ n()

unsigned int PhysicsTools::MVAComputer::DerivContext::n ( ) const
inline

Definition at line 170 of file MVAComputer.h.

Referenced by eval().

170 { return n_; }

◆ output()

double PhysicsTools::MVAComputer::DerivContext::output ( unsigned int  output,
std::vector< double > &  derivs 
) const

Definition at line 274 of file MVAComputer.cc.

References filterCSVwithJSON::copy, and PhysicsTools::MVAComputer::output.

274  {
275  derivs.clear();
276  derivs.reserve(n_);
277 
278  int pos = conf_[output];
279  if (pos >= (int)n_)
280  std::copy(&deriv_.front() + n_ * (pos - n_), &deriv_.front() + n_ * (pos - n_ + 1), std::back_inserter(derivs));
281  else {
282  derivs.resize(n_);
283  derivs[pos] = 1.;
284  }
285 
286  return values_[pos];
287  }
double output(unsigned int output, std::vector< double > &derivs) const
Definition: MVAComputer.cc:274

◆ values()

double* PhysicsTools::MVAComputer::DerivContext::values ( ) const
inline

Definition at line 168 of file MVAComputer.h.

Referenced by eval().

168 { return &values_.front(); }

Member Data Documentation

◆ conf_

std::vector<int> PhysicsTools::MVAComputer::DerivContext::conf_
mutable

Definition at line 174 of file MVAComputer.h.

◆ deriv_

std::vector<double> PhysicsTools::MVAComputer::DerivContext::deriv_
mutable

Definition at line 173 of file MVAComputer.h.

Referenced by eval().

◆ n_

unsigned int PhysicsTools::MVAComputer::DerivContext::n_

Definition at line 175 of file MVAComputer.h.

◆ values_

std::vector<double> PhysicsTools::MVAComputer::DerivContext::values_
mutable

Definition at line 172 of file MVAComputer.h.