FairShip
Loading...
Searching...
No Matches
splitcalCluster.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// SPDX-FileCopyrightText: Copyright CERN for the benefit of the SHiP
3// Collaboration
4
5#ifndef SPLITCAL_SPLITCALCLUSTER_H_
6#define SPLITCAL_SPLITCALCLUSTER_H_
7
8#include <TVector3.h>
9
10#include <array>
11#include <vector>
12
13#include "TObject.h" //
14#include "splitcalHit.h"
15
16class splitcalCluster : public TObject {
17 public:
20
22 virtual ~splitcalCluster();
23
25 virtual void Print() const;
26
27 void SetEtaPhiE(double& eta, double& phi, double& e) {
28 _eta = eta;
29 _phi = phi;
30 _energy = e;
31 }
32 void SetEta(double& eta) { _eta = eta; }
33 void SetPhi(double& phi) { _phi = phi; }
34 void SetEnergy(double& e) { _energy = e; }
35 void SetIndex(int i) { _index = i; }
36 void SetStartPoint(const double& x, const double& y, const double& z) {
37 _start[0] = x;
38 _start[1] = y;
39 _start[2] = z;
40 }
41 void SetEndPoint(const double& x, const double& y, const double& z) {
42 _end[0] = x;
43 _end[1] = y;
44 _end[2] = z;
45 }
46 void SetHitIndices(const std::vector<int>& v) { _hitIndices = v; }
47 void AddHit(int hitIndex, double weight = 1.0) {
48 _hitIndices.push_back(hitIndex);
49 _hitWeights.push_back(weight);
50 }
51
52 int GetIndex() { return _index; }
53 double GetEta() { return _eta; }
54 double GetPhi() { return _phi; }
55 double GetEnergy() { return _energy; }
56 double GetPx() { return _energy * sin(_eta) * cos(_phi); }
57 double GetPy() { return _energy * sin(_eta) * sin(_phi); }
58 double GetPz() { return _energy * cos(_eta); }
59 double GetEx() { return GetPx(); }
60 double GetEy() { return GetPy(); }
61 double GetEz() { return GetPz(); }
62 TVector3 GetStartPoint() const {
63 return TVector3(_start[0], _start[1], _start[2]);
64 }
65 TVector3 GetEndPoint() const { return TVector3(_end[0], _end[1], _end[2]); }
66 const std::vector<int>& GetHitIndices() const { return _hitIndices; }
67 const std::vector<double>& GetHitWeights() const { return _hitWeights; }
68
69 void ComputeEtaPhiE(const std::vector<splitcalHit>& hits);
70
72 splitcalCluster(const splitcalCluster& cluster) = default;
73 splitcalCluster& operator=(const splitcalCluster& cluster) = default;
74
75 private:
76 int _index;
77 double _eta, _phi, _energy;
78 std::array<double, 3> _start;
79 std::array<double, 3> _end;
80 std::vector<int> _hitIndices;
81 std::vector<double> _hitWeights;
82
84};
85
86#endif // SPLITCAL_SPLITCALCLUSTER_H_
void SetEnergy(double &e)
void SetStartPoint(const double &x, const double &y, const double &z)
const std::vector< double > & GetHitWeights() const
void ComputeEtaPhiE(const std::vector< splitcalHit > &hits)
void SetEndPoint(const double &x, const double &y, const double &z)
TVector3 GetStartPoint() const
std::array< double, 3 > _end
std::vector< double > _hitWeights
void AddHit(int hitIndex, double weight=1.0)
splitcalCluster(const splitcalCluster &cluster)=default
std::vector< int > _hitIndices
virtual void Print() const
void SetEtaPhiE(double &eta, double &phi, double &e)
virtual ~splitcalCluster()
splitcalCluster & operator=(const splitcalCluster &cluster)=default
void SetHitIndices(const std::vector< int > &v)
void SetIndex(int i)
ClassDef(splitcalCluster, 4)
std::array< double, 3 > _start
void SetEta(double &eta)
void SetPhi(double &phi)
TVector3 GetEndPoint() const
const std::vector< int > & GetHitIndices() const