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