Belle II Software development
TOPTrack Class Reference

Reconstructed track at TOP. More...

#include <TOPTrack.h>

Classes

struct  AssumedEmission
 assumed photon emission point in local frame More...
 
struct  SelectedHit
 selected photon hit from TOPDigits More...
 
struct  TrackAngles
 Sine and cosine of track polar and azimuthal angles at assumed photon emission. More...
 

Public Member Functions

 TOPTrack ()
 Default constructor.
 
 TOPTrack (const Track &track, const std::string &digitsName="", const Const::ChargedStable &chargedStable=Const::pion)
 Constructor from mdst track - isValid() must be checked before using the object.
 
 TOPTrack (const ExtHit *extHit, const std::string &digitsName="")
 Constructor from extrapolated track hit - isValid() must be checked before using the object.
 
bool overrideTransformation (const ROOT::Math::Transform3D &transform)
 Overrides transformation from local to nominal frame, which is by default obtained from DB.
 
void setTOFCorrection (const DBObjPtr< TOPCalTOFCorrection > &tofCorrections)
 Sets time-of-flight correction value.
 
bool isValid () const
 Checks if track is successfully constructed.
 
int getModuleID () const
 Returns slot ID.
 
double getMomentumMag () const
 Returns momentum magnitude (extrapolated to TOP)
 
double getTransverseMomentum () const
 Returns transverse momentum (at POCA)
 
double getCharge () const
 Returns charge.
 
double getTrackLength () const
 Returns track length from IP to the average position of photon emission within quartz.
 
double getLengthInQuartz () const
 Returns track length within quartz.
 
double getBeta (const Const::ChargedStable &particle, double overrideMass=0) const
 Returns particle beta.
 
const TOPTrack::AssumedEmission & getEmissionPoint (double dL=0) const
 Returns assumed photon emission position and track direction.
 
double getTOF (const Const::ChargedStable &particle, double dL=0, double overrideMass=0) const
 Returns time-of-flight from IP to photon emission position.
 
const TOP::HelixSwimmer & getHelix () const
 Returns helix Helix is given in nominal slot frame and with reference position at average photon emission.
 
const Track * getTrack () const
 Returns mdst track.
 
const ExtHit * getExtHit () const
 Returns extrapolated hit (track entrance to the bar)
 
const MCParticle * getMCParticle () const
 Returns MC particle assigned to this track (if any)
 
int getPDGCode () const
 Returns PDG code of associated MCParticle (returns 0 if none)
 
const TOPBarHit * getBarHit () const
 Returns bar hit of MC particle assigned to this track (if any)
 
const std::vector< SelectedHit > & getSelectedHits () const
 Returns selected photon hits from TOPDigits belonging to the slot ID.
 
double getBkgRate () const
 Returns estimated background hit rate.
 
bool isScanRequired (unsigned col, double time, double wid) const
 Checks if scan method of YScanner is needed to construct PDF for a given pixel column.
 

Private Member Functions

void set (const Track &track, const std::string &digitsName, const Const::ChargedStable &chargedStable)
 Sets the object (called by constructors)
 
bool setHelix (const ROOT::Math::Transform3D &transform)
 Sets helix (helix is given in nominal frame)
 
bool xsecPrism (std::vector< double > &lengths, std::vector< ROOT::Math::XYZPoint > &positions, const RaytracerBase::Prism &prism, const ROOT::Math::Transform3D &transform)
 Calculates intersection of trajectory with prism.
 

Private Attributes

int m_moduleID = 0
 slot ID
 
double m_momentum = 0
 track momentum magnitude at TOP
 
double m_pT = 0
 transverse momentum at POCA
 
double m_charge = 0
 track charge in units of elementary charge
 
double m_TOFLength = 0
 trajectory length corresponding to TOF of extrapolated hit
 
double m_TOFCorrection = 0
 time-of-flight correction
 
double m_trackLength = 0
 trajectory length from IP to average photon emission point
 
double m_length = 0
 trajectory length within quartz
 
TOP::HelixSwimmer m_helix
 trajectory helix in nominal slot frame
 
DBObjPtr< TOPCalModuleAlignment > m_alignment
 module alignment constants
 
DBObjPtr< TOPFrontEndSetting > m_feSetting
 front-end settings
 
const Track * m_track = 0
 mdst track
 
const ExtHit * m_extHit = 0
 extrapolated hit
 
const MCParticle * m_mcParticle = 0
 MC particle.
 
const TOPBarHit * m_barHit = 0
 bar hit
 
bool m_valid = false
 true for properly defined track
 
std::vector< SelectedHit > m_selectedHits
 selected photon hits from TOPDigits belonging to this slot ID
 
double m_bkgRate = 0
 estimated background hit rate
 
const TOPNominalTTS * m_tts = nullptr
 PMT independent TTS, used by isScanRequired.
 
std::unordered_multimap< unsigned, const SelectedHit * > m_columnHits
 selected hits mapped to pixel columns
 
std::map< double, TOPTrack::AssumedEmission > m_emissionPoints
 assumed emission points in module local frame, for dL != 0
 
TOPTrack::AssumedEmission m_emissionPoint0
 assumed emission point in module local frame, at dL = 0
 

Detailed Description

Reconstructed track at TOP.

Definition at line 41 of file TOPTrack.h.

Constructor & Destructor Documentation

◆ TOPTrack() [1/3]

TOPTrack ( )
inline

Default constructor.

Definition at line 104 of file TOPTrack.h.

105 {}

◆ TOPTrack() [2/3]

TOPTrack ( const Track & track,
const std::string & digitsName = "",
const Const::ChargedStable & chargedStable = Const::pion )
explicit

Constructor from mdst track - isValid() must be checked before using the object.

Parameters
trackmdst track
digitsNamename of TOPDigits collection
chargedStablehypothesis used in mdst track extrapolation

Definition at line 40 of file TOPTrack.cc.

41 {
42 // find extrapolated track hit at TOP
43
44 Const::EDetector myDetID = Const::EDetector::TOP;
45 const auto* geo = TOPGeometryPar::Instance()->getGeometry();
46 int numModules = geo->getNumModules();
47 int pdgCode = std::abs(chargedStable.getPDGCode());
48
49 RelationVector<ExtHit> extHits = track.getRelationsWith<ExtHit>();
50 double tmin = 1e10; // some large time
51 for (const auto& extHit : extHits) {
52 if (std::abs(extHit.getPdgCode()) != pdgCode) continue;
53 if (extHit.getDetectorID() != myDetID) continue;
54 if (extHit.getCopyID() < 1 or extHit.getCopyID() > numModules) continue;
55 if (extHit.getTOF() < tmin) {
56 tmin = extHit.getTOF();
57 m_extHit = &extHit;
58 }
59 }
60 if (not m_extHit) return;
61
62 // set the object
63
64 set(track, digitsName, chargedStable);
65 }

◆ TOPTrack() [3/3]

TOPTrack ( const ExtHit * extHit,
const std::string & digitsName = "" )
explicit

Constructor from extrapolated track hit - isValid() must be checked before using the object.

Parameters
extHitextrapolated track hit
digitsNamename of TOPDigits collection

Definition at line 68 of file TOPTrack.cc.

69 {
70 if (not extHit) return;
71 m_extHit = extHit;
72
73 const auto* track = extHit->getRelated<Track>();
74 if (not track) {
75 B2ERROR("TOPTrack: no related Track found for valid ExtHit");
76 return;
77 }
78
79 auto chargedStable = Const::chargedStableSet.find(std::abs(extHit->getPdgCode()));
80 if (chargedStable == Const::invalidParticle) {
81 B2ERROR("TOPTrack: extrapolation hypothesis of ExtHit is not ChargedStable");
82 return;
83 }
84
85 // set the object
86
87 set(*track, digitsName, chargedStable);
88 }

Member Function Documentation

◆ getBarHit()

const TOPBarHit * getBarHit ( ) const
inline

Returns bar hit of MC particle assigned to this track (if any)

Returns
bar hit or NULL pointer

Definition at line 246 of file TOPTrack.h.

246{return m_barHit;}

◆ getBeta()

double getBeta ( const Const::ChargedStable & particle,
double overrideMass = 0 ) const
inline

Returns particle beta.

Parameters
particleparticle mass hypothesis
overrideMassalternative mass value to be used to calculate beta. Ignored if <= 0.
Returns
particle beta

Definition at line 329 of file TOPTrack.h.

330 {
331 double mass = chargedStable.getMass();
332 if (overrideMass > 0)
333 mass = overrideMass;
334 return m_momentum / sqrt(m_momentum * m_momentum + mass * mass);
335 }
double sqrt(double a)
sqrt for double
Definition beamHelpers.h:28

◆ getBkgRate()

double getBkgRate ( ) const
inline

Returns estimated background hit rate.

Returns
background hit rate per module

Definition at line 258 of file TOPTrack.h.

258{return m_bkgRate;}

◆ getCharge()

double getCharge ( ) const
inline

Returns charge.

Returns
charge in units of elementary charge

Definition at line 169 of file TOPTrack.h.

169{return m_charge;}

◆ getEmissionPoint()

const TOPTrack::AssumedEmission & getEmissionPoint ( double dL = 0) const

Returns assumed photon emission position and track direction.

Parameters
dLlength difference to the average emission position
Returns
assumed photon emission position and track direction in local frame

Definition at line 359 of file TOPTrack.cc.

360 {
361 if (m_emissionPoints.size() > 1000) m_emissionPoints.clear(); // prevent blow-up
362
363 // dL = 0 is by far the most frequent argument, so it is kept out of the map
364 auto& emissionPoint = (dL == 0) ? m_emissionPoint0 : m_emissionPoints[dL];
365 if (not emissionPoint.isSet) {
366 emissionPoint.position = m_helix.getPosition(dL);
367 emissionPoint.trackAngles = TrackAngles(m_helix.getDirection(dL));
368 emissionPoint.isSet = true;
369 }
370 return emissionPoint;
371 }

◆ getExtHit()

const ExtHit * getExtHit ( ) const
inline

Returns extrapolated hit (track entrance to the bar)

Returns
extrapolated hit

Definition at line 224 of file TOPTrack.h.

224{return m_extHit;}

◆ getHelix()

const TOP::HelixSwimmer & getHelix ( ) const
inline

Returns helix Helix is given in nominal slot frame and with reference position at average photon emission.

Returns
helix

Definition at line 212 of file TOPTrack.h.

212{return m_helix;}

◆ getLengthInQuartz()

double getLengthInQuartz ( ) const
inline

Returns track length within quartz.

Returns
track length within quartz

Definition at line 181 of file TOPTrack.h.

181{return m_length;}

◆ getMCParticle()

const MCParticle * getMCParticle ( ) const
inline

Returns MC particle assigned to this track (if any)

Returns
MC particle or NULL pointer

Definition at line 230 of file TOPTrack.h.

230{return m_mcParticle;}

◆ getModuleID()

int getModuleID ( ) const
inline

Returns slot ID.

Returns
slot ID

Definition at line 151 of file TOPTrack.h.

151{return m_moduleID;}

◆ getMomentumMag()

double getMomentumMag ( ) const
inline

Returns momentum magnitude (extrapolated to TOP)

Returns
momentum magnitude

Definition at line 157 of file TOPTrack.h.

157{return m_momentum;}

◆ getPDGCode()

int getPDGCode ( ) const
inline

Returns PDG code of associated MCParticle (returns 0 if none)

Returns
PDG code or 0

Definition at line 236 of file TOPTrack.h.

237 {
238 if (m_mcParticle) return m_mcParticle->getPDG();
239 return 0;
240 }

◆ getSelectedHits()

const std::vector< SelectedHit > & getSelectedHits ( ) const
inline

Returns selected photon hits from TOPDigits belonging to the slot ID.

Returns
selected photon hits

Definition at line 252 of file TOPTrack.h.

252{return m_selectedHits;}

◆ getTOF()

double getTOF ( const Const::ChargedStable & particle,
double dL = 0,
double overrideMass = 0 ) const
inline

Returns time-of-flight from IP to photon emission position.

Parameters
particleparticle mass hypothesis
dLlength difference to the average emission position
overrideMassalternative mass value to be used to calculate beta. Ignored if <= 0.
Returns
time-of-flight

Definition at line 337 of file TOPTrack.h.

338 {
339 return (m_trackLength + dL) / getBeta(chargedStable, overrideMass) / Const::speedOfLight + m_TOFCorrection;
340 }

◆ getTrack()

const Track * getTrack ( ) const
inline

Returns mdst track.

Returns
mdst track

Definition at line 218 of file TOPTrack.h.

218{return m_track;}

◆ getTrackLength()

double getTrackLength ( ) const
inline

Returns track length from IP to the average position of photon emission within quartz.

Returns
track length from IP

Definition at line 175 of file TOPTrack.h.

175{return m_trackLength;}

◆ getTransverseMomentum()

double getTransverseMomentum ( ) const
inline

Returns transverse momentum (at POCA)

Returns
transverse momentum

Definition at line 163 of file TOPTrack.h.

163{return m_pT;}

◆ isScanRequired()

bool isScanRequired ( unsigned col,
double time,
double wid ) const

Checks if scan method of YScanner is needed to construct PDF for a given pixel column.

Parameters
colpixel column (0-based)
timePDF peak time
widPDF peak width squared
Returns
true if at least one of the detected photons is within the PDF peak convoluted with TTS.

Definition at line 373 of file TOPTrack.cc.

374 {
375 const auto& tts = *m_tts;
376 const auto& range = m_columnHits.equal_range(col);
377 for (auto it = range.first; it != range.second; ++it) {
378 const auto hit = it->second;
379 for (const auto& gaus : tts.getTTS()) {
380 double sigsq = wid + pow(gaus.sigma, 2) + pow(hit->timeErr, 2);
381 double x = pow(hit->time - time - gaus.position, 2) / sigsq;
382 if (x < 10) return true;
383 }
384 }
385
386 return false;
387 }

◆ isValid()

bool isValid ( ) const
inline

Checks if track is successfully constructed.

Returns
true if successful

Definition at line 145 of file TOPTrack.h.

145{return m_valid;}

◆ overrideTransformation()

bool overrideTransformation ( const ROOT::Math::Transform3D & transform)
inline

Overrides transformation from local to nominal frame, which is by default obtained from DB.

Needed for module alignment.

Parameters
transformtransformation from local to nominal frame
Returns
true if quartz bar intersection still exists

Definition at line 129 of file TOPTrack.h.

130 {
131 m_valid = setHelix(transform);
132 return m_valid;
133 }

◆ set()

void set ( const Track & track,
const std::string & digitsName,
const Const::ChargedStable & chargedStable )
private

Sets the object (called by constructors)

Parameters
trackmdst track
digitsNamename of TOPDigits collection
chargedStablehypothesis used in mdst track extrapolation

Definition at line 91 of file TOPTrack.cc.

92 {
93 // require fitResult
94
95 const auto* fitResult = track.getTrackFitResultWithClosestMass(chargedStable);
96 if (not fitResult) {
97 B2ERROR("TOPTrack: no TrackFitResult available for PDGCode = " << chargedStable.getPDGCode());
98 return;
99 }
100 m_pT = fitResult->getTransverseMomentum();
101
102 // require hits in CDC
103
104 if (fitResult->getHitPatternCDC().getNHits() == 0) return;
105
106 // set pointers
107
108 m_track = &track;
109 m_mcParticle = track.getRelated<MCParticle>();
110 if (m_mcParticle) {
111 const auto barHits = m_mcParticle->getRelationsWith<TOPBarHit>();
112 for (const auto& barHit : barHits) {
113 if (barHit.getModuleID() == m_extHit->getCopyID()) m_barHit = &barHit;
114 }
115 }
116
117 // set track parameters and helix
118
119 m_moduleID = m_extHit->getCopyID();
120 m_momentum = m_extHit->getMomentum().R();
121 m_charge = fitResult->getChargeSign();
122 m_TOFLength = m_extHit->getTOF() * Const::speedOfLight * getBeta(chargedStable);
123 m_valid = setHelix(m_alignment->getTransformation(m_moduleID));
124 if (not m_valid) return;
125
126 // selection of photon hits belonging to this track
127
128 unsigned numHitsOtherSlots = 0;
129 StoreArray<TOPDigit> digits(digitsName);
130 for (const auto& digit : digits) {
131 if (digit.getHitQuality() != TOPDigit::c_Good) continue;
132 if (digit.getModuleID() == m_moduleID) {
133 m_selectedHits.push_back(SelectedHit(digit.getPixelID(), digit.getTime(), digit.getTimeError()));
134 } else {
135 numHitsOtherSlots++;
136 }
137 }
138
139 // background rate estimation
140
141 const auto* geo = TOPGeometryPar::Instance()->getGeometry();
142 m_tts = &geo->getTTS(0); // PMT independent TTS should be fine in isScanRequired
143 const auto& tdc = geo->getNominalTDC();
144 double timeWindow = m_feSetting->getReadoutWindows() * tdc.getSyncTimeBase() / static_cast<double>(TOPNominalTDC::c_syncWindows);
145
146 const auto& backgroundPDFs = TOPRecoManager::getBackgroundPDFs();
147 unsigned k = m_moduleID - 1;
148 double effi = (k < backgroundPDFs.size()) ? backgroundPDFs[k].getEfficiency() : 0;
149 double effiSum = 0;
150 for (const auto& bkg : backgroundPDFs) effiSum += bkg.getEfficiency();
151 m_bkgRate = (effiSum > effi) ? numHitsOtherSlots * effi / (effiSum - effi) / timeWindow : 0;
152
153 // selected photon hits mapped to pixel columns
154
155 const auto* yScanner = TOPRecoManager::getYScanner(m_moduleID);
156 if (not yScanner) {
157 B2ERROR("TOPTrack: YScanner for given module not found (must be a bug!)" << LogVar("slot", m_moduleID));
158 m_valid = false;
159 return;
160 }
161 unsigned numCols = yScanner->getPixelPositions().getNumPixelColumns();
162 for (const auto& hit : m_selectedHits) {
163 unsigned col = (hit.pixelID - 1) % numCols;
164 m_columnHits.emplace(col, &hit);
165 }
166
167 m_valid = effi > 0; // no sense to provide PID for the track if the module is fully inefficient
168 }

◆ setHelix()

bool setHelix ( const ROOT::Math::Transform3D & transform)
private

Sets helix (helix is given in nominal frame)

Parameters
transformtransformation from local to nominal frame
Returns
true if quartz bar intersection exists

Definition at line 171 of file TOPTrack.cc.

172 {
173 m_emissionPoints.clear();
174 m_emissionPoint0.isSet = false;
175
176 // helix in module nominal frame (z-axis still parallel to magnetic field)
177
178 const auto* geo = TOPGeometryPar::Instance()->getGeometry();
179 const auto& module = geo->getModule(m_moduleID);
180 auto globalPosition = m_extHit->getPosition();
181 auto position = module.pointGlobalToNominal(static_cast<XYZPoint>(globalPosition));
182 auto momentum = module.momentumGlobalToNominal(m_extHit->getMomentum());
183 double Bz = BFieldManager::getField(globalPosition).Z();
184 m_helix.set(position, momentum, m_charge, Bz);
185 m_helix.setTransformation(transform);
186
187 // geometry data
188
189 const RaytracerBase::BarSegment bar(module);
190 const RaytracerBase::Mirror mirror(module);
191
192 // bar surfaces in module nominal frame
193
194 std::vector<XYZPoint> points;
195 std::vector<XYZVector> normals;
196 points.push_back(transform * XYZPoint(0, -bar.B / 2, 0)); // lower
197 normals.push_back(transform * XYZVector(0, -1, 0));
198
199 points.push_back(transform * XYZPoint(0, bar.B / 2, 0)); // upper
200 normals.push_back(transform * XYZVector(0, 1, 0));
201
202 points.push_back(transform * XYZPoint(-bar.A / 2, 0, 0)); // left side
203 normals.push_back(transform * XYZVector(-1, 0, 0));
204
205 points.push_back(transform * XYZPoint(bar.A / 2, 0, 0)); // right side
206 normals.push_back(transform * XYZVector(1, 0, 0));
207
208 // intersection with quartz bar
209
210 std::vector<double> lengths; // w.r.t extHit position
211 std::vector<XYZPoint> positions; // in module local frame
212 for (size_t i = 0; i < 2; i++) {
213 double t = m_helix.getDistanceToPlane(points[i], normals[i]);
214 if (isnan(t)) return false;
215 auto r = m_helix.getPosition(t);
216 if (std::abs(r.X()) > bar.A / 2) {
217 auto k = (r.X() > 0) ? 3 : 2;
218 t = m_helix.getDistanceToPlane(points[k], normals[k]);
219 if (isnan(t)) return false;
220 r = m_helix.getPosition(t);
221 if (r.Z() >= bar.zL and std::abs(r.Y()) > bar.B / 2) return false;
222 }
223 lengths.push_back(t);
224 positions.push_back(r);
225 }
226
227 // crossing prism?
228
229 if (positions[0].Z() < bar.zL or positions[1].Z() < bar.zL) {
230 const RaytracerBase::Prism prism(module);
231 bool ok = xsecPrism(lengths, positions, prism, transform);
232 if (not ok) return false;
233 }
234
235 // crossing mirror surface?
236
237 std::vector<bool> outOfBar;
238 XYZPoint rc(mirror.xc, mirror.yc, mirror.zc);
239 double Rsq = mirror.R * mirror.R;
240 for (const auto& r : positions) {
241 outOfBar.push_back((r - rc).Mag2() > Rsq);
242 }
243 if (outOfBar[0] and outOfBar[1]) return false;
244
245 if (outOfBar[0] or outOfBar[1]) { // track crosses mirror surface, where?
246 if (outOfBar[0]) std::reverse(lengths.begin(), lengths.end());
247 double t1 = lengths[0];
248 double t2 = lengths[1];
249 for (int i = 0; i < 20; i++) {
250 double t = (t1 + t2) / 2;
251 auto r = m_helix.getPosition(t);
252 if ((r - rc).Mag2() > Rsq) {
253 t2 = t;
254 } else {
255 t1 = t;
256 }
257 }
258 lengths[1] = (t1 + t2) / 2;
259 }
260
261 // set track length in quartz and full length from IP to the average emission point
262
263 m_length = std::abs(lengths[1] - lengths[0]);
264 double length = (lengths[0] + lengths[1]) / 2;
265 m_trackLength = m_TOFLength + length;
266
267 // finally move reference position to average emission point
268
269 m_helix.moveReferencePosition(length);
270
271 return m_length > bar.B / 2; // require minimal track length inside quartz (more than half of bar thickness)
272 }

◆ setTOFCorrection()

void setTOFCorrection ( const DBObjPtr< TOPCalTOFCorrection > & tofCorrections)

Sets time-of-flight correction value.

Parameters
tofCorrectionspayload with TOF corrections

Definition at line 389 of file TOPTrack.cc.

390 {
391 if (not m_valid) return;
392 if (not tofCorrections.isValid()) return;
393 if (not tofCorrections->isCalibrated()) return;
394
395 const auto* geo = TOPGeometryPar::Instance()->getGeometry();
396 const auto& topModule = geo->getModule(m_moduleID);
397 const auto globalPosition = m_extHit->getPosition();
398 const auto position = topModule.pointGlobalToNominal(static_cast<XYZPoint>(globalPosition));
399
400 m_TOFCorrection = tofCorrections->get(position.Z());
401 }

◆ xsecPrism()

bool xsecPrism ( std::vector< double > & lengths,
std::vector< ROOT::Math::XYZPoint > & positions,
const RaytracerBase::Prism & prism,
const ROOT::Math::Transform3D & transform )
private

Calculates intersection of trajectory with prism.

Parameters
lengthstrajectory lengths relative to extHit position of intersection points [in/out]
positionspositions of intersection points in module local frame [in/out]
prismprism geometry data
transformtransformation from local to nominal frame
Returns
true if intersection exists

Definition at line 275 of file TOPTrack.cc.

277 {
278 std::vector<XYZPoint> points;
279 std::vector<XYZVector> normals;
280
281 points.push_back(transform * XYZPoint(0, prism.yDown, 0)); // lower-most surface
282 normals.push_back(transform * XYZVector(0, -1, 0));
283
284 points.push_back(transform * XYZPoint(0, prism.yUp, 0)); // upper surface
285 normals.push_back(transform * XYZVector(0, 1, 0));
286
287 points.push_back(transform * XYZPoint(-prism.A / 2, 0, 0)); // left-side surface
288 normals.push_back(transform * XYZVector(-1, 0, 0));
289
290 points.push_back(transform * XYZPoint(prism.A / 2, 0, 0)); // right-side surface
291 normals.push_back(transform * XYZVector(1, 0, 0));
292
293 for (size_t i = 0; i < 2; i++) {
294 if (positions[i].Z() < prism.zR) {
295 double t = m_helix.getDistanceToPlane(points[i], normals[i]);
296 if (isnan(t)) return false;
297 auto r = m_helix.getPosition(t);
298 if (i == 0 and r.Z() > prism.zFlat) { // intersection with slanted surface -> find it using bisection
299 auto point = transform * XYZPoint(0, -prism.B / 2, 0);
300 double t1 = m_helix.getDistanceToPlane(point, normals[0]);
301 if (isnan(t1)) return false;
302 double t2 = t;
303 for (int iter = 0; iter < 20; iter++) {
304 t = (t1 + t2) / 2;
305 r = m_helix.getPosition(t);
306 double ySlanted = prism.yDown + prism.slope * (r.Z() - prism.zFlat);
307 if (r.Y() < ySlanted) t2 = t;
308 else t1 = t;
309 }
310 t = (t1 + t2) / 2;
311 }
312 if (std::abs(r.X()) > prism.A / 2) { // intersection on the side surface
313 auto k = (r.X() > 0) ? 3 : 2;
314 t = m_helix.getDistanceToPlane(points[k], normals[k]);
315 if (isnan(t)) return false;
316 r = m_helix.getPosition(t);
317 if (r.Z() < prism.zR) { // yes, it's on the prism side
318 if (r.Y() > prism.yUp or r.Y() < prism.yDown) return false;
319 double ySlanted = prism.yDown + prism.slope * (r.Z() - prism.zFlat);
320 if (r.Y() < ySlanted) return false;
321 } else { // no, it's on the prism entrance but outside the bar exit window -> find it using bisection
322 double t1 = lengths[i];
323 double t2 = t;
324 for (int iter = 0; iter < 20; iter++) {
325 t = (t1 + t2) / 2;
326 r = m_helix.getPosition(t);
327 if (r.Z() < prism.zR) t1 = t;
328 else t2 = t;
329 }
330 t = (t1 + t2) / 2;
331 }
332 }
333 lengths[i] = t;
334 positions[i] = m_helix.getPosition(t);
335 }
336 }
337
338 if (positions[0].Z() < prism.zL and positions[1].Z() < prism.zL) return false;
339
340 if (positions[0].Z() < prism.zL or positions[1].Z() < prism.zL) { // intersection is on exit window
341 int i0 = (positions[0].Z() < prism.zL) ? 0 : 1;
342 double t1 = lengths[i0];
343 double t2 = lengths[(i0 + 1) % 2];
344 for (int iter = 0; iter < 20; iter++) {
345 double t = (t1 + t2) / 2;
346 auto r = m_helix.getPosition(t);
347 if (r.Z() < prism.zL) t1 = t;
348 else t2 = t;
349 }
350 double t = (t1 + t2) / 2;
351 lengths[i0] = t;
352 positions[i0] = m_helix.getPosition(t);
353 }
354
355 return true;
356 }

Member Data Documentation

◆ m_alignment

DBObjPtr<TOPCalModuleAlignment> m_alignment
private

module alignment constants

Definition at line 306 of file TOPTrack.h.

◆ m_barHit

const TOPBarHit* m_barHit = 0
private

bar hit

Definition at line 312 of file TOPTrack.h.

◆ m_bkgRate

double m_bkgRate = 0
private

estimated background hit rate

Definition at line 316 of file TOPTrack.h.

◆ m_charge

double m_charge = 0
private

track charge in units of elementary charge

Definition at line 300 of file TOPTrack.h.

◆ m_columnHits

std::unordered_multimap<unsigned, const SelectedHit*> m_columnHits
private

selected hits mapped to pixel columns

Definition at line 318 of file TOPTrack.h.

◆ m_emissionPoint0

TOPTrack::AssumedEmission m_emissionPoint0
mutableprivate

assumed emission point in module local frame, at dL = 0

Definition at line 324 of file TOPTrack.h.

◆ m_emissionPoints

std::map<double, TOPTrack::AssumedEmission> m_emissionPoints
mutableprivate

assumed emission points in module local frame, for dL != 0

Definition at line 321 of file TOPTrack.h.

◆ m_extHit

const ExtHit* m_extHit = 0
private

extrapolated hit

Definition at line 310 of file TOPTrack.h.

◆ m_feSetting

DBObjPtr<TOPFrontEndSetting> m_feSetting
private

front-end settings

Definition at line 307 of file TOPTrack.h.

◆ m_helix

TOP::HelixSwimmer m_helix
private

trajectory helix in nominal slot frame

Definition at line 305 of file TOPTrack.h.

◆ m_length

double m_length = 0
private

trajectory length within quartz

Definition at line 304 of file TOPTrack.h.

◆ m_mcParticle

const MCParticle* m_mcParticle = 0
private

MC particle.

Definition at line 311 of file TOPTrack.h.

◆ m_moduleID

int m_moduleID = 0
private

slot ID

Definition at line 297 of file TOPTrack.h.

◆ m_momentum

double m_momentum = 0
private

track momentum magnitude at TOP

Definition at line 298 of file TOPTrack.h.

◆ m_pT

double m_pT = 0
private

transverse momentum at POCA

Definition at line 299 of file TOPTrack.h.

◆ m_selectedHits

std::vector<SelectedHit> m_selectedHits
private

selected photon hits from TOPDigits belonging to this slot ID

Definition at line 315 of file TOPTrack.h.

◆ m_TOFCorrection

double m_TOFCorrection = 0
private

time-of-flight correction

Definition at line 302 of file TOPTrack.h.

◆ m_TOFLength

double m_TOFLength = 0
private

trajectory length corresponding to TOF of extrapolated hit

Definition at line 301 of file TOPTrack.h.

◆ m_track

const Track* m_track = 0
private

mdst track

Definition at line 309 of file TOPTrack.h.

◆ m_trackLength

double m_trackLength = 0
private

trajectory length from IP to average photon emission point

Definition at line 303 of file TOPTrack.h.

◆ m_tts

const TOPNominalTTS* m_tts = nullptr
private

PMT independent TTS, used by isScanRequired.

Definition at line 317 of file TOPTrack.h.

◆ m_valid

bool m_valid = false
private

true for properly defined track

Definition at line 313 of file TOPTrack.h.


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