CMS 3D CMS Logo

Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes

RawParticle Class Reference

#include <RawParticle.h>

Inheritance diagram for RawParticle:
BaseParticlePropagator ParticlePropagator

List of all members.

Public Types

typedef ROOT::Math::Boost Boost
typedef ROOT::Math::AxisAngle Rotation
typedef ROOT::Math::Rotation3D Rotation3D
typedef ROOT::Math::RotationX RotationX
typedef ROOT::Math::RotationY RotationY
typedef ROOT::Math::RotationZ RotationZ

Public Member Functions

void boost (double bx, double by, double bz)
void boost (const Boost &b)
double charge () const
 get the MEASURED charge
void chargeConjugate ()
double cos2Theta () const
 Cos**2(theta) is faster to determine than eta.
double cos2ThetaV () const
double et () const
 get the transverse energy
double eta () const
int isUsed () const
double mass () const
 get the MEASURED mass
const XYZTLorentzVectormomentum () const
 the momentum fourvector
RawParticleoperator= (const RawParticle &rhs)
double PDGcharge () const
 get the THEORETICAL charge
double PDGcTau () const
 get the THEORETICAL lifetime
double PDGmass () const
 get the THEORETICAL mass
std::string PDGname () const
 get the PDG name
int pid () const
 get the HEP particle ID number
void print () const
void printName () const
double r () const
 vertex radius
double R () const
 vertex radius
double r2 () const
 vertex radius**2
double R2 () const
 vertex radius**2
 RawParticle (const RawParticle &p)
 RawParticle ()
 RawParticle (const int id, const XYZTLorentzVector &p)
 RawParticle (const std::string name, const XYZTLorentzVector &p)
 RawParticle (const XYZTLorentzVector &p, const XYZTLorentzVector &xStart)
 RawParticle (const XYZTLorentzVector &p)
 RawParticle (double px, double py, double pz, double e)
void reUse ()
void rotate (const RotationY &r)
void rotate (const RotationZ &r)
void rotate (double rphi, const XYZVector &raxis)
void rotate (const Rotation &r)
void rotate (const Rotation3D &r)
void rotate (const RotationX &r)
void rotateX (double rphi)
void rotateY (double rphi)
void rotateZ (double rphi)
void setCharge (float q)
 set the MEASURED charge
void setID (const std::string name)
void setID (const int id)
void setMass (float m)
 set the RECONSTRUCTED mass
void setStatus (int istat)
void setT (const double t)
 set the time of creation
void setVertex (const XYZTLorentzVector &vtx)
 set the vertex
void setVertex (double xv, double yv, double zv, double tv)
int status () const
 get the particle status
double t () const
 vertex time
double T () const
 vertex time
void translate (const XYZVector &t)
void use ()
const XYZTLorentzVectorvertex () const
 the vertex fourvector
double x () const
 x of vertex
double X () const
 x of vertex
double y () const
 y of vertex
double Y () const
 y of vertex
double z () const
 z of vertex
double Z () const
 z of vertex
virtual ~RawParticle ()

Protected Attributes

double myCharge
 the MEASURED charge
int myId
 the particle id number HEP-PID
const ParticleDatamyInfo
 The pointer to the PDG info.
double myMass
 the RECONSTRUCTED mass
int myStatus
 the status code according to PYTHIA
int myUsed
 status of the locking
XYZTLorentzVector myVertex
 the four vector of the vertex

Private Member Functions

void init ()

Private Attributes

ParticleTabletab

Detailed Description

Definition at line 31 of file RawParticle.h.


Member Typedef Documentation

typedef ROOT::Math::Boost RawParticle::Boost

Definition at line 39 of file RawParticle.h.

typedef ROOT::Math::AxisAngle RawParticle::Rotation

Definition at line 34 of file RawParticle.h.

typedef ROOT::Math::Rotation3D RawParticle::Rotation3D

Definition at line 35 of file RawParticle.h.

typedef ROOT::Math::RotationX RawParticle::RotationX

Definition at line 36 of file RawParticle.h.

typedef ROOT::Math::RotationY RawParticle::RotationY

Definition at line 37 of file RawParticle.h.

typedef ROOT::Math::RotationZ RawParticle::RotationZ

Definition at line 38 of file RawParticle.h.


Constructor & Destructor Documentation

RawParticle::RawParticle ( )

Definition at line 18 of file RawParticle.cc.

References init().

                         {
  init();
}
RawParticle::~RawParticle ( ) [virtual]

Definition at line 68 of file RawParticle.cc.

                          {
  //  nParticles--;
}
RawParticle::RawParticle ( const XYZTLorentzVector p)

Construct from a fourvector. The fourvector is taken for the particle, the vertex is set to 0.

Definition at line 22 of file RawParticle.cc.

References init().

RawParticle::RawParticle ( const int  id,
const XYZTLorentzVector p 
)

Construct from a fourvector and a PID. The fourvector and PID are taken for the particle, the vertex is set to 0.

Definition at line 27 of file RawParticle.cc.

References init(), and setID().

  : XYZTLorentzVector(p) {
  this->init();
  this->setID(id);
}
RawParticle::RawParticle ( const std::string  name,
const XYZTLorentzVector p 
)

Construct from a fourvector and a name. The fourvector and name are taken for the particle, the vertex is set to 0.

Definition at line 34 of file RawParticle.cc.

References init(), and setID().

  : XYZTLorentzVector(p) {
  this->init();
  this->setID(name);
}
RawParticle::RawParticle ( const XYZTLorentzVector p,
const XYZTLorentzVector xStart 
)

Construct from 2 fourvectors. The first fourvector is taken for the particle, the second for its vertex.

Definition at line 41 of file RawParticle.cc.

References init(), and myVertex.

                                                           : 
  XYZTLorentzVector(p)
{
  init();
  myVertex = xStart;
}
RawParticle::RawParticle ( double  px,
double  py,
double  pz,
double  e 
)

Construct from fourmomentum components. Vertex is set to 0.

Definition at line 49 of file RawParticle.cc.

References init().

                                                                  : 
  XYZTLorentzVector(px,py,pz,e)
{
  init();
}
RawParticle::RawParticle ( const RawParticle p)

Copy constructor

Definition at line 55 of file RawParticle.cc.

References myCharge, myId, myInfo, myMass, myStatus, myUsed, myVertex, and tab.

                                                 : 
  XYZTLorentzVector(right.Px(),right.Py(),right.Pz(),right.E()) 
{
  myId     = right.myId; 
  myStatus = right.myStatus;
  myUsed   = right.myUsed;
  myCharge = right.myCharge;
  myMass   = right.myMass;
  myVertex = (right.myVertex);
  tab = (right.tab);
  myInfo = (right.myInfo);
}

Member Function Documentation

void RawParticle::boost ( double  bx,
double  by,
double  bz 
)

Boost the particle. The arguments are the $\beta$ values of the boost in x, y and z direction.

Warning:
What happens to the vertex?

Definition at line 182 of file RawParticle.cc.

References b, momentum(), and AlCaHLTBitMon_ParallelJobs::p.

Referenced by NuclearInteractionSimulator::compute().

                                                           {
  Boost b(betax,betay,betaz);
  XYZTLorentzVector p ( b * momentum() );
  SetXYZT(p.X(),p.Y(),p.Z(),p.T());
}
void RawParticle::boost ( const Boost b) [inline]

Definition at line 310 of file RawParticle.h.

References b, momentum(), and AlCaHLTBitMon_ParallelJobs::p.

                                                        { 
  XYZTLorentzVector p ( b(momentum()) ); SetXYZT(p.Px(),p.Py(),p.Pz(),p.E());
}
double RawParticle::charge ( void  ) const [inline]
void RawParticle::chargeConjugate ( )

Convert the particle to its charge conjugate state. This operation resets the particle ID to that of the charge conjugated particle (if one exists). Also the measured charge is multiplied by -1.

Definition at line 143 of file RawParticle.cc.

References myCharge, and myId.

                             {
  myId = -myId;
  myCharge = -1*myCharge;
}
double RawParticle::cos2Theta ( ) const [inline]

Cos**2(theta) is faster to determine than eta.

Definition at line 267 of file RawParticle.h.

Referenced by KineParticleFilter::isOKForMe().

{ return Pz()*Pz()/Vect().Mag2(); }
double RawParticle::cos2ThetaV ( ) const [inline]
double RawParticle::et ( ) const

get the transverse energy

Definition at line 306 of file RawParticle.cc.

References mag2(), momentum(), and mathSSE::sqrt().

                      { 
  double mypp, tmpEt=-1.;
  
  mypp = std::sqrt(momentum().mag2());
  if ( mypp != 0 ) {
    tmpEt = E() * pt() / mypp;
  }
  return tmpEt;
}
double RawParticle::eta ( void  ) const [inline]

Get the pseudo rapidity of the particle. $ \eta = -\log ( \tan ( \vartheta/2)) $

Definition at line 266 of file RawParticle.h.

References create_public_lumi_plots::log, funct::tan(), and theta().

Referenced by EcalHitMaker::preshowerCellLine().

{ return -std::log(std::tan(this->theta()/2.)); }
void RawParticle::init ( void  ) [private]

Reimplemented in BaseParticlePropagator.

Definition at line 90 of file RawParticle.cc.

References instance, myCharge, myId, myInfo, myMass, myStatus, myUsed, and tab.

Referenced by RawParticle().

int RawParticle::isUsed ( ) const [inline]

Is the particle marked as used. The three methods isUsed(), use() and reUse() implement a simple locking mechanism.

Definition at line 233 of file RawParticle.h.

References myUsed.

{return myUsed;}
double RawParticle::mass ( ) const [inline]
const XYZTLorentzVector & RawParticle::momentum ( ) const [inline]
RawParticle & RawParticle::operator= ( const RawParticle rhs)

Copy assignment operator

Definition at line 73 of file RawParticle.cc.

References myCharge, myId, myInfo, myMass, myStatus, myUsed, myVertex, and tab.

                                                   {
  //  cout << "Copy assignment " << endl;
  if (this != &right) { // don't copy into yourself
    this->SetXYZT(right.Px(),right.Py(),right.Pz(),right.E());
    myId     = right.myId; 
    myStatus = right.myStatus;
    myUsed   = right.myUsed;
    myCharge = right.myCharge;
    myMass   = right.myMass;
    myVertex = right.myVertex;
    tab      = right.tab;
    myInfo   = right.myInfo;
  }
  return *this;
}
double RawParticle::PDGcharge ( ) const

get the THEORETICAL charge

Definition at line 245 of file RawParticle.cc.

References myInfo, and lumiQueryAPI::q.

                             { 
  double q=-99999;
  if ( myInfo ) {
    q=myInfo->charge();
  }
  return q;
}
double RawParticle::PDGcTau ( ) const

get the THEORETICAL lifetime

Definition at line 263 of file RawParticle.cc.

References abs, myId, myInfo, and w().

Referenced by ParticlePropagator::initProperDecayTime().

                           {
  double ct=1E99;
  if ( myInfo ) {

    // The lifetime is 0. in the Pythia Particle Data Table !
    //    ct=tab->theTable()->particle(ParticleID(myId))->lifetime().value();

    // Get it from the width (apparently Gamma/c!)
    double w = myInfo->totalWidth().value();
    if ( w != 0. && myId != 1000022 ) { 
      ct = 6.582119e-25 / w / 10.;   // ctau in cm 
    } else {
    // Temporary fix of a bug in the particle data table
      unsigned amyId = abs(myId);
      if ( amyId != 22 &&    // photon 
           amyId != 11 &&    // e+/-
           amyId != 10 &&    // nu_e
           amyId != 12 &&    // nu_mu
           amyId != 14 &&    // nu_tau
           amyId != 1000022 && // Neutralino
           amyId != 1000039 && // Gravitino
           amyId != 2112 &&  // neutron/anti-neutron
           amyId != 2212 &&  // proton/anti-proton
           amyId != 101 &&   // Deutreron etc..
           amyId != 102 &&   // Deutreron etc..
           amyId != 103 &&   // Deutreron etc..
           amyId != 104 ) {  // Deutreron etc.. 
        ct = 0.;
        /* */
      }
    }
  }

  /*
  std::cout << setw(20) << setprecision(18) 
       << "myId/ctau/width = " << myId << " " 
       << ct << " " << w << endl;  
  */

  return ct;
}
double RawParticle::PDGmass ( ) const

get the THEORETICAL mass

Definition at line 254 of file RawParticle.cc.

References m, and myInfo.

Referenced by FBaseSimEvent::addSimTrack().

                            { 
  double m=-99999;
  if ( myInfo ) {
    m = myInfo->mass().value();
  }
  return m;
}
std::string RawParticle::PDGname ( ) const

get the PDG name

Definition at line 188 of file RawParticle.cc.

References myInfo, and tab.

Referenced by printName().

                                     {
  std::string MyParticleName;
  if ( tab && myInfo ) {
    MyParticleName = myInfo->name();
  } else {
    MyParticleName = "unknown  ";
  }
  return (std::string) MyParticleName;}
int RawParticle::pid ( ) const [inline]
void RawParticle::print ( void  ) const

Print the formated particle information. The format is: NAME______PX______PY______PZ______E_______Mtheo___Mrec____Qrec____X_______Y_______Z_______T_______

Definition at line 211 of file RawParticle.cc.

References charge(), gather_cfg::cout, mass(), printName(), status(), T(), X(), Y(), and Z().

                         {
  printName();
  std::cout << std::setw(3) << status();
  std::cout.setf(std::ios::fixed, std::ios::floatfield);
  std::cout.setf(std::ios::right, std::ios::adjustfield);
  std::cout << std::setw(8) << std::setprecision(2) << Px();
  std::cout << std::setw(8) << std::setprecision(2) << Py();
  std::cout << std::setw(8) << std::setprecision(2) << Pz();
  std::cout << std::setw(8) << std::setprecision(2) << E();
  std::cout << std::setw(8) << std::setprecision(2) << M();
  std::cout << std::setw(8) << std::setprecision(2) << mass();
  std::cout << std::setw(8) << std::setprecision(2) << charge();
  std::cout << std::setw(8) << std::setprecision(2) << X();
  std::cout << std::setw(8) << std::setprecision(2) << Y();
  std::cout << std::setw(8) << std::setprecision(2) << Z();
  std::cout << std::setw(8) << std::setprecision(2) << T();
  std::cout << std::setw(0) << std::endl;
}
void RawParticle::printName ( ) const

Print the name of the particle. The name is deduced from the particle ID using a particle data table. It is printed with a length of 10 characters. If the id number cannot be found in the table "unknown" is printed as name.

Definition at line 199 of file RawParticle.cc.

References gather_cfg::cout, gen::k, and PDGname().

Referenced by print().

                             {
  std::string MyParticleName = PDGname();
  if (MyParticleName.length() != 0) {
    std::cout <<  MyParticleName;
    for(unsigned int k=0;k<9-MyParticleName.length() && k<10; k++) 
      std::cout << " " ;
  } else {
    std::cout << "unknown  ";
  }
}
double RawParticle::r ( ) const [inline]
double RawParticle::R ( ) const [inline]
double RawParticle::r2 ( ) const [inline]

vertex radius**2

Definition at line 280 of file RawParticle.h.

References myVertex.

Referenced by BaseParticlePropagator::propagateToBeamCylinder(), and r().

{ return myVertex.Perp2(); }
double RawParticle::R2 ( ) const [inline]
void RawParticle::reUse ( ) [inline]

Unlock the particle, see isUsed()

Definition at line 241 of file RawParticle.h.

References myUsed.

{ myUsed = 0;}  
void RawParticle::rotate ( const RotationX r) [inline]

Definition at line 298 of file RawParticle.h.

References r(), and v.

                                                             { 
  XYZVector v ( r(Vect()) ); SetXYZT(v.X(),v.Y(),v.Z(),E());
}
void RawParticle::rotate ( const RotationY r) [inline]

Definition at line 302 of file RawParticle.h.

References r(), and v.

                                                             { 
  XYZVector v ( r(Vect()) ); SetXYZT(v.X(),v.Y(),v.Z(),E());
}
void RawParticle::rotate ( const RotationZ r) [inline]

Definition at line 306 of file RawParticle.h.

References r(), and v.

                                                             { 
  XYZVector v ( r(Vect()) ); SetXYZT(v.X(),v.Y(),v.Z(),E());
}
void RawParticle::rotate ( double  rphi,
const XYZVector raxis 
)

Rotate the particle around an axis in space. The arguments give the amount to rotate rphi in radian and a vector raxis in 3D space around which the rotation is done. The vertex is rotated using the same transformation.

Definition at line 154 of file RawParticle.cc.

References r(), and v.

Referenced by NuclearInteractionSimulator::compute(), BremsstrahlungSimulator::compute(), MultipleScatteringSimulator::compute(), and MuonBremsstrahlungSimulator::compute().

                                                        {
  Rotation r(raxis,angle);
  XYZVector v(r * Vect());
  SetXYZT(v.X(),v.Y(),v.Z(),E());
}
void RawParticle::rotate ( const Rotation r) [inline]

Definition at line 294 of file RawParticle.h.

References r(), and v.

                                                            { 
  XYZVector v ( r(Vect()) ); SetXYZT(v.X(),v.Y(),v.Z(),E());
}
void RawParticle::rotate ( const Rotation3D r) [inline]

Definition at line 290 of file RawParticle.h.

References r(), and v.

                                                              { 
  XYZVector v ( r(Vect()) ); SetXYZT(v.X(),v.Y(),v.Z(),E());
}
void RawParticle::rotateX ( double  rphi)
Warning:
not yet implemented Rotate around x axis. Rotate rphi radian around the x axis. The Vertex is rotated as well.

Definition at line 161 of file RawParticle.cc.

References r(), and v.

                                {
  RotationX r(rphi);
  XYZVector v(r * Vect());
  SetXYZT(v.X(),v.Y(),v.Z(),E());
}
void RawParticle::rotateY ( double  rphi)

Rotate around z axis. Rotate rphi radian around the z axis. The Vertex is rotated as well.

Definition at line 168 of file RawParticle.cc.

References r(), and v.

                                {
  RotationY r(rphi);
  XYZVector v(r * Vect());
  SetXYZT(v.X(),v.Y(),v.Z(),E());
}
void RawParticle::rotateZ ( double  rphi)

Rotate around z axis. Rotate rphi radian around the z axis. The Vertex is rotated as well.

Definition at line 175 of file RawParticle.cc.

References r(), and v.

                                {
  RotationZ r(rphi);
  XYZVector v(r * Vect());
  SetXYZT(v.X(),v.Y(),v.Z(),E());
}
void RawParticle::setCharge ( float  q)
void RawParticle::setID ( const std::string  name)

Set identifier for this particle. This should be a standard HEP-PID name. It will be used to deduce the particle properties from a particle data table.

Definition at line 114 of file RawParticle.cc.

References myCharge, myId, myInfo, myMass, tab, and ParticleTable::theTable().

                                       {
  if ( tab ) { 
    if ( !myInfo ) myInfo = tab->theTable()->particle(name);
    if ( myInfo ) { 
      myId = myInfo->pid();
      myCharge = myInfo->charge();
      myMass   = myInfo->mass().value();
    } else {
      myId = 0;
    }
  }
}
void RawParticle::setID ( const int  id)

Set identifier for this particle. This should be a standard HEP-PID number. It will be used to deduce the name and the properties of the particle from a particle data table.

Definition at line 101 of file RawParticle.cc.

References errorMatrix2Lands_multiChannel::id, myCharge, myId, myInfo, myMass, RecoTau_DiTaus_pt_20-420_cfg::ParticleID, tab, and ParticleTable::theTable().

Referenced by MuonSimHitProducer::applyMaterialEffects(), NuclearInteractionSimulator::compute(), CalorimetryManager::MuonMipSimulation(), PileUpSimulator::produce(), and RawParticle().

                               {
  myId = id;
  if ( tab ) {
    if ( !myInfo ) 
      myInfo = tab->theTable()->particle(HepPDT::ParticleID(myId));
    if ( myInfo ) { 
      myCharge = myInfo->charge();
      myMass   = myInfo->mass().value();
    }
  }
}
void RawParticle::setMass ( float  m)

set the RECONSTRUCTED mass

Definition at line 133 of file RawParticle.cc.

References m, and myMass.

                            {
  myMass = m;
}
void RawParticle::setStatus ( int  istat)

Set the status of this particle. The coding follows PYTHIAs convention: 1 = stable

Definition at line 128 of file RawParticle.cc.

References myStatus.

                                {
  myStatus = istat;
}
void RawParticle::setT ( const double  t)

set the time of creation

Definition at line 149 of file RawParticle.cc.

References myVertex.

                                {
  myVertex.SetE(t);
}
void RawParticle::setVertex ( double  xv,
double  yv,
double  zv,
double  tv 
) [inline]

Definition at line 288 of file RawParticle.h.

References myVertex.

{ myVertex.SetXYZT(a,b,c,d); }
void RawParticle::setVertex ( const XYZTLorentzVector vtx) [inline]
int RawParticle::status ( void  ) const [inline]

get the particle status

Definition at line 265 of file RawParticle.h.

References myStatus.

Referenced by RawStableParticleFilter::isOKForMe(), operator<<(), and print().

{ return myStatus; }
double RawParticle::t ( ) const [inline]

vertex time

Definition at line 272 of file RawParticle.h.

References myVertex.

Referenced by FBaseSimEvent::addSimTrack(), and BaseParticlePropagator::setProperDecayTime().

{ return myVertex.E(); }
double RawParticle::T ( ) const [inline]

vertex time

Definition at line 276 of file RawParticle.h.

References myVertex.

Referenced by Pythia6Decays::particleDaughters(), print(), BaseParticlePropagator::propagate(), and translate().

{ return myVertex.E(); }
void RawParticle::translate ( const XYZVector t) [inline]

Translate the vertex by a given space amount

Definition at line 314 of file RawParticle.h.

References myVertex, T(), X(), Y(), and Z().

Referenced by MultipleScatteringSimulator::compute().

                                                      { 
  myVertex.SetXYZT(X()+tr.X(),Y()+tr.Y(),Z()+tr.Z(),T());
}
void RawParticle::use ( ) [inline]

Lock the particle, see isUsed()

Definition at line 237 of file RawParticle.h.

References myUsed.

{ myUsed = 1;}    
const XYZTLorentzVector & RawParticle::vertex ( ) const [inline]
double RawParticle::x ( ) const [inline]

x of vertex

Definition at line 269 of file RawParticle.h.

References myVertex.

Referenced by PFSimParticleProducer::produce().

{ return myVertex.Px(); }
double RawParticle::X ( ) const [inline]
double RawParticle::y ( ) const [inline]

y of vertex

Definition at line 270 of file RawParticle.h.

References myVertex.

Referenced by PFSimParticleProducer::produce().

{ return myVertex.Py(); }
double RawParticle::Y ( ) const [inline]
double RawParticle::z ( ) const [inline]
double RawParticle::Z ( ) const [inline]

Member Data Documentation

double RawParticle::myCharge [protected]

the MEASURED charge

Definition at line 253 of file RawParticle.h.

Referenced by charge(), chargeConjugate(), init(), operator=(), RawParticle(), setCharge(), and setID().

int RawParticle::myId [protected]

the particle id number HEP-PID

Definition at line 250 of file RawParticle.h.

Referenced by chargeConjugate(), init(), operator=(), PDGcTau(), pid(), RawParticle(), and setID().

const ParticleData* RawParticle::myInfo [protected]

The pointer to the PDG info.

Definition at line 255 of file RawParticle.h.

Referenced by init(), operator=(), PDGcharge(), PDGcTau(), PDGmass(), PDGname(), RawParticle(), and setID().

double RawParticle::myMass [protected]

the RECONSTRUCTED mass

Definition at line 254 of file RawParticle.h.

Referenced by init(), mass(), operator=(), RawParticle(), setID(), and setMass().

int RawParticle::myStatus [protected]

the status code according to PYTHIA

Definition at line 251 of file RawParticle.h.

Referenced by init(), operator=(), RawParticle(), setStatus(), and status().

int RawParticle::myUsed [protected]

status of the locking

Definition at line 252 of file RawParticle.h.

Referenced by init(), isUsed(), operator=(), RawParticle(), reUse(), and use().

the four vector of the vertex

Definition at line 249 of file RawParticle.h.

Referenced by cos2ThetaV(), operator=(), R2(), r2(), RawParticle(), setT(), setVertex(), T(), t(), translate(), vertex(), x(), X(), y(), Y(), z(), and Z().

Definition at line 258 of file RawParticle.h.

Referenced by init(), operator=(), PDGname(), RawParticle(), and setID().