Public Member Functions | Private Member Functions | List of all members
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
 
- Public Member Functions inherited from evdb_tool::I3DDrawer
virtual ~I3DDrawer () noexcept=default
 

Private Member Functions

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

Detailed Description

Definition at line 24 of file OpHit3DDrawer_tool.cc.

Constructor & Destructor Documentation

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

Definition at line 39 of file OpHit3DDrawer_tool.cc.

40 {
41  return;
42 }
evdb_tool::OpHit3DDrawer::~OpHit3DDrawer ( )

Definition at line 44 of file OpHit3DDrawer_tool.cc.

45 {
46 }

Member Function Documentation

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

Implements evdb_tool::I3DDrawer.

Definition at line 48 of file OpHit3DDrawer_tool.cc.

49 {
51 
52  if (recoOpt->fDrawOpHits == 0) return;
53 
54  // Service recovery
57 
59 
60  // This seems like a time waster but we want to get the full color scale for all OpHits... so loops away...
61  std::vector<float> opHitPEVec;
62 
63  // This is almost identically the same for loop we will re-excute below... sigh...
64  // But the idea is to get a min/max range for the drawing colors...
65  for(size_t idx = 0; idx < recoOpt->fOpHitLabels.size(); idx++)
66  {
67  art::InputTag opHitProducer = recoOpt->fOpHitLabels[idx];
68 
69  event.getByLabel(opHitProducer, opHitHandle);
70 
71  if (!opHitHandle.isValid() ) continue;
72  if ( opHitHandle->size() == 0) continue;
73 
74  // Start the loop over flashes
75  for(const auto& opHit : *opHitHandle)
76  {
77  // Make some selections...
78  if (opHit.PE() < recoOpt->fFlashMinPE) continue;
79  if (opHit.PeakTime() < recoOpt->fFlashTMin) continue;
80  if (opHit.PeakTime() > recoOpt->fFlashTMax) continue;
81 
82  opHitPEVec.push_back(opHit.PE());
83  }
84  }
85 
86  // Do we have any flashes and hits?
87  if (!opHitPEVec.empty())
88  {
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]) / (maxTotalPE - minTotalPE));
97 
98  // We are meant to draw the flashes/hits, so loop over the list of input flashes
99  for(size_t idx = 0; idx < recoOpt->fOpHitLabels.size(); idx++)
100  {
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  {
111  // Make some selections...
112  if (opHit.PE() < recoOpt->fFlashMinPE) continue;
113  if (opHit.PeakTime() < recoOpt->fFlashTMin) continue;
114  if (opHit.PeakTime() > recoOpt->fFlashTMax) continue;
115 
116  unsigned int opChannel = opHit.OpChannel();
117  const geo::OpDetGeo& opHitGeo = geo->OpDetGeoFromOpChannel(opChannel);
118  const geo::Point_t& opHitPos = opHitGeo.GetCenter();
119  float xWidth = opHit.Width();
120  float zWidth = opHitGeo.HalfW();
121  float yWidth = opHitGeo.HalfH();
122 
123  Eigen::Vector3f opHitLo(opHitPos.X() - xWidth, opHitPos.Y() - yWidth, opHitPos.Z() - zWidth);
124  Eigen::Vector3f opHitHi(opHitPos.X() + xWidth, opHitPos.Y() + yWidth, opHitPos.Z() + zWidth);
125 
126  float peFactor = cst->fRecoQLow[geo::kCollection] + opHitPEScale * std::min(maxTotalPE,float(opHit.PE()));
127 
128  int chargeColorIdx = cst->CalQ(geo::kCollection).GetColor(peFactor);
129 
130  DrawRectangularBox(view, opHitLo, opHitHi, chargeColorIdx, 2, 1);
131  }
132  }
133  }
134 
135  return;
136 }
void GetCenter(double *xyz, double localz=0.0) const
Definition: OpDetGeo.cxx:40
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:191
double HalfW() const
Definition: OpDetGeo.cxx:71
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:184
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
double HalfH() const
Definition: OpDetGeo.cxx:79
LArSoft geometry interface.
Definition: ChannelGeo.h:16
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:146
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 138 of file OpHit3DDrawer_tool.cc.

139 {
140  TPolyLine3D& top = view->AddPolyLine3D(5, color, width, style);
141  top.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
142  top.SetPoint(1, coordsHi[0], coordsHi[1], coordsLo[2]);
143  top.SetPoint(2, coordsHi[0], coordsHi[1], coordsHi[2]);
144  top.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
145  top.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
146 
147  TPolyLine3D& side = view->AddPolyLine3D(5, color, width, style);
148  side.SetPoint(0, coordsHi[0], coordsHi[1], coordsLo[2]);
149  side.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
150  side.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
151  side.SetPoint(3, coordsHi[0], coordsHi[1], coordsHi[2]);
152  side.SetPoint(4, coordsHi[0], coordsHi[1], coordsLo[2]);
153 
154  TPolyLine3D& side2 = view->AddPolyLine3D(5, color, width, style);
155  side2.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
156  side2.SetPoint(1, coordsLo[0], coordsLo[1], coordsLo[2]);
157  side2.SetPoint(2, coordsLo[0], coordsLo[1], coordsHi[2]);
158  side2.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
159  side2.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
160 
161  TPolyLine3D& bottom = view->AddPolyLine3D(5, color, width, style);
162  bottom.SetPoint(0, coordsLo[0], coordsLo[1], coordsLo[2]);
163  bottom.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
164  bottom.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
165  bottom.SetPoint(3, coordsLo[0], coordsLo[1], coordsHi[2]);
166  bottom.SetPoint(4, coordsLo[0], coordsLo[1], coordsLo[2]);
167 
168  return;
169 }
std::size_t color(std::string const &procname)

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