LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
evdb_tool::OpHit3DDrawer Class Reference
Inheritance diagram for evdb_tool::OpHit3DDrawer:
evdb_tool::I3DDrawer

Public Member Functions

 OpHit3DDrawer (const fhicl::ParameterSet &)
 
 ~OpHit3DDrawer ()
 
void Draw (const art::Event &, evdb::View3D *) const override
 

Private Member Functions

void DrawRectangularBox (evdb::View3D *, const Eigen::Vector3f &, const Eigen::Vector3f &, int, int, int) const
 

Detailed Description

Definition at line 25 of file OpHit3DDrawer_tool.cc.

Constructor & Destructor Documentation

evdb_tool::OpHit3DDrawer::OpHit3DDrawer ( const fhicl::ParameterSet pset)
explicit

Definition at line 44 of file OpHit3DDrawer_tool.cc.

45  {
46  return;
47  }
evdb_tool::OpHit3DDrawer::~OpHit3DDrawer ( )

Definition at line 49 of file OpHit3DDrawer_tool.cc.

49 {}

Member Function Documentation

void evdb_tool::OpHit3DDrawer::Draw ( const art::Event event,
evdb::View3D view 
) const
overridevirtual

Implements evdb_tool::I3DDrawer.

Definition at line 51 of file OpHit3DDrawer_tool.cc.

References evd::ColorDrawingOptions::CalQ(), DrawRectangularBox(), evd::RecoDrawingOptions::fDrawOpHits, evd::RecoDrawingOptions::fFlashMinPE, evd::RecoDrawingOptions::fFlashTMax, evd::RecoDrawingOptions::fFlashTMin, evd::RecoDrawingOptions::fOpHitLabels, evd::ColorDrawingOptions::fRecoQHigh, evd::ColorDrawingOptions::fRecoQLow, geo::OpDetGeo::GetCenter(), evdb::ColorScale::GetColor(), geo::OpDetGeo::HalfH(), geo::OpDetGeo::HalfW(), art::Handle< T >::isValid(), geo::kCollection, and geo::GeometryCore::OpDetGeoFromOpChannel().

52  {
54 
55  if (recoOpt->fDrawOpHits == 0) return;
56 
57  // Service recovery
60 
62 
63  // This seems like a time waster but we want to get the full color scale for all OpHits... so loops away...
64  std::vector<float> opHitPEVec;
65 
66  // This is almost identically the same for loop we will re-excute below... sigh...
67  // But the idea is to get a min/max range for the drawing colors...
68  for (size_t idx = 0; idx < recoOpt->fOpHitLabels.size(); idx++) {
69  art::InputTag opHitProducer = recoOpt->fOpHitLabels[idx];
70 
71  event.getByLabel(opHitProducer, opHitHandle);
72 
73  if (!opHitHandle.isValid()) continue;
74  if (opHitHandle->size() == 0) continue;
75 
76  // Start the loop over flashes
77  for (const auto& opHit : *opHitHandle) {
78  // Make some selections...
79  if (opHit.PE() < recoOpt->fFlashMinPE) continue;
80  if (opHit.PeakTime() < recoOpt->fFlashTMin) continue;
81  if (opHit.PeakTime() > recoOpt->fFlashTMax) continue;
82 
83  opHitPEVec.push_back(opHit.PE());
84  }
85  }
86 
87  // Do we have any flashes and hits?
88  if (!opHitPEVec.empty()) {
89  // Sorting is good for mind and body...
90  std::sort(opHitPEVec.begin(), opHitPEVec.end());
91 
92  float minTotalPE = opHitPEVec.front();
93  float maxTotalPE = opHitPEVec[0.9 * opHitPEVec.size()];
94 
95  // Now we can set the scaling factor for PE
96  float opHitPEScale((cst->fRecoQHigh[geo::kCollection] - cst->fRecoQLow[geo::kCollection]) /
97  (maxTotalPE - minTotalPE));
98 
99  // We are meant to draw the flashes/hits, so loop over the list of input flashes
100  for (size_t idx = 0; idx < recoOpt->fOpHitLabels.size(); idx++) {
101  art::InputTag opHitProducer = recoOpt->fOpHitLabels[idx];
102 
103  event.getByLabel(opHitProducer, opHitHandle);
104 
105  if (!opHitHandle.isValid()) continue;
106  if (opHitHandle->size() == 0) continue;
107 
108  // Start the loop over flashes
109  for (const auto& opHit : *opHitHandle) {
110  // Make some selections...
111  if (opHit.PE() < recoOpt->fFlashMinPE) continue;
112  if (opHit.PeakTime() < recoOpt->fFlashTMin) continue;
113  if (opHit.PeakTime() > recoOpt->fFlashTMax) continue;
114 
115  unsigned int opChannel = opHit.OpChannel();
116  const geo::OpDetGeo& opHitGeo = geo->OpDetGeoFromOpChannel(opChannel);
117  const geo::Point_t& opHitPos = opHitGeo.GetCenter();
118  float xWidth = opHit.Width();
119  float zWidth = opHitGeo.HalfW();
120  float yWidth = opHitGeo.HalfH();
121 
122  Eigen::Vector3f opHitLo(
123  opHitPos.X() - xWidth, opHitPos.Y() - yWidth, opHitPos.Z() - zWidth);
124  Eigen::Vector3f opHitHi(
125  opHitPos.X() + xWidth, opHitPos.Y() + yWidth, opHitPos.Z() + zWidth);
126 
127  float peFactor = cst->fRecoQLow[geo::kCollection] +
128  opHitPEScale * std::min(maxTotalPE, float(opHit.PE()));
129 
130  int chargeColorIdx = cst->CalQ(geo::kCollection).GetColor(peFactor);
131 
132  DrawRectangularBox(view, opHitLo, opHitHi, chargeColorIdx, 2, 1);
133  }
134  }
135  }
136 
137  return;
138  }
int GetColor(double x) const
Definition: ColorScale.cxx:126
double fFlashTMin
Minimal time for a flash to be displayed.
std::vector< double > fRecoQHigh
high edge of ADC values for drawing raw digits
double fFlashTMax
Maximum time for a flash to be displayed.
std::vector< double > fRecoQLow
low edge of ADC values for drawing raw digits
bool isValid() const noexcept
Definition: Handle.h:203
double HalfW() const
Definition: OpDetGeo.cxx:52
const evdb::ColorScale & CalQ(geo::SigType_t st) const
double fFlashMinPE
Minimal PE for a flash to be displayed.
geo::Point_t const & GetCenter() const
Definition: OpDetGeo.h:72
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:180
double HalfH() const
Definition: OpDetGeo.cxx:60
Namespace collecting geometry-related classes utilities.
OpDetGeo const & OpDetGeoFromOpChannel(unsigned int OpChannel) const
Returns the geo::OpDetGeo object for the given channel number.
std::vector< art::InputTag > fOpHitLabels
module labels that produced events
void DrawRectangularBox(evdb::View3D *, const Eigen::Vector3f &, const Eigen::Vector3f &, int, int, int) const
Signal from collection planes.
Definition: geo_types.h:152
void evdb_tool::OpHit3DDrawer::DrawRectangularBox ( evdb::View3D view,
const Eigen::Vector3f &  coordsLo,
const Eigen::Vector3f &  coordsHi,
int  color,
int  width,
int  style 
) const
private

Definition at line 140 of file OpHit3DDrawer_tool.cc.

References evdb::View3D::AddPolyLine3D(), and DEFINE_ART_CLASS_TOOL.

Referenced by Draw().

146  {
147  TPolyLine3D& top = view->AddPolyLine3D(5, color, width, style);
148  top.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
149  top.SetPoint(1, coordsHi[0], coordsHi[1], coordsLo[2]);
150  top.SetPoint(2, coordsHi[0], coordsHi[1], coordsHi[2]);
151  top.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
152  top.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
153 
154  TPolyLine3D& side = view->AddPolyLine3D(5, color, width, style);
155  side.SetPoint(0, coordsHi[0], coordsHi[1], coordsLo[2]);
156  side.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
157  side.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
158  side.SetPoint(3, coordsHi[0], coordsHi[1], coordsHi[2]);
159  side.SetPoint(4, coordsHi[0], coordsHi[1], coordsLo[2]);
160 
161  TPolyLine3D& side2 = view->AddPolyLine3D(5, color, width, style);
162  side2.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
163  side2.SetPoint(1, coordsLo[0], coordsLo[1], coordsLo[2]);
164  side2.SetPoint(2, coordsLo[0], coordsLo[1], coordsHi[2]);
165  side2.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
166  side2.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
167 
168  TPolyLine3D& bottom = view->AddPolyLine3D(5, color, width, style);
169  bottom.SetPoint(0, coordsLo[0], coordsLo[1], coordsLo[2]);
170  bottom.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
171  bottom.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
172  bottom.SetPoint(3, coordsLo[0], coordsLo[1], coordsHi[2]);
173  bottom.SetPoint(4, coordsLo[0], coordsLo[1], coordsLo[2]);
174 
175  return;
176  }
TPolyLine3D & AddPolyLine3D(int n, int c, int w, int s)
Definition: View3D.cxx:105
std::size_t color(std::string const &procname)

The documentation for this class was generated from the following file: