CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
13 
14 #include <boost/shared_ptr.hpp>
15 #include "boost/mpl/vector.hpp"
18 
19 using namespace edm;
20 
22  setWhatProduced(this);
23 }
24 
25 
27 }
28 
29 
30 
31 
32 boost::shared_ptr<SiPixelTemplateDBObject> SiPixelTemplateDBObjectESProducer::produce(const SiPixelTemplateDBObjectESProducerRcd & iRecord) {
33 
35  iRecord.getRecord<IdealMagneticFieldRecord>().get(magfield);
36 
37  GlobalPoint center(0.0, 0.0, 0.0);
38  float theMagField = magfield.product()->inTesla(center).mag();
39 
40  std::string label = "";
41 
42  if( theMagField>=-0.1 && theMagField<1.0 ) label = "0T";
43  else if(theMagField>=1.0 && theMagField<2.5 ) label = "2T";
44  else if(theMagField>=2.5 && theMagField<3.25) label = "3T";
45  else if(theMagField>=3.25 && theMagField<3.65) label = "35T";
46  else if(theMagField>=3.9 && theMagField<4.1 ) label = "4T";
47  else {
48  //label = "3.8T";
49  if(theMagField>=4.1 || theMagField<-0.1) edm::LogWarning("UnexpectedMagneticFieldUsingDefaultPixelTemplate") << "Magnetic field is " << theMagField;
50  }
52  iRecord.getRecord<SiPixelTemplateDBObjectRcd>().get(label,dbobject);
53 
54  if(std::fabs(theMagField-dbobject->sVector()[22])>0.1)
55  edm::LogWarning("UnexpectedMagneticFieldUsingNonIdealPixelTemplate") << "Magnetic field is " << theMagField << " Template Magnetic field is " << dbobject->sVector()[22];
56 
57  boost::shared_ptr<SiPixelTemplateDBObject> dbptr(new SiPixelTemplateDBObject(*(dbobject)));
58  return dbptr;
59 }
60 
const std::string & label
Definition: MVAComputer.cc:186
SiPixelTemplateDBObjectESProducer(const edm::ParameterSet &iConfig)
boost::shared_ptr< SiPixelTemplateDBObject > produce(const SiPixelTemplateDBObjectESProducerRcd &)
T const * product() const
Definition: ESHandle.h:62
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:48