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