8#include "trg/cdc/modules/trgcdc/CDCTriggerTrackCombinerModule.h"
10#include <framework/datastore/RelationVector.h>
22 "The combiner module of the CDC trigger.\n"
23 "Takes tracks from the various trigger stages (finder, fitter, neuro) "
24 "and combines them to a single track list. "
25 "The 2D track parameters are taken from the fitter, if present. "
26 "For the 3D track parameters there are different options (see parameters). "
27 "Combined tracks are not produced for tracks without 3D information "
28 "from either 3D fitter or neuro.\n"
32 "Name of the 2D finder track list.",
33 string(
"TRGCDC2DFinderTracks"));
35 "Name of the 2D fitter track list.",
36 string(
"TRGCDC2DFitterTracks"));
38 "Name of the 3D fitter track list.",
39 string(
"TRGCDC3DFitterTracks"));
41 "Name of the neuro track list.",
42 string(
"TRGCDCNeuroTracks"));
44 "Name of the output track list for the combined tracks.",
45 string(
"TRGCDCTracks"));
47 "Name of track segment hit list, needed for hit relations.",
50 "Select how to define cot(theta). Valid options are "
51 "3Dfitter (use 3Dfitter if present, otherwise neuro), "
52 "neuro (use neuro if present, otherwise 3Dfitter) or "
53 "avg (average 3Dfitter and neuro).",
56 "Select how to define z0. Valid options are "
57 "3Dfitter (use 3Dfitter if present, otherwise neuro), "
58 "neuro (use neuro if present, otherwise 3Dfitter), "
59 "avg (average 3Dfitter and neuro), "
60 "min (smaller |z0| of 3Dfitter and neuro) or "
61 "max (larger |z0| of 3Dfitter and neuro).",
96 if (!track3Dfitter && !trackNeuro) {
97 B2DEBUG(100,
"skip track without 3D parameters");
102 CDCTriggerTrack* track2D = (track2Dfitter) ? track2Dfitter : track2Dfinder;
108 bool usedFit =
false;
111 if (!track3Dfitter) {
112 B2DEBUG(100,
"no 3D fitter results, use neuro results");
113 z = trackNeuro->getZ0();
114 cotTheta = trackNeuro->getCotTheta();
117 }
else if (!trackNeuro) {
118 B2DEBUG(100,
"no neuro results, use 3D fitter results");
119 z = track3Dfitter->getZ0();
120 cotTheta = track3Dfitter->getCotTheta();
121 chi3D = track3Dfitter->getCotTheta();
124 B2DEBUG(100,
"combine 3D fitter and neuro results");
127 z = track3Dfitter->getZ0();
130 z = trackNeuro->getZ0();
133 z = (track3Dfitter->getZ0() + trackNeuro->getZ0()) / 2.;
137 z = (abs(track3Dfitter->getZ0()) < abs(trackNeuro->getZ0()))
138 ? track3Dfitter->getZ0()
139 : trackNeuro->getZ0();
143 z = (abs(track3Dfitter->getZ0()) > abs(trackNeuro->getZ0()))
144 ? track3Dfitter->getZ0()
145 : trackNeuro->getZ0();
150 <<
" (choose one of 3Dfitter, neuro, avg, min, max)");
154 cotTheta = track3Dfitter->getCotTheta();
157 cotTheta = trackNeuro->getCotTheta();
160 cotTheta = (track3Dfitter->getCotTheta() + trackNeuro->getCotTheta()) / 2.;
165 <<
" (choose one of 3Dfitter, neuro, avg)");
168 chi3D = track3Dfitter->getChi3D();
175 track2Dfinder->addRelationTo(combinedTrack);
180 combinedTrack->addRelationTo(&hit);
181 usedHit[hit.getArrayIndex()] =
true;
186 if (!usedHit[hit.getArrayIndex()]) {
187 combinedTrack->addRelationTo(&hit);
188 usedHit[hit.getArrayIndex()] =
true;
192 if (track3Dfitter && usedFit) {
195 if (!usedHit[hit.getArrayIndex()]) {
196 combinedTrack->addRelationTo(&hit);
197 usedHit[hit.getArrayIndex()] =
true;
201 if (trackNeuro && usedNN) {
204 if (!usedHit[hit.getArrayIndex()]) {
205 combinedTrack->addRelationTo(&hit);
206 usedHit[hit.getArrayIndex()] =
true;
Combination of several CDCHits to a track segment hit for the trigger.
StoreArray< CDCTriggerTrack > m_tracks2Dfinder
list of 2D finder tracks (all others are obtained via relations)
std::string m_zDefinition
defines how to calculate z0 of the combined track
std::string m_thetaDefinition
defines how to calculate cot(theta) of the combined track
std::string m_3DfitterCollectionName
name of the 3D fitter track list
virtual void initialize() override
Initialize the module and register DataStore arrays.
virtual void event() override
Combine tracks.
StoreArray< CDCTriggerSegmentHit > m_segmentHits
list of track segment hits
std::string m_outputCollectionName
name of the output track list for the combined tracks
std::string m_neuroCollectionName
name of the neuro track list
CDCTriggerTrackCombinerModule()
Constructor, for setting module description and parameters.
std::string m_2DfinderCollectionName
name of the 2D finder track list
StoreArray< CDCTriggerTrack > m_tracksCombined
list of combined output tracks
std::string m_2DfitterCollectionName
name of the 2D fitter track list
std::string m_hitCollectionName
name of track segment hit list (for relations)
Track created by the CDC trigger.
float getChi3D() const
get chi2 value of 3D fitter
float getChi2D() const
get chi2 value of 2D fitter
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
T * appendNew()
Construct a new T object at the end of the array.
int getEntries() const
Get the number of objects in the array.
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.