Home » PANDA » PandaRoot » Analysis » Vertex Fitter in Fast simulation
Vertex Fitter in Fast simulation [message #16125] 
Mon, 31 March 2014 15:52 
donghee
Messages: 385 Registered: January 2009 Location: Germnay

firstgrade participant 
From: *kph.unimainz.de


Hi Ralf,
Does vertex fitting make sense in fast simulation?
PndKinVtxFitter for D+ or D give constant chi2 value as 2e+06 in the fast simulation.
For PndVtxPRG I have same problem.
Best wishes,
Donghee












Re: Vertex Fitter in Fast simulation [message #16146 is a reply to message #16144] 
Tue, 01 April 2014 11:58 
donghee
Messages: 385 Registered: January 2009 Location: Germnay

firstgrade participant 
From: *kph.unimainz.de


We have few choice including your suggestion.
1. take a reference track, then get position.
2. Access poca in RhoTupleQA ntuple, which is already stored as "prefix"+pocax(y,z,qa) in your ntuple.
3. Redo poca by hand as like this where dp[j] is your candidate list.
PndVtxPoca POCAvtx;
TVector3 POCAvertex(0,0,0);
double POCA=10000;
double POCAdist=10000;
POCA = POCAvtx.GetPocaVtx(POCAvertex,dp[j]);
double poca_x = POCAvertex.);
double poca_y = POCAvertex.Y();
double poca_z = POCAvertex.Z();
I think that this way one may avoid ambiguity for choice of reference track.
But disadvantage is that POCA approach cannot be used with neutral composite as like pion0 k_s or Lambda0, unfortunately.
Best wished,
Donghee





Re: Vertex Fitter in Fast simulation [message #16190 is a reply to message #16137] 
Wed, 02 April 2014 18:04 
Elisabetta Prencipe (2)
Messages: 214 Registered: February 2013

firstgrade participant 
From: *ikp.kfajuelich.de


Hi Ralf,
I have one more question for today.
In the trunk 24275 now I get an analysis macro (fastsim). I can check basic plot of 4momentum, event shape, ... fine.
I want now to use the vertex fitter and then check the mass resolution.
So, I write for Ds, in the chain pbarp >Ds Ds(2536)+:
qa.qaComp("Ds", Dslist[j], ntp2); ///this was already in the analysis macro provided
//with this line I obtain all info on 4mom and mass
//Here I add info related to the vertex fitter
PndKinVtxFitter vtxfitter(Dslist[j]);
vtxfitter.Fit();
double chi2_vtx=vtxfitter.GetChi2();
if (chi2_vtx>0.){
RhoCandidate *jfit = Dslist[j]>GetFit();
TVector3 jVtx=jfit>Pos();
}
qa.qaComp("Ds_vtx_", XXXX, ntp2);
What shall I write where I put XXXX? I can't write Dslist[j], otherwise I get exactly same value as without the vertex fitter.
Could you help me, please, to understand how to get this in?
Thank you very much for your help!
Elisabetta




Re: Vertex Fitter in Fast simulation [message #16199 is a reply to message #16125] 
Thu, 03 April 2014 12:48 
Elisabetta Prencipe (2)
Messages: 214 Registered: February 2013

firstgrade participant 
From: *ikp.kfajuelich.de


Hi Donghee,
thank you for your reply.
Actually my question is not how to address the vertex fitter(s) in the full simulation macro: there I have, and it works.
Different vtx fitters give different mass resolutions. As well as I understood (but I may be wrong) the sense of performing the fast simulation campaign and repeat what we already set up in the release jan14 (with full simulation) is to check differences in efficiency and resolution, so we can decide if the fast simulation is compatible with what we already did with full simulation. Right now I am repeating my simulations (full and fast) in the new release. In the case of positive answer from the fast simulation tests, it will be easier to try and check the 4 detector setups proposed in one of the previous computing meeting, using the fast simulation only.
If PANDA likes the comparison in this way, then I go ahead.
My concern now is which vtx fitter is used by default in the fast simulation. In the case of my analysis, it depends which one is used, results can change in a sensitive way. So, what shall I compare, and with what?
My next post will be in the proper forum dedicated to the fast simulation.
cheers, Elisabetta








Re: Vertex Fitter in Fast simulation [message #16329 is a reply to message #16233] 
Wed, 16 April 2014 00:05 
Malte Albrecht
Messages: 11 Registered: May 2012

occasional visitor 
From: *adsl.alicedsl.de


Hi!
I tried to perform 4C as well as MassConstraint Fits in the fast sim. Using the PndKinFitter, as in Klaus' FastSim example works fine.
The MassConstraintFit does however not work... I tried the following:
PndKinFitter etaFit(etaCand);
etaFit.AddMassConstraint(0.547862);
etaFit.Fit();
etaCand in this example is a RhoCandidate* composed of two gammas.
The Fit always gives me:
Error in <TDecompLU::DecomposeLUCrout>: matrix is singular
Error in <TDecompLU::InvertLU>: matrix is singular, 0 diag elements < tolerance of 2.2204e16
chi2 is always zero, and it seems the fit does not do anything...
Is it correct to use the PndKinFitter in that way? Whats going wrong here?
Thanks!
Best regards,
Malte
[Updated on: Wed, 16 April 2014 00:08] Report message to a moderator




Re: Vertex Fitter in Fast simulation [message #16362 is a reply to message #16330] 
Thu, 17 April 2014 19:49 
Malte Albrecht
Messages: 11 Registered: May 2012

occasional visitor 
From: *ep1.ruhrunibochum.de


Hi Klaus!
Ah, okay I see.
I looked a bit into fsim/PndFastSim.cxx and tried to understand how the covariances are handled. As far as I see this, smearTrack() is called for each particle from the main Exec()loop. From there, cutAndSmear() is called  again for each particle. Further on in cutAndSmear() the function SetFlatCovMatrix(t,dp,dtheta,dphi,dE,dV.),dV.Y(),dV.Z()) is called with the appropriate values. Back in the main Exec()loop the 7x7covariance matrix (Cov7) is only set for charged particles (first time, that uncharged are cut out).
Wouldnt it be possible, to just call SetFlatCovMatrix with appropriate values for neutrals, and fill the Cov7 then? If so, what are good values for neutral tracks and where to get them from? Maybe you can point me into the right direction...
Best regards and happy easter,
Malte
P.S.: I tried that already with values similar to the ones for charged particles. Technically the mass constraint fit works then (Fitter does not produce any errors any more, and the gamma gamma spectrum shows a needle at the nominal etamass. However, the chi2 and pulldistributions look wrong. That must be due to the fact, that I simply used wrong values in the covariance matrix... therefore my question above






Re: Vertex Fitter in Fast simulation [message #16373 is a reply to message #16371] 
Fri, 18 April 2014 22:26 
StefanoSpataro
Messages: 2736 Registered: June 2005 Location: Torino

firstgrade participant 
From: *ip43.fastwebnet.it


Hi,
I think I found the problem.
First, the covariance matrix was not filled for neutrals, as you were saying. Second, in the EMC class the error in Energy was set but not the error in momentum. then all the elements with p were set to zero.
I fixed in my private version of the code, and I can see something reasonable. I wait for the Klaus' OK before committing the code.
Meanwhile, if you wanna try, these are the changes:
Index: ../../fsim/PndFsmEmcBarrel.cxx
===================================================================
 ../../fsim/PndFsmEmcBarrel.cxx (revisione 24552)
+++ ../../fsim/PndFsmEmcBarrel.cxx (copia locale)
@@ 107,12 +107,14 @@
if (wasDetected && fabs(t>charge())<1e8)
{
result>setdE(dE(t));
+ result>setdp(dE(t));
result>setdphi(dphi(t));
result>setdtheta(dtheta(t));
}
else
{
result>setdE(0.);
+ result>setdp(0.);
result>setdphi(0.);
result>setdtheta(0.);
}
Index: ../../fsim/PndFastSim.cxx
===================================================================
 ../../fsim/PndFastSim.cxx (revisione 24552)
+++ ../../fsim/PndFastSim.cxx (copia locale)
@@ 465,7 +465,7 @@
RhoCandidate tcand(ft>p4(),ft>charge(),svtx);
 if( (fPropagatefUseFlatCovMatrix) && fabs(ft>charge())>1e6)
+ if( (fPropagatefUseFlatCovMatrix))// && fabs(ft>charge())>1e6)
{
tcand.SetCov7(ft>Cov7());
pidCand>SetCov7( ft>Cov7() );
Index: ../../fsim/PndFsmEmcBwCap.cxx
===================================================================
 ../../fsim/PndFsmEmcBwCap.cxx (revisione 24552)
+++ ../../fsim/PndFsmEmcBwCap.cxx (copia locale)
@@ 99,12 +99,14 @@
if (wasDetected && fabs(t>charge())<1e8)
{
result>setdE(dE(t));
+ result>setdp(dE(t));
result>setdphi(dphi(t));
result>setdtheta(dtheta(t));
}
else
{
result>setdE(0.);
+ result>setdp(0.);
result>setdphi(0.);
result>setdtheta(0.);
}
Index: ../../fsim/PndFsmEmcFwCap.cxx
===================================================================
 ../../fsim/PndFsmEmcFwCap.cxx (revisione 24552)
+++ ../../fsim/PndFsmEmcFwCap.cxx (copia locale)
@@ 100,12 +100,14 @@
if (wasDetected && fabs(t>charge())<1e8)
{
result>setdE(dE(t));
+ result>setdp(dE(t));
result>setdphi(dphi(t));
result>setdtheta(dtheta(t));
}
else
{
result>setdE(0.);
+ result>setdp(0.);
result>setdphi(0.);
result>setdtheta(0.);
}
Index: ../../fsim/PndFsmEmcFS.cxx
===================================================================
 ../../fsim/PndFsmEmcFS.cxx (revisione 24552)
+++ ../../fsim/PndFsmEmcFS.cxx (copia locale)
@@ 100,12 +100,14 @@
if (wasDetected && fabs(t>charge())<1e8)
{
result>setdE(dE(t));
+ result>setdp(dE(t));
result>setdphi(dphi(t));
result>setdtheta(dtheta(t));
}
else
{
result>setdE(0.);
+ result>setdp(0.);
result>setdphi(0.);
result>setdtheta(0.);
}







Re: Vertex Fitter in Fast simulation [message #16379 is a reply to message #16125] 
Sun, 20 April 2014 08:35 
Klaus Götzen
Messages: 293 Registered: June 2006 Location: GSI

firstgrade participant 
From: *dip0.tipconnect.de


Hi,
thinking a bit more about the approach of setting dE = dp for neutrals, there is some problem with the way it is done now I think.
Since E and p are 100% correlated quantities, the covariance cannot be diagonal if you set both at the same time. That has to be taken into account right from the beginning. However when the smearing is techincally done in Fast Sim, it is in an uncorrelated way, so that E and p get an individual random modification.
I guess, a proper way would be for neutrals:
 Just set the dE in the detector classes.
 Chose a random smearing base on this dE value.
 Smear both E and p with this value.
 Set the according diagonal elemens for E and p and the correlated term sigma_E,p in covariance matrix before transformation to px, py, pz, E domain.
I'm not really sure whether this is the right way, but one could at least try like this.
Best and happy easter,
Klaus



Re: Vertex Fitter in Fast simulation [message #16382 is a reply to message #16379] 
Mon, 21 April 2014 21:28 
Malte Albrecht
Messages: 11 Registered: May 2012

occasional visitor 
From: *rz.ruhrunibochum.de


Hi,
I tried a lot around with this fitting issue today. Unfortunately, it wont work as I want it to
I started off with what Klaus said, and implemented that.
Klaus Goetzen wrote on Sun, 20 April 2014 08:35
Hi,
I guess, a proper way would be for neutrals:
 Just set the dE in the detector classes.
 Chose a random smearing base on this dE value.
 Smear both E and p with this value.
 Set the according diagonal elemens for E and p and the correlated term sigma_E,p in covariance matrix before transformation to px, py, pz, E domain.
I'm not really sure whether this is the right way, but one could at least try like this.
Best and happy easter,
Klaus
 I changed the files, so that just dE is set in the detector classes again.
 Now, I dont see how the smearing of dE and dp should be handled really...
If you compare the implementations for the smearing of energy and momentum, in case of neutrals there is only a scaling of the three momentum vector components done  both in smearMomentum and smearEnergy!
There is no sense in doing that twice, right? So... what is actually the meaning of smearing p and E seperately  for a neutral? Then it also makes no sense to have the smearing based on the same random number, since actually the same mathematical operation (the scaling) would be done twice. Please correct me if Im wrong...
Anyway, I still tried it. The results dont change (chi2 is ~0), everything looks approximately the same. Then I introduced the offdiagonal elements to the polar covariance matrix.
Am I correct, that in case of neutrals the diagonal elements, as well as the offdiagonals should contain dE*dE then?
When I put that into the covariance matrix, it seriously breaks things... the gammagamma mass spectrum looks like a barcode afterwards So, that is apparently not correct.
Any suggestions?
Best regards,
Malte




Re: Vertex Fitter in Fast simulation [message #16412 is a reply to message #16407] 
Tue, 22 April 2014 19:41 
Malte Albrecht
Messages: 11 Registered: May 2012

occasional visitor 
From: *ep1.ruhrunibochum.de


Hi Ralf,
thanks for your changes today, now my pulls and chi2 / Prob histograms look good. Actually what did the trick, are your changes to the calculation of the jacobian and the covPol, right?
Anyway, I did just a quick check, but 4C and mass constraint fits seem to be operational now.
Now one more question: How are staged fits handled? If I want a mass constraint fit (e.g. for an eta) and after that a 4C fit using the already prefitted 4vector of my massconstrainedeta (which would then actually be a 5Cfit, but ok...) ?
From other fitters I just know, that one can add MassConstraints, or FourVectorconstraints as many as one likes, but in the end one can still fit everything _together_ with one fitter object. Can I do something similar here, or do I always have to create new RhoCandidates and give them to the next fitter?
Greetings,
Malte



Re: Vertex Fitter in Fast simulation [message #16418 is a reply to message #16125] 
Wed, 23 April 2014 10:01 
Ralf Kliemt
Messages: 507 Registered: May 2007 Location: GSI, Darmstadt

firstgrade participant 
From: *gsi.de


Hi,
Yes, the jacobian is now from (p,theta,phi) to (px,py,pz,e) for charged particles and from (e,theta,phi) to (px,py,pz,e) for gammas.
You may want to try PndKinFitter and set more constraints. No warrenty here. However, our kinematic fitters fit the input node of the decay with all the final state particles. No intermediate decay is considered.
To circumvent that you can apply Lock() (and UnLock()) to a composite candidate. The fitters will then treat it as a final state particle. You'd be the first one to apply that feature. See RhoFitterBase for details.
Cheers
Ralf



Goto Forum:
Current Time: Fri Dec 08 08:21:24 CET 2023
Total time taken to generate the page: 0.01314 seconds
