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

Constructor & Destructor Documentation

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

Definition at line 47 of file SpacePoint3DDrawerHitCharge_tool.cc.

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

Definition at line 59 of file SpacePoint3DDrawerHitCharge_tool.cc.

60 {
61  return;
62 }

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

176 {
177  double integral(0);
178 
179  for(int sigPos = low; sigPos < hi; sigPos++) integral += peakAmp * TMath::Gaus(double(sigPos)+0.5,peakMean,peakWidth);
180 
181  return integral;
182 }
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 64 of file SpacePoint3DDrawerHitCharge_tool.cc.

70 {
71  // Let's not crash
72  if (hitsVec.empty() || !hitAssnVec) return;
73 
74  // Get services.
76 
77  using HitPosition = std::array<double,6>;
78  std::map<int,std::vector<HitPosition>> colorToHitMap;
79 
80  float minHitCharge(std::numeric_limits<float>::max());
81  float maxHitCharge(std::numeric_limits<float>::lowest());
82 
84  {
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  {
93  //float hitCharge = getSpacePointCharge(spacePoint, hitAssnVec);
94  float hitCharge = spacePoint->ErrXYZ()[1];
95 
96  minHitCharge = std::min(minHitCharge, hitCharge);
97  maxHitCharge = std::max(maxHitCharge, hitCharge);
98  }
99  }
100 
101  // Make sure we really have something here
102  if (maxHitCharge > minHitCharge)
103  {
104  float hitChiSqScale((cst->fRecoQHigh[geo::kCollection] - cst->fRecoQLow[geo::kCollection]) / (maxHitCharge - minHitCharge));
105 
106  for(const auto& spacePoint : hitsVec)
107  {
108  float hitCharge = getSpacePointCharge(spacePoint, hitAssnVec);
109 
110  if (hitCharge > 0.)
111  {
112  float chgFactor = cst->fRecoQLow[geo::kCollection] + hitChiSqScale * hitCharge;
113  int chargeColorIdx = cst->CalQ(geo::kCollection).GetColor(chgFactor);
114  const double* pos = spacePoint->XYZ();
115  const double* err = spacePoint->ErrXYZ();
116 
117  colorToHitMap[chargeColorIdx].push_back(HitPosition()={{pos[0],pos[1],pos[2],err[3],err[3],err[5]}});
118  }
119  }
120 
121  for(auto& hitPair : colorToHitMap)
122  {
123  TPolyMarker3D& pm = view->AddPolyMarker3D(hitPair.second.size(), hitPair.first, kFullDotLarge, 0.25);
124  for (const auto& hit : hitPair.second) pm.SetNextPoint(hit[0],hit[1],hit[2]);
125  }
126  }
127 
128  return;
129 }
double getSpacePointCharge(const art::Ptr< recob::SpacePoint > &, const art::FindManyP< recob::Hit > *) const
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
static int max(int a, int b)
void err(const char *fmt,...)
Definition: message.cpp:226
Detector simulation of raw signals on wires.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
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 131 of file SpacePoint3DDrawerHitCharge_tool.cc.

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  {
145  int hitStart = hit2D->PeakTime() - 2. * hit2D->RMS() - 0.5;
146  int hitStop = hit2D->PeakTime() + 2. * hit2D->RMS() + 0.5;
147 
148  lowIndex = std::max(hitStart, lowIndex);
149  hiIndex = std::min(hitStop + 1, hiIndex);
150 
151  hitCharge += hit2D->Integral();
152  }
153 
154  if (!hit2DVec.empty()) hitCharge /= float(hit2DVec.size());
155 
156  if (hitCharge > 0.)
157  {
158  if (hiIndex > lowIndex)
159  {
160  for(const auto& hit2D : hit2DVec)
161  totalCharge += chargeIntegral(hit2D->PeakTime(),hit2D->PeakAmplitude(),hit2D->RMS(),1.,lowIndex,hiIndex);
162 
163  totalCharge /= float(hit2DVec.size());
164  }
165  }
166 
167  return totalCharge;
168 }
double chargeIntegral(double, double, double, double, int, int) const
key_type key() const noexcept
Definition: Ptr.h:216
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55

Member Data Documentation

float evdb_tool::SpacePoint3DDrawerHitCharge::fMaxHitCharge
private

Definition at line 42 of file SpacePoint3DDrawerHitCharge_tool.cc.

float evdb_tool::SpacePoint3DDrawerHitCharge::fMinHitCharge
private

Definition at line 41 of file SpacePoint3DDrawerHitCharge_tool.cc.

bool evdb_tool::SpacePoint3DDrawerHitCharge::fUseAbsoluteScale
private

Definition at line 40 of file SpacePoint3DDrawerHitCharge_tool.cc.


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