All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SpacePoint3DDrawerStandard_tool.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file SpacePoint3DDrawerStandard_tool.cc
3 /// \author T. Usher
4 ////////////////////////////////////////////////////////////////////////
5 
9 
10 #include "nuevdb/EventDisplayBase/View3D.h"
11 
12 #include "art/Framework/Services/Registry/ServiceHandle.h"
13 #include "art/Utilities/ToolMacros.h"
14 #include "canvas/Persistency/Common/FindManyP.h"
15 
16 #include "TPolyMarker3D.h"
17 
18 namespace evdb_tool
19 {
20 
22 {
23 public:
24  explicit SpacePoint3DDrawerStandard(const fhicl::ParameterSet&);
25 
27 
28  void Draw(const std::vector<art::Ptr<recob::SpacePoint>>&, // Space points
29  evdb::View3D*, // 3D display
30  int, // Color
31  int, // Marker
32  float, // Size) const override;
33  const art::FindManyP<recob::Hit>* // pointer to associated hits
34  ) const;
35 
36 private:
37 };
38 
39 //----------------------------------------------------------------------
40 // Constructor.
42 {
43 // fNumPoints = pset.get< int>("NumPoints", 1000);
44 // fFloatBaseline = pset.get<bool>("FloatBaseline", false);
45  // For now only draw cryostat=0.
46 
47  return;
48 }
49 
51 {
52  return;
53 }
54 
55 void SpacePoint3DDrawerStandard::Draw(const std::vector<art::Ptr<recob::SpacePoint>>& spts,
56  evdb::View3D* view,
57  int color,
58  int marker,
59  float size,
60  const art::FindManyP<recob::Hit>* ) const
61 {
62  // Get services.
63 
64  art::ServiceHandle<evd::RecoDrawingOptions const> recoOpt;
65 
66  // Organize space points into separate collections according to the color
67  // we want them to be.
68  // If option If option fColorSpacePointsByChisq is false, this means
69  // having a single collection with color inherited from the prong
70  // (specified by the argument color).
71 
72  std::map<int, std::vector<const recob::SpacePoint*> > spmap; // Indexed by color.
73  int spcolor = color;
74 
75  for(auto &pspt : spts) {
76  //std::cout<<pspt<<std::endl;
77  //if(pspt == 0) throw cet::exception("RecoBaseDrawer:DrawSpacePoint3D") << "space point is null\n";
78 
79  // For rainbow effect, choose root colors in range [51,100].
80  // We are using 100=best (red), 51=worst (blue).
81 
82  // if (pspt->Chisq() > -100.) continue;
83 
84  spcolor = 12;
85 
86  if (pspt->Chisq() < -100.) spcolor = 16;
87 
88  if(recoOpt->fColorSpacePointsByChisq)
89  {
90  spcolor = 100 - 2.5 * pspt->Chisq();
91 
92  if(spcolor < 51) spcolor = 51;
93  if(spcolor > 100) spcolor = 100;
94  }
95  else spcolor = color;
96  //if (pspt->Chisq() < -1.) spcolor += 6;
97 
98  spmap[spcolor].push_back(&*pspt);
99  }
100 
101  // Loop over colors.
102  // Note that larger (=better) space points are plotted on
103  // top for optimal visibility.
104 
105  for(auto const icolor : spmap)
106  {
107  int spcolor = icolor.first;
108  const std::vector<const recob::SpacePoint*>& psps = icolor.second;
109 
110  // Make and fill a polymarker.
111 
112  TPolyMarker3D& pm = view->AddPolyMarker3D(psps.size(), spcolor, marker, size);
113 
114  for(size_t s = 0; s < psps.size(); ++s)
115  {
116  const recob::SpacePoint& spt = *psps[s];
117 
118  const double *xyz = spt.XYZ();
119  pm.SetPoint(s, xyz[0], xyz[1], xyz[2]);
120  }
121  }
122 
123  return;
124 }
125 
126 DEFINE_ART_CLASS_TOOL(SpacePoint3DDrawerStandard)
127 }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
void Draw(const std::vector< art::Ptr< recob::SpacePoint >> &, evdb::View3D *, int, int, float, const art::FindManyP< recob::Hit > *) const
const Double32_t * XYZ() const
Definition: SpacePoint.h:76
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60