CMS 3D CMS Logo

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>, TkStripCPERecord>> p2OTToken_;
45 };
46 
47 namespace {
48  template <typename T, typename R>
49  void setConsumes(edm::ESConsumesCollector& iCollector,
51  std::string const& iLabel) {
52  iToken = iCollector.consumesFrom<T, R>(edm::ESInputTag("", iLabel));
53  }
54 } // namespace
55 
56 using namespace edm;
57 
59  : computeCoarseLocalPositionFromDisk_(p.getParameter<bool>("ComputeCoarseLocalPositionFromDisk")) {
60  std::string const myname = p.getParameter<std::string>("ComponentName");
61  auto c = setWhatProduced(this, myname);
62  c.setConsumes(geomToken_);
63 
64  std::string const sname = p.getParameter<std::string>("StripCPE");
65  if (sname != "Fake") {
66  setConsumes(c, spToken_, sname);
67  }
68 
69  std::string const pname = p.getParameter<std::string>("PixelCPE");
70  if (pname != "Fake") {
71  setConsumes(c, ppToken_, pname);
72  }
73 
74  auto const mname = p.getParameter<std::string>("Matcher");
75  if (mname != "Fake") {
76  setConsumes(c, mpToken_, mname);
77  }
78 
79  auto const P2otname = p.getParameter<std::string>("Phase2StripCPE");
80  if (!P2otname.empty()) {
81  setConsumes(c, p2OTToken_, P2otname);
82  }
83 }
84 
85 std::unique_ptr<TransientTrackingRecHitBuilder> TkTransientTrackingRecHitBuilderESProducer::produce(
86  const TransientRecHitRecord& iRecord) {
87  const StripClusterParameterEstimator* sp = nullptr;
88  if (spToken_) {
89  sp = &iRecord.get(*spToken_);
90  }
91 
92  const PixelClusterParameterEstimator* pp = nullptr;
93  if (ppToken_) {
94  pp = &iRecord.get(*ppToken_);
95  }
96 
97  const SiStripRecHitMatcher* mp = nullptr;
98  if (mpToken_) {
99  mp = &iRecord.get(*mpToken_);
100  }
101 
103  edm::LogWarning("TkTransientTrackingRecHitBuilderESProducer")
104  << " The tracking rec hit positions and errors are not a persistent in data formats.\n"
105  << " They are not available from disk.\n"
106  << " However, TkTransientTrackingRecHitBuilderESProducer::ComputeCoarseLocalPositionFromDisk=True \n"
107  << " will make the coarse estimation of this position/error available without track refit.\n"
108  << " Position/error obtained from rechit with already defined position/error are not recomputed.\n"
109  << " Position/error obtained from track refit are precise.";
110 
111  auto const& dd = iRecord.get(geomToken_);
112 
113  //For Phase2 upgrade
114  if (p2OTToken_) {
115  return std::make_unique<TkTransientTrackingRecHitBuilder>(&dd, pp, &iRecord.get(*p2OTToken_));
116  }
117  return std::make_unique<TkTransientTrackingRecHitBuilder>(&dd, pp, sp, mp, computeCoarseLocalPositionFromDisk_);
118 }
119 
122 
123  desc.add<std::string>("ComponentName");
124  desc.add<bool>("ComputeCoarseLocalPositionFromDisk");
125  desc.add<std::string>("StripCPE")->setComment("Using \"Fake\" disables use of StripCPE");
126  desc.add<std::string>("PixelCPE")->setComment("Using \"Fake\" disables use of PixelCPE");
127  desc.add<std::string>("Matcher")->setComment("Using \"Fake\" disables use of SiStripRecHitMatcher");
128  desc.add<std::string>("Phase2StripCPE", "")->setComment("Using empty string disables use of Phase2StripCPE");
129 
130  descriptions.addDefault(desc);
131 }
132 
TkTransientTrackingRecHitBuilderESProducer::ppToken_
std::optional< edm::ESGetToken< PixelClusterParameterEstimator, TkPixelCPERecord > > ppToken_
Definition: TkTransientTrackingRecHitBuilderESProducer.cc:40
PixelClusterParameterEstimator
Definition: PixelClusterParameterEstimator.h:15
electrons_cff.bool
bool
Definition: electrons_cff.py:372
edm::ESInputTag
Definition: ESInputTag.h:87
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MessageLogger.h
TkTransientTrackingRecHitBuilderESProducer::spToken_
std::optional< edm::ESGetToken< StripClusterParameterEstimator, TkStripCPERecord > > spToken_
Definition: TkTransientTrackingRecHitBuilderESProducer.cc:39
edm::ESConsumesCollector
Definition: ESConsumesCollector.h:58
ESHandle.h
TkTransientTrackingRecHitBuilderESProducer::geomToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
Definition: TkTransientTrackingRecHitBuilderESProducer.cc:42
TkTransientTrackingRecHitBuilderESProducer::computeCoarseLocalPositionFromDisk_
const bool computeCoarseLocalPositionFromDisk_
Definition: TkTransientTrackingRecHitBuilderESProducer.cc:44
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
TkStripCPERecord
Definition: TkStripCPERecord.h:13
TransientRecHitRecord.h
PixelClusterParameterEstimator.h
TkTransientTrackingRecHitBuilderESProducer::TkTransientTrackingRecHitBuilderESProducer
TkTransientTrackingRecHitBuilderESProducer(const edm::ParameterSet &p)
Definition: TkTransientTrackingRecHitBuilderESProducer.cc:58
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TransientRecHitRecord
Definition: TransientRecHitRecord.h:14
ESProducer.h
Types.optional
optional
Definition: Types.py:167
TrackingGeometry.h
ESGetToken.h
TkTransientTrackingRecHitBuilder.h
StripClusterParameterEstimator
Definition: StripClusterParameterEstimator.h:25
TkTransientTrackingRecHitBuilderESProducer::p2OTToken_
std::optional< edm::ESGetToken< ClusterParameterEstimator< Phase2TrackerCluster1D >, TkStripCPERecord > > p2OTToken_
Definition: TkTransientTrackingRecHitBuilderESProducer.cc:43
Phase2StripCPE.h
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:112
unpackData-CaloStage2.pname
pname
Definition: unpackData-CaloStage2.py:76
createTree.dd
string dd
Definition: createTree.py:154
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
TrackerDigiGeometryRecord.h
edm::ParameterSet
Definition: ParameterSet.h:36
TrackerCPERecord.h
TkTransientTrackingRecHitBuilderESProducer
Definition: TkTransientTrackingRecHitBuilderESProducer.cc:30
TkTransientTrackingRecHitBuilderESProducer::mpToken_
std::optional< edm::ESGetToken< SiStripRecHitMatcher, TkStripCPERecord > > mpToken_
Definition: TkTransientTrackingRecHitBuilderESProducer.cc:41
edm::ESConsumesCollector::consumesFrom
auto consumesFrom(ESInputTag const &tag)
Definition: ESConsumesCollector.h:68
MagneticField.h
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
TkTransientTrackingRecHitBuilderESProducer::produce
std::unique_ptr< TransientTrackingRecHitBuilder > produce(const TransientRecHitRecord &)
Definition: TkTransientTrackingRecHitBuilderESProducer.cc:85
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord >
SiStripRecHitMatcher.h
ModuleFactory.h
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
T
long double T
Definition: Basic3DVectorLD.h:48
EventSetup.h
StripClusterParameterEstimator.h
edm::ESProducer
Definition: ESProducer.h:101
TkTransientTrackingRecHitBuilderESProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: TkTransientTrackingRecHitBuilderESProducer.cc:120
TransientTrackingRecHitBuilder.h
ClusterParameterEstimator.h
ParameterSet.h
createTree.pp
pp
Definition: createTree.py:17
SiStripRecHitMatcher
Definition: SiStripRecHitMatcher.h:25
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
dttmaxenums::R
Definition: DTTMax.h:29