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 };
40 
41 using namespace edm;
42 
44  std::string myname = p.getParameter<std::string>("ComponentName");
45  // Use LA-width from DB. If both (upper and this) are false LA-width is calcuated from LA-offset
46  useLAWidthFromDB_ = p.getParameter<bool>("useLAWidthFromDB");
47  // Use Alignment LA-offset
48  const bool doLorentzFromAlignment = p.getParameter<bool>("doLorentzFromAlignment");
49  char const* laLabel = ""; // standard LA, from calibration, label=""
51  laLabel = "fromAlignment";
52  }
53 
54  auto magname = p.getParameter<edm::ESInputTag>("MagneticFieldRecord");
55  UseErrorsFromTemplates_ = p.getParameter<bool>("UseErrorsFromTemplates");
56 
57  pset_ = p;
58  auto c = setWhatProduced(this, myname);
59  magfieldToken_ = c.consumes(magname);
60  pDDToken_ = c.consumes();
61  hTTToken_ = c.consumes();
62  lorentzAngleToken_ = c.consumes(edm::ESInputTag("", laLabel));
63  if (useLAWidthFromDB_) {
64  lorentzAngleWidthToken_ = c.consumes(edm::ESInputTag("", "forWidth"));
65  }
66  if (UseErrorsFromTemplates_) {
67  genErrorDBObjectToken_ = c.consumes();
68  }
69 }
70 
71 std::unique_ptr<PixelClusterParameterEstimator> PixelCPEGenericESProducer::produce(const TkPixelCPERecord& iRecord) {
72  // add the new la width object
73  const SiPixelLorentzAngle* lorentzAngleWidthProduct = nullptr;
74  if (useLAWidthFromDB_) { // use the width LA
75  lorentzAngleWidthProduct = &iRecord.get(lorentzAngleWidthToken_);
76  }
77  //std::cout<<" la width "<<lorentzAngleWidthProduct<<std::endl; //dk
78 
79  const SiPixelGenErrorDBObject* genErrorDBObjectProduct = nullptr;
80 
81  // Errors take only from new GenError
82  if (UseErrorsFromTemplates_) { // do only when generrors are needed
83  genErrorDBObjectProduct = &iRecord.get(genErrorDBObjectToken_);
84  //} else {
85  //std::cout<<" pass an empty GenError pointer"<<std::endl;
86  }
87  return std::make_unique<PixelCPEGeneric>(pset_,
88  &iRecord.get(magfieldToken_),
89  iRecord.get(pDDToken_),
90  iRecord.get(hTTToken_),
91  &iRecord.get(lorentzAngleToken_),
92  genErrorDBObjectProduct,
93  lorentzAngleWidthProduct);
94 }
95 
98 
99  // from PixelCPEBase
101 
102  // from PixelCPEGeneric
104 
105  // specific to PixelCPEGenericESProducer
106  desc.add<std::string>("ComponentName", "PixelCPEGeneric");
107  desc.add<edm::ESInputTag>("MagneticFieldRecord", edm::ESInputTag(""));
108  descriptions.add("_generic_default", desc);
109 }
110 
edm::ESInputTag
Definition: ESInputTag.h:87
TrackerGeometry.h
PixelCPEGenericESProducer::hTTToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > hTTToken_
Definition: PixelCPEGenericESProducer.cc:31
ESHandle.h
edm
HLT enums.
Definition: AlignableModifier.h:19
PixelClusterParameterEstimator.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
PixelCPEGenericESProducer::UseErrorsFromTemplates_
bool UseErrorsFromTemplates_
Definition: PixelCPEGenericESProducer.cc:38
ESProducer.h
TkPixelCPERecord
Definition: TkPixelCPERecord.h:18
PixelCPEGenericESProducer::lorentzAngleToken_
edm::ESGetToken< SiPixelLorentzAngle, SiPixelLorentzAngleRcd > lorentzAngleToken_
Definition: PixelCPEGenericESProducer.cc:32
PixelCPEGeneric_cfi.PixelCPEGenericESProducer
PixelCPEGenericESProducer
Definition: PixelCPEGeneric_cfi.py:4
TrackerTopology.h
TrackerTopologyRcd.h
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
PixelCPEGenericESProducer::produce
std::unique_ptr< PixelClusterParameterEstimator > produce(const TkPixelCPERecord &)
Definition: PixelCPEGenericESProducer.cc:71
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
SiPixelLorentzAngle
Definition: SiPixelLorentzAngle.h:11
IdealMagneticFieldRecord.h
PixelCPEGenericESProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: PixelCPEGenericESProducer.cc:96
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:109
HLT_FULL_cff.doLorentzFromAlignment
doLorentzFromAlignment
Definition: HLT_FULL_cff.py:7587
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
TrackerDigiGeometryRecord.h
edm::ParameterSet
Definition: ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
PixelCPEGenericESProducer::pDDToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pDDToken_
Definition: PixelCPEGenericESProducer.cc:30
PixelCPEGenericESProducer::genErrorDBObjectToken_
edm::ESGetToken< SiPixelGenErrorDBObject, SiPixelGenErrorDBObjectRcd > genErrorDBObjectToken_
Definition: PixelCPEGenericESProducer.cc:34
MagneticField.h
PixelCPEGeneric.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord >
PixelCPEGenericESProducer::useLAWidthFromDB_
bool useLAWidthFromDB_
Definition: PixelCPEGenericESProducer.cc:37
SiPixelGenErrorDBObjectRcd.h
PixelCPEGenericESProducer::pset_
edm::ParameterSet pset_
Definition: PixelCPEGenericESProducer.cc:36
ModuleFactory.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
PixelCPEGenericESProducer::lorentzAngleWidthToken_
edm::ESGetToken< SiPixelLorentzAngle, SiPixelLorentzAngleRcd > lorentzAngleWidthToken_
Definition: PixelCPEGenericESProducer.cc:33
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
PixelCPEGeneric::fillPSetDescription
static void fillPSetDescription(edm::ParameterSetDescription &desc)
Definition: PixelCPEGeneric.cc:439
PixelCPEGenericESProducer::PixelCPEGenericESProducer
PixelCPEGenericESProducer(const edm::ParameterSet &p)
Definition: PixelCPEGenericESProducer.cc:43
EventSetup.h
PixelCPEBase::fillPSetDescription
static void fillPSetDescription(edm::ParameterSetDescription &desc)
Definition: PixelCPEBase.cc:467
PixelCPEGenericESProducer::magfieldToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
Definition: PixelCPEGenericESProducer.cc:29
TkPixelCPERecord.h
SiPixelGenErrorDBObject
Definition: SiPixelGenErrorDBObject.h:16
edm::ESProducer
Definition: ESProducer.h:104
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56