RecoDrawingOptions_service.cc
Go to the documentation of this file.
1 ///
2 /// \file RecoDrawingOptions.cxx
3 /// \brief Global drawing options that apply to all displays
4 /// \author messier@indiana.edu
5 ///
7 #include <algorithm>
8 
9 namespace evd
10 {
13  : evdb::Reconfigurable{pset}
14  {
15  this->reconfigure(pset);
16  }
17 
18  //....................................................................
20  {
21  }
22 
23  //....................................................................
24  static bool is_empty(const std::string& s)
25  {
26  return (s=="" || s==" ");
27  }
28 
29  //....................................................................
31  std::vector<std::string>& modules,
32  std::vector<std::string>& instances,
33  const char* object)
34  {
35  unsigned int i;
36 
37  std::string A(object);
38  std::string B(object);
39 
40  A += ".val";
41  B += "Add.val";
42 
43  std::vector<std::string> a=pset.get<std::vector<std::string> >(A.c_str());
44  std::vector<std::string> b=pset.get<std::vector<std::string> >(B.c_str());
45 
46  modules.clear();
47  modules.insert(modules.end(), a.begin(), a.end());
48  modules.insert(modules.end(), b.begin(), b.end());
49 
50  auto newEnd = std::remove_if(modules.begin(), modules.end(), is_empty);
51  modules.erase(newEnd, modules.end());
52 
53  instances.resize(modules.size());
54  for(i=0; i<modules.size(); ++i) {
55  ParseModuleInstanceString(modules[i], instances[i]);
56  }
57  }
58 
59  //....................................................................
61  {
62  fClusterStyle = pset.get<int>("ClusterStyle.val");
63  fProngOpt = pset.get<int>("ProngOpt.val");
64  fTrackOpt = pset.get<int>("TrackOpt.val");
65  fVertexOpt = pset.get<int>("VertexOpt.val");
66  fOfflineChanOpt = pset.get<int>("OfflineChanOpt.val");
67  fShowerOpt = pset.get<int>("ShowerOpt.val");
68  fHoughOpt = pset.get<int>("HoughOpt.val");
69 
70  fClusterIndex = pset.get< std::vector< std::vector<int> > >("ClusterIndex.val");
71  fTrackIndex = pset.get< std::vector< std::vector<int> > >("TrackIndex.val");
72  fVertexIndex = pset.get< std::vector< std::vector<int> > >("VertexIndex.val");
73  fProngIndex = pset.get< std::vector< std::vector<int> > >("ProngIndex.val");
74 
75  this->ModuleList(pset, fCellHitModules, fCellHitInstances, "CellHits");
77  this->ModuleList(pset, fClusterModules, fClusterInstances, "Clusters");
78  this->ModuleList(pset, fProngModules, fProngInstances, "Prongs");
79  this->ModuleList(pset, fVertexModules, fVertexInstances, "Vertices");
80  this->ModuleList(pset, fTrackModules, fTrackInstances, "Tracks");
81  this->ModuleList(pset, fShowerModules, fShowerInstances, "Showers");
82  this->ModuleList(pset, fOfflineChanModules, fOfflineChanInstances, "OfflineChans");
83  }
84 
85  //......................................................................
87  std::string& inst) const
88  {
89  const size_t splitPos = mod.find_first_of('_');
90  if(splitPos == std::string::npos){
91  inst = "";
92  return;
93  }
94  inst = mod.substr(splitPos+1);
95  mod.resize(splitPos);
96  }
97 
98  //......................................................................
99 
101 
102 } // end namespace evd
103 ////////////////////////////////////////////////////////////////////////
void ParseModuleInstanceString(std::string &mod, std::string &inst) const
Parse apart a "module_instance" string.
void ModuleList(fhicl::ParameterSet const &pset, std::vector< std::string > &modules, std::vector< std::string > &instances, const char *object)
std::vector< std::string > fClusterModules
Module labels for Clusters.
std::vector< std::string > fVertexInstances
productInstance labels for Vertexes
#define DEFINE_ART_SERVICE(svc)
Definition: ServiceMacros.h:88
std::vector< std::string > fCellHitModules
Module labels for CellHits.
std::vector< std::string > fShowerInstances
productInstance labels for Showers
std::vector< std::string > fShowerModules
Module labels for Showers.
static bool is_empty(const std::string &s)
std::vector< std::string > fVertexModules
Module labels for Vertices.
Manage all things related to colors for the event display.
Definition: Display3DPad.h:11
Global drawing options that apply to all displays.
std::vector< std::string > fClusterInstances
productInstance labels for Clusters
void reconfigure(fhicl::ParameterSet const &pset) override
const XML_Char * s
Definition: expat.h:262
std::vector< std::string > fHoughResultModules
Module labels for HoughResults.
nova event display
const double a
std::vector< std::string > fTrackModules
Module labels for Tracks.
std::vector< std::string > fCellHitInstances
productInstance labels for CellHits
T get(std::string const &key) const
Definition: ParameterSet.h:231
std::vector< std::string > fOfflineChanInstances
productInstance labels for OfflineChans
std::vector< std::string > fProngInstances
productInstance labels for Prongs
Global drawing options that apply to all displays.
std::vector< std::vector< int > > fClusterIndex
static const double A
Definition: Units.h:82
std::vector< std::string > fProngModules
Module labels for Prongs.
std::vector< std::string > fOfflineChanModules
Module labels for OfflineChans.
std::vector< std::vector< int > > fVertexIndex
const hit & b
Definition: hits.cxx:21
std::vector< std::string > fTrackInstances
productInstance labels for Tracks
std::vector< std::vector< int > > fTrackIndex
RecoDrawingOptions(fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
std::vector< std::string > fHoughResultInstances
productInstance labels for HoughResults
std::vector< std::vector< int > > fProngIndex
enum BeamMode string