CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/CalibTracker/SiPixelESProducers/plugins/SiPixelFakeLorentzAngleESSource.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    SiPixelFakeLorentzAngleESSource
00004 // Class:      SiPixelFakeLorentzAngleESSource
00005 // 
00013 //
00014 // Original Author:  Lotte Wilke
00015 //         Created:  Jan 31 2008
00016 //
00017 //
00018 
00019 // user include files
00020 
00021 #include "CalibTracker/SiPixelESProducers/interface/SiPixelFakeLorentzAngleESSource.h"
00022 #include "CalibTracker/SiPixelESProducers/interface/SiPixelDetInfoFileReader.h"
00023 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00024 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00025 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00026 //
00027 // constructors and destructor
00028 //
00029 SiPixelFakeLorentzAngleESSource::SiPixelFakeLorentzAngleESSource(const edm::ParameterSet& conf_) : fp_(conf_.getParameter<edm::FileInPath>("file"))
00030 {
00031         edm::LogInfo("SiPixelFakeLorentzAngleESSource::SiPixelFakeLorentzAngleESSource");
00032         //the following line is needed to tell the framework what
00033         // data is being produced
00034         setWhatProduced(this);
00035         findingRecord<SiPixelLorentzAngleRcd>();
00036 }
00037 
00038 SiPixelFakeLorentzAngleESSource::~SiPixelFakeLorentzAngleESSource()
00039 {
00040  
00041    // do anything here that needs to be done at desctruction time
00042    // (e.g. close files, deallocate resources etc.)
00043 
00044 }
00045 
00046 std::auto_ptr<SiPixelLorentzAngle> SiPixelFakeLorentzAngleESSource::produce(const SiPixelLorentzAngleRcd & )
00047 {
00048 
00049         using namespace edm::es;
00050         unsigned int nmodules = 0;
00051         SiPixelLorentzAngle * obj = new SiPixelLorentzAngle();
00052         SiPixelDetInfoFileReader reader(fp_.fullPath());
00053         const std::vector<uint32_t> DetIds = reader.getAllDetIds();
00054         
00055         // Loop over detectors
00056         for(std::vector<uint32_t>::const_iterator detit = DetIds.begin(); detit!=DetIds.end(); detit++) {
00057                 nmodules++;
00058                 float langle =  0.106;   
00059                 //std::cout << "detid " << (*detit) << std::endl;
00060         
00061                 if( !obj->putLorentzAngle(*detit,langle) ) edm::LogError("SiPixelFakeLorentzAngleESSource")<<"[SiPixelFakeLorentzAngleESSource::produce] detid already exists"<<std::endl;
00062         }
00063         
00064         //std::cout << "Modules = " << nmodules << std::endl;
00065 
00066         return std::auto_ptr<SiPixelLorentzAngle>(obj);
00067         
00068 
00069 }
00070 
00071 void SiPixelFakeLorentzAngleESSource::setIntervalFor( const edm::eventsetup::EventSetupRecordKey&, 
00072                                                 const edm::IOVSyncValue& iosv, 
00073                                                 edm::ValidityInterval& oValidity ) {
00074   edm::ValidityInterval infinity( iosv.beginOfTime(), iosv.endOfTime() );
00075   oValidity = infinity;  
00076 }