Belle II Software development
trg modules

Classes

class  CDCTriggerNeuroDQMModule
 CDC Trigger DQM Module. More...
 
class  CDCTriggerNeuroDQMOnlineModule
 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  TRGEFFDQMModule
 Make summary of data quality from reconstruction. 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  TRGGRLInjectionVetoFromOverlayModule
 Module for adding to MC samples the information about the TRG active veto from beam background overlay files. More...
 
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  klmtrgLayerCounter
 
class  klmtrgLinearFit
 
class  KLMTriggerModule
 
struct  track_maker_t
 
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, ROOT::Math::XYVector > 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< ROOT::Math::XYVector, ROOT::Math::XYVector > 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.
 
int countBits (uint64_t n)
 
template<typename CONTAINER_T>
uint64_t to_bit_mask (const CONTAINER_T &container)
 
void bitshift (int64_t &out, int64_t &shift, int64_t in, int64_t deltashift)
 
template<typename T>
constexpr int64_t get_index (const T &e, int track_id=0)
 
 CDCTriggerNeuroDataModule ()
 Constructor, for setting module description and parameters.
 
virtual void initialize () override
 Initialize the module.
 
virtual void event () override
 Called once for each event.
 
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.
 
virtual void event () override
 Called once for each event.
 
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
 Initializes 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
 Initializes 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
 Initializes 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
 Initializes 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
 Initializes 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 ()
 Constructor.
 
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
 Initializes 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
 Initializes 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
 Initializes 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.
 
void clear_layersUsed ()
 
void add_layersUsed (int layersUsed)
 
void set_NLayerTrigger (int NlayerTrigger)
 
void run (const KLM_TRG_definitions::KLM_Digit_compact_ts &hits)
 
int get_n_sections_trig (int subdetector)
 
int get_triggermask (int subdetector, int section)
 
int get_BKLM_back_to_back_flag (int subdetector)
 
void clear_geometry ()
 
void add_geometry (const KLM_TRG_definitions::KLM_geo_fit_t &geometry)
 
void run (const KLM_TRG_definitions::KLM_Digit_compact_ts &hits)
 
const KLM_TRG_definitions::KLM_trig_linear_fits & get_result () const
 
int get_triggermask (int subdetector, int section)
 
int get_triggermask_or (int subdetector, int section)
 
void set_y_cutoff (int cutoff)
 
void set_intercept_cutoff (int cutoff)
 

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

Typedef Documentation

◆ cdcMap

typedef std::map< int, cdcPair > cdcMap

Map of <counter, cdcPair>, for hits with indices.

Definition at line 37 of file CDCTriggerHoughETFModule.h.

◆ cdcPair

typedef std::pair< unsigned short, ROOT::Math::XYVector > cdcPair

Pair of <iSuperLayer, (x, y)>, for hits in conformal space.

Definition at line 35 of file CDCTriggerHoughETFModule.h.

◆ coord2dPair

typedef std::pair< ROOT::Math::XYVector, ROOT::Math::XYVector > coord2dPair

Hough Tuples.

Definition at line 39 of file CDCTriggerHoughETFModule.h.

◆ MergerBits

Merger data bus Bitstream.

Definition at line 55 of file CDCTriggerUnpackerModule.h.

◆ MergerBus

using MergerBus = std::array<std::bitset<mergerWidth>, nAllMergers>

Merger data bus.

Definition at line 53 of file CDCTriggerUnpackerModule.h.

◆ NodeList

using NodeList = std::vector<std::vector<int> >

Node list.

Definition at line 42 of file CDCTriggerUnpackerModule.h.

Function Documentation

◆ add_geometry()

void add_geometry ( const KLM_TRG_definitions::KLM_geo_fit_t & geometry)

Definition at line 154 of file klmtrgLinearFit.cc.

155 {
156
157 m_KLMgeomap[get_index(geometry)] = geo_KLM_t{
158 geometry.slopeX,
159 geometry.offsetX,
160 geometry.slopeY,
161 geometry.offsetY
162 };
163
164
165 }

◆ add_layersUsed()

void add_layersUsed ( int layersUsed)

Definition at line 44 of file klmtrgLayerCounter.cc.

45 {
46 m_layersUsed.emplace_back(layersUsed);
47 }

◆ beginRun() [1/9]

void beginRun ( void )
overridevirtual

Called when new run started.

Reimplemented from Module.

Definition at line 353 of file TRGCDCModule.cc.

354 {
355 if (TRGDebug::level())
356 cout << "TRGCDCModule ... beginRun called " << endl;
357 }

◆ beginRun() [2/9]

void beginRun ( void )
overridevirtual

Called when new run started.

Reimplemented from Module.

Definition at line 102 of file TRGCDCTSStreamModule.cc.

103 {
104
105 _cdc = TRGCDC::getTRGCDC();
106
107 //...Super layer loop...
108 for (unsigned l = 0; l < _cdc->nSegmentLayers(); l++) {
109 const Belle2::TRGCDCLayer* lyr = _cdc->segmentLayer(l);
110 const unsigned nWires = lyr->nCells();
111
112 //...Clear old pointers...
113 _wires[l].clear();
114
115 //...TS loop...
116 for (unsigned i = 0; i < nWires; i++) {
117 const TCSegment& s = (TCSegment&) * (* lyr)[i];
118 _wires[l].push_back(s.wires()[5]);
119 }
120 }
121
122 if (_out) {
123 unsigned val = TRGBSRecord_BeginRun;
124 _out->write((char*) & val, 4);
125 val = 0;
126 _out->write((char*) & val, 4);
127 }
128
129 if (TRGDebug::level())
130 cout << "TRGCDCTSStreamModule ... beginRun called. TRGCDC version="
131 << _cdc->version() << endl;
132 }
unsigned nCells(void) const
returns # of cells.
Definition Layer.h:194

◆ beginRun() [3/9]

void beginRun ( void )
overridevirtual

Called when new run started.

Reimplemented from Module.

Definition at line 103 of file TRGECLBGTCHitModule.cc.

104 {
105 B2DEBUG(200, "TRGECLBGTCHitModule ... beginRun called ");
106 }

◆ beginRun() [4/9]

void beginRun ( void )
overridevirtual

Called when new run started.

Reimplemented from Module.

Definition at line 131 of file TRGECLFAMModule.cc.

132 {
133 if (_ConditionDB == 0) {
134 Threshold.resize(576, _threshold);
135 } else if (_ConditionDB == 1) { //Use global tag
136 Threshold.resize(576, 0);
137 for (const auto& para : m_FAMPara) {
138 Threshold[para.getTCId() - 1] = (int)((para.getThreshold()) * (para.getConversionFactor()));
139 }
140 }
141
142 B2DEBUG(200, "TRGECLFAMModule ... beginRun called ");
143
144 }

◆ beginRun() [5/9]

void beginRun ( void )
overridevirtual

Called when new run started.

Reimplemented from Module.

Definition at line 255 of file TRGECLModule.cc.

256 {
257 if (_ConditionDB == 1) {
258 for (const auto& para : m_ETMPara) {
259 _TotalEnergy = {(double)para.getELow(),
260 (double)para.getELow(),
261 (double)para.getELow()
262 };
263 for (int index = 0; index < 14; index ++) {
264 _2DBhabhaThresholdFWD.push_back((double)para.get2DBhabhaFWD(index));
265 _2DBhabhaThresholdBWD.push_back((double)para.get2DBhabhaBWD(index));
266 }
267 _3DBhabhaVetoThreshold = {
268 (double)para.get3DBhabhaVetoThreshold(0),
269 (double)para.get3DBhabhaVetoThreshold(1)
270 }; // /100 MeV
271 _3DBhabhaSelectionThreshold = {
272 (double)para.get3DBhabhaSelectionThreshold(0),
273 (double)para.get3DBhabhaSelectionThreshold(1)
274 }; // /100 MeV
275 _3DBhabhaVetoAngle = {
276 (double)para.get3DBhabhaVetoAngle(0),
277 (double)para.get3DBhabhaVetoAngle(1),
278 (double)para.get3DBhabhaVetoAngle(2),
279 (double)para.get3DBhabhaVetoAngle(3)
280 };
281 _3DBhabhaSelectionAngle = {
282 (double)para.get3DBhabhaSelectionAngle(0),
283 (double)para.get3DBhabhaSelectionAngle(1),
284 (double)para.get3DBhabhaSelectionAngle(2),
285 (double)para.get3DBhabhaSelectionAngle(3)
286 };
287 _mumuThreshold =
288 (double)(para.getmumuThreshold());
289 _mumuAngle = {
290 (double)para.getmumuAngle(0),
291 (double)para.getmumuAngle(1),
292 (double)para.getmumuAngle(2)
293 };
294 _LowMultiThreshold = {
295 (double)para.getLowMultiThreshold(0),
296 (double)para.getLowMultiThreshold(1),
297 (double)para.getLowMultiThreshold(2),
298 (double)para.getLowMultiThreshold(3)
299 }; // /100 MeV
300 }
301 }
302
303 B2INFO("[TRGECLModule] 3DBhabhaVetoInTrackThetaRegion (low : high) = ("
304 << m_3DBhabhaVetoInTrackThetaRegion[0] << " : "
305 << m_3DBhabhaVetoInTrackThetaRegion[1] << ")");
306
307 B2INFO("[TRGECLModule] EventTimingQualityThresholds (low : high)= ("
308 << m_EventTimingQualityThresholds[0] << " : "
309 << m_EventTimingQualityThresholds[1] << ") (GeV)");
310
311 B2INFO("[TRGECLModule] Taub2b two CL Angle cut in CM (degree) (dphi L, H, theta sum L, H ) = ("
312 << m_taub2bAngleCut[0] << ","
313 << m_taub2bAngleCut[1] << ","
314 << m_taub2bAngleCut[2] << ","
315 << m_taub2bAngleCut[3] << ")");
316 B2INFO("[TRGECLModule] Taub2b Total Energy Cut in lab. (GeV) = "
317 << m_taub2bEtotCut);
318 B2INFO("[TRGECLModule] Taub2b Cluster Energy Cut in lab. (GeV) : (E(CL1), E(CL2)) = ("
319 << m_taub2bClusterECut1 << ", "
320 << m_taub2bClusterECut2 << ")");
321 B2INFO("[TRGECLModule] Bhabha Add Angle cut in CM (degree) (dphi L, H, theta sum L, H) = ("
322 << m_3DBhabhaAddAngleCut[0] << ","
323 << m_3DBhabhaAddAngleCut[1] << ","
324 << m_3DBhabhaAddAngleCut[2] << ","
325 << m_3DBhabhaAddAngleCut[3] << ")");
326
327 B2INFO("[TRGECLModule] Taub2b2 two CL Angle cut in CM (degree) (dphi L, H, theta sum L, H) = ("
328 << m_taub2b2AngleCut[0] << ","
329 << m_taub2b2AngleCut[1] << ","
330 << m_taub2b2AngleCut[2] << ","
331 << m_taub2b2AngleCut[3] << ")");
332 B2INFO("[TRGECLModule] Taub2b2 Total Energy Cut in lab. (GeV) = "
333 << m_taub2b2EtotCut);
334 B2INFO("[TRGECLModule] Taub2b2 Energy Cut in lab. for cluster in endcap (GeV) = "
335 << m_taub2b2CLEEndcapCut);
336 B2INFO("[TRGECLModule] Taub2b2 Cluster energy cut in lab. (GeV) = "
337 << m_taub2b2CLECut);
338
339 B2INFO("[TRGECLModule] Taub2b3 two CL Angle cut in CM (degree) (dphi L, H, theta sum L, H) = ("
340 << m_taub2b3AngleCut[0] << ","
341 << m_taub2b3AngleCut[1] << ","
342 << m_taub2b3AngleCut[2] << ","
343 << m_taub2b3AngleCut[3] << ")");
344 B2INFO("[TRGECLModule] Taub2b3 Total Energy Cut in lab. (GeV) = "
345 << m_taub2b3EtotCut);
346 B2INFO("[TRGECLModule] Taub2b3 Cluster energy cut in lab. for one of b2b clusters (GeV) = "
347 << m_taub2b3CLEb2bCut);
348 B2INFO("[TRGECLModule] Taub2b3 Cluster energy low cut in lab. for all clusters (GeV) = "
349 << m_taub2b3CLELowCut);
350 B2INFO("[TRGECLModule] Taub2b3 Cluster energy high cut in lab. for all clusters(GeV) = "
351 << m_taub2b3CLEHighCut);
352
353 if (TRGDebug::level()) {
354 std::cout << "TRGECLModule ... beginRun called " << std::endl;
355 }
356 // _ecl = TrgEcl::getTrgEcl();
357
358 }

◆ beginRun() [6/9]

void beginRun ( void )
overridevirtual

begin Run

Reimplemented from Module.

Definition at line 133 of file TRGECLQAMModule.cc.

134 {
135
136 B2DEBUG(200, "TRGECLQAMModule ... beginRun called ");
137
138 }

◆ beginRun() [7/9]

void beginRun ( void )
overridevirtual

Called when new run started.

Reimplemented from Module.

Definition at line 97 of file TRGECLRawdataAnalysisModule.cc.

98 {
99
100 if (TRGDebug::level()) {
101 std::cout << "TRGECLRawdataAnalysisModule ... beginRun called " << std::endl;
102 }
103 // _ecl = TrgEcl::getTrgEcl();
104
105 }

◆ beginRun() [8/9]

void beginRun ( void )
overridevirtual

Called when new run started.

Reimplemented from HistoModule.

Definition at line 147 of file TRGGDLModule.cc.

148 {
149
150 //...GDL config. name...
151 string cfn = _configFilename;
152
153 //...GDL...
154 if (_gdl == 0) {
155 _gdl = TRGGDL::getTRGGDL(cfn,
156 _simulationMode,
157 _fastSimulationMode,
158 _firmwareSimulationMode,
159 _Phase,
160 _algFromDB,
161 _algFilePath,
162 _debugLevel,
163 _timquality_threshold_sfin,
164 _timquality_threshold_fine);
165 } else if (cfn != _gdl->configFile()) {
166 _gdl = TRGGDL::getTRGGDL(cfn,
167 _simulationMode,
168 _fastSimulationMode,
169 _firmwareSimulationMode,
170 _Phase,
171 _algFromDB,
172 _algFilePath,
173 _debugLevel,
174 _timquality_threshold_sfin,
175 _timquality_threshold_fine);
176 }
177 if (_debugLevel > 9) printf("TRGGDLModule::beginRun() ends.\n");
178
179 _gdl->checkDatabase();
180
181 B2DEBUG(100, "TRGGDLModule ... beginRun called configFile = " << cfn);
182 }

◆ beginRun() [9/9]

void beginRun ( void )
overridevirtual

Called when new run started.

Reimplemented from Module.

Definition at line 86 of file TRGGRLModule.cc.

87 {
88
89 //...GDL config. name...
90 string cfn = _configFilename;
91
92 //...GRL...
93 if (_grl == 0) {
94 _grl = TRGGRL::getTRGGRL(cfn,
95 _simulationMode,
96 _fastSimulationMode,
97 _firmwareSimulationMode);
98 } else if (cfn != _grl->configFile()) {
99 _grl = TRGGRL::getTRGGRL(cfn,
100 _simulationMode,
101 _fastSimulationMode,
102 _firmwareSimulationMode);
103 }
104
105 B2DEBUG(300, "TRGGDLModule ... beginRun called configFile = " << cfn);
106
107 }

◆ bitshift()

void bitshift ( int64_t & out,
int64_t & shift,
int64_t in,
int64_t deltashift )

Definition at line 31 of file klmtrgLinearFit.cc.

32 {
33 int64_t mask = 0xFFFFFF;
34 if (((mask << deltashift) & in) > 0) {
35 throw std::runtime_error("bitshift error");
36 }
37
38 out |= (in << shift);
39 shift += deltashift;
40 }

◆ CDCTriggerNeuroDataModule()

Constructor, for setting module description and parameters.

Definition at line 42 of file CDCTriggerNeuroDataModule.cc.

42 : Module()
43 {
44 setDescription(
45 "This module takes 2dtracks, track segments, and targettracks (either recotracks or mcparticles) as input and generates training data for the neurotrigger in a tab separated, gzip compressed file."
46 );
47 // parameters for saving / loading
48 addParam("hitCollectionName", m_hitCollectionName,
49 "Name of the input StoreArray of CDCTriggerSegmentHits. The Axials need to have a relation to inputtracks",
50 std::string(""));
51 addParam("inputCollectionName", m_inputCollectionName,
52 "Name of the StoreArray holding the 2D input tracks.",
53 std::string("CDCTriggerNNInput2DTracks"));
54 addParam("targetCollectionName", m_targetCollectionName,
55 "Name of the MCParticle/RecoTrack collection used as target values.",
56 std::string("RecoTracks"));
57 addParam("trainOnRecoTracks", m_trainOnRecoTracks,
58 "If true, use RecoTracks as targets instead of MCParticles.",
59 true);
60 addParam("EventTimeName", m_EventTimeName,
61 "Name of the event time object.",
62 std::string("CDCTriggerNeuroETFT0"));
63 addParam("NeuroTrackInputMode", m_neuroTrackInputMode,
64 "When using real tracks, use neurotracks instead of 2dtracks as input to the neurotrigger. this is important to get the relations right.",
65 false);
66 addParam("singleUse", m_singleUse,
67 "Only use a track for a single expert", true);
68 addParam("configFileName", m_configFileName,
69 "Name of the configuration file. This File should be created by the CDCTriggerIDHistModule and will be extended in this module",
70 std::string(""));
71 addParam("writeconfigFileName", m_writeconfigFileName,
72 "Name of the configuration file, which will be written. If left blank, the same file as the input configuration file is used and it will be overwritten.",
73 std::string(""));
74 addParam("gzipFilename", m_filename,
75 "Name of the gzip file, where the training samples will be saved.",
76 std::string("out.gz"));
77
78
79
80
81 }

◆ CDCTriggerNeuroIDHistModule()

Constructor, for setting module description and parameters.

Definition at line 38 of file CDCTriggerNeuroIDHistModule.cc.

38 : Module()
39 {
40 setDescription(
41 "description" //TODO
42 );
43 // parameters for saving / loading
44 addParam("hitCollectionName", m_hitCollectionName,
45 "Name of the input StoreArray of CDCTriggerSegmentHits.",
46 std::string(""));
47 addParam("inputCollectionName", m_inputCollectionName,
48 "Name of the StoreArray holding the 2D input tracks.",
49 std::string("TRGCDC2DFinderTracks"));
50 addParam("trainOnRecoTracks", m_trainOnRecoTracks,
51 "If true, use RecoTracks as targets instead of MCParticles.",
52 false);
53 addParam("targetCollectionName", m_targetCollectionName,
54 "Name of the MCParticle/RecoTrack collection used as target values.",
55 std::string("MCParticles"));
56 addParam("writeconfigfile", m_writeconfigFileName,
57 "Name of the config file, where all the parameters and the IDHist configuration is written.",
58 std::string(""));
59 addParam("configfile", m_configFileName,
60 "Name of the config file, where all the parameters and the IDHist configuration is read in from.",
61 std::string(""));
62 addParam("MaxEvents", m_nPrepare,
63 "amount of events used for creating the IDHist. If it is 0, "
64 "all Events are used.",
65 0);
66
67 }

◆ clear_geometry()

void clear_geometry ( )

Definition at line 148 of file klmtrgLinearFit.cc.

149 {
150 m_KLMgeomap.clear();
151
152 }

◆ clear_layersUsed()

void clear_layersUsed ( )

Definition at line 39 of file klmtrgLayerCounter.cc.

40 {
41 m_layersUsed.clear();
42 }

◆ countBits()

int countBits ( uint64_t n)
inline

Definition at line 21 of file bit_operations.h.

22 {
23 return static_cast<int>(std::bitset<64>(n).count());
24 }

◆ defineHisto()

void defineHisto ( )
overridevirtual

Define Histogram.

Reimplemented from HistoModule.

Definition at line 109 of file TRGGDLModule.cc.

110 {
111
112 oldDir = gDirectory;
113 newDir = gDirectory;
114 oldDir->mkdir("TRGGDLModule");
115 newDir->cd("TRGGDLModule");
116
117 h_inp = new TH1I("hTRGGDL_inp", "input bits from TRGGDLModule", 200, 0, 200);
118 h_ftd = new TH1I("hTRGGDL_ftd", "ftdl bits from TRGGDLModule", 200, 0, 200);
119 h_psn = new TH1I("hTRGGDL_psn", "psnm bits from TRGGDLModule", 200, 0, 200);
120
121 oldDir->cd();
122
123 }

◆ endRun() [1/9]

void endRun ( void )
overridevirtual

Called when run ended.

Reimplemented from Module.

Definition at line 391 of file TRGCDCModule.cc.

392 {
393 if (TRGDebug::level())
394 cout << "TRGCDCModule ... endRun called " << endl;
395 }

◆ endRun() [2/9]

void endRun ( void )
overridevirtual

Called when run ended.

Reimplemented from Module.

Definition at line 203 of file TRGCDCTSStreamModule.cc.

204 {
205 if (_out) {
206 unsigned val = TRGBSRecord_EndRun;
207 _out->write((char*) & val, 4);
208 val = 0;
209 _out->write((char*) & val, 4);
210 }
211
212 if (TRGDebug::level())
213 cout << "TRGCDCTSStreamModule ... endRun called " << endl;
214 }

◆ endRun() [3/9]

void endRun ( void )
overridevirtual

Called when run ended.

Reimplemented from Module.

Definition at line 125 of file TRGECLBGTCHitModule.cc.

126 {
127 B2DEBUG(200, "TRGECLBGTCHitModule ... endRun called ");
128 }

◆ endRun() [4/9]

void endRun ( void )
overridevirtual

Called when run ended.

Reimplemented from Module.

Definition at line 233 of file TRGECLFAMModule.cc.

234 {
235 B2DEBUG(200, "TRGECLFAMModule ... endRun called ");
236 }

◆ endRun() [5/9]

void endRun ( void )
overridevirtual

Called when run ended.

Reimplemented from Module.

Definition at line 428 of file TRGECLModule.cc.

429 {
430 if (TRGDebug::level()) {
431 std::cout << "TRGECLModule ... endRun called " << std::endl;
432 }
433 }

◆ endRun() [6/9]

void endRun ( void )
overridevirtual

End Run.

Reimplemented from Module.

Definition at line 202 of file TRGECLQAMModule.cc.

203 {
204
205 double mean_FWD = 0;
206 double mean_BAR = 0;
207 double mean_BWD = 0;
208
209 //QAM TC Hit Map Check
210 for (int TCId = 1; TCId < 577; TCId++) {
211 if (TCId < 81) { //Forward Endcap
212 mean_FWD += TCID[TCId - 1];
213 } else if (TCId < 513) { //Barrel
214 mean_BAR += TCID[TCId - 1];
215 } else { //Backward Endcap
216 mean_BWD += TCID[TCId - 1];
217 }
218 }
219 mean_FWD /= 80;
220 mean_BAR /= (512 - 80);
221 mean_BWD /= (576 - 512);
222
223 for (int TCId = 1; TCId < 577; TCId++) {
224 if (TCId < 81) { //Forward Endcap
225 if (TCID[TCId - 1] < mean_FWD * 0.1)m_FWD++;
226 } else if (TCId < 513) { //Barrel
227 if (TCID[TCId - 1] < mean_BAR * 0.1)m_BAR++;
228 } else { //Backward Endcap
229 if (TCID[TCId - 1] < mean_BWD * 0.1)m_BWD++;
230 }
231 }
232
233 m_ALL = m_FWD + m_BAR + m_BWD;
234 const int etot_size = etot.size();
235 for (int i = 0; i < etot_size; i++) {
236 h_etot->Fill(etot[i]);
237 }
238 //Caluate E_total peak and width
239
240 RooRealVar* E_tot = new RooRealVar("E_tot", "E_tot", 0, 4000);
241 RooDataHist* data_E_tot = new RooDataHist("data_E_tot", "dataset with E_tot", *E_tot, h_etot);
242 RooRealVar* mean_check = new RooRealVar("mean_check", "Mean for checking", 2000, 1000, 3000);
243 RooRealVar* sigma_check = new RooRealVar("sigma_check", "Sigma for checking", 100, 0, 300);
244 RooGaussian* gauss_check = new RooGaussian("gauss_check", "Gaussian for checking", *E_tot, *mean_check, *sigma_check);
245 gauss_check->fitTo(*data_E_tot);
246 double mean_ch = mean_check->getVal();
247
248 RooRealVar* mean_E_tot = new RooRealVar("mean_E_tot", "Mean of Gaussian", mean_ch, mean_ch - 200, mean_ch + 200);
249 // RooRealVar sigma_E_tot("sigma_E_tot","Width of Gaussian", 10, 0, 50);
250
251 RooRealVar* sigma1_E_tot = new RooRealVar("sigma1_E_tot", "Width of Gaussian", 30, 0, 60);
252 RooGaussian* gauss1_E_tot = new RooGaussian("gauss1_E_tot", "gauss(x,mean,sigma)", *E_tot, *mean_E_tot, *sigma1_E_tot);
253 RooRealVar* sigma2_E_tot = new RooRealVar("sigma2_E_tot", "Width of Gaussian", 100, 30, 250);
254 RooGaussian* gauss2_E_tot = new RooGaussian("gauss2_E_tot", "gauss(x,mean,sigma)", *E_tot, *mean_E_tot, *sigma2_E_tot);
255
256 RooRealVar* frac_core_E_tot = new RooRealVar("frac_core", "core fraction", 0.85, 0.0, 1.0);
257 RooAddModel* gaussm_E_tot = new RooAddModel("gaussm", "core+tail gauss", RooArgList(*gauss1_E_tot, *gauss2_E_tot),
258 RooArgList(*frac_core_E_tot));
259
260 // RooGaussian gauss_E_tot("gauss_E_tot","gauss(x,mean,sigma)",E_tot,mean_E_tot,sigma_E_tot);
261
262 gaussm_E_tot->fitTo(*data_E_tot, RooFit::Range(mean_ch - 300, mean_ch + 300));
263 //RooPlot* xframe_E_tot = E_tot->frame();
264 RooPlot* xframe_E_tot = E_tot->frame(RooFit::Title("energy_tot"));
265 //data_E_tot->plotOn(xframe_E_tot);
266 data_E_tot->plotOn(xframe_E_tot, RooFit::MarkerStyle(7));
267 // gauss_E_tot->plotOn(xframe_E_tot);
268 gaussm_E_tot->plotOn(xframe_E_tot, RooFit::Name("Cal_energy"), RooFit::LineColor(2));
269 double v_m_E_tot = mean_E_tot->getVal();
270 double e_m_E_tot = mean_E_tot->getError();
271
272 double v1_s1_E_tot = sigma1_E_tot->getVal();
273 // double e1_s1_E_tot = sigma1_E_tot->getError();
274 double v2_s1_E_tot = sigma2_E_tot->getVal();
275 // double e2_s1_E_tot = sigma2_E_tot->getError();
276
277 double frac_E_tot = frac_core_E_tot->getVal();
278 double v_s1_E_tot = v1_s1_E_tot * (frac_E_tot) + v2_s1_E_tot * (1 - frac_E_tot);
279
280
281
282 for (long unsigned int ii = 0; ii < caltime.size(); ii++) {
283 h_caltime->Fill(caltime[ii]);
284 }
285
286
287 //Calculate Caltime peak and width
288 RooRealVar T_c("T_c", "T_c", -100, 100);
289 RooDataHist data_T_c("data_T_c", "dataset with T_c", T_c, h_caltime);
290
291 RooRealVar mean_T_c("mean_T_c", "Mean of Gaussian", 0, -100, 100);
292 RooRealVar sigma1_T_c("sigma1_T_c", "Width of Gaussian", 10, 0, 50);
293 RooGaussian gauss1_T_c("gauss1_T_c", "gauss(x,mean,sigma)", T_c, mean_T_c, sigma1_T_c);
294 RooRealVar sigma2_T_c("sigma2_T_c", "Width of Gaussian", 30, 10, 100);
295 RooGaussian gauss2_T_c("gauss2_T_c", "gauss(x,mean,sigma)", T_c, mean_T_c, sigma2_T_c);
296
297 RooRealVar frac_core_T_c("frac_core", "core fraction", 0.85, 0.0, 1.0);
298 RooAddModel gaussm_T_c("gaussm", "core+tail gauss", RooArgList(gauss1_T_c, gauss2_T_c), RooArgList(frac_core_T_c));
299
300 gaussm_T_c.fitTo(data_T_c, RooFit::Range(-45, 45));
301 RooPlot* xframe_T_c = T_c.frame(RooFit::Title("Caltime"));
302 data_T_c.plotOn(xframe_T_c, RooFit::MarkerStyle(7));
303 gaussm_T_c.plotOn(xframe_T_c, RooFit::Name("Caltime"), RooFit::LineColor(2));
304 gaussm_T_c.plotOn(xframe_T_c, RooFit::Components("gauss1_T_c"), RooFit::LineColor(kGreen));
305 gaussm_T_c.plotOn(xframe_T_c, RooFit::Components("gauss2_T_c"), RooFit::LineColor(kMagenta));
306
307 xframe_T_c->GetXaxis()->SetTitle("Caltime[ns]");
308 xframe_T_c->GetYaxis()->SetTitle("Entries");
309
310 double v_m_T_c = mean_T_c.getVal();
311 double e_m_T_c = mean_T_c.getError();
312
313 double v1_s1_T_c = sigma1_T_c.getVal();
314 // double e1_s1_T_c = sigma1_T_c.getError();
315 double v2_s1_T_c = sigma2_T_c.getVal();
316 // double e2_s1_T_c = sigma2_T_c.getError();
317
318 double frac_T_c = frac_core_T_c.getVal();
319 double v_s1_T_c = v1_s1_T_c * (frac_T_c) + v2_s1_T_c * (1 - frac_T_c);
320
321
322
323 //Cluster E sum for Bhabha skim
324 const int cluster_size = cluster.size();
325 for (int ii = 0; ii < cluster_size; ii++) {
326 h_clusterE->Fill(cluster[ii]);
327 }
328
329 RooRealVar x("x", "esum", 0, 4000);
330 RooDataHist dh("dh", "ecltrg", x, h_clusterE);
331
332 RooRealVar mean("mean", "mean", 2000, 1000, 2500);
333 RooRealVar sigma("sigma", "sigma", 150, 0, 300);
334 RooRealVar tail("tail", "tail", 0.45, 0, 1);
335 RooNovosibirsk novo("novo", "", x, mean, sigma, tail);
336 novo.fitTo(dh, RooFit::Extended(0), RooFit::Range(1500, 2200));
337
338
339 double clusterE_vm, clusterE_em, clusterE_vs;
340
341 clusterE_vm = mean.getVal();
342 clusterE_em = mean.getError();
343 clusterE_vs = sigma.getVal();
344
345
346 TString outputfile = m_outputfile;
347 TFile file(outputfile, "RECREATE");
348 TTree* tree = new TTree("tree", "tree");
349 int nevent;
350 double FWD;
351 double BAR;
352 double BWD;
353 double ALL;
354
355 nevent = m_nevent;
356 FWD = m_FWD;
357 BAR = m_BAR;
358 BWD = m_BWD;
359 ALL = m_ALL;
360
361 m_etot_mean = v_m_E_tot;
362 m_etot_error = e_m_E_tot;
363 m_etot_sigma = v_s1_E_tot;
364
365 m_caltime_mean = v_m_T_c;
366 m_caltime_error = e_m_T_c;
367 m_caltime_sigma = v_s1_T_c;
368
369 tree->Branch("m_nRun", &m_nRun, "m_nRun/I");
370 tree->Branch("m_nevent", &nevent, "m_nevent/I");
371 tree->Branch("m_FWD", &FWD, "m_FWD/D");
372 tree->Branch("m_BAR", &BAR, "m_BAR/D");
373 tree->Branch("m_BWD", &BWD, "m_BWD/D");
374 tree->Branch("m_ALL", &ALL, "m_ALL/D");
375 tree->Branch("m_etot_mean", &m_etot_mean, "m_etot_mean/D");
376 tree->Branch("m_etot_error", &m_etot_error, "m_etot_error/D");
377 tree->Branch("m_etot_sigma", &m_etot_sigma, "m_etot_sigma/D");
378 tree->Branch("m_caltime_mean", &m_caltime_mean, "m_caltime_mean/D");
379 tree->Branch("m_caltime_error", &m_caltime_error, "m_caltime_error/D");
380 tree->Branch("m_caltime_sigma", &m_caltime_sigma, "m_caltime_sigma/D");
381 tree->Branch("m_clusterE_mean", &clusterE_vm, "m_clusterE_mean/D");
382 tree->Branch("m_clusterE_error", &clusterE_em, "m_clusterE_error/D");
383 tree->Branch("m_clusterE_sigma", &clusterE_vs, "m_clusterE_sigma/D");
384
385 tree->Fill();
386 tree->Write();
387 file.Close();
388
389
390
391 B2INFO("ECL Trigger QAM result "
392 << LogVar("Run Number", m_nRun)
393 << LogVar("Total Event", nevent)
394 << LogVar("The # of Low Hit TC in Forward Endcap", FWD)
395 << LogVar("The # of Low Hit TC in Barrel", BAR)
396 << LogVar("The # of Low Hit TC in Backward Endcap", BWD)
397 << LogVar("Total Energy Peak", m_etot_mean)
398 << LogVar("Total Energy Peak width", m_etot_sigma)
399 << LogVar("Caltime Peak", m_caltime_mean)
400 << LogVar("Caltime Peak width", m_caltime_sigma)
401 << LogVar("Cluster Energy Peak", clusterE_vm)
402 << LogVar("Cluster Energy Peak width", clusterE_vs));
403
404
405 B2DEBUG(100, "TRGECLQAMModule ... endRun called ");
406
407 }

◆ endRun() [7/9]

void endRun ( void )
overridevirtual

Called when run ended.

Reimplemented from Module.

Definition at line 184 of file TRGECLRawdataAnalysisModule.cc.

185 {
186 if (TRGDebug::level()) {
187 std::cout << "TRGECLRawdataAnalysisModule ... endRun called " << std::endl;
188 }
189 }

◆ endRun() [8/9]

void endRun ( void )
overridevirtual

Called when run ended.

Reimplemented from HistoModule.

Definition at line 212 of file TRGGDLModule.cc.

213 {
214 B2DEBUG(200, "TRGGDLModule ... endRun called ");
215 }

◆ endRun() [9/9]

void endRun ( void )
overridevirtual

Called when run ended.

Reimplemented from Module.

Definition at line 120 of file TRGGRLModule.cc.

121 {
122 B2DEBUG(300, "TRGGRLModule ... endRun called ");
123 }

◆ event() [1/11]

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 {
163 genfit::MeasuredStateOnPlane state =
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 }
199 m_NeuroTrigger.updateTrack(*m_tracks[itrack]);
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 = {};
210 if (m_neuroParameters.targetZ)
211 targetRaw.push_back(zTarget);
212 if (m_neuroParameters.targetTheta)
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
230 m_NeuroTrigger.getEventTime(isector, *m_tracks[itrack], m_neuroParameters.et_option(), m_neuroTrackInputMode);
231 // check hit pattern
232 unsigned long hitPattern = m_NeuroTrigger.getCompleteHitPattern(isector, *m_tracks[itrack], m_neuroTrackInputMode); // xxxxx0xxx
233 // sectorpattern holds the absolute 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 }
ROOT::Math::XYZVector getMomentum() const
Returns momentum vector.
Definition Particle.h:580
TO * getRelatedTo(const std::string &name="", const std::string &namedRelation="") const
Get the object to which this object has a relation.
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition B2Vector3.h:516

◆ event() [2/11]

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]; // currently unused
138 // float invptTarget = targetvector[1]; // currently unused
139 float thetaTarget = targetvector[2];
140 float zTarget = targetvector[3];
141
142
143 // update 2D track variables
144 m_NeuroTrigger.updateTrack(*m_tracks[itrack]);
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 = {};
154 if (m_neuroParameters.targetZ)
155 targetRaw.push_back(zTarget);
156 if (m_neuroParameters.targetTheta)
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 }

◆ event() [3/11]

void event ( void )
overridevirtual

Called event by event.

Reimplemented from Module.

Definition at line 360 of file TRGCDCModule.cc.

361 {
362 // initialize returnValue
363 _cdc->setReturnValue(0);
364
365 //...CDC trigger simulation...
366 _cdc->update();
367 _cdc->simulate();
368
369 // save the results to DataStore
370 _cdc->storeSimulationResults(m_2DfinderCollectionName,
371 m_2DfitterCollectionName,
372 m_3DfitterCollectionName);
373
374 // Set return value
375 int returnValue = _cdc->getReturnValue();
376 int mask = 0;
377 for (vector<string>::iterator it = _returnValueModuleNames.begin(); it != _returnValueModuleNames.end(); ++it) {
378 string const& moduleName = *it;
379 if (moduleName == "TSF") mask |= TRGCDC::EReturnValueType::TSF;
380 else if (moduleName == "ETF") mask |= TRGCDC::EReturnValueType::ETF;
381 else if (moduleName == "find2D") mask |= TRGCDC::EReturnValueType::find2D;
382 else if (moduleName == "fit2D") mask |= TRGCDC::EReturnValueType::fit2D;
383 else if (moduleName == "find3D") mask |= TRGCDC::EReturnValueType::find3D;
384 else if (moduleName == "fit3D") mask |= TRGCDC::EReturnValueType::fit3D;
385 }
386 if (mask != 0) returnValue &= mask;
387 setReturnValue(returnValue);
388 }

◆ event() [4/11]

void event ( void )
overridevirtual

Called event by event.

Reimplemented from Module.

Definition at line 135 of file TRGCDCTSStreamModule.cc.

136 {
137
138 //...To dump wire hits...
139 if (TRGDebug::level())
140 _cdc->dump("trgWireCentralHits");
141
142 if (_out) {
143 unsigned val = TRGBSRecord_BeginEvent;
144 _out->write((char*) & val, 4);
145 val = 0;
146 _out->write((char*) & val, 4);
147 }
148
149 //...Clock loop (from 0 to 99 cycles, about 800 ns)...
150 for (unsigned c = 0; c < 100; c++) {
151
152 if (_out) {
153 unsigned val = TRGBSRecord_Clock;
154 _out->write((char*) & val, 4);
155 val = 32;
156 _out->write((char*) & val, 4);
157 val = c;
158 _out->write((char*) & val, 4);
159 }
160
161 //...Super layer loop...
162 for (unsigned l = 0; l < 9; l++) {
163
164 //...Bit stream for this super layer...
165 TRGBitStream stream;
166
167 //...Wire loop...
168 for (unsigned i = 0; i < _wires[l].size(); i++) {
169 const TRGSignal& s = _wires[l][i]->signal();
170 bool hit = s.state(c);
171 stream.append(hit);
172 }
173
174 if (_out) {
175 unsigned val = TRGBSRecord_SegmentSL0;
176 val += l;
177 _out->write((char*) & val, 4);
178 val = stream.size();
179 _out->write((char*) & val, 4);
180 for (unsigned i = 0; i < stream.sizeInChar(); i++) {
181 char cs = stream.c(i);
182 _out->write(& cs, 1);
183 }
184 }
185
186 if (TRGDebug::level()) {
187 cout << "Super layer " << l << ", clock " << c << endl;
188 stream.dump();
189 }
190 }
191 }
192
193 if (_out) {
194 unsigned val = TRGBSRecord_EndEvent;
195 _out->write((char*) & val, 4);
196 val = 0;
197 _out->write((char*) & val, 4);
198 }
199
200 }

◆ event() [5/11]

void event ( void )
overridevirtual

Called event by event.

Reimplemented from Module.

Definition at line 111 of file TRGECLBGTCHitModule.cc.

112 {
113 B2DEBUG(200, "TRGECLBGTCHitMoudle ... event called");
114
115 if (m_eclHits.getEntries() > 0) {
116 genSimulationObj();
117 } else if (m_trgeclUnpackerStores.getEntries() > 0) {
118 genRandomTrgObj();
119 }
120 }

◆ event() [6/11]

void event ( void )
overridevirtual

Called event by event.

Reimplemented from Module.

Definition at line 149 of file TRGECLFAMModule.cc.

150 {
151
152 B2DEBUG(200, "TRGECLFAMMoudle ... event called");
153 //
154 //
155 if (m_nEvent < 1e2) {if (m_nEvent % 10 == 0) {B2DEBUG(200, "TRGECLFAMModule::event> evtno= " << m_nEvent);}}
156 else if (m_nEvent < 1e3) {if (m_nEvent % 100 == 0) {B2DEBUG(200, "TRGECLFAMModule::event> evtno= " << m_nEvent);}}
157 else if (m_nEvent < 1e4) {if (m_nEvent % 1000 == 0) {B2DEBUG(200, "TRGECLFAMModule::event> evtno= " << m_nEvent);}}
158 else if (m_nEvent < 1e5) {if (m_nEvent % 10000 == 0) {B2DEBUG(200, "TRGECLFAMModule::event> evtno= " << m_nEvent);}}
159 else if (m_nEvent < 1e6) {if (m_nEvent % 100000 == 0) {B2DEBUG(200, "TRGECLFAMModule::event> evtno= " << m_nEvent);}}
160
161
162 //
163 //
164 //
165 // FAM Digitizer
166 TrgEclDigitizer* obj_trgeclDigi = new TrgEclDigitizer();
167 obj_trgeclDigi->setWaveform(_waveform);
168 obj_trgeclDigi->setFADC(_FADC);
169 obj_trgeclDigi->setup(m_SourceOfTC);
170 if (_famMethod == 1 || _famMethod == 2) {
171 // no-fit method = backup method 1
172 obj_trgeclDigi->digitization01(TCDigiE, TCDigiT);
173 } else if (_famMethod == 3) {
174 // original method = backup method 2
175 obj_trgeclDigi->digitization02(TCDigiE, TCDigiT);
176 }
177 obj_trgeclDigi-> save(m_nEvent);
178
179
180 // FAM Fitter
181 TrgEclFAMFit* obj_trgeclfit = new TrgEclFAMFit();
182 obj_trgeclfit-> SetBeamBkgTagFlag(_beambkgtag);
183 obj_trgeclfit-> SetAnaTagFlag(_famana);
184 obj_trgeclfit-> setup(m_nEvent);
185 obj_trgeclfit-> SetThreshold(Threshold);
186
187 if (_famMethod == 1) {obj_trgeclfit-> FAMFit01(TCDigiE, TCDigiT); } // fitting method
188 else if (_famMethod == 2) {obj_trgeclfit-> FAMFit02(TCDigiE, TCDigiT); } // no-fit method = backup method 1
189 else if (_famMethod == 3) { obj_trgeclfit-> FAMFit03(TCDigiE, TCDigiT); } // original method = backup method 2
190 obj_trgeclfit-> save(m_nEvent);
191
192
193 // Count number of trigger cells in each ECL region for EventLevelClusteringInfo
194 uint16_t nTCsPerRegion[3] = {};
195 const double absTimeRequirement = 9999.; // Selection on time to reproduce data
196 const int firstBarrelId = 81; // First TCId in the barrel
197 const int lastBarrelId = 512; // Last TCId in the barrel
198 for (auto& trgeclhit : m_TRGECLHit) {
199 const int tcId = trgeclhit.getTCId();
200 const double tcTime = trgeclhit.getTimeAve();
201 if (std::abs(tcTime) < absTimeRequirement) {
202 if (tcId < firstBarrelId) {
203 nTCsPerRegion[0]++;
204 } else if (tcId > lastBarrelId) {
205 nTCsPerRegion[2]++;
206 } else {
207 nTCsPerRegion[1]++;
208 }
209 }
210 }
211
212 // Store
213 if (!m_eventLevelClusteringInfo) { m_eventLevelClusteringInfo.create();}
214 m_eventLevelClusteringInfo->setNECLTriggerCellsFWD(nTCsPerRegion[0]);
215 m_eventLevelClusteringInfo->setNECLTriggerCellsBarrel(nTCsPerRegion[1]);
216 m_eventLevelClusteringInfo->setNECLTriggerCellsBWD(nTCsPerRegion[2]);
217
218
219 //
220 //
221 //
222 m_nEvent++;
223 delete obj_trgeclDigi;
224 delete obj_trgeclfit;
225 //
226 //
227 //
228 }

◆ event() [7/11]

void event ( void )
overridevirtual

Called event by event.

Reimplemented from Module.

Definition at line 363 of file TRGECLModule.cc.

364 {
365
366 if (TRGDebug::level()) {
367 std::cout << "TRGECLMoudle ... event called" << std::endl;
368 }
369 //
370 // simulation
371 //
372 TrgEclMaster* _ecl = new TrgEclMaster();
373
374 _ecl->initialize(m_nEvent);
375 _ecl->setClusterMethod(_Clustering);
376 _ecl->setClusterLimit(_ClusterLimit);
377 _ecl->setBhabhaMethod(_Bhabha);
378 _ecl->setEventTimingMethod(_EventTiming);
379 _ecl->setTimeWindow(_TimeWindow);
380 _ecl->setOverlapWindow(_OverlapWindow);
381 _ecl->setNofTopTC(_NofTopTC);
382 _ecl->set2DBhabhaThreshold(_2DBhabhaThresholdFWD, _2DBhabhaThresholdBWD);
383 _ecl->set3DBhabhaSelectionThreshold(_3DBhabhaSelectionThreshold);
384 _ecl->set3DBhabhaVetoThreshold(_3DBhabhaVetoThreshold);
385 _ecl->set3DBhabhaSelectionAngle(_3DBhabhaSelectionAngle);
386 _ecl->set3DBhabhaVetoAngle(_3DBhabhaVetoAngle);
387 _ecl->setmumuThreshold(_mumuThreshold);
388 _ecl->setmumuAngle(_mumuAngle);
389 _ecl->set3DBhabhaAddAngleCut(m_3DBhabhaAddAngleCut);
390 _ecl->setTaub2bAngleCut(m_taub2bAngleCut);
391 _ecl->setTaub2bEtotCut(m_taub2bEtotCut);
392 _ecl->setTaub2bClusterECut(m_taub2bClusterECut1,
393 m_taub2bClusterECut2);
394 _ecl->setTaub2b2Cut(m_taub2b2AngleCut,
395 m_taub2b2EtotCut,
396 m_taub2b2CLEEndcapCut,
397 m_taub2b2CLECut);
398 _ecl->setTaub2b3Cut(m_taub2b3AngleCut,
399 m_taub2b3EtotCut,
400 m_taub2b3CLEb2bCut,
401 m_taub2b3CLELowCut,
402 m_taub2b3CLEHighCut);
403 _ecl->setTotalEnergyThreshold(_TotalEnergy);
404 _ecl->setLowMultiplicityThreshold(_LowMultiThreshold);
405 _ecl->setn300MeVClusterThreshold(_n300MeVCluster);
406 _ecl->setECLBurstThreshold(_ECLBurstThreshold);
407 _ecl->set3DBhabhaVetoInTrackThetaRegion(m_3DBhabhaVetoInTrackThetaRegion);
408 _ecl->setEventTimingQualityThresholds(m_EventTimingQualityThresholds);
409
410 if (_SelectEvent == 0) {
411 _ecl->simulate01(m_nEvent);
412 } else if (_SelectEvent == 1) {
413 _ecl->simulate02(m_nEvent);
414 }
415 // printf("TRGECLModule> eventId = %d \n", m_nEvent);
416 //
417 //
418 m_nEvent++;
419 //
420 //
421 //
422 delete _ecl;
423 }

◆ event() [8/11]

void event ( void )
overridevirtual

Event.

Reimplemented from Module.

Definition at line 143 of file TRGECLQAMModule.cc.

144 {
145
146 B2DEBUG(200, "TRGECLFAMMoudle ... event called");
147
148
149
150 //QAM ECL Hit Map
151
152 // StoreArray<TRGECLUnpackerStore> m_TRGECLUnpackerStore;
153 for (int ii = 0; ii < m_TRGECLUnpackerStore.getEntries(); ii++) {
154 TRGECLUnpackerStore* m_TRGECLUnpacker = m_TRGECLUnpackerStore[ii];
155
156
157 int TCId = (m_TRGECLUnpacker->getTCId());
158 int HitEnergy = (m_TRGECLUnpacker->getTCEnergy());
159
160 m_etot += HitEnergy;
161 if (TCId < 1 || TCId > 576 || HitEnergy == 0) {continue;}
162 TCID[TCId - 1]++;
163 int Caltime = m_TRGECLUnpacker->getTCCALTime();
164 if (Caltime != 0) {
165 caltime.push_back(Caltime);
166 }
167 }
168
169 etot.push_back(m_etot);
170
171 m_etot = 0;
172
173 //Unpacker EvtStore
174 //for ( int ii = 0; ii < m_TRGECLUnpackerSumStore.getEntries(); ii++){
175 TRGECLUnpackerEvtStore* m_TRGECLUnpackerEvt = m_TRGECLUnpackerEvtStore[0];
176
177 if (m_TRGECLUnpackerEvt->get3DBhabhaS() == 1) {
178 //Cluster Energy 2D Check
179 const int* clE = m_TRGECLUnpackerEvt->getCLEnergy();
180
181 int clER[6] = {0};
182
183 for (int i = 0; i < 6; i++) {
184 clER[i] = clE[i];
185 }
186
187 sort(clER, clER + 6);
188
189 clusterE = clER[5] + clER[4]; // Ecl1+Ecl2
190 cluster.push_back(clusterE);
191 }
192
193 StoreObjPtr<EventMetaData> bevt;
194 m_nRun = bevt->getRun();
195 m_nevent++;
196
197 }

◆ event() [9/11]

void event ( void )
overridevirtual

Called event by event.

Reimplemented from Module.

Definition at line 110 of file TRGECLRawdataAnalysisModule.cc.

111 {
112
113 if (TRGDebug::level()) {
114 std::cout << "TRGECLMoudle ... event called" << std::endl;
115 }
116
117 std::vector<int> TCId;
118 std::vector<double> TCTiming;
119 std::vector<double> TCEnergy;
120
121 TCId.clear();
122 TCTiming.clear();
123 TCEnergy.clear();
124
125 int HitRevoFAM = 0;
126 int HitFineTime = 0;
127
128
129 //
130 StoreArray<TRGECLUnpackerStore> trgeclUnpackerStoreArray;
131 for (int ii = 0; ii < trgeclUnpackerStoreArray.getEntries(); ii++) {
132
133 TRGECLUnpackerStore* TCHit = trgeclUnpackerStoreArray[ii];
134 int iTCID = (TCHit->getTCId() - 1);
135 int HitTiming = TCHit ->getTCTime();
136 int HitEnergy = TCHit -> getTCEnergy();
137 HitRevoFAM = TCHit -> getRevoFAM();
138 HitFineTime = TCHit -> getTCTime();
139
140 if (iTCID == -1) {continue;}
141
142 TCId.push_back(iTCID + 1);
143 TCTiming.push_back(HitTiming);
144 TCEnergy.push_back(HitEnergy);
145
146
147
148 }
149 TrgEclCluster obj_cluster;
150 if (TCId.size() > 0) {
151
152 obj_cluster.setClusteringMethod(_Clustering);
153 obj_cluster.setEventId(m_nEvent);
154 obj_cluster.setICN(TCId, TCEnergy, TCTiming); // Make Cluster
155 obj_cluster.save(m_nEvent); // Save Clusters to TRGECLCluster
156
157 }
158
159 int Timing = ((HitFineTime >> 3) & 0xF) + ((HitRevoFAM & 0x7F) << 4);
160
161 m_hitNum = 0;
162 StoreArray<TRGECLTiming> TimingArray;
163 TimingArray.appendNew();
164 m_hitNum = TimingArray.getEntries() - 1;
165 TimingArray[m_hitNum]->setEventId(m_nEvent);
166 TimingArray[m_hitNum]->setTiming(Timing);
167
168
169 //
170
171 //
172 //
173 m_nEvent++;
174 //
175 //
176 //
177
178
179 }

◆ event() [10/11]

void event ( void )
overridevirtual

Called event by event.

Reimplemented from HistoModule.

Definition at line 185 of file TRGGDLModule.cc.

186 {
187
188 if (_debugLevel > 9) printf("TRGGDLModule::event() starts.\n");
189
190 newDir->cd();
191
192 //...GDL simulation...
193 _gdl->update(true);
194 _gdl->simulate();
195 _gdl->accumulateInp(h_inp);
196 _gdl->accumulateFtd(h_ftd);
197 _gdl->accumulatePsn(h_psn);
198
199 //StoreObjPtr<TRGSummary> m_TRGSummary; /**< output for TRGSummary */
200 bool result_summary = false;
201 if (m_TRGSummary) {
202 result_summary = m_TRGSummary->test();
203 } else {
204 B2WARNING("TRGGDLModule.cc: TRGSummary not found. Check it!!!!");
205 }
206 setReturnValue(result_summary);
207
208 oldDir->cd();
209 }

◆ event() [11/11]

void event ( void )
overridevirtual

Called event by event.

Reimplemented from Module.

Definition at line 110 of file TRGGRLModule.cc.

111 {
112
113 //...GRL simulation...
114 _grl->update(true);
115 _grl->simulate();
116
117 }

◆ genRandomTrgObj()

void genRandomTrgObj ( )
private

Definition at line 181 of file TRGECLBGTCHitModule.cc.

182 {
183
184 for (const TRGECLUnpackerStore& ttt : m_trgeclUnpackerStores) {
185 int tcID = ttt.getTCId();
186 // TC energy(ADC)
187 double tcEnergyADC = (double) ttt.getTCEnergy();
188 // TC timing(ns)
189 double tcTime = (double) ttt.getTCTime();
190 if (tcID <= 0) {continue;}
191 // ADC to Energy(MeV) conversion
192 double adc2energy = 5.231;
193 // TC energy (GeV)
194 double tcEnergy = tcEnergyADC * (adc2energy / 1000);
195 // TC energy cut to reduce object size
196 if (tcEnergy < m_TCEnergyCut) { continue; }
197 // TC timing cut to reduce object size
198 if (tcTime < m_TCTimingCutLow || tcTime > m_TCTimingCutHigh) { continue; }
199 // store data
200 m_trgeclBGTCHits.appendNew(tcID,
201 tcEnergy,
202 tcTime);
203 }
204 }

◆ genSimulationObj()

void genSimulationObj ( )
private

Parameters.

Definition at line 141 of file TRGECLBGTCHitModule.cc.

142 {
143
144 struct hit_t { double e, t; };
145 map<int, hit_t> a;
146
147 for (const ECLHit& t : m_eclHits) {
148 double txtal = t.getTimeAve();
149 // timing cut, +-8ns, (almost) same as ECL in SensitiveDetector.cc
150 if (txtal >= 8000.0 || txtal < -8000.0) continue;
151 double edep = t.getEnergyDep();
152 int TimeIndex = (txtal + 8000.0) * (1. / 100);
153 int cellId = t.getCellId() - 1;
154 int iTCIdm = m_TCMap->getTCIdFromXtalId(cellId + 1) - 1;
155
156 int key = iTCIdm * 160 + TimeIndex;
157 hit_t& h = a[key];
158 double old_edep = h.e, old_txtal = h.t;
159 double new_edep = old_edep + edep;
160 h.e = new_edep;
161 h.t = (old_edep * old_txtal + edep * txtal) / new_edep;
162 }
163 // save TC data to dataobject
164 for (pair<int, hit_t> t : a) {
165 int key = t.first;
166 int tcid = key / 160;
167 const hit_t& h = t.second;
168 // TC energy cut to reduce object size
169 if (h.e < m_TCEnergyCut) { continue; }
170 // TC timing cut to reduce object size
171 if (h.t < m_TCTimingCutLow || h.t > m_TCTimingCutHigh) { continue; }
172 // store data
173 m_trgeclBGTCHits.appendNew(tcid + 1, h.e, h.t);
174 }
175
176 }

◆ get_BKLM_back_to_back_flag()

int get_BKLM_back_to_back_flag ( int subdetector)

Definition at line 158 of file klmtrgLayerCounter.cc.

159 {
160 for (const auto& e : m_summary1) {
161 if (e.subdetector == subdetector) {
162 return e.back2back;
163 }
164 }
165 return 0;
166 }

◆ get_index()

template<typename T>
int64_t get_index ( const T & e,
int track_id = 0 )
constexpr

Definition at line 43 of file klmtrgLinearFit.cc.

44 {
45 int64_t ret = 0;
46 int64_t shift = 0;
47 bitshift(ret, shift, track_id, 5);
48 bitshift(ret, shift, e.layer, 6);
49 bitshift(ret, shift, e.plane, 2);
50 bitshift(ret, shift, e.sector, 6);
51 bitshift(ret, shift, e.section, 3);
52 bitshift(ret, shift, e.subdetector, 3);
53
54
55 return ret;
56 };

◆ get_n_sections_trig()

int get_n_sections_trig ( int subdetector)

Definition at line 138 of file klmtrgLayerCounter.cc.

139 {
140 for (const auto& e : m_summary1) {
141 if (e.subdetector == subdetector) {
142 return e.n_sections_trig;
143 }
144 }
145 return 0;
146 }

◆ get_result()

const KLM_trig_linear_fits & get_result ( ) const

Definition at line 275 of file klmtrgLinearFit.cc.

276 {
277 return m_linear_fits;
278 }

◆ get_triggermask() [1/2]

int get_triggermask ( int subdetector,
int section )

Definition at line 148 of file klmtrgLayerCounter.cc.

149 {
150 for (const auto& e : m_sections_trig) {
151 if (e.subdetector == subdetector && e.section == section) {
152 return e.sector_mask;
153 }
154 }
155 return 0;
156 }

◆ get_triggermask() [2/2]

int get_triggermask ( int subdetector,
int section )

Definition at line 282 of file klmtrgLinearFit.cc.

283 {
284 for (const auto& e : m_sections_trig) {
285 if (e.subdetector == subdetector && e.section == section) {
286 return e.sector_mask;
287 }
288 }
289 return 0;
290 }

◆ get_triggermask_or()

int get_triggermask_or ( int subdetector,
int section )

Definition at line 292 of file klmtrgLinearFit.cc.

293 {
294 for (const auto& e : m_sections_trig) {
295 if (e.subdetector == subdetector && e.section == section) {
296 return e.sector_mask_or;
297 }
298 }
299 return 0;
300 }

◆ initialize() [1/11]

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.

84 {
85 // register store objects
86 m_tracks.isRequired(m_inputCollectionName);
87 // decided whether to load mcparticles or recotracks as training targets.
88 // This has to be done because the train target values are obtained
89 // for both classes in a different way.
90 if (m_trainOnRecoTracks) {
91 StoreArray<RecoTrack> targets(m_targetCollectionName);
92 targets.isRequired(m_targetCollectionName);
93 } else {
94 StoreArray<MCParticle> targets(m_targetCollectionName);
95 targets.isRequired(m_targetCollectionName);
96 }
97 // initialize the neurotrigger object, but use the parameters given in the module
98 if (m_configFileName != "") {
99 m_neuroParameters.loadconfigtxt(m_configFileName);
100 m_NeuroTrigger.initialize(m_neuroParameters);
101 } else {
102 B2ERROR("The Neurotrigger needs to be initialized by a configuration file! Make sure to give the configuration file as a parameter.");
103 }
104 // in this version, we first need an idhistfile in prior to collect the training data.
105 // this idhistfile is created by running another steering file before
106 // and stored in the config file loaded in the previous step.
107 m_trainSet.clear();
108 CDC::CDCGeometryPar& cdc = CDC::CDCGeometryPar::Instance();
109 // create an empty dataset of training data for each expert network
110 for (unsigned iMLP = 0; iMLP < m_NeuroTrigger.nSectors(); ++iMLP) {
111 m_trainSet.push_back(CDCTriggerMLPData());
112 int layerId = 3;
113 for (int iSL = 0; iSL < 9; ++iSL) {
114 m_trainSet[iMLP].addCounters(cdc.nWiresInLayer(layerId));
115 layerId += (iSL > 0 ? 6 : 7);
116 }
117 }
118 // this one sets up the other root store arrays needed to collect training data
119 m_NeuroTrigger.initializeCollections(m_hitCollectionName, m_EventTimeName, m_neuroParameters.et_option());
120 // consistency check of training parameters
121 if (m_NeuroTrigger.nSectors() != m_trainSet.size()) {
122 B2ERROR("Number of ID sets (" << m_trainSet.size() << ") should match " <<
123 "number of sectors (" << m_NeuroTrigger.nSectors() << ")");
124 }
125 // overwrite previous file with empty file, in case it already exists
126 std::ofstream gzipfile4(m_filename, std::ios_base::trunc | std::ios_base::binary);
127 boost::iostreams::filtering_ostream outStream;
128 outStream.push(boost::iostreams::gzip_compressor());
129 outStream.push(gzipfile4);
130 CDCTriggerMLPData::NeuroSet<27, 2> sample;
131 outStream << sample.headline << std::endl;
132 }

◆ initialize() [2/11]

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.

71 {
77 if (m_configFileName != "") {
78 m_neuroParameters.loadconfigtxt(m_configFileName);
79 m_NeuroTrigger.initialize(m_neuroParameters);
80 } else {
81 m_neuroParameters.saveconfigtxt("neuroconfig_example.conf");
82 B2ERROR("Configuration file is missing! Make sure to give the configuration file as a parameter. \
83 An example file neuroconfig_example.conf has been saved.");
84 }
85 m_trainSets_prepare.clear();
86 CDC::CDCGeometryPar& cdc = CDC::CDCGeometryPar::Instance();
87 for (unsigned iMLP = 0; iMLP < m_NeuroTrigger.nSectors(); ++iMLP) {
88 // sectors means experts here; this is the old naming within the neurotrigger
89 // class which originates from times were we had different expert networks for
90 // different geometrical sectors. In future, this might come back because of
91 // the 3DFinder and its rough information about the theta angle of the tracks.
92 m_trainSets_prepare.push_back(CDCTriggerMLPData());
93 // layerid is the layer number where the priority hits are.
94 // for every 1st priority wire there is a corresponding track segment.
95 int layerId = 3;
96 for (int iSL = 0; iSL < 9; ++iSL) {
97
98 m_trainSets_prepare[iMLP].addCounters(cdc.nWiresInLayer(layerId));
99 // the first superlayer has 2 layers extra compared to the rest
100 layerId += (iSL > 0 ? 6 : 7);
101 }
102 m_tracks.isRequired(m_inputCollectionName);
103 if (m_trainOnRecoTracks) {
104 StoreArray<RecoTrack> targets(m_targetCollectionName);
105 targets.isRequired(m_targetCollectionName);
106 } else {
107 StoreArray<MCParticle> targets(m_targetCollectionName);
108 targets.isRequired(m_targetCollectionName);
109 }
110
111 m_NeuroTrigger.initializeCollections(m_hitCollectionName);
112
113
114
115
116 }
117 if (m_NeuroTrigger.nSectors() == 0) {
118 B2ERROR("No networks defined, please make sure to have a proper configuration file! Example file will be created here: ./neurotrigger_default.conf");
119 m_neuroParameters.saveconfigtxt("neurotrigger_default.conf");
120 }
121 }

◆ initialize() [3/11]

void initialize ( void )
overridevirtual

Initializes TRGCDCModule.

Reimplemented from Module.

Definition at line 257 of file TRGCDCModule.cc.

258 {
259
260 //...Stop curl buck...
261 if (_curlBackStop) {
262 G4RunManager* g4rm = G4RunManager::GetRunManager();
263 if (g4rm != 0) {
264 if (g4rm->GetUserPhysicsList() != 0) {
265 _sa = new TCSAction();
266 g4rm->SetUserAction(_sa);
267 }
268 }
269 }
270 TRGDebug::level(_debugLevel);
271
272 if (TRGDebug::level()) {
273 cout << "TRGCDCModule::initialize ... options" << endl;
274 cout << TRGDebug::tab(4) << "debug level = " << TRGDebug::level()
275 << endl;
276 cout << TRGDebug::tab(4) << "back stop = " << _curlBackStop << endl;
277 cout << TRGDebug::tab(4) << "2D finder perfect = " << _perfect2DFinder
278 << endl;
279 cout << TRGDebug::tab(4) << "Hough finder Min. Peak = "
280 << _hFinderPeakMin
281 << endl;
282 }
283
284 // register DataStore elements
285 StoreArray<CDCTriggerSegmentHit> segmentHits;
286 segmentHits.registerInDataStore();
287 StoreArray<CDCHit> cdcHits(m_inputCollectionName);
288 cdcHits.isRequired();
289 StoreArray<MCParticle> mcparticles;
290 segmentHits.registerRelationTo(cdcHits);
291 mcparticles.registerRelationTo(segmentHits);
292 // register tracks only for full simulation (not for TSF simulation)
293 if (!(_fastSimulationMode & 1)) {
294 StoreArray<CDCTriggerTrack> tracks2Dfinder(m_2DfinderCollectionName);
295 StoreArray<CDCTriggerTrack> tracks2Dfitter(m_2DfitterCollectionName);
296 StoreArray<CDCTriggerTrack> tracks3Dfitter(m_3DfitterCollectionName);
297 tracks2Dfinder.registerInDataStore(m_2DfinderCollectionName);
298 tracks2Dfitter.registerInDataStore(m_2DfitterCollectionName);
299 tracks3Dfitter.registerInDataStore(m_3DfitterCollectionName);
300 tracks2Dfinder.registerRelationTo(segmentHits); // hits related over Hough cell
301 tracks2Dfitter.registerRelationTo(segmentHits); // hits used for the 2D fit
302 tracks3Dfitter.registerRelationTo(segmentHits); // hits used for the 2D and 3D fit
303 tracks2Dfinder.registerRelationTo(tracks2Dfitter);
304 tracks2Dfinder.registerRelationTo(tracks3Dfitter);
305 }
306 StoreObjPtr<TRGTiming> eventTime("CDCTriggerEventTime");
307 eventTime.registerInDataStore("CDCTriggerEventTime");
308
309 //...CDC trigger config. name...
310 static string cfn = _configFilename;
311
312 //...CDC trigger...
313 if ((cfn != _configFilename) || (_cdc == 0)) {
314 Belle2::CDC::CDCGeometryPar& cdc = Belle2::CDC::CDCGeometryPar::Instance();
315 _cdc = TRGCDC::getTRGCDC(_configFilename,
316 _simulationMode,
317 _fastSimulationMode,
318 _firmwareSimulationMode,
319 _firmwareSimulationStart,
320 _firmwareSimulationStop,
321 _fileTRGCDC,
322 _perfect2DFinder,
323 _perfect3DFinder,
324 _innerTSLUTFilename,
325 _outerTSLUTFilename,
326 _rootTRGCDCFilename,
327 _rootFitter3DFilename,
328 _hFinderPeakMin,
329 _hFinderMappingFilePlus,
330 _hFinderMappingFileMinus,
331 _hFinderDoit,
332 _fLogicLUTTSF,
333 _fLRLUT,
334 _fFitter3Dsmclr,
335 _fFitter3Ds2DFit,
336 _fFitter3Ds2DFitDrift,
337 _wireHitInefficiency,
338 _fileTSF,
339 _fileETF,
340 _fverETF,
341 _fprintFirmETF,
342 _fileHough3D,
343 _finder3DMode,
344 _fileFitter3D,
345 _fXtSimpleFitter3D,
346 cdc.getTdcBinWidth(),
347 _trgCDCDataInputMode,
348 m_inputCollectionName);
349 }
350 }
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.

◆ initialize() [4/11]

void initialize ( void )
overridevirtual

Initializes TRGCDCTSStreamModule.

Reimplemented from Module.

Definition at line 81 of file TRGCDCTSStreamModule.cc.

82 {
83 if (TRGDebug::level()) {
84 cout << "TRGCDCTSStreamModule::initialize ... options" << endl;
85 cout << TRGDebug::tab(4) << "debug level = " << _debugLevel << endl;
86 cout << TRGDebug::tab(4) << " mode = " << _mode << endl;
87 cout << TRGDebug::tab(4) << "output file = " << _streamFilename << endl;
88 }
89
90 if (_streamFilename != "unknown") {
91 _out = new ofstream(_streamFilename.c_str(), ios::out | ios::binary);
92 unsigned val = TRGBSRecord_Comment;
93 _out->write((char*) & val, 4);
94 const string cmt = "test data ";
95 val = cmt.size() * 8;
96 _out->write((char*) & val, 4);
97 _out->write(cmt.c_str(), cmt.size());
98 }
99 }

◆ initialize() [5/11]

void initialize ( void )
overridevirtual

Initializes TRGECLBGTCHitModule.

Reimplemented from Module.

Definition at line 84 of file TRGECLBGTCHitModule.cc.

85 {
86 B2DEBUG(100, "TRGECLBGTCHitModule::initialize>");
87
88 B2INFO("[TRGECLBGTCHitModule] TCEnergyCut : TC(E) GeV = "
89 << m_TCEnergyCut);
90 B2INFO("[TRGECLBGTCHitModule] TCTimingCutLow : TC(T) ns = "
91 << m_TCTimingCutLow);
92 B2INFO("[TRGECLBGTCHitModule] TCTimingCutHigh : TC(T) ns = "
93 << m_TCTimingCutHigh);
94
95 m_eclHits.registerInDataStore();
96 m_trgeclUnpackerStores.registerInDataStore();
97 m_trgeclBGTCHits.registerInDataStore();
98 }

◆ initialize() [6/11]

void initialize ( void )
overridevirtual

Initializes TRGECLFAMModule.

Reimplemented from Module.

Definition at line 101 of file TRGECLFAMModule.cc.

102 {
103
104 B2DEBUG(100, "TRGECLFAMModule::initialize ... options");
105 B2DEBUG(100, "TRGECLFAMModule::initialize> FAM Fit Method = " << _famMethod
106 << " ; Bin of Time Interval = " << _binTimeInterval
107 << " ;output TC waveforml = " << _waveform);
108 if (m_SourceOfTC <= 0 ||
109 m_SourceOfTC >= 4) {
110 B2FATAL("TRGECLFAMModule::initialize> SourceOfTC must be 1 or 2 or 3");
111 }
112
113 m_nRun = 0;
114 m_nEvent = 1;
115
116 m_TRGECLDigi0.registerInDataStore();
117 m_TRGECLWaveform.registerInDataStore();
118 m_TRGECLHit.registerInDataStore();
119 m_TRGECLFAMAna.registerInDataStore();
120 // This object is registered by few packages. Let's be agnostic about the
121 // execution order of the modules: the first package run registers the module
122 m_eventLevelClusteringInfo.isOptional() ? m_eventLevelClusteringInfo.isRequired() :
123 m_eventLevelClusteringInfo.registerInDataStore();
124
125 // m_FAMPara = new DBObjPtr<TRGECLFAMPara>;
126 }

◆ initialize() [7/11]

void initialize ( void )
overridevirtual

Initializes TRGECLModule.

Reimplemented from Module.

Definition at line 228 of file TRGECLModule.cc.

229 {
230
231 TRGDebug::level(_debugLevel);
232
233 if (TRGDebug::level()) {
234 std::cout << "TRGECLModule::initialize ... options" << std::endl;
235 std::cout << TRGDebug::tab(4) << "debug level = " << TRGDebug::level()
236 << std::endl;
237 }
238 //
239 //
240 //
241 m_nRun = 0 ;
242 m_nEvent = 0 ;
243 m_hitNum = 0;
244 m_hitTCNum = 0;
245
246 m_TRGECLHit.registerInDataStore();
247 m_TRGECLTrg.registerInDataStore();
248 m_TRGECLCluster.registerInDataStore();
249
250 }

◆ initialize() [8/11]

void initialize ( void )
overridevirtual

initialize

Reimplemented from Module.

Definition at line 115 of file TRGECLQAMModule.cc.

116 {
117
118 B2DEBUG(100, "TRGECLQAMModule::initialize ... options");
119
120
121 m_TRGECLUnpackerStore.registerInDataStore();
122 m_TRGECLUnpackerEvtStore.registerInDataStore();
123
124 m_TRGSummary.registerInDataStore();
125 // EvtMeta.registterInDataStore();
126
127
128 }

◆ initialize() [9/11]

void initialize ( void )
overridevirtual

Initializes TRGECLModule.

Reimplemented from Module.

Definition at line 70 of file TRGECLRawdataAnalysisModule.cc.

71 {
72
73 TRGDebug::level(_debugLevel);
74
75 if (TRGDebug::level()) {
76 std::cout << "TRGECLRawdataAnalysisModule::initialize ... options" << std::endl;
77 std::cout << TRGDebug::tab(4) << "debug level = " << TRGDebug::level()
78 << std::endl;
79 }
80 //
81 //
82 //
83 m_nRun = 0 ;
84 m_nEvent = 0 ;
85 m_hitNum = 0;
86 m_hitTCNum = 0;
87
88 m_TRGECLUnpackerStore.registerInDataStore();
89 m_TRGECLCluster.registerInDataStore();
90 m_TRGECLTiming.registerInDataStore();
91
92 }

◆ initialize() [10/11]

void initialize ( void )
overridevirtual

Initializes TRGGDLModule.

Reimplemented from HistoModule.

Definition at line 126 of file TRGGDLModule.cc.

127 {
128
129 REG_HISTOGRAM
130 defineHisto();
131
132// m_TRGSummary.isRequired();
133 TRGDebug::level(_debugLevel);
134
135 B2INFO("TRGGDLModule::initialize. simulationMode=" << _simulationMode);
136 if (_simulationMode != 3) {
137 m_TRGGRLInfo.isRequired("TRGGRLObjects");
138 }
139
140 if (m_simulateT0Jitter)
141 m_simClockState.isRequired();
142
143 m_TRGSummary.registerInDataStore();
144 }

◆ initialize() [11/11]

void initialize ( void )
overridevirtual

Initializes TRGGRLModule.

Reimplemented from Module.

Definition at line 77 of file TRGGRLModule.cc.

78 {
79
80// TRGDebug::level(_debugLevel);
81
82 B2DEBUG(100, "TRGGRLModule::initialize ... options");
83 }

◆ operator==()

bool operator== ( const CDCTriggerHoughCand & a,
const CDCTriggerHoughCand & b )
inline

Two cells are identical if they have the same coordinates.

Definition at line 77 of file CDCTriggerHoughETFModule.h.

78 {
79 return (a.getCoord().first.X() == b.getCoord().first.X() &&
80 a.getCoord().first.Y() == b.getCoord().first.Y());
81 }

◆ run() [1/2]

void run ( const KLM_TRG_definitions::KLM_Digit_compact_ts & hits)

Definition at line 54 of file klmtrgLayerCounter.cc.

55 {
56
57
58 m_sections_trig.clear();
59 m_summary1.clear();
60
61 auto hits1 = nt::algorithms::join_vectors(
62 hits,
63 m_layersUsed,
64 nt::comparators::on_common_args,
65 [&](auto e1, const auto&) {
66 e1.layer = e1.layer * 2 + e1.plane;
67 return e1;
68 }
69 );
70
71 __CSV__WRITE__(hits1);
72
73
74 auto grouped = nt_group(
75 hits1[0].subdetector,
76 hits1[0].section,
77 hits1[0].sector
78 ).apply_append(
79 hits1,
80 [](const auto & e1) {
81 auto bit_mask = to_bit_mask(nt_span(e1, layer));
82 return nt::ntuple(
83 ax_maker(layer_count) = countBits(bit_mask),
84 ax_maker(layer_mask) = bit_mask
85 );
86 });
87
88
89 __CSV__WRITE__(grouped);
90
91 nt::algorithms::filter(grouped, [&](const auto & e) { return e.layer_count >= m_NlayerTrigger; });
92
93
94
95
96
97 m_sections_trig = nt_group(
98 grouped[0].subdetector,
99 grouped[0].section
100 ).apply_append(
101 grouped,
102 [&](const auto & e1) {
103
104 auto bit_mask = to_bit_mask(nt_span(e1, sector));
105 n_sections_trig nsector = countBits(bit_mask);
106 return nt::ntuple(
107 sector_mask(bit_mask),
108 nsector
109 );
110 }
111 );
112
113 __CSV__WRITE__(m_sections_trig);
114
115
116
117 m_summary1 = nt_group(
118 m_sections_trig[0].subdetector
119 ).apply_append(
120 m_sections_trig,
121 [](const auto & e1) {
122 auto bit_mask = countBits(to_bit_mask(nt_span(e1, section)));
123 n_sections_trig nsector = nt::algorithms::sum(e1, [](auto&& e) {return e.n_sections_trig; });
124
125 return nt::ntuple(
126 nsector,
127 back2back(bit_mask == 2)
128
129 );
130 }
131 );
132
133 __CSV__WRITE__(m_summary1);
134
135
136 }

◆ run() [2/2]

void run ( const KLM_TRG_definitions::KLM_Digit_compact_ts & hits)

Definition at line 167 of file klmtrgLinearFit.cc.

168 {
169
170 __CSV__WRITE__(hits);
171 m_linear_fits.clear();
172
173
174 auto hits_w_geo_fit = nt::algorithms::add_column(
175 hits,
176 [&](const auto & e1) {
177 auto ret = nt::ntuple(
178 Belle2::KLM_TRG_definitions::x_pos(0),
179 Belle2::KLM_TRG_definitions::y_pos(0)
180 );
181
182 auto&& e2 = m_KLMgeomap[get_index(e1)];
183 ret.x_pos.v = e1.layer * e2.slopeX + e2.offsetX;
184 ret.y_pos.v = e1.strip * e2.slopeY + e2.offsetY;
185 return ret;
186
187 }
188 );
189
190
191 __CSV__WRITE__(hits_w_geo_fit);
192 nt::algorithms::sort(hits_w_geo_fit);
193
194
195 auto track_maker_ = track_maker_t{};
196 track_maker_.y_cutoff = y_cutoff;
197
198
199 auto hits_w_geo_fit_w_tracks = nt::algorithms::add_column(
200 hits_w_geo_fit,
201 [&](const auto & e) {
202 return nt::ntuple{
203 track_id(track_maker_(e))
204 };
205
206
207 }
208
209 );
210
211
212 __CSV__WRITE__(hits_w_geo_fit_w_tracks);
213
214
215
216 m_linear_fits = nt_group(
217 hits_w_geo_fit_w_tracks[0].subdetector,
218 hits_w_geo_fit_w_tracks[0].section,
219 hits_w_geo_fit_w_tracks[0].sector,
220 hits_w_geo_fit_w_tracks[0].plane,
221 hits_w_geo_fit_w_tracks[0].track_id
222 ).apply_append(
223 hits_w_geo_fit_w_tracks,
224 Linear_fit_of_Hits
225 );
226 __CSV__WRITE__(m_linear_fits);
227
228
229 nt::algorithms::filter(m_linear_fits, [&](const auto & e) { return std::abs(e.interceptXY) <= m_intercept_cutoff; });
230
231
232 auto m_linear_fits1 = nt_group(
233 m_linear_fits[0].subdetector,
234 m_linear_fits[0].section,
235 m_linear_fits[0].sector
236 ).apply_append(
237 m_linear_fits,
238 [](const auto & es) {
239 bool plane0 = false;
240 bool plane1 = false;
241 for (const auto& e : es) {
242 if (e.plane == 0) { plane0 = true; }
243 if (e.plane == 1) { plane1 = true; }
244 }
245 return nt::ntuple{
246 ax_maker(trigger_or) = (int)(plane0 || plane1),
247 ax_maker(trigger_and) = (int)(plane0 && plane1)
248 };
249 }
250 );
251 __CSV__WRITE__(m_linear_fits1);
252
253 m_sections_trig = nt_group(
254 m_linear_fits1[0].subdetector,
255 m_linear_fits1[0].section
256 ).apply_append(
257 m_linear_fits1,
258 [](const auto & e) {
259 auto ret = nt::ntuple{
260 KLM_TRG_definitions::sector_mask {},
261 KLM_TRG_definitions::sector_mask_or{}
262 };
263 auto trig_and = nt::algorithms::filter_copy(e, [](const auto & x) { return x.trigger_and > 0; });
264 ret.sector_mask.v = Belle2::to_bit_mask(nt_span(trig_and, sector));
265 ret.sector_mask_or.v = Belle2::to_bit_mask(nt_span(trig_and, sector));
266 return ret;
267
268 }
269 );
270 __CSV__WRITE__(m_sections_trig);
271
272
273 }

◆ set_intercept_cutoff()

void set_intercept_cutoff ( int cutoff)

Definition at line 307 of file klmtrgLinearFit.cc.

308 {
309 m_intercept_cutoff = cutoff;
310 }

◆ set_NLayerTrigger()

void set_NLayerTrigger ( int NlayerTrigger)

Definition at line 49 of file klmtrgLayerCounter.cc.

50 {
51 m_NlayerTrigger = NlayerTrigger;
52 }

◆ set_y_cutoff()

void set_y_cutoff ( int cutoff)

Definition at line 302 of file klmtrgLinearFit.cc.

303 {
304 y_cutoff = cutoff;
305 }

◆ terminate() [1/11]

void terminate ( void )
overridevirtual

Do the training for all sectors.

Reimplemented from Module.

Definition at line 287 of file CDCTriggerNeuroDataModule.cc.

288 {
289 std::stringstream ss;
290 for (unsigned int i = 0; i < m_trainSet.size(); ++i) {
291 ss << "expert " << i << " : " << m_trainSet[i].nSamples() << ", ";
292 }
293 // lock the parameters, which were used to obtain the training data, so they cannot be altered in the next steps.
294 m_neuroParameters.ETOption.lock();
295 m_neuroParameters.rescaleTarget.lock();
296 m_neuroParameters.targetZ.lock();
297 m_neuroParameters.targetTheta.lock();
298 for (auto x : m_neuroParameters.maxHitsPerSL) {
299 x.lock();
300 }
301 if (m_writeconfigFileName == "") {
302 B2INFO("write writeconfig now: " + m_configFileName);
303 m_neuroParameters.saveconfigtxt(m_configFileName);
304 } else {
305 B2INFO("write writeconfig now: " + m_writeconfigFileName);
306 m_neuroParameters.saveconfigtxt(m_writeconfigFileName);
307 }
308
309 B2DEBUG(10, "Collected events: " << ss.str());
310 }

◆ terminate() [2/11]

void terminate ( void )
overridevirtual

Do the training for all sectors.

Reimplemented from Module.

Definition at line 213 of file CDCTriggerNeuroIDHistModule.cc.

214 {
215
216 if (m_neuroParameters.IDRanges.size() > 0) {
217 if (m_neuroParameters.IDRanges[0].size() > 0) {
218 if (m_neuroParameters.IDRanges[0][0].isSet()) {
219 // the idranges are already set, print warning:
220 if (!m_neuroParameters.IDRanges[0][0].isLocked()) {
221 B2WARNING("ID ranges are already set in the config file, they will be updated now!");
222 } else {
223 B2ERROR("The ID ranges in the config file are already locked and cannot be updated!");
224 return;
225 }
226 }
227 }
228 }
229 m_neuroParameters.IDRanges.clear();
230 for (unsigned isector = 0; isector < m_trainSets_prepare.size(); ++isector) {
231 CDCTriggerMLPData::HeaderSet hset(isector, NeuroTrainer::getRelevantID(
232 m_trainSets_prepare[isector],
233 m_neuroParameters.cutSum,
234 m_neuroParameters.relevantCut));
235 std::vector<NNTParam<float>> expertline;
236 expertline.push_back(float(isector));
237 expertline.back().lock();
238 for (auto x : hset.relID) {
239 expertline.push_back(x);
240 expertline.back().lock();
241 }
242 m_neuroParameters.IDRanges.push_back(expertline);
243 B2DEBUG(15, hset);
244 }
245 // lock the variables used in this module, that are not supposed be changed
246 // further down the training chain because of the danger of implications or
247 // wrong assumptions.
248 m_neuroParameters.relevantCut.lock();
249 m_neuroParameters.cutSum.lock();
250 // the IDRanges are set here; however, they can be altered manually in the
251 // configuration file to achieve potentially better results, eg. widen
252 // the range of the axial phi acceptance. This is why they are not to be "locked".
253 m_neuroParameters.nInput.lock();
254 m_neuroParameters.nOutput.lock();
255 m_neuroParameters.nMLP.lock();
256 for (auto x : m_neuroParameters.SLpattern) {
257 x.lock();
258 }
259 for (auto x : m_neuroParameters.SLpatternMask) {
260 x.lock();
261 }
262 for (auto x : m_neuroParameters.maxHitsPerSL) {
263 x.lock();
264 }
265 m_neuroParameters.multiplyHidden.lock();
266
267 if (m_writeconfigFileName == "") {
268 m_neuroParameters.saveconfigtxt(m_configFileName);
269 } else {
270 m_neuroParameters.saveconfigtxt(m_writeconfigFileName);
271 }
272
273
274 // the *rangeTrain variables are used here, but just for obtaining the idranges.
275 // because they only have a very minor effect on those, they are not locked here.
276 //TODO: also write the config file to be directly able to start the training
277 }

◆ terminate() [3/11]

void terminate ( void )
overridevirtual

Called when processing ended.

Reimplemented from Module.

Definition at line 398 of file TRGCDCModule.cc.

399 {
400
401 _cdc->terminate();
402
403 if (TRGDebug::level())
404 cout << "TRGCDCModule ... terminate called " << endl;
405 }

◆ terminate() [4/11]

void terminate ( void )
overridevirtual

Called when processing ended.

Reimplemented from Module.

Definition at line 217 of file TRGCDCTSStreamModule.cc.

218 {
219 if (_out) {
220 _out->flush();
221 _out->close();
222 }
223
224 if (TRGDebug::level())
225 cout << "TRGCDCTSStreamModule ... terminate called " << endl;
226 }

◆ terminate() [5/11]

void terminate ( void )
overridevirtual

Called when processing ended.

Reimplemented from Module.

Definition at line 133 of file TRGECLBGTCHitModule.cc.

134 {
135 B2DEBUG(100, "TRGECLBGTCHitModule ... terminate called ");
136 }

◆ terminate() [6/11]

void terminate ( void )
overridevirtual

Called when processing ended.

Reimplemented from Module.

Definition at line 241 of file TRGECLFAMModule.cc.

242 {
243 B2DEBUG(100, "TRGECLFAMModule ... terminate called ");
244 }

◆ terminate() [7/11]

void terminate ( void )
overridevirtual

Called when processing ended.

Reimplemented from Module.

Definition at line 438 of file TRGECLModule.cc.

439 {
440 if (TRGDebug::level()) {
441 std::cout << "TRGECLModule ... terminate called " << std::endl;
442 }
443 }

◆ terminate() [8/11]

void terminate ( void )
overridevirtual

terminate

Reimplemented from Module.

Definition at line 411 of file TRGECLQAMModule.cc.

412 {
413 B2DEBUG(100, "TRGECLQAMModule ... terminate called ");
414
415 }

◆ terminate() [9/11]

void terminate ( void )
overridevirtual

Called when processing ended.

Reimplemented from Module.

Definition at line 194 of file TRGECLRawdataAnalysisModule.cc.

195 {
196 if (TRGDebug::level()) {
197 std::cout << "TRGECLRawdataAnalysisModule ... terminate called " << std::endl;
198 }
199 }

◆ terminate() [10/11]

void terminate ( void )
overridevirtual

Called when processing ended.

Reimplemented from HistoModule.

Definition at line 218 of file TRGGDLModule.cc.

219 {
220
221 _gdl->terminate();
222
223 B2DEBUG(100, "TRGGDLModule ... terminate called ");
224 }

◆ terminate() [11/11]

void terminate ( void )
overridevirtual

Called when processing ended.

Reimplemented from Module.

Definition at line 127 of file TRGGRLModule.cc.

128 {
129 _grl->terminate();
130 B2DEBUG(200, "TRGGRLModule ... terminate called ");
131 }

◆ to_bit_mask()

template<typename CONTAINER_T>
uint64_t to_bit_mask ( const CONTAINER_T & container)

Definition at line 30 of file bit_operations.h.

31 {
32
33 return std::accumulate(container.begin(), container.end(), uint64_t(0),
34 [](const auto & lhs, const auto & rhs) {
35 const auto bitshift = uint64_t(rhs);
36 if (bitshift > 32) {
37 throw std::runtime_error("from:\nuint64_t to_bit_mask(const CONTAINER_T& container)\ninput number to large.\n\n");
38 }
39 return lhs | (uint64_t(1) << bitshift);
40 });
41
42
43
44 }

◆ TRGCDCModule()

Constructor.

Definition at line 47 of file TRGCDCModule.cc.

48 : Module::Module(),
49 _debugLevel(0),
50 _configFilename("TRGCDCConfig.dat"),
51 _innerTSLUTFilename("undefined"),
52 _outerTSLUTFilename("undefined"),
53 _rootTRGCDCFilename("undefined"),
54 _rootFitter3DFilename("undefined"),
55 _curlBackStop(0),
56 _simulationMode(1),
57 _fastSimulationMode(0),
58 _firmwareSimulationMode(0),
59 _firmwareSimulationStart(0),
60 _firmwareSimulationStop(32 * 32 - 1),
61 _fileTRGCDC(0),
62 _perfect2DFinder(false),
63 _perfect3DFinder(false),
64 _hFinderPeakMin(5),
65 _hFinderMappingFilePlus("HoughMappingPlus20160223.dat"),
66 _hFinderMappingFileMinus("HoughMappingMinus20160223.dat"),
67 _hFinderDoit(2),
68 _fLogicLUTTSF(1),
69 _fLRLUT(1),
70 _fFitter3Dsmclr(0),
71 _fFitter3Ds2DFit(1),
72 _fFitter3Ds2DFitDrift(0),
73 _wireHitInefficiency(0.),
74 _fileTSF(0),
75 _fileETF(0),
76 _fverETF(0),
77 _fprintFirmETF(0),
78 _fileHough3D(0),
79 _finder3DMode(2),
80 _fileFitter3D(0),
81 _fXtSimpleFitter3D(0),
82 _trgCDCDataInputMode(0),
83 _cdc(0),
84 _sa(0)
85 {
86
87 string desc = "TRGCDCModule(" + version() + ")";
88 setDescription(desc);
89 setPropertyFlags(c_ParallelProcessingCertified);
90
91 vector<string> emptyvector;
92
93 addParam("DebugLevel", _debugLevel, "TRGCDC debug level", _debugLevel);
94 addParam("ConfigFile",
95 _configFilename,
96 "The filename of CDC trigger config file",
97 _configFilename);
98 addParam("ReturnValueModuleNames", _returnValueModuleNames,
99 "Chooses modules for return value. Can be a list of [TSF, ETF, 2DFind, 2DFit, 3DFind, 3DFit]. If empty list then returnValue will be for all modules.",
100 emptyvector);
101 addParam("InnerTSLUTFile",
102 _innerTSLUTFilename,
103 "The filename of LUT for inner-most track segments",
104 _innerTSLUTFilename);
105 addParam("OuterTSLUTFile",
106 _outerTSLUTFilename,
107 "The filename of LUT for outer track segments",
108 _outerTSLUTFilename);
109 addParam("RootTRGCDCFile",
110 _rootTRGCDCFilename,
111 "The filename of root file for TRGCDC",
112 string("TRGCDC.root"));
113 addParam("RootFitter3DFile",
114 _rootFitter3DFilename,
115 "The filename of root file for Fitter3D",
116 string("Fitter3D.root"));
117 addParam("CurlBackStop",
118 _curlBackStop,
119 "Curl back stop parameter",
120 _curlBackStop);
121 addParam("SimulationMode",
122 _simulationMode,
123 "TRGCDC simulation switch",
124 _simulationMode);
125 addParam("FastSimulationMode",
126 _fastSimulationMode,
127 "TRGCDC fast simulation mode",
128 _fastSimulationMode);
129 addParam("FirmwareSimulationMode",
130 _firmwareSimulationMode,
131 "TRGCDC firmware simulation mode",
132 _firmwareSimulationMode);
133 addParam("FirmwareSimulationStart",
134 _firmwareSimulationStart,
135 "TRGCDC firmware simulation start clock of CDC FE",
136 _firmwareSimulationStart);
137 addParam("FirmwareSimulationStop",
138 _firmwareSimulationStop,
139 "TRGCDC firmware simulation stop clock of CDC FE",
140 _firmwareSimulationStop);
141 addParam("TRGCDCRootFile",
142 _fileTRGCDC,
143 "Flag for making TRGCDC.root",
144 _fileTRGCDC);
145 addParam("TSFLogicLUT",
146 _fLogicLUTTSF,
147 "Use logic or LUT for TSF",
148 _fLogicLUTTSF);
149 addParam("2DFinderPerfect",
150 _perfect2DFinder,
151 "2D finder perfect option",
152 _perfect2DFinder);
153 addParam("3DFinderPerfect",
154 _perfect3DFinder,
155 "3D finder perfect option",
156 _perfect3DFinder);
157 addParam("HoughFinderPeakMin",
158 _hFinderPeakMin,
159 "Hough finder min. peak height",
160 _hFinderPeakMin);
161 addParam("HoughFinderMappingFilePlus",
162 _hFinderMappingFilePlus,
163 "Hough finder cell mapping file for charge plus",
164 _hFinderMappingFilePlus);
165 addParam("HoughFinderMappingFileMinus",
166 _hFinderMappingFileMinus,
167 "Hough finder cell mapping file for charge minus",
168 _hFinderMappingFileMinus);
169 addParam("HoughFinderDoit",
170 _hFinderDoit,
171 "Hough finder doit() version",
172 _hFinderDoit);
173 addParam("Fitter3DsLRLUT",
174 _fLRLUT,
175 "Using L/R LUT in fitter3D",
176 _fLRLUT);
177 addParam("Fitter3DsMcLR",
178 _fFitter3Dsmclr,
179 "Using MC L/R information for Fitter3D",
180 _fFitter3Dsmclr);
181 addParam("Fitter3Ds2DFit",
182 _fFitter3Ds2DFit,
183 "Using 1: 2D fit or 0: Hough Finder results for Fitter3D",
184 _fFitter3Ds2DFit);
185 addParam("Fitter3Ds2DFitDrift",
186 _fFitter3Ds2DFitDrift,
187 "Using 1: drift 2D fit or 0: wire 2D fit for Fitter3D",
188 _fFitter3Ds2DFitDrift);
189 addParam("wireHitInefficiency",
190 _wireHitInefficiency,
191 "wire hit inefficiency",
192 _wireHitInefficiency);
193 addParam("TSFRootFile",
194 _fileTSF,
195 "Flag for making TSF.root",
196 _fileTSF);
197 addParam("ETFRootFile",
198 _fileETF,
199 "Flag for making ETF.root",
200 _fileETF);
201 addParam("verETF",
202 _fverETF,
203 "Select ETF ver, 0:histogram, 1:old Version, 2:True T0",
204 _fverETF);
205 addParam("printFirmETF",
206 _fprintFirmETF,
207 "Flag for printing Firmware inputs for ETF",
208 _fprintFirmETF);
209 addParam("Hough3DRootFile",
210 _fileHough3D,
211 "Flag for making Hough3D.root",
212 _fileHough3D);
213 addParam("Finder3DMode",
214 _finder3DMode,
215 "Mode for finder3D",
216 _finder3DMode);
217 addParam("Fitter3DRootFile",
218 _fileFitter3D,
219 "Flag for making Fitter3D.root",
220 _fileFitter3D);
221 addParam("Fitter3DsXtSimple",
222 _fXtSimpleFitter3D,
223 "0: Use simple xt curve table. 1: use non-linear xt curve table.",
224 _fXtSimpleFitter3D);
225 addParam("TRGCDCDataInputMode",
226 _trgCDCDataInputMode,
227 "Flag for TRG CDC input mode",
228 _trgCDCDataInputMode);
229 addParam("inputCollection", m_inputCollectionName,
230 "Name of the CDCHit StoreArray to be used as input.",
231 string(""));
232 addParam("2DfinderCollection", m_2DfinderCollectionName,
233 "Name of the StoreArray holding the tracks made by the 2D finder.",
234 string("Trg2DFinderTracks"));
235 addParam("2DfitterCollection", m_2DfitterCollectionName,
236 "Name of the StoreArray holding the tracks made by the 2D fitter.",
237 string("Trg2DFitterTracks"));
238 addParam("3DfitterCollection", m_3DfitterCollectionName,
239 "Name of the StoreArray holding the tracks made by the 3D fitter.",
240 string("Trg3DFitterTracks"));
241
242
243 if (TRGDebug::level())
244 cout << "TRGCDCModule ... created" << endl;
245 }

◆ TRGCDCTSStreamModule()

Constructor.

Definition at line 42 of file TRGCDCTSStreamModule.cc.

43 : Module::Module(),
44 _debugLevel(0),
45 _mode(0),
46 _streamFilename("unknown"),
47 _cdc(0),
48 _out(0)
49 {
50
51 string desc = "TRGCDCTSStreamModule(" + version() + ")";
52 setDescription(desc);
53
54 addParam("DebugLevel",
55 _debugLevel,
56 "TRGCDCTSStream debug level",
57 _debugLevel);
58
59 addParam("Mode", _mode, "TRGCDCTSStream mode", _mode);
60
61 addParam("OutputStreamFile",
62 _streamFilename,
63 "The filename of bit stream",
64 _streamFilename);
65
66 if (TRGDebug::level())
67 cout << "TRGCDCTSStreamModule ... created" << endl;
68 }

◆ TRGECLBGTCHitModule()

Constructor.

Definition at line 41 of file TRGECLBGTCHitModule.cc.

42 : Module::Module(),
43 m_TCEnergyCut(0.005),
44 m_TCTimingCutLow(-1500),
45 m_TCTimingCutHigh(1500),
46 m_debugLevel(0)
47 {
48 string desc = "TRGECLBGTCHitModule(" + version() + ")";
49 setDescription(desc);
50 setPropertyFlags(c_ParallelProcessingCertified);
51
52 addParam("TCEnergyCut",
53 m_TCEnergyCut,
54 "TC energy cut: TC(E)<X (GeV), X=",
55 m_TCEnergyCut);
56 addParam("TCTimingCutLow",
57 m_TCTimingCutLow,
58 "TC Timing cut low: TC(T)>X (ns), X=",
59 m_TCTimingCutLow);
60 addParam("TCTimingCutHigh",
61 m_TCTimingCutHigh,
62 "TC Timing cut high: TC(T)<X (ns), X=",
63 m_TCTimingCutHigh);
64 addParam("DebugLevel",
65 m_debugLevel,
66 "TRGECL debug level",
67 m_debugLevel);
68
69 m_TCMap = new TrgEclMapping();
70
71 B2DEBUG(100, "TRGECLBGTCHitModule ... created");
72 }

◆ TRGECLFAMModule()

Constructor.

Definition at line 45 of file TRGECLFAMModule.cc.

46 : Module::Module(),
47 _debugLevel(0),
48 _famMethod(1),
49 _binTimeInterval(125),
50 _waveform(0),
51 _beambkgtag(0),
52 _famana(0),
53 _threshold(100.0),
54 _FADC(1),
55 _ConditionDB(0),
56 m_SourceOfTC(3)
57 {
58
59 string desc = "TRGECLFAMModule(" + version() + ")";
60 setDescription(desc);
61 setPropertyFlags(c_ParallelProcessingCertified);
62
63 addParam("DebugLevel", _debugLevel, "TRGECL debug level", _debugLevel);
64 addParam("FAMFitMethod", _famMethod, "TRGECLFAM fit method", _famMethod);
65 addParam("FAMBinTimeInterval", _binTimeInterval, "TRGECLFAM binTimeInterval",
66 _binTimeInterval);
67 addParam("TCWaveform", _waveform, "Output the TC waveform ",
68 _waveform);
69 addParam("FAMAnaTable", _famana, "Save FAM ana table ",
70 _famana);
71 addParam("BeamBkgTag", _beambkgtag, "Save beambackground tag in TRGECLHit table ",
72 _beambkgtag);
73 addParam("TCThreshold", _threshold, "Set FAM TC threshold ",
74 _threshold);
75 addParam("ShapingFunction", _FADC, "Set function of shaper ", _FADC);
76 addParam("ConditionDB", _ConditionDB, "Use conditionDB ", _ConditionDB);
77 addParam("SourceOfTC", m_SourceOfTC,
78 "Select source of TC data(1:=ECLHit or 2:=ECLSimHit or 3:=ECLHit+TRGECLBGTCHit)",
79 m_SourceOfTC);
80
81 if (_ConditionDB == 1) { //Use global tag
82 m_FAMPara.addCallback(this, &TRGECLFAMModule::beginRun);
83 }
84 B2DEBUG(100, "TRGECLFAMModule ... created");
85 Threshold.clear();
86
87 }

◆ TRGECLModule()

Constructor.

Definition at line 44 of file TRGECLModule.cc.

44 :
45 Module::Module(), _debugLevel(0), _Bhabha(0),
46 _Clustering(1), _ClusterLimit(6), _EventTiming(1),
47 _TimeWindow(250.0), _OverlapWindow(125.0), _NofTopTC(3),
48 _SelectEvent(1), _ConditionDB(0), _mumuThreshold(20),
49 _n300MeVCluster(1), _ECLBurstThreshold(200)
50 {
51
52 string desc = "TRGECLModule(" + version() + ")";
53 setDescription(desc);
54 setPropertyFlags(c_ParallelProcessingCertified);
55
56 addParam("DebugLevel",
57 _debugLevel,
58 "TRGECL debug level",
59 _debugLevel);
60 addParam("Bhabha",
61 _Bhabha,
62 "TRGECL Bhabha method 0 : Belle I, 1 :belle II(default)",
63 _Bhabha);
64 addParam("Clustering",
65 _Clustering,
66 "TRGECL Clustering method 0 : use only ICN, 1 : ICN + Energy(Default)",
67 _Clustering);
68 addParam("ClusterLimit",
69 _ClusterLimit,
70 "The Limit number of cluster (Default:6)",
71 _ClusterLimit);
72 addParam("EventTiming",
73 _EventTiming,
74 "TRGECL EventTiming method 0 : Belle I, 1 : Energetic TC, 2 : Energy Weighted timing (default)",
75 _EventTiming);
76 addParam("NofTopTC",
77 _NofTopTC,
78 "TRGECL # of considered TC in energy weighted Timing method(Only work for EvenTiming Method 2)",
79 _NofTopTC);
80 addParam("TimeWindow",
81 _TimeWindow,
82 "TRGECL Trigger decision Time Window",
83 _TimeWindow);
84 addParam("OverlapWindow",
85 _OverlapWindow,
86 "TRGECL Trigger decision Time Window",
87 _OverlapWindow);
88 addParam("EventSelect",
89 _SelectEvent,
90 "TRGECL Select one trigger window for logic study",
91 _SelectEvent);
92 addParam("ConditionDB",
93 _ConditionDB,
94 "Flag to use Condition Database(Default 0)",
95 _ConditionDB);
96 addParam("3DBhabhaVetoInTrackThetaRegion",
97 m_3DBhabhaVetoInTrackThetaRegion,
98 "set 3DBhabhaVetoInTrackThetaRegion (low TCID and high TCID)",
99 m_3DBhabhaVetoInTrackThetaRegion);
100 addParam("EventTimingQualityThresholds",
101 m_EventTimingQualityThresholds,
102 "set EventTimingQualityThresholds (low energy(GeV) and high energy(GeV))",
103 m_EventTimingQualityThresholds);
104 addParam("3DBhabhaAddAngleCut",
105 m_3DBhabhaAddAngleCut,
106 "set Angle Cut of Bhbaha Additional veto for hie (dphi low and high, theta sum low and high(degree)",
107 m_3DBhabhaAddAngleCut);
108 addParam("Taub2bAngleCut",
109 m_taub2bAngleCut,
110 "set Taub2bAngleCut(dphi low and high, theta sum low and high(degree)",
111 m_taub2bAngleCut);
112 addParam("Taub2bEtotCut",
113 m_taub2bEtotCut,
114 "set Taub2b total energy cut in TC ThetaID 1-17(GeV)",
115 m_taub2bEtotCut);
116 addParam("Taub2bClusterECut1",
117 m_taub2bClusterECut1,
118 "set Taub2b 1 cluster energy Cut (GeV) for CL1 : ",
119 m_taub2bClusterECut1);
120 addParam("Taub2bClusterECut2",
121 m_taub2bClusterECut2,
122 "set Taub2b 1 cluster energy Cut (GeV) for CL2 : ",
123 m_taub2bClusterECut2);
124
125 addParam("Taub2b2AngleCut",
126 m_taub2b2AngleCut,
127 "set Taub2b2AngleCut(dphi low and high, theta sum low and high(degree))",
128 m_taub2b2AngleCut);
129 addParam("Taub2b2EtotCut",
130 m_taub2b2EtotCut,
131 "set Taub2b2 total energy cut in TC ThetaID 1-17(GeV)",
132 m_taub2b2EtotCut);
133 addParam("Taub2b2CLEEndcapCut",
134 m_taub2b2CLEEndcapCut,
135 "set Taub2b2 energy Cut (GeV) for cluseter in endcap (GeV) : ",
136 m_taub2b2CLEEndcapCut);
137 addParam("Taub2b2CLECut",
138 m_taub2b2CLECut,
139 "set Taub2b2 cluster energy Cut (GeV) : ",
140 m_taub2b2CLECut);
141
142 addParam("Taub2b3AngleCut",
143 m_taub2b3AngleCut,
144 "set Taub2b3AngleCut(dphi low and high, theta sum low and high in cms (degree))",
145 m_taub2b3AngleCut);
146 addParam("Taub2b3EtotCut",
147 m_taub2b3EtotCut,
148 "set Taub2b3 total energy cut in lab in ThetaID 1-17(GeV)",
149 m_taub2b3EtotCut);
150 addParam("Taub2b3CLEb2bCut",
151 m_taub2b3CLEb2bCut,
152 "set Taub2b3 cluster energy Cut in lab for one of b2b clusters (GeV) : ",
153 m_taub2b3CLEb2bCut);
154 addParam("Taub2b3CLELowCut",
155 m_taub2b3CLELowCut,
156 "set Taub2b3 cluster energy low Cut in lab for all clusters (GeV) : ",
157 m_taub2b3CLELowCut);
158 addParam("Taub2b3CLEHighCut",
159 m_taub2b3CLEHighCut,
160 "set Taub2b3 cluster energy high Cut in lab for all clusters (GeV) : ",
161 m_taub2b3CLEHighCut);
162
163 _2DBhabhaThresholdFWD.clear();
164 _2DBhabhaThresholdBWD.clear();
165 _3DBhabhaSelectionThreshold.clear();
166 _3DBhabhaVetoThreshold.clear();
167 _3DBhabhaSelectionAngle.clear();
168 _3DBhabhaVetoAngle.clear();
169 _mumuAngle.clear();
170 m_3DBhabhaAddAngleCut.clear();
171 m_taub2bAngleCut.clear();
172 m_taub2b2AngleCut.clear();
173 m_taub2b3AngleCut.clear();
174
175 _TotalEnergy.clear();
176 _LowMultiThreshold.clear();
177
178 _TotalEnergy = {5, 10, 30}; // /100 MeV
179 _2DBhabhaThresholdFWD = {40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 30, 35}; // /100 MeV
180 _2DBhabhaThresholdBWD = {25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 30, 30}; // /100 MeV
181 _3DBhabhaVetoThreshold = {30, 45}; // /100 MeV
182 _3DBhabhaSelectionThreshold = {20, 40}; // /100 MeV
183 _3DBhabhaVetoAngle = {160, 200, 165, 190}; // /100 MeV
184 _3DBhabhaSelectionAngle = {140, 220, 160, 200}; // /100 MeV
185 _mumuThreshold = 20; //100 MeV
186 _mumuAngle = {160, 200, 165, 190}; // degree
187 m_3DBhabhaAddAngleCut = {150, 210, 160, 200}; // degree
188 _LowMultiThreshold = {10, 20, 25, 30}; // degree
189 _n300MeVCluster = 1;
190 _ECLBurstThreshold = 20;
191 m_3DBhabhaVetoInTrackThetaRegion = {3, 15};
192 m_EventTimingQualityThresholds = {0.5, 10}; // GeV
193 // taub2b
194 m_taub2bAngleCut = {110, 250, 130, 230}; // degree
195 m_taub2bEtotCut = 7; // GeV
196 m_taub2bClusterECut1 = 1.9; // GeV
197 m_taub2bClusterECut2 = 999; // GeV
198 // taub2b2
199 m_taub2b2AngleCut = {120, 240, 140, 220}; // degree
200 m_taub2b2EtotCut = 7.0; // GeV
201 m_taub2b2CLEEndcapCut = 3.0; // GeV
202 m_taub2b2CLECut = 0.162; // GeV
203 // taub2b3
204 m_taub2b3AngleCut = {120, 240, 140, 220}; // degree
205 m_taub2b3EtotCut = 7.0; // GeV
206 m_taub2b3CLEb2bCut = 0.14; // GeV
207 m_taub2b3CLELowCut = 0.12; // GeV
208 m_taub2b3CLEHighCut = 4.50; // GeV
209
210 if (TRGDebug::level()) {
211 std::cout << "TRGECLModule ... created" << std::endl;
212 }
213 }

◆ TRGECLQAMModule()

Constructor.

Definition at line 57 of file TRGECLQAMModule.cc.

58 : Module::Module(),
59 m_nevent(1), m_outputfile("")
60 {
61
62 string desc = "TRGECLQAMModule(" + version() + ")";
63 setDescription(desc);
64 setPropertyFlags(c_ParallelProcessingCertified);
65
66 addParam("outputFileName", m_outputfile, "TRGECL QAM file", m_outputfile);
67
68 m_nRun = 0;
69 m_nevent = 1;
70
71 //Problem TC Check
72 m_FWD = 0;
73 m_BAR = 0;
74 m_BWD = 0;
75 m_ALL = 0;
76 memset(TCID, 0, sizeof(TCID));
77
78
79 //Total Energy
80
81 m_etot = 0;
82 m_etot_mean = 0;
83 m_etot_error = 0;
84 m_etot_sigma = 0;
85
86 // std::vector<int> etot;
87 etot.clear();
88
89 //Caltime
90
91 m_caltime_mean = 0;
92 m_caltime_error = 0;
93 m_caltime_sigma = 0;
94 caltime.clear();
95
96 //Cluster E
97
98 clusterE = 0;
99 cluster.clear();
100
101 B2DEBUG(100, "TRGECLQAMModule ... created");
102 }

◆ TRGECLRawdataAnalysisModule()

Constructor.

Definition at line 37 of file TRGECLRawdataAnalysisModule.cc.

38 : Module::Module(),
39 _debugLevel(0), _Clustering(1)
40 {
41
42 string desc = "TRGECLRawdataAnalysisModule(" + version() + ")";
43 setDescription(desc);
44 // setPropertyFlags(c_ParallelProcessingCertified | c_InitializeInProcess);
45
46 addParam("DebugLevel", _debugLevel, "TRGECL debug level", _debugLevel);
47 addParam("Clustering", _Clustering, "TRGECL Clustering method 0 : use only ICN, 1 : ICN + Energy(Default)", _Clustering);
48
49
50
51 if (TRGDebug::level()) {
52 std::cout << "TRGECLRawdataAnalysisModule ... created" << std::endl;
53 }
54 }

◆ TRGGDLModule()

Constructor.

Definition at line 37 of file TRGGDLModule.cc.

37 : HistoModule(),
38//TRGGDLModule::TRGGDLModule()
39// : Module::Module(),
40 _debugLevel(0),
41 _configFilename("TRGGDLConfig.dat"),
42 _simulationMode(1),
43 _fastSimulationMode(0),
44 _firmwareSimulationMode(0),
45 _Phase("Phase2"),
46 _algFilePath("ftd.alg")
47 {
48
49 string desc = "TRGGDLModule(" + version() + ")";
50 setDescription(desc);
51 setPropertyFlags(c_ParallelProcessingCertified);
52
53 addParam("debugLevel", _debugLevel, "Debug Level", _debugLevel);
54 addParam("Belle2Phase", _Phase, "Phase2 or Phase3", _Phase);
55 addParam("ConfigFile",
56 _configFilename,
57 "The filename of CDC trigger config file",
58 _configFilename);
59 addParam("SimulationMode",
60 _simulationMode,
61 "TRGGDL simulation switch",
62 _simulationMode);
63 addParam("FastSimulationMode",
64 _fastSimulationMode,
65 "TRGGDL fast simulation mode",
66 _fastSimulationMode);
67 addParam("FirmwareSimulationMode",
68 _firmwareSimulationMode,
69 "TRGGDL firmware simulation mode",
70 _firmwareSimulationMode);
71
72 addParam("algFromDB",
73 _algFromDB,
74 "Set false when alg is taken from local file.",
75 true);
76
77 addParam("algFilePath",
78 _algFilePath,
79 ".alg file path",
80 _algFilePath);
81
82 addParam("timquality_threshold_sfin",
83 _timquality_threshold_sfin,
84 "Threshold to determine timing quality flag with MC truth: superfine",
85 -1.0);
86
87 addParam("timquality_threshold_fine",
88 _timquality_threshold_fine,
89 "Threshold to determine timing quality flag with MC truth: fine",
90 10.0);
91
92 addParam("simulateT0jitter",
93 m_simulateT0Jitter,
94 "if True, L1 jitter is simulated by EventT0Generator.",
95 false);
96
97 B2DEBUG(100, "TRGGDLModule ... created");
98 }

◆ TRGGRLModule()

Constructor.

Definition at line 36 of file TRGGRLModule.cc.

37 : Module::Module(),
38 _debugLevel(0),
39 _configFilename("TRGGDLConfig.dat"),
40 _simulationMode(2),
41 _fastSimulationMode(0),
42 _firmwareSimulationMode(0)
43 {
44
45 string desc = "TRGGRLModule(" + version() + ")";
46 setDescription(desc);
47 setPropertyFlags(c_ParallelProcessingCertified);
48
49 addParam("DebugLevel", _debugLevel, "TRGGRL debug level", _debugLevel);
50 addParam("ConfigFile",
51 _configFilename,
52 "The filename of CDC trigger config file",
53 _configFilename);
54 addParam("SimulationMode",
55 _simulationMode,
56 "TRGGRL simulation switch",
57 _simulationMode);
58 addParam("FastSimulationMode",
59 _fastSimulationMode,
60 "TRGGRL fast simulation mode",
61 _fastSimulationMode);
62 addParam("FirmwareSimulationMode",
63 _firmwareSimulationMode,
64 "TRGGRL firmware simulation mode",
65 _firmwareSimulationMode);
66 }

◆ version() [1/9]

string version ( void ) const

returns version of TRGCDCModule.

Definition at line 42 of file TRGCDCModule.cc.

43 {
44 return string("TRGCDCModule 5.07");
45 }

◆ version() [2/9]

string version ( void ) const

returns version of TRGCDCTSStreamModule.

Definition at line 37 of file TRGCDCTSStreamModule.cc.

38 {
39 return string("TRGCDCTSStreamModule 0.00");
40 }

◆ version() [3/9]

string version ( void ) const

returns version of TRGECLBGTCHitModule.

Definition at line 34 of file TRGECLBGTCHitModule.cc.

35 {
36 return string("TRGECLBGTCHitModule 1.00");
37 }

◆ version() [4/9]

string version ( void ) const

returns version of TRGECLFAMModule.

Definition at line 38 of file TRGECLFAMModule.cc.

39 {
40 return string("TRGECLFAMModule 1.00");
41 }

◆ version() [5/9]

string version ( void ) const

returns version of TRGECLModule.

Definition at line 37 of file TRGECLModule.cc.

38 {
39 return string("TRGECLModule 1.00");
40 }

◆ version() [6/9]

string version ( void ) const

version

Definition at line 50 of file TRGECLQAMModule.cc.

51 {
52 return string("TRGECLQAMModule 1.00");
53 }

◆ version() [7/9]

string version ( void ) const

returns version of TRGECLModule.

Definition at line 30 of file TRGECLRawdataAnalysisModule.cc.

31 {
32 return string("TRGECLAnalysisModule 1.00");
33 }

◆ version() [8/9]

string version ( void ) const

returns version of TRGGDLModule.

Definition at line 32 of file TRGGDLModule.cc.

33 {
34 return string("TRGGDLModule 0.00");
35 }

◆ version() [9/9]

string version ( void ) const

returns version of TRGGRLModule.

Definition at line 31 of file TRGGRLModule.cc.

32 {
33 return string("TRGGRLModule 0.00");
34 }

◆ ~TRGCDCModule()

~TRGCDCModule ( )
virtual

Destructor.

Definition at line 247 of file TRGCDCModule.cc.

248 {
249 if (_cdc)
250 TRGCDC::getTRGCDC("good-bye");
251
252 if (TRGDebug::level())
253 cout << "TRGCDCModule ... destructed " << endl;
254 }

◆ ~TRGCDCTSStreamModule()

~TRGCDCTSStreamModule ( )
virtual

Destructor.

Definition at line 70 of file TRGCDCTSStreamModule.cc.

71 {
72
73 if (_cdc)
74 TRGCDC::getTRGCDC("good-bye");
75
76 if (TRGDebug::level())
77 cout << "TRGCDCTSStreamModule ... destructed " << endl;
78 }

◆ ~TRGECLBGTCHitModule()

~TRGECLBGTCHitModule ( )
virtual

Destructor.

Definition at line 76 of file TRGECLBGTCHitModule.cc.

77 {
78 B2DEBUG(100, "TRGECLBGTCHitModule ... destructed ");
79 }

◆ ~TRGECLFAMModule()

~TRGECLFAMModule ( )
virtual

Destructor.

Definition at line 91 of file TRGECLFAMModule.cc.

92 {
93
94 B2DEBUG(100, "TRGECLFAMModule ... destructed ");
95
96 }

◆ ~TRGECLModule()

~TRGECLModule ( )
virtual

Destructor.

Definition at line 217 of file TRGECLModule.cc.

218 {
219 if (TRGDebug::level()) {
220 std::cout << "TRGECLModule ... destructed " << std::endl;
221
222 }
223 }

◆ ~TRGECLQAMModule()

~TRGECLQAMModule ( )
virtual

Destrunctor.

Definition at line 106 of file TRGECLQAMModule.cc.

107 {
108
109 B2DEBUG(100, "TRGECLQAMModule ... destructed ");
110 }

◆ ~TRGECLRawdataAnalysisModule()

Destructor.

Definition at line 58 of file TRGECLRawdataAnalysisModule.cc.

59 {
60
61 if (TRGDebug::level()) {
62 std::cout << "TRGECLRawdataAnalysisModule ... destructed " << std::endl;
63
64 }
65 }

◆ ~TRGGDLModule()

~TRGGDLModule ( )
virtual

Destructor.

Definition at line 100 of file TRGGDLModule.cc.

101 {
102
103 if (_gdl)
104 B2DEBUG(100, "good-bye");
105
106 B2DEBUG(100, "TRGGDLModule ... destructed ");
107 }

◆ ~TRGGRLModule()

~TRGGRLModule ( )
virtual

Destructor.

Definition at line 68 of file TRGGRLModule.cc.

69 {
70
71 if (_grl)
72 TRGGRL::getTRGGRL("good-bye");
73
74 }

Variable Documentation

◆ _gdl

TRGGDL * _gdl = 0
staticprivate

A pointer to a TRGGDL;.

Definition at line 113 of file TRGGDLModule.h.

◆ _grl

TRGGRL * _grl = 0
staticprivate

A pointer to a TRGGRL;.

Definition at line 79 of file TRGGRLModule.h.

◆ intNaN

const int intNaN = std::numeric_limits<int>::quiet_NaN()
static

Definition at line 53 of file trgrawdataModule.h.

◆ Linear_fit_of_Hits

Linear_fit_of_Hits_t Linear_fit_of_Hits
constexpr

Definition at line 140 of file klmtrgLinearFit.cc.

◆ mergerWidth

int mergerWidth = 256
staticconstexpr

Merger data width.

Definition at line 45 of file CDCTriggerUnpackerModule.h.

◆ nAllMergers

int nAllMergers = 146
staticconstexpr

Number of Mergers.

Definition at line 47 of file CDCTriggerUnpackerModule.h.

◆ nFinesse

int nFinesse = 48
staticconstexpr

Number of FINESSE in a PCIe40.

Definition at line 51 of file CDCTriggerUnpackerModule.h.

◆ wordWidth

int wordWidth = 32
staticconstexpr

width of a single word in the raw int buffer

Definition at line 49 of file CDCTriggerUnpackerModule.h.