# How to Get track trajectories in Heed+ or ViewDrift

**URL:** <https://root-forum.cern.ch/t/how-to-get-track-trajectories-in-heed-or-viewdrift/50755>\
**Category:** Garfield++\
**Created:** [July 11, 2022, 3:41am UTC](https://root-forum.cern.ch/t/how-to-get-track-trajectories-in-heed-or-viewdrift/50755 "2022-07-11T03:41:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [July 11, 2022, 3:41am UTC](https://root-forum.cern.ch/t/how-to-get-track-trajectories-in-heed-or-viewdrift/50755/1 "2022-07-11T03:41:26Z")

</div>

Dear experts

I want to calculate the **Distance of Closest Approach** between track and sense wire, so the trajectory of track is needed in the magnetic field. I found in the source code of **ViewDrift** there is a container of tracks: **m\_tracks** , but I didn’t find a function to get track points of curvatures. Is there a way to get that?

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [July 11, 2022, 6:58am UTC](https://root-forum.cern.ch/t/how-to-get-track-trajectories-in-heed-or-viewdrift/50755/2 "2022-07-11T06:58:25Z")

</div>

I’m sure @hschindl can help you

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [July 11, 2022, 7:27am UTC](https://root-forum.cern.ch/t/how-to-get-track-trajectories-in-heed-or-viewdrift/50755/3 "2022-07-11T07:27:22Z")

</div>

I added a function in source code to get points in `m_tracks`, but seems no matter I change max range of step length the number of points doesn’t change.  
Here is 1 GeV muon in 1T magnetic field trajectory, I didn’t draw wires but there is electric field also.

 ![截屏2022-07-11 16.25.59](https://root-forum.cern.ch/uploads/default/original/3X/6/7/678c5fa21b18c0520133c8b45a991857c646acb0.jpeg)

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [July 11, 2022, 7:41am UTC](https://root-forum.cern.ch/t/how-to-get-track-trajectories-in-heed-or-viewdrift/50755/4 "2022-07-11T07:41:39Z")

</div>

The points in `m_tracks` are just the coordinates of the clusters along the track (I’m afraid the parameterisations of the track segments are not stored). So what you observe is correct (the number of clusters per track length does not depend on the magnetic field and the step length).

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [July 11, 2022, 8:03am UTC](https://root-forum.cern.ch/t/how-to-get-track-trajectories-in-heed-or-viewdrift/50755/5 "2022-07-11T08:03:00Z")

</div>

Oh, that’s sad…Can you please tell me where the track trajectory parameters are calculated/obtained? So that I can add a function to save those.  
I saw the `ViewDrift.Plot()` is using `m_tracks` to draw the trajectory though…

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [July 11, 2022, 11:48am UTC](https://root-forum.cern.ch/t/how-to-get-track-trajectories-in-heed-or-viewdrift/50755/6 "2022-07-11T11:48:40Z")

</div>

> [@Crisps](#):
>
> Can you please tell me where the track trajectory parameters are calculated/obtained?

It’s done internally in Heed. I’ll need to check where exactly, but fear it won’t be straightforward to retrieve these parameters.

> [@Crisps](#):
>
> I saw the `ViewDrift.Plot()` is using `m_tracks` to draw the trajectory though…

Yes, as I said, these are the positions of the clusters along the track.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [July 25, 2022, 11:49am UTC](https://root-forum.cern.ch/t/how-to-get-track-trajectories-in-heed-or-viewdrift/50755/7 "2022-07-25T11:49:20Z")

</div>

Closed on July 25, 2022, 11:49am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
