CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
TkTransientTrackingRecHitBuilderESProducer.cc
Go to the documentation of this file.
13 
16 
18 
23 
24 #include <string>
25 #include <memory>
26 #include <optional>
27 
29 
31 public:
33 
34  std::unique_ptr<TransientTrackingRecHitBuilder> produce(const TransientRecHitRecord&);
35 
36  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
37 
38 private:
40  std::optional<edm::ESGetToken<StripClusterParameterEstimator, TkStripCPERecord>> spToken_;
41  std::optional<edm::ESGetToken<PixelClusterParameterEstimator, TkPixelCPERecord>> ppToken_;
42  std::optional<edm::ESGetToken<SiStripRecHitMatcher, TkStripCPERecord>> mpToken_;
44  std::optional<edm::ESGetToken<ClusterParameterEstimator<Phase2TrackerCluster1D>, TkPhase2OTCPERecord>> p2OTToken_;
46 };
47 
48 using namespace edm;
49 
51  : pname_(p.getParameter<std::string>("PixelCPE")),
52  computeCoarseLocalPositionFromDisk_(p.getParameter<bool>("ComputeCoarseLocalPositionFromDisk")) {
53  std::string const myname = p.getParameter<std::string>("ComponentName");
54  auto c = setWhatProduced(this, myname);
55  geomToken_ = c.consumes();
56 
57  std::string const sname = p.getParameter<std::string>("StripCPE");
58  if (sname != "Fake") {
59  spToken_ = c.consumes(edm::ESInputTag("", sname));
60  }
61 
62  if (pname_ != "Fake") {
63  ppToken_ = c.consumes(edm::ESInputTag("", pname_));
64  }
65 
66  auto const mname = p.getParameter<std::string>("Matcher");
67  if (mname != "Fake") {
68  mpToken_ = c.consumes(edm::ESInputTag("", mname));
69  }
70 
71  auto const P2otname = p.getParameter<std::string>("Phase2StripCPE");
72  if (!P2otname.empty()) {
73  p2OTToken_ = c.consumes(edm::ESInputTag("", P2otname));
74  }
75 }
76 
77 std::unique_ptr<TransientTrackingRecHitBuilder> TkTransientTrackingRecHitBuilderESProducer::produce(
78  const TransientRecHitRecord& iRecord) {
79  if (pname_ == "PixelCPEFast") {
80  edm::LogWarning("TkTransientTrackingRecHitBuilderESProducer")
81  << "\n\t\t WARNING!\n 'PixelCPEFast' has been chosen as PixelCPE choice.\n"
82  << " Track angles will NOT be used in the CPE estimation!\n";
83  }
84 
85  const StripClusterParameterEstimator* sp = nullptr;
86  if (spToken_ && !p2OTToken_) { // no strips in Phase-2
87  sp = &iRecord.get(*spToken_);
88  }
89 
90  const PixelClusterParameterEstimator* pp = nullptr;
91  if (ppToken_) {
92  pp = &iRecord.get(*ppToken_);
93  }
94 
95  const SiStripRecHitMatcher* mp = nullptr;
96  if (mpToken_) {
97  mp = &iRecord.get(*mpToken_);
98  }
99 
101  edm::LogWarning("TkTransientTrackingRecHitBuilderESProducer")
102  << " The tracking rec hit positions and errors are not a persistent in data formats.\n"
103  << " They are not available from disk.\n"
104  << " However, TkTransientTrackingRecHitBuilderESProducer::ComputeCoarseLocalPositionFromDisk=True \n"
105  << " will make the coarse estimation of this position/error available without track refit.\n"
106  << " Position/error obtained from rechit with already defined position/error are not recomputed.\n"
107  << " Position/error obtained from track refit are precise.";
108 
109  auto const& dd = iRecord.get(geomToken_);
110 
111  //For Phase2 upgrade
112  if (p2OTToken_) {
113  return std::make_unique<TkTransientTrackingRecHitBuilder>(&dd, pp, &iRecord.get(*p2OTToken_));
114  }
115  return std::make_unique<TkTransientTrackingRecHitBuilder>(&dd, pp, sp, mp, computeCoarseLocalPositionFromDisk_);
116 }
117 
120  desc.add<std::string>("ComponentName", "Fake");
121  desc.add<bool>("ComputeCoarseLocalPositionFromDisk", false);
122  desc.add<std::string>("StripCPE", "Fake")->setComment("Using \"Fake\" disables use of StripCPE");
123  desc.add<std::string>("PixelCPE", "Fake")->setComment("Using \"Fake\" disables use of PixelCPE");
124  desc.add<std::string>("Matcher", "Fake")->setComment("Using \"Fake\" disables use of SiStripRecHitMatcher");
125  desc.add<std::string>("Phase2StripCPE", "")->setComment("Using empty string disables use of Phase2StripCPE");
126  descriptions.addWithDefaultLabel(desc);
127 }
128 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
std::optional< edm::ESGetToken< SiStripRecHitMatcher, TkStripCPERecord > > mpToken_
std::unique_ptr< TransientTrackingRecHitBuilder > produce(const TransientRecHitRecord &)
string dd
Definition: createTree.py:154
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::optional< edm::ESGetToken< PixelClusterParameterEstimator, TkPixelCPERecord > > ppToken_
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
HLT enums.
Log< level::Warning, false > LogWarning
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
std::optional< edm::ESGetToken< StripClusterParameterEstimator, TkStripCPERecord > > spToken_
std::optional< edm::ESGetToken< ClusterParameterEstimator< Phase2TrackerCluster1D >, TkPhase2OTCPERecord > > p2OTToken_