GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » Analysis » Covariance Matrices in RhoCandidates
Covariance Matrices in RhoCandidates [message #16042] Tue, 25 March 2014 14:51 Go to next message
SHenssler is currently offline  SHenssler
Messages: 13
Registered: March 2014
Location: FZ Jülich
occasional visitor
From: *ext.kfa-juelich.de
Hello together,

I am currently evaulating alternative procedures for kinematic fitting and while doing some debugging i noticed, that the Covariance-Matrices i get are not positive-semi-definite.
I used the Rho-Macro for the kinematic fits and simply called my own routine after the vertex-fit was done (instead of calling the PndKinFitter).
My program also implements RhoFitterBase and after calling:

fDaughters.clear();
FindAndAddFinalStateDaughters(fHeadOfTree);

i take the P4-vectors and their covariances for each final state particle.
When i calcualte the eigenvectors for the covariances there are always some who are negative, which means the covariance matrices are not positive-semi-definite (i calculated the eigenvectors by hand for one example to make sure it is not a numeric problem and i get the same results).

Does anybody know something about this?

Thanks in andvance

Simon Henssler
Re: Covariance Matrices in RhoCandidates [message #16045 is a reply to message #16042] Tue, 25 March 2014 16:24 Go to previous messageGo to next message
Ralf Kliemt is currently offline  Ralf Kliemt
Messages: 500
Registered: May 2007
Location: GSI, Darmstadt
first-grade participant

From: *pool.mediaWays.net
Hello Simon,

Thanks for that finding.
Which macro do you use? I assume it is macro/run/ana_complete.C.
Please check those covariances before fitting. For one, the four-momenta of the RhoCandidates and if the issue is already present there, then try the reco candidate (PndPidCandidate/FairRecoCandidate).

Cheers
Ralf
Re: Covariance Matrices in RhoCandidates [message #16046 is a reply to message #16045] Tue, 25 March 2014 16:43 Go to previous messageGo to next message
SHenssler is currently offline  SHenssler
Messages: 13
Registered: March 2014
Location: FZ Jülich
occasional visitor
From: *ext.kfa-juelich.de
Hello Ralf,

i used the macro in tutorials/rho/tut_ana_task.C
i will check the covariances as you said, then i'll post the results again.

Cheers
Simon
Re: Covariance Matrices in RhoCandidates [message #16048 is a reply to message #16042] Tue, 25 March 2014 17:22 Go to previous messageGo to next message
SHenssler is currently offline  SHenssler
Messages: 13
Registered: March 2014
Location: FZ Jülich
occasional visitor
From: *ext.kfa-juelich.de
Hello again,

i checked the P4-Covariances of the RhoCandidates before doing any fitting and there are still some eigenvalues < 0, though it seem to be less than before.
I don't really understand what you mean by checking the RecoCandidates, because the FairRecoCandidate is virtual.

Greetings
Simon
Re: Covariance Matrices in RhoCandidates [message #16049 is a reply to message #16048] Tue, 25 March 2014 17:39 Go to previous messageGo to next message
Ralf Kliemt is currently offline  Ralf Kliemt
Messages: 500
Registered: May 2007
Location: GSI, Darmstadt
first-grade participant

From: *pool.mediaWays.net
Hi Simon,

That should be fine:
PndPidCandidate* myPidcand = (PndPidCandidate*) myRhocand->GetRecoCandidate();
Then proceed from there. PndPidCandidate inherits from FairRecoCandidate.

Cheers
Ralf
Re: Covariance Matrices in RhoCandidates [message #16061 is a reply to message #16042] Tue, 25 March 2014 22:13 Go to previous messageGo to next message
SHenssler is currently offline  SHenssler
Messages: 13
Registered: March 2014
Location: FZ Jülich
occasional visitor
From: *unitymediagroup.de
Hello Ralf,

i'm not really sure if this simply doesn't work, or if i'm doing something wrong...
if i do:
PndPidCandidate *myPidcand = (PndPidCandidate*) (jpsi[j]->GetRecoCandidate());

this works fine, but trying to access any member-functions, for example:
myPidCandidate->P4Cov().Print();
then i get a segmentation violation.

Greetings
Simon
Re: Covariance Matrices in RhoCandidates [message #16062 is a reply to message #16061] Wed, 26 March 2014 08:01 Go to previous messageGo to next message
Ralf Kliemt is currently offline  Ralf Kliemt
Messages: 500
Registered: May 2007
Location: GSI, Darmstadt
first-grade participant

From: *pool.mediaWays.net
Hi Simon,

Well, Only final state paticles have a RecoCand (which is basically the track information plus PID related properties from various detectors). A J/Psi is always a combined candidate and thus has no RecoCand. I think firstly you should look at the final state particles anyways.
To avoid segfaults, catch such pointer cunstructions with if(0=myPidcand) ...

Cheers
Ralf
Re: Covariance Matrices in RhoCandidates [message #16063 is a reply to message #16062] Wed, 26 March 2014 09:26 Go to previous messageGo to next message
SHenssler is currently offline  SHenssler
Messages: 13
Registered: March 2014
Location: FZ Jülich
occasional visitor
From: *ext.kfa-juelich.de
Hello Ralf,

i was just confused, because everything worked fine when i used the RhoCandidates directly... sorry i'm not really familiar with all the Panda physics and the computing framework,

anyway the calculated eigenvectors from the RhoCandidates and the PndPidCandidates are exactly the same and there are still some < 0. I used the TMatrixDEigen to calculate them, though i think with the values in a range of 10^-15 there should not occur any numeric issues.


Cheers
Simon
Re: Covariance Matrices in RhoCandidates [message #16111 is a reply to message #16042] Fri, 28 March 2014 13:35 Go to previous messageGo to next message
Ralf Kliemt is currently offline  Ralf Kliemt
Messages: 500
Registered: May 2007
Location: GSI, Darmstadt
first-grade participant

From: *gsi.de
Hi Simon,

The next to check would be the tracks themselves:

Get a track array (mind loading the reco file):
TClonesArray* tca = ( TClonesArray* ) fRootManager->GetObject ("SttMvdGemGenTrack");


Then get the track and proceed from there:
PndPidCandidate* pidCand = (PndPidCandidate*)cand->GetRecoCandidate();
PndTrack* track = ( PndTrack* ) tca->At ( pidCand->GetTrackIndex() );


Cheers
Ralf
Re: Covariance Matrices in RhoCandidates [message #16198 is a reply to message #16042] Thu, 03 April 2014 12:14 Go to previous messageGo to next message
SHenssler is currently offline  SHenssler
Messages: 13
Registered: March 2014
Location: FZ Jülich
occasional visitor
From: *ext.kfa-juelich.de
Hello Ralf,

I don't quite understand how to proceed with the tracks. Do they have covariances?
If they do, then how do I get them?

Thanks
Simon
Re: Covariance Matrices in RhoCandidates [message #16235 is a reply to message #16042] Fri, 04 April 2014 16:09 Go to previous messageGo to next message
Ralf Kliemt is currently offline  Ralf Kliemt
Messages: 500
Registered: May 2007
Location: GSI, Darmstadt
first-grade participant

From: *pool.mediaWays.net
Hello Simon,

You could go with the track parameters defined at the "first" hit of the measured trajectory:
PndPidCandidate* pidCand = (PndPidCandidate*)cand->GetRecoCandidate();
PndTrack* track = ( PndTrack* ) tca->At ( pidCand->GetTrackIndex() );

FairTrackParP* firstpar = track->GetParamFirst();


Then access the things via: GetX(), GetDX(), GetPx(), GetDPx() (and the other coordinates similar).
Header of FairTrackPar: here.

For the non-diagonal elements, i.e. the covariance matrix:
Double_t fistparCov[6][6];
firstpar->GetMARSCov(firstparCov); //cov is being filled here



If you want to access the prefit do this:
PndTrackCand* mytcand = track->GetTrackCandPtr();


Cheers
Ralf
Re: Covariance Matrices in RhoCandidates [message #16236 is a reply to message #16235] Fri, 04 April 2014 16:17 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: *to.infn.it
However also the candidate stores covariance matrices:

  const Float_t* GetErrorP7() const{return fErrP7;}
  const Float_t* GetCov() const{return fCov;}
  TMatrixD& Cov7() const;
  TMatrixD& P4Cov() const ;
Re: Covariance Matrices in RhoCandidates [message #16237 is a reply to message #16042] Fri, 04 April 2014 16:21 Go to previous messageGo to next message
Ralf Kliemt is currently offline  Ralf Kliemt
Messages: 500
Registered: May 2007
Location: GSI, Darmstadt
first-grade participant

From: *pool.mediaWays.net
Hi Stefano,

Those covariances are after the propagation to the IP. With the firstPar you get the actual values from the track fit. That is my point here.

Cheers
Ralf
Re: Covariance Matrices in RhoCandidates [message #16343 is a reply to message #16237] Wed, 16 April 2014 18:01 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: *to.infn.it
Sorry but I have not well understood, please excuse my ignoramce.
I suppose there can be negative values inside the covariance matrix, apart from the diagonal elements which must be positive. Now, how the eigenvectors enter and play a role? Are negative eigenvectors really problematic?
Re: Covariance Matrices in RhoCandidates [message #16344 is a reply to message #16343] Wed, 16 April 2014 19:37 Go to previous messageGo to next message
SHenssler is currently offline  SHenssler
Messages: 13
Registered: March 2014
Location: FZ Jülich
occasional visitor
From: *customers.d1-online.com
Hello Stefano,

positive semi definite does not mean that there cannot be negative values.
The Definition says, that any vector y multiplied in the way: y^t * C * y,
where C is the Covariance Matrix, must result in a value greater or equal to zero.
In a way that is the proof, that the Chi-Square value ( y^t * C^-1 * y ) is always positive.
Or rather, if C is not positive semi definite, then it cannot ne guaranteed that the Chi Square value is positive.
It is a mathematical property that every Covarince Matrix Must have.

Cheers
Simon
Re: Covariance Matrices in RhoCandidates [message #16345 is a reply to message #16344] Wed, 16 April 2014 22:02 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: *ip71.fastwebnet.it
Can you plot which kind of value you obtain and with which kind of particle?
Re: Covariance Matrices in RhoCandidates [message #16346 is a reply to message #16345] Thu, 17 April 2014 10:08 Go to previous messageGo to next message
SHenssler is currently offline  SHenssler
Messages: 13
Registered: March 2014
Location: FZ Jülich
occasional visitor
From: *customers.d1-online.com
You can Test if a Matrix ist positive semi definite by calculating the eigenvectors: if they are all positive, then the Matrix ist positive semi definite
That's what i mentioned before
Re: Covariance Matrices in RhoCandidates [message #16347 is a reply to message #16346] Thu, 17 April 2014 10:13 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: 93.48.236*
I repeat my question in more clear terms:
can you please tell what have you simulated, better if you upload the sim macro and the code you used to verify this negative values, so that one can reproduce your results?
Re: Covariance Matrices in RhoCandidates [message #16349 is a reply to message #16347] Thu, 17 April 2014 13:10 Go to previous messageGo to next message
SHenssler is currently offline  SHenssler
Messages: 13
Registered: March 2014
Location: FZ Jülich
occasional visitor
From: *customers.d1-online.com
Just as i mentioned at the start of this topic:
I used the rho macro in /tutorials/rho and then followed the steps Ralf proposed.
To verify the negative values i used the TMatrixDEigen Analysis from Root.
Re: Covariance Matrices in RhoCandidates [message #16350 is a reply to message #16349] Thu, 17 April 2014 13:43 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: 93.48.236*
Plese write exactly the code you used.
Re: Covariance Matrices in RhoCandidates [message #16351 is a reply to message #16350] Thu, 17 April 2014 13:58 Go to previous message
SHenssler is currently offline  SHenssler
Messages: 13
Registered: March 2014
Location: FZ Jülich
occasional visitor
From: *customers.d1-online.com
Hello Stefano,

I am on vacation right now and do not have access, so this will have to wait until next week.
Or you could ask Elisabetta, i think she verified the negative values.

Greetings
Simon
Previous Topic: option of polarization for Lambda-Lambdabar model
Next Topic: pi0 in fast simulation
Goto Forum:
  


Current Time: Fri Nov 15 16:48:15 CET 2019

Total time taken to generate the page: 0.02987 seconds