ATLAS Offline Software
Loading...
Searching...
No Matches
TRTProcessingOfEndCapHits Class Reference

#include <TRTProcessingOfEndCapHits.h>

Collaboration diagram for TRTProcessingOfEndCapHits:

Public Member Functions

 TRTProcessingOfEndCapHits (TRTSensitiveDetector *)
 ~TRTProcessingOfEndCapHits ()
bool ProcessHit (G4Step *)

Private Member Functions

 TRTProcessingOfEndCapHits (const TRTProcessingOfEndCapHits &)
TRTProcessingOfEndCapHitsoperator= (const TRTProcessingOfEndCapHits &)
void Initialize ()
void DeleteArrays ()

Private Attributes

int m_printMessages
int m_sectorsABC
int m_testLocalCoordinatesOfHits
int m_numberOfStrawsInPlanesAB
int m_numberOfStrawsInPlaneC
int m_numberOfWheelsAB
int m_numberOfStrawsInSectorsAB
int m_numberOfStrawsInSectorC
int m_initialStrawIDInSectorsAB
int m_initialStrawIDInSectorC
int m_numberOfStrawsInIDSectorsAB
int m_numberOfStrawsInIDSectorC
const TRTParameters * m_pParameters
TRTSensitiveDetectorm_pSensitiveDetector
int m_verboseLevel

Friends

class TRTParametersForEndCapHits

Detailed Description

Definition at line 15 of file TRTProcessingOfEndCapHits.h.

Constructor & Destructor Documentation

◆ TRTProcessingOfEndCapHits() [1/2]

TRTProcessingOfEndCapHits::TRTProcessingOfEndCapHits ( TRTSensitiveDetector * pSensitiveDet)

Definition at line 31 of file TRTProcessingOfEndCapHits.cxx.

32 :
33 m_printMessages(0), //FIXME obsolete?
34 m_sectorsABC(0),
45 m_pParameters(nullptr),
46 m_pSensitiveDetector(pSensitiveDet),
47 m_verboseLevel(pSensitiveDet->verboseLevel)
48{
49 m_pParameters = TRTParameters::GetPointer();
50
51 m_printMessages = m_pParameters->GetInteger("PrintMessages"); //FIXME Obsolete?
52
53 if (m_verboseLevel>5) { G4cout << "##### Constructor TRTProcessingOfEndCapHits" << G4endl; }
54
55 this->Initialize();
56
57 m_pParameters = nullptr;
58
59 if (m_verboseLevel>5) { G4cout << "##### Constructor TRTProcessingOfEndCapHits done" << G4endl; }
60}
TRTSensitiveDetector * m_pSensitiveDetector

◆ ~TRTProcessingOfEndCapHits()

TRTProcessingOfEndCapHits::~TRTProcessingOfEndCapHits ( )

Definition at line 65 of file TRTProcessingOfEndCapHits.cxx.

66{
67}

◆ TRTProcessingOfEndCapHits() [2/2]

TRTProcessingOfEndCapHits::TRTProcessingOfEndCapHits ( const TRTProcessingOfEndCapHits & )
private

Member Function Documentation

◆ DeleteArrays()

void TRTProcessingOfEndCapHits::DeleteArrays ( )
private

◆ Initialize()

void TRTProcessingOfEndCapHits::Initialize ( )
private

Definition at line 72 of file TRTProcessingOfEndCapHits.cxx.

73{
74 if (m_verboseLevel>5) { G4cout << "######### Method TRTProcessingOfEndCapHits::Initialize" << G4endl; }
75
76 m_sectorsABC = m_pParameters->GetInteger("SectorsABC");
77
79 m_pParameters->GetInteger("TestLocalCoordinatesOfHits");
80
81 if (m_verboseLevel>5) { G4cout << "######### Method TRTProcessingOfEndCapHits::Initialize done" << G4endl; }
82
83}

◆ operator=()

TRTProcessingOfEndCapHits & TRTProcessingOfEndCapHits::operator= ( const TRTProcessingOfEndCapHits & )
private

◆ ProcessHit()

bool TRTProcessingOfEndCapHits::ProcessHit ( G4Step * pStep)

Definition at line 88 of file TRTProcessingOfEndCapHits.cxx.

89{
90 G4Track* pTrack = pStep->GetTrack();
91 // get the HepMC barcode using the track helper
92 TrackHelper trHelp(pTrack);
93
94 G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
95 G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
96
97 G4TouchableHandle pTouchableHandle = pPreStepPoint->GetTouchableHandle();
98 int depth = 1;
99
100 int strawID = pTouchableHandle->GetReplicaNumber(depth++);
101
102 int sectorID = 0;
103
104 if (m_sectorsABC)
105 sectorID = pTouchableHandle->GetReplicaNumber(depth++);
106
107 int planeID = pTouchableHandle->GetReplicaNumber(depth++);
108
109 int wheelID = pTouchableHandle->GetReplicaNumber(depth);
110
111 G4ThreeVector globalPreStepPoint = pPreStepPoint->GetPosition();
112
113 int endCapID;
114
115 if (globalPreStepPoint.z() > 0.)
116 endCapID = 0;
117 else
118 endCapID = 1;
119
120 if (m_sectorsABC)
121 {
122 if (wheelID < m_numberOfWheelsAB)
123 {
124 strawID += m_numberOfStrawsInSectorsAB * sectorID -
126 if (strawID < 0)
128 }
129 else
130 {
132 if (strawID < 0)
133 strawID += m_numberOfStrawsInPlaneC;
134 }
135 }
136
137 G4ThreeVector globalPostStepPoint = pPostStepPoint->GetPosition();
138
139 const G4TouchableHistory* pTouchableHistory =
140 static_cast<const G4TouchableHistory*>(pPreStepPoint->GetTouchable());
141
142 const G4AffineTransform& topTransform = pTouchableHistory->GetHistory()->
143 GetTopTransform();
144
145 G4ThreeVector localPreStepPoint = topTransform.TransformPoint(globalPreStepPoint);
146 G4ThreeVector localPostStepPoint = topTransform.TransformPoint(globalPostStepPoint);
147
148 double preStepX = localPreStepPoint.x();
149 double preStepY = localPreStepPoint.y();
150 double preStepZ = localPreStepPoint.z();
151 double postStepX = localPostStepPoint.x();
152 double postStepY = localPostStepPoint.y();
153 double postStepZ = localPostStepPoint.z();
154
155
157 {
158 double preStepR = std::sqrt(preStepX * preStepX + preStepY * preStepY);
159 double postStepR = std::sqrt(postStepX * postStepX + postStepY * postStepY);
160
161 if (preStepR > 2.0000001 || postStepR > 2.0000001)
162 {
163 G4int particleEncoding = m_pSensitiveDetector->m_particleEncoding;
164 G4double kineticEnergy = m_pSensitiveDetector->m_kineticEnergy;
165 G4double energyDeposit = m_pSensitiveDetector->m_energyDeposit;
166
167 std::cout << "!!!!! End-caps. Error in local coordinates of hits!" << std::endl;
168 std::cout << " endCapID=" << endCapID << " wheelID=" << wheelID
169 << " planeID=" << planeID << " strawID=" << strawID
170 << " trackID=" << trHelp.GetUniqueID() << std::endl;
171 std::cout << " particleEncoding=" << particleEncoding;
172
173 if (kineticEnergy < 0.0001)
174 std::cout << " kineticEnergy=" << kineticEnergy * 1000000. << " eV";
175 else if (kineticEnergy < 0.1)
176 std::cout << " kineticEnergy=" << kineticEnergy * 1000. << " keV";
177 else if (kineticEnergy >= 100.)
178 std::cout << " kineticEnergy=" << kineticEnergy / 1000. << " GeV";
179 else if (kineticEnergy >= 100000.)
180 std::cout << " kineticEnergy=" << kineticEnergy / 1000000. << " TeV";
181 else
182 std::cout << " kineticEnergy=" << kineticEnergy << " MeV";
183
184 if (energyDeposit < 0.1)
185 std::cout << " energyDeposit=" << energyDeposit * 1000. << " eV"
186 << std::endl;
187 else if (energyDeposit >= 100.)
188 std::cout << " energyDeposit=" << energyDeposit / 1000. << " MeV"
189 << std::endl;
190 else
191 std::cout << " energyDeposit=" << energyDeposit << " keV" << std::endl;
192
193 std::cout << " preStepX=" << preStepX << " mm preStepY=" << preStepY
194 << " mm preStepR=" << preStepR << " mm" << std::endl;
195 std::cout << " postStepX=" << postStepX << " mm postStepY=" << postStepY
196 << " mm postStepR=" << postStepR << " mm" << std::endl << std::endl;
197 }
198 }
199
200 double preStepGlobalTime = pPreStepPoint->GetGlobalTime();
201 double postStepGlobalTime = pPostStepPoint->GetGlobalTime();
202 double globalTime = (preStepGlobalTime + postStepGlobalTime) / 2.;
203
204
205 int numberOfStrawsInPlane;
206 int numberOfStrawsInIDSector;
207
208 if (wheelID < m_numberOfWheelsAB) {
209 numberOfStrawsInPlane = m_numberOfStrawsInPlanesAB;
210 numberOfStrawsInIDSector = m_numberOfStrawsInIDSectorsAB;
211 } else {
212 numberOfStrawsInPlane = m_numberOfStrawsInPlaneC;
213 numberOfStrawsInIDSector = m_numberOfStrawsInIDSectorC;
214 }
215
216 // Mapping for negative endcap is
217 // nSectors = 32
218 // nStraws = num straws in sector
219 // straw = straw number within sector
220 // sector -> (nSectors + nSectors/2 - sector - 1) % nSectors
221 // straw -> nStraws - 1 - straw
222 //
223 // Since we calculate sector number below from strawID (where
224 // strawID is straw number in plane), its equivalent to map strawID
225 // first and then calculate sector number and straw number within sector.
226
227 // Mapping straw number in plane for negative endcap
228 if (endCapID > 0) {
229 strawID = (3*numberOfStrawsInPlane/2 - strawID - 1) % numberOfStrawsInPlane;
230 }
231
232 // Calculate sector number and straw number within sector.
233 sectorID = strawID / numberOfStrawsInIDSector;
234 strawID %= numberOfStrawsInIDSector;
235
236
237 int hitID;
238 if (endCapID == 0)
239 hitID = 0x00200000;
240 else
241 hitID = 0x00300000;
242
243 hitID += (wheelID << 15);
244 hitID += (sectorID << 10);
245 hitID += (planeID << 5);
246 hitID += strawID;
247
248 m_pSensitiveDetector->m_hitID = hitID;
249 auto* eventInfo = m_pSensitiveDetector->m_g4UserEventInfo;
250 m_pSensitiveDetector->m_partLink = trHelp.GenerateParticleLink(eventInfo ? eventInfo->GetEventStore() : nullptr);
251 m_pSensitiveDetector->m_preStepX = preStepX;
252 m_pSensitiveDetector->m_preStepY = preStepY;
253 m_pSensitiveDetector->m_preStepZ = preStepZ;
254 m_pSensitiveDetector->m_postStepX = postStepX;
255 m_pSensitiveDetector->m_postStepY = postStepY;
256 m_pSensitiveDetector->m_postStepZ = postStepZ;
257 m_pSensitiveDetector->m_globalTime = globalTime;
258
259 return true;
260}
std::string depth
tag string for intendation
Definition fastadd.cxx:46
@ energyDeposit

◆ TRTParametersForEndCapHits

friend class TRTParametersForEndCapHits
friend

Definition at line 17 of file TRTProcessingOfEndCapHits.h.

Member Data Documentation

◆ m_initialStrawIDInSectorC

int TRTProcessingOfEndCapHits::m_initialStrawIDInSectorC
private

Definition at line 44 of file TRTProcessingOfEndCapHits.h.

◆ m_initialStrawIDInSectorsAB

int TRTProcessingOfEndCapHits::m_initialStrawIDInSectorsAB
private

Definition at line 43 of file TRTProcessingOfEndCapHits.h.

◆ m_numberOfStrawsInIDSectorC

int TRTProcessingOfEndCapHits::m_numberOfStrawsInIDSectorC
private

Definition at line 47 of file TRTProcessingOfEndCapHits.h.

◆ m_numberOfStrawsInIDSectorsAB

int TRTProcessingOfEndCapHits::m_numberOfStrawsInIDSectorsAB
private

Definition at line 46 of file TRTProcessingOfEndCapHits.h.

◆ m_numberOfStrawsInPlaneC

int TRTProcessingOfEndCapHits::m_numberOfStrawsInPlaneC
private

Definition at line 37 of file TRTProcessingOfEndCapHits.h.

◆ m_numberOfStrawsInPlanesAB

int TRTProcessingOfEndCapHits::m_numberOfStrawsInPlanesAB
private

Definition at line 36 of file TRTProcessingOfEndCapHits.h.

◆ m_numberOfStrawsInSectorC

int TRTProcessingOfEndCapHits::m_numberOfStrawsInSectorC
private

Definition at line 42 of file TRTProcessingOfEndCapHits.h.

◆ m_numberOfStrawsInSectorsAB

int TRTProcessingOfEndCapHits::m_numberOfStrawsInSectorsAB
private

Definition at line 41 of file TRTProcessingOfEndCapHits.h.

◆ m_numberOfWheelsAB

int TRTProcessingOfEndCapHits::m_numberOfWheelsAB
private

Definition at line 39 of file TRTProcessingOfEndCapHits.h.

◆ m_pParameters

const TRTParameters* TRTProcessingOfEndCapHits::m_pParameters
private

Definition at line 49 of file TRTProcessingOfEndCapHits.h.

◆ m_printMessages

int TRTProcessingOfEndCapHits::m_printMessages
private

Definition at line 31 of file TRTProcessingOfEndCapHits.h.

◆ m_pSensitiveDetector

TRTSensitiveDetector* TRTProcessingOfEndCapHits::m_pSensitiveDetector
private

Definition at line 50 of file TRTProcessingOfEndCapHits.h.

◆ m_sectorsABC

int TRTProcessingOfEndCapHits::m_sectorsABC
private

Definition at line 33 of file TRTProcessingOfEndCapHits.h.

◆ m_testLocalCoordinatesOfHits

int TRTProcessingOfEndCapHits::m_testLocalCoordinatesOfHits
private

Definition at line 34 of file TRTProcessingOfEndCapHits.h.

◆ m_verboseLevel

int TRTProcessingOfEndCapHits::m_verboseLevel
private

Definition at line 52 of file TRTProcessingOfEndCapHits.h.


The documentation for this class was generated from the following files: