CMS 3D CMS Logo

defaultModuleLabel.cc
Go to the documentation of this file.
2 
3 #include <algorithm>
4 
5 namespace edm {
7  // remove all colons (module type may contain namespace)
8  label.erase(std::remove(label.begin(), label.end(), ':'), label.end());
9 
10  // remove everything after first '@' (used for module alternatives)
11  label.erase(std::find(label.begin(), label.end(), '@'), label.end());
12 
13  // the following code originates from HLTrigger/HLTcore/interface/defaultModuleLabel.h
14  // if the label is all uppercase, change it to all lowercase
15  // if the label starts with more than one uppercase letter, change n-1 to lowercase
16  // otherwise, change the first letter to lowercase
17  unsigned int ups = 0;
18  for (char c : label)
19  if (std::isupper(c))
20  ++ups;
21  else
22  break;
23  if (ups > 1 and ups != label.size())
24  --ups;
25  for (unsigned int i = 0; i < ups; ++i)
26  label[i] = std::tolower(label[i]);
27 
28  return label;
29  }
30 } // namespace edm
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
char const * label
std::string defaultModuleLabel(std::string label)
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:233
HLT enums.