CMS 3D CMS Logo

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

#include <SiPixelGainCalibHelper.h>

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

Public Member Functions

bool fill () override
 
 SiPixelGainCalibrationMap ()
 
- 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 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
 

Private Attributes

TrackerTopology m_trackerTopo
 

Static Private Attributes

static constexpr std::array< int, 3 > k_height = {{1200, 600, 1600}}
 
static constexpr int n_layers = 4
 
static constexpr int n_rings = 2
 

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, SiPixelPI::DetType myDetType>
class gainCalibHelper::SiPixelGainCalibrationMap< myType, PayloadType, myDetType >

Definition at line 1356 of file SiPixelGainCalibHelper.h.

Constructor & Destructor Documentation

◆ SiPixelGainCalibrationMap()

template<gainCalibPI::type myType, class PayloadType , SiPixelPI::DetType myDetType>
gainCalibHelper::SiPixelGainCalibrationMap< myType, PayloadType, myDetType >::SiPixelGainCalibrationMap ( )
inline

Definition at line 1359 of file SiPixelGainCalibHelper.h.

References StandaloneTrackerTopology::fromTrackerParametersXMLFile(), and contentValuesFiles::fullPath.

1361  Form("SiPixelGainCalibration %s Barrel Pixel Map", TypeName[myType])),
1363  edm::FileInPath("Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml").fullPath())} {
1364  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
1365  isForHLT_ = false;
1366  label_ = "SiPixelGainCalibrationOffline_PayloadInspector";
1367  } else {
1368  isForHLT_ = true;
1369  label_ = "SiPixelGainCalibrationForHLT_PayloadInspector";
1370  }
1371  };
constexpr char const * TypeName[2]
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)

Member Function Documentation

◆ fill()

template<gainCalibPI::type myType, class PayloadType , SiPixelPI::DetType myDetType>
bool gainCalibHelper::SiPixelGainCalibrationMap< myType, PayloadType, myDetType >::fill ( )
inlineoverridevirtual

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

Definition at line 1373 of file SiPixelGainCalibHelper.h.

References svgfig::canvas(), COUT, SiPixelPI::displayNotSupported(), Phase1PixelROCMaps::drawBarrelMaps(), Phase1PixelROCMaps::drawForwardMaps(), Phase1PixelROCMaps::drawMaps(), Exception, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload(), MillePedeFileConverter_cfg::fileName, gainCalibHelper::gainCalibPI::fillThePerModuleMap(), Phase1PixelROCMaps::fillWholeModule(), Phase1PixelROCMaps::getLayerMaps(), Phase1PixelROCMaps::getRingMaps(), gainCalibHelper::SiPixelGainCalibrationMap< myType, PayloadType, myDetType >::isForHLT_, gainCalibHelper::SiPixelGainCalibrationMap< myType, PayloadType, myDetType >::k_height, gainCalibHelper::SiPixelGainCalibrationMap< myType, PayloadType, myDetType >::label_, phase1PixelTopology::layer, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName, gainCalibHelper::SiPixelGainCalibrationMap< myType, PayloadType, myDetType >::m_trackerTopo, gainCalibHelper::SiPixelGainCalibrationMap< myType, PayloadType, myDetType >::n_layers, gainCalibHelper::SiPixelGainCalibrationMap< myType, PayloadType, myDetType >::n_rings, jetsAK4_Puppi_cff::payload, SiPixelPI::phase1size, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, TrackerTopology::pxbLayer(), relativeConstraints::ring, SiPixelPI::ring(), AlCaHLTBitMon_QueryRunRegistry::string, DetId::subdetId(), SiPixelPI::t_all, SiPixelPI::t_barrel, SiPixelPI::t_forward, gainCalibHelper::gainCalibPI::t_titles, makeGlobalPositionRcd_cfg::tag, createPayload::tagname, cond::impl::to_string(), SiPixelPI::unpack(), and trackingPlots::ztitle.

1373  {
1374  TGaxis::SetMaxDigits(2);
1375 
1376  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
1377  auto tagname = tag.name;
1378  auto iov = tag.iovs.front();
1379 
1380  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
1381 
1383  fmt::sprintf("average per %s %s", isForHLT_ ? "column" : "pixel", gainCalibPI::t_titles[myType]);
1384  Phase1PixelROCMaps theGainsMap("", ztitle);
1385 
1386  std::map<uint32_t, float> GainCalibMap_;
1387  gainCalibPI::fillThePerModuleMap(payload, GainCalibMap_, myType);
1388  if (GainCalibMap_.size() != SiPixelPI::phase1size) {
1389  edm::LogError(label_) << "SiPixelGainCalibration maps are not supported for non-Phase1 Pixel geometries !";
1390  TCanvas canvas("Canv", "Canv", 1200, 1000);
1391  SiPixelPI::displayNotSupported(canvas, GainCalibMap_.size());
1393  canvas.SaveAs(fileName.c_str());
1394  return false;
1395  }
1396 
1397  // hard-coded phase-I
1398  std::array<double, n_layers> b_minima = {{999., 999., 999., 999.}};
1399  std::array<double, n_rings> f_minima = {{999., 999.}};
1400 
1401  for (const auto& element : GainCalibMap_) {
1402  int subid = DetId(element.first).subdetId();
1403  if (subid == PixelSubdetector::PixelBarrel) {
1404  auto layer = m_trackerTopo.pxbLayer(DetId(element.first));
1405  if (element.second < b_minima.at(layer - 1)) {
1406  b_minima.at(layer - 1) = element.second;
1407  }
1408  theGainsMap.fillWholeModule(element.first, element.second);
1409  } else if (subid == PixelSubdetector::PixelEndcap) {
1410  auto ring = SiPixelPI::ring(DetId(element.first), m_trackerTopo, true);
1411  if (element.second < f_minima.at(ring - 1)) {
1412  f_minima.at(ring - 1) = element.second;
1413  }
1414  theGainsMap.fillWholeModule(element.first, element.second);
1415  }
1416  }
1417 
1418  gStyle->SetOptStat(0);
1419  //=========================
1420  TCanvas canvas("Summary", "Summary", 1200, k_height[myDetType]);
1421  canvas.cd();
1422 
1423  auto unpacked = SiPixelPI::unpack(std::get<0>(iov));
1424 
1425  std::string IOVstring = (unpacked.first == 0)
1426  ? std::to_string(unpacked.second)
1427  : (std::to_string(unpacked.first) + "," + std::to_string(unpacked.second));
1428 
1429  const auto headerText = fmt::sprintf("#color[4]{%s}, IOV: #color[4]{%s}", tagname, IOVstring);
1430 
1431  switch (myDetType) {
1432  case SiPixelPI::t_barrel:
1433  theGainsMap.drawBarrelMaps(canvas, headerText);
1434  break;
1435  case SiPixelPI::t_forward:
1436  theGainsMap.drawForwardMaps(canvas, headerText);
1437  break;
1438  case SiPixelPI::t_all:
1439  theGainsMap.drawMaps(canvas, headerText);
1440  break;
1441  default:
1442  throw cms::Exception("SiPixelGainCalibrationMap")
1443  << "\nERROR: unrecognized Pixel Detector part " << std::endl;
1444  }
1445 
1446  if (myDetType == SiPixelPI::t_barrel || myDetType == SiPixelPI::t_all) {
1447  for (unsigned int lay = 1; lay <= n_layers; lay++) {
1448  //SiPixelPI::adjustCanvasMargins(canvas.cd(lay), -1, 0.08, 0.1, 0.13);
1449 
1450  auto h_bpix_Gains = theGainsMap.getLayerMaps();
1451 
1452  COUT << " layer:" << lay << " max:" << h_bpix_Gains[lay - 1]->GetMaximum() << " min: " << b_minima.at(lay - 1)
1453  << std::endl;
1454 
1455  h_bpix_Gains[lay - 1]->GetZaxis()->SetRangeUser(b_minima.at(lay - 1) - 0.001,
1456  h_bpix_Gains[lay - 1]->GetMaximum() + 0.001);
1457  }
1458  }
1459 
1460  if (myDetType == SiPixelPI::t_forward || myDetType == SiPixelPI::t_all) {
1461  for (unsigned int ring = 1; ring <= n_rings; ring++) {
1462  //SiPixelPI::adjustCanvasMargins(canvas.cd(ring), -1, 0.08, 0.1, 0.13);
1463 
1464  auto h_fpix_Gains = theGainsMap.getRingMaps();
1465 
1466  COUT << " ring:" << ring << " max:" << h_fpix_Gains[ring - 1]->GetMaximum()
1467  << " min: " << f_minima.at(ring - 1) << std::endl;
1468 
1469  h_fpix_Gains[ring - 1]->GetZaxis()->SetRangeUser(f_minima.at(ring - 1) - 0.001,
1470  h_fpix_Gains[ring - 1]->GetMaximum() + 0.001);
1471  }
1472  }
1473 
1475  canvas.SaveAs(fileName.c_str());
1476 
1477  return true;
1478  }
static const std::array< std::string, 3 > t_titles
unsigned int pxbLayer(const DetId &id) const
static constexpr std::array< int, 3 > k_height
std::string to_string(const V &value)
Definition: OMSAccess.h:71
Log< level::Error, false > LogError
constexpr std::array< uint8_t, layerIndexSize > layer
static void fillThePerModuleMap(const std::shared_ptr< PayloadType > &payload, AvgMap &map, gainCalibPI::type theType)
std::pair< unsigned int, unsigned int > unpack(cond::Time_t since)
static const unsigned int phase1size
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
#define COUT
int ring(const DetId &detid, const TrackerTopology &tTopo_, bool phase_)
Definition: DetId.h:17
void displayNotSupported(TCanvas &canv, const unsigned int size)
def canvas(sub, attr)
Definition: svgfig.py:482
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)

Member Data Documentation

◆ isForHLT_

template<gainCalibPI::type myType, class PayloadType , SiPixelPI::DetType myDetType>
bool gainCalibHelper::SiPixelGainCalibrationMap< myType, PayloadType, myDetType >::isForHLT_
protected

◆ k_height

template<gainCalibPI::type myType, class PayloadType , SiPixelPI::DetType myDetType>
constexpr std::array<int, 3> gainCalibHelper::SiPixelGainCalibrationMap< myType, PayloadType, myDetType >::k_height = {{1200, 600, 1600}}
staticprivate

◆ label_

template<gainCalibPI::type myType, class PayloadType , SiPixelPI::DetType myDetType>
std::string gainCalibHelper::SiPixelGainCalibrationMap< myType, PayloadType, myDetType >::label_
protected

◆ m_trackerTopo

template<gainCalibPI::type myType, class PayloadType , SiPixelPI::DetType myDetType>
TrackerTopology gainCalibHelper::SiPixelGainCalibrationMap< myType, PayloadType, myDetType >::m_trackerTopo
private

◆ n_layers

template<gainCalibPI::type myType, class PayloadType , SiPixelPI::DetType myDetType>
constexpr int gainCalibHelper::SiPixelGainCalibrationMap< myType, PayloadType, myDetType >::n_layers = 4
staticprivate

◆ n_rings

template<gainCalibPI::type myType, class PayloadType , SiPixelPI::DetType myDetType>
constexpr int gainCalibHelper::SiPixelGainCalibrationMap< myType, PayloadType, myDetType >::n_rings = 2
staticprivate