CMS 3D CMS Logo

Enumerations | Functions
gainCalibHelper::gainCalibPI Namespace Reference

Enumerations

enum  type { t_gain = 0, t_pedestal = 1, t_correlation = 2 }
 

Functions

template<typename PayloadType >
static void fillTheHisto (const std::shared_ptr< PayloadType > &payload, std::shared_ptr< TH1F > h1, gainCalibPI::type theType, const std::vector< uint32_t > &wantedIds={})
 
template<typename PayloadType >
static void fillTheHistos (const std::shared_ptr< PayloadType > &payload, std::shared_ptr< TH1 > hBPix, std::shared_ptr< TH1 > hFPix, gainCalibPI::type theType)
 
template<typename PayloadType >
static void fillThePerModuleMap (const std::shared_ptr< PayloadType > &payload, AvgMap &map, gainCalibPI::type theType)
 

Enumeration Type Documentation

◆ type

Enumerator
t_gain 
t_pedestal 
t_correlation 

Definition at line 37 of file SiPixelGainCalibHelper.h.

37 { t_gain = 0, t_pedestal = 1, t_correlation = 2 };

Function Documentation

◆ fillTheHisto()

template<typename PayloadType >
static void gainCalibHelper::gainCalibPI::fillTheHisto ( const std::shared_ptr< PayloadType > &  payload,
std::shared_ptr< TH1F >  h1,
gainCalibPI::type  theType,
const std::vector< uint32_t > &  wantedIds = {} 
)
static

Definition at line 42 of file SiPixelGainCalibHelper.h.

45  {}) {
46  std::vector<uint32_t> detids;
47  if (wantedIds.empty()) {
48  payload->getDetIds(detids);
49  } else {
50  detids.assign(wantedIds.begin(), wantedIds.end());
51  }
52 
53  for (const auto& d : detids) {
54  // skip the special case used to signal there are no attached dets
55  if (d == 0xFFFFFFFF)
56  continue;
57 
58  auto range = payload->getRange(d);
59  int numberOfRowsToAverageOver = payload->getNumberOfRowsToAverageOver();
60  int ncols = payload->getNCols(d);
61  int nRocsInRow = (range.second - range.first) / ncols / numberOfRowsToAverageOver;
62  unsigned int nRowsForHLT = 1;
63  int nrows = std::max((payload->getNumberOfRowsToAverageOver() * nRocsInRow),
64  nRowsForHLT); // dirty trick to make it work for the HLT payload
65 
66  auto rangeAndCol = payload->getRangeAndNCols(d);
67  bool isDeadColumn;
68  bool isNoisyColumn;
69 
70  COUT << "NCOLS: " << payload->getNCols(d) << " " << rangeAndCol.second << " NROWS:" << nrows
71  << ", RANGES: " << rangeAndCol.first.second - rangeAndCol.first.first
72  << ", Ratio: " << float(rangeAndCol.first.second - rangeAndCol.first.first) / rangeAndCol.second
73  << std::endl;
74 
75  float quid(-99999.);
76 
77  for (int col = 0; col < ncols; col++) {
78  for (int row = 0; row < nrows; row++) {
79  switch (theType) {
81  quid = payload->getGain(col, row, rangeAndCol.first, rangeAndCol.second, isDeadColumn, isNoisyColumn);
82  break;
84  quid = payload->getPed(col, row, rangeAndCol.first, rangeAndCol.second, isDeadColumn, isNoisyColumn);
85  break;
86  default:
87  edm::LogError("gainCalibPI::fillTheHisto") << "Unrecognized type " << theType << std::endl;
88  break;
89  }
90  h1->Fill(quid);
91  } // loop on rows
92  } // loop on cols
93  } // loop on detids
94  } // fillTheHisto

Referenced by gainCalibHelper::SiPixelGainCalibrationValues< myType, PayloadType >::fill(), and gainCalibHelper::SiPixelGainCalibrationValuesPerRegion< isBarrel, myType, PayloadType >::fill().

◆ fillTheHistos()

template<typename PayloadType >
static void gainCalibHelper::gainCalibPI::fillTheHistos ( const std::shared_ptr< PayloadType > &  payload,
std::shared_ptr< TH1 >  hBPix,
std::shared_ptr< TH1 >  hFPix,
gainCalibPI::type  theType 
)
static

Definition at line 145 of file SiPixelGainCalibHelper.h.

148  {
149  std::vector<uint32_t> detids;
150  payload->getDetIds(detids);
151 
152  bool isCorrelation_ = hBPix.get()->InheritsFrom(TH2::Class()) && (theType == gainCalibPI::t_correlation);
153 
154  for (const auto& d : detids) {
155  int subid = DetId(d).subdetId();
156  auto range = payload->getRange(d);
157  int numberOfRowsToAverageOver = payload->getNumberOfRowsToAverageOver();
158  int ncols = payload->getNCols(d);
159  int nRocsInRow = (range.second - range.first) / ncols / numberOfRowsToAverageOver;
160  unsigned int nRowsForHLT = 1;
161  int nrows = std::max((payload->getNumberOfRowsToAverageOver() * nRocsInRow),
162  nRowsForHLT); // dirty trick to make it work for the HLT payload
163 
164  auto rangeAndCol = payload->getRangeAndNCols(d);
165  bool isDeadColumn;
166  bool isNoisyColumn;
167 
168  for (int col = 0; col < ncols; col++) {
169  for (int row = 0; row < nrows; row++) {
170  float gain = payload->getGain(col, row, rangeAndCol.first, rangeAndCol.second, isDeadColumn, isNoisyColumn);
171  float ped = payload->getPed(col, row, rangeAndCol.first, rangeAndCol.second, isDeadColumn, isNoisyColumn);
172 
173  switch (subid) {
175  if (isCorrelation_) {
176  hBPix->Fill(gain, ped);
177  } else {
178  hBPix->Fill((theType == gainCalibPI::t_gain ? gain : ped));
179  }
180  break;
181  }
183  if (isCorrelation_) {
184  hFPix->Fill(gain, ped);
185  } else {
186  hFPix->Fill((theType == gainCalibPI::t_gain ? gain : ped));
187  }
188  break;
189  }
190  default:
191  edm::LogError("gainCalibPI::fillTheHistos") << d << " is not a Pixel DetId" << std::endl;
192  break;
193  } // switch on subid
194  } // row loop
195  } // column loop
196  } // detid loop
197  } // filltheHistos

References HLT_2018_cff::Class, cuy::col, ztail::d, PedestalClient_cfi::gain, SiStripPI::max, hgcalPlots::ncols, jets_cff::payload, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, FastTimerService_cff::range, DetId::subdetId(), t_correlation, and t_gain.

◆ fillThePerModuleMap()

template<typename PayloadType >
static void gainCalibHelper::gainCalibPI::fillThePerModuleMap ( const std::shared_ptr< PayloadType > &  payload,
AvgMap map,
gainCalibPI::type  theType 
)
static

Definition at line 99 of file SiPixelGainCalibHelper.h.

101  {
102  std::vector<uint32_t> detids;
103  payload->getDetIds(detids);
104 
105  for (const auto& d : detids) {
106  auto range = payload->getRange(d);
107  int numberOfRowsToAverageOver = payload->getNumberOfRowsToAverageOver();
108  int ncols = payload->getNCols(d);
109  int nRocsInRow = (range.second - range.first) / ncols / numberOfRowsToAverageOver;
110  unsigned int nRowsForHLT = 1;
111  int nrows = std::max((payload->getNumberOfRowsToAverageOver() * nRocsInRow),
112  nRowsForHLT); // dirty trick to make it work for the HLT payload
113 
114  auto rangeAndCol = payload->getRangeAndNCols(d);
115  bool isDeadColumn;
116  bool isNoisyColumn;
117 
118  float sumOfX(0.);
119  int nPixels(0);
120  for (int col = 0; col < ncols; col++) {
121  for (int row = 0; row < nrows; row++) {
122  nPixels++;
123  switch (theType) {
124  case gainCalibPI::t_gain:
125  sumOfX +=
126  payload->getGain(col, row, rangeAndCol.first, rangeAndCol.second, isDeadColumn, isNoisyColumn);
127  break;
129  sumOfX += payload->getPed(col, row, rangeAndCol.first, rangeAndCol.second, isDeadColumn, isNoisyColumn);
130  break;
131  default:
132  edm::LogError("gainCalibPI::fillThePerModuleMap") << "Unrecognized type " << theType << std::endl;
133  break;
134  } // switch on the type
135  } // rows
136  } // columns
137  // fill the return value map
138  map[d] = sumOfX / nPixels;
139  } // loop on the detId
140  } // fillThePerModuleMap

References cuy::col, ztail::d, genParticles_cff::map, SiStripPI::max, hgcalPlots::ncols, jets_cff::payload, FastTimerService_cff::range, t_gain, and t_pedestal.

gainCalibHelper::gainCalibPI::t_pedestal
Definition: SiPixelGainCalibHelper.h:37
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
hgcalPlots.ncols
ncols
Definition: hgcalPlots.py:105
gainCalibHelper::gainCalibPI::t_gain
Definition: SiPixelGainCalibHelper.h:37
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
cuy.col
col
Definition: cuy.py:1010
HLT_2018_cff.Class
Class
Definition: HLT_2018_cff.py:7110
gainCalibHelper::gainCalibPI::t_correlation
Definition: SiPixelGainCalibHelper.h:37
DetId
Definition: DetId.h:17
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
edm::LogError
Definition: MessageLogger.h:183
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
COUT
#define COUT
Definition: PVValidationHelpers.h:13
ztail.d
d
Definition: ztail.py:151
genParticles_cff.map
map
Definition: genParticles_cff.py:11