ATLAS Offline Software
DerclcAng.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 #include <algorithm>
10 #include <cmath>
11 #include <iostream>
12 
13 namespace Trk {
14 
15 
16 //
17 // Angular constraints calculation in new data model.
18 //
19 // cnstV and cnstP values are used!!!
20 //-----------------------------------------------
21 
23 {
24  VKConstraintBase * base_cnst = (VKConstraintBase*) cnst;
25  const VKVertex * vk=cnst->getOriginVertex();
26  int NTRK = vk->TrackList.size();
27  int i,j;
28  double Scale=1.; // Scaling for better precision VK 28.03.2011 Wrong for error matrix!!! Should always be 1.!!!
29 
30  double diff=0., aa=0;
31  std::vector<double> deriv(NTRK,0);
32  for(i=0; i<NTRK-1; i++){
33  for(j=i+1; j<NTRK; j++){
34  diff = vk->TrackList[i]->cnstP[1] - vk->TrackList[j]->cnstP[1];
35  while(diff > M_PI) diff -= 2.*M_PI;
36  while(diff < -M_PI) diff += 2.*M_PI;
37  aa += diff*Scale;
38  deriv[i] += Scale;
39  deriv[j] -= Scale;
40  }
41  }
42 
43  int numCNST=0; //constraint number. Single constraint in this case
44  base_cnst->h0t[numCNST].X = 0.;
45  base_cnst->h0t[numCNST].Y = 0.;
46  base_cnst->h0t[numCNST].Z = 0.;
47  for(i=0; i<NTRK; i++){
48  base_cnst->f0t[i][numCNST].X = 0.;
49  base_cnst->f0t[i][numCNST].Y = deriv[i];
50  base_cnst->f0t[i][numCNST].Z = 0.;
51  }
52  base_cnst->aa[numCNST]=aa;
53 //std::cout.precision(11);
54 //std::cout<<" new delta Phi="<<base_cnst->aa[numCNST]<<'\n';
55 //std::cout<<base_cnst->f0t[0][numCNST].X<<", "<<base_cnst->f0t[0][numCNST].Y<<", "
56 // <<base_cnst->f0t[0][numCNST].Z<<'\n';
57 //std::cout<<base_cnst->f0t[1][numCNST].X<<", "<<base_cnst->f0t[1][numCNST].Y<<", "
58 // <<base_cnst->f0t[1][numCNST].Z<<'\n';
59 }
60 
62 {
63  VKConstraintBase * base_cnst = (VKConstraintBase*) cnst;
64  const VKVertex * vk=cnst->getOriginVertex();
65  int NTRK = vk->TrackList.size();
66  int i,j;
67  double Scale=1.; // Scaling for better precision VK 28.03.2011 Wrong for error matrix!!! Should always be 1.!!!
68 
69  double diff=0., der=0., aa=0;
70  std::vector<double> deriv(NTRK,0);
71  for(i=0; i<NTRK-1; i++){
72  for(j=i+1; j<NTRK; j++){
73  diff = sin(vk->TrackList[i]->cnstP[0] - vk->TrackList[j]->cnstP[0])*Scale;
74  der = Scale;
75  aa += diff;
76  deriv[i] += der;
77  deriv[j] -= der;
78  }
79  }
80 
81  int numCNST=0; //constraint number. Single constraint in this case
82  base_cnst->h0t[numCNST].X = 0.;
83  base_cnst->h0t[numCNST].Y = 0.;
84  base_cnst->h0t[numCNST].Z = 0.;
85  for(i=0; i<NTRK; i++){
86  base_cnst->f0t[i][numCNST].X = deriv[i];
87  base_cnst->f0t[i][numCNST].Y = 0.;
88  base_cnst->f0t[i][numCNST].Z = 0.;
89  }
90  base_cnst->aa[numCNST]=aa;
91 //std::cout.precision(11);
92 //std::cout<<" new delta Theta="<<base_cnst->aa[numCNST]<<'\n';
93 //std::cout<<base_cnst->f0t[0][numCNST].X<<", "<<base_cnst->f0t[0][numCNST].Y<<", "
94 // <<base_cnst->f0t[0][numCNST].Z<<'\n';
95 //std::cout<<base_cnst->f0t[1][numCNST].X<<", "<<base_cnst->f0t[1][numCNST].Y<<", "
96 // <<base_cnst->f0t[1][numCNST].Z<<'\n';
97 }
98 
100 {
101  VKConstraintBase * base_cnst = (VKConstraintBase*) cnst;
102  const VKVertex * vk=cnst->getOriginVertex();
103  int NTRK = vk->TrackList.size();
104  double curV[3] = {vk->refIterV[0]+vk->cnstV[0], vk->refIterV[1]+vk->cnstV[1],vk->refIterV[2]+vk->cnstV[2]};
105 
106 
107  int numCNST=0; //constraint number. Single constraint in this case
108  base_cnst->h0t[numCNST].X = cnst->getA();
109  base_cnst->h0t[numCNST].Y = cnst->getB();
110  base_cnst->h0t[numCNST].Z = cnst->getC();
111  for(int i=0; i<NTRK; i++){
112  base_cnst->f0t[i][numCNST].X = 0.;
113  base_cnst->f0t[i][numCNST].Y = 0.;
114  base_cnst->f0t[i][numCNST].Z = 0.;
115  }
116  base_cnst->aa[numCNST]=cnst->getA()*curV[0]+cnst->getB()*curV[1]+cnst->getC()*curV[2] - cnst->getD() ;
117 //std::cout.precision(11);
118 //std::cout<<" new plane="<<base_cnst->aa[numCNST]<<'\n';
119 }
120 
121 } /* End of namespace */
122 
CommonPars.h
Trk::VKPhiConstraint
Definition: Derivt.h:67
Trk::VKPlaneConstraint::getD
double getD() const
Definition: Derivt.h:117
M_PI
#define M_PI
Definition: ActiveFraction.h:11
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
Trk::VKVertex::refIterV
double refIterV[3]
Definition: TrkVKalVrtCoreBase.h:146
Trk::VKConstraintBase
Definition: Derivt.h:24
Trk::calcPlaneConstraint
void calcPlaneConstraint(VKPlaneConstraint *cnst)
Definition: DerclcAng.cxx:99
DerclcAng.h
TrkVKalVrtCoreBase.h
Trk::VKVertex::TrackList
std::vector< std::unique_ptr< VKTrack > > TrackList
Definition: TrkVKalVrtCoreBase.h:167
lumiFormat.i
int i
Definition: lumiFormat.py:85
Trk::VKPlaneConstraint::getB
double getB() const
Definition: Derivt.h:115
Scale
void Scale(TH1 *h, double d=1)
Definition: comparitor.cxx:77
Trk::VKConstraintBase::f0t
std::vector< std::vector< Vect3DF > > f0t
Definition: Derivt.h:37
Derivt.h
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::VKPlaneConstraint::getA
double getA() const
Definition: Derivt.h:114
Trk::VKConstraintBase::aa
std::vector< double > aa
Definition: Derivt.h:36
Trk::VKVertex::cnstV
double cnstV[3]
Definition: TrkVKalVrtCoreBase.h:143
Trk::VKConstraintBase::getOriginVertex
const VKVertex * getOriginVertex() const
Definition: Derivt.h:30
Trk::VKConstraintBase::h0t
std::vector< Vect3DF > h0t
Definition: Derivt.h:38
Trk::VKPlaneConstraint
Definition: Derivt.h:109
Trk::VKVertex
Definition: TrkVKalVrtCoreBase.h:128
Trk::calcPhiConstraint
void calcPhiConstraint(VKPhiConstraint *cnst)
Definition: DerclcAng.cxx:22
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
test_AnalysisBaseEventLoopJob.aa
aa
Definition: test_AnalysisBaseEventLoopJob.py:37
Trk::VKPlaneConstraint::getC
double getC() const
Definition: Derivt.h:116
Trk::VKThetaConstraint
Definition: Derivt.h:75
Trk::calcThetaConstraint
void calcThetaConstraint(VKThetaConstraint *cnst)
Definition: DerclcAng.cxx:61