CMS 3D CMS Logo

FakeAlignmentSource.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    FakeAlignmentSource
00004 // Class:      FakeAlignmentSource
00005 // 
00015 //
00016 // Original Author:  Gero Flucke (based on FakeAlignmentProducer written by Frederic Ronga)
00017 //         Created:  June 24, 2007
00018 // $Id: FakeAlignmentSource.cc,v 1.2 2008/06/26 17:52:29 flucke Exp $
00019 //
00020 //
00021 
00022 
00023 // System
00024 #include <memory>
00025 #include <string>
00026 
00027 // Framework
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 // Alignment
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& /*dummy*/,
00081                                const edm::IOVSyncValue& ioSyncVal, edm::ValidityInterval& iov);
00082 };
00083 
00084 //________________________________________________________________________________________
00085 //________________________________________________________________________________________
00086 //________________________________________________________________________________________
00087 
00088 FakeAlignmentSource::FakeAlignmentSource(const edm::ParameterSet& iConfig) 
00089 {
00090   // This 'appendToDataLabel' is used by the framework to distinguish providers
00091   // with different settings and to request a special one by e.g.
00092   // iSetup.get<TrackerDigiGeometryRecord>().get("theLabel", tkGeomHandle);
00093 
00094   edm::LogInfo("Alignments") 
00095     << "@SUB=FakeAlignmentSource" << "Providing data with label '" 
00096     << iConfig.getParameter<std::string>("appendToDataLabel") << "'.";
00097 
00098   // Tell framework what data is produced by which method:
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   // Tell framework to provide IOV for the above data:
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& /*dummy*/, 
00118                                             const edm::IOVSyncValue& ioSyncVal, 
00119                                             edm::ValidityInterval& outValidity )
00120 {
00121   // Implementation copied from SiStripGainFakeESSource: unlimited IOV
00122   outValidity = edm::ValidityInterval(ioSyncVal.beginOfTime(), ioSyncVal.endOfTime());
00123 }
00124 
00125 //define this as a plug-in
00126 DEFINE_FWK_EVENTSETUP_SOURCE(FakeAlignmentSource);

Generated on Tue Jun 9 17:23:57 2009 for CMSSW by  doxygen 1.5.4