PandaRoot
PndGemCluster.h
Go to the documentation of this file.
1 //* $Id: */
2 
3 // -------------------------------------------------------------------------
4 // ----- PndGemCluster header file -----
5 // ----- Created 03/06/2013 by R.Karabowicz -----
6 // -------------------------------------------------------------------------
7 
18 #ifndef PNDGEMCLUSTER_H
19 #define PNDGEMCLUSTER_H 1
20 
21 #include <vector>
22 
23 #include "FairTimeStamp.h"
24 
25 #include "PndDetectorList.h"
26 
27 #include "TObject.h"
28 
29 class PndGemCluster : public FairTimeStamp {
30  friend std::ostream &operator<<(std::ostream &out, PndGemCluster &cluster)
31  {
32  out << "PndGemCluster in: " << cluster.GetDetectorId() << "( system = " << cluster.GetSystemId() << ", station = " << cluster.GetStationNr()
33  << ", sensor = " << cluster.GetSensorNr() << ", side = " << cluster.GetSide() << "), channelNr = " << cluster.GetChannelNr() << " < from " << cluster.GetClusterBeg()
34  << " to " << cluster.GetClusterEnd() << " > charge = " << cluster.GetCharge() << ", cor = " << cluster.GetCor() << ", timestamp " << cluster.GetTimeStamp()
35  << ", from Point(s) ";
36  std::vector<Int_t> indices = cluster.GetIndices();
37  for (unsigned int i = 0; i < indices.size(); i++) {
38  out << indices[i] << " ";
39  }
40  out << std::endl;
41 
42  return out;
43  }
44 
45  public:
47  PndGemCluster();
48 
56  PndGemCluster(Int_t iDetectorId, Double_t iChannel, Int_t bChannel, Int_t eChannel, std::vector<Int_t> index);
57  PndGemCluster(Int_t iDetectorId, Double_t iChannel, Int_t bChannel, Int_t eChannel, Double_t signal, Double_t time, std::vector<Int_t> index);
58 
60  virtual ~PndGemCluster();
61 
62  void SetCharge(Double_t iCharge) { fClusterCharge = iCharge; }
63  void SetCor(Double_t iCor) { fClusterCor = iCor; }
64 
65  void SetClusterBeg(Int_t bChan) { fClusterBeg = bChan; }
66  void SetClusterEnd(Int_t eChan) { fClusterEnd = eChan; }
67 
68  void AddCharge(Double_t iCharge) { fClusterCharge += iCharge; }
69 
71  Int_t GetDetectorId() const { return fDetectorId; }
72  Double_t GetChannelNr() const { return fChannelNr; }
73 
74  Int_t GetSystemId() const { return ((fDetectorId & (31 << 27)) >> 27); }
75  Int_t GetStationNr() const { return ((fDetectorId & (8191 << 8)) >> 8); }
76  Int_t GetSensorNr() const
77  { // sensor number within station
78  return ((fDetectorId & (3 << 6)) >> 6);
79  }
80  Int_t GetSide() const { return ((fDetectorId & (1 << 5)) >> 5); } // 0=front, 1=back
81 
82  Int_t GetClusterBeg() const { return fClusterBeg; }
83  Int_t GetClusterEnd() const { return fClusterEnd; }
84  Double_t GetCharge() const { return fClusterCharge; }
85  Double_t GetCor() const { return fClusterCor; }
86 
87  std::vector<Int_t> GetIndices() const
88  {
89  std::vector<Int_t> result;
90  std::set<FairLink> myLinks = GetLinks();
91  for (std::set<FairLink>::iterator it = myLinks.begin(); it != myLinks.end(); it++) {
92  result.push_back(it->GetIndex());
93  }
94  return result;
95  }
96  Int_t GetNIndices() { return GetNLinks(); }
97  Int_t GetIndex(int i = 0) const { return GetLink(i).GetIndex(); }
98 
99  void AddIndex(int index) { AddLink(FairLink("GEMDigi", index)); }
100  void AddIndex(std::vector<Int_t> index) { SetLinks(FairMultiLinkedData("GEMDigi", index)); }
101 
102  virtual bool equal(FairTimeStamp *data)
103  {
104  PndGemCluster *myCluster = dynamic_cast<PndGemCluster *>(data);
105  if (myCluster != nullptr) {
106  if (fDetectorId == myCluster->GetDetectorId())
107  return kTRUE;
108  }
109  return false;
110  }
111 
112  virtual bool operator<(const PndGemCluster &myCluster) const
113  {
114  if (fDetectorId < myCluster.GetDetectorId())
115  return true;
116  else if (fDetectorId > myCluster.GetDetectorId())
117  return false;
118  if (fChannelNr < myCluster.GetChannelNr())
119  return true;
120  else if (fChannelNr > myCluster.GetChannelNr())
121  return false;
122  return false;
123  }
124 
125  virtual bool operator>(const PndGemCluster &myCluster) const
126  {
127  if (fDetectorId > myCluster.GetDetectorId())
128  return true;
129  else if (fDetectorId < myCluster.GetDetectorId())
130  return false;
131  if (fChannelNr > myCluster.GetChannelNr())
132  return true;
133  else if (fChannelNr < myCluster.GetChannelNr())
134  return false;
135  return false;
136  }
137 
138  virtual bool operator==(const PndGemCluster &myCluster) const
139  {
140  if (fDetectorId == myCluster.GetDetectorId())
141  if (fChannelNr == myCluster.GetChannelNr())
142  return true;
143  return false;
144  }
145 
146  private:
147  Int_t fDetectorId; // detectorId * 256 + stationId * 16 + sensorId
148  Double_t fChannelNr; // channel number
149 
150  Int_t fClusterBeg;
151  Int_t fClusterEnd;
152 
153  Double_t fClusterCharge; // charge in the cluster
154  Double_t fClusterCor; // correlation between clusters
155 
156  ClassDef(PndGemCluster, 1);
157 };
158 
159 #endif
Int_t GetSensorNr() const
Definition: PndGemCluster.h:76
Int_t GetDetectorId() const
Definition: PndGemCluster.h:71
void SetCharge(Double_t iCharge)
Definition: PndGemCluster.h:62
virtual bool equal(FairTimeStamp *data)
Int_t GetClusterBeg() const
Definition: PndGemCluster.h:82
void AddIndex(std::vector< Int_t > index)
virtual bool operator>(const PndGemCluster &myCluster) const
unsigned int i
Definition: P4_F32vec4.h:21
Int_t GetSystemId() const
Definition: PndGemCluster.h:74
Int_t GetNIndices()
Definition: PndGemCluster.h:96
void SetClusterBeg(Int_t bChan)
Definition: PndGemCluster.h:65
Int_t GetIndex(int i=0) const
Definition: PndGemCluster.h:97
Int_t GetClusterEnd() const
Definition: PndGemCluster.h:83
Double_t GetCor() const
Definition: PndGemCluster.h:85
void AddIndex(int index)
Definition: PndGemCluster.h:99
std::vector< Int_t > GetIndices() const
Definition: PndGemCluster.h:87
Int_t GetStationNr() const
Definition: PndGemCluster.h:75
virtual ~PndGemCluster()
friend std::ostream & operator<<(std::ostream &out, PndGemCluster &cluster)
Definition: PndGemCluster.h:30
void SetCor(Double_t iCor)
Definition: PndGemCluster.h:63
void AddCharge(Double_t iCharge)
Definition: PndGemCluster.h:68
Double_t GetCharge() const
Definition: PndGemCluster.h:84
virtual bool operator==(const PndGemCluster &myCluster) const
Double_t GetChannelNr() const
Definition: PndGemCluster.h:72
Int_t GetSide() const
Definition: PndGemCluster.h:80
virtual bool operator<(const PndGemCluster &myCluster) const
void SetClusterEnd(Int_t eChan)
Definition: PndGemCluster.h:66