/*********************************************************************** ** ** ** /----------------------------------------------\ ** ** | Delphes, a framework for the fast simulation | ** ** | of a generic collider experiment | ** ** \------------- arXiv:0903.2225v1 ------------/ ** ** ** ** ** ** This package uses: ** ** ------------------ ** ** ROOT: Nucl. Inst. & Meth. in Phys. Res. A389 (1997) 81-86 ** ** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] ** ** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] ** ** FROG: [hep-ex/0901.2718v1] ** ** HepMC: Comput. Phys. Commun.134 (2001) 41 ** ** ** ** ------------------------------------------------------------------ ** ** ** ** Main authors: ** ** ------------- ** ** ** ** Severine Ovyn Xavier Rouby ** ** severine.ovyn@uclouvain.be xavier.rouby@cern ** ** ** ** Center for Particle Physics and Phenomenology (CP3) ** ** Universite catholique de Louvain (UCL) ** ** Louvain-la-Neuve, Belgium ** ** ** ** Copyright (C) 2008-2009, ** ** All rights reserved. ** ** ** ***********************************************************************/ /// \file SmearUtil.cc /// \brief RESOLution class, and some generic definitions #include "SmearUtil.h" #include "TRandom.h" #include "TStopwatch.h" #include #include #include #include #include #include using namespace std; //------------------------------------------------------------------------------ RESOLution::RESOLution() { // Detector characteristics CEN_max_tracker = 2.5; // Maximum tracker coverage CEN_max_calo_cen = 3.0; // central calorimeter coverage CEN_max_calo_fwd = 5.0; // forward calorimeter pseudorapidity coverage CEN_max_mu = 2.4; // muon chambers pseudorapidity coverage // Energy resolution for electron/photon // \sigma/E = C + N/E + S/\sqrt{E} ELG_Scen = 0.05; // S term for central ECAL ELG_Ncen = 0.25; // N term for central ECAL ELG_Ccen = 0.005; // C term for central ECAL ELG_Sfwd = 2.084; // S term for FCAL ELG_Nfwd = 0.0; // N term for FCAL ELG_Cfwd = 0.107; // C term for FCAL ELG_Szdc = 0.70; // S term for ZDC ELG_Nzdc = 0.0; // N term for ZDC ELG_Czdc = 0.08; // C term for ZDC // Energy resolution for hadrons in ecal/hcal/hf // \sigma/E = C + N/E + S/\sqrt{E} HAD_Shcal = 1.5; // S term for central HCAL HAD_Nhcal = 0.; // N term for central HCAL HAD_Chcal = 0.05; // C term for central HCAL HAD_Shf = 2.7; // S term for FCAL HAD_Nhf = 0.; // N term for FCAL HAD_Chf = 0.13; // C term for FCAL HAD_Szdc = 1.38; // S term for ZDC HAD_Nzdc = 0.; // N term for ZDC HAD_Czdc = 0.13; // C term for ZDC // Muon smearing MU_SmearPt = 0.01; // time resolution ZDC_T_resolution = 0; // resolution for time measurement [s] RP220_T_resolution = 0; RP420_T_resolution = 0; // Tracking efficiencies TRACK_ptmin = 0.9; // minimal pt needed to reach the calorimeter in GeV TRACK_eff = 100; // efficiency associated to the tracking // Calorimetric towers TOWER_number = 40; const float tower_eta_edges[41] = { 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, 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, 4.350, 4.525, 4.700, 5.000}; // temporary object TOWER_eta_edges = new float[TOWER_number+1]; for(unsigned int i=0; i> varname >> value; CEN_max_tracker = value;} else if(strstr(temp_string.c_str(),"CEN_max_calo_cen")) {curstring >> varname >> value; CEN_max_calo_cen = value;} else if(strstr(temp_string.c_str(),"CEN_max_calo_fwd")) {curstring >> varname >> value; CEN_max_calo_fwd = value;} else if(strstr(temp_string.c_str(),"CEN_max_mu")) {curstring >> varname >> value; CEN_max_mu = value;} else if(strstr(temp_string.c_str(),"VFD_min_calo_vfd")) {curstring >> varname >> value; VFD_min_calo_vfd = value;} else if(strstr(temp_string.c_str(),"VFD_max_calo_vfd")) {curstring >> varname >> value; VFD_max_calo_vfd = value;} else if(strstr(temp_string.c_str(),"VFD_min_zdc")) {curstring >> varname >> value; VFD_min_zdc = value;} else if(strstr(temp_string.c_str(),"VFD_s_zdc")) {curstring >> varname >> value; VFD_s_zdc = value;} else if(strstr(temp_string.c_str(),"RP_220_s")) {curstring >> varname >> value; RP_220_s = value;} else if(strstr(temp_string.c_str(),"RP_220_x")) {curstring >> varname >> value; RP_220_x = value;} else if(strstr(temp_string.c_str(),"RP_420_s")) {curstring >> varname >> value; RP_420_s = value;} else if(strstr(temp_string.c_str(),"RP_420_x")) {curstring >> varname >> value; RP_420_x = value;} else if(strstr(temp_string.c_str(),"RP_beam1Card")) {curstring >> varname >> svalue;RP_beam1Card = svalue;} else if(strstr(temp_string.c_str(),"RP_beam2Card")) {curstring >> varname >> svalue;RP_beam2Card = svalue;} else if(strstr(temp_string.c_str(),"RP_IP_name")) {curstring >> varname >> svalue;RP_IP_name = svalue;} else if(strstr(temp_string.c_str(),"RP_offsetEl_s")) {curstring >> varname >> value; RP_offsetEl_s = value;} else if(strstr(temp_string.c_str(),"RP_offsetEl_x")) {curstring >> varname >> value; RP_offsetEl_x = value;} else if(strstr(temp_string.c_str(),"RP_offsetEl_y")) {curstring >> varname >> value; RP_offsetEl_y = value;} else if(strstr(temp_string.c_str(),"RP_cross_x")) {curstring >> varname >> value; RP_cross_x = value;} else if(strstr(temp_string.c_str(),"RP_cross_y")) {curstring >> varname >> value; RP_cross_y = value;} else if(strstr(temp_string.c_str(),"RP_cross_ang_x")) {curstring >> varname >> value; RP_cross_ang_x = value;} else if(strstr(temp_string.c_str(),"RP_cross_ang_y")) {curstring >> varname >> value; RP_cross_ang_y = value;} else if(strstr(temp_string.c_str(),"ELG_Scen")) {curstring >> varname >> value; ELG_Scen = value;} else if(strstr(temp_string.c_str(),"ELG_Ncen")) {curstring >> varname >> value; ELG_Ncen = value;} else if(strstr(temp_string.c_str(),"ELG_Ccen")) {curstring >> varname >> value; ELG_Ccen = value;} else if(strstr(temp_string.c_str(),"ELG_Sfwd")) {curstring >> varname >> value; ELG_Sfwd = value;} else if(strstr(temp_string.c_str(),"ELG_Cfwd")) {curstring >> varname >> value; ELG_Cfwd = value;} else if(strstr(temp_string.c_str(),"ELG_Nfwd")) {curstring >> varname >> value; ELG_Nfwd = value;} else if(strstr(temp_string.c_str(),"ELG_Szdc")) {curstring >> varname >> value; ELG_Szdc = value;} else if(strstr(temp_string.c_str(),"ELG_Czdc")) {curstring >> varname >> value; ELG_Czdc = value;} else if(strstr(temp_string.c_str(),"ELG_Nzdc")) {curstring >> varname >> value; ELG_Nzdc = value;} else if(strstr(temp_string.c_str(),"HAD_Shcal")) {curstring >> varname >> value; HAD_Shcal = value;} else if(strstr(temp_string.c_str(),"HAD_Nhcal")) {curstring >> varname >> value; HAD_Nhcal = value;} else if(strstr(temp_string.c_str(),"HAD_Chcal")) {curstring >> varname >> value; HAD_Chcal = value;} else if(strstr(temp_string.c_str(),"HAD_Shf")) {curstring >> varname >> value; HAD_Shf = value;} else if(strstr(temp_string.c_str(),"HAD_Nhf")) {curstring >> varname >> value; HAD_Nhf = value;} else if(strstr(temp_string.c_str(),"HAD_Chf")) {curstring >> varname >> value; HAD_Chf = value;} else if(strstr(temp_string.c_str(),"HAD_Szdc")) {curstring >> varname >> value; HAD_Szdc = value;} else if(strstr(temp_string.c_str(),"HAD_Nzdc")) {curstring >> varname >> value; HAD_Nzdc = value;} else if(strstr(temp_string.c_str(),"HAD_Czdc")) {curstring >> varname >> value; HAD_Czdc = value;} else if(strstr(temp_string.c_str(),"ZDC_T_resolution")) {curstring >> varname >> value; ZDC_T_resolution = value;} else if(strstr(temp_string.c_str(),"RP220_T_resolution")) {curstring >> varname >> value; RP220_T_resolution = value;} else if(strstr(temp_string.c_str(),"RP420_T_resolution")) {curstring >> varname >> value; RP420_T_resolution = value;} else if(strstr(temp_string.c_str(),"MU_SmearPt")) {curstring >> varname >> value; MU_SmearPt = value;} else if(strstr(temp_string.c_str(),"TRACK_radius")) {curstring >> varname >> ivalue;TRACK_radius = ivalue;} else if(strstr(temp_string.c_str(),"TRACK_length")) {curstring >> varname >> ivalue;TRACK_length = ivalue;} else if(strstr(temp_string.c_str(),"TRACK_bfield_x")) {curstring >> varname >> value; TRACK_bfield_x = value;} else if(strstr(temp_string.c_str(),"TRACK_bfield_y")) {curstring >> varname >> value; TRACK_bfield_y = value;} else if(strstr(temp_string.c_str(),"TRACK_bfield_z")) {curstring >> varname >> value; TRACK_bfield_z = value;} else if(strstr(temp_string.c_str(),"FLAG_bfield")) {curstring >> varname >> ivalue; FLAG_bfield = ivalue;} else if(strstr(temp_string.c_str(),"TRACK_ptmin")) {curstring >> varname >> value; TRACK_ptmin = value;} else if(strstr(temp_string.c_str(),"TRACK_eff")) {curstring >> varname >> ivalue;TRACK_eff = ivalue;} else if(strstr(temp_string.c_str(),"TOWER_number")) {curstring >> varname >> ivalue;TOWER_number = ivalue;} else if(strstr(temp_string.c_str(),"TOWER_eta_edges")){ curstring >> varname; for(unsigned int i=0; i> value; TOWER_eta_edges[i] = value;} } else if(strstr(temp_string.c_str(),"TOWER_dphi")){ curstring >> varname; for(unsigned int i=0; i> value; TOWER_dphi[i] = value;} } else if(strstr(temp_string.c_str(),"PTCUT_elec")) {curstring >> varname >> value; PTCUT_elec = value;} else if(strstr(temp_string.c_str(),"PTCUT_muon")) {curstring >> varname >> value; PTCUT_muon = value;} else if(strstr(temp_string.c_str(),"PTCUT_jet")) {curstring >> varname >> value; PTCUT_jet = value;} else if(strstr(temp_string.c_str(),"PTCUT_gamma")) {curstring >> varname >> value; PTCUT_gamma = value;} else if(strstr(temp_string.c_str(),"PTCUT_taujet")) {curstring >> varname >> value; PTCUT_taujet = value;} else if(strstr(temp_string.c_str(),"ZDC_gamma_E")) {curstring >> varname >> value; ZDC_gamma_E = value;} else if(strstr(temp_string.c_str(),"ZDC_n_E")) {curstring >> varname >> value; ZDC_n_E = value;} else if(strstr(temp_string.c_str(),"ISOL_PT")) {curstring >> varname >> value; ISOL_PT = value;} else if(strstr(temp_string.c_str(),"ISOL_Cone")) {curstring >> varname >> value; ISOL_Cone = value;} else if(strstr(temp_string.c_str(),"ISOL_Calo_ET")) {curstring >> varname >> value; ISOL_Calo_ET = value;} else if(strstr(temp_string.c_str(),"ISOL_Calo_Grid")) {curstring >> varname >> ivalue; ISOL_Calo_Grid = ivalue;} else if(strstr(temp_string.c_str(),"JET_coneradius")) {curstring >> varname >> value; JET_coneradius = value;} else if(strstr(temp_string.c_str(),"JET_jetalgo")) {curstring >> varname >> ivalue;JET_jetalgo = ivalue;} else if(strstr(temp_string.c_str(),"JET_seed")) {curstring >> varname >> value; JET_seed = value;} else if(strstr(temp_string.c_str(),"JET_Eflow")) {curstring >> varname >> ivalue; JET_Eflow = ivalue;} else if(strstr(temp_string.c_str(),"BTAG_b")) {curstring >> varname >> ivalue;BTAG_b = ivalue;} else if(strstr(temp_string.c_str(),"BTAG_mistag_c")) {curstring >> varname >> ivalue;BTAG_mistag_c = ivalue;} else if(strstr(temp_string.c_str(),"BTAG_mistag_l")) {curstring >> varname >> ivalue;BTAG_mistag_l = ivalue;} else if(strstr(temp_string.c_str(),"FLAG_vfd")) {curstring >> varname >> ivalue; FLAG_vfd = ivalue;} else if(strstr(temp_string.c_str(),"FLAG_RP")) {curstring >> varname >> ivalue; FLAG_RP = ivalue;} else if(strstr(temp_string.c_str(),"FLAG_trigger")) {curstring >> varname >> ivalue; FLAG_trigger = ivalue;} else if(strstr(temp_string.c_str(),"FLAG_frog")) {curstring >> varname >> ivalue; FLAG_frog = ivalue;} else if(strstr(temp_string.c_str(),"FLAG_lhco")) {curstring >> varname >> ivalue; FLAG_lhco = ivalue;} else if(strstr(temp_string.c_str(),"NEvents_Frog")) {curstring >> varname >> ivalue; NEvents_Frog = ivalue;} else if(strstr(temp_string.c_str(),"NEvents")) {curstring >> varname >> ivalue; NEvents = ivalue;} else if(strstr(temp_string.c_str(),"PdgTableFilename")) {curstring >> varname >> svalue; PdgTableFilename = svalue;} } if(ISOL_Calo_Grid%2 ==0) { ISOL_Calo_Grid++; cout <<"** WARNING: ISOL_Calo_Grid is not odd. Set it to "<< ISOL_Calo_Grid << " **" << endl; } //jet stuffs not defined in the input datacard JET_overlap = 0.75; // MidPoint algorithm definition JET_M_coneareafraction = 0.25; JET_M_maxpairsize = 2; JET_M_maxiterations = 100; // Define Cone algorithm. JET_C_adjacencycut = 2; JET_C_maxiterations = 100; JET_C_iratch = 1; //Define SISCone algorithm. JET_S_npass = 0; JET_S_protojet_ptmin= 0.0; //For Tau-jet definition TAU_energy_scone = 0.15; // radius R of the cone for tau definition, based on energy threshold TAU_track_scone = 0.4; // radius R of the cone for tau definition, based on track number TAU_track_pt = 2; // minimal pt [GeV] for tracks to be considered in tau definition TAU_energy_frac = 0.95; // fraction of energy required in the central part of the cone, for tau jets } void RESOLution::Logfile(const string& LogName) { // creates the list of good input files // this list is vector inputfiles. ifstream infile(inputfilelist.c_str()); vector inputfiles; string filename; while(1) { infile >> filename; // reads the first line of the list if(!infile.good()) break; // quits when at the end of the list ifstream checking_the_file(filename.c_str()); // try to open the file if(!checking_the_file.good()) continue; // skips bad/unknown files else checking_the_file.close(); // close file if found inputfiles.push_back(filename); // append the name to the vector } infile.close(); ofstream f_out(LogName.c_str()); f_out <<"**********************************************************************"<< endl; f_out <<"**********************************************************************"<< endl; f_out <<"** **"<< endl; f_out <<"** Welcome to **"<< endl; f_out <<"** **"<< endl; f_out <<"** **"<< endl; f_out <<"** .ddddddd- lL hH **"<< endl; f_out <<"** -Dd` `dD: Ll hH` **"<< endl; f_out <<"** dDd dDd eeee. lL .pp+pp Hh+hhh` -eeee- `sssss **"<< endl; f_out <<"** -Dd `DD ee. ee Ll .Pp. PP Hh. HH. ee. ee sSs **"<< endl; f_out <<"** dD` dDd eEeee: lL. pP. pP hH hH` eEeee:` -sSSSs. **"<< endl; f_out <<"** .Dd :dd eE. LlL PpppPP Hh Hh eE sSS **"<< endl; f_out <<"** dddddd:. eee+: lL. pp. hh. hh eee+ sssssS **"<< endl; f_out <<"** Pp **"<< endl; f_out <<"** **"<< endl; f_out <<"** Delphes, a framework for the fast simulation **"<< endl; f_out <<"** of a generic collider experiment **"<< endl; f_out <<"** **"<< endl; f_out <<"** --- Version 1.7 of Delphes --- **"<< endl; f_out <<"** Last date of change: 7 May 2009 **"<< endl; f_out <<"** **"<< endl; f_out <<"** **"<< endl; f_out <<"** This package uses: **"<< endl; f_out <<"** ------------------ **"<< endl; f_out <<"** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **"<< endl; f_out <<"** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **"<< endl; f_out <<"** FROG: L. Quertenmont, V. Roberfroid [hep-ex/0901.2718v1] **"<< endl; f_out <<"** **"<< endl; f_out <<"** ---------------------------------------------------------------- **"<< endl; f_out <<"** **"<< endl; f_out <<"** Main authors: **"<< endl; f_out <<"** ------------- **"<< endl; f_out <<"** **"<< endl; f_out <<"** Séverine Ovyn Xavier Rouby **"<< endl; f_out <<"** severine.ovyn@uclouvain.be xavier.rouby@cern **"<< endl; f_out <<"** Center for Particle Physics and Phenomenology (CP3) **"<< endl; f_out <<"** Universite Catholique de Louvain (UCL) **"<< endl; f_out <<"** Louvain-la-Neuve, Belgium **"<< endl; f_out <<"** **"<< endl; f_out <<"** ---------------------------------------------------------------- **"<< endl; f_out <<"** **"<< endl; f_out <<"** Former Delphes versions and documentation can be found on : **"<< endl; f_out <<"** http://www.fynu.ucl.ac.be/delphes.html **"<< endl; f_out <<"** **"<< endl; f_out <<"** **"<< endl; f_out <<"** Disclaimer: this program is a beta version of Delphes and **"<< endl; f_out <<"** therefore comes without guarantees. Beware of errors and please **"<< endl; f_out <<"** give us your feedbacks about potential bugs **"<< endl; f_out <<"** **"<< endl; f_out <<"**********************************************************************"<< endl; f_out <<"** **"<< endl; f_out<<"#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n"; f_out <<"* *"<< endl; f_out <<"#******************************** *"<<"\n"; f_out <<"# Input files *"<<"\n"; f_out <<"#******************************** *"<<"\n"; f_out << left << setw(22) <<"* Input list "<<"" << left << setw(39) << inputfilelist << "" << right << setw(9) << "*"<<"\n"; for (unsigned int i =0; i0: "<<"" << left << setw(5) << TOWER_number <<""<< right << setw(10)<<"*"<<"\n"; f_out << left << setw(55) <<"* Tower edges in eta, for eta>0: "<<"" << right << setw(15)<<"*"<<"\n"; f_out << "* "; for (unsigned int i=0; i0 [degree]:"<<"" << right << setw(15)<<"*"<<"\n"; f_out << "* "; for (unsigned int i=0; i 1E98) f_out<<"# No Calorimetric isolation applied *"<<"\n"; else { f_out << left << setw(40) <<"* Minimum ET for towers [GeV]: "<<"" << left << setw(20) < jet algo applied on the calorimetric towers *"<<"\n"; } f_out<<"* *"<<"\n"; f_out<<"* Six algorithms are currently available: *"<<"\n"; f_out<<"* - 1) CDF cone algorithm, *"<<"\n"; f_out<<"* - 2) CDF MidPoint algorithm, *"<<"\n"; f_out<<"* - 3) SIScone algorithm, *"<<"\n"; f_out<<"* - 4) kt algorithm, *"<<"\n"; f_out<<"* - 5) Cambrigde/Aachen algorithm, *"<<"\n"; f_out<<"* - 6) Anti-kt algorithm. *"<<"\n"; f_out<<"* *"<<"\n"; f_out<<"* You have chosen *"<<"\n"; switch(JET_jetalgo) { default: case 1: { f_out<<"* CDF JetClu jet algorithm with parameters: *"<<"\n"; f_out << left << setw(40) <<"* - Seed threshold: "<<"" << left << setw(10) <>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n"; f_out.close(); } // **********Provides the smeared TLorentzVector for the electrons******** // Smears the electron energy, and changes the 4-momentum accordingly // different smearing if the electron is central (eta < 2.5) or forward void RESOLution::SmearElectron(TLorentzVector &electron) { // the 'electron' variable will be changed by the function float energy = electron.E(); // before smearing float energyS = 0.0; // after smearing // \sigma/E = C + N/E + S/\sqrt{E} if(fabs(electron.Eta()) < CEN_max_tracker) { // if the electron is inside the tracker energyS = gRandom->Gaus(energy, sqrt( pow(ELG_Ncen,2) + pow(ELG_Ccen*energy,2) + pow(ELG_Scen*sqrt(energy),2) )); } if(fabs(electron.Eta()) > CEN_max_tracker && fabs(electron.Eta()) < CEN_max_calo_fwd){ energyS = gRandom->Gaus(energy, sqrt( pow(ELG_Nfwd,2) + pow(ELG_Cfwd*energy,2) + pow(ELG_Sfwd*sqrt(energy),2) ) ); } electron.SetPtEtaPhiE(energyS/cosh(electron.Eta()), electron.Eta(), electron.Phi(), energyS); if(electron.E() < 0)electron.SetPxPyPzE(0,0,0,0); // no negative values after smearing ! } // **********Provides the smeared TLorentzVector for the muons******** // Smears the muon pT and changes the 4-momentum accordingly void RESOLution::SmearMu(TLorentzVector &muon) { // the 'muon' variable will be changed by the function float pt = muon.Pt(); // before smearing float ptS=pt; if(fabs(muon.Eta()) < CEN_max_mu ) { ptS = gRandom->Gaus(pt, MU_SmearPt*pt ); // after smearing // \sigma/E = C + N/E + S/\sqrt{E} } muon.SetPtEtaPhiE(ptS, muon.Eta(), muon.Phi(), ptS*cosh(muon.Eta())); if(muon.E() < 0)muon.SetPxPyPzE(0,0,0,0); // no negative values after smearing ! } // **********Provides the smeared TLorentzVector for the hadrons******** // Smears the hadron 4-momentum void RESOLution::SmearHadron(TLorentzVector &hadron, const float frac) // the 'hadron' variable will be changed by the function // the 'frac' variable describes the long-living particles. Should be 0.7 for K0S and Lambda, 1. otherwise { float energy = hadron.E(); // before smearing float energyS = 0.0; // after smearing // \sigma/E = C + N/E + S/\sqrt{E} float energy_ecal = (1.0 - frac)*energy; // electromagnetic calorimeter float energy_hcal = frac*energy; // hadronic calorimeter // frac takes into account the decay of long-living particles, that decay in the calorimeters // some of the particles decay mostly in the ecal, some mostly in the hcal float energyS1,energyS2; if(fabs(hadron.Eta()) < CEN_max_calo_cen) { energyS1 = gRandom->Gaus(energy_hcal, sqrt( pow(HAD_Nhcal,2) + pow(HAD_Chcal*energy_hcal,2) + pow(HAD_Shcal*sqrt(energy_hcal),2) )) ; energyS2 = gRandom->Gaus(energy_ecal, sqrt( pow(ELG_Ncen,2) + pow(ELG_Ccen*energy_ecal,2) + pow(ELG_Scen*sqrt(energy_ecal),2) ) ); energyS = ((energyS1>0)?energyS1:0) + ((energyS2>0)?energyS2:0); } if(fabs(hadron.Eta()) > CEN_max_calo_cen && fabs(hadron.Eta()) < CEN_max_calo_fwd){ energyS = gRandom->Gaus(energy, sqrt( pow(HAD_Nhf,2) + pow(HAD_Chf*energy,2) + pow(HAD_Shf*sqrt(energy),2) )); } hadron.SetPtEtaPhiE(energyS/cosh(hadron.Eta()),hadron.Eta(), hadron.Phi(), energyS); if(hadron.E() < 0)hadron.SetPxPyPzE(0,0,0,0); } //****************************************************************************************** //void RESOLution::SortedVector(vector &vect) void RESOLution::SortedVector(vector &vect) { int i,j = 0; TLorentzVector tmp; bool en_desordre = true; int entries=vect.size(); for(i = 0 ; (i < entries) && en_desordre; i++) { en_desordre = false; for(j = 1 ; j < entries - i ; j++) { if ( vect[j].Pt() > vect[j-1].Pt() ) { //ParticleUtil tmp = vect[j-1]; D_Particle tmp = vect[j-1]; vect[j-1] = vect[j]; vect[j] = tmp; en_desordre = true; } } } } // **********Provides the energy in the cone of radius TAU_CONE_ENERGY for the tau identification******** // to be taken into account, a calo tower should // 1) have a transverse energy \f$ E_T = \sqrt{E_X^2 + E_Y^2} \f$ above a given threshold // 2) be inside a cone with a radius R and the axis defined by (eta,phi) double RESOLution::EnergySmallCone(const vector &towers, const float eta, const float phi) { double Energie=0; for(unsigned int i=0; i < towers.size(); i++) { if(towers[i].fourVector.pt() < JET_seed) continue; if((DeltaR(phi,eta,towers[i].fourVector.phi(),towers[i].fourVector.eta()) < TAU_energy_scone)) { Energie += towers[i].fourVector.E; } } return Energie; } // **********Provides the number of tracks in the cone of radius TAU_CONE_TRACKS for the tau identification******** // to be taken into account, a track should // 1) avec a transverse momentum \$f p_T \$ above a given threshold // 2) be inside a cone with a radius R and the axis defined by (eta,phi) // IMPORTANT REMARK !!!!! // NEW : "charge" will contain the sum of all charged tracks in the cone TAU_track_scone unsigned int RESOLution::NumTracks(float& charge, const vector &tracks, const float pt_track, const float eta, const float phi) { unsigned int numbtrack=0; // number of track in the tau-jet cone, which is smaller than R; charge=0; for(unsigned int i=0; i < tracks.size(); i++) { if(tracks[i].PT < pt_track ) continue; //float dr = DeltaR(phi,eta,tracks[i].PhiOuter,tracks[i].EtaOuter); float dr = DeltaR(phi,eta,tracks[i].Phi,tracks[i].Eta); if (dr > TAU_track_scone) continue; numbtrack++; charge += tracks[i].Charge; // total charge in the cone for Tau-jet } return numbtrack; } //*** Returns the PID of the particle with the highest energy, in a cone with a radius CONERADIUS and an axis (eta,phi) ********* //used by Btaggedjet ///// Attention : bug removed => CONERADIUS/2 -> CONERADIUS !! int RESOLution::Bjets(const TSimpleArray &subarray, const float& eta, const float& phi) { float emax=0; int Ppid=0; if(subarray.GetEntries()>0) { for(int i=0; i < subarray.GetEntries();i++) { // should have pt>PT_JETMIN and a small cone radius (rPhi,subarray[i]->Eta,phi,eta); if(genDeltaR < JET_coneradius && subarray[i]->E > emax) { emax=subarray[i]->E; Ppid=abs(subarray[i]->PID); } } } return Ppid; } //******************** Simulates the b-tagging efficiency for real bjet, or the misendentification for other jets**************** bool RESOLution::Btaggedjet(const TLorentzVector &JET, const TSimpleArray &subarray) { if( rand()%100 < (BTAG_b+1) && Bjets(subarray,JET.Eta(),JET.Phi())==pB ) return true; // b-tag of b-jets is 40% else if( rand()%100 < (BTAG_mistag_c+1) && Bjets(subarray,JET.Eta(),JET.Phi())==pC ) return true; // b-tag of c-jets is 10% else if( rand()%100 < (BTAG_mistag_l+1) && Bjets(subarray,JET.Eta(),JET.Phi())!=0) return true; // b-tag of light jets is 1% return false; } //***********************Isolation criteria*********************** //**************************************************************** bool RESOLution::Isolation(const D_Particle& part, const vector &tracks, const float& pt_second_track, const float& isolCone, float& ptiso ) { bool isolated = false; ptiso = 0; // sum of all track pt in isolation cone float deltar=1E99; // Initial value; should be high; no further repercussion // loop on all tracks, with p_t above threshold, close enough from the charged lepton for(unsigned int i=0; i < tracks.size(); i++) { if(tracks[i].PT < pt_second_track) continue; // ptcut on tracks float genDeltaR = DeltaR(part.Phi(),part.Eta(),tracks[i].Phi,tracks[i].Eta); if( (genDeltaR > deltar) || (genDeltaR==0) // rejets the track of the particle itself ) continue ; deltar=genDeltaR; // finds the closest track // as long as (genDeltaR==0) is put above, the particle itself is not taken into account if( genDeltaR < ISOL_Cone) ptiso += tracks[i].PT; // dR cut on tracks } if(deltar > isolCone) isolated = true; return isolated; } // ******* Calorimetric isolation float RESOLution::CaloIsolation(const D_Particle& part, const D_CaloTowerList & towers, const float iPhi, const float iEta) { // etrat, which is a percentage between 00 and 99. It is the ratio of the transverse energy // 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. if(ISOL_Calo_ET>1E10) return UNDEFINED; // avoid doing anything unreasonable... float et_sum=0; // available parameters: ISOL_Calo_ET , ISOL_Calo_Grid // Get the EtaCalo/PhiCalo of the muon ; // transform it into iEta/iPhi to get the towers, and their neighbourh (i-1, i-2, etc) unsigned int N = ISOL_Calo_Grid; int index= iUNDEFINED; // index of the central tower of the grid in TOWER_eta_edges[.]; // !! TOWER_eta_edges is only with eta>0 // finds the index of the central tower of the NxN grid for (unsigned int i=1; i< TOWER_number+1; i++) { if(fabs(iEta) >= TOWER_eta_edges[i-1] && fabs(iEta) < TOWER_eta_edges[i]) { index = i-1; break; } } if(index != iUNDEFINED) { // finds the size in phi of the cells for this eta float dphi = TOWER_dphi[index]*pi/180.; // in rad //cout << "Grid " << " ----------\n"; for (unsigned int i_eta=0; i_eta0) ? index+i_eta-(N-1)/2 : index+1+i_eta-(N-1)/2 ; float eta_ith_tower = TOWER_eta_edges[real_index]; if(iEta<0) eta_ith_tower *= -1; for (unsigned int i_phi=0; i_phi ISOL_Calo_ET) { et_sum += calMuon.getE(); //cout << "eta/phi = " << eta_ith_tower << "\t" << phi_ith_tower << "\t" << calMuon.getE() << " GeV" << endl; } //else cout << "eta/phi = " << eta_ith_tower << "\t" << phi_ith_tower << "\tnot active\n"; } } // NxN grid //cout << "-----------" << etrat << endl; } else if (CEN_max_mu < CEN_max_calo_fwd) cout << "** ERROR in RESOLution::CaloIsolation: 'muon'-tower not found! **" << endl; // should never happen ! this would be a bug //cout << "etrat = " << et_sum << "\t Pt=" << part.Pt() << endl; // should return a number between 0 and 99 (due to LHCO definitions) // which is Pt(muon) / sum(ET) float etrat = 0.; if(et_sum==0) etrat = 99.; else if(et_sum>0) etrat = 100*part.Pt()/et_sum; if(etrat<0) cout << "Error: negative etrat in CaloIsolation (" << etrat <<")\n"; //else if(etrat>99) cout << "Error: etrat should be in [0;99] in CaloIsolation (" << etrat <<")\n"; if(etrat>99) etrat = 99; return etrat; } //********** returns a segmented value for eta and phi, for calo towers ***** void RESOLution::BinEtaPhi(const float phi, const float eta, float& iPhi, float& iEta){ iEta = UNDEFINED; int index= iUNDEFINED; for (unsigned int i=1; i< TOWER_number+1; i++) { if(fabs(eta)>TOWER_eta_edges[i-1] && fabs(eta)<=TOWER_eta_edges[i]) { iEta = (eta>0) ? ((TOWER_eta_edges[i-1]+TOWER_eta_edges[i])/2.0) : -((TOWER_eta_edges[i-1]+TOWER_eta_edges[i])/2.0); index = i-1; break; } } if(index==UNDEFINED) return; iPhi = UNDEFINED; float dphi = TOWER_dphi[index]*pi/180.; for (unsigned int i=1; i < 360/TOWER_dphi[index]; i++ ) { float low = -pi+(i-1)*dphi; float high= low+dphi; if(phi > low && phi <= high ){ iPhi = (low+high)/2.0; break; } } if (phi > pi-dphi) iPhi = pi-dphi; } //**************************** Returns the delta Phi **************************** float DeltaPhi(const float phi1, const float phi2) { float deltaphi=phi1-phi2; // in here, -pi < phi < pi if(fabs(deltaphi) > pi) { deltaphi=2.*pi -fabs(deltaphi);// put deltaphi between 0 and pi } else deltaphi=fabs(deltaphi); return deltaphi; } //**************************** Returns the delta R**************************** float DeltaR(const float phi1, const float eta1, const float phi2, const float eta2) { return sqrt(pow(DeltaPhi(phi1,phi2),2) + pow(eta1-eta2,2)); } int sign(const int myint) { if (myint >0) return 1; else if (myint <0) return -1; else return 0; } int sign(const float myfloat) { if (myfloat >0) return 1; else if (myfloat <0) return -1; else return 0; } int ChargeVal(const int pid) { cout << "ChargeVal :: deprecated function, do not use it anymore" << endl; int charge; if( (pid == pGAMMA) || (pid == pPI0) || (pid == pK0L) || (pid == pN) || (pid == pSIGMA0) || (pid == pDELTA0) || (pid == pK0S) // not charged particles : invisible by tracker ) charge = 0; else charge = sign(pid); return charge; } //------------------------------------------------------------------------------ void RESOLution::ReadParticleDataGroupTable() { string temp_string; istringstream curstring; ifstream fichier_a_lire(PdgTableFilename.c_str()); if(!fichier_a_lire.good()) { cout <<"** ERROR: PDG Table ("<< PdgTableFilename << ") not found! exit. **" << endl; exit(1); return; } // first three lines of the file are useless getline(fichier_a_lire,temp_string); getline(fichier_a_lire,temp_string); getline(fichier_a_lire,temp_string); while (getline(fichier_a_lire,temp_string)) { curstring.clear(); // needed when using several times istringstream::str(string) curstring.str(temp_string); int ID; string name; int charge; float mass; float width; float lifetime; // ID name chg mass total width lifetime // 1 d -1 0.33000 0.00000 0.00000E+00 // in the table, the charge is in units of e+/3 // the total width is in GeV // the lifetime is ctau in mm curstring >> ID >> name >> charge >> mass >> width >> lifetime; PdgParticle particle(ID,name,mass,charge/3.,width,lifetime/1000.); PDGtable.insert(ID,particle); //PdgTable.insert(pair(ID,particle)); //cout << PDGtable[ID].name() << "\t" << PDGtable[ID].mass() << "\t" << PDGtable[ID].charge() << endl; } } // ReadParticleDataGroupTable // to be improved in order to avoid code repetition // sorry, no time to do it right now (XR, 19/05/2009) void time_report(const TStopwatch& global,const TStopwatch& loop,const TStopwatch& trigger,const TStopwatch& frog,const TStopwatch& lhco, const int flag_frog, const int flag_trigger, const int flag_lhco, const string& LogName, const Long64_t allEntries) { TStopwatch globalwatch(global), loopwatch(loop), triggerwatch(trigger), frogwatch(frog), lhcowatch(lhco); cout <<"** **"<< endl; cout <<"** ################## Time report ################# **"<< endl; cout << left << setw(32) <<"** Time report for "<<"" << left << setw(15) << allEntries <<"" << right << setw(22) <<"events **"<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n"; f_out.close(); } void print_header() { cout << endl << endl; cout <<"*********************************************************************"<< endl; cout <<"*********************************************************************"<< endl; cout <<"** **"<< endl; cout <<"** Welcome to **"<< endl; cout <<"** **"<< endl; cout <<"** **"<< endl; cout <<"** .ddddddd- lL hH **"<< endl; cout <<"** -Dd` `dD: Ll hH` **"<< endl; cout <<"** dDd dDd eeee. lL .pp+pp Hh+hhh` -eeee- `sssss **"<< endl; cout <<"** -Dd `DD ee. ee Ll .Pp. PP Hh. HH. ee. ee sSs **"<< endl; cout <<"** dD` dDd eEeee: lL. pP. pP hH hH` eEeee:` -sSSSs. **"<< endl; cout <<"** .Dd :dd eE. LlL PpppPP Hh Hh eE sSS **"<< endl; cout <<"** dddddd:. eee+: lL. pp. hh. hh eee+ sssssS **"<< endl; cout <<"** Pp **"<< endl; cout <<"** **"<< endl; cout <<"** Delphes, a framework for the fast simulation **"<< endl; cout <<"** of a generic collider experiment **"<< endl; cout <<"** arXiv:0903.2225v1 [hep-ph] **"<< endl; cout <<"** **"<< endl; cout <<"** --- Version 1.7 of Delphes --- **"<< endl; cout <<"** Last date of change: 7 May 2009 **"<< endl; cout <<"** **"<< endl; cout <<"** **"<< endl; cout <<"** This package uses: **"<< endl; cout <<"** ------------------ **"<< endl; cout <<"** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **"<< endl; cout <<"** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **"<< endl; cout <<"** FROG: [hep-ex/0901.2718v1] **"<< endl; cout <<"** **"<< endl; cout <<"**-----------------------------------------------------------------**"<< endl; cout <<"** **"<< endl; cout <<"** Main authors: **"<< endl; cout <<"** ------------- **"<< endl; cout <<"** **"<< endl; cout <<"** Séverine Ovyn Xavier Rouby **"<< endl; cout <<"** severine.ovyn@uclouvain.be xavier.rouby@cern **"<< endl; cout <<"** Center for Particle Physics and Phenomenology (CP3) **"<< endl; cout <<"** Universite Catholique de Louvain (UCL) **"<< endl; cout <<"** Louvain-la-Neuve, Belgium **"<< endl; cout <<"** **"<< endl; cout <<"**-----------------------------------------------------------------**"<< endl; cout <<"** **"<< endl; cout <<"** Former Delphes versions and documentation can be found on : **"<< endl; cout <<"** http://www.fynu.ucl.ac.be/delphes.html **"<< endl; cout <<"** **"<< endl; cout <<"** **"<< endl; cout <<"** Disclaimer: this program is a beta version of Delphes and **"<< endl; cout <<"** therefore comes without guarantees. Beware of errors and please **"<< endl; cout <<"** give us your feedbacks about potential bugs **"<< endl; cout <<"** **"<< endl; cout <<"*********************************************************************"<< endl; cout <<"*********************************************************************"<< endl; }