Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Shift Class Referenceabstract

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-30/SliceLID/shifts/Shift.h"

Inheritance diagram for Shift:
TrackLengthCorrection

Public Member Functions

 Shift (double scale)
 
double getScale () const
 
void setScale (double value)
 
virtual void shift (VarDict &varDict) const =0
 
virtual ~Shift ()=default
 
 Shift (const Shift &)=default
 
 Shift (Shift &&)=default
 
Shiftoperator= (const Shift &)=default
 
Shiftoperator= (Shift &&)=default
 

Static Protected Member Functions

static void mapVectorVar (const std::string &name, std::unordered_map< std::string, std::vector< double >> &vars, std::function< void(double &x)> func)
 
static void mapScalarVar (const std::string &name, std::unordered_map< std::string, double > &vars, std::function< void(double &x)> func)
 
static void scaleVectorVar (const std::string &name, std::unordered_map< std::string, std::vector< double >> &vars, double factor)
 
static void scaleScalarVar (const std::string &name, std::unordered_map< std::string, double > &vars, double factor)
 

Protected Attributes

double scale
 

Detailed Description

Definition at line 6 of file Shift.h.

Constructor & Destructor Documentation

Shift::Shift ( double  scale)

Definition at line 61 of file Shift.cxx.

62  : scale(scale)
63 { }
double scale
Definition: Shift.h:9
virtual Shift::~Shift ( )
virtualdefault
Shift::Shift ( const Shift )
default
Shift::Shift ( Shift &&  )
default

Member Function Documentation

double Shift::getScale ( ) const

Definition at line 51 of file Shift.cxx.

References scale.

52 {
53  return scale;
54 }
double scale
Definition: Shift.h:9
void Shift::mapScalarVar ( const std::string name,
std::unordered_map< std::string, double > &  vars,
std::function< void(double &x)>  func 
)
staticprotected

Definition at line 3 of file Shift.cxx.

References func(), and it.

Referenced by scaleScalarVar().

8 {
9  auto it = vars.find(name);
10  if (it == vars.end()) {
11  return;
12  }
13 
14  func(it->second);
15 }
const XML_Char * name
Definition: expat.h:151
set< int >::iterator it
double func(double x, double y)
const std::map< std::pair< std::string, std::string >, Variable > vars
void Shift::mapVectorVar ( const std::string name,
std::unordered_map< std::string, std::vector< double >> &  vars,
std::function< void(double &x)>  func 
)
staticprotected

Definition at line 17 of file Shift.cxx.

References func(), and it.

Referenced by scaleVectorVar().

22 {
23  auto it = vars.find(name);
24  if (it == vars.end()) {
25  return;
26  }
27 
28  for (auto &x : it->second) {
29  func(x);
30  }
31 }
const XML_Char * name
Definition: expat.h:151
set< int >::iterator it
double func(double x, double y)
const std::map< std::pair< std::string, std::string >, Variable > vars
Shift& Shift::operator= ( const Shift )
default
Shift& Shift::operator= ( Shift &&  )
default
void Shift::scaleScalarVar ( const std::string name,
std::unordered_map< std::string, double > &  vars,
double  factor 
)
staticprotected

Definition at line 33 of file Shift.cxx.

References mapScalarVar(), and submit_syst::x.

Referenced by TrackLengthCorrection::shift().

38 {
39  mapScalarVar(name, vars, [factor] (double &x) { x = factor * x; });
40 }
const XML_Char * name
Definition: expat.h:151
static void mapScalarVar(const std::string &name, std::unordered_map< std::string, double > &vars, std::function< void(double &x)> func)
Definition: Shift.cxx:3
const std::map< std::pair< std::string, std::string >, Variable > vars
void Shift::scaleVectorVar ( const std::string name,
std::unordered_map< std::string, std::vector< double >> &  vars,
double  factor 
)
staticprotected

Definition at line 42 of file Shift.cxx.

References mapVectorVar(), and submit_syst::x.

Referenced by TrackLengthCorrection::shift().

47 {
48  mapVectorVar(name, vars, [factor] (double &x) { x = factor * x; });
49 }
const XML_Char * name
Definition: expat.h:151
static void mapVectorVar(const std::string &name, std::unordered_map< std::string, std::vector< double >> &vars, std::function< void(double &x)> func)
Definition: Shift.cxx:17
const std::map< std::pair< std::string, std::string >, Variable > vars
void Shift::setScale ( double  value)

Definition at line 56 of file Shift.cxx.

References scale.

57 {
58  scale = value;
59 }
double scale
Definition: Shift.h:9
const XML_Char int const XML_Char * value
Definition: expat.h:331
virtual void Shift::shift ( VarDict varDict) const
pure virtual

Implemented in TrackLengthCorrection.

Member Data Documentation

double Shift::scale
protected

Definition at line 9 of file Shift.h.

Referenced by getScale(), setScale(), and TrackLengthCorrection::shift().


The documentation for this class was generated from the following files: