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
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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

const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordgeomToken_
 
std::string m_record
 
std::string m_tag
 
float m_value
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtopoToken_
 

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 69 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

72  m_record(iConfig.getParameter<std::string>("record")),
73  m_tag(iConfig.getParameter<std::string>("tag")),
74  m_value(iConfig.getParameter<double>("value")) {}

◆ ~SiPhase2OuterTrackerLorentzAngleWriter()

SiPhase2OuterTrackerLorentzAngleWriter::~SiPhase2OuterTrackerLorentzAngleWriter ( )
override

Definition at line 76 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

76  {
77  edm::LogInfo("SiPhase2OuterTrackerLorentzAngleWriter")
78  << "SiPhase2OuterTrackerLorentzAngleWriter::~SiPhase2OuterTrackerLorentzAngleWriter" << std::endl;
79 }

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 86 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

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

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

◆ beginJob()

void SiPhase2OuterTrackerLorentzAngleWriter::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 143 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

143 {}

◆ endJob()

void SiPhase2OuterTrackerLorentzAngleWriter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 146 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

146 {}

◆ fillDescriptions()

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

Definition at line 149 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

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

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

Member Data Documentation

◆ geomToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiPhase2OuterTrackerLorentzAngleWriter::geomToken_
private

Definition at line 60 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

Referenced by analyze().

◆ m_record

std::string SiPhase2OuterTrackerLorentzAngleWriter::m_record
private

Definition at line 61 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

Referenced by analyze().

◆ m_tag

std::string SiPhase2OuterTrackerLorentzAngleWriter::m_tag
private

Definition at line 62 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

◆ m_value

float SiPhase2OuterTrackerLorentzAngleWriter::m_value
private

Definition at line 63 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

Referenced by analyze().

◆ topoToken_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiPhase2OuterTrackerLorentzAngleWriter::topoToken_
private

Definition at line 59 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

Referenced by analyze().

SiPhase2OuterTrackerLorentzAngleWriter::m_record
std::string m_record
Definition: SiPhase2OuterTrackerLorentzAngleWriter.cc:61
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
SiPhase2OuterTrackerLorentzAngleWriter::geomToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
Definition: SiPhase2OuterTrackerLorentzAngleWriter.cc:60
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
SiPhase2OuterTrackerLorentzAngleWriter::m_value
float m_value
Definition: SiPhase2OuterTrackerLorentzAngleWriter.cc:63
TrackerGeometry::detUnits
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Definition: TrackerGeometry.h:61
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
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
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
edm::Service< cond::service::PoolDBOutputService >
iEvent
int iEvent
Definition: GenABIO.cc:224
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
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
edm::EDConsumerBase::esConsumes
auto esConsumes()
Definition: EDConsumerBase.h:206
SiPhase2OuterTrackerLorentzAngleWriter::topoToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
Definition: SiPhase2OuterTrackerLorentzAngleWriter.cc:59
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
SiPhase2OuterTrackerLorentzAngleWriter::m_tag
std::string m_tag
Definition: SiPhase2OuterTrackerLorentzAngleWriter.cc:62
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:217
StripSubdetector::TID
static constexpr auto TID
Definition: StripSubdetector.h:17
TrackerGeometry
Definition: TrackerGeometry.h:14