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

Public Member Functions

 SpacePoint3DDrawerHitCharge (const fhicl::ParameterSet &)
 
 ~SpacePoint3DDrawerHitCharge ()
 
void Draw (const std::vector< art::Ptr< recob::SpacePoint >> &, evdb::View3D *, int, int, float, const art::FindManyP< recob::Hit > *) const
 

Private Member Functions

double getSpacePointCharge (const art::Ptr< recob::SpacePoint > &, const art::FindManyP< recob::Hit > *) const
 
double chargeIntegral (double, double, double, double, int, int) const
 

Private Attributes

bool fUseAbsoluteScale
 
float fMinHitCharge
 
float fMaxHitCharge
 

Detailed Description

Definition at line 22 of file SpacePoint3DDrawerHitCharge_tool.cc.

Constructor & Destructor Documentation

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

Definition at line 48 of file SpacePoint3DDrawerHitCharge_tool.cc.

References fMaxHitCharge, fMinHitCharge, fUseAbsoluteScale, and fhicl::ParameterSet::get().

49  {
50  // fNumPoints = pset.get< int>("NumPoints", 1000);
51  // fFloatBaseline = pset.get<bool>("FloatBaseline", false);
52  // For now only draw cryostat=0.
53  fUseAbsoluteScale = pset.get<bool>("UseAbsoluteScale", false);
54  fMinHitCharge = pset.get<float>("MinHitCharge", 0.);
55  fMaxHitCharge = pset.get<float>("MaxHitCharge", 2500.);
56 
57  return;
58  }
T get(std::string const &key) const
Definition: ParameterSet.h:314
evdb_tool::SpacePoint3DDrawerHitCharge::~SpacePoint3DDrawerHitCharge ( )

Definition at line 60 of file SpacePoint3DDrawerHitCharge_tool.cc.

61  {
62  return;
63  }

Member Function Documentation

double evdb_tool::SpacePoint3DDrawerHitCharge::chargeIntegral ( double  peakMean,
double  peakAmp,
double  peakWidth,
double  areaNorm,
int  low,
int  hi 
) const
private

Definition at line 168 of file SpacePoint3DDrawerHitCharge_tool.cc.

References DEFINE_ART_CLASS_TOOL.

Referenced by getSpacePointCharge().

174  {
175  double integral(0);
176 
177  for (int sigPos = low; sigPos < hi; sigPos++)
178  integral += peakAmp * TMath::Gaus(double(sigPos) + 0.5, peakMean, peakWidth);
179 
180  return integral;
181  }
void evdb_tool::SpacePoint3DDrawerHitCharge::Draw ( const std::vector< art::Ptr< recob::SpacePoint >> &  hitsVec,
evdb::View3D view,
int  color,
int  marker,
float  size,
const art::FindManyP< recob::Hit > *  hitAssnVec 
) const
virtual

Implements evdb_tool::ISpacePoints3D.

Definition at line 65 of file SpacePoint3DDrawerHitCharge_tool.cc.

References evdb::View3D::AddPolyMarker3D(), evd::ColorDrawingOptions::CalQ(), fMaxHitCharge, fMinHitCharge, evd::ColorDrawingOptions::fRecoQHigh, evd::ColorDrawingOptions::fRecoQLow, fUseAbsoluteScale, evdb::ColorScale::GetColor(), getSpacePointCharge(), and geo::kCollection.

71  {
72  // Let's not crash
73  if (hitsVec.empty() || !hitAssnVec) return;
74 
75  // Get services.
77 
78  using HitPosition = std::array<double, 6>;
79  std::map<int, std::vector<HitPosition>> colorToHitMap;
80 
81  float minHitCharge(std::numeric_limits<float>::max());
82  float maxHitCharge(std::numeric_limits<float>::lowest());
83 
84  if (fUseAbsoluteScale) {
85  minHitCharge = fMinHitCharge;
86  maxHitCharge = fMaxHitCharge;
87  }
88  else
89  // Find the range in the input space point list
90  {
91  for (const auto& spacePoint : hitsVec) {
92  //float hitCharge = getSpacePointCharge(spacePoint, hitAssnVec);
93  float hitCharge = spacePoint->ErrXYZ()[1];
94 
95  minHitCharge = std::min(minHitCharge, hitCharge);
96  maxHitCharge = std::max(maxHitCharge, hitCharge);
97  }
98  }
99 
100  // Make sure we really have something here
101  if (maxHitCharge > minHitCharge) {
102  float hitChiSqScale((cst->fRecoQHigh[geo::kCollection] - cst->fRecoQLow[geo::kCollection]) /
103  (maxHitCharge - minHitCharge));
104 
105  for (const auto& spacePoint : hitsVec) {
106  float hitCharge = getSpacePointCharge(spacePoint, hitAssnVec);
107 
108  if (hitCharge > 0.) {
109  float chgFactor = cst->fRecoQLow[geo::kCollection] + hitChiSqScale * hitCharge;
110  int chargeColorIdx = cst->CalQ(geo::kCollection).GetColor(chgFactor);
111  const double* pos = spacePoint->XYZ();
112  const double* err = spacePoint->ErrXYZ();
113 
114  colorToHitMap[chargeColorIdx].push_back(
115  HitPosition() = {{pos[0], pos[1], pos[2], err[3], err[3], err[5]}});
116  }
117  }
118 
119  for (auto& hitPair : colorToHitMap) {
120  TPolyMarker3D& pm =
121  view->AddPolyMarker3D(hitPair.second.size(), hitPair.first, kFullDotLarge, 0.25);
122  for (const auto& hit : hitPair.second)
123  pm.SetNextPoint(hit[0], hit[1], hit[2]);
124  }
125  }
126 
127  return;
128  }
double getSpacePointCharge(const art::Ptr< recob::SpacePoint > &, const art::FindManyP< recob::Hit > *) const
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
const evdb::ColorScale & CalQ(geo::SigType_t st) const
Detector simulation of raw signals on wires.
TPolyMarker3D & AddPolyMarker3D(int n, int c, int st, double sz)
Definition: View3D.cxx:75
Signal from collection planes.
Definition: geo_types.h:152
double evdb_tool::SpacePoint3DDrawerHitCharge::getSpacePointCharge ( const art::Ptr< recob::SpacePoint > &  spacePoint,
const art::FindManyP< recob::Hit > *  hitAssnVec 
) const
private

Definition at line 130 of file SpacePoint3DDrawerHitCharge_tool.cc.

References chargeIntegral(), and art::Ptr< T >::key().

Referenced by Draw().

133  {
134  double totalCharge(0.);
135 
136  // Need to recover the integrated charge from the collection plane, so need to loop through associated hits
137  const std::vector<art::Ptr<recob::Hit>>& hit2DVec(hitAssnVec->at(spacePoint.key()));
138 
139  float hitCharge(0.);
140  int lowIndex(std::numeric_limits<int>::min());
141  int hiIndex(std::numeric_limits<int>::max());
142 
143  for (const auto& hit2D : hit2DVec) {
144  int hitStart = hit2D->PeakTime() - 2. * hit2D->RMS() - 0.5;
145  int hitStop = hit2D->PeakTime() + 2. * hit2D->RMS() + 0.5;
146 
147  lowIndex = std::max(hitStart, lowIndex);
148  hiIndex = std::min(hitStop + 1, hiIndex);
149 
150  hitCharge += hit2D->Integral();
151  }
152 
153  if (!hit2DVec.empty()) hitCharge /= float(hit2DVec.size());
154 
155  if (hitCharge > 0.) {
156  if (hiIndex > lowIndex) {
157  for (const auto& hit2D : hit2DVec)
158  totalCharge += chargeIntegral(
159  hit2D->PeakTime(), hit2D->PeakAmplitude(), hit2D->RMS(), 1., lowIndex, hiIndex);
160 
161  totalCharge /= float(hit2DVec.size());
162  }
163  }
164 
165  return totalCharge;
166  }
double chargeIntegral(double, double, double, double, int, int) const
key_type key() const noexcept
Definition: Ptr.h:166

Member Data Documentation

float evdb_tool::SpacePoint3DDrawerHitCharge::fMaxHitCharge
private

Definition at line 43 of file SpacePoint3DDrawerHitCharge_tool.cc.

Referenced by Draw(), and SpacePoint3DDrawerHitCharge().

float evdb_tool::SpacePoint3DDrawerHitCharge::fMinHitCharge
private

Definition at line 42 of file SpacePoint3DDrawerHitCharge_tool.cc.

Referenced by Draw(), and SpacePoint3DDrawerHitCharge().

bool evdb_tool::SpacePoint3DDrawerHitCharge::fUseAbsoluteScale
private

Definition at line 41 of file SpacePoint3DDrawerHitCharge_tool.cc.

Referenced by Draw(), and SpacePoint3DDrawerHitCharge().


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