Belle II Software  release-05-01-25
TRGGRLMatch.cc
1 //-----------------------------------------------------------------------------
2 // $Id$
3 //-----------------------------------------------------------------------------
4 // Filename : TRGGRLMatch.cc
5 // Section : TRG GRL
6 // Owner : Yoshihito Iwasaki
7 // Email : yoshihito.iwasaki@kek.jp
8 //-----------------------------------------------------------------------------
9 // Description : A class to represent a track helix parameter in Belle style
10 //-----------------------------------------------------------------------------
11 // $Log$
12 //-----------------------------------------------------------------------------
13 
14 #include "trg/trg/Signal.h"
15 #include "trg/cdc/Track.h"
16 #include "trg/cdc/Helix.h"
17 #include "trg/ecl/dataobjects/TRGECLCluster.h"
18 #include "trg/grl/TRGGRLMatch.h"
19 #include <math.h>
20 
21 using namespace std;
22 
23 namespace Belle2 {
30  TRGGRLMatch::TRGGRLMatch(TRGCDCTrack* track, TRGECLCluster* cluster, int flag)
31  : _track(track),
32  _cluster(cluster),
33  _match3D(flag)
34  {
35  calculate();
36  }
37 
39  {
40  }
41 
42  void
44  {
45 
46  //-- track/TRGCDC information
47  const TRGCDCHelix& helix = _track->helix();
48  _pt = _track->pt();
49  _center_x = helix.center().x();
50  _center_y = helix.center().y();
51  _center_z = helix.center().z();
52  _r = sqrt(_center_x * _center_x + _center_y * _center_y); //helix.radius();
53  _phi = atan2(_center_y, _center_x) ;
54 
55  //-- cluster/TRGECL information
62  _re_scaled_p = _pt * _D / _R;
63 
64  //-- calculation
65  double theta0 = acos(_R / (2 * _r)) + _phi;
66  double theta1 = 2 * _phi - theta0;
67 
68  double ex_x0 = _R * cos(theta0), ex_y0 = _R * sin(theta0), ex_x1 = _R * cos(theta1), ex_y1 = _R * sin(theta1);
69  double dr0 = sqrt((ex_x0 - _cluster_x) * (ex_x0 - _cluster_x) + (ex_y0 - _cluster_y) * (ex_y0 - _cluster_y));
70  double dr1 = sqrt((ex_x1 - _cluster_x) * (ex_x1 - _cluster_x) + (ex_y1 - _cluster_y) * (ex_y1 - _cluster_y));
71 
72  _dr = (dr0 < dr1) ? dr0 : dr1;
73  _ex_x = (dr0 < dr1) ? ex_x0 : ex_x1;
74  _ex_y = (dr0 < dr1) ? ex_y0 : ex_y1;
75 
76  //z information
77  if (_match3D == 1) {
78  _z0 = helix.dz();
79  _slope = helix.tanl();
80  _ex_z = _z0 + _slope * 2 * _r * asin(_R / (2 * _r));
81  _pz = _pt * _slope;
82  _p = sqrt(_pz * _pz + _pt * _pt);
83  _dz = _cluster_z - _ex_z;
84  _poe = _p / _cluster_e;
85 
86  }
87 
88  }
89 
90 
91  void
93  {
94 
95  cout << "double center_x = " << _center_x << ";" << endl;
96  cout << "double center_y = " << _center_y << ";" << endl;
97  cout << "double center_z = " << _center_z << ";" << endl;
98  cout << "double radius = " << _r << ";" << endl;
99  cout << "double pt = " << _pt << ";" << endl;
100  cout << "double p = " << _p << ";" << endl;
101  cout << "double cluster_x = " << _cluster_x << ";" << endl;
102  cout << "double cluster_y = " << _cluster_y << ";" << endl;
103  cout << "double cluster_z = " << _cluster_z << ";" << endl;
104  cout << "double ex_x = " << _ex_x << ";" << endl;
105  cout << "double ex_y = " << _ex_y << ";" << endl;
106  cout << "double ex_z = " << _ex_z << ";" << endl;
107 
108  }
109 
110 
112 } // namespace Belle2
113 
Belle2::TRGGRLMatch::_cluster_x
double _cluster_x
x position of cluster
Definition: TRGGRLMatch.h:126
Belle2::TRGCDCHelix::center
const HepGeom::Point3D< double > & center(void) const
returns position of helix center(z = 0.);
Definition: Helix.h:241
Belle2::TRGGRLMatch::_pt
double _pt
pt of track
Definition: TRGGRLMatch.h:115
Belle2::TRGGRLMatch::_pz
double _pz
pz of track
Definition: TRGGRLMatch.h:119
Belle2::TRGECLCluster
Example Detector.
Definition: TRGECLCluster.h:25
Belle2::TRGGRLMatch::_z0
double _z0
z0 of track
Definition: TRGGRLMatch.h:121
Belle2::TRGECLCluster::getPositionX
double getPositionX() const
The method to get hit average time Get Energy weighted position X.
Definition: TRGECLCluster.h:127
Belle2::TRGGRLMatch::_slope
double _slope
z slope (polar angle) of track
Definition: TRGGRLMatch.h:123
Belle2::TRGGRLMatch::_R
double _R
transverse distance of cluster to IP
Definition: TRGGRLMatch.h:134
Belle2::TRGGRLMatch::_cluster_z
double _cluster_z
z position of cluster
Definition: TRGGRLMatch.h:130
Belle2::TRGGRLMatch::_ex_z
double _ex_z
z position of the cluster calculated by matching
Definition: TRGGRLMatch.h:149
Belle2::TRGGRLMatch::_p
double _p
p of track
Definition: TRGGRLMatch.h:117
Belle2::TRGECLCluster::getPositionZ
double getPositionZ() const
Get Energy weighted position Z.
Definition: TRGECLCluster.h:131
Belle2::TRGCDCTrack::helix
const TRGCDCHelix & helix(void) const
returns helix parameter.
Definition: Track.h:144
Belle2::TRGECLCluster::getPositionY
double getPositionY() const
Get Energy weighted position Y.
Definition: TRGECLCluster.h:129
Belle2::TRGCDCHelix
TRGCDCHelix parameter class.
Definition: Helix.h:35
Belle2::TRGGRLMatch::_re_scaled_p
double _re_scaled_p
track momentum scaled with 3D information from cluster
Definition: TRGGRLMatch.h:138
Belle2::TRGGRLMatch::_D
double _D
distance of clusterto IP
Definition: TRGGRLMatch.h:136
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TRGGRLMatch::_dr
double _dr
dr between track and cluster
Definition: TRGGRLMatch.h:141
Belle2::TRGGRLMatch::_dz
double _dz
dz between track and cluster
Definition: TRGGRLMatch.h:143
Belle2::TRGGRLMatch::_match3D
int _match3D
flag tells 3D information is valid or not
Definition: TRGGRLMatch.h:102
Belle2::TRGGRLMatch::dump
void dump(void)
Unpacker of the TRGGRLMatch.
Definition: TRGGRLMatch.cc:92
Belle2::TRGGRLMatch::~TRGGRLMatch
virtual ~TRGGRLMatch()
Destructor.
Definition: TRGGRLMatch.cc:38
Belle2::TRGGRLMatch::calculate
void calculate(void)
a function to execute calculation of matching
Definition: TRGGRLMatch.cc:43
Belle2::TRGGRLMatch::_cluster_y
double _cluster_y
y position of cluster
Definition: TRGGRLMatch.h:128
Belle2::TRGGRLMatch::_center_x
double _center_x
center (x) of track helix
Definition: TRGGRLMatch.h:105
Belle2::TRGGRLMatch::_track
TRGCDCTrack * _track
a pointer to the TRGCDCTrack of the matching candidate
Definition: TRGGRLMatch.h:90
Belle2::TRGGRLMatch::_cluster_e
double _cluster_e
deposit energy of cluster
Definition: TRGGRLMatch.h:132
Belle2::TRGCDCHelix::tanl
double tanl(void) const
returns tanl.
Definition: Helix.h:297
Belle2::TRGGRLMatch::_cluster
TRGECLCluster * _cluster
a pointer to the TRGECLCluster of the matching candidate
Definition: TRGGRLMatch.h:99
Belle2::TRGCDCHelix::dz
double dz(void) const
returns dz.
Definition: Helix.h:290
Belle2::TRGCDCTrack
A class to represent a reconstructed charged track in TRGCDC.
Definition: Track.h:39
Belle2::TRGGRLMatch::_phi
double _phi
phi of the track center
Definition: TRGGRLMatch.h:113
Belle2::TRGGRLMatch::_center_z
double _center_z
center (z) of track helix
Definition: TRGGRLMatch.h:109
Belle2::TRGGRLMatch::_poe
double _poe
calculated p over e
Definition: TRGGRLMatch.h:151
Belle2::TRGCDCTrack::pt
virtual double pt(void) const override
returns Pt.
Definition: Track.h:166
Belle2::TRGGRLMatch::_ex_x
double _ex_x
x position of the cluster calculated by matching
Definition: TRGGRLMatch.h:145
Belle2::TRGECLCluster::getEnergyDep
double getEnergyDep() const
The method to get deposited energy.
Definition: TRGECLCluster.h:120
Belle2::TRGGRLMatch::_ex_y
double _ex_y
y position of the cluster calculated by matching
Definition: TRGGRLMatch.h:147
Belle2::TRGGRLMatch::_r
double _r
radius of track
Definition: TRGGRLMatch.h:111
Belle2::TRGGRLMatch::_center_y
double _center_y
center (y) of track helix
Definition: TRGGRLMatch.h:107