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:
36 
40 };
41 
42 using namespace edm;
43 
45  std::string myname = p.getParameter<std::string>("ComponentName");
46 
47  useLAFromDB_ = p.getParameter<bool>("useLAFromDB");
48  doLorentzFromAlignment_ = p.getParameter<bool>("doLorentzFromAlignment");
49 
50  pset_ = p;
51  auto c = setWhatProduced(this, myname);
52  magfieldToken_ = c.consumes();
53  pDDToken_ = c.consumes();
54  hTTToken_ = c.consumes();
55  templateStoreToken_ = c.consumes();
56  templateDBobjectToken_ = c.consumes();
57  templateDBobject2DToken_ = c.consumes();
58  if (useLAFromDB_ || doLorentzFromAlignment_) {
59  char const* laLabel = doLorentzFromAlignment_ ? "fromAlignment" : "";
60  lorentzAngleToken_ = c.consumes(edm::ESInputTag("", laLabel));
61  }
62 }
63 
65 
67  // templates2
69  desc.add<std::string>("ComponentName", "PixelCPEClusterRepair");
70 
71  // from PixelCPEBase
73 
74  // from PixelCPEClusterRepair
76 
77  // specific to PixelCPEClusterRepairESProducer
78  descriptions.add("_templates2_default", desc);
79 }
80 
81 std::unique_ptr<PixelClusterParameterEstimator> PixelCPEClusterRepairESProducer::produce(
82  const TkPixelCPERecord& iRecord) {
83  // Normal, default LA is used in case of template failure, load it unless
84  // turned off
85  // if turned off, null is ok, becomes zero
86  const SiPixelLorentzAngle* lorentzAngleProduct = nullptr;
87  if (useLAFromDB_ || doLorentzFromAlignment_) {
88  lorentzAngleProduct = &iRecord.get(lorentzAngleToken_);
89  }
90 
91  return std::make_unique<PixelCPEClusterRepair>(pset_,
92  &iRecord.get(magfieldToken_),
93  iRecord.get(pDDToken_),
94  iRecord.get(hTTToken_),
95  lorentzAngleProduct,
96  &iRecord.get(templateStoreToken_),
97  &iRecord.get(templateDBobjectToken_),
98  &iRecord.get(templateDBobject2DToken_));
99 }
100 
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)
edm::ESGetToken< std::vector< SiPixelTemplateStore >, SiPixelTemplateDBObjectESProducerRcd > templateStoreToken_
static void fillPSetDescription(edm::ParameterSetDescription &desc)
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pDDToken_
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
edm::ESGetToken< SiPixel2DTemplateDBObject, SiPixel2DTemplateDBObjectESProducerRcd > templateDBobject2DToken_
std::unique_ptr< PixelClusterParameterEstimator > produce(const TkPixelCPERecord &)
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