EventDisplay3DUtils.cxx
Go to the documentation of this file.
1 //
2 // - Serves as the link between ROOT "events" (e.g. mouse-clicks) and the ART
3 // event display service by providing a receiver slot for signals generated
4 // by the ROOT events. A ROOT dictionary needs to be generated for this.
5 //
6 
7 #include "nuevdb/EventDisplayBase/NavState.h"
9 
10 #include <string>
11 #include <cmath>
12 
13 #include <TColor.h>
14 
15 namespace gar{
16 
17  namespace evd3d
18  {
20  :fTbRun(0)
21  ,fTbEvt(0)
22  {
23  Double_t s[] = { 0.00, 0.20, 0.35, 0.43, 0.45, 0.50, 1.00};
24  Double_t r[] = { 0.00, 0.90, 1.00, 1.00, 1.00, 1.00, 0.00};
25  Double_t g[] = { 0.50, 0.10, 0.75, 0.90, 1.00, 1.00, 0.00};
26  Double_t b[] = { 0.30, 0.00, 0.00, 0.00, 0.00, 1.00, 0.00};
27  fColorCount = 200;
28  unsigned int abc = sizeof(s)/sizeof(s[0]);
29 
30  fColorBase = TColor::CreateGradientColorTable(abc, s, r, g, b,
31  fColorCount);
32  }
33 
35  {
36  evdb::NavState::Set(evdb::kPREV_EVENT);
37  }
38 
40  {
41  evdb::NavState::Set(evdb::kNEXT_EVENT);
42  }
43 
45  {
46  int run = std::stoi(fTbRun->GetString());
47  int event = std::stoi(fTbEvt->GetString());
48  evdb::NavState::SetTarget(run, event);
49  evdb::NavState::Set(evdb::kGOTO_EVENT);
50  }
51 
52  int EventDisplay3DUtils::LogColor(double value, double minVal, double maxVal, double magScale)
53  {
54  int nCol = fColorCount/2;
55  double scale = std::pow(10.0,magScale);
56  double nvalue = std::max(0.0,std::min((value-minVal)/(maxVal-minVal),1.0));
57  double lValue = std::log10(1.0+scale*nvalue)/magScale;
58  int iValue = nCol*lValue;
59  iValue = std::max(0,std::min(iValue,nCol-1));
60  return fColorBase + iValue;
61  }
62  }
63  }
static constexpr double g
Definition: Units.h:144
int LogColor(double val, double minVal, double maxVal, double magScale=5.0)
constexpr T pow(T x)
Definition: pow.h:72
constexpr BitMask< Storage > Set(Flag_t< Storage > flag)
Returns a bit mask which sets the specified flag.
static int max(int a, int b)
General GArSoft Utilities.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
static bool * b
Definition: config.cpp:1043
static QCString * s
Definition: config.cpp:1042
Event finding and building.