Main function of the segment finding by the cellular automaton.
73{
76
78
79 const std::map<ITrackType, std::vector<CDCHitVector>>& mcSegmentsByMCParticleIdx =
81
82 std::size_t nSegments = 0;
83 for (const std::pair<ITrackType, std::vector<CDCHitVector>> mcSegmentsAndMCParticleIdx : mcSegmentsByMCParticleIdx) {
84 const std::vector<CDCHitVector>& mcSegments = mcSegmentsAndMCParticleIdx.second;
85 nSegments += mcSegments.size();
86 }
87
88 outputSegments.reserve(outputSegments.size() + nSegments);
89 for (const std::pair<ITrackType, std::vector<CDCHitVector>> mcSegmentsAndMCParticleIdx : mcSegmentsByMCParticleIdx) {
90
91 const std::vector<CDCHitVector>& mcSegments = mcSegmentsAndMCParticleIdx.second;
92 for (const CDCHitVector& mcSegment : mcSegments) {
93 outputSegments.push_back(CDCSegment2D());
94 CDCSegment2D& segment2D = outputSegments.back();
95 for (const CDCHit* ptrHit : mcSegment) {
96 const CDCWireHit* wireHit = simHitLookUp.
getWireHit(ptrHit, inputWireHits);
97 if (not wireHit) continue;
98
100 segment2D.push_back(recoHit2D);
101 }
102 if (segment2D.size() < 3) outputSegments.pop_back();
103 }
104 }
105
106 CDC::RealisticTDCCountTranslator tdcCountTranslator;
107 for (CDCSegment2D& segment : outputSegments) {
108 for (CDCRecoHit2D& recoHit2D : segment) {
110 ROOT::Math::XYVector recoPos2D = recoHit2D.
getRecoPos2D();
111 double alpha = ROOT::Math::VectorUtil::DeltaPhi(recoPos2D, flightDirection);
112
113 const CDCWire& wire = recoHit2D.
getWire();
115 const bool rl = recoHit2D.
getRLInfo() == ERightLeft::c_Right;
116
119
120
121 const double beta = 1;
122 double flightTimeEstimate = 0;
124
125 driftLength =
128 flightTimeEstimate,
129 rl,
131 alpha);
132 } else {
133
136 rl,
138 alpha);
139
140 driftLength += gRandom->Gaus(0, std::sqrt(driftLengthVariance));
141 }
142 bool snapRecoPos = true;
144 }
145 }
146
148 for (CDCSegment2D& segment : outputSegments) {
149 if (segment.size() > 1) {
150 CDCRLWireHitSegment rlWireHitSegment = segment.getRLWireHitSegment();
152 }
153 }
154 }
155
156 for (CDCSegment2D& segment : outputSegments) {
157 segment.receiveISuperCluster();
158 }
159 std::sort(outputSegments.begin(), outputSegments.end());
160}
short getTDCCount() const
Getter for TDC count.
const WireID & getWireID() const
Getter for the wire id.
double getRefZ() const
Getter for the wire reference z coordinate Gives the wire's reference z coordinate.
double getDriftLength(unsigned short tdcCount, const WireID &wireID=WireID(), double timeOfFlightEstimator=0, bool leftRight=false, double z=0, double alpha=0, double theta=static_cast< double >(TMath::Pi()/2.), unsigned short adcCount=0) override
Get Drift length.
double getDriftLengthResolution(double driftLength, const WireID &wireID=WireID(), bool leftRight=false, double z=0, double alpha=0, double=static_cast< double >(TMath::Pi()/2.)) override
Get position resolution^2 corresponding to the drift length from getDriftLength of this class.
static const CDCMCTrackStore & getInstance()
Getter for the singletone instance.
std::vector< const CDCHit * > CDCHitVector
Type for an ordered sequence of pointers to the CDCHit.
const std::map< ITrackType, std::vector< Belle2::TrackFindingCDC::CDCMCTrackStore::CDCHitVector > > & getMCSegmentsByMCParticleIdx() const
Getter for the stored Monte Carlo segments ordered by their Monte Carlo Id.
static const CDCSimHitLookUp & getInstance()
Getter for the singletone instance.
TrackingUtilities::CDCRecoHit2D getClosestPrimaryRecoHit2D(const CDCHit *ptrHit, const std::vector< TrackingUtilities::CDCWireHit > &wireHits) const
Construct an TrackingUtilities::CDCRecoHit2D from the closest primary CDCSimHit information related t...
const TrackingUtilities::CDCWireHit * getWireHit(const CDCHit *ptrHit, const std::vector< TrackingUtilities::CDCWireHit > &wireHits) const
Retrieve the wire hit the given CDCHit form the given wire hits.
static const FlightTimeEstimator & instance(std::unique_ptr< FlightTimeEstimator > replacement=nullptr)
Getter for the instance.
virtual double getFlightTime2D(const ROOT::Math::XYVector &, double, double=1) const
Default estimator for the flight time.
bool m_param_reconstructedDriftLength
Parameter : Setup the drift length as it can be estimated from two dimensional information.
bool m_param_reconstructedPositions
Parameter : Switch to reconstruct the positions in the segments imitating the facet ca picking up all...
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the reconstructed hit.
void setRefDriftLength(double driftLength, bool snapRecoPos)
Setter for the drift length at the wire reference position.
double getRefDriftLength() const
Getter for the drift length at the wire reference position.
ROOT::Math::XYVector getFlightDirection2D() const
Getter for the direction of flight.
ROOT::Math::XYVector getRecoPos2D() const
Getter for the position in the reference plane.
const CDC::CDCWire & getWire() const
Getter for the wire the reconstructed hit associated to.
ERightLeft getRLInfo() const
Getter for the right left passage information.
static CDCSegment2D reconstructUsingFacets(const CDCRLWireHitSegment &rlWireHitSegment)
Reconstruct from wire hits with attached right left passage hypotheses by constructing facets between...
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.