CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Attributes | Private Attributes
templateHelper::SiPixelTemplateHeaderInfo< PayloadType, StoreType, TransientType, myType, myParam > Class Template Reference

#include <SiPixelTemplateHelper.h>

Inheritance diagram for templateHelper::SiPixelTemplateHeaderInfo< PayloadType, StoreType, TransientType, myType, myParam >:
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV > cond::payloadInspector::PlotImpl< IOV_M, 0 > cond::payloadInspector::PlotBase

Classes

struct  header_info
 

Public Member Functions

bool fill () override
 
 SiPixelTemplateHeaderInfo ()
 
- 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
 

Private Attributes

std::map< int, header_infotheInfos_
 

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, class StoreType, class TransientType, SiPixelPI::DetType myType, headerParam myParam>
class templateHelper::SiPixelTemplateHeaderInfo< PayloadType, StoreType, TransientType, myType, myParam >

Definition at line 553 of file SiPixelTemplateHelper.h.

Constructor & Destructor Documentation

◆ SiPixelTemplateHeaderInfo()

template<class PayloadType , class StoreType , class TransientType , SiPixelPI::DetType myType, headerParam myParam>
templateHelper::SiPixelTemplateHeaderInfo< PayloadType, StoreType, TransientType, myType, myParam >::SiPixelTemplateHeaderInfo ( )
inline

Definition at line 578 of file SiPixelTemplateHelper.h.

References templateHelper::SiPixelTemplateHeaderInfo< PayloadType, StoreType, TransientType, myType, myParam >::isTemplate_, and templateHelper::SiPixelTemplateHeaderInfo< PayloadType, StoreType, TransientType, myType, myParam >::label_.

580  "SiPixel CPE conditions Map of header quantities") {
581  if constexpr (std::is_same_v<PayloadType, SiPixelGenErrorDBObject>) {
582  isTemplate_ = false;
583  label_ = "SiPixelGenErrorDBObject_PayloadInspector";
584  } else {
585  isTemplate_ = true;
586  label_ = "SiPixelTemplateDBObject_PayloadInspector";
587  }
588  }

Member Function Documentation

◆ fill()

template<class PayloadType , class StoreType , class TransientType , SiPixelPI::DetType myType, headerParam myParam>
bool templateHelper::SiPixelTemplateHeaderInfo< PayloadType, StoreType, TransientType, myType, myParam >::fill ( )
inlineoverridevirtual

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

Definition at line 590 of file SiPixelTemplateHelper.h.

References Phase1PixelMaps::beautifyAllHistograms(), Phase1PixelMaps::bookBarrelHistograms(), Phase1PixelMaps::bookForwardHistograms(), svgfig::canvas(), makeHLTPrescaleTable::delimiter, SiPixelPI::displayNotSupported(), Phase1PixelMaps::drawBarrelMaps(), Phase1PixelMaps::drawForwardMaps(), Phase1PixelMaps::drawSummaryMaps(), mps_splice::entry, Exception, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload(), MillePedeFileConverter_cfg::fileName, Phase1PixelMaps::fillBarrelBin(), Phase1PixelMaps::fillForwardBin(), dqmdumpme::first, templateHelper::header_types, info(), input, templateHelper::SiPixelTemplateHeaderInfo< PayloadType, StoreType, TransientType, myType, myParam >::isTemplate_, templateHelper::k_Bfield, templateHelper::k_Dtype, templateHelper::k_END_OF_TYPES, templateHelper::k_fluence, templateHelper::k_ID, templateHelper::k_lorxbias, templateHelper::k_lorxwidth, templateHelper::k_lorybias, templateHelper::k_lorywidth, templateHelper::k_NTxx, templateHelper::k_NTy, templateHelper::k_NTyx, templateHelper::k_qscale, templateHelper::k_s50, templateHelper::k_ss50, templateHelper::k_temperature, templateHelper::k_title, templateHelper::k_Vbias, templateHelper::SiPixelTemplateHeaderInfo< PayloadType, StoreType, TransientType, myType, myParam >::label_, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName, jetsAK4_Puppi_cff::payload, SiPixelPI::phase0size, SiPixelPI::phase1size, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, Phase1PixelMaps::resetOption(), runTheMatrix::ret, edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, SiPixelPI::t_all, SiPixelPI::t_barrel, SiPixelPI::t_forward, makeGlobalPositionRcd_cfg::tag, createPayload::tagname, templateHelper::SiPixelTemplateHeaderInfo< PayloadType, StoreType, TransientType, myType, myParam >::theInfos_, and to_string().

590  {
591  gStyle->SetPalette(kRainBow);
592  if (!(myParam == headerParam::k_Vbias || myParam == headerParam::k_Dtype)) {
593  TGaxis::SetMaxDigits(2);
594  }
595 
596  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
597  auto iov = tag.iovs.front();
598  const auto& tagname = tag.name;
599  std::vector<StoreType> thePixelTemp_;
600  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
601 
602  if (payload.get()) {
603  if (!TransientType::pushfile(*payload, thePixelTemp_)) {
604  throw cms::Exception(label_) << "\nERROR: Templates not filled correctly. Check the conditions. Using "
605  "payload version "
606  << payload->version() << "\n\n";
607  }
608 
609  // store the map of ID / interesting quantities
610  SiPixelTemplate templ(thePixelTemp_);
611  for (const auto& theTemp : thePixelTemp_) {
612  header_info info;
613  info.ID = theTemp.head.ID;
614  info.NTy = theTemp.head.NTy;
615  info.NTyx = theTemp.head.NTyx;
616  info.NTxx = theTemp.head.NTxx;
617  info.Dtype = theTemp.head.Dtype;
618  info.qscale = theTemp.head.qscale;
619  info.lorywidth = theTemp.head.lorywidth;
620  info.lorxwidth = theTemp.head.lorxwidth;
621  info.lorybias = theTemp.head.lorybias;
622  info.lorxbias = theTemp.head.lorxbias;
623  info.Vbias = theTemp.head.Vbias;
624  info.temperature = theTemp.head.temperature;
625  info.fluence = theTemp.head.fluence;
626  info.s50 = theTemp.head.s50;
627  info.ss50 = theTemp.head.ss50;
628  info.templ_version = theTemp.head.templ_version;
629  info.Bfield = theTemp.head.Bfield;
630  theInfos_[theTemp.head.ID] = info;
631  }
632 
633  // Book the TH2Poly
634  Phase1PixelMaps theMaps("");
635  if (myType == SiPixelPI::t_all) {
636  theMaps.resetOption("COLZA L");
637  } else {
638  theMaps.resetOption("COLZL");
639  }
640 
641  std::string input{header_types[myParam]};
642  std::string delimiter = ";";
643  std::string first = input.substr(0, input.find(delimiter));
644  std::string second = input.substr(input.find(delimiter) + 1);
645 
646  if (myType == SiPixelPI::t_barrel) {
647  theMaps.bookBarrelHistograms("templateLABarrel", first.c_str(), second.c_str());
648  } else if (myType == SiPixelPI::t_forward) {
649  theMaps.bookForwardHistograms("templateLAForward", first.c_str(), second.c_str());
650  } else if (myType == SiPixelPI::t_all) {
651  theMaps.bookBarrelHistograms("templateLA", first.c_str(), second.c_str());
652  theMaps.bookForwardHistograms("templateLA", first.c_str(), second.c_str());
653  } else {
654  edm::LogError(label_) << " un-recognized detector type " << myType << std::endl;
655  return false;
656  }
657 
658  std::map<unsigned int, short> templMap = payload->getTemplateIDs();
659  if (templMap.size() == SiPixelPI::phase0size || templMap.size() > SiPixelPI::phase1size) {
661  << "There are " << templMap.size()
662  << " DetIds in this payload. SiPixelTempate Lorentz Angle maps are not supported for non-Phase1 Pixel "
663  "geometries !";
664  TCanvas canvas("Canv", "Canv", 1200, 1000);
665  SiPixelPI::displayNotSupported(canvas, templMap.size());
667  canvas.SaveAs(fileName.c_str());
668  return false;
669  } else {
670  if (templMap.size() < SiPixelPI::phase1size) {
671  edm::LogWarning(label_) << "\n ********* WARNING! ********* \n There are " << templMap.size()
672  << " DetIds in this payload !"
673  << "\n **************************** \n";
674  }
675  }
676 
677  for (auto const& entry : templMap) {
678  //templ.interpolate(entry.second, 0.f, 0.f, 1.f, 1.f);
679 
680  const auto& theInfo = theInfos_[entry.second];
681 
682  std::function<float(headerParam, header_info)> cutFunctor = [](headerParam my_param, header_info myInfo) {
683  float ret(-999.);
684  switch (my_param) {
685  case k_ID:
686  return (float)myInfo.ID;
687  case k_NTy:
688  return (float)myInfo.NTy;
689  case k_NTyx:
690  return (float)myInfo.NTyx;
691  case k_NTxx:
692  return (float)myInfo.NTxx;
693  case k_Dtype:
694  return (float)myInfo.Dtype;
695  case k_qscale:
696  return (float)myInfo.qscale;
697  case k_lorywidth:
698  return (float)myInfo.lorywidth;
699  case k_lorxwidth:
700  return (float)myInfo.lorxwidth;
701  case k_lorybias:
702  return (float)myInfo.lorybias;
703  case k_lorxbias:
704  return (float)myInfo.lorxbias;
705  case k_Vbias:
706  return (float)myInfo.Vbias;
707  case k_temperature:
708  return (float)myInfo.temperature;
709  case k_fluence:
710  return (float)myInfo.fluence;
711  case k_s50:
712  return (float)myInfo.s50;
713  case k_ss50:
714  return (float)myInfo.ss50;
715  case k_title:
716  return (float)myInfo.templ_version;
717  case k_Bfield:
718  return (float)myInfo.Bfield;
719  case k_END_OF_TYPES:
720  return ret;
721  default:
722  return ret;
723  }
724  };
725 
726  auto detid = DetId(entry.first);
727  if (myType == SiPixelPI::t_all) {
728  if ((detid.subdetId() == PixelSubdetector::PixelBarrel)) {
729  theMaps.fillBarrelBin("templateLA", entry.first, cutFunctor(myParam, theInfo));
730  }
731  if ((detid.subdetId() == PixelSubdetector::PixelEndcap)) {
732  theMaps.fillForwardBin("templateLA", entry.first, cutFunctor(myParam, theInfo));
733  }
734  } else if ((detid.subdetId() == PixelSubdetector::PixelBarrel) && (myType == SiPixelPI::t_barrel)) {
735  theMaps.fillBarrelBin("templateLABarrel", entry.first, cutFunctor(myParam, theInfo));
736  } else if ((detid.subdetId() == PixelSubdetector::PixelEndcap) && (myType == SiPixelPI::t_forward)) {
737  theMaps.fillForwardBin("templateLAForward", entry.first, cutFunctor(myParam, theInfo));
738  }
739  }
740 
741  theMaps.beautifyAllHistograms();
742 
743  TCanvas canvas("Canv", "Canv", (myType == SiPixelPI::t_barrel) ? 1200 : 1600, 1000);
744  if (myType == SiPixelPI::t_barrel) {
745  theMaps.drawBarrelMaps("templateLABarrel", canvas);
746  } else if (myType == SiPixelPI::t_forward) {
747  theMaps.drawForwardMaps("templateLAForward", canvas);
748  } else if (myType == SiPixelPI::t_all) {
749  theMaps.drawSummaryMaps("templateLA", canvas);
750  }
751 
752  canvas.cd();
753  TPaveText ksPt(0, 0, 0.88, 0.04, "NDC");
754  ksPt.SetBorderSize(0);
755  ksPt.SetFillColor(0);
756  const char* textToAdd = Form("%s Tag: #color[2]{%s}, IOV: #color[2]{%s}. Payload hash: #color[2]{%s}",
757  (isTemplate_ ? "Template" : "GenError"),
758  tagname.c_str(),
759  std::to_string(std::get<0>(iov)).c_str(),
760  (std::get<1>(iov)).c_str());
761  ksPt.AddText(textToAdd);
762  ksPt.Draw();
763 
765  canvas.SaveAs(fileName.c_str());
766  }
767  return true;
768  } // fill
static const TGPicture * info(bool iBackgroundIsBlack)
ret
prodAgent to be discontinued
static const unsigned int phase0size
static constexpr const char * header_types[]
Log< level::Error, false > LogError
static std::string to_string(const XMLCh *ch)
static std::string const input
Definition: EdmProvDump.cc:50
U second(std::pair< T, U > const &p)
static const unsigned int phase1size
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 , class StoreType , class TransientType , SiPixelPI::DetType myType, headerParam myParam>
bool templateHelper::SiPixelTemplateHeaderInfo< PayloadType, StoreType, TransientType, myType, myParam >::isTemplate_
protected

◆ label_

template<class PayloadType , class StoreType , class TransientType , SiPixelPI::DetType myType, headerParam myParam>
std::string templateHelper::SiPixelTemplateHeaderInfo< PayloadType, StoreType, TransientType, myType, myParam >::label_
protected

◆ theInfos_

template<class PayloadType , class StoreType , class TransientType , SiPixelPI::DetType myType, headerParam myParam>
std::map<int, header_info> templateHelper::SiPixelTemplateHeaderInfo< PayloadType, StoreType, TransientType, myType, myParam >::theInfos_
private