All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
flashmatch::LightPath Class Reference

#include <LightPath.h>

Inheritance diagram for flashmatch::LightPath:
flashmatch::BaseAlgorithm flashmatch::LoggerFeature

Public Member Functions

 LightPath (const std::string name="LightPath")
 Default constructor. More...
 
 ~LightPath ()
 Default destructor. More...
 
double Set_Gap (double x)
 
flashmatch::QCluster_t MakeQCluster (const ::geoalgo::Trajectory &trj) const
 
void MakeQCluster (const ::geoalgo::Vector &pt_1, const ::geoalgo::Vector &pt_2, flashmatch::QCluster_t &Q_cluster, double dedx=-1) const
 
double GetLightYield () const
 
- Public Member Functions inherited from flashmatch::BaseAlgorithm
 BaseAlgorithm (const Algorithm_t type, const std::string name)
 Default constructor. More...
 
 ~BaseAlgorithm ()
 Default destructor. More...
 
void Configure (const Config_t &pset)
 Function to accept configuration. More...
 
Algorithm_t AlgorithmType () const
 Algorithm type. More...
 
const std::string & AlgorithmName () const
 Algorithm name. More...
 
- Public Member Functions inherited from flashmatch::LoggerFeature
 LoggerFeature (const std::string logger_name="LoggerFeature")
 Default constructor. More...
 
 LoggerFeature (const LoggerFeature &original)
 Default copy constructor. More...
 
virtual ~LoggerFeature ()
 Default destructor. More...
 
const flashmatch::loggerlogger () const
 Logger getter. More...
 
void set_verbosity (::flashmatch::msg::Level_t level)
 Verbosity level. More...
 
const std::string & name () const
 Name getter, defined in a logger instance attribute. More...
 

Protected Member Functions

void _Configure_ (const Config_t &pset)
 

Protected Attributes

double _gap
 
double _light_yield
 
double _dEdxMIP
 

Detailed Description

User defined class LightPath ... these comments are used to generate doxygen documentation!

Definition at line 45 of file LightPath.h.

Constructor & Destructor Documentation

flashmatch::LightPath::LightPath ( const std::string  name = "LightPath")

Default constructor.

Definition at line 10 of file LightPath.cxx.

12  , _gap ( 0.5 )
13  , _light_yield ( 40000. )
14  , _dEdxMIP ( 2.07 ) //1.42[Mev*cm^2*g]*1.4[g/cm^3]=2.004MeV/cm
15  {}
BaseAlgorithm(const Algorithm_t type, const std::string name)
Default constructor.
Algorithm type that does not play a role in the framework execution but inherits from BaseAlgorithm...
const std::string & name() const
Name getter, defined in a logger instance attribute.
Definition: LoggerFeature.h:51
flashmatch::LightPath::~LightPath ( )
inline

Default destructor.

Definition at line 53 of file LightPath.h.

53 {}

Member Function Documentation

void flashmatch::LightPath::_Configure_ ( const Config_t pset)
protectedvirtual

Implements flashmatch::BaseAlgorithm.

Definition at line 17 of file LightPath.cxx.

18  {
19  _gap = pset.get< double > ( "SegmentSize" );
20  _light_yield = pset.get< double > ( "LightYield" );
21  _dEdxMIP = pset.get< double > ( "MIPdEdx" );
22  }
double flashmatch::LightPath::GetLightYield ( ) const
inline

Definition at line 67 of file LightPath.h.

67 { return _light_yield; }
QCluster_t flashmatch::LightPath::MakeQCluster ( const ::geoalgo::Trajectory trj) const

Definition at line 76 of file LightPath.cxx.

76  {
77 
78  QCluster_t result;
79  result.clear();
80 
81  for (size_t i = 0; i < trj.size() - 1; i++) {
82  auto const& this_loc(trj[i]);
83  auto const& last_loc(trj[i + 1]);
84  LightPath::MakeQCluster(this_loc, last_loc, result);
85  }
86 
87  // Trimming Q_cluster
88  auto const& bbox = DetectorSpecs::GetME().ActiveVolume();
89  double _vol_xmax = bbox.Max()[0];
90  double _vol_ymax = bbox.Max()[1];
91  double _vol_zmax = bbox.Max()[2];
92 
93  double _vol_xmin = bbox.Min()[0];
94  double _vol_ymin = bbox.Min()[1];
95  double _vol_zmin = bbox.Min()[2];
96  FLASH_INFO() << result << std::endl;
97  QCluster_t final_result;
98  final_result.clear();
99  for (size_t idx = 0; idx < result.size(); ++idx) {
100  auto pt = result[idx];
101  if (pt.x >= _vol_xmin && pt.x <= _vol_xmax && pt.y >= _vol_ymin && pt.y <= _vol_ymax && pt.z >= _vol_zmin && pt.z <= _vol_zmax) {
102  final_result.push_back(pt);
103  }
104  }
105  FLASH_INFO() << final_result << std::endl;
106 
107  return final_result;
108  }
const geoalgo::AABox & ActiveVolume() const
Detector active volume.
Definition: FMWKInterface.h:54
#define FLASH_INFO()
Compiler macro for INFO message.
static DetectorSpecs & GetME(std::string filename="detector_specs.cfg")
Definition: FMWKInterface.h:44
flashmatch::QCluster_t MakeQCluster(const ::geoalgo::Trajectory &trj) const
Definition: LightPath.cxx:76
const Point_t & Max() const
Maximum point getter.
void flashmatch::LightPath::MakeQCluster ( const ::geoalgo::Vector pt_1,
const ::geoalgo::Vector pt_2,
flashmatch::QCluster_t Q_cluster,
double  dedx = -1 
) const

Definition at line 24 of file LightPath.cxx.

27  {
28 
29  if(dedx < 0) dedx = _dEdxMIP;
30 
31  double dist = pt_1.Dist(pt_2);
32  QPoint_t q_pt;
33  FLASH_INFO() << "Filling points between (" << pt_1[0] << "," << pt_1[1] << "," << pt_1[2] << ")"
34  << " => (" << pt_2[0] << "," << pt_2[1] << "," << pt_2[2] << ") ... dist="<<dist<<std::endl;
35  if (dist <= _gap) {
36  ::geoalgo::Vector mid_pt((pt_1 + pt_2) / 2.);
37  q_pt.x = mid_pt[0];
38  q_pt.y = mid_pt[1];
39  q_pt.z = mid_pt[2];
40  q_pt.q = _light_yield * _dEdxMIP * dist;
41  FLASH_DEBUG() << "Smaller than gap threshold (" << _gap << ")" << std::endl
42  << "Traj pt (" << q_pt.x << "," << q_pt.y << "," << q_pt.z << ") q=" << q_pt.q << std::endl;
43  Q_cluster.emplace_back(q_pt);
44  return;
45  }
46 
47  int num_div = int(dist / _gap);
48 
49  ::geoalgo::Vector direct = (pt_1 - pt_2).Dir();
50 
51  Q_cluster.reserve(Q_cluster.size() + num_div);
52 
53  for (int div_index = 0; div_index < num_div + 1; div_index++) {
54  if (div_index < num_div) {
55  auto const mid_pt = pt_2 + direct * (_gap * div_index + _gap / 2.);
56  q_pt.x = mid_pt[0] ;
57  q_pt.y = mid_pt[1];
58  q_pt.z = mid_pt[2];
59  q_pt.q = _light_yield * _dEdxMIP * _gap;
60  FLASH_DEBUG() << "Traj pt (" << q_pt.x << "," << q_pt.y << "," << q_pt.z << ") q=" << q_pt.q << std::endl;
61  Q_cluster.emplace_back(q_pt);
62  }
63  else {
64  double weight = (dist - int(dist / _gap) * _gap);
65  auto const mid_pt = pt_2 + direct * (_gap * div_index + weight / 2.);
66  q_pt.x = mid_pt[0] ;
67  q_pt.y = mid_pt[1];
68  q_pt.z = mid_pt[2];
69  q_pt.q = _light_yield * _dEdxMIP * weight;
70  FLASH_DEBUG() << "Traj pt (" << q_pt.x << "," << q_pt.y << "," << q_pt.z << ") q=" << q_pt.q << std::endl;
71  Q_cluster.emplace_back(q_pt);
72  }//Last segment less than gap
73  }
74  }
#define FLASH_INFO()
Compiler macro for INFO message.
double Dist(const Vector &obj) const
Compute the distance to another vector.
#define FLASH_DEBUG()
Compiler macro for DEBUG message.
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
double flashmatch::LightPath::Set_Gap ( double  x)
inline

Definition at line 56 of file LightPath.h.

56 { _gap =x; return _gap;}
process_name opflash particleana ie x

Member Data Documentation

double flashmatch::LightPath::_dEdxMIP
protected

Definition at line 75 of file LightPath.h.

double flashmatch::LightPath::_gap
protected

Definition at line 73 of file LightPath.h.

double flashmatch::LightPath::_light_yield
protected

Definition at line 74 of file LightPath.h.


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