24#include "Identifier/Identifier.h"
37 declareInterface<IInDetTestPixelLayerTool>(
this);
47 return StatusCode::FAILURE;
52 return StatusCode::FAILURE;
57 return StatusCode::FAILURE;
61 !m_pixelDetElStatus.empty() && !VALIDATE_STATUS_ARRAY_ACTIVATED }));
64 return StatusCode::SUCCESS;
71 bool checkBarrelOnly)
const
78 ATH_MSG_WARNING(
"Found Track with no perigee parameters: no b-layer info "
89 const EventContext& ctx,
91 int pixel_layer)
const
100 "Not a valid TrackParticle: no b-layer info will be provided");
110 "b-layer info will be provided");
121 const EventContext& ctx,
124 bool checkBarrelOnly)
const
126 bool expect_hit =
false;
128 std::vector<std::unique_ptr<const Trk::TrackParameters>> pixelLayerParam;
135 for (std::unique_ptr<const Trk::TrackParameters>& p : pixelLayerParam) {
137 if (!(p->associatedSurface().associatedDetectorElement()))
140 p->associatedSurface().associatedDetectorElement()->identify();
142 if (checkBarrelOnly && !
m_pixelId->is_barrel(
id))
continue;
143 if (
m_pixelId->layer_disk(
id) != pixel_layer)
continue;
146 pixelDetElStatus->isGood(p->associatedSurface().associatedDetectorElement()->identifyHash()),
150 pixelDetElStatus->isGood(p->associatedSurface().associatedDetectorElement()->identifyHash())) ||
168 ATH_MSG_DEBUG(
"b-layer in dead region: fracGood = " << fracGood);
172 ATH_MSG_DEBUG(
"Condition Summary: not checking dead regions");
179 "Condition Summary: b-layer good but outside active area");
185 "Condition Summary: b-layer good, active areas not checked");
209 const EventContext& ctx = Gaudi::Hive::currentContext();
228 ATH_MSG_DEBUG(
"b-layer in dead region: fracGood = " << fracGood);
232 ATH_MSG_DEBUG(
"Condition Summary: not checking dead regions");
245 int pixel_layer)
const
250 ATH_MSG_WARNING(
"Found Track with no perigee parameters: no b-layer info "
251 "will be provided ");
262 int pixel_layer)
const
264 std::vector<std::unique_ptr<const Trk::TrackParameters>> pixelLayerParam;
269 bool found_layer =
false;
270 for (std::unique_ptr<const Trk::TrackParameters>& p : pixelLayerParam) {
271 if (!(p->associatedSurface().associatedDetectorElement()))
274 p->associatedSurface().associatedDetectorElement()->identify();
276 if (
m_pixelId->layer_disk(
id) == pixel_layer){
287 const EventContext& ctx = Gaudi::Hive::currentContext();
290 for (std::unique_ptr<const Trk::TrackParameters>& p : pixelLayerParam) {
292 if (!(p->associatedSurface().associatedDetectorElement()))
295 p->associatedSurface().associatedDetectorElement()->identify();
297 if (
m_pixelId->layer_disk(
id) != pixel_layer)
305 pixelDetElStatus->isGood(p->associatedSurface().associatedDetectorElement()->identifyHash())) ||
315 "Condition Summary: b-layer good but outside active area");
338 if (siElement ==
nullptr) {
340 ATH_MSG_DEBUG(
"TrackParameters do not belong to a Si Element");
345 if (trackpar->covariance()) {
352 ATH_MSG_DEBUG(
"---> extrapolation on bond gap within " << etatol
354 }
else if (!siIn.
in()) {
355 ATH_MSG_DEBUG(
"---> extrapolation not inside (active?) detector within "
356 << phitol <<
" " << etatol <<
", return");
368 std::vector<TrackStateOnPixelLayerInfo>& infoList)
const
371 std::unique_ptr<const Trk::TrackParameters> startParameters =
nullptr;
373 if (track->perigeeParameters()) {
374 startParameters = track->perigeeParameters()->uniqueClone();
375 }
else if (track->trackParameters()->front()) {
378 Gaudi::Hive::currentContext(),
379 *(track->trackParameters()->front()),
385 if (!startParameters) {
386 ATH_MSG_WARNING(
"Found Track with no perigee parameters: no b-layer info "
398 std::vector<TrackStateOnPixelLayerInfo>& infoList)
const
403 if (!startParameters) {
405 "b-layer info will be provided");
415 std::vector<TrackStateOnPixelLayerInfo>& infoList,
417 bool checkBarrelOnly)
const
422 std::vector<std::unique_ptr<const Trk::TrackParameters>> pixelLayerParam;
426 const EventContext& ctx = Gaudi::Hive::currentContext();
429 for (std::unique_ptr<const Trk::TrackParameters>& trkParam :
440 trkParam->associatedSurface().associatedDetectorElement()->identify();
443 if (checkBarrelOnly && !
m_pixelId->is_barrel(
id))
continue;
444 if (
m_pixelId->layer_disk(
id) != pixel_layer)
continue;
446 const auto* tmp = trkParam->associatedSurface().associatedDetectorElement();
453 ATH_MSG_WARNING(
"Failed to cast TrackParameters associated surface to "
454 "SiDetectorElement");
460 pixelLayerInfo.
pixelId(holeId_c);
462 double etaDist = -9999;
463 double phiDist = -9999;
474 <<
", returning false for getTrackStateOnPixelLayerInfo");
488 float error_locx = -9999;
489 float error_locy = -9999;
491 if (trkParam->covariance()) {
504 pixelDetElStatus->isGood(trkParam->associatedSurface().associatedDetectorElement()->identifyHash()),
508 pixelDetElStatus->isGood(trkParam->associatedSurface().associatedDetectorElement()->identifyHash())) ||
514 if (trkParam->covariance()) {
520 bool isIn = siIn.
in();
524 pixelLayerInfo.
type(insideGoodModule);
526 pixelLayerInfo.
type(nearGoodModuleEdge);
529 pixelLayerInfo.
type(insideBadModule);
531 pixelLayerInfo.
type(nearBadModuleEdge);
534 infoList.push_back(pixelLayerInfo);
542 const EventContext& ctx,
544 std::vector<std::unique_ptr<const Trk::TrackParameters>>& pixelLayerParam)
550 if(std::abs(trackpar->
position().z())>5000.){
551 ATH_MSG_DEBUG(
"Pathological track parameter well outside of tracking detector");
552 ATH_MSG_DEBUG(
"Propagator might have issue with this, discarding");
558 surfTrans.setIdentity();
562 std::vector<std::unique_ptr<Trk::TrackParameters>> paramList =
566 if (paramList.empty()) {
573 " Number of generated parameters by propagator: " << paramList.size());
576 for (std::unique_ptr<Trk::TrackParameters>& p : paramList) {
580 if (!(p->associatedSurface().associatedDetectorElement() !=
nullptr &&
581 p->associatedSurface().associatedDetectorElement()->identify() !=
586 id = p->associatedSurface().associatedDetectorElement()->identify();
593 pixelLayerParam.push_back(std::move(p));
602 double phiRegionSize,
603 double etaRegionSize,
611 const EventContext& ctx = Gaudi::Hive::currentContext();
613 bool is_good ( ( pixelDetElStatus && pixelDetElStatus->
isGood(id_hash))
621 double error_locx = -9999;
622 double error_locy = -9999;
624 if (trkParam->covariance()) {
633 if (trkParam->covariance()) {
634 phitol = phiRegionSize * error_locx;
635 etatol = etaRegionSize * error_locy;
648 "Failed to cast TrackParameters associated surface to SiDetectorElement");
655 phitol = std::max(phitol, design->
phiPitch() + 1e-6);
656 etatol = std::max(etatol, design->
etaPitch() + 1e-6);
659 "could not get pixel module design, returning 0 for getFracGood");
665 double startLocX = locx - phitol;
666 double startLocY = locy - etatol;
668 double endLocX = locx + phitol;
669 double endLocY = locy + etatol;
674 double etaDist = -9999;
675 double phiDist = -9999;
680 locx += (std::abs(phiDist) + 1e-6);
682 locy += (std::abs(etaDist) + 1e-6);
685 startLocX += (std::abs(phiDist) + 1e-6);
687 startLocY += (std::abs(etaDist) + 1e-6);
690 endLocX -= (std::abs(phiDist) + 1e-6);
692 endLocY -= (std::abs(etaDist) + 1e-6);
702 std::array<InDetDD::PixelDiodeTree::CellIndexType,2> diode_idx(si_param.
computeIndex(LocPos));
708 std::uint32_t feValue = design->
getFE(si_param);
710 pixelDetElStatus->
isChipGood(id_hash, feValue),
713 pixelDetElStatus->
isChipGood(id_hash, feValue)) ||
735 if (pixelDetElStatus) {
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
This is an Identifier helper class for the Pixel subdetector.
#define VALIDATE_STATUS_ARRAY(use_info, info_val, summary_val)
const ServiceHandle< StoreGateSvc > & detStore() const
This is a "hash" representation of an Identifier.
bool is_valid() const
Check if id is in a valid state.
Class used to describe the design of a module (diode segmentation and readout scheme)
PixelDiodeTree::DiodeProxyWithPosition diodeProxyFromIdxCachePosition(const std::array< PixelDiodeTree::IndexType, 2 > &idx) const
virtual void distanceToDetectorEdge(const SiLocalPosition &localPosition, double &etaDist, double &phiDist) const
Returns distance to nearest detector active edge +ve = inside -ve = outside.
PixelDiodeTree::DiodeProxy diodeProxyFromPosition(const Amg::Vector2D &pos) const
virtual double etaPitch() const
Pitch in eta direction.
static unsigned int getFE(const PixelDiodeTree::DiodeProxy &diode_proxy)
virtual double phiPitch() const
Pitch in phi direction.
Class to hold geometrical description of a silicon detector element.
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
bool nearBondGap(const Amg::Vector2D &localPosition, double etaTol) const
Test if near bond gap within tolerances.
class to run intersection tests
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
SiIntersect inDetector(const Amg::Vector2D &localPosition, double phiTol, double etaTol) const
Test that it is in the active region.
Identifier identifierOfPosition(const Amg::Vector2D &localPos) const
Full identifier of the cell for a given position: assumes a raw local position (no Lorentz shift)
bool isChipGood(IdentifierHash hash, unsigned int chip) const
bool isGood(IdentifierHash hash) const
double distToModuleEdgePhi() const
Identifier moduleId() const
TrackStateOnPixelLayerType type() const
double goodFraction() const
Identifier pixelId() const
const Amg::Vector3D & globalPosition() const
double distToModuleEdgeEta() const
const_pointer_type cptr()
Dereference the pointer.
Class for a CylinderSurface in the ATLAS detector.
const Amg::Vector3D & position() const
Access method for the position.
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
Amg::Vector2D localPosition() const
Access method for the local coordinates, local parameter definitions differ for each surface type.
Class describing the Line to which the Perigee refers to.
const TrkDetElementBase * associatedDetectorElement() const
return associated Detector Element
virtual IdentifierHash identifyHash() const =0
Identifier hash.
virtual Identifier identify() const =0
Identifier.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 2, 1 > Vector2D
double getGoodFraction(const InDet::SiDetectorElementStatus &pixelDetElStatus, const InDetDD::PixelModuleDesign &design, const PixelID &pixelID, const IdentifierHash &modulIdHash, const Identifier &startId, const Identifier &endId)
Get The fraction of good chips the pixel of a pixel array is connected to.
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
ParametersBase< TrackParametersDim, Charged > TrackParameters
A diode proxy which caches the position of a diode.
Helper class to access parameters of a diode.
std::array< PixelDiodeTree::CellIndexType, 2 > computeIndex(const Vector2D &pos) const
Compute the full 2D index (row, column) of the diode in the full diode matrix.
bool isValid() const
return true if this proxy refers to a valide diode