TriggerNamesService_service.cc
Go to the documentation of this file.
1 // ======================================================================
2 //
3 // TriggerNamesService
4 //
5 // ======================================================================
6 
8 
12 #include "cetlib_except/exception.h"
14 
16 using namespace cet;
17 using namespace fhicl;
18 using namespace std;
19 
20 // ----------------------------------------------------------------------
21 
22 TriggerNamesService::TriggerNamesService(ParameterSet const& procPS,
23  Strings const& trigger_path_names)
24  : trignames_{trigger_path_names}
25  , process_name_{procPS.get<string>("process_name")}
26  , wantSummary_{procPS.get<bool>("services.scheduler.wantSummary", false)}
27 {
28  // Make and hold onto a parameter set for posterity.
29  trigger_pset_.put("trigger_paths", trignames_);
30  ParameterSetRegistry::put(trigger_pset_);
31 
32  auto const& physics = procPS.get<ParameterSet>("physics", {});
33  end_names_ = physics.get<Strings>("end_paths", {});
34 
35  auto assign_position = [](auto& posmap, size_type const i, auto const& name) {
36  posmap[name] = i;
37  };
38 
39  using namespace std::placeholders;
41  trignames_, std::bind(assign_position, std::ref(trigpos_), _1, _2));
43  end_names_, std::bind(assign_position, std::ref(end_pos_), _1, _2));
44 
46  trignames_,
47  std::back_inserter(modulenames_),
48  [&physics](std::string const& par) { return physics.get<Strings>(par); });
49 } // c'tor
50 
51 // ----------------------------------------------------------------------
52 
53 bool
55  Strings& trigPaths) const
56 {
57  ParameterSet pset;
58  if (!ParameterSetRegistry::get(triggerResults.parameterSetID(), pset)) {
59  return false;
60  }
61  auto tmpPaths = pset.get<Strings>("trigger_paths", {});
62  if (tmpPaths.size() != triggerResults.size()) {
64  << "TriggerNamesService::getTrigPaths, Trigger names vector and\n"
65  "TriggerResults are different sizes. This should be impossible,\n"
66  "please send information to reproduce this problem to\n"
67  "the ART developers.\n";
68  }
69  std::swap(tmpPaths, trigPaths);
70  return true;
71 }
const XML_Char * name
Definition: expat.h:151
void put(std::string const &key)
fhicl::ParameterSet trigger_pset_
void for_all_with_index(FwdCont &, Func)
Strings const & getTrigPaths() const
Int_t par
Definition: SimpleIterate.C:24
std::vector< Strings > modulenames_
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
std::vector< std::string > Strings
T get(std::string const &key) const
Definition: ParameterSet.h:231
auto transform_all(Container &, OutputIt, UnaryOp)
std::size_t size() const
fhicl::ParameterSetID const & parameterSetID() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
enum BeamMode string