CMS 3D CMS Logo

Conv4HitsReco.h
Go to the documentation of this file.
1 #ifndef Conv4HitsReco_h
2 #define Conv4HitsReco_h
3 
4 #include <iostream>
5 #include <iomanip>
6 #include <cmath>
7 
8 #include <TVector3.h>
9 
11 public:
12  //Needed for construction
13  TVector3 vV;
14  TVector3 hit4;
15  TVector3 hit3;
16  TVector3 hit2;
17  TVector3 hit1;
18 
19  //Important quantities
20  TVector3 v3minus4;
21  TVector3 v1minus2;
22  TVector3 vN;
23  TVector3 vP;
24  TVector3 vPminusN;
25  TVector3 vPminusV;
26  TVector3 vNminusV;
27  TVector3 unitVn;
28  TVector3 unitVp;
29  double pn;
30  double pPN;
31  double nPN;
32  double PN;
33  double PN2;
34  double pNV;
35  double nNV;
36  double _eta;
37  double _pi;
38  double _eta2;
39  double _pi2;
40  TVector3 vMMaxLimit;
41  TVector3 vQMaxLimit;
42  double qMaxLimit;
43  double mMaxLimit;
44  double qMinLimit;
45  double mMinLimit;
46  TVector3 plusCenter;
47  TVector3 minusCenter;
48  TVector3 convVtx;
49  double plusRadius;
50  double minusRadius;
51 
55  double ptLegMinCut;
56  double ptLegMaxCut;
57  double ptPhotMaxCut;
58 
59  std::string qFromM_print(double m);
60  double qFromM(double); //For debugging purposes
61 
62  //Elements of the linearized system matrix
63  double Tq, Tm, T0;
64  double Oq, Om, O0;
65  int ComputeMaxLimits();
66  int ComputeMinLimits();
67  int GuessStartingValues(double &, double &);
68  int mqFindByIteration(double &, double &);
69  TVector3 GetIntersection(TVector3 &, TVector3 &, TVector3 &, TVector3 &);
70  TVector3 GetPlusCenter(double &);
71  TVector3 GetMinusCenter(double &);
72  void SetPtLegMinCut(double val) { ptLegMinCut = val; };
73  void SetPtLegMaxCut(double val) { ptLegMaxCut = val; };
74  void SetPtPhotMaxCut(double val) { ptPhotMaxCut = val; };
75  void SetLinSystCoeff(double, double);
76  void Set(double);
77  void SetIterationStopRelThreshold(double val) { iterationStopRelThreshold = val; };
78  void SetMaxNumberOfIterations(int val) { maxNumberOfIterations = val; };
79  void SetMaxVtxDistance(int val) { maxVtxDistance = val; };
80  double GetDq();
81  double GetDm();
82  double GetPtFromParamAndHitPair(double &, double &);
83  double GetPtPlusFromParam(double &);
84  double GetPtMinusFromParam(double &);
85  TVector3 GetConvVertexFromParams(double &, double &);
86  int IsNotValidForPtLimit(double, double, double, double);
87  int IsNotValidForVtxPosition(double &);
88 
89  int ConversionCandidate(TVector3 &, double &, double &);
90  void Dump();
91 
92  Conv4HitsReco(TVector3 &, TVector3 &, TVector3 &, TVector3 &, TVector3 &);
94 };
95 
96 #endif
97 
98 #ifdef Conv4HitsReco_cxx
99 Conv4HitsReco::Conv4HitsReco(TVector3 &vPhotVertex, TVector3 &h1, TVector3 &h2, TVector3 &h3, TVector3 &h4) {
100  vV = vPhotVertex;
101  hit4 = h4;
102  hit3 = h3;
103  hit2 = h2;
104  hit1 = h1;
105 
106  //Let's stay in the transverse plane...
107  vV.SetZ(0.);
108  hit4.SetZ(0.);
109  hit3.SetZ(0.);
110  hit2.SetZ(0.);
111  hit1.SetZ(0.);
112 
113  //Filling important quantities
114  vN.SetXYZ(0.5 * hit4.X() + 0.5 * hit3.X(), 0.5 * hit4.Y() + 0.5 * hit3.Y(), 0.5 * hit4.Z() + 0.5 * hit3.Z());
115  vP.SetXYZ(0.5 * hit2.X() + 0.5 * hit1.X(), 0.5 * hit2.Y() + 0.5 * hit1.Y(), 0.5 * hit2.Z() + 0.5 * hit1.Z());
116  vPminusN = vP - vN;
117  vPminusV = vP - vV;
118  vNminusV = vN - vV;
119  v3minus4 = hit3 - hit4;
120  v1minus2 = hit1 - hit2;
121  unitVn = v3minus4.Orthogonal().Unit();
122  unitVp = v1minus2.Orthogonal().Unit();
123  pPN = unitVp * vPminusN;
124  nPN = unitVn * vPminusN;
125  pNV = unitVp * vNminusV;
126  nNV = unitVn * vNminusV;
127  pn = unitVp * unitVn;
128  PN = vPminusN.Mag();
129  PN2 = vPminusN.Mag2();
130 
131  _eta = 0.5 * (hit3 - hit4).Mag();
132  _pi = 0.5 * (hit1 - hit2).Mag();
133  _eta2 = _eta * _eta;
134  _pi2 = _pi * _pi;
135 
136  //Default values for parameters
139  SetPtLegMinCut(0.2);
140  SetPtLegMaxCut(20.);
141  SetPtPhotMaxCut(30.);
142  SetMaxVtxDistance(20.);
143 }
144 
146  // std::cout << " Bye..." << std::endl;
147 }
148 
149 #endif // #ifdef Conv4HitsReco_h
TVector3 GetMinusCenter(double &)
int IsNotValidForPtLimit(double, double, double, double)
double minusRadius
Definition: Conv4HitsReco.h:50
TVector3 unitVp
Definition: Conv4HitsReco.h:28
TVector3 vNminusV
Definition: Conv4HitsReco.h:26
TVector3 vMMaxLimit
Definition: Conv4HitsReco.h:40
void SetPtLegMinCut(double val)
Definition: Conv4HitsReco.h:72
TVector3 hit3
Definition: Conv4HitsReco.h:15
double ptLegMaxCut
Definition: Conv4HitsReco.h:56
double GetPtMinusFromParam(double &)
double GetDm()
double mMaxLimit
Definition: Conv4HitsReco.h:43
double GetPtPlusFromParam(double &)
int GuessStartingValues(double &, double &)
void SetIterationStopRelThreshold(double val)
Definition: Conv4HitsReco.h:77
int ComputeMinLimits()
double GetPtFromParamAndHitPair(double &, double &)
double qMaxLimit
Definition: Conv4HitsReco.h:42
TVector3 hit2
Definition: Conv4HitsReco.h:16
int IsNotValidForVtxPosition(double &)
double plusRadius
Definition: Conv4HitsReco.h:49
void SetPtPhotMaxCut(double val)
Definition: Conv4HitsReco.h:74
double GetDq()
Conv4HitsReco(TVector3 &, TVector3 &, TVector3 &, TVector3 &, TVector3 &)
TVector3 GetIntersection(TVector3 &, TVector3 &, TVector3 &, TVector3 &)
TVector3 hit4
Definition: Conv4HitsReco.h:14
TVector3 vPminusV
Definition: Conv4HitsReco.h:25
int maxNumberOfIterations
Definition: Conv4HitsReco.h:53
TVector3 hit1
Definition: Conv4HitsReco.h:17
int mqFindByIteration(double &, double &)
TVector3 vPminusN
Definition: Conv4HitsReco.h:24
TVector3 vQMaxLimit
Definition: Conv4HitsReco.h:41
TVector3 minusCenter
Definition: Conv4HitsReco.h:47
int ComputeMaxLimits()
TVector3 convVtx
Definition: Conv4HitsReco.h:48
double mMinLimit
Definition: Conv4HitsReco.h:45
void SetMaxVtxDistance(int val)
Definition: Conv4HitsReco.h:79
void SetLinSystCoeff(double, double)
double ptLegMinCut
Definition: Conv4HitsReco.h:55
TVector3 GetConvVertexFromParams(double &, double &)
TVector3 plusCenter
Definition: Conv4HitsReco.h:46
int ConversionCandidate(TVector3 &, double &, double &)
double ptPhotMaxCut
Definition: Conv4HitsReco.h:57
void Set(double)
double qFromM(double)
TVector3 v1minus2
Definition: Conv4HitsReco.h:21
TVector3 GetPlusCenter(double &)
TVector3 unitVn
Definition: Conv4HitsReco.h:27
double qMinLimit
Definition: Conv4HitsReco.h:44
void SetPtLegMaxCut(double val)
Definition: Conv4HitsReco.h:73
double maxVtxDistance
Definition: Conv4HitsReco.h:54
TVector3 v3minus4
Definition: Conv4HitsReco.h:20
double iterationStopRelThreshold
Definition: Conv4HitsReco.h:52
std::string qFromM_print(double m)
void SetMaxNumberOfIterations(int val)
Definition: Conv4HitsReco.h:78