Changeset View
Changeset View
Standalone View
Standalone View
EvtGenBase/EvtParticle.hh
Show First 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | class EvtParticle { | ||||
*/ | */ | ||||
void setChannel( int i ); | void setChannel( int i ); | ||||
/** | /** | ||||
* Creates the daughters in the list of ids and | * Creates the daughters in the list of ids and | ||||
* adds them to the parent. Note that momentum | * adds them to the parent. Note that momentum | ||||
* is left uninitialized, this is _only_ creation. | * is left uninitialized, this is _only_ creation. | ||||
*/ | */ | ||||
void makeDaughters( unsigned int ndaug, EvtId* id ); | void makeDaughters( size_t ndaug, EvtId* id ); | ||||
/** | /** | ||||
* Creates the daughters in the list of ids and | * Creates the daughters in the list of ids and | ||||
* adds them to the parent. Note that momentum | * adds them to the parent. Note that momentum | ||||
* is left uninitialized, this is _only_ creation. | * is left uninitialized, this is _only_ creation. | ||||
*/ | */ | ||||
void makeDaughters( unsigned int ndaug, std::vector<EvtId> idVector ); | void makeDaughters( size_t ndaug, std::vector<EvtId> idVector ); | ||||
/** | /** | ||||
* Similar to the routine above except that here | * Similar to the routine above except that here | ||||
* momentum is generated according to phase space | * momentum is generated according to phase space | ||||
* daughters are filled with this momentum. | * daughters are filled with this momentum. | ||||
*/ | */ | ||||
double initializePhaseSpace( unsigned int numdaughter, EvtId* daughters, | double initializePhaseSpace( size_t numdaughter, EvtId* daughters, | ||||
bool forceResetMasses = false, | bool forceResetMasses = false, | ||||
double poleSize = -1., int whichTwo1 = 0, | double poleSize = -1., int whichTwo1 = 0, | ||||
int whichTwo2 = 1 ); | int whichTwo2 = 1 ); | ||||
/** | /** | ||||
* Get pointer the the i:th daugther. | * Get pointer the the i:th daugther. | ||||
*/ | */ | ||||
EvtParticle* getDaug( const int i ) { return _daug[i]; } | EvtParticle* getDaug( const int i ) { return m_daug[i]; } | ||||
/** | /** | ||||
* Get const pointer the the i:th daugther. | * Get const pointer the the i:th daugther. | ||||
*/ | */ | ||||
const EvtParticle* getDaug( const int i ) const { return _daug[i]; } | const EvtParticle* getDaug( const int i ) const { return m_daug[i]; } | ||||
/** | /** | ||||
* Iterates over the particles in a decay chain. | * Iterates over the particles in a decay chain. | ||||
*/ | */ | ||||
EvtParticle* nextIter( EvtParticle* rootOfTree = 0 ); | EvtParticle* nextIter( EvtParticle* rootOfTree = 0 ); | ||||
/** | /** | ||||
* Makes stdhep list | * Makes stdhep list | ||||
Show All 31 Lines | class EvtParticle { | ||||
*/ | */ | ||||
EvtParticle* getParent() const; | EvtParticle* getParent() const; | ||||
/** | /** | ||||
* Makes partptr the idaug:th daugther. | * Makes partptr the idaug:th daugther. | ||||
*/ | */ | ||||
void insertDaugPtr( int idaug, EvtParticle* partptr ) | void insertDaugPtr( int idaug, EvtParticle* partptr ) | ||||
{ | { | ||||
_daug[idaug] = partptr; | m_daug[idaug] = partptr; | ||||
partptr->_parent = this; | partptr->m_parent = this; | ||||
} | } | ||||
/** | /** | ||||
* Returns mass of particle. | * Returns mass of particle. | ||||
*/ | */ | ||||
double mass() const; | double mass() const; | ||||
/** | /** | ||||
* Used internally to decide if first time particle is decayed. | * Used internally to decide if first time particle is decayed. | ||||
Show All 29 Lines | class EvtParticle { | ||||
*/ | */ | ||||
const EvtVector4R& getP4() const; | const EvtVector4R& getP4() const; | ||||
/** | /** | ||||
* Sets the 4momentum in the parents restframe. | * Sets the 4momentum in the parents restframe. | ||||
*/ | */ | ||||
void setP4( const EvtVector4R& p4 ) | void setP4( const EvtVector4R& p4 ) | ||||
{ | { | ||||
_p = p4; | m_p = p4; | ||||
_pBeforeFSR = p4; | m_pBeforeFSR = p4; | ||||
} | } | ||||
void setP4WithFSR( const EvtVector4R& p4 ) { _p = p4; } | void setP4WithFSR( const EvtVector4R& p4 ) { m_p = p4; } | ||||
void setFSRP4toZero() { _pBeforeFSR.set( 0.0, 0.0, 0.0, 0.0 ); } | void setFSRP4toZero() { m_pBeforeFSR.set( 0.0, 0.0, 0.0, 0.0 ); } | ||||
/** | /** | ||||
* Retunrs the decay channel. | * Retunrs the decay channel. | ||||
*/ | */ | ||||
int getChannel() const; | int getChannel() const; | ||||
/** | /** | ||||
* Returns number of daugthers. | * Returns number of daugthers. | ||||
*/ | */ | ||||
size_t getNDaug() const; | size_t getNDaug() const; | ||||
void resetNDaug() | void resetNDaug() | ||||
{ | { | ||||
_ndaug = 0; | m_ndaug = 0; | ||||
return; | return; | ||||
} | } | ||||
/** | /** | ||||
* Prints out the particle "tree" of a given particle. The | * Prints out the particle "tree" of a given particle. The | ||||
* tree consists of all daughters (and their daughters, etc) | * tree consists of all daughters (and their daughters, etc) | ||||
* and their properties. | * and their properties. | ||||
*/ | */ | ||||
Show All 34 Lines | class EvtParticle { | ||||
*/ | */ | ||||
void setVectorSpinDensity(); | void setVectorSpinDensity(); | ||||
/** | /** | ||||
* Set forward spin density matrix. | * Set forward spin density matrix. | ||||
*/ | */ | ||||
void setSpinDensityForward( const EvtSpinDensity& rho ) | void setSpinDensityForward( const EvtSpinDensity& rho ) | ||||
{ | { | ||||
_rhoForward = rho; | m_rhoForward = rho; | ||||
} | } | ||||
/** | /** | ||||
* Set forward spin density matrix according to the density matrix | * Set forward spin density matrix according to the density matrix | ||||
* rho in the helicity amplitude basis. | * rho in the helicity amplitude basis. | ||||
*/ | */ | ||||
void setSpinDensityForwardHelicityBasis( const EvtSpinDensity& rho ); | void setSpinDensityForwardHelicityBasis( const EvtSpinDensity& rho ); | ||||
void setSpinDensityForwardHelicityBasis( const EvtSpinDensity& rho, | void setSpinDensityForwardHelicityBasis( const EvtSpinDensity& rho, | ||||
double alpha, double beta, | double alpha, double beta, | ||||
double gamma ); | double gamma ); | ||||
/** | /** | ||||
* Returns a rotation matrix need to rotate the basis state | * Returns a rotation matrix need to rotate the basis state | ||||
* to the helicity basis. The EvtSpinDensity matrix is just use | * to the helicity basis. The EvtSpinDensity matrix is just use | ||||
* as a matrix here. This function is to be implemented in each | * as a matrix here. This function is to be implemented in each | ||||
* derived class. | * derived class. | ||||
*/ | */ | ||||
virtual EvtSpinDensity rotateToHelicityBasis() const = 0; | virtual EvtSpinDensity rotateToHelicityBasis() const = 0; | ||||
virtual EvtSpinDensity rotateToHelicityBasis( double alpha, double beta, | virtual EvtSpinDensity rotateToHelicityBasis( double alpha, double beta, | ||||
double gamma ) const = 0; | double gamma ) const = 0; | ||||
/** | /** | ||||
* Get forward spin density matrix. | * Get forward spin density matrix. | ||||
*/ | */ | ||||
EvtSpinDensity getSpinDensityForward() { return _rhoForward; } | EvtSpinDensity getSpinDensityForward() { return m_rhoForward; } | ||||
/** | /** | ||||
* Set backward spin density matrix. | * Set backward spin density matrix. | ||||
*/ | */ | ||||
void setSpinDensityBackward( const EvtSpinDensity& rho ) | void setSpinDensityBackward( const EvtSpinDensity& rho ) | ||||
{ | { | ||||
_rhoBackward = rho; | m_rhoBackward = rho; | ||||
} | } | ||||
/** | /** | ||||
* Get backward spin density matrix. | * Get backward spin density matrix. | ||||
*/ | */ | ||||
EvtSpinDensity getSpinDensityBackward() { return _rhoBackward; } | EvtSpinDensity getSpinDensityBackward() { return m_rhoBackward; } | ||||
//Hacks will be removed when better solutions are thought of! | //Hacks will be removed when better solutions are thought of! | ||||
//This is used to suppress use of random numbers when doing initialization | //This is used to suppress use of random numbers when doing initialization | ||||
//of some models. | //of some models. | ||||
void noLifeTime() { _genlifetime = 0; } | void noLifeTime() { m_genlifetime = 0; } | ||||
//lange - April 29, 2002 | //lange - April 29, 2002 | ||||
void setId( EvtId id ) { _id = id; } | void setId( EvtId id ) { m_id = id; } | ||||
void initDecay( bool useMinMass = false ); | void initDecay( bool useMinMass = false ); | ||||
bool generateMassTree(); | bool generateMassTree(); | ||||
double compMassProb(); | double compMassProb(); | ||||
//setMass will blow away any existing 4vector | //setMass will blow away any existing 4vector | ||||
void setMass( double m ) { _p = EvtVector4R( m, 0.0, 0.0, 0.0 ); } | void setMass( double m ) { m_p = EvtVector4R( m, 0.0, 0.0, 0.0 ); } | ||||
//void setMixed() {_mix=true;} | //void setMixed() {m_mix=true;} | ||||
//void setUnMixed() {_mix=false;} | //void setUnMixed() {m_mix=false;} | ||||
//bool getMixed() {return _mix;} | //bool getMixed() {return m_mix;} | ||||
//void takeCConj() {EvtGenReport(EVTGEN_INFO,"EvtGen") << "should take conj\n";} | //void takeCConj() {EvtGenReport(EVTGEN_INFO,"EvtGen") << "should take conj\n";} | ||||
//this means that the particle has gone through initDecay | //this means that the particle has gone through initDecay | ||||
// and thus has a mass | // and thus has a mass | ||||
bool isInitialized() { return _isInit; } | bool isInitialized() { return m_isInit; } | ||||
bool hasValidP4() { return _validP4; } | bool hasValidP4() { return m_validP4; } | ||||
bool isDecayed() { return _isDecayed; } | bool isDecayed() { return m_isDecayed; } | ||||
// decay prob - only relevent if already decayed | // decay prob - only relevent if already decayed | ||||
// and is a scalar particle | // and is a scalar particle | ||||
// returned is a double* that should be prob/probMax | // returned is a double* that should be prob/probMax | ||||
double* decayProb() { return _decayProb; } | double* decayProb() { return m_decayProb; } | ||||
void setDecayProb( double p ); | void setDecayProb( double p ); | ||||
// Return the name of the particle (from the EvtId number) | // Return the name of the particle (from the EvtId number) | ||||
std::string getName() const; | std::string getName() const; | ||||
// Specify whether the particle has a special named attribute with | // Specify whether the particle has a special named attribute with | ||||
// a set value. By default, nothing is set, but derived classes | // a set value. By default, nothing is set, but derived classes | ||||
// can set this to mean something specific, e.g. if a photon is FSR | // can set this to mean something specific, e.g. if a photon is FSR | ||||
void setAttribute( std::string attName, int attValue ) | void setAttribute( std::string attName, int attValue ) | ||||
{ | { | ||||
_intAttributes[attName] = attValue; | m_intAttributes[attName] = attValue; | ||||
} | } | ||||
// Retrieve the integer value for the given attribute name | // Retrieve the integer value for the given attribute name | ||||
int getAttribute( std::string attName ); | int getAttribute( std::string attName ); | ||||
// Specify if the particle has a double attribute value, e.g. amplitude weight. | // Specify if the particle has a double attribute value, e.g. amplitude weight. | ||||
// By default, nothing is set, but derived classes can set this to mean something specific | // By default, nothing is set, but derived classes can set this to mean something specific | ||||
void setAttributeDouble( std::string attName, double attValue ) | void setAttributeDouble( std::string attName, double attValue ) | ||||
{ | { | ||||
_dblAttributes[attName] = attValue; | m_dblAttributes[attName] = attValue; | ||||
} | } | ||||
// Retrieve the double value for the given attribute name | // Retrieve the double value for the given attribute name | ||||
double getAttributeDouble( std::string attName ); | double getAttributeDouble( std::string attName ); | ||||
protected: | protected: | ||||
void setp( double e, double px, double py, double pz ) | void setp( double e, double px, double py, double pz ) | ||||
{ | { | ||||
_p.set( e, px, py, pz ); | m_p.set( e, px, py, pz ); | ||||
_pBeforeFSR = _p; | m_pBeforeFSR = m_p; | ||||
} | } | ||||
void setp( const EvtVector4R& p4 ) | void setp( const EvtVector4R& p4 ) | ||||
{ | { | ||||
_p = p4; | m_p = p4; | ||||
_pBeforeFSR = _p; | m_pBeforeFSR = m_p; | ||||
} | } | ||||
void setpart_num( EvtId particle_number ) | void setpart_num( EvtId particle_number ) | ||||
{ | { | ||||
assert( _channel == -10 || _id.getId() == particle_number.getId() || | assert( m_channel == -10 || m_id.getId() == particle_number.getId() || | ||||
_id.getId() == -1 ); | m_id.getId() == -1 ); | ||||
_id = particle_number; | m_id = particle_number; | ||||
} | } | ||||
bool _validP4; | bool m_validP4; | ||||
// A typedef to define the attribute (name, integer) map | // A typedef to define the attribute (name, integer) map | ||||
typedef std::map<std::string, int> EvtAttIntMap; | typedef std::map<std::string, int> EvtAttIntMap; | ||||
EvtAttIntMap _intAttributes; | EvtAttIntMap m_intAttributes; | ||||
// A typedef to define the attribute (name, double) map | // A typedef to define the attribute (name, double) map | ||||
typedef std::map<std::string, double> EvtAttDblMap; | typedef std::map<std::string, double> EvtAttDblMap; | ||||
EvtAttDblMap _dblAttributes; | EvtAttDblMap m_dblAttributes; | ||||
private: | private: | ||||
EvtParticle* _daug[MAX_DAUG]; | EvtParticle* m_daug[MAX_DAUG]; | ||||
size_t _ndaug; | size_t m_ndaug; | ||||
EvtParticle* _parent; | EvtParticle* m_parent; | ||||
int _channel; | int m_channel; | ||||
int _first; | int m_first; | ||||
EvtId _id; | EvtId m_id; | ||||
EvtVector4R _p; | EvtVector4R m_p; | ||||
EvtVector4R _pBeforeFSR; | EvtVector4R m_pBeforeFSR; | ||||
double _t; | double m_t; | ||||
bool _isInit; | bool m_isInit; | ||||
bool _isDecayed; | bool m_isDecayed; | ||||
//bool _mix; | //bool m_mix; | ||||
EvtSpinDensity _rhoForward; | EvtSpinDensity m_rhoForward; | ||||
EvtSpinDensity _rhoBackward; | EvtSpinDensity m_rhoBackward; | ||||
void makeStdHepRec( int firstparent, int lastparent, EvtStdHep& stdhep, | void makeStdHepRec( int firstparent, int lastparent, EvtStdHep& stdhep, | ||||
EvtSecondary& secondary, EvtId* stable_parent_ihep ); | EvtSecondary& secondary, EvtId* stable_parent_ihep ); | ||||
void makeStdHepRec( int firstparent, int lastparent, EvtStdHep& stdhep ); | void makeStdHepRec( int firstparent, int lastparent, EvtStdHep& stdhep ); | ||||
//This is a hack until things gets straightened out. (Ryd) | //This is a hack until things gets straightened out. (Ryd) | ||||
int _genlifetime; | int m_genlifetime; | ||||
//should never be used, therefor is private. | //should never be used, therefor is private. | ||||
//these does _not_ have an implementation | //these does _not_ have an implementation | ||||
EvtParticle& operator=( const EvtParticle& p ); | EvtParticle& operator=( const EvtParticle& p ); | ||||
EvtParticle( const EvtParticle& p ); | EvtParticle( const EvtParticle& p ); | ||||
double* _decayProb; | double* m_decayProb; | ||||
}; | }; | ||||
#endif | #endif |