CMS 3D CMS Logo

PixelCPEClusterRepairESProducer.cc
Go to the documentation of this file.
12 
17 
18 #include <string>
19 #include <memory>
20 
22 public:
25  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
26  std::unique_ptr<PixelClusterParameterEstimator> produce(const TkPixelCPERecord&);
27 
28 private:
35 
39 };
40 
41 using namespace edm;
42 
44  std::string myname = p.getParameter<std::string>("ComponentName");
45 
46  useLAFromDB_ = p.getParameter<bool>("useLAFromDB");
47  doLorentzFromAlignment_ = p.getParameter<bool>("doLorentzFromAlignment");
48 
49  pset_ = p;
50  auto c = setWhatProduced(this, myname);
51  magfieldToken_ = c.consumes();
52  pDDToken_ = c.consumes();
53  hTTToken_ = c.consumes();
54  templateDBobjectToken_ = c.consumes();
55  templateDBobject2DToken_ = c.consumes();
56  if (useLAFromDB_ || doLorentzFromAlignment_) {
57  char const* laLabel = doLorentzFromAlignment_ ? "fromAlignment" : "";
58  lorentzAngleToken_ = c.consumes(edm::ESInputTag("", laLabel));
59  }
60 }
61 
63 
65  // templates2
67  desc.add<std::string>("ComponentName", "PixelCPEClusterRepair");
68 
69  // from PixelCPEBase
71 
72  // from PixelCPEClusterRepair
74 
75  // specific to PixelCPEClusterRepairESProducer
76  descriptions.add("_templates2_default", desc);
77 }
78 
79 std::unique_ptr<PixelClusterParameterEstimator> PixelCPEClusterRepairESProducer::produce(
80  const TkPixelCPERecord& iRecord) {
81  // Normal, default LA is used in case of template failure, load it unless
82  // turned off
83  // if turned off, null is ok, becomes zero
84  const SiPixelLorentzAngle* lorentzAngleProduct = nullptr;
85  if (useLAFromDB_ || doLorentzFromAlignment_) {
86  lorentzAngleProduct = &iRecord.get(lorentzAngleToken_);
87  }
88 
89  return std::make_unique<PixelCPEClusterRepair>(pset_,
90  &iRecord.get(magfieldToken_),
91  iRecord.get(pDDToken_),
92  iRecord.get(hTTToken_),
93  lorentzAngleProduct,
94  &iRecord.get(templateDBobjectToken_),
95  &iRecord.get(templateDBobject2DToken_));
96 }
97 
edm::ESGetToken< SiPixelTemplateDBObject, SiPixelTemplateDBObjectESProducerRcd > templateDBobjectToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > hTTToken_
edm::ESGetToken< SiPixelLorentzAngle, SiPixelLorentzAngleRcd > lorentzAngleToken_
static void fillPSetDescription(edm::ParameterSetDescription &desc)
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
PixelCPEClusterRepairESProducer(const edm::ParameterSet &p)
static void fillPSetDescription(edm::ParameterSetDescription &desc)
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pDDToken_
edm::ESGetToken< SiPixel2DTemplateDBObject, SiPixel2DTemplateDBObjectESProducerRcd > templateDBobject2DToken_
std::unique_ptr< PixelClusterParameterEstimator > produce(const TkPixelCPERecord &)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
HLT enums.
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const