PandaRoot
PndGemSensor.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 // ----- PndGemSensor header file -----
15 // ----- Created 12/02/2009 by R. Karabowicz -----
16 // -------------------------------------------------------------------------
17 
41 #ifndef PNDGEMSENSOR_H
42 #define PNDGEMSENSOR_H 1
43 
44 #include "TNamed.h"
45 #include "PndDetectorList.h"
46 
47 #include <map>
48 #include <list>
49 #include <set>
50 #include <vector>
51 
52 class PndGemSensor : public TNamed {
53 
54  public:
56  PndGemSensor();
57 
72  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,
73  Double_t stripAngle0, Double_t stripAngle1, Double_t pitch0, Double_t pitch1);
74  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,
75  Double_t d, Double_t stripAngle0, Double_t stripAngle1, Double_t pitch0, Double_t pitch1);
76  PndGemSensor(const PndGemSensor &tempSensor);
77 
79  virtual ~PndGemSensor();
80 
82  TString GetDetectorName() const { return fName.Data(); }
83  void SetDetectorId(Int_t stationNr, Int_t sensorNr) { fDetectorId = static_cast<int>(DetectorId::kGEM) << 27 | 0 << 21 | stationNr << 8 | sensorNr << 6; }
84  Int_t GetDetectorId() const { return fDetectorId; }
85  Int_t GetSystemId() const { return ((fDetectorId & (31 << 27)) >> 27); }
86  Int_t GetStationNr() const { return ((fDetectorId & (8191 << 8)) >> 8); }
87  Int_t GetSensorNr() const
88  { // sensor number within station
89  return ((fDetectorId & (3 << 6)) >> 6);
90  }
91  Int_t GetType() const { return fType; }
92  Double_t GetX0() const { return fPosition[0]; }
93  Double_t GetY0() const { return fPosition[1]; }
94  Double_t GetZ0() const { return fPosition[2]; }
95  Double_t GetRotation() const { return fRotation; }
96  Double_t GetInnerRadius() const { return fInnerRadius; }
97  Double_t GetOuterRadius() const { return fOuterRadius; }
98  Double_t GetD() const { return fD; }
99  Double_t GetStripAngle(Int_t index) const { return fStripAngle[index]; }
100  Double_t GetPitch(Int_t index) const { return fPitch[index]; }
101  Double_t GetSigmaX() const { return fSigmaX; }
102  Double_t GetSigmaY() const { return fSigmaY; }
103  Double_t GetSigmaXY() const { return fSigmaXY; }
104  Int_t GetNChannels() const { return fNChannelsFront + fNChannelsBack; }
105  Int_t GetNChannelsFront() const { return fNChannelsFront; }
106  Int_t GetNChannelsBack() const { return fNChannelsBack; }
107 
108  Int_t GetSideChannels(Int_t si) const
109  {
110  if (si == 0)
111  return fNChannelsFront;
112  return fNChannelsBack;
113  } // will return NChFront for si==0, and NChBack for anything else
114 
122  Int_t GetChannel(Double_t x, Double_t y, Int_t iSide);
123 
124  Int_t GetChannel2(Double_t x, Double_t y, Int_t iSide, Double_t &feeDist);
125  // Double_t GetChannel(Double_t x, Double_t y, Int_t iSide, Double_t& stripWidth);
126 
129  Bool_t Inside(Double_t x, Double_t y);
130  Bool_t Inside(Double_t radius);
131 
138  // Bool_t ActivateChannels(Int_t ipt, Double_t x, Double_t y); // not implemented
139 
140  Double_t GetStripOrientation(Double_t x, Double_t y, Int_t iSide);
141  Double_t GetDistance(Int_t iSide, Double_t chan1, Double_t chan2);
142  Int_t GetDistance(Int_t iSide, Int_t chanMin, Int_t chanMax, Int_t chanTest);
143  Double_t GetDistance2(Int_t iSide, Double_t chan1, Double_t chan2);
144 
145  // returns the part of sensor in which chan is located.
146  // for most sensors it should return -1
147  // only for the sensors where the channel order is broken
148  Int_t GetSensorPart(Int_t iSide, Int_t chan);
149 
150  Double_t GetMeanChannel(Int_t iSide, Double_t chan1, Double_t weight1, Double_t chan2, Double_t weight2);
151 
152  Int_t GetNeighbours(Int_t iSide, Int_t iChan, Int_t &nChan1, Int_t &nChan2, Int_t &nChan3);
153 
162  // Int_t Intersect(Int_t iFStrip, Int_t iBStrip, std::vector<Double_t>& xCross, std::vector<Double_t>& yCross); // not implemented
163 
164  Int_t Intersect(Double_t iFStrip, Double_t iBStrip, Double_t &xCross, Double_t &yCross, Double_t &zCross);
165 
166  Int_t Intersect(Double_t iFStrip, Double_t iBStrip, Double_t &xCross, Double_t &yCross, Double_t &zCross, Double_t &dr, Double_t &dp);
167 
168  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);
169 
170  // Int_t IntersectClusters(Double_t fChan, Double_t bChan, Double_t& xCross, Double_t& yCross, Double_t& zCross); // not implemented
171 
179  // Int_t PointIndex(Int_t iFStrip, Int_t IBStrip); // not implemented
180 
182  void Reset();
183 
185  void Print();
186 
187  private:
190  Int_t fDetectorId; // Unique detector ID
191  Int_t fType; // Sensor type
192  Double_t fPosition[3]; // Coordinates of the sensor centre [cm]
193  Double_t fRotation; // Rotation angle in global c.m. [rad]
194  Double_t fInnerRadius; // Inner radius of the sensor [cm]
195  Double_t fOuterRadius; // Outer radius of the sensor [cm]
196  Double_t fD; // thickness of the sensor [cm]
197  Double_t fStripAngle[2]; // Strips angle
198  Double_t fPitch[2]; // Strip readout pitch or pixel size in x/y
199 
201  Int_t fNChannelsFront;
202  Int_t fNChannelsBack;
203 
206  // Logically, this belongs to the HitFinder, but it is here
207  // for performance reasons: to be executed once per sensor, not for
208  // each MCPoint
209  Double_t fSigmaX; // RMS in x, global c.s. [cm]
210  Double_t fSigmaY; // RMS in y, global c.s. [cm]
211  Double_t fSigmaXY; // Covariance in global c.s. [cm**2]
212 
221  Int_t FrontStripNumber(Double_t x, Double_t y) const;
222 
229  Int_t BackStripNumber(Double_t x, Double_t y) const;
230 
238  Bool_t IntCoord(Double_t x, Double_t y, Double_t z, Double_t &xint, Double_t &yint, Double_t &zint) const;
239 
245  Bool_t IsInside(Double_t xint, Double_t yint) const;
246 
247  ClassDef(PndGemSensor, 1);
248 };
249 
250 #endif
Int_t GetDetectorId() const
Definition: PndGemSensor.h:84
TString GetDetectorName() const
Definition: PndGemSensor.h:82
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:106
Int_t GetSystemId() const
Definition: PndGemSensor.h:85
Double_t GetOuterRadius() const
Definition: PndGemSensor.h:97
Int_t GetType() const
Definition: PndGemSensor.h:91
Double_t GetY0() const
Definition: PndGemSensor.h:93
Double_t GetSigmaY() const
Definition: PndGemSensor.h:102
Int_t GetStationNr() const
Definition: PndGemSensor.h:86
Int_t GetNChannelsFront() const
Definition: PndGemSensor.h:105
Double_t GetInnerRadius() const
Definition: PndGemSensor.h:96
Double_t GetStripOrientation(Double_t x, Double_t y, Int_t iSide)
Double_t GetRotation() const
Definition: PndGemSensor.h:95
void SetDetectorId(Int_t stationNr, Int_t sensorNr)
Definition: PndGemSensor.h:83
Int_t GetChannel(Double_t x, Double_t y, Int_t iSide)
Double_t GetZ0() const
Definition: PndGemSensor.h:94
Double_t GetPitch(Int_t index) const
Definition: PndGemSensor.h:100
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:101
Double_t GetSigmaXY() const
Definition: PndGemSensor.h:103
Int_t GetNChannels() const
Definition: PndGemSensor.h:104
Int_t GetSensorNr() const
Definition: PndGemSensor.h:87
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:92
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:108
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:98
virtual ~PndGemSensor()
Double_t GetStripAngle(Int_t index) const
Definition: PndGemSensor.h:99