ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
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 30 of file TRTProcessingOfEndCapHits.cxx.

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

◆ ~TRTProcessingOfEndCapHits()

TRTProcessingOfEndCapHits::~TRTProcessingOfEndCapHits ( )

Definition at line 64 of file TRTProcessingOfEndCapHits.cxx.

65 {
66 }

◆ TRTProcessingOfEndCapHits() [2/2]

TRTProcessingOfEndCapHits::TRTProcessingOfEndCapHits ( const TRTProcessingOfEndCapHits )
private

Member Function Documentation

◆ DeleteArrays()

void TRTProcessingOfEndCapHits::DeleteArrays ( )
private

◆ Initialize()

void TRTProcessingOfEndCapHits::Initialize ( )
private

Definition at line 71 of file TRTProcessingOfEndCapHits.cxx.

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

◆ operator=()

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

◆ ProcessHit()

bool TRTProcessingOfEndCapHits::ProcessHit ( G4Step *  pStep)

Definition at line 87 of file TRTProcessingOfEndCapHits.cxx.

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

Friends And Related Function Documentation

◆ 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:
TRTProcessingOfEndCapHits::m_pParameters
const TRTParameters * m_pParameters
Definition: TRTProcessingOfEndCapHits.h:49
egammaParameters::depth
@ depth
pointing depth of the shower as calculated in egammaqgcld
Definition: egammaParamDefs.h:276
TRTProcessingOfEndCapHits::m_printMessages
int m_printMessages
Definition: TRTProcessingOfEndCapHits.h:31
TRTSensitiveDetector::m_energyDeposit
double m_energyDeposit
Definition: TRTSensitiveDetector.h:73
TRTProcessingOfEndCapHits::m_verboseLevel
int m_verboseLevel
Definition: TRTProcessingOfEndCapHits.h:52
TRTProcessingOfEndCapHits::m_initialStrawIDInSectorC
int m_initialStrawIDInSectorC
Definition: TRTProcessingOfEndCapHits.h:44
TRTProcessingOfEndCapHits::m_numberOfWheelsAB
int m_numberOfWheelsAB
Definition: TRTProcessingOfEndCapHits.h:39
TRTProcessingOfEndCapHits::m_numberOfStrawsInPlanesAB
int m_numberOfStrawsInPlanesAB
Definition: TRTProcessingOfEndCapHits.h:36
TRTProcessingOfEndCapHits::m_numberOfStrawsInSectorC
int m_numberOfStrawsInSectorC
Definition: TRTProcessingOfEndCapHits.h:42
TRTProcessingOfEndCapHits::m_numberOfStrawsInSectorsAB
int m_numberOfStrawsInSectorsAB
Definition: TRTProcessingOfEndCapHits.h:41
Trk::energyDeposit
@ energyDeposit
Definition: MeasurementType.h:32
TRTSensitiveDetector::m_partLink
HepMcParticleLink m_partLink
Definition: TRTSensitiveDetector.h:70
TRTProcessingOfEndCapHits::Initialize
void Initialize()
Definition: TRTProcessingOfEndCapHits.cxx:71
TrackHelper
Definition: TrackHelper.h:14
TRTSensitiveDetector::m_postStepX
double m_postStepX
Definition: TRTSensitiveDetector.h:78
TRTProcessingOfEndCapHits::m_sectorsABC
int m_sectorsABC
Definition: TRTProcessingOfEndCapHits.h:33
TRTSensitiveDetector::m_globalTime
double m_globalTime
Definition: TRTSensitiveDetector.h:81
TRTSensitiveDetector::m_kineticEnergy
double m_kineticEnergy
Definition: TRTSensitiveDetector.h:72
TRTProcessingOfEndCapHits::m_initialStrawIDInSectorsAB
int m_initialStrawIDInSectorsAB
Definition: TRTProcessingOfEndCapHits.h:43
TRTSensitiveDetector::m_postStepY
double m_postStepY
Definition: TRTSensitiveDetector.h:79
TRTSensitiveDetector::m_preStepX
double m_preStepX
Definition: TRTSensitiveDetector.h:75
TRTProcessingOfEndCapHits::m_testLocalCoordinatesOfHits
int m_testLocalCoordinatesOfHits
Definition: TRTProcessingOfEndCapHits.h:34
TRTSensitiveDetector::m_preStepY
double m_preStepY
Definition: TRTSensitiveDetector.h:76
TRTSensitiveDetector::m_postStepZ
double m_postStepZ
Definition: TRTSensitiveDetector.h:80
TRTProcessingOfEndCapHits::m_numberOfStrawsInPlaneC
int m_numberOfStrawsInPlaneC
Definition: TRTProcessingOfEndCapHits.h:37
TRTProcessingOfEndCapHits::m_numberOfStrawsInIDSectorC
int m_numberOfStrawsInIDSectorC
Definition: TRTProcessingOfEndCapHits.h:47
TRTProcessingOfEndCapHits::m_numberOfStrawsInIDSectorsAB
int m_numberOfStrawsInIDSectorsAB
Definition: TRTProcessingOfEndCapHits.h:46
TRTSensitiveDetector::m_preStepZ
double m_preStepZ
Definition: TRTSensitiveDetector.h:77
TRTSensitiveDetector::m_particleEncoding
int m_particleEncoding
Definition: TRTSensitiveDetector.h:71
TRTSensitiveDetector::m_hitID
int m_hitID
Properties of current TRTUncompressedHit, set by TRTProcessingOfBarrelHits and TRTProcessingOfEndCapH...
Definition: TRTSensitiveDetector.h:69
TRTProcessingOfEndCapHits::m_pSensitiveDetector
TRTSensitiveDetector * m_pSensitiveDetector
Definition: TRTProcessingOfEndCapHits.h:50