CMS 3D CMS Logo

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

#include <SiPixelGainCalibHelper.h>

Inheritance diagram for gainCalibHelper::SiPixelGainCalibrationBPIXMap< 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
 
 SiPixelGainCalibrationBPIXMap ()
 
- 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
 

Private Attributes

TrackerTopology m_trackerTopo
 

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::SiPixelGainCalibrationBPIXMap< myType, PayloadType >

Definition at line 1098 of file SiPixelGainCalibHelper.h.

Constructor & Destructor Documentation

◆ SiPixelGainCalibrationBPIXMap()

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

Definition at line 1102 of file SiPixelGainCalibHelper.h.

1107  public:
1109  : cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV>(
1110  Form("SiPixelGainCalibration %s Barrel Pixel Map", TypeName[myType])),
1112  edm::FileInPath("Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml").fullPath())} {
1113  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
1114  isForHLT_ = false;

References StandaloneTrackerTopology::fromTrackerParametersXMLFile(), contentValuesFiles::fullPath, gainCalibHelper::SiPixelGainCalibrationBPIXMap< myType, PayloadType >::isForHLT_, gainCalibHelper::SiPixelGainCalibrationBPIXMap< myType, PayloadType >::label_, gainCalibHelper::SiPixelGainCalibrationBPIXMap< myType, PayloadType >::m_trackerTopo, and gainCalibHelper::TypeName.

Member Function Documentation

◆ fill()

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

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

Definition at line 1116 of file SiPixelGainCalibHelper.h.

1116  {
1117  isForHLT_ = true;
1118  label_ = "SiPixelGainCalibrationForHLT_PayloadInspector";
1119  }
1120  };
1121 
1122  bool fill() override {
1123  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
1124  auto iov = tag.iovs.front();
1125 
1126  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
1127 
1128  static const int n_layers = 4;
1129  int nlad_list[n_layers] = {6, 14, 22, 32};
1130  int divide_roc = 1;
1131 
1132  // --------------------- BOOK HISTOGRAMS
1133  std::array<TH2D*, n_layers> h_bpix_Gains;
1134 
1135  for (unsigned int lay = 1; lay <= 4; lay++) {
1136  int nlad = nlad_list[lay - 1];
1137 
1138  std::string name = "occ_Gain_Layer_" + std::to_string(lay);
1139  std::string title = "; Module # ; Ladder #";
1140  h_bpix_Gains[lay - 1] = new TH2D(name.c_str(),
1141  title.c_str(),
1142  72 * divide_roc,
1143  -4.5,
1144  4.5,
1145  (nlad * 4 + 2) * divide_roc,
1146  -nlad - 0.5,
1147  nlad + 0.5);
1148  }
1149 
1150  std::map<uint32_t, float> GainCalibMap_;
1151  gainCalibPI::fillThePerModuleMap(payload, GainCalibMap_, myType);
1152  if (GainCalibMap_.size() != SiPixelPI::phase1size) {
1153  edm::LogError(label_) << "SiPixelGainCalibration maps are not supported for non-Phase1 Pixel geometries !";
1154  TCanvas canvas("Canv", "Canv", 1200, 1000);
1155  SiPixelPI::displayNotSupported(canvas, GainCalibMap_.size());
1157  canvas.SaveAs(fileName.c_str());
1158  return false;
1159  }
1160 
1161  // hard-coded phase-I
1162  std::array<double, 4> minima = {{999., 999., 999., 999.}};
1163 
1164  for (const auto& element : GainCalibMap_) {
1165  int subid = DetId(element.first).subdetId();
1166  if (subid == PixelSubdetector::PixelBarrel) {
1167  auto layer = m_trackerTopo.pxbLayer(DetId(element.first));
1168  auto s_ladder = SiPixelPI::signed_ladder(DetId(element.first), m_trackerTopo, true);
1169  auto s_module = SiPixelPI::signed_module(DetId(element.first), m_trackerTopo, true);
1170 
1171  auto ladder = m_trackerTopo.pxbLadder(DetId(element.first));
1172  auto module = m_trackerTopo.pxbModule(DetId(element.first));
1173  COUT << "layer:" << layer << " ladder:" << ladder << " module:" << module << " signed ladder: " << s_ladder
1174  << " signed module: " << s_module << std::endl;
1175 
1176  if (element.second < minima.at(layer - 1))
1177  minima.at(layer - 1) = element.second;
1178 
1179  auto rocsToMask = SiPixelPI::maskedBarrelRocsToBins(layer, s_ladder, s_module);
1180  for (const auto& bin : rocsToMask) {
1181  h_bpix_Gains[layer - 1]->SetBinContent(bin.first, bin.second, element.second);
1182  }
1183  }
1184  }
1185 
1186  gStyle->SetOptStat(0);
1187  //=========================
1188  TCanvas canvas("Summary", "Summary", 1200, 1200);
1189  canvas.Divide(2, 2);
1190 
1191  for (unsigned int lay = 1; lay <= 4; lay++) {
1192  SiPixelPI::adjustCanvasMargins(canvas.cd(lay), -1, 0.08, 0.1, 0.13);
1193 
1194  COUT << " layer:" << lay << " max:" << h_bpix_Gains[lay - 1]->GetMaximum() << " min: " << minima.at(lay - 1)
1195  << std::endl;
1196 
1197  SiPixelPI::dress_occup_plot(canvas, h_bpix_Gains[lay - 1], lay, 0, 1, true, true, false);
1198  h_bpix_Gains[lay - 1]->GetZaxis()->SetRangeUser(minima.at(lay - 1) - 0.001,
1199  h_bpix_Gains[lay - 1]->GetMaximum() + 0.001);
1200  }
1201 
1202  auto unpacked = SiPixelPI::unpack(std::get<0>(iov));
1203 
1204  for (unsigned int lay = 1; lay <= 4; lay++) {
1205  canvas.cd(lay);
1206  auto ltx = TLatex();
1207  ltx.SetTextFont(62);
1208  ltx.SetTextColor(kBlue);
1209  ltx.SetTextSize(0.055);
1210  ltx.SetTextAlign(11);
1211  ltx.DrawLatexNDC(gPad->GetLeftMargin(),
1212  1 - gPad->GetTopMargin() + 0.01,
1213  unpacked.first == 0
1214  ? ("IOV:" + std::to_string(unpacked.second)).c_str()
1215  : (std::to_string(unpacked.first) + "," + std::to_string(unpacked.second)).c_str());
1216  }

Member Data Documentation

◆ isForHLT_

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

◆ label_

template<gainCalibPI::type myType, class PayloadType >
std::string gainCalibHelper::SiPixelGainCalibrationBPIXMap< myType, PayloadType >::label_
protected

◆ m_trackerTopo

template<gainCalibPI::type myType, class PayloadType >
TrackerTopology gainCalibHelper::SiPixelGainCalibrationBPIXMap< myType, PayloadType >::m_trackerTopo
private
gainCalibHelper::SiPixelGainCalibrationBPIXMap::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:1222
SiPixelPI::unpack
std::pair< unsigned int, unsigned int > unpack(cond::Time_t since)
Definition: SiPixelPayloadInspectorHelper.h:44
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
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
gainCalibHelper::SiPixelGainCalibrationBPIXMap::m_trackerTopo
TrackerTopology m_trackerTopo
Definition: SiPixelGainCalibHelper.h:1219
contentValuesFiles.fullPath
fullPath
Definition: contentValuesFiles.py:64
TrackerTopology::pxbLadder
unsigned int pxbLadder(const DetId &id) const
Definition: TrackerTopology.h:155
gainCalibHelper::SiPixelGainCalibrationBPIXMap::fill
bool fill() override
Definition: SiPixelGainCalibHelper.h:1116
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
SiPixelPI::displayNotSupported
void displayNotSupported(TCanvas &canv, const unsigned int size)
Definition: SiPixelPayloadInspectorHelper.h:971
TrackerTopology::pxbLayer
unsigned int pxbLayer(const DetId &id) const
Definition: TrackerTopology.h:144
DetId
Definition: DetId.h:17
edm::FileInPath
Definition: FileInPath.h:64
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
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::payloadInspector::PlotBase::title
std::string title() const
Definition: PayloadInspector.cc:42
cond
Definition: plugin.cc:23
gainCalibHelper::gainCalibPI::fillThePerModuleMap
static void fillThePerModuleMap(const std::shared_ptr< PayloadType > &payload, AvgMap &map, gainCalibPI::type theType)
Definition: SiPixelGainCalibHelper.h:99
edm::LogError
Definition: MessageLogger.h:183
SiPixelPI::maskedBarrelRocsToBins
std::vector< std::pair< int, int > > maskedBarrelRocsToBins(int layer, int ladder, int module)
Definition: SiPixelPayloadInspectorHelper.h:697
SiPixelPI::phase1size
static const unsigned int phase1size
Definition: SiPixelPayloadInspectorHelper.h:41
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:840
module
Definition: vlib.h:198
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
SiPixelPI::signed_module
int signed_module(const DetId &detid, const TrackerTopology &tTopo_, bool phase_)
Definition: SiPixelPayloadInspectorHelper.h:77
COUT
#define COUT
Definition: PVValidationHelpers.h:13
TrackerTopology::pxbModule
unsigned int pxbModule(const DetId &id) const
Definition: TrackerTopology.h:160
PVValHelper::ladder
Definition: PVValidationHelpers.h:72
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
SiPixelPI::dress_occup_plot
void dress_occup_plot(TCanvas &canv, TH2 *h, int lay, int ring=0, int phase=0, bool half_shift=true, bool mark_zero=true, bool standard_palette=true)
Definition: SiPixelPayloadInspectorHelper.h:148
cond::payloadInspector::SINGLE_IOV
Definition: PayloadInspector.h:265
SiPixelPI::signed_ladder
int signed_ladder(const DetId &detid, const TrackerTopology &tTopo_, bool phase_)
Definition: SiPixelPayloadInspectorHelper.h:65
StandaloneTrackerTopology::fromTrackerParametersXMLFile
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
Definition: StandaloneTrackerTopology.cc:168
gainCalibHelper::SiPixelGainCalibrationBPIXMap::SiPixelGainCalibrationBPIXMap
SiPixelGainCalibrationBPIXMap()
Definition: SiPixelGainCalibHelper.h:1102
SiPixelPI::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: SiPixelPayloadInspectorHelper.h:435
gainCalibHelper::SiPixelGainCalibrationBPIXMap::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:1223