[53] | 1 | /*
|
---|
| 2 | * ---- Delphes ----
|
---|
| 3 | * A Fast Simulator for general purpose LHC detector
|
---|
| 4 | * S. Ovyn ~~~~ severine.ovyn@uclouvain.be
|
---|
| 5 | *
|
---|
| 6 | * Center for Particle Physics and Phenomenology (CP3)
|
---|
| 7 | * Universite Catholique de Louvain (UCL)
|
---|
| 8 | * Louvain-la-Neuve, Belgium
|
---|
| 9 | * */
|
---|
| 10 |
|
---|
| 11 | #include "interface/BFieldProp.h"
|
---|
| 12 | #include "TRandom.h"
|
---|
| 13 |
|
---|
| 14 | #include <iostream>
|
---|
| 15 | #include <sstream>
|
---|
| 16 | #include <fstream>
|
---|
| 17 | #include <iomanip>
|
---|
| 18 |
|
---|
| 19 | #include<cmath>
|
---|
| 20 |
|
---|
| 21 |
|
---|
| 22 | using namespace std;
|
---|
| 23 |
|
---|
| 24 |
|
---|
| 25 | //------------------------------------------------------------------------------
|
---|
| 26 |
|
---|
| 27 | TrackPropagation::TrackPropagation() {
|
---|
| 28 |
|
---|
| 29 | TRACKING_RADIUS = 129;
|
---|
| 30 | TRACKING_LENGTH = 300;
|
---|
| 31 | MAXITERATION = 20000;
|
---|
| 32 | MINSEGLENGTH = 70;
|
---|
| 33 |
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | void TrackPropagation::Propagation(const TRootGenParticle *Part,TLorentzVector &genMomentum)
|
---|
| 37 | {
|
---|
| 38 |
|
---|
| 39 | double q = Charge(Part->PID);
|
---|
| 40 | if(q==0)return;
|
---|
| 41 |
|
---|
| 42 | float Xvertex1 = Part->X;
|
---|
| 43 | float Yvertex1 = Part->Y;
|
---|
| 44 | float Zvertex1 = Part->Z;
|
---|
| 45 |
|
---|
| 46 | //out of trackibg coverage?
|
---|
[59] | 47 | if(sqrt(Xvertex1*Xvertex1+Yvertex1*Yvertex1) > TRACKING_RADIUS){return;}
|
---|
[53] | 48 | if(fabs(Zvertex1) > TRACKING_LENGTH){return;}
|
---|
| 49 |
|
---|
| 50 | float Px = Part->Px;
|
---|
| 51 | float Py = Part->Py;
|
---|
| 52 | float Pz = Part->Pz;
|
---|
| 53 |
|
---|
| 54 | double px = Px / 0.003;
|
---|
| 55 | double py = Py / 0.003;
|
---|
| 56 | double pz = Pz / 0.003;
|
---|
[59] | 57 | double pt = sqrt(px*px+py*py);
|
---|
| 58 | double p = sqrt(px*px+py*py+pz*pz);
|
---|
| 59 |
|
---|
| 60 | if(q!=0){
|
---|
| 61 | double e = Part->E / 0.003;
|
---|
| 62 | // double M = sqrt(e*e - (px*px + py*py + pz*pz) );
|
---|
| 63 | double M = Part->M;
|
---|
| 64 | /*if(fabs(Part->PID)==11)
|
---|
| 65 | {
|
---|
| 66 | cout<<"genMomentum.M() "<<genMomentum.M()<<" "<<Part->M<<endl;
|
---|
| 67 | cout<<"e*e - (px*px + py*py + pz*pz) "<<e*e - (px*px + py*py + pz*pz)<<endl;
|
---|
| 68 | }*/
|
---|
| 69 | double vx = px/M;
|
---|
| 70 | double vy = py/M;
|
---|
| 71 | double vz = pz/M;
|
---|
[53] | 72 |
|
---|
[59] | 73 | double Bx = 0;
|
---|
| 74 | double By = 0;
|
---|
| 75 | double Bz = 3.8;
|
---|
| 76 |
|
---|
| 77 | double ax = (q/M)*(Bz*vy - By*vz);
|
---|
| 78 | double ay = (q/M)*(Bx*vz - Bz*vx);
|
---|
| 79 | double az = (q/M)*(By*vx - Bx*vy);
|
---|
| 80 | /*
|
---|
| 81 | cout<<"M "<<M<<" et le pid "<<Part->PID<<endl;
|
---|
| 82 | cout<<"ax "<<ax<<" ay "<<ay<<" az "<<az<<endl;
|
---|
| 83 | */
|
---|
| 84 | double dt = 1/p;
|
---|
| 85 | if(pt<266 && vz < 0.0012) dt = fabs(0.001/vz);
|
---|
| 86 |
|
---|
| 87 | double xold=Xvertex1; double x=xold;
|
---|
| 88 | double yold=Yvertex1; double y=yold;
|
---|
| 89 | double zold=Zvertex1; double z=zold;
|
---|
| 90 |
|
---|
| 91 | double VTold = sqrt(vx*vx+vy*vy);
|
---|
| 92 |
|
---|
| 93 | int k = 0;
|
---|
| 94 |
|
---|
| 95 | while(k < MAXITERATION){
|
---|
| 96 | k++;
|
---|
| 97 |
|
---|
| 98 | vx += ax*dt;
|
---|
| 99 | vy += ay*dt;
|
---|
| 100 | vz += az*dt;
|
---|
| 101 |
|
---|
| 102 | double VTratio = VTold/sqrt(vx*vx+vy*vy);
|
---|
| 103 | vx *= VTratio;
|
---|
| 104 | vy *= VTratio;
|
---|
| 105 |
|
---|
| 106 | ax = (q/M)*(Bz*vy - By*vz);
|
---|
| 107 | ay = (q/M)*(Bx*vz - Bz*vx);
|
---|
| 108 | az = (q/M)*(By*vx - Bx*vy);
|
---|
| 109 |
|
---|
| 110 | x += vx*dt;
|
---|
| 111 | y += vy*dt;
|
---|
| 112 | z += vz*dt;
|
---|
| 113 |
|
---|
| 114 | if( (x*x+y*y) > TRACKING_RADIUS*TRACKING_RADIUS ){ x /= (x*x+y*y)/(TRACKING_RADIUS*TRACKING_RADIUS); y /= (x*x+y*y)/(TRACKING_RADIUS*TRACKING_RADIUS); break;}
|
---|
| 115 | if( fabs(z)>TRACKING_LENGTH)break;
|
---|
| 116 |
|
---|
| 117 | xold = x;
|
---|
| 118 | yold = y;
|
---|
| 119 | zold = z;
|
---|
| 120 | }
|
---|
| 121 |
|
---|
[53] | 122 | if(x!=0 && y!=0 && z!=0)
|
---|
| 123 | {
|
---|
| 124 | double theta = fabs(atan(y/z));
|
---|
| 125 | double eta;
|
---|
| 126 | if(z > 0)eta = -log(tan(theta/2));
|
---|
| 127 | else eta = -(-log(tan(theta/2)));
|
---|
| 128 | double phi = atan2(y,x);
|
---|
| 129 | genMomentum.SetPtEtaPhiE(Part->PT,eta,phi,Part->E);
|
---|
| 130 | }
|
---|
[59] | 131 | // cout<<"genMomentum final "<<genMomentum.Pt()<<endl;
|
---|
[53] | 132 | }
|
---|
| 133 | }
|
---|