All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Private Attributes | List of all members
lightana::FlashGeoBarycenter Class Reference
Inheritance diagram for lightana::FlashGeoBarycenter:
lightana::FlashGeoBase

Classes

struct  Config
 

Public Member Functions

 FlashGeoBarycenter (art::ToolConfigTable< Config > const &config)
 
void GetFlashLocation (std::vector< double > pePerOpChannel, double &Ycenter, double &Zcenter, double &Ywidth, double &Zwidth) override
 

Private Attributes

unsigned int fWeightExp
 

Additional Inherited Members

- Private Member Functions inherited from lightana::FlashGeoBase
virtual ~FlashGeoBase () noexcept=default
 

Detailed Description

Definition at line 20 of file FlashGeoBarycenter_tool.cc.

Constructor & Destructor Documentation

lightana::FlashGeoBarycenter::FlashGeoBarycenter ( art::ToolConfigTable< Config > const &  config)
explicit

Definition at line 51 of file FlashGeoBarycenter_tool.cc.

52  : fWeightExp{ config().WeightExp() }
53  {
54  }

Member Function Documentation

void lightana::FlashGeoBarycenter::GetFlashLocation ( std::vector< double >  pePerOpChannel,
double &  Ycenter,
double &  Zcenter,
double &  Ywidth,
double &  Zwidth 
)
overridevirtual

Implements lightana::FlashGeoBase.

Definition at line 57 of file FlashGeoBarycenter_tool.cc.

60  {
61 
62  // Reset variables
63  Ycenter = Zcenter = 0.;
64  Ywidth = Zwidth = -999.;
65  double totalPE = 0.;
66  double sumy = 0., sumz = 0., sumy2 = 0., sumz2 = 0.;
67  double weight =1.;
68  for (unsigned int opch = 0; opch < pePerOpChannel.size(); opch++) {
69  // Get physical detector location for this opChannel
70  double PMTxyz[3];
72 
73  // Get weight for this channel
74  if(fWeightExp==1) weight = pePerOpChannel[opch];
75  else if(fWeightExp==2) weight = pePerOpChannel[opch]*pePerOpChannel[opch];
76  else weight = std::pow(pePerOpChannel[opch], fWeightExp);
77 
78  // Add up the position, weighting with PEs
79  sumy += weight*PMTxyz[1];
80  sumy2 += weight*PMTxyz[1]*PMTxyz[1];
81  sumz += weight*PMTxyz[2];
82  sumz2 += weight*PMTxyz[2]*PMTxyz[2];
83  totalPE += weight;
84  }
85 
86  Ycenter = sumy/totalPE;
87  Zcenter = sumz/totalPE;
88 
89  // This is just sqrt(<x^2> - <x>^2)
90  if ( (sumy2*totalPE - sumy*sumy) > 0. )
91  Ywidth = std::sqrt(sumy2*totalPE - sumy*sumy)/totalPE;
92 
93  if ( (sumz2*totalPE - sumz*sumz) > 0. )
94  Zwidth = std::sqrt(sumz2*totalPE - sumz*sumz)/totalPE;
95  }

Member Data Documentation

unsigned int lightana::FlashGeoBarycenter::fWeightExp
private

Definition at line 46 of file FlashGeoBarycenter_tool.cc.


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