CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
defaultModuleLabel.h File Reference
#include <string>
#include <boost/version.hpp>
#include <boost/units/detail/utility.hpp>

Go to the source code of this file.

Functions

template<typename T >
std::string defaultModuleLabel ()
 

Function Documentation

template<typename T >
std::string defaultModuleLabel ( )

Definition at line 16 of file defaultModuleLabel.h.

References EnergyCorrector::c, i, diffTwoXMLs::label, mergeVDriftHistosByStation::name, findQualityFiles::size, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by HLTForwardBackwardJetsFilter< T >::fillDescriptions(), HLTJetL1MatchProducer< T >::fillDescriptions(), HLTJetPairDzMatchFilter< T >::fillDescriptions(), HLTJetCollectionsFilter< jetType >::fillDescriptions(), HLTJetL1TMatchProducer< T >::fillDescriptions(), HLTDiJetAveFilter< T >::fillDescriptions(), HLTJetVBFFilter< T >::fillDescriptions(), HLTMonoJetFilter< T >::fillDescriptions(), HLTDiJetEtaTopologyFilter< T >::fillDescriptions(), EgammaEcalPFClusterIsolationProducer< T1 >::fillDescriptions(), EgammaHcalPFClusterIsolationProducer< T1 >::fillDescriptions(), HLTDiJetAveEtaFilter< T >::fillDescriptions(), HLTJetEtaTopologyFilter< T >::fillDescriptions(), HLTExclDiJetFilter< T >::fillDescriptions(), HLTJetCollectionsVBFFilter< T >::fillDescriptions(), HLTFatJetMassFilter< jetType >::fillDescriptions(), HLTSinglet< T >::fillDescriptions(), HLTGlobalSums< T >::fillDescriptions(), HLTAlphaTFilter< T >::fillDescriptions(), HLTJetTagWithMatching< T >::fillDescriptions(), HLTSmartSinglet< T >::fillDescriptions(), HLTJetTag< T >::fillDescriptions(), HLTDoubletDZ< T1, T2 >::fillDescriptions(), HLTEcalPFClusterIsolationProducer< T1 >::fillDescriptions(), HLTCountNumberOfObject< OColl >::fillDescriptions(), HLTElectronPFMTFilter< T >::fillDescriptions(), HLTDoublet< T1, T2 >::fillDescriptions(), HLTHcalPFClusterIsolationProducer< T1 >::fillDescriptions(), HLTCollectionProducer< T >::fillDescriptions(), HLTJetSortedVBFFilter< T >::fillDescriptions(), HLTJetCollectionsForLeptonPlusJets< jetType >::fillDescriptions(), HLTJetCollectionsForBoostedLeptonPlusJets< jetType >::fillDescriptions(), HLTJetCollForElePlusJets< T >::fillDescriptions(), HLTGenericFilter< T1 >::fillDescriptions(), HLTRechitInRegionsProducer< T1 >::fillDescriptions(), HLTJetCollectionsForElePlusJets< T >::fillDescriptions(), HLTJetHbbFilter< T >::fillDescriptions(), HLTJetsCleanedFromLeadingLeptons< JetType >::fillDescriptions(), SelectedElectronFEDListProducer< TEle, TCand >::fillDescriptions(), CorrectedMETProducerT< T >::fillDescriptions(), HLTRecHitInAllL1RegionsProducer< RecHitType >::fillDescriptions(), HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::fillDescriptions(), and PFJetMETcorrInputProducerT< T, Textractor >::fillDescriptions().

16  {
17  // start with the demangled name for T
18 #if BOOST_VERSION < 105200
19  std::string name = boost::units::detail::demangle(typeid(T).name());
20 #else
21  std::string name = boost::core::demangle(typeid(T).name());
22 #endif
23 
24  // expected size of the label
25  unsigned int size = 0;
26  for (char c: name)
27  if (std::isalnum(c)) ++size;
29  label.reserve(size);
30 
31  // tokenize the demangled name, keeping only alphanumeric characters,
32  // and convert the tokens to lowerCamelCase.
33  bool new_token = false;
34  for (char c: name) {
35  if (std::isalnum(c)) {
36  if (new_token)
37  label.push_back((char) std::toupper(c));
38  else
39  label.push_back(c);
40  new_token = false;
41  }
42  else {
43  new_token = true;
44  }
45  }
46 
47  // if the label is all uppercase, change it to all lowercase
48  // if the label starts with more than one uppercase letter, change n-1 to lowercase
49  // otherwise, change the first letter to lowercase
50  unsigned int ups = 0;
51  for (char c: label)
52  if (std::isupper(c))
53  ++ups;
54  else
55  break;
56  if (ups > 1 and ups != label.size())
57  --ups;
58  for (unsigned int i = 0; i < ups; ++i)
59  label[i] = std::tolower(label[i]);
60 
61  return label;
62 }
int i
Definition: DBlmapReader.cc:9
long double T
tuple size
Write out results.