CMS 3D CMS Logo

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

#include <SiPixelGainCalibHelper.h>

Inheritance diagram for gainCalibHelper::SiPixelGainCalibDiffAndRatioBase< myType, nIOVs, ntags, PayloadType >:
cond::payloadInspector::PlotImage< PayloadType, nIOVs, ntags > cond::payloadInspector::PlotImpl< IOV_M, NTAGS > cond::payloadInspector::PlotBase

Public Member Functions

bool fill () override
 
 SiPixelGainCalibDiffAndRatioBase ()
 
- Public Member Functions inherited from cond::payloadInspector::PlotImage< PayloadType, nIOVs, ntags >
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, NTAGS >
 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 isForHLT_
 
std::string label_
 
- Protected Attributes inherited from cond::payloadInspector::PlotImage< PayloadType, nIOVs, ntags >
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, nIOVs, ntags >
typedef PlotImpl< IOV_M, NTAGS > Base
 

Detailed Description

template<gainCalibPI::type myType, cond::payloadInspector::IOVMultiplicity nIOVs, int ntags, class PayloadType>
class gainCalibHelper::SiPixelGainCalibDiffAndRatioBase< myType, nIOVs, ntags, PayloadType >

Definition at line 1179 of file SiPixelGainCalibHelper.h.

Constructor & Destructor Documentation

◆ SiPixelGainCalibDiffAndRatioBase()

template<gainCalibPI::type myType, cond::payloadInspector::IOVMultiplicity nIOVs, int ntags, class PayloadType >
gainCalibHelper::SiPixelGainCalibDiffAndRatioBase< myType, nIOVs, ntags, PayloadType >::SiPixelGainCalibDiffAndRatioBase ( )
inline

Definition at line 1182 of file SiPixelGainCalibHelper.h.

1187  public:
1189  : cond::payloadInspector::PlotImage<PayloadType, nIOVs, ntags>(
1190  Form("SiPixelGainCalibration %s Diff and Ratio %i tag(s)", TypeName[myType], ntags)) {

References cond::payloadInspector::PlotBase::ntags(), and gainCalibHelper::TypeName.

Member Function Documentation

◆ fill()

template<gainCalibPI::type myType, cond::payloadInspector::IOVMultiplicity nIOVs, int ntags, class PayloadType >
bool gainCalibHelper::SiPixelGainCalibDiffAndRatioBase< myType, nIOVs, ntags, PayloadType >::fill ( )
inlineoverridevirtual

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

Definition at line 1192 of file SiPixelGainCalibHelper.h.

1193  {
1194  isForHLT_ = true;
1195  }
1196  }
1197 
1198  bool fill() override {
1199  gStyle->SetOptStat("emr");
1200  TGaxis::SetExponentOffset(-0.1, 0.01, "y"); // Y offset
1201  TH1F::SetDefaultSumw2(true);
1202 
1203  COUT << "ntags: " << ntags << " this->m_plotAnnotations.ntags: " << this->m_plotAnnotations.ntags << std::endl;
1204 
1205  // trick to deal with the multi-ioved tag and two tag case at the same time
1206  auto theIOVs = cond::payloadInspector::PlotBase::getTag<0>().iovs;
1207  auto f_tagname = cond::payloadInspector::PlotBase::getTag<0>().name;
1208  std::string l_tagname = "";
1209  auto firstiov = theIOVs.front();
1210  std::tuple<cond::Time_t, cond::Hash> lastiov;
1211 
1212  // we don't support (yet) comparison with more than 2 tags
1213  assert(this->m_plotAnnotations.ntags < 3);
1214 
1215  if (this->m_plotAnnotations.ntags == 2) {
1216  auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs;
1217  l_tagname = cond::payloadInspector::PlotBase::getTag<1>().name;
1218  lastiov = tag2iovs.front();
1219  } else {
1220  lastiov = theIOVs.back();
1221  }
1222 
1223  std::shared_ptr<PayloadType> last_payload = this->fetchPayload(std::get<1>(lastiov));
1224  std::shared_ptr<PayloadType> first_payload = this->fetchPayload(std::get<1>(firstiov));
1225 
1226  std::string lastIOVsince = std::to_string(std::get<0>(lastiov));
1227  std::string firstIOVsince = std::to_string(std::get<0>(firstiov));
1228 
1229  TCanvas canvas("Canv", "Canv", 1300, 800);
1230  canvas.Divide(2, 1);
1231  canvas.cd();
1232 
1233  SiPixelPI::adjustCanvasMargins(canvas.cd(1), 0.05, 0.12, 0.12, 0.04);
1234  SiPixelPI::adjustCanvasMargins(canvas.cd(2), 0.05, 0.12, 0.12, 0.04);
1235  canvas.Modified();
1236 
1237  auto array = gainCalibPI::fillDiffAndRatio(first_payload, last_payload, myType);
1238 
1239  array[0]->SetTitle(Form("SiPixel Gain Calibration %s - %s;per %s %s ratio;# %ss",
1240  (isForHLT_ ? "ForHLT" : "Offline"),
1241  TypeName[myType],
1242  (isForHLT_ ? "Column" : "Pixel"),
1243  TypeName[myType],
1244  (isForHLT_ ? "column" : "pixel")));
1245 
1246  array[1]->SetTitle(Form("SiPixel Gain Calibration %s - %s;per %s %s difference;# %ss",
1247  (isForHLT_ ? "ForHLT" : "Offline"),
1248  TypeName[myType],
1249  (isForHLT_ ? "Column" : "Pixel"),
1250  TypeName[myType],
1251  (isForHLT_ ? "column" : "pixel")));
1252 
1253  canvas.cd(1)->SetLogy();
1254  array[0]->SetTitle("");
1255  array[0]->SetLineColor(kBlack);
1256  array[0]->SetFillColor(kRed);
1257  array[0]->SetBarWidth(0.90);
1258  array[0]->SetMaximum(array[0]->GetMaximum() * 10);
1259  array[0]->Draw("bar");
1261  array[0]->SetStats(true);
1262 
1263  canvas.cd(2)->SetLogy();
1264  array[1]->SetTitle("");
1265  array[1]->SetLineColor(kBlack);
1266  array[1]->SetFillColor(kBlue);
1267  array[1]->SetBarWidth(0.90);
1268  array[1]->SetMaximum(array[1]->GetMaximum() * 10);
1269  array[1]->Draw("bar");
1271  array[1]->SetStats(true);
1272 
1273  canvas.Update();
1274 
1275  canvas.cd(1);
1276  TLatex latex;
1277  latex.SetTextSize(0.024);
1278  latex.SetTextAlign(13); //align at top
1279  latex.DrawLatexNDC(
1280  .41,
1281  .94,
1282  fmt::sprintf("#scale[1.2]{SiPixelGainCalibration%s Ratio}", (isForHLT_ ? "ForHLT" : "Offline")).c_str());
1283  if (this->m_plotAnnotations.ntags == 2) {
1284  latex.DrawLatexNDC(
1285  .41, .91, ("#splitline{#font[12]{" + f_tagname + "}}{ / #font[12]{" + l_tagname + "}}").c_str());
1286  } else {
1287  latex.DrawLatexNDC(.41, .91, (firstIOVsince + " / " + lastIOVsince).c_str());
1288  }
1289 
1290  canvas.cd(2);
1291  TLatex latex2;
1292  latex2.SetTextSize(0.024);
1293  latex2.SetTextAlign(13); //align at top
1294  latex2.DrawLatexNDC(
1295  .41,
1296  .94,
1297  fmt::sprintf("#scale[1.2]{SiPixelGainCalibration%s Diff}", (isForHLT_ ? "ForHLT" : "Offline")).c_str());
1298  if (this->m_plotAnnotations.ntags == 2) {
1299  latex2.DrawLatexNDC(
1300  .41, .91, ("#splitline{#font[12]{" + f_tagname + "}}{ - #font[12]{" + l_tagname + "}}").c_str());
1301  } else {
1302  latex2.DrawLatexNDC(.41, .91, (firstIOVsince + " - " + lastIOVsince).c_str());
1303  }
1304 
1305  TPaveStats* st1 = (TPaveStats*)array[0]->FindObject("stats");
1306  st1->SetTextSize(0.027);
1307  st1->SetLineColor(kRed);
1308  st1->SetTextColor(kRed);
1309  SiPixelPI::adjustStats(st1, 0.13, 0.84, 0.40, 0.94);
1310 
1311  TPaveStats* st2 = (TPaveStats*)array[1]->FindObject("stats");
1312  st2->SetTextSize(0.027);
1313  st2->SetLineColor(kBlue);
1314  st2->SetTextColor(kBlue);
1315  SiPixelPI::adjustStats(st2, 0.13, 0.84, 0.40, 0.94);
1316 
1317  auto ltx = TLatex();
1318  ltx.SetTextFont(62);
1319  //ltx.SetTextColor(kBlue);
1320  ltx.SetTextSize(0.040);
1321  ltx.SetTextAlign(11);
1322  canvas.cd(1);
1323  ltx.DrawLatexNDC(
1324  gPad->GetLeftMargin(),
1325  1 - gPad->GetTopMargin() + 0.01,
1326  fmt::sprintf("SiPixel %s Ratio, IOV %s / %s", TypeName[myType], firstIOVsince, lastIOVsince).c_str());
1327 
1328  canvas.cd(2);
1329  ltx.DrawLatexNDC(
1330  gPad->GetLeftMargin(),
1331  1 - gPad->GetTopMargin() + 0.01,
1332  fmt::sprintf("SiPixel %s Diff, IOV %s - %s", TypeName[myType], firstIOVsince, lastIOVsince).c_str());
1333 
1335  canvas.SaveAs(fileName.c_str());

Member Data Documentation

◆ isForHLT_

template<gainCalibPI::type myType, cond::payloadInspector::IOVMultiplicity nIOVs, int ntags, class PayloadType >
bool gainCalibHelper::SiPixelGainCalibDiffAndRatioBase< myType, nIOVs, ntags, PayloadType >::isForHLT_
protected

Definition at line 1338 of file SiPixelGainCalibHelper.h.

◆ label_

template<gainCalibPI::type myType, cond::payloadInspector::IOVMultiplicity nIOVs, int ntags, class PayloadType >
std::string gainCalibHelper::SiPixelGainCalibDiffAndRatioBase< myType, nIOVs, ntags, PayloadType >::label_
protected
gainCalibHelper::SiPixelGainCalibDiffAndRatioBase::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:1338
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
cond::payloadInspector::PlotImage< PayloadType, nIOVs, ntags >::m_imageFileName
std::string m_imageFileName
Definition: PayloadInspector.h:868
cond::payloadInspector::PlotAnnotations::ntags
int ntags
Definition: PayloadInspector.h:55
cms::cuda::assert
assert(be >=bs)
mps_check.array
array
Definition: mps_check.py:216
cond::payloadInspector::PlotImage< PayloadType, nIOVs, ntags >::PlotImage
PlotImage(const std::string &title)
Definition: PayloadInspector.h:855
gainCalibHelper::gainCalibPI::fillDiffAndRatio
static std::array< std::shared_ptr< TH1F >, 2 > fillDiffAndRatio(const std::shared_ptr< PayloadType > &payload_A, const std::shared_ptr< PayloadType > &payload_B, const gainCalibPI::type &theType)
Definition: SiPixelGainCalibHelper.h:44
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
gainCalibHelper::SiPixelGainCalibDiffAndRatioBase::SiPixelGainCalibDiffAndRatioBase
SiPixelGainCalibDiffAndRatioBase()
Definition: SiPixelGainCalibHelper.h:1182
gainCalibHelper::TypeName
constexpr char const * TypeName[2]
Definition: SiPixelGainCalibHelper.h:286
cond::payloadInspector::PlotBase::ntags
unsigned int ntags() const
Definition: PayloadInspector.cc:48
gainCalibHelper::SiPixelGainCalibDiffAndRatioBase::fill
bool fill() override
Definition: SiPixelGainCalibHelper.h:1192
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond
Definition: plugin.cc:23
cond::payloadInspector::PlotImage< PayloadType, nIOVs, ntags >::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:863
get
#define get
SiPixelPI::adjustStats
void adjustStats(TPaveStats *stats, float X1, float Y1, float X2, float Y2)
Definition: SiPixelPayloadInspectorHelper.h:519
COUT
#define COUT
Definition: PVValidationHelpers.h:13
cond::payloadInspector::PlotImage< PayloadType, nIOVs, ntags >
SiPixelPI::makeNicePlotStyle
void makeNicePlotStyle(TH1 *hist)
Definition: SiPixelPayloadInspectorHelper.h:545
cond::payloadInspector::PlotBase::m_plotAnnotations
PlotAnnotations m_plotAnnotations
Definition: PayloadInspector.h:276
SiPixelPI::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: SiPixelPayloadInspectorHelper.h:505