LDMX Software
EcalHelper.h File Reference

Class that propagates tracks to the ECAL face. More...

#include "Tracking/Event/Track.h"
#include <cmath>
#include "Math/Vector3D.h"

Go to the source code of this file.

Functions

std::vector< float > ecal::trackProp (const ldmx::Tracks &tracks, ldmx::TrackStateType ts_type, const std::string &ts_title)
 Return a vector of parameters for a propagated recoil track.
 
float ecal::distTwoLines (ROOT::Math::XYZVector v1, ROOT::Math::XYZVector v2, ROOT::Math::XYZVector w1, ROOT::Math::XYZVector w2)
 Returns the distance between the lines v and w, with v defined to pass through the points (v1,v2) (and similarly for w).
 
float ecal::distPtToLine (ROOT::Math::XYZVector h1, ROOT::Math::XYZVector p1, ROOT::Math::XYZVector p2)
 Return the minimum distance between the point h1 and the line passing through points p1 and p2.
 

Detailed Description

Class that propagates tracks to the ECAL face.

Author
Tamas Vami, Jihoon Yoo (UCSB)

Definition in file EcalHelper.h.

Function Documentation

◆ distPtToLine()

float ecal::distPtToLine ( ROOT::Math::XYZVector h1,
ROOT::Math::XYZVector p1,
ROOT::Math::XYZVector p2 )

Return the minimum distance between the point h1 and the line passing through points p1 and p2.

Parameters
[in]h1Point to find the distance to
[in]p1An arbitrary point on the line
[in]p2A second, distinct point on the line
Returns
Minimum distance between h1 and the line

Definition at line 81 of file EcalHelper.cxx.

82 {
83 return ((h1 - p1).Cross(h1 - p2)).R() / (p1 - p2).R();
84}

References ecal::distPtToLine().

Referenced by ecal::distPtToLine(), and ecal::EcalMipTrackingProcessor::produce().

◆ distTwoLines()

float ecal::distTwoLines ( ROOT::Math::XYZVector v1,
ROOT::Math::XYZVector v2,
ROOT::Math::XYZVector w1,
ROOT::Math::XYZVector w2 )

Returns the distance between the lines v and w, with v defined to pass through the points (v1,v2) (and similarly for w).

Parameters
[in]v1An arbitrary point on line v
[in]v2A second, distinct point on line v
[in]w1An arbitrary point on line w
[in]w2A second, distinct point on line w
Returns
Closest distance of approach of lines u and v

Definition at line 68 of file EcalHelper.cxx.

69 {
70 ROOT::Math::XYZVector e1 = v1 - v2;
71 ROOT::Math::XYZVector e2 = w1 - w2;
72 ROOT::Math::XYZVector crs = e1.Cross(e2);
73 if (crs.R() == 0) {
74 return 100.0; // arbitrary large number; edge case that shouldn't cause
75 // problems.
76 } else {
77 return std::abs(crs.Dot(v1 - w1) / crs.R());
78 }
79}

References ecal::distTwoLines().

Referenced by ecal::distTwoLines(), and ecal::EcalMipTrackingProcessor::produce().

◆ trackProp()

std::vector< float > ecal::trackProp ( const ldmx::Tracks & tracks,
ldmx::TrackStateType ts_type,
const std::string & ts_title )

Return a vector of parameters for a propagated recoil track.

Parameters
[in]tracksThe track collection
[in]ts_typeThe track state type, i.e. tracks state at the ECAL face
[in]ts_titleThe track state title, most likely "ecal"
Returns
Vector of parameters for a propagated recoil track

Definition at line 5 of file EcalHelper.cxx.

7 {
8 // Vector to hold the new track state variables
9 std::vector<float> new_track_states;
10
11 // Return if no tracks
12 if (tracks.empty()) return new_track_states;
13
14 // Otherwise loop on the tracks
15 for (auto &track : tracks) {
16 // Get track state for ts_type
17 auto trk_ts = track.getTrackState(ts_type);
18 // Continue if there's no value
19 if (!trk_ts.has_value()) continue;
20 ldmx::Track::TrackState &ecal_track_state = trk_ts.value();
21
22 // Check that the track state is filled
23 if (ecal_track_state.params_.size() < 5) continue;
24
25 float track_state_loc0 = static_cast<float>(ecal_track_state.params_[0]);
26 float track_state_loc1 = static_cast<float>(ecal_track_state.params_[1]);
27 // param 2 = phi (azimuthal), param 3 = theta (polar)
28 // param 4 = QoP
29 // ACTS (local) to LDMX (global) coordinates: (y_,z_,x_)-> (x_,y_,z_)
30 // convert qop [1/GeV] to p [MeV]
31 float p_track_state = (-1 / ecal_track_state.params_[4]) * 1000;
32 // p * sin(theta) * sin(phi)
33 float recoil_mom_x = p_track_state * sin(ecal_track_state.params_[3]) *
34 sin(ecal_track_state.params_[2]);
35 // p * cos(theta)
36 float recoil_mom_y = p_track_state * cos(ecal_track_state.params_[3]);
37 // p * sin(theta) * cos(phi)
38 float recoil_mom_z = p_track_state * sin(ecal_track_state.params_[3]) *
39 cos(ecal_track_state.params_[2]);
40
41 // Store the new track state variables
42 new_track_states.push_back(track_state_loc0);
43 new_track_states.push_back(track_state_loc1);
44 // z_-position at the ECAL (4) or Target (1)
45 if (ts_type == 4) {
46 // this should match `ECAL_SCORING_PLANE` in CKFProcessor
47 new_track_states.push_back(240.5);
48 } else if (ts_type == 1) {
49 // This should match `target_surface` in CKFProcessor
50 new_track_states.push_back(0.0);
51 }
52
53 new_track_states.push_back(recoil_mom_x);
54 new_track_states.push_back(recoil_mom_y);
55 new_track_states.push_back(recoil_mom_z);
56
57 // Break after getting the first valid track state
58 // TODO: interface this with CLUE to make sure the propageted track
59 // has an associated cluster in the ECAL
60 break;
61 }
62
63 return new_track_states;
64}

References ecal::trackProp().

Referenced by ecal::EcalPnetVetoProcessor::produce(), ecal::EcalVetoProcessor::produce(), and ecal::trackProp().