CMS 3D CMS Logo

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

#include <SiPixelGainCalibHelper.h>

Inheritance diagram for gainCalibHelper::SiPixelGainCalibrationValueComparisonBase< myType, PayloadType >:
cond::payloadInspector::PlotImage< PayloadType > cond::payloadInspector::PlotImpl< UNSPECIFIED_IOV, 0 > cond::payloadInspector::PlotBase gainCalibHelper::SiPixelGainCalibrationValueComparisonSingleTag< myType, PayloadType > gainCalibHelper::SiPixelGainCalibrationValueComparisonTwoTags< myType, PayloadType >

Public Member Functions

bool fill (const std::vector< std::tuple< cond::Time_t, cond::Hash >> &iovs) override
 
 SiPixelGainCalibrationValueComparisonBase ()
 
- Public Member Functions inherited from cond::payloadInspector::PlotImage< PayloadType >
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< UNSPECIFIED_IOV, 0 >
virtual bool fill ()
 
virtual bool fill (const std::vector< std::tuple< cond::Time_t, cond::Hash >> &iovs)
 
 PlotImpl (const std::string &type, const std::string &title)
 
std::string processData () override
 
void setSingleIov (bool flag)
 
void setTwoTags (bool flag)
 
 ~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 isForHLT_
 
std::string label_
 
- Protected Attributes inherited from cond::payloadInspector::PlotImage< PayloadType >
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 >
typedef PlotImpl< UNSPECIFIED_IOV, 0 > Base
 
- Public Attributes inherited from cond::payloadInspector::PlotImpl< UNSPECIFIED_IOV, 0 >
bool m_singleIovSet = false
 

Detailed Description

template<gainCalibPI::type myType, class PayloadType>
class gainCalibHelper::SiPixelGainCalibrationValueComparisonBase< myType, PayloadType >

Definition at line 928 of file SiPixelGainCalibHelper.h.

Constructor & Destructor Documentation

◆ SiPixelGainCalibrationValueComparisonBase()

template<gainCalibPI::type myType, class PayloadType >
gainCalibHelper::SiPixelGainCalibrationValueComparisonBase< myType, PayloadType >::SiPixelGainCalibrationValueComparisonBase ( )
inline

Definition at line 931 of file SiPixelGainCalibHelper.h.

935  public:
937  : cond::payloadInspector::PlotImage<PayloadType>(
938  Form("SiPixelGainCalibration %s Values Comparison", TypeName[myType])) {
939  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {

References gainCalibHelper::TypeName.

Member Function Documentation

◆ fill()

template<gainCalibPI::type myType, class PayloadType >
bool gainCalibHelper::SiPixelGainCalibrationValueComparisonBase< myType, PayloadType >::fill ( const std::vector< std::tuple< cond::Time_t, cond::Hash >> &  iovs)
inlineoverride

Definition at line 940 of file SiPixelGainCalibHelper.h.

941  {
942  isForHLT_ = true;
943  }
944  }
945  bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash>>& iovs) override {
946  gStyle->SetOptStat("emr");
947  TGaxis::SetExponentOffset(-0.1, 0.01, "y"); // Y offset
948  TH1F::SetDefaultSumw2(true);
949 
950  std::vector<std::tuple<cond::Time_t, cond::Hash>> sorted_iovs = iovs;
951  // make absolute sure the IOVs are sortd by since
952  std::sort(begin(sorted_iovs), end(sorted_iovs), [](auto const& t1, auto const& t2) {
953  return std::get<0>(t1) < std::get<0>(t2);
954  });
955  auto firstiov = sorted_iovs.front();
956  auto lastiov = sorted_iovs.back();
957 
958  std::shared_ptr<PayloadType> last_payload = this->fetchPayload(std::get<1>(lastiov));
959  std::shared_ptr<PayloadType> first_payload = this->fetchPayload(std::get<1>(firstiov));
960 
961  std::string lastIOVsince = std::to_string(std::get<0>(lastiov));
962  std::string firstIOVsince = std::to_string(std::get<0>(firstiov));
963 
964  float minimum(9999.);
965  float maximum(-9999.);
966 
967  switch (myType) {
968  case gainCalibPI::t_gain:
969  maximum = std::max(last_payload->getGainHigh(), first_payload->getGainHigh());
970  minimum = std::min(last_payload->getGainLow(), first_payload->getGainLow());
971  break;
973  maximum = std::max(last_payload->getPedHigh(), first_payload->getPedHigh());
974  minimum = std::min(last_payload->getPedLow(), first_payload->getPedLow());
975  break;
976  default:
977  edm::LogError(label_) << "Unrecognized type " << myType << std::endl;
978  break;
979  }
980 
981  TCanvas canvas("Canv", "Canv", 1200, 1000);
982  canvas.cd();
983  auto hfirst = std::make_shared<TH1F>(Form("First, IOV %s", firstIOVsince.c_str()),
984  Form("SiPixel Gain Calibration %s - %s;per %s %s;# %ss",
985  (isForHLT_ ? "ForHLT" : "Offline"),
986  TypeName[myType],
987  (isForHLT_ ? "Column" : "Pixel"),
988  TypeName[myType],
989  (isForHLT_ ? "column" : "pixel")),
990  200,
991  minimum,
992  maximum);
993 
994  auto hlast = std::make_shared<TH1F>(Form("Last, IOV %s", lastIOVsince.c_str()),
995  Form("SiPixel Gain Calibration %s - %s;per %s %s;# %ss",
996  (isForHLT_ ? "ForHLT" : "Offline"),
997  TypeName[myType],
998  (isForHLT_ ? "Column" : "Pixel"),
999  TypeName[myType],
1000  (isForHLT_ ? "column" : "pixel")),
1001  200,
1002  minimum,
1003  maximum);
1004 
1005  SiPixelPI::adjustCanvasMargins(canvas.cd(), 0.05, 0.12, 0.12, 0.03);
1006  canvas.Modified();
1007 
1008  gainCalibPI::fillTheHisto(first_payload, hfirst, myType);
1009  gainCalibPI::fillTheHisto(last_payload, hlast, myType);
1010 
1011  canvas.cd()->SetLogy();
1012  auto extrema = SiPixelPI::getExtrema(hfirst.get(), hlast.get());
1013  //hfirst->GetYaxis()->SetRangeUser(extrema.first, extrema.second * 1.10);
1014  hfirst->GetYaxis()->SetRangeUser(1., extrema.second * 10);
1015 
1016  hfirst->SetTitle("");
1017  hfirst->SetLineColor(kRed);
1018  hfirst->SetBarWidth(0.95);
1019  hfirst->Draw("hist");
1020 
1021  hlast->SetTitle("");
1022  hlast->SetFillColorAlpha(kBlue, 0.20);
1023  hlast->SetBarWidth(0.95);
1024  hlast->Draw("histsames");
1025 
1026  SiPixelPI::makeNicePlotStyle(hfirst.get());
1027  hfirst->SetStats(true);
1028  SiPixelPI::makeNicePlotStyle(hlast.get());
1029  hlast->SetStats(true);
1030 
1031  canvas.Update();
1032 
1033  TLegend legend = TLegend(0.45, 0.86, 0.74, 0.94);
1034  //legend.SetHeader("#font[22]{SiPixel Offline Gain Calibration Comparison}", "C"); // option "C" allows to center the header
1035  //legend.AddEntry(hfirst.get(), ("IOV: " + std::to_string(std::get<0>(firstiov))).c_str(), "FL");
1036  //legend.AddEntry(hlast.get(), ("IOV: " + std::to_string(std::get<0>(lastiov))).c_str(), "FL");
1037  legend.AddEntry(hfirst.get(), ("payload: #color[2]{" + std::get<1>(firstiov) + "}").c_str(), "F");
1038  legend.AddEntry(hlast.get(), ("payload: #color[4]{" + std::get<1>(lastiov) + "}").c_str(), "F");
1039  legend.SetTextSize(0.022);
1040  legend.SetLineColor(10);
1041  legend.Draw("same");
1042 
1043  TPaveStats* st1 = (TPaveStats*)hfirst->FindObject("stats");
1044  st1->SetTextSize(0.022);
1045  st1->SetLineColor(kRed);
1046  st1->SetTextColor(kRed);
1047  SiPixelPI::adjustStats(st1, 0.13, 0.84, 0.31, 0.94);
1048 
1049  TPaveStats* st2 = (TPaveStats*)hlast->FindObject("stats");
1050  st2->SetTextSize(0.022);
1051  st2->SetLineColor(kBlue);
1052  st2->SetTextColor(kBlue);
1053  SiPixelPI::adjustStats(st2, 0.13, 0.73, 0.31, 0.83);
1054 
1055  auto ltx = TLatex();
1056  ltx.SetTextFont(62);
1057  //ltx.SetTextColor(kBlue);
1058  ltx.SetTextSize(0.047);
1059  ltx.SetTextAlign(11);
1060  ltx.DrawLatexNDC(gPad->GetLeftMargin(),
1061  1 - gPad->GetTopMargin() + 0.01,
1062  ("SiPixel Gain Calibration IOV:#color[2]{" + std::to_string(std::get<0>(firstiov)) +
1063  "} vs IOV:#color[4]{" + std::to_string(std::get<0>(lastiov)) + "}")
1064  .c_str());
1065 
1067  canvas.SaveAs(fileName.c_str());
1068 #ifdef MMDEBUG

Member Data Documentation

◆ isForHLT_

template<gainCalibPI::type myType, class PayloadType >
bool gainCalibHelper::SiPixelGainCalibrationValueComparisonBase< myType, PayloadType >::isForHLT_
protected

Definition at line 1071 of file SiPixelGainCalibHelper.h.

◆ label_

template<gainCalibPI::type myType, class PayloadType >
std::string gainCalibHelper::SiPixelGainCalibrationValueComparisonBase< myType, PayloadType >::label_
protected
gainCalibHelper::gainCalibPI::t_pedestal
Definition: SiPixelGainCalibHelper.h:37
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
RandomServiceHelper.t2
t2
Definition: RandomServiceHelper.py:257
cond::payloadInspector::PlotImage< PayloadType >::m_imageFileName
std::string m_imageFileName
Definition: PayloadInspector.h:845
gainCalibHelper::gainCalibPI::t_gain
Definition: SiPixelGainCalibHelper.h:37
min
T min(T a, T b)
Definition: MathUtil.h:58
gainCalibHelper::SiPixelGainCalibrationValueComparisonBase::SiPixelGainCalibrationValueComparisonBase
SiPixelGainCalibrationValueComparisonBase()
Definition: SiPixelGainCalibHelper.h:931
cond::payloadInspector::PlotImage< PayloadType >::PlotImage
PlotImage(const std::string &title)
Definition: PayloadInspector.h:832
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
end
#define end
Definition: vmac.h:39
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
gainCalibHelper::TypeName
constexpr char const * TypeName[2]
Definition: SiPixelGainCalibHelper.h:200
cond::payloadInspector::PlotImpl< UNSPECIFIED_IOV, 0 >::fill
virtual bool fill()
Definition: PayloadInspector.h:379
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond
Definition: plugin.cc:23
edm::LogError
Definition: MessageLogger.h:183
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
cond::payloadInspector::PlotImage< PayloadType >::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:840
listHistos.legend
legend
Definition: listHistos.py:41
gainCalibHelper::SiPixelGainCalibrationValueComparisonBase::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:1071
gainCalibHelper::gainCalibPI::fillTheHisto
static void fillTheHisto(const std::shared_ptr< PayloadType > &payload, std::shared_ptr< TH1F > h1, gainCalibPI::type theType, const std::vector< uint32_t > &wantedIds={})
Definition: SiPixelGainCalibHelper.h:42
SiPixelPI::adjustStats
void adjustStats(TPaveStats *stats, float X1, float Y1, float X2, float Y2)
Definition: SiPixelPayloadInspectorHelper.h:449
gainCalibHelper::SiPixelGainCalibrationValueComparisonBase::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:1072
cond::payloadInspector::PlotImage< PayloadType >
SiPixelPI::makeNicePlotStyle
void makeNicePlotStyle(TH1 *hist)
Definition: SiPixelPayloadInspectorHelper.h:475
SiPixelPI::getExtrema
std::pair< float, float > getExtrema(TH1 *h1, TH1 *h2)
Definition: SiPixelPayloadInspectorHelper.h:459
begin
#define begin
Definition: vmac.h:32
SiPixelPI::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: SiPixelPayloadInspectorHelper.h:435