8#ifndef CDCTRIGGER3DFITTERModule_H
9#define CDCTRIGGER3DFITTERModule_H
11#include "framework/core/Module.h"
12#include <framework/datastore/StoreArray.h>
13#include <framework/datastore/StoreObjPtr.h>
14#include <trg/cdc/dataobjects/CDCTriggerSegmentHit.h>
15#include <trg/cdc/dataobjects/CDCTriggerTrack.h>
16#include <framework/dataobjects/BinnedEventT0.h>
38 virtual void event()
override;
44 std::vector<std::vector<CDCHit*>>
preselector(
double phi0,
double omega);
47 std::vector<std::vector<double>>
sConverter(
const std::vector<std::vector<CDCHit*>>& preselectedHits,
double omega);
50 std::vector<std::vector<double>>
zConverter(
const std::vector<std::vector<CDCHit*>>& preselectedHits,
double phi0,
double omega);
55 const int nCellZ0 = 16;
56 const int nCellCot = 16;
57 const double minZ0 = -50;
58 const double maxZ0 = 78;
59 const double minCot = -0.8;
60 const double maxCot = 1.5;
61 const double cellWidthZ0 = (maxZ0 - minZ0) / nCellZ0;
62 const double cellWidthCot = (maxCot - minCot) / nCellCot;
65 std::vector<std::vector<int>> votingCell;
67 inline int digitizeZ0(
double z0) {
return floor((maxZ0 - z0) / cellWidthZ0);}
68 inline int digitizeCot(
double cot) {
return floor((cot - minCot) / cellWidthCot);}
70 inline double getZ0CellValue(
double iZ0) {
return maxZ0 - (iZ0 + 0.5) * cellWidthZ0;}
71 inline double getCotCellValue(
double iCot) {
return minCot + (iCot + 0.5) * cellWidthCot;}
75 void vote(
const std::vector<std::vector<double>>& sCand,
const std::vector<std::vector<double>>& zCand);
76 std::tuple<double, double, int> findPeak();
80 std::pair<std::vector<double>, std::vector<double>>
selector(
const std::vector<std::vector<double>>& sCand,
81 const std::vector<std::vector<double>>& zCand,
double z0,
double cot);
84 std::pair<double, double>
fitter(
const std::vector<double>& s,
const std::vector<double>& z);
96 double calPhiCross(
double r,
double phi0,
double omega);
136 const int m_maxDriftTime = 512;
137 static const int m_nStereoLayer = 20;
138 const int m_nCellInTS = 11;
139 const int m_nLayerInSuperLayer = 5;
140 const double m_maxZSelection = 25;
144 std::vector<int> m_nWire;
145 std::vector<double> m_rWire;
146 std::vector<std::vector<double>> m_phiBW;
147 std::vector<double> m_zBW;
148 std::vector<double> m_stereoAngle;
149 std::map<std::pair<int, int>,
int> m_cellIDInTS = {
150 {std::make_pair(-2, -1), 0},
151 {std::make_pair(-2, 0), 1},
152 {std::make_pair(-2, 1), 2},
153 {std::make_pair(-1, -1), 3},
154 {std::make_pair(-1, 0), 4},
155 {std::make_pair(0, 0), 5},
156 {std::make_pair(1, -1), 6},
157 {std::make_pair(1, 0), 7},
158 {std::make_pair(2, -1), 8},
159 {std::make_pair(2, 0), 9},
160 {std::make_pair(2, 1), 10}
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Class for the Hough voter.
Module for the 3D Fitter of the CDC trigger.
std::string m_EventTimeName
name of the event time StoreObjPtr
std::pair< double, double > fitter(const std::vector< double > &s, const std::vector< double > &z)
Performance linear fitting with the selected s and z.
StoreArray< CDCTriggerTrack > m_tracks2D
list of 2D input tracks
std::vector< std::vector< double > > m_xtCurve
CDC geometry constants.
std::vector< std::vector< CDCHit * > > preselector(double phi0, double omega)
Select 10 wires which crosses with the given 2D track.
std::string m_CDCHitCollectionName
Name of the StoreArray containing the input CDChits.
virtual void initialize() override
Initialize the module and register DataStore arrays.
CDCTrigger3DFitterModule()
Constructor, for setting module description and parameters.
virtual void event() override
Run the 3D fitter for an event.
std::string m_outputCollectionName
Name of the StoreArray containing the resulting 3D tracks.
std::vector< std::vector< double > > zConverter(const std::vector< std::vector< CDCHit * > > &preselectedHits, double phi0, double omega)
Calculate z at the hit position.
StoreArray< CDCTriggerSegmentHit > m_TSHits
list of track segment hits
double getDriftLength(const CDCHit hit)
Get drift length.
double calPhiCross(double r, double phi0, double omega)
Calculate phi coordinate of the crossing point of the given radius and the given 2D track.
std::string m_inputCollectionName
Name of the StoreArray containing the input tracks from the 2D fitter.
double normalizeAngle(double angle)
Convert the given angle(rad) to the range [-pi, pi].
int getIStereoLayer(int iContinuousLayer)
Convert continuous layer ID (0–55) -> stereo layer ID (0–19).
std::string m_TSHitCollectionName
Name of the StoreArray containing the input track segment hits.
StoreArray< CDCTriggerTrack > m_tracks3D
list of 3D output tracks
std::vector< int > select5Cells(const CDCTriggerSegmentHit *TS)
1 cell is selected in each layer to reduce LUT comsumption.
int m_minVoteCount
Minimal number of votes in Hough voting.
StoreObjPtr< BinnedEventT0 > m_eventTime
StoreObjPtr containing the event time.
std::vector< std::vector< double > > sConverter(const std::vector< std::vector< CDCHit * > > &preselectedHits, double omega)
Calculate s(arc length of the 2D track) at the hit position.
std::pair< std::vector< double >, std::vector< double > > selector(const std::vector< std::vector< double > > &sCand, const std::vector< std::vector< double > > &zCand, double z0, double cot)
Select the nearest hits from the voter result.
std::vector< int > getIWireBegin(double phi0, double omega)
Get the beginning wire ID of the preselection range(10 wires) for each layer.
Combination of several CDCHits to a track segment hit for the trigger.
Accessor to arrays stored in the data store.
Type-safe access to single objects in the data store.
Abstract base class for different kinds of events.