Fork me on GitHub

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

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

commented code removed

File size: 84.4 KB
Line 
1/***********************************************************************
2** **
3** /----------------------------------------------\ **
4** | Delphes, a framework for the fast simulation | **
5** | of a generic collider experiment | **
6** \----------------------------------------------/ **
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
33/// \file SmearUtil.cc
34/// \brief RESOLution class, and some generic definitions
35
36
37#include "SmearUtil.h"
38#include "TRandom.h"
39#include "TStopwatch.h"
40
41#include <iostream>
42#include <fstream>
43#include <sstream>
44#include <iomanip>
45#include <map>
46using namespace std;
47
48//------------------------------------------------------------------------------
49
50RESOLution::RESOLution() {
51
52 // Detector characteristics
53 CEN_max_tracker = 2.5; // Maximum tracker coverage
54 CEN_max_calo_cen = 3.0; // central calorimeter coverage
55 CEN_max_calo_fwd = 5.0; // forward calorimeter pseudorapidity coverage
56 CEN_max_mu = 2.4; // muon chambers pseudorapidity coverage
57
58 // Energy resolution for electron/photon
59 // \sigma/E = C + N/E + S/\sqrt{E}
60 ELG_Scen = 0.05; // S term for central ECAL
61 ELG_Ncen = 0.25; // N term for central ECAL
62 ELG_Ccen = 0.005; // C term for central ECAL
63 ELG_Sfwd = 2.084; // S term for FCAL
64 ELG_Nfwd = 0.0; // N term for FCAL
65 ELG_Cfwd = 0.107; // C term for FCAL
66 ELG_Szdc = 0.70; // S term for ZDC
67 ELG_Nzdc = 0.0; // N term for ZDC
68 ELG_Czdc = 0.08; // C term for ZDC
69
70 // Energy resolution for hadrons in ecal/hcal/hf
71 // \sigma/E = C + N/E + S/\sqrt{E}
72 HAD_Shcal = 1.5; // S term for central HCAL
73 HAD_Nhcal = 0.; // N term for central HCAL
74 HAD_Chcal = 0.05; // C term for central HCAL
75 HAD_Shf = 2.7; // S term for FCAL
76 HAD_Nhf = 0.; // N term for FCAL
77 HAD_Chf = 0.13; // C term for FCAL
78 HAD_Szdc = 1.38; // S term for ZDC
79 HAD_Nzdc = 0.; // N term for ZDC
80 HAD_Czdc = 0.13; // C term for ZDC
81
82 // Muon smearing
83 MU_SmearPt = 0.01;
84
85 // time resolution
86 ZDC_T_resolution = 0; // resolution for time measurement [s]
87 RP220_T_resolution = 0;
88 RP420_T_resolution = 0;
89
90 // Tracking efficiencies
91 TRACK_ptmin = 0.9; // minimal pt needed to reach the calorimeter in GeV
92 TRACK_eff = 100; // efficiency associated to the tracking
93
94 // Calorimetric towers
95 TOWER_number = 40;
96 const float tower_eta_edges[41] = {
97 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,
98 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,
99 4.350, 4.525, 4.700, 5.000}; // temporary object
100 TOWER_eta_edges = new float[TOWER_number+1];
101 for(unsigned int i=0; i<TOWER_number +1; i++) TOWER_eta_edges[i] = tower_eta_edges[i];
102
103 const float tower_dphi[40] = {
104 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10,
105 10,10,10,10,10, 10,10,10,10,10, 10,10,10,10,10, 10,10,10,20, 20 }; // temporary object
106 TOWER_dphi = new float[TOWER_number];
107 for(unsigned int i=0; i<TOWER_number; i++) TOWER_dphi[i] = tower_dphi[i];
108
109
110 // Thresholds for reconstructed objetcs (GeV)
111 PTCUT_elec = 10.0;
112 PTCUT_muon = 10.0;
113 PTCUT_jet = 20.0;
114 PTCUT_gamma = 10.0;
115 PTCUT_taujet = 10.0;
116
117 ZDC_gamma_E = 20; // GeV
118 ZDC_n_E = 50; // GeV
119
120 // Isolation
121 ISOL_PT = 2.0; //minimal pt of tracks for isolation criteria
122 ISOL_Cone = 0.5; //Cone for isolation criteria
123 ISOL_Calo_ET = 1E99; //minimal tower energy for isolation criteria. Default off = 1E99
124 ISOL_Calo_Grid = 3; //Grid size (N x N) for calorimetric isolation -- should be odd
125
126 // General jet variable
127 JET_coneradius = 0.7; // generic jet radius ; not for tau's !!!
128 JET_jetalgo = 1; // 1 for Cone algorithm, 2 for MidPoint algorithm, 3 for SIScone algorithm, 4 for kt algorithm
129 JET_seed = 1.0; // minimum seed to start jet reconstruction
130 JET_Eflow = 1; // 1 for Energy flow in jets reco ; 0 if not
131
132 // Tagging definition
133 BTAG_b = 40;
134 BTAG_mistag_c = 10;
135 BTAG_mistag_l = 1;
136
137 // FLAGS
138 FLAG_bfield = 1; //1 to run the bfield propagation else 0
139 FLAG_vfd = 1; //1 to run the very forward detectors else 0
140 FLAG_RP = 1; //1 to run the zero degree calorimeter else 0
141 FLAG_trigger = 1; //1 to run the trigger selection else 0
142 FLAG_frog = 1; //1 to run the FROG event display
143 FLAG_lhco = 1;
144
145 // In case BField propagation allowed
146 TRACK_radius = 129; //radius of the BField coverage
147 TRACK_length = 300; //length of the BField coverage
148 TRACK_bfield_x = 0; //X composant of the BField
149 TRACK_bfield_y = 0; //Y composant of the BField
150 TRACK_bfield_z = 3.8; //Z composant of the BField
151
152 // In case Very forward detectors allowed
153 VFD_min_calo_vfd = 5.2; // very forward calorimeter (if any) like CASTOR
154 VFD_max_calo_vfd = 6.6;
155 VFD_min_zdc = 8.3;
156 VFD_s_zdc = 140; // distance of the Zero Degree Calorimeter, from the Interaction poin, in [m]
157
158 RP_220_s = 220; // distance of the RP to the IP, in meters
159 RP_220_x = 0.002; // distance of the RP to the beam, in meters
160 RP_420_s = 420; // distance of the RP to the IP, in meters
161 RP_420_x = 0.004; // distance of the RP to the beam, in meters
162 RP_IP_name = "IP5";
163 RP_beam1Card = "data/LHCB1IR5_v6.500.tfs";
164 RP_beam2Card = "data/LHCB1IR5_v6.500.tfs";
165
166 // In case FROG event display allowed
167 NEvents_Frog = 10;
168
169 // Number of events to be processed
170 NEvents = -1;
171
172 //********************************************
173 //jet stuffs not defined in the input datacard
174 //********************************************
175
176 JET_overlap = 0.75;
177 // MidPoint algorithm definition
178 JET_M_coneareafraction = 0.25;
179 JET_M_maxpairsize = 2;
180 JET_M_maxiterations = 100;
181 // Define Cone algorithm.
182 JET_C_adjacencycut = 2;
183 JET_C_maxiterations = 100;
184 JET_C_iratch = 1;
185 //Define SISCone algorithm.
186 JET_S_npass = 0;
187 JET_S_protojet_ptmin= 0.0;
188
189 //For Tau-jet definition
190 TAU_energy_scone = 0.15; // radius R of the cone for tau definition, based on energy threshold
191 TAU_track_scone = 0.4; // radius R of the cone for tau definition, based on track number
192 TAU_track_pt = 2; // minimal pt [GeV] for tracks to be considered in tau definition
193 TAU_energy_frac = 0.95; // fraction of energy required in the central part of the cone, for tau jets
194
195 PT_QUARKS_MIN = 2.0 ; // minimal pt needed by quarks to do b-tag
196
197 //for very forward detectors
198 RP_offsetEl_s = 120; // distance of beam separation point, from IP
199 RP_offsetEl_x = -0.097; // half distance of separation of beams in horizontal plan, in m
200 RP_offsetEl_y = 0; // half distance of separation of beams in vertical plan, in m
201 RP_cross_x = -500; // IP offset in horizontal plane, in micrometers
202 RP_cross_y = 0.0; // IP offset in vertical plane, in micrometers
203 RP_cross_ang_x = 142.5; // half-crossing angle in horizontal plane, in microrad
204 RP_cross_ang_y = 0.0; // half-crossing angle in vertical plane, in microrad
205
206
207 PdgTableFilename = "data/particle.tbl";
208
209}
210
211
212RESOLution::RESOLution(const RESOLution & DET) {
213 // Detector characteristics
214 CEN_max_tracker = DET.CEN_max_tracker;
215 CEN_max_calo_cen = DET.CEN_max_calo_cen;
216 CEN_max_calo_fwd = DET.CEN_max_calo_fwd;
217 CEN_max_mu = DET.CEN_max_mu;
218
219 // Energy resolution for electron/photon
220 ELG_Scen = DET.ELG_Scen;
221 ELG_Ncen = DET.ELG_Ncen;
222 ELG_Ccen = DET.ELG_Ccen;
223 ELG_Cfwd = DET.ELG_Cfwd;
224 ELG_Sfwd = DET.ELG_Sfwd;
225 ELG_Nfwd = DET.ELG_Nfwd;
226 ELG_Czdc = DET.ELG_Czdc;
227 ELG_Szdc = DET.ELG_Szdc;
228 ELG_Nzdc = DET.ELG_Nzdc;
229
230 // Energy resolution for hadrons in ecal/hcal/hf/zdc
231 HAD_Shcal = DET.HAD_Shcal;
232 HAD_Nhcal = DET.HAD_Nhcal;
233 HAD_Chcal = DET.HAD_Chcal;
234 HAD_Shf = DET.HAD_Shf;
235 HAD_Nhf = DET.HAD_Nhf;
236 HAD_Chf = DET.HAD_Chf;
237 HAD_Szdc = DET.HAD_Szdc;
238 HAD_Nzdc = DET.HAD_Nzdc;
239 HAD_Czdc = DET.HAD_Czdc;
240
241 // time resolution
242 ZDC_T_resolution = DET.ZDC_T_resolution; // resolution for time measurement [s]
243 RP220_T_resolution = DET.RP220_T_resolution;
244 RP420_T_resolution = DET.RP420_T_resolution;
245
246 // Muon smearing
247 MU_SmearPt = DET.MU_SmearPt;
248
249 // Tracking efficiencies
250 TRACK_ptmin = DET.TRACK_ptmin;
251 TRACK_eff = DET.TRACK_eff;
252
253 // Calorimetric towers
254 TOWER_number = DET.TOWER_number;
255 TOWER_eta_edges = new float[TOWER_number+1];
256 for(unsigned int i=0; i<TOWER_number +1; i++) TOWER_eta_edges[i] = DET.TOWER_eta_edges[i];
257
258 TOWER_dphi = new float[TOWER_number];
259 for(unsigned int i=0; i<TOWER_number; i++) TOWER_dphi[i] = DET.TOWER_dphi[i];
260
261 // Thresholds for reconstructed objetcs
262 PTCUT_elec = DET.PTCUT_elec;
263 PTCUT_muon = DET.PTCUT_muon;
264 PTCUT_jet = DET.PTCUT_jet;
265 PTCUT_gamma = DET.PTCUT_gamma;
266 PTCUT_taujet = DET.PTCUT_taujet;
267
268 ZDC_gamma_E = DET.ZDC_gamma_E;
269 ZDC_n_E = DET.ZDC_n_E;
270
271 // Isolation
272 ISOL_PT = DET.ISOL_PT; // tracking isolation
273 ISOL_Cone = DET.ISOL_Cone;
274 ISOL_Calo_ET = DET.ISOL_Calo_ET; // calorimeter isolation, defaut off
275 ISOL_Calo_Grid = DET.ISOL_Calo_Grid;
276
277
278 // General jet variable
279 JET_coneradius = DET.JET_coneradius;
280 JET_jetalgo = DET.JET_jetalgo;
281 JET_seed = DET.JET_seed;
282 JET_Eflow = DET.JET_Eflow;
283
284 // Tagging definition
285 BTAG_b = DET.BTAG_b;
286 BTAG_mistag_c = DET.BTAG_mistag_c;
287 BTAG_mistag_l = DET.BTAG_mistag_l;
288
289 // FLAGS
290 FLAG_bfield = DET.FLAG_bfield;
291 FLAG_vfd = DET.FLAG_vfd;
292 FLAG_RP = DET.FLAG_RP;
293 FLAG_trigger = DET.FLAG_trigger;
294 FLAG_frog = DET.FLAG_frog;
295 FLAG_lhco = DET.FLAG_lhco;
296
297 // In case BField propagation allowed
298 TRACK_radius = DET.TRACK_radius;
299 TRACK_length = DET.TRACK_length;
300 TRACK_bfield_x = DET.TRACK_bfield_x;
301 TRACK_bfield_y = DET.TRACK_bfield_y;
302 TRACK_bfield_z = DET.TRACK_bfield_z;
303
304 // In case Very forward detectors allowed
305 VFD_min_calo_vfd = DET.VFD_min_calo_vfd;
306 VFD_max_calo_vfd = DET.VFD_max_calo_vfd;
307 VFD_min_zdc = DET.VFD_min_zdc;
308 VFD_s_zdc = DET.VFD_s_zdc;
309
310 RP_220_s = DET.RP_220_s;
311 RP_220_x = DET.RP_220_x;
312 RP_420_s = DET.RP_420_s;
313 RP_420_x = DET.RP_420_x;
314 RP_beam1Card = DET.RP_beam1Card;
315 RP_beam2Card = DET.RP_beam2Card;
316 RP_offsetEl_s = DET.RP_offsetEl_s;
317 RP_offsetEl_x = DET.RP_offsetEl_x;
318 RP_offsetEl_y = DET.RP_offsetEl_y;
319 RP_cross_x = DET.RP_cross_x;
320 RP_cross_y = DET.RP_cross_y;
321 RP_cross_ang_x = DET.RP_cross_ang_x;
322 RP_cross_ang_y = DET.RP_cross_ang_y;
323 RP_IP_name = DET.RP_IP_name;
324
325 // In case FROG event display allowed
326 NEvents_Frog = DET.NEvents_Frog;
327
328 // Number of events to be processed
329 NEvents = DET.NEvents;
330
331 JET_overlap = DET.JET_overlap;
332 // MidPoint algorithm definition
333 JET_M_coneareafraction = DET.JET_M_coneareafraction;
334 JET_M_maxpairsize = DET.JET_M_maxpairsize;
335 JET_M_maxiterations = DET.JET_M_maxiterations;
336 // Define Cone algorithm.
337 JET_C_adjacencycut = DET.JET_C_adjacencycut;
338 JET_C_maxiterations = DET.JET_C_maxiterations;
339 JET_C_iratch = DET.JET_C_iratch;
340 //Define SISCone algorithm.
341 JET_S_npass = DET.JET_S_npass;
342 JET_S_protojet_ptmin = DET.JET_S_protojet_ptmin;
343
344 //For Tau-jet definition
345 TAU_energy_scone = DET.TAU_energy_scone;
346 TAU_track_scone = DET.TAU_track_scone;
347 TAU_track_pt = DET.TAU_track_pt;
348 TAU_energy_frac = DET.TAU_energy_frac;
349
350 PT_QUARKS_MIN = DET.PT_QUARKS_MIN;
351 PdgTableFilename = DET.PdgTableFilename;
352 PDGtable = DET.PDGtable;
353}
354
355RESOLution& RESOLution::operator=(const RESOLution& DET) {
356 if(this==&DET) return *this;
357 // Detector characteristics
358 CEN_max_tracker = DET.CEN_max_tracker;
359 CEN_max_calo_cen = DET.CEN_max_calo_cen;
360 CEN_max_calo_fwd = DET.CEN_max_calo_fwd;
361 CEN_max_mu = DET.CEN_max_mu;
362
363 // Energy resolution for electron/photon
364 ELG_Scen = DET.ELG_Scen;
365 ELG_Ncen = DET.ELG_Ncen;
366 ELG_Ccen = DET.ELG_Ccen;
367 ELG_Cfwd = DET.ELG_Cfwd;
368 ELG_Sfwd = DET.ELG_Sfwd;
369 ELG_Nfwd = DET.ELG_Nfwd;
370 ELG_Czdc = DET.ELG_Czdc;
371 ELG_Szdc = DET.ELG_Szdc;
372 ELG_Nzdc = DET.ELG_Nzdc;
373
374 // Energy resolution for hadrons in ecal/hcal/hf
375 HAD_Shcal = DET.HAD_Shcal;
376 HAD_Nhcal = DET.HAD_Nhcal;
377 HAD_Chcal = DET.HAD_Chcal;
378 HAD_Shf = DET.HAD_Shf;
379 HAD_Nhf = DET.HAD_Nhf;
380 HAD_Chf = DET.HAD_Chf;
381 HAD_Szdc = DET.HAD_Szdc;
382 HAD_Nzdc = DET.HAD_Nzdc;
383 HAD_Czdc = DET.HAD_Czdc;
384
385 // time resolution
386 ZDC_T_resolution = DET.ZDC_T_resolution; // resolution for time measurement [s]
387 RP220_T_resolution = DET.RP220_T_resolution;
388 RP420_T_resolution = DET.RP420_T_resolution;
389
390 // Muon smearing
391 MU_SmearPt = DET.MU_SmearPt;
392
393 // Tracking efficiencies
394 TRACK_ptmin = DET.TRACK_ptmin;
395 TRACK_eff = DET.TRACK_eff;
396
397 // Calorimetric towers
398 TOWER_number = DET.TOWER_number;
399 TOWER_eta_edges = new float[TOWER_number+1];
400 for(unsigned int i=0; i<TOWER_number +1; i++) TOWER_eta_edges[i] = DET.TOWER_eta_edges[i];
401
402 TOWER_dphi = new float[TOWER_number];
403 for(unsigned int i=0; i<TOWER_number; i++) TOWER_dphi[i] = DET.TOWER_dphi[i];
404
405 // Thresholds for reconstructed objetcs
406 PTCUT_elec = DET.PTCUT_elec;
407 PTCUT_muon = DET.PTCUT_muon;
408 PTCUT_jet = DET.PTCUT_jet;
409 PTCUT_gamma = DET.PTCUT_gamma;
410 PTCUT_taujet = DET.PTCUT_taujet;
411
412 ZDC_gamma_E = DET.ZDC_gamma_E;
413 ZDC_n_E = DET.ZDC_n_E;
414
415 // Isolation
416 ISOL_PT = DET.ISOL_PT; // tracking isolation
417 ISOL_Cone = DET.ISOL_Cone;
418 ISOL_Calo_ET = DET.ISOL_Calo_ET; // calorimeter isolation, defaut off
419 ISOL_Calo_Grid = DET.ISOL_Calo_Grid;
420
421 // General jet variable
422 JET_coneradius = DET.JET_coneradius;
423 JET_jetalgo = DET.JET_jetalgo;
424 JET_seed = DET.JET_seed;
425 JET_Eflow = DET.JET_Eflow;
426
427 // Tagging definition
428 BTAG_b = DET.BTAG_b;
429 BTAG_mistag_c = DET.BTAG_mistag_c;
430 BTAG_mistag_l = DET.BTAG_mistag_l;
431
432 // FLAGS
433 FLAG_bfield = DET.FLAG_bfield;
434 FLAG_vfd = DET.FLAG_vfd;
435 FLAG_RP = DET.FLAG_RP;
436 FLAG_trigger = DET.FLAG_trigger;
437 FLAG_frog = DET.FLAG_frog;
438 FLAG_lhco = DET.FLAG_lhco;
439
440 // In case BField propagation allowed
441 TRACK_radius = DET.TRACK_radius;
442 TRACK_length = DET.TRACK_length;
443 TRACK_bfield_x = DET.TRACK_bfield_x;
444 TRACK_bfield_y = DET.TRACK_bfield_y;
445 TRACK_bfield_z = DET.TRACK_bfield_z;
446
447 // In case Very forward detectors allowed
448 VFD_min_calo_vfd = DET.VFD_min_calo_vfd;
449 VFD_max_calo_vfd = DET.VFD_max_calo_vfd;
450 VFD_min_zdc = DET.VFD_min_zdc;
451 VFD_s_zdc = DET.VFD_s_zdc;
452
453 RP_220_s = DET.RP_220_s;
454 RP_220_x = DET.RP_220_x;
455 RP_420_s = DET.RP_420_s;
456 RP_420_x = DET.RP_420_x;
457 RP_offsetEl_s = DET.RP_offsetEl_s;
458 RP_offsetEl_x = DET.RP_offsetEl_x;
459 RP_offsetEl_y = DET.RP_offsetEl_y;
460 RP_beam1Card = DET.RP_beam1Card;
461 RP_beam2Card = DET.RP_beam2Card;
462 RP_cross_x = DET.RP_cross_x;
463 RP_cross_y = DET.RP_cross_y;
464 RP_cross_ang_x = DET.RP_cross_ang_x;
465 RP_cross_ang_y = DET.RP_cross_ang_y;
466 RP_IP_name = DET.RP_IP_name;
467
468
469 // In case FROG event display allowed
470 NEvents_Frog = DET.NEvents_Frog;
471
472 // Number of events to be processed
473 NEvents = DET.NEvents;
474
475 JET_overlap = DET.JET_overlap;
476 // MidPoint algorithm definition
477 JET_M_coneareafraction = DET.JET_M_coneareafraction;
478 JET_M_maxpairsize = DET.JET_M_maxpairsize;
479 JET_M_maxiterations = DET.JET_M_maxiterations;
480 // Define Cone algorithm.
481 JET_C_adjacencycut = DET.JET_C_adjacencycut;
482 JET_C_maxiterations = DET.JET_C_maxiterations;
483 JET_C_iratch = DET.JET_C_iratch;
484 //Define SISCone algorithm.
485 JET_S_npass = DET.JET_S_npass;
486 JET_S_protojet_ptmin = DET.JET_S_protojet_ptmin;
487
488 //For Tau-jet definition
489 TAU_energy_scone = DET.TAU_energy_scone;
490 TAU_track_scone = DET.TAU_track_scone;
491 TAU_track_pt = DET.TAU_track_pt;
492 TAU_energy_frac = DET.TAU_energy_frac;
493
494 PT_QUARKS_MIN = DET.PT_QUARKS_MIN;
495
496 PdgTableFilename = DET.PdgTableFilename;
497 PDGtable = DET.PDGtable;
498 return *this;
499}
500
501
502
503
504//------------------------------------------------------------------------------
505void RESOLution::ReadDataCard(const string datacard) {
506
507 string temp_string;
508 istringstream curstring;
509
510 ifstream fichier_a_lire(datacard.c_str());
511 if(!fichier_a_lire.good()) {
512 cout <<"** WARNING: Datadard not found, use default values **" << endl;
513 return;
514 }
515
516 while (getline(fichier_a_lire,temp_string)) {
517 curstring.clear(); // needed when using several times istringstream::str(string)
518 curstring.str(temp_string);
519 string varname;
520 float value; int ivalue; string svalue;
521
522 if(strstr(temp_string.c_str(),"#")) { }
523 else if(strstr(temp_string.c_str(),"CEN_max_tracker")) {curstring >> varname >> value; CEN_max_tracker = value;}
524 else if(strstr(temp_string.c_str(),"CEN_max_calo_cen")) {curstring >> varname >> value; CEN_max_calo_cen = value;}
525 else if(strstr(temp_string.c_str(),"CEN_max_calo_fwd")) {curstring >> varname >> value; CEN_max_calo_fwd = value;}
526 else if(strstr(temp_string.c_str(),"CEN_max_mu")) {curstring >> varname >> value; CEN_max_mu = value;}
527
528 else if(strstr(temp_string.c_str(),"VFD_min_calo_vfd")) {curstring >> varname >> value; VFD_min_calo_vfd = value;}
529 else if(strstr(temp_string.c_str(),"VFD_max_calo_vfd")) {curstring >> varname >> value; VFD_max_calo_vfd = value;}
530 else if(strstr(temp_string.c_str(),"VFD_min_zdc")) {curstring >> varname >> value; VFD_min_zdc = value;}
531 else if(strstr(temp_string.c_str(),"VFD_s_zdc")) {curstring >> varname >> value; VFD_s_zdc = value;}
532
533 else if(strstr(temp_string.c_str(),"RP_220_s")) {curstring >> varname >> value; RP_220_s = value;}
534 else if(strstr(temp_string.c_str(),"RP_220_x")) {curstring >> varname >> value; RP_220_x = value;}
535 else if(strstr(temp_string.c_str(),"RP_420_s")) {curstring >> varname >> value; RP_420_s = value;}
536 else if(strstr(temp_string.c_str(),"RP_420_x")) {curstring >> varname >> value; RP_420_x = value;}
537 else if(strstr(temp_string.c_str(),"RP_beam1Card")) {curstring >> varname >> svalue;RP_beam1Card = svalue;}
538 else if(strstr(temp_string.c_str(),"RP_beam2Card")) {curstring >> varname >> svalue;RP_beam2Card = svalue;}
539 else if(strstr(temp_string.c_str(),"RP_IP_name")) {curstring >> varname >> svalue;RP_IP_name = svalue;}
540
541 else if(strstr(temp_string.c_str(),"RP_offsetEl_s")) {curstring >> varname >> value; RP_offsetEl_s = value;}
542 else if(strstr(temp_string.c_str(),"RP_offsetEl_x")) {curstring >> varname >> value; RP_offsetEl_x = value;}
543 else if(strstr(temp_string.c_str(),"RP_offsetEl_y")) {curstring >> varname >> value; RP_offsetEl_y = value;}
544 else if(strstr(temp_string.c_str(),"RP_cross_x")) {curstring >> varname >> value; RP_cross_x = value;}
545 else if(strstr(temp_string.c_str(),"RP_cross_y")) {curstring >> varname >> value; RP_cross_y = value;}
546 else if(strstr(temp_string.c_str(),"RP_cross_ang_x")) {curstring >> varname >> value; RP_cross_ang_x = value;}
547 else if(strstr(temp_string.c_str(),"RP_cross_ang_y")) {curstring >> varname >> value; RP_cross_ang_y = value;}
548
549 else if(strstr(temp_string.c_str(),"ELG_Scen")) {curstring >> varname >> value; ELG_Scen = value;}
550 else if(strstr(temp_string.c_str(),"ELG_Ncen")) {curstring >> varname >> value; ELG_Ncen = value;}
551 else if(strstr(temp_string.c_str(),"ELG_Ccen")) {curstring >> varname >> value; ELG_Ccen = value;}
552 else if(strstr(temp_string.c_str(),"ELG_Sfwd")) {curstring >> varname >> value; ELG_Sfwd = value;}
553 else if(strstr(temp_string.c_str(),"ELG_Cfwd")) {curstring >> varname >> value; ELG_Cfwd = value;}
554 else if(strstr(temp_string.c_str(),"ELG_Nfwd")) {curstring >> varname >> value; ELG_Nfwd = value;}
555 else if(strstr(temp_string.c_str(),"ELG_Szdc")) {curstring >> varname >> value; ELG_Szdc = value;}
556 else if(strstr(temp_string.c_str(),"ELG_Czdc")) {curstring >> varname >> value; ELG_Czdc = value;}
557 else if(strstr(temp_string.c_str(),"ELG_Nzdc")) {curstring >> varname >> value; ELG_Nzdc = value;}
558
559 else if(strstr(temp_string.c_str(),"HAD_Shcal")) {curstring >> varname >> value; HAD_Shcal = value;}
560 else if(strstr(temp_string.c_str(),"HAD_Nhcal")) {curstring >> varname >> value; HAD_Nhcal = value;}
561 else if(strstr(temp_string.c_str(),"HAD_Chcal")) {curstring >> varname >> value; HAD_Chcal = value;}
562 else if(strstr(temp_string.c_str(),"HAD_Shf")) {curstring >> varname >> value; HAD_Shf = value;}
563 else if(strstr(temp_string.c_str(),"HAD_Nhf")) {curstring >> varname >> value; HAD_Nhf = value;}
564 else if(strstr(temp_string.c_str(),"HAD_Chf")) {curstring >> varname >> value; HAD_Chf = value;}
565 else if(strstr(temp_string.c_str(),"HAD_Szdc")) {curstring >> varname >> value; HAD_Szdc = value;}
566 else if(strstr(temp_string.c_str(),"HAD_Nzdc")) {curstring >> varname >> value; HAD_Nzdc = value;}
567 else if(strstr(temp_string.c_str(),"HAD_Czdc")) {curstring >> varname >> value; HAD_Czdc = value;}
568 else if(strstr(temp_string.c_str(),"ZDC_T_resolution")) {curstring >> varname >> value; ZDC_T_resolution = value;}
569 else if(strstr(temp_string.c_str(),"RP220_T_resolution")) {curstring >> varname >> value; RP220_T_resolution = value;}
570 else if(strstr(temp_string.c_str(),"RP420_T_resolution")) {curstring >> varname >> value; RP420_T_resolution = value;}
571 else if(strstr(temp_string.c_str(),"MU_SmearPt")) {curstring >> varname >> value; MU_SmearPt = value;}
572
573 else if(strstr(temp_string.c_str(),"TRACK_radius")) {curstring >> varname >> ivalue;TRACK_radius = ivalue;}
574 else if(strstr(temp_string.c_str(),"TRACK_length")) {curstring >> varname >> ivalue;TRACK_length = ivalue;}
575 else if(strstr(temp_string.c_str(),"TRACK_bfield_x")) {curstring >> varname >> value; TRACK_bfield_x = value;}
576 else if(strstr(temp_string.c_str(),"TRACK_bfield_y")) {curstring >> varname >> value; TRACK_bfield_y = value;}
577 else if(strstr(temp_string.c_str(),"TRACK_bfield_z")) {curstring >> varname >> value; TRACK_bfield_z = value;}
578 else if(strstr(temp_string.c_str(),"FLAG_bfield")) {curstring >> varname >> ivalue; FLAG_bfield = ivalue;}
579 else if(strstr(temp_string.c_str(),"TRACK_ptmin")) {curstring >> varname >> value; TRACK_ptmin = value;}
580 else if(strstr(temp_string.c_str(),"TRACK_eff")) {curstring >> varname >> ivalue;TRACK_eff = ivalue;}
581
582 else if(strstr(temp_string.c_str(),"TOWER_number")) {curstring >> varname >> ivalue;TOWER_number = ivalue;}
583 else if(strstr(temp_string.c_str(),"TOWER_eta_edges")){
584 curstring >> varname; for(unsigned int i=0; i<TOWER_number+1; i++) {curstring >> value; TOWER_eta_edges[i] = value;} }
585 else if(strstr(temp_string.c_str(),"TOWER_dphi")){
586 curstring >> varname; for(unsigned int i=0; i<TOWER_number; i++) {curstring >> value; TOWER_dphi[i] = value;} }
587
588 else if(strstr(temp_string.c_str(),"PTCUT_elec")) {curstring >> varname >> value; PTCUT_elec = value;}
589 else if(strstr(temp_string.c_str(),"PTCUT_muon")) {curstring >> varname >> value; PTCUT_muon = value;}
590 else if(strstr(temp_string.c_str(),"PTCUT_jet")) {curstring >> varname >> value; PTCUT_jet = value;}
591 else if(strstr(temp_string.c_str(),"PTCUT_gamma")) {curstring >> varname >> value; PTCUT_gamma = value;}
592 else if(strstr(temp_string.c_str(),"PTCUT_taujet")) {curstring >> varname >> value; PTCUT_taujet = value;}
593 else if(strstr(temp_string.c_str(),"ZDC_gamma_E")) {curstring >> varname >> value; ZDC_gamma_E = value;}
594 else if(strstr(temp_string.c_str(),"ZDC_n_E")) {curstring >> varname >> value; ZDC_n_E = value;}
595
596 else if(strstr(temp_string.c_str(),"ISOL_PT")) {curstring >> varname >> value; ISOL_PT = value;}
597 else if(strstr(temp_string.c_str(),"ISOL_Cone")) {curstring >> varname >> value; ISOL_Cone = value;}
598 else if(strstr(temp_string.c_str(),"ISOL_Calo_ET")) {curstring >> varname >> value; ISOL_Calo_ET = value;}
599 else if(strstr(temp_string.c_str(),"ISOL_Calo_Grid")) {curstring >> varname >> ivalue; ISOL_Calo_Grid = ivalue;}
600
601 else if(strstr(temp_string.c_str(),"JET_coneradius")) {curstring >> varname >> value; JET_coneradius = value;}
602 else if(strstr(temp_string.c_str(),"JET_jetalgo")) {curstring >> varname >> ivalue;JET_jetalgo = ivalue;}
603 else if(strstr(temp_string.c_str(),"JET_seed")) {curstring >> varname >> value; JET_seed = value;}
604 else if(strstr(temp_string.c_str(),"JET_Eflow")) {curstring >> varname >> ivalue; JET_Eflow = ivalue;}
605
606 else if(strstr(temp_string.c_str(),"BTAG_b")) {curstring >> varname >> ivalue;BTAG_b = ivalue;}
607 else if(strstr(temp_string.c_str(),"BTAG_mistag_c")) {curstring >> varname >> ivalue;BTAG_mistag_c = ivalue;}
608 else if(strstr(temp_string.c_str(),"BTAG_mistag_l")) {curstring >> varname >> ivalue;BTAG_mistag_l = ivalue;}
609
610 else if(strstr(temp_string.c_str(),"FLAG_vfd")) {curstring >> varname >> ivalue; FLAG_vfd = ivalue;}
611 else if(strstr(temp_string.c_str(),"FLAG_RP")) {curstring >> varname >> ivalue; FLAG_RP = ivalue;}
612 else if(strstr(temp_string.c_str(),"FLAG_trigger")) {curstring >> varname >> ivalue; FLAG_trigger = ivalue;}
613 else if(strstr(temp_string.c_str(),"FLAG_frog")) {curstring >> varname >> ivalue; FLAG_frog = ivalue;}
614 else if(strstr(temp_string.c_str(),"FLAG_lhco")) {curstring >> varname >> ivalue; FLAG_lhco = ivalue;}
615 else if(strstr(temp_string.c_str(),"NEvents_Frog")) {curstring >> varname >> ivalue; NEvents_Frog = ivalue;}
616 else if(strstr(temp_string.c_str(),"NEvents")) {curstring >> varname >> ivalue; NEvents = ivalue;}
617
618 else if(strstr(temp_string.c_str(),"PdgTableFilename")) {curstring >> varname >> svalue; PdgTableFilename = svalue;}
619 }
620
621 if(ISOL_Calo_Grid%2 ==0) {
622 ISOL_Calo_Grid++;
623 cout <<"** WARNING: ISOL_Calo_Grid is not odd. Set it to "<< ISOL_Calo_Grid << " **" << endl;
624 }
625
626 //jet stuffs not defined in the input datacard
627 JET_overlap = 0.75;
628 // MidPoint algorithm definition
629 JET_M_coneareafraction = 0.25;
630 JET_M_maxpairsize = 2;
631 JET_M_maxiterations = 100;
632 // Define Cone algorithm.
633 JET_C_adjacencycut = 2;
634 JET_C_maxiterations = 100;
635 JET_C_iratch = 1;
636 //Define SISCone algorithm.
637 JET_S_npass = 0;
638 JET_S_protojet_ptmin= 0.0;
639
640 //For Tau-jet definition
641 TAU_energy_scone = 0.15; // radius R of the cone for tau definition, based on energy threshold
642 TAU_track_scone = 0.4; // radius R of the cone for tau definition, based on track number
643 TAU_track_pt = 2; // minimal pt [GeV] for tracks to be considered in tau definition
644 TAU_energy_frac = 0.95; // fraction of energy required in the central part of the cone, for tau jets
645
646}
647
648void RESOLution::Logfile(const string& LogName) {
649 //void RESOLution::Logfile(string outputfilename) {
650
651 ofstream f_out(LogName.c_str());
652
653 f_out <<"**********************************************************************"<< endl;
654 f_out <<"**********************************************************************"<< endl;
655 f_out <<"** **"<< endl;
656 f_out <<"** Welcome to **"<< endl;
657 f_out <<"** **"<< endl;
658 f_out <<"** **"<< endl;
659 f_out <<"** .ddddddd- lL hH **"<< endl;
660 f_out <<"** -Dd` `dD: Ll hH` **"<< endl;
661 f_out <<"** dDd dDd eeee. lL .pp+pp Hh+hhh` -eeee- `sssss **"<< endl;
662 f_out <<"** -Dd `DD ee. ee Ll .Pp. PP Hh. HH. ee. ee sSs **"<< endl;
663 f_out <<"** dD` dDd eEeee: lL. pP. pP hH hH` eEeee:` -sSSSs. **"<< endl;
664 f_out <<"** .Dd :dd eE. LlL PpppPP Hh Hh eE sSS **"<< endl;
665 f_out <<"** dddddd:. eee+: lL. pp. hh. hh eee+ sssssS **"<< endl;
666 f_out <<"** Pp **"<< endl;
667 f_out <<"** **"<< endl;
668 f_out <<"** Delphes, a framework for the fast simulation **"<< endl;
669 f_out <<"** of a generic collider experiment **"<< endl;
670 f_out <<"** **"<< endl;
671 f_out <<"** --- Version 1.7 of Delphes --- **"<< endl;
672 f_out <<"** Last date of change: 7 May 2009 **"<< endl;
673 f_out <<"** **"<< endl;
674 f_out <<"** **"<< endl;
675 f_out <<"** This package uses: **"<< endl;
676 f_out <<"** ------------------ **"<< endl;
677 f_out <<"** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **"<< endl;
678 f_out <<"** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **"<< endl;
679 f_out <<"** FROG: L. Quertenmont, V. Roberfroid [hep-ex/0901.2718v1] **"<< endl;
680 f_out <<"** **"<< endl;
681 f_out <<"** ---------------------------------------------------------------- **"<< endl;
682 f_out <<"** **"<< endl;
683 f_out <<"** Main authors: **"<< endl;
684 f_out <<"** ------------- **"<< endl;
685 f_out <<"** **"<< endl;
686 f_out <<"** Séverine Ovyn Xavier Rouby **"<< endl;
687 f_out <<"** severine.ovyn@uclouvain.be xavier.rouby@cern **"<< endl;
688 f_out <<"** Center for Particle Physics and Phenomenology (CP3) **"<< endl;
689 f_out <<"** Universite Catholique de Louvain (UCL) **"<< endl;
690 f_out <<"** Louvain-la-Neuve, Belgium **"<< endl;
691 f_out <<"** **"<< endl;
692 f_out <<"** ---------------------------------------------------------------- **"<< endl;
693 f_out <<"** **"<< endl;
694 f_out <<"** Former Delphes versions and documentation can be found on : **"<< endl;
695 f_out <<"** http://www.fynu.ucl.ac.be/delphes.html **"<< endl;
696 f_out <<"** **"<< endl;
697 f_out <<"** **"<< endl;
698 f_out <<"** Disclaimer: this program is a beta version of Delphes and **"<< endl;
699 f_out <<"** therefore comes without guarantees. Beware of errors and please **"<< endl;
700 f_out <<"** give us your feedbacks about potential bugs **"<< endl;
701 f_out <<"** **"<< endl;
702 f_out <<"**********************************************************************"<< endl;
703 f_out <<"** **"<< endl;
704 f_out<<"#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n";
705 f_out<<"# Input PDG table : " << PdgTableFilename << " *"<<"\n";
706 f_out<<"* *"<<"\n";
707 f_out<<"* *"<<"\n";
708 f_out<<"#******************************** *"<<"\n";
709 f_out<<"# Central detector caracteristics *"<<"\n";
710 f_out<<"#******************************** *"<<"\n";
711 f_out<<"* *"<<"\n";
712 f_out << left << setw(30) <<"* Maximum tracking system: "<<""
713 << left << setw(10) <<CEN_max_tracker <<""<< right << setw(15)<<"*"<<"\n";
714 f_out << left << setw(30) <<"* Maximum central calorimeter: "<<""
715 << left << setw(10) <<CEN_max_calo_cen <<""<< right << setw(15)<<"*"<<"\n";
716 f_out << left << setw(30) <<"* Maximum forward calorimeter: "<<""
717 << left << setw(10) <<CEN_max_calo_fwd <<""<< right << setw(15)<<"*"<<"\n";
718 f_out << left << setw(30) <<"* Muon chambers coverage: "<<""
719 << left << setw(10) <<CEN_max_mu <<""<< right << setw(15)<<"*"<<"\n";
720 f_out<<"* *"<<"\n";
721 if(FLAG_RP==1){
722 f_out<<"#************************************ *"<<"\n";
723 f_out<<"# Very forward Roman Pots switched on *"<<"\n";
724 f_out<<"#************************************ *"<<"\n";
725 f_out<<"* *"<<"\n";
726 f_out << left << setw(55) <<"* Distance of the 220 RP to the IP in meters:"<<""
727 << left << setw(5) <<RP_220_s <<""<< right << setw(10)<<"*"<<"\n";
728 f_out << left << setw(55) <<"* Distance of the 220 RP to the beam in meters:"<<""
729 << left << setw(5) <<RP_220_x <<""<< right << setw(10)<<"*"<<"\n";
730 f_out << left << setw(55) <<"* Distance of the 420 RP to the IP in meters:"<<""
731 << left << setw(5) <<RP_420_s <<""<< right << setw(10)<<"*"<<"\n";
732 f_out << left << setw(55) <<"* Distance of the 420 RP to the beam in meters:"<<""
733 << left << setw(5) <<RP_420_x <<""<< right << setw(10)<<"*"<<"\n";
734 f_out << left << setw(55) <<"* Interaction point at the LHC named: "<<""
735 << left << setw(5) <<RP_IP_name <<""<< right << setw(10)<<"*"<<"\n";
736 f_out << left << setw(35) <<"* Datacard for beam 1: "<<""
737 << left << setw(25) <<RP_beam1Card <<""<< right << setw(10)<<"*"<<"\n";
738 f_out << left << setw(35) <<"* Datacard for beam 2: "<<""
739 << left << setw(25) <<RP_beam2Card <<""<< right << setw(10)<<"*"<<"\n";
740 f_out << left << setw(44) <<"* Beam separation, in meters(hor):"<<""
741 << left << setw(6) << RP_offsetEl_x <<""<< right << setw(10)<<"*"<<"\n";
742 f_out << left << setw(44) <<"* Beam separation, in meters(ver):"<<""
743 << left << setw(6) << RP_offsetEl_y <<""<< right << setw(10)<<"*"<<"\n";
744 f_out << left << setw(44) <<"* Distance from IP for Beam separation (m):"<<""
745 << left << setw(6) <<RP_offsetEl_s <<""<< right << setw(10)<<"*"<<"\n";
746 f_out << left << setw(44) <<"* X offset of beam crossing in micrometers:"<<""
747 << left << setw(6) <<RP_cross_x <<""<< right << setw(10)<<"*"<<"\n";
748 f_out << left << setw(44) <<"* Y offset of beam crossing in micrometers:"<<""
749 << left << setw(6) <<RP_cross_y <<""<< right << setw(10)<<"*"<<"\n";
750 f_out << left << setw(44) <<"* X Angle of beam crossing:"<<""
751 << left << setw(6) <<RP_cross_ang_x <<""<< right << setw(10)<<"*"<<"\n";
752 f_out << left << setw(44) <<"* Y Angle of beam crossing:"<<""
753 << left << setw(6) <<RP_cross_ang_y <<""<< right << setw(10)<<"*"<<"\n";
754 f_out<<"* *"<<"\n";
755 }
756 else {
757 f_out<<"#************************************* *"<<"\n";
758 f_out<<"# Very forward Roman Pots switched off *"<<"\n";
759 f_out<<"#************************************* *"<<"\n";
760 f_out<<"* *"<<"\n";
761 }
762 if(FLAG_vfd==1){
763 f_out<<"#************************************** *"<<"\n";
764 f_out<<"# Very forward calorimeters switched on *"<<"\n";
765 f_out<<"#************************************** *"<<"\n";
766 f_out<<"* *"<<"\n";
767 f_out << left << setw(55) <<"* Minimum very forward calorimeter: "<<""
768 << left << setw(5) <<VFD_min_calo_vfd <<""<< right << setw(10)<<"*"<<"\n";
769 f_out << left << setw(55) <<"* Maximum very forward calorimeter: "<<""
770 << left << setw(5) <<VFD_max_calo_vfd <<""<< right << setw(10)<<"*"<<"\n";
771 f_out << left << setw(55) <<"* Minimum coverage zero_degree calorimeter "<<""
772 << left << setw(5) <<VFD_min_zdc <<""<< right << setw(10)<<"*"<<"\n";
773 f_out << left << setw(55) <<"* Distance of the ZDC to the IP, in meters: "<<""
774 << left << setw(5) <<VFD_s_zdc <<""<< right << setw(10)<<"*"<<"\n";
775 f_out<<"* *"<<"\n";
776 }
777 else {
778 f_out<<"#*************************************** *"<<"\n";
779 f_out<<"# Very forward calorimeters switched off *"<<"\n";
780 f_out<<"#*************************************** *"<<"\n";
781 f_out<<"* *"<<"\n";
782 }
783
784 f_out<<"#************************************ *"<<"\n";
785 f_out<<"# Electromagnetic smearing parameters *"<<"\n";
786 f_out<<"#************************************ *"<<"\n";
787 f_out<<"* *"<<"\n";
788 //# \sigma/E = C + N/E + S/\sqrt{E}
789 f_out << left << setw(30) <<"* S term for central ECAL: "<<""
790 << left << setw(30) <<ELG_Scen <<""<< right << setw(10)<<"*"<<"\n";
791 f_out << left << setw(30) <<"* N term for central ECAL: "<<""
792 << left << setw(30) <<ELG_Ncen <<""<< right << setw(10)<<"*"<<"\n";
793 f_out << left << setw(30) <<"* C term for central ECAL: "<<""
794 << left << setw(30) <<ELG_Ccen <<""<< right << setw(10)<<"*"<<"\n";
795 f_out << left << setw(30) <<"* S term for FCAL: "<<""
796 << left << setw(30) <<ELG_Sfwd <<""<< right << setw(10)<<"*"<<"\n";
797 f_out << left << setw(30) <<"* N term for FCAL: "<<""
798 << left << setw(30) <<ELG_Nfwd <<""<< right << setw(10)<<"*"<<"\n";
799 f_out << left << setw(30) <<"* C term for FCAL: "<<""
800 << left << setw(30) <<ELG_Cfwd <<""<< right << setw(10)<<"*"<<"\n";
801 f_out << left << setw(30) <<"* S term for ZDC: "<<""
802 << left << setw(30) <<ELG_Szdc <<""<< right << setw(10)<<"*"<<"\n";
803 f_out << left << setw(30) <<"* N term for ZDC: "<<""
804 << left << setw(30) <<ELG_Nzdc <<""<< right << setw(10)<<"*"<<"\n";
805 f_out << left << setw(30) <<"* C term for ZDC: "<<""
806 << left << setw(30) <<ELG_Czdc <<""<< right << setw(10)<<"*"<<"\n";
807
808 f_out<<"* *"<<"\n";
809 f_out<<"#***************************** *"<<"\n";
810 f_out<<"# Hadronic smearing parameters *"<<"\n";
811 f_out<<"#***************************** *"<<"\n";
812 f_out<<"* *"<<"\n";
813 f_out << left << setw(30) <<"* S term for central HCAL: "<<""
814 << left << setw(30) <<HAD_Shcal <<""<< right << setw(10)<<"*"<<"\n";
815 f_out << left << setw(30) <<"* N term for central HCAL: "<<""
816 << left << setw(30) <<HAD_Nhcal <<""<< right << setw(10)<<"*"<<"\n";
817 f_out << left << setw(30) <<"* C term for central HCAL: "<<""
818 << left << setw(30) <<HAD_Chcal <<""<< right << setw(10)<<"*"<<"\n";
819 f_out << left << setw(30) <<"* S term for FCAL: "<<""
820 << left << setw(30) <<HAD_Shf <<""<< right << setw(10)<<"*"<<"\n";
821 f_out << left << setw(30) <<"* N term for FCAL: "<<""
822 << left << setw(30) <<HAD_Nhf <<""<< right << setw(10)<<"*"<<"\n";
823 f_out << left << setw(30) <<"* C term for FCAL: "<<""
824 << left << setw(30) <<HAD_Chf <<""<< right << setw(10)<<"*"<<"\n";
825 f_out << left << setw(30) <<"* S term for ZDC: "<<""
826 << left << setw(30) <<HAD_Szdc <<""<< right << setw(10)<<"*"<<"\n";
827 f_out << left << setw(30) <<"* N term for ZDC: "<<""
828 << left << setw(30) <<HAD_Nzdc <<""<< right << setw(10)<<"*"<<"\n";
829 f_out << left << setw(30) <<"* C term for ZDC: "<<""
830 << left << setw(30) <<HAD_Czdc <<""<< right << setw(10)<<"*"<<"\n";
831
832 f_out<<"* *"<<"\n";
833 f_out<<"#************************* *"<<"\n";
834 f_out<<"# Time smearing parameters *"<<"\n";
835 f_out<<"#************************* *"<<"\n";
836 f_out<<"* *"<<"\n";
837 f_out << left << setw(55) <<"* Time resolution for ZDC : "<<""
838 << left << setw(5) <<ZDC_T_resolution <<""<< right << setw(10)<<"*"<<"\n";
839 f_out << left << setw(55) <<"* Time resolution for RP220 : "<<""
840 << left << setw(5) <<RP220_T_resolution <<""<< right << setw(10)<<"*"<<"\n";
841 f_out << left << setw(55) <<"* Time resolution for RP420 : "<<""
842 << left << setw(5) <<RP420_T_resolution <<""<< right << setw(10)<<"*"<<"\n";
843 f_out<<"* *"<<"\n";
844
845 f_out<<"* *"<<"\n";
846 f_out<<"#************************* *"<<"\n";
847 f_out<<"# Muon smearing parameters *"<<"\n";
848 f_out<<"#************************* *"<<"\n";
849 f_out<<"* *"<<"\n";
850 f_out << left << setw(55) <<"* PT resolution for muons : "<<""
851 << left << setw(5) <<MU_SmearPt <<""<< right << setw(10)<<"*"<<"\n";
852 f_out<<"* *"<<"\n";
853 if(FLAG_bfield==1){
854 f_out<<"#*************************** *"<<"\n";
855 f_out<<"# Magnetic field switched on *"<<"\n";
856 f_out<<"#*************************** *"<<"\n";
857 f_out<<"* *"<<"\n";
858 f_out << left << setw(55) <<"* Radius of the BField coverage: "<<""
859 << left << setw(5) <<TRACK_radius <<""<< right << setw(10)<<"*"<<"\n";
860 f_out << left << setw(55) <<"* Length of the BField coverage: "<<""
861 << left << setw(5) <<TRACK_length <<""<< right << setw(10)<<"*"<<"\n";
862 f_out << left << setw(55) <<"* BField X component: "<<""
863 << left << setw(5) <<TRACK_bfield_x <<""<< right << setw(10)<<"*"<<"\n";
864 f_out << left << setw(55) <<"* BField Y component: "<<""
865 << left << setw(5) <<TRACK_bfield_y <<""<< right << setw(10)<<"*"<<"\n";
866 f_out << left << setw(55) <<"* BField Z component: "<<""
867 << left << setw(5) <<TRACK_bfield_z <<""<< right << setw(10)<<"*"<<"\n";
868 f_out << left << setw(55) <<"* Minimal pT needed to reach the calorimeter [GeV]: "<<""
869 << left << setw(10) <<TRACK_ptmin <<""<< right << setw(5)<<"*"<<"\n";
870 f_out << left << setw(55) <<"* Efficiency associated to the tracking: "<<""
871 << left << setw(10) <<TRACK_eff <<""<< right << setw(5)<<"*"<<"\n";
872 f_out<<"* *"<<"\n";
873 }
874 else {
875 f_out<<"#**************************** *"<<"\n";
876 f_out<<"# Magnetic field switched off *"<<"\n";
877 f_out<<"#**************************** *"<<"\n";
878 f_out << left << setw(55) <<"* Minimal pT needed to reach the calorimeter [GeV]: "<<""
879 << left << setw(10) <<TRACK_ptmin <<""<< right << setw(5)<<"*"<<"\n";
880 f_out << left << setw(55) <<"* Efficiency associated to the tracking: "<<""
881 << left << setw(10) <<TRACK_eff <<""<< right << setw(5)<<"*"<<"\n";
882 f_out<<"* *"<<"\n";
883 }
884 f_out<<"#******************** *"<<"\n";
885 f_out<<"# Calorimetric Towers *"<<"\n";
886 f_out<<"#******************** *"<<"\n";
887 f_out << left << setw(55) <<"* Number of calorimetric towers in eta, for eta>0: "<<""
888 << left << setw(5) << TOWER_number <<""<< right << setw(10)<<"*"<<"\n";
889 f_out << left << setw(55) <<"* Tower edges in eta, for eta>0: "<<"" << right << setw(15)<<"*"<<"\n";
890 f_out << "* ";
891 for (unsigned int i=0; i<TOWER_number+1; i++) {
892 f_out << left << setw(7) << TOWER_eta_edges[i];
893 if(!( (i+1) %9 )) f_out << right << setw(3) << "*" << "\n" << "* ";
894 }
895 for (unsigned int i=(TOWER_number+1)%9; i<9; i++) f_out << left << setw(7) << "";
896 f_out << right << setw(3)<<"*"<<"\n";
897 f_out << left << setw(55) <<"* Tower sizes in phi, for eta>0 [degree]:"<<"" << right << setw(15)<<"*"<<"\n";
898 f_out << "* ";
899 for (unsigned int i=0; i<TOWER_number; i++) {
900 f_out << left << setw(7) << TOWER_dphi[i];
901 if(!( (i+1) %9 )) f_out << right << setw(3) << "*" << "\n" << "* ";
902 }
903 for (unsigned int i=(TOWER_number)%9; i<9; i++) f_out << left << setw(7) << "";
904 f_out << right << setw(3)<<"*"<<"\n";
905 f_out<<"* *"<<"\n";
906 f_out<<"#******************* *"<<"\n";
907 f_out<<"# Minimum pT's [GeV] *"<<"\n";
908 f_out<<"#******************* *"<<"\n";
909 f_out<<"* *"<<"\n";
910 f_out << left << setw(40) <<"* Minimum pT for electrons: "<<""
911 << left << setw(20) <<PTCUT_elec <<""<< right << setw(10)<<"*"<<"\n";
912 f_out << left << setw(40) <<"* Minimum pT for muons: "<<""
913 << left << setw(20) <<PTCUT_muon <<""<< right << setw(10)<<"*"<<"\n";
914 f_out << left << setw(40) <<"* Minimum pT for jets: "<<""
915 << left << setw(20) <<PTCUT_jet <<""<< right << setw(10)<<"*"<<"\n";
916 f_out << left << setw(40) <<"* Minimum pT for Tau-jets: "<<""
917 << left << setw(20) <<PTCUT_taujet <<""<< right << setw(10)<<"*"<<"\n";
918 f_out << left << setw(40) <<"* Minimum pT for photons: "<<""
919 << left << setw(20) <<PTCUT_gamma <<""<< right << setw(10)<<"*"<<"\n";
920 f_out << left << setw(40) <<"* Minimum E for photons in ZDC: "<<""
921 << left << setw(20) <<ZDC_gamma_E <<""<< right << setw(10)<<"*"<<"\n";
922 f_out << left << setw(40) <<"* Minimum E for neutrons in ZDC: "<<""
923 << left << setw(20) <<ZDC_n_E <<""<< right << setw(10)<<"*"<<"\n";
924
925 f_out<<"* *"<<"\n";
926 f_out<<"#******************* *"<<"\n";
927 f_out<<"# Isolation criteria *"<<"\n";
928 f_out<<"#******************* *"<<"\n";
929 f_out<<"* *"<<"\n";
930 f_out << left << setw(40) <<"* Minimum pT for tracks [GeV]: "<<""
931 << left << setw(20) <<ISOL_PT <<""<< right << setw(10)<<"*"<<"\n";
932 f_out << left << setw(40) <<"* Cone for isolation criteria: "<<""
933 << left << setw(20) <<ISOL_Cone <<""<< right << setw(10)<<"*"<<"\n";
934
935 if(ISOL_Calo_ET > 1E98) f_out<<"# No Calorimetric isolation applied *"<<"\n";
936 else {
937 f_out << left << setw(40) <<"* Minimum ET for towers [GeV]: "<<""
938 << left << setw(20) <<ISOL_Calo_ET <<""<< right << setw(10)<<"*"<<"\n";
939 f_out << left << setw(40) <<"* Grid size (NxN) for calorimetric isolation: "<<""
940 << left << setw(20) <<ISOL_Calo_Grid <<""<< right << setw(4)<<"*"<<"\n";
941 }
942
943
944 f_out<<"* *"<<"\n";
945 f_out<<"#*************** *"<<"\n";
946 f_out<<"# Jet definition *"<<"\n";
947 f_out<<"#*************** *"<<"\n";
948 if(JET_Eflow)
949 {
950 f_out<<"#*************** *"<<"\n";
951 f_out<<"#* Running considering perfect energy flow on the tracker coverage *"<<"\n";
952 }
953 else
954 {
955 f_out<<"#* Running considering no energy flow on the tracker coverage *"<<"\n";
956 f_out<<"#* --> jet algo applied on the calorimetric towers *"<<"\n";
957 }
958 f_out<<"* *"<<"\n";
959 f_out<<"* Six algorithms are currently available: *"<<"\n";
960 f_out<<"* - 1) CDF cone algorithm, *"<<"\n";
961 f_out<<"* - 2) CDF MidPoint algorithm, *"<<"\n";
962 f_out<<"* - 3) SIScone algorithm, *"<<"\n";
963 f_out<<"* - 4) kt algorithm, *"<<"\n";
964 f_out<<"* - 5) Cambrigde/Aachen algorithm, *"<<"\n";
965 f_out<<"* - 6) Anti-kt algorithm. *"<<"\n";
966 f_out<<"* *"<<"\n";
967 f_out<<"* You have chosen *"<<"\n";
968 switch(JET_jetalgo) {
969 default:
970 case 1: {
971 f_out<<"* CDF JetClu jet algorithm with parameters: *"<<"\n";
972 f_out << left << setw(40) <<"* - Seed threshold: "<<""
973 << left << setw(10) <<JET_seed <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
974 f_out << left << setw(40) <<"* - Cone radius: "<<""
975 << left << setw(10) <<JET_coneradius <<""<< right << setw(20)<<"*"<<"\n";
976 f_out << left << setw(40) <<"* - Adjacency cut: "<<""
977 << left << setw(10) <<JET_C_adjacencycut <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
978 f_out << left << setw(40) <<"* - Max iterations: "<<""
979 << left << setw(10) <<JET_C_maxiterations <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
980 f_out << left << setw(40) <<"* - Iratch: "<<""
981 << left << setw(10) <<JET_C_iratch <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
982 f_out << left << setw(40) <<"* - Overlap threshold: "<<""
983 << left << setw(10) <<JET_overlap <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
984 }
985 break;
986 case 2: {
987 f_out<<"* CDF midpoint jet algorithm with parameters: *"<<"\n";
988 f_out << left << setw(40) <<"* - Seed threshold: "<<""
989 << left << setw(20) <<JET_seed <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
990 f_out << left << setw(40) <<"* - Cone radius: "<<""
991 << left << setw(20) <<JET_coneradius <<""<< right << setw(10)<<"*"<<"\n";
992 f_out << left << setw(40) <<"* - Cone area fraction:"<<""
993 << left << setw(20) <<JET_M_coneareafraction <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
994 f_out << left << setw(40) <<"* - Maximum pair size: "<<""
995 << left << setw(20) <<JET_M_maxpairsize <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
996 f_out << left << setw(40) <<"* - Max iterations: "<<""
997 << left << setw(20) <<JET_M_maxiterations <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
998 f_out << left << setw(40) <<"* - Overlap threshold: "<<""
999 << left << setw(20) <<JET_overlap <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
1000 }
1001 break;
1002 case 3: {
1003 f_out <<"* SISCone jet algorithm with parameters: *"<<"\n";
1004 f_out << left << setw(40) <<"* - Cone radius: "<<""
1005 << left << setw(20) <<JET_coneradius <<""<< right << setw(10)<<"*"<<"\n";
1006 f_out << left << setw(40) <<"* - Overlap threshold: "<<""
1007 << left << setw(20) <<JET_overlap <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
1008 f_out << left << setw(40) <<"* - Number pass max: "<<""
1009 << left << setw(20) <<JET_S_npass <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
1010 f_out << left << setw(40) <<"* - Minimum pT for protojet: "<<""
1011 << left << setw(20) <<JET_S_protojet_ptmin <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
1012 }
1013 break;
1014 case 4: {
1015 f_out <<"* KT jet algorithm with parameters: *"<<"\n";
1016 f_out << left << setw(40) <<"* - Cone radius: "<<""
1017 << left << setw(20) <<JET_coneradius <<""<< right << setw(10)<<"*"<<"\n";
1018 }
1019 break;
1020 case 5: {
1021 f_out <<"* Cambridge/Aachen jet algorithm with parameters: *"<<"\n";
1022 f_out << left << setw(40) <<"* - Cone radius: "<<""
1023 << left << setw(20) <<JET_coneradius <<""<< right << setw(10)<<"*"<<"\n";
1024 }
1025 break;
1026 case 6: {
1027 f_out <<"* Anti-kt jet algorithm with parameters: *"<<"\n";
1028 f_out << left << setw(40) <<"* - Cone radius: "<<""
1029 << left << setw(20) <<JET_coneradius <<""<< right << setw(10)<<"*"<<"\n";
1030 }
1031 break;
1032 }
1033 f_out<<"* *"<<"\n";
1034 f_out<<"#****************************** *"<<"\n";
1035 f_out<<"# Tau-jet definition parameters *"<<"\n";
1036 f_out<<"#****************************** *"<<"\n";
1037 f_out<<"* *"<<"\n";
1038 f_out << left << setw(45) <<"* Cone radius for calorimeter tagging: "<<""
1039 << left << setw(5) <<TAU_energy_scone <<""<< right << setw(20)<<"*"<<"\n";
1040 f_out << left << setw(45) <<"* Fraction of energy in the small cone: "<<""
1041 << left << setw(5) <<TAU_energy_frac*100 <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
1042 f_out << left << setw(45) <<"* Cone radius for tracking tagging: "<<""
1043 << left << setw(5) <<TAU_track_scone <<""<< right << setw(20)<<"*"<<"\n";
1044 f_out << left << setw(45) <<"* Minimum track pT [GeV]: "<<""
1045 << left << setw(5) <<TAU_track_pt <<""<< right << setw(20)<<"*"<<"\n";
1046 f_out<<"* *"<<"\n";
1047 f_out<<"#*************************** *"<<"\n";
1048 f_out<<"# B-tagging efficiencies [%] *"<<"\n";
1049 f_out<<"#*************************** *"<<"\n";
1050 f_out<<"* *"<<"\n";
1051 f_out << left << setw(50) <<"* Efficiency to tag a \"b\" as a b-jet: "<<""
1052 << left << setw(10) <<BTAG_b <<""<< right << setw(10)<<"*"<<"\n";
1053 f_out << left << setw(50) <<"* Efficiency to mistag a c-jet as a b-jet: "<<""
1054 << left << setw(10) <<BTAG_mistag_c <<""<< right << setw(10)<<"*"<<"\n";
1055 f_out << left << setw(50) <<"* Efficiency to mistag a light jet as a b-jet: "<<""
1056 << left << setw(10) <<BTAG_mistag_l <<""<< right << setw(10)<<"*"<<"\n";
1057 f_out<<"* *"<<"\n";
1058 f_out<<"* *"<<"\n";
1059 f_out<<"#....................................................................*"<<"\n";
1060 f_out<<"#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n";
1061
1062 f_out.close();
1063}
1064
1065// **********Provides the smeared TLorentzVector for the electrons********
1066// Smears the electron energy, and changes the 4-momentum accordingly
1067// different smearing if the electron is central (eta < 2.5) or forward
1068void RESOLution::SmearElectron(TLorentzVector &electron) {
1069 // the 'electron' variable will be changed by the function
1070 float energy = electron.E(); // before smearing
1071 float energyS = 0.0; // after smearing // \sigma/E = C + N/E + S/\sqrt{E}
1072
1073 if(fabs(electron.Eta()) < CEN_max_tracker) { // if the electron is inside the tracker
1074 energyS = gRandom->Gaus(energy, sqrt(
1075 pow(ELG_Ncen,2) +
1076 pow(ELG_Ccen*energy,2) +
1077 pow(ELG_Scen*sqrt(energy),2) ));
1078 }
1079 if(fabs(electron.Eta()) > CEN_max_tracker && fabs(electron.Eta()) < CEN_max_calo_fwd){
1080 energyS = gRandom->Gaus(energy, sqrt(
1081 pow(ELG_Nfwd,2) +
1082 pow(ELG_Cfwd*energy,2) +
1083 pow(ELG_Sfwd*sqrt(energy),2) ) );
1084 }
1085 electron.SetPtEtaPhiE(energyS/cosh(electron.Eta()), electron.Eta(), electron.Phi(), energyS);
1086 if(electron.E() < 0)electron.SetPxPyPzE(0,0,0,0); // no negative values after smearing !
1087}
1088
1089
1090// **********Provides the smeared TLorentzVector for the muons********
1091// Smears the muon pT and changes the 4-momentum accordingly
1092void RESOLution::SmearMu(TLorentzVector &muon) {
1093 // the 'muon' variable will be changed by the function
1094 float pt = muon.Pt(); // before smearing
1095 float ptS=pt;
1096
1097 if(fabs(muon.Eta()) < CEN_max_mu )
1098 {
1099 ptS = gRandom->Gaus(pt, MU_SmearPt*pt ); // after smearing // \sigma/E = C + N/E + S/\sqrt{E}
1100 }
1101 muon.SetPtEtaPhiE(ptS, muon.Eta(), muon.Phi(), ptS*cosh(muon.Eta()));
1102
1103 if(muon.E() < 0)muon.SetPxPyPzE(0,0,0,0); // no negative values after smearing !
1104}
1105
1106
1107// **********Provides the smeared TLorentzVector for the hadrons********
1108// Smears the hadron 4-momentum
1109void RESOLution::SmearHadron(TLorentzVector &hadron, const float frac)
1110 // the 'hadron' variable will be changed by the function
1111 // the 'frac' variable describes the long-living particles. Should be 0.7 for K0S and Lambda, 1. otherwise
1112{
1113 float energy = hadron.E(); // before smearing
1114 float energyS = 0.0; // after smearing // \sigma/E = C + N/E + S/\sqrt{E}
1115 float energy_ecal = (1.0 - frac)*energy; // electromagnetic calorimeter
1116 float energy_hcal = frac*energy; // hadronic calorimeter
1117 // frac takes into account the decay of long-living particles, that decay in the calorimeters
1118 // some of the particles decay mostly in the ecal, some mostly in the hcal
1119
1120 float energyS1,energyS2;
1121 if(fabs(hadron.Eta()) < CEN_max_calo_cen) {
1122 energyS1 = gRandom->Gaus(energy_hcal, sqrt(
1123 pow(HAD_Nhcal,2) +
1124 pow(HAD_Chcal*energy_hcal,2) +
1125 pow(HAD_Shcal*sqrt(energy_hcal),2) )) ;
1126
1127
1128 energyS2 = gRandom->Gaus(energy_ecal, sqrt(
1129 pow(ELG_Ncen,2) +
1130 pow(ELG_Ccen*energy_ecal,2) +
1131 pow(ELG_Scen*sqrt(energy_ecal),2) ) );
1132
1133 energyS = ((energyS1>0)?energyS1:0) + ((energyS2>0)?energyS2:0);
1134 }
1135 if(fabs(hadron.Eta()) > CEN_max_calo_cen && fabs(hadron.Eta()) < CEN_max_calo_fwd){
1136 energyS = gRandom->Gaus(energy, sqrt(
1137 pow(HAD_Nhf,2) +
1138 pow(HAD_Chf*energy,2) +
1139 pow(HAD_Shf*sqrt(energy),2) ));
1140}
1141
1142
1143
1144 hadron.SetPtEtaPhiE(energyS/cosh(hadron.Eta()),hadron.Eta(), hadron.Phi(), energyS);
1145
1146 if(hadron.E() < 0)hadron.SetPxPyPzE(0,0,0,0);
1147}
1148
1149//******************************************************************************************
1150
1151//void RESOLution::SortedVector(vector<ParticleUtil> &vect)
1152void RESOLution::SortedVector(vector<D_Particle> &vect)
1153{
1154 int i,j = 0;
1155 TLorentzVector tmp;
1156 bool en_desordre = true;
1157 int entries=vect.size();
1158 for(i = 0 ; (i < entries) && en_desordre; i++)
1159 {
1160 en_desordre = false;
1161 for(j = 1 ; j < entries - i ; j++)
1162 {
1163 if ( vect[j].Pt() > vect[j-1].Pt() )
1164 {
1165 //ParticleUtil tmp = vect[j-1];
1166 D_Particle tmp = vect[j-1];
1167 vect[j-1] = vect[j];
1168 vect[j] = tmp;
1169 en_desordre = true;
1170 }
1171 }
1172 }
1173}
1174
1175// **********Provides the energy in the cone of radius TAU_CONE_ENERGY for the tau identification********
1176// to be taken into account, a calo tower should
1177// 1) have a transverse energy \f$ E_T = \sqrt{E_X^2 + E_Y^2} \f$ above a given threshold
1178// 2) be inside a cone with a radius R and the axis defined by (eta,phi)
1179double RESOLution::EnergySmallCone(const vector<PhysicsTower> &towers, const float eta, const float phi) {
1180 double Energie=0;
1181 for(unsigned int i=0; i < towers.size(); i++) {
1182 if(towers[i].fourVector.pt() < JET_seed) continue;
1183 if((DeltaR(phi,eta,towers[i].fourVector.phi(),towers[i].fourVector.eta()) < TAU_energy_scone)) {
1184 Energie += towers[i].fourVector.E;
1185 }
1186 }
1187 return Energie;
1188}
1189
1190
1191// **********Provides the number of tracks in the cone of radius TAU_CONE_TRACKS for the tau identification********
1192// to be taken into account, a track should
1193// 1) avec a transverse momentum \$f p_T \$ above a given threshold
1194// 2) be inside a cone with a radius R and the axis defined by (eta,phi)
1195// IMPORTANT REMARK !!!!!
1196// NEW : "charge" will contain the sum of all charged tracks in the cone TAU_track_scone
1197unsigned int RESOLution::NumTracks(float& charge, const vector<TRootTracks> &tracks, const float pt_track, const float eta, const float phi) {
1198 unsigned int numbtrack=0; // number of track in the tau-jet cone, which is smaller than R;
1199 charge=0;
1200 for(unsigned int i=0; i < tracks.size(); i++) {
1201 if(tracks[i].PT < pt_track ) continue;
1202 //float dr = DeltaR(phi,eta,tracks[i].PhiOuter,tracks[i].EtaOuter);
1203 float dr = DeltaR(phi,eta,tracks[i].Phi,tracks[i].Eta);
1204 if (dr > TAU_track_scone) continue;
1205 numbtrack++;
1206 charge += tracks[i].Charge; // total charge in the cone for Tau-jet
1207 }
1208 return numbtrack;
1209}
1210
1211//*** Returns the PID of the particle with the highest energy, in a cone with a radius CONERADIUS and an axis (eta,phi) *********
1212//used by Btaggedjet
1213///// Attention : bug removed => CONERADIUS/2 -> CONERADIUS !!
1214int RESOLution::Bjets(const TSimpleArray<TRootC::GenParticle> &subarray, const float& eta, const float& phi) {
1215 float emax=0;
1216 int Ppid=0;
1217 if(subarray.GetEntries()>0) {
1218 for(int i=0; i < subarray.GetEntries();i++) { // should have pt>PT_JETMIN and a small cone radius (r<CONE_JET)
1219 float genDeltaR = DeltaR(subarray[i]->Phi,subarray[i]->Eta,phi,eta);
1220 if(genDeltaR < JET_coneradius && subarray[i]->E > emax) {
1221 emax=subarray[i]->E;
1222 Ppid=abs(subarray[i]->PID);
1223 }
1224 }
1225 }
1226 return Ppid;
1227}
1228
1229
1230//******************** Simulates the b-tagging efficiency for real bjet, or the misendentification for other jets****************
1231bool RESOLution::Btaggedjet(const TLorentzVector &JET, const TSimpleArray<TRootC::GenParticle> &subarray) {
1232 if( rand()%100 < (BTAG_b+1) && Bjets(subarray,JET.Eta(),JET.Phi())==pB ) return true; // b-tag of b-jets is 40%
1233 else if( rand()%100 < (BTAG_mistag_c+1) && Bjets(subarray,JET.Eta(),JET.Phi())==pC ) return true; // b-tag of c-jets is 10%
1234 else if( rand()%100 < (BTAG_mistag_l+1) && Bjets(subarray,JET.Eta(),JET.Phi())!=0) return true; // b-tag of light jets is 1%
1235 return false;
1236}
1237
1238//***********************Isolation criteria***********************
1239//****************************************************************
1240bool RESOLution::Isolation(const D_Particle& part, const vector<TRootTracks> &tracks, const float& pt_second_track, const float& isolCone, float& ptiso )
1241{
1242 bool isolated = false;
1243 ptiso = 0; // sum of all track pt in isolation cone
1244 float deltar=1E99; // Initial value; should be high; no further repercussion
1245
1246 // loop on all tracks, with p_t above threshold, close enough from the charged lepton
1247 for(unsigned int i=0; i < tracks.size(); i++) {
1248 if(tracks[i].PT < pt_second_track) continue; // ptcut on tracks
1249 float genDeltaR = DeltaR(part.Phi(),part.Eta(),tracks[i].Phi,tracks[i].Eta);
1250 if(
1251 (genDeltaR > deltar) ||
1252 (genDeltaR==0) // rejets the track of the particle itself
1253 ) continue ;
1254 deltar=genDeltaR; // finds the closest track
1255
1256 // as long as (genDeltaR==0) is put above, the particle itself is not taken into account
1257 if( genDeltaR < ISOL_Cone) ptiso += tracks[i].PT; // dR cut on tracks
1258 }
1259 if(deltar > isolCone) isolated = true;
1260 return isolated;
1261}
1262
1263// ******* Calorimetric isolation
1264float RESOLution::CaloIsolation(const D_Particle& part, const D_CaloTowerList & towers, const float iPhi, const float iEta) {
1265 // etrat, which is a percentage between 00 and 99. It is the ratio of the transverse energy
1266 // in a 3×3 grid surrounding the muon to the pT of the muon. For well-isolated muons, both ptiso and etrat will be small.
1267 if(ISOL_Calo_ET>1E10) return UNDEFINED; // avoid doing anything unreasonable...
1268 float et_sum=0;
1269 // available parameters: ISOL_Calo_ET , ISOL_Calo_Grid
1270 // Get the EtaCalo/PhiCalo of the muon ;
1271 // transform it into iEta/iPhi to get the towers, and their neighbourh (i-1, i-2, etc)
1272
1273 unsigned int N = ISOL_Calo_Grid;
1274 int index= iUNDEFINED; // index of the central tower of the grid in TOWER_eta_edges[.];
1275 // !! TOWER_eta_edges is only with eta>0
1276 // finds the index of the central tower of the NxN grid
1277 for (unsigned int i=1; i< TOWER_number+1; i++) {
1278 if(fabs(iEta) >= TOWER_eta_edges[i-1] && fabs(iEta) < TOWER_eta_edges[i]) {
1279 index = i-1;
1280 break;
1281 }
1282 }
1283 if(index != iUNDEFINED) {
1284 // finds the size in phi of the cells for this eta
1285 float dphi = TOWER_dphi[index]*pi/180.; // in rad
1286
1287 //cout << "Grid " << " ----------\n";
1288 for (unsigned int i_eta=0; i_eta<N; i_eta++) {
1289 unsigned int real_index = (iEta>0) ? index+i_eta-(N-1)/2 : index+1+i_eta-(N-1)/2 ;
1290 float eta_ith_tower = TOWER_eta_edges[real_index];
1291 if(iEta<0) eta_ith_tower *= -1;
1292
1293 for (unsigned int i_phi=0; i_phi<N; i_phi++) {
1294 float phi_ith_tower = iPhi + (float)(i_phi - (N-1.)/2.)*dphi;
1295 D_CaloTower calMuon(towers.getElement(eta_ith_tower,phi_ith_tower));
1296 if(calMuon.getEta() != UNDEFINED && calMuon.getE() > ISOL_Calo_ET) {
1297 et_sum += calMuon.getE();
1298 //cout << "eta/phi = " << eta_ith_tower << "\t" << phi_ith_tower << "\t" << calMuon.getE() << " GeV" << endl;
1299 }
1300 //else cout << "eta/phi = " << eta_ith_tower << "\t" << phi_ith_tower << "\tnot active\n";
1301 }
1302
1303 } // NxN grid
1304 //cout << "-----------" << etrat << endl;
1305 }
1306 else if (CEN_max_mu < CEN_max_calo_fwd)
1307 cout << "** ERROR in RESOLution::CaloIsolation: 'muon'-tower not found! **" << endl;
1308 // should never happen ! this would be a bug
1309 //cout << "etrat = " << et_sum << "\t Pt=" << part.Pt() << endl;
1310
1311 // should return a number between 0 and 99 (due to LHCO definitions)
1312 // which is Pt(muon) / sum(ET)
1313 float etrat = 0.;
1314 if(et_sum==0) etrat = 99.;
1315 else if(et_sum>0) etrat = 100*part.Pt()/et_sum;
1316 if(etrat<0) cout << "Error: negative etrat in CaloIsolation (" << etrat <<")\n";
1317 //else if(etrat>99) cout << "Error: etrat should be in [0;99] in CaloIsolation (" << etrat <<")\n";
1318 if(etrat>99) etrat = 99;
1319 return etrat;
1320}
1321
1322
1323 //********** returns a segmented value for eta and phi, for calo towers *****
1324void RESOLution::BinEtaPhi(const float phi, const float eta, float& iPhi, float& iEta){
1325 iEta = UNDEFINED;
1326 int index= iUNDEFINED;
1327 for (unsigned int i=1; i< TOWER_number+1; i++) {
1328 if(fabs(eta)>TOWER_eta_edges[i-1] && fabs(eta)<=TOWER_eta_edges[i]) {
1329 iEta = (eta>0) ? ((TOWER_eta_edges[i-1]+TOWER_eta_edges[i])/2.0) : -((TOWER_eta_edges[i-1]+TOWER_eta_edges[i])/2.0);
1330 index = i-1;
1331 break;
1332 }
1333 }
1334 if(index==UNDEFINED) return;
1335 iPhi = UNDEFINED;
1336 float dphi = TOWER_dphi[index]*pi/180.;
1337 for (unsigned int i=1; i < 360/TOWER_dphi[index]; i++ ) {
1338 float low = -pi+(i-1)*dphi;
1339 float high= low+dphi;
1340 if(phi > low && phi <= high ){
1341 iPhi = (low+high)/2.0;
1342 break;
1343 }
1344 }
1345 if (phi > pi-dphi) iPhi = pi-dphi;
1346}
1347
1348//**************************** Returns the delta Phi ****************************
1349float DeltaPhi(const float phi1, const float phi2) {
1350 float deltaphi=phi1-phi2; // in here, -pi < phi < pi
1351 if(fabs(deltaphi) > pi) {
1352 deltaphi=2.*pi -fabs(deltaphi);// put deltaphi between 0 and pi
1353 }
1354 else deltaphi=fabs(deltaphi);
1355
1356 return deltaphi;
1357}
1358
1359//**************************** Returns the delta R****************************
1360float DeltaR(const float phi1, const float eta1, const float phi2, const float eta2) {
1361 return sqrt(pow(DeltaPhi(phi1,phi2),2) + pow(eta1-eta2,2));
1362}
1363
1364int sign(const int myint) {
1365 if (myint >0) return 1;
1366 else if (myint <0) return -1;
1367 else return 0;
1368}
1369
1370int sign(const float myfloat) {
1371 if (myfloat >0) return 1;
1372 else if (myfloat <0) return -1;
1373 else return 0;
1374}
1375
1376int ChargeVal(const int pid)
1377{
1378 cout << "ChargeVal :: deprecated function, do not use it anymore" << endl;
1379 int charge;
1380 if(
1381 (pid == pGAMMA) ||
1382 (pid == pPI0) ||
1383 (pid == pK0L) ||
1384 (pid == pN) ||
1385 (pid == pSIGMA0) ||
1386 (pid == pDELTA0) ||
1387 (pid == pK0S) // not charged particles : invisible by tracker
1388 )
1389 charge = 0;
1390 else charge = sign(pid);
1391 return charge;
1392
1393}
1394
1395//------------------------------------------------------------------------------
1396void RESOLution::ReadParticleDataGroupTable() {
1397
1398 string temp_string;
1399 istringstream curstring;
1400
1401 ifstream fichier_a_lire(PdgTableFilename.c_str());
1402 if(!fichier_a_lire.good()) {
1403 cout <<"** ERROR: PDG Table ("<< PdgTableFilename
1404 << ") not found! exit. **" << endl;
1405 exit(1);
1406 return;
1407 }
1408 // first three lines of the file are useless
1409 getline(fichier_a_lire,temp_string);
1410 getline(fichier_a_lire,temp_string);
1411 getline(fichier_a_lire,temp_string);
1412
1413
1414 while (getline(fichier_a_lire,temp_string)) {
1415 curstring.clear(); // needed when using several times istringstream::str(string)
1416 curstring.str(temp_string);
1417 int ID; string name; int charge; float mass; float width; float lifetime;
1418 // ID name chg mass total width lifetime
1419 // 1 d -1 0.33000 0.00000 0.00000E+00
1420 // in the table, the charge is in units of e+/3
1421 // the total width is in GeV
1422 // the lifetime is ctau in mm
1423 curstring >> ID >> name >> charge >> mass >> width >> lifetime;
1424 PdgParticle particle(ID,name,mass,charge/3.,width,lifetime/1000.);
1425 PDGtable.insert(ID,particle);
1426 //PdgTable.insert(pair<int,PdgParticle>(ID,particle));
1427 //cout << PDGtable[ID].name() << "\t" << PDGtable[ID].mass() << "\t" << PDGtable[ID].charge() << endl;
1428 }
1429
1430} // ReadParticleDataGroupTable
1431
1432
1433// to be improved in order to avoid code repetition
1434// sorry, no time to do it right now (XR, 19/05/2009)
1435void time_report(const TStopwatch& global,const TStopwatch& loop,const TStopwatch& trigger,const TStopwatch& frog,const TStopwatch& lhco, const int flag_frog, const int flag_trigger, const int flag_lhco, const string& LogName, const Long64_t allEntries) {
1436
1437TStopwatch globalwatch(global), loopwatch(loop), triggerwatch(trigger), frogwatch(frog), lhcowatch(lhco);
1438
1439 cout <<"** **"<< endl;
1440 cout <<"** ################## Time report ################# **"<< endl;
1441 cout << left << setw(32) <<"** Time report for "<<""
1442 << left << setw(15) << allEntries <<""
1443 << right << setw(22) <<"events **"<<endl;
1444 cout <<"** **"<< endl;
1445 cout << left << setw(10) <<"**"<<""
1446 << left << setw(15) <<"Time (s):"<<""
1447 << right << setw(15) <<"CPU"<<""
1448 << right << setw(15) <<"Real"<<""
1449 << right << setw(14) <<"**"<<endl;
1450 cout << left << setw(10) <<"**"<<""
1451 << left << setw(15) <<" + Global:"<<""
1452 << right << setw(15) <<globalwatch.CpuTime()<<""
1453 << right << setw(15) <<globalwatch.RealTime()<<""
1454 << right << setw(14) <<"**"<<endl;
1455 cout << left << setw(10) <<"**"<<""
1456 << left << setw(15) <<" + Events:"<<""
1457 << right << setw(15) <<loopwatch.CpuTime()<<""
1458 << right << setw(15) <<loopwatch.RealTime()<<""
1459 << right << setw(14) <<"**"<<endl;
1460 if(flag_trigger == 1)
1461 {
1462 cout << left << setw(10) <<"**"<<""
1463 << left << setw(15) <<" + Trigger:"<<""
1464 << right << setw(15) <<triggerwatch.CpuTime()<<""
1465 << right << setw(15) <<triggerwatch.RealTime()<<""
1466 << right << setw(14) <<"**"<<endl;
1467 }
1468 if(flag_frog == 1)
1469 {
1470 cout << left << setw(10) <<"**"<<""
1471 << left << setw(15) <<" + Frog:"<<""
1472 << right << setw(15) <<frogwatch.CpuTime()<<""
1473 << right << setw(15) <<frogwatch.RealTime()<<""
1474 << right << setw(14) <<"**"<<endl;
1475 }
1476 if(flag_lhco == 1)
1477 {
1478 cout << left << setw(10) <<"**"<<""
1479 << left << setw(15) <<" + LHCO:"<<""
1480 << right << setw(15) <<lhcowatch.CpuTime()<<""
1481 << right << setw(15) <<lhcowatch.RealTime()<<""
1482 << right << setw(14) <<"**"<<endl;
1483 }
1484
1485
1486 ofstream f_out(LogName.c_str(),ios_base::app);
1487
1488 f_out <<"** *"<< endl;
1489 f_out <<"** ################## Time report ################# *"<< endl;
1490 f_out << left << setw(32) <<"** Time report for "<<""
1491 << left << setw(15) << allEntries <<""
1492 << right << setw(22) <<"events *"<<endl;
1493 f_out <<"** *"<< endl;
1494 f_out << left << setw(10) <<"**"<<""
1495 << left << setw(15) <<"Time (s):"<<""
1496 << right << setw(15) <<"CPU"<<""
1497 << right << setw(15) <<"Real"<<""
1498 << right << setw(15) <<" *"<<endl;
1499 f_out << left << setw(10) <<"**"<<""
1500 << left << setw(15) <<" + Global:"<<""
1501 << right << setw(15) <<globalwatch.CpuTime()<<""
1502 << right << setw(15) <<globalwatch.RealTime()<<""
1503 << right << setw(15) <<" *"<<endl;
1504 f_out << left << setw(10) <<"**"<<""
1505 << left << setw(15) <<" + Events:"<<""
1506 << right << setw(15) <<loopwatch.CpuTime()<<""
1507 << right << setw(15) <<loopwatch.RealTime()<<""
1508 << right << setw(15) <<" *"<<endl;
1509 if(flag_trigger == 1)
1510 {
1511 f_out << left << setw(10) <<"**"<<""
1512 << left << setw(15) <<" + Trigger:"<<""
1513 << right << setw(15) <<triggerwatch.CpuTime()<<""
1514 << right << setw(15) <<triggerwatch.RealTime()<<""
1515 << right << setw(15) <<" *"<<endl;
1516 }
1517 if(flag_frog == 1)
1518 {
1519 f_out << left << setw(10) <<"**"<<""
1520 << left << setw(15) <<" + Frog:"<<""
1521 << right << setw(15) <<frogwatch.CpuTime()<<""
1522 << right << setw(15) <<frogwatch.RealTime()<<""
1523 << right << setw(15) <<" *"<<endl;
1524 }
1525 if(flag_lhco == 1)
1526 {
1527 f_out << left << setw(10) <<"**"<<""
1528 << left << setw(15) <<" + LHCO:"<<""
1529 << right << setw(15) <<lhcowatch.CpuTime()<<""
1530 << right << setw(15) <<lhcowatch.RealTime()<<""
1531 << right << setw(15) <<" *"<<endl;
1532 }
1533 f_out<<"* *"<<"\n";
1534 f_out<<"* *"<<"\n";
1535 f_out<<"#....................................................................*"<<"\n";
1536 f_out<<"#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n";
1537
1538 f_out.close();
1539
1540}
1541
1542void print_header() {
1543 cout << endl << endl;
1544
1545 cout <<"*********************************************************************"<< endl;
1546 cout <<"*********************************************************************"<< endl;
1547 cout <<"** **"<< endl;
1548 cout <<"** Welcome to **"<< endl;
1549 cout <<"** **"<< endl;
1550 cout <<"** **"<< endl;
1551 cout <<"** .ddddddd- lL hH **"<< endl;
1552 cout <<"** -Dd` `dD: Ll hH` **"<< endl;
1553 cout <<"** dDd dDd eeee. lL .pp+pp Hh+hhh` -eeee- `sssss **"<< endl;
1554 cout <<"** -Dd `DD ee. ee Ll .Pp. PP Hh. HH. ee. ee sSs **"<< endl;
1555 cout <<"** dD` dDd eEeee: lL. pP. pP hH hH` eEeee:` -sSSSs. **"<< endl;
1556 cout <<"** .Dd :dd eE. LlL PpppPP Hh Hh eE sSS **"<< endl;
1557 cout <<"** dddddd:. eee+: lL. pp. hh. hh eee+ sssssS **"<< endl;
1558 cout <<"** Pp **"<< endl;
1559 cout <<"** **"<< endl;
1560 cout <<"** Delphes, a framework for the fast simulation **"<< endl;
1561 cout <<"** of a generic collider experiment **"<< endl;
1562 cout <<"** arXiv:0903.2225v1 [hep-ph] **"<< endl;
1563 cout <<"** **"<< endl;
1564 cout <<"** --- Version 1.7 of Delphes --- **"<< endl;
1565 cout <<"** Last date of change: 7 May 2009 **"<< endl;
1566 cout <<"** **"<< endl;
1567 cout <<"** **"<< endl;
1568 cout <<"** This package uses: **"<< endl;
1569 cout <<"** ------------------ **"<< endl;
1570 cout <<"** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **"<< endl;
1571 cout <<"** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **"<< endl;
1572 cout <<"** FROG: [hep-ex/0901.2718v1] **"<< endl;
1573 cout <<"** **"<< endl;
1574 cout <<"**-----------------------------------------------------------------**"<< endl;
1575 cout <<"** **"<< endl;
1576 cout <<"** Main authors: **"<< endl;
1577 cout <<"** ------------- **"<< endl;
1578 cout <<"** **"<< endl;
1579 cout <<"** Séverine Ovyn Xavier Rouby **"<< endl;
1580 cout <<"** severine.ovyn@uclouvain.be xavier.rouby@cern **"<< endl;
1581 cout <<"** Center for Particle Physics and Phenomenology (CP3) **"<< endl;
1582 cout <<"** Universite Catholique de Louvain (UCL) **"<< endl;
1583 cout <<"** Louvain-la-Neuve, Belgium **"<< endl;
1584 cout <<"** **"<< endl;
1585 cout <<"**-----------------------------------------------------------------**"<< endl;
1586 cout <<"** **"<< endl;
1587 cout <<"** Former Delphes versions and documentation can be found on : **"<< endl;
1588 cout <<"** http://www.fynu.ucl.ac.be/delphes.html **"<< endl;
1589 cout <<"** **"<< endl;
1590 cout <<"** **"<< endl;
1591 cout <<"** Disclaimer: this program is a beta version of Delphes and **"<< endl;
1592 cout <<"** therefore comes without guarantees. Beware of errors and please **"<< endl;
1593 cout <<"** give us your feedbacks about potential bugs **"<< endl;
1594 cout <<"** **"<< endl;
1595 cout <<"*********************************************************************"<< endl;
1596 cout <<"*********************************************************************"<< endl;
1597
1598}
Note: See TracBrowser for help on using the repository browser.