77 ReturnType product = std::make_unique<TkMSParameterization>();
79 auto& msParam = *product;
90 ROOT::Math::SMatrixIdentity
id;
106 auto sinth2 = 1.f / (1.f + tanlmd * tanlmd);
108 auto overp = sinth /
pt;
109 auto pz = pt * tanlmd;
113 std::cout << tl <<
' ' << pz <<
' ' << 1. / overp << std::endl;
115 float lastzz = -18.f;
118 for (
int iz = 0; iz < 2; ++iz) {
121 for (
float zz = lastzz;
zz < 18.1f;
zz += 0.2f) {
130 std::function<void(int, TrajectoryStateOnSurface, DetLayer const*, float, int)> propagate =
132 for (
auto il = from + 1; il <
maxLayers; ++il) {
135 compLayers.begin(), compLayers.end(), [](
auto a,
auto b) {
return a->seqNum() <
b->seqNum(); });
137 for (
auto it : compLayers) {
138 if (it->basicComponents().empty()) {
140 edm::LogError(
"TkMSParameterizationBuilder") <<
"a detlayer with no components: I cannot figure " 141 "out a DetId from this layer. please investigate.";
145 std::cout << il << (it->isBarrel() ?
" Barrel" :
" Forward") <<
" layer " << it->seqNum()
146 <<
" SubDet " << it->subDetector() << std::endl;
147 auto const& detWithState = it->compatibleDets(tsos, ANprop,
estimator);
148 if (detWithState.empty()) {
150 std::cout <<
"no det on this layer" << it->seqNum() << std::endl;
154 auto did = detWithState.front().first->geographicalId();
157 tsos = detWithState.front().second;
159 std::cout << tsos.globalPosition() <<
' ' << tsos.localError().positionError() << std::endl;
164 auto gp = tsos.globalPosition();
166 float errorPhi =
std::sqrt(
float(globalError.phierr(gp)));
167 float errorR =
std::sqrt(
float(globalError.rerr(gp)));
168 float errorZ =
std::sqrt(
float(globalError.czz()));
169 float xerr = overp * errorPhi;
170 float zerr = overp * (layer->isBarrel() ? errorZ : errorR);
171 auto zo = layer->isBarrel() ? gp.z() :
r;
173 mserr[from][il - 1].emplace_back(MSData{stid, it->seqNum(), z1, zo, xerr, zerr});
179 SiPixelRecHit hitpx(tsos.localPosition(),
he, 1., *detWithState.front().first, pref);
180 auto tsosl = kfu.
update(tsos, hitpx);
181 auto z1l = layer->isBarrel() ? tsos.
globalPosition().
z() : tsos.globalPosition().perp();
182 auto stidl = layer->seqNum();
183 propagate(il, tsosl, layer, z1l, stidl);
195 if (debug && mserr[from][from].
empty()) {
196 std::cout <<
"tl " << tanlmd << loc <<
' ' << from << std::endl;
197 for (
auto il = from; il <
maxLayers; ++il) {
199 for (
auto const&
e : mserr[from][il])
207 for (
int ip = 0; ip < 5; ++ip) {
208 phi += (3.14159f / 6.f) / 5.
f;
215 auto startingPlane = pb.
plane(startingPosition,
rot);
219 auto tsos0 = startingStateP;
221 DetLayer const* layer0 = searchGeom.pixelBarrelLayers()[0];
223 layer0 = searchGeom.posPixelForwardLayers()[0];
224 int stid0 = layer0->
seqNum();
229 std::cout <<
"first layer " << (it->isBarrel() ?
" Barrel" :
" Forward") <<
" layer " << it->seqNum()
230 <<
" SubDet " << it->subDetector() << std::endl;
234 if (detWithState.empty()) {
239 tsos0 = detWithState.front().second;
241 std::cout <<
"arrived at " <<
int(detWithState.front().first->geographicalId()) <<
' ' 242 << tsos0.globalPosition() <<
' ' << tsos0.localError().positionError() << std::endl;
245 float z1l = tsos0.globalPosition().z();
248 z1l = tsos0.globalPosition().perp();
251 propagate(0, tsos0, layer0, z1l, stid0);
256 for (
auto from = 0; from <
maxLayers; ++from)
257 for (
auto il = from; il <
maxLayers; ++il) {
258 if (mserr[from][il].
empty())
260 auto stid = mserr[from][il].front().stid;
261 auto lid = mserr[from][il].front().lid;
262 auto zi = mserr[from][il].front().zi;
266 for (
auto const&
e : mserr[from][il]) {
272 for (
auto const&
e : mserr[from][il]) {
273 if (
e.stid != stid || lid !=
e.lid)
284 auto& md = msParam.data[iid].data[
ib].data;
285 if (md.empty() ||
std::abs(xerr - md.back().uerr) > 0.2
f * xerr ||
286 std::abs(zerr - md.back().verr) > 0.2
f * zerr)
287 md.emplace_back(
Elem{zi, zo, xerr, zerr});
295 for (
auto&
e : msParam.data)
296 for (
auto&
d :
e.second.data)
297 std::stable_sort(
d.data.begin(),
d.data.end(), [](
auto const&
a,
auto const&
b) {
return a.vo <
b.vo; });
unsigned short packLID(unsigned int id, unsigned int od)
Sin< T >::type sin(const T &t)
ReturnType plane(const PositionType &pos, const RotationType &rot) const
const GeometricSearchTracker & searchTracker() const
GlobalPoint globalPosition() const
edm::ESGetToken< Propagator, TrackingComponentsRecord > thePropagatorToken_
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
Cos< T >::type cos(const T &t)
std::unique_ptr< TkMSParameterization > ReturnType
Abs< T >::type abs(const T &t)
edm::ESGetToken< NavigationSchool, NavigationSchoolRecord > theNavSchoolToken_
const MagneticField & field() const
std::vector< const DetLayer * > nextLayers(const DetLayer &detLayer, Args &&...args) const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55