 |
Belle II Software
release-05-01-25
|
4 #include <trg/cdc/dataobjects/CDCTriggerMLP.h>
5 #include <framework/datastore/StoreArray.h>
6 #include <framework/datastore/StoreObjPtr.h>
7 #include <framework/database/DBObjPtr.h>
8 #include <trg/cdc/dataobjects/CDCTriggerSegmentHit.h>
9 #include <trg/cdc/dbobjects/CDCTriggerNeuroConfig.h>
10 #include <framework/dataobjects/BinnedEventT0.h>
18 class CDCTriggerTrack;
48 std::vector<std::vector<float>>
nHidden = {{3.}};
58 std::vector<std::vector<float>>
phiRange = {{0., 360.}};
60 std::vector<std::vector<float>>
invptRange = {{ -5., 5.}};
62 std::vector<std::vector<float>>
thetaRange = {{17., 150.}};
118 std::vector<unsigned>
getRangeIndices(
const Parameters& p,
unsigned isector);
124 void save(
const std::string& filename,
const std::string& arrayname =
"MLPs");
130 bool load(
const std::string& filename,
const std::string& arrayname =
"MLPs");
141 void initializeCollections(std::string hitCollectionName, std::string eventTimeName, std::string et_option);
161 std::vector<int>
selectMLPs(
float phi0,
float invpt,
float theta);
168 int selectMLPbyPattern(std::vector<int>& MLPs,
unsigned long pattern,
const bool neurotrackinputmode);
205 std::string eto =
m_MLPs[0].get_et_option();
206 for (
unsigned int i = 0; i <
m_MLPs.size(); ++i) {
208 B2ERROR(
"Timing options in the expert networks in the CDC Neurotrigger differ!");
237 bool returnAllRelevant =
false);
244 std::vector<float>
getInputVector(
unsigned isector,
const std::vector<unsigned>& hitIds);
250 std::vector<float>
runMLP(
unsigned isector, std::vector<float> input);
253 std::vector<float>
runMLPFix(
unsigned isector, std::vector<float> input);
void updateTrack(const CDCTriggerTrack &track)
Calculate 2D phi position and arclength for the given track and store them.
CDCTriggerMLP & operator[](unsigned index)
return reference to a neural network
DBObjPtr< CDCTriggerNeuroConfig > m_cdctriggerneuroconfig
get NNT payload from database.
double m_idRef[9][2]
2D phi position of current track scaled to number of wires
unsigned tMax
Maximal drift time, identical for all networks.
void getEventTime(unsigned isector, const CDCTriggerTrack &track, std::string et_option, const bool)
Read out the event time and store it.
std::vector< std::vector< float > > phiRange
Phi region for which MLP is used in degree for all networks.
int m_T0
Event time of current event / track.
unsigned nMLP
Number of networks.
StoreArray< CDCTriggerSegmentHit > m_segmentHits
StoreArray containing the input track segment hits.
bool m_hasT0
Flag to show if stored event time is valid.
std::vector< unsigned long > SLpatternMask
Super layer pattern mask for which MLP is trained for all networks.
void setConstants()
Loads parameters from the geometry and precalculates some constants that will be needed.
double m_alpha[9][2]
2D crossing angle of current track
std::vector< std::vector< float > > nHidden
Number of nodes in each hidden layer for all networks or factor to multiply with number of inputs.
Track created by the CDC trigger.
std::vector< float > runMLP(unsigned isector, std::vector< float > input)
Run an expert MLP.
unsigned long getInputPattern(unsigned isector, const CDCTriggerTrack &track, const bool neurotrackinputmode)
Calculate input pattern for MLP.
std::vector< unsigned short > maxHitsPerSL
Maximum number of hits in a single super layer for all networks.
std::string get_et_option()
Return value of m_et_option.
StoreObjPtr< BinnedEventT0 > m_eventTime
StoreObjPtr containing the event time.
bool T0fromHits
DEPRECATED!! If true, determine event time from relevant hits if it is missing.
std::vector< std::vector< float > > thetaRange
Theta region for which MLP is used in degree for all networks.
std::vector< unsigned > getRangeIndices(const Parameters &p, unsigned isector)
Get indices for sector ranges in parameter lists.
Class for accessing objects in the database.
double getRelId(const CDCTriggerSegmentHit &hit)
Calculate phi position of a hit relative to 2D track (scaled to number of wires).
std::vector< std::vector< float > > invptRangeTrain
Charge / Pt region for which MLP is trained in 1/GeV for all networks.
bool targetZ
train z as output
std::vector< unsigned > selectHits(unsigned isector, const CDCTriggerTrack &track, bool returnAllRelevant=false)
Select best hits for each super layer.
std::vector< std::vector< float > > invptRange
Charge / Pt region for which MLP is used in 1/GeV for all networks.
Class to represent the CDC Neurotrigger.
int selectMLPbyPattern(std::vector< int > &MLPs, unsigned long pattern, const bool neurotrackinputmode)
Select one MLP from a list of sector indices.
Abstract base class for different kinds of events.
void setPrecision(std::vector< unsigned > precision)
set fixed point precision
const CDCTriggerMLP & operator[](unsigned index) const
return const reference to a neural network
Type-safe access to single objects in the data store.
bool targetTheta
train theta as output
std::vector< CDCTriggerMLP > m_MLPs
List of networks.
void addMLP(const CDCTriggerMLP &newMLP)
add an MLP to the list of networks
std::vector< float > runMLPFix(unsigned isector, std::vector< float > input)
Run an expert MLP with fixed point arithmetic.
std::string et_option
Determine, how the event time should be obtained.
double m_radius[9][2]
Radius of the CDC layers with priority wires (2 per super layer)
unsigned nSectors() const
return number of neural networks
void updateTrackFix(const CDCTriggerTrack &track)
Calculate 2D phi position and arclength for the given track and store them.
std::vector< std::vector< float > > phiRangeTrain
Phi region for which MLP is trained in degree for all networks.
std::vector< std::vector< float > > outputScale
Output scale for all networks.
virtual ~NeuroTrigger()
Default destructor.
std::string m_hitCollectionName
Name of the StoreArray containing the input track segment hits.
bool multiplyHidden
If true, multiply nHidden with number of input nodes.
NeuroTrigger()
Default constructor.
std::vector< int > selectMLPs(float phi0, float invpt, float theta)
Select all matching expert MLPs based on the given track parameters.
unsigned m_TSoffset[10]
Number of track segments up to super layer.
bool load(const std::string &filename, const std::string &arrayname="MLPs")
Load MLPs from file.
Accessor to arrays stored in the data store.
Struct to keep neurotrigger parameters.
void initializeCollections(std::string hitCollectionName, std::string eventTimeName, std::string et_option)
set the hit collection and event time to required and store the hit collection name
std::vector< std::vector< float > > thetaRangeTrain
Theta region for which MLP is trained in degree for all networks.
void save(const std::string &filename, const std::string &arrayname="MLPs")
Save MLPs to file.
Combination of several CDCHits to a track segment hit for the trigger.
std::vector< unsigned long > SLpattern
Super layer pattern for which MLP is trained for all networks.
std::vector< float > getInputVector(unsigned isector, const std::vector< unsigned > &hitIds)
Calculate input values for MLP.
Class to keep all parameters of an expert MLP for the neuro trigger.
void initialize(const Parameters &p)
Set parameters and get some network independent parameters.
std::vector< unsigned > selectHitsHWSim(unsigned isector, const CDCTriggerTrack &track)
Select hits for each super layer from the ones related to input track.
std::vector< unsigned > m_precision
Fixed point precision in bit after radix point.