CbmRoot
CbmTofCell.cxx
Go to the documentation of this file.
1
#include "
CbmTofCell.h
"
2
3
#include <FairLogger.h>
// for Logger, LOG
4
5
#include <TGeoManager.h>
// for gGeoManager
6
#include <TNamed.h>
// for TNamed
7
8
// ----- Default constructor -------------------------------------------
9
CbmTofCell::CbmTofCell
()
10
: TNamed()
11
, fDetectorId(0)
12
, fX(-666.)
13
, fY(-666.)
14
, fZ(-666.)
15
, fSizex(-666.)
16
, fSizey(-666.) {}
17
18
CbmTofCell::CbmTofCell
(Int_t detId,
19
Double_t
x
,
20
Double_t
y
,
21
Double_t z,
22
Double_t sizex,
23
Double_t sizey)
24
: TNamed()
25
, fDetectorId(detId)
26
, fX(
x
)
27
, fY(
y
)
28
, fZ(z)
29
, fSizex(sizex)
30
, fSizey(sizey) {}
31
// -------------------------------------------------------------------------
32
CbmTofCell::~CbmTofCell
() {}
33
/*
34
void CbmTofCell::GetPadInfo(CbmTrdPoint *trdPoint, Int_t &Col,
35
Int_t &Row, Int_t &Sector)
36
{
37
38
// Calculate point in the middle of the detector. This is
39
// for safety reasons, because the point at exit is slightly
40
// outside of the active volume. If one does not use a point
41
// in the detector one will get a wrong volume from the
42
// geomanager. Navigate to the correct volume to get all
43
// necessary information about this volume
44
45
Double_t x_mean = (trdPoint->GetXIn()+trdPoint->GetXOut())/2.;
46
Double_t y_mean = (trdPoint->GetYIn()+trdPoint->GetYOut())/2.;
47
Double_t z_mean = (trdPoint->GetZIn()+trdPoint->GetZOut())/2.;
48
gGeoManager->FindNode(x_mean, y_mean, z_mean);
49
50
// Get the local point in local MC coordinates from
51
// the geomanager. This coordinate system is rotated
52
// if the chamber is rotated. This is corrected in
53
// GetModuleInformation to have a
54
// the same local coordinate system in all the chambers
55
const Double_t *global_point = gGeoManager->GetCurrentPoint();
56
Double_t local_point[3]; // global_point[3];
57
gGeoManager->MasterToLocal(global_point, local_point);
58
59
Int_t ModuleID = trdPoint->GetDetectorID();
60
61
GetModuleInformation(ModuleID, local_point, Col, Row, Sector);
62
63
}
64
*/
65
66
/*
67
void CbmTofCell::GetModuleInformation(Int_t VolumeID, Double_t *local_point, Int_t &Col, Int_t &Row, Int_t §or)
68
{
69
70
// safety check. Up to now allways correct, so could be removed.
71
if (fDetectorId != VolumeID ){
72
LOG(error) <<"This is wrong!!!!!!!!!!!!!!!!!!!!!";
73
}
74
75
// calculate in which sector the point is
76
sector = GetSector(local_point);
77
78
Double_t posX, posY;
79
Double_t fpadsizex = GetPadSizex(sector);
80
Double_t fpadsizey = GetPadSizey(sector);
81
82
TransformToLocalSector(local_point, sector, posX, posY);
83
84
Col = 1+(Int_t)(posX/fPadSizex.At(sector));
85
Row = 1+(Int_t)(posY/fPadSizey.At(sector));
86
87
}
88
89
90
// ---- CalculateHitPosition ------------------------------------------
91
void CbmTofCell::GetPosition(const Int_t Col, const Int_t Row,
92
const Int_t VolumeId, const Int_t sector,
93
TVector3 &posHit, TVector3 &padSize) {
94
95
// calculate position in global coordinates from digi
96
// information(Sector, Col, Row).
97
// Returns two TVector3. One with the position and one
98
// with the padsize of the fired pad
99
100
if (fDetectorId != VolumeId ){
101
LOG(error) <<"This is wrong!!!!!!!!!!!!!!!!!!!!!";
102
}
103
104
Double_t local_point[3];
105
Double_t padsizex = fPadSizex.At(sector);
106
Double_t padsizey = fPadSizey.At(sector);
107
108
// calculate position in sector coordinate system with the
109
// origin in the lower right corner
110
local_point[0] = (((Float_t)Col-0.5) * padsizex);
111
local_point[1] = (((Float_t)Row-0.5) * padsizey);
112
113
// calculate position in module coordinate system
114
// with origin in the lower right corner of the module
115
local_point[0]+=fSectorBeginX.GetAt(sector);
116
local_point[1]+=fSectorBeginY.GetAt(sector);
117
118
// calculte position in the module coordinate system
119
// with origin in the middle of the module
120
local_point[0]-=fSizex;
121
local_point[1]-=fSizey;
122
local_point[2]=fSizez;
123
124
// Navigate to the correct module. (fX,fY,fZ)
125
gGeoManager->FindNode(fX, fY, fZ);
126
127
// Get the local point in local MC coordinates from
128
// the geomanager. This coordinate system is rotated
129
// if the chamber is rotated. This is corrected in
130
// GetModuleInformation to have a
131
// the same local coordinate system in all the chambers
132
Double_t global_point[3]; // global_point[3];
133
gGeoManager->LocalToMaster(local_point, global_point);
134
135
136
// calculate the position in the global coordinate system
137
// with the origin in target
138
Float_t posX=global_point[0];
139
Float_t posY=global_point[1];
140
Float_t posZ=global_point[2];
141
142
posHit.SetXYZ(posX, posY, posZ);
143
padSize.SetXYZ(padsizex,padsizey, 0.);
144
145
}
146
*/
147
148
void
CbmTofCell::Print
(Option_t*)
const
{
149
LOG(info) <<
"ID, X, Y, Z, sizex, sizey: "
<<
fDetectorId
<<
", "
<<
fX
150
<<
", "
<<
fY
<<
", "
<<
fZ
<<
", "
<<
fSizex
<<
", "
<<
fSizey
;
151
}
152
153
// -------------------------------------------------------------------------
154
ClassImp
(
CbmTofCell
)
CbmTofCell::fSizex
Double_t fSizex
Definition:
CbmTofCell.h:52
CbmTofCell::fX
Double_t fX
Definition:
CbmTofCell.h:49
CbmTofCell::fY
Double_t fY
Definition:
CbmTofCell.h:50
CbmTofCell::CbmTofCell
CbmTofCell()
Definition:
CbmTofCell.cxx:9
CbmTofCell
Definition:
CbmTofCell.h:8
CbmTofCell::fSizey
Double_t fSizey
Definition:
CbmTofCell.h:53
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition:
CbmConverterManager.cxx:12
CbmTofCell.h
CbmTofCell::fDetectorId
Int_t fDetectorId
Definition:
CbmTofCell.h:48
x
Double_t x
Definition:
CbmMvdSensorDigiToHitTask.cxx:68
y
Double_t y
Definition:
CbmMvdSensorDigiToHitTask.cxx:68
CbmTofCell::Print
void Print(Option_t *="") const
Definition:
CbmTofCell.cxx:148
CbmTofCell::~CbmTofCell
virtual ~CbmTofCell()
Definition:
CbmTofCell.cxx:32
CbmTofCell::fZ
Double_t fZ
Definition:
CbmTofCell.h:51
core
detectors
tof
CbmTofCell.cxx
Generated on Wed Oct 28 2020 15:11:46 for CbmRoot by
1.8.18