 |
Belle II Software
release-05-02-19
|
1 #ifndef GRLNEUROTRAINERMODULE_H
2 #define GRLNEUROTRAINERMODULE_H
4 #include <framework/core/Module.h>
6 #include <trg/grl/GRLNeuro.h>
7 #include <trg/grl/dataobjects/GRLMLPData.h>
37 virtual void event()
override;
47 void train(
unsigned isector);
53 void saveTraindata(
const std::string& filename,
const std::string& arrayname =
"trainSets");
60 bool loadTraindata(
const std::string& filename,
const std::string& arrayname =
"trainSets");
115 std::vector<int> TCThetaID;
116 std::vector<float> TCPhiLab;
117 std::vector<float> TCcotThetaLab;
118 std::vector<float> TCPhiCOM;
119 std::vector<float> TCThetaCOM;
120 std::vector<float> TC1GeV;
133 std::vector<TH1D*> h_cdc2d_pt_sig;
134 std::vector<TH1D*> h_selE_sig;
135 std::vector<TH1D*> h_selPhi_sig;
136 std::vector<TH1D*> h_selTheta_sig;
137 std::vector<TH1D*> h_result_sig;
138 std::vector<TH1D*> h_cdc2d_phi_bg;
139 std::vector<TH1D*> h_cdc2d_pt_bg;
140 std::vector<TH1D*> h_selE_bg;
141 std::vector<TH1D*> h_selPhi_bg;
142 std::vector<TH1D*> h_selTheta_bg;
143 std::vector<TH1D*> h_result_bg;
144 std::vector<TH1D*> h_ncdc_sig;
145 std::vector<TH1D*> h_ncdcf_sig;
146 std::vector<TH1D*> h_ncdcs_sig;
147 std::vector<TH1D*> h_ncdci_sig;
148 std::vector<TH1D*> h_necl_sig;
149 std::vector<TH1D*> h_ncdc_bg;
150 std::vector<TH1D*> h_ncdcf_bg;
151 std::vector<TH1D*> h_ncdcs_bg;
152 std::vector<TH1D*> h_ncdci_bg;
153 std::vector<TH1D*> h_necl_bg;
The trainer module for the neural networks of the CDC trigger.
double radtodeg
convert radian to degree
double m_nTrainMax
Maximal number of training samples.
int m_nValid
Number of validation samples.
GRLNeuroTrainerModule()
Constructor, for setting module description and parameters.
double m_nTrainMin
Minimal number of training samples.
int m_nTest
Number of test samples.
virtual ~GRLNeuroTrainerModule()
Destructor.
std::string m_arrayname
Name of the TObjArray holding the networks.
int n_sector
Number of Total sectors.
bool loadTraindata(const std::string &filename, const std::string &arrayname="trainSets")
Load saved training samples.
Class to represent the GRL Neuro.
std::string m_filename
Name of file where network weights etc.
int m_nThreads
Number of threads for training.
std::string m_TrgECLClusterName
Name of the StoreArray containing the ECL clusters.
Struct to keep neurotrigger parameters.
GRLNeuro m_GRLNeuro
Instance of the NeuroTrigger.
std::string m_logFilename
Name of file where training log is stored.
int m_maxEpochs
Maximal number of training epochs.
double m_wMax
Limit for weights.
Abstract base class for different kinds of events.
void saveTraindata(const std::string &filename, const std::string &arrayname="trainSets")
Save all training samples.
std::string m_trainFilename
Name of file where training samples are stored.
bool m_load
Switch to load saved parameters from a previous run.
int n_cdc_sector
Number of CDC sectors.
void updateRelevantID(unsigned isector)
calculate and set the relevant id range for given sector based on hit counters of the track segments.
int m_repeatTrain
Number of training runs with different random start weights.
std::vector< TH1D * > h_cdc2d_phi_sig
Histograms for monitoring.
std::string m_trainArrayname
Name of the TObjArray holding the training samples.
virtual void event() override
Called once for each event.
std::string m_2DfinderCollectionName
Name of the StoreArray containing the input 2D tracks.
std::vector< int > scale_bg
BG scale factor for training.
virtual void initialize() override
Initialize the module.
void train(unsigned isector)
Train a single MLP.
virtual void terminate() override
Do the training for all sectors.
bool m_multiplyNTrain
Switch to multiply number of samples with number of weights.
GRLNeuro::Parameters m_parameters
Parameters for the NeuroTrigger.
bool m_saveDebug
If true, save training curve and parameter distribution of training data.
int n_ecl_sector
Number of ECL sectors.
std::vector< GRLMLPData > m_trainSets
Sets of training data for all sectors.
int m_checkInterval
Training is stopped if validation error is higher than checkInterval epochs ago, i....
std::string m_GRLCollectionName
Name of the StoreObj containing the input GRL.