CMS 3D CMS Logo

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=0)
 
std::vector< MonitorElement * > FetchMonitor (std::vector< APVmon >, uint32_t, const TrackerTopology *topo=0)
 
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 &)
 

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 = 0 
)

Brief Fetch the Monitor Element index corresponding to a DetId.

Definition at line 141 of file APVGainHelpers.cc.

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

Referenced by SiStripGainsPCLWorker::dqmAnalyze().

143  {
144  std::vector<unsigned int> found_indices = std::vector<unsigned int>();
145 
146  int sId = APVGain::subdetectorId(det_id);
147  int sPlane = APVGain::subdetectorPlane(det_id, topo);
148  int sSide = APVGain::subdetectorSide(det_id, topo);
149 
150  for (auto& element : theMap) {
151  int subdetectorId = element.second.m_subdetectorId;
152  int subdetectorSide = element.second.m_subdetectorSide;
153  int subdetectorPlane = element.second.m_subdetectorPlane;
154 
155  bool match = (subdetectorId == 0 || subdetectorId == sId) &&
156  (subdetectorPlane == 0 || subdetectorPlane == sPlane) &&
157  (subdetectorSide == 0 || subdetectorSide == sSide);
158 
159  if (match) {
160  found_indices.push_back(element.first);
161  }
162  }
163  return found_indices;
164 }
int subdetectorPlane(uint32_t, const TrackerTopology *)
int subdetectorSide(uint32_t, const TrackerTopology *)
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 = 0 
)

Brief Fetch the Monitor Element corresponding to a DetId.

Definition at line 108 of file APVGainHelpers.cc.

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

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

110  {
111  std::vector<MonitorElement*> found = std::vector<MonitorElement*>();
112  int sId = APVGain::subdetectorId(det_id);
113  int sPlane = APVGain::subdetectorPlane(det_id, topo);
114  int sSide = APVGain::subdetectorSide(det_id, topo);
115  auto it = histos.begin();
116 
117  LogDebug("APVGainHelpers") << "sId: " << sId << " sPlane: " << sPlane << " sSide: " << sSide << std::endl;
118 
119  while (it != histos.end()) {
120  std::string tag = (*it).getMonitor()->getName();
121  int subdetectorId = (*it).getSubdetectorId();
122  int subdetectorSide = (*it).getSubdetectorSide();
123  int subdetectorPlane = (*it).getSubdetectorPlane();
124 
125  bool match = (subdetectorId == 0 || subdetectorId == sId) &&
126  (subdetectorPlane == 0 || subdetectorPlane == sPlane) &&
127  (subdetectorSide == 0 || subdetectorSide == sSide);
128 
129  if (match) {
130  found.emplace_back((*it).getMonitor());
131  LogDebug("APVGainHelpers") << det_id << " found: " << tag << std::endl;
132  (*it).printAll();
133  }
134  it++;
135  }
136  return found;
137 }
#define LogDebug(id)
int subdetectorPlane(uint32_t, const TrackerTopology *)
int subdetectorSide(uint32_t, const TrackerTopology *)
histos
Definition: combine.py:4
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< std::pair< std::string, std::string > > APVGain::monHnames ( std::vector< std::string >  VH,
bool  allPlanes,
const char *  tag 
)

Definition at line 166 of file APVGainHelpers.cc.

References constexpr, mps_fire::i, MillePedeFileConverter_cfg::out, python.rootplot.root2matplotlib::replace(), AlCaHLTBitMon_QueryRunRegistry::string, and GlobalPosition_Frontier_DevDB_cff::tag.

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

168  {
169  std::vector<std::pair<std::string, std::string>> out;
170 
171  // total number of measurement layers/wheels in the Strips Tracker
172  // 4(TIB) + 6(TOB) + 3(TID+) + 3(TID-) + 9(TEC+) + 9(TEC-)
173  constexpr int countOfPlanes = 34;
174 
175  int re = (allPlanes) ? countOfPlanes + VH.size() : VH.size();
176  out.reserve(re);
177 
178  std::string Tag = tag;
179  if (Tag.length())
180  Tag = "__" + Tag;
181 
182  std::string h_tag = "";
183  std::string h_tit = "";
184 
185  if (allPlanes) {
186  // Names of monitoring histogram for TIB layers
187  constexpr int TIBlayers = 4; //number of TIB layers.
188  for (int i = 1; i <= TIBlayers; i++) {
189  h_tag = "TIB_layer_" + std::to_string(i) + Tag;
190  h_tit = h_tag;
191  std::replace(h_tit.begin(), h_tit.end(), '_', ' ');
192  out.push_back(std::pair<std::string, std::string>(h_tag, h_tit));
193  }
194  // Names of monitoring histogram for TOB layers
195  constexpr int TOBlayers = 6; //number of TOB layers
196  for (int i = 1; i <= TOBlayers; i++) {
197  h_tag = "TOB_layer_" + std::to_string(i) + Tag;
198  h_tit = h_tag;
199  std::replace(h_tit.begin(), h_tit.end(), '_', ' ');
200  out.push_back(std::pair<std::string, std::string>(h_tag, h_tit));
201  }
202  // Names of monitoring histogram for TID wheels
203  constexpr int TIDwheels = 3; //number of TID wheels
204  for (int i = -TIDwheels; i <= TIDwheels; i++) {
205  if (i == 0)
206  continue;
207  if (i < 0)
208  h_tag = "TIDminus_wheel_" + std::to_string(i) + Tag;
209  else
210  h_tag = "TIDplus_wheel_" + std::to_string(i) + Tag;
211  h_tit = h_tag;
212  std::replace(h_tit.begin(), h_tit.end(), '_', ' ');
213  out.push_back(std::pair<std::string, std::string>(h_tag, h_tit));
214  }
215  // Names of monitoring histogram for TEC wheels
216  constexpr int TECwheels = 9; //number of TEC wheels
217  for (int i = -TECwheels; i <= TECwheels; i++) {
218  if (i == 0)
219  continue;
220  if (i < 0)
221  h_tag = "TECminus_wheel_" + std::to_string(i) + Tag;
222  else
223  h_tag = "TECplus_wheel_" + std::to_string(i) + Tag;
224  h_tit = h_tag;
225  std::replace(h_tit.begin(), h_tit.end(), '_', ' ');
226  out.push_back(std::pair<std::string, std::string>(h_tag, h_tit));
227  }
228  }
229 
230  for (unsigned int i = 0; i < VH.size(); i++) {
231  h_tag = VH[i] + Tag;
232  h_tit = h_tag;
233  std::replace(h_tit.begin(), h_tit.end(), '_', ' ');
234  out.push_back(std::pair<std::string, std::string>(h_tag, h_tit));
235  }
236 
237  return out;
238 }
def replace(string, replacements)
#define constexpr
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 15 of file APVGainHelpers.cc.

References DetId::subdetId().

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

15 { 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 29 of file APVGainHelpers.cc.

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

29  {
30  std::string d = tag.substr(0, 3);
31  if (d == "TIB")
32  return 3;
33  if (d == "TID")
34  return 4;
35  if (d == "TOB")
36  return 5;
37  if (d == "TEC")
38  return 6;
39  return 0;
40 };
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 76 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(), and SiStripGainsPCLWorker::SiStripGainsPCLWorker().

76  {
77  if (topo) {
79  return topo->tibLayer(det_id);
81  return (2 * topo->tidSide(det_id) - 3) * topo->tidWheel(det_id);
83  return topo->tobLayer(det_id);
85  return (2 * topo->tecSide(det_id) - 3) * topo->tecWheel(det_id);
86  }
87  return 0;
88 };
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 95 of file APVGainHelpers.cc.

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

95  {
96  std::size_t p = (tag.find("layer") != std::string::npos) ? tag.find("layer") : tag.find("wheel");
97  if (p != std::string::npos) {
98  std::size_t start = tag.find("_", p + 1) + 1;
99  std::size_t stop = tag.find('_', start);
100  std::string plane = tag.substr(start, stop - start);
101  return atoi(plane.c_str());
102  }
103  return 0;
104 };
Definition: start.py:1
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 48 of file APVGainHelpers.cc.

References TrackerTopology::side().

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

48 { 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 59 of file APVGainHelpers.cc.

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

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