CMS 3D CMS Logo

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

#include <SiPixelGainCalibHelper.h>

Inheritance diagram for gainCalibHelper::SiPixelGainCalibrationValues< 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
 
 SiPixelGainCalibrationValues ()
 
- 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::SiPixelGainCalibrationValues< myType, PayloadType >

Definition at line 205 of file SiPixelGainCalibHelper.h.

Constructor & Destructor Documentation

◆ SiPixelGainCalibrationValues()

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

Definition at line 209 of file SiPixelGainCalibHelper.h.

211  Form("SiPixelGainCalibration %s Values", TypeName[myType])) {
212  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
213  isForHLT_ = false;
214  label_ = "SiPixelGainCalibrationOffline_PayloadInspector";
215  } else {
216  isForHLT_ = true;
217  label_ = "SiPixelGainCalibrationForHLT_PayloadInspector";
218  }
219  }

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

Member Function Documentation

◆ fill()

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

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

Definition at line 221 of file SiPixelGainCalibHelper.h.

221  {
222  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
223  auto iov = tag.iovs.front();
224 
225  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
226 
227  gStyle->SetOptStat("emr");
228 
229  float minimum(9999.);
230  float maximum(-9999.);
231 
232  switch (myType) {
233  case gainCalibPI::t_gain:
234  maximum = payload->getGainHigh();
235  minimum = payload->getGainLow();
236  break;
238  maximum = payload->getPedHigh();
239  minimum = payload->getPedLow();
240  break;
241  default:
242  edm::LogError(label_) << "Unrecognized type " << myType << std::endl;
243  break;
244  }
245 
246  TCanvas canvas("Canv", "Canv", 1200, 1000);
247  auto h1 = std::make_shared<TH1F>(Form("%s values", TypeName[myType]),
248  Form("SiPixel Gain Calibration %s - %s;per %s %s;# %ss",
249  (isForHLT_ ? "ForHLT" : "Offline"),
250  TypeName[myType],
251  (isForHLT_ ? "Column" : "Pixel"),
252  TypeName[myType],
253  (isForHLT_ ? "column" : "pixel")),
254  200,
255  minimum,
256  maximum);
257  canvas.cd();
258  SiPixelPI::adjustCanvasMargins(canvas.cd(), 0.06, 0.12, 0.12, 0.05);
259  canvas.Modified();
260 
261  // fill the histogram
262  gainCalibPI::fillTheHisto(payload, h1, myType);
263 
264  canvas.cd()->SetLogy();
265  h1->SetTitle("");
266  h1->GetYaxis()->SetRangeUser(0.1, h1->GetMaximum() * 10.);
267  h1->SetFillColor(kBlue);
268  h1->SetMarkerStyle(20);
269  h1->SetMarkerSize(1);
270  h1->Draw("bar2");
271 
273  h1->SetStats(true);
274 
275  canvas.Update();
276 
277  TLegend legend = TLegend(0.40, 0.88, 0.94, 0.93);
278  legend.SetHeader(("Payload hash: #bf{" + (std::get<1>(iov)) + "}").c_str(),
279  "C"); // option "C" allows to center the header
280  //legend.AddEntry(h1.get(), ("IOV: " + std::to_string(std::get<0>(iov))).c_str(), "PL");
281  legend.SetLineColor(10);
282  legend.SetTextSize(0.025);
283  legend.Draw("same");
284 
285  TPaveStats* st = (TPaveStats*)h1->FindObject("stats");
286  st->SetTextSize(0.03);
287  SiPixelPI::adjustStats(st, 0.15, 0.83, 0.39, 0.93);
288 
289  auto ltx = TLatex();
290  ltx.SetTextFont(62);
291  //ltx.SetTextColor(kBlue);
292  ltx.SetTextSize(0.05);
293  ltx.SetTextAlign(11);
294  ltx.DrawLatexNDC(gPad->GetLeftMargin() + 0.1,
295  1 - gPad->GetTopMargin() + 0.01,
296  ("SiPixel Gain Calibration IOV:" + std::to_string(std::get<0>(iov))).c_str());
297 
299  canvas.SaveAs(fileName.c_str());
300 
301  return true;
302  }

References SiPixelPI::adjustCanvasMargins(), SiPixelPI::adjustStats(), svgfig::canvas(), cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload(), MillePedeFileConverter_cfg::fileName, gainCalibHelper::gainCalibPI::fillTheHisto(), gainCalibHelper::SiPixelGainCalibrationValues< myType, PayloadType >::isForHLT_, gainCalibHelper::SiPixelGainCalibrationValues< myType, PayloadType >::label_, listHistos::legend, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName, SiPixelPI::makeNicePlotStyle(), jets_cff::payload, AlCaHLTBitMon_QueryRunRegistry::string, gainCalibHelper::gainCalibPI::t_gain, gainCalibHelper::gainCalibPI::t_pedestal, GlobalPosition_Frontier_DevDB_cff::tag, and gainCalibHelper::TypeName.

Member Data Documentation

◆ isForHLT_

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

◆ label_

template<gainCalibPI::type myType, class PayloadType >
std::string gainCalibHelper::SiPixelGainCalibrationValues< myType, PayloadType >::label_
protected
gainCalibHelper::gainCalibPI::t_pedestal
Definition: SiPixelGainCalibHelper.h:37
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName
std::string m_imageFileName
Definition: PayloadInspector.h:845
gainCalibHelper::gainCalibPI::t_gain
Definition: SiPixelGainCalibHelper.h:37
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
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
gainCalibHelper::gainCalibPI::fillTheHisto
static void fillTheHisto(const std::shared_ptr< PayloadType > &payload, std::shared_ptr< TH1F > h1, gainCalibPI::type theType, const std::vector< uint32_t > &wantedIds={})
Definition: SiPixelGainCalibHelper.h:42
SiPixelPI::adjustStats
void adjustStats(TPaveStats *stats, float X1, float Y1, float X2, float Y2)
Definition: SiPixelPayloadInspectorHelper.h:449
gainCalibHelper::SiPixelGainCalibrationValues::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:305
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
SiPixelPI::makeNicePlotStyle
void makeNicePlotStyle(TH1 *hist)
Definition: SiPixelPayloadInspectorHelper.h:475
gainCalibHelper::SiPixelGainCalibrationValues::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:306
SiPixelPI::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: SiPixelPayloadInspectorHelper.h:435