00001
00002
00003
00004
00005
00006
00007
00008
00010 #ifndef ZMASSCONSTRAINT_CONSTRAINTFIT_H
00011 #define ZMASSCONSTRAINT_CONSTRAINTFIT_H
00012
00013
00014 #include "AsgTools/AsgTool.h"
00015
00016 #include "ZMassConstraint/IConstraintFit.h"
00017
00018 #include "EventPrimitives/EventPrimitives.h"
00019
00020 #include "xAODEgamma/Photon.h"
00021 #include "AsgTools/ToolHandle.h"
00022
00023
00024
00025 namespace CP {
00026 class IEgammaCalibrationAndSmearingTool;
00027 class IMuonCalibrationAndSmearingTool;
00028 }
00029
00030 namespace ZMassConstraint
00031 {
00032 class ConstraintFit : public virtual IConstraintFit,
00033 public asg::AsgTool
00034 {
00035
00037 ASG_TOOL_CLASS( ConstraintFit, ZMassConstraint::IConstraintFit )
00038
00039 public:
00040
00042 ConstraintFit( const std::string& name );
00043
00044 ~ConstraintFit(void);
00045
00047 StatusCode initialize();
00048
00050 StatusCode doMassFit (const ConstraintFitInput& input,
00051 ConstraintFitOutput& output);
00052
00054 double getMassError (const ConstraintFitInput& firstInput,
00055 const ConstraintFitInput& secondInput = ConstraintFitInput());
00056
00059 double getMassError (const ConstraintFitOutput& fitOutput,
00060 const ConstraintFitInput& extraInput = ConstraintFitInput());
00061
00063 double getMassError (const ConstraintFitOutput& fitOutput,
00064 const ConstraintFitOutput& secondFitOutput);
00065
00067 void addParticle (const xAOD::Muon& part,
00068 ConstraintFitInput& input,
00069 MassConstraintMuonType muonType = isCombMCMT);
00070
00072 void addParticle (const xAOD::Electron& part,
00073 float elEnergyRes,
00074 ConstraintFitInput& input);
00075
00077 void addFSRParticle(const xAOD::IParticle & part,
00078 const TLorentzVector& fsr4Vec,
00079 ConstraintFitInput& input);
00080
00081 private:
00082
00083
00084 enum TrackParameters {
00085 d0 = 0,
00086 z0 = 1,
00087 phi0 = 2,
00088 theta = 3,
00089 qOverP = 4,
00090 qP = 4,
00091 x = 0,
00092 y = 1,
00093 z = 2
00094 };
00095
00096 int massFitInterface(const ConstraintFitInput& theInput);
00097 void massFitRun(ConstraintFitOutput& output, double zresol = -1.);
00098 double getMassError(const std::vector<TLorentzVector>& particles,
00099 const std::vector<AmgMatrix(3,3)>& covariances);
00100 double likelihoodMass2(void);
00101 double likelihoodMass(double);
00102 void setIgnore(bool val){ m_ignoreInputChecks=val; }
00103 bool doSanityChecksOnCovariance(const TLorentzVector& vector, const AmgMatrix(5,5)& covar) const;
00104 void convertCovd0z0PhiThetaPToXYZ(const TLorentzVector& fourVec,
00105 const AmgMatrix(5,5)& covard0z0PhiThetaP,
00106 AmgMatrix(5,5)& covarXYZ) const;
00107 void convertCovXYZTod0z0PhiThetaP(const std::vector<TLorentzVector>& particleList,
00108 const Amg::MatrixX& covarXYZ,
00109 Amg::MatrixX& covard0z0PhiThetaP) const;
00110 private:
00111 bool m_conHasWidth;
00112 double m_conMass;
00113 double m_conWidth;
00114 double m_resolution;
00115 bool m_ignoreInputChecks;
00116
00117
00118 ToolHandle<CP::IEgammaCalibrationAndSmearingTool> m_energyRescaler;
00119 ToolHandle<CP::IMuonCalibrationAndSmearingTool> m_mu_resolSFTool;
00120
00121 ConstraintFitInput m_theInput;
00122 unsigned int m_parameters;
00123 unsigned int m_nobj;
00124 std::vector<double> m_objmass;
00125 Amg::MatrixX m_parametersInit;
00126 Amg::MatrixX m_covarianceInit;
00127 Amg::MatrixX m_parametersFinal;
00128 Amg::MatrixX m_covarianceFinal;
00129
00130
00131 double massFitCalculation(const Amg::MatrixX& var, double mass, Amg::MatrixX& p0);
00132 double massFit(const Amg::MatrixX& , const Amg::MatrixX& var, double mass, Amg::MatrixX& pOut,
00133 Amg::MatrixX& );
00134 float retrieve_eta_calo(const xAOD::IParticle& part) const;
00135 };
00136 }
00137 #endif // ZMASSCONSTRAINT_CONSTRAINTFIT_H