//////////////////////////////////////////////////////////////////////// /// \class RAT::DS::FitVertex /// /// \brief Container class for a single fit vertex /// /// \author Phil G Jones /// \author Matthew Mottram -- contact person /// /// REVISION HISTORY:\n /// - 27/04/2011 : P G Jones - New file /// - 19/08/2013 : P G Jones - Added validity flag for all values. /// - 10/09/2013 : K Majumdar - Adding in ability to do asymmetric errors and errors in Spherical coordinates /// - 2014-02-26 : P G Jones - DS Review refactor /// - 2014-08-01 : M Mottram - Added fixed parameter flags /// - 2014-09-15 : M Mottram - Added getter for validity mask /// - 2014-11-22 : M Mottram - Bug fix in SetMask methods to correctly unset bits /// - 2015-03-23 : M Mottram - Added SetMask method (previously SetXXXValid only set values to true) /// - 2016-07-01 : M J Parnell - Added ContainsAny method, and removed uneeded ContainsXXX checks /// /// \details This class contains a fit vertex. /// There are two masks that describe the status of the values, /// the dataMask describes whether the value has been set i.e. /// if the value exists. The validMask describes whether the /// value is valid. /// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// /// \class RAT::DS::FitVertex::NoValueError /// /// \brief An exception that is thrown when a user attempts to retrieve /// a value that was not fit. /// /// \author Phil G Jones /// /// REVISION HISTORY:\n /// 27/04/2011 : P G Jones - New file \n /// /// \details As brief /// //////////////////////////////////////////////////////////////////////// #ifndef __RAT_DS_FitVertex_ #define __RAT_DS_FitVertex_ #include #include #include #include namespace RAT { namespace DS { class FitVertex : public TObject { public: /// Bit mask positions enum EMaskValues { ePosition = 1, ePositivePositionError = 2, eNegativePositionError = 4, eDirection = 8, ePositiveDirectionError = 16, eNegativeDirectionError = 32, eEnergy = 64, ePositiveEnergyError = 128, eNegativeEnergyError = 256, eTime = 512, ePositiveTimeError = 1024, eNegativeTimeError = 2048 }; class NoValueError : public DataNotFound { public: /// Construct the error naming the variable that is problematic /// /// @param[in] className of class the variable is a member of /// @param[in] fieldName of the variable NoValueError( const std::string className, const std::string fieldName ) : DataNotFound(className, fieldName) { } }; /// Constructs the fit result FitVertex() : TObject(), dataMask(0x0), validMask(0x0), fixedMask(0x0) { } /// Set the position /// /// @param[in] pos position of the vertex /// @param[in] valid validity of the position /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetPosition( const TVector3& pos, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( ePosition, valid, fixed ); position = ROOT::Math::XYZVectorF(pos.X(), pos.Y(), pos.Z()); } /// Set the position errors along the positive coordinate axes of the given coordinate system, with the Fitted Position as the system's origin /// /// @param[in] posPosErr positive position error in [+x, +y, +z] coordinates /// @param[in] valid validity of the positive position error /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetPositivePositionError( const ROOT::Math::XYZVectorF posPosErr, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( ePositivePositionError, valid, fixed ); positivePositionError = posPosErr; } /// Set the position errors along the positive coordinate axes of the given coordinate system, with the Fitted Position as the system's origin /// /// @param[in] posPosErr positive position error in [r, +theta, +phi] coordinates /// @param[in] valid validity of the positive position error /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetPositivePositionError( const ROOT::Math::Polar3DVectorF posPosErr, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( ePositivePositionError, valid, fixed ); positivePositionError = ROOT::Math::XYZVectorF(posPosErr.X(), posPosErr.Y(), posPosErr.Z()); } /// Set the position errors along the negative coordinate axes of the given coordinate system, with the Fitted Position as the system's origin /// Note that the errors should be passed with positive coordinates. /// /// @param[in] negPosErr negative position error in [-x, -y, -z] coordinates (note positive values in vector passed) /// @param[in] valid validity of the negative position error /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetNegativePositionError( const ROOT::Math::XYZVectorF negPosErr, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( eNegativePositionError, valid, fixed ); negativePositionError = -negPosErr; } /// Set the position errors along the negative coordinate axes of the given coordinate system, with the Fitted Position as the system's origin /// Note that the errors should be passed with positive coordinates. /// /// @param[in] negPosErr negative position error in [r, -theta, -phi] coordinates (note positive values in vector passed) /// @param[in] valid validity of the negative position error /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetNegativePositionError( const ROOT::Math::Polar3DVectorF negPosErr, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( eNegativePositionError, valid, fixed ); negativePositionError = ROOT::Math::XYZVectorF(-negPosErr.X(), -negPosErr.Y(), -negPosErr.Z()); } /// Set the same position errors along both positive and negative axes of each direction in the coordinate system, with the Fitted Position as the system's origin /// /// @param[in] posErr position errors in [+x, +y, +z] /// @param[in] valid validity of the position errors /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetPositionErrors( const ROOT::Math::XYZVectorF posErr, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( ePositivePositionError, valid, fixed ); SetMasks( eNegativePositionError, valid, fixed ); positivePositionError = posErr; negativePositionError = -posErr; } /// Set the same position errors along both positive and negative axes of each direction in the coordinate system, with the Fitted Position as the system's origin /// /// @param[in] posErr position errors in [r, +theta, +phi] /// @param[in] valid validity of the position errors /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetPositionErrors( const ROOT::Math::Polar3DVectorF posErr, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( ePositivePositionError, valid, fixed ); SetMasks( eNegativePositionError, valid, fixed ); positivePositionError = ROOT::Math::XYZVectorF(posErr.X(), posErr.Y(), posErr.Z()); negativePositionError = ROOT::Math::XYZVectorF(-posErr.X(), -posErr.Y(), -posErr.Z()); } /// Set the position validity /// /// @param[in] valid validity of the position void SetPositionValid( const Bool_t valid ) { SetMask( validMask, ePosition, valid ); } /// Set the position error validity /// /// @param[in] valid validity of the positive position error void SetPositivePositionErrorValid( const Bool_t valid ) { SetMask( validMask, ePositivePositionError, valid ); } /// Set the position error validity /// /// @param[in] valid validity of the negative position error void SetNegativePositionErrorValid( const Bool_t valid ) { SetMask( validMask, eNegativePositionError, valid ); } /// Set the direction /// /// @param[in] dir direction /// @param[in] valid validity of the direction /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetDirection( const TVector3& dir, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( eDirection, valid, fixed ); direction = ROOT::Math::XYZVectorF(dir.X(), dir.Y(), dir.Z()); } /// Set the positive direction error /// /// @param[in] dirErr direction error /// @param[in] valid validity of the direction error /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetPositiveDirectionError( const TVector3& dirErr, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( ePositiveDirectionError, valid, fixed ); positiveDirectionError = ROOT::Math::XYZVectorF(dirErr.X(), dirErr.Y(), dirErr.Z()); } /// Set the negative direction error /// /// @param[in] dirErr direction error /// @param[in] valid validity of the direction error /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetNegativeDirectionError( const TVector3& dirErr, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( eNegativeDirectionError, valid , fixed); negativeDirectionError = ROOT::Math::XYZVectorF(-dirErr.X(), -dirErr.Y(), -dirErr.Z()); } /// Set the same direction errors along both positive and negative axes of each direction /// /// @param[in] dirErr direction error /// @param[in] valid validity of the direction errors /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetDirectionErrors( const TVector3& dirErr, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( ePositiveDirectionError, valid, fixed ); SetMasks( eNegativeDirectionError, valid, fixed ); positiveDirectionError = ROOT::Math::XYZVectorF( dirErr.X(), dirErr.Y(), dirErr.Z() ); negativeDirectionError = ROOT::Math::XYZVectorF( -dirErr.X(), -dirErr.Y(), -dirErr.Z() ); } /// Set the direction validity /// /// @param[in] valid validity of the direction void SetDirectionValid( const Bool_t valid ) { SetMask( validMask, eDirection, valid ); } /// Set the direction error validity /// /// @param[in] valid validity of the direction error void SetPositiveDirectionErrorValid( const Bool_t valid ) { SetMask( validMask, ePositiveDirectionError, valid ); } /// Set the direction error validity /// /// @param[in] valid validity of the direction error void SetNegativeDirectionErrorValid( const Bool_t valid ) { SetMask( validMask, eNegativeDirectionError, valid ); } /// Set the energy /// /// @param[in] energy_ of the vertex /// @param[in] valid validity of the energy /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetEnergy( const Double_t energy_, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( eEnergy, valid, fixed ); energy = energy_; } /// Set the positive energy error /// /// @param[in] energyErr positive energy error /// @param[in] valid validity of the positive energy error /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetPositiveEnergyError( const Double_t energyErr, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( ePositiveEnergyError, valid, fixed ); positiveEnergyError = energyErr; } /// Set the positive energy error /// /// @param[in] energyErr energy error /// @param[in] valid validity of the negative energy error /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetNegativeEnergyError( const Double_t energyErr, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( eNegativeEnergyError, valid, fixed ); negativeEnergyError = -energyErr; } /// Set the same energy error for both positive and negative error values /// /// @param[in] energyErr negative energy error /// @param[in] valid validity of the energy errors /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetEnergyErrors( const Double_t& energyErr, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( ePositiveEnergyError, valid, fixed ); SetMasks( eNegativeEnergyError, valid, fixed ); positiveEnergyError = energyErr; negativeEnergyError = -energyErr; } /// Set the energy validity /// /// @param[in] valid validity of the energy void SetEnergyValid( const Bool_t valid ) { SetMask( validMask, eEnergy, valid ); } /// Set the energy error validity /// /// @param[in] valid validity of the energy error void SetPositiveEnergyErrorValid( const Bool_t valid ) { SetMask( validMask, ePositiveEnergyError, valid ); } /// Set the energy error validity /// /// @param[in] valid validity of the energy error void SetNegativeEnergyErrorValid( const Bool_t valid ) { SetMask( validMask, eNegativeEnergyError, valid ); } /// Set the event time /// /// @param[in] time_ of the vertex /// @param[in] valid validity of the time /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetTime( const Double_t time_, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( eTime, valid, fixed ); time = time_; } /// Set the positive time error /// /// @param[in] timeErr time error /// @param[in] valid validity of the positive time error /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetPositiveTimeError( const Double_t timeErr, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( ePositiveTimeError, valid, fixed ); positiveTimeError = timeErr; } /// Set the positive time error /// /// @param[in] timeErr time error /// @param[in] valid validity of the negative time error /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetNegativeTimeError( const Double_t timeErr, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( eNegativeTimeError, valid, fixed ); negativeTimeError = -timeErr; } /// Set the same time error for both positive and negative error values /// /// @param[in] timeErr time error /// @param[in] valid validity of the time errors /// @param[in] fixed whether the parameter was calculated (fixed=false) by the fitter or passed by a seed (fixed=true) void SetTimeErrors( const Double_t& timeErr, const Bool_t valid=true, const Bool_t fixed=false ) { SetMasks( ePositiveTimeError, valid, fixed ); SetMasks( eNegativeTimeError, valid, fixed ); positiveTimeError = timeErr; negativeTimeError = -timeErr; } /// Set the time validity /// /// @param[in] valid validity of the time void SetTimeValid( const Bool_t valid ) { SetMask( validMask, eTime, valid ); } /// Set the time error validity /// /// @param[in] valid validity of the time error void SetPositiveTimeErrorValid( const Bool_t valid ) { SetMask( validMask, ePositiveTimeError, valid ); } /// Set the time error validity /// /// @param[in] valid validity of the time error void SetNegativeTimeErrorValid( const Bool_t valid ) { SetMask( validMask, eNegativeTimeError, valid ); } /// Returns the position, will throw a NoValueError if the position was not fit /// /// @return the position /// @throws NoValueError if the position has not been fit TVector3 GetPosition() const { if( !ContainsPosition() ) throw NoValueError("FitVertex", "position"); return TVector3(position.X(), position.Y(), position.Z()); } /// Returns the position errors along the positive axes relative to the Fitted Position, will throw a NoValueError if the positive position error was not set /// /// @return the positive position error /// @throws NoValueError if the position has not been fit TVector3 GetPositivePositionError() const { if( !( dataMask & ePositivePositionError ) ) throw NoValueError("FitVertex", "positiviePositionError"); return TVector3(positivePositionError.X(), positivePositionError.Y(), positivePositionError.Z()); } /// Returns the position errors along the negative axes relative to the Fitted Position, will throw a NoValueError if the negative position error was not set /// /// @return the negative position error /// @throws NoValueError if the position has not been fit TVector3 GetNegativePositionError() const { if( !( dataMask & eNegativePositionError ) ) throw NoValueError("FitVertex", "negativePositionError"); return TVector3(negativePositionError.X(), negativePositionError.Y(), negativePositionError.Z()); } /// Returns the direction, will throw a NoValueError if the direction was not fit /// /// @return the direction /// @throws NoValueError if the direction has not been fit TVector3 GetDirection() const { if( !ContainsDirection() ) throw NoValueError("FitVertex", "direction"); return TVector3(direction.X(), direction.Y(), direction.Z()); } /// Returns the direction error along the positive axis relative to the fitter direction, will throw a NoValueError if the direction error was not fit /// /// @return the positive direction error /// @throws NoValueError if the direction has not been fit TVector3 GetPositiveDirectionError() const { if( !( dataMask & ePositiveDirectionError ) ) throw NoValueError("FitVertex", "positiveDirectionError"); return TVector3(positiveDirectionError.X(), positiveDirectionError.Y(), positiveDirectionError.Z()); } /// Returns the direction error along the negative axis relative to the fitter direction, will throw a NoValueError if the direction error was not fit /// /// @return the negative direction error /// @throws NoValueError if the direction has not been fit TVector3 GetNegativeDirectionError() const { if( !( dataMask & eNegativeDirectionError ) ) throw NoValueError("FitVertex", "negativeDirectionError"); return TVector3(negativeDirectionError.X(), negativeDirectionError.Y(), negativeDirectionError.Z()); } /// Returns the energy, will throw a NoValueError if the energy was not fit /// /// @return the energy /// @throws NoValueError if the energy has not been fit Double_t GetEnergy() const { if( !ContainsEnergy() ) throw NoValueError("FitVertex", "energy"); return energy; } /// Returns the positive energy error, will throw a NoValueError if the energy error was not fit /// /// @return the positive energy error /// @throws NoValueError if the energy has not been fit Double_t GetPositiveEnergyError() const { if( !( dataMask & ePositiveEnergyError ) ) throw NoValueError("FitVertex", "positiveEnergyError"); return positiveEnergyError; } /// Returns the negative energy error, will throw a NoValueError if the energy error was not fit /// /// @return the negative energy error /// @throws NoValueError if the energy has not been fit Double_t GetNegativeEnergyError() const { if( !( dataMask & eNegativeEnergyError ) ) throw NoValueError("FitVertex", "negativeEnergyError"); return negativeEnergyError; } /// Returns the time, will throw a NoValueError if the time was not fit /// /// @return the time /// @throws NoValueError if the time has not been fit Double_t GetTime() const { if( !ContainsTime() ) throw NoValueError("FitVertex", "timeError"); return time; } /// Returns the positive time error, will throw a NoValueError if the time error was not fit /// /// @return the positive time error /// @throws NoValueError if the time has not been fit Double_t GetPositiveTimeError() const { if( !( dataMask & ePositiveTimeError ) ) throw NoValueError("FitVertex", "positiveTimeError"); return positiveTimeError; } /// Returns the negative time error, will throw a NoValueError if the time error was not fit /// /// @return the negative time error /// @throws NoValueError if the time has not been fit Double_t GetNegativeTimeError() const { if( !( dataMask & eNegativeTimeError ) ) throw NoValueError("FitVertex", "negativeTimeError"); return negativeTimeError; } /// Returns true/false if position value exists /// /// @return true if the position has been fit Bool_t ContainsPosition() const { return dataMask & ePosition; } /// Returns true/false if positive position error exists /// /// @return true if the positive position error has been set Bool_t ContainsPositivePositionError() const { return dataMask & ePositivePositionError; } /// Returns true/false if negative position error exists /// /// @return true if the negative position error has been set Bool_t ContainsNegativePositionError() const { return dataMask & eNegativePositionError; } /// Returns true/false if direction value exists /// /// @return true if the direction has been fit Bool_t ContainsDirection() const { return dataMask & eDirection; } /// Returns true/false if direction error value exists /// /// @return true if the direction error has been set Bool_t ContainsPositiveDirectionError() const { return dataMask & ePositiveDirectionError; } /// Returns true/false if direction error value exists /// /// @return true if the direction error has been set Bool_t ContainsNegativeDirectionError() const { return dataMask & eNegativeDirectionError; } /// Returns true/false if energy value exists /// /// @return true if the energy has been fit Bool_t ContainsEnergy() const { return dataMask & eEnergy; } /// Returns true/false if energy error value exists /// /// @return true if the energy error has been set Bool_t ContainsPositiveEnergyError() const { return dataMask & ePositiveEnergyError; } /// Returns true/false if energy error value exists /// /// @return true if the energy error has been set Bool_t ContainsNegativeEnergyError() const { return dataMask & eNegativeEnergyError; } /// Returns true/false if time value exists /// /// @return true if the time has been fit Bool_t ContainsTime() const { return dataMask & eTime; } /// Returns true/false if time error value exists /// /// @return true if the time error has been set Bool_t ContainsPositiveTimeError() const { return dataMask & ePositiveTimeError; } /// Returns true/false if time error value exists /// /// @return true if the time error has been set Bool_t ContainsNegativeTimeError() const { return dataMask & eNegativeTimeError; } /// Returns true/false if either the position, direction, energy, or time values exist /// /// @returns true if either the position, direction, energy, or time has been set Bool_t ContainsAny() const { return ContainsPosition() || ContainsDirection() || ContainsEnergy() || ContainsTime(); } /// Returns true/false if position value is valid /// /// @return true if the position is valid Bool_t ValidPosition() const { return ContainsPosition() && (validMask & ePosition); } /// Returns true/false if positive position error value is valid /// /// @return true if the positive position error is valid Bool_t ValidPositivePositionError() const { return ContainsPositivePositionError() && (validMask & ePositivePositionError); } /// Returns true/false if negative position error value is valid /// /// @return true if the negative position error is valid Bool_t ValidNegativePositionError() const { return ContainsNegativePositionError() && (validMask & eNegativePositionError); } /// Returns true/false if direction value is valid /// /// @return true if the direction is valid Bool_t ValidDirection() const { return ContainsDirection() && (validMask & eDirection); } /// Returns true/false if direction error value is valid /// /// @return true if the direction error is valid Bool_t ValidPositiveDirectionError() const { return ContainsPositiveDirectionError() && (validMask & ePositiveDirectionError); } /// Returns true/false if direction error value is valid /// /// @return true if the direction error is valid Bool_t ValidNegativeDirectionError() const { return ContainsNegativeDirectionError() && (validMask & eNegativeDirectionError); } /// Returns true/false if energy value is valid /// /// @return true if the energy is valid Bool_t ValidEnergy() const { return ContainsEnergy() && (validMask & eEnergy); } /// Returns true/false if energy error value is valid /// /// @return true if the energy error is valid Bool_t ValidPositiveEnergyError() const { return ContainsPositiveEnergyError() && (validMask & ePositiveEnergyError); } /// Returns true/false if energy error value is valid /// /// @return true if the energy error is valid Bool_t ValidNegativeEnergyError() const { return ContainsNegativeEnergyError() && (validMask & eNegativeEnergyError); } /// Returns true/false if time value is valid /// /// @return true if the time is valid Bool_t ValidTime() const { return ContainsTime() && (validMask & eTime); } /// Returns true/false if time error value is valid /// /// @return true if the time error is valid Bool_t ValidPositiveTimeError() const { return ContainsPositiveTimeError() && (validMask & ePositiveTimeError); } /// Returns true/false if time error value is valid /// /// @return true if the time error is valid Bool_t ValidNegativeTimeError() const { return ContainsNegativeTimeError() && (validMask & eNegativeTimeError); } /// Get if overall valid /// /// @return true if every contained value is valid inline Bool_t GetValid() const; /// Get validity mask /// /// @return the mask of fit validity bits UInt_t GetValidityMask() const { return validMask; }; /// Get if overall valid /// /// @return true if every contained value that was calculated by the last fitter (i.e. not fixed) is valid inline Bool_t GetValidUnfixed() const; /// Returns true/false if position value is fixed /// /// @return true if the position is fixed Bool_t FixedPosition() const { return ContainsPosition() && (fixedMask & ePosition); } /// Returns true/false if positive position error value is fixed /// /// @return true if the positive position error is fixed Bool_t FixedPositivePositionError() const { return ContainsPositivePositionError() && (fixedMask & ePositivePositionError); } /// Returns true/false if negative position error value is fixed /// /// @return true if the negative position error is fixed Bool_t FixedNegativePositionError() const { return ContainsNegativePositionError() && (fixedMask & eNegativePositionError); } /// Returns true/false if direction value is fixed /// /// @return true if the direction is fixed Bool_t FixedDirection() const { return ContainsDirection() && (fixedMask & eDirection); } /// Returns true/false if direction error value is fixed /// /// @return true if the direction error is fixed Bool_t FixedPositiveDirectionError() const { return ContainsPositiveDirectionError() && (fixedMask & ePositiveDirectionError); } /// Returns true/false if direction error value is fixed /// /// @return true if the direction error is fixed Bool_t FixedNegativeDirectionError() const { return ContainsNegativeDirectionError() && (fixedMask & eNegativeDirectionError); } /// Returns true/false if energy value is fixed /// /// @return true if the energy is fixed Bool_t FixedEnergy() const { return ContainsEnergy() && (fixedMask & eEnergy); } /// Returns true/false if energy error value is fixed /// /// @return true if the energy error is fixed Bool_t FixedPositiveEnergyError() const { return ContainsPositiveEnergyError() && (fixedMask & ePositiveEnergyError); } /// Returns true/false if energy error value is fixed /// /// @return true if the energy error is fixed Bool_t FixedNegativeEnergyError() const { return ContainsNegativeEnergyError() && (fixedMask & eNegativeEnergyError); } /// Returns true/false if time value is fixed /// /// @return true if the time is fixed Bool_t FixedTime() const { return ContainsTime() && (fixedMask & eTime); } /// Returns true/false if time error value is fixed /// /// @return true if the time error is fixed Bool_t FixedPositiveTimeError() const { return ContainsPositiveTimeError() && (fixedMask & ePositiveTimeError); } /// Returns true/false if time error value is fixed /// /// @return true if the time error is fixed Bool_t FixedNegativeTimeError() const { return ContainsNegativeTimeError() && (fixedMask & eNegativeTimeError); } // This ROOT macro adds dictionary methods to this class. // The number should be incremented whenever this class's members are changed. // It assumes this class has no virtual methods, use ClassDef if change this. ClassDefNV( FitVertex, 5 ); protected: /// Set the existence And Validity Masks /// /// @param[in] mask to set /// @param[in] valid Whether masked valid bits should be set /// @param[in] fixed Whether masked fixed bits should be set inline void SetMasks( const EMaskValues mask, const Bool_t valid, const Bool_t fixed=false ); /// Set a given bit of a mask to true/false /// /// @param[in] mask to set /// @param[in] param enum value of the parameter in the mask /// @param[in] value true or false value inline void SetMask( UInt_t& mask, const EMaskValues param, const Bool_t value ); private: ROOT::Math::XYZVectorF position; ///< Position ROOT::Math::XYZVectorF positivePositionError; ///< Position Errors along the positive coordinate axes ROOT::Math::XYZVectorF negativePositionError; ///< Position Errors along the negative coordinate axes ROOT::Math::XYZVectorF direction; ///< Direction ROOT::Math::XYZVectorF positiveDirectionError; ///< Direction Error along the positive coordinate axes ROOT::Math::XYZVectorF negativeDirectionError; ///< Direction Error along the negative coordinate axes Double32_t energy; ///< Energy Double32_t positiveEnergyError; ///< Positive energy error Double32_t negativeEnergyError; ///< Negative energy error Double_t time; ///< Fit time Double_t positiveTimeError; ///< Fit positive time error Double_t negativeTimeError; ///< Fit negative time error UInt_t dataMask; ///< States what data exists in this fit result UInt_t validMask; ///< States what data is valid UInt_t fixedMask; ///< States which parameters were fixed by the fitter (i.e. False implies these were calculated by the fitter) }; void FitVertex::SetMasks( const EMaskValues value, const Bool_t valid, const Bool_t fixed ) { dataMask |= value; if( valid ) validMask |= value; else validMask &= ~value; if( fixed ) fixedMask |= value; else fixedMask &= ~value; } void FitVertex::SetMask( UInt_t& mask, const EMaskValues bit, const Bool_t value ) { if( value ) mask |= bit; else mask &= ~bit; } Bool_t FitVertex::GetValid() const { Bool_t valid = ContainsAny(); valid = valid && ( !ContainsPosition() || ValidPosition() ); valid = valid && ( !ContainsDirection() || ValidDirection() ); valid = valid && ( !ContainsEnergy() || ValidEnergy() ); valid = valid && ( !ContainsTime() || ValidTime() ); return valid; } Bool_t FitVertex::GetValidUnfixed() const { Bool_t valid = ContainsAny(); valid = valid && ( !ContainsPosition() || ValidPosition() || FixedPosition() ); valid = valid && ( !ContainsDirection() || ValidDirection() || FixedDirection() ); valid = valid && ( !ContainsEnergy() || ValidEnergy() || FixedEnergy() ); valid = valid && ( !ContainsTime() || ValidTime() || FixedTime() ); return valid; } } //::DS } //::RAT #endif