CMS 3D CMS Logo

SiPixel2DTemplateDBObjectESProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // Package: SiPixelESProducers
3 // Class: SiPixel2DTemplateDBObjectESProducer
4 // Original Author: D.Fehling
5 // Created: Tue Sep 29 14:49:31 CET 2009
6 //
7 
9 
14 
15 #include <memory>
16 #include "boost/mpl/vector.hpp"
17 
20 
21 using namespace edm;
22 
24  setWhatProduced(this);
25 }
26 
27 
29 }
30 
31 
32 
33 
34 std::shared_ptr<const SiPixel2DTemplateDBObject> SiPixel2DTemplateDBObjectESProducer::produce(const SiPixel2DTemplateDBObjectESProducerRcd & iRecord) {
35 
36  ESHandle<MagneticField> magfield;
37  iRecord.getRecord<IdealMagneticFieldRecord>().get(magfield);
38 
39  GlobalPoint center(0.0, 0.0, 0.0);
40  float theMagField = magfield.product()->inTesla(center).mag();
41 
42  std::string label = "numerator"; // The correct default
43  if(theMagField>=4.1 || theMagField<-0.1) edm::LogWarning("UnexpectedMagneticFieldUsingDefaultPixel2DTemplate") << "Magnetic field is " << theMagField;
44 
46  iRecord.getRecord<SiPixel2DTemplateDBObjectRcd>().get(label,dbobject);
47 
48  if(std::fabs(theMagField-dbobject->sVector()[22])>0.1)
49  edm::LogWarning("UnexpectedMagneticFieldUsingNonIdealPixel2DTemplate") << "Magnetic field is " << theMagField << " Template Magnetic field is " << dbobject->sVector()[22];
50 
51  return std::shared_ptr<const SiPixel2DTemplateDBObject>(&(*dbobject), edm::do_nothing_deleter());
52 }
53 
std::vector< float > sVector() const
char const * label
T mag() const
Definition: PV3DBase.h:67
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
SiPixel2DTemplateDBObjectESProducer(const edm::ParameterSet &iConfig)
HLT enums.
std::shared_ptr< const SiPixel2DTemplateDBObject > produce(const SiPixel2DTemplateDBObjectESProducerRcd &)
T const * product() const
Definition: ESHandle.h:86