Belle II Software development
TRGGRLMatch.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include "trg/trg/Signal.h"
10#include "trg/cdc/TRGCDCTrack.h"
11#include "trg/cdc/Helix.h"
12#include "trg/ecl/dataobjects/TRGECLCluster.h"
13#include "trg/grl/TRGGRLMatch.h"
14#include <math.h>
15
16using namespace std;
17
18namespace Belle2 {
26 : _track(track),
27 _cluster(cluster),
28 _match3D(flag)
29 {
30 calculate();
31 }
32
34 {
35 }
36
37 void
39 {
40
41 //-- track/TRGCDC information
42 const TRGCDCHelix& helix = _track->helix();
43 _pt = _track->pt();
44 _center_x = helix.center().x();
45 _center_y = helix.center().y();
46 _center_z = helix.center().z();
47 _r = sqrt(_center_x * _center_x + _center_y * _center_y); //helix.radius();
48 _phi = atan2(_center_y, _center_x) ;
49
50 //-- cluster/TRGECL information
57 _re_scaled_p = _pt * _D / _R;
58
59 //-- calculation
60 double theta0 = acos(_R / (2 * _r)) + _phi;
61 double theta1 = 2 * _phi - theta0;
62
63 double ex_x0 = _R * cos(theta0), ex_y0 = _R * sin(theta0), ex_x1 = _R * cos(theta1), ex_y1 = _R * sin(theta1);
64 double dr0 = sqrt((ex_x0 - _cluster_x) * (ex_x0 - _cluster_x) + (ex_y0 - _cluster_y) * (ex_y0 - _cluster_y));
65 double dr1 = sqrt((ex_x1 - _cluster_x) * (ex_x1 - _cluster_x) + (ex_y1 - _cluster_y) * (ex_y1 - _cluster_y));
66
67 _dr = (dr0 < dr1) ? dr0 : dr1;
68 _ex_x = (dr0 < dr1) ? ex_x0 : ex_x1;
69 _ex_y = (dr0 < dr1) ? ex_y0 : ex_y1;
70
71 //z information
72 if (_match3D == 1) {
73 _z0 = helix.dz();
74 _slope = helix.tanl();
75 _ex_z = _z0 + _slope * 2 * _r * asin(_R / (2 * _r));
76 _pz = _pt * _slope;
77 _p = sqrt(_pz * _pz + _pt * _pt);
79 _poe = _p / _cluster_e;
80
81 }
82
83 }
84
85
86 void
88 {
89
90 cout << "double center_x = " << _center_x << ";" << endl;
91 cout << "double center_y = " << _center_y << ";" << endl;
92 cout << "double center_z = " << _center_z << ";" << endl;
93 cout << "double radius = " << _r << ";" << endl;
94 cout << "double pt = " << _pt << ";" << endl;
95 cout << "double p = " << _p << ";" << endl;
96 cout << "double cluster_x = " << _cluster_x << ";" << endl;
97 cout << "double cluster_y = " << _cluster_y << ";" << endl;
98 cout << "double cluster_z = " << _cluster_z << ";" << endl;
99 cout << "double ex_x = " << _ex_x << ";" << endl;
100 cout << "double ex_y = " << _ex_y << ";" << endl;
101 cout << "double ex_z = " << _ex_z << ";" << endl;
102
103 }
104
105
107} // namespace Belle2
108
TRGCDCHelix parameter class.
Definition: Helix.h:34
A class to represent a reconstructed charged track in TRGCDC.
Definition: TRGCDCTrack.h:38
Example Detector.
Definition: TRGECLCluster.h:24
double getPositionZ() const
Get Energy weighted position Z.
double getEnergyDep() const
The method to get deposited energy.
double getPositionX() const
The method to get hit average time Get Energy weighted position X.
double getPositionY() const
Get Energy weighted position Y.
double _phi
phi of the track center
Definition: TRGGRLMatch.h:110
int _match3D
flag tells 3D information is valid or not
Definition: TRGGRLMatch.h:99
double _cluster_y
y position of cluster
Definition: TRGGRLMatch.h:125
double _center_y
center (y) of track helix
Definition: TRGGRLMatch.h:104
double _cluster_z
z position of cluster
Definition: TRGGRLMatch.h:127
TRGECLCluster * _cluster
a pointer to the TRGECLCluster of the matching candidate
Definition: TRGGRLMatch.h:96
double _slope
z slope (polar angle) of track
Definition: TRGGRLMatch.h:120
double _cluster_e
deposit energy of cluster
Definition: TRGGRLMatch.h:129
double _cluster_x
x position of cluster
Definition: TRGGRLMatch.h:123
double _re_scaled_p
track momentum scaled with 3D information from cluster
Definition: TRGGRLMatch.h:135
double _r
radius of track
Definition: TRGGRLMatch.h:108
double _D
distance of clusterto IP
Definition: TRGGRLMatch.h:133
double _ex_y
y position of the cluster calculated by matching
Definition: TRGGRLMatch.h:144
double _center_x
center (x) of track helix
Definition: TRGGRLMatch.h:102
double _dr
dr between track and cluster
Definition: TRGGRLMatch.h:138
double _center_z
center (z) of track helix
Definition: TRGGRLMatch.h:106
double _ex_z
z position of the cluster calculated by matching
Definition: TRGGRLMatch.h:146
double _poe
calculated p over e
Definition: TRGGRLMatch.h:148
double _R
transverse distance of cluster to IP
Definition: TRGGRLMatch.h:131
TRGCDCTrack * _track
a pointer to the TRGCDCTrack of the matching candidate
Definition: TRGGRLMatch.h:93
double _z0
z0 of track
Definition: TRGGRLMatch.h:118
double _pz
pz of track
Definition: TRGGRLMatch.h:116
double _dz
dz between track and cluster
Definition: TRGGRLMatch.h:140
double _ex_x
x position of the cluster calculated by matching
Definition: TRGGRLMatch.h:142
double _pt
pt of track
Definition: TRGGRLMatch.h:112
double _p
p of track
Definition: TRGGRLMatch.h:114
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
const TRGCDCHelix & helix(void) const
returns helix parameter.
Definition: TRGCDCTrack.h:143
void calculate(void)
a function to execute calculation of matching
Definition: TRGGRLMatch.cc:38
const HepGeom::Point3D< double > & center(void) const
returns position of helix center(z = 0.);
Definition: Helix.h:243
double tanl(void) const
returns tanl.
Definition: Helix.h:299
virtual ~TRGGRLMatch()
Destructor.
Definition: TRGGRLMatch.cc:33
double dz(void) const
returns dz.
Definition: Helix.h:292
virtual double pt(void) const override
returns Pt.
Definition: TRGCDCTrack.h:165
void dump(void)
Unpacker of the TRGGRLMatch.
Definition: TRGGRLMatch.cc:87
TRGGRLMatch(TRGCDCTrack *track, TRGECLCluster *cluster, int flag)
public member functions of TRGGRLMatch class Private variables can be called by the corresponding get...
Definition: TRGGRLMatch.cc:25
Abstract base class for different kinds of events.
STL namespace.