CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Typedefs | Functions
APVGain Namespace Reference

Classes

struct  APVGainHistograms
 
struct  APVmon
 

Typedefs

typedef dqm::legacy::MonitorElement MonitorElement
 

Functions

std::vector< unsigned int > FetchIndices (std::map< unsigned int, APVloc >, uint32_t, const TrackerTopology *topo=nullptr)
 
std::vector< MonitorElement * > FetchMonitor (std::vector< APVmon >, uint32_t, const TrackerTopology *topo=nullptr)
 
std::vector< std::pair
< std::string, std::string > > 
monHnames (std::vector< std::string >, bool, const char *tag)
 
int subdetectorId (uint32_t)
 
int subdetectorId (const std::string &)
 
int subdetectorPlane (uint32_t, const TrackerTopology *)
 
int subdetectorPlane (const std::string &)
 
int subdetectorSide (uint32_t, const TrackerTopology *)
 
int subdetectorSide (const std::string &)
 
int thickness (uint32_t)
 
int thickness (const std::string &tag)
 

Typedef Documentation

Definition at line 17 of file APVGainHelpers.h.

Function Documentation

std::vector< unsigned int > APVGain::FetchIndices ( std::map< unsigned int, APVloc theMap,
uint32_t  det_id,
const TrackerTopology topo = nullptr 
)

Brief Fetch the Monitor Element index corresponding to a DetId.

Definition at line 187 of file APVGainHelpers.cc.

References match(), subdetectorId(), subdetectorPlane(), subdetectorSide(), and thickness().

Referenced by SiStripGainsCalibTreeWorker::dqmAnalyze(), and SiStripGainsPCLWorker::dqmAnalyze().

189  {
190  std::vector<unsigned int> found_indices = std::vector<unsigned int>();
191 
192  int sThick = APVGain::thickness(det_id);
193  int sId = APVGain::subdetectorId(det_id);
194  int sPlane = APVGain::subdetectorPlane(det_id, topo);
195  int sSide = APVGain::subdetectorSide(det_id, topo);
196 
197  for (auto& element : theMap) {
198  int subdetectorThickness = element.second.m_thickness;
199  int subdetectorId = element.second.m_subdetectorId;
200  int subdetectorSide = element.second.m_subdetectorSide;
201  int subdetectorPlane = element.second.m_subdetectorPlane;
202 
203  bool match = (subdetectorId == 0 || subdetectorId == sId) &&
204  (subdetectorPlane == 0 || subdetectorPlane == sPlane) &&
205  (subdetectorSide == 0 || subdetectorSide == sSide) &&
206  (subdetectorThickness == 0 || subdetectorThickness == sThick);
207 
208  if (match) {
209  found_indices.push_back(element.first);
210  }
211  }
212  return found_indices;
213 }
int subdetectorPlane(uint32_t, const TrackerTopology *)
int subdetectorSide(uint32_t, const TrackerTopology *)
int thickness(uint32_t)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
int subdetectorId(uint32_t)
std::vector< APVGain::MonitorElement * > APVGain::FetchMonitor ( std::vector< APVmon >  histos,
uint32_t  det_id,
const TrackerTopology topo = nullptr 
)

Brief Fetch the Monitor Element corresponding to a DetId.

Definition at line 151 of file APVGainHelpers.cc.

References newFWLiteAna::found, LogDebug, match(), AlCaHLTBitMon_QueryRunRegistry::string, subdetectorId(), subdetectorPlane(), subdetectorSide(), GlobalPosition_Frontier_DevDB_cff::tag, and thickness().

Referenced by SiStripGainsPCLHarvester::gainQualityMonitor(), SiStripGainFromCalibTree::processEvent(), and SiStripGainFromCalibTree::qualityMonitor().

153  {
154  std::vector<MonitorElement*> found = std::vector<MonitorElement*>();
155  int sThick = APVGain::thickness(det_id);
156  int sId = APVGain::subdetectorId(det_id);
157  int sPlane = APVGain::subdetectorPlane(det_id, topo);
158  int sSide = APVGain::subdetectorSide(det_id, topo);
159  auto it = histos.begin();
160 
161  LogDebug("APVGainHelpers") << "sId: " << sId << " sPlane: " << sPlane << " sSide: " << sSide << std::endl;
162 
163  while (it != histos.end()) {
164  std::string tag = (*it).getMonitor()->getName();
165  int subdetectorThickness = (*it).getThickness();
166  int subdetectorId = (*it).getSubdetectorId();
167  int subdetectorSide = (*it).getSubdetectorSide();
168  int subdetectorPlane = (*it).getSubdetectorPlane();
169 
170  bool match = (subdetectorId == 0 || subdetectorId == sId) &&
171  (subdetectorPlane == 0 || subdetectorPlane == sPlane) &&
172  (subdetectorSide == 0 || subdetectorSide == sSide) &&
173  (subdetectorThickness == 0 || subdetectorThickness == sThick);
174 
175  if (match) {
176  found.emplace_back((*it).getMonitor());
177  LogDebug("APVGainHelpers") << det_id << " found: " << tag << std::endl;
178  (*it).printAll();
179  }
180  it++;
181  }
182  return found;
183 }
int subdetectorPlane(uint32_t, const TrackerTopology *)
int subdetectorSide(uint32_t, const TrackerTopology *)
int thickness(uint32_t)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
int subdetectorId(uint32_t)
#define LogDebug(id)
std::vector< std::pair< std::string, std::string > > APVGain::monHnames ( std::vector< std::string >  VH,
bool  allPlanes,
const char *  tag 
)

Definition at line 215 of file APVGainHelpers.cc.

References mps_fire::i, submitPVResolutionJobs::out, python.rootplot.root2matplotlib::replace(), AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, and cond::impl::to_string().

Referenced by SiStripGainFromCalibTree::algoEndRun(), SiStripGainFromCalibTree::bookDQMHistos(), SiStripGainsCalibTreeWorker::bookHistograms(), SiStripGainsPCLWorker::bookHistograms(), SiStripGainsPCLHarvester::gainQualityMonitor(), SiStripGainsCalibTreeWorker::SiStripGainsCalibTreeWorker(), and SiStripGainsPCLWorker::SiStripGainsPCLWorker().

217  {
218  std::vector<std::pair<std::string, std::string>> out;
219 
220  // total number of measurement layers/wheels in the Strips Tracker
221  // 4(TIB) + 6(TOB) + 3(TID+) + 3(TID-) + 9(TEC+) + 9(TEC-)
222  constexpr int countOfPlanes = 34;
223 
224  int re = (allPlanes) ? countOfPlanes + VH.size() : VH.size();
225  out.reserve(re);
226 
227  std::string Tag = tag;
228  if (Tag.length())
229  Tag = "__" + Tag;
230 
231  std::string h_tag = "";
232  std::string h_tit = "";
233 
234  if (allPlanes) {
235  // Names of monitoring histogram for TIB layers
236  constexpr int TIBlayers = 4; //number of TIB layers.
237  for (int i = 1; i <= TIBlayers; i++) {
238  h_tag = "TIB_layer_" + std::to_string(i) + Tag;
239  h_tit = h_tag;
240  std::replace(h_tit.begin(), h_tit.end(), '_', ' ');
241  out.push_back(std::pair<std::string, std::string>(h_tag, h_tit));
242  }
243  // Names of monitoring histogram for TOB layers
244  constexpr int TOBlayers = 6; //number of TOB layers
245  for (int i = 1; i <= TOBlayers; i++) {
246  h_tag = "TOB_layer_" + std::to_string(i) + Tag;
247  h_tit = h_tag;
248  std::replace(h_tit.begin(), h_tit.end(), '_', ' ');
249  out.push_back(std::pair<std::string, std::string>(h_tag, h_tit));
250  }
251  // Names of monitoring histogram for TID wheels
252  constexpr int TIDwheels = 3; //number of TID wheels
253  for (int i = -TIDwheels; i <= TIDwheels; i++) {
254  if (i == 0)
255  continue;
256  if (i < 0)
257  h_tag = "TIDminus_wheel_" + std::to_string(i) + Tag;
258  else
259  h_tag = "TIDplus_wheel_" + std::to_string(i) + Tag;
260  h_tit = h_tag;
261  std::replace(h_tit.begin(), h_tit.end(), '_', ' ');
262  out.push_back(std::pair<std::string, std::string>(h_tag, h_tit));
263  }
264  // Names of monitoring histogram for TEC wheels
265  constexpr int TECwheels = 9; //number of TEC wheels
266  for (int i = -TECwheels; i <= TECwheels; i++) {
267  if (i == 0)
268  continue;
269  if (i < 0)
270  h_tag = "TECminus_wheel_" + std::to_string(i) + Tag;
271  else
272  h_tag = "TECplus_wheel_" + std::to_string(i) + Tag;
273  h_tit = h_tag;
274  std::replace(h_tit.begin(), h_tit.end(), '_', ' ');
275  out.push_back(std::pair<std::string, std::string>(h_tag, h_tit));
276  }
277  }
278 
279  for (unsigned int i = 0; i < VH.size(); i++) {
280  h_tag = VH[i] + Tag;
281  h_tit = h_tag;
282  std::replace(h_tit.begin(), h_tit.end(), '_', ' ');
283  out.push_back(std::pair<std::string, std::string>(h_tag, h_tit));
284  }
285 
286  return out;
287 }
std::string to_string(const V &value)
Definition: OMSAccess.h:71
int APVGain::subdetectorId ( uint32_t  det_id)

Brief Extract from the DetId the subdetector type. Return an integer which is associated to the subdetector type. The integer coding for phase0/phase1 geometry follows:

3 - TIB 4 - TID 5 - TOB 6 - TEC

Definition at line 16 of file APVGainHelpers.cc.

References DetId::subdetId().

Referenced by SiStripGainFromCalibTree::bookDQMHistos(), FetchIndices(), FetchMonitor(), SiStripGainsPCLHarvester::gainQualityMonitor(), SiStripGainsCalibTreeWorker::SiStripGainsCalibTreeWorker(), SiStripGainsPCLWorker::SiStripGainsPCLWorker(), subdetectorPlane(), and thickness().

16 { return DetId(det_id).subdetId(); };
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Definition: DetId.h:17
int APVGain::subdetectorId ( const std::string &  tag)

Brief Extract from a char * the subdetector type. Return an integer whioch is associated to the subdetector type. The integer coding follows:

3 - TIB 4 - TID 5 - TOB 6 - TEC

The char * string is expected to have a 3 char descriptor of the subdetector type in front.

Definition at line 30 of file APVGainHelpers.cc.

References ztail::d, and AlCaHLTBitMon_QueryRunRegistry::string.

30  {
31  std::string d = tag.substr(0, 3);
32  if (d == "TIB")
33  return 3;
34  if (d == "TID")
35  return 4;
36  if (d == "TOB")
37  return 5;
38  if (d == "TEC")
39  return 6;
40  return 0;
41 };
tuple d
Definition: ztail.py:151
int APVGain::subdetectorPlane ( uint32_t  det_id,
const TrackerTopology topo 
)

Brief Extract the detector plane position from a DetId. Return an integer that represent the detector plane where the module sits. For the barrel detectors (TIB and TOB) the detector plane is the layer, e.g. ranging from 1 to 4 in the TIB and from 1 to 6 in the TOB. For the endcap detectors the detector plane is the wheel number with a sign in front to tell in which side the wheel is sitting.

Definition at line 119 of file APVGainHelpers.cc.

References subdetectorId(), StripSubdetector::TEC, TrackerTopology::tecSide(), TrackerTopology::tecWheel(), StripSubdetector::TIB, TrackerTopology::tibLayer(), StripSubdetector::TID, TrackerTopology::tidSide(), TrackerTopology::tidWheel(), StripSubdetector::TOB, and TrackerTopology::tobLayer().

Referenced by SiStripGainFromCalibTree::bookDQMHistos(), FetchIndices(), FetchMonitor(), SiStripGainsPCLHarvester::gainQualityMonitor(), SiStripGainsCalibTreeWorker::SiStripGainsCalibTreeWorker(), and SiStripGainsPCLWorker::SiStripGainsPCLWorker().

119  {
120  if (topo) {
122  return topo->tibLayer(det_id);
123  else if (APVGain::subdetectorId(det_id) == StripSubdetector::TID)
124  return (2 * topo->tidSide(det_id) - 3) * topo->tidWheel(det_id);
125  else if (APVGain::subdetectorId(det_id) == StripSubdetector::TOB)
126  return topo->tobLayer(det_id);
127  else if (APVGain::subdetectorId(det_id) == StripSubdetector::TEC)
128  return (2 * topo->tecSide(det_id) - 3) * topo->tecWheel(det_id);
129  }
130  return 0;
131 };
static constexpr auto TEC
unsigned int tibLayer(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
unsigned int tidSide(const DetId &id) const
static constexpr auto TOB
static constexpr auto TIB
unsigned int tecWheel(const DetId &id) const
static constexpr auto TID
int subdetectorId(uint32_t)
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const
int APVGain::subdetectorPlane ( const std::string &  tag)

Brief Extract from a char * the subdetector type. Return an integer whioch is the detector plane where the module sits. The char * string is expected to have the subdetector plane put at its end after an "_" char.

Definition at line 138 of file APVGainHelpers.cc.

References AlCaHLTBitMon_ParallelJobs::p, command_line::start, and AlCaHLTBitMon_QueryRunRegistry::string.

138  {
139  std::size_t p = (tag.find("layer") != std::string::npos) ? tag.find("layer") : tag.find("wheel");
140  if (p != std::string::npos) {
141  std::size_t start = tag.find('_', p + 1) + 1;
142  std::size_t stop = tag.find('_', start);
143  std::string plane = tag.substr(start, stop - start);
144  return atoi(plane.c_str());
145  }
146  return 0;
147 };
int APVGain::subdetectorSide ( uint32_t  det_id,
const TrackerTopology topo 
)

Brief Extract the subdetector side from the Det Id Return and integer whose coding is 0 - no side description can be applied 1 - for negative side 2 - for positive side

Definition at line 49 of file APVGainHelpers.cc.

References TrackerTopology::side().

Referenced by SiStripGainFromCalibTree::bookDQMHistos(), FetchIndices(), FetchMonitor(), SiStripGainsPCLHarvester::gainQualityMonitor(), SiStripGainsCalibTreeWorker::SiStripGainsCalibTreeWorker(), and SiStripGainsPCLWorker::SiStripGainsPCLWorker().

49 { return topo->side(det_id); }
unsigned int side(const DetId &id) const
int APVGain::subdetectorSide ( const std::string &  tag)

Brief Extract the subdetector side from a char * descriptor Return and integer whose coding is 0 - no side description can be applied 1 - for negative side 2 - for positive side

The char * descriptor is expected to have either "minus" or "plus" string to specify the sign. If no sign spec is found 0 is returned.

Definition at line 60 of file APVGainHelpers.cc.

References visualization-live-secondInstance_cfg::m, and AlCaHLTBitMon_ParallelJobs::p.

60  {
61  std::size_t m = tag.find("minus");
62  std::size_t p = tag.find("plus");
63  if (m != std::string::npos)
64  return 1;
65  if (p != std::string::npos)
66  return 2;
67  return 0;
68 }
int APVGain::thickness ( uint32_t  det_id)

Brief Extract the sensor thickness from the Det Id Return and integer whose coding is 0 - no thickness can be determined 1 - for thin sensors 2 - for thick sensors

Definition at line 76 of file APVGainHelpers.cc.

References SiStripDetId::moduleGeometry(), subdetectorId(), DetId::subdetId(), SiStripDetId::TIB, SiStripDetId::TOB, W5, W6, and W7.

Referenced by SiStripGainFromCalibTree::bookDQMHistos(), FetchIndices(), FetchMonitor(), SiStripGainsPCLHarvester::gainQualityMonitor(), SiStripGainsCalibTreeWorker::SiStripGainsCalibTreeWorker(), and SiStripGainsPCLWorker::SiStripGainsPCLWorker().

76  {
78  SiStripDetId siStripDetId(det_id);
79  if (siStripDetId.subdetId() == SiStripDetId::TOB) {
80  return 2; // so it is TOB (thick)
81  }
82  if (siStripDetId.moduleGeometry() == SiStripModuleGeometry::W5 ||
83  siStripDetId.moduleGeometry() == SiStripModuleGeometry::W6 ||
84  siStripDetId.moduleGeometry() == SiStripModuleGeometry::W7) {
85  return 2; // so it is TEC ring 5-7 (thick)
86  }
87  return 1; // so it is TEC ring 1-4 or TIB or TID (thin)
88  } else {
89  return 0;
90  }
91 }
static constexpr auto TOB
Definition: SiStripDetId.h:39
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
static constexpr auto TIB
Definition: SiStripDetId.h:37
int subdetectorId(uint32_t)
int APVGain::thickness ( const std::string &  tag)

Brief Extract the thickness from a char * descriptor Return and integer whose coding is 0 - no thicnkness can be determined 1 - for thin sensors 2 - for thick sensors

The char * descriptor is expected to have either "thin" or "thick" string to specify the thickness. If no sign spec is found 0 is returned.

Definition at line 102 of file APVGainHelpers.cc.

102  {
103  std::size_t thin = tag.find("thin");
104  std::size_t thick = tag.find("thick");
105  if (thin != std::string::npos)
106  return 1;
107  if (thick != std::string::npos)
108  return 2;
109  return 0;
110 }