CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EventConsumerRegistrationInfo.cc
Go to the documentation of this file.
1 // $Id: EventConsumerRegistrationInfo.cc,v 1.15 2011/03/07 15:31:32 mommsen Exp $
3 
8 
9 #include <algorithm>
10 #include <iterator>
11 #include <ostream>
12 
13 
14 namespace stor
15 {
17  (
18  const edm::ParameterSet& pset,
19  const EventServingParams& eventServingParams,
20  const std::string& remoteHost
21  ) :
22  RegistrationInfoBase(pset, remoteHost, eventServingParams, true)
23  {
24  parsePSet(pset);
25  }
26 
28  (
29  const edm::ParameterSet& pset,
30  const std::string& remoteHost
31  ) :
32  RegistrationInfoBase(pset, remoteHost, EventServingParams(), false)
33  {
34  parsePSet(pset);
35  }
36 
37  void
39  {
40  try
41  {
42  outputModuleLabel_ = pset.getUntrackedParameter<std::string>("SelectHLTOutput");
43  }
44  catch( edm::Exception& e )
45  {
46  XCEPT_RAISE( stor::exception::ConsumerRegistration,
47  "No HLT output module specified" );
48  }
49 
50  triggerSelection_ = pset.getUntrackedParameter<std::string>("TriggerSelector", "");
51 
52  try
53  {
54  eventSelection_ = pset.getParameter<Strings>("TrackedEventSelection");
55  }
56  catch( edm::Exception& e )
57  {
58  edm::ParameterSet tmpPSet1 =
60  if ( ! tmpPSet1.empty() )
61  {
62  eventSelection_ = tmpPSet1.getParameter<Strings>("SelectEvents");
63  }
64  }
65 
66  prescale_ = pset.getUntrackedParameter<int>("prescale", 1);
67  uniqueEvents_ = pset.getUntrackedParameter<bool>("uniqueEvents", false);
68  headerRetryInterval_ = pset.getUntrackedParameter<int>("headerRetryInterval", 5);
69  }
70 
71 
72  void
74  {
75  pset.addUntrackedParameter<std::string>("SelectHLTOutput", outputModuleLabel_);
76  pset.addUntrackedParameter<std::string>("TriggerSelector", triggerSelection_);
77  pset.addParameter<Strings>("TrackedEventSelection", eventSelection_);
78  pset.addUntrackedParameter<bool>("uniqueEvents", uniqueEvents_);
79  pset.addUntrackedParameter<int>("prescale", prescale_);
80 
81  if ( headerRetryInterval_ != 5 )
82  pset.addUntrackedParameter<int>("headerRetryInterval", headerRetryInterval_);
83  }
84 
85  void
87  {
88  evtDist->registerEventConsumer(shared_from_this());
89  }
90 
91  void
93  {
94  os << "Output module: " << outputModuleLabel_ << "\n";
95 
96  if ( triggerSelection_.empty() )
97  {
98  if ( ! eventSelection_.empty() )
99  {
100  os << "Event Selection: ";
101  std::copy(eventSelection_.begin(), eventSelection_.end()-1,
102  std::ostream_iterator<Strings::value_type>(os, ","));
103  os << *(eventSelection_.end()-1);
104  }
105  }
106  else
107  os << "Trigger Selection: " << triggerSelection_;
108 
109  if ( prescale_ != 1 )
110  os << "; prescale: " << prescale_;
111 
112  if ( uniqueEvents_ != false )
113  os << "; uniqueEvents";
114 
115  os << "\n";
116  queueInfo(os);
117  }
118 
119  bool
121  {
122  if ( outputModuleLabel() != other.outputModuleLabel() )
123  return ( outputModuleLabel() < other.outputModuleLabel() );
124  if ( triggerSelection() != other.triggerSelection() )
125  return ( triggerSelection() < other.triggerSelection() );
126  if ( eventSelection() != other.eventSelection() )
127  return ( eventSelection() < other.eventSelection() );
128  if ( prescale() != other.prescale() )
129  return ( prescale() < other.prescale() );
130  if ( uniqueEvents() != other.uniqueEvents() )
131  return ( uniqueEvents() < other.uniqueEvents() );
132  return RegistrationInfoBase::operator<(other);
133  }
134 
135  bool
137  {
138  return (
139  outputModuleLabel() == other.outputModuleLabel() &&
140  triggerSelection() == other.triggerSelection() &&
141  eventSelection() == other.eventSelection() &&
142  prescale() == other.prescale() &&
143  uniqueEvents() == other.uniqueEvents() &&
145  );
146  }
147 
148  bool
150  {
151  return ! ( *this == other );
152  }
153 
154 }
155 
T getParameter(std::string const &) const
bool empty() const
Definition: ParameterSet.h:219
T getUntrackedParameter(std::string const &, T const &) const
virtual void do_eventType(std::ostream &) const
bool operator!=(const EventConsumerRegistrationInfo &) const
std::vector< std::string > Strings
Definition: MsgTools.h:18
bool operator==(const EventConsumerRegistrationInfo &) const
virtual void do_registerMe(EventDistributor *)
bool operator<(const EventConsumerRegistrationInfo &) const
virtual void do_appendToPSet(edm::ParameterSet &) const
void queueInfo(std::ostream &) const
virtual bool operator==(const RegistrationInfoBase &) const
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:145
void registerEventConsumer(const EventConsRegPtr)
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:209
virtual bool operator<(const RegistrationInfoBase &) const
EventConsumerRegistrationInfo(const edm::ParameterSet &pset, const EventServingParams &eventServingParams, const std::string &remoteHost=toolbox::net::getHostName())