SpacePoint3DDrawerStandard_tool.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file SpacePoint3DDrawerStandard_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>* ) const
59 {
60  // Get services.
61 
63 
64  // Organize space points into separate collections according to the color
65  // we want them to be.
66  // If option If option fColorSpacePointsByChisq is false, this means
67  // having a single collection with color inherited from the prong
68  // (specified by the argument color).
69 
70  std::map<int, std::vector<const recob::SpacePoint*> > spmap; // Indexed by color.
71  int spcolor = color;
72 
73  for(auto &pspt : spts) {
74  //std::cout<<pspt<<std::endl;
75  //if(pspt == 0) throw cet::exception("RecoBaseDrawer:DrawSpacePoint3D") << "space point is null\n";
76 
77  // For rainbow effect, choose root colors in range [51,100].
78  // We are using 100=best (red), 51=worst (blue).
79 
80  // if (pspt->Chisq() > -100.) continue;
81 
82  spcolor = 12;
83 
84  if (pspt->Chisq() < -100.) spcolor = 16;
85 
86  if(recoOpt->fColorSpacePointsByChisq)
87  {
88  spcolor = 100 - 2.5 * pspt->Chisq();
89 
90  if(spcolor < 51) spcolor = 51;
91  if(spcolor > 100) spcolor = 100;
92  }
93  else spcolor = color;
94  //if (pspt->Chisq() < -1.) spcolor += 6;
95 
96  spmap[spcolor].push_back(&*pspt);
97  }
98 
99  // Loop over colors.
100  // Note that larger (=better) space points are plotted on
101  // top for optimal visibility.
102 
103  for(auto const icolor : spmap)
104  {
105  int spcolor = icolor.first;
106  const std::vector<const recob::SpacePoint*>& psps = icolor.second;
107 
108  // Make and fill a polymarker.
109 
110  TPolyMarker3D& pm = view->AddPolyMarker3D(psps.size(), spcolor, marker, size);
111 
112  for(size_t s = 0; s < psps.size(); ++s)
113  {
114  const recob::SpacePoint& spt = *psps[s];
115 
116  const double *xyz = spt.XYZ();
117  pm.SetPoint(s, xyz[0], xyz[1], xyz[2]);
118  }
119  }
120 
121  return;
122 }
123 
125 }
#define DEFINE_ART_CLASS_TOOL(tool)
Definition: ToolMacros.h:42
int fColorSpacePointsByChisq
Generate space point colors by chisquare?
struct vector vector
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
void Draw(const std::vector< art::Ptr< recob::SpacePoint >> &, evdb::View3D *, int, int, float, const art::FindManyP< recob::Hit > *) const
std::size_t color(std::string const &procname)
const Double32_t * XYZ() const
Definition: SpacePoint.h:76
static QCString * s
Definition: config.cpp:1042