Problem 1448

Summary: sick cov matrix for surf-->free state conversion
Product: Examples/Extended Reporter: janstar1122
Component: errorpropagationAssignee: Pedro.Arce
Status: RESOLVED FIXED    
Severity: major    
Priority: P5    
Version: 9.6   
Hardware: All   
OS: All   

Description janstar1122 2013-02-23 04:53:36 CET
Hi,
there is some error in the code converting surface-state cov matrix to free-state cov matrix.
Attached code initializes surfState assuming diagonal cov matrix.
All looks fine.
Then I call
 G4ErrorSurfaceTrajParam newSurfParams=newSurfTrajState.GetParameters();

and resulting cov matrix acquires huge values 43212936.9 .
It does not make sense.
Could you please have a look?

Also, note that the mom dir for the free state is not normalized to one - is it correct?
 momentum direction= (80.00000000,0.00000000,1.00000000)

The full output & test code used for it are attached
Thanks
Jan

-------------- OUTPUT ------------

my surfState: 
 G4ErrorTrajState of type 1 : partycle: e-  
position:      (-250.000000,0.000000,0.000000)              
momentum: (80.000000,0.000000,1.000000)   
error matrix 
 1.000000  0.000000  0.000000  0.000000  0.000000 
 0.000000  1.000000  0.000000  0.000000  0.000000 
 0.000000  0.000000  1.000000  0.000000  0.000000 
 0.000000  0.000000  0.000000  1.000000  0.000000 
 0.000000  0.000000  0.000000  0.000000  1.000000 

 G4ErrorSurfaceTrajState: Params:  InvP= 0.012499 PV= 0.000000 PW= 1.000000 V= 0.000000 W= 0.000000
 vectorV direction= (0.000000,1.000000,0.000000) vectorW direction= (0.000000,0.000000,1.000000)

------my surfParams:  InvP= 0.012499 PV= 0 PW= 1 V= 0 W= 0
 vectorV direction= (0,1,0) vectorW direction= (0,0,1)

-------my freeState: 
 G4ErrorTrajState of type 0 : partycle: e-  
position:      (-250.000000,0.000000,0.000000)              
momentum: (80.000000,0.000000,1.000000)   
error matrix 
 1.000000  0.000000  0.000000  0.000000  0.000000 
 0.000000 6399.000156  0.000000  0.000000  0.000000 
 0.000000  0.000000 43212936.925447  0.000000 -1498.728114 
 0.000000  0.000000  0.000000  1.000000  0.000000 
 0.000000  0.000000 -1498.728114  0.000000  0.999844 

 G4ErrorFreeTrajState: Params:  InvP= 0.01249902 Theta= 0.01249935 Phi= 0.00000000 YPerp= 0.00000000 ZPerp= 3.12475589
 momentum direction= (80.00000000,0.00000000,1.00000000)

-------------------  CODE ------------------

//============================
void testBug2(){
  printf("testFreeInit() \n");

 //............. Set the starting trajectory..........
  G4ThreeVector xv3( -25*cm, 0*cm,0);
  G4ThreeVector pv3( 80*MeV, 0.*MeV, 1.*MeV );
  G4ErrorTrajErr error( 5, 1 );
  G4Vector3D Vdir=G4Vector3D(0,1,0),  Wdir=G4Vector3D(0,0,1);

  G4ErrorSurfaceTrajState newSurfTrajState=G4ErrorSurfaceTrajState( "e-",xv3, pv3 ,Vdir,Wdir ,error);
  G4cout << "my surfState: "<<G4endl; 
  newSurfTrajState.Dump();
  G4ErrorSurfaceTrajParam newSurfParams=newSurfTrajState.GetParameters();
  G4cout << "------my surfParams: "<< newSurfParams<<G4endl;
 

  G4ErrorFreeTrajState freeTrajState =G4ErrorFreeTrajState(newSurfTrajState); // replace current free-traj w/ updated values
  G4cout << "-------my freeState: "<<G4endl; //ok
  freeTrajState.Dump();
  
}