46 os <<
d.stid <<
'>' <<
d.lid <<
'|' <<
d.zi <<
'/' <<
d.zo <<
':' <<
d.uerr <<
'/' <<
d.verr;
57 descriptions.
add(
"TkMSParameterizationBuilder",
desc);
60 using ReturnType = std::unique_ptr<TkMSParameterization>;
77 ReturnType product = std::make_unique<TkMSParameterization>();
79 auto& msParam = *product;
83 auto const& searchGeom =
navSchool.searchTracker();
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);
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 ||
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; });
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
constexpr unsigned int nLmBins()
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
ReturnType produce(TkMSParameterizationRecord const &)
constexpr uint32_t maxLayers
Sin< T >::type sin(const T &t)
ReturnType plane(const PositionType &pos, const RotationType &rot) const
Log< level::Error, false > LogError
edm::ESGetToken< Propagator, TrackingComponentsRecord > thePropagatorToken_
constexpr std::array< uint8_t, layerIndexSize > layer
constexpr unsigned short packLID(unsigned int id, unsigned int od)
TkMSParameterizationBuilder(edm::ParameterSet 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)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
edm::ESGetToken< NavigationSchool, NavigationSchoolRecord > theNavSchoolToken_
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::ostream & operator<<(std::ostream &os, MSData d)
TkRotation< float > RotationType
Vector3DBase unit() const
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const