LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
ems::ShowersCollection Class Reference

Public Member Functions

 ShowersCollection (ShowerInfo const &part)
 
double MinAngle (ShowersCollection const &col2)
 
void Merge (ShowersCollection const &col2)
 
void Merge (ShowerInfo const &src)
 
double Angle (TVector3 p0, TVector3 test)
 
double Angle (TVector3 test)
 
size_t Size ()
 
std::vector< ShowerInfo > const & GetParts (void) const
 
bool IsClean ()
 
int PlaneId ()
 
TVector3 Front ()
 
TVector3 Dir ()
 
std::vector< double > DeDx (void)
 
std::vector< double > TotEn (void)
 

Public Attributes

ShowerInfo first
 

Private Attributes

bool Clean
 
int GId
 
std::vector< ShowerInfofParts
 

Detailed Description

Definition at line 182 of file MergeEMShower3D_module.cc.

Constructor & Destructor Documentation

ems::ShowersCollection::ShowersCollection ( ShowerInfo const &  part)

Definition at line 215 of file MergeEMShower3D_module.cc.

References Clean, fParts, ems::ShowerInfo::GetGid(), and GId.

215  :
216 first(part)
217 {
218  Clean = true;
219  GId = part.GetGid();
220  if (GId == 9999)
221  Clean = false;
222 
223  fParts.push_back(part);
224 }
TString part[npart]
Definition: Style.C:32
std::vector< ShowerInfo > fParts

Member Function Documentation

double ems::ShowersCollection::Angle ( TVector3  p0,
TVector3  test 
)

Definition at line 270 of file MergeEMShower3D_module.cc.

References Front(), and fhicl::has_insertion_operator_impl::test().

271 {
272  p0 = Front() - p0;
273  p0 *= 1.0 / p0.Mag();
274  test -= Front();
275  test *= 1.0 / test.Mag();
276  double c = p0 * test;
277  if (c > 1.0) c = 1.0;
278  return 180.0 * acos(c) / TMath::Pi();
279 }
double ems::ShowersCollection::Angle ( TVector3  test)

Definition at line 281 of file MergeEMShower3D_module.cc.

References Dir(), Front(), and fhicl::has_insertion_operator_impl::test().

282 {
283  test -= Front();
284  test *= 1.0 / test.Mag();
285  double c = Dir() * test;
286  if (c > 1.0) c = 1.0;
287  return 180.0 * acos(c) / TMath::Pi();
288 }
std::vector< double > ems::ShowersCollection::DeDx ( void  )

Definition at line 244 of file MergeEMShower3D_module.cc.

References fParts.

245 {
246  if (fParts.size()) return fParts.front().GetDedx();
247  else return std::vector<double>(0.0);
248 }
std::vector< ShowerInfo > fParts
TVector3 ems::ShowersCollection::Dir ( )

Definition at line 238 of file MergeEMShower3D_module.cc.

References fParts.

Referenced by Angle().

239 {
240  if (fParts.size()) return fParts.front().GetDir();
241  else return TVector3(0, 0, 0);
242 }
std::vector< ShowerInfo > fParts
TVector3 ems::ShowersCollection::Front ( )

Definition at line 232 of file MergeEMShower3D_module.cc.

References fParts.

Referenced by Angle().

233 {
234  if (fParts.size()) return fParts.front().GetFront();
235  else return TVector3(0, 0, 0);
236 }
std::vector< ShowerInfo > fParts
std::vector< ShowerInfo > const& ems::ShowersCollection::GetParts ( void  ) const
inline

Definition at line 197 of file MergeEMShower3D_module.cc.

197 { return fParts; }
std::vector< ShowerInfo > fParts
bool ems::ShowersCollection::IsClean ( )
inline

Definition at line 199 of file MergeEMShower3D_module.cc.

void ems::ShowersCollection::Merge ( ShowersCollection const &  col2)

Definition at line 303 of file MergeEMShower3D_module.cc.

References Clean, and fParts.

304 {
305  for (size_t i = 0; i < col2.fParts.size(); ++i)
306  for (size_t j = 0; j < fParts.size(); ++j)
307  if (fParts[j].GetGid() != col2.fParts[i].GetGid())
308  {
309  Clean = false;
310  break;
311  }
312 
313  for (size_t i = 0; i < col2.fParts.size(); ++i)
314  fParts.push_back(col2.fParts[i]);
315 
316 }
std::vector< ShowerInfo > fParts
void ems::ShowersCollection::Merge ( ShowerInfo const &  src)

Definition at line 318 of file MergeEMShower3D_module.cc.

References Clean, fParts, ems::ShowerInfo::GetGid(), and GId.

319 {
320  if (fParts.size())
321  {
322  for (auto const & p : fParts)
323  if (p.GetGid() != src.GetGid())
324  {
325  Clean = false;
326  break;
327  }
328  }
329  else
330  {
331  Clean = true;
332  GId = src.GetGid();
333  }
334  fParts.push_back(src);
335 }
std::vector< ShowerInfo > fParts
double ems::ShowersCollection::MinAngle ( ShowersCollection const &  col2)

Definition at line 291 of file MergeEMShower3D_module.cc.

References first, fParts, and ems::ShowerInfo::Pointsto().

292 {
293  double a, a_min = 360.0;
294  for (size_t i = 0; i < fParts.size(); ++i)
295  {
296  const ShowerInfo& temp = fParts[i];
297  a = col2.first.Pointsto(temp);
298  if (a < a_min) a_min = a;
299  }
300  return a_min;
301 }
std::vector< ShowerInfo > fParts
int ems::ShowersCollection::PlaneId ( )

Definition at line 226 of file MergeEMShower3D_module.cc.

References fParts.

227 {
228  if (fParts.size()) return fParts.front().GetPlaneId();
229  else return 0;
230 }
std::vector< ShowerInfo > fParts
size_t ems::ShowersCollection::Size ( )
inline

Definition at line 195 of file MergeEMShower3D_module.cc.

195 {return fParts.size();}
std::vector< ShowerInfo > fParts
std::vector< double > ems::ShowersCollection::TotEn ( void  )

Definition at line 250 of file MergeEMShower3D_module.cc.

References fParts.

251 {
252  std::vector<double> en;
253 
254  double enkU = 0.0; double enkV = 0.0; double enkZ = 0.0;
255  for (size_t i = 0; i < fParts.size(); ++i)
256  {
257  std::vector<double> showeren = fParts[i].GetEnTot();
258  enkU += showeren[0];
259  enkV += showeren[1];
260  enkZ += showeren[2];
261  }
262 
263  en.push_back(enkU);
264  en.push_back(enkV);
265  en.push_back(enkZ);
266 
267  return en;
268 }
std::vector< ShowerInfo > fParts

Member Data Documentation

bool ems::ShowersCollection::Clean
private

Definition at line 210 of file MergeEMShower3D_module.cc.

Referenced by Merge(), and ShowersCollection().

ShowerInfo ems::ShowersCollection::first

Definition at line 207 of file MergeEMShower3D_module.cc.

Referenced by MinAngle().

std::vector< ShowerInfo > ems::ShowersCollection::fParts
private
int ems::ShowersCollection::GId
private

Definition at line 211 of file MergeEMShower3D_module.cc.

Referenced by Merge(), and ShowersCollection().


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