All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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
 
- Public Member Functions inherited from evdb_tool::ISpacePoints3D
virtual ~ISpacePoints3D () noexcept=default
 

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 23 of file SpacePoint3DDrawerHitCharge_tool.cc.

Constructor & Destructor Documentation

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

Definition at line 50 of file SpacePoint3DDrawerHitCharge_tool.cc.

51 {
52 // fNumPoints = pset.get< int>("NumPoints", 1000);
53 // fFloatBaseline = pset.get<bool>("FloatBaseline", false);
54  // For now only draw cryostat=0.
55  fUseAbsoluteScale = pset.get<bool >("UseAbsoluteScale", false);
56  fMinHitCharge = pset.get<float>("MinHitCharge", 0.);
57  fMaxHitCharge = pset.get<float>("MaxHitCharge", 2500.);
58 
59  return;
60 }
evdb_tool::SpacePoint3DDrawerHitCharge::~SpacePoint3DDrawerHitCharge ( )

Definition at line 62 of file SpacePoint3DDrawerHitCharge_tool.cc.

63 {
64  return;
65 }

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 173 of file SpacePoint3DDrawerHitCharge_tool.cc.

179 {
180  double integral(0);
181 
182  for(int sigPos = low; sigPos < hi; sigPos++) integral += peakAmp * TMath::Gaus(double(sigPos)+0.5,peakMean,peakWidth);
183 
184  return integral;
185 }
standard_dbscan3dalg useful for diagnostics hits not in a line will not be clustered on on only for track like only for track like on on the smaller the less shower like tracks low
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 67 of file SpacePoint3DDrawerHitCharge_tool.cc.

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

Definition at line 134 of file SpacePoint3DDrawerHitCharge_tool.cc.

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

Member Data Documentation

float evdb_tool::SpacePoint3DDrawerHitCharge::fMaxHitCharge
private

Definition at line 45 of file SpacePoint3DDrawerHitCharge_tool.cc.

float evdb_tool::SpacePoint3DDrawerHitCharge::fMinHitCharge
private

Definition at line 44 of file SpacePoint3DDrawerHitCharge_tool.cc.

bool evdb_tool::SpacePoint3DDrawerHitCharge::fUseAbsoluteScale
private

Definition at line 43 of file SpacePoint3DDrawerHitCharge_tool.cc.


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