CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/FastSimulation/Particle/interface/RawParticle.h

Go to the documentation of this file.
00001 #ifndef RAWPARTTICLE_H
00002 #define RAWPARTTICLE_H
00003 
00004 #include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h"
00005 #include "DataFormats/Math/interface/LorentzVector.h"
00006 #include "DataFormats/Math/interface/Vector3D.h"
00007 
00008 #include "Math/GenVector/RotationX.h"
00009 #include "Math/GenVector/RotationY.h"
00010 #include "Math/GenVector/RotationZ.h"
00011 #include "Math/GenVector/Rotation3D.h"
00012 #include "Math/GenVector/AxisAngle.h"
00013 #include "Math/GenVector/Boost.h"
00014 
00015 class ParticleTable;
00016 
00017 #include <string>
00018 #include <iosfwd>
00019 
00020 
00021 
00028 typedef math::XYZTLorentzVector XYZTLorentzVector;
00029 typedef math::XYZVector XYZVector;
00030 
00031 class RawParticle : public XYZTLorentzVector {
00032 public:
00033 
00034   typedef ROOT::Math::AxisAngle Rotation;
00035   typedef ROOT::Math::Rotation3D Rotation3D;
00036   typedef ROOT::Math::RotationX RotationX;
00037   typedef ROOT::Math::RotationY RotationY;
00038   typedef ROOT::Math::RotationZ RotationZ;
00039   typedef ROOT::Math::Boost Boost;
00040 
00041   RawParticle();
00042 
00043   virtual ~RawParticle();
00044 
00048   RawParticle(const XYZTLorentzVector& p);
00049 
00053   RawParticle(const int id, 
00054               const XYZTLorentzVector& p);
00055 
00059   RawParticle(const std::string name, 
00060               const XYZTLorentzVector& p);
00061 
00065   RawParticle(const XYZTLorentzVector& p, 
00066               const XYZTLorentzVector& xStart);
00067 
00071   RawParticle(double px, double py, double pz, double e);
00072 
00074   RawParticle(const RawParticle &p);
00075 
00077   RawParticle&  operator = (const RawParticle & rhs );
00078 
00079 public:
00080 
00085   void setID(const int id); 
00086 
00091   void setID(const std::string name); 
00092 
00097   void setStatus(int istat);
00098 
00100   void setMass(float m);   
00101 
00103   void setCharge(float q);
00104 
00106   void setT(const double t);
00107 
00109   void setVertex(const XYZTLorentzVector& vtx); 
00110   void setVertex(double xv, double yv, double zv, double tv); 
00111 
00112   /***  methods to be overloaded to include vertex ***/
00113 
00118   void boost(double bx, double by, double bz);
00119   void boost(const Boost& b);
00120   
00121   //  inline void boost(const Hep3Vector<double> &bv );
00122 
00128   void rotate(double rphi, const XYZVector& raxis);
00129   void rotate(const Rotation& r);
00130   void rotate(const Rotation3D& r);
00131 
00133   //   void rotateUz(Hep3Vector &nuz);
00134 
00138   void rotateX(double rphi); 
00139   void rotate(const RotationX& r);
00140 
00145   void rotateY(double rphi);
00146   void rotate(const RotationY& r);
00151   void rotateZ(double rphi);
00152   void rotate(const RotationZ& r);
00153 
00155   void translate(const XYZVector& t);
00156 
00157   //  inline RawParticle & transform(const HepRotation &rot);
00158   //  inline RawParticle & transform(const HepLorentzRotation &rot);
00159 
00164   void chargeConjugate();
00165   
00166   int    pid() const;         
00167   
00168   int    status() const;      
00169   
00170   double charge() const;      
00171   
00172   double PDGcharge() const;   
00173   
00174   double mass() const;        
00175   
00176   double PDGmass() const;     
00177   
00178   double PDGcTau() const;     
00179   
00181   std::string    PDGname() const;
00182 
00186   double eta() const; 
00187 
00189   double cos2Theta() const;
00190   double cos2ThetaV() const;
00191   
00192   double et() const;   
00193   
00194   double x() const;  
00195   double X() const;  
00196   
00197   double y() const;  
00198   double Y() const;  
00199   
00200   double z() const;  
00201   double Z() const;  
00202   
00203   double t() const;  
00204   double T() const;  
00205   
00206   double r() const;  
00207   double R() const;  
00208   
00209   double r2() const;  
00210   double R2() const;  
00211   
00212   const XYZTLorentzVector& vertex() const;   
00213   
00214   const XYZTLorentzVector& momentum() const;   
00215   
00221   void printName() const; 
00222   
00227   void print() const;
00228   
00233   int isUsed() const {return myUsed;}
00234   
00237   void use() { myUsed = 1;}    
00238   
00241   void reUse() { myUsed = 0;}  
00242   
00243  private:
00244   
00245   void init();
00246   
00247  protected:
00248   
00249   XYZTLorentzVector myVertex;         
00250   int myId;                           
00251   int myStatus;                       
00252   int myUsed;                         
00253   double myCharge;                    
00254   double myMass;                      
00255   const ParticleData* myInfo;         
00256   
00257  private:
00258   ParticleTable* tab;
00259 };
00260 
00261 
00262 std::ostream& operator <<(std::ostream& o , const RawParticle& p); 
00263 
00264 inline int RawParticle::pid() const { return myId; }
00265 inline int RawParticle::status() const { return myStatus; }
00266 inline double RawParticle::eta() const { return -std::log(std::tan(this->theta()/2.)); }
00267 inline double RawParticle::cos2Theta() const { return Pz()*Pz()/Vect().Mag2(); }
00268 inline double RawParticle::cos2ThetaV() const { return Z()*Z()/myVertex.Vect().Mag2(); }
00269 inline double RawParticle::x() const { return myVertex.Px(); }
00270 inline double RawParticle::y() const { return myVertex.Py(); }
00271 inline double RawParticle::z() const { return myVertex.Pz(); }
00272 inline double RawParticle::t() const { return myVertex.E(); }
00273 inline double RawParticle::X() const { return myVertex.Px(); }
00274 inline double RawParticle::Y() const { return myVertex.Py(); }
00275 inline double RawParticle::Z() const { return myVertex.Pz(); }
00276 inline double RawParticle::T() const { return myVertex.E(); }
00277 inline double RawParticle::R() const { return std::sqrt(R2()); }
00278 inline double RawParticle::R2() const { return myVertex.Perp2(); }
00279 inline double RawParticle::r() const { return std::sqrt(r2()); }
00280 inline double RawParticle::r2() const { return myVertex.Perp2(); }
00281 inline double RawParticle::charge() const { return myCharge; }
00282 inline double RawParticle::mass() const { return myMass; }
00283 
00284 inline const XYZTLorentzVector&  RawParticle::vertex() const { return myVertex ; }
00285 inline const XYZTLorentzVector&  RawParticle::momentum() const { return *this; }
00286 
00287 inline void RawParticle::setVertex(const XYZTLorentzVector& vtx) { myVertex = vtx; }
00288 inline void RawParticle::setVertex(double a, double b, double c, double d) { myVertex.SetXYZT(a,b,c,d); }
00289 
00290 inline void RawParticle::rotate(const RawParticle::Rotation3D& r) { 
00291   XYZVector v ( r(Vect()) ); SetXYZT(v.X(),v.Y(),v.Z(),E());
00292 }
00293 
00294 inline void RawParticle::rotate(const RawParticle::Rotation& r) { 
00295   XYZVector v ( r(Vect()) ); SetXYZT(v.X(),v.Y(),v.Z(),E());
00296 }
00297 
00298 inline void RawParticle::rotate(const RawParticle::RotationX& r) { 
00299   XYZVector v ( r(Vect()) ); SetXYZT(v.X(),v.Y(),v.Z(),E());
00300 }
00301 
00302 inline void RawParticle::rotate(const RawParticle::RotationY& r) { 
00303   XYZVector v ( r(Vect()) ); SetXYZT(v.X(),v.Y(),v.Z(),E());
00304 }
00305 
00306 inline void RawParticle::rotate(const RawParticle::RotationZ& r) { 
00307   XYZVector v ( r(Vect()) ); SetXYZT(v.X(),v.Y(),v.Z(),E());
00308 }
00309 
00310 inline void RawParticle::boost(const RawParticle::Boost& b) { 
00311   XYZTLorentzVector p ( b(momentum()) ); SetXYZT(p.Px(),p.Py(),p.Pz(),p.E());
00312 }
00313 
00314 inline void RawParticle::translate(const XYZVector& tr) { 
00315   myVertex.SetXYZT(X()+tr.X(),Y()+tr.Y(),Z()+tr.Z(),T());
00316 }
00317 
00318 
00319 
00320 
00321 
00322 #endif