CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HICMuonPropagator.cc
Go to the documentation of this file.
7 
8 #include "CLHEP/Units/GlobalPhysicalConstants.h"
9 #include "CLHEP/Vector/ThreeVector.h"
10 #include <CLHEP/Vector/LorentzVector.h>
11 #include <cmath>
12 #include <stdlib.h>
13 #include <string>
14 #include <iostream>
15 #include <vector>
16 //#define MUPROPAGATOR_DEBUG
17 namespace cms {
20  const Cylinder& surface) const
21  {
22 #ifdef MUPROPAGATOR_DEBUG
23  cout<<"MuPropagator::Start propagation"<<endl;
24 #endif
25 // From FreeTrajectoryState to the vertex.
26 
27  GlobalPoint x = fts.parameters().position();
29  double px = p.x(); double py = p.y(); double pz = p.z();
30  double aCharge = fts.charge();
32  double dfcalc,phnext,zdet;
33 // double pt = p.perp();
34  double a = p.perp()/pz;
35 
36  double b = -a*theHICConst->zvert;
37 
38  double phiold=x.phi();
39  if(x.phi()<0.) phiold=twopi+x.phi();
40 
41 #ifdef MUPROPAGATOR_DEBUG
42  cout<< "MuPropagator::xold=" << x<<" p="<<p<<endl;
43  cout<<"MuPropagator::Propagate to cylinder="<<surface.radius()<<" pt="<<pt<<
44  " line parameters="<<a<<" "<<b<<endl;
45 #endif
46 
47 // Propagate on surface:phidet
48 
49  dfcalc = aCharge*0.006*fabs(x.perp()-surface.radius())/p.perp();
50  phnext = phiold+dfcalc;
51 
52  if(phnext>twopi) phnext = phnext-twopi;
53  if(phnext<0.) phnext = phnext+twopi;
54 
55 // Propagate Zdet
56 
57  zdet = (surface.radius()-b)/a;
58 
59 // New state
60  GlobalPoint xnew(surface.radius()*cos(phnext),surface.radius()*sin(phnext),zdet);
61  GlobalVector pnew(px*cos(dfcalc)-py*sin(dfcalc),px*sin(dfcalc)+py*cos(dfcalc),pz);
62 #ifdef MUPROPAGATOR_DEBUG
63  cout<< "almost empty propagator for the moment phnext,zdet="<<phnext<<" "<<zdet<<endl;
64  cout<<"New coordinates="<<xnew<<endl;
65  cout<<"New momentum="<<pnew<<endl;
66 #endif
67 
69  GlobalTrajectoryParameters(xnew, pnew, (int)aCharge, field),
70  CurvilinearTrajectoryError(e), surface
71  );
72  return tsos;
73  }
74 
77  const Plane& surface) const
78  {
79 
80 
81 //
82 // Check if it is detector or layer
83 // if(surface.position().perp()>0.000001) {
84 // HICTrajectoryCorrector* theNewPropagator = new HICTrajectoryCorrector();
85 // TrajectoryStateOnSurface tsos = theCorrector->propagate(fts,surface);
86 // delete theNewPropagator;
87 // return tsos;
88 // } else {
89 // Check if it is forward pixel detector
90 // if(abs(surface.position().z())>0. && abs(surface.position().z())<50.) {
91 // GtfPropagator* theNewPropagator = new GtfPropagator(oppositeToMomentum);
92 // TrajectoryStateOnSurface tsos = theCorrector->propagate(fts,surface);
93 // delete theNewPropagator;
94 // return tsos;
95 // }
96 // }
97 //
98  double dfcalc,phnext,rdet;
99 
100 #ifdef MUPROPAGATOR_DEBUG
101  cout<<"MuPropagator::Start propagation"<<endl;
102 #endif
103 // Information from previous layer
104 //
105  GlobalPoint x = fts.parameters().position();
106  GlobalVector p = fts.parameters().momentum();
107  double px = p.x(); double py = p.y(); double pz = p.z();
108  double aCharge = fts.charge();
110  double phiold=x.phi();
111  if(x.phi()<0.) phiold=twopi+x.phi();
112 
113 #ifdef MUPROPAGATOR_DEBUG
114  cout<< "MuPropagator::xold=" << x<<" p= "<<p<<endl;
115 #endif
116 
117  double a = p.perp()/pz;
118  double b = x.perp()-a*x.z();
119 
120 #ifdef MUPROPAGATOR_DEBUG
121  cout<<"MuPropagator::Propagate to disk="<<surface.position().z()<<" pz="<<pz<<
122  " line parameters="<<a<<" "<<b<<endl;
123 #endif
124 
125 // Propagate on surface:phidet
126 //
127  dfcalc = aCharge*0.006*fabs(x.z()-surface.position().z())/fabs(pz);
128  phnext = phiold+dfcalc;
129 
130  if(phnext>twopi) phnext = phnext-twopi;
131  if(phnext<0.) phnext = phnext+twopi;
132 
133 // Propagate Zdet
134 //
135  rdet = a*surface.position().z()-b;
136 
137 // New state
138  GlobalPoint xnew(rdet*cos(phnext),rdet*sin(phnext),surface.position().z());
139  GlobalVector pnew(px*cos(dfcalc)-py*sin(dfcalc),px*sin(dfcalc)+py*cos(dfcalc),pz);
140 
141 #ifdef MUPROPAGATOR_DEBUG
142  cout<< "MuPropagator::phiold,phnext,zdet,charge,dfcalc="
143  <<phiold<<" "<<phnext<<" "<<
144  surface.position().z()<<" "<<aCharge<<" "<<dfcalc<<endl;
145  cout<<"New coordinates="<<xnew<<endl;
146  cout<<"New momentum="<<pnew<<endl;
147 #endif
148 
150  GlobalTrajectoryParameters(xnew, pnew, (int)aCharge, field),
152  surface);
153  return tsos;
154  }
155 
156 }
const MagneticField * field
T perp() const
Definition: PV3DBase.h:71
const GlobalTrajectoryParameters & parameters() const
float zvert
Definition: HICConst.h:25
TrajectoryStateOnSurface propagate(const FreeTrajectoryState &fts, const Cylinder &cylin) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
T y() const
Definition: PV3DBase.h:62
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
TrackCharge charge() const
const CurvilinearTrajectoryError & curvilinearError() const
Definition: Plane.h:17
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:55
T z() const
Definition: PV3DBase.h:63
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double b
Definition: hdecay.h:120
const AlgebraicSymMatrix55 & matrix() const
double a
Definition: hdecay.h:121
tuple cout
Definition: gather_cfg.py:121
Definition: DDAxes.h:10
T x() const
Definition: PV3DBase.h:61
const PositionType & position() const