CMS 3D CMS Logo

SiPhase2OuterTrackerFakeLorentzAngleESSource.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiPhase2OuterTrackerFakeLorentzAngleESSource
4 // Class: SiPhase2OuterTrackerFakeLorentzAngleESSource
5 //
11 //
12 // Original Author: Marco Musich
13 // Created: Jul 31st, 2020
14 //
15 //
16 
17 // user include files
23 //
24 // constructors and destructor
25 //
27  const edm::ParameterSet& conf_)
28  : LAvalue_(conf_.getParameter<double>("LAValue")), recordName_(conf_.getParameter<std::string>("recordName")) {
29  edm::LogInfo("SiPhase2OuterTrackerFakeLorentzAngleESSource::SiPhase2OuterTrackerFakeLorentzAngleESSource");
30  // the following line is needed to tell the framework what
31  // data is being produced
32  if (recordName_ == "LorentzAngle") {
34  m_tTopoToken = cc.consumes();
35  m_geomDetToken = cc.consumes();
36  findingRecord<SiPhase2OuterTrackerLorentzAngleRcd>();
37  } else if (recordName_ == "SimLorentzAngle") {
39  m_tTopoToken = cc.consumes();
40  m_geomDetToken = cc.consumes();
41  findingRecord<SiPhase2OuterTrackerLorentzAngleSimRcd>();
42  }
43 }
44 
46 
47 namespace fakeOTLA {
48  template <class T>
49  std::unique_ptr<T> produceRecord(const float value, const GeometricDet& geomDet) {
50  using namespace edm::es;
51  T* obj = new T();
52  for (const auto detId : TrackerGeometryUtils::getOuterTrackerDetIds(geomDet)) {
53  const DetId detectorId = DetId(detId);
54  const int subDet = detectorId.subdetId();
55  if (detectorId.det() == DetId::Detector::Tracker) {
56  if (subDet == StripSubdetector::TOB || subDet == StripSubdetector::TID) {
57  if (!obj->putLorentzAngle(detId, value))
58  edm::LogError("SiPhase2OuterTrackerFakeLorentzAngleESSource")
59  << "[SiPhase2OuterTrackerFakeLorentzAngleESSource::produce] detid already exists" << std::endl;
60  } // if it's a OT DetId
61  } // check if Tracker
62  } // loop on DetIds
63  return std::unique_ptr<T>(obj);
64  }
65 } // namespace fakeOTLA
66 
67 std::unique_ptr<SiPhase2OuterTrackerLorentzAngle> SiPhase2OuterTrackerFakeLorentzAngleESSource::produceOTLA(
69  const auto& geomDet = rcd.getRecord<TrackerTopologyRcd>().get(m_geomDetToken);
70  return fakeOTLA::produceRecord<SiPhase2OuterTrackerLorentzAngle>(LAvalue_, geomDet);
71 }
72 
73 std::unique_ptr<SiPhase2OuterTrackerLorentzAngle> SiPhase2OuterTrackerFakeLorentzAngleESSource::produceOTSimLA(
75  const auto& geomDet = rcd.getRecord<TrackerTopologyRcd>().get(m_geomDetToken);
76  return fakeOTLA::produceRecord<SiPhase2OuterTrackerLorentzAngle>(LAvalue_, geomDet);
77 }
78 
80  const edm::IOVSyncValue& iosv,
81  edm::ValidityInterval& oValidity) {
83  oValidity = infinity;
84 }
85 
88  desc.add<double>("LAValue", 0.07);
89  desc.add<std::string>("recordName", "LorentzAngle");
90  descriptions.add("siPhase2OTFakeLorentzAngleESSource", desc);
91 }
92 
93 //define this as a plug-in
edm::eventsetup::DependentRecordImplementation::getRecord
const DepRecordT getRecord() const
Definition: DependentRecordImplementation.h:50
MessageLogger.h
SiPhase2OuterTrackerLorentzAngleSimRcd
Definition: SiPhase2OuterTrackerCondDataRecords.h:12
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
fakeOTLA
Definition: SiPhase2OuterTrackerFakeLorentzAngleESSource.cc:47
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::ValidityInterval
Definition: ValidityInterval.h:28
SiPhase2OuterTrackerFakeLorentzAngleESSource
Definition: SiPhase2OuterTrackerFakeLorentzAngleESSource.h:37
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
infinity
const double infinity
Definition: CSCChamberFitter.cc:10
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
align::Tracker
Definition: StructureType.h:70
DetId
Definition: DetId.h:17
fakeOTLA::produceRecord
std::unique_ptr< T > produceRecord(const float value, const GeometricDet &geomDet)
Definition: SiPhase2OuterTrackerFakeLorentzAngleESSource.cc:49
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
SiPhase2OuterTrackerFakeLorentzAngleESSource::setIntervalFor
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
Definition: SiPhase2OuterTrackerFakeLorentzAngleESSource.cc:79
TrackerGeometryUtils::getOuterTrackerDetIds
std::vector< uint32_t > getOuterTrackerDetIds(const GeometricDet &geomDet)
Definition: utils.cc:20
GeometricDet
Definition: GeometricDet.h:31
SiPhase2OuterTrackerFakeLorentzAngleESSource::~SiPhase2OuterTrackerFakeLorentzAngleESSource
~SiPhase2OuterTrackerFakeLorentzAngleESSource() override
Definition: SiPhase2OuterTrackerFakeLorentzAngleESSource.cc:45
SiPhase2OuterTrackerFakeLorentzAngleESSource::SiPhase2OuterTrackerFakeLorentzAngleESSource
SiPhase2OuterTrackerFakeLorentzAngleESSource(const edm::ParameterSet &)
Definition: SiPhase2OuterTrackerFakeLorentzAngleESSource.cc:26
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
DEFINE_FWK_EVENTSETUP_SOURCE
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:91
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SourceFactory.h
SiPhase2OuterTrackerFakeLorentzAngleESSource.h
edm::ParameterSet
Definition: ParameterSet.h:47
SiPhase2OuterTrackerFakeLorentzAngleESSource::produceOTLA
virtual std::unique_ptr< SiPhase2OuterTrackerLorentzAngle > produceOTLA(const SiPhase2OuterTrackerLorentzAngleRcd &)
Definition: SiPhase2OuterTrackerFakeLorentzAngleESSource.cc:67
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
SiPhase2OuterTrackerFakeLorentzAngleESSource::produceOTSimLA
virtual std::unique_ptr< SiPhase2OuterTrackerLorentzAngle > produceOTSimLA(const SiPhase2OuterTrackerLorentzAngleSimRcd &)
Definition: SiPhase2OuterTrackerFakeLorentzAngleESSource.cc:73
SiPhase2OuterTrackerLorentzAngleRcd
Definition: SiPhase2OuterTrackerCondDataRecords.h:9
value
Definition: value.py:1
utils.h
get
#define get
cc
SiPhase2OuterTrackerFakeLorentzAngleESSource::recordName_
const std::string recordName_
Definition: SiPhase2OuterTrackerFakeLorentzAngleESSource.h:59
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
std
Definition: JetResolutionObject.h:76
SiPhase2OuterTrackerFakeLorentzAngleESSource::m_tTopoToken
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > m_tTopoToken
Definition: SiPhase2OuterTrackerFakeLorentzAngleESSource.h:56
T
long double T
Definition: Basic3DVectorLD.h:48
PixelGeomDetUnit.h
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
edm::es
Definition: es_Label.h:33
SiPhase2OuterTrackerFakeLorentzAngleESSource::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: SiPhase2OuterTrackerFakeLorentzAngleESSource.cc:86
edm::IOVSyncValue::beginOfTime
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
SiPhase2OuterTrackerFakeLorentzAngleESSource::m_geomDetToken
edm::ESGetToken< GeometricDet, IdealGeometryRecord > m_geomDetToken
Definition: SiPhase2OuterTrackerFakeLorentzAngleESSource.h:57
edm::Log
Definition: MessageLogger.h:70
StripSubdetector.h
StripSubdetector::TID
static constexpr auto TID
Definition: StripSubdetector.h:17