All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ColorDrawingOptions.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file ColorDrawingOptions_service.cc
3 ///
4 /// \author brebel@fnal.gov
5 
6 // Framework includes
7 #include "messagefacility/MessageLogger/MessageLogger.h"
8 
9 /// LArSoft includes
11 
12 namespace evd{
13 
14  //......................................................................
15  ColorDrawingOptions::ColorDrawingOptions(fhicl::ParameterSet const& pset)
16  : evdb::Reconfigurable{pset}
17  , fColorOrGray(pset.get< int >("ColorOrGrayScale"))
18  , fRawDiv (pset.get< std::vector<int> >("RawDiv") )
19  , fRecoDiv (pset.get< std::vector<int> >("RecoDiv") )
20  , fRawQLow (pset.get< std::vector<double> >("RawQLow") )
21  , fRawQHigh (pset.get< std::vector<double> >("RawQHigh") )
22  , fRecoQLow (pset.get< std::vector<double> >("RecoQLow") )
23  , fRecoQHigh (pset.get< std::vector<double> >("RecoQHigh") )
24  {
25  this->CheckInputVectorSizes();
26 
27  for(size_t i = 0; i < fRawDiv.size(); ++i){
28  fColorScaleRaw.push_back(evdb::ColorScale(fRawQLow[i], fRawQHigh[i],
29  evdb::kBlueToRedII, evdb::kLinear,
30  fRawDiv[i],
31  285.0, 135.0, // angle in the color wheel
32  0.65, 0.25)); // intensity from light to dark,
33  // starting with low color wheel value
34 
35  fGrayScaleRaw.push_back(evdb::ColorScale(fRawQLow[i], fRawQHigh[i],
36  evdb::kLinGray, evdb::kLinear,
37  fRawDiv[i],
38  270.0, 0.0, // angle in the color wheel
39  0.5, 0.5)); // intensity from light to dark,
40  // starting with low color wheel value
41  }
42 
43  for(size_t i = 0; i < fRecoDiv.size(); ++i){
44  fColorScaleReco.push_back(evdb::ColorScale(fRecoQLow[i], fRecoQHigh[i],
45  evdb::kBlueToRedII, evdb::kLinear,
46  fRecoDiv[i],
47  285.0, 135.0,
48  0.65, 0.25));
49  fGrayScaleReco.push_back(evdb::ColorScale(fRecoQLow[i], fRecoQHigh[i],
50  evdb::kLinGray, evdb::kLinear,
51  fRecoDiv[i],
52  270.0, 0.0,
53  0.5, 0.5));
54  }
55  }
56 
57  //......................................................................
59  {
60 
61  // compare all input vectors for reco and raw color scaling against
62  // the number of possible signal types in the geometry
63  if(fRawDiv.size() != geo::kMysteryType){
64  if(fRawDiv.size() == 1 && fRawQLow.size() == 1 && fRawQHigh.size() == 1){
65  // pad out the vectors to all have the same entries
66  fRawDiv .resize(geo::kMysteryType, fRawDiv[0]);
67  fRawQLow .resize(geo::kMysteryType, fRawQLow[0]);
69  mf::LogWarning("ColorDrawingOptions") << "only 1 value given for raw color scale: "
70  << "number of divisions, low and high values.\n"
71  << "Pad out those values for the number of signal types.";
72  }
73  else
74  throw cet::exception("ColorDrawingOptionsUnclear") << "You have specified an incorrect number of "
75  << "values for the raw color/gray scale "
76  << "than there are types of signal planes in "
77  << "the detector. It is unclear what your "
78  << "intention is, so bail.\n";
79  }// end check on the raw vector sizes
80 
81  if(fRecoDiv.size() != geo::kMysteryType){
82  if(fRecoDiv.size() == 1 && fRecoQLow.size() == 1 && fRecoQHigh.size() == 1){
83  // pad out the vectors to all have the same entries
84  fRecoDiv .resize(geo::kMysteryType, fRecoDiv[0]);
87  mf::LogWarning("ColorDrawingOptions") << "only 1 value given for reco color scale: "
88  << "number of divisions, low and high values.\n"
89  << "Pad out those values for the number of signal types.";
90  }
91  else
92  throw cet::exception("ColorDrawingOptionsUnclear") << "You have specified an incorrect number of "
93  << "values for the reco color/gray scale "
94  << "than there are types of signal planes in "
95  << "the detector. It is unclear what your "
96  << "intention is, so bail.\n";
97  }// end check on the reco vector sizes
98 
99  return;
100  }
101 
102  //......................................................................
103  void ColorDrawingOptions::reconfigure(fhicl::ParameterSet const& pset)
104  {
105  fColorOrGray = pset.get< int >("ColorOrGrayScale");
106  fRawDiv = pset.get< std::vector<int> >("RawDiv");
107  fRecoDiv = pset.get< std::vector<int> >("RecoDiv");
108  fRawQLow = pset.get< std::vector<double> >("RawQLow");
109  fRawQHigh = pset.get< std::vector<double> >("RawQHigh");
110  fRecoQLow = pset.get< std::vector<double> >("RecoQLow");
111  fRecoQHigh = pset.get< std::vector<double> >("RecoQHigh");
112 
113  this->CheckInputVectorSizes();
114 
115  for(size_t i = 0; i < fRawDiv.size(); ++i){
116  fColorScaleRaw[i].SetBounds(fRawQLow[i], fRawQHigh[i]);
117  fGrayScaleRaw[i] .SetBounds(fRawQLow[i], fRawQHigh[i]);
118  }
119 
120  for(size_t i = 0; i < fRecoDiv.size(); ++i){
121  fColorScaleReco[i].SetBounds(fRecoQLow[i], fRecoQHigh[i]);
122  fGrayScaleReco[i] .SetBounds(fRecoQLow[i], fRecoQHigh[i]);
123  }
124 
125  return;
126  }
127 
128  //......................................................................
129  const evdb::ColorScale& ColorDrawingOptions::RawQ(geo::SigType_t st) const
130  {
131  size_t pos = (size_t)st;
132 
133  if(st == geo::kMysteryType)
134  throw cet::exception("ColorDrawingOptions") << "asked for RawQ with geo::kMysteryType, "
135  << "bad things will happen, so bail\n";
136 
137  if(fColorOrGray > 0) return fGrayScaleRaw[pos];
138 
139  return fColorScaleRaw[pos];
140  }
141 
142  //......................................................................
143  const evdb::ColorScale& ColorDrawingOptions::CalQ(geo::SigType_t st) const
144  {
145  size_t pos = (size_t)st;
146 
147  if(st == geo::kMysteryType)
148  throw cet::exception("ColorDrawingOptions") << "asked for CalQ with geo::kMysteryType, "
149  << "bad things will happen, so bail\n";
150 
151  if(fColorOrGray > 0) return fGrayScaleReco[pos];
152 
153  return fColorScaleReco[pos];
154  }
155 
156  //......................................................................
157  const evdb::ColorScale& ColorDrawingOptions::RawT(geo::SigType_t st) const
158  {
159  size_t pos = (size_t)st;
160 
161  if(st == geo::kMysteryType)
162  throw cet::exception("ColorDrawingOptions") << "asked for RawT with geo::kMysteryType, "
163  << "bad things will happen, so bail\n";
164 
165 
166  if(fColorOrGray > 0) return fGrayScaleRaw[pos];
167 
168  return fColorScaleRaw[pos];
169  }
170 
171  //......................................................................
172  const evdb::ColorScale& ColorDrawingOptions::CalT(geo::SigType_t st) const
173  {
174  size_t pos = (size_t)st;
175 
176  if(st == geo::kMysteryType)
177  throw cet::exception("ColorDrawingOptions") << "asked for CalT with geo::kMysteryType, "
178  << "bad things will happen, so bail\n";
179 
180  if(fColorOrGray > 0) return fGrayScaleReco[pos];
181 
182  return fColorScaleReco[pos];
183  }
184 }// namespace
185 ////////////////////////////////////////////////////////////////////////
std::vector< double > fRawQLow
low edge of ADC values for drawing raw digits
Who knows?
Definition: geo_types.h:147
const evdb::ColorScale & CalT(geo::SigType_t st) const
std::vector< int > fRawDiv
number of divisions in raw
std::vector< evdb::ColorScale > fGrayScaleRaw
std::vector< evdb::ColorScale > fColorScaleReco
std::vector< evdb::ColorScale > fColorScaleRaw
void reconfigure(fhicl::ParameterSet const &pset)
ColorDrawingOptions(fhicl::ParameterSet const &pset)
std::vector< double > fRecoQHigh
high edge of ADC values for drawing raw digits
std::vector< double > fRecoQLow
low edge of ADC values for drawing raw digits
The color scales used by the event display.
const evdb::ColorScale & RawQ(geo::SigType_t st) const
enum geo::_plane_sigtype SigType_t
const evdb::ColorScale & CalQ(geo::SigType_t st) const
std::vector< double > fRawQHigh
high edge of ADC values for drawing raw digits
int fColorOrGray
0 = color, 1 = gray
std::vector< int > fRecoDiv
number of divisions in raw
std::vector< evdb::ColorScale > fGrayScaleReco
const evdb::ColorScale & RawT(geo::SigType_t st) const