Fork me on GitHub

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

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

energy flow

File size: 70.8 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
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 //jet stuffs not defined in the input datacard
596 JET_overlap = 0.75;
597 // MidPoint algorithm definition
598 JET_M_coneareafraction = 0.25;
599 JET_M_maxpairsize = 2;
600 JET_M_maxiterations = 100;
601 // Define Cone algorithm.
602 JET_C_adjacencycut = 2;
603 JET_C_maxiterations = 100;
604 JET_C_iratch = 1;
605 //Define SISCone algorithm.
606 JET_S_npass = 0;
607 JET_S_protojet_ptmin= 0.0;
608
609 //For Tau-jet definition
610 TAU_energy_scone = 0.15; // radius R of the cone for tau definition, based on energy threshold
611 TAU_track_scone = 0.4; // radius R of the cone for tau definition, based on track number
612 TAU_track_pt = 2; // minimal pt [GeV] for tracks to be considered in tau definition
613 TAU_energy_frac = 0.95; // fraction of energy required in the central part of the cone, for tau jets
614
615}
616
617void RESOLution::Logfile(const string& LogName) {
618 //void RESOLution::Logfile(string outputfilename) {
619
620 ofstream f_out(LogName.c_str());
621
622 f_out <<"**********************************************************************"<< endl;
623 f_out <<"**********************************************************************"<< endl;
624 f_out <<"** **"<< endl;
625 f_out <<"** Welcome to **"<< endl;
626 f_out <<"** **"<< endl;
627 f_out <<"** **"<< endl;
628 f_out <<"** .ddddddd- lL hH **"<< endl;
629 f_out <<"** -Dd` `dD: Ll hH` **"<< endl;
630 f_out <<"** dDd dDd eeee. lL .pp+pp Hh+hhh` -eeee- `sssss **"<< endl;
631 f_out <<"** -Dd `DD ee. ee Ll .Pp. PP Hh. HH. ee. ee sSs **"<< endl;
632 f_out <<"** dD` dDd eEeee: lL. pP. pP hH hH` eEeee:` -sSSSs. **"<< endl;
633 f_out <<"** .Dd :dd eE. LlL PpppPP Hh Hh eE sSS **"<< endl;
634 f_out <<"** dddddd:. eee+: lL. pp. hh. hh eee+ sssssS **"<< endl;
635 f_out <<"** Pp **"<< endl;
636 f_out <<"** **"<< endl;
637 f_out <<"** Delphes, a framework for the fast simulation **"<< endl;
638 f_out <<"** of a generic collider experiment **"<< endl;
639 f_out <<"** **"<< endl;
640 f_out <<"** --- Version 1.6 of Delphes --- **"<< endl;
641 f_out <<"** Last date of change: 7 May 2009 **"<< endl;
642 f_out <<"** **"<< endl;
643 f_out <<"** **"<< endl;
644 f_out <<"** This package uses: **"<< endl;
645 f_out <<"** ------------------ **"<< endl;
646 f_out <<"** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **"<< endl;
647 f_out <<"** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **"<< endl;
648 f_out <<"** FROG: L. Quertenmont, V. Roberfroid [hep-ex/0901.2718v1] **"<< endl;
649 f_out <<"** **"<< endl;
650 f_out <<"** ---------------------------------------------------------------- **"<< endl;
651 f_out <<"** **"<< endl;
652 f_out <<"** Main authors: **"<< endl;
653 f_out <<"** ------------- **"<< endl;
654 f_out <<"** **"<< endl;
655 f_out <<"** Séverine Ovyn Xavier Rouby **"<< endl;
656 f_out <<"** severine.ovyn@uclouvain.be xavier.rouby@cern **"<< endl;
657 f_out <<"** Center for Particle Physics and Phenomenology (CP3) **"<< endl;
658 f_out <<"** Universite Catholique de Louvain (UCL) **"<< endl;
659 f_out <<"** Louvain-la-Neuve, Belgium **"<< endl;
660 f_out <<"** **"<< endl;
661 f_out <<"** ---------------------------------------------------------------- **"<< endl;
662 f_out <<"** **"<< endl;
663 f_out <<"** Former Delphes versions and documentation can be found on : **"<< endl;
664 f_out <<"** http://www.fynu.ucl.ac.be/delphes.html **"<< endl;
665 f_out <<"** **"<< endl;
666 f_out <<"** **"<< endl;
667 f_out <<"** Disclaimer: this program is a beta version of Delphes and **"<< endl;
668 f_out <<"** therefore comes without guarantees. Beware of errors and please **"<< endl;
669 f_out <<"** give us your feedbacks about potential bugs **"<< endl;
670 f_out <<"** **"<< endl;
671 f_out <<"**********************************************************************"<< endl;
672 f_out <<"** **"<< endl;
673 f_out<<"#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n";
674 f_out<<"# Input PDG table : " << PdgTableFilename << " *"<<"\n";
675 f_out<<"* *"<<"\n";
676 f_out<<"* *"<<"\n";
677 f_out<<"#******************************** *"<<"\n";
678 f_out<<"# Central detector caracteristics *"<<"\n";
679 f_out<<"#******************************** *"<<"\n";
680 f_out<<"* *"<<"\n";
681 f_out << left << setw(30) <<"* Maximum tracking system: "<<""
682 << left << setw(10) <<CEN_max_tracker <<""<< right << setw(15)<<"*"<<"\n";
683 f_out << left << setw(30) <<"* Maximum central calorimeter: "<<""
684 << left << setw(10) <<CEN_max_calo_cen <<""<< right << setw(15)<<"*"<<"\n";
685 f_out << left << setw(30) <<"* Maximum forward calorimeter: "<<""
686 << left << setw(10) <<CEN_max_calo_fwd <<""<< right << setw(15)<<"*"<<"\n";
687 f_out << left << setw(30) <<"* Muon chambers coverage: "<<""
688 << left << setw(10) <<CEN_max_mu <<""<< right << setw(15)<<"*"<<"\n";
689 f_out<<"* *"<<"\n";
690 if(FLAG_RP==1){
691 f_out<<"#************************************ *"<<"\n";
692 f_out<<"# Very forward Roman Pots switched on *"<<"\n";
693 f_out<<"#************************************ *"<<"\n";
694 f_out<<"* *"<<"\n";
695 f_out << left << setw(55) <<"* Distance of the 220 RP to the IP in meters:"<<""
696 << left << setw(5) <<RP_220_s <<""<< right << setw(10)<<"*"<<"\n";
697 f_out << left << setw(55) <<"* Distance of the 220 RP to the beam in meters:"<<""
698 << left << setw(5) <<RP_220_x <<""<< right << setw(10)<<"*"<<"\n";
699 f_out << left << setw(55) <<"* Distance of the 420 RP to the IP in meters:"<<""
700 << left << setw(5) <<RP_420_s <<""<< right << setw(10)<<"*"<<"\n";
701 f_out << left << setw(55) <<"* Distance of the 420 RP to the beam in meters:"<<""
702 << left << setw(5) <<RP_420_x <<""<< right << setw(10)<<"*"<<"\n";
703 f_out << left << setw(55) <<"* Interaction point at the LHC named: "<<""
704 << left << setw(5) <<RP_IP_name <<""<< right << setw(10)<<"*"<<"\n";
705 f_out << left << setw(35) <<"* Datacard for beam 1: "<<""
706 << left << setw(25) <<RP_beam1Card <<""<< right << setw(10)<<"*"<<"\n";
707 f_out << left << setw(35) <<"* Datacard for beam 2: "<<""
708 << left << setw(25) <<RP_beam2Card <<""<< right << setw(10)<<"*"<<"\n";
709 f_out << left << setw(44) <<"* Beam separation, in meters: "<<""
710 << left << setw(6) << RP_offsetEl_x <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
711 f_out << left << setw(44) <<"* Distance from IP for Beam separation (m):"<<""
712 << left << setw(6) <<RP_offsetEl_s <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
713 f_out << left << setw(44) <<"* X offset of beam crossing in micrometers:"<<""
714 << left << setw(6) <<RP_cross_x <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
715 f_out << left << setw(44) <<"* Y offset of beam crossing in micrometers:"<<""
716 << left << setw(6) <<RP_cross_y <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
717 f_out << left << setw(44) <<"* Angle of beam crossing:"<<""
718 << left << setw(6) <<RP_cross_ang <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
719 f_out<<"* *"<<"\n";
720 }
721 else {
722 f_out<<"#************************************* *"<<"\n";
723 f_out<<"# Very forward Roman Pots switched off *"<<"\n";
724 f_out<<"#************************************* *"<<"\n";
725 f_out<<"* *"<<"\n";
726 }
727 if(FLAG_vfd==1){
728 f_out<<"#************************************** *"<<"\n";
729 f_out<<"# Very forward calorimeters switched on *"<<"\n";
730 f_out<<"#************************************** *"<<"\n";
731 f_out<<"* *"<<"\n";
732 f_out << left << setw(55) <<"* Minimum very forward calorimeter: "<<""
733 << left << setw(5) <<VFD_min_calo_vfd <<""<< right << setw(10)<<"*"<<"\n";
734 f_out << left << setw(55) <<"* Maximum very forward calorimeter: "<<""
735 << left << setw(5) <<VFD_max_calo_vfd <<""<< right << setw(10)<<"*"<<"\n";
736 f_out << left << setw(55) <<"* Minimum coverage zero_degree calorimeter "<<""
737 << left << setw(5) <<VFD_min_zdc <<""<< right << setw(10)<<"*"<<"\n";
738 f_out << left << setw(55) <<"* Distance of the ZDC to the IP, in meters: "<<""
739 << left << setw(5) <<VFD_s_zdc <<""<< right << setw(10)<<"*"<<"\n";
740 f_out<<"* *"<<"\n";
741 }
742 else {
743 f_out<<"#*************************************** *"<<"\n";
744 f_out<<"# Very forward calorimeters switched off *"<<"\n";
745 f_out<<"#*************************************** *"<<"\n";
746 f_out<<"* *"<<"\n";
747 }
748
749 f_out<<"#************************************ *"<<"\n";
750 f_out<<"# Electromagnetic smearing parameters *"<<"\n";
751 f_out<<"#************************************ *"<<"\n";
752 f_out<<"* *"<<"\n";
753 //# \sigma/E = C + N/E + S/\sqrt{E}
754 f_out << left << setw(30) <<"* S term for central ECAL: "<<""
755 << left << setw(30) <<ELG_Scen <<""<< right << setw(10)<<"*"<<"\n";
756 f_out << left << setw(30) <<"* N term for central ECAL: "<<""
757 << left << setw(30) <<ELG_Ncen <<""<< right << setw(10)<<"*"<<"\n";
758 f_out << left << setw(30) <<"* C term for central ECAL: "<<""
759 << left << setw(30) <<ELG_Ccen <<""<< right << setw(10)<<"*"<<"\n";
760 f_out << left << setw(30) <<"* S term for FCAL: "<<""
761 << left << setw(30) <<ELG_Sfwd <<""<< right << setw(10)<<"*"<<"\n";
762 f_out << left << setw(30) <<"* N term for FCAL: "<<""
763 << left << setw(30) <<ELG_Nfwd <<""<< right << setw(10)<<"*"<<"\n";
764 f_out << left << setw(30) <<"* C term for FCAL: "<<""
765 << left << setw(30) <<ELG_Cfwd <<""<< right << setw(10)<<"*"<<"\n";
766 f_out << left << setw(30) <<"* S term for ZDC: "<<""
767 << left << setw(30) <<ELG_Szdc <<""<< right << setw(10)<<"*"<<"\n";
768 f_out << left << setw(30) <<"* N term for ZDC: "<<""
769 << left << setw(30) <<ELG_Nzdc <<""<< right << setw(10)<<"*"<<"\n";
770 f_out << left << setw(30) <<"* C term for ZDC: "<<""
771 << left << setw(30) <<ELG_Czdc <<""<< right << setw(10)<<"*"<<"\n";
772
773 f_out<<"* *"<<"\n";
774 f_out<<"#***************************** *"<<"\n";
775 f_out<<"# Hadronic smearing parameters *"<<"\n";
776 f_out<<"#***************************** *"<<"\n";
777 f_out<<"* *"<<"\n";
778 f_out << left << setw(30) <<"* S term for central HCAL: "<<""
779 << left << setw(30) <<HAD_Shcal <<""<< right << setw(10)<<"*"<<"\n";
780 f_out << left << setw(30) <<"* N term for central HCAL: "<<""
781 << left << setw(30) <<HAD_Nhcal <<""<< right << setw(10)<<"*"<<"\n";
782 f_out << left << setw(30) <<"* C term for central HCAL: "<<""
783 << left << setw(30) <<HAD_Chcal <<""<< right << setw(10)<<"*"<<"\n";
784 f_out << left << setw(30) <<"* S term for FCAL: "<<""
785 << left << setw(30) <<HAD_Shf <<""<< right << setw(10)<<"*"<<"\n";
786 f_out << left << setw(30) <<"* N term for FCAL: "<<""
787 << left << setw(30) <<HAD_Nhf <<""<< right << setw(10)<<"*"<<"\n";
788 f_out << left << setw(30) <<"* C term for FCAL: "<<""
789 << left << setw(30) <<HAD_Chf <<""<< right << setw(10)<<"*"<<"\n";
790 f_out << left << setw(30) <<"* S term for ZDC: "<<""
791 << left << setw(30) <<HAD_Szdc <<""<< right << setw(10)<<"*"<<"\n";
792 f_out << left << setw(30) <<"* N term for ZDC: "<<""
793 << left << setw(30) <<HAD_Nzdc <<""<< right << setw(10)<<"*"<<"\n";
794 f_out << left << setw(30) <<"* C term for ZDC: "<<""
795 << left << setw(30) <<HAD_Czdc <<""<< right << setw(10)<<"*"<<"\n";
796
797 f_out<<"* *"<<"\n";
798 f_out<<"#************************* *"<<"\n";
799 f_out<<"# Time smearing parameters *"<<"\n";
800 f_out<<"#************************* *"<<"\n";
801 f_out<<"* *"<<"\n";
802 f_out << left << setw(55) <<"* Time resolution for ZDC : "<<""
803 << left << setw(5) <<ZDC_T_resolution <<""<< right << setw(10)<<"*"<<"\n";
804 f_out << left << setw(55) <<"* Time resolution for RP220 : "<<""
805 << left << setw(5) <<RP220_T_resolution <<""<< right << setw(10)<<"*"<<"\n";
806 f_out << left << setw(55) <<"* Time resolution for RP420 : "<<""
807 << left << setw(5) <<RP420_T_resolution <<""<< right << setw(10)<<"*"<<"\n";
808 f_out<<"* *"<<"\n";
809
810 f_out<<"* *"<<"\n";
811 f_out<<"#************************* *"<<"\n";
812 f_out<<"# Muon smearing parameters *"<<"\n";
813 f_out<<"#************************* *"<<"\n";
814 f_out<<"* *"<<"\n";
815 f_out << left << setw(55) <<"* PT resolution for muons : "<<""
816 << left << setw(5) <<MU_SmearPt <<""<< right << setw(10)<<"*"<<"\n";
817 f_out<<"* *"<<"\n";
818 if(FLAG_bfield==1){
819 f_out<<"#*************************** *"<<"\n";
820 f_out<<"# Magnetic field switched on *"<<"\n";
821 f_out<<"#*************************** *"<<"\n";
822 f_out<<"* *"<<"\n";
823 f_out << left << setw(55) <<"* Radius of the BField coverage: "<<""
824 << left << setw(5) <<TRACK_radius <<""<< right << setw(10)<<"*"<<"\n";
825 f_out << left << setw(55) <<"* Length of the BField coverage: "<<""
826 << left << setw(5) <<TRACK_length <<""<< right << setw(10)<<"*"<<"\n";
827 f_out << left << setw(55) <<"* BField X component: "<<""
828 << left << setw(5) <<TRACK_bfield_x <<""<< right << setw(10)<<"*"<<"\n";
829 f_out << left << setw(55) <<"* BField Y component: "<<""
830 << left << setw(5) <<TRACK_bfield_y <<""<< right << setw(10)<<"*"<<"\n";
831 f_out << left << setw(55) <<"* BField Z component: "<<""
832 << left << setw(5) <<TRACK_bfield_z <<""<< right << setw(10)<<"*"<<"\n";
833 f_out << left << setw(55) <<"* Minimal pT needed to reach the calorimeter [GeV]: "<<""
834 << left << setw(10) <<TRACK_ptmin <<""<< right << setw(5)<<"*"<<"\n";
835 f_out << left << setw(55) <<"* Efficiency associated to the tracking: "<<""
836 << left << setw(10) <<TRACK_eff <<""<< right << setw(5)<<"*"<<"\n";
837 f_out<<"* *"<<"\n";
838 }
839 else {
840 f_out<<"#**************************** *"<<"\n";
841 f_out<<"# Magnetic field switched off *"<<"\n";
842 f_out<<"#**************************** *"<<"\n";
843 f_out << left << setw(55) <<"* Minimal pT needed to reach the calorimeter [GeV]: "<<""
844 << left << setw(10) <<TRACK_ptmin <<""<< right << setw(5)<<"*"<<"\n";
845 f_out << left << setw(55) <<"* Efficiency associated to the tracking: "<<""
846 << left << setw(10) <<TRACK_eff <<""<< right << setw(5)<<"*"<<"\n";
847 f_out<<"* *"<<"\n";
848 }
849 f_out<<"#******************** *"<<"\n";
850 f_out<<"# Calorimetric Towers *"<<"\n";
851 f_out<<"#******************** *"<<"\n";
852 f_out << left << setw(55) <<"* Number of calorimetric towers in eta, for eta>0: "<<""
853 << left << setw(5) << TOWER_number <<""<< right << setw(10)<<"*"<<"\n";
854 f_out << left << setw(55) <<"* Tower edges in eta, for eta>0: "<<"" << right << setw(15)<<"*"<<"\n";
855 f_out << "* ";
856 for (unsigned int i=0; i<TOWER_number+1; i++) {
857 f_out << left << setw(7) << TOWER_eta_edges[i];
858 if(!( (i+1) %9 )) f_out << right << setw(3) << "*" << "\n" << "* ";
859 }
860 for (unsigned int i=(TOWER_number+1)%9; i<9; i++) f_out << left << setw(7) << "";
861 f_out << right << setw(3)<<"*"<<"\n";
862 f_out << left << setw(55) <<"* Tower sizes in phi, for eta>0 [degree]:"<<"" << right << setw(15)<<"*"<<"\n";
863 f_out << "* ";
864 for (unsigned int i=0; i<TOWER_number; i++) {
865 f_out << left << setw(7) << TOWER_dphi[i];
866 if(!( (i+1) %9 )) f_out << right << setw(3) << "*" << "\n" << "* ";
867 }
868 for (unsigned int i=(TOWER_number)%9; i<9; i++) f_out << left << setw(7) << "";
869 f_out << right << setw(3)<<"*"<<"\n";
870 f_out<<"* *"<<"\n";
871 f_out<<"#******************* *"<<"\n";
872 f_out<<"# Minimum pT's [GeV] *"<<"\n";
873 f_out<<"#******************* *"<<"\n";
874 f_out<<"* *"<<"\n";
875 f_out << left << setw(40) <<"* Minimum pT for electrons: "<<""
876 << left << setw(20) <<PTCUT_elec <<""<< right << setw(10)<<"*"<<"\n";
877 f_out << left << setw(40) <<"* Minimum pT for muons: "<<""
878 << left << setw(20) <<PTCUT_muon <<""<< right << setw(10)<<"*"<<"\n";
879 f_out << left << setw(40) <<"* Minimum pT for jets: "<<""
880 << left << setw(20) <<PTCUT_jet <<""<< right << setw(10)<<"*"<<"\n";
881 f_out << left << setw(40) <<"* Minimum pT for Tau-jets: "<<""
882 << left << setw(20) <<PTCUT_taujet <<""<< right << setw(10)<<"*"<<"\n";
883 f_out << left << setw(40) <<"* Minimum pT for photons: "<<""
884 << left << setw(20) <<PTCUT_gamma <<""<< right << setw(10)<<"*"<<"\n";
885 f_out << left << setw(40) <<"* Minimum E for photons in ZDC: "<<""
886 << left << setw(20) <<ZDC_gamma_E <<""<< right << setw(10)<<"*"<<"\n";
887 f_out << left << setw(40) <<"* Minimum E for neutrons in ZDC: "<<""
888 << left << setw(20) <<ZDC_n_E <<""<< right << setw(10)<<"*"<<"\n";
889
890 f_out<<"* *"<<"\n";
891 f_out<<"#******************* *"<<"\n";
892 f_out<<"# Isolation criteria *"<<"\n";
893 f_out<<"#******************* *"<<"\n";
894 f_out<<"* *"<<"\n";
895 f_out << left << setw(40) <<"* Minimum pT for tracks [GeV]: "<<""
896 << left << setw(20) <<ISOL_PT <<""<< right << setw(10)<<"*"<<"\n";
897 f_out << left << setw(40) <<"* Cone for isolation criteria: "<<""
898 << left << setw(20) <<ISOL_Cone <<""<< right << setw(10)<<"*"<<"\n";
899
900 if(ISOL_Calo_ET > 1E98) f_out<<"# No Calorimetric isolation applied *"<<"\n";
901 else {
902 f_out << left << setw(40) <<"* Minimum ET for towers [GeV]: "<<""
903 << left << setw(20) <<ISOL_Calo_ET <<""<< right << setw(10)<<"*"<<"\n";
904 f_out << left << setw(40) <<"* Grid size (NxN) for calorimetric isolation: "<<""
905 << left << setw(20) <<ISOL_Calo_Grid <<""<< right << setw(10)<<"*"<<"\n";
906 }
907
908
909 f_out<<"* *"<<"\n";
910 f_out<<"#*************** *"<<"\n";
911 f_out<<"# Jet definition *"<<"\n";
912 f_out<<"#*************** *"<<"\n";
913 if(JET_Eflow)
914 {
915 f_out<<"#*************** *"<<"\n";
916 f_out<<"#* Running considering perfect energy flow on the tracker coverage *"<<"\n";
917 }
918 else
919 {
920 f_out<<"#* Running considering no energy flow on the tracker coverage *"<<"\n";
921 f_out<<"#* --> jet algo applied on the calorimetric towers *"<<"\n";
922 }
923 f_out<<"* *"<<"\n";
924 f_out<<"* Six algorithms are currently available: *"<<"\n";
925 f_out<<"* - 1) CDF cone algorithm, *"<<"\n";
926 f_out<<"* - 2) CDF MidPoint algorithm, *"<<"\n";
927 f_out<<"* - 3) SIScone algorithm, *"<<"\n";
928 f_out<<"* - 4) kt algorithm, *"<<"\n";
929 f_out<<"* - 5) Cambrigde/Aachen algorithm, *"<<"\n";
930 f_out<<"* - 6) Anti-kt algorithm. *"<<"\n";
931 f_out<<"* *"<<"\n";
932 f_out<<"* You have chosen *"<<"\n";
933 switch(JET_jetalgo) {
934 default:
935 case 1: {
936 f_out<<"* CDF JetClu jet algorithm with parameters: *"<<"\n";
937 f_out << left << setw(40) <<"* - Seed threshold: "<<""
938 << left << setw(10) <<JET_seed <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
939 f_out << left << setw(40) <<"* - Cone radius: "<<""
940 << left << setw(10) <<JET_coneradius <<""<< right << setw(20)<<"*"<<"\n";
941 f_out << left << setw(40) <<"* - Adjacency cut: "<<""
942 << left << setw(10) <<JET_C_adjacencycut <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
943 f_out << left << setw(40) <<"* - Max iterations: "<<""
944 << left << setw(10) <<JET_C_maxiterations <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
945 f_out << left << setw(40) <<"* - Iratch: "<<""
946 << left << setw(10) <<JET_C_iratch <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
947 f_out << left << setw(40) <<"* - Overlap threshold: "<<""
948 << left << setw(10) <<JET_overlap <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
949 }
950 break;
951 case 2: {
952 f_out<<"* CDF midpoint jet algorithm with parameters: *"<<"\n";
953 f_out << left << setw(40) <<"* - Seed threshold: "<<""
954 << left << setw(20) <<JET_seed <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
955 f_out << left << setw(40) <<"* - Cone radius: "<<""
956 << left << setw(20) <<JET_coneradius <<""<< right << setw(10)<<"*"<<"\n";
957 f_out << left << setw(40) <<"* - Cone area fraction:"<<""
958 << left << setw(20) <<JET_M_coneareafraction <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
959 f_out << left << setw(40) <<"* - Maximum pair size: "<<""
960 << left << setw(20) <<JET_M_maxpairsize <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
961 f_out << left << setw(40) <<"* - Max iterations: "<<""
962 << left << setw(20) <<JET_M_maxiterations <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
963 f_out << left << setw(40) <<"* - Overlap threshold: "<<""
964 << left << setw(20) <<JET_overlap <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
965 }
966 break;
967 case 3: {
968 f_out <<"* SISCone jet algorithm with parameters: *"<<"\n";
969 f_out << left << setw(40) <<"* - Cone radius: "<<""
970 << left << setw(20) <<JET_coneradius <<""<< right << setw(10)<<"*"<<"\n";
971 f_out << left << setw(40) <<"* - Overlap threshold: "<<""
972 << left << setw(20) <<JET_overlap <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
973 f_out << left << setw(40) <<"* - Number pass max: "<<""
974 << left << setw(20) <<JET_S_npass <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
975 f_out << left << setw(40) <<"* - Minimum pT for protojet: "<<""
976 << left << setw(20) <<JET_S_protojet_ptmin <<""<< right << setw(10)<<"! not in datacard *"<<"\n";
977 }
978 break;
979 case 4: {
980 f_out <<"* KT jet algorithm with parameters: *"<<"\n";
981 f_out << left << setw(40) <<"* - Cone radius: "<<""
982 << left << setw(20) <<JET_coneradius <<""<< right << setw(10)<<"*"<<"\n";
983 }
984 break;
985 case 5: {
986 f_out <<"* Cambridge/Aachen jet algorithm with parameters: *"<<"\n";
987 f_out << left << setw(40) <<"* - Cone radius: "<<""
988 << left << setw(20) <<JET_coneradius <<""<< right << setw(10)<<"*"<<"\n";
989 }
990 break;
991 case 6: {
992 f_out <<"* Anti-kt jet algorithm with parameters: *"<<"\n";
993 f_out << left << setw(40) <<"* - Cone radius: "<<""
994 << left << setw(20) <<JET_coneradius <<""<< right << setw(10)<<"*"<<"\n";
995 }
996 break;
997 }
998 f_out<<"* *"<<"\n";
999 f_out<<"#****************************** *"<<"\n";
1000 f_out<<"# Tau-jet definition parameters *"<<"\n";
1001 f_out<<"#****************************** *"<<"\n";
1002 f_out<<"* *"<<"\n";
1003 f_out << left << setw(45) <<"* Cone radius for calorimeter tagging: "<<""
1004 << left << setw(5) <<TAU_energy_scone <<""<< right << setw(20)<<"*"<<"\n";
1005 f_out << left << setw(45) <<"* Fraction of energy in the small cone: "<<""
1006 << left << setw(5) <<TAU_energy_frac*100 <<""<< right << setw(20)<<"! not in datacard *"<<"\n";
1007 f_out << left << setw(45) <<"* Cone radius for tracking tagging: "<<""
1008 << left << setw(5) <<TAU_track_scone <<""<< right << setw(20)<<"*"<<"\n";
1009 f_out << left << setw(45) <<"* Minimum track pT [GeV]: "<<""
1010 << left << setw(5) <<TAU_track_pt <<""<< right << setw(20)<<"*"<<"\n";
1011 f_out<<"* *"<<"\n";
1012 f_out<<"#*************************** *"<<"\n";
1013 f_out<<"# B-tagging efficiencies [%] *"<<"\n";
1014 f_out<<"#*************************** *"<<"\n";
1015 f_out<<"* *"<<"\n";
1016 f_out << left << setw(50) <<"* Efficiency to tag a \"b\" as a b-jet: "<<""
1017 << left << setw(10) <<BTAG_b <<""<< right << setw(10)<<"*"<<"\n";
1018 f_out << left << setw(50) <<"* Efficiency to mistag a c-jet as a b-jet: "<<""
1019 << left << setw(10) <<BTAG_mistag_c <<""<< right << setw(10)<<"*"<<"\n";
1020 f_out << left << setw(50) <<"* Efficiency to mistag a light jet as a b-jet: "<<""
1021 << left << setw(10) <<BTAG_mistag_l <<""<< right << setw(10)<<"*"<<"\n";
1022 f_out<<"* *"<<"\n";
1023 f_out<<"* *"<<"\n";
1024 f_out<<"#....................................................................*"<<"\n";
1025 f_out<<"#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n";
1026
1027}
1028
1029// **********Provides the smeared TLorentzVector for the electrons********
1030// Smears the electron energy, and changes the 4-momentum accordingly
1031// different smearing if the electron is central (eta < 2.5) or forward
1032void RESOLution::SmearElectron(TLorentzVector &electron) {
1033 // the 'electron' variable will be changed by the function
1034 float energy = electron.E(); // before smearing
1035 float energyS = 0.0; // after smearing // \sigma/E = C + N/E + S/\sqrt{E}
1036
1037 if(fabs(electron.Eta()) < CEN_max_tracker) { // if the electron is inside the tracker
1038 energyS = gRandom->Gaus(energy, sqrt(
1039 pow(ELG_Ncen,2) +
1040 pow(ELG_Ccen*energy,2) +
1041 pow(ELG_Scen*sqrt(energy),2) ));
1042 }
1043 if(fabs(electron.Eta()) > CEN_max_tracker && fabs(electron.Eta()) < CEN_max_calo_fwd){
1044 energyS = gRandom->Gaus(energy, sqrt(
1045 pow(ELG_Nfwd,2) +
1046 pow(ELG_Cfwd*energy,2) +
1047 pow(ELG_Sfwd*sqrt(energy),2) ) );
1048 }
1049 electron.SetPtEtaPhiE(energyS/cosh(electron.Eta()), electron.Eta(), electron.Phi(), energyS);
1050 if(electron.E() < 0)electron.SetPxPyPzE(0,0,0,0); // no negative values after smearing !
1051}
1052
1053
1054// **********Provides the smeared TLorentzVector for the muons********
1055// Smears the muon pT and changes the 4-momentum accordingly
1056void RESOLution::SmearMu(TLorentzVector &muon) {
1057 // the 'muon' variable will be changed by the function
1058 float pt = muon.Pt(); // before smearing
1059 float ptS=pt;
1060
1061 if(fabs(muon.Eta()) < CEN_max_mu )
1062 {
1063 ptS = gRandom->Gaus(pt, MU_SmearPt*pt ); // after smearing // \sigma/E = C + N/E + S/\sqrt{E}
1064 }
1065 muon.SetPtEtaPhiE(ptS, muon.Eta(), muon.Phi(), ptS*cosh(muon.Eta()));
1066
1067 if(muon.E() < 0)muon.SetPxPyPzE(0,0,0,0); // no negative values after smearing !
1068}
1069
1070
1071// **********Provides the smeared TLorentzVector for the hadrons********
1072// Smears the hadron 4-momentum
1073void RESOLution::SmearHadron(TLorentzVector &hadron, const float frac)
1074 // the 'hadron' variable will be changed by the function
1075 // the 'frac' variable describes the long-living particles. Should be 0.7 for K0S and Lambda, 1. otherwise
1076{
1077 float energy = hadron.E(); // before smearing
1078 float energyS = 0.0; // after smearing // \sigma/E = C + N/E + S/\sqrt{E}
1079 float energy_ecal = (1.0 - frac)*energy; // electromagnetic calorimeter
1080 float energy_hcal = frac*energy; // hadronic calorimeter
1081 // frac takes into account the decay of long-living particles, that decay in the calorimeters
1082 // some of the particles decay mostly in the ecal, some mostly in the hcal
1083
1084 float energyS1,energyS2;
1085 if(fabs(hadron.Eta()) < CEN_max_calo_cen) {
1086 energyS1 = gRandom->Gaus(energy_hcal, sqrt(
1087 pow(HAD_Nhcal,2) +
1088 pow(HAD_Chcal*energy_hcal,2) +
1089 pow(HAD_Shcal*sqrt(energy_hcal),2) )) ;
1090
1091
1092 energyS2 = gRandom->Gaus(energy_ecal, sqrt(
1093 pow(ELG_Ncen,2) +
1094 pow(ELG_Ccen*energy_ecal,2) +
1095 pow(ELG_Scen*sqrt(energy_ecal),2) ) );
1096
1097 energyS = ((energyS1>0)?energyS1:0) + ((energyS2>0)?energyS2:0);
1098 }
1099 if(fabs(hadron.Eta()) > CEN_max_calo_cen && fabs(hadron.Eta()) < CEN_max_calo_fwd){
1100 energyS = gRandom->Gaus(energy, sqrt(
1101 pow(HAD_Nhf,2) +
1102 pow(HAD_Chf*energy,2) +
1103 pow(HAD_Shf*sqrt(energy),2) ));
1104}
1105
1106
1107
1108 hadron.SetPtEtaPhiE(energyS/cosh(hadron.Eta()),hadron.Eta(), hadron.Phi(), energyS);
1109
1110 if(hadron.E() < 0)hadron.SetPxPyPzE(0,0,0,0);
1111}
1112
1113//******************************************************************************************
1114
1115//void RESOLution::SortedVector(vector<ParticleUtil> &vect)
1116void RESOLution::SortedVector(vector<D_Particle> &vect)
1117{
1118 int i,j = 0;
1119 TLorentzVector tmp;
1120 bool en_desordre = true;
1121 int entries=vect.size();
1122 for(i = 0 ; (i < entries) && en_desordre; i++)
1123 {
1124 en_desordre = false;
1125 for(j = 1 ; j < entries - i ; j++)
1126 {
1127 if ( vect[j].Pt() > vect[j-1].Pt() )
1128 {
1129 //ParticleUtil tmp = vect[j-1];
1130 D_Particle tmp = vect[j-1];
1131 vect[j-1] = vect[j];
1132 vect[j] = tmp;
1133 en_desordre = true;
1134 }
1135 }
1136 }
1137}
1138
1139// **********Provides the energy in the cone of radius TAU_CONE_ENERGY for the tau identification********
1140// to be taken into account, a calo tower should
1141// 1) have a transverse energy \f$ E_T = \sqrt{E_X^2 + E_Y^2} \f$ above a given threshold
1142// 2) be inside a cone with a radius R and the axis defined by (eta,phi)
1143double RESOLution::EnergySmallCone(const vector<PhysicsTower> &towers, const float eta, const float phi) {
1144 double Energie=0;
1145 for(unsigned int i=0; i < towers.size(); i++) {
1146 if(towers[i].fourVector.pt() < JET_seed) continue;
1147 if((DeltaR(phi,eta,towers[i].fourVector.phi(),towers[i].fourVector.eta()) < TAU_energy_scone)) {
1148 Energie += towers[i].fourVector.E;
1149 }
1150 }
1151 return Energie;
1152}
1153
1154
1155// **********Provides the number of tracks in the cone of radius TAU_CONE_TRACKS for the tau identification********
1156// to be taken into account, a track should
1157// 1) avec a transverse momentum \$f p_T \$ above a given threshold
1158// 2) be inside a cone with a radius R and the axis defined by (eta,phi)
1159// IMPORTANT REMARK !!!!!
1160// NEW : "charge" will contain the sum of all charged tracks in the cone TAU_track_scone
1161unsigned int RESOLution::NumTracks(float& charge, const vector<TRootTracks> &tracks, const float pt_track, const float eta, const float phi) {
1162 unsigned int numbtrack=0; // number of track in the tau-jet cone, which is smaller than R;
1163 charge=0;
1164 for(unsigned int i=0; i < tracks.size(); i++) {
1165 if(tracks[i].PT < pt_track ) continue;
1166 //float dr = DeltaR(phi,eta,tracks[i].PhiOuter,tracks[i].EtaOuter);
1167 float dr = DeltaR(phi,eta,tracks[i].Phi,tracks[i].Eta);
1168 if (dr > TAU_track_scone) continue;
1169 numbtrack++;
1170 charge += tracks[i].Charge; // total charge in the cone for Tau-jet
1171 }
1172 return numbtrack;
1173}
1174
1175//*** Returns the PID of the particle with the highest energy, in a cone with a radius CONERADIUS and an axis (eta,phi) *********
1176//used by Btaggedjet
1177///// Attention : bug removed => CONERADIUS/2 -> CONERADIUS !!
1178int RESOLution::Bjets(const TSimpleArray<TRootC::GenParticle> &subarray, const float& eta, const float& phi) {
1179 float emax=0;
1180 int Ppid=0;
1181 if(subarray.GetEntries()>0) {
1182 for(int i=0; i < subarray.GetEntries();i++) { // should have pt>PT_JETMIN and a small cone radius (r<CONE_JET)
1183 float genDeltaR = DeltaR(subarray[i]->Phi,subarray[i]->Eta,phi,eta);
1184 if(genDeltaR < JET_coneradius && subarray[i]->E > emax) {
1185 emax=subarray[i]->E;
1186 Ppid=abs(subarray[i]->PID);
1187 }
1188 }
1189 }
1190 return Ppid;
1191}
1192
1193
1194//******************** Simulates the b-tagging efficiency for real bjet, or the misendentification for other jets****************
1195bool RESOLution::Btaggedjet(const TLorentzVector &JET, const TSimpleArray<TRootC::GenParticle> &subarray) {
1196 if( rand()%100 < (BTAG_b+1) && Bjets(subarray,JET.Eta(),JET.Phi())==pB ) return true; // b-tag of b-jets is 40%
1197 else if( rand()%100 < (BTAG_mistag_c+1) && Bjets(subarray,JET.Eta(),JET.Phi())==pC ) return true; // b-tag of c-jets is 10%
1198 else if( rand()%100 < (BTAG_mistag_l+1) && Bjets(subarray,JET.Eta(),JET.Phi())!=0) return true; // b-tag of light jets is 1%
1199 return false;
1200}
1201
1202//***********************Isolation criteria***********************
1203//****************************************************************
1204bool RESOLution::Isolation(const D_Particle& part, const vector<TRootTracks> &tracks, const float& pt_second_track, const float& isolCone, float& ptiso )
1205{
1206 bool isolated = false;
1207 ptiso = 0; // sum of all track pt in isolation cone
1208 float deltar=1E99; // Initial value; should be high; no further repercussion
1209
1210 // loop on all tracks, with p_t above threshold, close enough from the charged lepton
1211 for(unsigned int i=0; i < tracks.size(); i++) {
1212 if(tracks[i].PT < pt_second_track) continue; // ptcut on tracks
1213 float genDeltaR = DeltaR(part.Phi(),part.Eta(),tracks[i].Phi,tracks[i].Eta);
1214 if(
1215 (genDeltaR > deltar) ||
1216 (genDeltaR==0) // rejets the track of the particle itself
1217 ) continue ;
1218 deltar=genDeltaR; // finds the closest track
1219
1220 // as long as (genDeltaR==0) is put above, the particle itself is not taken into account
1221 if( genDeltaR < ISOL_Cone) ptiso += tracks[i].PT; // dR cut on tracks
1222 }
1223 if(deltar > isolCone) isolated = true;
1224 return isolated;
1225}
1226
1227// ******* Calorimetric isolation
1228float RESOLution::CaloIsolation(const D_Particle& part, const D_CaloTowerList & towers) {
1229 // etrat, which is a percentage between 00 and 99. It is the ratio of the transverse energy
1230 // 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.
1231 if(ISOL_Calo_ET>1E10) return UNDEFINED; // avoid doing anything unreasonable...
1232 float etrat=0;
1233 // available parameters: ISOL_Calo_ET , ISOL_Calo_Grid
1234/* for(unsigned int i=0; i < towers.size(); i++) {
1235 if(towers[i].E > ISOL_Calo_ET) {
1236 float genDeltaR = DeltaR(part.Phi(),part.Eta(),towers[i].getPhi(),towers[i].getEta());
1237 if(genDeltaR < ISOL_Calo_Cone) {
1238 ptiso += towers[i].getET();
1239 }
1240 }
1241 } // loop on towers
1242 ptiso -=
1243*/
1244 etrat = 100*etrat/part.Pt();
1245 if(etrat<0) cout << "Error: negative etrat in CaloIsolation (" << etrat <<")\n";
1246 else if(etrat>99) cout << "Error: etrat shoud be in [0;99] in CaloIsolation (" << etrat <<")\n";
1247 return etrat;
1248}
1249
1250
1251 //********** returns a segmented value for eta and phi, for calo towers *****
1252void RESOLution::BinEtaPhi(const float phi, const float eta, float& iPhi, float& iEta){
1253 iEta = UNDEFINED;
1254 int index= iUNDEFINED;
1255 for (unsigned int i=1; i< TOWER_number+1; i++) {
1256 if(fabs(eta)>TOWER_eta_edges[i-1] && fabs(eta)<TOWER_eta_edges[i]) {
1257 iEta = (eta>0) ? TOWER_eta_edges[i-1] : -TOWER_eta_edges[i];
1258 index = i-1;
1259 break;
1260 }
1261 }
1262 if(index==UNDEFINED) return;
1263 iPhi = UNDEFINED;
1264 float dphi = TOWER_dphi[index]*pi/180.;
1265 for (unsigned int i=1; i < 360/TOWER_dphi[index]; i++ ) {
1266 float low = -pi+(i-1)*dphi;
1267 float high= low+dphi;
1268 if(phi > low && phi < high ){
1269 iPhi = low;
1270 break;
1271 }
1272 }
1273 if (phi > pi-dphi) iPhi = pi-dphi;
1274}
1275
1276
1277
1278//**************************** Returns the delta Phi ****************************
1279float DeltaPhi(const float phi1, const float phi2) {
1280 float deltaphi=phi1-phi2; // in here, -pi < phi < pi
1281 if(fabs(deltaphi) > pi) {
1282 deltaphi=2.*pi -fabs(deltaphi);// put deltaphi between 0 and pi
1283 }
1284 else deltaphi=fabs(deltaphi);
1285
1286 return deltaphi;
1287}
1288
1289//**************************** Returns the delta R****************************
1290float DeltaR(const float phi1, const float eta1, const float phi2, const float eta2) {
1291 return sqrt(pow(DeltaPhi(phi1,phi2),2) + pow(eta1-eta2,2));
1292}
1293
1294int sign(const int myint) {
1295 if (myint >0) return 1;
1296 else if (myint <0) return -1;
1297 else return 0;
1298}
1299
1300int sign(const float myfloat) {
1301 if (myfloat >0) return 1;
1302 else if (myfloat <0) return -1;
1303 else return 0;
1304}
1305
1306int ChargeVal(const int pid)
1307{
1308 cout << "ChargeVal :: deprecated function, do not use it anymore" << endl;
1309 int charge;
1310 if(
1311 (pid == pGAMMA) ||
1312 (pid == pPI0) ||
1313 (pid == pK0L) ||
1314 (pid == pN) ||
1315 (pid == pSIGMA0) ||
1316 (pid == pDELTA0) ||
1317 (pid == pK0S) // not charged particles : invisible by tracker
1318 )
1319 charge = 0;
1320 else charge = sign(pid);
1321 return charge;
1322
1323}
1324
1325//------------------------------------------------------------------------------
1326void RESOLution::ReadParticleDataGroupTable() {
1327
1328 string temp_string;
1329 istringstream curstring;
1330
1331 ifstream fichier_a_lire(PdgTableFilename.c_str());
1332 if(!fichier_a_lire.good()) {
1333 cout <<"** ERROR: PDG Table ("<< PdgTableFilename
1334 << ") not found! exit. **" << endl;
1335 exit(1);
1336 return;
1337 }
1338 // first three lines of the file are useless
1339 getline(fichier_a_lire,temp_string);
1340 getline(fichier_a_lire,temp_string);
1341 getline(fichier_a_lire,temp_string);
1342
1343
1344 while (getline(fichier_a_lire,temp_string)) {
1345 curstring.clear(); // needed when using several times istringstream::str(string)
1346 curstring.str(temp_string);
1347 int ID; string name; int charge; float mass; float width; float lifetime;
1348 // ID name chg mass total width lifetime
1349 // 1 d -1 0.33000 0.00000 0.00000E+00
1350 curstring >> ID >> name >> charge >> mass >> width >> lifetime;
1351 PdgParticle particle(ID,name,mass,charge/3.,width,lifetime);
1352 PDGtable.insert(ID,particle);
1353 //PdgTable.insert(pair<int,PdgParticle>(ID,particle));
1354 //cout << PDGtable[ID].name() << "\t" << PDGtable[ID].mass() << "\t" << PDGtable[ID].charge() << endl;
1355 }
1356
1357} // ReadParticleDataGroupTable
Note: See TracBrowser for help on using the repository browser.