#include <PhysicsTools/KinFitter/interface/TFitConstraintEp.h>
Definition at line 13 of file TFitConstraintEp.h.
TFitConstraintEp::TFitConstraintEp | ( | ) |
TFitConstraintEp::TFitConstraintEp | ( | vector< TAbsFitParticle * > * | particles, | |
TFitConstraintEp::component | thecomponent, | |||
Double_t | constraint = 0. | |||
) |
Definition at line 36 of file TFitConstraintEp.cc.
References _particles.
00039 :TAbsFitConstraint() 00040 ,_particles(0) 00041 ,_constraint(constraint) 00042 ,_component(thecomponent) 00043 { 00044 // particles: vector containing pointer to TAbsFitParticle objects. 00045 // Energy or momentum conservation will be calculated for 00046 // those particles. 00047 // thecomponent: conserved 4vector component ( pX, pY, pZ, E ). For 00048 // full 4vector conservation four objects of type TFitConstraintEp 00049 // are needed (four constraints) 00050 // constraint:value of energy or momentum constraint ( e.g. sum[ pX_i ] = constraint ) 00051 00052 if (particles) { 00053 _particles = (*particles); 00054 } 00055 }
TFitConstraintEp::TFitConstraintEp | ( | const TString & | name, | |
const TString & | title, | |||
vector< TAbsFitParticle * > * | particles, | |||
TFitConstraintEp::component | thecomponent, | |||
Double_t | constraint = 0. | |||
) |
Definition at line 57 of file TFitConstraintEp.cc.
References _particles.
00061 :TAbsFitConstraint(name, title) 00062 ,_particles(0) 00063 ,_constraint(constraint) 00064 ,_component(thecomponent) 00065 { 00066 // particles: vector containing pointer to TAbsFitParticle objects. 00067 // Energy or momentum conservation will be calculated for 00068 // those particles. 00069 // thecomponent: conserved 4vector component ( pX, pY, pZ, E ). For 00070 // full 4vector conservation four objects of type TFitConstraintEp 00071 // are needed (four constraints) 00072 // constraint:value of energy or momentum constraint ( e.g. sum[ pX_i ] = constraint ) 00073 00074 if (particles) { 00075 _particles = (*particles); 00076 } 00077 }
TFitConstraintEp::~TFitConstraintEp | ( | ) | [virtual] |
void TFitConstraintEp::addParticle | ( | TAbsFitParticle * | particle | ) |
Definition at line 86 of file TFitConstraintEp.cc.
References _particles.
Referenced by addParticles().
00086 { 00087 // Add one particles to list of constrained particles 00088 00089 _particles.push_back( particle ); 00090 00091 }
void TFitConstraintEp::addParticles | ( | TAbsFitParticle * | p1, | |
TAbsFitParticle * | p2 = 0 , |
|||
TAbsFitParticle * | p3 = 0 , |
|||
TAbsFitParticle * | p4 = 0 , |
|||
TAbsFitParticle * | p5 = 0 , |
|||
TAbsFitParticle * | p6 = 0 , |
|||
TAbsFitParticle * | p7 = 0 , |
|||
TAbsFitParticle * | p8 = 0 , |
|||
TAbsFitParticle * | p9 = 0 , |
|||
TAbsFitParticle * | p10 = 0 | |||
) |
Definition at line 93 of file TFitConstraintEp.cc.
References addParticle().
00095 { 00096 // Add many particles to list of constrained particles 00097 00098 if (p1) addParticle( p1 ); 00099 if (p2) addParticle( p2 ); 00100 if (p3) addParticle( p3 ); 00101 if (p4) addParticle( p4 ); 00102 if (p5) addParticle( p5 ); 00103 if (p6) addParticle( p6 ); 00104 if (p7) addParticle( p7 ); 00105 if (p8) addParticle( p8 ); 00106 if (p9) addParticle( p9 ); 00107 if (p10) addParticle( p10 ); 00108 00109 }
Double_t TFitConstraintEp::getCurrentValue | ( | ) | [virtual] |
Implements TAbsFitConstraint.
Definition at line 138 of file TFitConstraintEp.cc.
References _component, _constraint, _particles, i, and int.
Referenced by getInfoString().
00138 { 00139 // Get value of constraint after the fit 00140 00141 Double_t CurrentValue(0); 00142 UInt_t Npart = _particles.size(); 00143 for (unsigned int i=0;i<Npart;i++) { 00144 const TLorentzVector* FourVec = _particles[i]->getCurr4Vec(); 00145 CurrentValue += (*FourVec)[(int) _component]; 00146 } 00147 CurrentValue -= _constraint; 00148 return CurrentValue; 00149 }
TMatrixD * TFitConstraintEp::getDerivative | ( | TAbsFitParticle * | particle | ) | [virtual] |
Implements TAbsFitConstraint.
Definition at line 114 of file TFitConstraintEp.cc.
References _component, and int.
00114 { 00115 // returns derivative df/dP with P=(p,E) and f the constraint (f=0). 00116 // The matrix contains one row (df/dp, df/dE). 00117 00118 TMatrixD* DerivativeMatrix = new TMatrixD(1,4); 00119 (*DerivativeMatrix) *= 0.; 00120 (*DerivativeMatrix)(0,(int) _component) = 1.; 00121 return DerivativeMatrix; 00122 }
TString TFitConstraintEp::getInfoString | ( | ) | [virtual] |
Reimplemented from TAbsFitConstraint.
Definition at line 151 of file TFitConstraintEp.cc.
References _component, _constraint, lat::endl(), getCurrentValue(), getInitValue(), and info.
Referenced by print().
00151 { 00152 // Collect information to be used for printout 00153 00154 stringstream info; 00155 info << scientific << setprecision(6); 00156 00157 info << "__________________________" << endl 00158 << endl; 00159 info << "OBJ: " << IsA()->GetName() << "\t" << GetName() << "\t" << GetTitle() << endl; 00160 00161 info << "initial value: " << getInitValue() << endl; 00162 info << "current value: " << getCurrentValue() << endl; 00163 info << "component: " << _component << endl; 00164 info << "constraint: " << _constraint << endl; 00165 00166 return info.str(); 00167 00168 }
Double_t TFitConstraintEp::getInitValue | ( | ) | [virtual] |
Implements TAbsFitConstraint.
Definition at line 125 of file TFitConstraintEp.cc.
References _component, _constraint, _particles, i, and int.
Referenced by getInfoString().
00125 { 00126 // Get initial value of constraint (before the fit) 00127 00128 Double_t InitValue(0) ; 00129 UInt_t Npart = _particles.size(); 00130 for (unsigned int i=0;i<Npart;i++) { 00131 const TLorentzVector* FourVec = _particles[i]->getIni4Vec(); 00132 InitValue += (*FourVec)[(int) _component]; 00133 } 00134 InitValue -= _constraint; 00135 return InitValue; 00136 }
Reimplemented from TAbsFitConstraint.
Definition at line 170 of file TFitConstraintEp.cc.
References getInfoString().
00170 { 00171 // Print constraint contents 00172 00173 edm::LogVerbatim("KinFitter") << this->getInfoString(); 00174 00175 }
Definition at line 56 of file TFitConstraintEp.h.
Referenced by getCurrentValue(), getDerivative(), getInfoString(), and getInitValue().
Double_t TFitConstraintEp::_constraint [private] |
Definition at line 55 of file TFitConstraintEp.h.
Referenced by getCurrentValue(), getInfoString(), and getInitValue().
vector<TAbsFitParticle*> TFitConstraintEp::_particles [private] |
Definition at line 54 of file TFitConstraintEp.h.
Referenced by addParticle(), getCurrentValue(), getInitValue(), and TFitConstraintEp().