Neutral Particle Spectrometer analysis code
Loading...
Searching...
No Matches
THcNPSCluster.cxx
Go to the documentation of this file.
1#include "THcNPSCluster.h"
2#include <iostream>
3
4//______________________________________________________
6 fE(kBig),
7 fT(kBig),
8 fP(kBig),
9 fHasVertex(false)
10{
11 // Constructor
12
13 fSize = 0;
14
15 // Initialize momentum and vertex vectors
16 fPvect.SetXYZ(0., 0., 0.);
17 fVertex.SetXYZ(0., 0., 0.);
18 fCenterLab.SetXYZ(0., 0., 0.);
19}
20
21//______________________________________________________
23{
24 fCenter.SetXYZ(x, y, z);
25 fE = e;
26 fT = t;
27 fP = e; // assume photon
28
29 fPvect.SetXYZ(0., 0., 0.);
30 fVertex.SetXYZ(0., 0., 0.);
31 fCenterLab.SetXYZ(0., 0., 0.);
32 fHasVertex = false;
33}
34
35//______________________________________________________
37{
42 fHasVertex = false;
43 fE = fT = fP = kBig;
44 fBlocks.clear();
45 fSize = 0;
46
47}
48
49//______________________________________________________
51{
52 // Set vertex vector
54
55 // Rotate along y-axis, correct for vertex
56 Double_t x_lab = fCenter.X()*cos(angle) + fCenter.Z()*sin(angle) - fVertex.X();
57 Double_t y_lab = fCenter.Y() - fVertex.Y();
58 Double_t z_lab = -fCenter.X()*sin(angle) + fCenter.Z()*cos(angle) - fVertex.Z();
59
60 TVector3 rvect(x_lab, y_lab, z_lab);
61 Double_t th = rvect.Theta();
62 Double_t ph = rvect.Phi();
63
64 fCenterLab = rvect;
65 // TVector3: phi is polar angle and theta is azimuth
66 pvect.SetXYZ(fE * cos(ph) * sin(th),
67 fE * sin(ph) * sin(th),
68 fE * cos(th));
69
70 fPvect = pvect;
71}
72
73//______________________________________________________
75{
76 // Print contents of cluster, XYZ and E
77
78 std::cout << fCenter.X() << " " << fCenter.Y() << " " << fCenter.Z() << " " << fT << " " << fE << std::endl;
79
80}
81
const Data_t kBig
#define e(i)
double Double_t
const char Option_t
Option_t Option_t TPoint TPoint angle
ClassImp(VDC::AnalyticTTDConv) using namespace std
TVector3 fCenter
std::vector< Int_t > fBlocks
TVector3 fCenterLab
virtual void RotateToLab(Double_t angle, TVector3 &vertex, TVector3 &pvect)
virtual void Print(Option_t *opt="") const
TVector3 fPvect
TVector3 fVertex
virtual void Clear(Option_t *opt="")
Double_t Z() const
void SetXYZ(Double_t x, Double_t y, Double_t z)
Double_t Phi() const
Double_t Y() const
Double_t X() const
Double_t Theta() const
RVec< PromoteType< T > > cos(const RVec< T > &v)
RVec< PromoteType< T > > sin(const RVec< T > &v)
Double_t y[n]
Double_t x[n]
double * vertex