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

#include <RecoTrack.h>

Inheritance diagram for DecayTreeFitter::RecoTrack:
DecayTreeFitter::RecoParticle 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

 RecoTrack (RhoCandidate *bc, const ParticleBase *mother, const Configuration &config)
 
virtual ~RecoTrack ()
 
virtual ErrCode initPar2 (FitParams *)
 
virtual ErrCode initCov (FitParams *)
 
virtual int dimM () const
 
virtual int type () const
 
virtual ErrCode projectRecoConstraint (const FitParams *, Projection &) const
 
ErrCode updCache (const FitParams *fitparams)
 
virtual int nFinalChargedCandidates () const
 
virtual void addToConstraintList (constraintlist &alist, int depth) const
 
void setFlightLength (double flt)
 
const DecayTreeFitter::Statestate () const
 
const DecayTreeFitter::StateclosestCachedState (double z)
 
virtual ErrCode initPar1 (FitParams *)
 
virtual std::string parname (int index) const
 
virtual int dim () const
 
virtual int momIndex () const
 
virtual bool hasEnergy () const
 
virtual ErrCode projectConstraint (Constraint::Type, const FitParams *, Projection &) const
 
virtual double chiSquare (const FitParams *fitparams) 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 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)
 
void setParticle (RhoCandidate *bc)
 
void collectVertexDaughters (daucontainer &particles, int posindex)
 
bool setMassConstraint (bool add)
 
void setMassConstraint (double mass)
 

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 ()
 

Private Attributes

const TVector3 m_bfield
 
const RhoCandidatem_candidate
 
const RecoTrackStateProviderm_stateprovider
 
bool m_useTrackTraj
 
bool m_cached
 
double m_flt
 
DecayTreeFitter::State m_state
 
std::vector
< DecayTreeFitter::State
m_StateCache
 

Detailed Description

Definition at line 30 of file RecoTrack.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::RecoTrack::RecoTrack ( RhoCandidate bc,
const ParticleBase mother,
const Configuration config 
)

Definition at line 44 of file RecoTrack.cxx.

References m_candidate, m_state, m_stateprovider, and DecayTreeFitter::RecoTrackStateProvider::state().

47 : RecoParticle(cand,aMother),
48 // m_track(cand.proto()->track()),
49 m_candidate(cand),
50 m_stateprovider( config.stateProvider() ),
51 m_useTrackTraj( config.useTrackTraj() ),
52 // m_tracktraj(0),
53 m_cached(false),
54 m_flt(0)
55 // m_bremEnergy(0),
56 // m_bremEnergyCov(0)
57 {
58  //set it to something such that we have a momentum estimate
59  //m_state = m_track->firstState() ;
60  m_stateprovider->state( m_state,const_cast<RhoCandidate*>(m_candidate));
61  // get the bremenergy correction
62  //[R.Kliemt, Dec.2014]
63  // TODO: How do we want to treat Bremsstrahlung? Certainly not inside the Fitter!
64  // if( particle().particleID().abspid() == 11 ) {
65  // // FIXME: this is a hack. it will go wrong if you fit the
66  // // updated decay tree twice. to do this properly we need to use
67  // // the bremadding tools, but there are other problems with that.
68  // double momentumFromTrack = 1/std::abs(m_state.qOverP() ) ;
69  // double momentumError2FromTrack = m_state.covariance()(4,4) * std::pow(momentumFromTrack,4) ;
70  // double momentumFromParticle = particle().momentum().P() ;
71  // double momentumError2FromParticle =
72  // particle().momCovMatrix()(3,3) * std::pow(particle().momentum().E()/momentumFromParticle,2) ;
73  // m_bremEnergyCov = momentumError2FromParticle - momentumError2FromTrack ;
74  // m_bremEnergy = momentumFromParticle - momentumFromTrack ;
75  // // if the correction is too small or unphysical, ignore it. the units are MeV.
76  // if( !(m_bremEnergyCov >1*Gaudi::Units::MeV*Gaudi::Units::MeV &&
77  // m_bremEnergy>1*Gaudi::Units::MeV ) )
78  // m_bremEnergy = m_bremEnergyCov = 0 ;
79  // if(vtxverbose>=1) {
80  // std::cout << "Fitting an electron. ("
81  // << momentumFromTrack << " +/- " << std::sqrt( momentumError2FromTrack ) << ") --> ("
82  // << momentumFromParticle << " +/- " << std::sqrt( momentumError2FromParticle ) << ")" << std::endl ;
83  // std::cout << "brem correction: " << m_bremEnergy << " +/- " << std::sqrt( m_bremEnergyCov ) << std::endl ;
84  // }
85  // applyBremCorrection(m_state,m_bremEnergy,m_bremEnergyCov) ;
86  // }
87 }
const RhoCandidate * m_candidate
Definition: RecoTrack.h:60
const RecoTrackStateProvider * stateProvider() const
Definition: Configuration.h:27
RecoParticle(RhoCandidate *bc, const ParticleBase *mother)
DecayTreeFitter::State m_state
Definition: RecoTrack.h:67
void state(DecayTreeFitter::State &aState, RhoCandidate *track) const
const RecoTrackStateProvider * m_stateprovider
Definition: RecoTrack.h:62
virtual DecayTreeFitter::RecoTrack::~RecoTrack ( )
inlinevirtual

Definition at line 35 of file RecoTrack.h.

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::RecoTrack::addToConstraintList ( constraintlist alist,
int  depth 
) const
inlinevirtual

Implements DecayTreeFitter::ParticleBase.

Definition at line 49 of file RecoTrack.h.

References dimM(), and DecayTreeFitter::Constraint::track.

49  {
50  alist.push_back(Constraint(this,Constraint::track,depth,dimM()) ) ;
51  }
virtual int dimM() const
Definition: RecoTrack.h:39
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 ; }
double DecayTreeFitter::RecoParticle::chiSquare ( const FitParams fitparams) const
virtualinherited

Definition at line 50 of file RecoParticle.cxx.

References DecayTreeFitter::FitParams::dim(), and p.

51 {
52  std::cout<<" Marke 3" <<std::endl;
53  // project
54  Projection p(fitparams->dim(),dimM()) ;
55  projectRecoConstraint(fitparams,p) ;
56  return p.chiSquare() ;
57 }
virtual ErrCode projectRecoConstraint(const FitParams *fitparams, Projection &p) const =0
Double_t p
Definition: anasim.C:58
virtual int dimM() const =0
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
const DecayTreeFitter::State & DecayTreeFitter::RecoTrack::closestCachedState ( double  z)

Definition at line 254 of file RecoTrack.cxx.

References dz, i, and z.

255 {
256  // give the state with the best matching z coordinate, for an empty cache vector, we'll return the "current state"
257  int beststate=-1;
258  double bestdz=9999; //[cm] initially stupidly large
259  for (unsigned int i=0;i<m_StateCache.size();i++){
260  double dz=std::abs(m_StateCache[i].z() - z);
261  if(dz < bestdz)
262  {
263  bestdz=dz;
264  beststate=i;
265  }
266  }
267  if(beststate>=0) return m_StateCache[beststate];
268  else return m_state;
269 }
Int_t i
Definition: run_full.C:25
std::vector< DecayTreeFitter::State > m_StateCache
Definition: RecoTrack.h:68
DecayTreeFitter::State m_state
Definition: RecoTrack.h:67
Double_t z
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::RecoParticle::dim ( ) const
inlinevirtualinherited

Implements DecayTreeFitter::ParticleBase.

Definition at line 27 of file RecoParticle.h.

27 { return 3; } //(px,py,pz)
virtual int DecayTreeFitter::RecoTrack::dimM ( ) const
inlinevirtual

Implements DecayTreeFitter::RecoParticle.

Definition at line 39 of file RecoTrack.h.

Referenced by addToConstraintList().

39 { return 5 ; }
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::RecoParticle::hasEnergy ( ) const
inlinevirtualinherited

Reimplemented from DecayTreeFitter::ParticleBase.

Definition at line 30 of file RecoParticle.h.

30 { return false ; }
bool DecayTreeFitter::ParticleBase::hasMassConstraint ( ) const
inlineprotectedinherited
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::RecoTrack::initCov ( FitParams fitparams)
virtual

Definition at line 104 of file RecoTrack.cxx.

References DecayTreeFitter::FitParams::cov(), particle, and row.

105 {
106  // we only need a rough estimate of the covariance
107  assert(m_cached) ;
108  TMatrixD covP = particle()->P3Cov() ;
109  int momindex = momIndex() ;
110  for(int row=0; row<3; row++)
111  fitparams->cov()(momindex+row,momindex+row) = 1000*covP(row,row) ;
112  return ErrCode() ;
113 }
int row
Definition: anaLmdDigi.C:67
RhoError P3Cov() const
RhoCandidate * particle() const
Definition: ParticleBase.h:57
virtual int momIndex() const
Definition: RecoParticle.h:29
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52
TMatrixDSym & cov()
Definition: FitParams.h:34
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
virtual ErrCode DecayTreeFitter::RecoParticle::initPar1 ( FitParams )
inlinevirtualinherited
ErrCode DecayTreeFitter::RecoTrack::initPar2 ( FitParams fitparams)
virtual

Implements DecayTreeFitter::ParticleBase.

Definition at line 90 of file RecoTrack.cxx.

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

91 {
92  if(vtxverbose>5){std::cout<<"RecoTrack::initPar2: - updcache"<<std::endl;}
93  ErrCode rc = updCache(fitparams) ;
94  const TVector3& recoP = particle()->P3() ;
95  int momindex = momIndex() ;
96  if(vtxverbose>5){std::cout<<"RecoTrack::initPar2: - write p3 to fitparams at momindex "<<momindex<<std::endl;}
97  fitparams->par(momindex+0) = recoP.x() ;
98  fitparams->par(momindex+1) = recoP.y() ;
99  fitparams->par(momindex+2) = recoP.z() ;
100  return rc ;
101 }
ErrCode updCache(const FitParams *fitparams)
Definition: RecoTrack.cxx:124
RhoCandidate * particle() const
Definition: ParticleBase.h:57
virtual int momIndex() const
Definition: RecoParticle.h:29
int vtxverbose
TVector3 P3() const
Definition: RhoCandidate.h:199
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::RecoParticle::momIndex ( ) const
inlinevirtualinherited

Reimplemented from DecayTreeFitter::ParticleBase.

Definition at line 29 of file RecoParticle.h.

References DecayTreeFitter::ParticleBase::index().

29 { 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
virtual int DecayTreeFitter::RecoTrack::nFinalChargedCandidates ( ) const
inlinevirtual

Reimplemented from DecayTreeFitter::ParticleBase.

Definition at line 47 of file RecoTrack.h.

47 { return 1 ; }
std::string DecayTreeFitter::RecoParticle::parname ( int  index) const
virtualinherited

Reimplemented from DecayTreeFitter::ParticleBase.

Definition at line 28 of file RecoParticle.cxx.

References DecayTreeFitter::ParticleBase::parname().

29 {
30  return ParticleBase::parname(ind+4) ;
31 }
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::RecoParticle::projectConstraint ( Constraint::Type  aType,
const FitParams fitparams,
Projection p 
) const
virtualinherited

Reimplemented from DecayTreeFitter::ParticleBase.

Definition at line 34 of file RecoParticle.cxx.

References DecayTreeFitter::Constraint::photon, DecayTreeFitter::ParticleBase::projectConstraint(), and DecayTreeFitter::Constraint::track.

37 {
38  ErrCode aStatus ;
39  switch(aType) {
40  case Constraint::track:
41  case Constraint::photon:
42  aStatus |= projectRecoConstraint(fitparams,p) ;
43  break ;
44  default:
45  aStatus |= ParticleBase::projectConstraint(aType,fitparams,p) ;
46  }
47  return aStatus ;
48 }
virtual ErrCode projectRecoConstraint(const FitParams *fitparams, Projection &p) const =0
virtual ErrCode projectConstraint(Constraint::Type, const FitParams *, Projection &) const
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
ErrCode DecayTreeFitter::RecoTrack::projectRecoConstraint ( const FitParams fitparams,
Projection p 
) const
virtual

Implements DecayTreeFitter::RecoParticle.

Definition at line 281 of file RecoTrack.cxx.

References col, dz, DecayTreeFitter::Projection::H(), mom, DecayTreeFitter::FitParams::par(), RhoCalculationTools::PrintMatrix(), pz, DecayTreeFitter::Projection::r(), row, sqrt(), status, DecayTreeFitter::Projection::V(), DecayTreeFitter::Projection::Vfast(), and vtxverbose.

282 {
283  ErrCode status ;
284  assert(m_cached) ;
285  if(vtxverbose>=5)std::cout<<"RecoTrack::projectRecoConstraint()"<<std::endl;
286  (const_cast<RecoTrack*>(this))->updCache(fitparams) ;
287  if(vtxverbose>=5)std::cout<<"RecoTrack::projectRecoConstraint() cache updated"<<std::endl;
288 
289  int posindex = mother()->posIndex() ;
290  TVector3 motherpos(fitparams->par()(posindex+0),
291  fitparams->par()(posindex+1),
292  fitparams->par()(posindex+2)) ;
293 
294  int momindex = momIndex() ;
295  double px = fitparams->par()(momindex+0) ;
296  double py = fitparams->par()(momindex+1) ;
297  double pz = fitparams->par()(momindex+2) ;
298  double mom2 = px*px+py*py+pz*pz ;
299  double mom = std::sqrt(mom2) ;
300  double tx = px/pz ;
301  double ty = py/pz ;
302  double qop = charge() / mom ;
303 
304  double dtxdpx = 1./pz ;
305  double dtxdpz = -tx/pz ;
306  double dtydpy = 1./pz ;
307  double dtydpz = -ty/pz ;
308 
309  double dqopdpx = - qop * px/mom2 ;
310  double dqopdpy = - qop * py/mom2 ;
311  double dqopdpz = - qop * pz/mom2 ;
312 
313  if(vtxverbose>=5)std::cout<<"RecoTrack::projectRecoConstraint() residual"<<std::endl;
314  // fill the residual
315  const TVectorD& m_m = m_state.stateVector() ;
316  const TMatrixD& m_V = m_state.covariance() ;
317  double dz = m_state.z() - motherpos.z() ;
318 
319  if(vtxverbose>=5) {
320  std::cout<<"RecoTrack::projectRecoConstraint() "<<std::endl;
321  std::cout<<"----------------------"<<std::endl;
322  std::cout<<" state position: (" <<m_state.x()<<","<<m_state.y()<<","<<m_state.z()<<")"<<std::endl;
323  std::cout<<" mother pos: (" <<motherpos.x()<<","<<motherpos.y()<<","<<motherpos.z()<<")"<<std::endl;
324  std::cout<<" state tx,ty,q/p: (" <<m_state.tx()<<","<<m_state.ty()<<","<<m_state.qOverP()<<")"<<std::endl;
325  std::cout<<" fitpar tx, ty, q/p: (" <<tx<<","<<ty<<","<<qop<<")"<<std::endl;
326  std::cout<<" drift dz*(tx,ty,1): (" <<dz*tx<<","<<dz*ty<<","<<dz<<")" <<std::endl;
327  std::cout<<" fitpar mom: (" <<px<<","<<py<<","<<pz<<")"<<std::endl;
328  std::cout<<" q, mom: (" <<charge()<<","<<mom<<")"<<std::endl;
329  std::cout<<"----------------------"<<std::endl;
330  }
332  p.r(0) = m_m(0) - motherpos.x() - dz*tx ;
333  p.r(1) = m_m(1) - motherpos.y() - dz*ty ;
334  p.r(2) = m_m(2) - tx ;
335  p.r(3) = m_m(3) - ty ;
336  p.r(4) = m_m(4) - qop ;
337 
338  if(vtxverbose>=5)std::cout<<"RecoTrack::projectRecoConstraint() projection"<<std::endl;
339  // compute the projection matrix
340  // derivative of position to position of mother
341  p.H(0,posindex+0) = -1 ;
342  p.H(1,posindex+1) = -1 ;
343  p.H(0,posindex+2) = tx ;
344  p.H(1,posindex+2) = ty ;
345 
346  // derivative of position to 3-momentum
347  p.H(0,momindex+0) = -dz * dtxdpx ;
348  p.H(0,momindex+2) = -dz * dtxdpz ;
349  p.H(1,momindex+1) = -dz * dtydpy ;
350  p.H(1,momindex+2) = -dz * dtydpz ;
351 
352  // derivative of slopes/qop to 3-momentum
353  p.H(2,momindex+0) = -dtxdpx ;
354  p.H(2,momindex+2) = -dtxdpz ;
355  p.H(3,momindex+1) = -dtydpy ;
356  p.H(3,momindex+2) = -dtydpz ;
357  p.H(4,momindex+0) = -dqopdpx ;
358  p.H(4,momindex+1) = -dqopdpy ;
359  p.H(4,momindex+2) = -dqopdpz ;
360 
361  if(vtxverbose>=5)std::cout<<"RecoTrack::projectRecoConstraint() covariance"<<std::endl;
362  // copy the covariance matrix
363  for(int row=0; row<dimM(); row++)
364  for(int col=0; col<dimM()/*=row*/; col++)
365  p.Vfast(row,col) = m_V(row,col) ;
366 
367  if(vtxverbose>6){
368  std::cout<<"RecoTrack::projectRecoConstraint(): projection is:"<<posindex<<std::endl;
369  std::cout<<"r "; p.r().Print();
370  std::cout<<"V "; p.V().Print();
371  std::cout<<"H "; RhoCalculationTools::PrintMatrix(p.H());
372  }
373  if(vtxverbose>=5)std::cout<<"RecoTrack::projectRecoConstraint() finished"<<std::endl;
374  return status ;
375 
376 }
int row
Definition: anaLmdDigi.C:67
const TVectorD & r() const
Definition: Projection.h:37
const TMatrixDSym & covariance() const
Definition: State.h:159
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
int col
Definition: anaLmdDigi.C:67
Double_t mom
Definition: plot_dirc.C:14
double z() const
Definition: State.h:86
double y() const
Definition: State.h:85
virtual int momIndex() const
Definition: RecoParticle.h:29
const TMatrixD & H() const
Definition: Projection.h:28
const TMatrixDSym & V() const
Definition: Projection.h:47
DecayTreeFitter::State m_state
Definition: RecoTrack.h:67
virtual int posIndex() const
Definition: ParticleBase.h:69
static void PrintMatrix(TMatrixT< double > m)
virtual int dimM() const
Definition: RecoTrack.h:39
double ty() const
Definition: State.h:91
double tx() const
Definition: State.h:90
double x() const
Definition: State.h:84
const TVectorD & stateVector() const
Definition: State.h:156
int vtxverbose
double qOverP() const
Definition: State.h:93
const ParticleBase * mother() const
Definition: ParticleBase.h:60
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52
double pz[39]
Definition: pipisigmas.h:14
int status[10]
Definition: f_Init.h:28
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::RecoTrack::setFlightLength ( double  flt)
inline

Definition at line 53 of file RecoTrack.h.

References m_flt.

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

53 { m_flt = flt ; }
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 ; }
const DecayTreeFitter::State& DecayTreeFitter::RecoTrack::state ( ) const
inline

Definition at line 56 of file RecoTrack.h.

References m_state.

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

56 { return m_state ; }
DecayTreeFitter::State m_state
Definition: RecoTrack.h:67
virtual int DecayTreeFitter::RecoTrack::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
ErrCode DecayTreeFitter::RecoTrack::updCache ( const FitParams fitparams)

Definition at line 124 of file RecoTrack.cxx.

References DecayTreeFitter::ErrCode::badsetup, dz, name, DecayTreeFitter::FitParams::par(), r, sqrt(), vtxverbose, x, y, and DecayTreeFitter::State::z().

125 {
126  //if(vtxverbose>5){std::cout<<"RecoTrack::updCache() - TODO: fix Stateprovider with real to-Z-propagation! "<<std::endl;}
127  ErrCode rc ;
128  //m_cached = true ; // DIRTY
129  //return rc; // Somewhat dirty
130 
131  // declare some constants
132  const double ztolerance = m_stateprovider->ToleranceZ();//0.05; //*Gaudi::Units::cm ;
133  //const double ztolerance = m_stateprovider->ToleranceZ();
134  const double maxR = 0.05; //* Gaudi::Units::cm ; Beampipe radius in PANDA is 2cm
135 
136  //A don't do anything if too few of a change
137  //B try cache
138  //C ask stateprovider
139  // TODO really from Rhocand?
141  if(vtxverbose>5){std::cout<<"RecoTrack::updCache() - ask for fitparam z at posindex+2 = "<<mother()->posIndex()+2<<std::endl;}
142  double vx = fitparams->par()(mother()->posIndex()+0) ;
143  double vy = fitparams->par()(mother()->posIndex()+1) ;
144  double vz = fitparams->par()(mother()->posIndex()+2) ;
145  double dz = vz - m_state.z() ;
146  double x = m_state.x() + dz * m_state.tx() ;
147  double y = m_state.y() + dz * m_state.ty() ;
148  double r = std::sqrt( x*x + y*y ) ;
149  if(vtxverbose>5){std::cout<<"RecoTrack::updCache() - fitpar z="<<vz<<" current state z="<<m_state.z()<<" dz="<<dz<<" ztolerance="<<ztolerance<<std::endl;}
150  // If we stay close to the existing state, don't change anything.
151  if( std::abs( dz ) > ztolerance )
152  {
153  // first just look for the closest cached state
154  if(vtxverbose>5){std::cout<<"RecoTrack::updCache() - find cached state"<<std::endl;}
155  const DecayTreeFitter::State& aState = closestCachedState ( vz ) ;
156  if( std::abs( aState.z() - vz ) < std::abs( dz ) )
157  {
158  if(vtxverbose>5)std::cout << "RecoTrack::updCache(): Found a closer state! " << name() << " fitpar z=" << vz << " current state z=" << m_state.z() << " better state z=" << aState.z() << std::endl ;
159  m_state = aState ;
160  dz = vz - m_state.z() ;
161  }
162  }
163 
164  if( std::abs( dz ) > ztolerance || r > maxR )
165  {
166  if(vtxverbose>5)std::cout << "RecoTrack::updCache(): calculate a new state."<< std::endl ;
167  // now that there is no cached state closeby, we'll fetch one
168  if( !m_stateprovider ) {
169  std::cerr<<"ERROR: DecayTreeFitter::RecoTrack::updCache() has no StateProvider"<<std::endl;
170  m_cached=false;
171  rc = ErrCode::badsetup;
172  return rc;
173  }
174  if(vtxverbose>5){std::cout<<"RecoTrack::updCache() - call stateprovider"<<std::endl;}
175  m_stateprovider->state(m_state,const_cast<RhoCandidate*>(m_candidate),vx,vy,vz) ;
176  m_StateCache.push_back(m_state);
177  }
178 
179  if(vtxverbose>5){std::cout<<"RecoTrack::updCache() - done"<<std::endl;}
180  m_cached = true ;
181  return rc ;
182 }
double r
Definition: RiemannTest.C:14
const RhoCandidate * m_candidate
Definition: RecoTrack.h:60
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
double z() const
Definition: State.h:86
double y() const
Definition: State.h:85
std::vector< DecayTreeFitter::State > m_StateCache
Definition: RecoTrack.h:68
const DecayTreeFitter::State & closestCachedState(double z)
Definition: RecoTrack.cxx:254
DecayTreeFitter::State m_state
Definition: RecoTrack.h:67
const std::string & name() const
Definition: ParticleBase.h:61
virtual int posIndex() const
Definition: ParticleBase.h:69
Double_t x
double ty() const
Definition: State.h:91
double tx() const
Definition: State.h:90
Double_t y
double x() const
Definition: State.h:84
void state(DecayTreeFitter::State &aState, RhoCandidate *track) const
int vtxverbose
const ParticleBase * mother() const
Definition: ParticleBase.h:60
const RecoTrackStateProvider * m_stateprovider
Definition: RecoTrack.h:62

Member Data Documentation

const TVector3 DecayTreeFitter::RecoTrack::m_bfield
private

Definition at line 59 of file RecoTrack.h.

bool DecayTreeFitter::RecoTrack::m_cached
private

Definition at line 65 of file RecoTrack.h.

const RhoCandidate* DecayTreeFitter::RecoTrack::m_candidate
private

Definition at line 60 of file RecoTrack.h.

Referenced by RecoTrack().

double DecayTreeFitter::RecoTrack::m_flt
private

Definition at line 66 of file RecoTrack.h.

Referenced by setFlightLength().

DecayTreeFitter::State DecayTreeFitter::RecoTrack::m_state
private

Definition at line 67 of file RecoTrack.h.

Referenced by RecoTrack(), and state().

std::vector<DecayTreeFitter::State> DecayTreeFitter::RecoTrack::m_StateCache
private

Definition at line 68 of file RecoTrack.h.

const RecoTrackStateProvider* DecayTreeFitter::RecoTrack::m_stateprovider
private

Definition at line 62 of file RecoTrack.h.

Referenced by RecoTrack().

bool DecayTreeFitter::RecoTrack::m_useTrackTraj
private

Definition at line 63 of file RecoTrack.h.


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