ATLAS Offline Software
DigitizationModule.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // DigitizationModule.cxx, ATLAS Detector software
8 
10 
11 Trk::DigitizationModule::DigitizationModule(std::shared_ptr<const Segmentation> moduleSegmentation,
12  double halfThickness,
13  int readoutDirection,
14  double lorentzAngle) :
15 
16  m_halfThickness(halfThickness),
17  m_readoutDirection(readoutDirection),
18  m_lorentzAngle(lorentzAngle),
19  m_tanLorentzAngle(tan(lorentzAngle)),
20  m_segmentation(std::move(moduleSegmentation)),
21  m_boundarySurfaces(),
22  m_segmentationSurfacesX(),
23  m_segmentationSurfacesY()
24 {
25  m_segmentation->createSegmenationSurfaces(m_boundarySurfaces,
30  lorentzAngle);
31 }
32 
33 const std::vector< std::shared_ptr<const Trk::Surface> > Trk::DigitizationModule::segmentationSurfaces(const Trk::DigitizationCell& entryCids, const Trk::DigitizationCell& exitCids) const
34 {
35  std::vector< std::shared_ptr<const Trk::Surface> > sSurfaces;
36 
37  int startbinX = entryCids.first;
38  int endbinX = exitCids.first;
39  // swap if needed
40  if (startbinX > endbinX) std::swap(startbinX,endbinX);
41  // now cash in the rest
42  for ( ; startbinX <= endbinX; ++startbinX)
43  sSurfaces.push_back(m_segmentationSurfacesX[startbinX]);
44 
45  // start bin, end bin
46  int startbinY = entryCids.second;
47  int endbinY = exitCids.second;
48  // swap if needed
49  if (startbinY > endbinY) std::swap(startbinY,endbinY);
50  // now cash in the rest
51  for ( ; startbinY <= endbinY; ++startbinY)
52  sSurfaces.push_back(m_segmentationSurfacesY[startbinY]);
53 
54  // return what you have
55  return sSurfaces;
56 }
57 
58 const std::vector< std::shared_ptr<const Trk::Surface> > Trk::DigitizationModule::stepSurfaces(const Amg::Vector3D& start, const Amg::Vector3D& end) const
59 {
60  // prepare the return vector
61  std::vector< std::shared_ptr<const Trk::Surface> > stepSurfaces;
62 
63  const Trk::DigitizationCell startCell = m_segmentation->cell(start);
64  const Trk::DigitizationCell endCell = m_segmentation->cell(end);
65 
66  // go along x - first with the naive binning (i.e. w.o lorentz angle)
67  size_t sCellX = startCell.first;
68  size_t eCellX = endCell.first;
69  if (sCellX > eCellX) std::swap(sCellX,eCellX);
70  // now take the boundaries as well
71  if (sCellX > 0) --sCellX;
72  ++eCellX;
73  // the surfaces along Y are easy, just the bin surfaces
74  size_t sCellY = startCell.second;
75  size_t eCellY = endCell.second;
76  if (sCellY > eCellY) std::swap(sCellY,eCellY);
77  // reserve - be safe
78  stepSurfaces.reserve((eCellY-sCellY)+(eCellX-sCellX)+2);
79  // now fill the x surfaces
80  for ( ; sCellX <= eCellX && sCellX < m_segmentationSurfacesX.size(); ++sCellX)
81  stepSurfaces.push_back(m_segmentationSurfacesX[sCellX]);
82  // end fill the y surfaces
83  for ( ; sCellY <= eCellY && sCellY < m_segmentationSurfacesY.size(); ++sCellY)
84  stepSurfaces.push_back(m_segmentationSurfacesY[sCellY]);
85  // return the lot
86  return stepSurfaces;
87 }
88 
89 
90 
Trk::DigitizationModule::lorentzAngle
double lorentzAngle() const
return the lorentz Angle
Definition: DigitizationModule.h:115
Trk::DigitizationModule::readoutDirection
int readoutDirection() const
return the readout direction
Definition: DigitizationModule.h:112
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
DigitizationModule.h
Trk::DigitizationModule::m_boundarySurfaces
std::vector< std::shared_ptr< const Surface > > m_boundarySurfaces
boundary surfaces, they are ordered: readout, opposite, x boundaries, y boundaries
Definition: DigitizationModule.h:102
Trk::DigitizationModule::stepSurfaces
const std::vector< std::shared_ptr< const Surface > > stepSurfaces(const Amg::Vector3D &start, const Amg::Vector3D &end) const
return the test surfaces between these points
Definition: DigitizationModule.cxx:58
Trk::DigitizationCell
std::pair< size_t, size_t > DigitizationCell
Definition: DigitizationCell.h:18
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
Trk::DigitizationModule::DigitizationModule
DigitizationModule(std::shared_ptr< const Segmentation > moduleSegmentation, double halfThickness, int readoutDirection, double lorentzAngle)
Constructor from a Segmentation descriptor.
Definition: DigitizationModule.cxx:11
Trk::DigitizationModule::m_segmentationSurfacesX
std::vector< std::shared_ptr< const Surface > > m_segmentationSurfacesX
segmentation surfaces in X - without boundaries
Definition: DigitizationModule.h:103
Trk::DigitizationModule::m_segmentationSurfacesY
std::vector< std::shared_ptr< const Surface > > m_segmentationSurfacesY
segmentation surfaces in Y - without boundaries
Definition: DigitizationModule.h:104
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
WriteCalibToCool.swap
swap
Definition: WriteCalibToCool.py:94
Trk::DigitizationModule::m_segmentation
std::shared_ptr< const Segmentation > m_segmentation
segmentation descriptor
Definition: DigitizationModule.h:101
Trk::DigitizationModule::segmentationSurfaces
const std::vector< std::shared_ptr< const Surface > > segmentationSurfaces(const DigitizationCell &entryCids, const DigitizationCell &exitCids) const
Return the internal test segmentation surfaces to test between entry and exit given by their cell id'...
Definition: DigitizationModule.cxx:33
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::DigitizationModule::halfThickness
double halfThickness() const
module thickness
Definition: DigitizationModule.h:109