CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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:
39  std::optional<edm::ESGetToken<StripClusterParameterEstimator, TkStripCPERecord>> spToken_;
40  std::optional<edm::ESGetToken<PixelClusterParameterEstimator, TkPixelCPERecord>> ppToken_;
41  std::optional<edm::ESGetToken<SiStripRecHitMatcher, TkStripCPERecord>> mpToken_;
43  std::optional<edm::ESGetToken<ClusterParameterEstimator<Phase2TrackerCluster1D>, TkPhase2OTCPERecord>> p2OTToken_;
45 };
46 
47 using namespace edm;
48 
50  : computeCoarseLocalPositionFromDisk_(p.getParameter<bool>("ComputeCoarseLocalPositionFromDisk")) {
51  std::string const myname = p.getParameter<std::string>("ComponentName");
52  auto c = setWhatProduced(this, myname);
53  geomToken_ = c.consumes();
54 
55  std::string const sname = p.getParameter<std::string>("StripCPE");
56  if (sname != "Fake") {
57  spToken_ = c.consumes(edm::ESInputTag("", sname));
58  }
59 
60  std::string const pname = p.getParameter<std::string>("PixelCPE");
61  if (pname != "Fake") {
62  ppToken_ = c.consumes(edm::ESInputTag("", pname));
63  }
64 
65  auto const mname = p.getParameter<std::string>("Matcher");
66  if (mname != "Fake") {
67  mpToken_ = c.consumes(edm::ESInputTag("", mname));
68  }
69 
70  auto const P2otname = p.getParameter<std::string>("Phase2StripCPE");
71  if (!P2otname.empty()) {
72  p2OTToken_ = c.consumes(edm::ESInputTag("", P2otname));
73  }
74 }
75 
76 std::unique_ptr<TransientTrackingRecHitBuilder> TkTransientTrackingRecHitBuilderESProducer::produce(
77  const TransientRecHitRecord& iRecord) {
78  const StripClusterParameterEstimator* sp = nullptr;
79  if (spToken_ && !p2OTToken_) { // no strips in Phase-2
80  sp = &iRecord.get(*spToken_);
81  }
82 
83  const PixelClusterParameterEstimator* pp = nullptr;
84  if (ppToken_) {
85  pp = &iRecord.get(*ppToken_);
86  }
87 
88  const SiStripRecHitMatcher* mp = nullptr;
89  if (mpToken_) {
90  mp = &iRecord.get(*mpToken_);
91  }
92 
94  edm::LogWarning("TkTransientTrackingRecHitBuilderESProducer")
95  << " The tracking rec hit positions and errors are not a persistent in data formats.\n"
96  << " They are not available from disk.\n"
97  << " However, TkTransientTrackingRecHitBuilderESProducer::ComputeCoarseLocalPositionFromDisk=True \n"
98  << " will make the coarse estimation of this position/error available without track refit.\n"
99  << " Position/error obtained from rechit with already defined position/error are not recomputed.\n"
100  << " Position/error obtained from track refit are precise.";
101 
102  auto const& dd = iRecord.get(geomToken_);
103 
104  //For Phase2 upgrade
105  if (p2OTToken_) {
106  return std::make_unique<TkTransientTrackingRecHitBuilder>(&dd, pp, &iRecord.get(*p2OTToken_));
107  }
108  return std::make_unique<TkTransientTrackingRecHitBuilder>(&dd, pp, sp, mp, computeCoarseLocalPositionFromDisk_);
109 }
110 
113  desc.add<std::string>("ComponentName", "Fake");
114  desc.add<bool>("ComputeCoarseLocalPositionFromDisk", false);
115  desc.add<std::string>("StripCPE", "Fake")->setComment("Using \"Fake\" disables use of StripCPE");
116  desc.add<std::string>("PixelCPE", "Fake")->setComment("Using \"Fake\" disables use of PixelCPE");
117  desc.add<std::string>("Matcher", "Fake")->setComment("Using \"Fake\" disables use of SiStripRecHitMatcher");
118  desc.add<std::string>("Phase2StripCPE", "")->setComment("Using empty string disables use of Phase2StripCPE");
119  descriptions.addWithDefaultLabel(desc);
120 }
121 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
const edm::EventSetup & c
tuple pp
Definition: createTree.py:17
std::optional< edm::ESGetToken< SiStripRecHitMatcher, TkStripCPERecord > > mpToken_
std::unique_ptr< TransientTrackingRecHitBuilder > produce(const TransientRecHitRecord &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::optional< edm::ESGetToken< PixelClusterParameterEstimator, TkPixelCPERecord > > ppToken_
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
Log< level::Warning, false > LogWarning
std::optional< edm::ESGetToken< StripClusterParameterEstimator, TkStripCPERecord > > spToken_
std::optional< edm::ESGetToken< ClusterParameterEstimator< Phase2TrackerCluster1D >, TkPhase2OTCPERecord > > p2OTToken_