Fork me on GitHub

source: svn/trunk/src/SmearUtil.cc@ 243

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

JetUtils.cc

File size: 51.5 KB
Line 
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/// \file SmearUtil.cc
12/// \brief RESOLution class, and some generic definitions
13
14
15#include "SmearUtil.h"
16#include "TRandom.h"
17
18#include <iostream>
19#include <fstream>
20#include <sstream>
21#include <iomanip>
22using namespace std;
23
24
25ParticleUtil::ParticleUtil(const TLorentzVector &genMomentum, int pid) {
26 _pid=pid;
27 _e = genMomentum.E();
28 _px = genMomentum.Px();
29 _py = genMomentum.Py();
30 _pz = genMomentum.Pz();
31 _pt = genMomentum.Pt();
32
33 //_e, _px, _py, _pz, _pt;
34 //float _eta, _etaCalo, _phi, _phiCalo;
35 //int _pid;
36}
37
38//------------------------------------------------------------------------------
39
40RESOLution::RESOLution() {
41
42 // Detector characteristics
43 CEN_max_tracker = 2.5; // Maximum tracker coverage
44 CEN_max_calo_cen = 3.0; // central calorimeter coverage
45 CEN_max_calo_fwd = 5.0; // forward calorimeter pseudorapidity coverage
46 CEN_max_mu = 2.4; // muon chambers pseudorapidity coverage
47
48 // Energy resolution for electron/photon
49 // \sigma/E = C + N/E + S/\sqrt{E}
50 ELG_Scen = 0.05; // S term for central ECAL
51 ELG_Ncen = 0.25; // N term for central ECAL
52 ELG_Ccen = 0.005; // C term for central ECAL
53 ELG_Cfwd = 0.107; // S term for forward ECAL
54 ELG_Sfwd = 2.084; // C term for forward ECAL
55 ELG_Nfwd = 0.0; // N term for central ECAL
56
57 // Energy resolution for hadrons in ecal/hcal/hf
58 // \sigma/E = C + N/E + S/\sqrt{E}
59 HAD_Shcal = 1.5; // S term for central HCAL // hadronic calorimeter
60 HAD_Nhcal = 0.; // N term for central HCAL
61 HAD_Chcal = 0.05; // C term for central HCAL
62 HAD_Shf = 2.7; // S term for HF // forward calorimeter
63 HAD_Nhf = 0.; // N term for HF
64 HAD_Chf = 0.13; // C term for HF
65
66 // Muon smearing
67 MU_SmearPt = 0.01;
68
69 // Tracking efficiencies
70 TRACK_ptmin = 0.9; // minimal pt needed to reach the calorimeter in GeV
71 TRACK_eff = 100; // efficiency associated to the tracking
72
73 // Calorimetric towers
74 TOWER_number = 40;
75 const float tower_eta_edges[41] = {
76 0., 0.087, 0.174, 0.261, 0.348, 0.435, 0.522, 0.609, 0.696, 0.783, 0.870, 0.957, 1.044, 1.131, 1.218, 1.305, 1.392, 1.479, 1.566,
77 1.653, 1.740, 1.830, 1.930, 2.043, 2.172, 2.322, 2.500, 2.650, 2.868, 2.950, 3.125, 3.300, 3.475, 3.650, 3.825, 4.000, 4.175,
78 4.350, 4.525, 4.700, 5.000}; // temporary object
79 TOWER_eta_edges = new float[TOWER_number+1];
80 for(unsigned int i=0; i<TOWER_number +1; i++) TOWER_eta_edges[i] = tower_eta_edges[i];
81
82 const float tower_dphi[40] = {
83 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10,
84 10,10,10,10,10, 10,10,10,10,10, 10,10,10,10,10, 10,10,10,20, 20 }; // temporary object
85 TOWER_dphi = new float[TOWER_number];
86 for(unsigned int i=0; i<TOWER_number; i++) TOWER_dphi[i] = tower_dphi[i];
87
88
89 // Thresholds for reconstructed objetcs
90 PTCUT_elec = 10.0;
91 PTCUT_muon = 10.0;
92 PTCUT_jet = 20.0;
93 PTCUT_gamma = 10.0;
94 PTCUT_taujet = 10.0;
95
96 // General jet variable
97 JET_coneradius = 0.7; // generic jet radius ; not for tau's !!!
98 JET_jetalgo = 1; // 1 for Cone algorithm, 2 for MidPoint algorithm, 3 for SIScone algorithm, 4 for kt algorithm
99 JET_seed = 1.0; // minimum seed to start jet reconstruction
100
101 // Tagging definition
102 BTAG_b = 40;
103 BTAG_mistag_c = 10;
104 BTAG_mistag_l = 1;
105
106 // FLAGS
107 FLAG_bfield = 1; //1 to run the bfield propagation else 0
108 FLAG_vfd = 1; //1 to run the very forward detectors else 0
109 FLAG_trigger = 1; //1 to run the trigger selection else 0
110 FLAG_frog = 1; //1 to run the FROG event display
111
112 // In case BField propagation allowed
113 TRACK_radius = 129; //radius of the BField coverage
114 TRACK_length = 300; //length of the BField coverage
115 TRACK_bfield_x = 0; //X composant of the BField
116 TRACK_bfield_y = 0; //Y composant of the BField
117 TRACK_bfield_z = 3.8; //Z composant of the BField
118
119 // In case Very forward detectors allowed
120 VFD_min_calo_vfd = 5.2; // very forward calorimeter (if any) like CASTOR
121 VFD_max_calo_vfd = 6.6;
122 VFD_min_zdc = 8.3;
123 VFD_s_zdc = 140; // distance of the Zero Degree Calorimeter, from the Interaction poin, in [m]
124
125 RP_220_s = 220; // distance of the RP to the IP, in meters
126 RP_220_x = 0.002; // distance of the RP to the beam, in meters
127 RP_420_s = 420; // distance of the RP to the IP, in meters
128 RP_420_x = 0.004; // distance of the RP to the beam, in meters
129
130 // In case FROG event display allowed
131 NEvents_Frog = 10;
132
133 //********************************************
134 //jet stuffs not defined in the input datacard
135 //********************************************
136
137 JET_overlap = 0.75;
138 // MidPoint algorithm definition
139 JET_M_coneareafraction = 0.25;
140 JET_M_maxpairsize = 2;
141 JET_M_maxiterations = 100;
142 // Define Cone algorithm.
143 JET_C_adjacencycut = 2;
144 JET_C_maxiterations = 100;
145 JET_C_iratch = 1;
146 //Define SISCone algorithm.
147 JET_S_npass = 0;
148 JET_S_protojet_ptmin= 0.0;
149
150 //For Tau-jet definition
151 TAU_energy_scone = 0.15; // radius R of the cone for tau definition, based on energy threshold
152 TAU_track_scone = 0.4; // radius R of the cone for tau definition, based on track number
153 TAU_track_pt = 2; // minimal pt [GeV] for tracks to be considered in tau definition
154 TAU_energy_frac = 0.95; // fraction of energy required in the central part of the cone, for tau jets
155
156 PT_QUARKS_MIN = 2.0 ; // minimal pt needed by quarks to do b-tag
157
158}
159
160
161RESOLution::RESOLution(const RESOLution & DET) {
162 // Detector characteristics
163 CEN_max_tracker = DET.CEN_max_tracker;
164 CEN_max_calo_cen = DET.CEN_max_calo_cen;
165 CEN_max_calo_fwd = DET.CEN_max_calo_fwd;
166 CEN_max_mu = DET.CEN_max_mu;
167
168 // Energy resolution for electron/photon
169 ELG_Scen = DET.ELG_Scen;
170 ELG_Ncen = DET.ELG_Ncen;
171 ELG_Ccen = DET.ELG_Ccen;
172 ELG_Cfwd = DET.ELG_Cfwd;
173 ELG_Sfwd = DET.ELG_Sfwd;
174 ELG_Nfwd = DET.ELG_Nfwd;
175
176 // Energy resolution for hadrons in ecal/hcal/hf
177 HAD_Shcal = DET.HAD_Shcal;
178 HAD_Nhcal = DET.HAD_Nhcal;
179 HAD_Chcal = DET.HAD_Chcal;
180 HAD_Shf = DET.HAD_Shf;
181 HAD_Nhf = DET.HAD_Nhf;
182 HAD_Chf = DET.HAD_Chf;
183
184 // Muon smearing
185 MU_SmearPt = DET.MU_SmearPt;
186
187 // Tracking efficiencies
188 TRACK_ptmin = DET.TRACK_ptmin;
189 TRACK_eff = DET.TRACK_eff;
190
191 // Calorimetric towers
192 TOWER_number = DET.TOWER_number;
193 TOWER_eta_edges = new float[TOWER_number+1];
194 for(unsigned int i=0; i<TOWER_number +1; i++) TOWER_eta_edges[i] = DET.TOWER_eta_edges[i];
195
196 TOWER_dphi = new float[TOWER_number];
197 for(unsigned int i=0; i<TOWER_number; i++) TOWER_dphi[i] = DET.TOWER_dphi[i];
198
199 // Thresholds for reconstructed objetcs
200 PTCUT_elec = DET.PTCUT_elec;
201 PTCUT_muon = DET.PTCUT_muon;
202 PTCUT_jet = DET.PTCUT_jet;
203 PTCUT_gamma = DET.PTCUT_gamma;
204 PTCUT_taujet = DET.PTCUT_taujet;
205
206 // General jet variable
207 JET_coneradius = DET.JET_coneradius;
208 JET_jetalgo = DET.JET_jetalgo;
209 JET_seed = DET.JET_seed;
210
211 // Tagging definition
212 BTAG_b = DET.BTAG_b;
213 BTAG_mistag_c = DET.BTAG_mistag_c;
214 BTAG_mistag_l = DET.BTAG_mistag_l;
215
216 // FLAGS
217 FLAG_bfield = DET.FLAG_bfield;
218 FLAG_vfd = DET.FLAG_vfd;
219 FLAG_trigger = DET.FLAG_trigger;
220 FLAG_frog = DET.FLAG_frog;
221
222 // In case BField propagation allowed
223 TRACK_radius = DET.TRACK_radius;
224 TRACK_length = DET.TRACK_length;
225 TRACK_bfield_x = DET.TRACK_bfield_x;
226 TRACK_bfield_y = DET.TRACK_bfield_y;
227 TRACK_bfield_z = DET.TRACK_bfield_z;
228
229 // In case Very forward detectors allowed
230 VFD_min_calo_vfd = DET.VFD_min_calo_vfd;
231 VFD_max_calo_vfd = DET.VFD_max_calo_vfd;
232 VFD_min_zdc = DET.VFD_min_zdc;
233 VFD_s_zdc = DET.VFD_s_zdc;
234
235 RP_220_s = DET.RP_220_s;
236 RP_220_x = DET.RP_220_x;
237 RP_420_s = DET.RP_420_s;
238 RP_420_x = DET.RP_420_x;
239
240 // In case FROG event display allowed
241 NEvents_Frog = DET.NEvents_Frog;
242
243 JET_overlap = DET.JET_overlap;
244 // MidPoint algorithm definition
245 JET_M_coneareafraction = DET.JET_M_coneareafraction;
246 JET_M_maxpairsize = DET.JET_M_maxpairsize;
247 JET_M_maxiterations = DET.JET_M_maxiterations;
248 // Define Cone algorithm.
249 JET_C_adjacencycut = DET.JET_C_adjacencycut;
250 JET_C_maxiterations = DET.JET_C_maxiterations;
251 JET_C_iratch = DET.JET_C_iratch;
252 //Define SISCone algorithm.
253 JET_S_npass = DET.JET_S_npass;
254 JET_S_protojet_ptmin = DET.JET_S_protojet_ptmin;
255
256 //For Tau-jet definition
257 TAU_energy_scone = DET.TAU_energy_scone;
258 TAU_track_scone = DET.TAU_track_scone;
259 TAU_track_pt = DET.TAU_track_pt;
260 TAU_energy_frac = DET.TAU_energy_frac;
261
262 PT_QUARKS_MIN = DET.PT_QUARKS_MIN;
263}
264
265RESOLution& RESOLution::operator=(const RESOLution& DET) {
266 if(this==&DET) return *this;
267 // Detector characteristics
268 CEN_max_tracker = DET.CEN_max_tracker;
269 CEN_max_calo_cen = DET.CEN_max_calo_cen;
270 CEN_max_calo_fwd = DET.CEN_max_calo_fwd;
271 CEN_max_mu = DET.CEN_max_mu;
272
273 // Energy resolution for electron/photon
274 ELG_Scen = DET.ELG_Scen;
275 ELG_Ncen = DET.ELG_Ncen;
276 ELG_Ccen = DET.ELG_Ccen;
277 ELG_Cfwd = DET.ELG_Cfwd;
278 ELG_Sfwd = DET.ELG_Sfwd;
279 ELG_Nfwd = DET.ELG_Nfwd;
280
281 // Energy resolution for hadrons in ecal/hcal/hf
282 HAD_Shcal = DET.HAD_Shcal;
283 HAD_Nhcal = DET.HAD_Nhcal;
284 HAD_Chcal = DET.HAD_Chcal;
285 HAD_Shf = DET.HAD_Shf;
286 HAD_Nhf = DET.HAD_Nhf;
287 HAD_Chf = DET.HAD_Chf;
288
289 // Muon smearing
290 MU_SmearPt = DET.MU_SmearPt;
291
292 // Tracking efficiencies
293 TRACK_ptmin = DET.TRACK_ptmin;
294 TRACK_eff = DET.TRACK_eff;
295
296 // Calorimetric towers
297 TOWER_number = DET.TOWER_number;
298 TOWER_eta_edges = new float[TOWER_number+1];
299 for(unsigned int i=0; i<TOWER_number +1; i++) TOWER_eta_edges[i] = DET.TOWER_eta_edges[i];
300
301 TOWER_dphi = new float[TOWER_number];
302 for(unsigned int i=0; i<TOWER_number; i++) TOWER_dphi[i] = DET.TOWER_dphi[i];
303
304 // Thresholds for reconstructed objetcs
305 PTCUT_elec = DET.PTCUT_elec;
306 PTCUT_muon = DET.PTCUT_muon;
307 PTCUT_jet = DET.PTCUT_jet;
308 PTCUT_gamma = DET.PTCUT_gamma;
309 PTCUT_taujet = DET.PTCUT_taujet;
310
311 // General jet variable
312 JET_coneradius = DET.JET_coneradius;
313 JET_jetalgo = DET.JET_jetalgo;
314 JET_seed = DET.JET_seed;
315
316 // Tagging definition
317 BTAG_b = DET.BTAG_b;
318 BTAG_mistag_c = DET.BTAG_mistag_c;
319 BTAG_mistag_l = DET.BTAG_mistag_l;
320
321 // FLAGS
322 FLAG_bfield = DET.FLAG_bfield;
323 FLAG_vfd = DET.FLAG_vfd;
324 FLAG_trigger = DET.FLAG_trigger;
325 FLAG_frog = DET.FLAG_frog;
326
327 // In case BField propagation allowed
328 TRACK_radius = DET.TRACK_radius;
329 TRACK_length = DET.TRACK_length;
330 TRACK_bfield_x = DET.TRACK_bfield_x;
331 TRACK_bfield_y = DET.TRACK_bfield_y;
332 TRACK_bfield_z = DET.TRACK_bfield_z;
333
334 // In case Very forward detectors allowed
335 VFD_min_calo_vfd = DET.VFD_min_calo_vfd;
336 VFD_max_calo_vfd = DET.VFD_max_calo_vfd;
337 VFD_min_zdc = DET.VFD_min_zdc;
338 VFD_s_zdc = DET.VFD_s_zdc;
339
340 RP_220_s = DET.RP_220_s;
341 RP_220_x = DET.RP_220_x;
342 RP_420_s = DET.RP_420_s;
343 RP_420_x = DET.RP_420_x;
344
345 // In case FROG event display allowed
346 NEvents_Frog = DET.NEvents_Frog;
347
348 JET_overlap = DET.JET_overlap;
349 // MidPoint algorithm definition
350 JET_M_coneareafraction = DET.JET_M_coneareafraction;
351 JET_M_maxpairsize = DET.JET_M_maxpairsize;
352 JET_M_maxiterations = DET.JET_M_maxiterations;
353 // Define Cone algorithm.
354 JET_C_adjacencycut = DET.JET_C_adjacencycut;
355 JET_C_maxiterations = DET.JET_C_maxiterations;
356 JET_C_iratch = DET.JET_C_iratch;
357 //Define SISCone algorithm.
358 JET_S_npass = DET.JET_S_npass;
359 JET_S_protojet_ptmin = DET.JET_S_protojet_ptmin;
360
361 //For Tau-jet definition
362 TAU_energy_scone = DET.TAU_energy_scone;
363 TAU_track_scone = DET.TAU_track_scone;
364 TAU_track_pt = DET.TAU_track_pt;
365 TAU_energy_frac = DET.TAU_energy_frac;
366
367 PT_QUARKS_MIN = DET.PT_QUARKS_MIN;
368 return *this;
369}
370
371
372
373
374//------------------------------------------------------------------------------
375void RESOLution::ReadDataCard(const string datacard) {
376
377 string temp_string;
378 istringstream curstring;
379
380 ifstream fichier_a_lire(datacard.c_str());
381 if(!fichier_a_lire.good()) {
382 cout <<"** Datadard not found, use default values **" << endl;
383 return;
384 }
385
386 while (getline(fichier_a_lire,temp_string)) {
387 curstring.clear(); // needed when using several times istringstream::str(string)
388 curstring.str(temp_string);
389 string varname;
390 float value; int ivalue;
391
392 if(strstr(temp_string.c_str(),"#")) { }
393 else if(strstr(temp_string.c_str(),"CEN_max_tracker")) {curstring >> varname >> value; CEN_max_tracker = value;}
394 else if(strstr(temp_string.c_str(),"CEN_max_calo_cen")) {curstring >> varname >> value; CEN_max_calo_cen = value;}
395 else if(strstr(temp_string.c_str(),"CEN_max_calo_fwd")) {curstring >> varname >> value; CEN_max_calo_fwd = value;}
396 else if(strstr(temp_string.c_str(),"CEN_max_mu")) {curstring >> varname >> value; CEN_max_mu = value;}
397
398 else if(strstr(temp_string.c_str(),"VFD_min_calo_vfd")) {curstring >> varname >> value; VFD_min_calo_vfd = value;}
399 else if(strstr(temp_string.c_str(),"VFD_max_calo_vfd")) {curstring >> varname >> value; VFD_max_calo_vfd = value;}
400 else if(strstr(temp_string.c_str(),"VFD_min_zdc")) {curstring >> varname >> value; VFD_min_zdc = value;}
401 else if(strstr(temp_string.c_str(),"VFD_s_zdc")) {curstring >> varname >> value; VFD_s_zdc = value;}
402
403 else if(strstr(temp_string.c_str(),"RP_220_s")) {curstring >> varname >> value; RP_220_s = value;}
404 else if(strstr(temp_string.c_str(),"RP_220_x")) {curstring >> varname >> value; RP_220_x = value;}
405 else if(strstr(temp_string.c_str(),"RP_420_s")) {curstring >> varname >> value; RP_420_s = value;}
406 else if(strstr(temp_string.c_str(),"RP_420_x")) {curstring >> varname >> value; RP_420_x = value;}
407
408 else if(strstr(temp_string.c_str(),"ELG_Scen")) {curstring >> varname >> value; ELG_Scen = value;}
409 else if(strstr(temp_string.c_str(),"ELG_Ncen")) {curstring >> varname >> value; ELG_Ncen = value;}
410 else if(strstr(temp_string.c_str(),"ELG_Ccen")) {curstring >> varname >> value; ELG_Ccen = value;}
411 else if(strstr(temp_string.c_str(),"ELG_Sfwd")) {curstring >> varname >> value; ELG_Sfwd = value;}
412 else if(strstr(temp_string.c_str(),"ELG_Cfwd")) {curstring >> varname >> value; ELG_Cfwd = value;}
413 else if(strstr(temp_string.c_str(),"ELG_Nfwd")) {curstring >> varname >> value; ELG_Nfwd = value;}
414 else if(strstr(temp_string.c_str(),"HAD_Shcal")) {curstring >> varname >> value; HAD_Shcal = value;}
415 else if(strstr(temp_string.c_str(),"HAD_Nhcal")) {curstring >> varname >> value; HAD_Nhcal = value;}
416 else if(strstr(temp_string.c_str(),"HAD_Chcal")) {curstring >> varname >> value; HAD_Chcal = value;}
417 else if(strstr(temp_string.c_str(),"HAD_Shf")) {curstring >> varname >> value; HAD_Shf = value;}
418 else if(strstr(temp_string.c_str(),"HAD_Nhf")) {curstring >> varname >> value; HAD_Nhf = value;}
419 else if(strstr(temp_string.c_str(),"HAD_Chf")) {curstring >> varname >> value; HAD_Chf = value;}
420 else if(strstr(temp_string.c_str(),"MU_SmearPt")) {curstring >> varname >> value; MU_SmearPt = value;}
421
422 else if(strstr(temp_string.c_str(),"TRACK_radius")) {curstring >> varname >> ivalue;TRACK_radius = ivalue;}
423 else if(strstr(temp_string.c_str(),"TRACK_length")) {curstring >> varname >> ivalue;TRACK_length = ivalue;}
424 else if(strstr(temp_string.c_str(),"TRACK_bfield_x")) {curstring >> varname >> value; TRACK_bfield_x = value;}
425 else if(strstr(temp_string.c_str(),"TRACK_bfield_y")) {curstring >> varname >> value; TRACK_bfield_y = value;}
426 else if(strstr(temp_string.c_str(),"TRACK_bfield_z")) {curstring >> varname >> value; TRACK_bfield_z = value;}
427 else if(strstr(temp_string.c_str(),"FLAG_bfield")) {curstring >> varname >> ivalue; FLAG_bfield = ivalue;}
428 else if(strstr(temp_string.c_str(),"TRACK_ptmin")) {curstring >> varname >> value; TRACK_ptmin = value;}
429 else if(strstr(temp_string.c_str(),"TRACK_eff")) {curstring >> varname >> ivalue;TRACK_eff = ivalue;}
430
431 else if(strstr(temp_string.c_str(),"TOWER_number")) {curstring >> varname >> ivalue;TOWER_number = ivalue;}
432 else if(strstr(temp_string.c_str(),"TOWER_eta_edges")){
433 curstring >> varname; for(unsigned int i=0; i<TOWER_number+1; i++) {curstring >> value; TOWER_eta_edges[i] = value;} }
434 else if(strstr(temp_string.c_str(),"TOWER_dphi")){
435 curstring >> varname; for(unsigned int i=0; i<TOWER_number; i++) {curstring >> value; TOWER_dphi[i] = value;} }
436
437 else if(strstr(temp_string.c_str(),"PTCUT_elec")) {curstring >> varname >> value; PTCUT_elec = value;}
438 else if(strstr(temp_string.c_str(),"PTCUT_muon")) {curstring >> varname >> value; PTCUT_muon = value;}
439 else if(strstr(temp_string.c_str(),"PTCUT_jet")) {curstring >> varname >> value; PTCUT_jet = value;}
440 else if(strstr(temp_string.c_str(),"PTCUT_gamma")) {curstring >> varname >> value; PTCUT_gamma = value;}
441 else if(strstr(temp_string.c_str(),"PTCUT_taujet")) {curstring >> varname >> value; PTCUT_taujet = value;}
442
443 else if(strstr(temp_string.c_str(),"JET_coneradius")) {curstring >> varname >> value; JET_coneradius = value;}
444 else if(strstr(temp_string.c_str(),"JET_jetalgo")) {curstring >> varname >> ivalue;JET_jetalgo = ivalue;}
445 else if(strstr(temp_string.c_str(),"JET_seed")) {curstring >> varname >> value; JET_seed = value;}
446
447 else if(strstr(temp_string.c_str(),"BTAG_b")) {curstring >> varname >> ivalue;BTAG_b = ivalue;}
448 else if(strstr(temp_string.c_str(),"BTAG_mistag_c")) {curstring >> varname >> ivalue;BTAG_mistag_c = ivalue;}
449 else if(strstr(temp_string.c_str(),"BTAG_mistag_l")) {curstring >> varname >> ivalue;BTAG_mistag_l = ivalue;}
450
451 else if(strstr(temp_string.c_str(),"FLAG_vfd")) {curstring >> varname >> ivalue; FLAG_vfd = ivalue;}
452 else if(strstr(temp_string.c_str(),"FLAG_trigger")) {curstring >> varname >> ivalue; FLAG_trigger = ivalue;}
453 else if(strstr(temp_string.c_str(),"FLAG_frog")) {curstring >> varname >> ivalue; FLAG_frog = ivalue;}
454 else if(strstr(temp_string.c_str(),"NEvents_Frog")) {curstring >> varname >> ivalue; NEvents_Frog = ivalue;}
455 }
456
457 //jet stuffs not defined in the input datacard
458 JET_overlap = 0.75;
459 // MidPoint algorithm definition
460 JET_M_coneareafraction = 0.25;
461 JET_M_maxpairsize = 2;
462 JET_M_maxiterations = 100;
463 // Define Cone algorithm.
464 JET_C_adjacencycut = 2;
465 JET_C_maxiterations = 100;
466 JET_C_iratch = 1;
467 //Define SISCone algorithm.
468 JET_S_npass = 0;
469 JET_S_protojet_ptmin= 0.0;
470
471 //For Tau-jet definition
472 TAU_energy_scone = 0.15; // radius R of the cone for tau definition, based on energy threshold
473 TAU_track_scone = 0.4; // radius R of the cone for tau definition, based on track number
474 TAU_track_pt = 2; // minimal pt [GeV] for tracks to be considered in tau definition
475 TAU_energy_frac = 0.95; // fraction of energy required in the central part of the cone, for tau jets
476
477}
478
479void RESOLution::Logfile(const string& LogName) {
480 //void RESOLution::Logfile(string outputfilename) {
481
482 ofstream f_out(LogName.c_str());
483
484 f_out<<"#*********************************************************************"<<"\n";
485 f_out<<"# *"<<"\n";
486 f_out<<"# ---- DELPHES release 1.0 ---- *"<<"\n";
487 f_out<<"# *"<<"\n";
488 f_out<<"# A Fast Simulator for general purpose LHC detector *"<<"\n";
489 f_out<<"# Written by S. Ovyn and X. Rouby *"<<"\n";
490 f_out<<"# severine.ovyn@uclouvain.be *"<<"\n";
491 f_out<<"# *"<<"\n";
492 f_out<<"# http: *"<<"\n";
493 f_out<<"# *"<<"\n";
494 f_out<<"# Center for Particle Physics and Phenomenology (CP3) *"<<"\n";
495 f_out<<"# Universite Catholique de Louvain (UCL) *"<<"\n";
496 f_out<<"# Louvain-la-Neuve, Belgium *"<<"\n";
497 f_out<<"# *"<<"\n";
498 f_out<<"#....................................................................*"<<"\n";
499 f_out<<"# *"<<"\n";
500 f_out<<"# This package uses: *"<<"\n";
501 f_out<<"# FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] *"<<"\n";
502 f_out<<"# Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] *"<<"\n";
503 f_out<<"# ExRootAnalysis *"<<"\n";
504 f_out<<"# *"<<"\n";
505 f_out<<"#....................................................................*"<<"\n";
506 f_out<<"# *"<<"\n";
507 f_out<<"# This file contains all the running parameters (detector and cuts) *"<<"\n";
508 f_out<<"# necessary to reproduce the detector simulation *"<<"\n";
509 f_out<<"# *"<<"\n";
510 f_out<<"#....................................................................*"<<"\n";
511 f_out<<"#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n";
512 f_out<<"* *"<<"\n";
513 f_out<<"#******************************** *"<<"\n";
514 f_out<<"# Central detector caracteristics *"<<"\n";
515 f_out<<"#******************************** *"<<"\n";
516 f_out<<"* *"<<"\n";
517 f_out << left << setw(30) <<"* Maximum tracking system: "<<""
518 << left << setw(10) <<CEN_max_tracker <<""<< right << setw(15)<<"*"<<"\n";
519 f_out << left << setw(30) <<"* Maximum central calorimeter: "<<""
520 << left << setw(10) <<CEN_max_calo_cen <<""<< right << setw(15)<<"*"<<"\n";
521 f_out << left << setw(30) <<"* Maximum forward calorimeter: "<<""
522 << left << setw(10) <<CEN_max_calo_fwd <<""<< right << setw(15)<<"*"<<"\n";
523 f_out << left << setw(30) <<"* Muon chambers coverage: "<<""
524 << left << setw(10) <<CEN_max_mu <<""<< right << setw(15)<<"*"<<"\n";
525 f_out<<"* *"<<"\n";
526 if(FLAG_vfd==1){
527 f_out<<"#********************************** *"<<"\n";
528 f_out<<"# Very forward detector switches on *"<<"\n";
529 f_out<<"#********************************** *"<<"\n";
530 f_out<<"* *"<<"\n";
531 f_out << left << setw(55) <<"* Minimum very forward calorimeter: "<<""
532 << left << setw(5) <<VFD_min_calo_vfd <<""<< right << setw(10)<<"*"<<"\n";
533 f_out << left << setw(55) <<"* Maximum very forward calorimeter: "<<""
534 << left << setw(5) <<VFD_max_calo_vfd <<""<< right << setw(10)<<"*"<<"\n";
535 f_out << left << setw(55) <<"* Minimum coverage zero_degree calorimeter "<<""
536 << left << setw(5) <<VFD_min_zdc <<""<< right << setw(10)<<"*"<<"\n";
537 f_out << left << setw(55) <<"* Distance of the ZDC to the IP, in meters: "<<""
538 << left << setw(5) <<VFD_s_zdc <<""<< right << setw(10)<<"*"<<"\n";
539 f_out << left << setw(55) <<"* Distance of the RP to the IP, in meters: "<<""
540 << left << setw(5) <<RP_220_s <<""<< right << setw(10)<<"*"<<"\n";
541 f_out << left << setw(55) <<"* Distance of the RP to the beam, in meters: "<<""
542 << left << setw(5) <<RP_220_x <<""<< right << setw(10)<<"*"<<"\n";
543 f_out << left << setw(55) <<"* Distance of the RP to the IP, in meters: "<<""
544 << left << setw(5) <<RP_420_s <<""<< right << setw(10)<<"*"<<"\n";
545 f_out << left << setw(55) <<"* Distance of the RP to the beam, in meters: "<<""
546 << left << setw(5) <<RP_420_x <<""<< right << setw(10)<<"*"<<"\n";
547 f_out<<"* *"<<"\n";
548 }
549 else {
550 f_out<<"#*********************************** *"<<"\n";
551 f_out<<"# Very forward detector switches off *"<<"\n";
552 f_out<<"#*********************************** *"<<"\n";
553 f_out<<"* *"<<"\n";
554 }
555 f_out<<"#************************************ *"<<"\n";
556 f_out<<"# Electromagnetic smearing parameters *"<<"\n";
557 f_out<<"#************************************ *"<<"\n";
558 f_out<<"* *"<<"\n";
559 //# \sigma/E = C + N/E + S/\sqrt{E}
560 f_out << left << setw(30) <<"* S term for central ECAL: "<<""
561 << left << setw(30) <<ELG_Scen <<""<< right << setw(10)<<"*"<<"\n";
562 f_out << left << setw(30) <<"* N term for central ECAL: "<<""
563 << left << setw(30) <<ELG_Ncen <<""<< right << setw(10)<<"*"<<"\n";
564 f_out << left << setw(30) <<"* C term for central ECAL: "<<""
565 << left << setw(30) <<ELG_Ccen <<""<< right << setw(10)<<"*"<<"\n";
566 f_out << left << setw(30) <<"* S term for forward ECAL: "<<""
567 << left << setw(30) <<ELG_Sfwd <<""<< right << setw(10)<<"*"<<"\n";
568 f_out << left << setw(30) <<"* N term for forward ECAL: "<<""
569 << left << setw(30) <<ELG_Nfwd <<""<< right << setw(10)<<"*"<<"\n";
570 f_out << left << setw(30) <<"* C term for forward ECAL: "<<""
571 << left << setw(30) <<ELG_Cfwd <<""<< right << setw(10)<<"*"<<"\n";
572 f_out<<"* *"<<"\n";
573 f_out<<"#***************************** *"<<"\n";
574 f_out<<"# Hadronic smearing parameters *"<<"\n";
575 f_out<<"#***************************** *"<<"\n";
576 f_out<<"* *"<<"\n";
577 f_out << left << setw(30) <<"* S term for central HCAL: "<<""
578 << left << setw(30) <<HAD_Shcal <<""<< right << setw(10)<<"*"<<"\n";
579 f_out << left << setw(30) <<"* N term for central HCAL: "<<""
580 << left << setw(30) <<HAD_Nhcal <<""<< right << setw(10)<<"*"<<"\n";
581 f_out << left << setw(30) <<"* C term for central HCAL: "<<""
582 << left << setw(30) <<HAD_Chcal <<""<< right << setw(10)<<"*"<<"\n";
583 f_out << left << setw(30) <<"* S term for forward HCAL: "<<""
584 << left << setw(30) <<HAD_Shf <<""<< right << setw(10)<<"*"<<"\n";
585 f_out << left << setw(30) <<"* N term for forward HCAL: "<<""
586 << left << setw(30) <<HAD_Nhf <<""<< right << setw(10)<<"*"<<"\n";
587 f_out << left << setw(30) <<"* C term for forward HCAL: "<<""
588 << left << setw(30) <<HAD_Chf <<""<< right << setw(10)<<"*"<<"\n";
589 f_out<<"* *"<<"\n";
590 f_out<<"#************************* *"<<"\n";
591 f_out<<"# Muon smearing parameters *"<<"\n";
592 f_out<<"#************************* *"<<"\n";
593 f_out<<"* *"<<"\n";
594 f_out << left << setw(55) <<"* PT resolution for muons : "<<""
595 << left << setw(5) <<MU_SmearPt <<""<< right << setw(10)<<"*"<<"\n";
596 f_out<<"* *"<<"\n";
597 if(FLAG_bfield==1){
598 f_out<<"#*************************** *"<<"\n";
599 f_out<<"# Magnetic field switches on *"<<"\n";
600 f_out<<"#*************************** *"<<"\n";
601 f_out<<"* *"<<"\n";
602 f_out << left << setw(55) <<"* Radius of the BField coverage: "<<""
603 << left << setw(5) <<TRACK_radius <<""<< right << setw(10)<<"*"<<"\n";
604 f_out << left << setw(55) <<"* Length of the BField coverage: "<<""
605 << left << setw(5) <<TRACK_length <<""<< right << setw(10)<<"*"<<"\n";
606 f_out << left << setw(55) <<"* BField X component: "<<""
607 << left << setw(5) <<TRACK_bfield_x <<""<< right << setw(10)<<"*"<<"\n";
608 f_out << left << setw(55) <<"* BField Y component: "<<""
609 << left << setw(5) <<TRACK_bfield_y <<""<< right << setw(10)<<"*"<<"\n";
610 f_out << left << setw(55) <<"* BField Z component: "<<""
611 << left << setw(5) <<TRACK_bfield_z <<""<< right << setw(10)<<"*"<<"\n";
612 f_out << left << setw(55) <<"* Minimal pT needed to reach the calorimeter [GeV]: "<<""
613 << left << setw(10) <<TRACK_ptmin <<""<< right << setw(5)<<"*"<<"\n";
614 f_out << left << setw(55) <<"* Efficiency associated to the tracking: "<<""
615 << left << setw(10) <<TRACK_eff <<""<< right << setw(5)<<"*"<<"\n";
616 f_out<<"* *"<<"\n";
617 }
618 else {
619 f_out<<"#**************************** *"<<"\n";
620 f_out<<"# Magnetic field switches off *"<<"\n";
621 f_out<<"#**************************** *"<<"\n";
622 f_out << left << setw(55) <<"* Minimal pT needed to reach the calorimeter [GeV]: "<<""
623 << left << setw(10) <<TRACK_ptmin <<""<< right << setw(5)<<"*"<<"\n";
624 f_out << left << setw(55) <<"* Efficiency associated to the tracking: "<<""
625 << left << setw(10) <<TRACK_eff <<""<< right << setw(5)<<"*"<<"\n";
626 f_out<<"* *"<<"\n";
627 }
628 f_out<<"#******************** *"<<"\n";
629 f_out<<"# Calorimetric Towers *"<<"\n";
630 f_out<<"#******************** *"<<"\n";
631 f_out << left << setw(55) <<"* Number of calorimetric towers in eta, for eta>0: "<<""
632 << left << setw(5) << TOWER_number <<""<< right << setw(10)<<"*"<<"\n";
633 f_out << left << setw(55) <<"* Tower edges in eta, for eta>0: "<<"" << right << setw(15)<<"*"<<"\n";
634 f_out << "* ";
635 for (unsigned int i=0; i<TOWER_number+1; i++) {
636 f_out << left << setw(7) << TOWER_eta_edges[i];
637 if(!( (i+1) %9 )) f_out << right << setw(3) << "*" << "\n" << "* ";
638 }
639 for (unsigned int i=(TOWER_number+1)%9; i<9; i++) f_out << left << setw(7) << "";
640 f_out << right << setw(3)<<"*"<<"\n";
641 f_out << left << setw(55) <<"* Tower sizes in phi, for eta>0 [degree]:"<<"" << right << setw(15)<<"*"<<"\n";
642 f_out << "* ";
643 for (unsigned int i=0; i<TOWER_number; i++) {
644 f_out << left << setw(7) << TOWER_dphi[i];
645 if(!( (i+1) %9 )) f_out << right << setw(3) << "*" << "\n" << "* ";
646 }
647 for (unsigned int i=(TOWER_number)%9; i<9; i++) f_out << left << setw(7) << "";
648 f_out << right << setw(3)<<"*"<<"\n";
649 f_out<<"* *"<<"\n";
650 f_out<<"#******************* *"<<"\n";
651 f_out<<"# Minimum pT's [GeV] *"<<"\n";
652 f_out<<"#******************* *"<<"\n";
653 f_out<<"* *"<<"\n";
654 f_out << left << setw(40) <<"* Minimum pT for electrons: "<<""
655 << left << setw(20) <<PTCUT_elec <<""<< right << setw(10)<<"*"<<"\n";
656 f_out << left << setw(40) <<"* Minimum pT for muons: "<<""
657 << left << setw(20) <<PTCUT_muon <<""<< right << setw(10)<<"*"<<"\n";
658 f_out << left << setw(40) <<"* Minimum pT for jets: "<<""
659 << left << setw(20) <<PTCUT_jet <<""<< right << setw(10)<<"*"<<"\n";
660 f_out << left << setw(40) <<"* Minimum pT for Tau-jets: "<<""
661 << left << setw(20) <<PTCUT_taujet <<""<< right << setw(10)<<"*"<<"\n";
662 f_out << left << setw(40) <<"* Minimum pT for photons: "<<""
663 << left << setw(20) <<PTCUT_gamma <<""<< right << setw(10)<<"*"<<"\n";
664 f_out<<"* *"<<"\n";
665 f_out<<"#*************** *"<<"\n";
666 f_out<<"# Jet definition *"<<"\n";
667 f_out<<"#*************** *"<<"\n";
668 f_out<<"* *"<<"\n";
669 f_out<<"* Six algorithms are currently available: *"<<"\n";
670 f_out<<"* - 1) CDF cone algorithm, *"<<"\n";
671 f_out<<"* - 2) CDF MidPoint algorithm, *"<<"\n";
672 f_out<<"* - 3) SIScone algorithm, *"<<"\n";
673 f_out<<"* - 4) kt algorithm, *"<<"\n";
674 f_out<<"* - 5) Cambrigde/Aachen algorithm, *"<<"\n";
675 f_out<<"* - 6) Anti-kt algorithm. *"<<"\n";
676 f_out<<"* *"<<"\n";
677 f_out<<"* You have chosen *"<<"\n";
678 switch(JET_jetalgo) {
679 default:
680 case 1: {
681 f_out<<"* CDF JetClu jet algorithm with parameters: *"<<"\n";
682 f_out << left << setw(40) <<"* - Seed threshold: "<<""
683 << left << setw(10) <<JET_seed <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
684 f_out << left << setw(40) <<"* - Cone radius: "<<""
685 << left << setw(10) <<JET_coneradius <<""<< right << setw(20)<<"*"<<"\n";
686 f_out << left << setw(40) <<"* - Adjacency cut: "<<""
687 << left << setw(10) <<JET_C_adjacencycut <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
688 f_out << left << setw(40) <<"* - Max iterations: "<<""
689 << left << setw(10) <<JET_C_maxiterations <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
690 f_out << left << setw(40) <<"* - Iratch: "<<""
691 << left << setw(10) <<JET_C_iratch <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
692 f_out << left << setw(40) <<"* - Overlap threshold: "<<""
693 << left << setw(10) <<JET_overlap <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
694 }
695 break;
696 case 2: {
697 f_out<<"* CDF midpoint jet algorithm with parameters: *"<<"\n";
698 f_out << left << setw(40) <<"* - Seed threshold: "<<""
699 << left << setw(20) <<JET_seed <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
700 f_out << left << setw(40) <<"* - Cone radius: "<<""
701 << left << setw(20) <<JET_coneradius <<""<< right << setw(10)<<"*"<<"\n";
702 f_out << left << setw(40) <<"* - Cone area fraction:"<<""
703 << left << setw(20) <<JET_M_coneareafraction <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
704 f_out << left << setw(40) <<"* - Maximum pair size: "<<""
705 << left << setw(20) <<JET_M_maxpairsize <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
706 f_out << left << setw(40) <<"* - Max iterations: "<<""
707 << left << setw(20) <<JET_M_maxiterations <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
708 f_out << left << setw(40) <<"* - Overlap threshold: "<<""
709 << left << setw(20) <<JET_overlap <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
710 }
711 break;
712 case 3: {
713 f_out <<"* SISCone jet algorithm with parameters: *"<<"\n";
714 f_out << left << setw(40) <<"* - Cone radius: "<<""
715 << left << setw(20) <<JET_coneradius <<""<< right << setw(10)<<"*"<<"\n";
716 f_out << left << setw(40) <<"* - Overlap threshold: "<<""
717 << left << setw(20) <<JET_overlap <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
718 f_out << left << setw(40) <<"* - Number pass max: "<<""
719 << left << setw(20) <<JET_S_npass <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
720 f_out << left << setw(40) <<"* - Minimum pT for protojet: "<<""
721 << left << setw(20) <<JET_S_protojet_ptmin <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
722 }
723 break;
724 case 4: {
725 f_out <<"* KT jet algorithm with parameters: *"<<"\n";
726 f_out << left << setw(40) <<"* - Cone radius: "<<""
727 << left << setw(20) <<JET_coneradius <<""<< right << setw(10)<<"*"<<"\n";
728 }
729 break;
730 case 5: {
731 f_out <<"* Cambridge/Aachen jet algorithm with parameters: *"<<"\n";
732 f_out << left << setw(40) <<"* - Cone radius: "<<""
733 << left << setw(20) <<JET_coneradius <<""<< right << setw(10)<<"*"<<"\n";
734 }
735 break;
736 case 6: {
737 f_out <<"* Anti-kt jet algorithm with parameters: *"<<"\n";
738 f_out << left << setw(40) <<"* - Cone radius: "<<""
739 << left << setw(20) <<JET_coneradius <<""<< right << setw(10)<<"*"<<"\n";
740 }
741 break;
742 }
743 f_out<<"* *"<<"\n";
744 f_out<<"#****************************** *"<<"\n";
745 f_out<<"# Tau-jet definition parameters *"<<"\n";
746 f_out<<"#****************************** *"<<"\n";
747 f_out<<"* *"<<"\n";
748 f_out << left << setw(45) <<"* Cone radius for calorimeter tagging: "<<""
749 << left << setw(5) <<TAU_energy_scone <<""<< right << setw(20)<<"*"<<"\n";
750 f_out << left << setw(45) <<"* Fraction of energy in the small cone: "<<""
751 << left << setw(5) <<TAU_energy_frac*100 <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
752 f_out << left << setw(45) <<"* Cone radius for tracking tagging: "<<""
753 << left << setw(5) <<TAU_track_scone <<""<< right << setw(20)<<"*"<<"\n";
754 f_out << left << setw(45) <<"* Minimum track pT [GeV]: "<<""
755 << left << setw(5) <<TAU_track_pt <<""<< right << setw(20)<<"*"<<"\n";
756 f_out<<"* *"<<"\n";
757 f_out<<"#*************************** *"<<"\n";
758 f_out<<"# B-tagging efficiencies [%] *"<<"\n";
759 f_out<<"#*************************** *"<<"\n";
760 f_out<<"* *"<<"\n";
761 f_out << left << setw(50) <<"* Efficiency to tag a \"b\" as a b-jet: "<<""
762 << left << setw(10) <<BTAG_b <<""<< right << setw(10)<<"*"<<"\n";
763 f_out << left << setw(50) <<"* Efficiency to mistag a c-jet as a b-jet: "<<""
764 << left << setw(10) <<BTAG_mistag_c <<""<< right << setw(10)<<"*"<<"\n";
765 f_out << left << setw(50) <<"* Efficiency to mistag a light jet as a b-jet: "<<""
766 << left << setw(10) <<BTAG_mistag_l <<""<< right << setw(10)<<"*"<<"\n";
767 f_out<<"* *"<<"\n";
768 f_out<<"* *"<<"\n";
769 f_out<<"#....................................................................*"<<"\n";
770 f_out<<"#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n";
771
772}
773
774// **********Provides the smeared TLorentzVector for the electrons********
775// Smears the electron energy, and changes the 4-momentum accordingly
776// different smearing if the electron is central (eta < 2.5) or forward
777void RESOLution::SmearElectron(TLorentzVector &electron) {
778 // the 'electron' variable will be changed by the function
779 float energy = electron.E(); // before smearing
780 float energyS = 0.0; // after smearing // \sigma/E = C + N/E + S/\sqrt{E}
781
782 if(fabs(electron.Eta()) < CEN_max_tracker) { // if the electron is inside the tracker
783 energyS = gRandom->Gaus(energy, sqrt(
784 pow(ELG_Ncen,2) +
785 pow(ELG_Ccen*energy,2) +
786 pow(ELG_Scen*sqrt(energy),2) ));
787 }
788 if(fabs(electron.Eta()) > CEN_max_tracker && fabs(electron.Eta()) < CEN_max_calo_fwd){
789 energyS = gRandom->Gaus(energy, sqrt(
790 pow(ELG_Nfwd,2) +
791 pow(ELG_Cfwd*energy,2) +
792 pow(ELG_Sfwd*sqrt(energy),2) ) );
793 }
794 electron.SetPtEtaPhiE(energyS/cosh(electron.Eta()), electron.Eta(), electron.Phi(), energyS);
795 if(electron.E() < 0)electron.SetPxPyPzE(0,0,0,0); // no negative values after smearing !
796}
797
798
799// **********Provides the smeared TLorentzVector for the muons********
800// Smears the muon pT and changes the 4-momentum accordingly
801void RESOLution::SmearMu(TLorentzVector &muon) {
802 // the 'muon' variable will be changed by the function
803 float pt = muon.Pt(); // before smearing
804 float ptS=pt;
805
806 if(fabs(muon.Eta()) < CEN_max_mu )
807 {
808 ptS = gRandom->Gaus(pt, MU_SmearPt*pt ); // after smearing // \sigma/E = C + N/E + S/\sqrt{E}
809 }
810 muon.SetPtEtaPhiE(ptS, muon.Eta(), muon.Phi(), ptS*cosh(muon.Eta()));
811
812 if(muon.E() < 0)muon.SetPxPyPzE(0,0,0,0); // no negative values after smearing !
813}
814
815
816// **********Provides the smeared TLorentzVector for the hadrons********
817// Smears the hadron 4-momentum
818void RESOLution::SmearHadron(TLorentzVector &hadron, const float frac)
819 // the 'hadron' variable will be changed by the function
820 // the 'frac' variable describes the long-living particles. Should be 0.7 for K0S and Lambda, 1. otherwise
821{
822 float energy = hadron.E(); // before smearing
823 float energyS = 0.0; // after smearing // \sigma/E = C + N/E + S/\sqrt{E}
824 float energy_ecal = (1.0 - frac)*energy; // electromagnetic calorimeter
825 float energy_hcal = frac*energy; // hadronic calorimeter
826 // frac takes into account the decay of long-living particles, that decay in the calorimeters
827 // some of the particles decay mostly in the ecal, some mostly in the hcal
828
829 float energyS1,energyS2;
830 if(fabs(hadron.Eta()) < CEN_max_calo_cen) {
831 energyS1 = gRandom->Gaus(energy_hcal, sqrt(
832 pow(HAD_Nhcal,2) +
833 pow(HAD_Chcal*energy_hcal,2) +
834 pow(HAD_Shcal*sqrt(energy_hcal),2) )) ;
835
836
837 energyS2 = gRandom->Gaus(energy_ecal, sqrt(
838 pow(ELG_Ncen,2) +
839 pow(ELG_Ccen*energy_ecal,2) +
840 pow(ELG_Scen*sqrt(energy_ecal),2) ) );
841
842 energyS = ((energyS1>0)?energyS1:0) + ((energyS2>0)?energyS2:0);
843 }
844 if(fabs(hadron.Eta()) > CEN_max_calo_cen && fabs(hadron.Eta()) < CEN_max_calo_fwd){
845 energyS = gRandom->Gaus(energy, sqrt(
846 pow(HAD_Nhf,2) +
847 pow(HAD_Chf*energy,2) +
848 pow(HAD_Shf*sqrt(energy),2) ));
849}
850
851
852
853 hadron.SetPtEtaPhiE(energyS/cosh(hadron.Eta()),hadron.Eta(), hadron.Phi(), energyS);
854
855 if(hadron.E() < 0)hadron.SetPxPyPzE(0,0,0,0);
856}
857
858//******************************************************************************************
859
860void RESOLution::SortedVector(vector<ParticleUtil> &vect)
861{
862 int i,j = 0;
863 TLorentzVector tmp;
864 bool en_desordre = true;
865 int entries=vect.size();
866 for(i = 0 ; (i < entries) && en_desordre; i++)
867 {
868 en_desordre = false;
869 for(j = 1 ; j < entries - i ; j++)
870 {
871 if ( vect[j].Pt() > vect[j-1].Pt() )
872 {
873 ParticleUtil tmp = vect[j-1];
874 vect[j-1] = vect[j];
875 vect[j] = tmp;
876 en_desordre = true;
877 }
878 }
879 }
880}
881
882// **********Provides the energy in the cone of radius TAU_CONE_ENERGY for the tau identification********
883// to be taken into account, a calo tower should
884// 1) have a transverse energy \f$ E_T = \sqrt{E_X^2 + E_Y^2} \f$ above a given threshold
885// 2) be inside a cone with a radius R and the axis defined by (eta,phi)
886double RESOLution::EnergySmallCone(const vector<PhysicsTower> &towers, const float eta, const float phi) {
887 double Energie=0;
888 for(unsigned int i=0; i < towers.size(); i++) {
889 if(towers[i].fourVector.pt() < JET_seed) continue;
890 if((DeltaR(phi,eta,towers[i].fourVector.phi(),towers[i].fourVector.eta()) < TAU_energy_scone)) {
891 Energie += towers[i].fourVector.E;
892 }
893 }
894 return Energie;
895}
896
897
898// **********Provides the number of tracks in the cone of radius TAU_CONE_TRACKS for the tau identification********
899// to be taken into account, a track should
900// 1) avec a transverse momentum \$f p_T \$ above a given threshold
901// 2) be inside a cone with a radius R and the axis defined by (eta,phi)
902// IMPORTANT REMARK !!!!!
903// previously, the argument 'phi' was before the argument 'eta'
904// this has been changed for consistency with the other functions
905// double check your running code that uses NumTracks !
906unsigned int RESOLution::NumTracks(const vector<TLorentzVector> &tracks, const float pt_track, const float eta, const float phi) {
907 unsigned int numtrack=0;
908 for(unsigned int i=0; i < tracks.size(); i++) {
909 if((tracks[i].Pt() < pt_track )||
910 (DeltaR(phi,eta,tracks[i].Phi(),tracks[i].Eta()) > TAU_track_scone)
911 )continue;
912 numtrack++;
913 }
914 return numtrack;
915}
916
917
918//*** Returns the PID of the particle with the highest energy, in a cone with a radius CONERADIUS and an axis (eta,phi) *********
919//used by Btaggedjet
920///// Attention : bug removed => CONERADIUS/2 -> CONERADIUS !!
921int RESOLution::Bjets(const TSimpleArray<TRootGenParticle> &subarray, const float eta, const float phi) {
922 float emax=0;
923 int Ppid=0;
924 if(subarray.GetEntries()>0) {
925 for(int i=0; i < subarray.GetEntries();i++) { // should have pt>PT_JETMIN and a small cone radius (r<CONE_JET)
926 float genDeltaR = DeltaR(subarray[i]->Phi,subarray[i]->Eta,phi,eta);
927 if(genDeltaR < JET_coneradius && subarray[i]->E > emax) {
928 emax=subarray[i]->E;
929 Ppid=abs(subarray[i]->PID);
930 }
931 }
932 }
933 return Ppid;
934}
935
936
937//******************** Simulates the b-tagging efficiency for real bjet, or the misendentification for other jets****************
938bool RESOLution::Btaggedjet(const TLorentzVector &JET, const TSimpleArray<TRootGenParticle> &subarray) {
939 if( rand()%100 < (BTAG_b+1) && Bjets(subarray,JET.Eta(),JET.Phi())==pB ) return true; // b-tag of b-jets is 40%
940 else if( rand()%100 < (BTAG_mistag_c+1) && Bjets(subarray,JET.Eta(),JET.Phi())==pC ) return true; // b-tag of c-jets is 10%
941 else if( rand()%100 < (BTAG_mistag_l+1) && Bjets(subarray,JET.Eta(),JET.Phi())!=0) return true; // b-tag of light jets is 1%
942 return false;
943}
944
945//***********************Isolation criteria***********************
946//****************************************************************
947bool RESOLution::Isolation(const float phi, const float eta,const vector<TLorentzVector> &tracks, const float pt_second_track)
948{
949 bool isolated = false;
950 float deltar=5000.; // Initial value; should be high; no further repercussion
951 // loop on all final charged particles, with p_t >2, close enough from the electron
952 for(unsigned int i=0; i < tracks.size(); i++)
953 {
954 if(tracks[i].Pt() < pt_second_track)continue;
955 float genDeltaR = DeltaR(phi,eta,tracks[i].Phi(),tracks[i].Eta());
956 if(
957 (genDeltaR > deltar) ||
958 (genDeltaR==0)
959 ) continue ;
960 deltar=genDeltaR;
961 }
962 if(deltar > 0.5) isolated = true;
963 return isolated;
964}
965
966
967 //********** returns a segmented value for eta and phi, for calo towers *****
968void RESOLution::BinEtaPhi(const float phi, const float eta, float& iPhi, float& iEta){
969 iEta = -100;
970 int index=-100;
971 for (unsigned int i=1; i< TOWER_number+1; i++) {
972 if(fabs(eta)>TOWER_eta_edges[i-1] && fabs(eta)<TOWER_eta_edges[i]) {
973 iEta = (eta>0) ? TOWER_eta_edges[i-1] : -TOWER_eta_edges[i];
974 index = i-1;
975 //cout << setw(15) << left << eta << "\t" << iEta << endl;
976 break;
977 }
978 }
979 if(index==-100) return;
980 iPhi = -100;
981 float dphi = TOWER_dphi[index]*PI/180.;
982 for (unsigned int i=1; i < 360/TOWER_dphi[index]; i++ ) {
983 float low = -PI+(i-1)*dphi;
984 float high= low+dphi;
985 if(phi > low && phi < high ){
986 iPhi = low;
987 break;
988 }
989 }
990 if (phi > PI-dphi) iPhi = PI-dphi;
991}
992
993//**************************** Returns the delta Phi ****************************
994float DeltaPhi(const float phi1, const float phi2) {
995 float deltaphi=phi1-phi2; // in here, -PI < phi < PI
996 if(fabs(deltaphi) > PI) {
997 deltaphi=2.*PI -fabs(deltaphi);// put deltaphi between 0 and PI
998 }
999 else deltaphi=fabs(deltaphi);
1000
1001 return deltaphi;
1002}
1003
1004//**************************** Returns the delta R****************************
1005float DeltaR(const float phi1, const float eta1, const float phi2, const float eta2) {
1006 return sqrt(pow(DeltaPhi(phi1,phi2),2) + pow(eta1-eta2,2));
1007}
1008
1009int sign(const int myint) {
1010 if (myint >0) return 1;
1011 else if (myint <0) return -1;
1012 else return 0;
1013}
1014
1015int sign(const float myfloat) {
1016 if (myfloat >0) return 1;
1017 else if (myfloat <0) return -1;
1018 else return 0;
1019}
1020
1021int Charge(const int pid)
1022{
1023 int charge;
1024 if(
1025 (pid == pGAMMA) ||
1026 (pid == pPI0) ||
1027 (pid == pK0L) ||
1028 (pid == pN) ||
1029 (pid == pSIGMA0) ||
1030 (pid == pDELTA0) ||
1031 (pid == pK0S) // not charged particles : invisible by tracker
1032 )
1033 charge = 0;
1034 else charge = (sign(pid));
1035 return charge;
1036
1037}
Note: See TracBrowser for help on using the repository browser.