RawDrawingOptions_service.cc
Go to the documentation of this file.
1 ///
2 /// \file RawDrawingOptions.cxx
3 /// \brief Global drawing options that apply to all displays
4 /// \author messier@indiana.edu
5 ///
7 
8 
9 namespace evd
10 {
11  //....................................................................
14  : evdb::Reconfigurable{pset}
15  {
16  this->reconfigure(pset);
17  }
18 
19  //....................................................................
21  {
22  }
23 
24  //....................................................................
25  static bool is_empty(const std::string& s)
26  {
27  return (s=="" || s==" ");
28  }
29 
30  //....................................................................
32  std::vector<std::string>& modules,
33  std::vector<std::string>& instances,
34  const char* object)
35  {
36  unsigned int i;
37 
38  std::string A(object);
39  std::string B(object);
40 
41  A += ".val";
42  B += "Add.val";
43 
44  std::vector<std::string> a=pset.get<std::vector<std::string> >(A.c_str());
45  std::vector<std::string> b=pset.get<std::vector<std::string> >(B.c_str());
46 
47  modules.clear();
48  modules.insert(modules.end(), a.begin(), a.end());
49  modules.insert(modules.end(), b.begin(), b.end());
50 
51  auto newEnd = std::remove_if(modules.begin(), modules.end(), is_empty);
52  modules.erase(newEnd, modules.end());
53 
54  instances.resize(modules.size());
55  for(i=0; i<modules.size(); ++i) {
56  ParseModuleInstanceString(modules[i], instances[i]);
57  }
58  }
59 
60  //....................................................................
62  {
63  fColor = pset.get<int>("Color.val");
64  fWhichHits = pset.get<int>("WhichHits.val");
65  fWhichQ = pset.get<int>("WhichQ.val");
66  fRawDrawingOpt = pset.get<int>("RawDrawingOpt.val");
67  fScaleFactor = pset.get<float>("ScaleFactor.val");
68  fTimeRange = pset.get< std::vector<float> >("TimeRange.val");
69  fTimeBinSize = pset.get<float>("TimeBinSize.val");
70  fTimeAutoZoomTruth = pset.get<int>("TimeAutoZoomTruth.val");
71  fADCRange = pset.get< std::vector<float> >("ADCRange.val");
72  fADCBinSize = pset.get<float>("ADCBinSize.val");
73  fHit3DStyle = pset.get<int>("Hit3DStyle.val");
74  fTHistogram = pset.get<int>("THistogram.val");
75 
76  // Ensure sensical ranges and bin size.
77  if ( fTimeBinSize <= 0 ) fTimeBinSize = 0.01; //10 ns
78  if ( fTimeRange[0] >= (fTimeRange[1]-fTimeBinSize)) fTimeRange[1] = fTimeRange[0] + 10*fTimeBinSize;
79  if ( (fTimeRange[1]-fTimeRange[0]) < fTimeBinSize ) fTimeBinSize = fTimeRange[1]-fTimeRange[2];
80 
81  if ( fADCBinSize < 1) fADCBinSize = 1;
82  if ( fADCRange[0] >= (fADCRange[1]-fADCBinSize)) fADCRange[1] = fADCRange[0] + 10*fADCBinSize;
83  if ( (fADCRange[1]-fADCRange[0]) < fADCBinSize ) fADCBinSize = fADCRange[1]-fADCRange[2];
84 
85  this->ModuleList(pset, fRawDigitsModules, fRawDigitsInstances, "RawDigitsModules");
86  this->ModuleList(pset, fCellHitsModules, fCellHitsInstances, "CellHitsModules");
87  }
88 
89  //....................................................................
91  std::string& inst) const
92  {
93  const size_t splitPos = mod.find_first_of('_');
94  if(splitPos == std::string::npos){
95  inst = "";
96  return;
97  }
98  inst = mod.substr(splitPos+1);
99  mod.resize(splitPos);
100  }
101 
103 
104 } // end namespace evd
105 ////////////////////////////////////////////////////////////////////////
std::vector< float > fTimeRange
RawDrawingOptions(fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
void reconfigure(fhicl::ParameterSet const &pset) override
Global drawing options that apply to all displays.
#define DEFINE_ART_SERVICE(svc)
Definition: ServiceMacros.h:88
void ParseModuleInstanceString(std::string &mod, std::string &inst) const
Parse apart a "module_instance" string. Input the joined string as mod. If there is no underscore...
static bool is_empty(const std::string &s)
std::vector< std::string > fCellHitsModules
Manage all things related to colors for the event display.
Definition: Display3DPad.h:11
const XML_Char * s
Definition: expat.h:262
std::vector< std::string > fRawDigitsModules
nova event display
std::vector< std::string > fRawDigitsInstances
const double a
T get(std::string const &key) const
Definition: ParameterSet.h:231
static const double A
Definition: Units.h:82
void ModuleList(fhicl::ParameterSet const &pset, std::vector< std::string > &modules, std::vector< std::string > &instances, const char *object)
const hit & b
Definition: hits.cxx:21
Global drawing options that apply to all displays.
std::vector< float > fADCRange
std::vector< std::string > fCellHitsInstances
enum BeamMode string