Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:44:45

0001 // -*- C++ -*-
0002 //
0003 // Package:    FakeAlignmentSource
0004 // Class:      FakeAlignmentSource
0005 //
0006 /**\class FakeAlignmentSource FakeAlignmentSource.cc Alignment/FakeAlignmentProducer/plugins/FakeAlignmentSource.cc
0007 
0008 Description: Producer of fake alignment data for all geometries (currently: Tracker, DT and CSC)
0009              (including IOV, in contrast to FakeAlignmentProducer)
0010 
0011 Implementation: 
0012 The alignment objects are filled with dummy/empty data, 
0013 reconstruction Geometry should notice that and not pass to GeometryAligner.
0014 */
0015 //
0016 // Original Author:  Gero Flucke (based on FakeAlignmentProducer written by Frederic Ronga)
0017 //         Created:  June 24, 2007
0018 // $Id: FakeAlignmentSource.cc,v 1.2 2008/06/26 17:52:29 flucke Exp $
0019 //
0020 //
0021 
0022 // System
0023 #include <memory>
0024 #include <string>
0025 
0026 // Framework
0027 #include "FWCore/Framework/interface/SourceFactory.h"
0028 #include "FWCore/Framework/interface/ESProducer.h"
0029 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
0030 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0031 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0032 
0033 // Alignment
0034 #include "CondFormats/Alignment/interface/Alignments.h"
0035 #include "CondFormats/Alignment/interface/AlignmentErrorsExtended.h"
0036 #include "CondFormats/Alignment/interface/AlignmentSurfaceDeformations.h"
0037 #include "CondFormats/AlignmentRecord/interface/TrackerAlignmentRcd.h"
0038 #include "CondFormats/AlignmentRecord/interface/DTAlignmentRcd.h"
0039 #include "CondFormats/AlignmentRecord/interface/CSCAlignmentRcd.h"
0040 #include "CondFormats/AlignmentRecord/interface/TrackerAlignmentErrorExtendedRcd.h"
0041 #include "CondFormats/AlignmentRecord/interface/DTAlignmentErrorExtendedRcd.h"
0042 #include "CondFormats/AlignmentRecord/interface/CSCAlignmentErrorExtendedRcd.h"
0043 #include "CondFormats/AlignmentRecord/interface/GlobalPositionRcd.h"
0044 #include "CondFormats/AlignmentRecord/interface/TrackerSurfaceDeformationRcd.h"
0045 
0046 class FakeAlignmentSource : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder {
0047 public:
0048   FakeAlignmentSource(const edm::ParameterSet&);
0049   ~FakeAlignmentSource() override {}
0050 
0051   /// Tracker and its APE
0052   std::unique_ptr<Alignments> produceTkAli(const TrackerAlignmentRcd&) { return std::make_unique<Alignments>(); }
0053   std::unique_ptr<AlignmentErrorsExtended> produceTkAliErr(const TrackerAlignmentErrorExtendedRcd&) {
0054     return std::make_unique<AlignmentErrorsExtended>();
0055   }
0056 
0057   /// DT and its APE
0058   std::unique_ptr<Alignments> produceDTAli(const DTAlignmentRcd&) { return std::make_unique<Alignments>(); }
0059   std::unique_ptr<AlignmentErrorsExtended> produceDTAliErr(const DTAlignmentErrorExtendedRcd&) {
0060     return std::make_unique<AlignmentErrorsExtended>();
0061   }
0062 
0063   /// CSC and its APE
0064   std::unique_ptr<Alignments> produceCSCAli(const CSCAlignmentRcd&) { return std::make_unique<Alignments>(); }
0065   std::unique_ptr<AlignmentErrorsExtended> produceCSCAliErr(const CSCAlignmentErrorExtendedRcd&) {
0066     return std::make_unique<AlignmentErrorsExtended>();
0067   }
0068 
0069   /// GlobalPositions
0070   std::unique_ptr<Alignments> produceGlobals(const GlobalPositionRcd&) { return std::make_unique<Alignments>(); }
0071 
0072   /// Tracker surface deformations
0073   std::unique_ptr<AlignmentSurfaceDeformations> produceTrackerSurfaceDeformation(const TrackerSurfaceDeformationRcd&) {
0074     return std::make_unique<AlignmentSurfaceDeformations>();
0075   }
0076 
0077 protected:
0078   /// provide (dummy) IOV
0079   void setIntervalFor(const edm::eventsetup::EventSetupRecordKey& /*dummy*/,
0080                       const edm::IOVSyncValue& ioSyncVal,
0081                       edm::ValidityInterval& iov) override;
0082 
0083 private:
0084   bool produceTracker_;
0085   bool produceDT_;
0086   bool produceCSC_;
0087   bool produceGlobalPosition_;
0088   bool produceTrackerSurfaceDeformation_;
0089 };
0090 
0091 //________________________________________________________________________________________
0092 //________________________________________________________________________________________
0093 //________________________________________________________________________________________
0094 
0095 FakeAlignmentSource::FakeAlignmentSource(const edm::ParameterSet& iConfig)
0096     : produceTracker_(iConfig.getParameter<bool>("produceTracker")),
0097       produceDT_(iConfig.getParameter<bool>("produceDT")),
0098       produceCSC_(iConfig.getParameter<bool>("produceCSC")),
0099       produceGlobalPosition_(iConfig.getParameter<bool>("produceGlobalPosition")),
0100       produceTrackerSurfaceDeformation_(iConfig.getParameter<bool>("produceTrackerSurfaceDeformation")) {
0101   // This 'appendToDataLabel' is used by the framework to distinguish providers
0102   // with different settings and to request a special one by e.g.
0103   // iSetup.get<TrackerDigiGeometryRecord>().get("theLabel", tkGeomHandle);
0104 
0105   edm::LogInfo("Alignments") << "@SUB=FakeAlignmentSource"
0106                              << "Providing data with label '" << iConfig.getParameter<std::string>("appendToDataLabel")
0107                              << "'.";
0108 
0109   // Tell framework what data is produced by which method:
0110   if (produceTracker_) {
0111     this->setWhatProduced(this, &FakeAlignmentSource::produceTkAli);
0112     this->setWhatProduced(this, &FakeAlignmentSource::produceTkAliErr);
0113   }
0114   if (produceDT_) {
0115     this->setWhatProduced(this, &FakeAlignmentSource::produceDTAli);
0116     this->setWhatProduced(this, &FakeAlignmentSource::produceDTAliErr);
0117   }
0118   if (produceCSC_) {
0119     this->setWhatProduced(this, &FakeAlignmentSource::produceCSCAli);
0120     this->setWhatProduced(this, &FakeAlignmentSource::produceCSCAliErr);
0121   }
0122   if (produceGlobalPosition_) {
0123     this->setWhatProduced(this, &FakeAlignmentSource::produceGlobals);
0124   }
0125   if (produceTrackerSurfaceDeformation_) {
0126     this->setWhatProduced(this, &FakeAlignmentSource::produceTrackerSurfaceDeformation);
0127   }
0128 
0129   // Tell framework to provide IOV for the above data:
0130   if (produceTracker_) {
0131     this->findingRecord<TrackerAlignmentRcd>();
0132     this->findingRecord<TrackerAlignmentErrorExtendedRcd>();
0133   }
0134   if (produceDT_) {
0135     this->findingRecord<DTAlignmentRcd>();
0136     this->findingRecord<DTAlignmentErrorExtendedRcd>();
0137   }
0138   if (produceCSC_) {
0139     this->findingRecord<CSCAlignmentRcd>();
0140     this->findingRecord<CSCAlignmentErrorExtendedRcd>();
0141   }
0142   if (produceGlobalPosition_) {
0143     this->findingRecord<GlobalPositionRcd>();
0144   }
0145   if (produceTrackerSurfaceDeformation_) {
0146     this->findingRecord<TrackerSurfaceDeformationRcd>();
0147   }
0148 }
0149 
0150 void FakeAlignmentSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey& /*dummy*/,
0151                                          const edm::IOVSyncValue& ioSyncVal,
0152                                          edm::ValidityInterval& outValidity) {
0153   // Implementation copied from SiStripGainFakeESSource: unlimited IOV
0154   outValidity = edm::ValidityInterval(ioSyncVal.beginOfTime(), ioSyncVal.endOfTime());
0155 }
0156 
0157 //define this as a plug-in
0158 DEFINE_FWK_EVENTSETUP_SOURCE(FakeAlignmentSource);