Belle II Software development
|
Class to keep all parameters of an expert MLP for the neuro trigger. More...
#include <CDCTriggerMLP.h>
Public Member Functions | |
CDCTriggerMLP () | |
default constructor. | |
CDCTriggerMLP (std::vector< unsigned short > &nodes, unsigned short targets, std::vector< float > &outputscale, std::vector< float > &phirangeUse, std::vector< float > &invptrangeUse, std::vector< float > &thetarangeUse, std::vector< float > &phirangeTrain, std::vector< float > &invptrangeTrain, std::vector< float > &thetarangeTrain, unsigned short maxHits, unsigned long pattern, unsigned long patternMask, unsigned short tmax, const std::string &etoption) | |
constructor to set all parameters (not weights and relevantID ranges). | |
~CDCTriggerMLP () | |
destructor, empty because we don't allocate memory anywhere. | |
bool | isTrained () const |
check if weights are default values or set by some trainer | |
unsigned | nLayers () const |
get number of layers | |
unsigned | nNodesLayer (unsigned iLayer) const |
get number of nodes in a layer | |
unsigned | nWeights () const |
get number of weights from length of weights vector | |
unsigned | nWeightsCal () const |
calculate number of weights from number of nodes | |
std::vector< float > | getWeights () const |
get weights vector | |
void | setWeights (std::vector< float > xweights) |
set weights vector | |
unsigned short | getMaxHitsPerSL () const |
get maximum hit number for a single super layer | |
unsigned long | getSLpattern () const |
get super layer pattern | |
unsigned long | getSLpatternMask () const |
get bitmask for super layer pattern | |
unsigned long | getSLpatternUnmasked () const |
get raw super layer pattern | |
unsigned short | getTMax () const |
get maximal drift time | |
std::vector< float > | getIDRange (unsigned iSL) const |
get relevant ID range for given super layer | |
void | setRelID (std::vector< float > relid) |
set and get total relevant ID range | |
std::vector< float > | getRelID () const |
std::string | get_et_option () const |
Returns way of obtaining the event time. | |
bool | inPhiRangeUse (float phi) const |
check whether given phi value is in sector | |
bool | inPtRangeUse (float pt) const |
check whether given pt value is in sector | |
bool | inInvptRangeUse (float invpt) const |
check whether given 1/pt value is in sector | |
bool | inThetaRangeUse (float theta) const |
check whether given theta value is in sector | |
bool | inPhiRangeTrain (float phi) const |
check whether given phi value is in training sector | |
bool | inPtRangeTrain (float pt) const |
check whether given pt value is in training sector | |
bool | inInvptRangeTrain (float invpt) const |
check whether given 1/pt value is in training sector | |
bool | inThetaRangeTrain (float theta) const |
check whether given theta value is in training sector | |
bool | isRelevant (float relId, unsigned iSL) const |
check whether given relative TS ID is in relevant range | |
float | scaleId (double relId, unsigned iSL) const |
scale relative TS ID from relevant range to approximately [-1, 1] (to facilitate the FPGA implementation, the scale factor is rounded to a power of 2) | |
std::vector< float > | scaleTarget (std::vector< float > target) const |
scale target value from outputScale to [-1, 1] | |
std::vector< float > | unscaleTarget (std::vector< float > target) const |
scale target value from [-1, 1] to outputScale | |
int | zIndex () const |
get target index for z (-1 if no output is trained for z) | |
int | thetaIndex () const |
get target index for theta (-1 if no output is trained for theta) | |
Private Member Functions | |
ClassDef (CDCTriggerMLP, 11) | |
Needed to make the ROOT object storable. | |
Private Attributes | |
std::vector< unsigned short > | nNodes |
Number of nodes in each layer, not including bias nodes. | |
std::vector< float > | weights |
Weights of the network. | |
bool | trained |
Indicator whether the weights are just default values or have been set by some trainer (set to true when setWeights() is first called). | |
unsigned short | targetVars |
output variables: 1: z, 2: theta, 3: (z, theta) | |
std::vector< float > | outputScale |
Output[i] of the MLP is scaled from [-1, 1] to [outputScale[2i], outputScale[2i+1]]. | |
std::vector< float > | phiRangeUse |
Phi region in radian for which this expert is used. | |
std::vector< float > | invptRangeUse |
Charge / Pt region in 1/GeV for which this expert is used. | |
std::vector< float > | thetaRangeUse |
Theta region in radian for which this expert is trained. | |
std::vector< float > | phiRangeTrain |
Phi region in radian for which this expert is used. | |
std::vector< float > | invptRangeTrain |
Charge / Pt region in 1/GeV for which this expert is trained. | |
std::vector< float > | thetaRangeTrain |
Theta region in radian for which this expert is trained. | |
unsigned short | maxHitsPerSL |
Maximum number of inputs for a single super layer. | |
unsigned long | SLpattern |
Super layer pattern for which this expert is trained. | |
unsigned long | SLpatternMask |
Bitmask for comparing the super layer pattern. | |
unsigned short | tMax |
Maximal drift time (for scaling), hits with larger values are ignored. | |
std::vector< float > | relevantID |
Hits must be within ID region around 2D track to be used as input. | |
std::string | et_option |
Returns way of obtaining the event time. | |
Friends | |
class | CDCTriggerNeuroTrainerModule |
class | NeuroTrigger |
Class to keep all parameters of an expert MLP for the neuro trigger.
Definition at line 20 of file CDCTriggerMLP.h.
CDCTriggerMLP | ( | ) |
default constructor.
Definition at line 13 of file CDCTriggerMLP.cc.
CDCTriggerMLP | ( | std::vector< unsigned short > & | nodes, |
unsigned short | targets, | ||
std::vector< float > & | outputscale, | ||
std::vector< float > & | phirangeUse, | ||
std::vector< float > & | invptrangeUse, | ||
std::vector< float > & | thetarangeUse, | ||
std::vector< float > & | phirangeTrain, | ||
std::vector< float > & | invptrangeTrain, | ||
std::vector< float > & | thetarangeTrain, | ||
unsigned short | maxHits, | ||
unsigned long | pattern, | ||
unsigned long | patternMask, | ||
unsigned short | tmax, | ||
const std::string & | etoption | ||
) |
constructor to set all parameters (not weights and relevantID ranges).
Definition at line 32 of file CDCTriggerMLP.cc.
|
inline |
destructor, empty because we don't allocate memory anywhere.
Definition at line 47 of file CDCTriggerMLP.h.
|
inline |
|
inline |
get relevant ID range for given super layer
Definition at line 74 of file CDCTriggerMLP.h.
|
inline |
|
inline |
Definition at line 80 of file CDCTriggerMLP.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool inInvptRangeTrain | ( | float | invpt | ) | const |
check whether given 1/pt value is in training sector
Definition at line 119 of file CDCTriggerMLP.cc.
bool inInvptRangeUse | ( | float | invpt | ) | const |
check whether given 1/pt value is in sector
Definition at line 93 of file CDCTriggerMLP.cc.
bool inPhiRangeTrain | ( | float | phi | ) | const |
check whether given phi value is in training sector
Definition at line 105 of file CDCTriggerMLP.cc.
bool inPhiRangeUse | ( | float | phi | ) | const |
bool inPtRangeTrain | ( | float | pt | ) | const |
check whether given pt value is in training sector
Definition at line 113 of file CDCTriggerMLP.cc.
bool inPtRangeUse | ( | float | pt | ) | const |
check whether given pt value is in sector
Definition at line 87 of file CDCTriggerMLP.cc.
bool inThetaRangeTrain | ( | float | theta | ) | const |
check whether given theta value is in training sector
Definition at line 125 of file CDCTriggerMLP.cc.
bool inThetaRangeUse | ( | float | theta | ) | const |
check whether given theta value is in sector
Definition at line 99 of file CDCTriggerMLP.cc.
bool isRelevant | ( | float | relId, |
unsigned | iSL | ||
) | const |
check whether given relative TS ID is in relevant range
Definition at line 131 of file CDCTriggerMLP.cc.
|
inline |
check if weights are default values or set by some trainer
Definition at line 50 of file CDCTriggerMLP.h.
|
inline |
|
inline |
|
inline |
unsigned nWeightsCal | ( | ) | const |
calculate number of weights from number of nodes
Definition at line 66 of file CDCTriggerMLP.cc.
float scaleId | ( | double | relId, |
unsigned | iSL | ||
) | const |
scale relative TS ID from relevant range to approximately [-1, 1] (to facilitate the FPGA implementation, the scale factor is rounded to a power of 2)
Definition at line 137 of file CDCTriggerMLP.cc.
std::vector< float > scaleTarget | ( | std::vector< float > | target | ) | const |
scale target value from outputScale to [-1, 1]
Definition at line 147 of file CDCTriggerMLP.cc.
|
inline |
set and get total relevant ID range
Definition at line 79 of file CDCTriggerMLP.h.
|
inline |
int thetaIndex | ( | ) | const |
get target index for theta (-1 if no output is trained for theta)
Definition at line 175 of file CDCTriggerMLP.cc.
std::vector< float > unscaleTarget | ( | std::vector< float > | target | ) | const |
scale target value from [-1, 1] to outputScale
Definition at line 158 of file CDCTriggerMLP.cc.
int zIndex | ( | ) | const |
get target index for z (-1 if no output is trained for z)
Definition at line 169 of file CDCTriggerMLP.cc.
|
friend |
Definition at line 23 of file CDCTriggerMLP.h.
|
friend |
Definition at line 24 of file CDCTriggerMLP.h.
|
private |
Returns way of obtaining the event time.
The different options are: "etf_only" : only ETF info is used, otherwise an error is thrown. "fastestpriority" : event time is estimated by fastest priority time in selected track segments. if something fails, it is set to 0. "zero" : the event time is set to 0. "etf_or_fastestpriority" : the event time is obtained by the ETF, if not possible, the flag "fastestppriority" is used. "etf_or_zero" : the event time is obtained by the ETF, if
Definition at line 182 of file CDCTriggerMLP.h.
|
private |
Charge / Pt region in 1/GeV for which this expert is trained.
Taking 1 / Pt instead of Pt means that straight tracks are at 0, i.e. there is a smooth transition from positive to negative charge.
Definition at line 146 of file CDCTriggerMLP.h.
|
private |
Charge / Pt region in 1/GeV for which this expert is used.
Taking 1 / Pt instead of Pt means that straight tracks are at 0, i.e. there is a smooth transition from positive to negative charge.
Definition at line 137 of file CDCTriggerMLP.h.
|
private |
Maximum number of inputs for a single super layer.
Definition at line 151 of file CDCTriggerMLP.h.
|
private |
Number of nodes in each layer, not including bias nodes.
Definition at line 118 of file CDCTriggerMLP.h.
|
private |
Output[i] of the MLP is scaled from [-1, 1] to [outputScale[2i], outputScale[2i+1]].
Definition at line 129 of file CDCTriggerMLP.h.
|
private |
Phi region in radian for which this expert is used.
Valid ranges go from -2pi to 2pi.
Definition at line 142 of file CDCTriggerMLP.h.
|
private |
Phi region in radian for which this expert is used.
Valid ranges go from -2pi to 2pi.
Definition at line 133 of file CDCTriggerMLP.h.
|
private |
Hits must be within ID region around 2D track to be used as input.
Default for axial layers is +- 1 wire, default for stereo layers is region spanned by stereos +- 1 wire.
Definition at line 166 of file CDCTriggerMLP.h.
|
private |
Super layer pattern for which this expert is trained.
Binary pattern of 9 * maxHitsPerSL bits (on/off for each hit). 0 means no restriction rather than no inputs.
Definition at line 155 of file CDCTriggerMLP.h.
|
private |
Bitmask for comparing the super layer pattern.
A track matches a sector, if SLpattern & SLpatternMask == hitPattern(track) & SLpatternMask.
Definition at line 159 of file CDCTriggerMLP.h.
|
private |
output variables: 1: z, 2: theta, 3: (z, theta)
Definition at line 126 of file CDCTriggerMLP.h.
|
private |
Theta region in radian for which this expert is trained.
Definition at line 148 of file CDCTriggerMLP.h.
|
private |
Theta region in radian for which this expert is trained.
Definition at line 139 of file CDCTriggerMLP.h.
|
private |
Maximal drift time (for scaling), hits with larger values are ignored.
Definition at line 162 of file CDCTriggerMLP.h.
|
private |
Indicator whether the weights are just default values or have been set by some trainer (set to true when setWeights() is first called).
Definition at line 123 of file CDCTriggerMLP.h.
|
private |
Weights of the network.
Definition at line 120 of file CDCTriggerMLP.h.