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)
 
cond::persistency::Session dbSession ()
 
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 ()
 
const std::map< std::string, std::string > & inputParamValues () const
 
bool isSingleIov () const
 
bool isTwoTags () const
 
unsigned int ntags () const
 
std::string payloadType () const
 
 PlotBase ()
 
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 153 of file SiPixelTemplateHelper.h.

Constructor & Destructor Documentation

◆ SiPixelHeaderTable()

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

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.

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_, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::iy(), templateHelper::SiPixelHeaderTable< PayloadType, StoreType, TransientType >::label_, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName, jetsAK4_Puppi_cff::payload, templateHelper::SiPixelHeaderTable< PayloadType, StoreType, TransientType >::roundoff(), AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, createPayload::tagname, and to_string().

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  // Some of the Phase-2 templates have DType = 0 for all partitions (TBPX, TEPX, TFPX)
246  // so they are distinguished by the uH strength value (<0).
247  // To avoid changing the behaviour of 0T payload (uH=-99) that case is treated separately
248  if (tempValue.head.Dtype != 0 || (uH < 0 && uH > -99)) {
249  h2_ghost->SetBinContent(idx, iy, 1);
250  } else {
251  h2_ghost->SetBinContent(idx, iy, -1);
252  }
253  h2_ghost->GetYaxis()->SetBinLabel(iy, h2_Header->GetYaxis()->GetBinLabel(iy));
254  h2_ghost->GetXaxis()->SetBinLabel(idx, "");
255  }
256 
257  if (tempValue.head.templ_version != tempVersion) {
258  tempVersion = tempValue.head.templ_version;
259  }
260  }
261 
262  h2_Header->GetXaxis()->LabelsOption("h");
263  h2_Header->GetXaxis()->SetNdivisions(500 + tempSize, false);
264  h2_Header->GetYaxis()->SetLabelSize(0.05);
265  h2_Header->SetMarkerSize(1.5);
266 
267  h2_ghost->GetXaxis()->LabelsOption("h");
268  h2_ghost->GetXaxis()->SetNdivisions(500 + tempSize, false);
269  h2_ghost->GetYaxis()->SetLabelSize(0.05);
270 
271  canvas.cd();
272  h2_ghost->Draw("col");
273  h2_Header->Draw("TEXTsame");
274 
275  TPaveText ksPt(0, 0, 0.88, 0.04, "NDC");
276  ksPt.SetBorderSize(0);
277  ksPt.SetFillColor(0);
278  const char* textToAdd = Form("%s Version: #color[2]{%i}. Payload hash: #color[2]{%s}",
279  (isTemplate_ ? "Template" : "GenError"),
280  tempVersion,
281  (std::get<1>(iov)).c_str());
282  ksPt.AddText(textToAdd);
283  ksPt.Draw();
284 
285  auto ltx = TLatex();
286  ltx.SetTextFont(62);
287  ltx.SetTextSize(0.040);
288  ltx.SetTextAlign(11);
289  ltx.DrawLatexNDC(
290  gPad->GetLeftMargin(),
291  1 - gPad->GetTopMargin() + 0.01,
292  ("#color[4]{" + tagname + "}, IOV: #color[4]{" + std::to_string(std::get<0>(iov)) + "}").c_str());
293 
295  canvas.SaveAs(fileName.c_str());
296  }
297  return true;
298  }
static std::string to_string(const XMLCh *ch)
def canvas(sub, attr)
Definition: svgfig.py:482
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
float roundoff(float value, unsigned char prec)
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)

◆ roundoff()

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

Definition at line 300 of file SiPixelTemplateHelper.h.

References f, and funct::pow().

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

300  {
301  float pow_10 = pow(10.0f, (float)prec);
302  return round(value * pow_10) / pow_10;
303  }
double f[11][100]
Definition: value.py:1
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

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