Fork me on GitHub

source: svn/trunk/src/VeryForward.cc@ 377

Last change on this file since 377 was 377, checked in by Xavier Rouby, 15 years ago

new PDG table ; switch back to old ZDC and old RomanPots

File size: 13.6 KB
Line 
1/***********************************************************************
2** **
3** /----------------------------------------------\ **
4** | Delphes, a framework for the fast simulation | **
5** | of a generic collider experiment | **
6** \------------- arXiv:0903.2225v1 ------------/ **
7** **
8** **
9** This package uses: **
10** ------------------ **
11** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **
12** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **
13** FROG: [hep-ex/0901.2718v1] **
14** **
15** ------------------------------------------------------------------ **
16** **
17** Main authors: **
18** ------------- **
19** **
20** Severine Ovyn Xavier Rouby **
21** severine.ovyn@uclouvain.be xavier.rouby@cern **
22** **
23** Center for Particle Physics and Phenomenology (CP3) **
24** Universite catholique de Louvain (UCL) **
25** Louvain-la-Neuve, Belgium **
26** **
27** Copyright (C) 2008-2009, **
28** All rights reserved. **
29** **
30***********************************************************************/
31
32#include "VeryForward.h"
33#include "H_RomanPot.h"
34#include "PdgParticle.h"
35#include <iostream>
36#include<cmath>
37
38using namespace std;
39
40
41//------------------------------------------------------------------------------
42VeryForward::VeryForward() :
43 DET(new RESOLution()), d_max(1.+std::max(DET->RP_420_s,DET->RP_220_s)),
44 beamline1(new H_BeamLine(1,d_max)), beamline2(new H_BeamLine(1,d_max)),
45 relative_energy(true), // should always be true
46 kickers_on(1) // should always be 1
47 {
48 init(); //Initialisation of Hector
49}
50
51VeryForward::VeryForward(const string& DetDatacard) :
52 DET(new RESOLution())
53 {
54 DET->ReadDataCard(DetDatacard);
55 const float d_max = 1.+std::max(DET->RP_420_s,DET->RP_220_s);
56 beamline1 = new H_BeamLine(1,d_max);
57 beamline2 = new H_BeamLine(1,d_max);
58 init(); //Initialisation of Hector
59 relative_energy = true; // should always be true
60 kickers_on = 1; // should always be 1
61}
62
63VeryForward::VeryForward(const RESOLution * DetDatacard) :
64 DET(new RESOLution(*DetDatacard)), d_max(1.+std::max(DET->RP_420_s,DET->RP_220_s)),
65 beamline1(new H_BeamLine(1,d_max)), beamline2(new H_BeamLine(1,d_max)),
66 relative_energy(true), // should always be true
67 kickers_on(1) // should always be 1
68 {
69 init(); //Initialisation of Hector
70}
71
72VeryForward::VeryForward(const VeryForward& vf) :
73 DET(new RESOLution(*(vf.DET))), d_max(vf.d_max),
74 beamline1(new H_BeamLine(*(vf.beamline1))), beamline2(new H_BeamLine(*(vf.beamline2))),
75 relative_energy(vf.relative_energy),
76 kickers_on(vf.kickers_on) {
77}
78
79VeryForward& VeryForward::operator=(const VeryForward& vf){
80 if (this==&vf) return *this;
81 DET = new RESOLution(*(vf.DET));
82 d_max = vf.d_max;
83 beamline1 = new H_BeamLine(*(vf.beamline1));
84 beamline2 = new H_BeamLine(*(vf.beamline2));
85 relative_energy =vf.relative_energy;
86 kickers_on = vf.kickers_on;
87 return *this;
88}
89
90
91void VeryForward::init() {
92 //Initialisation of Hector
93 relative_energy = true; // should always be true
94 kickers_on = 1; // should always be 1
95 beamline1->fill(DET->RP_beam1Card,1,DET->RP_IP_name);
96 beamline1->offsetElements(DET->RP_offsetEl_s,-DET->RP_offsetEl_x);
97 H_RomanPot * rp220_1 = new H_RomanPot("rp220_1",DET->RP_220_s,DET->RP_220_x*1E6); // RP 220m, 2mm, beam 1
98 H_RomanPot * rp420_1 = new H_RomanPot("rp420_1",DET->RP_420_s,DET->RP_420_x*1E6); // RP 420m, 4mm, beam 1
99 beamline1->add(rp220_1);
100 beamline1->add(rp420_1);
101
102 beamline2->fill(DET->RP_beam2Card,-1,DET->RP_IP_name);
103 beamline2->offsetElements(DET->RP_offsetEl_s,+DET->RP_offsetEl_x);
104 H_RomanPot * rp220_2 = new H_RomanPot("rp220_2",DET->RP_220_s,DET->RP_220_x*1E6);// RP 220m, 2mm, beam 2
105 H_RomanPot * rp420_2 = new H_RomanPot("rp420_2",DET->RP_420_s,DET->RP_420_x*1E6);// RP 420m, 4mm, beam 2
106 beamline2->add(rp220_2);
107 beamline2->add(rp420_2);
108 // rp220_1, rp220_2, rp420_1 and rp420_2 will be deallocated in ~H_AbstractBeamLine
109 // do not put explicit delete
110}
111
112
113
114void VeryForward::ZDC(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchZDC, TRootGenParticle *particle)
115{
116 TRootZdcHits *elementZdc;
117 float energy = particle->E;
118
119 // Zero degree calorimeter, for forward neutrons and photons
120 if (particle->Status ==1 && ( (particle->PID==pN && energy>DET->ZDC_n_E) ||
121 (particle->PID==pGAMMA && energy>DET->ZDC_gamma_E) )
122 && fabs(particle->Eta) > DET->VFD_min_zdc ) {
123 elementZdc = (TRootZdcHits*) branchZDC->NewEntry();
124
125
126 // for compatibility with 'old' version
127 TLorentzVector genMomentum;
128 genMomentum.SetPxPyPzE(particle->Px, particle->Py, particle->Pz, particle->E);
129 elementZdc->Set(genMomentum);
130 // ******************
131
132
133 //particle->print();
134
135 // 1) energy smearing
136 float energyS = -1.;
137 if (particle->PID == pGAMMA)
138 energyS = gRandom->Gaus(particle->E, sqrt( pow(DET->ELG_Nzdc,2) +
139 pow(DET->ELG_Czdc*particle->E,2) +
140 pow(DET->ELG_Szdc*sqrt(particle->E),2) ));
141 else // smearing with hadronic resolution
142 energyS = gRandom->Gaus(particle->E, sqrt( pow(DET->HAD_Nzdc,2) +
143 pow(DET->HAD_Czdc*particle->E,2) +
144 pow(DET->HAD_Szdc*sqrt(particle->E),2) ));
145 elementZdc->E = energyS;
146
147
148 // 2) time of flight t is t = T + d/[ cos(theta) v ]
149 float cos_theta = 1; //very good approximation, if eta_zdc >3
150 if (DET->VFD_min_zdc<3) { // if smaller eta -> make the complete calculation
151 double tx = atan(particle->Px/particle->Pz);
152 double ty = atan(particle->Py/particle->Pz);
153 double theta = sqrt( pow(tx,2) + pow(ty,2) );
154 //cout << "tx = " << tx << " ty = " << ty << " theta = " << theta << " cos(theta) = " << cos(theta) << endl;
155 // NB: in practice, eta= 8 <-> theta 0.038° <-> 7x10^-4 rad <-> cos(theta) ~1
156 // eta = 2.6 <-> cos(theta) = 0.99
157 // eta = 3.0 <-> cos(theta) = 0.995
158 cos_theta = cos(theta);
159 }
160 // units from StdHEP : Z [mm] T[mm/c]
161 // units from Delphes : VFD_s_zdc [m] speed_of_light [m/s]
162 double flight_distance = (DET->VFD_s_zdc - particle->Z*(1E-3))/cos_theta ;
163 double flight_time = (flight_distance + 1E-3 * particle->T )/speed_of_light; // assumes highly relativistic particles, [s]
164 double timeS = gRandom->Gaus(flight_time,DET->ZDC_T_resolution);
165 elementZdc->T = timeS;
166
167 // 3) side: which ZDC has been hit?
168 elementZdc->side = sign(particle->Eta);
169
170 // 4) object nature : e.m. (photon) or had (neutron) ?
171 //elementZdc->hadronic_hit = (bool) (particle->PID==pN);
172 }
173}
174
175
176void VeryForward::RomanPots(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchRP220,ExRootTreeBranch *branchFP420,TRootGenParticle *particle)
177{
178 float charge = particle->Charge, mass = particle->M;
179 if (mass<-999) { // unitialised!
180 PdgParticle pdg_part = DET->PDGtable[particle->PID];
181 charge = pdg_part.charge();
182 mass = pdg_part.mass();
183 }
184 //if(particle->Charge!=1) return; // only particles with Q=+1 can hope to reach RP200/FP420
185
186 TRootRomanPotHits* elementRP220;
187 //TRootForwardTaggerHits* elementFP420;
188 TRootRomanPotHits* elementFP420;
189
190 TLorentzVector genMomentum;
191 genMomentum.SetPxPyPzE(particle->Px, particle->Py, particle->Pz, particle->E);
192
193 // to go faster, why not rejecting particles already going into the ZDC?
194 if( (particle->Status == 1) && (fabs(genMomentum.Eta()) > DET->CEN_max_calo_fwd) )
195 {
196 //cout << "VeryForward :: M = " << mass << "\t Q = " << charge << "\t\t " << particle->PID << endl;
197 H_BeamParticle p1(mass,charge); /// put here particle->CHARGE and particle->MASS
198 p1.smearAng(); p1.smearPos(); // vertex smearing
199 p1.setPosition(p1.getX()+DET->RP_cross_x,p1.getY()+DET->RP_cross_y,p1.getTX()-1*kickers_on*DET->RP_cross_ang,p1.getTY(),0);
200 p1.set4Momentum(particle->Px,particle->Py,particle->Pz,particle->E);
201
202 H_BeamLine *beamline;
203 if(genMomentum.Eta() >0) beamline = beamline1;
204 else beamline = beamline2;
205
206 p1.computePath(beamline,1);
207
208 if(p1.stopped(beamline)) {
209 if (p1.getStoppingElement()->getName()=="rp220_1" || p1.getStoppingElement()->getName()=="rp220_2") {
210 p1.propagate(DET->RP_220_s);
211 elementRP220 = (TRootRomanPotHits*) branchRP220->NewEntry();
212 elementRP220->X = (1E-6)*p1.getX(); // [m]
213 elementRP220->Y = (1E-6)*p1.getY(); // [m]
214 elementRP220->Tx = (1E-6)*p1.getTX(); // [rad]
215 elementRP220->Ty = (1E-6)*p1.getTY(); // [rad]
216 elementRP220->S = p1.getS(); // [m]
217
218 /* time of flight t is t = T + d/[ cos(theta) v ]
219 // nb: here we assume a straight path to the detector, which is not the case!
220 // this time estimate is always underestimated (while exact for the ZDC case)
221 float cos_theta = 1; //very good approximation, if CEN_max_calo_fwd >3
222 if (DET->CEN_max_calo_fwd<3) { // if smaller eta -> make the complete calculation
223 double tx = atan(particle->Px/particle->Pz);
224 double ty = atan(particle->Py/particle->Pz);
225 double theta = sqrt( pow(tx,2) + pow(ty,2) );
226 //cout << "tx = " << tx << " ty = " << ty << " theta = " << theta << " cos(theta) = " << cos(theta) << endl;
227 // NB: in practice, eta= 8 <-> theta 0.038° <-> 7x10^-4 rad <-> cos(theta) ~1
228 // eta = 2.6 <-> cos(theta) = 0.99
229 // eta = 3.0 <-> cos(theta) = 0.995
230 cos_theta = cos(theta);
231 }
232 // units from StdHEP : Z [mm] T[mm/c]
233 // units from Delphes : p1.getS [m] speed_of_light [m/s]
234 //double flight_distance = (p1.getS() - particle->Z*(1E-3))/cos_theta ;
235 //elementRP220->T = (flight_distance + 1E-3 * particle->T )/speed_of_light; // assumes highly relativistic particles, [s]
236 */
237 elementRP220->E = p1.getE(); // not yet implemented
238 elementRP220->q2 = -1; // not yet implemented
239 elementRP220->side = sign(particle->Eta);
240
241 } else if (p1.getStoppingElement()->getName()=="rp420_1" || p1.getStoppingElement()->getName()=="rp420_2") {
242 p1.propagate(DET->RP_420_s);
243 //elementFP420 = (TRootForwardTaggerHits*) branchFP420->NewEntry();
244 elementFP420 = (TRootRomanPotHits*) branchFP420->NewEntry();
245 elementFP420->X = (1E-6)*p1.getX(); // [m]
246 elementFP420->Y = (1E-6)*p1.getY(); // [m]
247 elementFP420->Tx = (1E-6)*p1.getTX(); // [rad]
248 elementFP420->Ty = (1E-6)*p1.getTY(); // [rad]
249 elementFP420->S = p1.getS(); // [m]
250
251 // time of flight t is t = T + d/[ cos(theta) v ]
252 // nb: here we assume a straight path to the detector, which is not the case!
253 // this time estimate is always underestimated (while exact for the ZDC case)
254 float cos_theta = 1; //very good approximation, if CEN_max_calo_fwd >3
255 if (DET->CEN_max_calo_fwd<3) { // if smaller eta -> make the complete calculation
256 double tx = atan(particle->Px/particle->Pz);
257 double ty = atan(particle->Py/particle->Pz);
258 double theta = sqrt( pow(tx,2) + pow(ty,2) );
259 //cout << "tx = " << tx << " ty = " << ty << " theta = " << theta << " cos(theta) = " << cos(theta) << endl;
260 // NB: in practice, eta= 8 <-> theta 0.038° <-> 7x10^-4 rad <-> cos(theta) ~1
261 // eta = 2.6 <-> cos(theta) = 0.99
262 // eta = 3.0 <-> cos(theta) = 0.995
263 cos_theta = cos(theta);
264 }
265 // units from StdHEP : Z [mm] T[mm/c]
266 // units from Delphes : p1.getS [m] speed_of_light [m/s]
267 double flight_distance = (p1.getS() - particle->Z*(1E-3))/cos_theta ;
268 elementFP420->T = (flight_distance + 1E-3 * particle->T )/speed_of_light; // assumes highly relativistic particles, [s]
269 elementFP420->E = p1.getE(); // not yet implemented
270 elementFP420->q2 = -1; // not yet implemented
271 elementFP420->side = sign(particle->Eta);
272 }
273
274 }
275 // if(p1.stopped(beamline) && (p1.getStoppingElement()->getS() > 100))
276 // cout << "Eloss =" << 7000.-p1.getE() << " ; " << p1.getStoppingElement()->getName() << endl;
277 } // if forward proton
278}
279
280 // Forward particles in CASTOR ?
281 // if (particle->Status == 1 && (fabs(particle->Eta) > DET->MIN_CALO_VFWD)
282 // && (fabs(particle->Eta) < DET->MAX_CALO_VFWD)) {
283 //
284 //
285 // } // CASTOR
286 // */
287
Note: See TracBrowser for help on using the repository browser.