CMS 3D CMS Logo

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

#include <SiPixelGainCalibHelper.h>

Inheritance diagram for gainCalibHelper::SiPixelGainCalibrationValuesByPart< myType, PayloadType >:
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV > cond::payloadInspector::PlotImpl< IOV_M, 0 > cond::payloadInspector::PlotBase

Public Member Functions

bool fill () override
 
 SiPixelGainCalibrationValuesByPart ()
 
- Public Member Functions inherited from cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
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, 0 >
 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, cond::payloadInspector::SINGLE_IOV >
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, cond::payloadInspector::SINGLE_IOV >
typedef PlotImpl< IOV_M, 0 > Base
 

Detailed Description

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

Definition at line 865 of file SiPixelGainCalibHelper.h.

Constructor & Destructor Documentation

◆ SiPixelGainCalibrationValuesByPart()

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

Definition at line 869 of file SiPixelGainCalibHelper.h.

872  public:
874  : cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV>(
875  Form("SiPixelGainCalibrationOffline %s Values By Partition", TypeName[myType])) {
876  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
877  isForHLT_ = false;
878  label_ = "SiPixelGainCalibrationOffline_PayloadInspector";
879  } else {

References gainCalibHelper::SiPixelGainCalibrationValuesByPart< myType, PayloadType >::isForHLT_, gainCalibHelper::SiPixelGainCalibrationValuesByPart< myType, PayloadType >::label_, and gainCalibHelper::TypeName.

Member Function Documentation

◆ fill()

template<gainCalibPI::type myType, class PayloadType >
bool gainCalibHelper::SiPixelGainCalibrationValuesByPart< myType, PayloadType >::fill ( )
inlineoverridevirtual

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

Definition at line 881 of file SiPixelGainCalibHelper.h.

885  {
886  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
887  auto iov = tag.iovs.front();
888 
889  gStyle->SetOptStat("emr");
890 
891  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
892 
893  TCanvas canvas("Canv", "Canv", 1400, 800);
894  canvas.Divide(2, 1);
895  canvas.cd();
896 
897  float minimum(9999.);
898  float maximum(-9999.);
899 
900  switch (myType) {
901  case gainCalibPI::t_gain:
902  maximum = payload->getGainHigh();
903  minimum = payload->getGainLow();
904  break;
906  maximum = payload->getPedHigh();
907  minimum = payload->getPedLow();
908  break;
909  default:
910  edm::LogError(label_) << "Unrecognized type " << myType << std::endl;
911  break;
912  }
913 
914  auto hBPix = std::make_shared<TH1F>(Form("%s BPIX", TypeName[myType]),
915  Form("SiPixel Gain Calibration %s BPIx -%s;per %s %s (BPix);# %ss",
916  (isForHLT_ ? "ForHLT" : "Offline"),
917  TypeName[myType],
918  (isForHLT_ ? "Column" : "Pixel"),
919  TypeName[myType],
920  (isForHLT_ ? "column" : "pixel")),
921  200,
922  minimum,
923  maximum);
924 
925  auto hFPix = std::make_shared<TH1F>(Form("%s FPIX", TypeName[myType]),
926  Form("SiPixel Gain Calibration %s FPix -%s;per %s %s (FPix);# %ss",
927  (isForHLT_ ? "ForHLT" : "Offline"),
928  TypeName[myType],
929  (isForHLT_ ? "Column" : "Pixel"),
930  TypeName[myType],
931  (isForHLT_ ? "column" : "pixel")),
932  200,
933  minimum,
934  maximum);
935 
936  for (unsigned int i : {1, 2}) {
937  SiPixelPI::adjustCanvasMargins(canvas.cd(i), 0.04, 0.12, 0.12, 0.02);
938  canvas.cd(i)->Modified();
939  }
940 
941  // actually fill the histograms
942  fillTheHistos(payload, hBPix, hFPix, myType);
943 
944  canvas.cd(1)->SetLogy();
945  hBPix->SetTitle("");
946  hBPix->GetYaxis()->SetRangeUser(0.1, hBPix->GetMaximum() * 10);
947  hBPix->SetFillColor(kBlue);
948  hBPix->SetMarkerStyle(20);
949  hBPix->SetMarkerSize(1);
950  hBPix->Draw("hist");
951 
952  SiPixelPI::makeNicePlotStyle(hBPix.get());
953  hBPix->SetStats(true);
954 
955  canvas.cd(2)->SetLogy();
956  hFPix->SetTitle("");
957  hFPix->GetYaxis()->SetRangeUser(0.1, hFPix->GetMaximum() * 10);
958  hFPix->SetFillColor(kBlue);
959  hFPix->SetMarkerStyle(20);
960  hFPix->SetMarkerSize(1);
961  hFPix->Draw("hist");
962 
963  SiPixelPI::makeNicePlotStyle(hFPix.get());
964  hFPix->SetStats(true);
965 
966  canvas.Update();
967 
968  TLegend legend = TLegend(0.32, 0.92, 0.97, 0.95);
969  legend.SetHeader(("Payload hash: #bf{" + (std::get<1>(iov)) + "}").c_str(),
970  "C"); // option "C" allows to center the header
971  //legend.AddEntry(h1.get(), ("IOV: " + std::to_string(std::get<0>(iov))).c_str(), "PL");
972  legend.SetLineColor(10);
973  legend.SetTextSize(0.025);
974  canvas.cd(1);
975  legend.Draw("same");
976  canvas.cd(2);
977  legend.Draw("same");
978 
979  canvas.cd(1);
980  TPaveStats* st1 = (TPaveStats*)hBPix->FindObject("stats");
981  st1->SetTextSize(0.03);
982  SiPixelPI::adjustStats(st1, 0.13, 0.815, 0.44, 0.915);
983 
984  canvas.cd(2);
985  TPaveStats* st2 = (TPaveStats*)hFPix->FindObject("stats");
986  st2->SetTextSize(0.03);
987  SiPixelPI::adjustStats(st2, 0.14, 0.815, 0.44, 0.915);
988 
989  auto ltx = TLatex();
990  ltx.SetTextFont(62);
991  //ltx.SetTextColor(kBlue);
992  ltx.SetTextSize(0.045);
993  ltx.SetTextAlign(11);
994  canvas.cd(1);
995  ltx.DrawLatexNDC(gPad->GetLeftMargin() + 0.01,
996  1 - gPad->GetTopMargin() + 0.01,
997  ("SiPixel Gain Calibration IOV:" + std::to_string(std::get<0>(iov))).c_str());
998 
999  canvas.cd(2);
1000  ltx.DrawLatexNDC(gPad->GetLeftMargin() + 0.01,
1001  1 - gPad->GetTopMargin() + 0.01,
1002  ("SiPixel Gain Calibration IOV:" + std::to_string(std::get<0>(iov))).c_str());
1003 

Member Data Documentation

◆ isForHLT_

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

◆ label_

template<gainCalibPI::type myType, class PayloadType >
std::string gainCalibHelper::SiPixelGainCalibrationValuesByPart< myType, PayloadType >::label_
protected
gainCalibHelper::gainCalibPI::t_pedestal
Definition: SiPixelGainCalibHelper.h:40
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
gainCalibHelper::SiPixelGainCalibrationValuesByPart::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:1008
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName
std::string m_imageFileName
Definition: PayloadInspector.h:910
mps_fire.i
i
Definition: mps_fire.py:428
gainCalibHelper::gainCalibPI::t_gain
Definition: SiPixelGainCalibHelper.h:40
gainCalibHelper::SiPixelGainCalibrationValuesByPart::SiPixelGainCalibrationValuesByPart
SiPixelGainCalibrationValuesByPart()
Definition: SiPixelGainCalibHelper.h:869
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::PlotImage
PlotImage(const std::string &title)
Definition: PayloadInspector.h:897
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
gainCalibHelper::TypeName
constexpr char const * TypeName[2]
Definition: SiPixelGainCalibHelper.h:288
jets_cff.payload
payload
Definition: jets_cff.py:32
cond
Definition: plugin.cc:23
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:905
listHistos.legend
legend
Definition: listHistos.py:41
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
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
SiPixelPI::makeNicePlotStyle
void makeNicePlotStyle(TH1 *hist)
Definition: SiPixelPayloadInspectorHelper.h:548
gainCalibHelper::SiPixelGainCalibrationValuesByPart::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:1007
gainCalibHelper::gainCalibPI::fillTheHistos
static void fillTheHistos(const std::shared_ptr< PayloadType > &payload, std::shared_ptr< TH1 > hBPix, std::shared_ptr< TH1 > hFPix, gainCalibPI::type theType)
Definition: SiPixelGainCalibHelper.h:233
cond::payloadInspector::SINGLE_IOV
Definition: PayloadInspector.h:295
SiPixelPI::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: SiPixelPayloadInspectorHelper.h:508