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 1013 of file SiPixelGainCalibHelper.h.

Constructor & Destructor Documentation

◆ SiPixelGainCalibrationValueComparisonBase()

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

Definition at line 1016 of file SiPixelGainCalibHelper.h.

1020  public:
1022  : cond::payloadInspector::PlotImage<PayloadType>(
1023  Form("SiPixelGainCalibration %s Values Comparison", TypeName[myType])) {
1024  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 1025 of file SiPixelGainCalibHelper.h.

1026  {
1027  isForHLT_ = true;
1028  }
1029  }
1030  bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash>>& iovs) override {
1031  gStyle->SetOptStat("emr");
1032  TGaxis::SetExponentOffset(-0.1, 0.01, "y"); // Y offset
1033  TH1F::SetDefaultSumw2(true);
1034 
1035  std::vector<std::tuple<cond::Time_t, cond::Hash>> sorted_iovs = iovs;
1036  // make absolute sure the IOVs are sortd by since
1037  std::sort(begin(sorted_iovs), end(sorted_iovs), [](auto const& t1, auto const& t2) {
1038  return std::get<0>(t1) < std::get<0>(t2);
1039  });
1040  auto firstiov = sorted_iovs.front();
1041  auto lastiov = sorted_iovs.back();
1042 
1043  std::shared_ptr<PayloadType> last_payload = this->fetchPayload(std::get<1>(lastiov));
1044  std::shared_ptr<PayloadType> first_payload = this->fetchPayload(std::get<1>(firstiov));
1045 
1046  std::string lastIOVsince = std::to_string(std::get<0>(lastiov));
1047  std::string firstIOVsince = std::to_string(std::get<0>(firstiov));
1048 
1049  float minimum(9999.);
1050  float maximum(-9999.);
1051 
1052  switch (myType) {
1053  case gainCalibPI::t_gain:
1054  maximum = std::max(last_payload->getGainHigh(), first_payload->getGainHigh());
1055  minimum = std::min(last_payload->getGainLow(), first_payload->getGainLow());
1056  break;
1058  maximum = std::max(last_payload->getPedHigh(), first_payload->getPedHigh());
1059  minimum = std::min(last_payload->getPedLow(), first_payload->getPedLow());
1060  break;
1061  default:
1062  edm::LogError(label_) << "Unrecognized type " << myType << std::endl;
1063  break;
1064  }
1065 
1066  TCanvas canvas("Canv", "Canv", 1200, 1000);
1067  canvas.cd();
1068  auto hfirst = std::make_shared<TH1F>(Form("First, IOV %s", firstIOVsince.c_str()),
1069  Form("SiPixel Gain Calibration %s - %s;per %s %s;# %ss",
1070  (isForHLT_ ? "ForHLT" : "Offline"),
1071  TypeName[myType],
1072  (isForHLT_ ? "Column" : "Pixel"),
1073  TypeName[myType],
1074  (isForHLT_ ? "column" : "pixel")),
1075  200,
1076  minimum,
1077  maximum);
1078 
1079  auto hlast = std::make_shared<TH1F>(Form("Last, IOV %s", lastIOVsince.c_str()),
1080  Form("SiPixel Gain Calibration %s - %s;per %s %s;# %ss",
1081  (isForHLT_ ? "ForHLT" : "Offline"),
1082  TypeName[myType],
1083  (isForHLT_ ? "Column" : "Pixel"),
1084  TypeName[myType],
1085  (isForHLT_ ? "column" : "pixel")),
1086  200,
1087  minimum,
1088  maximum);
1089 
1090  SiPixelPI::adjustCanvasMargins(canvas.cd(), 0.05, 0.12, 0.12, 0.03);
1091  canvas.Modified();
1092 
1093  gainCalibPI::fillTheHisto(first_payload, hfirst, myType);
1094  gainCalibPI::fillTheHisto(last_payload, hlast, myType);
1095 
1096  canvas.cd()->SetLogy();
1097  auto extrema = SiPixelPI::getExtrema(hfirst.get(), hlast.get());
1098  //hfirst->GetYaxis()->SetRangeUser(extrema.first, extrema.second * 1.10);
1099  hfirst->GetYaxis()->SetRangeUser(1., extrema.second * 10);
1100 
1101  hfirst->SetTitle("");
1102  hfirst->SetLineColor(kRed);
1103  hfirst->SetBarWidth(0.95);
1104  hfirst->Draw("hist");
1105 
1106  hlast->SetTitle("");
1107  hlast->SetFillColorAlpha(kBlue, 0.20);
1108  hlast->SetBarWidth(0.95);
1109  hlast->Draw("histsames");
1110 
1111  SiPixelPI::makeNicePlotStyle(hfirst.get());
1112  hfirst->SetStats(true);
1113  SiPixelPI::makeNicePlotStyle(hlast.get());
1114  hlast->SetStats(true);
1115 
1116  canvas.Update();
1117 
1118  TLegend legend = TLegend(0.45, 0.86, 0.74, 0.94);
1119  //legend.SetHeader("#font[22]{SiPixel Offline Gain Calibration Comparison}", "C"); // option "C" allows to center the header
1120  //legend.AddEntry(hfirst.get(), ("IOV: " + std::to_string(std::get<0>(firstiov))).c_str(), "FL");
1121  //legend.AddEntry(hlast.get(), ("IOV: " + std::to_string(std::get<0>(lastiov))).c_str(), "FL");
1122  legend.AddEntry(hfirst.get(), ("payload: #color[2]{" + std::get<1>(firstiov) + "}").c_str(), "F");
1123  legend.AddEntry(hlast.get(), ("payload: #color[4]{" + std::get<1>(lastiov) + "}").c_str(), "F");
1124  legend.SetTextSize(0.022);
1125  legend.SetLineColor(10);
1126  legend.Draw("same");
1127 
1128  TPaveStats* st1 = (TPaveStats*)hfirst->FindObject("stats");
1129  st1->SetTextSize(0.021);
1130  st1->SetLineColor(kRed);
1131  st1->SetTextColor(kRed);
1132  SiPixelPI::adjustStats(st1, 0.13, 0.86, 0.31, 0.94);
1133 
1134  TPaveStats* st2 = (TPaveStats*)hlast->FindObject("stats");
1135  st2->SetTextSize(0.021);
1136  st2->SetLineColor(kBlue);
1137  st2->SetTextColor(kBlue);
1138  SiPixelPI::adjustStats(st2, 0.13, 0.77, 0.31, 0.85);
1139 
1140  auto ltx = TLatex();
1141  ltx.SetTextFont(62);
1142  //ltx.SetTextColor(kBlue);
1143  ltx.SetTextSize(0.047);
1144  ltx.SetTextAlign(11);
1145  ltx.DrawLatexNDC(gPad->GetLeftMargin(),
1146  1 - gPad->GetTopMargin() + 0.01,
1147  ("SiPixel Gain Calibration IOV:#color[2]{" + std::to_string(std::get<0>(firstiov)) +
1148  "} vs IOV:#color[4]{" + std::to_string(std::get<0>(lastiov)) + "}")
1149  .c_str());
1150 
1152  canvas.SaveAs(fileName.c_str());
1153 #ifdef MMDEBUG

Member Data Documentation

◆ isForHLT_

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

Definition at line 1156 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:40
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:910
gainCalibHelper::gainCalibPI::t_gain
Definition: SiPixelGainCalibHelper.h:40
min
T min(T a, T b)
Definition: MathUtil.h:58
gainCalibHelper::SiPixelGainCalibrationValueComparisonBase::SiPixelGainCalibrationValueComparisonBase
SiPixelGainCalibrationValueComparisonBase()
Definition: SiPixelGainCalibHelper.h:1016
cond::payloadInspector::PlotImage< PayloadType >::PlotImage
PlotImage(const std::string &title)
Definition: PayloadInspector.h:897
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
gainCalibHelper::TypeName
constexpr char const * TypeName[2]
Definition: SiPixelGainCalibHelper.h:288
mps_fire.end
end
Definition: mps_fire.py:242
cond::payloadInspector::PlotImpl< UNSPECIFIED_IOV, 0 >::fill
virtual bool fill()
Definition: PayloadInspector.h:409
cond
Definition: plugin.cc:23
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
cond::payloadInspector::PlotImage< PayloadType >::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:905
listHistos.legend
legend
Definition: listHistos.py:41
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
gainCalibHelper::SiPixelGainCalibrationValueComparisonBase::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:1156
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:130
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
SiPixelPI::adjustStats
void adjustStats(TPaveStats *stats, float X1, float Y1, float X2, float Y2)
Definition: SiPixelPayloadInspectorHelper.h:522
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
gainCalibHelper::SiPixelGainCalibrationValueComparisonBase::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:1157
cond::payloadInspector::PlotImage< PayloadType >
SiPixelPI::makeNicePlotStyle
void makeNicePlotStyle(TH1 *hist)
Definition: SiPixelPayloadInspectorHelper.h:548
SiPixelPI::getExtrema
std::pair< float, float > getExtrema(TH1 *h1, TH1 *h2)
Definition: SiPixelPayloadInspectorHelper.h:532
SiPixelPI::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: SiPixelPayloadInspectorHelper.h:508