FairRoot/PandaRoot
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
RhoFitterBase Class Reference

#include <RhoFitterBase.h>

Inheritance diagram for RhoFitterBase:
DecayTreeFitter::Fitter Rho4CFitter RhoKalmanVtxFitter RhoKinFitter RhoKinHyperonFitter RhoKinHyperonVtxFitter RhoKinVtxFitter RhoDecayTreeFitter

Public Member Functions

 RhoFitterBase ()
 
 RhoFitterBase (RhoCandidate *decayTree)
 
 RhoFitterBase (const RhoFitterBase &)
 
 ~RhoFitterBase ()
 
Bool_t Fit ()
 
Bool_t FitAll ()
 
double Chi2Contribution (const RhoCandidate *)
 
double GetChi2 () const
 
int GetNdf () const
 
double GetProb () const
 
void SetVerbose (Bool_t v=kTRUE)
 

Protected Member Functions

RhoCandidateHeadOfTree () const
 
virtual Bool_t FitNode (RhoCandidate *b)
 
RhoCandidateCopyCand (RhoCandidate *)
 uppermost particle composite in tree More...
 
RhoCandidateCopyTree (RhoCandidate *)
 
void InsertChi2 (const RhoCandidate *bc, const double chi2)
 
void SetDaugthersFromComposite (RhoCandidate *cand)
 
void FindAndAddFinalStateDaughters (RhoCandidate *cand)
 
void SetFourMomentumByDaughters (RhoCandidate *composite)
 
void SetDecayVertex (RhoCandidate *composite, const TVector3 &vtx, const TMatrixD &CovVV)
 

Protected Attributes

Bool_t fVerbose
 
RhoCandidatefHeadOfTree
 
std::vector< RhoCandidate * > fDaughters
 
double fChiSquare
 
int fNDegreesOfFreedom
 

Private Member Functions

Bool_t IterateAndFit (RhoCandidate *b)
 

Private Attributes

std::map< Int_t, Double_tfChi2Map
 ! each particle's contribution to the chi^2 More...
 

Detailed Description

Definition at line 21 of file RhoFitterBase.h.

Constructor & Destructor Documentation

RhoFitterBase::RhoFitterBase ( )
inline

constructor

Definition at line 28 of file RhoFitterBase.h.

28 {};
RhoFitterBase::RhoFitterBase ( RhoCandidate decayTree)

Definition at line 30 of file RhoFitterBase.cxx.

References CopyTree(), fChi2Map, and fHeadOfTree.

30  : fVerbose ( kFALSE ), fChiSquare(-9999), fNDegreesOfFreedom(-9999)
31 {
32  //fHeadOfTree=CopyCand( head );
33  //TODO do we want to copy the trere here and now?
34  fHeadOfTree=CopyTree(head);
35  fChi2Map.clear();
36 }
std::map< Int_t, Double_t > fChi2Map
! each particle&#39;s contribution to the chi^2
Definition: RhoFitterBase.h:80
RhoCandidate * fHeadOfTree
Definition: RhoFitterBase.h:62
double fChiSquare
Definition: RhoFitterBase.h:74
RhoCandidate * CopyTree(RhoCandidate *)
int fNDegreesOfFreedom
Definition: RhoFitterBase.h:75
RhoFitterBase::RhoFitterBase ( const RhoFitterBase other)

Definition at line 42 of file RhoFitterBase.cxx.

References CopyTree(), and fHeadOfTree.

42  : TObject(other), fVerbose ( other.fVerbose )
43 {
44  //fHeadOfTree=CopyCand(*other.fHeadOfTree);
45  //TODO do we want to copy the tree here and now?
47 }
RhoCandidate * fHeadOfTree
Definition: RhoFitterBase.h:62
RhoCandidate * CopyTree(RhoCandidate *)
RhoFitterBase::~RhoFitterBase ( )

Definition at line 38 of file RhoFitterBase.cxx.

39 {
40 }

Member Function Documentation

Double_t RhoFitterBase::Chi2Contribution ( const RhoCandidate b)

access to the fitted candidates

Definition at line 86 of file RhoFitterBase.cxx.

References Double_t, fChi2Map, uid(), and RhoCandidate::Uid().

87 {
88  if(!b) return -999.;
89  Int_t uid = b->Uid();
90  Double_t chi2=fChi2Map[uid];
91  return chi2 >=0.0 ? chi2 : -1.;
92 }
Int_t Uid() const
Definition: RhoCandidate.h:419
std::map< Int_t, Double_t > fChi2Map
! each particle&#39;s contribution to the chi^2
Definition: RhoFitterBase.h:80
int uid(int lev, int lrun, int lmode)
Definition: autocutx.C:122
Double_t
RhoCandidate * RhoFitterBase::CopyCand ( RhoCandidate b)
protected

uppermost particle composite in tree

Definition at line 51 of file RhoFitterBase.cxx.

References RhoFactory::Instance(), RhoFactory::NewCandidate(), RhoCandidate::RemoveAssociations(), and RhoCandidate::SetFit().

Referenced by CopyTree().

52 {
54  newCand->RemoveAssociations();
55  b->SetFit(newCand);//ready to be modified
56  return newCand;
57 }
void RemoveAssociations()
static RhoFactory * Instance()
Definition: RhoFactory.cxx:34
void SetFit(RhoCandidate *b)
Definition: RhoCandidate.h:292
static RhoCandidate * NewCandidate()
Definition: RhoFactory.cxx:52
RhoCandidate * RhoFitterBase::CopyTree ( RhoCandidate head)
protected

Definition at line 61 of file RhoFitterBase.cxx.

References CopyCand(), RhoCandidate::Daughter(), i, RhoCandidate::IsComposite(), RhoCandidate::NDaughters(), and RhoCandidate::SetMotherLink().

Referenced by RhoFitterBase().

62 {
63  //std::cout<<"\n\tcopy tree "<<head->Uid()<<" "<<&head<<" "<<head->PdgCode()<<" "<<head->NDaughters()<<"...";
64  RhoCandidate* headcopy=CopyCand(head);
65  RhoCandidate* daucopy=0;
66  RhoCandidate* dau=0;
67  for(Int_t i=0;i<head->NDaughters();i++)
68  {
69  dau=head->Daughter(i);
70  //std::cout<<" daugter "<<dau->Uid()<<" "<<i<<" "<<dau->PdgCode()<<" at "<<dau<<" ";
71  if(dau == head) {
72  std::cout<<endl<<"*** Candidate is its own mother??? *** \n"<<std::endl;
73  std::cout<<" print: "<<*head<<std::endl;;
74  }
75  assert(dau != head);
76  if(dau->IsComposite()) daucopy=CopyTree(dau);
77  else daucopy=CopyCand(dau);
78  //std::cout<<"CopyTree: copied candidate "<<dau->Uid()<<std::endl;
79  daucopy->SetMotherLink(headcopy); //daughter link is set automatically, too
80  }
81  return headcopy;
82 }
Int_t i
Definition: run_full.C:25
void SetMotherLink(RhoCandidate *m, bool verbose=true)
Bool_t IsComposite() const
RhoCandidate * Daughter(Int_t n)
Int_t NDaughters() const
RhoCandidate * CopyTree(RhoCandidate *)
RhoCandidate * CopyCand(RhoCandidate *)
uppermost particle composite in tree
void RhoFitterBase::FindAndAddFinalStateDaughters ( RhoCandidate cand)
protected

Definition at line 149 of file RhoFitterBase.cxx.

References RhoCandidate::Daughter(), fDaughters, RhoCandidate::IsComposite(), RhoCandidate::IsLocked(), and RhoCandidate::NDaughters().

Referenced by Rho4CFitter::Fit(), RhoKinFitter::Fit(), and Rho4CFitter::FitConserveMasses().

150 {
151  RhoCandidate* tc;
152  for (int k=0;k<cand->NDaughters();k++) {
153  tc=cand->Daughter(k);
154  if (!tc->IsComposite() || tc->IsLocked()) { fDaughters.push_back(tc); }
155  else { FindAndAddFinalStateDaughters(tc); }
156  }
157  return;
158 }
void FindAndAddFinalStateDaughters(RhoCandidate *cand)
Bool_t IsComposite() const
RhoCandidate * Daughter(Int_t n)
Bool_t IsLocked()
Definition: RhoCandidate.h:330
std::vector< RhoCandidate * > fDaughters
Definition: RhoFitterBase.h:69
Int_t NDaughters() const
Bool_t RhoFitterBase::Fit ( )
Bool_t RhoFitterBase::FitAll ( )

Definition at line 101 of file RhoFitterBase.cxx.

References fHeadOfTree, RhoCandidate::IsLocked(), and IterateAndFit().

102 {
103  if(fHeadOfTree->IsLocked())
104  {
105  Warning("RhoFitterBase::FitAll","You tried to fit a locked candidate. Retuning kFALSE now.");
106  return kFALSE;
107  }
108  return IterateAndFit(fHeadOfTree);
109 }
Bool_t IsLocked()
Definition: RhoCandidate.h:330
RhoCandidate * fHeadOfTree
Definition: RhoFitterBase.h:62
Bool_t IterateAndFit(RhoCandidate *b)
Bool_t RhoFitterBase::FitNode ( RhoCandidate b)
protectedvirtual

Reimplemented in RhoKinHyperonVtxFitter, RhoKinVtxFitter, and RhoKalmanVtxFitter.

Definition at line 130 of file RhoFitterBase.cxx.

Referenced by Fit(), and IterateAndFit().

131 {
132  Warning("RhoFitterBase::FitNode","Method not implemented in %s",this->GetName());
133  return kFALSE;
134 }
double RhoFitterBase::GetChi2 ( ) const
inline
int RhoFitterBase::GetNdf ( ) const
inline

Definition at line 49 of file RhoFitterBase.h.

References fNDegreesOfFreedom.

Referenced by poormantracks(), and PndRhoTupleQA::qaFitter().

49 {return fNDegreesOfFreedom;};
int fNDegreesOfFreedom
Definition: RhoFitterBase.h:75
double RhoFitterBase::GetProb ( ) const
inline
RhoCandidate& RhoFitterBase::HeadOfTree ( ) const
inlineprotected

Definition at line 57 of file RhoFitterBase.h.

References fHeadOfTree.

57 { return *fHeadOfTree; }
RhoCandidate * fHeadOfTree
Definition: RhoFitterBase.h:62
void RhoFitterBase::InsertChi2 ( const RhoCandidate bc,
const double  chi2 
)
inlineprotected

Definition at line 66 of file RhoFitterBase.h.

References fChi2Map, and RhoCandidate::Uid().

Referenced by RhoKalmanVtxFitter::Calculate().

66 {fChi2Map[ bc->Uid()] = chi2;}
Int_t Uid() const
Definition: RhoCandidate.h:419
std::map< Int_t, Double_t > fChi2Map
! each particle&#39;s contribution to the chi^2
Definition: RhoFitterBase.h:80
Bool_t RhoFitterBase::IterateAndFit ( RhoCandidate b)
private

Definition at line 112 of file RhoFitterBase.cxx.

References Bool_t, RhoCandidate::Daughter(), FitNode(), i, RhoCandidate::IsComposite(), RhoCandidate::IsLocked(), and RhoCandidate::NDaughters().

Referenced by FitAll().

113 {
114  RhoCandidate* dau=0;
115  Bool_t check = kFALSE;
116  for(Int_t i=0;i<b->NDaughters();i++)
117  {
118  dau=b->Daughter(i);
119  if (dau->IsComposite() && !dau->IsLocked())
120  {
121  check = IterateAndFit(dau);
122  if(kFALSE==check) return kFALSE;
123  }
124  }
125  check = FitNode(b);
126  if(kFALSE==check) return kFALSE;
127  return kTRUE;
128 }
virtual Bool_t FitNode(RhoCandidate *b)
Int_t i
Definition: run_full.C:25
Bool_t IsComposite() const
RhoCandidate * Daughter(Int_t n)
Bool_t IsLocked()
Definition: RhoCandidate.h:330
Int_t NDaughters() const
Bool_t IterateAndFit(RhoCandidate *b)
void RhoFitterBase::SetDaugthersFromComposite ( RhoCandidate cand)
protected

Definition at line 136 of file RhoFitterBase.cxx.

References RhoCandidate::Daughter(), fDaughters, RhoCandidate::IsComposite(), and RhoCandidate::NDaughters().

Referenced by RhoKinHyperonFitter::Fit(), RhoKinVtxFitter::FitNode(), RhoKinHyperonVtxFitter::FitNode(), and RhoKinHyperonFitter::SetMatrices().

137 {
138  fDaughters.clear();
139  if(cand->IsComposite()){
140  RhoCandidate* tc;
141  for (int k=0;k<cand->NDaughters();k++) {
142  tc=cand->Daughter(k);
143  fDaughters.push_back(tc);
144  }
145  }
146  return;
147 }
Bool_t IsComposite() const
RhoCandidate * Daughter(Int_t n)
std::vector< RhoCandidate * > fDaughters
Definition: RhoFitterBase.h:69
Int_t NDaughters() const
void RhoFitterBase::SetDecayVertex ( RhoCandidate composite,
const TVector3 &  vtx,
const TMatrixD CovVV 
)
protected

Definition at line 178 of file RhoFitterBase.cxx.

References RhoCandidate::SetDecayVtx().

Referenced by RhoKalmanVtxFitter::Calculate(), RhoKinVtxFitter::SetOutput(), and RhoKinHyperonVtxFitter::SetOutput().

179 {
180  RhoError decaypointcov(CovVV);
181  RhoVector3Err decayvertex(vtx,decaypointcov);
182  composite->SetDecayVtx(decayvertex);
183 }
void SetDecayVtx(RhoVector3Err theVtx)
void RhoFitterBase::SetFourMomentumByDaughters ( RhoCandidate composite)
protected

Definition at line 160 of file RhoFitterBase.cxx.

References RhoCandidate::Cov7(), RhoCandidate::Daughter(), RhoCandidate::IsComposite(), RhoCandidate::IsLocked(), RhoCandidate::NDaughters(), RhoCandidate::P4(), RhoCandidate::SetCov7(), and RhoCandidate::SetP4().

Referenced by RhoKalmanVtxFitter::Calculate(), Rho4CFitter::Fit(), Rho4CFitter::FitConserveMasses(), RhoKinVtxFitter::SetOutput(), and RhoKinFitter::SetOutput().

161 {
162  RhoCandidate* tc;
163  TLorentzVector tmpLV;
164  TMatrixD tmpCov(7,7);
165  // Sum daughter fourmomenta, dive into nodes if necessary
166  for (int k=0;k<composite->NDaughters();k++) {
167  tc=composite->Daughter(k);
168  if (tc->IsComposite() && !tc->IsLocked()) { SetFourMomentumByDaughters(tc); }
169  tmpLV += tc->P4();
170  tmpCov = tmpCov + tc->Cov7();
171  }
172  composite->SetP4(tmpLV);
173  composite->SetCov7(tmpCov);
174  //std::cout<<" Base fitter cov7 from tc "<<tc->Uid()<<"/"<<tc->Charge()<<"/"<<tc->PdgCode()<<": ";tmpCov.Print();
175  return;
176 }
Bool_t IsComposite() const
RhoCandidate * Daughter(Int_t n)
void SetFourMomentumByDaughters(RhoCandidate *composite)
void SetP4(Double_t mass, const TVector3 &p3)
Bool_t IsLocked()
Definition: RhoCandidate.h:330
TLorentzVector P4() const
Definition: RhoCandidate.h:195
TMatrixD Cov7() const
Int_t NDaughters() const
void SetCov7(const TMatrixD &cov7)
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52
void RhoFitterBase::SetVerbose ( Bool_t  v = kTRUE)
inline

Definition at line 52 of file RhoFitterBase.h.

References fVerbose, and v.

52 {fVerbose=v;}
__m128 v
Definition: P4_F32vec4.h:4

Member Data Documentation

std::map<Int_t,Double_t> RhoFitterBase::fChi2Map
private

! each particle's contribution to the chi^2

Definition at line 80 of file RhoFitterBase.h.

Referenced by Chi2Contribution(), Fit(), InsertChi2(), and RhoFitterBase().

double RhoFitterBase::fChiSquare
protected
std::vector<RhoCandidate*> RhoFitterBase::fDaughters
protected
RhoCandidate* RhoFitterBase::fHeadOfTree
protected
int RhoFitterBase::fNDegreesOfFreedom
protected
Bool_t RhoFitterBase::fVerbose
protected

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