//-------------------------------------------------------------------------- // File and Version Information: // $Id: BtaThrust.cc,v 1.2 1997/1/20 10:05:13 // // Description: // Class BtaThrust - a simple object to calculate thrust // There are three modes: // BTAllParticles (0) (default) - use both charged and neutrals // BTChargedOnly (1) - use only charged particles // BTNeutralOnly (2) - use only neutral particles // // Environment: // Software developed for the BaBar Detector at the SLAC B-Factory. // // Author List: // Scott Metzler original author // G. Hamel de Monchenault Implement in terms of BtaThrustVector // John Back Re-written to be used without BtaSelectors. // //------------------------------------------------------------------------ #include "BaBar/BaBar.hh" #include #include "BetaCoreTools/BtaThrust.hh" #include "CLHEP/Alist/AList.h" #include "Beta/EventInfo.hh" #include "Beta/BtaCandidate.hh" #include "BetaCoreTools/BtaBooster.hh" BtaThrust::BtaThrust(const HepAList& list, const EventInfo& evtinfo, BetaParticles mode, bool cutInCms, BetaFitter fitter) : _charged( false ) { _theFitter = fitter; _cutInCms = cutInCms; _checkCharge = false; // create first the BtaCandidate selector if( mode != BtaThrust::BTAllParticles ) { if( mode == BtaThrust::BTChargedOnly) { _checkCharge = true; _charged = true; } else if( mode == BtaThrust::BTNeutralOnly ) { _checkCharge = true; _charged = false; } } init( list, evtinfo); } BtaThrust::~BtaThrust() { } void BtaThrust::init( const HepAList& list , const EventInfo& eventInfo) { // create the Y(4S) candidate, and the corresponding BtaBooster BtaCandidate theUps( eventInfo.cmFrame() ); BtaBooster theBooster( &theUps ); if (_theFitter == BtaThrust::BTVector) { // compute the thrust vector _theThrustVector.boostAndCompute(list, &theBooster, _cutInCms, _checkCharge, _charged); } else if (_theFitter == BtaThrust::BTFitter) { _theThrustFitter.boostAndCompute(list, &theBooster, _cutInCms, _checkCharge, _charged); } else { // compute the thrust vector _theThrustVector.boostAndCompute(list, &theBooster, _cutInCms, _checkCharge, _charged); } } double BtaThrust::thrust() const { double value(0.0); if (_theFitter == BtaThrust::BTVector) { value = _theThrustVector.thrust(); } else if (_theFitter == BtaThrust::BTFitter) { value = _theThrustFitter.thrust(); } else { value = _theThrustVector.thrust(); } return value; } Hep3Vector BtaThrust::thrust_axis() const { Hep3Vector theVector(0.0, 0.0, 0.0); if (_theFitter == BtaThrust::BTVector) { theVector = _theThrustVector.thrustAxis(); } else if (_theFitter == BtaThrust::BTFitter) { theVector = _theThrustFitter.thrustAxis(); } else { theVector = _theThrustVector.thrustAxis(); } return theVector; }