LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ColorDrawingOptions.cc
Go to the documentation of this file.
1 
6 // Framework includes
8 
11 
12 namespace evd {
13 
14  //......................................................................
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) {
29  fRawQHigh[i],
32  fRawDiv[i],
33  285.0,
34  135.0, // angle in the color wheel
35  0.65,
36  0.25)); // intensity from light to dark,
37  // starting with low color wheel value
38 
40  fRawQHigh[i],
43  fRawDiv[i],
44  270.0,
45  0.0, // angle in the color wheel
46  0.5,
47  0.5)); // intensity from light to dark,
48  // starting with low color wheel value
49  }
50 
51  for (size_t i = 0; i < fRecoDiv.size(); ++i) {
53  fRecoQHigh[i],
56  fRecoDiv[i],
57  285.0,
58  135.0,
59  0.65,
60  0.25));
62  fRecoQHigh[i],
65  fRecoDiv[i],
66  270.0,
67  0.0,
68  0.5,
69  0.5));
70  }
71  }
72 
73  //......................................................................
75  {
76 
77  // compare all input vectors for reco and raw color scaling against
78  // the number of possible signal types in the geometry
79  if (fRawDiv.size() != geo::kMysteryType) {
80  if (fRawDiv.size() == 1 && fRawQLow.size() == 1 && fRawQHigh.size() == 1) {
81  // pad out the vectors to all have the same entries
82  fRawDiv.resize(geo::kMysteryType, fRawDiv[0]);
85  mf::LogWarning("ColorDrawingOptions")
86  << "only 1 value given for raw color scale: "
87  << "number of divisions, low and high values.\n"
88  << "Pad out those values for the number of signal types.";
89  }
90  else
91  throw cet::exception("ColorDrawingOptionsUnclear")
92  << "You have specified an incorrect number of "
93  << "values for the raw 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 raw vector sizes
98 
99  if (fRecoDiv.size() != geo::kMysteryType) {
100  if (fRecoDiv.size() == 1 && fRecoQLow.size() == 1 && fRecoQHigh.size() == 1) {
101  // pad out the vectors to all have the same entries
102  fRecoDiv.resize(geo::kMysteryType, fRecoDiv[0]);
105  mf::LogWarning("ColorDrawingOptions")
106  << "only 1 value given for reco color scale: "
107  << "number of divisions, low and high values.\n"
108  << "Pad out those values for the number of signal types.";
109  }
110  else
111  throw cet::exception("ColorDrawingOptionsUnclear")
112  << "You have specified an incorrect number of "
113  << "values for the reco color/gray scale "
114  << "than there are types of signal planes in "
115  << "the detector. It is unclear what your "
116  << "intention is, so bail.\n";
117  } // end check on the reco vector sizes
118 
119  return;
120  }
121 
122  //......................................................................
124  {
125  fColorOrGray = pset.get<int>("ColorOrGrayScale");
126  fRawDiv = pset.get<std::vector<int>>("RawDiv");
127  fRecoDiv = pset.get<std::vector<int>>("RecoDiv");
128  fRawQLow = pset.get<std::vector<double>>("RawQLow");
129  fRawQHigh = pset.get<std::vector<double>>("RawQHigh");
130  fRecoQLow = pset.get<std::vector<double>>("RecoQLow");
131  fRecoQHigh = pset.get<std::vector<double>>("RecoQHigh");
132 
133  this->CheckInputVectorSizes();
134 
135  for (size_t i = 0; i < fRawDiv.size(); ++i) {
136  fColorScaleRaw[i].SetBounds(fRawQLow[i], fRawQHigh[i]);
137  fGrayScaleRaw[i].SetBounds(fRawQLow[i], fRawQHigh[i]);
138  }
139 
140  for (size_t i = 0; i < fRecoDiv.size(); ++i) {
141  fColorScaleReco[i].SetBounds(fRecoQLow[i], fRecoQHigh[i]);
142  fGrayScaleReco[i].SetBounds(fRecoQLow[i], fRecoQHigh[i]);
143  }
144 
145  return;
146  }
147 
148  //......................................................................
150  {
151  size_t pos = (size_t)st;
152 
153  if (st == geo::kMysteryType)
154  throw cet::exception("ColorDrawingOptions") << "asked for RawQ with geo::kMysteryType, "
155  << "bad things will happen, so bail\n";
156 
157  if (fColorOrGray > 0) return fGrayScaleRaw[pos];
158 
159  return fColorScaleRaw[pos];
160  }
161 
162  //......................................................................
164  {
165  size_t pos = (size_t)st;
166 
167  if (st == geo::kMysteryType)
168  throw cet::exception("ColorDrawingOptions") << "asked for CalQ with geo::kMysteryType, "
169  << "bad things will happen, so bail\n";
170 
171  if (fColorOrGray > 0) return fGrayScaleReco[pos];
172 
173  return fColorScaleReco[pos];
174  }
175 
176  //......................................................................
178  {
179  size_t pos = (size_t)st;
180 
181  if (st == geo::kMysteryType)
182  throw cet::exception("ColorDrawingOptions") << "asked for RawT with geo::kMysteryType, "
183  << "bad things will happen, so bail\n";
184 
185  if (fColorOrGray > 0) return fGrayScaleRaw[pos];
186 
187  return fColorScaleRaw[pos];
188  }
189 
190  //......................................................................
192  {
193  size_t pos = (size_t)st;
194 
195  if (st == geo::kMysteryType)
196  throw cet::exception("ColorDrawingOptions") << "asked for CalT with geo::kMysteryType, "
197  << "bad things will happen, so bail\n";
198 
199  if (fColorOrGray > 0) return fGrayScaleReco[pos];
200 
201  return fColorScaleReco[pos];
202  }
203 } // namespace
std::vector< double > fRawQLow
low edge of ADC values for drawing raw digits
Who knows?
Definition: geo_types.h:153
const evdb::ColorScale & CalT(geo::SigType_t st) const
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)
Manage all things related to colors for the event display.
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.
LArSoft includes.
Build an association between a numerical range and a ROOT color index for use in, eg...
Definition: ColorScale.h:44
const evdb::ColorScale & RawQ(geo::SigType_t st) const
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
T get(std::string const &key) const
Definition: ParameterSet.h:314
const evdb::ColorScale & CalQ(geo::SigType_t st) const
std::vector< int > fRawDiv
number of divisions in raw
Blue = cold, red = hot.
Definition: ColorScale.h:21
Rainbow with high and low flipped.
Definition: ColorScale.h:18
std::vector< double > fRawQHigh
high edge of ADC values for drawing raw digits
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
int fColorOrGray
0 = color, 1 = gray
std::vector< int > fRecoDiv
number of divisions in raw
std::vector< evdb::ColorScale > fGrayScaleReco
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
const evdb::ColorScale & RawT(geo::SigType_t st) const