23 constexpr float undefinedValue{-9999.};
24 constexpr float smallestAllowableSin(1e-8);
25 constexpr float smallestAllowableTan(1e-8);
26 constexpr float smallestAllowableQoverPt(1e-8);
101 TString tsDir = (TString) sDir;
103 if (tsDir.Contains(
"Primary")) {
105 }
else if (tsDir.Contains(
"Secondary")) {
114 for (
int ipt = 0; ipt <=
m_nPtBins; ipt++) {
115 m_PtBins[ipt] = (float) ptBins[ipt];
130 for (
unsigned int iparam = 0; iparam <
NPARAMS; iparam++) {
135 if(iparam ==
PT)
continue;
234 std::string tmpName, tmpTitle;
240 std::shared_ptr<TH1D> refHistEta {
m_pullHelpereta[iparam]->ProjectionY(
"refEta")};
241 std::shared_ptr<TH1D> refHistPt {
m_pullHelperpt[iparam]->ProjectionY(
"refPt")};
242 std::shared_ptr<TH1D> refHistLowPt {
m_pullHelperlowpt[iparam]->ProjectionY(
"refLowPt")};
246 for (
int ibins = 0; ibins < nPtBins; ibins++) {
247 tmpName =
"pullProjection_pt_" +
m_paramProp[iparam] +
"_bin_"+ std::to_string(ibins + 1);
253 tmpName =
"resProjection_pt_" +
m_paramProp[iparam] +
"_bin_"+ std::to_string(ibins + 1);
258 for (
int ibins = 0; ibins < nLowPtBins; ibins++) {
259 tmpName =
"pullProjection_lowpt_" +
m_paramProp[iparam] +
"_bin_"+ std::to_string(ibins + 1);
265 tmpName =
"resProjection_lowpt_" +
m_paramProp[iparam] +
"_bin_"+ std::to_string(ibins + 1);
270 for (
int ibins = 0; ibins < nEtaBins; ibins++) {
271 tmpName =
"pullProjection_eta_" +
m_paramProp[iparam] +
"_bin_"+ std::to_string(ibins + 1);
277 tmpName =
"resProjection_eta_" +
m_paramProp[iparam] +
"_bin_"+ std::to_string(ibins + 1);
304 if (!isPrimTrk && !isSecdTrk) {
326 const bool tanThetaIsSane = std::abs(tanHalfTheta) > smallestAllowableTan;
327 float eta = undefinedValue;
328 if (tanThetaIsSane)
eta = -std::log(tanHalfTheta);
329 for (
unsigned int iparam = 0; iparam <
NPARAMS; iparam++) {
330 if(iparam ==
PT)
continue;
363 for (
unsigned int iparam = 0; iparam <
NPARAMS; iparam++) {
370 if (not saneQoverPt){
375 bool saneQoverPtrec = std::abs(
m_trkP[
QOVERPT]) > smallestAllowableQoverPt;
376 if (not saneQoverPtrec){
389 const float sinTheta{std::sin(trkprt.
theta())};
390 const float cosTheta{std::cos(trkprt.
theta())};
391 const bool saneSineValue = (std::abs(sinTheta) > smallestAllowableSin);
392 const float inverseSinTheta = saneSineValue ? 1./sinTheta : undefinedValue;
394 trkprt.
qOverP()*inverseSinTheta * Gaudi::Units::GeV : undefinedValue;
409 m_trkErrP[
QOVERPT] = qOverPT_err2 > 0 ? std::sqrt(qOverPT_err2) * Gaudi::Units::GeV : 0.;
416 throw std::runtime_error(
417 "TrackParticle without covariance matrix for defining parameters or the covariance matrix is wrong dimensionality.");
419 if (std::abs(trkprt.
qOverP()) < 0) {
421 throw std::runtime_error(
"q/p is zero");
423 double pt = trkprt.
pt();
424 double diff_qp = -pt / std::abs(trkprt.
qOverP());
425 double diff_theta = trkprt.
theta() == 0 ? 0 : pt / std::tan(trkprt.
theta());
427 double pt_err2 = diff_qp * (diff_qp * cov[14] + diff_theta * cov[13]) + diff_theta * diff_theta * cov[9];
428 m_trkErrP[
PT] = pt_err2 < 0 ? 0 : std::sqrt(pt_err2) / Gaudi::Units::GeV;
438 for (
int iParams = 0; iParams <
NPARAMS; iParams++) {
441 if (acc.isAvailable(truthprt)) {
451 const float qOverP = qOverPAcc.
isAvailable(truthprt) ? qOverPAcc(truthprt) : undefinedValue;
452 if ((qOverP != undefinedValue) and (
m_truetrkP[
THETA] != undefinedValue)){
454 if (std::abs(sinTheta) > smallestAllowableSin){
475 for (
unsigned int iparam = 0; iparam <
NPARAMS; iparam++) {
476 if(iparam ==
PT)
continue;
Scalar eta() const
pseudorapidity 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]
InDetPerfPlot_Resolution(InDetPlotBase *pParent, const std::string &dirName)
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)
void getPlots(float weight=1.0)
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]
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]
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.