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/VeryForward.h"
|
---|
12 | #include "interface/SmearUtil.h"
|
---|
13 | #include "TRandom.h"
|
---|
14 |
|
---|
15 | #include <iostream>
|
---|
16 | #include <sstream>
|
---|
17 | #include <fstream>
|
---|
18 | #include <iomanip>
|
---|
19 |
|
---|
20 | #include<cmath>
|
---|
21 |
|
---|
22 |
|
---|
23 | using namespace std;
|
---|
24 |
|
---|
25 |
|
---|
26 | //------------------------------------------------------------------------------
|
---|
27 |
|
---|
28 | VeryForward::VeryForward(string DetDatacard) {
|
---|
29 |
|
---|
30 | DET = new RESOLution();
|
---|
31 | DET->ReadDataCard(DetDatacard);
|
---|
32 |
|
---|
33 | //Initialisation of Hector
|
---|
34 | relative_energy = true; // should always be true
|
---|
35 | kickers_on = 1; // should always be 1
|
---|
36 |
|
---|
37 | // user should provide : (1) optics file for each beamline, and IPname,
|
---|
38 | // and offset data (s,x) for optical elements
|
---|
39 | beamline1 = new H_BeamLine(1,500.);
|
---|
40 | beamline1->fill("data/LHCB1IR5_v6.500.tfs",1,"IP5");
|
---|
41 | beamline1->offsetElements(120,-0.097);
|
---|
42 | H_RomanPot * rp220_1 = new H_RomanPot("rp220_1",220,2000); // RP 220m, 2mm, beam 1
|
---|
43 | H_RomanPot * rp420_1 = new H_RomanPot("rp420_1",420,4000); // RP 420m, 4mm, beam 1
|
---|
44 | beamline1->add(rp220_1);
|
---|
45 | beamline1->add(rp420_1);
|
---|
46 |
|
---|
47 | beamline2 = new H_BeamLine(1,500.);
|
---|
48 | beamline2->fill("data/LHCB1IR5_v6.500.tfs",-1,"IP5");
|
---|
49 | beamline2->offsetElements(120,+0.097);
|
---|
50 | H_RomanPot * rp220_2 = new H_RomanPot("rp220_2",220,2000);// RP 220m, 2mm, beam 2
|
---|
51 | H_RomanPot * rp420_2 = new H_RomanPot("rp420_2",420,4000);// RP 420m, 4mm, beam 2
|
---|
52 | beamline2->add(rp220_2);
|
---|
53 | beamline2->add(rp420_2);
|
---|
54 |
|
---|
55 |
|
---|
56 | }
|
---|
57 |
|
---|
58 | void VeryForward::ZDC(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchZDC,TRootGenParticle *particle)
|
---|
59 | {
|
---|
60 | int pid=abs(particle->PID);
|
---|
61 | float eta=fabs(particle->Eta);
|
---|
62 |
|
---|
63 |
|
---|
64 | TRootZdcHits *elementZdc;
|
---|
65 | TLorentzVector genMomentum;
|
---|
66 | // Zero degree calorimeter, for forward neutrons and photons
|
---|
67 | if (particle->Status ==1 && (pid == pN || pid == pGAMMA ) && eta > DET->VFD_min_zdc ) {
|
---|
68 | genMomentum.SetPxPyPzE(particle->Px, particle->Py, particle->Pz, particle->E);
|
---|
69 | // !!!!!!!!! vérifier que particle->Z est bien en micromÚtres!!!
|
---|
70 | // !!!!!!!!! vérifier que particle->T est bien en secondes!!!
|
---|
71 | // !!!!!!!!! pas de smearing ! on garde trop d'info !
|
---|
72 | elementZdc = (TRootZdcHits*) branchZDC->NewEntry();
|
---|
73 | elementZdc->Set(genMomentum);
|
---|
74 |
|
---|
75 | // time of flight t is t = T + d/[ cos(theta) v ]
|
---|
76 | //double tx = acos(particle->Px/particle->Pz);
|
---|
77 | //double ty = acos(particle->Py/particle->Pz);
|
---|
78 | //double theta = (1E-6)*sqrt( pow(tx,2) + pow(ty,2) );
|
---|
79 | //double flight_distance = (DET->ZDC_S - particle->Z*(1E-6))/cos(theta) ; // assumes that Z is in micrometers
|
---|
80 | double flight_distance = (DET->VFD_s_zdc - particle->Z*(1E-6));
|
---|
81 | // assumes also that the emission angle is so small that 1/(cos theta) = 1
|
---|
82 | elementZdc->T = 0*particle->T + flight_distance/speed_of_light; // assumes highly relativistic particles
|
---|
83 | elementZdc->side = sign(eta);
|
---|
84 |
|
---|
85 |
|
---|
86 | }
|
---|
87 |
|
---|
88 | }
|
---|
89 | void VeryForward::RomanPots(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchRP220,ExRootTreeBranch *branchFP420,TRootGenParticle *particle)
|
---|
90 | {
|
---|
91 | int pid=abs(particle->PID);
|
---|
92 | float eta=fabs(particle->Eta);
|
---|
93 |
|
---|
94 | TRootRomanPotHits* elementRP220;
|
---|
95 | TRootRomanPotHits* elementFP420;
|
---|
96 |
|
---|
97 | TLorentzVector genMomentum;
|
---|
98 | genMomentum.SetPxPyPzE(particle->Px, particle->Py, particle->Pz, particle->E);
|
---|
99 | // if forward proton
|
---|
100 | if( (pid == pP) && (particle->Status == 1) && (fabs(genMomentum.Eta()) > DET->CEN_max_calo_fwd) )
|
---|
101 | {
|
---|
102 | // !!!!!!!! put here particle->CHARGE and particle->MASS
|
---|
103 | H_BeamParticle p1; /// put here particle->CHARGE and particle->MASS
|
---|
104 | p1.smearAng();
|
---|
105 | p1.smearPos();
|
---|
106 | p1.setPosition(p1.getX()-500.,p1.getY(),p1.getTX()-1*kickers_on*CRANG,p1.getTY(),0);
|
---|
107 | p1.set4Momentum(particle->Px,particle->Py,particle->Pz,particle->E);
|
---|
108 |
|
---|
109 | H_BeamLine *beamline;
|
---|
110 | if(genMomentum.Eta() >0) beamline = beamline1;
|
---|
111 | else beamline = beamline2;
|
---|
112 |
|
---|
113 | p1.computePath(beamline,1);
|
---|
114 |
|
---|
115 | if(p1.stopped(beamline)) {
|
---|
116 | if (p1.getStoppingElement()->getName()=="rp220_1" || p1.getStoppingElement()->getName()=="rp220_2") {
|
---|
117 | p1.propagate(DET->RP_220_s);
|
---|
118 | elementRP220 = (TRootRomanPotHits*) branchRP220->NewEntry();
|
---|
119 | elementRP220->X = (1E-6)*p1.getX(); // [m]
|
---|
120 | elementRP220->Y = (1E-6)*p1.getY(); // [m]
|
---|
121 | elementRP220->Tx = (1E-6)*p1.getTX(); // [rad]
|
---|
122 | elementRP220->Ty = (1E-6)*p1.getTY(); // [rad]
|
---|
123 | elementRP220->S = p1.getS(); // [m]
|
---|
124 | elementRP220->T = -1; // not yet implemented
|
---|
125 | elementRP220->E = p1.getE(); // not yet implemented
|
---|
126 | elementRP220->q2 = -1; // not yet implemented
|
---|
127 | elementRP220->side = sign(eta);
|
---|
128 |
|
---|
129 | } else if (p1.getStoppingElement()->getName()=="rp420_1" || p1.getStoppingElement()->getName()=="rp420_2") {
|
---|
130 | p1.propagate(DET->RP_420_s);
|
---|
131 | elementFP420 = (TRootRomanPotHits*) branchFP420->NewEntry();
|
---|
132 | elementFP420->X = (1E-6)*p1.getX(); // [m]
|
---|
133 | elementFP420->Y = (1E-6)*p1.getY(); // [m]
|
---|
134 | elementFP420->Tx = (1E-6)*p1.getTX(); // [rad]
|
---|
135 | elementFP420->Ty = (1E-6)*p1.getTY(); // [rad]
|
---|
136 | elementFP420->S = p1.getS(); // [m]
|
---|
137 | elementFP420->T = -1; // not yet implemented
|
---|
138 | elementFP420->E = p1.getE(); // not yet implemented
|
---|
139 | elementFP420->q2 = -1; // not yet implemented
|
---|
140 | elementFP420->side = sign(eta);
|
---|
141 | }
|
---|
142 |
|
---|
143 | }
|
---|
144 | // if(p1.stopped(beamline) && (p1.getStoppingElement()->getS() > 100))
|
---|
145 | // cout << "Eloss =" << 7000.-p1.getE() << " ; " << p1.getStoppingElement()->getName() << endl;
|
---|
146 | } // if forward proton
|
---|
147 | }
|
---|
148 |
|
---|
149 | // Forward particles in CASTOR ?
|
---|
150 | // /* if (particle->Status == 1 && (fabs(particle->Eta) > DET->MIN_CALO_VFWD)
|
---|
151 | // && (fabs(particle->Eta) < DET->MAX_CALO_VFWD)) {
|
---|
152 | //
|
---|
153 | //
|
---|
154 | // } // CASTOR
|
---|
155 | // */
|
---|
156 | //
|
---|