1 |
econte |
1.1 |
#define private public
|
2 |
|
|
#include "TrackingTools/PatternTools/interface/ClosestApproachInRPhi.h"
|
3 |
|
|
#include "TrackingTools/PatternTools/interface/TwoTrackMinimumDistanceHelixHelix.h"
|
4 |
|
|
#undef private
|
5 |
|
|
|
6 |
|
|
// #include "DataFormats/GeometrySurface/interface/BoundPlane.h"
|
7 |
|
|
#include "MagneticField/Engine/interface/MagneticField.h"
|
8 |
|
|
|
9 |
|
|
// #include "TrackingTools/TrajectoryState/interface/BasicSingleTrajectoryState.h"
|
10 |
|
|
#include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
#include <iostream>
|
14 |
|
|
|
15 |
|
|
class ConstMagneticField : public MagneticField {
|
16 |
|
|
public:
|
17 |
|
|
|
18 |
|
|
virtual GlobalVector inTesla ( const GlobalPoint& ) const {
|
19 |
|
|
return GlobalVector(0,0,4);
|
20 |
|
|
}
|
21 |
|
|
|
22 |
|
|
};
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
namespace {
|
26 |
|
|
inline GlobalPoint mean ( std::pair<GlobalPoint, GlobalPoint> pr ) {
|
27 |
|
|
return GlobalPoint ( 0.5*(pr.first.basicVector() + pr.second.basicVector()) );
|
28 |
|
|
}
|
29 |
|
|
|
30 |
|
|
inline double dist ( std::pair<GlobalPoint, GlobalPoint> pr ) {
|
31 |
|
|
return ( pr.first - pr.second ).mag();
|
32 |
|
|
}
|
33 |
|
|
}
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
void compute(GlobalTrajectoryParameters const & gtp1, GlobalTrajectoryParameters const & gtp2) {
|
37 |
|
|
ClosestApproachInRPhi ca;
|
38 |
|
|
TwoTrackMinimumDistanceHelixHelix TTMDhh;
|
39 |
|
|
|
40 |
|
|
std::cout << "CAIR" << std::endl;
|
41 |
|
|
bool ok = ca.calculate(gtp1,gtp2);
|
42 |
|
|
if(!ok)
|
43 |
|
|
std::cout << "no intercept!" << std::endl;
|
44 |
|
|
else {
|
45 |
|
|
std::cout << "distance, xpoint " << ca.distance() << ca.crossingPoint() << std::endl;
|
46 |
|
|
std::pair <GlobalTrajectoryParameters, GlobalTrajectoryParameters > tca = ca.trajectoryParameters();
|
47 |
|
|
std::cout << tca.first << std::endl;
|
48 |
|
|
std::cout << tca.second << std::endl;
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
std::cout << "TTMDhh" << std::endl;
|
52 |
|
|
bool nok = TTMDhh.calculate(gtp1,gtp2,.0001);
|
53 |
|
|
if(nok)
|
54 |
|
|
std::cout << "no intercept!" << std::endl;
|
55 |
|
|
else {
|
56 |
|
|
std::pair<GlobalPoint, GlobalPoint> pr = TTMDhh.points();
|
57 |
|
|
std::cout << "distance, xpoint " << dist(pr) << mean(pr) << std::endl;
|
58 |
|
|
// std::pair <GlobalTrajectoryParameters, GlobalTrajectoryParameters > thh = TTMDhh.trajectoryParameters();
|
59 |
|
|
// std::cout << thh.first << std::endl;
|
60 |
|
|
// std::cout << thh.second << std::endl;
|
61 |
|
|
}
|
62 |
|
|
}
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
int main() {
|
66 |
|
|
|
67 |
|
|
MagneticField * field = new ConstMagneticField;
|
68 |
|
|
|
69 |
|
|
{
|
70 |
|
|
// going back and forth gtp2 should be identical to gpt1....
|
71 |
|
|
GlobalPoint gp1(1,0,0);
|
72 |
|
|
GlobalVector gv1(1,1,-1);
|
73 |
|
|
GlobalTrajectoryParameters gtp1(gp1,gv1,1,field);
|
74 |
|
|
double bz = field->inTesla(gp1).z() * 2.99792458e-3;
|
75 |
|
|
GlobalPoint np(0.504471, -0.498494, 0.497014);
|
76 |
|
|
GlobalTrajectoryParameters gtpN = ClosestApproachInRPhi::newTrajectory(np,gtp1,bz);
|
77 |
|
|
GlobalTrajectoryParameters gtp2 = ClosestApproachInRPhi::newTrajectory(gp1,gtpN,bz);
|
78 |
|
|
std::cout << gtp1 << std::endl;
|
79 |
|
|
std::cout << gtpN << std::endl;
|
80 |
|
|
std::cout << gtp2 << std::endl;
|
81 |
|
|
std::cout << std::endl;
|
82 |
|
|
}
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
{
|
86 |
|
|
std::cout <<"opposite sign, same direction, same origin: the two circles are tangent to each other at gp1\n" << std::endl;
|
87 |
|
|
GlobalPoint gp1(0,0,0);
|
88 |
|
|
GlobalVector gv1(1,1,1);
|
89 |
|
|
GlobalTrajectoryParameters gtp1(gp1,gv1,1,field);
|
90 |
|
|
|
91 |
|
|
GlobalPoint gp2(0,0,0);
|
92 |
|
|
GlobalVector gv2(1,1,-1);
|
93 |
|
|
GlobalTrajectoryParameters gtp2(gp2,gv2,-1,field);
|
94 |
|
|
|
95 |
|
|
compute(gtp1,gtp2);
|
96 |
|
|
std::cout << std::endl;
|
97 |
|
|
|
98 |
|
|
}
|
99 |
|
|
{
|
100 |
|
|
std::cout <<" not crossing: the pcas are on the line connecting the two centers\n"
|
101 |
|
|
<<"the momenta at the respective pcas shall be parallel as they are perpendicular to the same line\n"
|
102 |
|
|
<<"(the one connecting the two centers)\n" << std::endl;
|
103 |
|
|
GlobalPoint gp1(-1,0,0);
|
104 |
|
|
GlobalVector gv1(1,1,1);
|
105 |
|
|
GlobalTrajectoryParameters gtp1(gp1,gv1,-1,field);
|
106 |
|
|
|
107 |
|
|
GlobalPoint gp2(1,0,0);
|
108 |
|
|
GlobalVector gv2(1,1,-1);
|
109 |
|
|
GlobalTrajectoryParameters gtp2(gp2,gv2,1,field);
|
110 |
|
|
|
111 |
|
|
compute(gtp1,gtp2);
|
112 |
|
|
std::cout << std::endl;
|
113 |
|
|
}
|
114 |
|
|
{
|
115 |
|
|
std::cout <<"crossing (only opposite changes w.r.t. previous)\n" << std::endl;
|
116 |
|
|
GlobalPoint gp1(-1,0,0);
|
117 |
|
|
GlobalVector gv1(1,1,1);
|
118 |
|
|
GlobalTrajectoryParameters gtp1(gp1,gv1,1,field);
|
119 |
|
|
|
120 |
|
|
GlobalPoint gp2(1,0,0);
|
121 |
|
|
GlobalVector gv2(1,1,-1);
|
122 |
|
|
GlobalTrajectoryParameters gtp2(gp2,gv2,-1,field);
|
123 |
|
|
|
124 |
|
|
compute(gtp1,gtp2);
|
125 |
|
|
std::cout << std::endl;
|
126 |
|
|
}
|
127 |
|
|
|
128 |
|
|
{
|
129 |
|
|
std::cout <<"crossing\n" << std::endl;
|
130 |
|
|
GlobalPoint gp1(-1,0,0);
|
131 |
|
|
GlobalVector gv1(1,1,1);
|
132 |
|
|
GlobalTrajectoryParameters gtp1(gp1,gv1,-1,field);
|
133 |
|
|
|
134 |
|
|
GlobalPoint gp2(1,0,0);
|
135 |
|
|
GlobalVector gv2(-1,1,-1);
|
136 |
|
|
GlobalTrajectoryParameters gtp2(gp2,gv2,1,field);
|
137 |
|
|
|
138 |
|
|
compute(gtp1,gtp2);
|
139 |
|
|
std::cout << std::endl;
|
140 |
|
|
}
|
141 |
|
|
|
142 |
|
|
|
143 |
|
|
return 0;
|
144 |
|
|
|
145 |
|
|
}
|