CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
InputTag.cc
Go to the documentation of this file.
4 
5 namespace edm {
6 
8  : label_(""),
9  instance_(""),
10  process_(),
11  branchType_(NumBranchTypes),
12  typeID_(),
13  cachedOffset_(0U),
14  fillCount_(0),
15  productRegistry_(0) {
16  }
17 
18 
19  InputTag::InputTag(std::string const& label, std::string const& instance, std::string const& processName)
20  : label_(label),
21  instance_(instance),
22  process_(processName),
23  branchType_(NumBranchTypes),
24  typeID_(),
25  cachedOffset_(0U),
26  fillCount_(0),
27  productRegistry_(0) {
28  }
29 
30  InputTag::InputTag(char const* label, char const* instance, char const* processName)
31  : label_(label),
32  instance_(instance),
33  process_(processName),
34  branchType_(NumBranchTypes),
35  typeID_(),
36  cachedOffset_(0U),
37  fillCount_(0),
38  productRegistry_(0) {
39  }
40 
41 
42  InputTag::InputTag(std::string const& s)
43  : label_(""),
44  instance_(""),
45  process_(),
46  branchType_(NumBranchTypes),
47  cachedOffset_(0U),
48  fillCount_(0),
49  productRegistry_(0) {
50 
51  // string is delimited by colons
52  std::vector<std::string> tokens = tokenize(s, ":");
53  size_t nwords = tokens.size();
54  if(nwords > 3) {
55  throw edm::Exception(errors::Configuration,"InputTag")
56  << "Input tag " << s << " has " << nwords << " tokens";
57  }
58  if(nwords > 0) label_ = tokens[0];
59  if(nwords > 1) instance_ = tokens[1];
60  if(nwords > 2) process_=tokens[2];
61  }
62 
64 
65  bool InputTag::operator==(InputTag const& tag) const {
66  return (label_ == tag.label_)
67  && (instance_ == tag.instance_)
68  && (process_ == tag.process_);
69  }
70 
71 
72  std::string InputTag::encode() const {
73  //NOTE: since the encoding gets used to form the configuration hash I did not want
74  // to change it so that not specifying a process would cause two colons to appear in the
75  // encoding and thus not being backwards compatible
76  static std::string const separator(":");
77  std::string result = label_;
78  if(!instance_.empty() || !process_.empty()) {
79  result += separator + instance_;
80  }
81  if(!process_.empty()) {
82  result += separator + process_;
83  }
84  return result;
85  }
86 
87  std::ostream& operator<<(std::ostream& ost, InputTag const& tag) {
88  static std::string const process(", process = ");
89  ost << "InputTag: label = " << tag.label() << ", instance = " << tag.instance()
90  << (tag.process().empty() ? std::string() : (process + tag.process()));
91  return ost;
92  }
93 }
94 
static PFTauRenderPlugin instance
std::string instance_
Definition: InputTag.h:45
std::string encode() const
Definition: InputTag.cc:72
tuple result
Definition: query.py:137
std::string process_
Definition: InputTag.h:46
std::string label_
Definition: InputTag.h:44
std::vector< std::string > tokenize(std::string const &input, std::string const &separator)
breaks the input string into tokens, delimited by the separator
Definition: Parse.cc:57
bool operator==(InputTag const &tag) const
Definition: InputTag.cc:65
std::string const & label() const
Definition: InputTag.h:25
std::string const & process() const
Definition: InputTag.h:29
tuple process
Definition: LaserDQM_cfg.py:3
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
std::string const & instance() const
Definition: InputTag.h:26