1 |
msegala |
1.1 |
#include "RecoTracker/SingleTrackPattern/test/TrajectoryInValidHit.h"
|
2 |
|
|
#include "TrackingTools/TrackFitters/interface/TrajectoryStateCombiner.h"
|
3 |
|
|
#include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
|
4 |
|
|
#include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
|
5 |
|
|
#include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
|
6 |
|
|
#include "Geometry/CommonTopologies/interface/StripTopology.h"
|
7 |
|
|
#include "Geometry/CommonTopologies/interface/PixelTopology.h"
|
8 |
|
|
#include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementError.h"
|
9 |
|
|
#include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementVector.h"
|
10 |
|
|
#include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
|
11 |
|
|
#include "DataFormats/SiStripDetId/interface/TIBDetId.h"
|
12 |
|
|
#include "DataFormats/SiStripDetId/interface/TIDDetId.h"
|
13 |
|
|
#include "DataFormats/SiStripDetId/interface/TOBDetId.h"
|
14 |
|
|
#include "Geometry/TrackerGeometryBuilder/interface/GluedGeomDet.h"
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
using namespace std;
|
18 |
|
|
TrajectoryInValidHit::TrajectoryInValidHit( const TrajectoryMeasurement& tm, const TrackerGeometry* tracker)
|
19 |
|
|
{
|
20 |
|
|
theCombinedPredictedState = TrajectoryStateCombiner().combine( tm.forwardPredictedState(),
|
21 |
|
|
tm.backwardPredictedState());
|
22 |
|
|
|
23 |
|
|
theHit = tm.recHit();
|
24 |
|
|
|
25 |
|
|
uint iidd = theHit->geographicalId().rawId();
|
26 |
|
|
// TrajectoryStateTransform tsostransform;
|
27 |
|
|
// PTrajectoryStateOnDet* combinedptsod=tsostransform.persistentState( theCombinedPredictedState,iidd);
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
StripSubdetector strip=StripSubdetector(iidd);
|
31 |
|
|
unsigned int subid=strip.subdetId();
|
32 |
|
|
uint laytib = 1000;
|
33 |
|
|
uint laytob = 1000;
|
34 |
|
|
float xB = 0.;
|
35 |
|
|
float yB = 0.;
|
36 |
|
|
//set bounds for point to be within to be counted in the study
|
37 |
|
|
if (subid == StripSubdetector::TIB) {
|
38 |
|
|
TIBDetId tibid(iidd);
|
39 |
|
|
laytib =tibid.layer();
|
40 |
|
|
xB = 0.3;
|
41 |
|
|
yB = 0.5;
|
42 |
|
|
}
|
43 |
|
|
if (subid == StripSubdetector::TOB) {
|
44 |
|
|
TOBDetId tobid(iidd);
|
45 |
|
|
laytob =tobid.layer();
|
46 |
|
|
xB = 0.3;
|
47 |
|
|
yB = 1.0;
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
LocalVector monoco, stereoco;
|
53 |
|
|
LocalPoint pmonoco, pstereoco;
|
54 |
|
|
|
55 |
|
|
const GeomDetUnit * monodet;
|
56 |
|
|
const GeomDetUnit * stereodet;
|
57 |
|
|
|
58 |
|
|
/* if (laytib == 1 || laytib == 2 || laytob == 1 || laytob == 2){
|
59 |
|
|
|
60 |
|
|
GluedGeomDet * gdet=(GluedGeomDet *)tracker->idToDet(theHit->geographicalId());
|
61 |
|
|
GlobalVector gtrkdirco=gdet->toGlobal(combinedptsod->parameters().momentum());
|
62 |
|
|
|
63 |
|
|
monodet=gdet->monoDet();
|
64 |
|
|
monoco=monodet->toLocal(gtrkdirco);
|
65 |
|
|
pmonoco=project(gdet,monodet,combinedptsod->parameters().position(),monoco);
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
RPhilocX_temp = pmonoco.x();
|
69 |
|
|
RPhilocY_temp = pmonoco.y();
|
70 |
|
|
|
71 |
|
|
stereodet = gdet->stereoDet();
|
72 |
|
|
stereoco=stereodet->toLocal(gtrkdirco);
|
73 |
|
|
pstereoco=project(gdet,stereodet,combinedptsod->parameters().position(),stereoco);
|
74 |
|
|
|
75 |
|
|
StereolocX_temp = pstereoco.x();
|
76 |
|
|
StereolocY_temp = pstereoco.y();
|
77 |
|
|
}
|
78 |
|
|
else { */
|
79 |
|
|
RPhilocX_temp = theCombinedPredictedState.localPosition().x();
|
80 |
|
|
RPhilocY_temp = theCombinedPredictedState.localPosition().y();
|
81 |
|
|
//StereolocX_temp = 1000.; //treat mono and stereo the same now.
|
82 |
|
|
StereolocX_temp = theCombinedPredictedState.localPosition().x();
|
83 |
|
|
//StereolocY_temp = 1000.;
|
84 |
|
|
StereolocY_temp = theCombinedPredictedState.localPosition().y();
|
85 |
|
|
monodet = (GeomDetUnit*)theHit->det();
|
86 |
|
|
stereodet = (GeomDetUnit*)theHit->det();
|
87 |
|
|
|
88 |
|
|
// }
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
// Restrict the bound regions for better understanding of the modul assignment.
|
92 |
|
|
|
93 |
|
|
LocalPoint BoundedPointRphi;
|
94 |
|
|
LocalPoint BoundedPointSte;
|
95 |
|
|
float xRphi,yRphi,zz;
|
96 |
|
|
float xSte,ySte;
|
97 |
|
|
|
98 |
|
|
// Insert the bounded values
|
99 |
|
|
|
100 |
|
|
if (RPhilocX_temp < 0. ) xRphi = RPhilocX_temp - xB;
|
101 |
|
|
else xRphi = RPhilocX_temp + xB;
|
102 |
|
|
if (RPhilocY_temp < 0. ) yRphi = RPhilocY_temp - yB;
|
103 |
|
|
else yRphi = RPhilocY_temp + yB;
|
104 |
|
|
|
105 |
|
|
if (StereolocX_temp < 0. ) xSte = StereolocX_temp - xB;
|
106 |
|
|
else xSte = StereolocX_temp + xB;
|
107 |
|
|
if (StereolocY_temp < 0. ) ySte = StereolocY_temp - yB;
|
108 |
|
|
else ySte = StereolocY_temp + yB;
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
zz = theCombinedPredictedState.localPosition().z();
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
BoundedPointRphi = LocalPoint(xRphi,yRphi,zz);
|
115 |
|
|
BoundedPointSte = LocalPoint(xSte,ySte,zz);
|
116 |
|
|
|
117 |
|
|
cout << "Bouding point rphi = " << LocalPoint(xRphi,yRphi,zz) << endl;
|
118 |
|
|
cout << "Bouding point stereo = " << LocalPoint(xSte,ySte,zz) << endl;
|
119 |
|
|
if (monodet!=stereodet){cout << "monodet!=stereodet" << endl;} else {cout << "monodet==stereodet" << endl;}
|
120 |
|
|
|
121 |
|
|
// ---> RPhi Stereo modules
|
122 |
|
|
if ( monodet->surface().bounds().inside(BoundedPointRphi)) {
|
123 |
|
|
|
124 |
|
|
RPhilocX = RPhilocX_temp;
|
125 |
|
|
RPhilocY = RPhilocY_temp;
|
126 |
|
|
}
|
127 |
|
|
else {
|
128 |
|
|
RPhilocX = 2000.;
|
129 |
|
|
RPhilocY = 2000.;
|
130 |
|
|
}
|
131 |
|
|
// ---> TIB Stereo modules
|
132 |
|
|
if ( stereodet->surface().bounds().inside(BoundedPointSte)) {
|
133 |
|
|
StereolocX = StereolocX_temp;
|
134 |
|
|
StereolocY = StereolocY_temp;
|
135 |
|
|
}
|
136 |
|
|
else {
|
137 |
|
|
StereolocX = 2000.;
|
138 |
|
|
StereolocY = 2000.;
|
139 |
|
|
}
|
140 |
|
|
}
|
141 |
|
|
|
142 |
|
|
double TrajectoryInValidHit::localRPhiX() const
|
143 |
|
|
{
|
144 |
|
|
return RPhilocX;
|
145 |
|
|
}
|
146 |
|
|
double TrajectoryInValidHit::localRPhiY() const
|
147 |
|
|
{
|
148 |
|
|
return RPhilocY;
|
149 |
|
|
}
|
150 |
|
|
double TrajectoryInValidHit::localStereoX() const
|
151 |
|
|
{
|
152 |
|
|
return StereolocX;
|
153 |
|
|
}
|
154 |
|
|
double TrajectoryInValidHit::localStereoY() const
|
155 |
|
|
{
|
156 |
|
|
return StereolocY;
|
157 |
|
|
}
|
158 |
|
|
double TrajectoryInValidHit::localZ() const
|
159 |
|
|
{
|
160 |
|
|
return theCombinedPredictedState.localPosition().z();
|
161 |
|
|
}
|
162 |
|
|
double TrajectoryInValidHit::localErrorX() const
|
163 |
|
|
{
|
164 |
|
|
return sqrt(theCombinedPredictedState.localError().positionError().xx());
|
165 |
|
|
}
|
166 |
|
|
double TrajectoryInValidHit::localErrorY() const
|
167 |
|
|
{
|
168 |
|
|
return sqrt(theCombinedPredictedState.localError().positionError().yy());
|
169 |
|
|
}
|
170 |
|
|
double TrajectoryInValidHit::globalX() const
|
171 |
|
|
{
|
172 |
|
|
return theCombinedPredictedState.globalPosition().x();
|
173 |
|
|
}
|
174 |
|
|
|
175 |
|
|
double TrajectoryInValidHit::globalY() const
|
176 |
|
|
{
|
177 |
|
|
return theCombinedPredictedState.globalPosition().y();
|
178 |
|
|
}
|
179 |
|
|
double TrajectoryInValidHit::globalZ() const
|
180 |
|
|
{
|
181 |
|
|
return theCombinedPredictedState.globalPosition().z();
|
182 |
|
|
}
|
183 |
|
|
|
184 |
|
|
|
185 |
|
|
bool TrajectoryInValidHit::InValid() const
|
186 |
|
|
{
|
187 |
|
|
return IsInvHit;
|
188 |
|
|
}
|
189 |
|
|
|
190 |
|
|
LocalPoint TrajectoryInValidHit::project(const GeomDet *det,const GeomDet* projdet,LocalPoint position,LocalVector trackdirection)const
|
191 |
|
|
{
|
192 |
|
|
cout << "getting projection" << endl;
|
193 |
|
|
GlobalPoint globalpoint=(det->surface()).toGlobal(position);
|
194 |
|
|
|
195 |
|
|
// position of the initial and final point of the strip in glued local coordinates
|
196 |
|
|
LocalPoint projposition=(projdet->surface()).toLocal(globalpoint);
|
197 |
|
|
|
198 |
|
|
//correct the position with the track direction
|
199 |
|
|
|
200 |
|
|
float scale=-projposition.z()/trackdirection.z();
|
201 |
|
|
|
202 |
|
|
projposition+= scale*trackdirection;
|
203 |
|
|
|
204 |
|
|
return projposition;
|
205 |
|
|
}
|