00001
00002
00003
00004
00005
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <memory>
00025 #include <string>
00026
00027
00028 #include "FWCore/Framework/interface/SourceFactory.h"
00029 #include "FWCore/Framework/interface/ESProducer.h"
00030 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
00031 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00032
00033
00034 #include "CondFormats/Alignment/interface/Alignments.h"
00035 #include "CondFormats/Alignment/interface/AlignmentErrors.h"
00036 #include "CondFormats/AlignmentRecord/interface/TrackerAlignmentRcd.h"
00037 #include "CondFormats/AlignmentRecord/interface/DTAlignmentRcd.h"
00038 #include "CondFormats/AlignmentRecord/interface/CSCAlignmentRcd.h"
00039 #include "CondFormats/AlignmentRecord/interface/TrackerAlignmentErrorRcd.h"
00040 #include "CondFormats/AlignmentRecord/interface/DTAlignmentErrorRcd.h"
00041 #include "CondFormats/AlignmentRecord/interface/CSCAlignmentErrorRcd.h"
00042 #include "CondFormats/AlignmentRecord/interface/GlobalPositionRcd.h"
00043
00044 class FakeAlignmentSource : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder {
00045 public:
00046 FakeAlignmentSource(const edm::ParameterSet&);
00047 ~FakeAlignmentSource() {}
00048
00050 std::auto_ptr<Alignments> produceTkAli(const TrackerAlignmentRcd&) {
00051 return std::auto_ptr<Alignments>(new Alignments);
00052 }
00053 std::auto_ptr<AlignmentErrors> produceTkAliErr(const TrackerAlignmentErrorRcd&) {
00054 return std::auto_ptr<AlignmentErrors>(new AlignmentErrors);
00055 }
00056
00058 std::auto_ptr<Alignments> produceDTAli(const DTAlignmentRcd&) {
00059 return std::auto_ptr<Alignments>(new Alignments);
00060 }
00061 std::auto_ptr<AlignmentErrors> produceDTAliErr(const DTAlignmentErrorRcd&) {
00062 return std::auto_ptr<AlignmentErrors>(new AlignmentErrors);
00063 }
00064
00066 std::auto_ptr<Alignments> produceCSCAli(const CSCAlignmentRcd&) {
00067 return std::auto_ptr<Alignments>(new Alignments);
00068 }
00069 std::auto_ptr<AlignmentErrors> produceCSCAliErr(const CSCAlignmentErrorRcd&) {
00070 return std::auto_ptr<AlignmentErrors>(new AlignmentErrors);
00071 }
00072
00074 std::auto_ptr<Alignments> produceGlobals(const GlobalPositionRcd&) {
00075 return std::auto_ptr<Alignments>(new Alignments);
00076 }
00077
00078 protected:
00080 virtual void setIntervalFor( const edm::eventsetup::EventSetupRecordKey& ,
00081 const edm::IOVSyncValue& ioSyncVal, edm::ValidityInterval& iov);
00082 };
00083
00084
00085
00086
00087
00088 FakeAlignmentSource::FakeAlignmentSource(const edm::ParameterSet& iConfig)
00089 {
00090
00091
00092
00093
00094 edm::LogInfo("Alignments")
00095 << "@SUB=FakeAlignmentSource" << "Providing data with label '"
00096 << iConfig.getParameter<std::string>("appendToDataLabel") << "'.";
00097
00098
00099 this->setWhatProduced(this, &FakeAlignmentSource::produceTkAli);
00100 this->setWhatProduced(this, &FakeAlignmentSource::produceTkAliErr);
00101 this->setWhatProduced(this, &FakeAlignmentSource::produceDTAli);
00102 this->setWhatProduced(this, &FakeAlignmentSource::produceDTAliErr);
00103 this->setWhatProduced(this, &FakeAlignmentSource::produceCSCAli);
00104 this->setWhatProduced(this, &FakeAlignmentSource::produceCSCAliErr);
00105 this->setWhatProduced(this, &FakeAlignmentSource::produceGlobals);
00106
00107
00108 this->findingRecord<TrackerAlignmentRcd>();
00109 this->findingRecord<TrackerAlignmentErrorRcd>();
00110 this->findingRecord<DTAlignmentRcd>();
00111 this->findingRecord<DTAlignmentErrorRcd>();
00112 this->findingRecord<CSCAlignmentRcd>();
00113 this->findingRecord<CSCAlignmentErrorRcd>();
00114 this->findingRecord<GlobalPositionRcd>();
00115 }
00116
00117 void FakeAlignmentSource::setIntervalFor( const edm::eventsetup::EventSetupRecordKey& ,
00118 const edm::IOVSyncValue& ioSyncVal,
00119 edm::ValidityInterval& outValidity )
00120 {
00121
00122 outValidity = edm::ValidityInterval(ioSyncVal.beginOfTime(), ioSyncVal.endOfTime());
00123 }
00124
00125
00126 DEFINE_FWK_EVENTSETUP_SOURCE(FakeAlignmentSource);