 |
Belle II Software
release-05-02-19
|
1 #ifndef CDCTRIGGERNEUROTRAINERMODULE_H
2 #define CDCTRIGGERNEUROTRAINERMODULE_H
4 #include <framework/core/Module.h>
6 #include <trg/cdc/NeuroTrigger.h>
7 #include <trg/cdc/dataobjects/CDCTriggerMLPData.h>
40 virtual void event()
override;
50 void train(
unsigned isector);
56 void saveTraindata(
const std::string& filename,
const std::string& arrayname =
"trainSets");
63 bool loadTraindata(
const std::string& filename,
const std::string& arrayname =
"trainSets");
bool m_stopLoop
Switch for eary stopping.
std::vector< TH1D * > ptHistsMC
pt of MCParticles
int m_nThreads
Number of threads for training.
NeuroTrigger m_NeuroTrigger
Instance of the NeuroTrigger.
std::string m_trainFilename
Name of file where training samples are stored.
virtual void terminate() override
Do the training for all sectors.
std::string m_trainArrayname
Name of the TObjArray holding the training samples.
std::string m_arrayname
Name of the TObjArray holding the networks.
double m_nTrainMax
Maximal number of training samples.
double m_wMax
Limit for weights.
bool m_cutSum
Switch to apply cut to single hit counter or to sum over counters.
bool m_rescaleTarget
Switch to rescale out of range target values or ignore them.
std::string m_logFilename
Name of file where training log is stored.
double m_relevantCut
Cut on the hit counters to get relevant ID ranges.
bool loadTraindata(const std::string &filename, const std::string &arrayname="trainSets")
Load saved training samples.
bool m_saveDebug
If true, save training curve and parameter distribution of training data.
virtual ~CDCTriggerNeuroTrainerModule()
Destructor.
StoreArray< CDCTriggerTrack > m_tracks
List of input tracks.
bool m_neuroTrackInputMode
Use neurotracks instead of 2dtracks as input for the neurotrigger.
void saveTraindata(const std::string &filename, const std::string &arrayname="trainSets")
Save all training samples.
void train(unsigned isector)
Train a single MLP.
Class to represent the CDC Neurotrigger.
virtual void initialize() override
Initialize the module.
Abstract base class for different kinds of events.
std::vector< std::vector< float > > m_IDranges
Input ranges given over the module parameters.
std::string m_EventTimeName
name of the event time StoreObjPtr
NeuroTrigger::Parameters m_parameters
Parameters for the NeuroTrigger.
std::string m_hitCollectionName
Name of the StoreArray containing the input track segment hits.
std::vector< TH1D * > ptHists2D
pt of 2D tracks
bool m_load
Switch to load saved parameters from a previous run.
std::vector< CDCTriggerMLPData > m_trainSets
Sets of training data for all sectors.
int m_repeatTrain
Number of training runs with different random start weights.
bool m_selectSectorByMC
Switch for sector selection during training.
int m_nTrainPrepare
Number of samples to prepare input ranges.
void updateRelevantID(unsigned isector)
calculate and set the relevant id range for given sector based on hit counters of the track segments.
virtual void event() override
Called once for each event.
int m_nValid
Number of validation samples.
std::string m_inputCollectionName
Name of the StoreArray containing the input 2D tracks.
std::vector< TH1D * > phiHists2D
phi of 2D tracks
std::vector< TH1D * > thetaHistsMC
theta of MCParticles
std::string m_filename
Name of file where network weights etc.
Accessor to arrays stored in the data store.
std::vector< TH1D * > zHistsMC
z of MCParticles
Struct to keep neurotrigger parameters.
bool m_trainOnRecoTracks
Switch between MCParticles or RecoTracks as targets.
int m_nTest
Number of test samples.
int m_maxEpochs
Maximal number of training epochs.
double m_nTrainMin
Minimal number of training samples.
bool m_multiplyNTrain
Switch to multiply number of samples with number of weights.
int m_checkInterval
Training is stopped if validation error is higher than checkInterval epochs ago, i....
CDCTriggerNeuroTrainerModule()
Constructor, for setting module description and parameters.
std::string m_targetCollectionName
Name of the MCParticles/RecoTracks collection used as target values.
The trainer module for the neural networks of the CDC trigger.
std::vector< TH1D * > phiHistsMC
phi of MCParticles