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)
 
cond::persistency::Session dbSession ()
 
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 ()
 
const std::map< std::string, std::string > & inputParamValues () const
 
bool isSingleIov () const
 
bool isTwoTags () const
 
unsigned int ntags () const
 
std::string payloadType () const
 
 PlotBase ()
 
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 314 of file SiPixelTemplateHelper.h.

Constructor & Destructor Documentation

◆ SiPixelIDs()

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

Definition at line 316 of file SiPixelTemplateHelper.h.

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

318  "SiPixelMap of Template / GenError ID Values") {
319  if constexpr (std::is_same_v<PayloadType, SiPixelGenErrorDBObject>) {
320  isTemplate_ = false;
321  label_ = "SiPixelGenErrorDBObject_PayloadInspector";
322  } else {
323  isTemplate_ = true;
324  label_ = "SiPixelTemplateDBObject_PayloadInspector";
325  }
326  }

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 328 of file SiPixelTemplateHelper.h.

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, jetsAK4_Puppi_cff::payload, SiPixelPI::phase0size, SiPixelPI::phase1size, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, AlCaHLTBitMon_QueryRunRegistry::string, SiPixelPI::t_barrel, SiPixelPI::t_forward, and makeGlobalPositionRcd_cfg::tag.

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

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