SpacePoint3DDrawerChiSquare_tool.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file SpacePoint3DDrawerChiSquare_tool.cc
3 /// \author T. Usher
4 ////////////////////////////////////////////////////////////////////////
5 
9 
12 #include "canvas/Persistency/Common/FindManyP.h"
13 
14 #include "TPolyMarker3D.h"
15 
16 namespace evdb_tool
17 {
18 
20 {
21 public:
23 
25 
26  void Draw(const std::vector<art::Ptr<recob::SpacePoint>>&, // Space points
27  evdb::View3D*, // 3D display
28  int, // Color
29  int, // Marker
30  float, // Size) const override;
31  const art::FindManyP<recob::Hit>* // pointer to associated hits
32  ) const;
33 
34 private:
35 };
36 
37 //----------------------------------------------------------------------
38 // Constructor.
40 {
41 // fNumPoints = pset.get< int>("NumPoints", 1000);
42 // fFloatBaseline = pset.get<bool>("FloatBaseline", false);
43  // For now only draw cryostat=0.
44 
45  return;
46 }
47 
49 {
50  return;
51 }
52 
54  evdb::View3D* view,
55  int color,
56  int marker,
57  float size,
58  const art::FindManyP<recob::Hit>* hitAssns) const
59 {
60  // Get services.
62 
63  using HitPosition = std::array<double,6>;
64  std::map<int,std::vector<HitPosition>> colorToHitMap;
65 
66  float minHitChiSquare(0.);
67  float maxHitChiSquare(2.);
68  float hitChiSqScale((cst->fRecoQHigh[geo::kCollection] - cst->fRecoQLow[geo::kCollection]) / (maxHitChiSquare - minHitChiSquare));
69 
70  for(const auto& spacePoint : hitsVec)
71  {
72  const double* pos = spacePoint->XYZ();
73  const double* err = spacePoint->ErrXYZ();
74 
75  int chargeColorIdx(0);
76  float spacePointChiSq(spacePoint->Chisq());
77 
78  float hitChiSq = std::max(minHitChiSquare, std::min(maxHitChiSquare, spacePointChiSq));
79 
80  float chgFactor = cst->fRecoQHigh[geo::kCollection] - hitChiSqScale * hitChiSq;
81 
82  chargeColorIdx = cst->CalQ(geo::kCollection).GetColor(chgFactor);
83 
84  colorToHitMap[chargeColorIdx].push_back(HitPosition()={{pos[0],pos[1],pos[2],err[3],err[3],err[5]}});
85  }
86 
87  for(auto& hitPair : colorToHitMap)
88  {
89  TPolyMarker3D& pm = view->AddPolyMarker3D(hitPair.second.size(), hitPair.first, kFullDotLarge, 0.17);
90  for (const auto& hit : hitPair.second) pm.SetNextPoint(hit[0],hit[1],hit[2]);
91  }
92 
93  return;
94 }
95 
97 }
#define DEFINE_ART_CLASS_TOOL(tool)
Definition: ToolMacros.h:42
struct vector vector
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
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
const evdb::ColorScale & CalQ(geo::SigType_t st) const
static int max(int a, int b)
void err(const char *fmt,...)
Definition: message.cpp:226
Detector simulation of raw signals on wires.
std::size_t color(std::string const &procname)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
void Draw(const std::vector< art::Ptr< recob::SpacePoint >> &, evdb::View3D *, int, int, float, const art::FindManyP< recob::Hit > *) const
Signal from collection planes.
Definition: geo_types.h:146