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
 
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)
 

Private Member Functions

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

Private Attributes

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
 

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 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>
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)
 
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 58 of file SiStripDetVOffTkMapPlotter.cc.

58 {}

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 60 of file SiStripDetVOffTkMapPlotter.cc.

60  {
61  cond::Time_t theIov = 0;
62  if (m_IOV != 0) {
63  theIov = m_IOV;
64  } else if (!m_Time.empty()) {
65  theIov = cond::time::from_boost(boost::posix_time::time_from_string(m_Time));
66  } else {
67  // Use the current time if no input. Will get the last IOV.
68  theIov = cond::time::from_boost(boost::posix_time::second_clock::universal_time());
69  }
70 
71  // open db session
72  edm::LogInfo("SiStripDetVOffMapPlotter") << "[SiStripDetVOffMapPlotter::" << __func__ << "] "
73  << "Query the condition database " << m_condDb << " for tag " << m_plotTag;
75  condDbSession.transaction().start(true);
76  cond::persistency::IOVProxy iovProxy = condDbSession.readIov(m_plotTag);
77  auto iovs = iovProxy.selectAll();
78  auto iiov = iovs.find(theIov);
79  if (iiov == iovs.end())
80  throw cms::Exception("Input IOV " + std::to_string(m_IOV) + "/" + m_Time + " is invalid!");
81 
82  theIov = (*iiov).since;
83  edm::LogInfo("SiStripDetVOffMapPlotter") << "[SiStripDetVOffMapPlotter::" << __func__ << "] "
84  << "Make tkMap for IOV " << theIov << " ("
85  << boost::posix_time::to_simple_string(cond::time::to_boost(theIov)) << ")";
86  auto payload = condDbSession.fetchPayload<SiStripDetVOff>((*iiov).payloadId);
87 
88  edm::ESHandle<TkDetMap> tkDetMapHandle;
89  evtSetup.get<TrackerTopologyRcd>().get(tkDetMapHandle);
90  const TkDetMap* tkDetMap = tkDetMapHandle.product();
91  TrackerMap lvmap, hvmap;
92  TkHistoMap lvhisto(tkDetMap, "LV_Status", "LV_Status", -1);
93  TkHistoMap hvhisto(tkDetMap, "HV_Status", "HV_Status", -1);
94 
95  edm::ESHandle<GeometricDet> geomDetHandle;
96  evtSetup.get<IdealGeometryRecord>().get(geomDetHandle);
97 
98  const auto detids = TrackerGeometryUtils::getSiStripDetIds(*geomDetHandle);
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(), edm::EventSetup::get(), get, 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(), 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

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

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
cudaStream_t stream
Definition: HistoContainer.h:57
edm::LogInfo
Definition: MessageLogger.h:254
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
cond::persistency::ConnectionPool::createSession
Session createSession(const std::string &connectionString, bool writeCapable=false)
Definition: ConnectionPool.cc:158
SiStripDetVOffTkMapPlotter::m_connectionPool
cond::persistency::ConnectionPool m_connectionPool
Definition: SiStripDetVOffTkMapPlotter.cc:32
cond::persistency::IOVProxy::selectAll
IOVArray selectAll()
Definition: IOVProxy.cc:171
TrackerGeometryUtils::getSiStripDetIds
std::vector< uint32_t > getSiStripDetIds(const GeometricDet &geomDet)
Definition: utils.cc:4
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:93
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
SiStripDetVOffTkMapPlotter::m_plotTag
std::string m_plotTag
Definition: SiStripDetVOffTkMapPlotter.cc:34
edm::ESHandle
Definition: DTSurvey.h:22
TkDetMap
Definition: TkDetMap.h:175
jets_cff.payload
payload
Definition: jets_cff.py:34
TrackerMap
Definition: TrackerMap.h:76
cond::persistency::Session::readIov
IOVProxy readIov(const std::string &tag)
Definition: Session.cc:63
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::persistency::IOVProxy
Definition: IOVProxy.h:92
edm::ParameterSet
Definition: ParameterSet.h:36
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:39
cond::persistency::ConnectionPool::configure
void configure()
Definition: ConnectionPool.cc:125
get
#define get
SiStripDetVOffTkMapPlotter::m_plotFormat
std::string m_plotFormat
Definition: SiStripDetVOffTkMapPlotter.cc:41
TkHistoMap
Definition: TkHistoMap.h:12
SiStripDetVOffTkMapPlotter::m_condDb
std::string m_condDb
Definition: SiStripDetVOffTkMapPlotter.cc:33
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
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
cms::Exception
Definition: Exception.h:70
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
IdealGeometryRecord
Definition: IdealGeometryRecord.h:27
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