CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
SiPhase2OuterTrackerLorentzAngleWriter Class Reference

#include <CondTools/SiPhase2Tracker/plugins/SiPhase2OuterTrackerLorentzAngleWriter.cc>

Inheritance diagram for SiPhase2OuterTrackerLorentzAngleWriter:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 SiPhase2OuterTrackerLorentzAngleWriter (const edm::ParameterSet &)
 
 ~SiPhase2OuterTrackerLorentzAngleWriter () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 

Private Attributes

std::string m_record
 
std::string m_tag
 
float m_value
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Description: Put the values of the Lorentz angle for Phase-2 Outer Tracker detId in as database file

Implementation: [Notes on implementation]

Definition at line 46 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

Constructor & Destructor Documentation

◆ SiPhase2OuterTrackerLorentzAngleWriter()

SiPhase2OuterTrackerLorentzAngleWriter::SiPhase2OuterTrackerLorentzAngleWriter ( const edm::ParameterSet iConfig)
explicit

Definition at line 67 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

68  : m_record(iConfig.getParameter<std::string>("record")),
69  m_tag(iConfig.getParameter<std::string>("tag")),
70  m_value(iConfig.getParameter<double>("value")) {}

◆ ~SiPhase2OuterTrackerLorentzAngleWriter()

SiPhase2OuterTrackerLorentzAngleWriter::~SiPhase2OuterTrackerLorentzAngleWriter ( )
override

Definition at line 72 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

72  {
73  edm::LogInfo("SiPhase2OuterTrackerLorentzAngleWriter")
74  << "SiPhase2OuterTrackerLorentzAngleWriter::~SiPhase2OuterTrackerLorentzAngleWriter" << std::endl;
75 }

Member Function Documentation

◆ analyze()

void SiPhase2OuterTrackerLorentzAngleWriter::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 82 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

82  {
84  using namespace edm;
85  edm::LogInfo("SiPhase2OuterTrackerLorentzAngleWriter")
86  << "SiPhase2OuterTrackerLorentzAngleWriter::analyze " << std::endl;
87 
88  // Database services (write)
90  if (!mydbservice.isAvailable()) {
91  edm::LogWarning("SiPhase2OuterTrackerLorentzAngleWriter") << "Service is unavailable" << std::endl;
92  return;
93  }
94 
95  std::string tag = mydbservice->tag(m_record);
96  unsigned int irun = iEvent.id().run();
97  edm::LogVerbatim("SiPhase2OuterTrackerLorentzAngleWriter") << "Writing on tag : " << tag << std::endl;
98  edm::LogVerbatim("SiPhase2OuterTrackerLorentzAngleWriter") << "Usinng as IOV run : " << irun << std::endl;
99 
100  // map to be filled
101  std::unordered_map<unsigned int, float> detsLAtoDB;
102 
103  // Retrieve tracker topology from geometry
104  edm::ESHandle<TrackerTopology> tTopoHandle;
105  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
106  const TrackerTopology* const tTopo = tTopoHandle.product();
107 
108  // Retrieve old style tracker geometry from geometry
110  iSetup.get<TrackerDigiGeometryRecord>().get(pDD);
111  edm::LogInfo("SiPhase2OuterTrackerLorentzAngleWriter")
112  << " There are " << pDD->detUnits().size() << " modules in this geometry." << std::endl;
113 
114  for (auto const& det_u : pDD->detUnits()) {
115  const DetId detid = det_u->geographicalId();
116  uint32_t rawId = detid.rawId();
117  int subid = detid.subdetId();
118  if (detid.det() == DetId::Detector::Tracker) {
119  const Phase2TrackerGeomDetUnit* pixdet = dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u);
120  assert(pixdet);
121  LogDebug("SiPhase2OuterTrackerLorentzAngleWriter") << rawId << " is a " << subid << " det" << std::endl;
122  if (subid == StripSubdetector::TOB || subid == StripSubdetector::TID) {
123  LogDebug("SiPhase2OuterTrackerLorentzAngleWriter")
124  << "subdetector ID:" << subid << " layer:" << tTopo->layer(detid) << std::endl;
125  detsLAtoDB[rawId] = m_value;
126  }
127  }
128  }
129 
130  edm::LogInfo("SiPhase2OuterTrackerLorentzAngleWriter")
131  << " There are " << detsLAtoDB.size() << " OT Lorentz Angle values assigned" << std::endl;
132 
133  // SiStripLorentzAngle object
134 
135  auto lorentzAngle = std::make_unique<SiPhase2OuterTrackerLorentzAngle>();
136  lorentzAngle->putLorentzAngles(detsLAtoDB);
137  edm::LogInfo("SiPhase2OuterTrackerLorentzAngleWriter") << "currentTime " << mydbservice->currentTime() << std::endl;
138  mydbservice->writeOne(lorentzAngle.get(), mydbservice->currentTime(), m_record);
139 }

References cms::cuda::assert(), cond::service::PoolDBOutputService::currentTime(), DetId::det(), TrackerGeometry::detUnits(), edm::EventSetup::get(), get, iEvent, edm::Service< T >::isAvailable(), TrackerTopology::layer(), LogDebug, m_record, m_value, edm::ESHandle< T >::product(), DetId::rawId(), AlCaHLTBitMon_QueryRunRegistry::string, DetId::subdetId(), GlobalPosition_Frontier_DevDB_cff::tag, cond::service::PoolDBOutputService::tag(), StripSubdetector::TID, StripSubdetector::TOB, align::Tracker, and cond::service::PoolDBOutputService::writeOne().

◆ beginJob()

void SiPhase2OuterTrackerLorentzAngleWriter::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 142 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

142 {}

◆ endJob()

void SiPhase2OuterTrackerLorentzAngleWriter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 145 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

145 {}

◆ fillDescriptions()

void SiPhase2OuterTrackerLorentzAngleWriter::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 148 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

148  {
150  desc.add<std::string>("record", "SiPhase2OuterTrackerLorentzAngleRcd");
151  desc.add<std::string>("tag", "SiPhase2OuterTrackerLorentzAngle");
152  desc.add<double>("value", 0.07);
153  descriptions.addDefault(desc);
154 }

References edm::ConfigurationDescriptions::addDefault(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ m_record

std::string SiPhase2OuterTrackerLorentzAngleWriter::m_record
private

Definition at line 59 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

Referenced by analyze().

◆ m_tag

std::string SiPhase2OuterTrackerLorentzAngleWriter::m_tag
private

Definition at line 60 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

◆ m_value

float SiPhase2OuterTrackerLorentzAngleWriter::m_value
private

Definition at line 61 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

Referenced by analyze().

SiPhase2OuterTrackerLorentzAngleWriter::m_record
std::string m_record
Definition: SiPhase2OuterTrackerLorentzAngleWriter.cc:59
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
cond::service::PoolDBOutputService::tag
std::string tag(const std::string &recordName)
Definition: PoolDBOutputService.cc:124
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackerTopology
Definition: TrackerTopology.h:16
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
cms::cuda::assert
assert(be >=bs)
TrackerTopology::layer
unsigned int layer(const DetId &id) const
Definition: TrackerTopology.cc:47
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
align::Tracker
Definition: StructureType.h:70
DetId
Definition: DetId.h:17
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
SiPhase2OuterTrackerLorentzAngleWriter::m_value
float m_value
Definition: SiPhase2OuterTrackerLorentzAngleWriter.cc:61
TrackerGeometry::detUnits
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Definition: TrackerGeometry.h:61
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
edm::ESHandle< TrackerTopology >
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
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::Service< cond::service::PoolDBOutputService >
iEvent
int iEvent
Definition: GenABIO.cc:224
get
#define get
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition: PoolDBOutputService.h:63
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
SiPhase2OuterTrackerLorentzAngleWriter::m_tag
std::string m_tag
Definition: SiPhase2OuterTrackerLorentzAngleWriter.cc:60
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:217
StripSubdetector::TID
static constexpr auto TID
Definition: StripSubdetector.h:17