Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new-aperture-parametrization-CTPPS #31250

Merged
merged 7 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 18 additions & 35 deletions Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include "TMatrixD.h"
#include "TVectorD.h"
#include "TF1.h"
#include "TF2.h"

//----------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -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<TF2> empiricalAperture45_;
std::unique_ptr<TF2> empiricalAperture56_;

bool produceHitsRelativeToBeam_;
bool roundToPitch_;
Expand Down Expand Up @@ -135,14 +135,10 @@ CTPPSDirectProtonSimulation::CTPPSDirectProtonSimulation(const edm::ParameterSet
produceRecHits_(iConfig.getParameter<bool>("produceRecHits")),

useEmpiricalApertures_(iConfig.getParameter<bool>("useEmpiricalApertures")),
empiricalAperture45_xi0_int_(iConfig.getParameter<double>("empiricalAperture45_xi0_int")),
empiricalAperture45_xi0_slp_(iConfig.getParameter<double>("empiricalAperture45_xi0_slp")),
empiricalAperture45_a_int_(iConfig.getParameter<double>("empiricalAperture45_a_int")),
empiricalAperture45_a_slp_(iConfig.getParameter<double>("empiricalAperture45_a_slp")),
empiricalAperture56_xi0_int_(iConfig.getParameter<double>("empiricalAperture56_xi0_int")),
empiricalAperture56_xi0_slp_(iConfig.getParameter<double>("empiricalAperture56_xi0_slp")),
empiricalAperture56_a_int_(iConfig.getParameter<double>("empiricalAperture56_a_int")),
empiricalAperture56_a_slp_(iConfig.getParameter<double>("empiricalAperture56_a_slp")),
empiricalAperture45_(
new TF2("empiricalAperture45", iConfig.getParameter<std::string>("empiricalAperture45").c_str())),
empiricalAperture56_(
new TF2("empiricalAperture56", iConfig.getParameter<std::string>("empiricalAperture56").c_str())),

produceHitsRelativeToBeam_(iConfig.getParameter<bool>("produceHitsRelativeToBeam")),
roundToPitch_(iConfig.getParameter<bool>("roundToPitch")),
Expand Down Expand Up @@ -192,14 +188,8 @@ void CTPPSDirectProtonSimulation::fillDescriptions(edm::ConfigurationDescription
desc.add<bool>("produceRecHits", true);

desc.add<bool>("useEmpiricalApertures", false);
desc.add<double>("empiricalAperture45_xi0_int", 0.);
desc.add<double>("empiricalAperture45_xi0_slp", 0.);
desc.add<double>("empiricalAperture45_a_int", 0.);
desc.add<double>("empiricalAperture45_a_slp", 0.);
desc.add<double>("empiricalAperture56_xi0_int", 0.);
desc.add<double>("empiricalAperture56_xi0_slp", 0.);
desc.add<double>("empiricalAperture56_a_int", 0.);
desc.add<double>("empiricalAperture56_a_slp", 0.);
desc.add<std::string>("empiricalAperture45", "0")->setComment("2D function of xi and xangle for cutoff on sec 45");
desc.add<std::string>("empiricalAperture56", "0")->setComment("2D function of xi and xangle for cutoff on sec 56");

desc.add<bool>("produceHitsRelativeToBeam", false);
desc.add<bool>("roundToPitch", true);
Expand Down Expand Up @@ -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<TF2> *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
Expand All @@ -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();
Expand Down Expand Up @@ -623,4 +606,4 @@ void CTPPSDirectProtonSimulation::processProton(

//----------------------------------------------------------------------------------------------------

DEFINE_FWK_MODULE(CTPPSDirectProtonSimulation);
DEFINE_FWK_MODULE(CTPPSDirectProtonSimulation);
12 changes: 4 additions & 8 deletions Validation/CTPPS/python/simu_config/year_2016_postTS2_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
12 changes: 4 additions & 8 deletions Validation/CTPPS/python/simu_config/year_2016_preTS2_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
12 changes: 4 additions & 8 deletions Validation/CTPPS/python/simu_config/year_2017_postTS2_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

12 changes: 4 additions & 8 deletions Validation/CTPPS/python/simu_config/year_2017_preTS2_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)"

13 changes: 5 additions & 8 deletions Validation/CTPPS/python/simu_config/year_2018_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down