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