Main Page | Namespace List | Class List | File List | Namespace Members | Class Members | File Members

Track.h

Go to the documentation of this file.
00001 
00002 //   **************************************************************************
00003 //   *                                                                        *
00004 //   *                      ! ! ! A T T E N T I O N ! ! !                     *
00005 //   *                                                                        *
00006 //   *  This file was created automatically by GaudiObjDesc, please do not    *
00007 //   *  delete it or edit it by hand.                                         *
00008 //   *                                                                        *
00009 //   *  If you want to change this file, first change the corresponding       *
00010 //   *  xml-file and rerun the tools from GaudiObjDesc (or run make if you    *
00011 //   *  are using it from inside a Gaudi-package).                            *
00012 //   *                                                                        *
00013 //   **************************************************************************
00014 
00015 #ifndef TrEvent_Track_H
00016 #define TrEvent_Track_H 1
00017 
00018 // Include files
00019 #include "Kernel/CLHEPStreams.h"
00020 #include "Event/State.h"
00021 #include "Kernel/LHCbID.h"
00022 #include "CLHEP/Geometry/Plane3D.h"
00023 #include "GaudiKernel/KeyedObject.h"
00024 #include "GaudiKernel/KeyedContainer.h"
00025 #include <vector>
00026 #include <vector>
00027 #include <vector>
00028 #include <vector>
00029 #include <vector>
00030 
00031 
00032 // Forward declarations
00033 class StatusCode;
00034 class Point3D;
00035 class Vector3D;
00036 class SymMatrix;
00037 
00038 
00039 // Class ID definition
00040 static const CLID& CLID_Track = 10010;
00041 
00042 // Namespace for locations in TDS
00043 namespace TrackLocation {
00044   static const std::string& Default = "Rec/Track/Best";
00045   static const std::string& Velo = "Rec/Tr/Velo";
00046   static const std::string& Seed = "Rec/Tr/Seed";
00047   static const std::string& Match = "Rec/Tr/Match";
00048   static const std::string& Forward = "Rec/Tr/Forward";
00049   static const std::string& Follow = "Rec/Tr/Follow";
00050   static const std::string& VeloTT = "Rec/Tr/VeloTT";
00051   static const std::string& KsTrack = "Rec/Tr/KsTrack";
00052 }
00053 
00054 
00064 class Track: public KeyedObject<int>
00065 {
00066 public:
00067 
00069   enum TrackType{ Velo=1,
00070                   VeloR=2,
00071                   Backward=4,
00072                   Long=8,
00073                   Upstream=16,
00074                   Downstream=32,
00075                   Ttrack=64 };
00077   enum HistoryFlag{ LongTrack=1,
00078                     Seeding=2,
00079                     TrKshort=4,
00080                     TrMatching=8,
00081                     VeloTrack=16,
00082                     VeloTT=32,
00083                     TrgForward=64,
00084                     TrgVelo=128,
00085                     TrgVeloTT=256 };
00087   enum Flag{ Valid=1,
00088              Unique=2 };
00089 
00091   Track() : m_chi2PerDoF(0.0),
00092             m_nDoF(0),
00093             m_flags(0),
00094             m_lhcbids(),
00095             m_physicsState(),
00096             m_states() {}
00097 
00099   virtual ~Track() {}
00100 
00101   // Retrieve pointer to class definition structure
00102   virtual const CLID& clID() const;
00103   static const CLID& classID();
00104 
00106   StatusCode positionAndMomentum(HepPoint3D& pos,
00107                                  HepVector3D& mom,
00108                                  HepSymMatrix& cov6D) const;
00109 
00111   StatusCode position(HepPoint3D& pos,
00112                       HepSymMatrix& errPos) const;
00113 
00115   StatusCode slopes(HepVector3D& slopes,
00116                     HepSymMatrix& errSlopes) const;
00117 
00119   double p() const;
00120 
00122   double pt() const;
00123 
00125   StatusCode momentum(HepVector3D& mom,
00126                       HepSymMatrix& errMom) const;
00127 
00129   StatusCode posMomCovariance(HepSymMatrix& cov6D) const;
00130 
00132   int charge() const;
00133 
00135   unsigned int nStates() const;
00136 
00138   void addToStates(State* value);
00139 
00141   void removeFromStates(State* value);
00142 
00144   virtual State* closestState(double z);
00145 
00147   virtual const State* closestState(double z) const;
00148 
00150   virtual State* closestState(HepPlane3D& plane);
00151 
00153   virtual const State* closestState(HepPlane3D& plane) const;
00154 
00156   virtual State* stateAt(const State::Location& value);
00157 
00159   virtual const State* stateAt(const State::Location& value) const;
00160 
00162   double chi2() const;
00163 
00165   virtual void reset();
00166 
00168   virtual Track* clone() const;
00169 
00171   std::vector<LHCbID> & LHCbIDs();
00172 
00174   const std::vector<LHCbID> & LHCbIDs() const;
00175 
00177   void setLHCbIDs(const std::vector<LHCbID>& value);
00178 
00180   void addToLHCbIDs(const LHCbID& value);
00181 
00183   void removeFromLHCbIDs(const LHCbID& value);
00184 
00186   virtual bool producedByAlgo(const HistoryFlag& value) const;
00187 
00189   virtual void setProducedByAlgo(const HistoryFlag& value);
00190 
00192   double chi2PerDoF() const;
00193 
00195   void setChi2PerDoF(double value);
00196 
00198   int nDoF() const;
00199 
00201   void setNDoF(int value);
00202 
00204   unsigned int flags() const;
00205 
00207   void setType(const TrackType& value);
00208 
00210   bool checkType(const TrackType& value) const;
00211 
00213   void setFlag(const Flag& value);
00214 
00216   bool checkFlag(const Flag& value) const;
00217 
00219   const State& physicsState() const;
00220 
00222   State& physicsState();
00223 
00225   void setPhysicsState(const State& value);
00226 
00228   const std::vector<State*>& states() const;
00229 
00231   std::vector<State*>& states();
00232 
00234   void setStates(const std::vector<State*>& value);
00235 
00236 protected:
00237 
00238 private:
00239 
00241   enum flagsBits{typeBits    = 0,
00242                  historyBits = 7,
00243                  flagBits    = 16};
00244 
00246   enum flagsMasks{typeMask    = 0x7FL,
00247                   historyMask = 0xFF80L,
00248                   flagMask    = 0x30000L};
00249 
00250 
00251   double              m_chi2PerDoF;   
00252   int                 m_nDoF;         
00253   unsigned int        m_flags;        
00254   std::vector<LHCbID> m_lhcbids;      
00255   State               m_physicsState; 
00256   std::vector<State*> m_states;       
00257 
00258 };
00259 
00260 // -----------------------------------------------------------------------------
00261 //   end of class
00262 // -----------------------------------------------------------------------------
00263 
00264 // Including forward declarations
00265 #include "GaudiKernel/StatusCode.h"
00266 #include "CLHEP/Geometry/Point3D.h"
00267 #include "CLHEP/Geometry/Vector3D.h"
00268 #include "CLHEP/Matrix/SymMatrix.h"
00269 
00270 
00271 inline const CLID& Track::clID() const
00272 {
00273   return Track::classID();
00274 }
00275 
00276 inline const CLID& Track::classID()
00277 {
00278   return CLID_Track;
00279 }
00280 
00281 inline double Track::chi2PerDoF() const 
00282 {
00283   return m_chi2PerDoF;
00284 }
00285 
00286 inline void Track::setChi2PerDoF(double value) 
00287 {
00288   m_chi2PerDoF = value;
00289 }
00290 
00291 inline int Track::nDoF() const 
00292 {
00293   return m_nDoF;
00294 }
00295 
00296 inline void Track::setNDoF(int value) 
00297 {
00298   m_nDoF = value;
00299 }
00300 
00301 inline unsigned int Track::flags() const 
00302 {
00303   return m_flags;
00304 }
00305 
00306 inline void Track::setType(const TrackType& value)
00307 {
00308   unsigned int val = (unsigned int)value;
00309   m_flags &= ~typeMask;
00310   m_flags |= ((((unsigned int)val) << typeBits) & typeMask);
00311 }
00312 
00313 inline bool Track::checkType(const TrackType& value) const
00314 {
00315   unsigned int val = (unsigned int)value;  return 0 != ( m_flags & typeMask & val );
00316 }
00317 
00318 inline void Track::setFlag(const Flag& value)
00319 {
00320   unsigned int val = (unsigned int)value;
00321   m_flags &= ~flagMask;
00322   m_flags |= ((((unsigned int)val) << flagBits) & flagMask);
00323 }
00324 
00325 inline bool Track::checkFlag(const Flag& value) const
00326 {
00327   unsigned int val = (unsigned int)value;  return 0 != ( m_flags & flagMask & val );
00328 }
00329 
00330 inline const State& Track::physicsState() const 
00331 {
00332   return m_physicsState;
00333 }
00334 
00335 inline State& Track::physicsState() 
00336 {
00337   return m_physicsState;
00338 }
00339 
00340 inline void Track::setPhysicsState(const State& value) 
00341 {
00342   m_physicsState = value;
00343 }
00344 
00345 inline const std::vector<State*>& Track::states() const 
00346 {
00347   return m_states;
00348 }
00349 
00350 inline std::vector<State*>& Track::states() 
00351 {
00352   return m_states;
00353 }
00354 
00355 inline void Track::setStates(const std::vector<State*>& value) 
00356 {
00357   m_states = value;
00358 }
00359 
00360 inline int Track::charge() const 
00361 {
00362 
00363   double qP = m_physicsState.qOverP();
00364   return ( qP != 0. ? int(fabs(qP)/qP) : 0 );
00365         
00366 }
00367 
00368 inline unsigned int Track::nStates() const 
00369 {
00370 
00371   return m_states.size();
00372         
00373 }
00374 
00375 inline void Track::addToStates(State* value) 
00376 {
00377 
00378   m_states.push_back( value );
00379         
00380 }
00381 
00382 inline void Track::removeFromStates(State* value) 
00383 {
00384 
00385   std::vector<State*>::iterator iter =
00386     std::remove( m_states.begin(), m_states.end(), value );
00387   m_states.erase( iter, m_states.end() );
00388         
00389 }
00390 
00391 inline double Track::chi2() const 
00392 {
00393 
00394   return ( m_chi2PerDoF * double(m_nDoF) );
00395         
00396 }
00397 
00398 inline void Track::reset() 
00399 {
00400 
00401   m_chi2PerDoF   = 0;
00402   m_nDoF         = 0;
00403   m_flags        = 0;
00404   m_physicsState.reset();
00405   m_states.clear();
00406   m_lhcbids.clear();
00407         
00408 }
00409 
00410 inline std::vector<LHCbID> & Track::LHCbIDs() 
00411 {
00412 
00413   return m_lhcbids;
00414         
00415 }
00416 
00417 inline const std::vector<LHCbID> & Track::LHCbIDs() const 
00418 {
00419 
00420   return m_lhcbids;
00421         
00422 }
00423 
00424 inline void Track::setLHCbIDs(const std::vector<LHCbID>& value) 
00425 {
00426 
00427   m_lhcbids = value;
00428         
00429 }
00430 
00431 inline void Track::addToLHCbIDs(const LHCbID& value) 
00432 {
00433 
00434   m_lhcbids.push_back( value );
00435         
00436 }
00437 
00438 inline void Track::removeFromLHCbIDs(const LHCbID& value) 
00439 {
00440 
00441   std::vector<LHCbID>::iterator iter =
00442     std::remove( m_lhcbids.begin(), m_lhcbids.end(), value );
00443   m_lhcbids.erase( iter, m_lhcbids.end() );
00444         
00445 }
00446 
00447 // Definition of Keyed Container for Track
00448 typedef KeyedContainer<Track, Containers::HashMap> Tracks;
00449 
00450 #endif 

Generated on Tue Dec 14 22:00:36 2004 for New Track Event Model by doxygen 1.3.5