Fork me on GitHub

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

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

new parameters for RomanPots in datacard ; print_header added

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