23 constexpr float undefinedValue{-9999.};
24 constexpr float smallestAllowableSin(1e-8);
25 constexpr float smallestAllowableTan(1e-8);
26 constexpr float smallestAllowableQoverPt(1e-8);
103 TString tsDir = (TString) sDir;
105 if (tsDir.Contains(
"Primary")) {
107 }
else if (tsDir.Contains(
"Secondary")) {
116 for (
int ipt = 0; ipt <=
m_nPtBins; ipt++) {
117 m_PtBins[ipt] = (float) ptBins[ipt];
132 for (
unsigned int iparam = 0; iparam <
NPARAMS; iparam++) {
137 if(iparam ==
PT)
continue;
239 std::string tmpName, tmpTitle;
245 std::shared_ptr<TH1D> refHistEta {
m_pullHelpereta[iparam]->ProjectionY(
"refEta")};
246 std::shared_ptr<TH1D> refHistPt {
m_pullHelperpt[iparam]->ProjectionY(
"refPt")};
247 std::shared_ptr<TH1D> refHistLowPt {
m_pullHelperlowpt[iparam]->ProjectionY(
"refLowPt")};
251 for (
int ibins = 0; ibins < nPtBins; ibins++) {
252 tmpName =
"pullProjection_pt_" +
m_paramProp[iparam] +
"_bin_"+ std::to_string(ibins + 1);
258 tmpName =
"resProjection_pt_" +
m_paramProp[iparam] +
"_bin_"+ std::to_string(ibins + 1);
263 for (
int ibins = 0; ibins < nLowPtBins; ibins++) {
264 tmpName =
"pullProjection_lowpt_" +
m_paramProp[iparam] +
"_bin_"+ std::to_string(ibins + 1);
270 tmpName =
"resProjection_lowpt_" +
m_paramProp[iparam] +
"_bin_"+ std::to_string(ibins + 1);
275 for (
int ibins = 0; ibins < nEtaBins; ibins++) {
276 tmpName =
"pullProjection_eta_" +
m_paramProp[iparam] +
"_bin_"+ std::to_string(ibins + 1);
282 tmpName =
"resProjection_eta_" +
m_paramProp[iparam] +
"_bin_"+ std::to_string(ibins + 1);
309 if (!isPrimTrk && !isSecdTrk) {
343 const float tanHalfTheta = std::tan(
theta * 0.5);
344 const bool tanThetaIsSane = std::abs(tanHalfTheta) > smallestAllowableTan;
345 float eta = undefinedValue;
346 if (tanThetaIsSane)
eta = -std::log(tanHalfTheta);
347 for (
unsigned int iparam = 0; iparam <
NPARAMS; iparam++) {
348 if(iparam ==
PT)
continue;
383 for (
unsigned int iparam = 0; iparam <
NPARAMS; iparam++) {
390 if (not saneQoverPt){
395 bool saneQoverPtrec = std::abs(
m_trkP[
QOVERPT]) > smallestAllowableQoverPt;
396 if (not saneQoverPtrec){
419 const float sinTheta{std::sin(trkprt.
theta())};
420 const float cosTheta{std::cos(trkprt.
theta())};
421 const bool saneSineValue = (std::abs(sinTheta) > smallestAllowableSin);
422 const float inverseSinTheta = saneSineValue ? 1./sinTheta : undefinedValue;
424 trkprt.
qOverP()*inverseSinTheta * Gaudi::Units::GeV : undefinedValue;
439 m_trkErrP[
QOVERPT] = qOverPT_err2 > 0 ? std::sqrt(qOverPT_err2) * Gaudi::Units::GeV : 0.;
446 throw std::runtime_error(
447 "TrackParticle without covariance matrix for defining parameters or the covariance matrix is wrong dimensionality.");
449 if (std::abs(trkprt.
qOverP()) < 0) {
451 throw std::runtime_error(
"q/p is zero");
453 double pt = trkprt.
pt();
454 double diff_qp = -pt / std::abs(trkprt.
qOverP());
455 double diff_theta = trkprt.
theta() == 0 ? 0 : pt / std::tan(trkprt.
theta());
457 double pt_err2 = diff_qp * (diff_qp * cov[14] + diff_theta * cov[13]) + diff_theta * diff_theta * cov[9];
458 m_trkErrP[
PT] = pt_err2 < 0 ? 0 : std::sqrt(pt_err2) / Gaudi::Units::GeV;
483 for (
int iParams = 0; iParams <
NPARAMS; iParams++) {
486 if (acc.isAvailable(truthprt)) {
496 const float qOverP = qOverPAcc.
isAvailable(truthprt) ? qOverPAcc(truthprt) : undefinedValue;
497 if ((qOverP != undefinedValue) and (
m_truetrkP[
THETA] != undefinedValue)){
499 if (std::abs(sinTheta) > smallestAllowableSin){
525 for (
unsigned int iparam = 0; iparam <
NPARAMS; iparam++) {
526 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]
InDetPerfPlot_Resolution(InDetPlotBase *pParent, const std::string &dirName, bool d0Only=false, bool hasHGTDReco=false)
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 type-safe access to aux data.
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 timeResolution() const
Returns the time resolution.
float theta() const
Returns the parameter, which has range 0 to .
float time() const
Returns the time.
const ParametersCovMatrix_t definingParametersCovMatrix() const
Returns the 5x5 symmetric matrix containing the defining parameters covariance matrix.
uint8_t hasValidTime() const
Returns whether or not the track has a valid time.
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.