PandaRoot
PndGemSensor.h
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- PndGemSensor header file -----
3 // ----- Created 12/02/2009 by R. Karabowicz -----
4 // -------------------------------------------------------------------------
5 
29 #ifndef PNDGEMSENSOR_H
30 #define PNDGEMSENSOR_H 1
31 
32 #include "TNamed.h"
33 #include "PndDetectorList.h"
34 
35 #include <map>
36 #include <list>
37 #include <set>
38 #include <vector>
39 
40 class PndGemSensor : public TNamed {
41 
42  public:
44  PndGemSensor();
45 
60  PndGemSensor(TString tempName, Int_t detId, Int_t iType, Double_t x0, Double_t y0, Double_t z0, Double_t rotation, Double_t innerRad, Double_t outerRad, Double_t d,
61  Double_t stripAngle0, Double_t stripAngle1, Double_t pitch0, Double_t pitch1);
62  PndGemSensor(TString tempName, Int_t stationNr, Int_t sectorNr, Int_t iType, Double_t x0, Double_t y0, Double_t z0, Double_t rotation, Double_t innerRad, Double_t outerRad,
63  Double_t d, Double_t stripAngle0, Double_t stripAngle1, Double_t pitch0, Double_t pitch1);
64  PndGemSensor(const PndGemSensor &tempSensor);
65 
67  virtual ~PndGemSensor();
68 
70  TString GetDetectorName() const { return fName.Data(); }
71  void SetDetectorId(Int_t stationNr, Int_t sensorNr) { fDetectorId = static_cast<int>(DetectorId::kGEM) << 27 | 0 << 21 | stationNr << 8 | sensorNr << 6; }
72  Int_t GetDetectorId() const { return fDetectorId; }
73  Int_t GetSystemId() const { return ((fDetectorId & (31 << 27)) >> 27); }
74  Int_t GetStationNr() const { return ((fDetectorId & (8191 << 8)) >> 8); }
75  Int_t GetSensorNr() const
76  { // sensor number within station
77  return ((fDetectorId & (3 << 6)) >> 6);
78  }
79  Int_t GetType() const { return fType; }
80  Double_t GetX0() const { return fPosition[0]; }
81  Double_t GetY0() const { return fPosition[1]; }
82  Double_t GetZ0() const { return fPosition[2]; }
83  Double_t GetRotation() const { return fRotation; }
84  Double_t GetInnerRadius() const { return fInnerRadius; }
85  Double_t GetOuterRadius() const { return fOuterRadius; }
86  Double_t GetD() const { return fD; }
87  Double_t GetStripAngle(Int_t index) const { return fStripAngle[index]; }
88  Double_t GetPitch(Int_t index) const { return fPitch[index]; }
89  Double_t GetSigmaX() const { return fSigmaX; }
90  Double_t GetSigmaY() const { return fSigmaY; }
91  Double_t GetSigmaXY() const { return fSigmaXY; }
92  Int_t GetNChannels() const { return fNChannelsFront + fNChannelsBack; }
93  Int_t GetNChannelsFront() const { return fNChannelsFront; }
94  Int_t GetNChannelsBack() const { return fNChannelsBack; }
95 
96  Int_t GetSideChannels(Int_t si) const
97  {
98  if (si == 0)
99  return fNChannelsFront;
100  return fNChannelsBack;
101  } // will return NChFront for si==0, and NChBack for anything else
102 
110  Int_t GetChannel(Double_t x, Double_t y, Int_t iSide);
111 
112  Int_t GetChannel2(Double_t x, Double_t y, Int_t iSide, Double_t &feeDist);
113  // Double_t GetChannel(Double_t x, Double_t y, Int_t iSide, Double_t& stripWidth);
114 
117  Bool_t Inside(Double_t x, Double_t y);
118  Bool_t Inside(Double_t radius);
119 
126  // Bool_t ActivateChannels(Int_t ipt, Double_t x, Double_t y); // not implemented
127 
128  Double_t GetStripOrientation(Double_t x, Double_t y, Int_t iSide);
129  Double_t GetDistance(Int_t iSide, Double_t chan1, Double_t chan2);
130  Int_t GetDistance(Int_t iSide, Int_t chanMin, Int_t chanMax, Int_t chanTest);
131  Double_t GetDistance2(Int_t iSide, Double_t chan1, Double_t chan2);
132 
133  // returns the part of sensor in which chan is located.
134  // for most sensors it should return -1
135  // only for the sensors where the channel order is broken
136  Int_t GetSensorPart(Int_t iSide, Int_t chan);
137 
138  Double_t GetMeanChannel(Int_t iSide, Double_t chan1, Double_t weight1, Double_t chan2, Double_t weight2);
139 
140  Int_t GetNeighbours(Int_t iSide, Int_t iChan, Int_t &nChan1, Int_t &nChan2, Int_t &nChan3);
141 
150  // Int_t Intersect(Int_t iFStrip, Int_t iBStrip, std::vector<Double_t>& xCross, std::vector<Double_t>& yCross); // not implemented
151 
152  Int_t Intersect(Double_t iFStrip, Double_t iBStrip, Double_t &xCross, Double_t &yCross, Double_t &zCross);
153 
154  Int_t Intersect(Double_t iFStrip, Double_t iBStrip, Double_t &xCross, Double_t &yCross, Double_t &zCross, Double_t &dr, Double_t &dp);
155 
156  Int_t Intersect(Double_t iFStrip, Double_t iBStrip, Double_t &xCross, Double_t &yCross, Double_t &zCross, Double_t &dx, Double_t &dy, Double_t &dr, Double_t &dp);
157 
158  // Int_t IntersectClusters(Double_t fChan, Double_t bChan, Double_t& xCross, Double_t& yCross, Double_t& zCross); // not implemented
159 
167  // Int_t PointIndex(Int_t iFStrip, Int_t IBStrip); // not implemented
168 
170  void Reset();
171 
173  void Print();
174 
175  private:
178  Int_t fDetectorId; // Unique detector ID
179  Int_t fType; // Sensor type
180  Double_t fPosition[3]; // Coordinates of the sensor centre [cm]
181  Double_t fRotation; // Rotation angle in global c.m. [rad]
182  Double_t fInnerRadius; // Inner radius of the sensor [cm]
183  Double_t fOuterRadius; // Outer radius of the sensor [cm]
184  Double_t fD; // thickness of the sensor [cm]
185  Double_t fStripAngle[2]; // Strips angle
186  Double_t fPitch[2]; // Strip readout pitch or pixel size in x/y
187 
189  Int_t fNChannelsFront;
190  Int_t fNChannelsBack;
191 
194  // Logically, this belongs to the HitFinder, but it is here
195  // for performance reasons: to be executed once per sensor, not for
196  // each MCPoint
197  Double_t fSigmaX; // RMS in x, global c.s. [cm]
198  Double_t fSigmaY; // RMS in y, global c.s. [cm]
199  Double_t fSigmaXY; // Covariance in global c.s. [cm**2]
200 
209  Int_t FrontStripNumber(Double_t x, Double_t y) const;
210 
217  Int_t BackStripNumber(Double_t x, Double_t y) const;
218 
226  Bool_t IntCoord(Double_t x, Double_t y, Double_t z, Double_t &xint, Double_t &yint, Double_t &zint) const;
227 
233  Bool_t IsInside(Double_t xint, Double_t yint) const;
234 
235  ClassDef(PndGemSensor, 1);
236 };
237 
238 #endif
Int_t GetDetectorId() const
Definition: PndGemSensor.h:72
TString GetDetectorName() const
Definition: PndGemSensor.h:70
Int_t Intersect(Double_t iFStrip, Double_t iBStrip, Double_t &xCross, Double_t &yCross, Double_t &zCross)
Int_t GetNChannelsBack() const
Definition: PndGemSensor.h:94
Int_t GetSystemId() const
Definition: PndGemSensor.h:73
Double_t GetOuterRadius() const
Definition: PndGemSensor.h:85
Int_t GetType() const
Definition: PndGemSensor.h:79
Double_t GetY0() const
Definition: PndGemSensor.h:81
Double_t GetSigmaY() const
Definition: PndGemSensor.h:90
Int_t GetStationNr() const
Definition: PndGemSensor.h:74
Int_t GetNChannelsFront() const
Definition: PndGemSensor.h:93
Double_t GetInnerRadius() const
Definition: PndGemSensor.h:84
Double_t GetStripOrientation(Double_t x, Double_t y, Int_t iSide)
Double_t GetRotation() const
Definition: PndGemSensor.h:83
void SetDetectorId(Int_t stationNr, Int_t sensorNr)
Definition: PndGemSensor.h:71
Int_t GetChannel(Double_t x, Double_t y, Int_t iSide)
Double_t GetZ0() const
Definition: PndGemSensor.h:82
Double_t GetPitch(Int_t index) const
Definition: PndGemSensor.h:88
Double_t GetDistance(Int_t iSide, Double_t chan1, Double_t chan2)
Int_t GetChannel2(Double_t x, Double_t y, Int_t iSide, Double_t &feeDist)
Double_t GetSigmaX() const
Definition: PndGemSensor.h:89
Double_t GetSigmaXY() const
Definition: PndGemSensor.h:91
Int_t GetNChannels() const
Definition: PndGemSensor.h:92
Int_t GetSensorNr() const
Definition: PndGemSensor.h:75
Bool_t Inside(Double_t x, Double_t y)
Int_t GetSensorPart(Int_t iSide, Int_t chan)
Double_t GetX0() const
Definition: PndGemSensor.h:80
Double_t GetDistance2(Int_t iSide, Double_t chan1, Double_t chan2)
Int_t GetNeighbours(Int_t iSide, Int_t iChan, Int_t &nChan1, Int_t &nChan2, Int_t &nChan3)
Int_t GetSideChannels(Int_t si) const
Definition: PndGemSensor.h:96
Double_t GetMeanChannel(Int_t iSide, Double_t chan1, Double_t weight1, Double_t chan2, Double_t weight2)
Double_t GetD() const
Definition: PndGemSensor.h:86
virtual ~PndGemSensor()
Double_t GetStripAngle(Int_t index) const
Definition: PndGemSensor.h:87