CMS 3D CMS Logo

SiPixel2DTemplateDBObjectESProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiPixel2DTemplateDBObjectESProducer
4 // Class: SiPixel2DTemplateDBObjectESProducer
5 //
12 //
13 // Original Author: D.Fehling
14 // Created: Tue Sep 29 14:49:31 CET 2009
15 //
16 //
17 
22 
26 
27 #include <memory>
28 
29 using namespace edm;
30 
32 public:
35  std::shared_ptr<const SiPixel2DTemplateDBObject> produce(const SiPixel2DTemplateDBObjectESProducerRcd&);
36 
37 private:
40 };
41 
43  auto cc = setWhatProduced(this);
44  magfieldToken_ = cc.consumes();
45  dbToken_ = cc.consumes(edm::ESInputTag{"", "numerator"}); // The correct default
46 }
47 
49 
50 std::shared_ptr<const SiPixel2DTemplateDBObject> SiPixel2DTemplateDBObjectESProducer::produce(
52  const auto& magfield = iRecord.get(magfieldToken_);
53 
54  GlobalPoint center(0.0, 0.0, 0.0);
55  float theMagField = magfield.inTesla(center).mag();
56 
57  if (theMagField >= 4.1 || theMagField < -0.1)
58  edm::LogWarning("UnexpectedMagneticFieldUsingDefaultPixel2DTemplate") << "Magnetic field is " << theMagField;
59 
60  const auto& dbobject = iRecord.get(dbToken_);
61 
62  if ((theMagField > 0.1) && (std::fabs(theMagField - dbobject.sVector()[22]) > 0.1))
63  //2D templates not actually used at 0T, so don't print warning
64  edm::LogWarning("UnexpectedMagneticFieldUsingNonIdealPixel2DTemplate")
65  << "Magnetic field is " << theMagField << " Template Magnetic field is " << dbobject.sVector()[22];
66 
67  return std::shared_ptr<const SiPixel2DTemplateDBObject>(&dbobject, edm::do_nothing_deleter());
68 }
69 
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
edm::ESGetToken< SiPixel2DTemplateDBObject, SiPixel2DTemplateDBObjectRcd > dbToken_
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
SiPixel2DTemplateDBObjectESProducer(const edm::ParameterSet &iConfig)
HLT enums.
std::shared_ptr< const SiPixel2DTemplateDBObject > produce(const SiPixel2DTemplateDBObjectESProducerRcd &)
Log< level::Warning, false > LogWarning
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const