CMS 3D CMS Logo

Classes | Functions
APVGain Namespace Reference

Classes

struct  APVmon
 

Functions

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 &)
 

Function Documentation

std::vector< 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 runEdmFileComparison::found, match(), subdetectorId(), subdetectorPlane(), and subdetectorSide().

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

109  {
110  std::vector<MonitorElement*> found = std::vector<MonitorElement*>();
111  int sId = APVGain::subdetectorId((uint32_t)det_id);
112  int sPlane = APVGain::subdetectorPlane((uint32_t)det_id, topo);
113  int sSide = APVGain::subdetectorSide((uint32_t)det_id, topo);
114  std::vector<APVGain::APVmon>::iterator it= histos.begin();
115 
116  while (it!=histos.end()) {
117  //std::string tag = (*it)->getName();
118  int subdetectorId = (*it).subdetectorId;
119  int subdetectorSide = (*it).subdetectorSide;
120  int subdetectorPlane = (*it).subdetectorPlane;
121 
122  bool match = (subdetectorId==0 || subdetectorId==sId) &&
123  (subdetectorPlane==0 || subdetectorPlane==sPlane) &&
124  (subdetectorSide==0 || subdetectorSide==sSide);
125 
126  if (match) {
127  found.push_back((*it).monitor);
128  }
129  it++;
130  }
131  return found;
132 }
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< std::pair< std::string, std::string > > APVGain::monHnames ( std::vector< std::string >  VH,
bool  allPlanes,
const char *  tag 
)

Definition at line 137 of file APVGainHelpers.cc.

References 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(), and SiStripGainsPCLHarvester::gainQualityMonitor().

137  {
138 
139  std::vector<std::pair<std::string,std::string>> out;
140  int re = (allPlanes)? 34 + VH.size() : VH.size();
141  out.reserve( re );
142 
143 
144  std::string Tag = tag;
145  if (Tag.length()) Tag = "__" + Tag;
146 
147  std::string h_tag = "";
148  std::string h_tit = "";
149 
150  if (allPlanes) {
151  // Names of monitoring histogram for TIB layers
152  int TIBlayers = 4; //number of TIB layers.
153  for(int i=1; i<=TIBlayers; i++) {
154  h_tag = "TIB_layer_" + std::to_string(i) + Tag;
155  h_tit = h_tag; std::replace(h_tit.begin(),h_tit.end(),'_',' ');
156  out.push_back(std::pair<std::string,std::string>(h_tag,h_tit));
157  }
158  // Names of monitoring histogram for TOB layers
159  int TOBlayers = 6; //number of TOB layers
160  for(int i=1; i<=TOBlayers; i++) {
161  h_tag = "TOB_layer_" + std::to_string(i) + Tag;
162  h_tit = h_tag; std::replace(h_tit.begin(),h_tit.end(),'_',' ');
163  out.push_back(std::pair<std::string,std::string>(h_tag,h_tit));
164  }
165  // Names of monitoring histogram for TID wheels
166  int TIDwheels = 3; //number of TID wheels
167  for(int i=-TIDwheels; i<=TIDwheels; i++) {
168  if (i==0) continue;
169  if (i<0) h_tag = "TIDminus_wheel_" + std::to_string(i) + Tag;
170  else h_tag = "TIDplus_wheel_" + std::to_string(i) + Tag;
171  h_tit = h_tag; std::replace(h_tit.begin(),h_tit.end(),'_',' ');
172  out.push_back(std::pair<std::string,std::string>(h_tag,h_tit));
173  }
174  // Names of monitoring histogram for TEC wheels
175  int TECwheels = 9; //number of TEC wheels
176  for(int i=-TECwheels; i<=TECwheels; i++) {
177  if (i==0) continue;
178  if (i<0) h_tag = "TECminus_wheel_" + std::to_string(i) + Tag;
179  else h_tag = "TECplus_wheel_" + std::to_string(i) + Tag;
180  h_tit = h_tag; std::replace(h_tit.begin(),h_tit.end(),'_',' ');
181  out.push_back(std::pair<std::string,std::string>(h_tag,h_tit));
182  }
183  }
184 
185  for(unsigned int i=0; i<VH.size();i++) {
186  h_tag = VH[i] + Tag;
187  h_tit = h_tag; std::replace(h_tit.begin(),h_tit.end(),'_',' ');
188  out.push_back(std::pair<std::string,std::string>(h_tag,h_tit));
189  }
190 
191  return out;
192 }
def replace(string, replacements)
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 17 of file APVGainHelpers.cc.

References DetId::subdetId().

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

17  {
18  return DetId(det_id).subdetId();
19 };
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
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 34 of file APVGainHelpers.cc.

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

34  {
35  std::string d = tag.substr(0,3);
36  if ( d.compare("TIB")==0 ) return 3;
37  if ( d.compare("TID")==0 ) return 4;
38  if ( d.compare("TOB")==0 ) return 5;
39  if ( d.compare("TEC")==0 ) return 6;
40  return 0;
41 };
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 79 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(), SiStripGainsPCLWorker::bookHistograms(), FetchMonitor(), and SiStripGainsPCLHarvester::gainQualityMonitor().

79  {
80  if( topo ) {
81  if( APVGain::subdetectorId(det_id)==StripSubdetector::TIB ) return topo->tibLayer(det_id);
82  else if( APVGain::subdetectorId(det_id)==StripSubdetector::TID ) return (2*topo->tidSide(det_id)-3)*topo->tidWheel(det_id);
83  else if( APVGain::subdetectorId(det_id)==StripSubdetector::TOB ) return topo->tobLayer(det_id);
84  else if( APVGain::subdetectorId(det_id)==StripSubdetector::TEC ) return (2*topo->tecSide(det_id)-3)*topo->tecWheel(det_id);
85  }
86  return 0;
87 };
unsigned int tibLayer(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
unsigned int tidSide(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
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 94 of file APVGainHelpers.cc.

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

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

References TrackerTopology::side().

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

49  {
50  return topo->side( det_id );
51 }
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 63 of file APVGainHelpers.cc.

References funct::m, and AlCaHLTBitMon_ParallelJobs::p.

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