ATLAS Offline Software
ConstraintFit.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 //
7 // Z mass constraint fit
8 //
9 // original version by:
10 // Konstantinos Nikolopoulos
11 // Univ. of Athens
12 //
14 #ifndef ZMASSCONSTRAINT_CONSTRAINTFIT_H
15 #define ZMASSCONSTRAINT_CONSTRAINTFIT_H
16 
17 // Framework include(s):
18 #include "AsgTools/AsgTool.h"
19 
21 
23 #include "xAODEgamma/Photon.h"
24 #include "AsgTools/ToolHandle.h"
27 
28 namespace ZMassConstraint
29 {
30  class ConstraintFit : public virtual IConstraintFit,
31  public asg::AsgTool
32  {
33 
36 
37  public:
38 
40  ConstraintFit( const std::string& name );
41 
42  ~ConstraintFit(void); // default destructor
43 
46 
50 
52  double getMassError (const ConstraintFitInput& firstInput,
53  const ConstraintFitInput& secondInput = ConstraintFitInput());
54 
57  double getMassError (const ConstraintFitOutput& fitOutput,
58  const ConstraintFitInput& extraInput = ConstraintFitInput());
59 
61  double getMassError (const ConstraintFitOutput& fitOutput,
62  const ConstraintFitOutput& secondFitOutput);
63 
65  void addParticle (const xAOD::Muon& part,
68 
70  void addParticle (const xAOD::Electron& part,
71  float elEnergyRes,
73 
75  void addFSRParticle(const xAOD::IParticle & part,
76  const TLorentzVector& fsr4Vec,
78 
79  private:
80 
81  // Enum list for tracking covariance
83  d0 = 0,
84  z0 = 1,
85  phi0 = 2,
86  theta = 3,
87  qOverP = 4,
88  qP = 4,
89  x = 0,
90  y = 1,
91  z = 2
92  };
93 
94  int massFitInterface(const ConstraintFitInput& theInput);
95  void massFitRun(ConstraintFitOutput& output, double zresol = -1.);
96  double getMassError(const std::vector<TLorentzVector>& particles,
97  const std::vector<AmgMatrix(3,3)>& covariances);
98  double likelihoodMass2(void);
99  double likelihoodMass(double);
101  bool doSanityChecksOnCovariance(const TLorentzVector& vector, const AmgMatrix(5,5)& covar) const;
102  void convertCovd0z0PhiThetaPToXYZ(const TLorentzVector& fourVec,
103  const AmgMatrix(5,5)& covard0z0PhiThetaP,
104  AmgMatrix(5,5)& covarXYZ) const;
105  void convertCovXYZTod0z0PhiThetaP(const std::vector<TLorentzVector>& particleList,
106  const Amg::MatrixX& covarXYZ,
107  Amg::MatrixX& covard0z0PhiThetaP) const;
108  private:
110  double m_conMass;
111  double m_conWidth;
112  double m_resolution;
114 
115  // Calibration tools
116  ToolHandle<CP::IEgammaCalibrationAndSmearingTool> m_energyRescaler; // electron resolution
117  ToolHandle<CP::IMuonCalibrationAndSmearingTool> m_mu_resolSFTool; // Muon error rescaling
118 
120  unsigned int m_parameters;
121  unsigned int m_nobj;
122  std::vector<double> m_objmass;
127 
128  // double calculateChi2(const Amg::MatrixX* p0, Amg::MatrixX* var, const double Mass);
129  double massFitCalculation(const Amg::MatrixX& var, double mass, Amg::MatrixX& p0);
130  double massFit(const Amg::MatrixX& /*p0*/, const Amg::MatrixX& var, double mass, Amg::MatrixX& pOut,
131  Amg::MatrixX& /*varout*/);
132  float retrieve_eta_calo(const xAOD::IParticle& part) const;
133  };
134 }
135 #endif // ZMASSCONSTRAINT_CONSTRAINTFIT_H
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
ZMassConstraint::ConstraintFit::y
@ y
Definition: ConstraintFit.h:90
ZMassConstraint::ConstraintFit::theta
@ theta
Definition: ConstraintFit.h:86
ZMassConstraint::ConstraintFit::m_conMass
double m_conMass
Definition: ConstraintFit.h:110
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
ZMassConstraint::ConstraintFit::m_parametersInit
Amg::MatrixX m_parametersInit
Definition: ConstraintFit.h:123
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
ZMassConstraint::IConstraintFit
Definition: IConstraintFit.h:42
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
ZMassConstraint::ConstraintFit::qP
@ qP
Definition: ConstraintFit.h:88
ZMassConstraint::ConstraintFit::massFitCalculation
double massFitCalculation(const Amg::MatrixX &var, double mass, Amg::MatrixX &p0)
Definition: ConstraintFit.cxx:786
ZMassConstraint::ConstraintFit::m_objmass
std::vector< double > m_objmass
Definition: ConstraintFit.h:122
ZMassConstraint::ConstraintFit::ConstraintFit
ConstraintFit(const std::string &name)
Create a proper constructor for Athena.
Definition: ConstraintFit.cxx:13
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
ZMassConstraint::ConstraintFitOutput
Definition: ConstraintFitOutput.h:13
ZMassConstraint::ConstraintFit::z0
@ z0
Definition: ConstraintFit.h:84
ZMassConstraint::ConstraintFit::m_parametersFinal
Amg::MatrixX m_parametersFinal
Definition: ConstraintFit.h:125
ZMassConstraint::ConstraintFit::doSanityChecksOnCovariance
bool doSanityChecksOnCovariance(const TLorentzVector &vector, const AmgMatrix(5, 5)&covar) const
Definition: ConstraintFit.cxx:1090
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
ZMassConstraint::MassConstraintMuonType
MassConstraintMuonType
Definition: IConstraintFit.h:35
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
AmgMatrix
#define AmgMatrix(rows, cols)
Definition: EventPrimitives.h:49
IConstraintFit.h
ZMassConstraint::ConstraintFit::massFitRun
void massFitRun(ConstraintFitOutput &output, double zresol=-1.)
Definition: ConstraintFit.cxx:584
ZMassConstraint::ConstraintFit::massFitInterface
int massFitInterface(const ConstraintFitInput &theInput)
Definition: ConstraintFit.cxx:384
ZMassConstraint::ConstraintFit::convertCovXYZTod0z0PhiThetaP
void convertCovXYZTod0z0PhiThetaP(const std::vector< TLorentzVector > &particleList, const Amg::MatrixX &covarXYZ, Amg::MatrixX &covard0z0PhiThetaP) const
Definition: ConstraintFit.cxx:1158
ZMassConstraint::ConstraintFit
Definition: ConstraintFit.h:32
IEgammaCalibrationAndSmearingTool.h
ZMassConstraint::ConstraintFit::m_nobj
unsigned int m_nobj
Definition: ConstraintFit.h:121
ZMassConstraint::ConstraintFit::getMassError
double getMassError(const ConstraintFitInput &firstInput, const ConstraintFitInput &secondInput=ConstraintFitInput())
Calculate the mass error without fit - use just the inputs.
Definition: ConstraintFit.cxx:905
ZMassConstraint::ConstraintFit::m_theInput
ConstraintFitInput m_theInput
Definition: ConstraintFit.h:119
ZMassConstraint::ConstraintFit::m_covarianceInit
Amg::MatrixX m_covarianceInit
Definition: ConstraintFit.h:124
ZMassConstraint::ConstraintFit::TrackParameters
TrackParameters
Definition: ConstraintFit.h:82
ZMassConstraint::ConstraintFit::convertCovd0z0PhiThetaPToXYZ
void convertCovd0z0PhiThetaPToXYZ(const TLorentzVector &fourVec, const AmgMatrix(5, 5)&covard0z0PhiThetaP, AmgMatrix(5, 5)&covarXYZ) const
Definition: ConstraintFit.cxx:1127
ZMassConstraint::ConstraintFit::d0
@ d0
Definition: ConstraintFit.h:83
Photon.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
vector
Definition: MultiHisto.h:13
ZMassConstraint::ConstraintFit::likelihoodMass
double likelihoodMass(double)
Definition: ConstraintFit.cxx:434
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
ZMassConstraint::ConstraintFitInput
Definition: ConstraintFitInput.h:12
ZMassConstraint::ConstraintFit::retrieve_eta_calo
float retrieve_eta_calo(const xAOD::IParticle &part) const
Definition: ConstraintFit.cxx:1189
ZMassConstraint
Definition: ConstraintFit.cxx:12
ZMassConstraint::isCombMCMT
@ isCombMCMT
Definition: IConstraintFit.h:36
ZMassConstraint::ConstraintFit::m_conHasWidth
bool m_conHasWidth
Definition: ConstraintFit.h:109
ZMassConstraint::ConstraintFit::massFit
double massFit(const Amg::MatrixX &, const Amg::MatrixX &var, double mass, Amg::MatrixX &pOut, Amg::MatrixX &)
Definition: ConstraintFit.cxx:856
merge.output
output
Definition: merge.py:17
ZMassConstraint::ConstraintFit::addFSRParticle
void addFSRParticle(const xAOD::IParticle &part, const TLorentzVector &fsr4Vec, ConstraintFitInput &input)
Add in FSR photon to input, (energy resolution is obtain in method)
Definition: ConstraintFit.cxx:83
EventPrimitives.h
ZMassConstraint::ConstraintFit::m_conWidth
double m_conWidth
Definition: ConstraintFit.h:111
ZMassConstraint::ConstraintFit::setIgnore
void setIgnore(bool val)
Definition: ConstraintFit.h:100
ZMassConstraint::ConstraintFit::m_parameters
unsigned int m_parameters
Definition: ConstraintFit.h:120
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
IMuonCalibrationAndSmearingTool.h
ZMassConstraint::ConstraintFit::phi0
@ phi0
Definition: ConstraintFit.h:85
xAOD::Electron_v1
Definition: Electron_v1.h:34
ZMassConstraint::ConstraintFit::m_ignoreInputChecks
bool m_ignoreInputChecks
Definition: ConstraintFit.h:113
ZMassConstraint::ConstraintFit::m_resolution
double m_resolution
Definition: ConstraintFit.h:112
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
ZMassConstraint::ConstraintFit::doMassFit
StatusCode doMassFit(const ConstraintFitInput &input, ConstraintFitOutput &output)
Perform the constrained mass fit.
Definition: ConstraintFit.cxx:54
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84
ZMassConstraint::ConstraintFit::initialize
StatusCode initialize()
Initialize constraint fit.
Definition: ConstraintFit.cxx:34
ZMassConstraint::ConstraintFit::z
@ z
Definition: ConstraintFit.h:91
ZMassConstraint::ConstraintFit::m_mu_resolSFTool
ToolHandle< CP::IMuonCalibrationAndSmearingTool > m_mu_resolSFTool
Definition: ConstraintFit.h:117
ZMassConstraint::ConstraintFit::m_energyRescaler
ToolHandle< CP::IEgammaCalibrationAndSmearingTool > m_energyRescaler
Definition: ConstraintFit.h:116
ZMassConstraint::ConstraintFit::addParticle
void addParticle(const xAOD::Muon &part, ConstraintFitInput &input, MassConstraintMuonType muonType=isCombMCMT)
Add muon to input, must provide the resolution Scale Factor.
Definition: ConstraintFit.cxx:145
ZMassConstraint::ConstraintFit::likelihoodMass2
double likelihoodMass2(void)
Definition: ConstraintFit.cxx:502
ToolHandle.h
AsgTool.h
ZMassConstraint::ConstraintFit::~ConstraintFit
~ConstraintFit(void)
Definition: ConstraintFit.cxx:30
ZMassConstraint::ConstraintFit::m_covarianceFinal
Amg::MatrixX m_covarianceFinal
Definition: ConstraintFit.h:126
ZMassConstraint::ConstraintFit::qOverP
@ qOverP
Definition: ConstraintFit.h:87
ZMassConstraint::ConstraintFit::x
@ x
Definition: ConstraintFit.h:89
TRTCalib_cfilter.p0
p0
Definition: TRTCalib_cfilter.py:129