PandaRoot
BSEmcCluster.h
Go to the documentation of this file.
1 //----------------------------------------------------------------------
2 // Software developed for the BaBar Detector at the SLAC B-Factory.
3 // Adapted for the PANDA experiment at GSI
4 //
5 // Author List:
6 // Xiaorong Shi Lawrence Livermore National Lab
7 // Steve Playfer University of Edinburgh
8 // Stephen Gowdy University of Edinburgh
9 //
10 //-----------------------------------------------------------------------
11 
12 #ifndef BSEMCCLUSTER_HH
13 #define BSEMCCLUSTER_HH
14 
15 #include <string> // for string
16 #include <vector>
17 
18 #include "Rtypes.h" // for BSEmcCluster::Class, BSEmcCluster::...
19 #include "RtypesCore.h" // for Double_t, Int_t, Bool_t, kFALSE
20 #include "TVector3.h" // for TVector3
21 
22 #include "FairMultiLinkedData.h" // for FairMultiLinkedData
23 #include "FairTimeStamp.h" // for FairTimeStamp
24 
25 #include "BSEmcDataBranchNames.h"
26 
27 class BSEmcDigi; // lines 24-24
28 class FairLink;
29 class TBuffer;
30 class TClass;
31 class TMemberInspector;
32 
40  Int_t fDigiIdx;
41  Int_t fDetectorId;
42  Double_t fWeight;
43  BSEmcDigiInfo_t(Int_t t_digiIdx = -1, Int_t t_detId = 0, Double_t t_weight = 1.0) : fDigiIdx(t_digiIdx), fDetectorId(t_detId), fWeight(t_weight) {}
44  Bool_t operator==(const BSEmcDigiInfo_t &t_other) { return fDigiIdx == t_other.fDigiIdx; }
45 };
46 
54 class BSEmcCluster : public FairTimeStamp {
55 
56  public:
57  // Constructors
58  BSEmcCluster();
59  BSEmcCluster(const BSEmcCluster &t_other);
60 
61  virtual void Print(const Option_t *t_opt = "") const;
62  // Destructor
63  virtual ~BSEmcCluster();
64 
65  Double_t GetEnergy() const;
66  TVector3 GetPosition() const;
67  Int_t GetNumberOfDigis() const { return fDigis.size(); }
68  Int_t NumberOfDigis() const;
69 
70  Int_t GetNumberOfSubCluster() const { return fNSubClusters; }
71 
72  // Modifiers
73  void SetNSubClusters(UInt_t nSubClusters);
74  void SetEnergy(Double_t t_energy)
75  {
76  fEnergy = t_energy;
77  fEnergyValid = kTRUE;
78  }
79  void SetPosition(const TVector3 &t_pos)
80  {
81  fWhere = t_pos;
82  fWhereValid = kTRUE;
83  }
84  void SetTrackEntering(const FairMultiLinkedData &t_tracks) { fTrackEntering = t_tracks; }
85  void SetTrackExiting(const FairMultiLinkedData &t_tracks) { fTrackExiting = t_tracks; }
86 
87  std::vector<Int_t> GetMcList(Int_t t_branchId) const;
88  FairMultiLinkedData GetTrackEntering() const { return fTrackEntering; }
89  FairMultiLinkedData GetTrackExiting() const { return fTrackExiting; }
90 
91  const std::vector<BSEmcDigiInfo_t> &GetDigis() const { return fDigis; }
92  const std::vector<BSEmcDigiInfo_t> &GetMaximaDigis() const { return fMaxima; }
93 
94  const BSEmcDigi *GetMaximumDigi(const std::vector<const BSEmcDigi *> &t_digis) const;
95  Double_t GetMaximumEnergy(const std::vector<const BSEmcDigi *> &t_digis) const;
96  BSEmcDigiInfo_t GetMaximumDigiInfo(const std::vector<const BSEmcDigi *> &t_digis) const;
97  Double_t CalculateTimeStamp(const std::vector<const BSEmcDigi *> &t_digis) const;
98 
99  void AddDigi(const BSEmcDigiInfo_t &t_digiInfo);
100  void AddDigi(Int_t t_arrayindex, Int_t t_detectorId, Double_t t_weight = 1);
101  void AddDigiLink(FairLink t_entrynr);
102  void RemoveDigi(Int_t t_arrayindex);
103  void AddCluster(const BSEmcCluster &t_cluster);
104  void AddMaximum(const BSEmcDigiInfo_t &t_maximum);
105  void AddMaximum(Int_t t_arrayindex, Int_t t_detectorid);
106  void RemoveMaximum(Int_t t_arrayindex);
107  void Clear()
108  {
109  fDigis.clear();
110  fMaxima.clear();
111  }
112 
113  void SetRadius(Double_t t_clusradius) { fRadius = t_clusradius; }
114  // Add single crystal radius to precluster radius, because distance to crystal centre is taken and not its size.
115  // If this correction is not implemented, preclusters consisting of a single crystal will get a radius of 0 and will
116  // never be merged to another cluster. Added multiplier n to allow the use of the diameter, or manually increase the
117  // radius of a cluster
118  void SetXRadius(Double_t t_xrad) { fXRadius = t_xrad; }
119  void SetYRadius(Double_t t_yrad) { fYRadius = t_yrad; }
120 
121  Double_t GetRadius() const { return fRadius; }
122  Double_t GetXRadius() const { return fXRadius; }
123  Double_t GetYRadius() const { return fYRadius; }
124 
125  protected:
126  void invalidateCache(Bool_t);
127 
128  protected:
129  std::vector<BSEmcDigiInfo_t> fDigis{};
130  std::vector<BSEmcDigiInfo_t> fMaxima{};
131 
132  Bool_t fEnergyValid{kFALSE};
133  Double_t fEnergy{-1};
134  Bool_t fWhereValid{kFALSE};
135  TVector3 fWhere{0, 0, 0};
136  UInt_t fNSubClusters{0};
137 
138  FairMultiLinkedData fTrackEntering{};
139  FairMultiLinkedData fTrackExiting{};
140 
141  Double_t fRadius{-1};
142  Double_t fXRadius{-1};
143  Double_t fYRadius{-1};
144  ClassDef(BSEmcCluster, 3)
145 };
146 
147 #endif /*BSEMCCLUSTER_HH*/
void SetEnergy(Double_t t_energy)
Definition: BSEmcCluster.h:74
Double_t GetRadius() const
Definition: BSEmcCluster.h:121
BSEmcDigiInfo_t(Int_t t_digiIdx=-1, Int_t t_detId=0, Double_t t_weight=1.0)
Definition: BSEmcCluster.h:43
FairMultiLinkedData GetTrackExiting() const
Definition: BSEmcCluster.h:89
void SetTrackExiting(const FairMultiLinkedData &t_tracks)
Definition: BSEmcCluster.h:85
const std::vector< BSEmcDigiInfo_t > & GetDigis() const
Definition: BSEmcCluster.h:91
void SetXRadius(Double_t t_xrad)
Definition: BSEmcCluster.h:118
Double_t GetYRadius() const
Definition: BSEmcCluster.h:123
const std::vector< BSEmcDigiInfo_t > & GetMaximaDigis() const
Definition: BSEmcCluster.h:92
FairMultiLinkedData GetTrackEntering() const
Definition: BSEmcCluster.h:88
void SetPosition(const TVector3 &t_pos)
Definition: BSEmcCluster.h:79
Double_t fWeight
Definition: BSEmcCluster.h:42
a cluster (group of neighboring crystals) of hit emc crystals
Definition: BSEmcCluster.h:54
void SetRadius(Double_t t_clusradius)
Definition: BSEmcCluster.h:113
Double_t GetXRadius() const
Definition: BSEmcCluster.h:122
Int_t GetNumberOfDigis() const
Definition: BSEmcCluster.h:67
void SetTrackEntering(const FairMultiLinkedData &t_tracks)
Definition: BSEmcCluster.h:84
represents the reconstructed hit of one emc crystal
Definition: BSEmcDigi.h:47
void SetYRadius(Double_t t_yrad)
Definition: BSEmcCluster.h:119
Bool_t operator==(const BSEmcDigiInfo_t &t_other)
Definition: BSEmcCluster.h:44
simple Struct used in Cluster classes to index crystal. Includes the weight of the crystal on the cur...
Definition: BSEmcCluster.h:39
Int_t GetNumberOfSubCluster() const
Definition: BSEmcCluster.h:70