Skip to content
Snippets Groups Projects
Commit 5c28611b authored by Matthew Thomas Anthony's avatar Matthew Thomas Anthony :speech_balloon: Committed by Vincent Pascuzzi
Browse files

updated package TrkDigEvent to latest 20.20.XVAL. Added copyright statements...

updated package TrkDigEvent to latest 20.20.XVAL. Added copyright statements to all relevant source code


Former-commit-id: 5165c434e9e745ddce97f8af6b18963fe5d06979
parent e5f7e008
No related branches found
No related tags found
No related merge requests found
Showing
with 23 additions and 1405 deletions
10
dir
811013
svn+ssh://svn.cern.ch/reps/atlasoff/Tracking/TrkDigitization/TrkDigEvent/tags/TrkDigEvent-00-00-02
svn+ssh://svn.cern.ch/reps/atlasoff
2016-11-16T18:30:22.023929Z
784672
ffabbri
4525493e-7705-40b1-a816-d608a930855b
cmt
dir
TrkDigEvent
dir
src
dir
ChangeLog
file
2017-10-10T18:36:07.000000Z
d20eb6f73185c227d948eae97cc0a77e
2016-11-16T18:28:29.588301Z
784667
ffabbri
703
2016-11-16 Federica Fabbri < Federica.Fabbri -at- cern.ch >
* Added in Rectangular segmentation a new constructor to include variable binning along Y
* Change in createSegmenationSurfaces, the position of Y surfaces is taken directly from bin utility
* Tagged as TrkDigEvent-00-00-02
2016-09-01 Andreas Salzburger < Andreas.Salzburger -at- cern.ch >
* Fixing lorentz angle apllication
* Tagged as TrkDigEvent-00-00-01
2016-01-20 Noemi Calace < Noemi.Calace@cern.ch>
* Adding TrapezoidSegmentation
* Tagged as TrkDigEvent-00-00-00
2016-01-12 Andreas Salzburger < Andreas.Salzburger -at- cern.ch >
* initial import
* TrkDigEvent-00-00-00
2016-11-16 Federica Fabbri < Federica.Fabbri -at- cern.ch >
* Added in Rectangular segmentation a new constructor to include variable binning along Y
* Change in createSegmenationSurfaces, the position of Y surfaces is taken directly from bin utility
* Tagged as TrkDigEvent-00-00-02
2016-09-01 Andreas Salzburger < Andreas.Salzburger -at- cern.ch >
* Fixing lorentz angle apllication
* Tagged as TrkDigEvent-00-00-01
2016-01-20 Noemi Calace < Noemi.Calace@cern.ch>
* Adding TrapezoidSegmentation
* Tagged as TrkDigEvent-00-00-00
2016-01-12 Andreas Salzburger < Andreas.Salzburger -at- cern.ch >
* initial import
* TrkDigEvent-00-00-00
10
dir
811013
svn+ssh://svn.cern.ch/reps/atlasoff/Tracking/TrkDigitization/TrkDigEvent/tags/TrkDigEvent-00-00-02/TrkDigEvent
svn+ssh://svn.cern.ch/reps/atlasoff
2016-11-16T18:28:29.588301Z
784667
ffabbri
4525493e-7705-40b1-a816-d608a930855b
Segmentation.h
file
2017-10-10T18:36:06.000000Z
8d7ca457493584e73dcfa874a0cc090a
2016-01-12T15:27:05.330151Z
717372
salzburg
3345
DigitizationCell.h
file
2017-10-10T18:36:06.000000Z
70894f93535ebf4c81c4a3a3ceaf8dea
2016-01-12T15:27:05.330151Z
717372
salzburg
2340
TrapezoidSegmentation.h
file
2017-10-10T18:36:06.000000Z
a2d8b3f04361537432a344b47df544af
2016-01-20T14:25:53.149023Z
718774
ncalace
7316
DigitizationModule.h
file
2017-10-10T18:36:06.000000Z
c89a975315d3ea67c40691d8dc0b9538
2016-01-12T15:27:05.330151Z
717372
salzburg
6182
RectangularSegmentation.h
file
2017-10-10T18:36:06.000000Z
646f9bf6ed9c021abb53576bc60cd640
2016-11-16T18:28:29.588301Z
784667
ffabbri
5688
//////////////////////////////////////////////////////////////////
// DigitizationCell.h, ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef TRKDIGEVENT_DIGITIZATIONCELL_H
#define TRKDIGEVENT_DIGITIZATIONCELL_H
// GeoPrimitives
#include "GeoPrimitives/GeoPrimitives.h"
namespace Trk {
/** @typedef of a pair of ints for definition a cell */
typedef std::pair<size_t,size_t> DigitizationCell;
/** @struct DigitizationStep for further handling */
struct DigitizationStep {
double stepLength; //!< this is the path length within the cell
double driftLength; //!< this is the path length of the setp center to the readout surface
DigitizationCell stepCell; //!< this is the cell identifier of the segment
Amg::Vector3D stepEntry; //!< this is the Entry point into the segment
Amg::Vector3D stepExit; //!< this is the Exit point from the segment
Amg::Vector2D stepReadoutProjected; //!< this is the projected position at the readout surface
Amg::Vector2D stepCellCenter; //!< this is the cell position
/** Standard constructor */
DigitizationStep() :
stepLength(0.),
driftLength(0.),
stepCell(std::pair<size_t,size_t>(0,0)),
stepEntry(0.,0.,0.),
stepExit(0.,0.,0.),
stepReadoutProjected(0.,0.),
stepCellCenter(0.,0.)
{}
/** Constructor with arguments */
DigitizationStep(double sl, double dl,
DigitizationCell dc,
const Amg::Vector3D& entryP,
const Amg::Vector3D& exitP,
const Amg::Vector2D& projectedPosition,
const Amg::Vector2D& cellPosition) :
stepLength(sl),
driftLength(dl),
stepCell(dc),
stepEntry(entryP),
stepExit(exitP),
stepReadoutProjected(projectedPosition),
stepCellCenter(cellPosition)
{}
};
}
#endif
\ No newline at end of file
//////////////////////////////////////////////////////////////////
// DigitizationModule.h, ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef TRKDIGEVENT_PLANARDIGITIZATIONMODULE_H
#define TRKDIGEVENT_PLANARDIGITIZATIONMODULE_H
// GeoPrimitives
#include "GeoPrimitives/GeoPrimitives.h"
// Trk
#include "TrkDigEvent/DigitizationCell.h"
#include "TrkDigEvent/Segmentation.h"
// STL
#include <memory>
namespace Trk {
class Surface;
/** @class DigitizationModule
Class that holds the surfaces for a planar digitization detector module.
It needs a descriptor to design different pixel/strixels/strip setups (with a segmentation class)
The digitizaiton is done in the local frame of the surface and binning can be done
in local x and local y direction.
The lorentz angle is assumed to be only in x-direction and constant for the module,
it is measured from the local z-direction.
The readout direction defines the charge drift either:
a) towards the surface at -halfThickness if readout is defined at -1
b) towards the surface at +halfThickness if readout is defined at +1
Conventions:
- 3D positions are within the 3D frame of the module
- 2D positions are corrected to parameter surface at the center of the module (and not the readout surface)
The lorenzShift is the correction from the readout surface to the parameter surface
@author Andreas.Salzburger -at- cern.ch
*/
class DigitizationModule {
public :
/** Constructor from a Segmentation descriptor */
DigitizationModule(std::shared_ptr<const Segmentation> moduleSegmentation,
double halfThickness,
int readoutDirection,
double lorentzAngle);
/** Virtual Destructor */
virtual ~DigitizationModule(){}
/** Return the internal test segmentation surfaces to test between entry and exit given by their cell id's - the boundaries are not given */
const std::vector< std::shared_ptr<const Surface> > segmentationSurfaces(const DigitizationCell& entryCids, const DigitizationCell& exitCids) const;
/** Get the digitization cell fropm a position */
const DigitizationCell cell(const Amg::Vector2D& position) const;
/** module thickness */
double halfThickness() const;
/** return the readout direction */
int readoutDirection() const;
/** return the lorentz Angle */
double lorentzAngle() const;
/** return the segmenation */
const Segmentation& segmentation() const;
/** return the test surfaces between these points */
const std::vector< std::shared_ptr<const Surface> > stepSurfaces(const Amg::Vector3D& start, const Amg::Vector3D& end) const;
/** Fill the associated digitsation cell from this start and end position, correct for lorentz effect if needed */
const DigitizationStep digitizationStep(const Amg::Vector3D& start, const Amg::Vector3D& end) const;
/** return the bounding surfaces at top and bottom */
const std::vector< std::shared_ptr<const Surface> >& boundarySurfaces() const;
/** return all surfaces in X - excluding the boundaries */
const std::vector< std::shared_ptr<const Surface> >& segmentationSurfacesX() const;
/** return all surfaces in Y - excluding the boundaries */
const std::vector< std::shared_ptr<const Surface> >& segmentationSurfacesY() const;
private:
double m_halfThickness;
int m_readoutDirection; //!< defines if the readout is along (+1) / (-1) wrt the z axis
double m_lorentzAngle; //!< the lorentz angle
double m_tanLorentzAngle; //!< and the tangent of it
std::shared_ptr<const Segmentation> m_segmentation; //!< segmentation descriptor
std::vector< std::shared_ptr<const Surface> > m_boundarySurfaces; //!< boundary surfaces, they are ordered: readout, opposite, x boundaries, y boundaries
std::vector< std::shared_ptr<const Surface> > m_segmentationSurfacesX; //!< segmentation surfaces in X - without boundaries
std::vector< std::shared_ptr<const Surface> > m_segmentationSurfacesY; //!< segmentation surfaces in Y - without boundaries
};
inline double DigitizationModule::halfThickness() const
{ return m_halfThickness; }
inline int DigitizationModule::readoutDirection() const
{ return m_readoutDirection; }
inline double DigitizationModule::lorentzAngle() const
{ return m_lorentzAngle; }
inline const Segmentation& DigitizationModule::segmentation() const
{ return (*(m_segmentation.get())); }
inline const std::vector< std::shared_ptr<const Surface> >& DigitizationModule::boundarySurfaces() const
{ return m_boundarySurfaces; }
inline const std::vector< std::shared_ptr<const Surface> >& DigitizationModule::segmentationSurfacesX() const
{ return m_segmentationSurfacesX; }
inline const std::vector< std::shared_ptr<const Surface> >& DigitizationModule::segmentationSurfacesY() const
{ return m_segmentationSurfacesY; }
inline const DigitizationStep DigitizationModule::digitizationStep(const Amg::Vector3D& start, const Amg::Vector3D& end) const
{ return m_segmentation->digitizationStep(start,end,m_halfThickness,m_readoutDirection,m_lorentzAngle); }
}
#endif
//////////////////////////////////////////////////////////////////
// RectangularSegmentation.h, ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef TRKDIGEVENT_RECTANGLESEGMENTATION_H
#define TRKDIGEVENT_RECTANGLESEGMENTATION_H
// GeoPrimitives
#include "GeoPrimitives/GeoPrimitives.h"
// Trk includes
#include "TrkDigEvent/Segmentation.h"
#include "TrkDigEvent/DigitizationCell.h"
#include "TrkSurfaces/RectangleBounds.h"
#include "TrkDetDescrUtils/BinUtility.h"
// STL
#include <memory>
namespace Trk {
/** @class Segmentation Base class
Segementation class for generic pixel, strixels and strip segmentations on a rectangle shape
Conventions:
- 3D positions are within the 3D frame of the module
- 2D positions are corrected to the readout surface
(they need to be corrected by the lorentzShift for the parameter surface in the center of the surface)
@author Andreas.Salzburger -at- cern.ch, Noemi.Calace -at- cern.ch
*/
class RectangularSegmentation : public Segmentation {
public:
/** Constructor for all same-size pixels or strips (in cas numCellsY is set to 1) */
RectangularSegmentation(std::shared_ptr<const Trk::RectangleBounds>,
size_t numCellsX, size_t numCellsY=1);
/** Constructor for ATLAS module type pixels or strips */
RectangularSegmentation(std::shared_ptr<const Trk::RectangleBounds>,
size_t numCellsX, double longY, size_t numCellsY, double numOfChips);
/** TODO contructor from BinUtilities for more complex readouts */
/** Virtual Destructor */
virtual ~RectangularSegmentation();
/** Create the segmentation surfaces in X */
void createSegmenationSurfaces(std::vector< std::shared_ptr< const Surface> >& boundarySurfaces,
std::vector< std::shared_ptr< const Surface> >& segmentationSurfacesX,
std::vector< std::shared_ptr< const Surface> >& segmentationSurfacesY,
double halfThickness,
int readoutDirection=1.,
double lorentzAngle=0.) const override;
/** Get the digitization cell fropm a 3D position - ignores the shift */
const DigitizationCell cell(const Amg::Vector3D& position) const override;
/** Get the digitization cell fropm a position */
const DigitizationCell cell(const Amg::Vector2D& position) const override;
/** calculate the cell Position from the Id */
const Amg::Vector2D cellPosition(const DigitizationCell& cId) const override;
/** Fill the associated digitsation cell from this start and end position, correct for lorentz effect if needed */
const DigitizationStep digitizationStep(const Amg::Vector3D& start,
const Amg::Vector3D& end,
double halfThickness,
int readoutDirection=1,
double lorentzAngle=0.) const override;
/** return the surface bounds by reference */
const SurfaceBounds& moduleBounds() const override;
/** Return the simple binning parameters */
size_t numCellsX() const;
/** Return the simple binning parameters */
size_t numCellsY() const;
private:
template <class T> const DigitizationCell cellT(const T& position) const;
std::shared_ptr<const RectangleBounds> m_activeBounds;
BinUtility* m_binUtility;
size_t m_binsX;
size_t m_binsY;
};
inline const SurfaceBounds& RectangularSegmentation::moduleBounds() const { return (*(m_activeBounds.get())); }
inline size_t RectangularSegmentation::numCellsX() const { return m_binsX; }
inline size_t RectangularSegmentation::numCellsY() const { return m_binsY; }
template <class T> const DigitizationCell RectangularSegmentation::cellT(const T& position) const
{
if (m_binsX == 1)
return DigitizationCell(0, m_binUtility->bin(position,0));
else if (m_binsY == 1 )
return DigitizationCell(m_binUtility->bin(position,0), 0);
return DigitizationCell(m_binUtility->bin(position,0), m_binUtility->bin(position,1));
}
inline const DigitizationCell RectangularSegmentation::cell(const Amg::Vector3D& position) const { return cellT<Amg::Vector3D>(position); }
inline const DigitizationCell RectangularSegmentation::cell(const Amg::Vector2D& position) const { return cellT<Amg::Vector2D>(position); }
}
#endif
\ No newline at end of file
//////////////////////////////////////////////////////////////////
// Segmentation.h, ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef TRKDIGEVENT_SEGMENTATION_H
#define TRKDIGEVENT_SEGMENTATION_H
// GeoPrimitives
#include "GeoPrimitives/GeoPrimitives.h"
// Trk includes
#include "TrkDigEvent/DigitizationCell.h"
// STL
#include <memory>
namespace Trk {
class Surface;
class SurfaceBounds;
/** @class Segmentation Base class
This helper class allows to define an arbitrary readout
segmentation for the geoemtric digitization, provided a shape of the module,
it creates the segmentation surfaces and hands them to the digitization module
Since the segmentation description might be identical for many elements while
the lorentz angle may change, lorentzAngle and readoutDirection are provided
and th the segmenation class only creates the surfaces for the module, but
hosts the binning information.
@author Andreas.Salzburger -at- cern.ch, Noemi.Calace -at- cern.ch
*/
class Segmentation {
public:
/** Virtual Destructor */
virtual ~Segmentation() {}
/** Create the segmentation surfaces in X */
virtual void createSegmenationSurfaces(std::vector< std::shared_ptr< const Surface> >& boundarySurfaces,
std::vector< std::shared_ptr< const Surface> >& segmentationSurfacesX,
std::vector< std::shared_ptr< const Surface> >& segmentationSurfacesY,
double halfThickness,
int readoutDirection,
double lorentzAngle) const = 0;
/** Get the digitization cell fropm a 3D position - ignores the shift */
virtual const DigitizationCell cell(const Amg::Vector3D& position) const = 0;
/** Get the digitization cell fropm a 2D position */
virtual const DigitizationCell cell(const Amg::Vector2D& position) const = 0;
/** calculate the cell Position from the Id */
virtual const Amg::Vector2D cellPosition(const DigitizationCell& dCell) const = 0;
/** Fill the associated digitsation cell from the start and end position in 3D, correct for lorentz effect if needed */
virtual const DigitizationStep digitizationStep(const Amg::Vector3D& start,
const Amg::Vector3D& end,
double halfThickness,
int readoutDirection,
double lorentzAngle) const =0;
/** return the surface bounds by reference */
virtual const SurfaceBounds& moduleBounds() const = 0;
};
}
#endif
\ No newline at end of file
//////////////////////////////////////////////////////////////////
// TrapezoidSegmentation.h, ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef TRKDIGEVENT_TRAPEZOIDSEGMENTATION_H
#define TRKDIGEVENT_TRAPEZOIDSEGMENTATION_H
// GeoPrimitives
#include "GeoPrimitives/GeoPrimitives.h"
// Trk includes
#include "TrkDigEvent/Segmentation.h"
#include "TrkDigEvent/DigitizationCell.h"
#include "TrkSurfaces/TrapezoidBounds.h"
#include "TrkDetDescrUtils/BinUtility.h"
// STL
#include <memory>
namespace Trk {
/** @class Segmentation Base class
Segementation class for generic pixel, strixels and strip segmentations on a trapezoidal shape
Conventions:
- 3D positions are within the 3D frame of the module
- 2D positions are corrected to the readout surface
(the lorentzShift is not taken into account fro trapezoidal elements)
@author Andreas.Salzburger -at- cern.ch, Noemi.Calace -at- cern.ch
*/
class TrapezoidSegmentation : public Segmentation {
public:
/** Constructor for all same-size pixels or strips (in case numCellsY is set to 1) */
TrapezoidSegmentation(std::shared_ptr<const Trk::TrapezoidBounds>,
size_t numCellsX, size_t numCellsY=1);
/** TODO contructor from BinUtilities for more complex readouts */
/** Virtual Destructor */
virtual ~TrapezoidSegmentation();
/** Create the segmentation surfaces in X */
void createSegmenationSurfaces(std::vector< std::shared_ptr< const Surface> >& boundarySurfaces,
std::vector< std::shared_ptr< const Surface> >& segmentationSurfacesX,
std::vector< std::shared_ptr< const Surface> >& segmentationSurfacesY,
double halfThickness,
int readoutDirection=1.,
double lorentzAngle=0.) const override;
/** Get the digitization cell from a 3D position - ignores the shift */
const DigitizationCell cell(const Amg::Vector3D& position) const override;
/** Get the digitization cell from a position */
const DigitizationCell cell(const Amg::Vector2D& position) const override;
/** calculate the cell Position from the Id */
const Amg::Vector2D cellPosition(const DigitizationCell& cId) const override;
/** Fill the associated digitisation cell from this start and end position, correct for lorentz effect if needed */
const DigitizationStep digitizationStep(const Amg::Vector3D& start,
const Amg::Vector3D& end,
double halfThickness,
int readoutDirection=1,
double lorentzAngle=0.) const override;
/** return the surface bounds by reference */
const SurfaceBounds& moduleBounds() const override;
/** Return the simple binning parameters */
size_t numCellsX() const;
/** Return the simple binning parameters */
size_t numCellsY() const;
private:
template <class T> const DigitizationCell cellT(const T& position) const;
/** Return the local pitch X */
double PitchX(const Amg::Vector2D &localPos) const;
/** Return the local sinStereo */
double sinStereoLocal(const Amg::Vector2D &localPos) const;
/** Return the projected x value on the y=0 */
double projectLocX(const Amg::Vector2D &localPos) const;
/** Return the radius correponding to the given module */
double radius() const;
std::shared_ptr<const TrapezoidBounds> m_activeBounds;
BinUtility* m_binUtility;
size_t m_binsX;
size_t m_binsY;
};
inline const SurfaceBounds& TrapezoidSegmentation::moduleBounds() const { return (*(m_activeBounds.get())); }
inline size_t TrapezoidSegmentation::numCellsX() const { return m_binsX; }
inline size_t TrapezoidSegmentation::numCellsY() const { return m_binsY; }
template <class T> const DigitizationCell TrapezoidSegmentation::cellT(const T& position) const
{
if (m_binsX == 1)
return DigitizationCell(0, m_binUtility->bin(position,0));
else if (m_binsY == 1 )
return DigitizationCell(m_binUtility->bin(position,0), 0);
return DigitizationCell(m_binUtility->bin(position,0), m_binUtility->bin(position,1));
}
inline const DigitizationCell TrapezoidSegmentation::cell(const Amg::Vector3D& position) const {
Amg::Vector3D CorrPosition = position;
CorrPosition.x() = projectLocX(Amg::Vector2D(CorrPosition.x(), CorrPosition.y()));
return cellT<Amg::Vector3D>(CorrPosition);
}
inline const DigitizationCell TrapezoidSegmentation::cell(const Amg::Vector2D& position) const {
using Trk::locX;
using Trk::locY;
Amg::Vector2D CorrPosition = position;
CorrPosition[Trk::locX] = projectLocX(Amg::Vector2D(CorrPosition[Trk::locX], CorrPosition[Trk::locY]));
return cellT<Amg::Vector2D>(CorrPosition);
}
double TrapezoidSegmentation::radius() const
{
return m_activeBounds->halflengthY()/(m_activeBounds->maxHalflengthX() - m_activeBounds->minHalflengthX())*(m_activeBounds->maxHalflengthX() + m_activeBounds->minHalflengthX());
}
double TrapezoidSegmentation::sinStereoLocal(const Amg::Vector2D &localPos) const {
using Trk::locX;
using Trk::locY;
double oneOverRadius = 1./radius();
double x = localPos[Trk::locX];
double y = localPos[Trk::locY];
return -x*oneOverRadius / sqrt( (1+y*oneOverRadius)*(1+y*oneOverRadius) + x*oneOverRadius*x*oneOverRadius );
}
double TrapezoidSegmentation::PitchX(const Amg::Vector2D &localPos) const {
using Trk::locY;
double tanPhi = (m_activeBounds->maxHalflengthX()-m_activeBounds->minHalflengthX())/m_activeBounds->halflengthY();
double lengthXatHit = (radius()+localPos[Trk::locY])*tanPhi;
return lengthXatHit/float(m_binsX);
}
double TrapezoidSegmentation::projectLocX(const Amg::Vector2D& localPos) const {
return -radius()*tan(asin(sinStereoLocal(localPos)));
}
}
#endif // end of TRKDIGEVENT_TRAPEZOIDSEGMENTATION_H
\ No newline at end of file
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
//////////////////////////////////////////////////////////////////
// DigitizationCell.h, ATLAS Detector software
///////////////////////////////////////////////////////////////////
......@@ -57,4 +61,4 @@ namespace Trk {
}
#endif
\ No newline at end of file
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
//////////////////////////////////////////////////////////////////
// DigitizationModule.h, ATLAS Detector software
///////////////////////////////////////////////////////////////////
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
//////////////////////////////////////////////////////////////////
// RectangularSegmentation.h, ATLAS Detector software
///////////////////////////////////////////////////////////////////
......@@ -111,4 +115,4 @@ namespace Trk {
}
#endif
\ No newline at end of file
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
//////////////////////////////////////////////////////////////////
// Segmentation.h, ATLAS Detector software
///////////////////////////////////////////////////////////////////
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
//////////////////////////////////////////////////////////////////
// TrapezoidSegmentation.h, ATLAS Detector software
///////////////////////////////////////////////////////////////////
......@@ -155,4 +159,4 @@ namespace Trk {
}
#endif // end of TRKDIGEVENT_TRAPEZOIDSEGMENTATION_H
\ No newline at end of file
#endif // end of TRKDIGEVENT_TRAPEZOIDSEGMENTATION_H
10
dir
811013
svn+ssh://svn.cern.ch/reps/atlasoff/Tracking/TrkDigitization/TrkDigEvent/tags/TrkDigEvent-00-00-02/cmt
svn+ssh://svn.cern.ch/reps/atlasoff
2016-01-12T15:27:05.330151Z
717372
salzburg
4525493e-7705-40b1-a816-d608a930855b
requirements
file
2017-10-10T18:36:06.000000Z
2fc73822f00bb6333f47ab599468ec70
2016-01-12T15:27:05.330151Z
717372
salzburg
602
package TrkDigEvent
author <Andreas.Salzburger@cern.ch>
# public dependencies
public
use AtlasPolicy AtlasPolicy-*
use GeoPrimitives GeoPrimitives-* DetectorDescription
use TrkSurfaces TrkSurfaces-* Tracking/TrkDetDescr
use TrkDetDescrUtils TrkDetDescrUtils-* Tracking/TrkDetDescr
private
public
library TrkDigEvent *.cxx
apply_pattern installed_library
private
#macro cppdebugflags '$(cppdebugflags_s)'
#macro_remove componentshr_linkopts "-Wl,-s"
macro DOXYGEN_IMAGE_PATH "../doc/images"
macro DOXYGEN_INLINE_INHERITED_MEMB "YES"
package TrkDigEvent
author <Andreas.Salzburger@cern.ch>
# public dependencies
public
use AtlasPolicy AtlasPolicy-*
use GeoPrimitives GeoPrimitives-* DetectorDescription
use TrkSurfaces TrkSurfaces-* Tracking/TrkDetDescr
use TrkDetDescrUtils TrkDetDescrUtils-* Tracking/TrkDetDescr
private
public
library TrkDigEvent *.cxx
apply_pattern installed_library
private
#macro cppdebugflags '$(cppdebugflags_s)'
#macro_remove componentshr_linkopts "-Wl,-s"
macro DOXYGEN_IMAGE_PATH "../doc/images"
macro DOXYGEN_INLINE_INHERITED_MEMB "YES"
10
dir
811013
svn+ssh://svn.cern.ch/reps/atlasoff/Tracking/TrkDigitization/TrkDigEvent/tags/TrkDigEvent-00-00-02/src
svn+ssh://svn.cern.ch/reps/atlasoff
2016-11-16T18:28:29.588301Z
784667
ffabbri
4525493e-7705-40b1-a816-d608a930855b
TrapezoidSegmentation.cxx
file
2017-10-10T18:36:06.000000Z
d8cc7c6f03234a120487c5c71b62f2c9
2016-01-20T14:25:53.149023Z
718774
ncalace
9333
RectangleSegmentation.cxx
file
2017-10-10T18:36:06.000000Z
549e318c69ca34825d7925f70ff8faf2
2016-11-16T18:28:29.588301Z
784667
ffabbri
13590
DigitizationModule.cxx
file
2017-10-10T18:36:06.000000Z
713a54038cee4bcebc160767f5c3cfdd
2016-09-01T15:35:22.256228Z
771332
salzburg
3600
//////////////////////////////////////////////////////////////////
// DigitizationModule.cxx, ATLAS Detector software
///////////////////////////////////////////////////////////////////
#include "TrkDigEvent/DigitizationModule.h"
Trk::DigitizationModule::DigitizationModule(std::shared_ptr<const Segmentation> moduleSegmentation,
double halfThickness,
int readoutDirection,
double lorentzAngle) :
m_halfThickness(halfThickness),
m_readoutDirection(readoutDirection),
m_lorentzAngle(lorentzAngle),
m_tanLorentzAngle(tan(lorentzAngle)),
m_segmentation(moduleSegmentation),
m_boundarySurfaces(),
m_segmentationSurfacesX(),
m_segmentationSurfacesY()
{
m_segmentation->createSegmenationSurfaces(m_boundarySurfaces,
m_segmentationSurfacesX,
m_segmentationSurfacesY,
halfThickness,
readoutDirection,
lorentzAngle);
}
const std::vector< std::shared_ptr<const Trk::Surface> > Trk::DigitizationModule::segmentationSurfaces(const Trk::DigitizationCell& entryCids, const Trk::DigitizationCell& exitCids) const
{
std::vector< std::shared_ptr<const Trk::Surface> > sSurfaces;
int startbinX = entryCids.first;
int endbinX = exitCids.first;
// swap if needed
if (startbinX > endbinX) std::swap(startbinX,endbinX);
// now cash in the rest
for ( ; startbinX <= endbinX; ++startbinX)
sSurfaces.push_back(m_segmentationSurfacesX[startbinX]);
// start bin, end bin
int startbinY = entryCids.second;
int endbinY = exitCids.second;
// swap if needed
if (startbinY > endbinY) std::swap(startbinY,endbinY);
// now cash in the rest
for ( ; startbinY <= endbinY; ++startbinY)
sSurfaces.push_back(m_segmentationSurfacesY[startbinY]);
// return what you have
return sSurfaces;
}
const std::vector< std::shared_ptr<const Trk::Surface> > Trk::DigitizationModule::stepSurfaces(const Amg::Vector3D& start, const Amg::Vector3D& end) const
{
// prepare the return vector
std::vector< std::shared_ptr<const Trk::Surface> > stepSurfaces;
const Trk::DigitizationCell startCell = m_segmentation->cell(start);
const Trk::DigitizationCell endCell = m_segmentation->cell(end);
// go along x - first with the naive binning (i.e. w.o lorentz angle)
size_t sCellX = startCell.first;
size_t eCellX = endCell.first;
if (sCellX > eCellX) std::swap(sCellX,eCellX);
// now take the boundaries as well
if (sCellX > 0) --sCellX;
++eCellX;
// the surfaces along Y are easy, just the bin surfaces
size_t sCellY = startCell.second;
size_t eCellY = endCell.second;
if (sCellY > eCellY) std::swap(sCellY,eCellY);
// reserve - be safe
stepSurfaces.reserve((eCellY-sCellY)+(eCellX-sCellX)+2);
// now fill the x surfaces
for ( ; sCellX <= eCellX && sCellX < m_segmentationSurfacesX.size(); ++sCellX)
stepSurfaces.push_back(m_segmentationSurfacesX[sCellX]);
// end fill the y surfaces
for ( ; sCellY <= eCellY && sCellY < m_segmentationSurfacesY.size(); ++sCellY)
stepSurfaces.push_back(m_segmentationSurfacesY[sCellY]);
// return the lot
return stepSurfaces;
}
//////////////////////////////////////////////////////////////////
// RectangularSegmentation.cxx, ATLAS Detector software
///////////////////////////////////////////////////////////////////
// Trk includes
#include "TrkDigEvent/RectangularSegmentation.h"
#include "TrkDetDescrUtils/SharedObject.h"
#include "TrkSurfaces/PlaneSurface.h"
#include "TrkSurfaces/RectangleBounds.h"
// Amg includes
#include "GeoPrimitives/GeoPrimitivesHelpers.h"
Trk::RectangularSegmentation::RectangularSegmentation(std::shared_ptr<const Trk::RectangleBounds> mBounds,
size_t numCellsX, size_t numCellsY) :
m_activeBounds(mBounds),
m_binUtility(nullptr),
m_binsX(numCellsX),
m_binsY(numCellsY)
{
// first the x dimension if needed
if (numCellsX > 1)
m_binUtility = new Trk::BinUtility(numCellsX, -mBounds->halflengthX(), mBounds->halflengthX(), Trk::open, Trk::binX);
// use y dimension if needed
if (numCellsY > 1){
Trk::BinUtility yBinUtility(numCellsY, -mBounds->halflengthY(), mBounds->halflengthY(), Trk::open, Trk::binY);
if (m_binUtility)
(*m_binUtility) += yBinUtility;
else
m_binUtility = new Trk::BinUtility(yBinUtility);
}
}
/** Constructor for ATLAS module type pixels */
Trk::RectangularSegmentation::RectangularSegmentation(std::shared_ptr<const Trk::RectangleBounds> mBounds, size_t numCellsX, double longY, size_t numCellsY, double numberOfChip):
m_activeBounds(mBounds),
m_binUtility(nullptr),
m_binsX(numCellsX),
m_binsY(numCellsY)
{
// first the x dimension if needed
if (numCellsX > 1)
m_binUtility = new Trk::BinUtility(numCellsX, -mBounds->halflengthX(), mBounds->halflengthX(), Trk::open, Trk::binX);
// use y dimension if needed
if (numCellsY > 1){
int numCellsYinChip = numCellsY/numberOfChip;
double begin = -mBounds->halflengthY();
double end = (2. * mBounds->halflengthY() / numberOfChip) - mBounds->halflengthY();
std::vector<float> boundaries;
boundaries.push_back(begin);
for (int i = 0; i< numberOfChip; i++){
Trk::BinUtility SmallBinUtility((size_t) numCellsYinChip-2, begin+longY, end-longY, Trk::open, Trk::binY);
boundaries.insert(boundaries.end(), SmallBinUtility.binningData().at(0).boundaries.begin(), SmallBinUtility.binningData().at(0).boundaries.end());
boundaries.push_back(end);
begin=end;
end+=(2 * mBounds->halflengthY() / numberOfChip);
}
if (boundaries.size() != numCellsY+1) exit(1);
Trk::BinUtility yBinUtility(boundaries, Trk::open, Trk::binY);
if (m_binUtility)
(*m_binUtility) += yBinUtility;
else
m_binUtility = new Trk::BinUtility(yBinUtility);
boundaries.clear();
}
}
Trk::RectangularSegmentation::~RectangularSegmentation()
{
delete m_binUtility;
}
void Trk::RectangularSegmentation::createSegmenationSurfaces(std::vector< std::shared_ptr< const Trk::Surface> >& boundarySurfaces,
std::vector< std::shared_ptr< const Trk::Surface> >& segmentationSurfacesX,
std::vector< std::shared_ptr< const Trk::Surface> >& segmentationSurfacesY,
double halfThickness,
int readoutDirection,
double lorentzAngle) const
{
// may be needed throughout
double lorentzAngleTan = tan(lorentzAngle);
double lorentzPlaneShiftX = halfThickness*lorentzAngleTan;
// (A) --- top/bottom surfaces -----------------------------------------------------------
// let's create the top/botten surfaces first - we call them readout / counter readout
// there are some things to consider
// - they share the RectangleBounds only if the lorentzAngle is 0, otherwise only the readout surface has full length bounds like the module
Trk::SharedObject<const Trk::SurfaceBounds> moduleBounds(new Trk::RectangleBounds(m_activeBounds->halflengthX(),m_activeBounds->halflengthY()));
// - they are separated by half a thickness in z
Amg::Transform3D* readoutPlaneTransform = new Amg::Transform3D(Amg::Transform3D::Identity());
Amg::Transform3D* counterPlaneTransform = new Amg::Transform3D(Amg::Transform3D::Identity());
// readout and counter readout bounds, the bounds of the readout plane are like the active ones
Trk::SharedObject<const Trk::SurfaceBounds> readoutPlaneBounds = moduleBounds;
Trk::SharedObject<const Trk::SurfaceBounds> counterPlaneBounds(nullptr);
// the transform of the readout plane is always centric
(*readoutPlaneTransform).translation() = Amg::Vector3D(0.,0.,readoutDirection*halfThickness);
// no lorentz angle and everything is straight-forward
if (lorentzAngle == 0.){
counterPlaneBounds = moduleBounds;
(*counterPlaneTransform).translation() = Amg::Vector3D(0.,0.,-readoutDirection*halfThickness);
} else {
// lorentz reduced Bounds
double lorentzReducedHalfX = m_activeBounds->halflengthX() - fabs(lorentzPlaneShiftX);
Trk::SharedObject<const Trk::SurfaceBounds> lorentzReducedBounds(new Trk::RectangleBounds(lorentzReducedHalfX,m_activeBounds->halflengthY()));
counterPlaneBounds = lorentzReducedBounds;
// now we shift the counter plane in position - this depends on lorentz angle
double counterPlaneShift = -readoutDirection*lorentzPlaneShiftX;
(*counterPlaneTransform).translation() = Amg::Vector3D(counterPlaneShift,0.,-readoutDirection*halfThickness);
}
// - build the readout & counter readout surfaces
boundarySurfaces.push_back(std::shared_ptr<const Trk::PlaneSurface>(new Trk::PlaneSurface(readoutPlaneTransform,readoutPlaneBounds)));
boundarySurfaces.push_back(std::shared_ptr<const Trk::PlaneSurface>(new Trk::PlaneSurface(counterPlaneTransform,counterPlaneBounds)));
// (B) - bin X and lorentz surfaces -----------------------------------------------------------
// easy stuff first, constant pitch size and
double pitchX = 2.*m_activeBounds->halflengthX()/m_binsX;
// now, let's create the SharedBounds of all surfaces marking x bins - choice fixes orientation of the matrix
Trk::SharedObject<const Trk::SurfaceBounds> xBinBounds(new Trk::RectangleBounds(m_activeBounds->halflengthY(),halfThickness));
// now, let's create the SharedBounds of all surfaces marking lorentz planes
double lorentzPlaneHalfX = fabs(halfThickness/cos(lorentzAngle));
// teh bounds of the lorentz plane
Trk::SharedObject<const Trk::SurfaceBounds> lorentzPlaneBounds = (lorentzAngle==0.) ? xBinBounds :
Trk::SharedObject<const Trk::SurfaceBounds>(new Trk::RectangleBounds(m_activeBounds->halflengthY(),lorentzPlaneHalfX));
// now the rotation matrix for the xBins
Amg::RotationMatrix3D xBinRotationMatrix;
xBinRotationMatrix.col(0) = Amg::Vector3D::UnitY();
xBinRotationMatrix.col(1) = Amg::Vector3D::UnitZ();
xBinRotationMatrix.col(2) = Amg::Vector3D::UnitX();
// now the lorentz plane rotation should be the xBin rotation, rotated by the lorentz angle around y
Amg::RotationMatrix3D lorentzPlaneRotationMatrix = (lorentzAngle !=0.) ?
xBinRotationMatrix * Amg::AngleAxis3D(lorentzAngle, Amg::Vector3D::UnitX()) : xBinRotationMatrix;
// reserve, it's always (number of bins-1) as the boundaries are within the boundarySurfaces
segmentationSurfacesX.reserve(m_binsX);
for (size_t ibinx = 0; ibinx <= m_binsX; ++ibinx){
// the current step x position
double cPosX = -m_activeBounds->halflengthX()+ibinx*pitchX;
// (i) this is the low/high boundary --- ( ibin == 0/m_binsX )
if (!ibinx || ibinx == m_binsX){
// check if it a straight boundary or not: always straight for no lorentz angle, and either the first boundary or the last dependening on lorentz & readout
bool boundaryStraight = (lorentzAngle == 0. || (!ibinx && readoutDirection*lorentzAngle > 0.) || (ibinx==m_binsX && readoutDirection*lorentzAngle < 0));
// set the low boundary parameters : position & rotation
Amg::Vector3D boundaryXPosition = boundaryStraight ? Amg::Vector3D(cPosX, 0.,0.) : Amg::Vector3D(cPosX-readoutDirection*lorentzPlaneShiftX, 0., 0.);
const Amg::RotationMatrix3D& boundaryXRotation = boundaryStraight ? xBinRotationMatrix : lorentzPlaneRotationMatrix;
// build the rotation from it
Amg::Transform3D* boundaryXTransform = new Amg::Transform3D(Amg::getTransformFromRotTransl(boundaryXRotation, boundaryXPosition));
// the correct bounds for this
Trk::SharedObject<const Trk::SurfaceBounds> boundaryXBounds = boundaryStraight ? xBinBounds : lorentzPlaneBounds;
// boundary surfaces
boundarySurfaces.push_back(std::shared_ptr<const Trk::PlaneSurface>(new Trk::PlaneSurface(boundaryXTransform,boundaryXBounds)));
// (ii) this is the in between bins --- ( 1 <= ibin < m_mbnsX )
} else {
// shift by the lorentz angle
Amg::Vector3D lorentzPlanePosition(cPosX-readoutDirection*lorentzPlaneShiftX, 0., 0.);
Amg::Transform3D* lorentzPlaneTransform = new Amg::Transform3D(Amg::getTransformFromRotTransl(lorentzPlaneRotationMatrix,lorentzPlanePosition));
// lorentz plane surfaces
segmentationSurfacesX.push_back(std::shared_ptr<const Trk::PlaneSurface>(new Trk::PlaneSurface(lorentzPlaneTransform,lorentzPlaneBounds)));
}
}
// (C) - bin Y surfaces - everything is defined -----------------------------------------------------------
// now the rotation matrix for the yBins - anticyclic
Amg::RotationMatrix3D yBinRotationMatrix;
yBinRotationMatrix.col(0) = Amg::Vector3D::UnitX();
yBinRotationMatrix.col(1) = Amg::Vector3D::UnitZ();
yBinRotationMatrix.col(2) = Amg::Vector3D(0.,-1.,0.);
// easy stuff first, constant pitch in Y
double pitchY = 2.*m_activeBounds->halflengthY()/m_binsY;
// let's create the SharedBounds of all surfaces marking y bins
Trk::SharedObject<const Trk::SurfaceBounds> yBinBounds(new Trk::RectangleBounds(m_activeBounds->halflengthX(),halfThickness));
// reserve, it's always (number of bins-1) as the boundaries are within the boundarySurfaces
segmentationSurfacesY.reserve(m_binsY);
for (size_t ibiny = 0; ibiny <= m_binsY; ++ibiny){
// the position of the bin surface
//Use the bin utility to find center of different surfaces
double binPosY = m_binUtility->binningData().at(1).boundaries[ibiny];
//double binPosY = -m_activeBounds->halflengthY()+ibiny*pitchY;
Amg::Vector3D binSurfaceCenter(0.,binPosY,0.);
Amg::Transform3D* binTransform = new Amg::Transform3D(Amg::getTransformFromRotTransl(yBinRotationMatrix,binSurfaceCenter));
// these are the boundaries
if (ibiny == 0 || ibiny == m_binsY)
boundarySurfaces.push_back(std::shared_ptr<Trk::PlaneSurface>(new Trk::PlaneSurface(binTransform,yBinBounds)));
else // these are the bin boundaries
segmentationSurfacesY.push_back(std::shared_ptr<Trk::PlaneSurface>(new Trk::PlaneSurface(binTransform,yBinBounds)));
}
}
const Amg::Vector2D Trk::RectangularSegmentation::cellPosition(const DigitizationCell& dCell) const
{
// use the bin utility for this job
double bX = m_binsX ? m_binUtility->binPosition(dCell.first,0.,0) : 0.;
double bY = m_binsY ? m_binUtility->binPosition(dCell.second,0.,1) : 0.;
return Amg::Vector2D(bX,bY);
}
/** Get the digitization cell from 3D position, it used the projection to the readout surface to estimate the 2D positon */
const Trk::DigitizationStep Trk::RectangularSegmentation::digitizationStep(const Amg::Vector3D& startStep,
const Amg::Vector3D& endStep,
double halfThickness,
int readoutDirection,
double lorentzAngle) const
{
Amg::Vector3D stepCenter = 0.5*(startStep+endStep);
// take the full drift length
// this is the absolute drift in z
double driftInZ = halfThickness-readoutDirection*stepCenter.z();
// this is the absolute drift length
double driftLength = driftInZ/cos(lorentzAngle);
// project to parameter the readout surface
double lorentzDeltaX = readoutDirection*driftInZ*tan(lorentzAngle);
// the projected center, it has the lorentz shift applied
Amg::Vector2D stepCenterProjected(stepCenter.x()+lorentzDeltaX,stepCenter.y());
// the cell & its center
Trk::DigitizationCell dCell = cell(stepCenterProjected);
Amg::Vector2D cellCenter = cellPosition(dCell);
// we are ready to return what we have
return Trk::DigitizationStep((endStep-startStep).mag(),driftLength,dCell,startStep,endStep,stepCenterProjected,cellCenter);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment