Belle II Software  release-08-01-10
trg modules
Collaboration diagram for trg modules:

Classes

class  CDCTriggerNeuroDQMModule
 CDC Trigger DQM Module. More...
 
class  CDCTrigger2DFitterModule
 Module for the 2D Fitter of the CDC trigger. More...
 
class  CDCTrigger3DFitterModule
 Module for the 3D Fitter of the CDC trigger. More...
 
class  CDCTriggerHoughCand
 Hough Candidates class. More...
 
class  CDCTriggerHoughETFModule
 
class  CDCTrigger2DFinderModule
 
class  CDCTriggerMCMatcherModule
 A module to match CDCTriggerTracks to MCParticles. More...
 
class  CDCTriggerRecoHitMatcherModule
 A module to match CDCTriggerTracks to RecoTracks. More...
 
class  CDCTriggerRecoMatcherModule
 A module to match CDCTriggerTracks to RecoTracks. More...
 
class  CDCTriggerNDFinderModule
 CDC Trigger NDFinder Module. More...
 
class  CDCTriggerNeuroDataModule
 
class  CDCTriggerNeuroIDHistModule
 Description. More...
 
class  CDCTriggerNeuroModule
 The neural network module of the CDC trigger. More...
 
class  CDCTriggerETFModule
 Module for the Event Time Finder of the CDC trigger. More...
 
class  CDCTriggerTrackCombinerModule
 Module to combine the information from the various track trigger stages. More...
 
class  CDCTriggerTSFFirmwareModule
 This class is the interface between TSim/basf2 TSF module and the firmware simulation core of XSim/ISim. More...
 
class  CDCTriggerTSFModule
 Module for the Track Segment Finder of the CDC trigger. More...
 
class  TRGCDCModule
 A module to simulate the CDC trigger. More...
 
class  TRGCDCT2DDQMModule
 DQM module of TRGCDCT2D. More...
 
class  TRGCDCT3DDQMModule
 DQM module for TRGCDCT3D. More...
 
class  TRGCDCTSFDQMModule
 DQM module of TRGCDCTSF. More...
 
class  TRGCDCTSStreamModule
 A module to process CDC trigger data. More...
 
struct  SubTrigger
 enum class SubTriggerType : unsigned char {Merger, TSF, T2D, T3D, Neuro, ETF}; More...
 
class  CDCTriggerUnpackerModule
 Unpack the trigger data recorded in B2L. More...
 
struct  Merger
 unpacker for the merger reader (TSF which reads the merger output) More...
 
struct  Tracker2D
 unpacker for the 2D tracker More...
 
struct  Neuro
 unpacker for the Neuro More...
 
class  MCMatcherTRGECLModule
 Class to represent the hit of one cell. More...
 
class  TRGECLFAMModule
 A module of FAM. More...
 
class  TRGECLModule
 A module of ETM. More...
 
class  TRGECLBGTCHitModule
 
class  TRGECLDQMModule
 
class  TRGECLEventTimingDQMModule
 This module is for ecl trigger DQM related to L1 event timing. More...
 
class  TRGECLQAMModule
 
class  TRGECLRawdataAnalysisModule
 A module of ETM. More...
 
class  TRGECLTimingCalModule
 Class ECL Trigger Timiing Calibration Module. More...
 
class  TRGECLUnpackerModule
 A module of TRG ECL Unpacker. More...
 
class  TRGGDLCosmicRunModule
 Module that returns true if the trigger condition for the 2017 cosmic runs is fulfilled. More...
 
class  TRGGDLModule
 A module to simulate the Global Decision Logic. More...
 
class  TRGGDLDQMModule
 
class  TRGGDLDSTModule
 
class  TRGGDLSummaryModule
 
class  TRGGRLMatchModule
 Match between CDC trigger track and ECL trigger cluster. More...
 
class  TRGGRLModule
 A module to simulate the Global Decision Logic. More...
 
class  TRGGRLProjectsModule
 A module to simulate the Global Decision Logic. More...
 
class  TRGGRLDQMModule
 
class  GRLNeuroModule
 The module for application of the neural networks of the GRL. More...
 
class  GRLNeuroTrainerModule
 The trainer module for the neural networks of the CDC trigger. More...
 
class  KLM_TRG_definitions
 
class  KLMTriggerModule
 
struct  Linear_fit_of_Hits_t
 
class  TRGTOPDQMModule
 
class  TRGTOPTRD2TTSConverterModule
 TRG TOP Raw Digits to TimeStamps Converter. More...
 
class  TRGTOPUnpackerModule
 TRG TOP Unpacker. More...
 
class  TRGTOPUnpackerWaveformModule
 TRG TOP Unpacker for Timestamps. More...
 
class  TRGTOPWaveformPlotterModule
 
class  TRGRAWDATAModule
 

Typedefs

typedef std::pair< unsigned short, TVector2 > cdcPair
 Pair of <iSuperLayer, (x, y)>, for hits in conformal space.
 
typedef std::map< int, cdcPaircdcMap
 Map of <counter, cdcPair>, for hits with indices.
 
typedef std::pair< TVector2, TVector2 > coord2dPair
 Hough Tuples.
 
using NodeList = std::vector< std::vector< int > >
 Node list.
 
using MergerBus = std::array< std::bitset< mergerWidth >, nAllMergers >
 Merger data bus.
 
using MergerBits = Bitstream< MergerBus >
 Merger data bus Bitstream.
 

Functions

bool operator== (const CDCTriggerHoughCand &a, const CDCTriggerHoughCand &b)
 Two cells are identical if they have the same coordinates.
 
 REG_MODULE (CDCTriggerNeuroData)
 
 REG_MODULE (CDCTriggerNeuroIDHist)
 
 REG_MODULE (TRGCDC)
 register the basf2 module TRGCDC
 
 REG_MODULE (TRGCDCTSStream)
 register the basf2 TRGCDCTSStream module
 
 REG_MODULE (TRGECLFAM)
 Register module name.
 
 REG_MODULE (TRGECL)
 Register Module.
 
 REG_MODULE (TRGECLBGTCHit)
 Register module name.
 
 REG_MODULE (TRGECLQAM)
 Register module name.
 
 REG_MODULE (TRGECLRawdataAnalysis)
 Register Module.
 
 REG_MODULE (TRGGDL)
 
 REG_MODULE (TRGGRL)
 Register module for TRGGRL.
 
Belle2::group_helper::KLM_trg_summery make_trg (const std::vector< Belle2::group_helper::KLM_Digit_compact > &hits, int eventNR, int NLayerTrigger)
 
std::vector< Belle2::group_helper::KLM_trig_linear_fit > klm_trig_linear_fit (std::vector< Belle2::group_helper::KLM_Digit_compact > &hits, const std::vector< Belle2::group_helper::KLM_geo_fit_t > &geometry)
 
 CDCTriggerNeuroDataModule ()
 Constructor, for setting module description and parameters.
 
virtual void initialize () override
 Initialize the module. More...
 
virtual void event () override
 Called once for each event. More...
 
virtual void terminate () override
 Do the training for all sectors.
 
 CDCTriggerNeuroIDHistModule ()
 Constructor, for setting module description and parameters.
 
virtual void initialize () override
 Initialize the module. More...
 
virtual void event () override
 Called once for each event. More...
 
virtual void terminate () override
 Do the training for all sectors.
 
std::string version (void) const
 returns version of TRGCDCModule.
 
 TRGCDCModule ()
 Constructor.
 
virtual ~TRGCDCModule ()
 Destructor.
 
virtual void initialize () override
 Initilizes TRGCDCModule.
 
virtual void beginRun () override
 Called when new run started.
 
virtual void event () override
 Called event by event.
 
virtual void endRun () override
 Called when run ended.
 
virtual void terminate () override
 Called when processing ended.
 
std::string version (void) const
 returns version of TRGCDCTSStreamModule.
 
 TRGCDCTSStreamModule ()
 Constructor.
 
virtual ~TRGCDCTSStreamModule ()
 Destructor.
 
virtual void initialize () override
 Initilizes TRGCDCTSStreamModule.
 
virtual void beginRun () override
 Called when new run started.
 
virtual void event () override
 Called event by event.
 
virtual void endRun () override
 Called when run ended.
 
virtual void terminate () override
 Called when processing ended.
 
std::string version (void) const
 returns version of TRGECLFAMModule.
 
 TRGECLFAMModule ()
 Constructor.
 
virtual ~TRGECLFAMModule ()
 Destructor.
 
virtual void initialize () override
 Initilizes TRGECLFAMModule.
 
virtual void beginRun () override
 Called when new run started.
 
virtual void event () override
 Called event by event.
 
virtual void endRun () override
 Called when run ended.
 
virtual void terminate () override
 Called when processing ended.
 
std::string version (void) const
 returns version of TRGECLModule.
 
 TRGECLModule ()
 Constructor.
 
virtual ~TRGECLModule ()
 Destructor

 
virtual void initialize () override
 Initilizes TRGECLModule.
 
virtual void beginRun () override
 Called when new run started.
 
virtual void event () override
 Called event by event.
 
virtual void endRun () override
 Called when run ended.
 
virtual void terminate () override
 Called when processing ended.
 
std::string version (void) const
 returns version of TRGECLBGTCHitModule.
 
 TRGECLBGTCHitModule ()
 Constructor.
 
virtual ~TRGECLBGTCHitModule ()
 Destructor.
 
virtual void initialize () override
 Initilizes TRGECLBGTCHitModule.
 
virtual void beginRun () override
 Called when new run started.
 
virtual void event () override
 Called event by event.
 
virtual void endRun () override
 Called when run ended.
 
virtual void terminate () override
 Called when processing ended.
 
void genSimulationObj ()
 Parameters.
 
void genRandomTrgObj ()
 
std::string version () const
 version
 
 TRGECLQAMModule ()
 Costructor.
 
virtual ~TRGECLQAMModule ()
 Destrunctor.
 
virtual void initialize () override
 initialize
 
virtual void beginRun () override
 begin Run
 
virtual void event () override
 Event.
 
virtual void endRun () override
 End Run.
 
virtual void terminate () override
 terminate
 
std::string version (void) const
 returns version of TRGECLModule.
 
 TRGECLRawdataAnalysisModule ()
 Constructor.
 
virtual ~TRGECLRawdataAnalysisModule ()
 Destructor

 
virtual void initialize () override
 Initilizes TRGECLModule.
 
virtual void beginRun () override
 Called when new run started.
 
virtual void event () override
 Called event by event.
 
virtual void endRun () override
 Called when run ended.
 
virtual void terminate () override
 Called when processing ended.
 
std::string version (void) const
 returns version of TRGGDLModule.
 
 TRGGDLModule ()
 Constructor.
 
virtual ~TRGGDLModule ()
 Destructor.
 
virtual void defineHisto () override
 Define Histogram.
 
virtual void initialize () override
 Initilizes TRGGDLModule.
 
virtual void beginRun () override
 Called when new run started.
 
virtual void event () override
 Called event by event.
 
virtual void endRun () override
 Called when run ended.
 
virtual void terminate () override
 Called when processing ended.
 
std::string version (void) const
 returns version of TRGGRLModule.
 
 TRGGRLModule ()
 Constructor.
 
virtual ~TRGGRLModule ()
 Destructor.
 
virtual void initialize () override
 Initilizes TRGGRLModule.
 
virtual void beginRun () override
 Called when new run started.
 
virtual void event () override
 Called event by event.
 
virtual void endRun () override
 Called when run ended.
 
virtual void terminate () override
 Called when processing ended.
 

Variables

static constexpr int mergerWidth = 256
 Merger data width.
 
static constexpr int nAllMergers = 146
 Number of Mergers.
 
static constexpr int wordWidth = 32
 width of a single word in the raw int buffer
 
static constexpr int nFinesse = 48
 Number of FINESSE in a PCIe40.
 
constexpr Linear_fit_of_Hits_t Linear_fit_of_Hits
 
static const int intNaN = std::numeric_limits<int>::quiet_NaN()
 
static TRGGDL_gdl = 0
 A pointer to a TRGGDL;.
 
static TRGGRL_grl = 0
 A pointer to a TRGGRL;.
 

Detailed Description

Function Documentation

◆ event() [1/2]

void event ( void  )
overridevirtual

Called once for each event.

Prepare input and target for each track and store it.

Reimplemented from Module.

Definition at line 134 of file CDCTriggerNeuroDataModule.cc.

135  {
136  StoreObjPtr<EventMetaData> evtmetadata;
137  for (int itrack = 0; itrack < m_tracks.getEntries(); ++itrack) {
138  // get related MCParticle/RecoTrack for target
139  // and retrieve track parameters
140  //float phi0Target = 0;
141  //float invptTarget = 0;
142  float thetaTarget = 0;
143  float zTarget = 0;
144  if (m_trainOnRecoTracks) {
145  RecoTrack* recoTrack =
146  m_tracks[itrack]->getRelatedTo<RecoTrack>(m_targetCollectionName);
147  if (!recoTrack) {
148  B2DEBUG(150, "Skipping CDCTriggerTrack without relation to RecoTrack.");
149  continue;
150  }
151  // a RecoTrack has multiple representations for different particle hypothesis
152  // -> just take the first one that does not give errors.
153  const std::vector<genfit::AbsTrackRep*>& reps = recoTrack->getRepresentations();
154  bool foundValidRep = false;
155  for (unsigned irep = 0; irep < reps.size() && !foundValidRep; ++irep) {
156  if (!recoTrack->wasFitSuccessful(reps[irep])) {
157  continue;
158  }
159 
160  // get state (position, momentum etc.) from hit closest to IP and
161  // extrapolate to z-axis (may throw an exception -> continue to next representation)
162  try {
164  recoTrack->getMeasuredStateOnPlaneClosestTo(ROOT::Math::XYZVector(0, 0, 0), reps[irep]);
165  reps[irep]->extrapolateToLine(state, TVector3(0, 0, -1000), TVector3(0, 0, 2000));
166  // flip tracks if necessary, such that trigger tracks and reco tracks
167  // point in the same direction
168  if (state.getMom().Dot(B2Vector3D(m_tracks[itrack]->getDirection())) < 0) {
169  state.setPosMom(state.getPos(), -state.getMom());
170  state.setChargeSign(-state.getCharge());
171  }
172  // get track parameters
173  //phi0Target = state.getMom().Phi();
174  //invptTarget = state.getCharge() / state.getMom().Pt();
175  thetaTarget = state.getMom().Theta();
176  zTarget = state.getPos().Z();
177  } catch (...) {
178  continue;
179  }
180  // break loop
181  foundValidRep = true;
182  }
183  if (!foundValidRep) {
184  B2DEBUG(150, "No valid representation found for RecoTrack, skipping.");
185  continue;
186  }
187  } else {
188  MCParticle* mcTrack =
189  m_tracks[itrack]->getRelatedTo<MCParticle>(m_targetCollectionName);
190  if (not mcTrack) {
191  B2DEBUG(150, "Skipping CDCTriggerTrack without relation to MCParticle.");
192  continue;
193  }
194  //phi0Target = mcTrack->getMomentum().Phi();
195  //invptTarget = mcTrack->getCharge() / mcTrack->getMomentum().Pt();
196  thetaTarget = mcTrack->getMomentum().Theta();
197  zTarget = mcTrack->getProductionVertex().Z();
198  }
200 
201  // find all matching sectors
202  float phi0 = m_tracks[itrack]->getPhi0();
203  float invpt = m_tracks[itrack]->getKappa(1.5);
204  float theta = atan2(1., m_tracks[itrack]->getCotTheta());
205  std::vector<int> sectors = m_NeuroTrigger.selectMLPsTrain(phi0, invpt, theta);
206  if (sectors.size() == 0) continue;
207 
208  // get target values
209  std::vector<float> targetRaw = {};
211  targetRaw.push_back(zTarget);
213  targetRaw.push_back(thetaTarget);
214  for (unsigned i = 0; i < sectors.size(); ++i) {
215  int isector = sectors[i];
216  std::vector<float> target = m_NeuroTrigger[isector].scaleTarget(targetRaw);
217  // skip out of range targets or rescale them
218  bool outOfRange = false;
219  for (unsigned itarget = 0; itarget < target.size(); ++itarget) {
220  if (fabs(target[itarget]) > 1.) {
221  outOfRange = true;
222  target[itarget] /= fabs(target[itarget]);
223  }
224  }
225  if (!m_neuroParameters.rescaleTarget && outOfRange) {
226  continue;
227  }
228  //
229  // read out or determine event time
231  // check hit pattern
232  unsigned long hitPattern = m_NeuroTrigger.getCompleteHitPattern(isector, *m_tracks[itrack], m_neuroTrackInputMode); // xxxxx0xxx
233  // sectorpattern holds the absolut necessary SLs for the expert
234  unsigned long sectorPattern = m_NeuroTrigger[isector].getSLpattern(); // 010100010
235  // sectorpatternmask holds the SLs, which are generally used to determine the right expert
236  unsigned long sectorPatternMask = m_NeuroTrigger[isector].getSLpatternMask(); // 010101010
237  B2DEBUG(250, "hitPattern " << hitPattern << " sectorPattern " << sectorPattern);
238  // if multiple experts should be trained with one track, the necessary SLs have to be in the hitpattern
239  if (!m_singleUse && sectorPattern > 0 && (sectorPattern & hitPattern) != sectorPattern) {
240  B2DEBUG(250, "hitPattern not matching " << (sectorPattern & hitPattern));
241  continue;
242  // if one track should only be used for one expert, the absolute necessary SLs for this expert should match exactly the set within the hitpattern of the generally used SLs for determining the expert.
243  } else if (m_singleUse && sectorPattern > 0 && (sectorPattern) != (hitPattern & sectorPatternMask)) {
244  // 010100010 != 0x0x0x0x0
245  B2DEBUG(250, "hitPattern not matching " << (sectorPatternMask & hitPattern));
246  continue;
247  }
248  // check, if enough axials are there. first, we select the axial bits from the
249  // hitpattern (341 = int('101010101',base=2)) and then check if the number of
250  // ones is equal or greater than 4.
251  if ((hitPattern & 341) != 341 && // this is an ugly workaround, because popcount is only
252  (hitPattern & 341) != 340 && // available with c++20 and newer
253  (hitPattern & 341) != 337 &&
254  (hitPattern & 341) != 325 &&
255  (hitPattern & 341) != 277 &&
256  (hitPattern & 341) != 85) {
257  B2DEBUG(250, "Not enough axial hits (<4), skipping!");
258  continue;
259  }
260  // get training data
261  std::vector<unsigned> hitIds;
262  if (m_neuroTrackInputMode) {
263  hitIds = m_NeuroTrigger.selectHitsHWSim(isector, *m_tracks[itrack]);
264  } else {
265  hitIds = m_NeuroTrigger.selectHits(isector, *m_tracks[itrack]);
266  }
267  // add a "sample" it is a full training set including some zeroes for the neurotrigger values (raw and scaled z and theta). Those are sometimes used in the training for reference, but cannot be added here without running *some* neuotrigger instance.
268  CDCTriggerMLPData::NeuroSet<27, 2> sample(m_NeuroTrigger.getInputVector(isector, hitIds).data(), target.data(),
269  evtmetadata->getExperiment(), evtmetadata->getRun(), evtmetadata->getSubrun(), evtmetadata->getEvent(), itrack, i,
270  m_tracks.getEntries(), 0, 0, 0, 0, phi0, theta, invpt);
271  //check whether we already have enough samples
272  m_trainSet[isector].addSample(sample);
273  if ((m_trainSet)[isector].nSamples() % 1000 == 0) {
274  B2DEBUG(50, m_trainSet[isector].nSamples() << " samples for training collected for sector " << isector);
275  }
276  std::ofstream gzipfile4(m_filename, std::ios_base::app | std::ios_base::binary);
277  boost::iostreams::filtering_ostream outStream;
278  outStream.push(boost::iostreams::gzip_compressor());
279  outStream.push(gzipfile4);
280  outStream << sample << std::endl;
281  m_trackcounter++;
282  }
283 
284  }
285  }
std::vector< CDCTriggerMLPData > m_trainSet
Sets of training data for all sectors.
bool m_trainOnRecoTracks
Switch between MCParticles or RecoTracks as targets.
NeuroTriggerParameters m_neuroParameters
Parameters for the NeuroTrigger.
NeuroTrigger m_NeuroTrigger
Instance of the NeuroTrigger.
std::string m_targetCollectionName
Name of the MCParticles/RecoTracks collection used as target values.
bool m_neuroTrackInputMode
Switch to rescale out of range target values or ignore them.
StoreArray< CDCTriggerTrack > m_tracks
List of input tracks.
std::string m_filename
Name of gzip file where the training data are saved.
bool m_singleUse
use a track only once and not for every expert
NNTParam< bool > rescaleTarget
flag to allow for target tracks lying out of the output range to be rescaled during training.
NNTParam< bool > targetTheta
train theta as output
NNTParam< bool > targetZ
train z as output
const std::string et_option() const
return the string variant ov the et option
void updateTrack(const CDCTriggerTrack &track)
Calculate 2D phi position and arclength for the given track and store them.
std::vector< unsigned > selectHits(unsigned isector, const CDCTriggerTrack &track, bool returnAllRelevant=false)
Select best hits for each super layer.
std::vector< float > getInputVector(unsigned isector, const std::vector< unsigned > &hitIds)
Calculate input values for MLP.
std::vector< unsigned > selectHitsHWSim(unsigned isector, const CDCTriggerTrack &track)
Select hits for each super layer from the ones related to input track.
std::vector< int > selectMLPsTrain(float phi0, float invpt, float theta)
Select all matching expert MLPs based on the given track parameters.
unsigned long getCompleteHitPattern(unsigned isector, const CDCTriggerTrack &track, const bool neurotrackinputmode)
Get complete hit pattern of neurotrack.
void getEventTime(unsigned isector, const CDCTriggerTrack &track, std::string et_option, const bool)
Read out the event time and store it.
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
#StateOnPlane with additional covariance matrix.
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition: B2Vector3.h:516

◆ event() [2/2]

void event ( void  )
overridevirtual

Called once for each event.

Prepare input and target for each track and store it.

Reimplemented from Module.

Definition at line 126 of file CDCTriggerNeuroIDHistModule.cc.

127  {
128  StoreObjPtr<EventMetaData> evtmetadata;
129  for (int itrack = 0; itrack < m_tracks.getEntries(); ++itrack) {
130  // get related MCParticle/RecoTrack for target
131  // and retrieve track parameters
132 
133  std::vector<float> targetvector = NeuroTrainer::getTrainTargets(m_trainOnRecoTracks, m_tracks[itrack], m_targetCollectionName);
134  if (targetvector[4] == 0) {
135  continue;
136  } // no valid representation found
137  float phi0Target = targetvector[0];
138  float invptTarget = targetvector[1];
139  float thetaTarget = targetvector[2];
140  float zTarget = targetvector[3];
141 
142 
143  // update 2D track variables
145 
146  // find all matching sectors
147  float phi0 = m_tracks[itrack]->getPhi0();
148  float invpt = m_tracks[itrack]->getKappa(1.5);
149  float theta = atan2(1., m_tracks[itrack]->getCotTheta());
150  std::vector<int> sectors = m_NeuroTrigger.selectMLPsTrain(phi0, invpt, theta);
151  if (sectors.size() == 0) continue;
152  // get target values
153  std::vector<float> targetRaw = {};
155  targetRaw.push_back(zTarget);
157  targetRaw.push_back(thetaTarget);
158  for (unsigned i = 0; i < sectors.size(); ++i) {
159  int isector = sectors[i];
160  std::vector<float> target = m_NeuroTrigger[isector].scaleTarget(targetRaw);
161  // skip out of range targets or rescale them
162  bool outOfRange = false;
163  for (unsigned itarget = 0; itarget < target.size(); ++itarget) {
164  if (fabs(target[itarget]) > 1.) {
165  outOfRange = true;
166  target[itarget] /= fabs(target[itarget]);
167  }
168  }
169  if (!m_neuroParameters.rescaleTarget && outOfRange) continue;
170  if (m_nPrepare == 0 || m_trainSets_prepare[isector].getTrackCounter() < m_nPrepare) {
171  // get relative ids for all hits related to the MCParticle / RecoTrack
172  // and count them to find relevant id range
173  // using only related hits suppresses background EXCEPT for curling tracks
174  if (m_trainOnRecoTracks) {
175  RecoTrack* recoTrack =
176  m_tracks[itrack]->getRelatedTo<RecoTrack>(m_targetCollectionName);
177  for (const CDCTriggerSegmentHit& hit :
178  recoTrack->getRelationsTo<CDCTriggerSegmentHit>(m_hitCollectionName)) {
179  // get relative id
180  double relId = m_NeuroTrigger.getRelId(hit);
181  m_trainSets_prepare[isector].addHit(hit.getISuperLayer(), round(relId));
182  }
183  } else {
184  MCParticle* mcTrack =
185  m_tracks[itrack]->getRelatedTo<MCParticle>(m_targetCollectionName);
186  for (const CDCTriggerSegmentHit& hit :
187  mcTrack->getRelationsTo<CDCTriggerSegmentHit>(m_hitCollectionName)) {
188  // get relative id
189  double relId = m_NeuroTrigger.getRelId(hit);
190  m_trainSets_prepare[isector].addHit(hit.getISuperLayer(), round(relId));
191  }
192  }
193  m_trainSets_prepare[isector].countTrack();
194  }
195  }
196  }
197  bool stop = true;
198  for (unsigned isector = 0; isector < m_trainSets_prepare.size(); ++isector) {
199  if (m_nPrepare == 0 || m_trainSets_prepare[isector].getTrackCounter() < m_nPrepare) {
200  stop = false;
201  break;
202  }
203  }
204  if (stop) {
205  B2INFO("Training sample preparation for NeuroTrigger finished, stopping event loop.");
206  // if required hit number is reached, get relevant ids
207  StoreObjPtr<EventMetaData> eventMetaData;
208  eventMetaData->setEndOfData();
209  }
210  }
bool m_trainOnRecoTracks
Switch between MCParticles or RecoTracks as targets.
NeuroTriggerParameters m_neuroParameters
Parameters for the NeuroTrigger.
NeuroTrigger m_NeuroTrigger
Instance of the NeuroTrigger.
std::string m_targetCollectionName
Name of the MCParticles/RecoTracks collection used as target values.
StoreArray< CDCTriggerTrack > m_tracks
List of input tracks.
std::vector< CDCTriggerMLPData > m_trainSets_prepare
dataset for all idhist prepare data
int m_nPrepare
Number of samples to prepare input ranges.
double getRelId(const CDCTriggerSegmentHit &hit)
Calculate phi position of a hit relative to 2D track (scaled to number of wires).

◆ initialize() [1/2]

void initialize ( void  )
overridevirtual

Initialize the module.

Initialize the networks and register datastore objects.

Reimplemented from Module.

Definition at line 83 of file CDCTriggerNeuroDataModule.cc.

◆ initialize() [2/2]

void initialize ( void  )
overridevirtual

Initialize the module.

Initialize the networks and register datastore objects.

First Initialize the neurotrigger object, which is needed because of the original structure of the training procedure in the old module. Second, the dataset for the idhist data will be initialized and set up.

Reimplemented from Module.

Definition at line 70 of file CDCTriggerNeuroIDHistModule.cc.