Belle II Software  release-06-02-00
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 > &phirange, std::vector< float > &invptrange, std::vector< float > &thetarange, unsigned short maxHits, unsigned long pattern, unsigned long patternMask, unsigned short tmax, bool calcT0, 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
 
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
 
bool getT0fromHits () const
 get flag for event time definition
 
std::string get_et_option () const
 Returns way of obtaining the event time.
 
bool inPhiRange (float phi) const
 check whether given phi value is in sector
 
bool inPtRange (float pt) const
 check whether given pt value is in sector
 
bool inInvptRange (float invpt) const
 check whether given 1/pt value is in sector
 
bool inThetaRange (float theta) const
 check whether given theta value is in 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, 7)
 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 > phiRange
 Phi region in radian for which this expert is trained. More...
 
std::vector< float > invptRange
 Charge / Pt region in 1/GeV for which this expert is trained. More...
 
std::vector< float > thetaRange
 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...
 
bool T0fromHits
 DEPRECATED!! If true, the event time will be determined from hits within relevantID region, if it is missing. More...
 

Friends

class CDCTriggerNeuroTrainerModule
 

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 163 of file CDCTriggerMLP.h.

◆ invptRange

std::vector<float> invptRange
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 127 of file CDCTriggerMLP.h.

◆ phiRange

std::vector<float> phiRange
private

Phi region in radian for which this expert is trained.

Valid ranges go from -2pi to 2pi.

Definition at line 123 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 147 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 136 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 140 of file CDCTriggerMLP.h.

◆ T0fromHits

bool T0fromHits
private

DEPRECATED!! If true, the event time will be determined from hits within relevantID region, if it is missing.

Otherwise, no drift times are used if the event time is missing. Stored here to make sure that the event time definition is the same during training and during execution.

Definition at line 170 of file CDCTriggerMLP.h.


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