REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestVolumeHits.h
1 
20 #ifndef RestCore_TRestVolumeHits
21 #define RestCore_TRestVolumeHits
22 
23 #include <TObject.h>
24 #include <TVector3.h>
25 
26 #include <iostream>
27 
28 #include "TRestHits.h"
29 
30 class TRestVolumeHits : public TRestHits {
31  protected:
32  std::vector<Float_t> fSigmaX; // [fNHits] Sigma on X axis for each volume hit (units microms)
33  std::vector<Float_t> fSigmaY; // [fNHits] Sigma on Y axis for each volume hit (units microms)
34  std::vector<Float_t> fSigmaZ; // [fNHits] Sigma on Z axis for each volume hit (units microms)
35 
36  public:
37  void AddHit(Double_t x, Double_t y, Double_t z, Double_t en, Double_t time, REST_HitType type,
38  Double_t sigmaX, Double_t sigmaY, Double_t sigmaZ);
39  void AddHit(const TVector3& pos, Double_t en, Double_t time, REST_HitType type, const TVector3& sigma);
40  void AddHit(const TRestVolumeHits& hits, Int_t n);
41 
42  void RemoveHits();
43  void MergeHits(Int_t n, Int_t m);
44 
45  void RemoveHit(int n);
46  void SortByEnergy();
47  void SwapHits(Int_t i, Int_t j);
48 
49  Bool_t areXY() const;
50  Bool_t areXZ() const;
51  Bool_t areYZ() const;
52  Bool_t areXYZ() const;
53 
54  // Setters
55 
56  // Getters
57  inline Double_t GetSigmaX(int n) const { return fSigmaX[n]; } // return value in mm
58  inline Double_t GetSigmaY(int n) const { return fSigmaY[n]; } // return value in mm
59  inline Double_t GetSigmaZ(int n) const { return fSigmaZ[n]; } // return value in mm
60 
61  TVector3 GetSigma(int n) const;
62 
63  void PrintHits() const;
64 
65  inline Double_t GetClusterSize(int n) const {
66  return TMath::Sqrt(fSigmaX[n] * fSigmaX[n] + fSigmaY[n] * fSigmaY[n] + fSigmaZ[n] * fSigmaZ[n]);
67  }
68  inline Double_t GetXYSize(int n) const {
69  return TMath::Sqrt(fSigmaX[n] * fSigmaX[n] + fSigmaY[n] * fSigmaY[n]);
70  }
71 
72  static void kMeansClustering(TRestVolumeHits* hits, TRestVolumeHits& vHits, int maxIt = 100);
73 
74  // Constructor & Destructor
76  ~TRestVolumeHits();
77 
78  ClassDef(TRestVolumeHits, 2);
79 };
80 #endif
It saves a 3-coordinate position and an energy for each punctual deposition.
Definition: TRestHits.h:39
Double_t GetSigmaX() const
It calculates the hits standard deviation in the X-coordinate.
Definition: TRestHits.cxx:685
Double_t GetSigmaY() const
It calculates the hits standard deviation in the Y-coordinate.
Definition: TRestHits.cxx:703
void RemoveHit(int n)
It removes the hit at position n from the list.
Bool_t areXZ() const
It will return true only if all the hits inside are of type XZ.
Bool_t areXYZ() const
It will return true only if all the hits inside are of type XYZ.
void SwapHits(Int_t i, Int_t j)
It exchanges hits n and m affecting to the ordering of the hits inside the list of hits.
Bool_t areYZ() const
It will return true only if all the hits inside are of type YZ.
Bool_t areXY() const
It will return true only if all the hits inside are of type XY.
void RemoveHits()
It removes all hits inside the class.