CalibTracker
SiPixelESProducers
plugins
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
18
#include "
FWCore/Framework/interface/ESProducer.h
"
19
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
20
#include "
FWCore/Utilities/interface/do_nothing_deleter.h
"
21
#include "
FWCore/Framework/interface/ModuleFactory.h
"
22
23
#include "
MagneticField/Engine/interface/MagneticField.h
"
24
#include "
CondFormats/SiPixelObjects/interface/SiPixel2DTemplateDBObject.h
"
25
#include "
CalibTracker/Records/interface/SiPixel2DTemplateDBObjectESProducerRcd.h
"
26
27
#include <memory>
28
29
using namespace
edm
;
30
31
class
SiPixel2DTemplateDBObjectESProducer
:
public
edm::ESProducer
{
32
public
:
33
SiPixel2DTemplateDBObjectESProducer
(
const
edm::ParameterSet
& iConfig);
34
~
SiPixel2DTemplateDBObjectESProducer
()
override
;
35
std::shared_ptr<const SiPixel2DTemplateDBObject> produce(
const
SiPixel2DTemplateDBObjectESProducerRcd
&);
36
37
private
:
38
edm::ESGetToken<MagneticField, IdealMagneticFieldRecord>
magfieldToken_
;
39
edm::ESGetToken<SiPixel2DTemplateDBObject, SiPixel2DTemplateDBObjectRcd>
dbToken_
;
40
};
41
42
SiPixel2DTemplateDBObjectESProducer::SiPixel2DTemplateDBObjectESProducer
(
const
edm::ParameterSet
& iConfig) {
43
auto
cc
= setWhatProduced(
this
);
44
magfieldToken_ =
cc
.consumes();
45
dbToken_ =
cc
.consumes(
edm::ESInputTag
{
""
,
"numerator"
});
// The correct default
46
}
47
48
SiPixel2DTemplateDBObjectESProducer::~SiPixel2DTemplateDBObjectESProducer
() {}
49
50
std::shared_ptr<const SiPixel2DTemplateDBObject>
SiPixel2DTemplateDBObjectESProducer::produce
(
51
const
SiPixel2DTemplateDBObjectESProducerRcd
& iRecord) {
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
(std::fabs(theMagField - dbobject.sVector()[22]) > 0.1)
63
edm::LogWarning
(
"UnexpectedMagneticFieldUsingNonIdealPixel2DTemplate"
)
64
<<
"Magnetic field is "
<< theMagField <<
" Template Magnetic field is "
<< dbobject.sVector()[22];
65
66
return
std::shared_ptr<const SiPixel2DTemplateDBObject>(&dbobject,
edm::do_nothing_deleter
());
67
}
68
69
DEFINE_FWK_EVENTSETUP_MODULE
(
SiPixel2DTemplateDBObjectESProducer
);
edm::ESInputTag
Definition:
ESInputTag.h:87
SiPixel2DTemplateDBObject.h
SiPixel2DTemplateDBObjectESProducer::~SiPixel2DTemplateDBObjectESProducer
~SiPixel2DTemplateDBObjectESProducer() override
Definition:
SiPixel2DTemplateDBObjectESProducer.cc:48
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::do_nothing_deleter
Definition:
do_nothing_deleter.h:34
SiPixel2DTemplateDBObjectESProducerRcd
Definition:
SiPixel2DTemplateDBObjectESProducerRcd.h:12
ESProducer.h
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition:
MessageLogger.h:122
cc
SiPixel2DTemplateDBObjectESProducer::magfieldToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
Definition:
SiPixel2DTemplateDBObjectESProducer.cc:38
Point3DBase< float, GlobalTag >
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition:
DependentRecordImplementation.h:103
SiPixel2DTemplateDBObjectESProducer::dbToken_
edm::ESGetToken< SiPixel2DTemplateDBObject, SiPixel2DTemplateDBObjectRcd > dbToken_
Definition:
SiPixel2DTemplateDBObjectESProducer.cc:39
SiPixel2DTemplateDBObjectESProducerRcd.h
edm::ParameterSet
Definition:
ParameterSet.h:47
SiPixel2DTemplateDBObjectESProducer
Definition:
SiPixel2DTemplateDBObjectESProducer.cc:31
MagneticField.h
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord >
ModuleFactory.h
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition:
ModuleFactory.h:60
SiPixel2DTemplateDBObjectESProducer::SiPixel2DTemplateDBObjectESProducer
SiPixel2DTemplateDBObjectESProducer(const edm::ParameterSet &iConfig)
Definition:
SiPixel2DTemplateDBObjectESProducer.cc:42
edm::ESProducer
Definition:
ESProducer.h:104
ParameterSet.h
SiPixel2DTemplateDBObjectESProducer::produce
std::shared_ptr< const SiPixel2DTemplateDBObject > produce(const SiPixel2DTemplateDBObjectESProducerRcd &)
Definition:
SiPixel2DTemplateDBObjectESProducer.cc:50
volumeBasedMagneticField_160812_cfi.magfield
magfield
Definition:
volumeBasedMagneticField_160812_cfi.py:11
do_nothing_deleter.h
Generated for CMSSW Reference Manual by
1.8.16