00001 // 00002 // $Id: Vector_Resolution.h,v 1.1 2011/05/26 09:46:53 mseidel Exp $ 00003 // 00004 // File: hitfit/Vector_Resolution.h 00005 // Purpose: Calculate resolutions in p, phi, eta. 00006 // Created: Jul, 2000, sss, based on run 1 mass analysis code. 00007 // 00008 // These objects hold three Resolution objects, one each for p, phi, eta. 00009 // In addition, we have a use_et flag; if set, then the p resolution 00010 // is really in pt. 00011 // 00012 // We can initialize these objects from a string; the format is 00013 // 00014 // <p-res>/<eta-res>/<phi-res>[/et] 00015 // 00016 // where the resolution formats are as given in Resolution.h. 00017 // 00018 // CMSSW File : interface/Vector_Resolution.h 00019 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0 00020 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch> 00021 // 00022 00023 00047 #ifndef HITFIT_VECTOR_RESOLUTION_H 00048 #define HITFIT_VECTOR_RESOLUTION_H 00049 00050 00051 #include <string> 00052 #include <iosfwd> 00053 #include "TopQuarkAnalysis/TopHitFit/interface/Resolution.h" 00054 #include "TopQuarkAnalysis/TopHitFit/interface/fourvec.h" 00055 00056 00057 namespace hitfit { 00058 00059 00094 class Vector_Resolution 00095 // 00096 // Purpose: Calculate resolutions in p, phi, eta. 00097 // 00098 { 00099 public: 00100 // Constructor. Create a vector resolution object with infinite precision 00105 Vector_Resolution (); 00106 00107 // Constructor. Parse a string as described above. 00114 Vector_Resolution (std::string s); 00115 00116 // Constructor from individual resolution objects. 00130 Vector_Resolution (const Resolution& p_res, 00131 const Resolution& eta_res, 00132 const Resolution& phi_res, 00133 bool use_et = false); 00134 00135 // Get back the individual resolution objects. 00139 const Resolution& p_res () const; 00140 00144 const Resolution& eta_res () const; 00145 00149 const Resolution& phi_res () const; 00150 00151 // Return the use_et flag. 00155 bool use_et () const; 00156 00157 // Calculate resolutions from a 4-momentum. 00163 double p_sigma (const Fourvec& v) const; 00164 00170 double eta_sigma (const Fourvec& v) const; 00171 00177 double phi_sigma (const Fourvec& v) const; 00178 00179 // Smear a 4-vector V according to the resolutions. 00180 // If DO_SMEAR_DIR is false, only smear the total energy. 00191 void smear (Fourvec& v, 00192 CLHEP::HepRandomEngine& engine, 00193 bool do_smear_dir = false) const; 00194 00195 // Dump this object, for debugging. 00196 friend std::ostream& operator<< (std::ostream& s, 00197 const Vector_Resolution& r); 00198 00199 private: 00200 // State for this object. 00204 Resolution _p_res; 00205 00209 Resolution _eta_res; 00210 00214 Resolution _phi_res; 00215 00219 bool _use_et; 00220 00221 // Helper. 00229 void smear_dir (Fourvec& v, CLHEP::HepRandomEngine& engine) const; 00230 }; 00231 00232 00233 } // namespace hitfit 00234 00235 00236 #endif // not HITFIT_VECTOR_RESOLUTION_H