diff --git a/Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc b/Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc index 0ae46d5a1cb2e..d04fc363c0e78 100644 --- a/Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc +++ b/Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc @@ -51,6 +51,7 @@ #include "TMatrixD.h" #include "TVectorD.h" #include "TF1.h" +#include "TF2.h" //---------------------------------------------------------------------------------------------------- @@ -98,10 +99,9 @@ class CTPPSDirectProtonSimulation : public edm::stream::EDProducer<> { bool checkApertures_; bool useEmpiricalApertures_; - double empiricalAperture45_xi0_int_, empiricalAperture45_xi0_slp_, empiricalAperture45_a_int_, - empiricalAperture45_a_slp_; - double empiricalAperture56_xi0_int_, empiricalAperture56_xi0_slp_, empiricalAperture56_a_int_, - empiricalAperture56_a_slp_; + //aperture parameters + std::unique_ptr empiricalAperture45_; + std::unique_ptr empiricalAperture56_; bool produceHitsRelativeToBeam_; bool roundToPitch_; @@ -135,14 +135,10 @@ CTPPSDirectProtonSimulation::CTPPSDirectProtonSimulation(const edm::ParameterSet produceRecHits_(iConfig.getParameter("produceRecHits")), useEmpiricalApertures_(iConfig.getParameter("useEmpiricalApertures")), - empiricalAperture45_xi0_int_(iConfig.getParameter("empiricalAperture45_xi0_int")), - empiricalAperture45_xi0_slp_(iConfig.getParameter("empiricalAperture45_xi0_slp")), - empiricalAperture45_a_int_(iConfig.getParameter("empiricalAperture45_a_int")), - empiricalAperture45_a_slp_(iConfig.getParameter("empiricalAperture45_a_slp")), - empiricalAperture56_xi0_int_(iConfig.getParameter("empiricalAperture56_xi0_int")), - empiricalAperture56_xi0_slp_(iConfig.getParameter("empiricalAperture56_xi0_slp")), - empiricalAperture56_a_int_(iConfig.getParameter("empiricalAperture56_a_int")), - empiricalAperture56_a_slp_(iConfig.getParameter("empiricalAperture56_a_slp")), + empiricalAperture45_( + new TF2("empiricalAperture45", iConfig.getParameter("empiricalAperture45").c_str())), + empiricalAperture56_( + new TF2("empiricalAperture56", iConfig.getParameter("empiricalAperture56").c_str())), produceHitsRelativeToBeam_(iConfig.getParameter("produceHitsRelativeToBeam")), roundToPitch_(iConfig.getParameter("roundToPitch")), @@ -192,14 +188,8 @@ void CTPPSDirectProtonSimulation::fillDescriptions(edm::ConfigurationDescription desc.add("produceRecHits", true); desc.add("useEmpiricalApertures", false); - desc.add("empiricalAperture45_xi0_int", 0.); - desc.add("empiricalAperture45_xi0_slp", 0.); - desc.add("empiricalAperture45_a_int", 0.); - desc.add("empiricalAperture45_a_slp", 0.); - desc.add("empiricalAperture56_xi0_int", 0.); - desc.add("empiricalAperture56_xi0_slp", 0.); - desc.add("empiricalAperture56_a_int", 0.); - desc.add("empiricalAperture56_a_slp", 0.); + desc.add("empiricalAperture45", "0")->setComment("2D function of xi and xangle for cutoff on sec 45"); + desc.add("empiricalAperture56", "0")->setComment("2D function of xi and xangle for cutoff on sec 56"); desc.add("produceHitsRelativeToBeam", false); desc.add("roundToPitch", true); @@ -335,28 +325,20 @@ void CTPPSDirectProtonSimulation::processProton( double z_sign; double beamMomentum = 0.; double xangle = 0.; - double empiricalAperture_xi0_int, empiricalAperture_xi0_slp; - double empiricalAperture_a_int, empiricalAperture_a_slp; - + const std::unique_ptr *empiricalAperture; if (mom_lhc.z() < 0) // sector 45 { arm = 0; z_sign = -1; beamMomentum = beamParameters.getBeamMom45(); xangle = beamParameters.getHalfXangleX45(); - empiricalAperture_xi0_int = empiricalAperture45_xi0_int_; - empiricalAperture_xi0_slp = empiricalAperture45_xi0_slp_; - empiricalAperture_a_int = empiricalAperture45_a_int_; - empiricalAperture_a_slp = empiricalAperture45_a_slp_; + empiricalAperture = &empiricalAperture45_; } else { // sector 56 arm = 1; z_sign = +1; beamMomentum = beamParameters.getBeamMom56(); xangle = beamParameters.getHalfXangleX56(); - empiricalAperture_xi0_int = empiricalAperture56_xi0_int_; - empiricalAperture_xi0_slp = empiricalAperture56_xi0_slp_; - empiricalAperture_a_int = empiricalAperture56_a_int_; - empiricalAperture_a_slp = empiricalAperture56_a_slp_; + empiricalAperture = &empiricalAperture56_; } // calculate effective RP arrival time @@ -383,10 +365,11 @@ void CTPPSDirectProtonSimulation::processProton( // check empirical aperture if (useEmpiricalApertures_) { const auto &xangle = lhcInfo.crossingAngle(); - const double xi_th = (empiricalAperture_xi0_int + xangle * empiricalAperture_xi0_slp) + - (empiricalAperture_a_int + xangle * empiricalAperture_a_slp) * th_x_phys; + (*empiricalAperture)->SetParameter("xi", xi); + (*empiricalAperture)->SetParameter("xangle", xangle); + const double th_x_th = (*empiricalAperture)->EvalPar(nullptr); - if (xi > xi_th) { + if (th_x_th > th_x_phys) { if (verbosity_) { ssLog << "stop because of empirical appertures"; edm::LogInfo("CTPPSDirectProtonSimulation") << ssLog.str(); @@ -623,4 +606,4 @@ void CTPPSDirectProtonSimulation::processProton( //---------------------------------------------------------------------------------------------------- -DEFINE_FWK_MODULE(CTPPSDirectProtonSimulation); +DEFINE_FWK_MODULE(CTPPSDirectProtonSimulation); \ No newline at end of file diff --git a/Validation/CTPPS/python/simu_config/year_2016_postTS2_cff.py b/Validation/CTPPS/python/simu_config/year_2016_postTS2_cff.py index 740b9630224ed..919769fb0f079 100644 --- a/Validation/CTPPS/python/simu_config/year_2016_postTS2_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2016_postTS2_cff.py @@ -34,14 +34,10 @@ # aperture cuts ctppsDirectProtonSimulation.useEmpiricalApertures = True -ctppsDirectProtonSimulation.empiricalAperture45_xi0_int = 0.104 -ctppsDirectProtonSimulation.empiricalAperture45_xi0_slp = 0.000E+00 -ctppsDirectProtonSimulation.empiricalAperture45_a_int = 116.4 -ctppsDirectProtonSimulation.empiricalAperture45_a_slp = -0.000 -ctppsDirectProtonSimulation.empiricalAperture56_xi0_int = 0.110 -ctppsDirectProtonSimulation.empiricalAperture56_xi0_slp = 0. -ctppsDirectProtonSimulation.empiricalAperture56_a_int = 150.0 -ctppsDirectProtonSimulation.empiricalAperture56_a_slp = 0. + +ctppsDirectProtonSimulation.empiricalAperture45="4.09513E-06+(([xi]<0.104719)*0.000972149+([xi]>=0.104719)*0.0350197)*([xi]-0.104719)" +ctppsDirectProtonSimulation.empiricalAperture56="2.0617E-05+(([xi]<0.14324)*0.00475349+([xi]>=0.14324)*0.00629514)*([xi]-0.14324)" + # defaults def SetDefaults(process): diff --git a/Validation/CTPPS/python/simu_config/year_2016_preTS2_cff.py b/Validation/CTPPS/python/simu_config/year_2016_preTS2_cff.py index 509586bd68b5d..c879b42d59d6b 100644 --- a/Validation/CTPPS/python/simu_config/year_2016_preTS2_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2016_preTS2_cff.py @@ -34,14 +34,10 @@ # aperture cuts ctppsDirectProtonSimulation.useEmpiricalApertures = True -ctppsDirectProtonSimulation.empiricalAperture45_xi0_int = 0.111 -ctppsDirectProtonSimulation.empiricalAperture45_xi0_slp = 0.000E+00 -ctppsDirectProtonSimulation.empiricalAperture45_a_int = 127.0 -ctppsDirectProtonSimulation.empiricalAperture45_a_slp = -0.000 -ctppsDirectProtonSimulation.empiricalAperture56_xi0_int = 0.138 -ctppsDirectProtonSimulation.empiricalAperture56_xi0_slp = 0.000E+00 -ctppsDirectProtonSimulation.empiricalAperture56_a_int = 191.6 -ctppsDirectProtonSimulation.empiricalAperture56_a_slp = -0.000 + +ctppsDirectProtonSimulation.empiricalAperture45="3.76296E-05+(([xi]<0.117122)*0.00712775+([xi]>=0.117122)*0.0148651)*([xi]-0.117122)" +ctppsDirectProtonSimulation.empiricalAperture56="1.85954E-05+(([xi]<0.14324)*0.00475349+([xi]>=0.14324)*0.00629514)*([xi]-0.14324)" + # defaults def SetDefaults(process): diff --git a/Validation/CTPPS/python/simu_config/year_2017_postTS2_cff.py b/Validation/CTPPS/python/simu_config/year_2017_postTS2_cff.py index 1d64fca91425a..528edebe13ca8 100644 --- a/Validation/CTPPS/python/simu_config/year_2017_postTS2_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2017_postTS2_cff.py @@ -10,15 +10,11 @@ # aperture cuts ctppsDirectProtonSimulation.useEmpiricalApertures = True -ctppsDirectProtonSimulation.empiricalAperture45_xi0_int = 0.073 -ctppsDirectProtonSimulation.empiricalAperture45_xi0_slp = 4.107E-04 -ctppsDirectProtonSimulation.empiricalAperture45_a_int = 39.0 -ctppsDirectProtonSimulation.empiricalAperture45_a_slp = 0.768 -ctppsDirectProtonSimulation.empiricalAperture56_xi0_int = 0.067 -ctppsDirectProtonSimulation.empiricalAperture56_xi0_slp = 6.868E-04 -ctppsDirectProtonSimulation.empiricalAperture56_a_int = -50.2 -ctppsDirectProtonSimulation.empiricalAperture56_a_slp = 1.740 + +ctppsDirectProtonSimulation.empiricalAperture45="-(8.92079E-07*[xangle]-0.000150214)+(([xi]<(0.000278622*[xangle]+0.0964383))*-(3.9541e-05*[xangle]-0.0115104)+([xi]>=(0.000278622*[xangle]+0.0964383))*-(0.000108249*[xangle]-0.0249303))*([xi]-(0.000278622*[xangle]+0.0964383))" +ctppsDirectProtonSimulation.empiricalAperture56="4.56961E-05+(([xi]<(0.00075625*[xangle]+0.0643361))*-(3.01107e-05*[xangle]-0.00985126)+([xi]>=(0.00075625*[xangle]+0.0643361))*-(8.95437e-05*[xangle]-0.0169474))*([xi]-(0.00075625*[xangle]+0.0643361))" # timing resolution ctppsDirectProtonSimulation.timeResolutionDiamonds45 = "2 * 0.130" ctppsDirectProtonSimulation.timeResolutionDiamonds56 = "2 * 0.130" + diff --git a/Validation/CTPPS/python/simu_config/year_2017_preTS2_cff.py b/Validation/CTPPS/python/simu_config/year_2017_preTS2_cff.py index 98e47f9f43cfd..6602a537401fb 100644 --- a/Validation/CTPPS/python/simu_config/year_2017_preTS2_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2017_preTS2_cff.py @@ -10,15 +10,11 @@ # aperture cuts ctppsDirectProtonSimulation.useEmpiricalApertures = True -ctppsDirectProtonSimulation.empiricalAperture45_xi0_int = 0.066 -ctppsDirectProtonSimulation.empiricalAperture45_xi0_slp = 3.536E-04 -ctppsDirectProtonSimulation.empiricalAperture45_a_int = 47.7 -ctppsDirectProtonSimulation.empiricalAperture45_a_slp = 0.447 -ctppsDirectProtonSimulation.empiricalAperture56_xi0_int = 0.062 -ctppsDirectProtonSimulation.empiricalAperture56_xi0_slp = 5.956E-04 -ctppsDirectProtonSimulation.empiricalAperture56_a_int = -31.9 -ctppsDirectProtonSimulation.empiricalAperture56_a_slp = 1.323 + +ctppsDirectProtonSimulation.empiricalAperture45="-(8.71198E-07*[xangle]-0.000134726)+(([xi]<(0.000264704*[xangle]+0.081951))*-(4.32065E-05*[xangle]-0.0130746)+([xi]>=(0.000264704*[xangle]+0.081951))*-(0.000183472*[xangle]-0.0395241))*([xi]-(0.000264704*[xangle]+0.081951))" +ctppsDirectProtonSimulation.empiricalAperture56="3.43116E-05+(([xi]<(0.000626936*[xangle]+0.061324))*0.00654394+([xi]>=(0.000626936*[xangle]+0.061324))*-(0.000145164*[xangle]-0.0272919))*([xi]-(0.000626936*[xangle]+0.061324))" # timing resolution ctppsDirectProtonSimulation.timeResolutionDiamonds45 = "2 * (0.0025*(x-3) + 0.080)" ctppsDirectProtonSimulation.timeResolutionDiamonds56 = "2 * (0.0050*(x-3) + 0.060)" + diff --git a/Validation/CTPPS/python/simu_config/year_2018_cff.py b/Validation/CTPPS/python/simu_config/year_2018_cff.py index 99aae2b4853bc..6caee845e4bd6 100644 --- a/Validation/CTPPS/python/simu_config/year_2018_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2018_cff.py @@ -42,14 +42,11 @@ # aperture cuts ctppsDirectProtonSimulation.useEmpiricalApertures = True -ctppsDirectProtonSimulation.empiricalAperture45_xi0_int = 0.079 -ctppsDirectProtonSimulation.empiricalAperture45_xi0_slp = 4.211E-04 -ctppsDirectProtonSimulation.empiricalAperture45_a_int = 42.8 -ctppsDirectProtonSimulation.empiricalAperture45_a_slp = 0.669 -ctppsDirectProtonSimulation.empiricalAperture56_xi0_int = 0.074 -ctppsDirectProtonSimulation.empiricalAperture56_xi0_slp = 6.604E-04 -ctppsDirectProtonSimulation.empiricalAperture56_a_int = -22.7 -ctppsDirectProtonSimulation.empiricalAperture56_a_slp = 1.600 + +ctppsDirectProtonSimulation.empiricalAperture45="-(8.44219E-07*[xangle]-0.000100957)+(([xi]<(0.000247185*[xangle]+0.101599))*-(1.40289E-05*[xangle]-0.00727237)+([xi]>=(0.000247185*[xangle]+0.101599))*-(0.000107811*[xangle]-0.0261867))*([xi]-(0.000247185*[xangle]+0.101599))" + +ctppsDirectProtonSimulation.empiricalAperture56="-(-4.74758E-07*[xangle]+3.0881E-05)+(([xi]<(0.000727859*[xangle]+0.0722653))*-(2.43968E-05*[xangle]-0.0085461)+([xi]>=(0.000727859*[xangle]+0.0722653))*-(7.19216E-05*[xangle]-0.0148267))*([xi]-(0.000727859*[xangle]+0.0722653))" + # local reconstruction ctppsLocalTrackLiteProducer.includeStrips = False