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 {
23
24
26 : _track(track),
27 _cluster(cluster),
28 _match3D(flag)
29 {
30 calculate();
31 }
32
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
51 _cluster_x = _cluster->getPositionX();
52 _cluster_y = _cluster->getPositionY();
53 _cluster_z = _cluster->getPositionZ();
54 _cluster_e = _cluster->getEnergyDep();
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.
double _phi
phi of the track center
int _match3D
flag tells 3D information is valid or not
Definition TRGGRLMatch.h:99
double _cluster_y
y position of cluster
double _center_y
center (y) of track helix
double _cluster_z
z position of cluster
TRGECLCluster * _cluster
a pointer to the TRGECLCluster of the matching candidate
Definition TRGGRLMatch.h:96
double _slope
z slope (polar angle) of track
double _cluster_e
deposit energy of cluster
double _cluster_x
x position of cluster
double _re_scaled_p
track momentum scaled with 3D information from cluster
double _r
radius of track
double _D
distance of clusterto IP
double _ex_y
y position of the cluster calculated by matching
double _center_x
center (x) of track helix
double _dr
dr between track and cluster
double _center_z
center (z) of track helix
double _ex_z
z position of the cluster calculated by matching
double _poe
calculated p over e
double _R
transverse distance of cluster to IP
TRGCDCTrack * _track
a pointer to the TRGCDCTrack of the matching candidate
Definition TRGGRLMatch.h:93
double _z0
z0 of track
double _pz
pz of track
double _dz
dz between track and cluster
double _ex_x
x position of the cluster calculated by matching
double _pt
pt of track
double _p
p of track
double sqrt(double a)
sqrt for double
Definition beamHelpers.h:28
void calculate(void)
a function to execute calculation of matching
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.
double dz(void) const
returns dz.
Definition Helix.h:292
void dump(void)
Unpacker of the TRGGRLMatch.
TRGGRLMatch(TRGCDCTrack *track, TRGECLCluster *cluster, int flag)
public member functions of TRGGRLMatch class Private variables can be called by the corresponding get...
Abstract base class for different kinds of events.
STL namespace.