CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
TkMSParameterizationBuilder Class Referencefinal
Inheritance diagram for TkMSParameterizationBuilder:
edm::ESProducer edm::ESProductResolverFactoryProducer edm::eventsetup::ESProductResolverProvider

Public Types

using ReturnType = std::unique_ptr< TkMSParameterization >
 

Public Member Functions

ReturnType produce (TkMSParameterizationRecord const &)
 
 TkMSParameterizationBuilder (edm::ParameterSet const &)
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
 ESProducer (ESProducer &&)=delete
 
ESResolverIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProduceroperator= (const ESProducer &)=delete
 
ESProduceroperator= (ESProducer &&)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESResolverIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProductResolverFactoryProducer
 ESProductResolverFactoryProducer ()
 
 ESProductResolverFactoryProducer (const ESProductResolverFactoryProducer &)=delete
 
const ESProductResolverFactoryProduceroperator= (const ESProductResolverFactoryProducer &)=delete
 
 ~ESProductResolverFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
void createKeyedResolvers (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
const ComponentDescriptiondescription () const
 
 ESProductResolverProvider ()
 
 ESProductResolverProvider (const ESProductResolverProvider &)=delete
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedResolverskeyedResolvers (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const ESProductResolverProvideroperator= (const ESProductResolverProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~ESProductResolverProvider () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
static void prevalidate (ConfigurationDescriptions &)
 

Private Attributes

edm::ESGetToken< NavigationSchool, NavigationSchoolRecordtheNavSchoolToken_
 
edm::ESGetToken< Propagator, TrackingComponentsRecordthePropagatorToken_
 

Additional Inherited Members

- Protected Types inherited from edm::ESProductResolverFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::ESProductResolverProvider
using KeyedResolversVector = std::vector< std::pair< DataKey, std::shared_ptr< ESProductResolver > >>
 
- Protected Member Functions inherited from edm::ESProducer
ESConsumesInfoconsumesInfoPushBackNew ()
 
unsigned int consumesInfoSize () const
 
template<typename CallbackT , typename TList , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>> iCallback, const TList *, const TRecord *iRecord, const es::Label &iLabel)
 
template<typename CallbackT , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>>, const eventsetup::produce::Null *, const TRecord *, const es::Label &)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TDecorator >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename TFunc >
auto setWhatProduced (TFunc &&func, const es::Label &iLabel={})
 
template<typename TReturn , typename TRecord , typename TFunc , typename TDecorator >
ESConsumesCollectorT< TRecord > setWhatProduced (TFunc &&func, TDecorator &&iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProductResolverFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ESProductResolverFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedResolversVector registerResolvers (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::ESProductResolverProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 

Detailed Description

Definition at line 50 of file TkMSParameterizationBuilder.cc.

Member Typedef Documentation

◆ ReturnType

Definition at line 60 of file TkMSParameterizationBuilder.cc.

Constructor & Destructor Documentation

◆ TkMSParameterizationBuilder()

TkMSParameterizationBuilder::TkMSParameterizationBuilder ( edm::ParameterSet const &  pset)

Definition at line 68 of file TkMSParameterizationBuilder.cc.

References gpuPixelDoublets::cc, muonDTDigis_cfi::pset, edm::ESProducer::setWhatProduced(), AlCaHLTBitMon_QueryRunRegistry::string, theNavSchoolToken_, and thePropagatorToken_.

68  {
69  auto cc = setWhatProduced(this, "");
70  theNavSchoolToken_ = cc.consumes(edm::ESInputTag("", pset.getParameter<std::string>("navigationSchool")));
71  thePropagatorToken_ = cc.consumes(edm::ESInputTag("", "PropagatorWithMaterial"));
72 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
edm::ESGetToken< Propagator, TrackingComponentsRecord > thePropagatorToken_
edm::ESGetToken< NavigationSchool, NavigationSchoolRecord > theNavSchoolToken_

Member Function Documentation

◆ fillDescriptions()

static void TkMSParameterizationBuilder::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 53 of file TkMSParameterizationBuilder.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

53  {
55  // desc.add<std::string>("ComponentName","TkMSParameterization");
56  desc.add<std::string>("navigationSchool", "SimpleNavigationSchool");
57  descriptions.add("TkMSParameterizationBuilder", desc);
58  }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

TkMSParameterizationBuilder::ReturnType TkMSParameterizationBuilder::produce ( TkMSParameterizationRecord const &  iRecord)

Definition at line 74 of file TkMSParameterizationBuilder.cc.

References a, funct::abs(), alongMomentum, b, correctionTermsCaloMet_cff::C, Chi2MeasurementEstimator_cfi::Chi2MeasurementEstimator, GeometricSearchDet::compatibleDets(), runTheMatrix::const, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), funct::cos(), gather_cfg::cout, ztail::d, debug, MillePedeFileConverter_cfg::e, relativeConstraints::empty, submitPVResolutionJobs::err, f, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), runTauDisplay::gp, hcalSimParameters_cfi::he, cuy::ib, l1ctLayer2EG_cff::id, createfilelist::int, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, nano_mu_digi_cff::layer, tkMSParameterization::lmBin(), volumeBasedMagneticField_160812_cfi::magfield, pixelTopology::maxLayers, SiStripPI::min, HLT_2023v12_cff::navSchool, tkMSParameterization::nLmBins(), groupFilesInBlocks::nn, tkMSParameterization::packLID(), phi, PlaneBuilder::plane(), DiDispStaMuonMonitor_cfi::pt, alignCSCRings::r, makeMuonMisalignmentScenario::rot, idealTransformation::rotation, DetLayer::seqNum(), funct::sin(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, theNavSchoolToken_, thePropagatorToken_, ErrorFrameTransformer::transform(), KFUpdator::update(), z, spu::zerr(), and geometryCSVtoXML::zz.

74  {
75  using namespace tkMSParameterization;
76 
77  ReturnType product = std::make_unique<TkMSParameterization>();
78 
79  auto& msParam = *product;
80 
81  //
82  TkNavigationSchool const& navSchool = dynamic_cast<TkNavigationSchool const&>(iRecord.get(theNavSchoolToken_));
83  auto const& searchGeom = navSchool.searchTracker();
84  auto const& magfield = navSchool.field();
85 
86  //
87  auto const& ANprop = iRecord.get(thePropagatorToken_);
88 
89  // error (very very small)
90  ROOT::Math::SMatrixIdentity id;
92  C *= 1.e-16;
93 
95 
96  Chi2MeasurementEstimator estimator(30., -3.0, 0.5, 2.0, 0.5, 1.e12); // same as defauts....
97  KFUpdator kfu;
98  LocalError he(0.001 * 0.001, 0, 0.002 * 0.002);
99 
100  // loop over lambdas
101  bool debug = false;
102  float tl = 0;
103  for (decltype(nLmBins()) ib = 0; ib < nLmBins(); ++ib, tl += lmBin()) {
104  float pt = 1.0f;
105  float tanlmd = tl; // 0.1f;
106  auto sinth2 = 1.f / (1.f + tanlmd * tanlmd);
107  auto sinth = std::sqrt(sinth2);
108  auto overp = sinth / pt;
109  auto pz = pt * tanlmd;
110 
111  // debug= (tl>2.34f && tl<2.55f);
112  if (debug)
113  std::cout << tl << ' ' << pz << ' ' << 1. / overp << std::endl;
114 
115  float lastzz = -18.f;
116  bool goFw = false;
117  std::string loc = " Barrel";
118  for (int iz = 0; iz < 2; ++iz) {
119  if (iz > 0)
120  goFw = true;
121  for (float zz = lastzz; zz < 18.1f; zz += 0.2f) {
122  float z = zz;
123  GlobalPoint startingPosition(0, 0, z);
124 
125  constexpr int maxLayers = 6;
126 
127  std::vector<MSData> mserr[maxLayers][maxLayers];
128 
129  // define propagation from/to
130  std::function<void(int, TrajectoryStateOnSurface, DetLayer const*, float, int)> propagate =
131  [&](int from, TrajectoryStateOnSurface tsos, DetLayer const* layer, float z1, int stid) {
132  for (auto il = from + 1; il < maxLayers; ++il) {
133  auto compLayers = navSchool.nextLayers(*layer, *tsos.freeState(), alongMomentum);
134  std::stable_sort(
135  compLayers.begin(), compLayers.end(), [](auto a, auto b) { return a->seqNum() < b->seqNum(); });
136  layer = nullptr;
137  for (auto it : compLayers) {
138  if (it->basicComponents().empty()) {
139  //this should never happen. but better protect for it
140  edm::LogError("TkMSParameterizationBuilder") << "a detlayer with no components: I cannot figure "
141  "out a DetId from this layer. please investigate.";
142  continue;
143  }
144  if (debug)
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()) {
149  if (debug)
150  std::cout << "no det on this layer" << it->seqNum() << std::endl;
151  continue;
152  }
153  layer = it;
154  auto did = detWithState.front().first->geographicalId();
155  if (debug)
156  std::cout << "arrived at " << int(did) << std::endl;
157  tsos = detWithState.front().second;
158  if (debug)
159  std::cout << tsos.globalPosition() << ' ' << tsos.localError().positionError() << std::endl;
160 
161  // save errs
162  auto globalError =
163  ErrorFrameTransformer::transform(tsos.localError().positionError(), tsos.surface());
164  auto gp = tsos.globalPosition();
165  float r = gp.perp();
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;
172  // std::cout << tanlmd << ' ' << z1 << ' ' << it->seqNum() << ':' << xerr <<'/'<<zerr << std::endl;
173  mserr[from][il - 1].emplace_back(MSData{stid, it->seqNum(), z1, zo, xerr, zerr});
174 
175  if (from == 0) {
176  // spawn prop from this layer
177  // constrain it to this location (relevant for layer other than very first)
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);
184  }
185  break;
186  } // loop on compLayers
187  if (!layer)
188  break;
189  // if (!goFw) lastbz=z1;
190  if (from == 0)
191  lastzz = zz;
192 
193  } // layer loop
194 
195  if (debug && mserr[from][from].empty()) {
196  std::cout << "tl " << tanlmd << loc << ' ' << from << std::endl;
197  for (auto il = from; il < maxLayers; ++il) {
198  std::cout << il << ' ';
199  for (auto const& e : mserr[from][il])
200  std::cout << e << ' '; // << '-' <<e.uerr*sinth <<'/'<<e.verr*sinth <<' ';
201  std::cout << std::endl;
202  }
203  }
204  }; // propagate
205 
206  float phi = 0.0415f;
207  for (int ip = 0; ip < 5; ++ip) {
208  phi += (3.14159f / 6.f) / 5.f;
209  GlobalVector startingMomentum(pt * std::sin(phi), pt * std::cos(phi), pz);
210 
211  // make TSOS happy
212  //Define starting plane
213  PlaneBuilder pb;
214  auto rot = rotation(startingMomentum);
215  auto startingPlane = pb.plane(startingPosition, rot);
216 
217  TrajectoryStateOnSurface startingStateP(
218  GlobalTrajectoryParameters(startingPosition, startingMomentum, 1, &magfield), err, *startingPlane);
219  auto tsos0 = startingStateP;
220 
221  DetLayer const* layer0 = searchGeom.pixelBarrelLayers()[0];
222  if (goFw)
223  layer0 = searchGeom.posPixelForwardLayers()[0];
224  int stid0 = layer0->seqNum();
225 
226  {
227  auto it = layer0;
228  if (debug)
229  std::cout << "first layer " << (it->isBarrel() ? " Barrel" : " Forward") << " layer " << it->seqNum()
230  << " SubDet " << it->subDetector() << std::endl;
231  }
232 
233  auto const& detWithState = layer0->compatibleDets(tsos0, ANprop, estimator);
234  if (detWithState.empty()) {
235  if (debug)
236  std::cout << "no det on first layer" << layer0->seqNum() << std::endl;
237  continue;
238  }
239  tsos0 = detWithState.front().second;
240  if (debug)
241  std::cout << "arrived at " << int(detWithState.front().first->geographicalId()) << ' '
242  << tsos0.globalPosition() << ' ' << tsos0.localError().positionError() << std::endl;
243 
244  // for barrel
245  float z1l = tsos0.globalPosition().z();
246  if (goFw) {
247  loc = " Forward";
248  z1l = tsos0.globalPosition().perp();
249  }
250 
251  propagate(0, tsos0, layer0, z1l, stid0);
252 
253  } // loop on phi
254 
255  // fill
256  for (auto from = 0; from < maxLayers; ++from)
257  for (auto il = from; il < maxLayers; ++il) {
258  if (mserr[from][il].empty())
259  continue;
260  auto stid = mserr[from][il].front().stid;
261  auto lid = mserr[from][il].front().lid;
262  auto zi = mserr[from][il].front().zi;
263  float xerr = 0;
264  float zerr = 0;
265  float zo = 0;
266  for (auto const& e : mserr[from][il]) {
267  if (e.stid != stid)
268  continue;
269  lid = std::min(lid, e.lid);
270  }
271  float nn = 0;
272  for (auto const& e : mserr[from][il]) {
273  if (e.stid != stid || lid != e.lid)
274  continue;
275  xerr += e.uerr;
276  zerr += e.verr;
277  zo += e.zo;
278  ++nn;
279  }
280  xerr /= nn;
281  zerr /= nn;
282  zo /= nn;
283  auto iid = packLID(stid, lid);
284  auto& md = msParam.data[iid].data[ib].data;
285  if (md.empty() || std::abs(xerr - md.back().uerr) > 0.2f * xerr ||
286  std::abs(zerr - md.back().verr) > 0.2f * zerr)
287  md.emplace_back(Elem{zi, zo, xerr, zerr});
288  } // loop on layers
289  }
290  } // loop on z
291 
292  } // loop on tanLa
293 
294  // sort
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; });
298 
299  return product;
300 }
static GlobalError transform(const LocalError &le, const Surface &surf)
constexpr unsigned int nLmBins()
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
void zerr(int)
constexpr uint32_t maxLayers
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
ReturnType plane(const PositionType &pos, const RotationType &rot) const
Definition: PlaneBuilder.h:21
constexpr float lmBin()
Log< level::Error, false > LogError
edm::ESGetToken< Propagator, TrackingComponentsRecord > thePropagatorToken_
constexpr unsigned short packLID(unsigned int id, unsigned int od)
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
Definition: KFUpdator.cc:177
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::unique_ptr< TkMSParameterization > ReturnType
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
int seqNum() const
Definition: DetLayer.h:35
d
Definition: ztail.py:151
edm::ESGetToken< NavigationSchool, NavigationSchoolRecord > theNavSchoolToken_
#define debug
Definition: HDRShower.cc:19
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
ib
Definition: cuy.py:661
Our base class.
Definition: SiPixelRecHit.h:23

Member Data Documentation

◆ theNavSchoolToken_

edm::ESGetToken<NavigationSchool, NavigationSchoolRecord> TkMSParameterizationBuilder::theNavSchoolToken_
private

Definition at line 64 of file TkMSParameterizationBuilder.cc.

Referenced by produce(), and TkMSParameterizationBuilder().

◆ thePropagatorToken_

edm::ESGetToken<Propagator, TrackingComponentsRecord> TkMSParameterizationBuilder::thePropagatorToken_
private

Definition at line 65 of file TkMSParameterizationBuilder.cc.

Referenced by produce(), and TkMSParameterizationBuilder().