Anp::FillTrackGeom Class Reference

#include <FillTrackGeom.h>

Inheritance diagram for Anp::FillTrackGeom:
Anp::AlgSnarl Anp::Base

List of all members.

Public Member Functions

 FillTrackGeom ()
virtual ~FillTrackGeom ()
bool Run (Record &record)

Private Member Functions

void Fill (Track &track) const

Detailed Description

Definition at line 13 of file FillTrackGeom.h.


Constructor & Destructor Documentation

Anp::FillTrackGeom::FillTrackGeom (  ) 

Definition at line 20 of file FillTrackGeom.cxx.

00021 {
00022 }

Anp::FillTrackGeom::~FillTrackGeom (  )  [virtual]

Definition at line 25 of file FillTrackGeom.cxx.

00026 {
00027 }


Member Function Documentation

void Anp::FillTrackGeom::Fill ( Track track  )  const [private]

Definition at line 41 of file FillTrackGeom.cxx.

References Anp::Track::Add(), Anp::angle(), Anp::Vertex::CosX(), Anp::Vertex::CosY(), Anp::Vertex::CosZ(), Anp::Track::ErrorQP(), Anp::Track::GetBegVtx(), Anp::Track::GetEndVtx(), Anp::Track::KeyExists(), Anp::Track::Pass(), Anp::Track::QP(), Anp::Vertex::X(), Anp::Vertex::Y(), and Anp::Vertex::Z().

Referenced by Run().

00042 {
00043    const double x_vtx = track.GetBegVtx().X();
00044    const double y_vtx = track.GetBegVtx().Y();
00045    const double z_vtx = track.GetBegVtx().Z();
00046 
00047    const double x_end = track.GetEndVtx().X();
00048    const double y_end = track.GetEndVtx().Y();
00049    const double z_end = track.GetEndVtx().Z();
00050    
00051    const double cosx_vtx = track.GetBegVtx().CosX();
00052    const double cosy_vtx = track.GetBegVtx().CosY();
00053 
00055    // transform all x,y coordinates into the new coordinates
00057    const double xy_angle_vtx = Anp::angle(x_vtx, y_vtx);
00058 
00059    const double rot_x_vtx =  x_vtx * std::cos(xy_angle_vtx) + y_vtx * std::sin(xy_angle_vtx);
00060    const double rot_y_vtx = -x_vtx * std::sin(xy_angle_vtx) + y_vtx * std::cos(xy_angle_vtx);
00061 
00062    const double rot_x_end =  x_end * std::cos(xy_angle_vtx) + y_end * std::sin(xy_angle_vtx);
00063    const double rot_y_end = -x_end * std::sin(xy_angle_vtx) + y_end * std::cos(xy_angle_vtx);
00064 
00065    const double x_rel = rot_x_end - rot_x_vtx;
00066    const double y_rel = rot_y_end - rot_y_vtx;
00067    const double z_rel = z_end - z_vtx;
00068 
00070    // determine angles of track's end relative to vtx 
00071    // in new coordinates - xy plane
00073    
00074    if(!track.KeyExists(104))
00075    {
00076       track.Add(104, Anp::angle(x_rel, y_rel));
00077    }
00078 
00080    // difference between hit and projected straight line from vtx
00082 
00083    if(track.GetBegVtx().CosZ() > 0.0)
00084    {
00085       const double t_end = z_rel/track.GetBegVtx().CosZ();
00086       
00087       const double x_proj = cosx_vtx * t_end + x_vtx;
00088       const double y_proj = cosy_vtx * t_end + y_vtx;
00089 
00090       const double x_proj_rot =  x_proj * std::cos(xy_angle_vtx) + y_proj * std::sin(xy_angle_vtx);
00091       const double y_proj_rot = -x_proj * std::sin(xy_angle_vtx) + y_proj * std::cos(xy_angle_vtx);
00092 
00093       const double x_proj_diff = rot_x_end - x_proj_rot;
00094       const double y_proj_diff = rot_y_end - y_proj_rot;
00095 
00096       const double proj_xy_angle = Anp::angle(x_proj_diff, y_proj_diff);
00097       
00098       const double proj_distance = std::sqrt(x_proj_diff*x_proj_diff + y_proj_diff*y_proj_diff);
00099 
00100       if(!track.KeyExists(108))
00101       {      
00102          track.Add(108, proj_xy_angle);
00103       }
00104       if(!track.KeyExists(109))
00105       {
00106          track.Add(109, x_proj_diff);
00107       }
00108       if(!track.KeyExists(110))
00109       {
00110          track.Add(110, y_proj_diff);
00111       }
00112       if(!track.KeyExists(111))
00113       {
00114          track.Add(111, proj_distance);
00115       }
00116    }
00117 
00118    //
00119    // Add standard track variables for convienience
00120    //
00121    if(track.Pass() && track.ErrorQP() > 0.0)
00122    {
00123       if(!track.KeyExists(120)) track.Add(120, track.ErrorQP());
00124       if(!track.KeyExists(121)) track.Add(121, track.QP());
00125       if(!track.KeyExists(122)) track.Add(122, track.QP()/track.ErrorQP());
00126    }
00127 }

bool Anp::FillTrackGeom::Run ( Record record  )  [virtual]

Implements Anp::AlgSnarl.

Definition at line 30 of file FillTrackGeom.cxx.

References Fill(), it, Anp::Record::TrackBegIterator(), and Anp::Record::TrackEndIterator().

00031 {
00032    for(TrackIterator it = record.TrackBegIterator(); it != record.TrackEndIterator(); ++it)
00033    {
00034       Fill(*it);
00035    }
00036 
00037    return true;
00038 }


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

Generated on 11 Jan 2018 for loon by  doxygen 1.6.1