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