CMS 3D CMS Logo

Public Member Functions | Private Attributes

ParticlePropagator Class Reference

#include <ParticlePropagator.h>

Inheritance diagram for ParticlePropagator:
BaseParticlePropagator RawParticle

List of all members.

Public Member Functions

double fieldMap (double x, double y, double z)
double fieldMap (const TrackerLayer &layer, double coord, int success)
void initProperDecayTime ()
 ParticlePropagator ()
 Default c'tor.
 ParticlePropagator (const RawParticle &myPart, double R, double Z, const MagneticFieldMap *aFieldMap, const RandomEngine *engine)
 ParticlePropagator (const BaseParticlePropagator &myPropPart, const MagneticFieldMap *aFieldMap)
 ParticlePropagator (const XYZTLorentzVector &p, const XYZTLorentzVector &v, float q, const MagneticFieldMap *aFieldMap)
 ParticlePropagator (const XYZTLorentzVector &p, const XYZVector &v, float q, const MagneticFieldMap *aFieldMap)
 ParticlePropagator (const RawParticle &myPart, const MagneticFieldMap *aFieldMap, const RandomEngine *engine)
 ParticlePropagator (const FSimTrack &simTrack, const MagneticFieldMap *aFieldMap, const RandomEngine *engine)
 ParticlePropagator (const ParticlePropagator &myPropPart)
ParticlePropagator propagated () const
bool propagateToBoundSurface (const TrackerLayer &)
bool propagateToClosestApproach (double x0=0., double y0=0., bool first=true)
bool propagateToNominalVertex (const XYZTLorentzVector &hit2=XYZTLorentzVector(0., 0., 0., 0.))
void setPropagationConditions (const TrackerLayer &, bool firstLoop=true)

Private Attributes

const RandomEnginerandom
const MagneticFieldMaptheFieldMap

Detailed Description

Definition at line 27 of file ParticlePropagator.h.


Constructor & Destructor Documentation

ParticlePropagator::ParticlePropagator ( )

Default c'tor.

Definition at line 13 of file ParticlePropagator.cc.

Referenced by propagated().

ParticlePropagator::ParticlePropagator ( const RawParticle myPart,
double  R,
double  Z,
const MagneticFieldMap aFieldMap,
const RandomEngine engine 
)

Constructor taking as arguments a RawParticle, as well as the radius, half-height and magnetic field defining the cylinder for which propagation is to be performed

Definition at line 16 of file ParticlePropagator.cc.

References fieldMap(), initProperDecayTime(), BaseParticlePropagator::setMagneticField(), RawParticle::X(), RawParticle::Y(), and RawParticle::Z().

                                                                   :
  BaseParticlePropagator(myPart,RCyl,ZCyl,0.),
  theFieldMap(aFieldMap),
  random(engine)
{
  setMagneticField(fieldMap(X(),Y(),Z()));
  initProperDecayTime();
}
ParticlePropagator::ParticlePropagator ( const RawParticle myPart,
const MagneticFieldMap aFieldMap,
const RandomEngine engine 
)

Constructor with only a RawParticle as argument for subsequent propagation to known surfaces (ECAL, HCAL ...)

Definition at line 28 of file ParticlePropagator.cc.

References fieldMap(), initProperDecayTime(), BaseParticlePropagator::setMagneticField(), RawParticle::X(), RawParticle::Y(), and RawParticle::Z().

                                                                    : 
  BaseParticlePropagator(myPart,0.,0.,0.),
  theFieldMap(aFieldMap),
  random(engine)
 
{
  setMagneticField(fieldMap(X(),Y(),Z()));
  initProperDecayTime();
}
ParticlePropagator::ParticlePropagator ( const XYZTLorentzVector p,
const XYZTLorentzVector v,
float  q,
const MagneticFieldMap aFieldMap 
)

Constructor with two LorentzVector (momentum and vertex (in cm)) and an electric charge propagation to known surfaces (ECAL, HCAL ...)

Definition at line 40 of file ParticlePropagator.cc.

References fieldMap(), RawParticle::setCharge(), BaseParticlePropagator::setMagneticField(), RawParticle::X(), RawParticle::Y(), and RawParticle::Z().

                                                                          :
  BaseParticlePropagator(RawParticle(mom,vert),0.,0.,0.),
  theFieldMap(aFieldMap),
  random(0)
{
  setCharge(q);
  setMagneticField(fieldMap(X(),Y(),Z()));
}
ParticlePropagator::ParticlePropagator ( const XYZTLorentzVector p,
const XYZVector v,
float  q,
const MagneticFieldMap aFieldMap 
)

Constructor with a LorentzVector (momentum), a Hep3Vector (vertex in cm) and an electric charge propagation to known surfaces (ECAL, HCAL ...)

Definition at line 51 of file ParticlePropagator.cc.

References fieldMap(), RawParticle::setCharge(), BaseParticlePropagator::setMagneticField(), RawParticle::X(), RawParticle::Y(), and RawParticle::Z().

                                                                          :
  BaseParticlePropagator(
    RawParticle(mom,XYZTLorentzVector(vert.X(),vert.Y(),vert.Z(),0.0)),0.,0.,0.),
  theFieldMap(aFieldMap),
  random(0)
{
  setCharge(q);
  setMagneticField(fieldMap(X(),Y(),Z()));
}
ParticlePropagator::ParticlePropagator ( const FSimTrack simTrack,
const MagneticFieldMap aFieldMap,
const RandomEngine engine 
)

Constructor with a FSimTrack from the FSimEvent

Definition at line 63 of file ParticlePropagator.cc.

References FSimTrack::decayTime(), fieldMap(), initProperDecayTime(), FSimTrack::nDaughters(), FSimVertex::position(), BaseParticlePropagator::setMagneticField(), BaseParticlePropagator::setProperDecayTime(), RawParticle::setVertex(), FSimTrack::vertex(), RawParticle::X(), RawParticle::Y(), and RawParticle::Z().

                                                                   : 
  BaseParticlePropagator(RawParticle(simTrack.type(),simTrack.momentum()),
                         0.,0.,0.),
  theFieldMap(aFieldMap),
  random(engine)
{
  setVertex(simTrack.vertex().position());
  setMagneticField(fieldMap(X(),Y(),Z()));
  if ( simTrack.decayTime() < 0. ) { 
    if ( simTrack.nDaughters() ) 
      // This particle already decayed, don't decay it twice
      this->setProperDecayTime(1E99);
    else
      // This particle hasn't decayed yet. Decay time according to particle lifetime
      initProperDecayTime();
  } else {
    // Decay time pre-defined at generator level 
    this->setProperDecayTime(simTrack.decayTime());
  }
}
ParticlePropagator::ParticlePropagator ( const ParticlePropagator myPropPart)

Constructor with a (Base)ParticlePropagator

Definition at line 86 of file ParticlePropagator.cc.

                                                                           :
  BaseParticlePropagator(myPropPart),
  theFieldMap(myPropPart.theFieldMap)
{  
  //  setMagneticField(fieldMap(x(),y(),z()));
}
ParticlePropagator::ParticlePropagator ( const BaseParticlePropagator myPropPart,
const MagneticFieldMap aFieldMap 
)

Member Function Documentation

double ParticlePropagator::fieldMap ( double  x,
double  y,
double  z 
)

The fieldMap given by the detector geormetry

Definition at line 134 of file ParticlePropagator.cc.

References RawParticle::charge(), MagneticFieldMap::inTeslaZ(), and theFieldMap.

Referenced by ParticlePropagator(), propagateToBoundSurface(), propagateToClosestApproach(), and propagateToNominalVertex().

                                                           {
  // Arguments now passed in cm.
  //  return MagneticFieldMap::instance()->inTesla(GlobalPoint(xx/10.,yy/10.,zz/10.)).z();
  // Return a dummy value for neutral particles!
  return charge() == 0.0 || theFieldMap == 0 ? 
    4. : theFieldMap->inTeslaZ(GlobalPoint(xx,yy,zz));
}
double ParticlePropagator::fieldMap ( const TrackerLayer layer,
double  coord,
int  success 
)

Definition at line 143 of file ParticlePropagator.cc.

References RawParticle::charge(), MagneticFieldMap::inTeslaZ(), and theFieldMap.

                                                                                 {
  // Arguments now passed in cm.
  //  return MagneticFieldMap::instance()->inTesla(GlobalPoint(xx/10.,yy/10.,zz/10.)).z();
  // Return a dummy value for neutral particles!
  return charge() == 0.0 || theFieldMap == 0 ? 
    4. : theFieldMap->inTeslaZ(layer,coord,success);
}
void ParticlePropagator::initProperDecayTime ( )

Initialize the proper decay time of the particle

Definition at line 103 of file ParticlePropagator.cc.

References abs, RandomEngine::flatShoot(), funct::log(), RawParticle::PDGcTau(), RawParticle::pid(), BaseParticlePropagator::properDecayTime, random, and BaseParticlePropagator::setProperDecayTime().

Referenced by ParticlePropagator().

                                        {

  // And this is the proper time at which the particle will decay
  double properDecayTime = 
    (pid()==0||pid()==22||abs(pid())==11||abs(pid())==2112||abs(pid())==2212||
     !random) ?
    1E99 : -PDGcTau() * std::log(random->flatShoot());

  this->setProperDecayTime(properDecayTime);

}
ParticlePropagator ParticlePropagator::propagated ( ) const

Return a new instance, corresponding to the particle propagated to the surface of the cylinder

Reimplemented from BaseParticlePropagator.

Definition at line 129 of file ParticlePropagator.cc.

References ParticlePropagator(), BaseParticlePropagator::propagated(), and theFieldMap.

bool ParticlePropagator::propagateToBoundSurface ( const TrackerLayer layer)

Definition at line 152 of file ParticlePropagator.cc.

References TrackerLayer::disk(), TrackerLayer::diskInnerRadius(), generateEDF::done, BaseParticlePropagator::fiducial, fieldMap(), BaseParticlePropagator::hasDecayed(), BaseParticlePropagator::propagate(), RawParticle::r(), BaseParticlePropagator::setMagneticField(), BaseParticlePropagator::success, and RawParticle::z().

Referenced by TrajectoryManager::propagateToLayer().

                                                                     {


  fiducial = true;
  BoundDisk* disk = layer.disk();
  //  bool disk = layer.forward();
  //  double innerradius=-999;
  double innerradius = disk ? layer.diskInnerRadius() : -999. ;

  //  if( disk ) {
    //    const Surface& surface = layer.surface();
    //    const BoundDisk & myDisk = dynamic_cast<const BoundDisk&>(surface);
    //    innerradius=myDisk.innerRadius();       
  //    innerradius=myDisk->innerRadius();        
  //  }

  bool done = propagate();

  // Set the magnetic field at the new location (if succesfully propagated)
  if ( done && !hasDecayed() ) { 
    if ( success == 2 ) 
      setMagneticField(fieldMap(layer,r(),success));
    else if ( success == 1 )
      setMagneticField(fieldMap(layer,z(),success));
  }     
       
  // There is some real material here
  fiducial = !(!disk &&  success!=1) &&
             !( disk && (success!=2  || r()<innerradius));

  return done;
}
bool ParticlePropagator::propagateToClosestApproach ( double  x0 = 0.,
double  y0 = 0.,
bool  first = true 
)

Update the particle after propagation to the closest approach from Z axis, to the preshower layer 1 & 2, to the ECAL entrance, to the HCAL entrance, the HCAL 2nd and 3rd layer (not coded yet), the VFCAL entrance, or any BoundSurface(disk or cylinder)

Reimplemented from BaseParticlePropagator.

Definition at line 117 of file ParticlePropagator.cc.

References fieldMap(), and BaseParticlePropagator::setMagneticField().

bool ParticlePropagator::propagateToNominalVertex ( const XYZTLorentzVector hit2 = XYZTLorentzVector(0.,0.,0.,0.))
void ParticlePropagator::setPropagationConditions ( const TrackerLayer layer,
bool  firstLoop = true 
)

Definition at line 186 of file ParticlePropagator.cc.

References BoundSurface::bounds(), TrackerLayer::cylinder(), TrackerLayer::disk(), TrackerLayer::diskOuterRadius(), BaseParticlePropagator::firstLoop, TrackerLayer::forward(), Bounds::length(), GloballyPositioned< T >::position(), and Bounds::width().

Referenced by ConvBremSeedProducer::produce(), and TrajectoryManager::propagateToLayer().

                                                             { 
  // Set the magentic field
  // setMagneticField(fieldMap(x(),y(),z()));

  // Set R and Z according to the Tracker Layer characteristics.
  //  const Surface& surface = layer.surface();

  if( layer.forward() ) {

    //    const BoundDisk & myDisk = dynamic_cast<const BoundDisk&>(surface);
    // ParticlePropagator works in mm, whereas the detector geometry is in cm
    BaseParticlePropagator::setPropagationConditions(
                                  layer.diskOuterRadius(),
                                  fabs(layer.disk()->position().z()),
                                  firstLoop);       

  // ... or if it is a cylinder barrel 
  } else {

    //    const BoundCylinder & myCylinder = dynamic_cast<const BoundCylinder &>(surface);
    // ParticlePropagator works now in cm
    BaseParticlePropagator::setPropagationConditions(
                                         layer.cylinder()->bounds().width()/2.,
                                         layer.cylinder()->bounds().length()/2.,
                                         firstLoop);
  }

}

Member Data Documentation

Definition at line 97 of file ParticlePropagator.h.

Referenced by initProperDecayTime().

Definition at line 96 of file ParticlePropagator.h.

Referenced by fieldMap(), and propagated().