23 constexpr float undefinedValue{-9999.};
24 constexpr float smallestAllowableSin(1e-8);
25 constexpr float smallestAllowableTan(1e-8);
26 constexpr float smallestAllowableQoverPt(1e-8);
102 TString tsDir = (TString) sDir;
104 if (tsDir.Contains(
"Primary")) {
106 }
else if (tsDir.Contains(
"Secondary")) {
115 for (
int ipt = 0; ipt <=
m_nPtBins; ipt++) {
116 m_PtBins[ipt] = (float) ptBins[ipt];
131 for (
unsigned int iparam = 0; iparam <
NPARAMS; iparam++) {
136 if(iparam ==
PT)
continue;
237 std::string tmpName, tmpTitle;
243 std::shared_ptr<TH1D> refHistEta {
m_pullHelpereta[iparam]->ProjectionY(
"refEta")};
244 std::shared_ptr<TH1D> refHistPt {
m_pullHelperpt[iparam]->ProjectionY(
"refPt")};
245 std::shared_ptr<TH1D> refHistLowPt {
m_pullHelperlowpt[iparam]->ProjectionY(
"refLowPt")};
249 for (
int ibins = 0; ibins < nPtBins; ibins++) {
250 tmpName =
"pullProjection_pt_" +
m_paramProp[iparam] +
"_bin_"+ std::to_string(ibins + 1);
256 tmpName =
"resProjection_pt_" +
m_paramProp[iparam] +
"_bin_"+ std::to_string(ibins + 1);
261 for (
int ibins = 0; ibins < nLowPtBins; ibins++) {
262 tmpName =
"pullProjection_lowpt_" +
m_paramProp[iparam] +
"_bin_"+ std::to_string(ibins + 1);
268 tmpName =
"resProjection_lowpt_" +
m_paramProp[iparam] +
"_bin_"+ std::to_string(ibins + 1);
273 for (
int ibins = 0; ibins < nEtaBins; ibins++) {
274 tmpName =
"pullProjection_eta_" +
m_paramProp[iparam] +
"_bin_"+ std::to_string(ibins + 1);
280 tmpName =
"resProjection_eta_" +
m_paramProp[iparam] +
"_bin_"+ std::to_string(ibins + 1);
307 if (!isPrimTrk && !isSecdTrk) {
341 const float tanHalfTheta = std::tan(
theta * 0.5);
342 const bool tanThetaIsSane = std::abs(tanHalfTheta) > smallestAllowableTan;
343 float eta = undefinedValue;
344 if (tanThetaIsSane)
eta = -std::log(tanHalfTheta);
345 for (
unsigned int iparam = 0; iparam <
NPARAMS; iparam++) {
346 if(iparam ==
PT)
continue;
380 for (
unsigned int iparam = 0; iparam <
NPARAMS; iparam++) {
387 if (not saneQoverPt){
392 bool saneQoverPtrec = std::abs(
m_trkP[
QOVERPT]) > smallestAllowableQoverPt;
393 if (not saneQoverPtrec){
406 const float sinTheta{std::sin(trkprt.
theta())};
407 const float cosTheta{std::cos(trkprt.
theta())};
408 const bool saneSineValue = (std::abs(sinTheta) > smallestAllowableSin);
409 const float inverseSinTheta = saneSineValue ? 1./sinTheta : undefinedValue;
411 trkprt.
qOverP()*inverseSinTheta * Gaudi::Units::GeV : undefinedValue;
426 m_trkErrP[
QOVERPT] = qOverPT_err2 > 0 ? std::sqrt(qOverPT_err2) * Gaudi::Units::GeV : 0.;
433 throw std::runtime_error(
434 "TrackParticle without covariance matrix for defining parameters or the covariance matrix is wrong dimensionality.");
436 if (std::abs(trkprt.
qOverP()) < 0) {
438 throw std::runtime_error(
"q/p is zero");
440 double pt = trkprt.
pt();
441 double diff_qp = -pt / std::abs(trkprt.
qOverP());
442 double diff_theta = trkprt.
theta() == 0 ? 0 : pt / std::tan(trkprt.
theta());
444 double pt_err2 = diff_qp * (diff_qp * cov[14] + diff_theta * cov[13]) + diff_theta * diff_theta * cov[9];
445 m_trkErrP[
PT] = pt_err2 < 0 ? 0 : std::sqrt(pt_err2) / Gaudi::Units::GeV;
455 for (
int iParams = 0; iParams <
NPARAMS; iParams++) {
458 if (acc.isAvailable(truthprt)) {
468 const float qOverP = qOverPAcc.
isAvailable(truthprt) ? qOverPAcc(truthprt) : undefinedValue;
469 if ((qOverP != undefinedValue) and (
m_truetrkP[
THETA] != undefinedValue)){
471 if (std::abs(sinTheta) > smallestAllowableSin){
492 for (
unsigned int iparam = 0; iparam <
NPARAMS; iparam++) {
493 if(iparam ==
PT)
continue;
Scalar eta() const
pseudorapidity method
Scalar theta() const
theta method
Helper class to provide constant type-safe access to aux data.
TH1 * m_resmean_vs_pt_neg[NPARAMS]
TH1 * m_pullwidth_vs_lowpt[NPARAMS]
TH1 * m_reswidth_vs_eta[NPARAMS]
IDPVM::ResolutionHelper::methods m_resolutionMethod
float m_PtBins[m_nPtBins+1]
TH1 * m_resProjections_vs_eta[NPARAMS][m_nEtaBins]
TH1 * m_resmean_vs_lowpt_neg[NPARAMS]
TProfile * m_sigma_vs_pt[NPARAMS]
static const int m_nLowPtBins
TH2 * m_pullHelperlowpt[NPARAMS]
TH2 * m_resHelperpt_pos[NPARAMS]
TH1 * m_pullProjections_vs_lowpt[NPARAMS][m_nLowPtBins]
TH1 * m_reswidth_vs_eta_neg[NPARAMS]
TH1 * m_resProjections_vs_pt[NPARAMS][m_nPtBins]
TH2 * m_pullHelperpt[NPARAMS]
TH2 * m_resHelperpt_neg[NPARAMS]
TProfile * m_sigma_vs_lowpt[NPARAMS]
TH1 * m_resmean_vs_eta_neg[NPARAMS]
TH1 * m_reswidth_vs_pt_neg[NPARAMS]
float m_truetrkP[NPARAMS]
TH1 * m_reswidth_vs_lowpt_neg[NPARAMS]
void fill(const xAOD::TrackParticle &trkprt, const xAOD::TruthParticle &truthprt, float weight)
TH2 * m_resHelperpt[NPARAMS]
TH1 * m_reswidth_vs_pt[NPARAMS]
static const int m_nPtBins
TH1 * m_pullwidth_vs_pt[NPARAMS]
TH1 * m_pullProjections_vs_eta[NPARAMS][m_nEtaBins]
void getTrackParameters(const xAOD::TruthParticle &truthprt)
TH1 * m_reswidth_vs_eta_pos[NPARAMS]
TH1 * m_resmean_vs_eta[NPARAMS]
TH1 * m_reswidth_vs_lowpt_pos[NPARAMS]
void getPlots(float weight=1.0, bool useTruthKin=true)
float m_LowPtBins[m_nLowPtBins+1]
TProfile * m_sigma_vs_eta[NPARAMS]
TH1 * m_pullmean_vs_eta[NPARAMS]
TH1 * m_pullProjections_vs_pt[NPARAMS][m_nPtBins]
IDPVM::ResolutionHelper m_resolutionHelper
TH1 * m_reswidth_vs_lowpt[NPARAMS]
TH1 * m_resmean_vs_eta_pos[NPARAMS]
TH1 * m_pullmean_vs_lowpt[NPARAMS]
TH2 * m_resHelperlowpt_pos[NPARAMS]
TH2 * m_pullHelpereta[NPARAMS]
TH1 * m_resmean_vs_pt[NPARAMS]
TH1 * m_resProjections_vs_lowpt[NPARAMS][m_nLowPtBins]
std::string m_paramProp[NPARAMS]
TH2 * m_resHelperlowpt_neg[NPARAMS]
TH2 * m_resHelpereta_pos[NPARAMS]
TH1 * m_reswidth_vs_pt_pos[NPARAMS]
TH1 * m_resmean_vs_lowpt[NPARAMS]
TH2 * m_resHelpereta[NPARAMS]
TH1 * m_pullmean_vs_pt[NPARAMS]
TH2 * m_resHelpereta_neg[NPARAMS]
TH1 * m_pullwidth_vs_eta[NPARAMS]
TH2 * m_resHelperlowpt[NPARAMS]
TH1 * m_resmean_vs_pt_pos[NPARAMS]
TH1 * m_resmean_vs_lowpt_pos[NPARAMS]
InDetPerfPlot_Resolution(InDetPlotBase *pParent, const std::string &dirName, bool d0Only=false)
void book(Htype *&pHisto, const std::string &histoIdentifier, const std::string &nameOverride="", const std::string &folder="default")
Helper method to book histograms using an identifier string.
InDetPlotBase(InDetPlotBase *pParent, const std::string &dirName)
Constructor taking parent node and directory name for plots.
TH1D * Book1D(const std::string &name, const std::string &labels, int nBins, float start, float end, bool prependDir=true)
Book a TH1D histogram.
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
float z0() const
Returns the parameter.
float theta() const
Returns the parameter, which has range 0 to .
const ParametersCovMatrix_t definingParametersCovMatrix() const
Returns the 5x5 symmetric matrix containing the defining parameters covariance matrix.
float d0() const
Returns the parameter.
float qOverP() const
Returns the parameter.
std::vector< float > definingParametersCovMatrixVec() const
Returns the length 6 vector containing the elements of defining parameters covariance matrix.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
float phi0() const
Returns the parameter, which has range to .
virtual double pt() const override final
The transverse momentum ( ) of the particle.
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
Class to retrieve associated truth from a track, implementing a cached response.
std::vector< double > logLinearBinning(const unsigned int nBins, const double absXmin, const double absXmax, const bool symmetriseAroundZero)
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthParticle_v1 TruthParticle
Typedef to implementation.