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

1188  public:
1190  : cond::payloadInspector::PlotImage<PayloadType, nIOVs, ntags>(
1191  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 1193 of file SiPixelGainCalibHelper.h.

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