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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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
 

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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

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

◆ ~SiPhase2OuterTrackerLorentzAngleWriter()

SiPhase2OuterTrackerLorentzAngleWriter::~SiPhase2OuterTrackerLorentzAngleWriter ( )
override

Definition at line 74 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

74  {
75  edm::LogInfo("SiPhase2OuterTrackerLorentzAngleWriter")
76  << "SiPhase2OuterTrackerLorentzAngleWriter::~SiPhase2OuterTrackerLorentzAngleWriter" << std::endl;
77 }
Log< level::Info, false > LogInfo

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 84 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

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::writeOneIOV().

84  {
86  using namespace edm;
87  edm::LogInfo("SiPhase2OuterTrackerLorentzAngleWriter")
88  << "SiPhase2OuterTrackerLorentzAngleWriter::analyze " << std::endl;
89 
90  // Database services (write)
92  if (!mydbservice.isAvailable()) {
93  edm::LogWarning("SiPhase2OuterTrackerLorentzAngleWriter") << "Service is unavailable" << std::endl;
94  return;
95  }
96 
97  std::string tag = mydbservice->tag(m_record);
98  unsigned int irun = iEvent.id().run();
99  edm::LogVerbatim("SiPhase2OuterTrackerLorentzAngleWriter") << "Writing on tag : " << tag << std::endl;
100  edm::LogVerbatim("SiPhase2OuterTrackerLorentzAngleWriter") << "Usinng as IOV run : " << irun << std::endl;
101 
102  // map to be filled
103  std::unordered_map<unsigned int, float> detsLAtoDB;
104 
105  // Retrieve tracker topology from geometry
106  const TrackerTopology* const tTopo = &iSetup.getData(topoToken_);
107 
108  // Retrieve old style tracker geometry from geometry
109  const TrackerGeometry* pDD = &iSetup.getData(geomToken_);
110  edm::LogInfo("SiPhase2OuterTrackerLorentzAngleWriter")
111  << " There are " << pDD->detUnits().size() << " modules in this geometry." << std::endl;
112 
113  for (auto const& det_u : pDD->detUnits()) {
114  const DetId detid = det_u->geographicalId();
115  uint32_t rawId = detid.rawId();
116  int subid = detid.subdetId();
117  if (detid.det() == DetId::Detector::Tracker) {
118  const Phase2TrackerGeomDetUnit* pixdet = dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u);
119  assert(pixdet);
120  LogDebug("SiPhase2OuterTrackerLorentzAngleWriter") << rawId << " is a " << subid << " det" << std::endl;
121  if (subid == StripSubdetector::TOB || subid == StripSubdetector::TID) {
122  LogDebug("SiPhase2OuterTrackerLorentzAngleWriter")
123  << "subdetector ID:" << subid << " layer:" << tTopo->layer(detid) << std::endl;
124  detsLAtoDB[rawId] = m_value;
125  }
126  }
127  }
128 
129  edm::LogInfo("SiPhase2OuterTrackerLorentzAngleWriter")
130  << " There are " << detsLAtoDB.size() << " OT Lorentz Angle values assigned" << std::endl;
131 
132  // SiPhase2OuterTrackerLorentzAngle object
133  auto lorentzAngle = std::make_unique<SiPhase2OuterTrackerLorentzAngle>();
134  lorentzAngle->putLorentzAngles(detsLAtoDB);
135  edm::LogInfo("SiPhase2OuterTrackerLorentzAngleWriter") << "currentTime " << mydbservice->currentTime() << std::endl;
136  mydbservice->writeOneIOV(*lorentzAngle, mydbservice->currentTime(), m_record);
137 }
Log< level::Info, true > LogVerbatim
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
assert(be >=bs)
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
unsigned int layer(const DetId &id) const
std::string tag(const std::string &recordName)
int iEvent
Definition: GenABIO.cc:224
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
Log< level::Info, false > LogInfo
Definition: DetId.h:17
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
HLT enums.
bool isAvailable() const
Definition: Service.h:40
Log< level::Warning, false > LogWarning
static constexpr auto TID
#define LogDebug(id)

◆ fillDescriptions()

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

Definition at line 140 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

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

140  {
142  desc.setComment("Module to write SiPhase2OuterTrackerLorentzAngle Payloads");
143  desc.add<std::string>("record", "SiPhase2OuterTrackerLorentzAngleRcd")->setComment("record to write");
144  desc.add<std::string>("tag", "SiPhase2OuterTrackerLorentzAngle")->setComment("tag to write");
145  desc.add<double>("value", 0.07)->setComment("value to be put in the payload");
146  descriptions.addWithDefaultLabel(desc);
147 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ geomToken_

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

Definition at line 58 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

Referenced by analyze().

◆ 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().

◆ topoToken_

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

Definition at line 57 of file SiPhase2OuterTrackerLorentzAngleWriter.cc.

Referenced by analyze().