8#include <tracking/trackFindingCDC/filters/track/CDCTrackDeadBoardFilter.h>
10#include <cdc/dataobjects/CDCHit.h>
11#include <cdc/geometry/CDCGeometryPar.h>
12#include <cdc/topology/CDCWire.h>
13#include <cdc/topology/CDCWireLayer.h>
15#include <tracking/trackingUtilities/rootification/StoreWrappedObjPtr.h>
16#include <tracking/trackingUtilities/eventdata/tracks/CDCTrack.h>
17#include <tracking/trackingUtilities/eventdata/hits/CDCRecoHit3D.h>
26 namespace TrackFindingCDC {
28 void addBoardCandsAtLayer(std::vector<unsigned int>& boardCands,
const Belle2::TrackingUtilities::Helix& globalHelix,
33 if (rLayer <= 0)
return;
36 if (std::isnan(arcLength))
return;
38 ROOT::Math::XYZVector pos3D = globalHelix.
atArcLength2D(arcLength);
41 double deltaPhi = 2. / rLayer;
43 for (
int i = -1; i <= 1; i++) {
44 ROOT::Math::XYZVector thisPos = pos3D;
45 VectorUtil::setPhi(thisPos, pos3D.Phi() + i * deltaPhi);
47 const auto board = geometryPar.getBoardID(WireID(iclayer, iWire));
48 boardCands.push_back(board);
53 bool cdcTrackDeadBoardFilter(
const Belle2::TrackingUtilities::CDCTrack& aCDCTrack,
int minJump)
56 Belle2::TrackingUtilities::StoreWrappedObjPtr< std::vector<unsigned int> > deadBoardsVectorPtr(
"CDCDeadBoardsVector");
58 if (not deadBoardsVectorPtr.isValid() || (*deadBoardsVectorPtr).size() == 0)
return false;
60 const std::vector<unsigned int>& deadBoardsVector = *deadBoardsVectorPtr;
66 Belle2::TrackingUtilities::Helix globalHelix = trajectory.getLocalHelix().helix();
67 auto localOrigin = trajectory.getLocalOrigin();
71 const Belle2::TrackingUtilities::CDCRecoHit3D* prevHitPtr =
nullptr;
72 for (
const Belle2::TrackingUtilities::CDCRecoHit3D& thisHit : aCDCTrack) {
74 prevHitPtr = &thisHit;
81 if (abs(iclayerPrev - iclayerThis) >= minJump) {
84 int dir = (iclayerThis - iclayerPrev) < 0 ? -1 : 1;
86 unsigned int newlayerThis = iclayerThis - dir * 3;
87 unsigned int newlayerPrev = iclayerPrev + dir * 3;
89 std::vector<unsigned int> boardCands;
90 boardCands.reserve(6);
91 addBoardCandsAtLayer(boardCands, globalHelix, newlayerThis, geometryPar);
92 addBoardCandsAtLayer(boardCands, globalHelix, newlayerPrev, geometryPar);
94 for (
auto iboard : boardCands) {
95 if (std::find(deadBoardsVector.begin(), deadBoardsVector.end(), iboard) != deadBoardsVector.end())
return true;
99 prevHitPtr = &thisHit;
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.
double getRefCylindricalR() const
Getter for the common (averaged) cylindrical radius at the wire reference point.
static const CDCWireLayer * getInstance(ILayer iCLayer)
Getter from the the continuous layer id. Does not construct a new object.
const CDCTrajectory3D & getStartTrajectory3D() const
Getter for the two dimensional trajectory.
double arcLength2DToCylindricalR(double cylindricalR) const
Calculates the two dimensional arc length that first reaches a cylindrical radius on the helix Return...
double passiveMoveBy(const ROOT::Math::XYZVector &by)
Moves the coordinates system by the given vector.
ROOT::Math::XYZVector atArcLength2D(double s) const
Calculates the point, which lies at the give perpendicular travel distance (counted from the perigee)
signed short IWire
The type of the wire ids enumerating wires within a given layer.
signed short ILayer
The type of the layer ids enumerating layers within a superlayer.
Abstract base class for different kinds of events.