ATLAS Offline Software
ROIMon.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // ********************************************************************
6 // NAME: CaloCellVecMon.cxx
7 //
8 // AUTHORS: F Spano' 06/15/2006
9 // ********************************************************************
10 #include "ROIMon.h"
11 
12 #include <algorithm>
13 #include <cmath>
14 #include <cstdint>
15 #include <functional>
16 #include <set>
17 
18 
19 using CLHEP::Hep3Vector;
20 
21 
22 // a reference for 2d distance of a point from a line is in
23 // http://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html
24 
26  : m_MinDist(0),
27  m_tileMuDeltaEta(0),
28  m_tileMuDeltaPhi(0)
29 {
30  m_myComTime=comtime;
32  m_theTime=-9999.;
33  m_theDistance=-9999.;
34 
35 }
36 
37 
38 ROIMon::~ROIMon()= default;
39 
40 
41 int ROIMon::Accept( const Hep3Vector& Point){
42 
43 // get info from TileMuFitter
44 
45  int accept=0;
46  //double m_tileComTime =0.;
47  //double m_tileMuX = 0.;
48  //double m_tileMuY = 0.;
49  //double m_tileMuZ = 0.;
50 
51  //double m_tileMuCosTheta = 0.;
52  //double m_tileMuSinThetaSinPhi = 0.;
53  //double m_tileMuSinThetaCosPhi = 0.;
54 
55  Hep3Vector MuZeroPosition;
56  Hep3Vector MuDirection;
57 
58  MuZeroPosition = m_myComTime->GetCounterPosition() ;
59  MuDirection = m_myComTime->GetcosThetaDirection();
60 
61  if(m_myComTime->getTime()!=0 || MuZeroPosition.x()!=0 || MuZeroPosition.z()!=0 )
62  {
63  //m_tileComTime = m_myComTime->getTime();
64 
65  //m_tileMuSinThetaCosPhi = MuDirection.x();
66  //m_tileMuSinThetaSinPhi = MuDirection.y();
67  //m_tileMuCosTheta = MuDirection.z();
68 
69  //m_tileMuX = MuZeroPosition.x();
70  //m_tileMuY = MuZeroPosition.y();
71  //m_tileMuZ = MuZeroPosition.z();
72  }
73 
74 
75  // m_theTime = m_tileComTime;
76 
77  // extract distance of minimum approach==============
78  // for instance see a brief sicussion at http://math.mit.edu/~djk/18_022/chapter02/example02.html
79  // bring everything back to the origin (but we would just need one point on the line) using the Zero Position of the track
80  Hep3Vector TranslateToOrigin=Point-MuZeroPosition;
81  // find orthogonal component of the point vector with respect to the line
82  Hep3Vector OrtVec=TranslateToOrigin - TranslateToOrigin.dot(MuDirection)*MuDirection;
83  // its magnitude is the distance we need
84  m_theDistance=OrtVec.mag();
85 
87  return accept;
88 }
89 // TOTRY: need to change it and put accept in the constructor so that
90 // return does only send things back.
91 
92 
94 
95 // get info from TileMuFitter
96 
97  int accept=0;
98  double tileComTime =0.;
99 
100  Hep3Vector MuZeroPosition;
101  Hep3Vector MuDirection;
102 
103  MuZeroPosition = m_myComTime->GetCounterPosition() ;
104  MuDirection = m_myComTime->GetcosThetaDirection();
105 
106  if(m_myComTime->getTime()!=0 || MuZeroPosition.x()!=0 || MuZeroPosition.z()!=0 )
107  {
108  tileComTime = m_myComTime->getTime();
109  }
110  m_theTime = tileComTime;
111  return accept;
112 }
113 
114 
115 
116 float ROIMon::GetDistance(const Hep3Vector& Point){
117  /*int acceptance=*/this->Accept(Point);
118  return m_theDistance;
119 }
120 
122  /*int acceptance=*/this->AcceptTime();
123  return m_theTime;
124 }
125 
ComTime::getTime
double getTime() const
Definition: ComTime.h:44
ROIMon::m_maxDistance
float m_maxDistance
Definition: ROIMon.h:36
CutsMETMaker::accept
StatusCode accept(const xAOD::Muon *mu)
Definition: CutsMETMaker.cxx:18
ROIMon::GetTime
float GetTime()
Definition: ROIMon.cxx:121
ComTime
Definition: ComTime.h:17
ROIMon::GetDistance
float GetDistance(const CLHEP::Hep3Vector &Point)
Definition: ROIMon.cxx:116
ComTime::GetcosThetaDirection
CLHEP::Hep3Vector GetcosThetaDirection() const
Definition: ComTime.h:47
ROIMon::ROIMon
ROIMon(ComTime *comtime, float distance)
Definition: ROIMon.cxx:25
ROIMon::~ROIMon
~ROIMon()
ROIMon::Accept
int Accept(const CLHEP::Hep3Vector &Point)
Definition: ROIMon.cxx:41
ROIMon.h
ChargedTracksWeightFilter::Spline::Point
Linear spline representation of a function used to calculate weights.
Definition: ChargedTracksWeightFilter.h:28
ROIMon::AcceptTime
int AcceptTime()
Definition: ROIMon.cxx:93
ROIMon::m_theTime
float m_theTime
Definition: ROIMon.h:38
ComTime::GetCounterPosition
CLHEP::Hep3Vector GetCounterPosition() const
Definition: ComTime.h:46
ROIMon::m_myComTime
ComTime * m_myComTime
Definition: ROIMon.h:39
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
ROIMon::m_theDistance
float m_theDistance
Definition: ROIMon.h:37