CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
templateHelper::SiPixelIDs< PayloadType, myType > Class Template Reference

#include <SiPixelTemplateHelper.h>

Inheritance diagram for templateHelper::SiPixelIDs< PayloadType, myType >:
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV > cond::payloadInspector::PlotImpl< IOV_M, 0 > cond::payloadInspector::PlotBase

Public Member Functions

bool fill () override
 
 SiPixelIDs ()
 
- Public Member Functions inherited from cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
std::shared_ptr< PayloadType > fetchPayload (const cond::Hash &payloadHash)
 
 PlotImage (const std::string &title)
 
std::string serializeData () override
 
- Public Member Functions inherited from cond::payloadInspector::PlotImpl< IOV_M, 0 >
 PlotImpl (const std::string &type, const std::string &title)
 
std::string processData () override
 
 ~PlotImpl () override=default
 
- Public Member Functions inherited from cond::payloadInspector::PlotBase
void addInputParam (const std::string &paramName)
 
std::string data () const
 
cond::persistency::Session dbSession ()
 
bool exec_process (const std::string &connectionString, const std::vector< std::tuple< std::string, cond::Time_t, cond::Time_t >> &tagsWithTimeBoundaries)
 
template<typename PayloadType >
std::shared_ptr< PayloadType > fetchPayload (const cond::Hash &payloadHash)
 
template<int index>
TagReference getTag ()
 
cond::Tag_t getTagInfo (const std::string &tag)
 
virtual void init ()
 
boost::python::list inputParams () const
 
const std::map< std::string, std::string > & inputParamValues () const
 
bool isSingleIov () const
 
bool isTwoTags () const
 
unsigned int ntags () const
 
std::string payloadType () const
 
 PlotBase ()
 
bool process (const std::string &connectionString, const boost::python::list &tagsWithTimeBoundaries)
 
void setInputParamValues (const boost::python::dict &values)
 
std::string title () const
 
std::string type () const
 
virtual ~PlotBase ()=default
 

Protected Attributes

bool isTemplate_
 
std::string label_
 
- Protected Attributes inherited from cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
std::string m_imageFileName
 
- Protected Attributes inherited from cond::payloadInspector::PlotBase
std::set< std::string > m_inputParams
 
std::map< std::string, std::string > m_inputParamValues
 
PlotAnnotations m_plotAnnotations
 
std::vector< std::pair< cond::Time_t, cond::Time_t > > m_tagBoundaries
 
std::vector< std::vector< std::tuple< cond::Time_t, cond::Hash > > > m_tagIovs
 
std::vector< std::string > m_tagNames
 

Additional Inherited Members

- Public Types inherited from cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
typedef PlotImpl< IOV_M, 0 > Base
 

Detailed Description

template<class PayloadType, SiPixelPI::DetType myType>
class templateHelper::SiPixelIDs< PayloadType, myType >

Definition at line 310 of file SiPixelTemplateHelper.h.

Constructor & Destructor Documentation

◆ SiPixelIDs()

template<class PayloadType , SiPixelPI::DetType myType>
templateHelper::SiPixelIDs< PayloadType, myType >::SiPixelIDs ( )
inline

Definition at line 312 of file SiPixelTemplateHelper.h.

312  :
313  SiPixelIDs()
314  : cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV>(
315  "SiPixelMap of Template / GenError ID Values") {
316  if constexpr (std::is_same_v<PayloadType, SiPixelGenErrorDBObject>) {
317  isTemplate_ = false;
318  label_ = "SiPixelGenErrorDBObject_PayloadInspector";
319  } else {
320  isTemplate_ = true;
321  label_ = "SiPixelTemplateDBObject_PayloadInspector";
322  }

References templateHelper::SiPixelIDs< PayloadType, myType >::isTemplate_, and templateHelper::SiPixelIDs< PayloadType, myType >::label_.

Member Function Documentation

◆ fill()

template<class PayloadType , SiPixelPI::DetType myType>
bool templateHelper::SiPixelIDs< PayloadType, myType >::fill ( )
inlineoverridevirtual

Implements cond::payloadInspector::PlotImpl< IOV_M, 0 >.

Definition at line 324 of file SiPixelTemplateHelper.h.

325  {
326  gStyle->SetPalette(kRainBow);
327 
328  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
329  auto iov = tag.iovs.front();
330  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
331 
332  std::string barrelName_ = fmt::sprintf("%sIDsBarrel", (isTemplate_ ? "template" : "genError"));
333  std::string endcapName_ = fmt::sprintf("%sIDsForward", (isTemplate_ ? "template" : "genError"));
334  std::string title_ = fmt::sprintf("%s IDs", (isTemplate_ ? "template" : "genError"));
335 
336  if (payload.get()) {
337  // Book the TH2Poly
338  Phase1PixelMaps theMaps("text");
339  if (myType == SiPixelPI::t_barrel) {
340  // book the barrel bins of the TH2Poly
341  theMaps.bookBarrelHistograms(barrelName_, title_.c_str(), title_.c_str());
342  } else if (myType == SiPixelPI::t_forward) {
343  // book the forward bins of the TH2Poly
344  theMaps.bookForwardHistograms(endcapName_, title_.c_str(), title_.c_str());
345  }
346 
347  std::map<unsigned int, short> templMap;
348  if constexpr (std::is_same_v<PayloadType, SiPixelGenErrorDBObject>) {
349  templMap = payload->getGenErrorIDs();
350  } else {
351  templMap = payload->getTemplateIDs();
352  }
353 
354  if (templMap.size() == SiPixelPI::phase0size || templMap.size() > SiPixelPI::phase1size) {
356  << "There are " << templMap.size()
357  << " DetIds in this payload. SiPixelIDs maps are not supported for non-Phase1 Pixel geometries !";
358  TCanvas canvas("Canv", "Canv", 1200, 1000);
359  SiPixelPI::displayNotSupported(canvas, templMap.size());
361  canvas.SaveAs(fileName.c_str());
362  return false;
363  } else {
364  if (templMap.size() < SiPixelPI::phase1size) {
365  edm::LogWarning(label_) << "\n ********* WARNING! ********* \n There are " << templMap.size()
366  << " DetIds in this payload !"
367  << "\n **************************** \n";
368  }
369  }
370 
371  /*
372  std::vector<unsigned int> detids;
373  std::transform(templMap.begin(),
374  templMap.end(),
375  std::back_inserter(detids),
376  [](const std::map<unsigned int, short>::value_type& pair) { return pair.first; });
377  */
378 
379  for (auto const& entry : templMap) {
380  COUT << "DetID: " << entry.first << fmt::sprintf("%s ID ", (isTemplate_ ? "Template" : "GenError"))
381  << entry.second << std::endl;
382  auto detid = DetId(entry.first);
383  if ((detid.subdetId() == PixelSubdetector::PixelBarrel) && (myType == SiPixelPI::t_barrel)) {
384  theMaps.fillBarrelBin(barrelName_, entry.first, entry.second);
385  } else if ((detid.subdetId() == PixelSubdetector::PixelEndcap) && (myType == SiPixelPI::t_forward)) {
386  theMaps.fillForwardBin(endcapName_, entry.first, entry.second);
387  }
388  }
389 
390  theMaps.beautifyAllHistograms();
391 
392  TCanvas canvas("Canv", "Canv", (myType == SiPixelPI::t_barrel) ? 1200 : 1500, 1000);
393  if (myType == SiPixelPI::t_barrel) {
394  theMaps.drawBarrelMaps(barrelName_, canvas);
395  } else if (myType == SiPixelPI::t_forward) {
396  theMaps.drawForwardMaps(endcapName_, canvas);
397  }
398 
399  canvas.cd();
400 
402  canvas.SaveAs(fileName.c_str());
403  }
404  return true;

References Phase1PixelMaps::beautifyAllHistograms(), Phase1PixelMaps::bookBarrelHistograms(), Phase1PixelMaps::bookForwardHistograms(), svgfig::canvas(), COUT, SiPixelPI::displayNotSupported(), Phase1PixelMaps::drawBarrelMaps(), Phase1PixelMaps::drawForwardMaps(), mps_splice::entry, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload(), MillePedeFileConverter_cfg::fileName, Phase1PixelMaps::fillBarrelBin(), Phase1PixelMaps::fillForwardBin(), templateHelper::SiPixelIDs< PayloadType, myType >::isTemplate_, templateHelper::SiPixelIDs< PayloadType, myType >::label_, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName, jets_cff::payload, SiPixelPI::phase0size, SiPixelPI::phase1size, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, AlCaHLTBitMon_QueryRunRegistry::string, SiPixelPI::t_barrel, SiPixelPI::t_forward, and makeGlobalPositionRcd_cfg::tag.

Member Data Documentation

◆ isTemplate_

template<class PayloadType , SiPixelPI::DetType myType>
bool templateHelper::SiPixelIDs< PayloadType, myType >::isTemplate_
protected

◆ label_

template<class PayloadType , SiPixelPI::DetType myType>
std::string templateHelper::SiPixelIDs< PayloadType, myType >::label_
protected
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName
std::string m_imageFileName
Definition: PayloadInspector.h:910
SiPixelPI::t_barrel
Definition: SiPixelPayloadInspectorHelper.h:574
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
templateHelper::SiPixelIDs::isTemplate_
bool isTemplate_
Definition: SiPixelTemplateHelper.h:407
mps_splice.entry
entry
Definition: mps_splice.py:68
templateHelper::SiPixelIDs::label_
std::string label_
Definition: SiPixelTemplateHelper.h:408
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::PlotImage
PlotImage(const std::string &title)
Definition: PayloadInspector.h:897
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
SiPixelPI::displayNotSupported
void displayNotSupported(TCanvas &canv, const unsigned int size)
Definition: SiPixelPayloadInspectorHelper.h:782
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
SiPixelPI::phase0size
static const unsigned int phase0size
Definition: SiPixelPayloadInspectorHelper.h:42
DetId
Definition: DetId.h:17
jets_cff.payload
payload
Definition: jets_cff.py:32
Phase1PixelMaps
Definition: Phase1PixelMaps.h:31
cond
Definition: plugin.cc:23
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
SiPixelPI::phase1size
static const unsigned int phase1size
Definition: SiPixelPayloadInspectorHelper.h:43
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:905
templateHelper::SiPixelIDs::SiPixelIDs
SiPixelIDs()
Definition: SiPixelTemplateHelper.h:312
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
COUT
#define COUT
Definition: PVValidationHelpers.h:13
SiPixelPI::t_forward
Definition: SiPixelPayloadInspectorHelper.h:574
cond::payloadInspector::SINGLE_IOV
Definition: PayloadInspector.h:295