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

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

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