CMS 3D CMS Logo

Public Member Functions

SiPixelTemplateDBObjectESProducer Class Reference

#include <CalibTracker/SiPixelESProducers/plugin/SiPixelTemplateDBObjectESProducer.cc>

Inheritance diagram for SiPixelTemplateDBObjectESProducer:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

List of all members.

Public Member Functions

boost::shared_ptr
< SiPixelTemplateDBObject
produce (const SiPixelTemplateDBObjectESProducerRcd &)
 SiPixelTemplateDBObjectESProducer (const edm::ParameterSet &iConfig)
 ~SiPixelTemplateDBObjectESProducer ()

Detailed Description

Description: ESProducer for magnetic-field-dependent local reco templates

Implementation: Used inside the RecoLocalTracker/Records/TkPixelRecord to select the correct db for given magnetic field

Definition at line 25 of file SiPixelTemplateDBObjectESProducer.h.


Constructor & Destructor Documentation

SiPixelTemplateDBObjectESProducer::SiPixelTemplateDBObjectESProducer ( const edm::ParameterSet iConfig)

Definition at line 21 of file SiPixelTemplateDBObjectESProducer.cc.

                                                                                                   {
        setWhatProduced(this);
}
SiPixelTemplateDBObjectESProducer::~SiPixelTemplateDBObjectESProducer ( )

Definition at line 26 of file SiPixelTemplateDBObjectESProducer.cc.

                                                                     {
}

Member Function Documentation

boost::shared_ptr< SiPixelTemplateDBObject > SiPixelTemplateDBObjectESProducer::produce ( const SiPixelTemplateDBObjectESProducerRcd iRecord)

Definition at line 32 of file SiPixelTemplateDBObjectESProducer.cc.

References edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), label, autoMagneticFieldProducer_cfi::magfield, and edm::ESHandle< T >::product().

                                                                                                                                        {
        
        ESHandle<MagneticField> magfield;
        iRecord.getRecord<IdealMagneticFieldRecord>().get(magfield);

        GlobalPoint center(0.0, 0.0, 0.0);
        float theMagField = magfield.product()->inTesla(center).mag();

        std::string label = "";
        
        if(     theMagField>=-0.1 && theMagField<1.0 ) label = "0T";
        else if(theMagField>=1.0  && theMagField<2.5 ) label = "2T";
        else if(theMagField>=2.5  && theMagField<3.25) label = "3T";
        else if(theMagField>=3.25 && theMagField<3.65) label = "35T";
        else if(theMagField>=3.9  && theMagField<4.1 ) label = "4T";
        else {
                //label = "3.8T";
                if(theMagField>=4.1 || theMagField<-0.1) edm::LogWarning("UnexpectedMagneticFieldUsingDefaultPixelTemplate") << "Magnetic field is " << theMagField;
        }
        ESHandle<SiPixelTemplateDBObject> dbobject;
        iRecord.getRecord<SiPixelTemplateDBObjectRcd>().get(label,dbobject);

        if(std::fabs(theMagField-dbobject->sVector()[22])>0.1)
                edm::LogWarning("UnexpectedMagneticFieldUsingNonIdealPixelTemplate") << "Magnetic field is " << theMagField << " Template Magnetic field is " << dbobject->sVector()[22];
        
        boost::shared_ptr<SiPixelTemplateDBObject> dbptr(new SiPixelTemplateDBObject(*(dbobject)));
        return dbptr;
}