CMS 3D CMS Logo

SiPixelTemplateDBObjectESProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // Package: SiPixelESProducers
3 // Class: SiPixelTemplateDBObjectESProducer
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 SiPixelTemplateDBObject> SiPixelTemplateDBObjectESProducer::produce(const SiPixelTemplateDBObjectESProducerRcd & 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 = "";
43 
44  if( theMagField>=-0.1 && theMagField<1.0 ) label = "0T";
45  else if(theMagField>=1.0 && theMagField<2.5 ) label = "2T";
46  else if(theMagField>=2.5 && theMagField<3.25) label = "3T";
47  else if(theMagField>=3.25 && theMagField<3.65) label = "35T";
48  else if(theMagField>=3.9 && theMagField<4.1 ) label = "4T";
49  else {
50  //label = "3.8T";
51  if(theMagField>=4.1 || theMagField<-0.1) edm::LogWarning("UnexpectedMagneticFieldUsingDefaultPixelTemplate") << "Magnetic field is " << theMagField;
52  }
54  iRecord.getRecord<SiPixelTemplateDBObjectRcd>().get(label,dbobject);
55 
56  if(std::fabs(theMagField-dbobject->sVector()[22])>0.1)
57  edm::LogWarning("UnexpectedMagneticFieldUsingNonIdealPixelTemplate") << "Magnetic field is " << theMagField << " Template Magnetic field is " << dbobject->sVector()[22];
58 
59  return std::shared_ptr<const SiPixelTemplateDBObject>(&(*dbobject), edm::do_nothing_deleter());
60 }
61 
SiPixelTemplateDBObjectESProducer(const edm::ParameterSet &iConfig)
char const * label
T mag() const
Definition: PV3DBase.h:67
std::shared_ptr< const SiPixelTemplateDBObject > produce(const SiPixelTemplateDBObjectESProducerRcd &)
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
HLT enums.
std::vector< float > const & sVector() const
T const * product() const
Definition: ESHandle.h:84