FairRoot/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 
8 
20 #ifndef PNDGEMCLUSTER_H
21 #define PNDGEMCLUSTER_H 1
22 
23 #include <vector>
24 
25 #include "FairTimeStamp.h"
26 
27 #include "PndDetectorList.h"
28 
29 #include "TObject.h"
30 
31 class PndGemCluster : public FairTimeStamp
32 {
34  out << "PndGemCluster in: " << cluster.GetDetectorId()
35  << "( system = " << cluster.GetSystemId()
36  << ", station = " << cluster.GetStationNr()
37  << ", sensor = " << cluster.GetSensorNr()
38  << ", side = " << cluster.GetSide()
39  << "), channelNr = " << cluster.GetChannelNr()
40  << " < from " << cluster.GetClusterBeg()
41  << " to " << cluster.GetClusterEnd()
42  << " > charge = " << cluster.GetCharge()
43  << ", cor = " << cluster.GetCor()
44  << ", timestamp "<< cluster.GetTimeStamp()
45  << ", from Point(s) ";
46  std::vector<Int_t>indices = cluster.GetIndices();
47  for (unsigned int i = 0; i < indices.size(); i++){
48  out << indices[i] << " ";
49  }
50  out << std::endl;
51 
52  return out;
53  }
54 
55  public:
56 
58  PndGemCluster();
59 
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 {
87  return ( ( fDetectorId & ( 31<<27) ) >> 27); }
88  Int_t GetStationNr() const {
89  return ( ( fDetectorId & (8191<< 8) ) >> 8 ); }
90  Int_t GetSensorNr() const { // sensor number within station
91  return ( ( fDetectorId & ( 3<< 6) ) >> 6 ); }
92  Int_t GetSide() const {
93  return ( ( fDetectorId & ( 1<< 5) ) >> 5 ); } // 0=front, 1=back
94 
95  Int_t GetClusterBeg() const { return fClusterBeg; }
96  Int_t GetClusterEnd() const { return fClusterEnd; }
97  Double_t GetCharge() const { return fClusterCharge; }
98  Double_t GetCor() const { return fClusterCor; }
99 
100  std::vector<Int_t> GetIndices() const {
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){
112  AddLink(FairLink("GEMDigi", index));
113  }
114  void AddIndex(std::vector<Int_t> index){
115  SetLinks(FairMultiLinkedData("GEMDigi", index));
116  }
117 
118  virtual bool equal(FairTimeStamp* data){
119  PndGemCluster* myCluster = dynamic_cast <PndGemCluster*> (data);
120  if (myCluster != 0){
121  if (fDetectorId == myCluster->GetDetectorId() )
122  return kTRUE;
123  }
124  return false;
125  }
126 
127  virtual bool operator<(const PndGemCluster& myCluster) const{
128  if (fDetectorId < myCluster.GetDetectorId()) return true; else if (fDetectorId > myCluster.GetDetectorId()) return false;
129  if (fChannelNr < myCluster.GetChannelNr ()) return true; else if (fChannelNr > myCluster.GetChannelNr ()) return false;
130  return false;
131  }
132 
133  virtual bool operator>(const PndGemCluster& myCluster) const{
134  if (fDetectorId > myCluster.GetDetectorId()) return true; else if (fDetectorId < myCluster.GetDetectorId()) return false;
135  if (fChannelNr > myCluster.GetChannelNr ()) return true; else if (fChannelNr < myCluster.GetChannelNr ()) return false;
136  return false;
137  }
138 
139  virtual bool operator==(const PndGemCluster& myCluster) const{
140  if (fDetectorId == myCluster.GetDetectorId())
141  if (fChannelNr == myCluster.GetChannelNr ())
142  return true;
143  return false;
144  }
145 
146  private:
147 
148  Int_t fDetectorId; // detectorId * 256 + stationId * 16 + sensorId
149  Double_t fChannelNr; // channel number
150 
151  Int_t fClusterBeg;
152  Int_t fClusterEnd;
153 
154  Double_t fClusterCharge; // charge in the cluster
155  Double_t fClusterCor; // correlation between clusters
156 
158 
159 };
160 
161 #endif
Double_t GetCor() const
Definition: PndGemCluster.h:98
Double_t GetChannelNr() const
Definition: PndGemCluster.h:84
Int_t GetSensorNr() const
Definition: PndGemCluster.h:90
Int_t GetClusterBeg() const
Definition: PndGemCluster.h:95
Double_t fClusterCharge
Int_t i
Definition: run_full.C:25
void SetCharge(Double_t iCharge)
Definition: PndGemCluster.h:74
virtual bool equal(FairTimeStamp *data)
Int_t GetSide() const
Definition: PndGemCluster.h:92
Double_t fChannelNr
void AddIndex(std::vector< Int_t > index)
Int_t GetNIndices()
virtual bool operator<(const PndGemCluster &myCluster) const
void SetClusterBeg(Int_t bChan)
Definition: PndGemCluster.h:77
Double_t
virtual ~PndGemCluster()
TFile * out
Definition: reco_muo.C:20
Double_t fClusterCor
Int_t GetClusterEnd() const
Definition: PndGemCluster.h:96
void AddIndex(int index)
friend std::ostream & operator<<(std::ostream &out, PndGemCluster &cluster)
Definition: PndGemCluster.h:33
void SetCor(Double_t iCor)
Definition: PndGemCluster.h:75
Int_t GetDetectorId() const
Definition: PndGemCluster.h:83
ClassDef(PndGemCluster, 1)
Int_t GetIndex(int i=0) const
void AddCharge(Double_t iCharge)
Definition: PndGemCluster.h:80
virtual bool operator==(const PndGemCluster &myCluster) const
std::vector< Int_t > GetIndices() const
Double_t GetCharge() const
Definition: PndGemCluster.h:97
Int_t GetStationNr() const
Definition: PndGemCluster.h:88
Int_t GetSystemId() const
Definition: PndGemCluster.h:86
virtual bool operator>(const PndGemCluster &myCluster) const
void SetClusterEnd(Int_t eChan)
Definition: PndGemCluster.h:78