16 #include "TPrincipal.h" 34 const art::FindManyP<recob::Hit>& fmh,
35 TVector3& ShowerCentre);
82 const art::FindManyP<recob::Hit>& fmh =
85 std::vector<art::Ptr<recob::SpacePoint>> trackSpacePoints;
95 auto const clockData =
101 TVector3 trackCentre;
102 TVector3 Eigenvector =
ShowerPCAVector(clockData, detProp, trackSpacePoints, fmh, trackCentre);
105 TVector3 StartPositionVec = {-999, -999, -999};
107 TVector3 GeneralDir = (trackCentre - StartPositionVec).Unit();
110 double DotProduct = Eigenvector.Dot(GeneralDir);
113 if (DotProduct < 0) {
114 Eigenvector[0] = -Eigenvector[0];
115 Eigenvector[1] = -Eigenvector[1];
116 Eigenvector[2] = -Eigenvector[2];
119 TVector3 EigenvectorErr = {-999, -999, -999};
131 const art::FindManyP<recob::Hit>& fmh,
132 TVector3& ShowerCentre)
136 TPrincipal* pca =
new TPrincipal(3,
"");
138 float TotalCharge = 0;
145 for (
auto& sp : sps) {
152 sp_position = sp_position - ShowerCentre;
166 wht *= std::sqrt(Charge / TotalCharge);
170 sp_coord[0] = sp_position.X() * wht;
171 sp_coord[1] = sp_position.Y() * wht;
172 sp_coord[2] = sp_position.Z() * wht;
175 pca->AddRow(sp_coord);
179 pca->MakePrincipals();
182 const TMatrixD* Eigenvectors = pca->GetEigenVectors();
184 TVector3 Eigenvector = {(*Eigenvectors)[0][0], (*Eigenvectors)[1][0], (*Eigenvectors)[2][0]};
void SetElement(T &dataproduct, const std::string &Name, bool checktag=false)
double ElectronLifetime() const
const art::FindManyP< T1 > & GetFindManyP(const art::ValidHandle< std::vector< T2 > > &handle, const art::Event &evt, const art::InputTag &moduleTag)
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
double SpacePointTime(art::Ptr< recob::SpacePoint > const &sp, art::FindManyP< recob::Hit > const &fmh) const
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
bool CheckElement(const std::string &Name) const
int GetElement(const std::string &Name, T &Element) const
double SpacePointCharge(art::Ptr< recob::SpacePoint > const &sp, art::FindManyP< recob::Hit > const &fmh) const
Contains all timing reference information for the detector.
TVector3 ShowerCentre(std::vector< art::Ptr< recob::SpacePoint >> const &showersps) const
2D representation of charge deposited in the TDC/wire plane
auto const & get(AssnsNode< L, R, D > const &r)
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
QTextStream & endl(QTextStream &s)
TVector3 SpacePointPosition(art::Ptr< recob::SpacePoint > const &sp) const