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