ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
TrkDriftCircleMath::CurvedSegmentFinder Class Reference

#include <CurvedSegmentFinder.h>

Collaboration diagram for TrkDriftCircleMath::CurvedSegmentFinder:

Public Member Functions

 CurvedSegmentFinder (int debugLevel)
 
 ~CurvedSegmentFinder ()=default
 
void setMaxCurvatureParameters (double maxDeltaAlpha, double maxDeltab)
 
void curvedSegments (const ChamberGeometry &mdtGeo, SegVec &Segs) const
 

Private Attributes

int m_debugLevel {0}
 
double m_maxDeltaAlpha {0.1}
 
double m_maxDeltab {3.}
 

Detailed Description

Definition at line 20 of file CurvedSegmentFinder.h.

Constructor & Destructor Documentation

◆ CurvedSegmentFinder()

TrkDriftCircleMath::CurvedSegmentFinder::CurvedSegmentFinder ( int  debugLevel)
inline

Definition at line 22 of file CurvedSegmentFinder.h.

◆ ~CurvedSegmentFinder()

TrkDriftCircleMath::CurvedSegmentFinder::~CurvedSegmentFinder ( )
default

Member Function Documentation

◆ curvedSegments()

void TrkDriftCircleMath::CurvedSegmentFinder::curvedSegments ( const ChamberGeometry mdtGeo,
SegVec Segs 
) const

Definition at line 10 of file CurvedSegmentFinder.cxx.

10  {
11  int nCurved = 0;
12  // collect all the ML1 and ML2 only segments
13  SegVec ml1segs, ml2segs;
14  for (auto & seg : segs) {
15  int isBarrel = seg.dcs()[0].id().isBarrel();
16  if (!isBarrel) continue;
17 
18  if (seg.hitsMl2() == 0) {
19  ml1segs.push_back(seg);
20  } else if (seg.hitsMl1() == 0) {
21  ml2segs.push_back(seg);
22  }
23  }
24  // check that both ML have segments
25  if (ml1segs.empty() || ml2segs.empty()) return;
26  // Chamber information needed to calculate Delta b
27  const LocVec2D& ml1LocVec2D = mdtGeo.tubePosition(0, mdtGeo.nlay(), 0);
28  const LocVec2D& ml2LocVec2D = mdtGeo.tubePosition(1, 1, 0);
29  double chamberMidPtY = (ml1LocVec2D.y() + ml2LocVec2D.y()) / 2.0;
30  // loop over the ML segments and find matches
31  if (m_debugLevel >= 10)
32  std::cout << "CurvedSegmentsFinder begining match with " << ml1segs.size() << " ML1 segments and " << ml2segs.size()
33  << " ML2 segments" << std::endl;
34  for (auto & ml1seg : ml1segs) {
35  // bool foundCurvedSeg = false;
36  const double tanML1 = std::tan(ml1seg.line().phi());
37  const double mid1 = (chamberMidPtY - ml1seg.line().position().y()) / tanML1 + ml1seg.line().position().x();
38  const double y01 = ml1seg.line().position().y() - ml1seg.line().position().x() * tanML1;
39  for (auto & ml2seg : ml2segs) {
40  // angle between the 2 segments
41  const double deltaAlpha = ml1seg.line().phi() - ml2seg.line().phi();
42  // distance of closest approach between the 2 segments at the middle of chamber
43  const double tanML2 = std::tan(ml2seg.line().phi());
44 
45  const double mid2 = (chamberMidPtY - ml2seg.line().position().y()) / tanML2 + ml2seg.line().position().x();
46  const double y02 = ml2seg.line().position().y() - ml2seg.line().position().x() * tanML2;
47  double deltab = (mid2 * tanML1 - chamberMidPtY + y01) / std::hypot(1, tanML1);
48  const double deltab2 = (mid1 * tanML2 - chamberMidPtY + y02) / std::hypot(1, tanML2);
49  if (std::abs(deltab2) < std::abs(deltab)) deltab = deltab2;
50  if (std::abs(deltaAlpha) >= m_maxDeltaAlpha || std::abs(deltab) >= m_maxDeltab) continue;
51  ++nCurved;
52 
53  // foundCurvedSeg = true;
54  if (m_debugLevel >= 10)
55  std::cout << "CurvedSegment combination found with parameters (DeltaAlpha,Deltab) = (" << deltaAlpha << ", "
56  << deltab << ")" << std::endl;
57  // build the curved segment
58  DCOnTrackVec dcs = ml1seg.dcs();
59  dcs.insert(dcs.end(), ml2seg.dcs().begin(), ml2seg.dcs().end());
60  double segChi2 = ml1seg.chi2() + ml2seg.chi2();
61  double segNDoF = ml1seg.ndof() + ml2seg.ndof();
62  Segment seg(ml1seg.line(), dcs, segChi2, segNDoF, ml1seg.dtheta(), ml1seg.dy0());
63  // find the x coordinate of at the middle of the chamber for ml2 segment
64  const double xb = ml2seg.line().position().x() - (ml2seg.line().position().y() - chamberMidPtY) / tan(ml2seg.line().phi());
65  // set the curvature parameters
66  seg.setCurvatureParameters(deltaAlpha, xb);
67  // hit information
68  seg.deltas(ml1seg.deltas() + ml2seg.deltas());
69  seg.hitsOutOfTime(ml1seg.hitsOutOfTime() + ml2seg.hitsOutOfTime());
70  seg.hitsOnTrack(ml1seg.hitsOnTrack() + ml2seg.hitsOnTrack());
71  seg.hitsPerMl(ml1seg.hitsMl1(), ml2seg.hitsMl2());
72  seg.closeHits(ml1seg.closeHits() + ml2seg.closeHits());
73 
74  // store the new segment
75  segs.push_back(seg);
76  // remove the ML2 segment from the list
77  // ml2segs.erase( ml2 );
78  // break;
79  }
80  } // end loop on ml2
81  if (m_debugLevel >= 5) std::cout << "Finished CurvedSegments Finding, and found " << nCurved << " CurvedSegments" << std::endl;
82  }

◆ setMaxCurvatureParameters()

void TrkDriftCircleMath::CurvedSegmentFinder::setMaxCurvatureParameters ( double  maxDeltaAlpha,
double  maxDeltab 
)
inline

Definition at line 26 of file CurvedSegmentFinder.h.

26  {
27  m_maxDeltaAlpha = maxDeltaAlpha;
28  m_maxDeltab = maxDeltab;
29  }

Member Data Documentation

◆ m_debugLevel

int TrkDriftCircleMath::CurvedSegmentFinder::m_debugLevel {0}
private

Definition at line 33 of file CurvedSegmentFinder.h.

◆ m_maxDeltaAlpha

double TrkDriftCircleMath::CurvedSegmentFinder::m_maxDeltaAlpha {0.1}
private

Definition at line 34 of file CurvedSegmentFinder.h.

◆ m_maxDeltab

double TrkDriftCircleMath::CurvedSegmentFinder::m_maxDeltab {3.}
private

Definition at line 35 of file CurvedSegmentFinder.h.


The documentation for this class was generated from the following files:
TrkDriftCircleMath::DCOnTrackVec
std::vector< DCOnTrack > DCOnTrackVec
Definition: DCOnTrack.h:59
TrkDriftCircleMath::CurvedSegmentFinder::m_maxDeltab
double m_maxDeltab
Definition: CurvedSegmentFinder.h:35
Trk::TrackState::Segment
@ Segment
Definition: TrackStateDefs.h:37
TrkDriftCircleMath::CurvedSegmentFinder::m_maxDeltaAlpha
double m_maxDeltaAlpha
Definition: CurvedSegmentFinder.h:34
DQHistogramMerge.debugLevel
debugLevel
Definition: DQHistogramMerge.py:40
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
DataModelTestDataCommonDict::xb
DMTest::CView::Pers_t xb
Definition: DataModelTestDataCommonDict.h:44
python.LArCondContChannels.isBarrel
isBarrel
Definition: LArCondContChannels.py:659
TrkDriftCircleMath::CurvedSegmentFinder::m_debugLevel
int m_debugLevel
Definition: CurvedSegmentFinder.h:33
TrkDriftCircleMath::SegVec
std::vector< Segment > SegVec
Definition: TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/Segment.h:122