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 useLAAlignmentOffsets = p.getParameter<bool>("useLAAlignmentOffsets");
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  c.setConsumes(magfieldToken_, magname)
60  .setConsumes(pDDToken_)
61  .setConsumes(hTTToken_)
62  .setConsumes(lorentzAngleToken_, edm::ESInputTag("", laLabel));
63  if (useLAWidthFromDB_) {
64  c.setConsumes(lorentzAngleWidthToken_, edm::ESInputTag("", "forWidth"));
65  }
66  if (UseErrorsFromTemplates_) {
67  c.setConsumes(genErrorDBObjectToken_);
68  }
69 
70  //std::cout<<" ESProducer "<<myname<<" "<<useLAWidthFromDB_<<" "<<useLAAlignmentOffsets_<<" "
71  // <<UseErrorsFromTemplates_<<std::endl; //dk
72 }
73 
74 std::unique_ptr<PixelClusterParameterEstimator> PixelCPEGenericESProducer::produce(const TkPixelCPERecord& iRecord) {
75  // add the new la width object
76  const SiPixelLorentzAngle* lorentzAngleWidthProduct = nullptr;
77  if (useLAWidthFromDB_) { // use the width LA
78  lorentzAngleWidthProduct = &iRecord.get(lorentzAngleWidthToken_);
79  }
80  //std::cout<<" la width "<<lorentzAngleWidthProduct<<std::endl; //dk
81 
82  const SiPixelGenErrorDBObject* genErrorDBObjectProduct = nullptr;
83 
84  // Errors take only from new GenError
85  if (UseErrorsFromTemplates_) { // do only when generrors are needed
86  genErrorDBObjectProduct = &iRecord.get(genErrorDBObjectToken_);
87  //} else {
88  //std::cout<<" pass an empty GenError pointer"<<std::endl;
89  }
90  return std::make_unique<PixelCPEGeneric>(pset_,
91  &iRecord.get(magfieldToken_),
92  iRecord.get(pDDToken_),
93  iRecord.get(hTTToken_),
94  &iRecord.get(lorentzAngleToken_),
95  genErrorDBObjectProduct,
96  lorentzAngleWidthProduct);
97 }
98 
101 
102  // from PixelCPEBase
104 
105  // from PixelCPEGeneric
107 
108  // specific to PixelCPEGenericESProducer
109  desc.add<std::string>("ComponentName", "PixelCPEGeneric");
110  desc.add<edm::ESInputTag>("MagneticFieldRecord", edm::ESInputTag(""));
111  desc.add<bool>("useLAAlignmentOffsets", false);
112  desc.add<bool>("DoLorentz", false);
113  descriptions.add("_generic_default", desc);
114 }
115 
edm::ESInputTag
Definition: ESInputTag.h:87
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
TrackerGeometry.h
PixelCPEGenericESProducer::hTTToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > hTTToken_
Definition: PixelCPEGenericESProducer.cc:31
ESHandle.h
HLT_2018_cff.useLAAlignmentOffsets
useLAAlignmentOffsets
Definition: HLT_2018_cff.py:6265
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
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:74
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:99
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:112
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackerDigiGeometryRecord.h
edm::ParameterSet
Definition: ParameterSet.h:36
PixelCPEGenericESProducer::pDDToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pDDToken_
Definition: PixelCPEGenericESProducer.cc:30
PixelCPEGenericESProducer::genErrorDBObjectToken_
edm::ESGetToken< SiPixelGenErrorDBObject, SiPixelGenErrorDBObjectRcd > genErrorDBObjectToken_
Definition: PixelCPEGenericESProducer.cc:34
MagneticField.h
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
PixelCPEGeneric.h
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
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:630
PixelCPEGenericESProducer::PixelCPEGenericESProducer
PixelCPEGenericESProducer(const edm::ParameterSet &p)
Definition: PixelCPEGenericESProducer.cc:43
EventSetup.h
PixelCPEBase::fillPSetDescription
static void fillPSetDescription(edm::ParameterSetDescription &desc)
Definition: PixelCPEBase.cc:465
PixelCPEGenericESProducer::magfieldToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
Definition: PixelCPEGenericESProducer.cc:29
TkPixelCPERecord.h
SiPixelGenErrorDBObject
Definition: SiPixelGenErrorDBObject.h:16
edm::ESProducer
Definition: ESProducer.h:101