QwAnalysis
QwBridgingTrackFilter.cc
Go to the documentation of this file.
1 // Corresonding header
3 
4 // Qweak headers
5 #include "QwLog.h"
6 #include "QwUnits.h"
7 #include "QwPartialTrack.h"
8 
9 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
10 
12 {
13  // Set default filter criteria
14  // - polar angle, should probably be split in front and back
15  fMinTheta = 1.0 * Qw::deg;
16  fMaxTheta = 13.0 * Qw::deg;
17  // - difference in polar angle between front and back
18  fMinDiffTheta = 5.0 * Qw::deg;
19  fMaxDiffTheta = 45.0 * Qw::deg;
20  // - azimuthal angle
21  fMinPhi = 0.0 * Qw::deg;
22  fMaxPhi = 360.0 * Qw::deg;
23  // - difference in azimuthal angle between front and back
24  fMinDiffPhi = - 20.0 * Qw::deg;
25  fMaxDiffPhi = 20.0 * Qw::deg;
26  // - longitudinal vertex position in target
27  fMinVertexZ = -672.0 * Qw::cm;
28  fMaxVertexZ = -628.0 * Qw::cm;
29 }
30 
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
32 
33 /**
34  * Filter combinations of front and back partial tracks before bridging
35  * @param front Front partial track
36  * @param back Back partial track
37  * @return Failure code (zero when accepted)
38  */
41  const QwPartialTrack* back) const
42 {
43  // NOTE The angle limits will be determined from MC simulation results
44 
45  // Scattering angle limit
46  double theta = front->GetMomentumDirectionTheta();
47  if ((theta < fMinTheta) || (theta > fMaxTheta)) {
48  QwDebug << "QwBridgingTrackFilter: theta = " << theta/Qw::deg << " deg, "
49  << "allowed range [" << fMinTheta/Qw::deg << ","
50  << fMaxTheta/Qw::deg << "] deg" << QwLog::endl;
51  return kFailThetaFront;
52  }
53 
54  // Bending angle limits in the magnetic field
55  double dtheta = (back->GetMomentumDirectionTheta() - front->GetMomentumDirectionTheta());
56  if ((dtheta < fMinDiffTheta) || (dtheta > fMaxDiffTheta)) {
57  // QwMessage << "QwBridgingTrackFilter: dtheta = " << dtheta/Qw::deg << " deg, "
58  // << "allowed range [" << fMinDiffTheta/Qw::deg << ","
59  // << fMaxDiffTheta/Qw::deg << "] deg" << QwLog::endl;
60  return kFailDiffTheta;
61  }
62  double dphi = (back->GetMomentumDirectionPhi() - front->GetMomentumDirectionPhi());
63  if ((dphi < fMinDiffPhi) || (dphi > fMaxDiffPhi)) {
64  // QwMessage << "QwBridgingTrackFilter: dphi = " << dphi/Qw::deg << " deg, "
65  // << "allowed range [" << fMinDiffPhi/Qw::deg << ","
66  // << fMaxDiffPhi/Qw::deg << "] deg" << QwLog::endl;
67  return kFailDiffPhi;
68  }
69 
70  // Scattering vertex limits and position phi limits (QTOR keep-out zone)
71  TVector3 start_position = front->GetPosition(-330.685 * Qw::cm);
72  TVector3 start_direction = front->GetMomentumDirection();
73  // front track position and angles at z = -250 cm plane
74  //double r = fabs(start_position.Z() - (-250.0 * Qw::cm)) / start_direction.Z(); // unused
75  //double x = start_position.X() + r * start_direction.X(); // unused
76  //double y = start_position.Y() + r * start_direction.Y(); // unused
77 
78  // double position_r = sqrt(x*x + y*y);
79  double position_phi = start_position.Phi();
80  //double direction_theta = direction_theta = front->GetMomentumDirectionTheta(); // unused
81 
82  //double vertex_z = -250.0 * Qw::cm - position_r / tan(acos(start_direction.Z()));
83  double vertex_z=-(front->fSlopeX*front->fOffsetX + front->fSlopeY*front->fOffsetY)/(front->fSlopeX*front->fSlopeX+front->fSlopeY*front->fSlopeY);
84  if (vertex_z < fMinVertexZ || vertex_z > fMaxVertexZ) {
85  // QwMessage << "QwBridgingTrackFilter: vertex z = " << vertex_z/Qw::cm << " cm, "
86  // << "allowed range [" << fMinVertexZ/Qw::cm << ","
87  // << fMaxVertexZ/Qw::cm << "] cm" << QwLog::endl;
88  return kFailVertexZ;
89  }
90 
91  // scattering angle phi and the position_phi at Region 2 should have very small difference
92  // this will post a limit on the phi difference
93  double direction_phi = 0.0;
94  direction_phi = front->GetMomentumDirectionPhi();
95  double delta_front_phi = fabs(direction_phi - position_phi);
96  if (delta_front_phi> 5.0*Qw::deg) {
97  // QwMessage << "QwBridgingTrackFilter: delta_front_phi = " << delta_front_phi/Qw::deg << " deg, "
98  // << "allowed range [-5, 5] cm" << QwLog::endl;
99  return kFailVertexZ;
100  }
101 
102  // TODO: add in QTOR keep-out zones
103 
104  return kPass;
105 }
106 
107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Double_t fOffsetX
x coordinate (at MAGNET_CENTER)
Double_t fSlopeY
y slope
double fMinTheta
Angle and position boundaries for the filter.
static const double deg
Definition: QwUnits.h:106
Double_t GetMomentumDirectionTheta() const
Return the theta angle.
const TVector3 GetPosition(const double z) const
Return the vertex at position z.
Definition of the partial track class.
QwBridgingTrackFilter()
Default constructor.
EStatus Filter(const QwPartialTrack *front, const QwPartialTrack *back) const
Filter front and back track combinations.
#define QwDebug
Predefined log drain for debugging output.
Definition: QwLog.h:60
A logfile class, based on an identical class in the Hermes analyzer.
const TVector3 GetMomentumDirection() const
Return the direction.
Double_t fSlopeX
x slope
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
Definition of the track filter for the bridging methods.
Double_t fOffsetY
y coordinate (at MAGNET_CENTER)
Double_t GetMomentumDirectionPhi() const
Return the phi angle.
EStatus
List of possible failure modes for the filter.
Contains the straight part of a track in one region only.
static const double cm
Length units: base unit is mm.
Definition: QwUnits.h:61