CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
templateHelper::SiPixelHeaderTable< PayloadType, StoreType, TransientType > Class Template Reference

#include <SiPixelTemplateHelper.h>

Inheritance diagram for templateHelper::SiPixelHeaderTable< PayloadType, StoreType, TransientType >:
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV > cond::payloadInspector::PlotImpl< IOV_M, 0 > cond::payloadInspector::PlotBase

Public Member Functions

bool fill () override
 
float roundoff (float value, unsigned char prec)
 
 SiPixelHeaderTable ()
 
- 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 isTemplate_
 
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<class PayloadType, class StoreType, class TransientType>
class templateHelper::SiPixelHeaderTable< PayloadType, StoreType, TransientType >

Definition at line 152 of file SiPixelTemplateHelper.h.

Constructor & Destructor Documentation

◆ SiPixelHeaderTable()

template<class PayloadType , class StoreType , class TransientType >
templateHelper::SiPixelHeaderTable< PayloadType, StoreType, TransientType >::SiPixelHeaderTable ( )
inline

Definition at line 155 of file SiPixelTemplateHelper.h.

157  "SiPixel CPE Conditions Header summary") {
158  if constexpr (std::is_same_v<PayloadType, SiPixelGenErrorDBObject>) {
159  isTemplate_ = false;
160  label_ = "SiPixelGenErrorDBObject_PayloadInspector";
161  } else {
162  isTemplate_ = true;
163  label_ = "SiPixelTemplateDBObject_PayloadInspector";
164  }
165  }

References templateHelper::SiPixelHeaderTable< PayloadType, StoreType, TransientType >::isTemplate_, and templateHelper::SiPixelHeaderTable< PayloadType, StoreType, TransientType >::label_.

Member Function Documentation

◆ fill()

template<class PayloadType , class StoreType , class TransientType >
bool templateHelper::SiPixelHeaderTable< PayloadType, StoreType, TransientType >::fill ( )
inlineoverridevirtual

< template ID number

< Bfield in Tesla

< hall mobility

< pixel size (for future use in upgraded geometry)

< pixel size (for future use in upgraded geometry)

< pixel size (for future use in upgraded geometry)

< number of Template y entries

< number of Template y-slices of x entries

< number of Template x-entries in each slice

< detector type (0=BPix, 1=FPix)

< Charge scaling to match cmssw and pixelav

< detector bias potential in Volts

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

Definition at line 167 of file SiPixelTemplateHelper.h.

167  {
168  gStyle->SetHistMinimumZero(); // will display zero as zero in the text map
169  gStyle->SetPalette(kMint); // for the ghost plot (colored BPix and FPix bins)
170 
171  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
172  auto iov = tag.iovs.front();
173  auto tagname = tag.name;
174  std::vector<StoreType> thePixelTemp_;
175  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
176 
177  if (payload.get()) {
178  if (!TransientType::pushfile(*payload, thePixelTemp_)) {
179  throw cms::Exception(label_) << "\nERROR:" << (isTemplate_ ? "Templates" : "GenErrors")
180  << " not filled correctly."
181  << " Check the conditions. Using "
182  << (isTemplate_ ? "SiPixelTemplateDBObject" : "SiPixelGenErrorDBObject")
183  << payload->version() << "\n\n";
184  }
185 
186  // store the map of ID / interesting quantities
187  TransientType templ(thePixelTemp_);
188  TCanvas canvas("Header Summary", "Header summary", 1400, 1000);
189  canvas.cd();
190 
191  unsigned int tempSize = thePixelTemp_.size();
192 
193  canvas.SetTopMargin(0.07);
194  canvas.SetBottomMargin(0.06);
195  canvas.SetLeftMargin(0.17);
196  canvas.SetRightMargin(0.03);
197  canvas.Modified();
198  canvas.SetGrid();
199 
200  auto h2_Header = std::make_unique<TH2F>("Header", ";;", tempSize, 0, tempSize, 12, 0., 12.);
201  auto h2_ghost = std::make_unique<TH2F>("ghost", ";;", tempSize, 0, tempSize, 12, 0., 12.);
202  h2_Header->SetStats(false);
203  h2_ghost->SetStats(false);
204 
205  int tempVersion = -999;
206 
207  for (const auto& theTemp : thePixelTemp_ | boost::adaptors::indexed(1)) {
208  auto tempValue = theTemp.value();
209  auto idx = theTemp.index();
210  float uH = -99.;
211  if (tempValue.head.Bfield != 0.) {
212  uH = roundoff(tempValue.head.lorxwidth / tempValue.head.zsize / tempValue.head.Bfield, 4);
213  }
214 
215  // clang-format off
216  h2_Header->SetBinContent(idx, 12, tempValue.head.ID);
217  h2_Header->SetBinContent(idx, 11, tempValue.head.Bfield);
218  h2_Header->SetBinContent(idx, 10, uH);
219  h2_Header->SetBinContent(idx, 9, tempValue.head.xsize);
220  h2_Header->SetBinContent(idx, 8, tempValue.head.ysize);
221  h2_Header->SetBinContent(idx, 7, tempValue.head.zsize);
222  h2_Header->SetBinContent(idx, 6, tempValue.head.NTy);
223  h2_Header->SetBinContent(idx, 5, tempValue.head.NTyx);
224  h2_Header->SetBinContent(idx, 4, tempValue.head.NTxx);
225  h2_Header->SetBinContent(idx, 3, tempValue.head.Dtype);
226  h2_Header->SetBinContent(idx, 2, tempValue.head.qscale);
227  h2_Header->SetBinContent(idx, 1, tempValue.head.Vbias);
228  // clang-format on
229 
230  h2_Header->GetYaxis()->SetBinLabel(12, (isTemplate_ ? "TemplateID" : "GenErrorID"));
231  h2_Header->GetYaxis()->SetBinLabel(11, "B-field [T]");
232  h2_Header->GetYaxis()->SetBinLabel(10, "#mu_{H} [1/T]");
233  h2_Header->GetYaxis()->SetBinLabel(9, "x-size [#mum]");
234  h2_Header->GetYaxis()->SetBinLabel(8, "y-size [#mum]");
235  h2_Header->GetYaxis()->SetBinLabel(7, "z-size [#mum]");
236  h2_Header->GetYaxis()->SetBinLabel(6, "NTy");
237  h2_Header->GetYaxis()->SetBinLabel(5, "NTyx");
238  h2_Header->GetYaxis()->SetBinLabel(4, "NTxx");
239  h2_Header->GetYaxis()->SetBinLabel(3, "DetectorType");
240  h2_Header->GetYaxis()->SetBinLabel(2, "qScale");
241  h2_Header->GetYaxis()->SetBinLabel(1, "VBias [V]");
242  h2_Header->GetXaxis()->SetBinLabel(idx, "");
243 
244  for (unsigned int iy = 1; iy <= 12; iy++) {
245  if (tempValue.head.Dtype != 0 || uH < 0) {
246  h2_ghost->SetBinContent(idx, iy, 1);
247  } else {
248  h2_ghost->SetBinContent(idx, iy, -1);
249  }
250  h2_ghost->GetYaxis()->SetBinLabel(iy, h2_Header->GetYaxis()->GetBinLabel(iy));
251  h2_ghost->GetXaxis()->SetBinLabel(idx, "");
252  }
253 
254  if (tempValue.head.templ_version != tempVersion) {
255  tempVersion = tempValue.head.templ_version;
256  }
257  }
258 
259  h2_Header->GetXaxis()->LabelsOption("h");
260  h2_Header->GetXaxis()->SetNdivisions(500 + tempSize, false);
261  h2_Header->GetYaxis()->SetLabelSize(0.05);
262  h2_Header->SetMarkerSize(1.5);
263 
264  h2_ghost->GetXaxis()->LabelsOption("h");
265  h2_ghost->GetXaxis()->SetNdivisions(500 + tempSize, false);
266  h2_ghost->GetYaxis()->SetLabelSize(0.05);
267 
268  canvas.cd();
269  h2_ghost->Draw("col");
270  h2_Header->Draw("TEXTsame");
271 
272  TPaveText ksPt(0, 0, 0.88, 0.04, "NDC");
273  ksPt.SetBorderSize(0);
274  ksPt.SetFillColor(0);
275  const char* textToAdd = Form("%s Version: #color[2]{%i}. Payload hash: #color[2]{%s}",
276  (isTemplate_ ? "Template" : "GenError"),
277  tempVersion,
278  (std::get<1>(iov)).c_str());
279  ksPt.AddText(textToAdd);
280  ksPt.Draw();
281 
282  auto ltx = TLatex();
283  ltx.SetTextFont(62);
284  ltx.SetTextSize(0.040);
285  ltx.SetTextAlign(11);
286  ltx.DrawLatexNDC(
287  gPad->GetLeftMargin(),
288  1 - gPad->GetTopMargin() + 0.01,
289  ("#color[4]{" + tagname + "}, IOV: #color[4]{" + std::to_string(std::get<0>(iov)) + "}").c_str());
290 
292  canvas.SaveAs(fileName.c_str());
293  }
294  return true;
295  }

References svgfig::canvas(), Exception, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload(), MillePedeFileConverter_cfg::fileName, heavyIonCSV_trainingSettings::idx, templateHelper::SiPixelHeaderTable< PayloadType, StoreType, TransientType >::isTemplate_, templateHelper::SiPixelHeaderTable< PayloadType, StoreType, TransientType >::label_, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName, jets_cff::payload, templateHelper::SiPixelHeaderTable< PayloadType, StoreType, TransientType >::roundoff(), AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, and createPayload::tagname.

◆ roundoff()

template<class PayloadType , class StoreType , class TransientType >
float templateHelper::SiPixelHeaderTable< PayloadType, StoreType, TransientType >::roundoff ( float  value,
unsigned char  prec 
)
inline

Definition at line 297 of file SiPixelTemplateHelper.h.

297  {
298  float pow_10 = pow(10.0f, (float)prec);
299  return round(value * pow_10) / pow_10;
300  }

References f, and funct::pow().

Referenced by templateHelper::SiPixelHeaderTable< PayloadType, StoreType, TransientType >::fill().

Member Data Documentation

◆ isTemplate_

template<class PayloadType , class StoreType , class TransientType >
bool templateHelper::SiPixelHeaderTable< PayloadType, StoreType, TransientType >::isTemplate_
protected

◆ label_

template<class PayloadType , class StoreType , class TransientType >
std::string templateHelper::SiPixelHeaderTable< PayloadType, StoreType, TransientType >::label_
protected
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:910
templateHelper::SiPixelHeaderTable::label_
std::string label_
Definition: SiPixelTemplateHelper.h:304
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
templateHelper::SiPixelHeaderTable::roundoff
float roundoff(float value, unsigned char prec)
Definition: SiPixelTemplateHelper.h:297
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
jets_cff.payload
payload
Definition: jets_cff.py:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:905
value
Definition: value.py:1
templateHelper::SiPixelHeaderTable::isTemplate_
bool isTemplate_
Definition: SiPixelTemplateHelper.h:303
createPayload.tagname
tagname
Definition: createPayload.py:183
Exception
Definition: hltDiff.cc:245
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29