Public Member Functions | Static Protected Member Functions | Protected Attributes | Private Attributes | Static Private Attributes | List of all members
TrackLengthCorrection Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-02-25/SliceLID/shifts/TrackLengthCorrection.h"

Inheritance diagram for TrackLengthCorrection:
Shift

Public Member Functions

 TrackLengthCorrection (bool isMC=false, bool isFD=false)
 
void setParams (bool isMC, bool isFD)
 
void shift (VarDict &varDict) const
 
double getScale () const
 
void setScale (double value)
 

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
 

Private Attributes

bool isMC
 
bool isFD
 

Static Private Attributes

static const std::vector< std::stringAFFECTED_VECTOR_VARS
 
static const std::vector< std::stringAFFECTED_SCALAR_VARS
 

Detailed Description

Definition at line 12 of file TrackLengthCorrection.h.

Constructor & Destructor Documentation

TrackLengthCorrection::TrackLengthCorrection ( bool  isMC = false,
bool  isFD = false 
)

Definition at line 27 of file TrackLengthCorrection.cxx.

29 { }
const double TRK_LEN_SCALE
Shift(double scale)
Definition: Shift.cxx:61

Member Function Documentation

double Shift::getScale ( ) const
inherited

Definition at line 51 of file Shift.cxx.

References Shift::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 
)
staticprotectedinherited

Definition at line 3 of file Shift.cxx.

References func(), and it.

Referenced by Shift::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 
)
staticprotectedinherited

Definition at line 17 of file Shift.cxx.

References func(), and it.

Referenced by Shift::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
void Shift::scaleScalarVar ( const std::string name,
std::unordered_map< std::string, double > &  vars,
double  factor 
)
staticprotectedinherited

Definition at line 33 of file Shift.cxx.

References Shift::mapScalarVar(), and submit_syst::x.

Referenced by 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 
)
staticprotectedinherited

Definition at line 42 of file Shift.cxx.

References Shift::mapVectorVar(), and submit_syst::x.

Referenced by 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 TrackLengthCorrection::setParams ( bool  isMC,
bool  isFD 
)

Definition at line 31 of file TrackLengthCorrection.cxx.

References isFD, and isMC.

32 {
33  this->isMC = isMC;
34  this->isFD = isFD;
35 }
void Shift::setScale ( double  value)
inherited

Definition at line 56 of file Shift.cxx.

References Shift::scale.

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

Implements Shift.

Definition at line 37 of file TrackLengthCorrection.cxx.

References AFFECTED_SCALAR_VARS, AFFECTED_VECTOR_VARS, isFD, isMC, VarDict::scalarVarMap, Shift::scale, Shift::scaleScalarVar(), Shift::scaleVectorVar(), and VarDict::vectorVarMap.

Referenced by SliceLID::FillSliceLID::predict(), and LSTME::FillLSTME::predictEnergy().

38 {
39  if ((isMC) || (! isFD)) {
40  return;
41  }
42 
43  for (const auto &vname : AFFECTED_SCALAR_VARS) {
44  scaleScalarVar(vname, varDict.scalarVarMap, scale);
45  }
46 
47  for (const auto &vname : AFFECTED_VECTOR_VARS) {
48  scaleVectorVar(vname, varDict.vectorVarMap, scale);
49  }
50 }
static const std::vector< std::string > AFFECTED_VECTOR_VARS
double scale
Definition: Shift.h:9
std::unordered_map< std::string, std::vector< double > > vectorVarMap
Definition: VarDict.h:11
static const std::vector< std::string > AFFECTED_SCALAR_VARS
static void scaleVectorVar(const std::string &name, std::unordered_map< std::string, std::vector< double >> &vars, double factor)
Definition: Shift.cxx:42
static void scaleScalarVar(const std::string &name, std::unordered_map< std::string, double > &vars, double factor)
Definition: Shift.cxx:33
std::unordered_map< std::string, double > scalarVarMap
Definition: VarDict.h:10

Member Data Documentation

const std::vector< std::string > TrackLengthCorrection::AFFECTED_SCALAR_VARS
staticprivate

Definition at line 19 of file TrackLengthCorrection.h.

Referenced by shift().

const std::vector< std::string > TrackLengthCorrection::AFFECTED_VECTOR_VARS
staticprivate

Definition at line 18 of file TrackLengthCorrection.h.

Referenced by shift().

bool TrackLengthCorrection::isFD
private

Definition at line 16 of file TrackLengthCorrection.h.

Referenced by setParams(), and shift().

bool TrackLengthCorrection::isMC
private

Definition at line 15 of file TrackLengthCorrection.h.

Referenced by setParams(), and shift().

double Shift::scale
protectedinherited

Definition at line 9 of file Shift.h.

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


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