Fork me on GitHub

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

Last change on this file since 404 was 389, checked in by Xavier Rouby, 16 years ago

temp modif

File size: 14.2 KB
RevLine 
[260]1/***********************************************************************
2** **
3** /----------------------------------------------\ **
4** | Delphes, a framework for the fast simulation | **
5** | of a generic collider experiment | **
[374]6** \------------- arXiv:0903.2225v1 ------------/ **
[260]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***********************************************************************/
[53]31
[219]32#include "VeryForward.h"
33#include "H_RomanPot.h"
[377]34#include "PdgParticle.h"
[53]35#include <iostream>
36#include<cmath>
37
38using namespace std;
39
40
41//------------------------------------------------------------------------------
[374]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
[219]49}
50
[374]51VeryForward::VeryForward(const string& DetDatacard) :
52 DET(new RESOLution())
53 {
[219]54 DET->ReadDataCard(DetDatacard);
[374]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
[219]61}
62
[374]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
[219]70}
71
[374]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) {
[219]77}
78
79VeryForward& VeryForward::operator=(const VeryForward& vf){
80 if (this==&vf) return *this;
81 DET = new RESOLution(*(vf.DET));
[374]82 d_max = vf.d_max;
[219]83 beamline1 = new H_BeamLine(*(vf.beamline1));
84 beamline2 = new H_BeamLine(*(vf.beamline2));
[374]85 relative_energy =vf.relative_energy;
86 kickers_on = vf.kickers_on;
[219]87 return *this;
88}
89
90
91void VeryForward::init() {
[53]92 //Initialisation of Hector
[385]93 static unsigned int counter;
94 counter =0;
[53]95 relative_energy = true; // should always be true
96 kickers_on = 1; // should always be 1
[257]97 beamline1->fill(DET->RP_beam1Card,1,DET->RP_IP_name);
[252]98 beamline1->offsetElements(DET->RP_offsetEl_s,-DET->RP_offsetEl_x);
[377]99 H_RomanPot * rp220_1 = new H_RomanPot("rp220_1",DET->RP_220_s,DET->RP_220_x*1E6); // RP 220m, 2mm, beam 1
100 H_RomanPot * rp420_1 = new H_RomanPot("rp420_1",DET->RP_420_s,DET->RP_420_x*1E6); // RP 420m, 4mm, beam 1
[242]101 beamline1->add(rp220_1);
[53]102 beamline1->add(rp420_1);
103
[257]104 beamline2->fill(DET->RP_beam2Card,-1,DET->RP_IP_name);
[252]105 beamline2->offsetElements(DET->RP_offsetEl_s,+DET->RP_offsetEl_x);
[377]106 H_RomanPot * rp220_2 = new H_RomanPot("rp220_2",DET->RP_220_s,DET->RP_220_x*1E6);// RP 220m, 2mm, beam 2
107 H_RomanPot * rp420_2 = new H_RomanPot("rp420_2",DET->RP_420_s,DET->RP_420_x*1E6);// RP 420m, 4mm, beam 2
[53]108 beamline2->add(rp220_2);
109 beamline2->add(rp420_2);
[242]110 // rp220_1, rp220_2, rp420_1 and rp420_2 will be deallocated in ~H_AbstractBeamLine
111 // do not put explicit delete
[53]112}
113
[242]114
[377]115
[374]116void VeryForward::ZDC(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchZDC, TRootGenParticle *particle)
[53]117{
118 TRootZdcHits *elementZdc;
[374]119 float energy = particle->E;
120
[53]121 // Zero degree calorimeter, for forward neutrons and photons
[374]122 if (particle->Status ==1 && ( (particle->PID==pN && energy>DET->ZDC_n_E) ||
123 (particle->PID==pGAMMA && energy>DET->ZDC_gamma_E) )
124 && fabs(particle->Eta) > DET->VFD_min_zdc ) {
[53]125 elementZdc = (TRootZdcHits*) branchZDC->NewEntry();
[377]126
[385]127
128 elementZdc->pid = particle->PID;
129
[377]130
131 // for compatibility with 'old' version
132 TLorentzVector genMomentum;
133 genMomentum.SetPxPyPzE(particle->Px, particle->Py, particle->Pz, particle->E);
134 elementZdc->Set(genMomentum);
135 // ******************
136
137
138 //particle->print();
139
[374]140 // 1) energy smearing
141 float energyS = -1.;
142 if (particle->PID == pGAMMA)
143 energyS = gRandom->Gaus(particle->E, sqrt( pow(DET->ELG_Nzdc,2) +
144 pow(DET->ELG_Czdc*particle->E,2) +
145 pow(DET->ELG_Szdc*sqrt(particle->E),2) ));
146 else // smearing with hadronic resolution
147 energyS = gRandom->Gaus(particle->E, sqrt( pow(DET->HAD_Nzdc,2) +
148 pow(DET->HAD_Czdc*particle->E,2) +
149 pow(DET->HAD_Szdc*sqrt(particle->E),2) ));
150 elementZdc->E = energyS;
151
152
153 // 2) time of flight t is t = T + d/[ cos(theta) v ]
154 float cos_theta = 1; //very good approximation, if eta_zdc >3
155 if (DET->VFD_min_zdc<3) { // if smaller eta -> make the complete calculation
156 double tx = atan(particle->Px/particle->Pz);
157 double ty = atan(particle->Py/particle->Pz);
158 double theta = sqrt( pow(tx,2) + pow(ty,2) );
159 //cout << "tx = " << tx << " ty = " << ty << " theta = " << theta << " cos(theta) = " << cos(theta) << endl;
160 // NB: in practice, eta= 8 <-> theta 0.038° <-> 7x10^-4 rad <-> cos(theta) ~1
161 // eta = 2.6 <-> cos(theta) = 0.99
162 // eta = 3.0 <-> cos(theta) = 0.995
163 cos_theta = cos(theta);
164 }
165 // units from StdHEP : Z [mm] T[mm/c]
166 // units from Delphes : VFD_s_zdc [m] speed_of_light [m/s]
167 double flight_distance = (DET->VFD_s_zdc - particle->Z*(1E-3))/cos_theta ;
168 double flight_time = (flight_distance + 1E-3 * particle->T )/speed_of_light; // assumes highly relativistic particles, [s]
169 double timeS = gRandom->Gaus(flight_time,DET->ZDC_T_resolution);
170 elementZdc->T = timeS;
171
172 // 3) side: which ZDC has been hit?
[355]173 elementZdc->side = sign(particle->Eta);
[374]174
175 // 4) object nature : e.m. (photon) or had (neutron) ?
[377]176 //elementZdc->hadronic_hit = (bool) (particle->PID==pN);
[53]177 }
178}
[377]179
180
[53]181void VeryForward::RomanPots(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchRP220,ExRootTreeBranch *branchFP420,TRootGenParticle *particle)
182{
[377]183 float charge = particle->Charge, mass = particle->M;
184 if (mass<-999) { // unitialised!
185 PdgParticle pdg_part = DET->PDGtable[particle->PID];
186 charge = pdg_part.charge();
187 mass = pdg_part.mass();
188 }
189 //if(particle->Charge!=1) return; // only particles with Q=+1 can hope to reach RP200/FP420
190
[53]191 TRootRomanPotHits* elementRP220;
[377]192 //TRootForwardTaggerHits* elementFP420;
193 TRootRomanPotHits* elementFP420;
[53]194
195 TLorentzVector genMomentum;
196 genMomentum.SetPxPyPzE(particle->Px, particle->Py, particle->Pz, particle->E);
[377]197
198 // to go faster, why not rejecting particles already going into the ZDC?
[385]199 if( particle->PID == pP)
[377]200 if( (particle->Status == 1) && (fabs(genMomentum.Eta()) > DET->CEN_max_calo_fwd) )
[53]201 {
[377]202 //cout << "VeryForward :: M = " << mass << "\t Q = " << charge << "\t\t " << particle->PID << endl;
[385]203 H_BeamParticle p1(mass,charge);
[377]204 p1.smearAng(); p1.smearPos(); // vertex smearing
[385]205 cout << "x = " << p1.getX() + DET->RP_cross_x
206 << " y= " << p1.getY() + DET->RP_cross_y
207 << " tx= " << p1.getTX() - kickers_on*DET->RP_cross_ang
208 << " ty=" << p1.getTY() << endl;
209 p1.setPosition(p1.getX()+DET->RP_cross_x,p1.getY()+DET->RP_cross_y,p1.getTX()-kickers_on*DET->RP_cross_ang,p1.getTY(),0);
210 //p1.set4Momentum(particle->Px,particle->Py,particle->Pz,particle->E);
211 p1.setE(particle->E);
212
[53]213 H_BeamLine *beamline;
214 if(genMomentum.Eta() >0) beamline = beamline1;
215 else beamline = beamline2;
216
217 p1.computePath(beamline,1);
218
219 if(p1.stopped(beamline)) {
220 if (p1.getStoppingElement()->getName()=="rp220_1" || p1.getStoppingElement()->getName()=="rp220_2") {
[385]221 static unsigned int counter;
222 counter++;
223 if (counter==1) {
[389]224 //p1.getPath(0,"p1path.txt");
[385]225 cout << "RP : " << particle->PID << "\t" << charge << "=" << particle->Charge
226 << "\t" << mass << "=" << particle->M
227 << "\t E=" << particle->E
228 << endl;
229 }
[100]230 p1.propagate(DET->RP_220_s);
[53]231 elementRP220 = (TRootRomanPotHits*) branchRP220->NewEntry();
232 elementRP220->X = (1E-6)*p1.getX(); // [m]
233 elementRP220->Y = (1E-6)*p1.getY(); // [m]
234 elementRP220->Tx = (1E-6)*p1.getTX(); // [rad]
235 elementRP220->Ty = (1E-6)*p1.getTY(); // [rad]
236 elementRP220->S = p1.getS(); // [m]
[374]237
238 /* time of flight t is t = T + d/[ cos(theta) v ]
239 // nb: here we assume a straight path to the detector, which is not the case!
240 // this time estimate is always underestimated (while exact for the ZDC case)
241 float cos_theta = 1; //very good approximation, if CEN_max_calo_fwd >3
242 if (DET->CEN_max_calo_fwd<3) { // if smaller eta -> make the complete calculation
243 double tx = atan(particle->Px/particle->Pz);
244 double ty = atan(particle->Py/particle->Pz);
245 double theta = sqrt( pow(tx,2) + pow(ty,2) );
246 //cout << "tx = " << tx << " ty = " << ty << " theta = " << theta << " cos(theta) = " << cos(theta) << endl;
247 // NB: in practice, eta= 8 <-> theta 0.038° <-> 7x10^-4 rad <-> cos(theta) ~1
248 // eta = 2.6 <-> cos(theta) = 0.99
249 // eta = 3.0 <-> cos(theta) = 0.995
250 cos_theta = cos(theta);
251 }
252 // units from StdHEP : Z [mm] T[mm/c]
253 // units from Delphes : p1.getS [m] speed_of_light [m/s]
254 //double flight_distance = (p1.getS() - particle->Z*(1E-3))/cos_theta ;
255 //elementRP220->T = (flight_distance + 1E-3 * particle->T )/speed_of_light; // assumes highly relativistic particles, [s]
256 */
257 elementRP220->E = p1.getE(); // not yet implemented
258 elementRP220->q2 = -1; // not yet implemented
259 elementRP220->side = sign(particle->Eta);
[385]260
261
262 elementRP220->pid = particle->PID;
[53]263
264 } else if (p1.getStoppingElement()->getName()=="rp420_1" || p1.getStoppingElement()->getName()=="rp420_2") {
[100]265 p1.propagate(DET->RP_420_s);
[377]266 //elementFP420 = (TRootForwardTaggerHits*) branchFP420->NewEntry();
267 elementFP420 = (TRootRomanPotHits*) branchFP420->NewEntry();
[53]268 elementFP420->X = (1E-6)*p1.getX(); // [m]
269 elementFP420->Y = (1E-6)*p1.getY(); // [m]
270 elementFP420->Tx = (1E-6)*p1.getTX(); // [rad]
271 elementFP420->Ty = (1E-6)*p1.getTY(); // [rad]
[355]272 elementFP420->S = p1.getS(); // [m]
[374]273
274 // time of flight t is t = T + d/[ cos(theta) v ]
275 // nb: here we assume a straight path to the detector, which is not the case!
276 // this time estimate is always underestimated (while exact for the ZDC case)
277 float cos_theta = 1; //very good approximation, if CEN_max_calo_fwd >3
278 if (DET->CEN_max_calo_fwd<3) { // if smaller eta -> make the complete calculation
279 double tx = atan(particle->Px/particle->Pz);
280 double ty = atan(particle->Py/particle->Pz);
281 double theta = sqrt( pow(tx,2) + pow(ty,2) );
282 //cout << "tx = " << tx << " ty = " << ty << " theta = " << theta << " cos(theta) = " << cos(theta) << endl;
283 // NB: in practice, eta= 8 <-> theta 0.038° <-> 7x10^-4 rad <-> cos(theta) ~1
284 // eta = 2.6 <-> cos(theta) = 0.99
285 // eta = 3.0 <-> cos(theta) = 0.995
286 cos_theta = cos(theta);
287 }
288 // units from StdHEP : Z [mm] T[mm/c]
289 // units from Delphes : p1.getS [m] speed_of_light [m/s]
290 double flight_distance = (p1.getS() - particle->Z*(1E-3))/cos_theta ;
291 elementFP420->T = (flight_distance + 1E-3 * particle->T )/speed_of_light; // assumes highly relativistic particles, [s]
[53]292 elementFP420->E = p1.getE(); // not yet implemented
293 elementFP420->q2 = -1; // not yet implemented
[355]294 elementFP420->side = sign(particle->Eta);
[385]295
296
297 elementFP420->pid = particle->PID;
[53]298 }
299
300 }
[355]301 // if(p1.stopped(beamline) && (p1.getStoppingElement()->getS() > 100))
302 // cout << "Eloss =" << 7000.-p1.getE() << " ; " << p1.getStoppingElement()->getName() << endl;
[53]303 } // if forward proton
304}
305
306 // Forward particles in CASTOR ?
[355]307 // if (particle->Status == 1 && (fabs(particle->Eta) > DET->MIN_CALO_VFWD)
308 // && (fabs(particle->Eta) < DET->MAX_CALO_VFWD)) {
[53]309 //
310 //
[355]311 // } // CASTOR
312 // */
313
Note: See TracBrowser for help on using the repository browser.