/*********************************************************************** ** ** ** /----------------------------------------------\ ** ** | Delphes, a framework for the fast simulation | ** ** | of a generic collider experiment | ** ** \----------------------------------------------/ ** ** ** ** ** ** This package uses: ** ** ------------------ ** ** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] ** ** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] ** ** FROG: [hep-ex/0901.2718v1] ** ** ** ** ------------------------------------------------------------------ ** ** ** ** 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 #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 // 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 // Muon smearing MU_SmearPt = 0.01; // 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(),"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(),"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(),"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(),"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(),"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_zdc")) {curstring >> varname >> ivalue; FLAG_zdc = 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(),"NEvents_Frog")) {curstring >> varname >> ivalue; NEvents_Frog = ivalue;} } //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) { //void RESOLution::Logfile(string outputfilename) { 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.4beta of Delphes --- **"<< endl; f_out <<"** Last date of change: 9 February 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<<"* *"<<"\n"; f_out<<"#******************************** *"<<"\n"; f_out<<"# Central detector caracteristics *"<<"\n"; f_out<<"#******************************** *"<<"\n"; f_out<<"* *"<<"\n"; f_out << left << setw(30) <<"* Maximum tracking system: "<<"" << left << setw(10) <0: "<<"" << 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>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n"; } // **********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 !!!!! // previously, the argument 'phi' was before the argument 'eta' // this has been changed for consistency with the other functions // double check your running code that uses NumTracks ! unsigned int RESOLution::NumTracks(const vector &tracks, const float pt_track, const float eta, const float phi) { unsigned int numtrack=0; for(unsigned int i=0; i < tracks.size(); i++) { if((tracks[i].Pt() < pt_track )|| (DeltaR(phi,eta,tracks[i].Phi(),tracks[i].Eta()) > TAU_track_scone) )continue; numtrack++; } return numtrack; } //*** 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 float phi, const float eta,const vector &tracks, const float pt_second_track) { bool isolated = false; float deltar=5000.; // Initial value; should be high; no further repercussion // loop on all final charged particles, with p_t >2, close enough from the electron for(unsigned int i=0; i < tracks.size(); i++) { if(tracks[i].Pt() < pt_second_track)continue; float genDeltaR = DeltaR(phi,eta,tracks[i].Phi(),tracks[i].Eta()); if( (genDeltaR > deltar) || (genDeltaR==0) ) continue ; deltar=genDeltaR; } if(deltar > 0.5) isolated = true; return isolated; } //********** 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)0) ? TOWER_eta_edges[i-1] : -TOWER_eta_edges[i]; index = i-1; //cout << setw(15) << left << eta << "\t" << iEta << endl; 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; 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 Charge(const int pid) { 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; }