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  theMaps.bookBarrelHistograms(barrelName_, title_.c_str(), title_.c_str());
341  // book the barrel bins of the TH2Poly
342  theMaps.bookBarrelBins(barrelName_);
343  } else if (myType == SiPixelPI::t_forward) {
344  theMaps.bookForwardHistograms(endcapName_, title_.c_str(), title_.c_str());
345  // book the forward bins of the TH2Poly
346  theMaps.bookForwardBins(endcapName_);
347  }
348 
349  std::map<unsigned int, short> templMap;
350  if constexpr (std::is_same_v<PayloadType, SiPixelGenErrorDBObject>) {
351  templMap = payload->getGenErrorIDs();
352  } else {
353  templMap = payload->getTemplateIDs();
354  }
355 
356  if (templMap.size() == SiPixelPI::phase0size || templMap.size() > SiPixelPI::phase1size) {
358  << "There are " << templMap.size()
359  << " DetIds in this payload. SiPixelIDs maps are not supported for non-Phase1 Pixel geometries !";
360  TCanvas canvas("Canv", "Canv", 1200, 1000);
361  SiPixelPI::displayNotSupported(canvas, templMap.size());
363  canvas.SaveAs(fileName.c_str());
364  return false;
365  } else {
366  if (templMap.size() < SiPixelPI::phase1size) {
367  edm::LogWarning(label_) << "\n ********* WARNING! ********* \n There are " << templMap.size()
368  << " DetIds in this payload !"
369  << "\n **************************** \n";
370  }
371  }
372 
373  /*
374  std::vector<unsigned int> detids;
375  std::transform(templMap.begin(),
376  templMap.end(),
377  std::back_inserter(detids),
378  [](const std::map<unsigned int, short>::value_type& pair) { return pair.first; });
379  */
380 
381  for (auto const& entry : templMap) {
382  COUT << "DetID: " << entry.first << fmt::sprintf("%s ID ", (isTemplate_ ? "Template" : "GenError"))
383  << entry.second << std::endl;
384  auto detid = DetId(entry.first);
385  if ((detid.subdetId() == PixelSubdetector::PixelBarrel) && (myType == SiPixelPI::t_barrel)) {
386  theMaps.fillBarrelBin(barrelName_, entry.first, entry.second);
387  } else if ((detid.subdetId() == PixelSubdetector::PixelEndcap) && (myType == SiPixelPI::t_forward)) {
388  theMaps.fillForwardBin(endcapName_, entry.first, entry.second);
389  }
390  }
391 
392  theMaps.beautifyAllHistograms();
393 
394  TCanvas canvas("Canv", "Canv", (myType == SiPixelPI::t_barrel) ? 1200 : 1500, 1000);
395  if (myType == SiPixelPI::t_barrel) {
396  theMaps.drawBarrelMaps(barrelName_, canvas);
397  } else if (myType == SiPixelPI::t_forward) {
398  theMaps.drawForwardMaps(endcapName_, canvas);
399  }
400 
401  canvas.cd();
402 
404  canvas.SaveAs(fileName.c_str());
405  }
406  return true;

References Phase1PixelMaps::beautifyAllHistograms(), Phase1PixelMaps::bookBarrelBins(), Phase1PixelMaps::bookBarrelHistograms(), Phase1PixelMaps::bookForwardBins(), 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 GlobalPosition_Frontier_DevDB_cff::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:409
mps_splice.entry
entry
Definition: mps_splice.py:68
templateHelper::SiPixelIDs::label_
std::string label_
Definition: SiPixelTemplateHelper.h:410
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:781
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
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
jets_cff.payload
payload
Definition: jets_cff.py:32
Phase1PixelMaps
Definition: Phase1PixelMaps.h:31
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond
Definition: plugin.cc:23
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
COUT
#define COUT
Definition: PVValidationHelpers.h:13
SiPixelPI::t_forward
Definition: SiPixelPayloadInspectorHelper.h:574
cond::payloadInspector::SINGLE_IOV
Definition: PayloadInspector.h:295