FairRoot/PandaRoot
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
DecayTreeFitter::MissingParticle Class Reference

#include <MissingParticle.h>

Inheritance diagram for DecayTreeFitter::MissingParticle:
DecayTreeFitter::ParticleBase

Public Types

enum  ParticleType {
  kInteractionPoint, kRecoComposite, kRecoResonance, kInternalParticle,
  kRecoTrack, kResonance, kRecoPhoton, kMissingParticle
}
 
typedef std::vector
< ParticleBase * > 
ParticleContainer
 
typedef std::vector
< ParticleBase * > 
daucontainer
 
typedef
daucontainer::const_iterator 
const_iterator
 
typedef std::vector< std::pair
< const ParticleBase *, int > > 
indexmap
 
typedef std::vector
< DecayTreeFitter::Constraint
constraintlist
 

Public Member Functions

 MissingParticle (RhoCandidate *bc, const ParticleBase *mother)
 
virtual ~MissingParticle ()
 
virtual ErrCode initPar1 (FitParams *)
 
virtual ErrCode initPar2 (FitParams *)
 
virtual std::string parname (int index) const
 
virtual int dim () const
 
virtual int momIndex () const
 
virtual bool hasEnergy () const
 
virtual int type () const
 
virtual void addToConstraintList (constraintlist &, int) const
 
virtual void updateIndex (int &offset)
 
virtual ErrCode initCov (FitParams *) const
 
virtual void print (const FitParams *) const
 
const ParticleBaselocate (RhoCandidate *bc) const
 
RhoCandidateparticle () const
 
virtual int index () const
 
const ParticleBasemother () const
 
const std::string & name () const
 
virtual ErrCode projectGeoConstraint (const FitParams *, Projection &) const
 
virtual ErrCode projectMassConstraint (const FitParams *, Projection &) const
 
virtual ErrCode projectConstraint (Constraint::Type, const FitParams *, Projection &) const
 
virtual int posIndex () const
 
virtual int lenIndex () const
 
virtual bool hasPosition () const
 
int eneIndex () const
 
virtual double chiSquareD (const FitParams *) const
 
double pdtMass () const
 
double pdtWidth () const
 
double pdtCLifeTime () const
 
double pdtTau () const
 
int charge () const
 
const daucontainerdaughters () const
 
const_iterator begin () const
 
const_iterator end () const
 
ParticleBaseaddDaughter (RhoCandidate *, const Configuration &config)
 
void removeDaughter (const ParticleBase *pb)
 
virtual void retrieveIndexMap (indexmap &anindexmap) const
 
void setMother (const ParticleBase *m)
 
virtual int nFinalChargedCandidates () const
 
void setParticle (RhoCandidate *bc)
 
void collectVertexDaughters (daucontainer &particles, int posindex)
 
bool setMassConstraint (bool add)
 
void setMassConstraint (double mass)
 
ChiSquare chiSquare (const FitParams *fitparams) const
 

Static Public Member Functions

static ParticleBasecreateParticle (RhoCandidate *bc, const ParticleBase *mother, const Configuration &config)
 

Protected Member Functions

daucontainerdaughters ()
 
ErrCode initTau (FitParams *par) const
 
void makeName (RhoCandidate *bc)
 
bool hasMassConstraint () const
 
void setIndex (int i)
 
void setName (const std::string &n)
 

Static Protected Member Functions

static double pdtCLifeTime (RhoCandidate *bc)
 
static bool isAResonance (const TParticlePDG *bc)
 
static double bFieldOverC ()
 

Detailed Description

Definition at line 17 of file MissingParticle.h.

Member Typedef Documentation

typedef daucontainer::const_iterator DecayTreeFitter::ParticleBase::const_iterator
inherited

Definition at line 97 of file ParticleBase.h.

Definition at line 110 of file ParticleBase.h.

Definition at line 96 of file ParticleBase.h.

typedef std::vector< std::pair<const ParticleBase*,int> > DecayTreeFitter::ParticleBase::indexmap
inherited

Definition at line 105 of file ParticleBase.h.

Definition at line 33 of file ParticleBase.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

DecayTreeFitter::MissingParticle::MissingParticle ( RhoCandidate bc,
const ParticleBase mother 
)

Definition at line 28 of file MissingParticle.cxx.

29 : ParticleBase(bc,aMother)
30 {
31  // this will be one of the very few particles for which we adjust
32  // the dimension if there is a constraint
33 }
ParticleBase(RhoCandidate *bc, const ParticleBase *mother)
DecayTreeFitter::MissingParticle::~MissingParticle ( )
virtual

Definition at line 35 of file MissingParticle.cxx.

35 {}

Member Function Documentation

ParticleBase * DecayTreeFitter::ParticleBase::addDaughter ( RhoCandidate cand,
const Configuration config 
)
inherited

Definition at line 94 of file ParticleBase.cxx.

References DecayTreeFitter::ParticleBase::createParticle().

Referenced by DecayTreeFitter::InternalParticle::InternalParticle().

95 {
96  m_daughters.push_back( DecayTreeFitter::ParticleBase::createParticle(cand,this,config) ) ;
97  return m_daughters.back() ;
98 }
ParticleContainer m_daughters
Definition: ParticleBase.h:146
static ParticleBase * createParticle(RhoCandidate *bc, const ParticleBase *mother, const Configuration &config)
virtual void DecayTreeFitter::MissingParticle::addToConstraintList ( constraintlist ,
int   
) const
inlinevirtual

Implements DecayTreeFitter::ParticleBase.

Definition at line 31 of file MissingParticle.h.

31 {}
const_iterator DecayTreeFitter::ParticleBase::begin ( ) const
inlineinherited

Definition at line 100 of file ParticleBase.h.

References DecayTreeFitter::ParticleBase::m_daughters.

100 { return m_daughters.begin() ; }
ParticleContainer m_daughters
Definition: ParticleBase.h:146
double DecayTreeFitter::ParticleBase::bFieldOverC ( )
staticprotectedinherited

Definition at line 582 of file ParticleBase.cxx.

References C(), RhoCalculationTools::GetBz(), and pos.

583 {
584  TVector3 pos(0.,0.,0.); //TODO get a sensible position, but let's assume zero first...
585  return RhoCalculationTools::GetBz ( pos ) / TMath::C() ;
586 }
TVector3 pos
int Pic_FED Eff_lEE C()
static Double_t GetBz(const TVector3 &position)
Return the magnetic field along the z-axis in kGs
int DecayTreeFitter::ParticleBase::charge ( ) const
inlineinherited

Definition at line 90 of file ParticleBase.h.

References DecayTreeFitter::ParticleBase::m_charge.

90 { return m_charge ; }
ChiSquare DecayTreeFitter::ParticleBase::chiSquare ( const FitParams fitparams) const
inherited

Definition at line 568 of file ParticleBase.cxx.

References DecayTreeFitter::FitParams::chiSquare().

Referenced by DecayTreeFitter::DecayChain::chiSquare().

569 {
570  ChiSquare chi2 ;
571  // add contribution from daughters
572  for(daucontainer::const_iterator it = m_daughters.begin() ;
573  it != m_daughters.end() ; ++it) {
574  chi2 += (*it)->chiSquare(fitparams) ;
575  }
576  // add own chisquare, adjust for number of parameters
577  chi2 += fitparams->chiSquare( *this ) ;
578  chi2 += ChiSquare( 0, -dim() ) ;
579  return chi2 ;
580 }
ParticleContainer m_daughters
Definition: ParticleBase.h:146
virtual int dim() const =0
double chiSquare() const
Definition: FitParams.h:51
double DecayTreeFitter::ParticleBase::chiSquareD ( const FitParams fitparams) const
virtualinherited

Definition at line 551 of file ParticleBase.cxx.

552 {
553  double rc = 0;
554  for(daucontainer::const_iterator it = m_daughters.begin() ;
555  it != m_daughters.end(); ++it)
556  rc += (*it)->chiSquareD(fitparams) ;
557  return rc ;
558 }
ParticleContainer m_daughters
Definition: ParticleBase.h:146
void DecayTreeFitter::ParticleBase::collectVertexDaughters ( daucontainer particles,
int  posindex 
)
inherited

Definition at line 227 of file ParticleBase.cxx.

References name, and vtxverbose.

228 {
229  // collect all particles emitted from vertex with position posindex
230  if(vtxverbose>=3) {
231  std::cout << "DecayTreeFitter::ParticleBase::collectVertexDaughters " << posindex << std::endl ;
232  }
233  //skip: head of tree, particles from different vertex, resonances
234  if( mother() && mother()->posIndex() == posindex && type()!=kRecoResonance && type()!=kResonance )
235  {
236  particles.push_back( this ) ;
237  if(vtxverbose>=3) {
238  std::cout << "DecayTreeFitter::ParticleBase::collectVertexDaughters - added a particle "<<name()<<" to vertex " << posindex << std::endl ;
239  }
240  }
241  for( daucontainer::const_iterator idau = daughters().begin() ;
242  idau != daughters().end() ; ++idau )
243  (*idau)->collectVertexDaughters(particles,posindex ) ; //FIXME: RK Caution here!!
244  //collectVertexDaughters(particles,posindex ) ;
245 }
int vtxverbose
const_iterator begin() const
Definition: ParticleBase.h:100
const std::string & name() const
Definition: ParticleBase.h:61
virtual int posIndex() const
Definition: ParticleBase.h:69
virtual int type() const =0
const daucontainer & daughters() const
Definition: ParticleBase.h:99
const ParticleBase * mother() const
Definition: ParticleBase.h:60
ParticleBase * DecayTreeFitter::ParticleBase::createParticle ( RhoCandidate bc,
const ParticleBase mother,
const Configuration config 
)
staticinherited

Definition at line 113 of file ParticleBase.cxx.

References RhoCandidate::Charge(), fabs(), RhoCandidate::GetRecoCandidate(), DecayTreeFitter::ParticleBase::index(), RhoCandidate::IsLocked(), DecayTreeFitter::ParticleBase::name(), RhoCandidate::NDaughters(), RhoCandidate::PdgCode(), RhoCandidate::PdtEntry(), DecayTreeFitter::ParticleBase::type(), RhoCandidate::Uid(), and vtxverbose.

Referenced by DecayTreeFitter::ParticleBase::addDaughter().

116 {
117  // This routine interpretes a beta candidate as one of the
118  // 'Particles' used by the fitter.
119 
120  const TParticlePDG* prop = particle->PdtEntry();
121 
122  if(vtxverbose>=5)
123  std::cout << "DecayTreeFitter::ParticleBase::createParticle from " <<particle->PdgCode() << " | " << particle->Uid() << std::endl ;
124  ParticleBase* rc=0 ;
125  //bool bsconstraint = false ;
126 
127  // We refit invalid fits, kinematic fits and composites with beamspot
128  // constraint if not at head of tree.
129  bool validfit = particle->IsLocked();//TODO needed? && particle.endVertex() != 0 ;
130  bool iscomposite = (particle->NDaughters()>0) ;
131  bool isresonance = iscomposite && prop && isAResonance(prop) ;
132 
133  if(!mother) { // 'head of tree' particles
134  //if ( bsconstraint )
135  //rc = new InteractionPoint(particle) ;
136  //else
137 
138  if( iscomposite )
139  { if(vtxverbose>=2) std::cout<<" H "; if(vtxverbose>=5) std::cout<<std::endl;
140  rc = new InternalParticle(particle,0,config) ; // still need proper head-of-tree class
141  }
142  else {
143  std::cout << "DecayTreeFitter::ParticleBase::createParticle: You are fitting a decay tree that exists of "
144  << "a single, non-composite particle and which does not have a beamconstraint."
145  << "I do not understand what you want me to do with this." << std::endl ;
146  std::cout<<" X ";
147  rc = new InternalParticle(particle,0,config) ; // still need proper head-of-tree class
148  }
149  } else if( !iscomposite ) { // external particles (i.e. tracks/neutrals)
150  bool hasrecocand = ( NULL !=particle->GetRecoCandidate() );
151  bool ischarged = ( fabs(particle->Charge())>0 );
152  //bool hastrack = proto && (proto->GetTrackIndex() >= 0) ;
153  //bool hascalo = proto && (proto->GetEmcNumberOfCrystals() > 0) ;
154  //std::cout<<" particle="<<particle<<" proto="<<proto<<" ntrk="<<proto->GetTrackIndex()<<" ncry"<<proto->GetEmcNumberOfCrystals()<<std::endl;
155  if( hasrecocand )
156  {
157  if( ischarged )
158  { if(vtxverbose>=2) std::cout<<" T "; if(vtxverbose>=5) std::cout<<std::endl;
159  rc = new RecoTrack(particle,mother,config) ; // reconstructed track
160  } else
161  { if(vtxverbose>=2) std::cout<<" P "; if(vtxverbose>=5) std::cout<<std::endl;
162  rc = new RecoPhoton(particle,mother) ; // reconstructed photon
163  }
164  } else if( validfit ) { // fitted composites w/o daughters?
165  if( isresonance )
166  { if(vtxverbose>=2) std::cout<<" RF "; if(vtxverbose>=5) std::cout<<std::endl;
167  rc = new RecoResonance(particle,mother) ;
168  } else
169  { if(vtxverbose>=2) std::cout<<" CF "; if(vtxverbose>=5) std::cout<<std::endl;
170  rc = new RecoComposite(particle,mother) ;
171  }
172  } else { // missing particle!
173  if(vtxverbose>=2) std::cout<<" M "; if(vtxverbose>=5) std::cout<<std::endl;
174  rc = new MissingParticle(particle,mother) ;
175  }
176  } else { // 'internal' particles
177  if( validfit /*|| isconversion*/ ) { // fitted composites
178  if( isresonance ) {
179  if(vtxverbose>=2) std::cout<<" Rf "; if(vtxverbose>=5) std::cout<<std::endl;
180  rc = new RecoResonance(particle,mother) ;
181  } else {
182  if(vtxverbose>=2) std::cout<<" Cf "; if(vtxverbose>=5) std::cout<<std::endl;
183  rc = new RecoComposite(particle,mother) ;
184  }
185  } else { // unfited composites
186  if( isresonance ) {
187  if(vtxverbose>=2) std::cout<<" R "; if(vtxverbose>=5) std::cout<<std::endl;
188  rc = new Resonance(particle,mother,config) ;
189  } else {
190  if(vtxverbose>=2) std::cout<<" I "; if(vtxverbose>=5) std::cout<<std::endl;
191  rc = new InternalParticle(particle,mother,config) ;
192  }
193  }
194  }
195  if(vtxverbose>=5)
196  std::cout << "DecayTreeFitter::ParticleBase::createParticle finished " <<particle->PdgCode() << " | " << particle->Uid() << std::endl ;
197 
198  if(vtxverbose>=2)
199  std::cout << "DecayTreeFitter::ParticleBase::createParticle returns type=" << rc->type()
200  << " index=" << rc->index() << " with name \""<< rc->name() << "\""<<std::endl ;
201  return rc ;
202 }
int vtxverbose
RhoCandidate * particle() const
Definition: ParticleBase.h:57
PndPidCandidate * GetRecoCandidate() const
Definition: RhoCandidate.h:376
static bool isAResonance(const TParticlePDG *bc)
Int_t Uid() const
Definition: RhoCandidate.h:419
const std::string & name() const
Definition: ParticleBase.h:61
virtual int index() const
Definition: ParticleBase.h:59
Bool_t IsLocked()
Definition: RhoCandidate.h:330
const TParticlePDG * PdtEntry() const
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
virtual int type() const =0
Int_t NDaughters() const
Double_t Charge() const
Definition: RhoCandidate.h:184
const daucontainer& DecayTreeFitter::ParticleBase::daughters ( ) const
inlineinherited
daucontainer& DecayTreeFitter::ParticleBase::daughters ( )
inlineprotectedinherited

Definition at line 138 of file ParticleBase.h.

References DecayTreeFitter::ParticleBase::m_daughters.

138 { return m_daughters ; }
ParticleContainer m_daughters
Definition: ParticleBase.h:146
virtual int DecayTreeFitter::MissingParticle::dim ( ) const
inlinevirtual

Implements DecayTreeFitter::ParticleBase.

Definition at line 27 of file MissingParticle.h.

References DecayTreeFitter::ParticleBase::hasMassConstraint().

27 { return hasMassConstraint() ? 3 : 4 ; }
const_iterator DecayTreeFitter::ParticleBase::end ( ) const
inlineinherited

Definition at line 101 of file ParticleBase.h.

References DecayTreeFitter::ParticleBase::m_daughters.

Referenced by DecayTreeFitter::ParticleBase::locate().

101 { return m_daughters.end() ; }
ParticleContainer m_daughters
Definition: ParticleBase.h:146
int DecayTreeFitter::ParticleBase::eneIndex ( ) const
inlineinherited

Definition at line 80 of file ParticleBase.h.

References DecayTreeFitter::ParticleBase::hasEnergy(), and DecayTreeFitter::ParticleBase::momIndex().

80 { return hasEnergy() ? momIndex()+3 : -1 ; }
virtual int momIndex() const
Definition: ParticleBase.h:71
virtual bool hasEnergy() const
Definition: ParticleBase.h:74
virtual bool DecayTreeFitter::MissingParticle::hasEnergy ( ) const
inlinevirtual

Reimplemented from DecayTreeFitter::ParticleBase.

Definition at line 29 of file MissingParticle.h.

References DecayTreeFitter::ParticleBase::hasMassConstraint().

29 { return hasMassConstraint() ? false : true ; }
bool DecayTreeFitter::ParticleBase::hasMassConstraint ( ) const
inlineprotectedinherited

Definition at line 139 of file ParticleBase.h.

References DecayTreeFitter::ParticleBase::m_hasMassConstraint.

Referenced by dim(), and hasEnergy().

virtual bool DecayTreeFitter::ParticleBase::hasPosition ( ) const
inlinevirtualinherited

Reimplemented in DecayTreeFitter::RecoComposite, DecayTreeFitter::InternalParticle, and DecayTreeFitter::Resonance.

Definition at line 78 of file ParticleBase.h.

78 { return false ; }
virtual int DecayTreeFitter::ParticleBase::index ( ) const
inlinevirtualinherited
ErrCode DecayTreeFitter::ParticleBase::initCov ( FitParams fitparams) const
virtualinherited

Reimplemented in DecayTreeFitter::InteractionPoint, and DecayTreeFitter::RecoPhoton.

Definition at line 248 of file ParticleBase.cxx.

References DecayTreeFitter::FitParams::cov(), name, row, status, and vtxverbose.

Referenced by DecayTreeFitter::Fitter::add(), and DecayTreeFitter::InteractionPoint::initCov().

249 {
250  ErrCode status ;
251 
252  if(vtxverbose>=2) {
253  std::cout << "DecayTreeFitter::ParticleBase::initCov for " << name() << std::endl ;
254  }
255 
256  // position
257  int posindex = posIndex() ;
258  if( posindex>=0 ) {
259  const double sigx = 10; // * Gaudi::Units::cm ;
260  const double sigy = 10; // * Gaudi::Units::cm ;
261  const double sigz = 50; // * Gaudi::Units::cm ;
262  fitparams->cov()(posindex+0,posindex+0) = sigx*sigx ;
263  fitparams->cov()(posindex+1,posindex+1) = sigy*sigy ;
264  fitparams->cov()(posindex+2,posindex+2) = sigz*sigz ;
265  }
266 
267  // momentum
268  int momindex = momIndex() ;
269  if(momindex>=0) {
270  // TODO: calo at high energy?
271  const double sigmom = 10; // * Gaudi::Units::GeV ; // GeV
272  int maxrow = hasEnergy() ? 4 : 3 ;
273  for(int row=momindex; row<momindex+maxrow; row++)
274  fitparams->cov()(row,row) = sigmom*sigmom ;
275  }
276 
277  // lifetime
278  int lenindex = lenIndex() ;
279  if(lenindex>=0) {
280  const double sigz = 50; // * Gaudi::Units::cm ;
281  fitparams->cov()(lenindex,lenindex) = sigz*sigz ;
282  }
283 
284  for(daucontainer::const_iterator it = m_daughters.begin() ;
285  it != m_daughters.end() ; ++it)
286  status |= (*it)->initCov(fitparams) ;
287  return status ;
288 }
int row
Definition: anaLmdDigi.C:67
ParticleContainer m_daughters
Definition: ParticleBase.h:146
int vtxverbose
virtual int momIndex() const
Definition: ParticleBase.h:71
virtual int lenIndex() const
Definition: ParticleBase.h:70
virtual bool hasEnergy() const
Definition: ParticleBase.h:74
const std::string & name() const
Definition: ParticleBase.h:61
virtual int posIndex() const
Definition: ParticleBase.h:69
TMatrixDSym & cov()
Definition: FitParams.h:34
int status[10]
Definition: f_Init.h:28
ErrCode DecayTreeFitter::MissingParticle::initPar1 ( FitParams fitpar)
virtual

Implements DecayTreeFitter::ParticleBase.

Definition at line 37 of file MissingParticle.cxx.

References DecayTreeFitter::FitParams::par(), particle, and vtxverbose.

38 {
39  if(vtxverbose>5){std::cout<<"MissingParticle::initPar1: - "<<std::endl;}
40  // take them from the bc
41  TLorentzVector p4 = particle()->P4() ;
42  int momindex = momIndex();
43  fitpar->par()(momindex+0) = p4.Px() ;
44  fitpar->par()(momindex+1) = p4.Py() ;
45  fitpar->par()(momindex+2) = p4.Pz() ;
46  if(hasEnergy()) fitpar->par()(momindex+3) = p4.E() ;
47  return ErrCode() ;
48 }
RhoCandidate * particle() const
Definition: ParticleBase.h:57
virtual bool hasEnergy() const
int vtxverbose
TLorentzVector P4() const
Definition: RhoCandidate.h:195
virtual ErrCode DecayTreeFitter::MissingParticle::initPar2 ( FitParams )
inlinevirtual
ErrCode DecayTreeFitter::ParticleBase::initTau ( FitParams par) const
protectedinherited

Definition at line 522 of file ParticleBase.cxx.

References mom, DecayTreeFitter::FitParams::par(), DecayTreeFitter::ParticleBase::posIndex(), and DecayTreeFitter::ErrCode::success.

523 {
524  int lenindex = lenIndex() ;
525  if(lenindex>=0 && hasPosition() ) {
526  const ParticleBase* amother = mother() ;
527  int momposindex = amother ? amother->posIndex() : -1 ;
528  int posindex = posIndex() ;
529  int momindex = momIndex() ;
530  assert(momposindex>=0) ; // check code logic: no mother -> no tau
531  //assert(fitparams->par(momposindex+0)!=0 ||fitparams->par(momposindex+1)!=0
532  // ||fitparams->par(momposindex+2)!=0) ; // mother must be initialized
533 
534  TVector3 dX,mom ;
535  double mom2(0) ;
536  for(int irow=0; irow<3; irow++) {
537  dX(irow) = fitparams->par(posindex+irow) - fitparams->par(momposindex+irow) ;
538  double px = fitparams->par(momindex+irow) ;
539  mom(irow) = px ;
540  mom2 += px*px ;
541  }
542  double tau = dX.Dot(mom)/mom2 ;
543  // we don't like 0 and we don't like very negative values
544  if( tau==0 ) tau=pdtTau() ;
545  //tau = tau==0 ? pdtTau() : std::max(tau,-pdtTau()) ;
546  fitparams->par(lenindex) = tau ;
547  }
548  return ErrCode::success ;
549 }
virtual int momIndex() const
Definition: ParticleBase.h:71
virtual int lenIndex() const
Definition: ParticleBase.h:70
Double_t mom
Definition: plot_dirc.C:14
virtual int posIndex() const
Definition: ParticleBase.h:69
virtual bool hasPosition() const
Definition: ParticleBase.h:78
const ParticleBase * mother() const
Definition: ParticleBase.h:60
bool DecayTreeFitter::ParticleBase::isAResonance ( const TParticlePDG *  bc)
staticprotectedinherited

Definition at line 205 of file ParticleBase.cxx.

References C(), and vtxverbose.

205  {
206  bool rc = false ;
207  switch(prop->PdgCode()) {
208  case 11: // bremstrahlung is treated as a resonance
209  case -11:
210  rc = true ;
211  break ;
212  //case 22: // conversions are not treated as a resonance
213  //case 310: // K shorts count as "stable" in PDT Table
214  //rc = false;
215  //break ;
216  default: // this should take care of the pi0
217  rc = (prop->Lifetime()>0) && (100.*TMath::C()*prop->Lifetime() < 0.0001); //[cm]
218  if(rc) break;
219  if(vtxverbose>4)std::cout<<"ParticleBase::isAResonance l."<<__LINE__<<": ctau="<<100.*TMath::C()*prop->Lifetime()<<" cm"<<std::endl;
220  if(prop->Stable()) return false;
221  //rc = prop.ctau() < 0.001*Gaudi::Units::mm ;
222  break;
223  }
224  return rc ;
225 }
int vtxverbose
int Pic_FED Eff_lEE C()
virtual int DecayTreeFitter::ParticleBase::lenIndex ( ) const
inlinevirtualinherited
const ParticleBase * DecayTreeFitter::ParticleBase::locate ( RhoCandidate bc) const
inherited

Definition at line 353 of file ParticleBase.cxx.

References DecayTreeFitter::ParticleBase::end(), and DecayTreeFitter::ParticleBase::locate().

Referenced by DecayTreeFitter::Fitter::decayLengthSum(), DecayTreeFitter::DecayChain::locate(), DecayTreeFitter::ParticleBase::locate(), DecayTreeFitter::Fitter::name(), and DecayTreeFitter::Fitter::updateCand().

354 {
355  // does there exist an 'iscloneof' in lhcb?
356  const ParticleBase* rc = m_particle == abc ? this : 0 ;
357  for(daucontainer::const_iterator it = m_daughters.begin() ;
358  !rc && it != m_daughters.end(); ++it)
359  rc = (*it)->locate(abc) ;
360  return rc ;
361 }
ParticleContainer m_daughters
Definition: ParticleBase.h:146
const ParticleBase * locate(RhoCandidate *bc) const
void DecayTreeFitter::ParticleBase::makeName ( RhoCandidate bc)
protectedinherited
virtual int DecayTreeFitter::MissingParticle::momIndex ( ) const
inlinevirtual

Reimplemented from DecayTreeFitter::ParticleBase.

Definition at line 28 of file MissingParticle.h.

References DecayTreeFitter::ParticleBase::index().

28 { return index() ; }
virtual int index() const
Definition: ParticleBase.h:59
const ParticleBase* DecayTreeFitter::ParticleBase::mother ( ) const
inlineinherited
const std::string& DecayTreeFitter::ParticleBase::name ( ) const
inlineinherited
int DecayTreeFitter::ParticleBase::nFinalChargedCandidates ( ) const
virtualinherited

Reimplemented in DecayTreeFitter::RecoTrack.

Definition at line 560 of file ParticleBase.cxx.

Referenced by DecayTreeFitter::sortByType().

560  {
561  int rc=0;
562  for(daucontainer::const_iterator it = m_daughters.begin() ;
563  it != m_daughters.end() ; ++it)
564  rc +=(*it)->nFinalChargedCandidates() ;
565  return rc ;
566 }
ParticleContainer m_daughters
Definition: ParticleBase.h:146
std::string DecayTreeFitter::MissingParticle::parname ( int  index) const
virtual

Reimplemented from DecayTreeFitter::ParticleBase.

Definition at line 50 of file MissingParticle.cxx.

References DecayTreeFitter::ParticleBase::parname().

51 {
52  return ParticleBase::parname(ind+4) ;
53 }
virtual std::string parname(int index) const
RhoCandidate* DecayTreeFitter::ParticleBase::particle ( ) const
inlineinherited
double DecayTreeFitter::ParticleBase::pdtCLifeTime ( ) const
inlineinherited

Definition at line 88 of file ParticleBase.h.

References DecayTreeFitter::ParticleBase::m_pdtCLifeTime.

88 { return m_pdtCLifeTime ; }
static double DecayTreeFitter::ParticleBase::pdtCLifeTime ( RhoCandidate bc)
staticprotectedinherited
double DecayTreeFitter::ParticleBase::pdtMass ( ) const
inlineinherited
double DecayTreeFitter::ParticleBase::pdtTau ( ) const
inlineinherited
double DecayTreeFitter::ParticleBase::pdtWidth ( ) const
inlineinherited

Definition at line 87 of file ParticleBase.h.

References DecayTreeFitter::ParticleBase::m_pdtWidth.

87 { return m_pdtWidth ; }
virtual int DecayTreeFitter::ParticleBase::posIndex ( ) const
inlinevirtualinherited
void DecayTreeFitter::ParticleBase::print ( const FitParams fitpar) const
virtualinherited

Definition at line 309 of file ParticleBase.cxx.

References DecayTreeFitter::FitParams::cov(), i, name, DecayTreeFitter::FitParams::par(), pz, and sqrt().

310 {
311  std::cout << std::setw(5) << "[" << type() << "]" << std::setw(15) << std::flush << name().c_str()
312  << std::setw(15)<< " val" << std::setw(15)<< "err" << std::setw(15) << "sigma^2"<< std::endl ;
313  std::cout << std::setprecision(5) ;
314  for(int i=0; i<dim(); i++) {
315  int theindex = index()+i ;
316  std::cout << std::setw(2) << theindex << " "
317  << std::setw(20) << parname(i).c_str()
318  << std::setw(15) << fitpar->par()(theindex)
319  << std::setw(15) << sqrt(fitpar->cov()(theindex,theindex))
320  << std::setw(15) << fitpar->cov()(theindex,theindex) <<std::endl ;
321  }
322  if( hasEnergy() ) {
323  int momindex = momIndex() ;
324  double E = fitpar->par()(momindex+3) ;
325  double px = fitpar->par()(momindex+0) ;
326  double py = fitpar->par()(momindex+1) ;
327  double pz = fitpar->par()(momindex+2) ;
328  double mass2 = E*E-px*px-py*py-pz*pz ;
329  double mass = mass2>0 ? sqrt(mass2) : -sqrt(-mass2) ;
330 
331  // TODO this does not work? fitpar->cov()).GetSub(momindex+0,momindex+3)
332  TMatrixDSym cov = fitpar->cov().GetSub(momindex+0,momindex+3,momindex+0,momindex+3);
333  //HepSymMatrix cov = fitpar->cov().sub(momindex+0,momindex+3) ;
334  TVectorD G(4) ; //was at G(4,0) .. ??why
335  G(0) = -px/mass ;
336  G(1) = -py/mass ;
337  G(2) = -pz/mass ;
338  G(3) = E/mass ;
339  double massvar = cov.Similarity(G) ;
340  std::cout << std::setw(2)<< "-"<<" " << std::setw(20) << "mass: "
341  << std::setw(15) << mass
342  << std::setw(15) << sqrt(massvar)
343  << std::setw(15) << massvar << std::endl ;
344  }
345 
346  for(daucontainer::const_iterator it = m_daughters.begin() ;
347  it != m_daughters.end() ; ++it)
348  (*it)->print(fitpar) ;
349 
350 }
ParticleContainer m_daughters
Definition: ParticleBase.h:146
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
virtual int dim() const =0
virtual int momIndex() const
Definition: ParticleBase.h:71
virtual bool hasEnergy() const
Definition: ParticleBase.h:74
const std::string & name() const
Definition: ParticleBase.h:61
virtual int index() const
Definition: ParticleBase.h:59
virtual std::string parname(int index) const
virtual int type() const =0
double pz[39]
Definition: pipisigmas.h:14
TMatrixDSym & cov()
Definition: FitParams.h:34
ErrCode DecayTreeFitter::ParticleBase::projectConstraint ( Constraint::Type  atype,
const FitParams ,
Projection  
) const
virtualinherited
ErrCode DecayTreeFitter::ParticleBase::projectGeoConstraint ( const FitParams fitparams,
Projection p 
) const
virtualinherited

Definition at line 387 of file ParticleBase.cxx.

References DecayTreeFitter::Projection::H(), mom, p2, DecayTreeFitter::FitParams::par(), RhoCalculationTools::PrintMatrix(), pz, DecayTreeFitter::Projection::r(), row, sqrt(), DecayTreeFitter::ErrCode::success, DecayTreeFitter::Projection::V(), and vtxverbose.

389 {
390  // implements the constraint
391 
392  // vec{x}_decay = vec{x}_production + decaylength * vec{p} / p
393  int posindexmother = mother()->posIndex() ;
394  int posindex = posIndex();
395  int lenindex = lenIndex() ;
396  int momindex = momIndex() ;
397  assert(posindexmother>=0 && posindex>=0 && lenindex>=0 && momindex>=0) ;
398 
399 
400  // size of momentum
401  double px = fitparams->par()(momindex+0) ;
402  double py = fitparams->par()(momindex+1) ;
403  double pz = fitparams->par()(momindex+2) ;
404  double p2 = px*px+py*py+pz*pz ;
405  double mom = std::sqrt(p2) ;
406 
407  double dvx = fitparams->par()(posindexmother+0) - fitparams->par()(posindex+0);
408  double dvy = fitparams->par()(posindexmother+1) - fitparams->par()(posindex+1);
409  double dvz = fitparams->par()(posindexmother+2) - fitparams->par()(posindex+2);
410  double len=dvx*dvx+dvy*dvy+dvz*dvz;
411  len=std::sqrt(len);
412 
413  // lineair approximation is fine for now
414  for(int row=0; row<3; row++) {
415  double posxmother = fitparams->par()(posindexmother+row) ;
416  double posx = fitparams->par()(posindex+row) ;
417  double momx = fitparams->par()(momindex+row) ;
418  p.r(row) = posxmother - posx + len*momx/mom ;
419  p.H(row,posindexmother+row) = 1 ;
420  p.H(row,posindex+row) = -1 ;
421  p.H(row,lenindex) = momx/mom ;
422  }
423  // still need these as well
424  p.H(0,momindex+0) = len/mom*( 1 - px*px/p2 ) ;
425  p.H(0,momindex+1) = len/mom*( 0 - px*py/p2 ) ;
426  p.H(0,momindex+2) = len/mom*( 0 - px*pz/p2 ) ;
427  p.H(1,momindex+0) = len/mom*( 0 - py*px/p2 ) ;
428  p.H(1,momindex+1) = len/mom*( 1 - py*py/p2 ) ;
429  p.H(1,momindex+2) = len/mom*( 0 - py*pz/p2 ) ;
430  p.H(2,momindex+0) = len/mom*( 0 - pz*px/p2 ) ;
431  p.H(2,momindex+1) = len/mom*( 0 - pz*py/p2 ) ;
432  p.H(2,momindex+2) = len/mom*( 1 - pz*pz/p2 ) ;
434  //if( charge()!=0 )
435  //{
436  //double lambda = bFieldOverC() * charge() ;
437  //double tau = fitparams->par(lenIndex());
438  //double pt = sqrt(px*px+py*py) ;
439  //const double posprecision = 1e-4 ; // 1mu
440  //if( fabs(pt*lambda*tau*tau) > posprecision )
441  //{
443  //double sinlt = sin(lambda*tau) ;
444  //double coslt = cos(lambda*tau) ;
445  //double px1 = px*coslt - py*sinlt ;
446  //double py1 = py*coslt + px*sinlt ;
447 
448  //p.r(0) += -tau*px + (py1-py)/lambda ;
449  //p.r(1) += -tau*py - (px1-px)/lambda ;
450 
451  //p.H(0,lenindex+0) += -px + px1 ;
452  //p.H(0,momindex+0) += -tau + sinlt/lambda ;
453  //p.H(0,momindex+1) += (coslt-1)/lambda ;
454  //p.H(1,lenindex+0) += -py + py1 ;
455  //p.H(1,momindex+0) += - (coslt-1)/lambda ;
456  //p.H(1,momindex+1) += -tau + sinlt/lambda ;
457 
459  //std::cout << "Using helix for position of particle: " << name().c_str() << " "
460  //<< lambda << " " << lambda*tau
461  //<< " delta-x,y: " << -tau*px + (py1-py)/lambda << " "
462  //<< -tau*py - (px1-px)/lambda << std::endl ;
463  //}
464  //}
466 
467  //p.setParticle( *mother() ) ; // adds geoconstraint chi2 to the balance of the mother particle. Why?
468  if(vtxverbose>6){
469  std::cout<<"ParticleBase::projectConstraint(): projection is:"<<std::endl;
470  std::cout<<"r "; p.r().Print();
471  std::cout<<"V "; p.V().Print();
472  std::cout<<"H "; RhoCalculationTools::PrintMatrix(p.H());
473  }
474  return ErrCode::success ;
475 }
int row
Definition: anaLmdDigi.C:67
int vtxverbose
const TVectorD & r() const
Definition: Projection.h:37
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
virtual int momIndex() const
Definition: ParticleBase.h:71
virtual int lenIndex() const
Definition: ParticleBase.h:70
Double_t mom
Definition: plot_dirc.C:14
const TMatrixD & H() const
Definition: Projection.h:28
const TMatrixDSym & V() const
Definition: Projection.h:47
virtual int posIndex() const
Definition: ParticleBase.h:69
static void PrintMatrix(TMatrixT< double > m)
TPad * p2
Definition: hist-t7.C:117
const ParticleBase * mother() const
Definition: ParticleBase.h:60
double pz[39]
Definition: pipisigmas.h:14
ErrCode DecayTreeFitter::ParticleBase::projectMassConstraint ( const FitParams fitparams,
Projection p 
) const
virtualinherited

Definition at line 477 of file ParticleBase.cxx.

References DecayTreeFitter::Projection::H(), DecayTreeFitter::FitParams::par(), pz, DecayTreeFitter::Projection::r(), DecayTreeFitter::ErrCode::success, DecayTreeFitter::Projection::Vfast(), and vtxverbose.

479 {
480  if(vtxverbose>6){std::cout<<"ParticleBase::projectMassConstraint():"<<std::endl;}
481  double mass = pdtMass() ;
482  double mass2 = mass*mass ;
483  int momindex = momIndex() ;
484 
485  // initialize the value
486  double px = fitparams->par()(momindex+0) ;
487  double py = fitparams->par()(momindex+1) ;
488  double pz = fitparams->par()(momindex+2) ;
489  double E = fitparams->par()(momindex+3) ;
490  if(vtxverbose>6){std::cout<<"px="<<px<<", py="<<py<<", pz="<<pz<<", E="<<E<<", pdtmass="<<mass<<std::endl;}
491  p.r(0) = E*E-px*px-py*py-pz*pz-mass2 ;
492 
493  // calculate the projection matrix
494  p.H(0,momindex+0) = -2.0*px ;
495  p.H(0,momindex+1) = -2.0*py ;
496  p.H(0,momindex+2) = -2.0*pz ;
497  p.H(0,momindex+3) = 2.0*E ;
498 
499  // set the variance in the residual
500  double width = pdtWidth() ;
501  p.Vfast(0,0) = 4*mass*mass*width*width ;
502 
503  return ErrCode::success ;
504 }
int vtxverbose
const TVectorD & r() const
Definition: Projection.h:37
virtual int momIndex() const
Definition: ParticleBase.h:71
const TMatrixD & H() const
Definition: Projection.h:28
double pz[39]
Definition: pipisigmas.h:14
double & Vfast(int row, int col)
Definition: Projection.h:50
void DecayTreeFitter::ParticleBase::removeDaughter ( const ParticleBase pb)
inherited

Definition at line 100 of file ParticleBase.cxx.

Referenced by DecayTreeFitter::Fitter::remove().

101 {
102  daucontainer::iterator it = std::find(m_daughters.begin(),m_daughters.end(),pb) ;
103  if(it != m_daughters.end() ) {
104  ParticleBase* _dp = *it ;
105  m_daughters.erase(it) ;
106  if(_dp) delete _dp ;
107  } else {
108  std::cout << "ERROR: cannot remove particle, because not found ..." << std::endl ;
109  }
110 }
ParticleContainer m_daughters
Definition: ParticleBase.h:146
void DecayTreeFitter::ParticleBase::retrieveIndexMap ( indexmap anindexmap) const
virtualinherited

Definition at line 377 of file ParticleBase.cxx.

378 {
379 
380  anindexmap.push_back(std::pair<const ParticleBase*,int>(this,index())) ;
381  for(daucontainer::const_iterator it = m_daughters.begin() ;
382  it != m_daughters.end() ; ++it)
383  (*it)->retrieveIndexMap(anindexmap) ;
384 }
ParticleContainer m_daughters
Definition: ParticleBase.h:146
virtual int index() const
Definition: ParticleBase.h:59
void DecayTreeFitter::ParticleBase::setIndex ( int  i)
inlineprotectedinherited

Definition at line 141 of file ParticleBase.h.

References i, and DecayTreeFitter::ParticleBase::m_index.

141 { m_index = i ; }
Int_t i
Definition: run_full.C:25
bool DecayTreeFitter::ParticleBase::setMassConstraint ( bool  add)
inlineinherited

Definition at line 118 of file ParticleBase.h.

References DecayTreeFitter::ParticleBase::m_hasMassConstraint.

Referenced by DecayTreeFitter::DecayChain::setMassConstraint().

118  {
119  std::swap(add,m_hasMassConstraint) ;
120  return add != m_hasMassConstraint ;
121  }
void DecayTreeFitter::ParticleBase::setMassConstraint ( double  mass)
inlineinherited
void DecayTreeFitter::ParticleBase::setMother ( const ParticleBase m)
inlineinherited

Definition at line 108 of file ParticleBase.h.

References m, and DecayTreeFitter::ParticleBase::m_mother.

108 { m_mother = m ; }
__m128 m
Definition: P4_F32vec4.h:28
const ParticleBase * m_mother
Definition: ParticleBase.h:145
void DecayTreeFitter::ParticleBase::setName ( const std::string &  n)
inlineprotectedinherited

Definition at line 142 of file ParticleBase.h.

References DecayTreeFitter::ParticleBase::m_name, and n.

142 { m_name = n ; }
int n
void DecayTreeFitter::ParticleBase::setParticle ( RhoCandidate bc)
inlineinherited

Definition at line 113 of file ParticleBase.h.

References DecayTreeFitter::ParticleBase::m_particle.

113 { m_particle = bc ; }
virtual int DecayTreeFitter::MissingParticle::type ( ) const
inlinevirtual
void DecayTreeFitter::ParticleBase::updateIndex ( int &  offset)
virtualinherited

Definition at line 83 of file ParticleBase.cxx.

References offset(), and vtxverbose.

Referenced by DecayTreeFitter::Fitter::add(), and DecayTreeFitter::DecayChain::DecayChain().

84 {
85  if(vtxverbose>=5){std::cout<<"ParticleBase::updateIndex() start"<<std::endl;}
86  // first the daughters
87  for(const_iterator it = begin(); it!= end(); ++it) (*it)->updateIndex(offset) ;
88  // now the real work
89  m_index = offset ;
90  offset += dim() ;
91  if(vtxverbose>=5){std::cout<<"ParticleBase::updateIndex() end"<<std::endl;}
92 }
int vtxverbose
virtual int dim() const =0
TVector3 offset(2, 0, 0)
const_iterator begin() const
Definition: ParticleBase.h:100
daucontainer::const_iterator const_iterator
Definition: ParticleBase.h:97
const_iterator end() const
Definition: ParticleBase.h:101

The documentation for this class was generated from the following files: