LArSoft  v10_04_05
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 &)
 
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 26 of file OpHit3DDrawer_tool.cc.

Constructor & Destructor Documentation

evdb_tool::OpHit3DDrawer::OpHit3DDrawer ( const fhicl::ParameterSet )
inlineexplicit

Definition at line 28 of file OpHit3DDrawer_tool.cc.

References Draw(), and DrawRectangularBox().

28 {}

Member Function Documentation

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

Implements evdb_tool::I3DDrawer.

Definition at line 41 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, Get, geo::OpDetGeo::GetCenter(), evdb::ColorScale::GetColor(), geo::OpDetGeo::HalfH(), geo::OpDetGeo::HalfW(), art::Handle< T >::isValid(), and geo::kCollection.

Referenced by OpHit3DDrawer().

42  {
44 
45  if (recoOpt->fDrawOpHits == 0) return;
46 
47  // Service recovery
49 
51 
52  // This seems like a time waster but we want to get the full color scale for all OpHits... so loops away...
53  std::vector<float> opHitPEVec;
54 
55  // This is almost identically the same for loop we will re-excute below... sigh...
56  // But the idea is to get a min/max range for the drawing colors...
57  for (size_t idx = 0; idx < recoOpt->fOpHitLabels.size(); idx++) {
58  art::InputTag opHitProducer = recoOpt->fOpHitLabels[idx];
59 
60  event.getByLabel(opHitProducer, opHitHandle);
61 
62  if (!opHitHandle.isValid()) continue;
63  if (opHitHandle->size() == 0) continue;
64 
65  // Start the loop over flashes
66  for (const auto& opHit : *opHitHandle) {
67  // Make some selections...
68  if (opHit.PE() < recoOpt->fFlashMinPE) continue;
69  if (opHit.PeakTime() < recoOpt->fFlashTMin) continue;
70  if (opHit.PeakTime() > recoOpt->fFlashTMax) continue;
71 
72  opHitPEVec.push_back(opHit.PE());
73  }
74  }
75 
76  // Do we have any flashes and hits?
77  if (!opHitPEVec.empty()) {
78  // Sorting is good for mind and body...
79  std::sort(opHitPEVec.begin(), opHitPEVec.end());
80 
81  float minTotalPE = opHitPEVec.front();
82  float maxTotalPE = opHitPEVec[0.9 * opHitPEVec.size()];
83 
84  // Now we can set the scaling factor for PE
85  float opHitPEScale((cst->fRecoQHigh[geo::kCollection] - cst->fRecoQLow[geo::kCollection]) /
86  (maxTotalPE - minTotalPE));
87 
88  // We are meant to draw the flashes/hits, so loop over the list of input flashes
89  auto const& wireReadoutGeom = art::ServiceHandle<geo::WireReadout const>()->Get();
90  for (size_t idx = 0; idx < recoOpt->fOpHitLabels.size(); idx++) {
91  art::InputTag opHitProducer = recoOpt->fOpHitLabels[idx];
92 
93  event.getByLabel(opHitProducer, opHitHandle);
94 
95  if (!opHitHandle.isValid()) continue;
96  if (opHitHandle->size() == 0) continue;
97 
98  // Start the loop over flashes
99  for (const auto& opHit : *opHitHandle) {
100  // Make some selections...
101  if (opHit.PE() < recoOpt->fFlashMinPE) continue;
102  if (opHit.PeakTime() < recoOpt->fFlashTMin) continue;
103  if (opHit.PeakTime() > recoOpt->fFlashTMax) continue;
104 
105  unsigned int opChannel = opHit.OpChannel();
106  const geo::OpDetGeo& opHitGeo = wireReadoutGeom.OpDetGeoFromOpChannel(opChannel);
107  const geo::Point_t& opHitPos = opHitGeo.GetCenter();
108  float xWidth = opHit.Width();
109  float zWidth = opHitGeo.HalfW();
110  float yWidth = opHitGeo.HalfH();
111 
112  Eigen::Vector3f opHitLo(
113  opHitPos.X() - xWidth, opHitPos.Y() - yWidth, opHitPos.Z() - zWidth);
114  Eigen::Vector3f opHitHi(
115  opHitPos.X() + xWidth, opHitPos.Y() + yWidth, opHitPos.Z() + zWidth);
116 
117  float peFactor = cst->fRecoQLow[geo::kCollection] +
118  opHitPEScale * std::min(maxTotalPE, float(opHit.PE()));
119 
120  int chargeColorIdx = cst->CalQ(geo::kCollection).GetColor(peFactor);
121 
122  DrawRectangularBox(view, opHitLo, opHitHi, chargeColorIdx, 2, 1);
123  }
124  }
125  }
126  }
Point_t const & GetCenter() const
Definition: OpDetGeo.h:71
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
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:48
const evdb::ColorScale & CalQ(geo::SigType_t st) const
double fFlashMinPE
Minimal PE for a flash to be displayed.
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:56
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:148
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 128 of file OpHit3DDrawer_tool.cc.

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

Referenced by Draw(), and OpHit3DDrawer().

134  {
135  TPolyLine3D& top = view->AddPolyLine3D(5, color, width, style);
136  top.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
137  top.SetPoint(1, coordsHi[0], coordsHi[1], coordsLo[2]);
138  top.SetPoint(2, coordsHi[0], coordsHi[1], coordsHi[2]);
139  top.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
140  top.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
141 
142  TPolyLine3D& side = view->AddPolyLine3D(5, color, width, style);
143  side.SetPoint(0, coordsHi[0], coordsHi[1], coordsLo[2]);
144  side.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
145  side.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
146  side.SetPoint(3, coordsHi[0], coordsHi[1], coordsHi[2]);
147  side.SetPoint(4, coordsHi[0], coordsHi[1], coordsLo[2]);
148 
149  TPolyLine3D& side2 = view->AddPolyLine3D(5, color, width, style);
150  side2.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
151  side2.SetPoint(1, coordsLo[0], coordsLo[1], coordsLo[2]);
152  side2.SetPoint(2, coordsLo[0], coordsLo[1], coordsHi[2]);
153  side2.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
154  side2.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
155 
156  TPolyLine3D& bottom = view->AddPolyLine3D(5, color, width, style);
157  bottom.SetPoint(0, coordsLo[0], coordsLo[1], coordsLo[2]);
158  bottom.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
159  bottom.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
160  bottom.SetPoint(3, coordsLo[0], coordsLo[1], coordsHi[2]);
161  bottom.SetPoint(4, coordsLo[0], coordsLo[1], coordsLo[2]);
162  }
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: