CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiPixelGenErrorDBObjectESProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // Package: SiPixelESProducers
3 // Class: SiPixelGenErrorDBObjectESProducer
4 // Original Author: D.Fehling
5 // Created: Tue Sep 29 14:49:31 CET 2009
6 //
7 
9 
14 
15 #include <boost/shared_ptr.hpp>
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 boost::shared_ptr<SiPixelGenErrorDBObject> SiPixelGenErrorDBObjectESProducer::produce(const SiPixelGenErrorDBObjectESProducerRcd & iRecord) {
35 
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("UnexpectedMagneticFieldUsingDefaultPixelGenError") << "Magnetic field is " << theMagField;
52  }
54  iRecord.getRecord<SiPixelGenErrorDBObjectRcd>().get(label,dbobject);
55 
56  if(std::fabs(theMagField-dbobject->sVector()[22])>0.1)
57  edm::LogWarning("UnexpectedMagneticFieldUsingNonIdealPixelGenError") << "Magnetic field is " << theMagField << " GenError Magnetic field is " << dbobject->sVector()[22];
58 
59  return boost::shared_ptr<SiPixelGenErrorDBObject>(const_cast<SiPixelGenErrorDBObject*>(&(*dbobject)), edm::do_nothing_deleter());
60 }
61 
tuple magfield
Definition: HLT_ES_cff.py:2311
SiPixelGenErrorDBObjectESProducer(const edm::ParameterSet &iConfig)
T const * product() const
Definition: ESHandle.h:86
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
boost::shared_ptr< SiPixelGenErrorDBObject > produce(const SiPixelGenErrorDBObjectESProducerRcd &)