Fork me on GitHub

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

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

new header in all files

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