CMS 3D CMS Logo

PixelCPEGenericESProducer.cc
Go to the documentation of this file.
10 
15 
16 // new record
18 
19 #include <string>
20 #include <memory>
21 
23 public:
25  std::unique_ptr<PixelClusterParameterEstimator> produce(const TkPixelCPERecord&);
26  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
27 
28 private:
35 
39  std::string CPEgenericMode_; // user's choice of CPE generic
40 };
41 
42 using namespace edm;
43 
45  CPEgenericMode_ = p.getParameter<std::string>("ComponentName");
46  // Use LA-width from DB. If both (upper and this) are false LA-width is calcuated from LA-offset
47  useLAWidthFromDB_ = p.getParameter<bool>("useLAWidthFromDB");
48  // Use Alignment LA-offset
49  const bool doLorentzFromAlignment = p.getParameter<bool>("doLorentzFromAlignment");
50  char const* laLabel = ""; // standard LA, from calibration, label=""
52  laLabel = "fromAlignment";
53  }
54 
55  auto magname = p.getParameter<edm::ESInputTag>("MagneticFieldRecord");
56  UseErrorsFromTemplates_ = p.getParameter<bool>("UseErrorsFromTemplates");
57 
58  pset_ = p;
59  auto c = setWhatProduced(this, CPEgenericMode_);
60  magfieldToken_ = c.consumes(magname);
61  pDDToken_ = c.consumes();
62  hTTToken_ = c.consumes();
63  lorentzAngleToken_ = c.consumes(edm::ESInputTag("", laLabel));
64  if (useLAWidthFromDB_) {
65  lorentzAngleWidthToken_ = c.consumes(edm::ESInputTag("", "forWidth"));
66  }
67  if (UseErrorsFromTemplates_) {
68  genErrorDBObjectToken_ = c.consumes();
69  }
70 }
71 
72 std::unique_ptr<PixelClusterParameterEstimator> PixelCPEGenericESProducer::produce(const TkPixelCPERecord& iRecord) {
73  // add the new la width object
74  const SiPixelLorentzAngle* lorentzAngleWidthProduct = nullptr;
75  if (useLAWidthFromDB_) { // use the width LA
76  lorentzAngleWidthProduct = &iRecord.get(lorentzAngleWidthToken_);
77  }
78  //std::cout<<" la width "<<lorentzAngleWidthProduct<<std::endl; //dk
79 
80  const SiPixelGenErrorDBObject* genErrorDBObjectProduct = nullptr;
81 
82  // Errors take only from new GenError
83  if (UseErrorsFromTemplates_) { // do only when generrors are needed
84  genErrorDBObjectProduct = &iRecord.get(genErrorDBObjectToken_);
85  //} else {
86  //std::cout<<" pass an empty GenError pointer"<<std::endl;
87  }
88 
89  return std::make_unique<PixelCPEGeneric>(pset_,
90  &iRecord.get(magfieldToken_),
91  iRecord.get(pDDToken_),
92  iRecord.get(hTTToken_),
93  &iRecord.get(lorentzAngleToken_),
94  genErrorDBObjectProduct,
95  lorentzAngleWidthProduct);
96 }
97 
100 
101  // from PixelCPEBase
103 
104  // from PixelCPEGeneric
106 
107  // specific to PixelCPEGenericESProducer
108  desc.add<std::string>("ComponentName", "PixelCPEGeneric");
109  desc.add<edm::ESInputTag>("MagneticFieldRecord", edm::ESInputTag(""));
110  descriptions.add("_generic_default", desc);
111 }
112 
edm::ESGetToken< SiPixelLorentzAngle, SiPixelLorentzAngleRcd > lorentzAngleToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > hTTToken_
static void fillPSetDescription(edm::ParameterSetDescription &desc)
edm::ESGetToken< SiPixelLorentzAngle, SiPixelLorentzAngleRcd > lorentzAngleWidthToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pDDToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
std::unique_ptr< PixelClusterParameterEstimator > produce(const TkPixelCPERecord &)
edm::ESGetToken< SiPixelGenErrorDBObject, SiPixelGenErrorDBObjectRcd > genErrorDBObjectToken_
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
static void fillPSetDescription(edm::ParameterSetDescription &desc)
PixelCPEGenericESProducer(const edm::ParameterSet &p)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)