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