Belle II Software  release-08-01-10
CDCTriggerMLP Class Reference

Class to keep all parameters of an expert MLP for the neuro trigger. More...

#include <CDCTriggerMLP.h>

Inheritance diagram for CDCTriggerMLP:
Collaboration diagram for CDCTriggerMLP:

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. More...
 
std::vector< float > invptRangeUse
 Charge / Pt region in 1/GeV for which this expert is used. More...
 
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. More...
 
std::vector< float > invptRangeTrain
 Charge / Pt region in 1/GeV for which this expert is trained. More...
 
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. More...
 
unsigned long SLpatternMask
 Bitmask for comparing the super layer pattern. More...
 
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. More...
 
std::string et_option
 Returns way of obtaining the event time. More...
 

Friends

class CDCTriggerNeuroTrainerModule
 
class NeuroTrigger
 

Detailed Description

Class to keep all parameters of an expert MLP for the neuro trigger.

Definition at line 20 of file CDCTriggerMLP.h.

Member Data Documentation

◆ et_option

std::string et_option
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.

◆ invptRangeTrain

std::vector<float> invptRangeTrain
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.

◆ invptRangeUse

std::vector<float> invptRangeUse
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.

◆ phiRangeTrain

std::vector<float> phiRangeTrain
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.

◆ phiRangeUse

std::vector<float> phiRangeUse
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.

◆ relevantID

std::vector<float> relevantID
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.

◆ SLpattern

unsigned long SLpattern
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.

◆ SLpatternMask

unsigned long SLpatternMask
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.


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