Belle II Software development
CDCTrigger2DFinderModule Class Reference
Inheritance diagram for CDCTrigger2DFinderModule:
Module PathElement

Public Types

enum  EModulePropFlags {
  c_Input = 1 ,
  c_Output = 2 ,
  c_ParallelProcessingCertified = 4 ,
  c_HistogramManager = 8 ,
  c_InternalSerializer = 16 ,
  c_TerminateInAllProcesses = 32 ,
  c_DontCollectStatistics = 64 ,
  c_NoParallelWork = 128
}
 Each module can be tagged with property flags, which indicate certain features of the module. More...
 
typedef ModuleCondition::EAfterConditionPath EAfterConditionPath
 Forward the EAfterConditionPath definition from the ModuleCondition.
 

Public Member Functions

 CDCTrigger2DFinderModule ()
 Constructor.
 
virtual void initialize () override
 Initialize the module and check module parameters.
 
virtual void beginRun () override
 Register run-dependent DataStore arrays.
 
virtual void event () override
 Run tracking.
 
virtual void terminate () override
 Clean up.
 
int fastInterceptFinder (CDCHitMap &hits, double x1_s, double x2_s, double y1_s, double y2_s, unsigned iterations, unsigned ix_s, unsigned iy_s)
 Fast intercept finder Divide Hough plane recursively to find cells with enough crossing lines.
 
bool shortTrack (std::bitset< 45 > &superLayers)
 check the short track condition (= hits in the inner super layers rather than any super layers)
 
void connectedRegions ()
 Combine Hough candidates to tracks by merging connected cells.
 
void addNeighbors (const CDCTriggerHoughCand &center, const std::vector< CDCTriggerHoughCand > &candidates, std::vector< CDCTriggerHoughCand > &merged, std::vector< CDCTriggerHoughCand > &rejected, unsigned short nSLmax) const
 Recursive function to add combine connected cells.
 
bool inList (const CDCTriggerHoughCand &a, const std::vector< CDCTriggerHoughCand > &list) const
 Check if candidate is in list.
 
bool connected (const CDCTriggerHoughCand &a, const CDCTriggerHoughCand &b) const
 Check if candidates are connected.
 
void mergeIdList (std::vector< unsigned > &merged, std::vector< unsigned > &a, std::vector< unsigned > &b)
 Merge lists a and b and put the result in merged.
 
void patternClustering (const CDCHitMap &inputMap)
 Combine Hough candidates to tracks by a fixed pattern algorithm.
 
bool connectedLR (unsigned patternL, unsigned patternR)
 Check for left/right connection of patterns in 2 x 2 squares.
 
bool connectedUD (unsigned patternD, unsigned patternU)
 Check for up/down connection of patterns in 2 x 2 squares.
 
bool connectedDiag (unsigned patternLD, unsigned patternRU)
 Check for diagonal connected of patterns in 2 x 2 squares.
 
unsigned topRightSquare (std::vector< unsigned > &pattern)
 Find the top right square within a cluster of 2 x 2 squares In case of ambiguity, top is favored over right @ return index of corner within pattern vector.
 
unsigned topRightCorner (unsigned pattern)
 Find the top right corner within 2 x 2 square.
 
unsigned bottomLeftCorner (unsigned pattern)
 Find the bottom left corner within 2 x 2 square.
 
void findAllCrossingHits (std::vector< unsigned > &list, double x1, double x2, double y1, double y2, const CDCHitMap &inputMap)
 Find all hits in inputMap whose Hough curve crosses the rectangle with corners (x1, y1) and (x2, y2) and add the hit indices to list.
 
void selectHits (std::vector< unsigned > &list, std::vector< unsigned > &selected, std::vector< unsigned > &unselected)
 Select one hit per super layer.
 
virtual std::vector< std::string > getFileNames (bool outputFiles)
 Return a list of output filenames for this modules.
 
virtual void endRun ()
 This method is called if the current run ends.
 
const std::string & getName () const
 Returns the name of the module.
 
const std::string & getType () const
 Returns the type of the module (i.e.
 
const std::string & getPackage () const
 Returns the package this module is in.
 
const std::string & getDescription () const
 Returns the description of the module.
 
void setName (const std::string &name)
 Set the name of the module.
 
void setPropertyFlags (unsigned int propertyFlags)
 Sets the flags for the module properties.
 
LogConfig & getLogConfig ()
 Returns the log system configuration.
 
void setLogConfig (const LogConfig &logConfig)
 Set the log system configuration.
 
void setLogLevel (int logLevel)
 Configure the log level.
 
void setDebugLevel (int debugLevel)
 Configure the debug messaging level.
 
void setAbortLevel (int abortLevel)
 Configure the abort log level.
 
void setLogInfo (int logLevel, unsigned int logInfo)
 Configure the printed log information for the given level.
 
void if_value (const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 Add a condition to the module.
 
void if_false (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to add a condition to the module.
 
void if_true (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to set the condition of the module.
 
bool hasCondition () const
 Returns true if at least one condition was set for the module.
 
const ModuleCondition * getCondition () const
 Return a pointer to the first condition (or nullptr, if none was set)
 
const std::vector< ModuleCondition > & getAllConditions () const
 Return all set conditions for this module.
 
bool evalCondition () const
 If at least one condition was set, it is evaluated and true returned if at least one condition returns true.
 
std::shared_ptr< Path > getConditionPath () const
 Returns the path of the last true condition (if there is at least one, else reaturn a null pointer).
 
Module::EAfterConditionPath getAfterConditionPath () const
 What to do after the conditional path is finished.
 
std::vector< std::shared_ptr< Path > > getAllConditionPaths () const
 Return all condition paths currently set (no matter if the condition is true or not).
 
bool hasProperties (unsigned int propertyFlags) const
 Returns true if all specified property flags are available in this module.
 
bool hasUnsetForcedParams () const
 Returns true and prints error message if the module has unset parameters which the user has to set in the steering file.
 
const ModuleParamList & getParamList () const
 Return module param list.
 
template<typename T>
ModuleParam< T > & getParam (const std::string &name) const
 Returns a reference to a parameter.
 
bool hasReturnValue () const
 Return true if this module has a valid return value set.
 
int getReturnValue () const
 Return the return value set by this module.
 
std::shared_ptr< PathElement > clone () const override
 Create an independent copy of this module.
 
std::shared_ptr< boost::python::list > getParamInfoListPython () const
 Returns a python list of all parameters.
 

Static Public Member Functions

static void exposePythonAPI ()
 Exposes methods of the Module class to Python.
 

Protected Member Functions

virtual void def_initialize ()
 Wrappers to make the methods without "def_" prefix callable from Python.
 
virtual void def_beginRun ()
 Wrapper method for the virtual function beginRun() that has the implementation to be used in a call from Python.
 
virtual void def_event ()
 Wrapper method for the virtual function event() that has the implementation to be used in a call from Python.
 
virtual void def_endRun ()
 This method can receive that the current run ends as a call from the Python side.
 
virtual void def_terminate ()
 Wrapper method for the virtual function terminate() that has the implementation to be used in a call from Python.
 
void setDescription (const std::string &description)
 Sets the description of the module.
 
void setType (const std::string &type)
 Set the module type.
 
template<typename T>
void addParam (const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
 Adds a new parameter to the module.
 
template<typename T>
void addParam (const std::string &name, T &paramVariable, const std::string &description)
 Adds a new enforced parameter to the module.
 
void setReturnValue (int value)
 Sets the return value for this module as integer.
 
void setReturnValue (bool value)
 Sets the return value for this module as bool.
 
void setParamList (const ModuleParamList &params)
 Replace existing parameter list.
 

Protected Attributes

std::string m_hitCollectionName
 Name of the StoreArray containing the input track segment hits.
 
std::string m_outputCollectionName
 Name of the StoreArray containing the tracks found by the Hough tracking.
 
std::string m_clusterCollectionName
 Name of the StoreArray containing the clusters formed in the Hough plane.
 
unsigned m_nCellsPhi
 number of Hough cells in phi
 
unsigned m_nCellsR
 number of Hough cells in 1/r
 
double m_minPt
 Hough plane limit in Pt [GeV].
 
int m_shiftPt
 shift the Hough plane in 1/r to avoid curvature 0 tracks < 0: shift in negative direction (negative half is larger) 0: no shift (same limits for negative and positive half)
 
double m_maxR = 0.
 Hough plane limit in 1/r [1/cm].
 
double m_shiftR = 0.
 Hough plane shift in 1/r [1/cm].
 
unsigned m_maxIterations = 0
 number of iterations for the fast peak finder, smallest n such that 2^(n+1) > max(nCellsPhi, nCellsR).
 
unsigned m_nCells = 0
 number of cells for the fast peak finder: 2^(maxIterations + 1).
 
double m_rectX = 0
 Store the rectangle size in x.
 
double m_rectY = 0
 Store the rectangle size in y.
 
unsigned m_minHits
 minimum number of hits from different super layers in a Hough cell to form a candidate
 
unsigned m_minHitsShort
 short tracks require hits in the first minHitsShort super layers to form a candidate
 
unsigned m_minCells
 minimum number of cells in a cluster to form a track
 
bool m_onlyLocalMax
 switch to ignore candidates connected to cells with higher super layer count
 
unsigned m_connect
 number of neighbors to check for connection (4: direct, 6: direct + upper right and lower left corner, 8: direct + all corners)
 
bool m_ignore2nd
 switch to skip second priority hits
 
bool m_usePriority
 switch between priority position and center position of track segment
 
bool m_requireSL0
 switch to check separately for a hit in the innermost super layer
 
bool m_suppressClone
 switch to send only the first found track and suppress the subsequent clones
 
bool m_usehitpattern
 switch to use hit pattern inside TSF
 
bool m_useadc
 switch to use hit pattern inside TSF with ADC cut
 
bool m_useDB
 switch to use database to load run dependent parameter
 
unsigned m_storePlane
 switch to save the Hough plane in DataStore (0: don't save, 1: save only peaks, 2: save full plane)
 
bool m_clusterPattern
 switch for clustering algorithm (if true use nested patterns)
 
unsigned m_clusterSizeX
 maximum cluster size for pattern algorithm
 
unsigned m_clusterSizeY
 maximum cluster size for pattern algorithm
 
bool m_hitRelationsFromCorners
 switch for creating relations to hits in the pattern clustering algorithm.
 
std::string m_testFilename
 filename for test output for firmware debugging
 
std::ofstream m_testFile
 filestream for test output for firmware debugging
 
CDCHitMap m_hitMap
 map of TS hits containing <iHit, <iSL, (x, y)>> with iHit: hit index in StoreArray iSL: super layer index
 
std::vector< CDCTriggerHoughCand > m_houghCand
 Hough Candidates.
 
double m_radius [9][5] = {{0.}}
 Radius of the CDC layers with priority wires (2 per super layer).
 
unsigned m_TSoffset [10] = {0}
 Number of track segments up to super layer.
 
StoreArray< CDCTriggerSegmentHit > m_segmentHits
 list of track segment hits
 
StoreArray< CDCTriggerTrack > m_tracks
 list of found tracks
 
StoreArray< CDCTriggerHoughCluster > m_clusters
 list of clusters in the Hough map
 
StoreObjPtr< TMatrix > m_houghPlane
 matrix containing the Hough plane
 
DBObjPtr< CDCTrigger2DConfig > m_cdctrg2d_DB
 run dependent parameter database of 2D
 

Private Member Functions

std::list< ModulePtr > getModules () const override
 no submodules, return empty list
 
std::string getPathString () const override
 return the module name.
 
void setParamPython (const std::string &name, const boost::python::object &pyObj)
 Implements a method for setting boost::python objects.
 
void setParamPythonDict (const boost::python::dict &dictionary)
 Implements a method for reading the parameter values from a boost::python dictionary.
 

Private Attributes

std::string m_name
 The name of the module, saved as a string (user-modifiable)
 
std::string m_type
 The type of the module, saved as a string.
 
std::string m_package
 Package this module is found in (may be empty).
 
std::string m_description
 The description of the module.
 
unsigned int m_propertyFlags
 The properties of the module as bitwise or (with |) of EModulePropFlags.
 
LogConfig m_logConfig
 The log system configuration of the module.
 
ModuleParamList m_moduleParamList
 List storing and managing all parameter of the module.
 
bool m_hasReturnValue
 True, if the return value is set.
 
int m_returnValue
 The return value.
 
std::vector< ModuleCondition > m_conditions
 Module condition, only non-null if set.
 

Detailed Description

Definition at line 86 of file CDCTrigger2DFinderModule.h.

Member Typedef Documentation

◆ EAfterConditionPath

Forward the EAfterConditionPath definition from the ModuleCondition.

Definition at line 89 of file Module.h.

Member Enumeration Documentation

◆ EModulePropFlags

enum EModulePropFlags
inherited

Each module can be tagged with property flags, which indicate certain features of the module.

Enumerator
c_Input 

This module is an input module (reads data).

c_Output 

This module is an output module (writes data).

c_ParallelProcessingCertified 

This module can be run in parallel processing mode safely (All I/O must be done through the data store, in particular, the module must not write any files.)

c_HistogramManager 

This module is used to manage histograms accumulated by other modules.

c_InternalSerializer 

This module is an internal serializer/deserializer for parallel processing.

c_TerminateInAllProcesses 

When using parallel processing, call this module's terminate() function in all processes().

This will also ensure that there is exactly one process (single-core if no parallel modules found) or at least one input, one main and one output process.

c_DontCollectStatistics 

No statistics is collected for this module.

c_NoParallelWork 

This module does no per-event work that is worth running in parallel.

A parallel section made up only of such modules is merged back into the input path, so that a single uncertified module in between does not prevent the modules after it from being parallelised.

Definition at line 77 of file Module.h.

77 {
78 c_Input = 1,
79 c_Output = 2,
80 c_ParallelProcessingCertified = 4,
81 c_HistogramManager = 8,
82 c_InternalSerializer = 16,
83 c_TerminateInAllProcesses = 32,
84 c_DontCollectStatistics = 64,
85 c_NoParallelWork = 128,
86 };
@ c_Output
Output Process.
Definition ProcHelper.h:19
@ c_Input
Input Process.
Definition ProcHelper.h:17

Constructor & Destructor Documentation

◆ CDCTrigger2DFinderModule()

Constructor.

Definition at line 34 of file CDCTrigger2DFinderModule.cc.

34 : Module()
35{
36 //Set module properties
37 setDescription("Hough tracking algorithm for CDC trigger.");
39
40 // Define module parameters
41 addParam("hitCollectionName", m_hitCollectionName,
42 "Name of the input StoreArray of CDCTriggerSegmentHits.",
43 std::string(""));
44 addParam("outputCollectionName", m_outputCollectionName,
45 "Name of the StoreArray holding the tracks found in the Hough tracking.",
46 std::string("TRGCDC2DFinderTracks"));
47 addParam("clusterCollectionName", m_clusterCollectionName,
48 "Name of the StoreArray holding the clusters formed in the Hough plane.",
49 std::string(""));
50 addParam("nCellsPhi", m_nCellsPhi,
51 "Number of Hough cells in phi (limits: [-180, 180]). Must be an even number.",
52 (unsigned)(160));
53 addParam("nCellsR", m_nCellsR,
54 "Number of Hough cells in 1/r. Must be an even number.",
55 (unsigned)(34));
56 addParam("minPt", m_minPt,
57 "Minimum Pt [GeV]. "
58 "Hough plane limits in 1/r are [-1/r(minPt), 1/r(minPt)]", (double)(0.3));
59 addParam("shiftPt", m_shiftPt,
60 "Shift the Hough plane by 1/4 cell size in 1/r to avoid "
61 "curvature 0 tracks (<0: shift in negative direction, "
62 "0: no shift, >0: shift in positive direction).", 0);
63
64 addParam("minHits", m_minHits,
65 "Minimum hits from different super layers required in a peak cell.",
66 (unsigned)(4));
67 addParam("minHitsShort", m_minHitsShort,
68 "Minimum hits required required in a peak cell for a short track"
69 " (must be in the first minHitsShort super layers).",
70 (unsigned)(4));
71 addParam("minCells", m_minCells,
72 "Peaks with less than minCells connected cells are ignored.",
73 (unsigned)(2));
74 addParam("onlyLocalMax", m_onlyLocalMax,
75 "Switch to remove cells connected to a cell with higher super layer count.",
76 false);
77 addParam("connect", m_connect,
78 "Definition for connected cells. 4: direct (left/right/top/bottom), "
79 "6: direct + 2 diagonal (top right/bottom left), "
80 "8: direct + all diagonal (top right/top left/bottom right/bottom left)",
81 (unsigned)(6));
82 addParam("ignore2ndPriority", m_ignore2nd,
83 "Switch to skip second priority hits.", false);
84 addParam("usePriorityPosition", m_usePriority,
85 "If true, use wire position of priority cell in track segment, "
86 "otherwise use wire position of center cell.", true);
87 addParam("requireSL0", m_requireSL0,
88 "Switch to check separately for a hit in the innermost superlayer.", false);
89 addParam("storeHoughPlane", m_storePlane,
90 "Switch for saving Hough plane as TMatrix in DataStore. "
91 "0: don't store anything, 1: store only peaks, 2: store full plane "
92 "(will increase runtime).", (unsigned)(0));
93 addParam("clusterPattern", m_clusterPattern,
94 "use nested pattern algorithm to find clusters", true);
95 addParam("clusterSizeX", m_clusterSizeX,
96 "maximum number of 2 x 2 squares in cluster for pattern algorithm",
97 (unsigned)(3));
98 addParam("clusterSizeY", m_clusterSizeY,
99 "maximum number of 2 x 2 squares in cluster for pattern algorithm",
100 (unsigned)(3));
101 addParam("hitRelationsFromCorners", m_hitRelationsFromCorners,
102 "Switch for creating relations to hits in the pattern algorithm. "
103 "If true, create relations from cluster corners, otherwise "
104 "from estimated cluster center (might not have relations).", false);
105
106 addParam("testFilename", m_testFilename,
107 "If not empty, a file with input (hits) and output (tracks) "
108 "for each event is written (for firmware debugging).", std::string(""));
109
110 addParam("suppressClone", m_suppressClone,
111 "Switch to send only the first found track and suppress the "
112 "subsequent clones.", false);
113
114 addParam("usehitpattern", m_usehitpattern,
115 "Switch to use hit pattern inside TSF ", false);
116
117 addParam("useadc", m_useadc,
118 "Switch to use ADC. Can be used with usehitpattern enabled. ", false);
119
120 addParam("useDB", m_useDB,
121 "Switch to use database to load run dependent parameters. ", true);
122}
bool m_usehitpattern
switch to use hit pattern inside TSF
std::string m_testFilename
filename for test output for firmware debugging
unsigned m_minCells
minimum number of cells in a cluster to form a track
bool m_useadc
switch to use hit pattern inside TSF with ADC cut
unsigned m_minHitsShort
short tracks require hits in the first minHitsShort super layers to form a candidate
unsigned m_nCellsR
number of Hough cells in 1/r
int m_shiftPt
shift the Hough plane in 1/r to avoid curvature 0 tracks < 0: shift in negative direction (negative h...
std::string m_outputCollectionName
Name of the StoreArray containing the tracks found by the Hough tracking.
unsigned m_nCellsPhi
number of Hough cells in phi
bool m_usePriority
switch between priority position and center position of track segment
bool m_clusterPattern
switch for clustering algorithm (if true use nested patterns)
bool m_hitRelationsFromCorners
switch for creating relations to hits in the pattern clustering algorithm.
unsigned m_storePlane
switch to save the Hough plane in DataStore (0: don't save, 1: save only peaks, 2: save full plane)
bool m_ignore2nd
switch to skip second priority hits
unsigned m_connect
number of neighbors to check for connection (4: direct, 6: direct + upper right and lower left corner...
bool m_suppressClone
switch to send only the first found track and suppress the subsequent clones
unsigned m_clusterSizeX
maximum cluster size for pattern algorithm
double m_minPt
Hough plane limit in Pt [GeV].
bool m_requireSL0
switch to check separately for a hit in the innermost super layer
unsigned m_minHits
minimum number of hits from different super layers in a Hough cell to form a candidate
std::string m_clusterCollectionName
Name of the StoreArray containing the clusters formed in the Hough plane.
std::string m_hitCollectionName
Name of the StoreArray containing the input track segment hits.
bool m_onlyLocalMax
switch to ignore candidates connected to cells with higher super layer count
bool m_useDB
switch to use database to load run dependent parameter
unsigned m_clusterSizeY
maximum cluster size for pattern algorithm
void setDescription(const std::string &description)
Sets the description of the module.
Definition Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition Module.cc:208
Module()
Constructor.
Definition Module.cc:30
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition Module.h:80
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition Module.h:560

Member Function Documentation

◆ addNeighbors()

void addNeighbors ( const CDCTriggerHoughCand & center,
const std::vector< CDCTriggerHoughCand > & candidates,
std::vector< CDCTriggerHoughCand > & merged,
std::vector< CDCTriggerHoughCand > & rejected,
unsigned short nSLmax ) const

Recursive function to add combine connected cells.

All candidates are compared to center. Connected candidates are added to the merged list. If the module option onlyLocalMax is on, connected cells with SLcount lower than the cluster maximum are added to the rejected list instead. The function is called recursively for all connected candidates.

Parameters
centerstarting candidate
candidateslist of candidates compared to center
mergedlist for storing all candidates belonging to the cluster
rejectedlist for storing rejected candidates (connected, but lower SLcount, not in any other cluster either)
nSLmaxhighest SLcount for this cluster

Definition at line 296 of file CDCTriggerHoughtrafo.cc.

301{
302 for (unsigned icand = 0; icand < candidates.size(); ++icand) {
303 B2DEBUG(120, "compare center " << center.getID()
304 << " to " << candidates[icand].getID());
305 if (inList(candidates[icand], merged) || inList(candidates[icand], rejected)) {
306 B2DEBUG(120, " " << candidates[icand].getID() << " already in list");
307 continue;
308 }
309 bool reject = inList(center, rejected);
310 if (connected(center, candidates[icand])) {
311 if (m_onlyLocalMax && candidates[icand].getSLcount() < nSLmax) {
312 B2DEBUG(100, " lower than highest SLcount, rejected");
313 rejected.push_back(candidates[icand]);
314 } else if (m_onlyLocalMax && !reject && candidates[icand].getSLcount() > nSLmax) {
315 B2DEBUG(100, " new highest SLcount, clearing list");
316 nSLmax = candidates[icand].getSLcount();
317 for (unsigned imerged = 0; imerged < merged.size(); ++imerged) {
318 rejected.push_back(merged[imerged]);
319 }
320 merged.clear();
321 merged.push_back(candidates[icand]);
322 } else if (m_onlyLocalMax && candidates[icand].getSLcount() > center.getSLcount()) {
323 B2DEBUG(100, " connected to rejected cell, skip");
324 continue;
325 } else if (m_onlyLocalMax && reject) {
326 B2DEBUG(100, " connected to rejected cell, rejected");
327 rejected.push_back(candidates[icand]);
328 } else {
329 B2DEBUG(100, " connected");
330 merged.push_back(candidates[icand]);
331 }
332 std::vector<CDCTriggerHoughCand> cpyCand = candidates;
333 cpyCand.erase(cpyCand.begin() + icand);
334 addNeighbors(candidates[icand], cpyCand, merged, rejected, nSLmax);
335 }
336 }
337}
bool inList(const CDCTriggerHoughCand &a, const std::vector< CDCTriggerHoughCand > &list) const
Check if candidate is in list.
bool connected(const CDCTriggerHoughCand &a, const CDCTriggerHoughCand &b) const
Check if candidates are connected.
void addNeighbors(const CDCTriggerHoughCand &center, const std::vector< CDCTriggerHoughCand > &candidates, std::vector< CDCTriggerHoughCand > &merged, std::vector< CDCTriggerHoughCand > &rejected, unsigned short nSLmax) const
Recursive function to add combine connected cells.
unsigned getID() const
Get candidate number.
unsigned short getSLcount() const
Get super layer count.
int getID(const std::vector< double > &breaks, double t)
get id of the time point t
Definition calibTools.h:60

◆ beginRun()

void beginRun ( void )
overridevirtual

Register run-dependent DataStore arrays.

Reimplemented from Module.

Definition at line 169 of file CDCTrigger2DFinderModule.cc.

170{
171 if (m_useDB) {
172 if (not m_cdctrg2d_DB.isValid()) {
173 StoreObjPtr<EventMetaData> evtMetaData;
174 B2FATAL("No database for CDCTRG 2D parameter. exp " << evtMetaData->getExperiment() << " run "
175 << evtMetaData->getRun());
176 } else {
177 m_usehitpattern = m_cdctrg2d_DB->getfullhit();
178 m_useadc = m_cdctrg2d_DB->getADC();
179 m_minHits = m_cdctrg2d_DB->gethitthreshold();
180 m_minHitsShort = m_cdctrg2d_DB->gethitthreshold();
181 }
182 }
183
184 const CDCGeometryPar& cdc = CDCGeometryPar::Instance();
185 int layerId = 3;
186 int nTS = 0;
187 for (int iSL = 0; iSL < 9; ++iSL) {
188 m_TSoffset[iSL] = nTS;
189 nTS += cdc.nWiresInLayer(layerId);
190 m_TSoffset[iSL + 1] = nTS;
191 if (!m_usehitpattern) {
192 for (int priority = 0; priority < 2; ++ priority) {
193 m_radius[iSL][priority] = cdc.senseWireR(layerId + priority);
194 }
195 } else {
196 for (int priority = 0; priority < 5; ++ priority) {
197 if (iSL == 0) m_radius[iSL][priority] = cdc.senseWireR(layerId + priority);
198 else m_radius[iSL][priority] = cdc.senseWireR(layerId + priority - 2);
199 }
200 }
201 layerId += (iSL > 0 ? 6 : 7);
202 }
203}
double m_radius[9][5]
Radius of the CDC layers with priority wires (2 per super layer).
unsigned m_TSoffset[10]
Number of track segments up to super layer.
DBObjPtr< CDCTrigger2DConfig > m_cdctrg2d_DB
run dependent parameter database of 2D
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.

◆ bottomLeftCorner()

unsigned bottomLeftCorner ( unsigned pattern)

Find the bottom left corner within 2 x 2 square.

In case of ambiguity left corner is returned. x . -> return this one . x @ return index of corner within pattern

Definition at line 799 of file CDCTriggerHoughtrafo.cc.

800{
801 // scan pattern from left to right:
802 // 2 3
803 // 0 1
804 if (pattern & 1) return 0;
805 if ((pattern >> 2) & 1) {
806 if ((pattern >> 1) & 1) {
807 setReturnValue(false);
808 B2DEBUG(100, "bottomLeftCorner not unique");
809 }
810 return 2;
811 }
812 if ((pattern >> 1) & 1) return 1;
813 return 3;
814}
void setReturnValue(int value)
Sets the return value for this module as integer.
Definition Module.cc:220

◆ clone()

std::shared_ptr< PathElement > clone ( ) const
overridevirtualinherited

Create an independent copy of this module.

Note that parameters are shared, so changing them on a cloned module will also affect the original module.

Implements PathElement.

Definition at line 179 of file Module.cc.

180{
183 newModule->setName(getName());
184 newModule->m_package = m_package;
185 newModule->m_propertyFlags = m_propertyFlags;
186 newModule->m_logConfig = m_logConfig;
187 newModule->m_conditions = m_conditions;
188
189 return newModule;
190}
std::shared_ptr< Module > registerModule(const std::string &moduleName, std::string sharedLibPath="") noexcept(false)
Creates an instance of a module and registers it to the ModuleManager.
static ModuleManager & Instance()
Exception is thrown if the requested module could not be created by the ModuleManager.
void setParameters(const ModuleParamList &params)
Set values for parameters from other parameter list.
const ModuleParamList & getParamList() const
Return module param list.
Definition Module.h:363
const std::string & getName() const
Returns the name of the module.
Definition Module.h:187
const std::string & getType() const
Returns the type of the module (i.e.
Definition Module.cc:41
unsigned int m_propertyFlags
The properties of the module as bitwise or (with |) of EModulePropFlags.
Definition Module.h:512
ModuleParamList m_moduleParamList
List storing and managing all parameter of the module.
Definition Module.h:516
void setName(const std::string &name)
Set the name of the module.
Definition Module.h:214
LogConfig m_logConfig
The log system configuration of the module.
Definition Module.h:514
std::vector< ModuleCondition > m_conditions
Module condition, only non-null if set.
Definition Module.h:521
std::string m_package
Package this module is found in (may be empty).
Definition Module.h:510
std::shared_ptr< Module > ModulePtr
Defines a pointer to a module object as a boost shared pointer.
Definition Module.h:43

◆ connected()

bool connected ( const CDCTriggerHoughCand & a,
const CDCTriggerHoughCand & b ) const

Check if candidates are connected.

Definition at line 350 of file CDCTriggerHoughtrafo.cc.

352{
353 double ax1 = a.getCoord().first.X();
354 double ax2 = a.getCoord().second.X();
355 double ay1 = a.getCoord().first.Y();
356 double ay2 = a.getCoord().second.Y();
357 double bx1 = b.getCoord().first.X();
358 double bx2 = b.getCoord().second.X();
359 double by1 = b.getCoord().first.Y();
360 double by2 = b.getCoord().second.Y();
361 // direct neighbors
362 bool direct = ((ax2 == bx1 && ay1 == by1) || // right
363 (ax1 == bx2 && ay1 == by1) || // left
364 (ax1 == bx1 && ay2 == by1) || // above
365 (ax1 == bx1 && ay1 == by2) || // below
366 (ax1 + 2. * M_PI == bx2 && ay1 == by1) ||
367 (ax2 == bx1 + 2. * M_PI && ay1 == by1));
368 // diagonal connections
369 bool diagRise = ((ax2 == bx1 && ay2 == by1) || // right above
370 (ax1 == bx2 && ay1 == by2) || // left below
371 (ax1 + 2. * M_PI == bx2 && ay1 == by2) ||
372 (ax2 == bx1 + 2. * M_PI && ay2 == by1));
373 bool diagFall = ((ax1 == bx2 && ay2 == by1) || // left above
374 (ax2 == bx1 && ay1 == by2) || // right below
375 (ax2 == bx1 + 2. * M_PI && ay1 == by2) ||
376 (ax1 + 2. * M_PI == bx2 && ay2 == by1));
377 if (m_connect == 4) return direct;
378 else if (m_connect == 6) return (direct || diagRise);
379 else if (m_connect == 8) return (direct || diagRise || diagFall);
380 else B2WARNING("Unknown option for connect " << m_connect << ", using default.");
381 return (direct || diagRise);
382}

◆ connectedDiag()

bool connectedDiag ( unsigned patternLD,
unsigned patternRU )

Check for diagonal connected of patterns in 2 x 2 squares.

Definition at line 738 of file CDCTriggerHoughtrafo.cc.

739{
740 if (m_connect == 4) return false;
741
742 // connected if
743 // . .
744 // x .
745 // . x
746 // . .
747 return (((patternRU >> 0) & 1) && ((patternLD >> 3) & 1));
748}

◆ connectedLR()

bool connectedLR ( unsigned patternL,
unsigned patternR )

Check for left/right connection of patterns in 2 x 2 squares.

Definition at line 681 of file CDCTriggerHoughtrafo.cc.

682{
683 // connected if
684 // . x | x . or . . | . .
685 // . . | . . . x | x .
686 bool connectDirect = (((patternL >> 3) & 1) && ((patternR >> 2) & 1)) ||
687 (((patternL >> 1) & 1) && ((patternR >> 0) & 1));
688 // connected if
689 // . . | x .
690 // . x | . .
691 bool connectRise = ((patternL >> 1) & 1) && ((patternR >> 2) & 1);
692 // connected if
693 // . x | . .
694 // . . | x .
695 bool connectFall = ((patternL >> 3) & 1) && ((patternR >> 0) & 1);
696
697 if (m_connect == 4) return connectDirect;
698 else if (m_connect == 6) return (connectDirect || connectRise);
699 else if (m_connect == 8) return (connectDirect || connectRise || connectFall);
700 else B2WARNING("Unknown option for connect " << m_connect << ", using default.");
701 return (connectDirect || connectRise);
702}

◆ connectedRegions()

void connectedRegions ( )

Combine Hough candidates to tracks by merging connected cells.

The track coordinate is the center of gravity of the resulting cell cluster.

Definition at line 179 of file CDCTriggerHoughtrafo.cc.

180{
181 std::vector<std::vector<CDCTriggerHoughCand>> regions;
182 std::vector<CDCTriggerHoughCand> cpyCand = m_houghCand;
183
184 // debug: print candidate list
185 B2DEBUG(50, "m_houghCand number " << cpyCand.size());
186 for (unsigned icand = 0; icand < m_houghCand.size(); ++icand) {
187 Coord2dPair coord = m_houghCand[icand].getCoord();
188 B2DEBUG(100, m_houghCand[icand].getID()
189 << " nSL " << m_houghCand[icand].getSLcount()
190 << " x1 " << coord.first.X() << " x2 " << coord.second.X()
191 << " y1 " << coord.first.Y() << " y2 " << coord.second.Y());
192 }
193
194 regions.reserve(cpyCand.size());
195 // combine connected cells to regions
196 while (cpyCand.size() > 0) {
197 B2DEBUG(100, "make new region");
198 std::vector<CDCTriggerHoughCand> region;
199 std::vector<CDCTriggerHoughCand> rejected;
200 region.reserve(cpyCand.size());
201 rejected.reserve(cpyCand.size());
202 CDCTriggerHoughCand start = cpyCand[0];
203 cpyCand.erase(cpyCand.begin());
204 region.push_back(start);
205 addNeighbors(start, cpyCand, region, rejected, start.getSLcount());
206 regions.push_back(region);
207 for (auto cand = cpyCand.begin(); cand != cpyCand.end();) {
208 if (inList(*cand, region) || inList(*cand, rejected))
209 cpyCand.erase(cand);
210 else
211 ++cand;
212 }
213 }
214
215 std::vector<ROOT::Math::XYVector> cellIds = {};
216
217 // find center of gravity for each region
218 for (unsigned ir = 0; ir < regions.size(); ++ir) {
219 B2DEBUG(50, "region " << ir << " (" << regions[ir].size() << " cells).");
220 // skip regions with size below cut
221 if (regions[ir].size() < m_minCells) {
222 B2DEBUG(50, "Skipping region with " << regions[ir].size() << " cells.");
223 continue;
224 }
225 double xfirst = regions[ir][0].getCoord().first.X();
226 double x = 0;
227 double y = 0;
228 int n = 0;
229 std::vector<unsigned> mergedList;
230 int xmin = m_nCellsPhi;
231 int xmax = 0;
232 int ymin = m_nCellsR;
233 int ymax = 0;
234 cellIds.clear();
235 cellIds.reserve(regions[ir].size());
236 for (unsigned ir2 = 0; ir2 < regions[ir].size(); ++ir2) {
237 Coord2dPair hc = regions[ir][ir2].getCoord();
238 B2DEBUG(100, " " << regions[ir][ir2].getID()
239 << " nSL " << regions[ir][ir2].getSLcount()
240 << " x1 " << hc.first.X() << " x2 " << hc.second.X()
241 << " y1 " << hc.first.Y() << " y2 " << hc.second.Y());
242 int ix = floor((hc.first.X() + M_PI) / 2. / M_PI * m_nCellsPhi + 0.5);
243 int iy = floor((hc.first.Y() + m_maxR - m_shiftR) / 2. / m_maxR * m_nCellsR + 0.5);
244 x += (hc.first.X() + hc.second.X());
245 if (xfirst - hc.first.X() > M_PI) {
246 x += 4 * M_PI;
247 ix += m_nCellsPhi;
248 } else if (hc.first.X() - xfirst > M_PI) {
249 x -= 4 * M_PI;
250 ix -= m_nCellsPhi;
251 }
252 y += (hc.first.Y() + hc.second.Y());
253 n += 1;
254 std::vector<unsigned> idList = regions[ir][ir2].getIdList();
255 mergeIdList(mergedList, mergedList, idList);
256 xmin = std::min(xmin, ix);
257 xmax = std::max(xmax, ix);
258 ymin = std::min(ymin, iy);
259 ymax = std::max(ymax, iy);
260 cellIds.push_back(ROOT::Math::XYVector(ix, iy));
261 }
262 x *= 0.5 / n;
263 if (x > M_PI)
264 x -= 2 * M_PI;
265 else if (x <= -M_PI)
266 x += 2 * M_PI;
267 y *= 0.5 / n;
268 B2DEBUG(50, "x " << x << " y " << y);
269
270 // select 1 hit per super layer
271 std::vector<unsigned> selectedList = {};
272 std::vector<unsigned> unselectedList = {};
273 selectHits(mergedList, selectedList, unselectedList);
274
275 // save track
276 const CDCTriggerTrack* track =
277 m_tracks.appendNew(x, 2. * y, 0.);
278 // relations to selected hits
279 for (unsigned i = 0; i < selectedList.size(); ++i) {
280 unsigned its = selectedList[i];
281 track->addRelationTo(m_segmentHits[its]);
282 }
283 // relations to additional hits get a negative weight
284 for (unsigned i = 0; i < unselectedList.size(); ++i) {
285 unsigned its = unselectedList[i];
286 track->addRelationTo(m_segmentHits[its], -1.);
287 }
288 // save detail information about the cluster
289 const CDCTriggerHoughCluster* cluster =
290 m_clusters.appendNew(xmin, xmax, ymin, ymax, cellIds);
291 track->addRelationTo(cluster);
292 }
293}
double m_shiftR
Hough plane shift in 1/r [1/cm].
StoreArray< CDCTriggerSegmentHit > m_segmentHits
list of track segment hits
std::vector< CDCTriggerHoughCand > m_houghCand
Hough Candidates.
void selectHits(std::vector< unsigned > &list, std::vector< unsigned > &selected, std::vector< unsigned > &unselected)
Select one hit per super layer.
StoreArray< CDCTriggerTrack > m_tracks
list of found tracks
void mergeIdList(std::vector< unsigned > &merged, std::vector< unsigned > &a, std::vector< unsigned > &b)
Merge lists a and b and put the result in merged.
StoreArray< CDCTriggerHoughCluster > m_clusters
list of clusters in the Hough map
double m_maxR
Hough plane limit in 1/r [1/cm].
std::pair< ROOT::Math::XYVector, ROOT::Math::XYVector > Coord2dPair
Hough Tuples.

◆ connectedUD()

bool connectedUD ( unsigned patternD,
unsigned patternU )

Check for up/down connection of patterns in 2 x 2 squares.

Definition at line 705 of file CDCTriggerHoughtrafo.cc.

706{
707 // connected if
708 // . . . .
709 // x . . x
710 // --- or ---
711 // x . . x
712 // . . . .
713 bool connectDirect = (((patternU >> 0) & 1) && ((patternD >> 2) & 1)) ||
714 (((patternU >> 1) & 1) && ((patternD >> 3) & 1));
715 // connected if
716 // . .
717 // . x
718 // ---
719 // x .
720 // . .
721 bool connectRise = ((patternU >> 1) & 1) && ((patternD >> 2) & 1);
722 // connected if
723 // . .
724 // x .
725 // ---
726 // . x
727 // . .
728 bool connectFall = ((patternU >> 0) & 1) && ((patternD >> 3) & 1);
729
730 if (m_connect == 4) return connectDirect;
731 else if (m_connect == 6) return (connectDirect || connectRise);
732 else if (m_connect == 8) return (connectDirect || connectRise || connectFall);
733 else B2WARNING("Unknown option for connect " << m_connect << ", using default.");
734 return (connectDirect || connectRise);
735}

◆ def_beginRun()

virtual void def_beginRun ( )
inlineprotectedvirtualinherited

Wrapper method for the virtual function beginRun() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 426 of file Module.h.

426{ beginRun(); }

◆ def_endRun()

virtual void def_endRun ( )
inlineprotectedvirtualinherited

This method can receive that the current run ends as a call from the Python side.

For regular C++-Modules that forwards the call to the regular endRun() method.

Reimplemented in PyModule.

Definition at line 439 of file Module.h.

439{ endRun(); }

◆ def_event()

virtual void def_event ( )
inlineprotectedvirtualinherited

Wrapper method for the virtual function event() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 432 of file Module.h.

432{ event(); }

◆ def_initialize()

virtual void def_initialize ( )
inlineprotectedvirtualinherited

Wrappers to make the methods without "def_" prefix callable from Python.

Overridden in PyModule. Wrapper method for the virtual function initialize() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 420 of file Module.h.

420{ initialize(); }

◆ def_terminate()

virtual void def_terminate ( )
inlineprotectedvirtualinherited

Wrapper method for the virtual function terminate() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 445 of file Module.h.

445{ terminate(); }

◆ endRun()

virtual void endRun ( void )
inlinevirtualinherited

This method is called if the current run ends.

Use this method to store information, which should be aggregated over one run.

This method can be implemented by subclasses.

Reimplemented in AlignDQMModule, AnalysisPhase1StudyModule, arichBtestModule, ARICHDQMModule, AWESOMEBasicModule, B2BIIConvertMdstModule, B2BIIMCParticlesMonitorModule, B2BIIMdstInputModule, BeamabortModule, BeamabortStudyModule, BeamDigitizerModule, BeamBkgHitRateMonitorModule, BelleMCOutputModule, BgoDigitizerModule, BgoModule, BgoStudyModule, BKLMDigitAnalyzerModule, BKLMTrackingModule, CalibrationCollectorModule, CaveModule, CDCPackerModule, CDCUnpackerModule, CDCDedxDQMModule, CDCDedxValidationModule, CDCDQMModule, CDCTriggerNDFinderModule, CDCTriggerNeuroDQMModule, CDCTriggerNeuroDQMOnlineModule, CertifyParallelModule, ClawDigitizerModule, ClawModule, ClawStudyModule, ClawsDigitizerModule, CLAWSModule, ClawsStudyModule, Convert2RawDetModule, CsiDigitizer_v2Module, CsIDigitizerModule, CsiModule, CsiStudy_v2Module, CsIStudyModule, DeSerializerPXDModule, DosiDigitizerModule, DosiModule, DosiStudyModule, DQMHistAnalysisARICHModule, DQMHistAnalysisARICHMonObjModule, DQMHistAnalysisCDCDedxModule, DQMHistAnalysisCDCEpicsModule, DQMHistAnalysisCDCMonObjModule, DQMHistAnalysisDAQMonObjModule, DQMHistAnalysisDeltaEpicsMonObjExampleModule, DQMHistAnalysisDeltaTestModule, DQMHistAnalysisECLConnectedRegionsModule, DQMHistAnalysisECLModule, DQMHistAnalysisECLOutOfTimeDigitsModule, DQMHistAnalysisECLShapersModule, DQMHistAnalysisECLSummaryModule, DQMHistAnalysisEcmsMonObjModule, DQMHistAnalysisEpicsExampleModule, DQMHistAnalysisEpicsOutputModule, DQMHistAnalysisEventT0TriggerJitterModule, DQMHistAnalysisExampleFlagsModule, DQMHistAnalysisExampleModule, DQMHistAnalysisHLTMonObjModule, DQMHistAnalysisInput2Module, DQMHistAnalysisInputPVSrvModule, DQMHistAnalysisInputTestModule, DQMHistAnalysisKLM2Module, DQMHistAnalysisKLMModule, DQMHistAnalysisKLMMonObjModule, DQMHistAnalysisMiraBelleModule, DQMHistAnalysisMonObjModule, DQMHistAnalysisOutputFileModule, DQMHistAnalysisOutputMonObjModule, DQMHistAnalysisPhysicsModule, DQMHistAnalysisPXDChargeModule, DQMHistAnalysisPXDTrackChargeModule, DQMHistAnalysisSVDClustersOnTrackModule, DQMHistAnalysisSVDDoseModule, DQMHistAnalysisSVDEfficiencyModule, DQMHistAnalysisSVDOccupancyModule, DQMHistAnalysisSVDOnMiraBelleModule, DQMHistAnalysisSVDUnpackerModule, DQMHistAnalysisTOPModule, DQMHistAnalysisTRGECLModule, DQMHistAnalysisTRGEFFModule, DQMHistAnalysisTRGGDLModule, DQMHistAnalysisTRGModule, DQMHistComparitorModule, DQMHistDeltaHistoModule, DqmHistoManagerModule, DQMHistOutputToEPICSModule, DQMHistSnapshotsModule, Ds2RawFileModule, Ds2RawModule, Ds2RbufModule, Ds2SampleModule, ECLBackgroundModule, ECLCovarianceMatrixModule, ECLCRFinderModule, ECLFinalizerModule, ECLHitDebugModule, ECLLocalMaximumFinderModule, ECLLocalRunCalibratorModule, ECLShowerCorrectorModule, ECLSplitterN2Module, EffPlotsModule, ElapsedTimeModule, EventInfoPrinterModule, EventT0ValidationModule, EvReductionModule, EvtGenDecayModule, ExtModule, FANGSDigitizerModule, FANGSModule, FANGSStudyModule, FastRbuf2DsModule, TRGGDLUnpackerModule, GenfitVisModule, GetEventFromSocketModule, He3DigitizerModule, He3tubeModule, He3tubeStudyModule, HistoManagerModule, HitXPModule, HLTDQM2ZMQModule, HLTDs2ZMQModule, KLMDigitizerModule, KLMTrackingModule, KLMTriggerModule, MCMatcherTRGECLModule, MCTrackCandClassifierModule, MicrotpcModule, MicrotpcStudyModule, TpcDigitizerModule, TPCStudyModule, MonitorDataModule, MuidModule, NoKickCutsEvalModule, NtuplePhase1_v6Module, OverrideGenerationFlagsModule, PartialSeqRootReaderModule, Ph1bpipeModule, Ph1sustrModule, PinDigitizerModule, PindiodeModule, PindiodeStudyModule, PlumeDigitizerModule, PlumeModule, PrintDataModule, PrintEventRateModule, PXDROIFinderModule, PyModule, QcsmonitorDigitizerModule, QcsmonitorModule, QcsmonitorStudyModule, RandomBarrierModule, Raw2DsModule, RawInputModule, Rbuf2DsModule, Rbuf2RbufModule, ReceiveEventModule, ReprocessorModule, Root2BinaryModule, Root2RawModule, RT2SPTCConverterModule, RxSocketModule, SecMapTrainerBaseModule, SecMapTrainerVXDTFModule, SectorMapBootstrapModule, SeqRootInputModule, SeqRootMergerModule, SeqRootOutputModule, SerializerModule, SPTCmomentumSeedRetrieverModule, SPTCvirtualIPRemoverModule, SrsensorModule, StatisticsSummaryModule, StorageDeserializerModule, StorageRootOutputModule, StorageSerializerModule, SubEventModule, SVDClusterizerModule, SVDRecoDigitCreatorModule, SVDUnpackerModule, SVDB4CommissioningPlotsModule, SVDClusterCalibrationsMonitorModule, SVDClusterEvaluationModule, SVDClusterEvaluationTrueInfoModule, SVDDataFormatCheckModule, svdDumpModule, SVDHotStripFinderModule, SVDLatencyCalibrationModule, SVDLocalCalibrationsMonitorModule, SVDOccupancyAnalysisModule, SVDPerformanceModule, SVDPositionErrorScaleFactorImporterModule, SVDROIDQMModule, SVDROIFinderModule, SVDTimeCalibrationsMonitorModule, SVDUnpackerDQMModule, SwitchDataStoreModule, TOPBackgroundModule, TOPTBCComparatorModule, TOPUnpackerModule, TOPWaveformQualityPlotterModule, TrackFinderMCTruthRecoTracksModule, TrackFinderVXDAnalizerModule, TrackingPerformanceEvaluationModule, FindletModule< AFindlet >, FindletModule< AsicBackgroundLibraryCreator >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderLegendre >, FindletModule< AxialTrackFinderLegendre >, FindletModule< CDCHitsRemover >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromHitsFindlet >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromSegmentsFindlet >, FindletModule< CKFToCDCFindlet >, FindletModule< CKFToCDCFromEclFindlet >, FindletModule< CKFToPXDFindlet >, FindletModule< CKFToSVDFindlet >, FindletModule< CKFToSVDSeedFindlet >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterPreparer >, FindletModule< ClusterPreparer >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< CosmicsTrackMergerFindlet >, FindletModule< DATCONFPGAFindlet >, FindletModule< FacetCreator >, FindletModule< FacetCreator >, FindletModule< HitBasedT0Extractor >, FindletModule< HitBasedT0Extractor >, FindletModule< HitReclaimer >, FindletModule< HitReclaimer >, FindletModule< MCVXDCDCTrackMergerFindlet >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFitter >, FindletModule< SegmentFitter >, FindletModule< SegmentLinker >, FindletModule< SegmentLinker >, FindletModule< SegmentOrienter >, FindletModule< SegmentOrienter >, FindletModule< SegmentPairCreator >, FindletModule< SegmentPairCreator >, FindletModule< SegmentRejecter >, FindletModule< SegmentRejecter >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTripleCreator >, FindletModule< SegmentTripleCreator >, FindletModule< StereoHitFinder >, FindletModule< StereoHitFinder >, FindletModule< SuperClusterCreator >, FindletModule< SuperClusterCreator >, FindletModule< TrackCombiner >, FindletModule< TrackCombiner >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackExporter >, FindletModule< TrackExporter >, FindletModule< TrackFinder >, FindletModule< TrackFinderAutomaton >, FindletModule< TrackFinderCosmics >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackingUtilities::FindletStoreArrayInput< BaseEventTimeExtractorModuleFindlet< AFindlet > > >, FindletModule< TrackingUtilities::FindletStoreArrayInput< BaseEventTimeExtractorModuleFindlet< AFindlet > > >, FindletModule< TrackLinker >, FindletModule< TrackLinker >, FindletModule< TrackOrienter >, FindletModule< TrackOrienter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityEstimator >, FindletModule< TrackQualityEstimator >, FindletModule< TrackRejecter >, FindletModule< TrackRejecter >, FindletModule< vxdHoughTracking::SVDHoughTracking >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitCreator >, FindletModule< WireHitCreator >, FindletModule< WireHitPreparer >, FindletModule< WireHitPreparer >, TrackSetEvaluatorHopfieldNNDEVModule, TRGCDCETFUnpackerModule, TRGCDCModule, TRGCDCT2DDQMModule, TRGCDCT3DConverterModule, TRGCDCT3DDQMModule, TRGCDCT3DUnpackerModule, TRGCDCTSFUnpackerModule, TRGCDCTSFDQMModule, TRGCDCTSStreamModule, TRGECLBGTCHitModule, TRGECLDQMModule, TRGECLFAMModule, TRGECLModule, TRGECLQAMModule, TRGECLRawdataAnalysisModule, TRGECLTimingCalModule, TRGECLUnpackerModule, TRGGDLDQMModule, TRGGDLDSTModule, TRGGDLModule, TRGGDLSummaryModule, TRGGRLDQMModule, TRGGRLMatchModule, TRGGRLModule, TRGGRLProjectsModule, TRGGRLUnpackerModule, TRGRAWDATAModule, TRGTOPDQMModule, TRGTOPTRD2TTSConverterModule, TRGTOPUnpackerModule, TRGTOPUnpackerWaveformModule, TRGTOPWaveformPlotterModule, TxModule, TxSocketModule, V0findingPerformanceEvaluationModule, vxdDigitMaskingModule, VXDSimpleClusterizerModule, ZMQTxInputModule, and ZMQTxWorkerModule.

Definition at line 166 of file Module.h.

166{};

◆ evalCondition()

bool evalCondition ( ) const
inherited

If at least one condition was set, it is evaluated and true returned if at least one condition returns true.

If no condition or result value was defined, the method returns false. Otherwise, the condition is evaluated and true returned, if at least one condition returns true. To speed up the evaluation, the condition strings were already parsed in the method if_value().

Returns
True if at least one condition and return value exists and at least one condition expression was evaluated to true.

Definition at line 96 of file Module.cc.

97{
98 if (m_conditions.empty()) return false;
99
100 //okay, a condition was set for this Module...
101 if (!m_hasReturnValue) {
102 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
103 }
104
105 for (const auto& condition : m_conditions) {
106 if (condition.evaluate(m_returnValue)) {
107 return true;
108 }
109 }
110 return false;
111}
int m_returnValue
The return value.
Definition Module.h:519
bool m_hasReturnValue
True, if the return value is set.
Definition Module.h:518

◆ event()

void event ( void )
overridevirtual

Run tracking.

Pair of <counter, CDCPair>, for hits with indices

Reimplemented from Module.

Definition at line 206 of file CDCTrigger2DFinderModule.cc.

207{
208 /* Clean hits */
209 m_hitMap.clear();
210 m_houghCand.clear();
211
212 /* set default return value */
213 setReturnValue(true);
214
215 if (m_testFilename != "") {
217 << m_segmentHits.getEntries() << std::endl;
218 }
219
220 if (m_segmentHits.getEntries() == 0) {
221 //B2WARNING("CDCTracking: tsHitsCollection is empty!");
222 return;
223 }
224
225 /* get CDCHits coordinates in conformal space */
226 for (int iHit = 0; iHit < m_segmentHits.getEntries(); iHit++) {
227 unsigned short iSL = m_segmentHits[iHit]->getISuperLayer();
228 if (m_testFilename != "") {
229 m_testFile << iSL << " " << m_segmentHits[iHit]->getSegmentID() - m_TSoffset[iSL] << " "
230 << m_segmentHits[iHit]->getPriorityPosition() << std::endl;
231 }
232 if (iSL % 2) continue;
233 if (m_ignore2nd && m_segmentHits[iHit]->getPriorityPosition() < 3) continue;
234
235 if (m_usehitpattern) {
236 unsigned hitpattern;
237 if (m_useadc) hitpattern = m_segmentHits[iHit]->getadcpattern();
238 else hitpattern = m_segmentHits[iHit]->gethitpattern();
239 int nhitpattern = 0;
240 if (iSL == 0)nhitpattern = 15;
241 else nhitpattern = 11;
242 for (int i = 0; i < nhitpattern; i++) {
243 if ((hitpattern & (1 << i)) != 0) {
244 double phi = m_segmentHits[iHit]->getSegmentID() - m_TSoffset[iSL];
245 if (iSL != 0 && i == 0) phi = phi - 1;
246 else if (iSL != 0 && i == 1) phi = phi + 0;
247 else if (iSL != 0 && i == 2) phi = phi + 1;
248 else if (iSL != 0 && i == 3) phi = phi - 0.5;
249 else if (iSL != 0 && i == 4) phi = phi + 0.5;
250 else if (iSL != 0 && i == 5) phi = phi + 0;
251 else if (iSL != 0 && i == 6) phi = phi - 0.5;
252 else if (iSL != 0 && i == 7) phi = phi + 0.5;
253 else if (iSL != 0 && i == 8) phi = phi - 1;
254 else if (iSL != 0 && i == 9) phi = phi + 0;
255 else if (iSL != 0 && i == 10) phi = phi + 1;
256 else if (iSL == 0 && i == 0) phi = phi + 0;
257 else if (iSL == 0 && i == 1) phi = phi - 0.5;
258 else if (iSL == 0 && i == 2) phi = phi + 0.5;
259 else if (iSL == 0 && i == 3) phi = phi - 1;
260 else if (iSL == 0 && i == 4) phi = phi + 0;
261 else if (iSL == 0 && i == 5) phi = phi + 1;
262 else if (iSL == 0 && i == 6) phi = phi - 1.5;
263 else if (iSL == 0 && i == 7) phi = phi - 0.5;
264 else if (iSL == 0 && i == 8) phi = phi + 0.5;
265 else if (iSL == 0 && i == 9) phi = phi + 1.5;
266 else if (iSL == 0 && i == 10) phi = phi - 2;
267 else if (iSL == 0 && i == 11) phi = phi - 1;
268 else if (iSL == 0 && i == 12) phi = phi + 0;
269 else if (iSL == 0 && i == 13) phi = phi + 1;
270 else if (iSL == 0 && i == 14) phi = phi + 2;
271 phi = phi * 2. * M_PI / (m_TSoffset[iSL + 1] - m_TSoffset[iSL]);
272 int iLayer = 0;
273 if (iSL != 0 && i == 0) iLayer = 0;
274 else if (iSL != 0 && i == 1) iLayer = 0;
275 else if (iSL != 0 && i == 2) iLayer = 0;
276 else if (iSL != 0 && i == 3) iLayer = 1;
277 else if (iSL != 0 && i == 4) iLayer = 1;
278 else if (iSL != 0 && i == 5) iLayer = 2;
279 else if (iSL != 0 && i == 6) iLayer = 3;
280 else if (iSL != 0 && i == 7) iLayer = 3;
281 else if (iSL != 0 && i == 8) iLayer = 4;
282 else if (iSL != 0 && i == 9) iLayer = 4;
283 else if (iSL != 0 && i == 10) iLayer = 4;
284 else if (iSL == 0 && i == 0) iLayer = 0;
285 else if (iSL == 0 && i == 1) iLayer = 1;
286 else if (iSL == 0 && i == 2) iLayer = 1;
287 else if (iSL == 0 && i == 3) iLayer = 2;
288 else if (iSL == 0 && i == 4) iLayer = 2;
289 else if (iSL == 0 && i == 5) iLayer = 2;
290 else if (iSL == 0 && i == 6) iLayer = 3;
291 else if (iSL == 0 && i == 7) iLayer = 3;
292 else if (iSL == 0 && i == 8) iLayer = 3;
293 else if (iSL == 0 && i == 9) iLayer = 3;
294 else if (iSL == 0 && i == 10) iLayer = 4;
295 else if (iSL == 0 && i == 11) iLayer = 4;
296 else if (iSL == 0 && i == 12) iLayer = 4;
297 else if (iSL == 0 && i == 13) iLayer = 4;
298 else if (iSL == 0 && i == 14) iLayer = 4;
299
300 double r = m_radius[iSL][iLayer];
301 ROOT::Math::XYVector pos(std::cos(phi) / r, std::sin(phi) / r);
302 m_hitMap.insert(std::make_pair(iHit * 15 + i, std::make_pair(iSL * 5 + iLayer, pos)));
303 }
304 }
305 } else {
306 double phi = m_segmentHits[iHit]->getSegmentID() - m_TSoffset[iSL];
307 if (m_usePriority) {
308 phi += 0.5 * (((m_segmentHits[iHit]->getPriorityPosition() >> 1) & 1)
309 - (m_segmentHits[iHit]->getPriorityPosition() & 1));
310 }
311 phi = phi * 2. * M_PI / (m_TSoffset[iSL + 1] - m_TSoffset[iSL]);
312 double r = m_radius[iSL][int(m_usePriority &&
313 m_segmentHits[iHit]->getPriorityPosition() < 3)];
314 ROOT::Math::XYVector pos(std::cos(phi) / r, std::sin(phi) / r);
315 m_hitMap.insert(std::make_pair(iHit, std::make_pair(iSL, pos)));
316 }
317 }
318
319 /* prepare matrix for storing the Hough plane */
320 if (m_storePlane > 0) {
321 m_houghPlane.create();
323 }
324
325 // hit map containing only the early hits
326 CDCHitMap fastHitMap;
327 if (m_suppressClone && !m_hitMap.empty()) {
328 // find the first track candidates in Hough plane
329 // only for z0 resolution study with single-track events
330 // This will surely fail with multi-track ones,
331 // in which case we really need tick-by-tick simulation for all hits.
332
334 typedef std::pair<int, CDCPair> CDCHitPair;
335 // sequential hit map, ordered by TS found time
336 typedef std::vector<CDCHitPair> CDCSeqMap;
337 CDCSeqMap seqHitMap;
338 // copy hit map to sequential hit map and sort it by TS found time
339 seqHitMap.reserve(m_hitMap.size());
340 for (auto hit : m_hitMap) {
341 seqHitMap.push_back(hit);
342 }
343 sort(seqHitMap.begin(), seqHitMap.end(), [this](CDCHitPair i, CDCHitPair j) {
344 return m_segmentHits[i.first]->foundTime() < m_segmentHits[j.first]->foundTime();
345 });
346 auto seqHitItr = seqHitMap.begin();
347 /* layer filter */
348 std::vector<bool> layerHit(CDC_SUPER_LAYERS, false);
349 // data clock cycle in unit of 2ns
350 short period = 16;
351 short firstTick = m_segmentHits[(*seqHitMap.begin()).first]->foundTime() / period + 1;
352 short lastTick = m_segmentHits[(*(seqHitMap.end() - 1)).first]->foundTime() / period + 1;
353 // add TS hits in every clock cycle until a track candidate is found
354 for (auto tick = firstTick * period; tick < lastTick * period; tick += period) {
355 int nHitInCycle = 0;
356 for (auto itr = seqHitItr; itr < seqHitMap.end(); ++itr) {
357 CDCHitPair currentHit = *itr;
358 // start from the first hit over SL threshold
359 if (std::count(layerHit.begin(), layerHit.end(), true) >= m_minHits &&
360 m_segmentHits[currentHit.first]->foundTime() > tick) {
361 break;
362 }
363 nHitInCycle++;
364 layerHit[m_segmentHits[currentHit.first]->getISuperLayer()] = true;
365 }
366 copy_n(seqHitItr, nHitInCycle, inserter(fastHitMap, fastHitMap.end()));
367 fastInterceptFinder(fastHitMap, -m_rectX, m_rectX, -m_rectY + m_shiftR, m_rectY + m_shiftR, 0, 0, 0);
368 B2DEBUG(20, "at tick " << tick << ", number of candidates: " << m_houghCand.size());
369 if (!m_houghCand.empty()) {
370 B2DEBUG(10, "found a track at clock " << tick << " with "
371 << fastHitMap.size() << "hits");
372 break;
373 }
374 advance(seqHitItr, nHitInCycle);
375 }
376 } else {
377 /* find track candidates in Hough plane using all TS hits */
379 if (!m_houghCand.empty()) {
380 B2DEBUG(10, "found a track with " << m_hitMap.size() << "hits");
381 }
382 }
383
384 /* merge track candidates */
386 patternClustering(fastHitMap);
387 else
389
390 if (m_testFilename != "") {
391 m_testFile << m_tracks.getEntries() << std::endl;
392 for (int i = 0; i < m_tracks.getEntries(); ++i) {
393 float ix = (m_tracks[i]->getPhi0() - M_PI_4) * m_nCellsPhi / 2. / M_PI - 0.5;
394 float iy = (m_tracks[i]->getOmega() / 2. + m_maxR - m_shiftR) * m_nCellsR / 2. / m_maxR - 0.5;
395 m_testFile << round(2 * ix) / 2. << " " << round(2 * iy) / 2. << " "
396 << m_tracks[i]->getChargeSign() << std::endl;
397 RelationVector<CDCTriggerSegmentHit> hits =
398 m_tracks[i]->getRelationsTo<CDCTriggerSegmentHit>(m_hitCollectionName);
399 m_testFile << hits.size() << std::endl;
400 for (unsigned ihit = 0; ihit < hits.size(); ++ihit) {
401 unsigned short iSL = hits[ihit]->getISuperLayer();
402 m_testFile << iSL << " " << hits[ihit]->getSegmentID() - m_TSoffset[iSL] << " "
403 << hits[ihit]->getPriorityPosition() << " "
404 << hits.weight(ihit) << std::endl;
405 }
406 }
407 }
408}
void patternClustering(const CDCHitMap &inputMap)
Combine Hough candidates to tracks by a fixed pattern algorithm.
StoreObjPtr< TMatrix > m_houghPlane
matrix containing the Hough plane
std::ofstream m_testFile
filestream for test output for firmware debugging
int fastInterceptFinder(CDCHitMap &hits, double x1_s, double x2_s, double y1_s, double y2_s, unsigned iterations, unsigned ix_s, unsigned iy_s)
Fast intercept finder Divide Hough plane recursively to find cells with enough crossing lines.
double m_rectX
Store the rectangle size in x.
double m_rectY
Store the rectangle size in y.
CDCHitMap m_hitMap
map of TS hits containing <iHit, <iSL, (x, y)>> with iHit: hit index in StoreArray iSL: super layer i...
void connectedRegions()
Combine Hough candidates to tracks by merging connected cells.
size_t size() const
Get number of relations.
float weight(int index) const
Get weight with index.
std::unordered_map< int, CDCPair > CDCHitMap
Map of <counter, CDCPair>, for hits with indices.

◆ exposePythonAPI()

void exposePythonAPI ( )
staticinherited

Exposes methods of the Module class to Python.

Definition at line 325 of file Module.cc.

326{
327 // to avoid confusion between std::arg and boost::python::arg we want a shorthand namespace as well
328 namespace bp = boost::python;
329
330 docstring_options options(true, true, false); //userdef, py sigs, c++ sigs
331
332 void (Module::*setReturnValueInt)(int) = &Module::setReturnValue;
333
334 enum_<Module::EAfterConditionPath>("AfterConditionPath",
335 R"(Determines execution behaviour after a conditional path has been executed:
336
337.. attribute:: END
338
339 End processing of this path after the conditional path. (this is the default for if_value() etc.)
340
341.. attribute:: CONTINUE
342
343 After the conditional path, resume execution after this module.)")
344 .value("END", Module::EAfterConditionPath::c_End)
345 .value("CONTINUE", Module::EAfterConditionPath::c_Continue)
346 ;
347
348 /* Do not change the names of >, <, ... we use them to serialize conditional paths */
349 enum_<Belle2::ModuleCondition::EConditionOperators>("ConditionOperator")
356 ;
357
358 enum_<Module::EModulePropFlags>("ModulePropFlags",
359 R"(Flags to indicate certain low-level features of modules, see :func:`Module.set_property_flags()`, :func:`Module.has_properties()`. Most useful flags are:
360
361.. attribute:: PARALLELPROCESSINGCERTIFIED
362
363 This module can be run in parallel processing mode safely (All I/O must be done through the data store, in particular, the module must not write any files.)
364
365.. attribute:: HISTOGRAMMANAGER
366
367 This module is used to manage histograms accumulated by other modules
368
369.. attribute:: TERMINATEINALLPROCESSES
370
371 When using parallel processing, call this module's terminate() function in all processes. This will also ensure that there is exactly one process (single-core if no parallel modules found) or at least one input, one main and one output process.
372
373.. attribute:: NOPARALLELWORK
374
375 This module does no per-event work that is worth running in parallel, for example because it only sets something up. It can still be parallel processing certified: the flag only says that a parallel section consisting of nothing but such modules is not worth creating, so it is merged back into the input path and the search for a parallel section continues after it.
376)")
377 .value("INPUT", Module::EModulePropFlags::c_Input)
378 .value("OUTPUT", Module::EModulePropFlags::c_Output)
379 .value("PARALLELPROCESSINGCERTIFIED", Module::EModulePropFlags::c_ParallelProcessingCertified)
380 .value("HISTOGRAMMANAGER", Module::EModulePropFlags::c_HistogramManager)
381 .value("INTERNALSERIALIZER", Module::EModulePropFlags::c_InternalSerializer)
382 .value("TERMINATEINALLPROCESSES", Module::EModulePropFlags::c_TerminateInAllProcesses)
383 .value("NOPARALLELWORK", Module::EModulePropFlags::c_NoParallelWork)
384 ;
385
386 //Python class definition
387 class_<Module, PyModule> module("Module", R"(
388Base class for Modules.
389
390A module is the smallest building block of the framework.
391A typical event processing chain consists of a Path containing
392modules. By inheriting from this base class, various types of
393modules can be created. To use a module, please refer to
394:func:`Path.add_module()`. A list of modules is available by running
395``basf2 -m`` or ``basf2 -m package``, detailed information on parameters is
396given by e.g. ``basf2 -m RootInput``.
397
398The 'Module Development' section in the manual provides detailed information
399on how to create modules, setting parameters, or using return values/conditions:
400https://xwiki.desy.de/xwiki/rest/p/f4fa4/#HModuleDevelopment
401
402)");
403 module
404 .def("__str__", &Module::getPathString)
405 .def("name", &Module::getName, return_value_policy<copy_const_reference>(),
406 "Returns the name of the module. Can be changed via :func:`set_name() <Module.set_name()>`, use :func:`type() <Module.type()>` for identifying a particular module class.")
407 .def("type", &Module::getType, return_value_policy<copy_const_reference>(),
408 "Returns the type of the module (i.e. class name minus 'Module')")
409 .def("set_name", &Module::setName, args("name"), R"(
410Set custom name, e.g. to distinguish multiple modules of the same type.
411
412>>> path.add_module('EventInfoSetter')
413>>> ro = path.add_module('RootOutput', branchNames=['EventMetaData'])
414>>> ro.set_name('RootOutput_metadata_only')
415>>> print(path)
416[EventInfoSetter -> RootOutput_metadata_only]
417
418)")
419 .def("description", &Module::getDescription, return_value_policy<copy_const_reference>(),
420 "Returns the description of this module.")
421 .def("package", &Module::getPackage, return_value_policy<copy_const_reference>(),
422 "Returns the package this module belongs to.")
423 .def("available_params", &_getParamInfoListPython,
424 "Return list of all module parameters as `ModuleParamInfo` instances")
425 .def("has_properties", &Module::hasProperties, (bp::arg("properties")),
426 R"DOCSTRING(Allows to check if the module has the given properties out of `ModulePropFlags` set.
427
428>>> if module.has_properties(ModulePropFlags.PARALLELPROCESSINGCERTIFIED):
429>>> ...
430
431Parameters:
432 properties (int): bitmask of `ModulePropFlags` to check for.
433)DOCSTRING")
434 .def("set_property_flags", &Module::setPropertyFlags, args("property_mask"),
435 "Set module properties in the form of an OR combination of `ModulePropFlags`.");
436 {
437 // python signature is too crowded, make ourselves
438 docstring_options subOptions(true, false, false); //userdef, py sigs, c++ sigs
439 module
440 .def("if_value", &Module::if_value,
441 (bp::arg("expression"), bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
442 R"DOCSTRING(if_value(expression, condition_path, after_condition_path=AfterConditionPath.END)
443
444Sets a conditional sub path which will be executed after this
445module if the return value set in the module passes the given ``expression``.
446
447Modules can define a return value (int or bool) using ``setReturnValue()``,
448which can be used in the steering file to split the Path based on this value, for example
449
450>>> module_with_condition.if_value("<1", another_path)
451
452In case the return value of the ``module_with_condition`` for a given event is
453less than 1, the execution will be diverted into ``another_path`` for this event.
454
455You could for example set a special return value if an error occurs, and divert
456the execution into a path containing :b2:mod:`RootOutput` if it is found;
457saving only the data producing/produced by the error.
458
459After a conditional path has executed, basf2 will by default stop processing
460the path for this event. This behaviour can be changed by setting the
461``after_condition_path`` argument.
462
463Parameters:
464 expression (str): Expression to determine if the conditional path should be executed.
465 This should be one of the comparison operators ``<``, ``>``, ``<=``,
466 ``>=``, ``==``, or ``!=`` followed by a numerical value for the return value
467 condition_path (Path): path to execute in case the expression is fulfilled
468 after_condition_path (AfterConditionPath): What to do once the ``condition_path`` has been executed.
469)DOCSTRING")
470 .def("if_false", &Module::if_false,
471 (bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
472 R"DOC(if_false(condition_path, after_condition_path=AfterConditionPath.END)
473
474Sets a conditional sub path which will be executed after this module if
475the return value of the module evaluates to False. This is equivalent to
476calling `if_value` with ``expression=\"<1\"``)DOC")
477 .def("if_true", &Module::if_true,
478 (bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
479 R"DOC(if_true(condition_path, after_condition_path=AfterConditionPath.END)
480
481Sets a conditional sub path which will be executed after this module if
482the return value of the module evaluates to True. It is equivalent to
483calling `if_value` with ``expression=\">=1\"``)DOC");
484 }
485 module
486 .def("has_condition", &Module::hasCondition,
487 "Return true if a conditional path has been set for this module "
488 "using `if_value`, `if_true` or `if_false`")
489 .def("get_all_condition_paths", &_getAllConditionPathsPython,
490 "Return a list of all conditional paths set for this module using "
491 "`if_value`, `if_true` or `if_false`")
492 .def("get_all_conditions", &_getAllConditionsPython,
@ c_GE
Greater or equal than: ">=".
@ c_SE
Smaller or equal than: "<=".
@ c_GT
Greater than: ">".
@ c_NE
Not equal: "!=".
@ c_EQ
Equal: "=" or "==".
@ c_ST
Smaller than: "<".
void if_value(const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
Add a condition to the module.
Definition Module.cc:79
void if_true(const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
A simplified version to set the condition of the module.
Definition Module.cc:90
@ c_HistogramManager
This module is used to manage histograms accumulated by other modules.
Definition Module.h:81
@ c_NoParallelWork
This module does no per-event work that is worth running in parallel.
Definition Module.h:85
@ c_Input
This module is an input module (reads data).
Definition Module.h:78
@ c_InternalSerializer
This module is an internal serializer/deserializer for parallel processing.
Definition Module.h:82
@ c_Output
This module is an output module (writes data).
Definition Module.h:79
@ c_TerminateInAllProcesses
When using parallel processing, call this module's terminate() function in all processes().
Definition Module.h:83
void if_false(const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
A simplified version to add a condition to the module.
Definition Module.cc:85
ModuleCondition::EAfterConditionPath EAfterConditionPath
Forward the EAfterConditionPath definition from the ModuleCondition.
Definition Module.h:89

◆ fastInterceptFinder()

int fastInterceptFinder ( CDCHitMap & hits,
double x1_s,
double x2_s,
double y1_s,
double y2_s,
unsigned iterations,
unsigned ix_s,
unsigned iy_s )

Fast intercept finder Divide Hough plane recursively to find cells with enough crossing lines.

Parameters
hitsmap of hit coordinates in conformal space
x1_s,x2_s,y1_s,y2_slimits of starting rectangle
iterationscurrent iteration index
ix_s,iy_sindices of starting rectangle

Definition at line 47 of file CDCTriggerHoughtrafo.cc.

52{
53 std::string indent = "";
54 for (unsigned i = 0; i < iterations; ++i) indent += " ";
55 B2DEBUG(150, indent << "intercept finder iteration " << iterations
56 << " x1 " << x1_s * 180 / M_PI << " x2 " << x2_s * 180 / M_PI
57 << " y1 " << y1_s << " y2 " << y2_s
58 << " ix " << ix_s << " iy " << iy_s);
59
60 int i, j, iHit;
61 double unitx, unity;
62 double y1, y2;
63 double m, a;
64 CDCPair hp;
65 unsigned short iSL;
66 // list of hit indices crossing the current rectangle
67 std::vector<unsigned> idx_list;
68 idx_list.reserve(hits.size());
69
70 // limits of divided rectangles
71 double x1_d, x2_d, y1_d, y2_d;
72
73 // cell indices in full plane
74 unsigned ix, iy;
75
76 unitx = ((x2_s - x1_s) / 2.0);
77 unity = ((y2_s - y1_s) / 2.0);
78
79 CDCHitMap containedHits;
80 containedHits.reserve(hits.size());
81
82 std::bitset<CDC_SUPER_LAYERS> layerHit; /* For layer filter */
83
84 // divide x axis in half
85 for (i = 0; i < 2 ; ++i) {
86 // divide y axis in half
87 for (j = 0; j < 2; ++j) {
88 x1_d = x1_s + i * unitx;
89 x2_d = x1_s + (i + 1) * unitx;
90 y1_d = y1_s + j * unity;
91 y2_d = y1_s + (j + 1) * unity;
92
93 ix = 2 * ix_s + i;
94 iy = 2 * iy_s + j;
95
96 // skip extra cells outside of the Hough plane
97 if (x2_d <= -M_PI || x1_d >= M_PI || y2_d <= -m_maxR + m_shiftR || y1_d >= m_maxR + m_shiftR) {
98 B2DEBUG(150, indent << "skip Hough cell outside of plane limits");
99 continue;
100 }
101
102 // if the cell size in phi is too large, the hit calculation is not reliable
103 // -> continue to next iteration without hit check
104 if (iterations != m_maxIterations && unitx > M_PI / 2.) {
105 fastInterceptFinder(hits, x1_d, x2_d, y1_d, y2_d, iterations + 1, ix, iy);
106 continue;
107 }
108
109 const double sin_x1d = std::sin(x1_d - 1e-10);
110 const double cos_x1d = std::cos(x1_d - 1e-10);
111 const double sin_x2d = std::sin(x2_d + 1e-10);
112 const double cos_x2d = std::cos(x2_d + 1e-10);
113
114 idx_list.clear();
115 layerHit.reset();
116 containedHits.clear();
117 for (auto it = hits.begin(); it != hits.end(); ++it) {
118 iHit = it->first;
119 hp = it->second;
120 iSL = hp.first;
121 m = hp.second.X();
122 a = hp.second.Y();
123
124 // calculate Hough curve with slightly enlarged limits to avoid errors due to rounding
125 y1 = m * sin_x1d - a * cos_x1d;
126 y2 = m * sin_x2d - a * cos_x2d;
127 // skip decreasing half of the sine (corresponds to curl back half of the track)
128 if (iterations == m_maxIterations && y1 > y2) continue;
129 if (!((y1 > y2_d && y2 > y2_d) || (y1 < y1_d && y2 < y1_d))) {
130 if (iterations == m_maxIterations) {
131 idx_list.push_back(iHit);
132 }
133 layerHit[iSL] = true; /* layer filter */
134 containedHits.insert(*it);
135 }
136 }
137 // if a hit in the first SL is required but not present, set nSL to 0, otherwise count the number of layers
138 unsigned short nSL = (m_requireSL0 && !layerHit[0]) ? 0 : layerHit.count();
139 B2DEBUG(150, indent << "i " << i << " j " << j
140 << " layerHit " << int(layerHit[0]) << int(layerHit[2])
141 << int(layerHit[4]) << int(layerHit[6]) << int(layerHit[8])
142 << " nSL " << nSL);
143 if (nSL >= m_minHits || shortTrack(layerHit)) {
144 if (iterations != m_maxIterations) {
145 fastInterceptFinder(containedHits, x1_d, x2_d, y1_d, y2_d, iterations + 1, ix, iy);
146 } else {
147 ROOT::Math::XYVector v1(x1_d, y1_d);
148 ROOT::Math::XYVector v2(x2_d, y2_d);
149 m_houghCand.push_back(CDCTriggerHoughCand(idx_list, std::make_pair(v1, v2),
150 nSL, m_houghCand.size()));
151 if (m_storePlane > 0) {
152 (*m_houghPlane)[ix - (m_nCells - m_nCellsPhi) / 2][iy - (m_nCells - m_nCellsR) / 2] = nSL;
153 }
154 }
155 } else if (m_storePlane > 1) {
156 // to store the full Hough plane, we need to continue the iteration
157 // to minimal cell size everywhere
158 for (unsigned min = m_minHits - 1; min > 0; --min) {
159 if (nSL >= min) {
160 if (iterations != m_maxIterations) {
161 fastInterceptFinder(containedHits, x1_d, x2_d, y1_d, y2_d, iterations + 1, ix, iy);
162 } else {
163 (*m_houghPlane)[ix - (m_nCells - m_nCellsPhi) / 2][iy - (m_nCells - m_nCellsR) / 2] = nSL;
164 }
165 break;
166 }
167 }
168 }
169 }
170 }
171
172 return 0;
173}
unsigned m_maxIterations
number of iterations for the fast peak finder, smallest n such that 2^(n+1) > max(nCellsPhi,...
bool shortTrack(std::bitset< 45 > &superLayers)
check the short track condition (= hits in the inner super layers rather than any super layers)
unsigned m_nCells
number of cells for the fast peak finder: 2^(maxIterations + 1).
std::pair< unsigned short, ROOT::Math::XYVector > CDCPair
Pair of <iSuperLayer, (x, y)>, for hits in conformal space.

◆ findAllCrossingHits()

void findAllCrossingHits ( std::vector< unsigned > & list,
double x1,
double x2,
double y1,
double y2,
const CDCHitMap & inputMap )

Find all hits in inputMap whose Hough curve crosses the rectangle with corners (x1, y1) and (x2, y2) and add the hit indices to list.

Definition at line 423 of file CDCTriggerHoughtrafo.cc.

427{
428 double m, a, y1_h, y2_h;
429
430 const double sin_x1 = std::sin(x1 - 1e-10);
431 const double cos_x1 = std::cos(x1 - 1e-10);
432 const double sin_x2 = std::sin(x2 + 1e-10);
433 const double cos_x2 = std::cos(x2 + 1e-10);
434
435 std::array<double, 3> phi = {0, 0, 0};
436
437 for (int iHit = 0; iHit < m_segmentHits.getEntries(); iHit++) {
438 unsigned short iSL = m_segmentHits[iHit]->getISuperLayer();
439 if (iSL % 2) continue;
440 // associate only the hits actually used to form the cluster
441 if (m_suppressClone && inputMap.find(iHit) == inputMap.end()) continue;
442 //TODO: add options: center cell / active priority cell / all priority cells
443 phi[0] = m_segmentHits[iHit]->getSegmentID() - m_TSoffset[iSL];
444 phi[1] = phi[0] + 0.5;
445 phi[2] = phi[0] - 0.5;
446 const auto& radiusISL = m_radius[iSL];
447 for (unsigned i = 0; i < 3; ++i) {
448 phi[i] *= 2. * M_PI / (m_TSoffset[iSL + 1] - m_TSoffset[iSL]);
449 m = std::cos(phi[i]) / radiusISL[std::min(i, 1u)];
450 a = std::sin(phi[i]) / radiusISL[std::min(i, 1u)];
451 // calculate Hough curve with slightly enlarged limits to avoid errors due to rounding
452 y1_h = m * sin_x1 - a * cos_x1;
453 y2_h = m * sin_x2 - a * cos_x2;
454 // skip decreasing half of the sine (corresponds to curl back half of the track)
455 if (y1_h > y2_h) continue;
456 if (!((y1_h > y2 && y2_h > y2) || (y1_h < y1 && y2_h < y1))) {
457 list.push_back(iHit);
458 break;
459 }
460 }
461 }
462}

◆ getAfterConditionPath()

Module::EAfterConditionPath getAfterConditionPath ( ) const
inherited

What to do after the conditional path is finished.

(defaults to c_End if no condition is set)

Definition at line 133 of file Module.cc.

134{
135 if (m_conditions.empty()) return EAfterConditionPath::c_End;
136
137 //okay, a condition was set for this Module...
138 if (!m_hasReturnValue) {
139 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
140 }
141
142 for (const auto& condition : m_conditions) {
143 if (condition.evaluate(m_returnValue)) {
144 return condition.getAfterConditionPath();
145 }
146 }
147
148 return EAfterConditionPath::c_End;
149}

◆ getAllConditionPaths()

std::vector< std::shared_ptr< Path > > getAllConditionPaths ( ) const
inherited

Return all condition paths currently set (no matter if the condition is true or not).

Definition at line 150 of file Module.cc.

151{
152 std::vector<std::shared_ptr<Path>> allConditionPaths;
153 for (const auto& condition : m_conditions) {
154 allConditionPaths.push_back(condition.getPath());
155 }
156
157 return allConditionPaths;
158}

◆ getAllConditions()

const std::vector< ModuleCondition > & getAllConditions ( ) const
inlineinherited

Return all set conditions for this module.

Definition at line 324 of file Module.h.

325 {
326 return m_conditions;
327 }

◆ getCondition()

const ModuleCondition * getCondition ( ) const
inlineinherited

Return a pointer to the first condition (or nullptr, if none was set)

Definition at line 314 of file Module.h.

315 {
316 if (m_conditions.empty()) {
317 return nullptr;
318 } else {
319 return &m_conditions.front();
320 }
321 }

◆ getConditionPath()

std::shared_ptr< Path > getConditionPath ( ) const
inherited

Returns the path of the last true condition (if there is at least one, else reaturn a null pointer).

Definition at line 113 of file Module.cc.

114{
115 PathPtr p;
116 if (m_conditions.empty()) return p;
117
118 //okay, a condition was set for this Module...
119 if (!m_hasReturnValue) {
120 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
121 }
122
123 for (const auto& condition : m_conditions) {
124 if (condition.evaluate(m_returnValue)) {
125 return condition.getPath();
126 }
127 }
128
129 // if none of the conditions were true, return a null pointer.
130 return p;
131}
std::shared_ptr< Path > PathPtr
Defines a pointer to a path object as a boost shared pointer.
Definition Path.h:35

◆ getDescription()

const std::string & getDescription ( ) const
inlineinherited

Returns the description of the module.

Definition at line 202 of file Module.h.

202{return m_description;}

◆ getFileNames()

virtual std::vector< std::string > getFileNames ( bool outputFiles)
inlinevirtualinherited

Return a list of output filenames for this modules.

This will be called when basf2 is run with "--dry-run" if the module has set either the c_Input or c_Output properties.

If the parameter outputFiles is false (for modules with c_Input) the list of input filenames should be returned (if any). If outputFiles is true (for modules with c_Output) the list of output files should be returned (if any).

If a module has sat both properties this member is called twice, once for each property.

The module should return the actual list of requested input or produced output filenames (including handling of input/output overrides) so that the grid system can handle input/output files correctly.

This function should return the same value when called multiple times. This is especially important when taking the input/output overrides from Environment as they get consumed when obtained so the finalized list of output files should be stored for subsequent calls.

Reimplemented in RootInputModule, RootOutputModule, and StorageRootOutputModule.

Definition at line 134 of file Module.h.

135 {
136 return std::vector<std::string>();
137 }

◆ getLogConfig()

LogConfig & getLogConfig ( )
inlineinherited

Returns the log system configuration.

Definition at line 225 of file Module.h.

225{return m_logConfig;}

◆ getModules()

std::list< ModulePtr > getModules ( ) const
inlineoverrideprivatevirtualinherited

no submodules, return empty list

Implements PathElement.

Definition at line 506 of file Module.h.

506{ return std::list<ModulePtr>(); }

◆ getName()

const std::string & getName ( ) const
inlineinherited

Returns the name of the module.

This can be changed via e.g. set_name() in the steering file to give more useful names if there is more than one module of the same type.

For identifying the type of a module, using getType() (or type() in Python) is recommended.

Definition at line 187 of file Module.h.

187{return m_name;}

◆ getPackage()

const std::string & getPackage ( ) const
inlineinherited

Returns the package this module is in.

Definition at line 197 of file Module.h.

197{return m_package;}

◆ getParamInfoListPython()

std::shared_ptr< boost::python::list > getParamInfoListPython ( ) const
inherited

Returns a python list of all parameters.

Each item in the list consists of the name of the parameter, a string describing its type, a python list of all default values and the description of the parameter.

Returns
A python list containing the parameters of this parameter list.

Definition at line 279 of file Module.cc.

280{
282}
std::shared_ptr< boost::python::list > getParamInfoListPython() const
Returns a python list of all parameters.

◆ getParamList()

const ModuleParamList & getParamList ( ) const
inlineinherited

Return module param list.

Definition at line 363 of file Module.h.

363{ return m_moduleParamList; }

◆ getPathString()

std::string getPathString ( ) const
overrideprivatevirtualinherited

return the module name.

Implements PathElement.

Definition at line 192 of file Module.cc.

193{
194
195 std::string output = getName();
196
197 for (const auto& condition : m_conditions) {
198 output += condition.getString();
199 }
200
201 return output;
202}

◆ getReturnValue()

int getReturnValue ( ) const
inlineinherited

Return the return value set by this module.

This value is only meaningful if hasReturnValue() is true

Definition at line 381 of file Module.h.

381{ return m_returnValue; }

◆ getType()

const std::string & getType ( ) const
inherited

Returns the type of the module (i.e.

class name minus 'Module')

Definition at line 41 of file Module.cc.

42{
43 if (m_type.empty())
44 B2FATAL("Module type not set for " << getName());
45 return m_type;
46}
std::string m_type
The type of the module, saved as a string.
Definition Module.h:509

◆ hasCondition()

bool hasCondition ( ) const
inlineinherited

Returns true if at least one condition was set for the module.

Definition at line 311 of file Module.h.

311{ return not m_conditions.empty(); };

◆ hasProperties()

bool hasProperties ( unsigned int propertyFlags) const
inherited

Returns true if all specified property flags are available in this module.

Parameters
propertyFlagsOred EModulePropFlags which should be compared with the module flags.

Definition at line 160 of file Module.cc.

161{
162 return (propertyFlags & m_propertyFlags) == propertyFlags;
163}

◆ hasReturnValue()

bool hasReturnValue ( ) const
inlineinherited

Return true if this module has a valid return value set.

Definition at line 378 of file Module.h.

378{ return m_hasReturnValue; }

◆ hasUnsetForcedParams()

bool hasUnsetForcedParams ( ) const
inherited

Returns true and prints error message if the module has unset parameters which the user has to set in the steering file.

Definition at line 166 of file Module.cc.

167{
169 std::string allMissing = "";
170 for (const auto& s : missing)
171 allMissing += s + " ";
172 if (!missing.empty())
173 B2ERROR("The following required parameters of Module '" << getName() << "' were not specified: " << allMissing <<
174 "\nPlease add them to your steering file.");
175 return !missing.empty();
176}
std::vector< std::string > getUnsetForcedParams() const
Returns list of unset parameters (if they are required to have a value.

◆ if_false()

void if_false ( const std::shared_ptr< Path > & path,
EAfterConditionPath afterConditionPath = EAfterConditionPath::c_End )
inherited

A simplified version to add a condition to the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

It is equivalent to the if_value() method, using the expression "<1". This method is meant to be used together with the setReturnValue(bool value) method.

Parameters
pathShared pointer to the Path which will be executed if the return value is false.
afterConditionPathWhat to do after executing 'path'.

Definition at line 85 of file Module.cc.

86{
87 if_value("<1", path, afterConditionPath);
88}

◆ if_true()

void if_true ( const std::shared_ptr< Path > & path,
EAfterConditionPath afterConditionPath = EAfterConditionPath::c_End )
inherited

A simplified version to set the condition of the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

It is equivalent to the if_value() method, using the expression ">=1". This method is meant to be used together with the setReturnValue(bool value) method.

Parameters
pathShared pointer to the Path which will be executed if the return value is true.
afterConditionPathWhat to do after executing 'path'.

Definition at line 90 of file Module.cc.

91{
92 if_value(">=1", path, afterConditionPath);
93}

◆ if_value()

void if_value ( const std::string & expression,
const std::shared_ptr< Path > & path,
EAfterConditionPath afterConditionPath = EAfterConditionPath::c_End )
inherited

Add a condition to the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

See https://xwiki.desy.de/xwiki/rest/p/a94f2 or ModuleCondition for a description of the syntax.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

Parameters
expressionThe expression of the condition.
pathShared pointer to the Path which will be executed if the condition is evaluated to true.
afterConditionPathWhat to do after executing 'path'.

Definition at line 79 of file Module.cc.

80{
81 m_conditions.emplace_back(expression, path, afterConditionPath);
82}

◆ initialize()

void initialize ( void )
overridevirtual

Initialize the module and check module parameters.

Reimplemented from Module.

Definition at line 125 of file CDCTrigger2DFinderModule.cc.

126{
128 m_tracks.registerInDataStore(m_outputCollectionName);
129 m_clusters.registerInDataStore(m_clusterCollectionName);
130
131 m_tracks.registerRelationTo(m_segmentHits);
132 m_tracks.registerRelationTo(m_clusters);
133
134 if (m_storePlane > 0) m_houghPlane.registerInDataStore("HoughPlane");
135
136 if (m_testFilename != "") {
138 }
139
140 if (m_suppressClone) {
141 B2INFO("2D finder will exit with the first track candidate in time.");
142 }
143
144 /* Extent the Hough plane such that the cell number is a power of 2 (same for x and y).
145 * This is for the fast peak finder, which divides the Hough plane in half in each step.
146 * Peaks found outside of the actual limits are ignored. */
147 m_maxIterations = std::ceil(std::log2(std::max(m_nCellsPhi, m_nCellsR))) - 1;
148 m_nCells = std::pow(2, m_maxIterations + 1);
149 /* limits in phi: [-pi, pi] + extra cells */
150 m_rectX = M_PI * m_nCells / m_nCellsPhi;
151 /* limits in R: [-R(minPt), R(minPt)] + extra cells + shift */
152 m_maxR = 0.5 * Const::speedOfLight * 1.5e-4 / m_minPt;
154 m_shiftR = 0;
155 if (m_shiftPt < 0) {
156 m_shiftR = -m_maxR / 2. / m_nCellsR;
157 } else if (m_shiftPt > 0) {
158 m_shiftR = m_maxR / 2. / m_nCellsR;
159 }
160
161 B2DEBUG(50, "extending Hough plane to " << m_maxIterations << " iterations, "
162 << m_nCells << " cells: phi in ["
163 << -m_rectX * 180. / M_PI << ", " << m_rectX * 180. / M_PI
164 << "] deg, 1/r in [" << -m_rectY + m_shiftR << ", " << m_rectY + m_shiftR << "] /cm");
165
166}
static const double speedOfLight
[cm/ns]
Definition Const.h:696

◆ inList()

bool inList ( const CDCTriggerHoughCand & a,
const std::vector< CDCTriggerHoughCand > & list ) const

Check if candidate is in list.

Definition at line 340 of file CDCTriggerHoughtrafo.cc.

342{
343 for (unsigned i = 0; i < list.size(); ++i) {
344 if (a == list[i]) return true;
345 }
346 return false;
347}

◆ mergeIdList()

void mergeIdList ( std::vector< unsigned > & merged,
std::vector< unsigned > & a,
std::vector< unsigned > & b )

Merge lists a and b and put the result in merged.

Definition at line 388 of file CDCTriggerHoughtrafo.cc.

391{
392 bool found;
393
394 merged.reserve(a.size() + b.size());
395 for (auto it = a.begin(); it != a.end(); ++it) {
396 found = false;
397 for (auto it_in = merged.begin(); it_in != merged.end(); ++it_in) {
398 if (*it_in == *it) {
399 found = true;
400 break;
401 }
402 }
403 if (!found) {
404 merged.push_back(*it);
405 }
406 }
407
408 for (auto it = b.begin(); it != b.end(); ++it) {
409 found = false;
410 for (auto it_in = merged.begin(); it_in != merged.end(); ++it_in) {
411 if (*it_in == *it) {
412 found = true;
413 break;
414 }
415 }
416 if (!found) {
417 merged.push_back(*it);
418 }
419 }
420}

◆ patternClustering()

void patternClustering ( const CDCHitMap & inputMap)

Combine Hough candidates to tracks by a fixed pattern algorithm.

The Hough plane is first divided in 2 x 2 squares, then squares are combined.

Definition at line 503 of file CDCTriggerHoughtrafo.cc.

504{
505 // fill a matrix of 2 x 2 squares
506 TMatrix plane2(m_nCellsPhi / 2, m_nCellsR / 2);
507 TMatrix planeIcand(m_nCellsPhi, m_nCellsR);
508 for (unsigned icand = 0; icand < m_houghCand.size(); ++icand) {
509 double x = (m_houghCand[icand].getCoord().first.X() +
510 m_houghCand[icand].getCoord().second.X()) / 2.;
511 unsigned ix = floor((x + M_PI) / 2. / M_PI * m_nCellsPhi);
512 double y = (m_houghCand[icand].getCoord().first.Y() +
513 m_houghCand[icand].getCoord().second.Y()) / 2.;
514 unsigned iy = floor((y + m_maxR - m_shiftR) / 2. / m_maxR * m_nCellsR);
515 plane2[ix / 2][iy / 2] += 1 << ((ix % 2) + 2 * (iy % 2));
516 planeIcand[ix][iy] = icand;
517 B2DEBUG(100, "candidate " << icand << " at ix " << ix << " iy " << iy);
518 }
519 // look for clusters of 2 x 2 squares in a (rX x rY) region
520 unsigned nX = m_nCellsPhi / 2;
521 unsigned nY = m_nCellsR / 2;
522 unsigned rX = m_clusterSizeX;
523 unsigned rY = m_clusterSizeY;
524 std::vector<unsigned> pattern(rX * rY, 0);
525 std::vector<ROOT::Math::XYVector> cellIds;
526 cellIds.reserve(rX * rY);
527 for (unsigned ix = 0; ix < nX; ++ix) {
528 for (unsigned iy = 0; iy < nY; ++iy) {
529 if (!plane2[ix][iy]) continue;
530 // check if we are in a lower left corner
531 unsigned ileft = (ix - 1 + nX) % nX;
532 B2DEBUG(100, "ix " << ix << " iy " << iy);
533 if (connectedLR(plane2[ileft][iy], plane2[ix][iy]) ||
534 (iy > 0 && connectedUD(plane2[ix][iy - 1], plane2[ix][iy])) ||
535 (iy > 0 && connectedDiag(plane2[ileft][iy - 1], plane2[ix][iy]))) {
536 B2DEBUG(100, "skip connected square");
537 continue;
538 }
539 // form cluster
540 pattern.assign(rX * rY, 0); // reset pattern to 0
541 pattern[0] = plane2[ix][iy];
542 cellIds.clear();
543 cellIds.emplace_back(ROOT::Math::XYVector(2. * ix, 2. * iy));
544 for (unsigned ix2 = 0; ix2 < rX; ++ix2) {
545 for (unsigned iy2 = 0; iy2 < rY; ++iy2) {
546 if (iy + iy2 >= nY) continue;
547 unsigned ip = ix2 + rX * iy2;
548 unsigned iright = (ix + ix2 + nX) % nX;
549 ileft = (iright - 1 + nX) % nX;
550 B2DEBUG(100, "ix2 " << ix2 << " ileft " << ileft << " iright " << iright);
551 if ((ix2 > 0 && // check left/right connection
552 pattern[ip - 1] &&
553 connectedLR(plane2[ileft][iy + iy2], plane2[iright][iy + iy2])) ||
554 (iy2 > 0 && // check up/down connection
555 pattern[ip - rX] &&
556 connectedUD(plane2[iright][iy + iy2 - 1], plane2[iright][iy + iy2])) ||
557 (ix2 > 0 && iy2 > 0 && // check diagonal connection
558 pattern[ip - rX - 1] &&
559 connectedDiag(plane2[ileft][iy + iy2 - 1], plane2[iright][iy + iy2]))) {
560 pattern[ip] = plane2[iright][iy + iy2];
561 B2DEBUG(100, "connect cell " << iright << " " << iy + iy2);
562 cellIds.emplace_back(ROOT::Math::XYVector(2. * (ix + ix2), 2. * (iy + iy2)));
563 }
564 }
565 }
566 B2DEBUG(100, "cluster starting at " << ix << " " << iy);
567 // check if cluster continues beyond defined area
568 bool overflowRight = false;
569 bool overflowTop = false;
570 for (unsigned iy2 = 0; iy2 < rY; ++iy2) {
571 unsigned ip = rX - 1 + rX * iy2;
572 if (!pattern[ip]) continue;
573 unsigned iright = (ix + rX + nX) % nX;
574 ileft = (iright - 1 + nX) % nX;
575 if (connectedLR(plane2[ileft][iy + iy2], plane2[iright][iy + iy2]) ||
576 ((iy + iy2 + 1 < nY) &&
577 connectedDiag(plane2[ileft][iy + iy2], plane2[iright][iy + iy2 + 1]))) {
578 setReturnValue(false);
579 overflowRight = true;
580 }
581 }
582 if (iy + rY < nY) {
583 for (unsigned ix2 = 0; ix2 < rX; ++ix2) {
584 unsigned ip = ix2 + rX * (rY - 1);
585 if (!pattern[ip]) continue;
586 unsigned iright = (ix + ix2 + 1 + nX) % nX;
587 ileft = (iright - 1 + nX) % nX;
588 if (connectedUD(plane2[ileft][iy + rY - 1], plane2[ileft][iy + rY]) ||
589 connectedDiag(plane2[ileft][iy + rY - 1], plane2[iright][iy + rY])) {
590 setReturnValue(false);
591 overflowTop = true;
592 }
593 }
594 }
595 if (overflowRight && !overflowTop) {
596 B2DEBUG(100, "cluster extends right of " << rX << " x " << rY << " area");
597 } else if (overflowTop && !overflowRight) {
598 B2DEBUG(100, "cluster extends above " << rX << " x " << rY << " area");
599 } else if (overflowRight && overflowTop) {
600 B2DEBUG(100, "cluster extends right and above " << rX << " x " << rY << " area");
601 }
602 // find corners of cluster
603 unsigned topRight2 = topRightSquare(pattern);
604 unsigned topRight = topRightCorner(pattern[topRight2]);
605 unsigned bottomLeft = bottomLeftCorner(pattern[0]);
606 B2DEBUG(100, "topRight2 " << topRight2 << " topRight " << topRight << " bottomLeft " << bottomLeft);
607 // average over corners to find cluster center
608 unsigned ixTR = 2 * (topRight2 % m_clusterSizeX) + (topRight % 2);
609 unsigned ixBL = bottomLeft % 2;
610 unsigned iyTR = 2 * (topRight2 / m_clusterSizeX) + (topRight / 2);
611 unsigned iyBL = bottomLeft / 2;
612 B2DEBUG(100, "ixTR " << ixTR << " ixBL " << ixBL << " iyTR " << iyTR << " iyBL " << iyBL);
613 // skip size 1 clusters
614 if (m_minCells > 1 && ixTR == ixBL && iyTR == iyBL) {
615 B2DEBUG(100, "skipping cluster of size 1");
616 continue;
617 }
618 float centerX = 2 * ix + (ixTR + ixBL) / 2.;
619 if (centerX >= m_nCellsPhi) centerX -= m_nCellsPhi;
620 float centerY = 2 * iy + (iyTR + iyBL) / 2.;
621 B2DEBUG(100, "center at cell (" << centerX << ", " << centerY << ")");
622 // convert to coordinates
623 double x = -M_PI + (centerX + 0.5) * 2. * M_PI / m_nCellsPhi;
624 double y = -m_maxR + m_shiftR + (centerY + 0.5) * 2. * m_maxR / m_nCellsR;
625 B2DEBUG(100, "center coordinates (" << x << ", " << y << ")");
626 // get list of related hits
627 std::vector <unsigned> idList = {};
629 unsigned icandTR = planeIcand[(ixTR + 2 * ix) % m_nCellsPhi][iyTR + 2 * iy];
630 unsigned icandBL = planeIcand[ixBL + 2 * ix][iyBL + 2 * iy];
631 std::vector<unsigned> candIdListTR = m_houghCand[icandTR].getIdList();
632 std::vector<unsigned> candIdListBL = m_houghCand[icandBL].getIdList();
633 mergeIdList(idList, candIdListTR, candIdListBL);
634 B2DEBUG(100, "merge id lists from candidates " << icandTR << " and " << icandBL);
635 } else {
636 double dx = M_PI / m_nCellsPhi;
637 double dy = m_maxR / m_nCellsR;
638 double x1 = (round(centerX) == centerX) ? x - dx : x - 2 * dx;
639 double x2 = (round(centerX) == centerX) ? x + dx : x + 2 * dx;
640 double y1 = (round(centerY) == centerY) ? y - dy : y - 2 * dy;
641 double y2 = (round(centerY) == centerY) ? y + dy : y + 2 * dy;
642 findAllCrossingHits(idList, x1, x2, y1, y2, inputMap);
643 }
644 if (idList.size() == 0) {
645 setReturnValue(false);
646 B2DEBUG(100, "id list empty");
647 }
648
649 // select 1 hit per super layer
650 std::vector<unsigned> selectedList = {};
651 std::vector<unsigned> unselectedList = {};
652 selectHits(idList, selectedList, unselectedList);
653
654 // save track
655 const CDCTriggerTrack* track =
656 m_tracks.appendNew(x, 2. * y, 0.);
657 // relations to selected hits
658 for (unsigned i = 0; i < selectedList.size(); ++i) {
659 unsigned its = selectedList[i];
660 track->addRelationTo(m_segmentHits[its]);
661 }
662 // relations to additional hits get a negative weight
663 for (unsigned i = 0; i < unselectedList.size(); ++i) {
664 unsigned its = unselectedList[i];
665 track->addRelationTo(m_segmentHits[its], -1.);
666 }
667 // save detail information about the cluster
668 const CDCTriggerHoughCluster* cluster =
669 m_clusters.appendNew(2 * ix, 2 * (ix + m_clusterSizeX) - 1,
670 2 * iy, 2 * (iy + m_clusterSizeY) - 1,
671 cellIds);
672 track->addRelationTo(cluster);
673 }
674 }
675}
void findAllCrossingHits(std::vector< unsigned > &list, double x1, double x2, double y1, double y2, const CDCHitMap &inputMap)
Find all hits in inputMap whose Hough curve crosses the rectangle with corners (x1,...
bool connectedLR(unsigned patternL, unsigned patternR)
Check for left/right connection of patterns in 2 x 2 squares.
unsigned topRightCorner(unsigned pattern)
Find the top right corner within 2 x 2 square.
bool connectedUD(unsigned patternD, unsigned patternU)
Check for up/down connection of patterns in 2 x 2 squares.
unsigned bottomLeftCorner(unsigned pattern)
Find the bottom left corner within 2 x 2 square.
bool connectedDiag(unsigned patternLD, unsigned patternRU)
Check for diagonal connected of patterns in 2 x 2 squares.
unsigned topRightSquare(std::vector< unsigned > &pattern)
Find the top right square within a cluster of 2 x 2 squares In case of ambiguity, top is favored over...

◆ selectHits()

void selectHits ( std::vector< unsigned > & list,
std::vector< unsigned > & selected,
std::vector< unsigned > & unselected )

Select one hit per super layer.

Parameters
listinput list of hit Ids
selectedselected hit Ids are added to selected
unselectedthe rest of the hit Ids are added to unselected

Definition at line 468 of file CDCTriggerHoughtrafo.cc.

471{
472 std::array<int, 5> bestPerSL;
473 bestPerSL.fill(-1);
474 for (unsigned i = 0; i < list.size(); ++i) {
475 unsigned iax = m_segmentHits[list[i]]->getISuperLayer() / 2;
476 bool firstPriority = (m_segmentHits[list[i]]->getPriorityPosition() == 3);
477 if (bestPerSL[iax] < 0) {
478 bestPerSL[iax] = i;
479 } else {
480 unsigned itsBest = list[bestPerSL[iax]];
481 bool firstBest = (m_segmentHits[itsBest]->getPriorityPosition() == 3);
482 // selection rules:
483 // first priority, higher ID
484 if ((firstPriority && !firstBest) ||
485 (firstPriority == firstBest &&
486 m_segmentHits[list[i]]->getSegmentID() > m_segmentHits[itsBest]->getSegmentID())) {
487 bestPerSL[iax] = i;
488 }
489 }
490 }
491
492 for (unsigned i = 0; i < list.size(); ++i) {
493 unsigned iax = m_segmentHits[list[i]]->getISuperLayer() / 2;
494 if (int(i) == bestPerSL[iax]) selected.push_back(list[i]);
495 else unselected.push_back(list[i]);
496 }
497}

◆ setAbortLevel()

void setAbortLevel ( int abortLevel)
inherited

Configure the abort log level.

Definition at line 67 of file Module.cc.

68{
69 m_logConfig.setAbortLevel(static_cast<LogConfig::ELogLevel>(abortLevel));
70}
ELogLevel
Definition of the supported log levels.
Definition LogConfig.h:26
void setAbortLevel(ELogLevel abortLevel)
Configure the abort level.
Definition LogConfig.h:112

◆ setDebugLevel()

void setDebugLevel ( int debugLevel)
inherited

Configure the debug messaging level.

Definition at line 61 of file Module.cc.

62{
63 m_logConfig.setDebugLevel(debugLevel);
64}
void setDebugLevel(int debugLevel)
Configure the debug messaging level.
Definition LogConfig.h:98

◆ setDescription()

void setDescription ( const std::string & description)
protectedinherited

Sets the description of the module.

Parameters
descriptionA description of the module.

Definition at line 214 of file Module.cc.

215{
216 m_description = description;
217}
std::string m_description
The description of the module.
Definition Module.h:511

◆ setLogConfig()

void setLogConfig ( const LogConfig & logConfig)
inlineinherited

Set the log system configuration.

Definition at line 230 of file Module.h.

230{m_logConfig = logConfig;}

◆ setLogInfo()

void setLogInfo ( int logLevel,
unsigned int logInfo )
inherited

Configure the printed log information for the given level.

Parameters
logLevelThe log level (one of LogConfig::ELogLevel)
logInfoWhat kind of info should be printed? ORed combination of LogConfig::ELogInfo flags.

Definition at line 73 of file Module.cc.

74{
75 m_logConfig.setLogInfo(static_cast<LogConfig::ELogLevel>(logLevel), logInfo);
76}
void setLogInfo(ELogLevel logLevel, unsigned int logInfo)
Configure the printed log information for the given level.
Definition LogConfig.h:127

◆ setLogLevel()

void setLogLevel ( int logLevel)
inherited

Configure the log level.

Definition at line 55 of file Module.cc.

56{
57 m_logConfig.setLogLevel(static_cast<LogConfig::ELogLevel>(logLevel));
58}
void setLogLevel(ELogLevel logLevel)
Configure the log level.
Definition LogConfig.cc:25

◆ setName()

void setName ( const std::string & name)
inlineinherited

Set the name of the module.

Note
The module name is set when using the REG_MODULE macro, but the module can be renamed before calling process() using the set_name() function in your steering file.
Parameters
nameThe name of the module

Definition at line 214 of file Module.h.

214{ m_name = name; };

◆ setParamList()

void setParamList ( const ModuleParamList & params)
inlineprotectedinherited

Replace existing parameter list.

Definition at line 501 of file Module.h.

501{ m_moduleParamList = params; }

◆ setParamPython()

void setParamPython ( const std::string & name,
const boost::python::object & pyObj )
privateinherited

Implements a method for setting boost::python objects.

The method supports the following types: list, dict, int, double, string, bool The conversion of the python object to the C++ type and the final storage of the parameter value is done in the ModuleParam class.

Parameters
nameThe unique name of the parameter.
pyObjThe object which should be converted and stored as the parameter value.

Definition at line 234 of file Module.cc.

235{
236 LogSystem& logSystem = LogSystem::Instance();
237 logSystem.updateModule(&(getLogConfig()), getName());
238 try {
240 } catch (std::runtime_error& e) {
241 throw std::runtime_error("Cannot set parameter '" + name + "' for module '"
242 + m_name + "': " + e.what());
243 }
244
245 logSystem.updateModule(nullptr);
246}
void updateModule(const LogConfig *moduleLogConfig=nullptr, const std::string &moduleName="")
Sets the log configuration to the given module log configuration and sets the module name This method...
Definition LogSystem.h:200
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
Definition LogSystem.cc:28
LogConfig & getLogConfig()
Returns the log system configuration.
Definition Module.h:225
std::string m_name
The name of the module, saved as a string (user-modifiable)
Definition Module.h:508
void setParamPython(const std::string &name, const PythonObject &pyObj)
Implements a method for setting boost::python objects.

◆ setParamPythonDict()

void setParamPythonDict ( const boost::python::dict & dictionary)
privateinherited

Implements a method for reading the parameter values from a boost::python dictionary.

The key of the dictionary has to be the name of the parameter and the value has to be of one of the supported parameter types.

Parameters
dictionaryThe python dictionary from which the parameter values are read.

Definition at line 249 of file Module.cc.

250{
251
252 LogSystem& logSystem = LogSystem::Instance();
253 logSystem.updateModule(&(getLogConfig()), getName());
254
255 boost::python::list dictKeys = dictionary.keys();
256 int nKey = boost::python::len(dictKeys);
257
258 //Loop over all keys in the dictionary
259 for (int iKey = 0; iKey < nKey; ++iKey) {
260 boost::python::object currKey = dictKeys[iKey];
261 boost::python::extract<std::string> keyProxy(currKey);
262
263 if (keyProxy.check()) {
264 const boost::python::object& currValue = dictionary[currKey];
265 setParamPython(keyProxy, currValue);
266 } else {
267 B2ERROR("Setting the module parameters from a python dictionary: invalid key in dictionary!");
268 }
269 }
270
271 logSystem.updateModule(nullptr);
272}
void setParamPython(const std::string &name, const boost::python::object &pyObj)
Implements a method for setting boost::python objects.
Definition Module.cc:234

◆ setPropertyFlags()

void setPropertyFlags ( unsigned int propertyFlags)
inherited

Sets the flags for the module properties.

Parameters
propertyFlagsbitwise OR of EModulePropFlags

Definition at line 208 of file Module.cc.

209{
210 m_propertyFlags = propertyFlags;
211}

◆ setReturnValue() [1/2]

void setReturnValue ( bool value)
protectedinherited

Sets the return value for this module as bool.

The bool value is saved as an integer with the convention 1 meaning true and 0 meaning false. The value can be used in the steering file to divide the analysis chain into several paths.

Parameters
valueThe value of the return value.

Definition at line 227 of file Module.cc.

228{
229 m_hasReturnValue = true;
230 m_returnValue = value;
231}

◆ setReturnValue() [2/2]

void setReturnValue ( int value)
protectedinherited

Sets the return value for this module as integer.

The value can be used in the steering file to divide the analysis chain into several paths.

Parameters
valueThe value of the return value.

Definition at line 220 of file Module.cc.

221{
222 m_hasReturnValue = true;
223 m_returnValue = value;
224}

◆ setType()

void setType ( const std::string & type)
protectedinherited

Set the module type.

Only for use by internal modules (which don't use the normal REG_MODULE mechanism).

Definition at line 48 of file Module.cc.

49{
50 if (!m_type.empty())
51 B2FATAL("Trying to change module type from " << m_type << " is not allowed, the value is assumed to be fixed.");
52 m_type = type;
53}

◆ shortTrack()

bool shortTrack ( std::bitset< 45 > & superLayers)

check the short track condition (= hits in the inner super layers rather than any super layers)

Parameters
superLayersarray of hit/no hit for all super layers

Definition at line 25 of file CDCTriggerHoughtrafo.cc.

26{
27 unsigned short lcnt = 0;
28 // check axial super layers (even layer number),
29 // break at first layer without hit
30 for (int i = 0; i < CDC_SUPER_LAYERS; i += 2) {
31 if (layer[i] == true) ++lcnt;
32 else break;
33 }
34 return (lcnt >= m_minHitsShort);
35}

◆ terminate()

void terminate ( void )
overridevirtual

Clean up.

Reimplemented from Module.

Definition at line 411 of file CDCTrigger2DFinderModule.cc.

412{
413 if (m_testFilename != "") m_testFile.close();
414}

◆ topRightCorner()

unsigned topRightCorner ( unsigned pattern)

Find the top right corner within 2 x 2 square.

In case of ambiguity right corner is returned. x . . x -> return this one @ return index of corner within pattern

Definition at line 781 of file CDCTriggerHoughtrafo.cc.

782{
783 // scan pattern from right to left:
784 // 2 3
785 // 0 1
786 if ((pattern >> 3) & 1) return 3;
787 if ((pattern >> 1) & 1) {
788 if ((pattern >> 2) & 1) {
789 setReturnValue(false);
790 B2DEBUG(100, "topRightCorner not unique");
791 }
792 return 1;
793 }
794 if ((pattern >> 2) & 1) return 2;
795 return 0;
796}

◆ topRightSquare()

unsigned topRightSquare ( std::vector< unsigned > & pattern)

Find the top right square within a cluster of 2 x 2 squares In case of ambiguity, top is favored over right @ return index of corner within pattern vector.

Definition at line 751 of file CDCTriggerHoughtrafo.cc.

752{
753 // scan from top right corner until an active square is found
754 for (unsigned index = pattern.size() - 1; index > 0; --index) {
755 if (!pattern[index]) continue;
756 // check for ambiguity
757 unsigned ix = index % m_clusterSizeX;
758 unsigned iy = index / m_clusterSizeX;
759 if (ix < m_clusterSizeX - 1 && iy > 0) {
760 bool unique = true;
761 for (unsigned index2 = index - 1; index2 > 0; --index2) {
762 if (!pattern[index2]) continue;
763 unsigned ix2 = index2 % m_clusterSizeX;
764 unsigned iy2 = index2 / m_clusterSizeX;
765 if (iy2 < iy && ix2 > ix) {
766 unique = false;
767 break;
768 }
769 }
770 if (!unique) {
771 setReturnValue(false);
772 B2DEBUG(100, "topRightSquare not unique");
773 }
774 }
775 return index;
776 }
777 return 0;
778}

Member Data Documentation

◆ m_cdctrg2d_DB

DBObjPtr<CDCTrigger2DConfig> m_cdctrg2d_DB
protected

run dependent parameter database of 2D

Definition at line 293 of file CDCTrigger2DFinderModule.h.

◆ m_clusterCollectionName

std::string m_clusterCollectionName
protected

Name of the StoreArray containing the clusters formed in the Hough plane.

Definition at line 187 of file CDCTrigger2DFinderModule.h.

◆ m_clusterPattern

bool m_clusterPattern
protected

switch for clustering algorithm (if true use nested patterns)

Definition at line 251 of file CDCTrigger2DFinderModule.h.

◆ m_clusters

StoreArray<CDCTriggerHoughCluster> m_clusters
protected

list of clusters in the Hough map

Definition at line 288 of file CDCTrigger2DFinderModule.h.

◆ m_clusterSizeX

unsigned m_clusterSizeX
protected

maximum cluster size for pattern algorithm

Definition at line 253 of file CDCTrigger2DFinderModule.h.

◆ m_clusterSizeY

unsigned m_clusterSizeY
protected

maximum cluster size for pattern algorithm

Definition at line 255 of file CDCTrigger2DFinderModule.h.

◆ m_conditions

std::vector<ModuleCondition> m_conditions
privateinherited

Module condition, only non-null if set.

Definition at line 521 of file Module.h.

◆ m_connect

unsigned m_connect
protected

number of neighbors to check for connection (4: direct, 6: direct + upper right and lower left corner, 8: direct + all corners)

Definition at line 227 of file CDCTrigger2DFinderModule.h.

◆ m_description

std::string m_description
privateinherited

The description of the module.

Definition at line 511 of file Module.h.

◆ m_hasReturnValue

bool m_hasReturnValue
privateinherited

True, if the return value is set.

Definition at line 518 of file Module.h.

◆ m_hitCollectionName

std::string m_hitCollectionName
protected

Name of the StoreArray containing the input track segment hits.

Definition at line 183 of file CDCTrigger2DFinderModule.h.

◆ m_hitMap

CDCHitMap m_hitMap
protected

map of TS hits containing <iHit, <iSL, (x, y)>> with iHit: hit index in StoreArray iSL: super layer index

(x, y): coordinates in conformal space

Definition at line 274 of file CDCTrigger2DFinderModule.h.

◆ m_hitRelationsFromCorners

bool m_hitRelationsFromCorners
protected

switch for creating relations to hits in the pattern clustering algorithm.

true: create relations for all hits passing through the corners of a cluster, false: create relations for all hits passing though the estimated center of the cluster (can be 0 hits if center is not part of the cluster)

Definition at line 262 of file CDCTrigger2DFinderModule.h.

◆ m_houghCand

std::vector<CDCTriggerHoughCand> m_houghCand
protected

Hough Candidates.

Definition at line 276 of file CDCTrigger2DFinderModule.h.

◆ m_houghPlane

StoreObjPtr<TMatrix> m_houghPlane
protected

matrix containing the Hough plane

Definition at line 290 of file CDCTrigger2DFinderModule.h.

◆ m_ignore2nd

bool m_ignore2nd
protected

switch to skip second priority hits

Definition at line 229 of file CDCTrigger2DFinderModule.h.

◆ m_logConfig

LogConfig m_logConfig
privateinherited

The log system configuration of the module.

Definition at line 514 of file Module.h.

◆ m_maxIterations

unsigned m_maxIterations = 0
protected

number of iterations for the fast peak finder, smallest n such that 2^(n+1) > max(nCellsPhi, nCellsR).

Initialized at 0 by the SW shifter

Definition at line 205 of file CDCTrigger2DFinderModule.h.

◆ m_maxR

double m_maxR = 0.
protected

Hough plane limit in 1/r [1/cm].

Initialized at 0 by the SW shifter

Definition at line 200 of file CDCTrigger2DFinderModule.h.

◆ m_minCells

unsigned m_minCells
protected

minimum number of cells in a cluster to form a track

Definition at line 221 of file CDCTrigger2DFinderModule.h.

◆ m_minHits

unsigned m_minHits
protected

minimum number of hits from different super layers in a Hough cell to form a candidate

Definition at line 216 of file CDCTrigger2DFinderModule.h.

◆ m_minHitsShort

unsigned m_minHitsShort
protected

short tracks require hits in the first minHitsShort super layers to form a candidate

Definition at line 219 of file CDCTrigger2DFinderModule.h.

◆ m_minPt

double m_minPt
protected

Hough plane limit in Pt [GeV].

Definition at line 193 of file CDCTrigger2DFinderModule.h.

◆ m_moduleParamList

ModuleParamList m_moduleParamList
privateinherited

List storing and managing all parameter of the module.

Definition at line 516 of file Module.h.

◆ m_name

std::string m_name
privateinherited

The name of the module, saved as a string (user-modifiable)

Definition at line 508 of file Module.h.

◆ m_nCells

unsigned m_nCells = 0
protected

number of cells for the fast peak finder: 2^(maxIterations + 1).

Initialized at 0 by the SW shifter

Definition at line 207 of file CDCTrigger2DFinderModule.h.

◆ m_nCellsPhi

unsigned m_nCellsPhi
protected

number of Hough cells in phi

Definition at line 189 of file CDCTrigger2DFinderModule.h.

◆ m_nCellsR

unsigned m_nCellsR
protected

number of Hough cells in 1/r

Definition at line 191 of file CDCTrigger2DFinderModule.h.

◆ m_onlyLocalMax

bool m_onlyLocalMax
protected

switch to ignore candidates connected to cells with higher super layer count

Definition at line 223 of file CDCTrigger2DFinderModule.h.

◆ m_outputCollectionName

std::string m_outputCollectionName
protected

Name of the StoreArray containing the tracks found by the Hough tracking.

Definition at line 185 of file CDCTrigger2DFinderModule.h.

◆ m_package

std::string m_package
privateinherited

Package this module is found in (may be empty).

Definition at line 510 of file Module.h.

◆ m_propertyFlags

unsigned int m_propertyFlags
privateinherited

The properties of the module as bitwise or (with |) of EModulePropFlags.

Definition at line 512 of file Module.h.

◆ m_radius

double m_radius[9][5] = {{0.}}
protected

Radius of the CDC layers with priority wires (2 per super layer).

Initialized at 0 by the SW shifter

Definition at line 279 of file CDCTrigger2DFinderModule.h.

279{{0.}};

◆ m_rectX

double m_rectX = 0
protected

Store the rectangle size in x.

Definition at line 210 of file CDCTrigger2DFinderModule.h.

◆ m_rectY

double m_rectY = 0
protected

Store the rectangle size in y.

Definition at line 212 of file CDCTrigger2DFinderModule.h.

◆ m_requireSL0

bool m_requireSL0
protected

switch to check separately for a hit in the innermost super layer

Definition at line 233 of file CDCTrigger2DFinderModule.h.

◆ m_returnValue

int m_returnValue
privateinherited

The return value.

Definition at line 519 of file Module.h.

◆ m_segmentHits

StoreArray<CDCTriggerSegmentHit> m_segmentHits
protected

list of track segment hits

Definition at line 284 of file CDCTrigger2DFinderModule.h.

◆ m_shiftPt

int m_shiftPt
protected

shift the Hough plane in 1/r to avoid curvature 0 tracks < 0: shift in negative direction (negative half is larger) 0: no shift (same limits for negative and positive half)

0: shift in positive direction (positive half is larger)

Definition at line 198 of file CDCTrigger2DFinderModule.h.

◆ m_shiftR

double m_shiftR = 0.
protected

Hough plane shift in 1/r [1/cm].

Initialized at 0 by the SW shifter

Definition at line 202 of file CDCTrigger2DFinderModule.h.

◆ m_storePlane

unsigned m_storePlane
protected

switch to save the Hough plane in DataStore (0: don't save, 1: save only peaks, 2: save full plane)

Definition at line 249 of file CDCTrigger2DFinderModule.h.

◆ m_suppressClone

bool m_suppressClone
protected

switch to send only the first found track and suppress the subsequent clones

Definition at line 236 of file CDCTrigger2DFinderModule.h.

◆ m_testFile

std::ofstream m_testFile
protected

filestream for test output for firmware debugging

Definition at line 267 of file CDCTrigger2DFinderModule.h.

◆ m_testFilename

std::string m_testFilename
protected

filename for test output for firmware debugging

Definition at line 265 of file CDCTrigger2DFinderModule.h.

◆ m_tracks

StoreArray<CDCTriggerTrack> m_tracks
protected

list of found tracks

Definition at line 286 of file CDCTrigger2DFinderModule.h.

◆ m_TSoffset

unsigned m_TSoffset[10] = {0}
protected

Number of track segments up to super layer.

Initialized at 0 by the SW shifter

Definition at line 281 of file CDCTrigger2DFinderModule.h.

281{0};

◆ m_type

std::string m_type
privateinherited

The type of the module, saved as a string.

Definition at line 509 of file Module.h.

◆ m_useadc

bool m_useadc
protected

switch to use hit pattern inside TSF with ADC cut

Definition at line 242 of file CDCTrigger2DFinderModule.h.

◆ m_useDB

bool m_useDB
protected

switch to use database to load run dependent parameter

Definition at line 245 of file CDCTrigger2DFinderModule.h.

◆ m_usehitpattern

bool m_usehitpattern
protected

switch to use hit pattern inside TSF

Definition at line 239 of file CDCTrigger2DFinderModule.h.

◆ m_usePriority

bool m_usePriority
protected

switch between priority position and center position of track segment

Definition at line 231 of file CDCTrigger2DFinderModule.h.


The documentation for this class was generated from the following files: