8 #include <trg/cdc/dataobjects/CDCTriggerMLP.h>
14 nNodes{27, 27, 2}, trained(false), targetVars(3), outputScale{ -1., 1., -1., 1.},
15 phiRange{0., 2. * M_PI}, invptRange{ -5., 5.}, thetaRange{0., M_PI},
16 maxHitsPerSL(1), SLpattern(0), SLpatternMask(0), tMax(256),
26 et_option(
"etf_or_fastestpriority"),
33 unsigned short targets,
34 std::vector<float>& outputscale,
35 std::vector<float>& phirange,
36 std::vector<float>& invptrange,
37 std::vector<float>& thetarange,
38 unsigned short maxHits,
39 unsigned long pattern,
40 unsigned long patternMask,
43 const std::string& etoption):
44 nNodes(nodes), trained(false), targetVars(targets), outputScale(outputscale),
45 phiRange(phirange), invptRange(invptrange), thetaRange(thetarange),
46 maxHitsPerSL(maxHits), SLpattern(pattern), SLpatternMask(patternMask),
69 for (
unsigned il = 1; il <
nLayers() - 1; ++il) {
79 return ((
phiRange[0] <= (phi - 2. * M_PI) && (phi - 2. * M_PI) <=
phiRange[1]) ||
113 scale = pow(2, floor(log2(scale)));
115 return scale * (relId - offset);
121 std::vector<float> scaled;
122 scaled.assign(target.size(), 0.);
123 for (
unsigned i = 0; i < target.size(); ++i) {
132 std::vector<float> unscaled;
133 unscaled.assign(target.size(), 0.);
134 for (
unsigned i = 0; i < target.size(); ++i) {
unsigned nWeightsCal() const
calculate number of weights from number of nodes
std::vector< float > thetaRange
Theta region in radian for which this expert is trained.
bool inPhiRange(float phi) const
check whether given phi value is in sector
bool inThetaRange(float theta) const
check whether given theta value is in sector
std::vector< unsigned short > nNodes
Number of nodes in each layer, not including bias nodes.
std::vector< float > unscaleTarget(std::vector< float > target) const
scale target value from [-1, 1] to outputScale
CDCTriggerMLP()
default constructor.
std::vector< float > scaleTarget(std::vector< float > target) const
scale target value from outputScale to [-1, 1]
std::vector< float > outputScale
Output[i] of the MLP is scaled from [-1, 1] to [outputScale[2i], outputScale[2i+1]].
bool inPtRange(float pt) const
check whether given pt value is in sector
std::vector< float > relevantID
Hits must be within ID region around 2D track to be used as input.
float scaleId(double relId, unsigned iSL) const
scale relative TS ID from relevant range to approximately [-1, 1] (to facilitate the FPGA implementat...
bool isRelevant(float relId, unsigned iSL) const
check whether given relative TS ID is in relevant range
unsigned short targetVars
output variables: 1: z, 2: theta, 3: (z, theta)
std::vector< float > weights
Weights of the network.
unsigned nLayers() const
get number of layers
std::vector< float > phiRange
Phi region in radian for which this expert is trained.
bool inInvptRange(float invpt) const
check whether given 1/pt value is in sector
unsigned nWeights() const
get number of weights from length of weights vector
int thetaIndex() const
get target index for theta (-1 if no output is trained for theta)
std::vector< float > invptRange
Charge / Pt region in 1/GeV for which this expert is trained.
int zIndex() const
get target index for z (-1 if no output is trained for z)
Abstract base class for different kinds of events.