CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripDetVOffTkMapPlotter Class Reference
Inheritance diagram for SiStripDetVOffTkMapPlotter:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &evt, const edm::EventSetup &evtSetup) override
 
void endJob () override
 
 SiStripDetVOffTkMapPlotter (const edm::ParameterSet &iConfig)
 
 ~SiStripDetVOffTkMapPlotter () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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)
 

Private Member Functions

std::string formatIOV (cond::Time_t iov, std::string format="%Y-%m-%d__%H_%M_%S")
 

Private Attributes

edm::ESGetToken< GeometricDet, IdealGeometryRecordgeomDetToken_
 
std::string m_condDb
 
cond::persistency::ConnectionPool m_connectionPool
 
cond::Time_t m_IOV
 
std::string m_outputFile
 
std::string m_plotFormat
 
std::string m_plotTag
 
std::string m_Time
 
edm::ESGetToken< TkDetMap, TrackerTopologyRcdtkDetMapToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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

Definition at line 22 of file SiStripDetVOffTkMapPlotter.cc.

Constructor & Destructor Documentation

◆ SiStripDetVOffTkMapPlotter()

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

◆ ~SiStripDetVOffTkMapPlotter()

SiStripDetVOffTkMapPlotter::~SiStripDetVOffTkMapPlotter ( )
override

Definition at line 63 of file SiStripDetVOffTkMapPlotter.cc.

63 {}

Member Function Documentation

◆ analyze()

void SiStripDetVOffTkMapPlotter::analyze ( const edm::Event evt,
const edm::EventSetup evtSetup 
)
overridevirtual

Implements edm::EDAnalyzer.

Definition at line 65 of file SiStripDetVOffTkMapPlotter.cc.

65  {
66  cond::Time_t theIov = 0;
67  if (m_IOV != 0) {
68  theIov = m_IOV;
69  } else if (!m_Time.empty()) {
70  theIov = cond::time::from_boost(boost::posix_time::time_from_string(m_Time));
71  } else {
72  // Use the current time if no input. Will get the last IOV.
73  theIov = cond::time::from_boost(boost::posix_time::second_clock::universal_time());
74  }
75 
76  // open db session
77  edm::LogInfo("SiStripDetVOffMapPlotter") << "[SiStripDetVOffMapPlotter::" << __func__ << "] "
78  << "Query the condition database " << m_condDb << " for tag " << m_plotTag;
80  condDbSession.transaction().start(true);
81  cond::persistency::IOVProxy iovProxy = condDbSession.readIov(m_plotTag);
82  auto iovs = iovProxy.selectAll();
83  auto iiov = iovs.find(theIov);
84  if (iiov == iovs.end())
85  throw cms::Exception("Input IOV " + std::to_string(m_IOV) + "/" + m_Time + " is invalid!");
86 
87  theIov = (*iiov).since;
88  edm::LogInfo("SiStripDetVOffMapPlotter") << "[SiStripDetVOffMapPlotter::" << __func__ << "] "
89  << "Make tkMap for IOV " << theIov << " ("
90  << boost::posix_time::to_simple_string(cond::time::to_boost(theIov)) << ")";
91  auto payload = condDbSession.fetchPayload<SiStripDetVOff>((*iiov).payloadId);
92 
93  const TkDetMap* tkDetMap = &evtSetup.getData(tkDetMapToken_);
94  TrackerMap lvmap, hvmap;
95  TkHistoMap lvhisto(tkDetMap, "LV_Status", "LV_Status", -1);
96  TkHistoMap hvhisto(tkDetMap, "HV_Status", "HV_Status", -1);
97 
98  const auto detids = TrackerGeometryUtils::getSiStripDetIds(evtSetup.getData(geomDetToken_));
99  for (auto id : detids) {
100  if (payload->IsModuleLVOff(id))
101  lvhisto.fill(id, 1); // RED
102  else
103  lvhisto.fill(id, 0.5);
104 
105  if (payload->IsModuleHVOff(id))
106  hvhisto.fill(id, 1); // RED
107  else
108  hvhisto.fill(id, 0.5);
109  }
110 
111  lvhisto.dumpInTkMap(&lvmap);
112  hvhisto.dumpInTkMap(&hvmap);
113  lvmap.setPalette(1);
114  hvmap.setPalette(1);
115  lvmap.save(true, 0, 0, "LV_tkMap_" + formatIOV(theIov) + "." + m_plotFormat);
116  hvmap.save(true, 0, 0, "HV_tkMap_" + formatIOV(theIov) + "." + m_plotFormat);
117 
118  if (!m_outputFile.empty()) {
119  lvhisto.save(m_outputFile);
120  hvhisto.save(m_outputFile);
121  }
122 }

References cond::persistency::ConnectionPool::createSession(), TkHistoMap::dumpInTkMap(), cond::persistency::Session::fetchPayload(), TkHistoMap::fill(), cond::persistency::IOVArray::find(), formatIOV(), cond::time::from_boost(), geomDetToken_, edm::EventSetup::getData(), TrackerGeometryUtils::getSiStripDetIds(), m_condDb, m_connectionPool, m_IOV, m_outputFile, m_plotFormat, m_plotTag, m_Time, jets_cff::payload, cond::persistency::Session::readIov(), TkHistoMap::save(), TrackerMap::save(), cond::persistency::IOVProxy::selectAll(), TrackerMap::setPalette(), cond::persistency::Transaction::start(), tkDetMapToken_, cond::time::to_boost(), and cond::persistency::Session::transaction().

◆ endJob()

void SiStripDetVOffTkMapPlotter::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 124 of file SiStripDetVOffTkMapPlotter.cc.

124 {}

Referenced by o2olib.O2ORunMgr::executeJob().

◆ formatIOV()

std::string SiStripDetVOffTkMapPlotter::formatIOV ( cond::Time_t  iov,
std::string  format = "%Y-%m-%d__%H_%M_%S" 
)
private

Definition at line 126 of file SiStripDetVOffTkMapPlotter.cc.

126  {
127  auto facet = new boost::posix_time::time_facet(format.c_str());
128  std::ostringstream stream;
129  stream.imbue(std::locale(stream.getloc(), facet));
131  return stream.str();
132 }

References cms::cuda::stream, and cond::time::to_boost().

Referenced by analyze().

Member Data Documentation

◆ geomDetToken_

edm::ESGetToken<GeometricDet, IdealGeometryRecord> SiStripDetVOffTkMapPlotter::geomDetToken_
private

Definition at line 46 of file SiStripDetVOffTkMapPlotter.cc.

Referenced by analyze().

◆ m_condDb

std::string SiStripDetVOffTkMapPlotter::m_condDb
private

Definition at line 33 of file SiStripDetVOffTkMapPlotter.cc.

Referenced by analyze().

◆ m_connectionPool

cond::persistency::ConnectionPool SiStripDetVOffTkMapPlotter::m_connectionPool
private

Definition at line 32 of file SiStripDetVOffTkMapPlotter.cc.

Referenced by analyze(), and SiStripDetVOffTkMapPlotter().

◆ m_IOV

cond::Time_t SiStripDetVOffTkMapPlotter::m_IOV
private

Definition at line 37 of file SiStripDetVOffTkMapPlotter.cc.

Referenced by analyze().

◆ m_outputFile

std::string SiStripDetVOffTkMapPlotter::m_outputFile
private

Definition at line 43 of file SiStripDetVOffTkMapPlotter.cc.

Referenced by analyze().

◆ m_plotFormat

std::string SiStripDetVOffTkMapPlotter::m_plotFormat
private

Definition at line 41 of file SiStripDetVOffTkMapPlotter.cc.

Referenced by analyze().

◆ m_plotTag

std::string SiStripDetVOffTkMapPlotter::m_plotTag
private

Definition at line 34 of file SiStripDetVOffTkMapPlotter.cc.

Referenced by analyze().

◆ m_Time

std::string SiStripDetVOffTkMapPlotter::m_Time
private

Definition at line 39 of file SiStripDetVOffTkMapPlotter.cc.

Referenced by analyze().

◆ tkDetMapToken_

edm::ESGetToken<TkDetMap, TrackerTopologyRcd> SiStripDetVOffTkMapPlotter::tkDetMapToken_
private

Definition at line 45 of file SiStripDetVOffTkMapPlotter.cc.

Referenced by analyze().

cond::time::to_boost
boost::posix_time::ptime to_boost(Time_t iValue)
Definition: TimeConversions.h:39
TrackerMap::setPalette
void setPalette(int numpalette)
Definition: TrackerMap.h:155
cms::cuda::stream
uint32_t const T *__restrict__ const uint32_t *__restrict__ int32_t int Histo::index_type cudaStream_t stream
Definition: HistoContainer.h:51
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
SiStripDetVOffTkMapPlotter::geomDetToken_
edm::ESGetToken< GeometricDet, IdealGeometryRecord > geomDetToken_
Definition: SiStripDetVOffTkMapPlotter.cc:46
cond::persistency::ConnectionPool::createSession
Session createSession(const std::string &connectionString, bool writeCapable=false)
Definition: ConnectionPool.cc:174
SiStripDetVOffTkMapPlotter::m_connectionPool
cond::persistency::ConnectionPool m_connectionPool
Definition: SiStripDetVOffTkMapPlotter.cc:32
cond::persistency::IOVProxy::selectAll
IOVArray selectAll()
Definition: IOVProxy.cc:181
TrackerGeometryUtils::getSiStripDetIds
std::vector< uint32_t > getSiStripDetIds(const GeometricDet &geomDet)
Definition: utils.cc:5
SiStripDetVOffTkMapPlotter::m_IOV
cond::Time_t m_IOV
Definition: SiStripDetVOffTkMapPlotter.cc:37
cond::persistency::Session::fetchPayload
std::unique_ptr< T > fetchPayload(const cond::Hash &payloadHash)
Definition: Session.h:213
cond::persistency::IOVArray::find
Iterator find(cond::Time_t time) const
Definition: IOVProxy.cc:101
SiStripDetVOffTkMapPlotter::m_plotTag
std::string m_plotTag
Definition: SiStripDetVOffTkMapPlotter.cc:34
TkDetMap
Definition: TkDetMap.h:175
jets_cff.payload
payload
Definition: jets_cff.py:32
TrackerMap
Definition: TrackerMap.h:76
cond::persistency::Session::readIov
IOVProxy readIov(const std::string &tag)
Definition: Session.cc:63
cond::persistency::IOVProxy
Definition: IOVProxy.h:92
edm::ParameterSet
Definition: ParameterSet.h:47
cond::time::from_boost
Time_t from_boost(boost::posix_time::ptime bt)
Definition: TimeConversions.h:43
cond::persistency::Session
Definition: Session.h:63
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
SiStripDetVOff
Definition: SiStripDetVOff.h:31
cond::persistency::ConnectionPool::setParameters
void setParameters(const edm::ParameterSet &connectionPset)
Definition: ConnectionPool.cc:43
cond::persistency::ConnectionPool::configure
void configure()
Definition: ConnectionPool.cc:129
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripDetVOffTkMapPlotter::m_plotFormat
std::string m_plotFormat
Definition: SiStripDetVOffTkMapPlotter.cc:41
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
TkHistoMap
Definition: TkHistoMap.h:12
SiStripDetVOffTkMapPlotter::m_condDb
std::string m_condDb
Definition: SiStripDetVOffTkMapPlotter.cc:33
cond::persistency::Session::transaction
Transaction & transaction()
Definition: Session.cc:52
cond::persistency::Transaction::start
void start(bool readOnly=true)
Definition: Session.cc:18
TrackerMap::save
void save(bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap.svg", int width=1500, int height=800)
Definition: TrackerMap.cc:810
SiStripDetVOffTkMapPlotter::m_outputFile
std::string m_outputFile
Definition: SiStripDetVOffTkMapPlotter.cc:43
format
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDConsumerBase::esConsumes
auto esConsumes()
Definition: EDConsumerBase.h:206
cms::Exception
Definition: Exception.h:70
SiStripDetVOffTkMapPlotter::m_Time
std::string m_Time
Definition: SiStripDetVOffTkMapPlotter.cc:39
SiStripDetVOffTkMapPlotter::formatIOV
std::string formatIOV(cond::Time_t iov, std::string format="%Y-%m-%d__%H_%M_%S")
Definition: SiStripDetVOffTkMapPlotter.cc:126
SiStripDetVOffTkMapPlotter::tkDetMapToken_
edm::ESGetToken< TkDetMap, TrackerTopologyRcd > tkDetMapToken_
Definition: SiStripDetVOffTkMapPlotter.cc:45