Fork me on GitHub

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

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

new CaloIsolation for muons : EtRatio up-to-date

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