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

Constructor & Destructor Documentation

◆ SiPixelGainCalibrationValuesByPart()

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

Definition at line 784 of file SiPixelGainCalibHelper.h.

787  public:
789  : cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV>(
790  Form("SiPixelGainCalibrationOffline %s Values By Partition", TypeName[myType])) {
791  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
792  isForHLT_ = false;
793  label_ = "SiPixelGainCalibrationOffline_PayloadInspector";
794  } 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 796 of file SiPixelGainCalibHelper.h.

800  {
801  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
802  auto iov = tag.iovs.front();
803 
804  gStyle->SetOptStat("emr");
805 
806  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
807 
808  TCanvas canvas("Canv", "Canv", 1400, 800);
809  canvas.Divide(2, 1);
810  canvas.cd();
811 
812  float minimum(9999.);
813  float maximum(-9999.);
814 
815  switch (myType) {
816  case gainCalibPI::t_gain:
817  maximum = payload->getGainHigh();
818  minimum = payload->getGainLow();
819  break;
821  maximum = payload->getPedHigh();
822  minimum = payload->getPedLow();
823  break;
824  default:
825  edm::LogError(label_) << "Unrecognized type " << myType << std::endl;
826  break;
827  }
828 
829  auto hBPix = std::make_shared<TH1F>(Form("%s BPIX", TypeName[myType]),
830  Form("SiPixel Gain Calibration %s BPIx -%s;per %s %s (BPix);# %ss",
831  (isForHLT_ ? "ForHLT" : "Offline"),
832  TypeName[myType],
833  (isForHLT_ ? "Column" : "Pixel"),
834  TypeName[myType],
835  (isForHLT_ ? "column" : "pixel")),
836  200,
837  minimum,
838  maximum);
839 
840  auto hFPix = std::make_shared<TH1F>(Form("%s FPIX", TypeName[myType]),
841  Form("SiPixel Gain Calibration %s FPix -%s;per %s %s (FPix);# %ss",
842  (isForHLT_ ? "ForHLT" : "Offline"),
843  TypeName[myType],
844  (isForHLT_ ? "Column" : "Pixel"),
845  TypeName[myType],
846  (isForHLT_ ? "column" : "pixel")),
847  200,
848  minimum,
849  maximum);
850 
851  for (unsigned int i : {1, 2}) {
852  SiPixelPI::adjustCanvasMargins(canvas.cd(i), 0.04, 0.12, 0.12, 0.02);
853  canvas.cd(i)->Modified();
854  }
855 
856  // actually fill the histograms
857  fillTheHistos(payload, hBPix, hFPix, myType);
858 
859  canvas.cd(1)->SetLogy();
860  hBPix->SetTitle("");
861  hBPix->GetYaxis()->SetRangeUser(0.1, hBPix->GetMaximum() * 10);
862  hBPix->SetFillColor(kBlue);
863  hBPix->SetMarkerStyle(20);
864  hBPix->SetMarkerSize(1);
865  hBPix->Draw("hist");
866 
867  SiPixelPI::makeNicePlotStyle(hBPix.get());
868  hBPix->SetStats(true);
869 
870  canvas.cd(2)->SetLogy();
871  hFPix->SetTitle("");
872  hFPix->GetYaxis()->SetRangeUser(0.1, hFPix->GetMaximum() * 10);
873  hFPix->SetFillColor(kBlue);
874  hFPix->SetMarkerStyle(20);
875  hFPix->SetMarkerSize(1);
876  hFPix->Draw("hist");
877 
878  SiPixelPI::makeNicePlotStyle(hFPix.get());
879  hFPix->SetStats(true);
880 
881  canvas.Update();
882 
883  TLegend legend = TLegend(0.32, 0.92, 0.97, 0.95);
884  legend.SetHeader(("Payload hash: #bf{" + (std::get<1>(iov)) + "}").c_str(),
885  "C"); // option "C" allows to center the header
886  //legend.AddEntry(h1.get(), ("IOV: " + std::to_string(std::get<0>(iov))).c_str(), "PL");
887  legend.SetLineColor(10);
888  legend.SetTextSize(0.025);
889  canvas.cd(1);
890  legend.Draw("same");
891  canvas.cd(2);
892  legend.Draw("same");
893 
894  canvas.cd(1);
895  TPaveStats* st1 = (TPaveStats*)hBPix->FindObject("stats");
896  st1->SetTextSize(0.03);
897  SiPixelPI::adjustStats(st1, 0.13, 0.815, 0.44, 0.915);
898 
899  canvas.cd(2);
900  TPaveStats* st2 = (TPaveStats*)hFPix->FindObject("stats");
901  st2->SetTextSize(0.03);
902  SiPixelPI::adjustStats(st2, 0.14, 0.815, 0.44, 0.915);
903 
904  auto ltx = TLatex();
905  ltx.SetTextFont(62);
906  //ltx.SetTextColor(kBlue);
907  ltx.SetTextSize(0.045);
908  ltx.SetTextAlign(11);
909  canvas.cd(1);
910  ltx.DrawLatexNDC(gPad->GetLeftMargin() + 0.01,
911  1 - gPad->GetTopMargin() + 0.01,
912  ("SiPixel Gain Calibration IOV:" + std::to_string(std::get<0>(iov))).c_str());
913 
914  canvas.cd(2);
915  ltx.DrawLatexNDC(gPad->GetLeftMargin() + 0.01,
916  1 - gPad->GetTopMargin() + 0.01,
917  ("SiPixel Gain Calibration IOV:" + std::to_string(std::get<0>(iov))).c_str());
918 

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:37
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
gainCalibHelper::SiPixelGainCalibrationValuesByPart::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:923
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName
std::string m_imageFileName
Definition: PayloadInspector.h:845
mps_fire.i
i
Definition: mps_fire.py:355
gainCalibHelper::gainCalibPI::t_gain
Definition: SiPixelGainCalibHelper.h:37
gainCalibHelper::SiPixelGainCalibrationValuesByPart::SiPixelGainCalibrationValuesByPart
SiPixelGainCalibrationValuesByPart()
Definition: SiPixelGainCalibHelper.h:784
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::PlotImage
PlotImage(const std::string &title)
Definition: PayloadInspector.h:832
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
gainCalibHelper::TypeName
constexpr char const * TypeName[2]
Definition: SiPixelGainCalibHelper.h:200
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
jets_cff.payload
payload
Definition: jets_cff.py:34
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond
Definition: plugin.cc:23
edm::LogError
Definition: MessageLogger.h:183
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:840
listHistos.legend
legend
Definition: listHistos.py:41
SiPixelPI::adjustStats
void adjustStats(TPaveStats *stats, float X1, float Y1, float X2, float Y2)
Definition: SiPixelPayloadInspectorHelper.h:449
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
SiPixelPI::makeNicePlotStyle
void makeNicePlotStyle(TH1 *hist)
Definition: SiPixelPayloadInspectorHelper.h:475
gainCalibHelper::SiPixelGainCalibrationValuesByPart::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:922
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:145
cond::payloadInspector::SINGLE_IOV
Definition: PayloadInspector.h:265
SiPixelPI::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: SiPixelPayloadInspectorHelper.h:435