LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
SpacePoint3DDrawerAsymmetry_tool.cc
Go to the documentation of this file.
1 
9 
11 
15 
16 #include "TMath.h"
17 #include "TPolyMarker3D.h"
18 
19 namespace evdb_tool {
20 
22  public:
24 
26 
27  void Draw(const std::vector<art::Ptr<recob::SpacePoint>>&, // Space points
28  evdb::View3D*, // 3D display
29  int, // Color
30  int, // Marker
31  float, // Size) const override;
32  const art::FindManyP<recob::Hit>* // pointer to associated hits
33  ) const;
34 
35  private:
38  };
39 
40  //----------------------------------------------------------------------
41  // Constructor.
43  {
44  // fNumPoints = pset.get< int>("NumPoints", 1000);
45  // fFloatBaseline = pset.get<bool>("FloatBaseline", false);
46  // For now only draw cryostat=0.
47  fMinAsymmetry = pset.get<float>("MinAsymmetry", -1.);
48  fMaxAsymmetry = pset.get<float>("MaxAsymmetry", 1.);
49 
50  return;
51  }
52 
54  {
55  return;
56  }
57 
59  evdb::View3D* view,
60  int color,
61  int marker,
62  float size,
63  const art::FindManyP<recob::Hit>* hitAssnVec) const
64  {
65  // Let's not crash
66  if (hitsVec.empty() || !hitAssnVec) return;
67 
68  // Get services.
70 
71  using HitPosition = std::array<double, 6>;
72  std::map<int, std::vector<HitPosition>> colorToHitMap;
73 
74  // Get the scale factor
75  float asymmetryScale((cst->fRecoQHigh[geo::kCollection] - cst->fRecoQLow[geo::kCollection]) /
77 
78  for (const auto& spacePoint : hitsVec) {
79  float hitAsymmetry = spacePoint->ErrXYZ()[3] - fMinAsymmetry;
80 
81  if (std::abs(hitAsymmetry) <= fMaxAsymmetry - fMinAsymmetry) {
82  float chgFactor = cst->fRecoQLow[geo::kCollection] + asymmetryScale * hitAsymmetry;
83  int chargeColorIdx = cst->CalQ(geo::kCollection).GetColor(chgFactor);
84  const double* pos = spacePoint->XYZ();
85  const double* err = spacePoint->ErrXYZ();
86 
87  colorToHitMap[chargeColorIdx].push_back(
88  HitPosition() = {{pos[0], pos[1], pos[2], err[2], err[2], err[5]}});
89  }
90  }
91 
92  for (auto& hitPair : colorToHitMap) {
93  TPolyMarker3D& pm =
94  view->AddPolyMarker3D(hitPair.second.size(), hitPair.first, kFullDotLarge, 0.25);
95  for (const auto& hit : hitPair.second)
96  pm.SetNextPoint(hit[0], hit[1], hit[2]);
97  }
98 
99  return;
100  }
101 
103 }
#define DEFINE_ART_CLASS_TOOL(tool)
Definition: ToolMacros.h:42
constexpr auto abs(T v)
Returns the absolute value of the argument.
int GetColor(double x) const
Definition: ColorScale.cxx:126
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
The color scales used by the event display.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:289
T get(std::string const &key) const
Definition: ParameterSet.h:314
const evdb::ColorScale & CalQ(geo::SigType_t st) const
Detector simulation of raw signals on wires.
std::size_t color(std::string const &procname)
A collection of 3D drawable objects.
void Draw(const std::vector< art::Ptr< recob::SpacePoint >> &, evdb::View3D *, int, int, float, const art::FindManyP< recob::Hit > *) const
TPolyMarker3D & AddPolyMarker3D(int n, int c, int st, double sz)
Definition: View3D.cxx:75
Signal from collection planes.
Definition: geo_types.h:152