21 const IInterface* parent)
40 return StatusCode::SUCCESS;
46 for(
long unsigned int i=0;i<HitCollections.size();++i){
48 ATH_CHECK(HitsWriteHandles[i].record(std::make_unique<SiHitCollection>(HitCollections[i])));
51 return StatusCode::SUCCESS;
56 return StatusCode::SUCCESS;
60 std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry,
61 const std::vector<ActsFatras::Hit>& hits,
64 ATH_MSG_VERBOSE(name() <<
" particle " << isp <<
" with " << hits.size() <<
" hits");
70 auto hit_geoid = hit.geometryId();
73 auto acts_surface = trackingGeometry->findSurface(hit_geoid);
78 const Trk::Surface& hitSurface = acts_de->atlasSurface();
82 ATH_MSG_VERBOSE(name() <<
" hit Id Acts|atlas: "<< hit_geoid <<
"|" << hitId);
85 ATH_MSG_VERBOSE(name() <<
" hit position global Acts|atlas: " << hit.position() <<
"|" << detElementBase->
center());
93 double thickness = hitSiDetElement->
thickness();
100 Amg::Vector3D localDirection = sTransform.inverse().linear() * particleDir;
101 localDirection *= thickness/cos(localDirection.theta());
103 int movingDirection = localDirection.z() > 0. ? 1 : -1;
105 double distX = localDirection.x();
106 double distY = localDirection.y();
108 double localEntryX = interX-0.5*distX;
109 double localEntryY = interY-0.5*distY;
110 double localExitX = interX+0.5*distX;
111 double localExitY = interY+0.5*distY;
114 Amg::Vector3D localEntry(hitTransform * (sTransform *
Amg::Vector3D(localEntryX,localEntryY,-0.5*movingDirection*thickness)));
116 const HepGeom::Point3D<double> localEntryHep( localEntry.x(), localEntry.y(), localEntry.z() );
117 const HepGeom::Point3D<double> localExitHep( localExit.x(), localExit.y(), localExit.z() );
119 auto isPixel=hitSiDetElement->
isPixel();
120 ATH_MSG_VERBOSE(name() <<
" localEntryHep|localExitHep (atlas)" << localEntryHep <<
"|" << localExitHep);
127 auto truth_barcode = isp.
barcode();
128 auto siHit =
SiHit(localEntryHep,
143 ATH_MSG_VERBOSE(name() <<
" convert and store 1 hit, total " << pixelSiHits.
size() <<
" Pixel | "<<sctSiHits.
size()<<
" SCT hits stored for particle" << isp);
145 catch (
const std::exception& e){
146 ATH_MSG_DEBUG(name() <<
"Can not find Acts Surface (" << e.what() <<
")...Skip...");
const ActsDetectorElement * getActsDetectorElement(const Acts::Surface &surf)
Attempts to retrieve the ActsDetectorElement associated to the passed ActsSurface.
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
AtlasHitsVector< SiHit > SiHitCollection
size_t size() const
Number of registered mappings.
StatusCode WriteHits(std::vector< SiHitCollection > &HitCollections, const EventContext &ctx) const
SG::WriteHandleKeyArray< SiHitCollection > m_HitCollectionKeys
std::array< StringProperty, 2 > m_HitCollectionNames
virtual StatusCode initialize() override
const PixelID * m_pixIdHelper
the Pixel ID helper
void createHits(const ISF::ISFParticle &isp, std::shared_ptr< const Acts::TrackingGeometry > trackingGeometry, const std::vector< ActsFatras::Hit > &hits, SiHitCollection &pixelSiHits, SiHitCollection &sctSiHits) const
Loop over the hits and call the hit creator, provide the ActsFatras::Particle to create the hits.
virtual StatusCode finalize() override
const SCT_ID * m_sctIdHelper
the SCT ID helper
ActsFatrasWriteHandler(const std::string &, const std::string &, const IInterface *)
Constructor.
~ActsFatrasWriteHandler()
Destructor.
const ServiceHandle< StoreGateSvc > & detStore() const
void push_back(const T &t)
The generic ISF particle definition,.
int barcode() const
the barcode
Class to hold geometrical description of a silicon detector element.
const GeoTrf::Transform3D & transformHit() const
Local (simulation/hit frame) to global transform.
Abstract Base Class for tracking surfaces.
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const =0
Specified by each surface type: GlobalToLocal method without dynamic memory allocation - boolean chec...
const TrkDetElementBase * associatedDetectorElement() const
return associated Detector Element
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
virtual bool isOnSurface(const Amg::Vector3D &glopo, const BoundaryCheck &bchk=true, double tol1=0., double tol2=0.) const
This method returns true if the GlobalPosition is on the Surface for both, within or without check of...
Identifier associatedDetectorElementIdentifier() const
return Identifier of the associated Detector Element
const Amg::Vector3D & center() const
Returns the center position of the Surface.
This is the base class for all tracking detector elements with read-out relevant information.
virtual const Amg::Vector3D & center() const =0
Return the center of the element.
std::vector< std::string > intersection(std::vector< std::string > &v1, std::vector< std::string > &v2)
constexpr double energyToAthena(const double actsE)
Converts an energy scalar from Acts to Athena units.
constexpr double timeToAthena(T actsT)
Converts a time unit from Acts to Athena units.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D