When calculating a*a-b*b the form (a-b)*(a+b) is usually more numerically stable.
authorfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 Feb 2009 11:12:50 +0000 (11:12 +0000)
committerfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 Feb 2009 11:12:50 +0000 (11:12 +0000)
40 files changed:
EVGEN/AliGenGeVSim.cxx
EVGEN/AliGenHBTosl.cxx
EVGEN/AliGenMC.cxx
EVGEN/AliGenParam.cxx
EVGEN/AliGenSlowNucleons.cxx
HMPID/AliHMPIDv1.cxx
HMPID/AliHMPIDv2.cxx
HMPID/AliHMPIDv3.cxx
ITS/AliITSNeuralTrack.cxx
ITS/AliITSTrackV1.cxx
ITS/AliITStrackMI.cxx
ITS/AliITStrackerMI.cxx
ITS/AliITSv11GeomCableFlat.cxx
ITS/AliITSv11GeometrySPD.cxx
ITS/AliITSv11GeometrySSD.cxx
LHC/AliLhcProcessIBS.cxx
MUON/AliMUONTrackExtrap.cxx
PWG1/AliComparisonDEdx.cxx
PWG1/AliComparisonDraw.cxx
PYTHIA6/AliPythia.cxx
PYTHIA6/AliPythia6.cxx
STEER/AliESDTagCreator.cxx
STEER/AliESDcascade.cxx
STEER/AliExternalTrackParam.cxx
STEER/AliRieman.cxx
STEER/AliTracker.cxx
STEER/AliVParticle.cxx
STEER/AliVertexerTracks.cxx
TEPEMGEN/diffcross.f
TPC/AliTPCTracklet.cxx
TPC/AliTPCcalibAlign.cxx
TPC/AliTPCseed.cxx
TPC/AliTPCtrackerMI.cxx
TPC/template.cxx
TPHIC/tphic17.f
TRD/AliTRDCalibraFillHisto.cxx
TRD/AliTRDseed.cxx
TRD/AliTRDtracker.cxx
TRD/AliTRDtrackerV1.cxx
macros/TestRieman.C

index ff744da..3fdab52 100644 (file)
@@ -265,11 +265,10 @@ static Double_t aPtYFormula2(Double_t *x, Double_t * par) {
   // mass -> [0] , temperature -> [1] , expansion velocity -> [2]
 
   Double_t aFormE = TMath::Sqrt(par[0]*par[0] + x[0]*x[0]) * TMath::CosH(x[1]);
-  Double_t aFormG = 1 / TMath::Sqrt( 1 - par[2]*par[2] );
+  Double_t aFormG = 1 / TMath::Sqrt((1.-par[2])*(1.+par[2]));
   Double_t aFormYp = par[2]*TMath::Sqrt( (par[0]*par[0] + x[0]*x[0]) 
-                                        * TMath::CosH(x[1])*TMath::CosH(x[1])
-                                        - par[0]*par[0] )
-    /( par[1]*TMath::Sqrt(1-par[2]*par[2]));
+                                        * (TMath::CosH(x[1])-par[0])*(TMath::CosH(x[1])+par[0]))
+    /( par[1]*TMath::Sqrt((1.-par[2])*(1.+par[2])));
 
   return x[0] * aFormE * TMath::Exp( - aFormG * aFormE / par[1])
     *( TMath::SinH(aFormYp)/aFormYp 
index 1dd0529..5069540 100644 (file)
@@ -1565,7 +1565,7 @@ void  AliGenHBTosl::GetQOutQSideQLong(TParticle* f, TParticle* s,Double_t& out,
   }
 
  Double_t beta = pzsum/esum;
- Double_t gamma = 1.0/TMath::Sqrt(1.0 - beta*beta);
+ Double_t gamma = 1.0/TMath::Sqrt((1.-beta)*(1.+beta));
 
  lon = gamma * ( pzdiff - beta*ediff );
 
index 466f44b..5588b5c 100644 (file)
@@ -361,7 +361,7 @@ void AliGenMC::Boost()
 //
 
     Double_t beta  = TMath::TanH(fDyBoost);
-    Double_t gamma = 1./TMath::Sqrt(1.-beta*beta);
+    Double_t gamma = 1./TMath::Sqrt((1.-beta)*(1.+beta));
     Double_t gb    = gamma * beta;
 
     //    printf("\n Boosting particles to lab frame %f %f %f", fDyBoost, beta, gamma);
index a72a584..506347f 100644 (file)
@@ -321,7 +321,7 @@ void AliGenParam::Generate()
                    "Division by 0: Please check you rapidity range !");
          }
          
-         pl=xmt*ty/sqrt(1.-ty*ty);
+         pl=xmt*ty/sqrt((1.-ty)*(1.+ty));
          theta=TMath::ATan2(pt,pl);
 // Cut on theta
          if(theta<fThetaMin || theta>fThetaMax) continue;
index 16cb40b..88341bf 100644 (file)
@@ -310,7 +310,7 @@ void AliGenSlowNucleons::Lorentz(Double_t m, Double_t beta, Float_t* q)
 {
 /* Lorentz transform in the direction of q[2] */
  
-    Double_t gamma  = 1/sqrt(1-beta*beta); 
+    Double_t gamma  = 1/sqrt((1.-beta)*(1.+beta)); 
     Double_t energy = sqrt(m*m + q[0]*q[0] + q[1]*q[1] + q[2]*q[2]);
     q[2] = gamma * (q[2] + beta*energy);
 }
index e1fb5fe..fd22de9 100644 (file)
@@ -283,7 +283,7 @@ void AliHMPIDv1::GenFee(Float_t qtot)
     gMC->GetRandom()->RndmArray(2,ranf);    //Sample direction
     cthf=ranf[0]*2-1.0;
     if(cthf<0) continue;
-    sthf = TMath::Sqrt((1 - cthf) * (1 + cthf));
+    sthf = TMath::Sqrt((1. - cthf) * (1. + cthf));
     phif = ranf[1] * 2 * TMath::Pi();
     
     if(Double_t randomNumber=gMC->GetRandom()->Rndm()<=0.57)
@@ -423,7 +423,7 @@ Float_t AliHMPIDv1::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)
     //FORMULAE FROM HANDBOOK OF OPTICS, 33.23 OR
     //W.R. HUNTER, J.O.S.A. 54 (1964),15 , J.O.S.A. 55(1965),1197
 
-    Float_t sinin=TMath::Sqrt(1-pdoti*pdoti);
+    Float_t sinin=TMath::Sqrt((1.-pdoti)*(1.+pdoti));
     Float_t tanin=sinin/pdoti;
 
     Float_t c1=cn*cn-ck*ck-sinin*sinin;
index 0e36b96..bea66d6 100644 (file)
@@ -533,7 +533,7 @@ void AliHMPIDv2::GenFee(Float_t qtot)
     gMC->GetRandom()->RndmArray(2,ranf);    //Sample direction
     cthf=ranf[0]*2-1.0;
     if(cthf<0) continue;
-    sthf = TMath::Sqrt((1 - cthf) * (1 + cthf));
+    sthf = TMath::Sqrt((1. - cthf) * (1. + cthf));
     phif = ranf[1] * 2 * TMath::Pi();
     
     if(Double_t randomNumber=gMC->GetRandom()->Rndm()<=0.57)
@@ -673,7 +673,7 @@ Float_t AliHMPIDv2::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)
     //FORMULAE FROM HANDBOOK OF OPTICS, 33.23 OR
     //W.R. HUNTER, J.O.S.A. 54 (1964),15 , J.O.S.A. 55(1965),1197
 
-    Float_t sinin=TMath::Sqrt(1-pdoti*pdoti);
+    Float_t sinin=TMath::Sqrt((1.-pdoti)*(1.+pdoti));
     Float_t tanin=sinin/pdoti;
 
     Float_t c1=cn*cn-ck*ck-sinin*sinin;
index 60bd7a7..0f49fef 100644 (file)
@@ -602,7 +602,7 @@ void AliHMPIDv3::GenFee(Float_t qtot)
     gMC->GetRandom()->RndmArray(2,ranf);    //Sample direction
     cthf=ranf[0]*2-1.0;
     if(cthf<0) continue;
-    sthf = TMath::Sqrt((1 - cthf) * (1 + cthf));
+    sthf = TMath::Sqrt((1. - cthf) * (1. + cthf));
     phif = ranf[1] * 2 * TMath::Pi();
     
     if(Double_t randomNumber=gMC->GetRandom()->Rndm()<=0.57)
@@ -742,7 +742,7 @@ Float_t AliHMPIDv3::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)
     //FORMULAE FROM HANDBOOK OF OPTICS, 33.23 OR
     //W.R. HUNTER, J.O.S.A. 54 (1964),15 , J.O.S.A. 55(1965),1197
 
-    Float_t sinin=TMath::Sqrt(1-pdoti*pdoti);
+    Float_t sinin=TMath::Sqrt((1.-pdoti)*(1.+pdoti));
     Float_t tanin=sinin/pdoti;
 
     Float_t c1=cn*cn-ck*ck-sinin*sinin;
index 348dc09..4f3f060 100644 (file)
@@ -423,8 +423,8 @@ Int_t AliITSNeuralTrack::PropagateTo(Double_t rk)
        Double_t bk = ArgB(rk), bkm1 = ArgB(rkm1);
        Double_t ck = ArgC(rk), ckm1 = ArgC(rkm1);
        
-       Double_t f02 = ck / TMath::Sqrt(1. - aAk * aAk) - ckm1 / TMath::Sqrt(1. - aAkm1 * aAkm1);
-       Double_t f04 = bk / TMath::Sqrt(1. - aAk * aAk) - bkm1 / TMath::Sqrt(1. - aAkm1 * aAkm1);
+       Double_t f02 = ck / TMath::Sqrt((1.-aAk)*(1.+aAk)) - ckm1 / TMath::Sqrt((1.-aAkm1)*(1.+aAkm1));
+       Double_t f04 = bk / TMath::Sqrt((1.-aAk)*(1.+aAk)) - bkm1 / TMath::Sqrt((1.-aAkm1)*(1.+aAkm1));
        Double_t f12 = fTanL * fDt * (1. / rk - 1. / rkm1);
        Double_t f13 = rk - rkm1;
        
index 7a6bb81..80ca853 100644 (file)
@@ -258,10 +258,10 @@ void AliITSTrackV1::LmTPC() {
   Double_t r = 1./cTPC;
   xo =  etaTPC / cTPC;
   Double_t yo1, yo2, diffsq1, diffsq2;  
-  yo1 = yTPC +  TMath::Sqrt(r*r - (xl-xo)*(xl-xo)); 
-  yo2 = yTPC -  TMath::Sqrt(r*r - (xl-xo)*(xl-xo));   
-  diffsq1=TMath::Abs((yo1-vyl)*(yo1-vyl)+(xo-vxl)*(xo-vxl)-r*r);
-  diffsq2=TMath::Abs((yo2-vyl)*(yo2- vyl)+(xo-vxl)*(xo-vxl)-r*r);
+  yo1 = yTPC +  TMath::Sqrt((r-(xl-xo))*(r+(xl-xo))); 
+  yo2 = yTPC -  TMath::Sqrt((r-(xl-xo))*(r+(xl-xo)));   
+  diffsq1=TMath::Abs((yo1-vyl)*(yo1-vyl)+((xo-vxl)-r)*((xo-vxl)+r));
+  diffsq2=TMath::Abs((yo2-vyl)*(yo2-vyl)+((xo-vxl)-r)*((xo-vxl)+r));
   if(diffsq1<diffsq2) {yo=yo1; signy=1.;} else {yo=yo2; signy=-1.;};
   
   ////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -292,12 +292,12 @@ void AliITSTrackV1::LmTPC() {
 
   dfidy=(xm*cosa+ym*sina)/(frtrack*frtrack);
   dDdy=signdd*((y0m-fVertex(1))*cosa-(x0m-fVertex(0))*sina)/dd;
-  Double_t dyodr=signy*(r+(xl-xo)*etaTPC)/TMath::Sqrt(r*r-(xl-xo)*(xl-xo));
+  Double_t dyodr=signy*(r+(xl-xo)*etaTPC)/TMath::Sqrt((r-(xl-xo))*(r+(xl-xo)));
   Double_t dyomdr=sina*etaTPC+cosa*dyodr;
   Double_t dxomdr=cosa*etaTPC-sina*dyodr;
   Double_t ddddR=((x0m-fVertex(0))*dxomdr+(y0m-fVertex(1))*dyomdr)/dd;
   dDdC=-r*r*(signdd*ddddR-1.);
-  Double_t dyoldxol=signy*(xl-xo)/TMath::Sqrt(r*r-(xl-xo)*(xl-xo));
+  Double_t dyoldxol=signy*(xl-xo)/TMath::Sqrt((r-(xl-xo))*(r+(xl-xo)));
   Double_t dxomdeta=r*(cosa-sina*dyoldxol);
   Double_t dyomdeta=r*(sina+cosa*dyoldxol);
   dDdeta=signdd*((x0m-fVertex(0))*dxomdeta+(y0m-fVertex(1))*dyomdeta)/dd;
@@ -474,8 +474,8 @@ void AliITSTrackV1::Propagation(Double_t rk) {
   Double_t bk=ArgB(rk), bkm1=ArgB(rkm1);       
   Double_t ck=ArgC(rk), ckm1=ArgC(rkm1);  
 
-  Double_t f02=ck/TMath::Sqrt(1.-aAk*aAk) - ckm1/TMath::Sqrt(1.-aAkm1*aAkm1);
-  Double_t f04=bk/TMath::Sqrt(1.-aAk*aAk) - bkm1/TMath::Sqrt(1.-aAkm1*aAkm1);          
+  Double_t f02=ck/TMath::Sqrt((1.-aAk)*(1.+aAk)) - ckm1/TMath::Sqrt((1.-aAkm1)*(1.+aAkm1));
+  Double_t f04=bk/TMath::Sqrt((1.-aAk)*(1.+aAk)) - bkm1/TMath::Sqrt((1.-aAkm1)*(1.+aAkm1));    
   Double_t f12=tgl*d*(1./rk - 1./rkm1);
   Double_t f13=rk - rkm1;
   
@@ -593,7 +593,7 @@ void AliITSTrackV1::AddEL(Double_t signdE, Bool_t flagtot, Double_t mass) {
   dE=signdE*dE/1000.; 
          
   e+=dE;
-  Double_t p=TMath::Sqrt(e*e-mass*mass);   
+  Double_t p=TMath::Sqrt((e-mass)*(e+mass));   
   Double_t sign=1.;
   if(fX4 < 0.) sign=-1.; 
   pt=sign*p/sqcl; 
index 7a0161d..3eb1f71 100644 (file)
@@ -160,7 +160,7 @@ Int_t AliITStrackMI::GetProlongationFast(Double_t alp, Double_t xk,Double_t &y,
   //get fast prolongation 
   //-----------------------------------------------------------------------------
   Double_t ca=TMath::Cos(alp-GetAlpha()), sa=TMath::Sin(alp-GetAlpha());
-  Double_t cf=TMath::Sqrt(1.- GetSnp()*GetSnp());  
+  Double_t cf=TMath::Sqrt((1.-GetSnp())*(1.+GetSnp()));  
   // **** rotation **********************  
   y= -GetX()*sa + GetY()*ca;
   // **** translation ******************  
@@ -169,7 +169,7 @@ Int_t AliITStrackMI::GetProlongationFast(Double_t alp, Double_t xk,Double_t &y,
   if (TMath::Abs(f2) >= 0.9999) {
     return 0;
   }
-  Double_t r1=TMath::Sqrt(1.- f1*f1), r2=TMath::Sqrt(1.- f2*f2);  
+  Double_t r1=TMath::Sqrt((1.-f1)*(1.+f1)), r2=TMath::Sqrt((1.-f2)*(1.+f2));  
   y += dx*(f1+f2)/(r1+r2);
   z  = GetZ()+dx*(f1+f2)/(f1*r2 + f2*r1)*GetTgl();  
   return 1;
index 8490d38..300815a 100644 (file)
@@ -3631,7 +3631,7 @@ Double_t AliITStrackerMI::GetPredictedChi2MI(AliITStrackMI* track, const AliITSR
   Float_t erry,errz;
   Float_t theta = track->GetTgl();
   Float_t phi   = track->GetSnp();
-  phi = TMath::Sqrt(phi*phi/(1.-phi*phi));
+  phi = TMath::Abs(phi)*TMath::Sqrt(1./((1.-phi)*(1.+phi)));
   AliITSClusterParam::GetError(layer,cluster,theta,phi,track->GetExpQ(),erry,errz);
   AliDebug(2,Form(" chi2: tr-cl   %f  %f   tr X %f cl X %f",track->GetY()-cluster->GetY(),track->GetZ()-cluster->GetZ(),track->GetX(),cluster->GetX()));
   // Take into account the mis-alignment (bring track to cluster plane)
@@ -3655,7 +3655,7 @@ Double_t AliITStrackerMI::GetPredictedChi2MI(AliITStrackMI* track, const AliITSR
   track->SetSigmaY(layer,erry);
   track->SetSigmaZ(layer, errz);
   //track->fNormQ[layer] = cluster->GetQ()/TMath::Sqrt(1+theta*theta+phi*phi);
-  track->SetNormQ(layer,cluster->GetQ()/TMath::Sqrt((1.+ track->GetTgl()*track->GetTgl())/(1.- track->GetSnp()*track->GetSnp())));
+  track->SetNormQ(layer,cluster->GetQ()/TMath::Sqrt((1.+ track->GetTgl()*track->GetTgl())/((1.-track->GetSnp())*(1.+track->GetSnp()))));
   return chi2;
 
 }
@@ -4776,7 +4776,7 @@ Int_t AliITStrackerMI::CorrectForPipeMaterial(AliITStrackMI *t,
     if(fxOverX0PipeTrks[index]<0) {
       if (!t->PropagateToTGeo(xToGo,1,xOverX0,lengthTimesMeanDensity)) return 0;
       Double_t angle=TMath::Sqrt((1.+t->GetTgl()*t->GetTgl())/
-                                (1.-t->GetSnp()*t->GetSnp()));
+                                ((1.-t->GetSnp())*(1.+t->GetSnp())));
       fxOverX0PipeTrks[index] = TMath::Abs(xOverX0)/angle;
       fxTimesRhoPipeTrks[index] = TMath::Abs(lengthTimesMeanDensity)/angle;
       return 1;
@@ -4879,7 +4879,7 @@ Int_t AliITStrackerMI::CorrectForShieldMaterial(AliITStrackMI *t,
     if(fxOverX0ShieldTrks[index]<0) {
       if (!t->PropagateToTGeo(xToGo,1,xOverX0,lengthTimesMeanDensity)) return 0;
       Double_t angle=TMath::Sqrt((1.+t->GetTgl()*t->GetTgl())/
-                                (1.-t->GetSnp()*t->GetSnp()));
+                                ((1.-t->GetSnp())*(1.+t->GetSnp())));
       fxOverX0ShieldTrks[index] = TMath::Abs(xOverX0)/angle;
       fxTimesRhoShieldTrks[index] = TMath::Abs(lengthTimesMeanDensity)/angle;
       return 1;
@@ -4989,7 +4989,7 @@ Int_t AliITStrackerMI::CorrectForLayerMaterial(AliITStrackMI *t,
       AliTracker::MeanMaterialBudget(oldGlobXYZ,globXYZ,mparam);
       if(mparam[1]>900000) return 0;
       Double_t angle=TMath::Sqrt((1.+t->GetTgl()*t->GetTgl())/
-                                (1.-t->GetSnp()*t->GetSnp()));
+                                ((1.-t->GetSnp())*(1.+t->GetSnp())));
       xOverX0=mparam[1]/angle;
       lengthTimesMeanDensity=mparam[0]*mparam[4]/angle;
       fxOverX0LayerTrks[index] = TMath::Abs(xOverX0);
index d25eff7..b9fbb3c 100644 (file)
@@ -712,7 +712,7 @@ TGeoVolume* AliITSv11GeomCableFlat::CreateAndInsertCableCylSegment(Int_t p2,
   Double_t torusPhi1 = TMath::ACos(cosPhi);
   Double_t torusR = (length/2)/TMath::Sin(torusPhi1);
   torusPhi1 = torusPhi1*TMath::RadToDeg();
-  Double_t perpLength = TMath::Sqrt(torusR*torusR-length*length/4);
+  Double_t perpLength = TMath::Sqrt((torusR-0.5*length)*(torusR+0.5*length));
   Double_t localTransT[3] = {-perpLength,0,0};
   Double_t globalTransT[3];
   rotTorus.LocalToMasterVect(localTransT, globalTransT);
index 2844e4e..2f511b7 100644 (file)
@@ -1311,7 +1311,7 @@ Bool_t AliITSv11GeometrySPD::CFHolePoints(Double_t s,Double_t r1,
     bc = 2.*l*r2;
     if(bc==0.0) {printf("bc=0 l=%e r2=%e\n",l,r2);return kFALSE;}
     betac = TMath::ACos(ac/bc);
-    alphac = TMath::Sqrt(bc*bc-ac*ac)/(2.*l*r1);
+    alphac = TMath::Sqrt((bc-ac)*(bc+ac))/(2.*l*r1);
     scb = r2*betac;
     sca = r1*alphac;
     t = r1*0.5*TMath::Pi() - sca + scb;
index 3717b6b..d78d926 100644 (file)
@@ -2581,8 +2581,8 @@ TList* AliITSv11GeometrySSD::GetSSDHybridParts(){
                                 - fgkSSDConnectorSeparation;
   Double_t wirey = ssdstiffenerseparation+fgkSSDStiffenerWidth
                                 - 2.*fgkSSDConnectorPosition[1]-fgkSSDConnectorWidth;
-  Double_t ssdwireradius = TMath::Sqrt(TMath::Power(wirex,2.)
-                                        + TMath::Power(wirey,2));
+  Double_t ssdwireradius = TMath::Sqrt(wirex*wirex+wirey*wirey);
+
   Double_t wireangle = TMath::ATan(wirex/wirey);
   TGeoTube *hybridwireshape = new TGeoTube("HybridWireShape", 0., 
                                                fgkSSDWireRadius, 0.5*ssdwireradius);
@@ -4502,17 +4502,17 @@ void AliITSv11GeometrySSD::Layer6(TGeoVolume* moth){
   for(Int_t i=0; i<fgklayernumber; i++){
        mountingblockratio[i] = fgkSSDMountingBlockLength[0]/fgkMountingBlockSupportRadius[i];
     mountingsupportedge[i]    = 0.5*fgkMountingBlockSupportRadius[i]
-                                                         *(TMath::Sqrt(4.0-TMath::Power(mountingblockratio[i],2))
+                                                          * (TMath::Sqrt((2.-mountingblockratio[i])*(2.+mountingblockratio[i]))
                                                          * TMath::Sin(2.0*TMath::Pi()/kssdlayladdernumber[i])
                                                          - mountingblockratio[i]*(1.0+TMath::Cos(2.0*TMath::Pi()
                                                          / kssdlayladdernumber[i])));
     theta[i] = TMath::ASin(0.5*mountingblockratio[i]+mountingsupportedge[i]/fgkMountingBlockSupportRadius[i]);
     phi[i]   = TMath::ASin(0.5*mountingblockratio[i]);
        mountingsupportedgevector[i] = new TVector3();
-    mountingsupportedgevector[i]->SetX(-0.5*fgkSSDMountingBlockLength[0]);
-       mountingsupportedgevector[i]->SetY(fgkMountingBlockSupportRadius[i]*TMath::Sqrt(1.
-                                                                -TMath::Power(mountingsupportedgevector[i]->X()
-                                                                /                         fgkMountingBlockSupportRadius[i],2)));
+        mountingsupportedgevector[i]->SetX(-0.5*fgkSSDMountingBlockLength[0]);
+       mountingsupportedgevector[i]->SetY(fgkMountingBlockSupportRadius[i]*TMath::Sqrt(
+                                                       (1.-mountingsupportedgevector[i]->X()/fgkMountingBlockSupportRadius[i])*
+                                                       (1.+mountingsupportedgevector[i]->X()/fgkMountingBlockSupportRadius[i])));
     psi0[i] = 0.5*TMath::Pi()-phi[i];  
     deltapsi[i] = (theta[i]+phi[i])/nedges;
   }
@@ -5018,7 +5018,7 @@ void AliITSv11GeometrySSD::SetLadderSupport(Int_t nedges){
   for(Int_t i=0; i<fgklayernumber; i++){
        mountingblockratio[i] = fgkSSDMountingBlockLength[0]/fgkMountingBlockSupportRadius[i];
     mountingsupportedge[i]    = 0.5*fgkMountingBlockSupportRadius[i]
-                                                         *(TMath::Sqrt(4.0-TMath::Power(mountingblockratio[i],2))
+                                                          *(TMath::Sqrt((2.-mountingblockratio[i])*(2.+mountingblockratio[i]))
                                                          * TMath::Sin(2.0*TMath::Pi()/kssdlayladdernumber[i])
                                                          - mountingblockratio[i]*(1.0+TMath::Cos(2.0*TMath::Pi()
                                                          / kssdlayladdernumber[i])));
@@ -7029,9 +7029,8 @@ void AliITSv11GeometrySSD::SetLadderSupport(Int_t nedges){
   // Generating EndCap High Voltage Tubes 
   /////////////////////////////////////////////////////////////
   Double_t effectiveinneradius = TMath::Sqrt(ncables)*radiusmin;
-  Double_t effectiveouteradius = TMath::Sqrt(TMath::Power(effectiveinneradius,2.)
-                                                          +             TMath::Power(radiusmax,2.)
-                               -             TMath::Power(radiusmin,2.));
+  Double_t effectiveouteradius = TMath::Sqrt(effectiveinneradius*effectiveinneradius+(radiusmax-radiusmin)*(radiusmax-radiusmin));
+
   TGeoTube* effectiveinnertubeshape = new TGeoTube(0.,effectiveinneradius,0.5*width);
   TGeoTube* effectiveoutertubeshape = new TGeoTube(effectiveinneradius,
                                                                                                   effectiveouteradius,0.5*width);
index 4ad295a..a5263d2 100644 (file)
@@ -114,9 +114,9 @@ void AliLhcProcessIBS::Evolve(Float_t dt)
      // impact parameter
      Float_t d    = sige*avd/sigx;
      // 
-     Float_t at = sige*TMath::Sqrt(1.-d*d)/(gamma*ssigx);
-     Float_t bt = sige*TMath::Sqrt(1.-d*d)/(gamma*ssigy);
-     Float_t ct = sige*TMath::Sqrt(1.-d*d)*TMath::Sqrt(4.*sigy/fR[i]);
+     Float_t at = sige*TMath::Sqrt((1.-d)*(1.+d))/(gamma*ssigx);
+     Float_t bt = sige*TMath::Sqrt((1.-d)*(1.+d))/(gamma*ssigy);
+     Float_t ct = sige*TMath::Sqrt((1.-d)*(1.+d))*TMath::Sqrt(4.*sigy/fR[i]);
      //
      Double_t par[3];
      par[0] = at;
@@ -127,8 +127,9 @@ void AliLhcProcessIBS::Evolve(Float_t dt)
      Float_t f = (Float_t) 8.0*TMath::Pi()*
         fct->Integral(0., 1., par, 1.e-5);
      //
-     fTaux =  1./(asd*f*(d*d-at*at/2.));
-     fTaue =  1./(asd*f*(1.-d*d));
+     const Double_t osq2=1./TMath::Sqrt(2.);
+     fTaux =  1./(asd*f*(d-osq2*at)*(d+osq2*at)); 
+     fTaue =  1./(asd*f*((1.-d)*(1.+d)));
      //     printf("\n taux, taue %f %f", taux, taue);
      //     Float_t tauy = -2./at*at/asd/f;
      fBeam[i]->IncreaseEmittance(dt/fTaux, dt/fTaue);
index 2830ca0..f63f50e 100644 (file)
@@ -270,7 +270,7 @@ void AliMUONTrackExtrap::RecoverTrackParam(Double_t *v3, Double_t charge, AliMUO
   trackParam->SetNonBendingCoor(v3[0]); // X
   trackParam->SetBendingCoor(v3[1]); // Y
   trackParam->SetZ(v3[2]); // Z
-  Double_t pYZ = v3[6] * TMath::Sqrt(1.0 - v3[3] * v3[3]);
+  Double_t pYZ = v3[6] * TMath::Sqrt((1.-v3[3])*(1.+v3[3]));
   trackParam->SetInverseBendingMomentum(charge/pYZ);
   trackParam->SetBendingSlope(v3[4]/v3[5]);
   trackParam->SetNonBendingSlope(v3[3]/v3[5]);
index e0bd632..effcda2 100644 (file)
@@ -178,7 +178,7 @@ void AliComparisonDEdx::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC){
   //
   Float_t ratio = infoRC->GetESDtrack()->GetTPCsignal()/infoMC->GetPrim();
   Float_t sphi =  infoRC->GetESDtrack()->GetInnerParam()->GetSnp();
-  Float_t tphi =  sphi/TMath::Sqrt(1-sphi*sphi);
+  Float_t tphi =  sphi/TMath::Sqrt((1.-sphi)*(1.+sphi));
 
   if (TMath::Abs(infoMC->GetParticle().GetPdgCode()) != GetMCPdgCode()) return;
   //if (mcpt>0.5) {
index c4636a1..002c967 100644 (file)
@@ -383,7 +383,7 @@ void  AliComparisonDraw::ProcessTPCdedx(AliMCInfo* infoMC, AliESDRecInfo *infoRC
   //
   Float_t ratio = infoRC->GetESDtrack()->GetTPCsignal()/infoMC->GetPrim();
   Float_t sphi =  infoRC->GetESDtrack()->GetInnerParam()->GetSnp();
-  Float_t tphi =  sphi/TMath::Sqrt(1-sphi*sphi);
+  Float_t tphi =  sphi/TMath::Sqrt((1.-sphi)*(1.+sphi));
 
 
   if (TMath::Abs(infoMC->GetParticle().GetPdgCode())!=211) return;
index 2a532d3..da25b4c 100644 (file)
@@ -1129,7 +1129,7 @@ void  AliPythia::Quench()
                //
                // Isotropic decay ????
                Double_t cost = 2. * gRandom->Rndm() - 1.;
-               Double_t sint = TMath::Sqrt(1. - cost * cost);
+               Double_t sint = TMath::Sqrt((1.-cost)*(1.+cost));
                Double_t phis =  2. * TMath::Pi() * gRandom->Rndm();
                
                Double_t pz1 =   pst * cost;
index f8c761f..ff98f1e 100644 (file)
@@ -1142,7 +1142,7 @@ void  AliPythia6::Quench()
                //
                // Isotropic decay ????
                Double_t cost = 2. * gRandom->Rndm() - 1.;
-               Double_t sint = TMath::Sqrt(1. - cost * cost);
+               Double_t sint = TMath::Sqrt((1.-cost)*(1.+cost));
                Double_t phis =  2. * TMath::Pi() * gRandom->Rndm();
                
                Double_t pz1 =   pst * cost;
index bff879e..892ea15 100644 (file)
@@ -329,8 +329,9 @@ void AliESDTagCreator::CreateTag(TChain* chain, const char *type) {
       if ((status&AliESDtrack::kESDpid)==0) continue;
       Double_t p[3];
       esdTrack->GetPxPyPz(p);
-      Double_t momentum = sqrt(pow(p[0],2) + pow(p[1],2) + pow(p[2],2));
-      Double_t fPt = sqrt(pow(p[0],2) + pow(p[1],2));
+      Double_t pt2 = p[0]*p[0]+p[1]*p[1];
+      Double_t momentum = TMath::Sqrt(pt2+p[2]*p[2]);
+      Double_t fPt = TMath::Sqrt(pt2);
       totalP += momentum;
       meanPt += fPt;
       if(fPt > maxPt) maxPt = fPt;
@@ -655,8 +656,9 @@ void AliESDTagCreator::CreateTag(TFile* file, const char *guid, const char *md5,
       if ((status&AliESDtrack::kESDpid)==0) continue;
       Double_t p[3];
       esdTrack->GetPxPyPz(p);
-      Double_t momentum = sqrt(pow(p[0],2) + pow(p[1],2) + pow(p[2],2));
-      Double_t fPt = sqrt(pow(p[0],2) + pow(p[1],2));
+      Double_t pt2 = p[0]*p[0]+p[1]*p[1];
+      Double_t momentum = TMath::Sqrt(pt2+p[2]*p[2]);
+      Double_t fPt = TMath::Sqrt(pt2);
       totalP += momentum;
       meanPt += fPt;
       if(fPt > maxPt) maxPt = fPt;
@@ -975,8 +977,9 @@ void AliESDTagCreator::CreateTag(TFile* file, const char *filepath, Int_t Counte
       if ((status&AliESDtrack::kESDpid)==0) continue;
       Double_t p[3];
       esdTrack->GetPxPyPz(p);
-      Double_t momentum = sqrt(pow(p[0],2) + pow(p[1],2) + pow(p[2],2));
-      Double_t fPt = sqrt(pow(p[0],2) + pow(p[1],2));
+      Double_t pt2 = p[0]*p[0]+p[1]*p[1];
+      Double_t momentum = TMath::Sqrt(pt2+p[2]*p[2]);
+      Double_t fPt = TMath::Sqrt(pt2);
       totalP += momentum;
       meanPt += fPt;
       if(fPt > maxPt) maxPt = fPt;
@@ -1308,8 +1311,9 @@ void AliESDTagCreator::CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, AliGRP
       if ((status&AliESDtrack::kESDpid)==0) continue;
       Double_t p[3];
       esdTrack->GetPxPyPz(p);
-      Double_t momentum = sqrt(pow(p[0],2) + pow(p[1],2) + pow(p[2],2));
-      Double_t fPt = sqrt(pow(p[0],2) + pow(p[1],2));
+      Double_t pt2 = p[0]*p[0]+p[1]*p[1];
+      Double_t momentum = TMath::Sqrt(pt2+p[2]*p[2]);
+      Double_t fPt = TMath::Sqrt(pt2);
       totalP += momentum;
       meanPt += fPt;
       if(fPt > maxPt) maxPt = fPt;
index 4b4bb8c..3b37198 100644 (file)
@@ -335,7 +335,7 @@ Double_t AliESDcascade::ChangeMassHypothesis(Double_t &v0q, Int_t code) {
   Double_t pxl=px0+pxb, pyl=py0+pyb, pzl=pz0+pzb;
   Double_t pl=TMath::Sqrt(pxl*pxl + pyl*pyl + pzl*pzl);
   
-  fEffMassXi=TMath::Sqrt((e0+eb)*(e0+eb) - pl*pl);
+  fEffMassXi=TMath::Sqrt(((e0+eb)-pl)*((e0+eb)+pl));
 
   Double_t beta=pl/(e0+eb);
   Double_t pl0=(px0*pxl + py0*pyl + pz0*pzl)/pl;
index b400fc3..14ff04b 100644 (file)
@@ -1483,7 +1483,7 @@ AliExternalTrackParam::GetYAt(Double_t x, Double_t b, Double_t &y) const {
   if (TMath::Abs(f1) >= kAlmost1) return kFALSE;
   if (TMath::Abs(f2) >= kAlmost1) return kFALSE;
   
-  Double_t r1=TMath::Sqrt(1.- f1*f1), r2=TMath::Sqrt(1.- f2*f2);
+  Double_t r1=TMath::Sqrt((1.-f1)*(1.+f1)), r2=TMath::Sqrt((1.-f2)*(1.+f2));
   y = fP[0] + dx*(f1+f2)/(r1+r2);
   return kTRUE;
 }
@@ -1503,7 +1503,7 @@ AliExternalTrackParam::GetZAt(Double_t x, Double_t b, Double_t &z) const {
   if (TMath::Abs(f1) >= kAlmost1) return kFALSE;
   if (TMath::Abs(f2) >= kAlmost1) return kFALSE;
   
-  Double_t r1=sqrt(1.- f1*f1), r2=sqrt(1.- f2*f2);
+  Double_t r1=sqrt((1.-f1)*(1.+f1)), r2=sqrt((1.-f2)*(1.+f2));
   z = fP[1] + dx*(r2 + f2*(f1+f2)/(r1+r2))*fP[3]; // Many thanks to P.Hristov !
   return kTRUE;
 }
@@ -1522,7 +1522,7 @@ AliExternalTrackParam::GetXYZAt(Double_t x, Double_t b, Double_t *r) const {
   if (TMath::Abs(f1) >= kAlmost1) return kFALSE;
   if (TMath::Abs(f2) >= kAlmost1) return kFALSE;
   
-  Double_t r1=TMath::Sqrt(1.- f1*f1), r2=TMath::Sqrt(1.- f2*f2);
+  Double_t r1=TMath::Sqrt((1.-f1)*(1.+f1)), r2=TMath::Sqrt((1.-f2)*(1.+f2));
   r[0] = x;
   r[1] = fP[0] + dx*(f1+f2)/(r1+r2);
   r[2] = fP[1] + dx*(r2 + f2*(f1+f2)/(r1+r2))*fP[3];//Thanks to Andrea & Peter
index 632e441..11994ec 100755 (executable)
@@ -577,8 +577,9 @@ Double_t AliRieman::GetDYat(Double_t x) const {
   Double_t x0 = -fParams[1]/fParams[0];
   if (-fParams[2]*fParams[0]+fParams[1]*fParams[1]+1<0) return 0;
   Double_t rm1  = fParams[0]/TMath::Sqrt(-fParams[2]*fParams[0]+fParams[1]*fParams[1]+1); 
-  if ( 1./(rm1*rm1)-(x-x0)*(x-x0)<=0) return 0;
-  Double_t res = (x-x0)/TMath::Sqrt(1./(rm1*rm1)-(x-x0)*(x-x0));
+  Double_t arg = (1./rm1-(x-x0))*(1./rm1+(x-x0));
+  if ( arg <= 0) return 0;
+  Double_t res = (x-x0)/TMath::Sqrt(arg);
   if (fParams[0]<0) res*=-1.;
   return res;
 }
index 77299d7..81b2a40 100644 (file)
@@ -361,7 +361,7 @@ Double_t mass, Double_t maxStep, Bool_t rotateTo, Double_t maxSnp){
       //
       Double_t ca=TMath::Cos(alphan-track->GetAlpha()), 
                sa=TMath::Sin(alphan-track->GetAlpha());
-      Double_t sf=track->GetSnp(), cf=TMath::Sqrt(1.- sf*sf);
+      Double_t sf=track->GetSnp(), cf=TMath::Sqrt((1.-sf)*(1.+sf));
       Double_t sinNew =  sf*ca - cf*sa;
       if (TMath::Abs(sinNew) >= maxSnp) return kFALSE;
       if (!track->Rotate(alphan)) return kFALSE;
index 6ad69d1..b0e37e2 100644 (file)
@@ -56,7 +56,7 @@ Bool_t AliVParticle::Local2GlobalMomentum(Double_t p[3], Double_t alpha) const {
 
   Double_t pt=1./TMath::Abs(p[0]);
   Double_t cs=TMath::Cos(alpha), sn=TMath::Sin(alpha);
-  Double_t r=TMath::Sqrt(1 - p[1]*p[1]);
+  Double_t r=TMath::Sqrt((1. - p[1])*(1. + p[1]));
   p[0]=pt*(r*cs - p[1]*sn); p[1]=pt*(p[1]*cs + r*sn); p[2]=pt*p[2];
 
   return kTRUE;
index 03cc3ed..97a7626 100644 (file)
@@ -688,7 +688,7 @@ Bool_t AliVertexerTracks::PropagateTrackTo(AliExternalTrackParam *track,
     //
     Double_t ca=TMath::Cos(alphan-track->GetAlpha()), 
       sa=TMath::Sin(alphan-track->GetAlpha());
-    Double_t sf=track->GetSnp(), cf=TMath::Sqrt(1.- sf*sf);
+    Double_t sf=track->GetSnp(), cf=TMath::Sqrt((1.-sf)*(1.+sf));
     Double_t sinNew =  sf*ca - cf*sa;
     if(TMath::Abs(sinNew) >= maxSnp) return kFALSE;
     if(!track->Rotate(alphan)) return kFALSE;
index 09213b9..9cf4e37 100644 (file)
@@ -44,10 +44,10 @@ C======================================================================
       COMMON/PHYSPARAM/gamma,beta,m,w1xw1,w1xw2,w2xw2,wl,wy
 
       DOUBLE PRECISION ARCOSH,x
-      ARCOSH(x)=LOG(x+SQRT(x**2-1D0))
+      ARCOSH(x)=LOG(x+SQRT((x-1D0)*(x+1D0)))
 
       gamma=gm
-      beta=sqrt(1D0-1D0/gamma**2)
+      beta=sqrt((1D0-1D0/gamma)*(1D0+1D0/gamma))
       m=mass
       
       w1xw1 = 1D0/gamma**2
index fcc3ebd..b06af50 100755 (executable)
@@ -617,7 +617,7 @@ Bool_t AliTPCTracklet::Riemann2Helix(Double_t *a,Double_t */*ca*/,
   Double_t R=.5*TMath::Sqrt(4.*a[0]+a[1]*a[1]+a[2]*a[2]);
   Double_t dx=x0-xr0;
   if (dx*dx>=R*R) return kFALSE;
-  Double_t dy=TMath::Sqrt(R*R-dx*dx); //sign!!
+  Double_t dy=TMath::Sqrt((R-dx)*(R+dx)); //sign!!
   if (TMath::Abs(yr0+dy)>TMath::Abs(yr0-dy))
     dy=-dy;
   Double_t y0=yr0+dy; 
index 6b74981..ea8072c 100644 (file)
@@ -380,17 +380,17 @@ void AliTPCcalibAlign::ProcessTracklets(const AliExternalTrackParam &tp1,
   y1   =tp1.GetY();
   z1   =tp1.GetZ();
   Double_t snp1=tp1.GetSnp();
-  dydx1=snp1/TMath::Sqrt(1.-snp1*snp1);
+  dydx1=snp1/TMath::Sqrt((1.-snp1)*(1.+snp1));
   Double_t tgl1=tp1.GetTgl();
   // dz/dx = 1/(cos(theta)*cos(phi))
-  dzdx1=tgl1/TMath::Sqrt(1.-snp1*snp1);
+  dzdx1=tgl1/TMath::Sqrt((1.-snp1)*(1.+snp1));
   x2   =tp2.GetX();
   y2   =tp2.GetY();
   z2   =tp2.GetZ();
   Double_t snp2=tp2.GetSnp();
-  dydx2=snp2/TMath::Sqrt(1.-snp2*snp2);
+  dydx2=snp2/TMath::Sqrt((1.-snp2)*(1.+snp2));
   Double_t tgl2=tp2.GetTgl();
-  dzdx2=tgl2/TMath::Sqrt(1.-snp2*snp2);
+  dzdx2=tgl2/TMath::Sqrt((1.-snp2)*(1.+snp2));
   Int_t accept =   AcceptTracklet(tp1,tp2);  
   //
   //
index 324a27f..fe5b716 100644 (file)
@@ -442,8 +442,8 @@ Int_t  AliTPCseed::GetProlongation(Double_t xk, Double_t &y, Double_t & z) const
   }
 
   //  Double_t y1=fP0, z1=fP1;
-  Double_t c1=GetSnp(), r1=sqrt(1.- c1*c1);
-  Double_t c2=c1 + GetC()*dx, r2=sqrt(1.- c2*c2);
+  Double_t c1=GetSnp(), r1=sqrt((1.-c1)*(1.+c1));
+  Double_t c2=c1 + GetC()*dx, r2=sqrt((1.-c2)*(1.+c2));
   
   y = GetY();
   z = GetZ();
@@ -1023,10 +1023,10 @@ Double_t AliTPCseed::GetYat(Double_t xk) const {
 // This function calculates the Y-coordinate of a track at the plane x=xk.
 //-----------------------------------------------------------------
   if (TMath::Abs(GetSnp())>AliTPCReconstructor::GetMaxSnpTrack()) return 0.; //patch 01 jan 06
-    Double_t c1=GetSnp(), r1=TMath::Sqrt(1.- c1*c1);
+    Double_t c1=GetSnp(), r1=TMath::Sqrt((1.-c1)*(1.+c1));
     Double_t c2=c1+GetC()*(xk-GetX());
     if (TMath::Abs(c2)>AliTPCReconstructor::GetMaxSnpTrack()) return 0;
-    Double_t r2=TMath::Sqrt(1.- c2*c2);
+    Double_t r2=TMath::Sqrt((1.-c2)*(1.+c2));
     return GetY() + (xk-GetX())*(c1+c2)/(r1+r2);
 }
 
@@ -1351,10 +1351,10 @@ void  AliTPCseed::GetError(AliTPCclusterMI* cluster, AliExternalTrackParam * par
   AliTPCClusterParam *clusterParam = AliTPCcalibDB::Instance()->GetClusterParam();
   Double_t tany,tanz;  
   Double_t snp1=param->GetSnp();
-  tany=snp1/TMath::Sqrt(1.-snp1*snp1);
+  tany=snp1/TMath::Sqrt((1.-snp1)*(1.+snp1));
   //
   Double_t tgl1=param->GetTgl();
-  tanz=tgl1/TMath::Sqrt(1.-snp1*snp1);
+  tanz=tgl1/TMath::Sqrt((1.-snp1)*(1.+snp1));
   //
   Int_t padSize = 0;                          // short pads
   if (cluster->GetDetector() >= 36) {
@@ -1376,10 +1376,10 @@ void  AliTPCseed::GetShape(AliTPCclusterMI* cluster, AliExternalTrackParam * par
   AliTPCClusterParam *clusterParam = AliTPCcalibDB::Instance()->GetClusterParam();
   Double_t tany,tanz;  
   Double_t snp1=param->GetSnp();
-  tany=snp1/TMath::Sqrt(1.-snp1*snp1);
+  tany=snp1/TMath::Sqrt((1.-snp1)*(1.+snp1));
   //
   Double_t tgl1=param->GetTgl();
-  tanz=tgl1/TMath::Sqrt(1.-snp1*snp1);
+  tanz=tgl1/TMath::Sqrt((1.-snp1)*(1.+snp1));
   //
   Int_t padSize = 0;                          // short pads
   if (cluster->GetDetector() >= 36) {
index 48923b0..8438c6f 100644 (file)
@@ -1060,8 +1060,8 @@ Bool_t   AliTPCtrackerMI::GetProlongation(Double_t x1, Double_t x2, Double_t x[5
     return kFALSE;
   }
 
-  Double_t c1=x[4]*x1 - x[2], r1=sqrt(1.- c1*c1);
-  Double_t c2=x[4]*x2 - x[2], r2=sqrt(1.- c2*c2);  
+  Double_t c1=x[4]*x1 - x[2], r1=sqrt((1.-c1)*(1.+c1));
+  Double_t c2=x[4]*x2 - x[2], r2=sqrt((1.-c2)*(1.+c2));  
   y = x[0];
   z = x[1];
   
index b46291c..375c92b 100644 (file)
@@ -22,8 +22,8 @@ static int PropagateTo(TVector &x, Double_t fX, Double_t xk) {
   }
 
   Double_t x1=fX, x2=x1+(xk-x1), dx=x2-x1;//, y1=x(0), z1=x(1);
-  Double_t c1=x(2)*x1 - x(3), r1=sqrt(1.- c1*c1);
-  Double_t c2=x(2)*x2 - x(3), r2=sqrt(1.- c2*c2);
+  Double_t c1=x(2)*x1 - x(3), r1=sqrt((1.-c1)*(1.+c1));
+  Double_t c2=x(2)*x2 - x(3), r2=sqrt((1.-c2)*(1.+c2));
   
   x(0) += dx*(c1+c2)/(r1+r2);
   x(1) += dx*(c1+c2)/(c1*r2 + c2*r1)*x(4);
@@ -38,7 +38,7 @@ static int Rotate(TVector &x, Double_t fX, Double_t alpha) {
   
   fX = x1*ca + y1*sa;
   x(0)=-x1*sa + y1*ca;
-  x(3)=x(3)*ca + (x(2)*y1 + sqrt(1.- r1*r1))*sa;
+  x(3)=x(3)*ca + (x(2)*y1 + sqrt((1.-r1)*(1.+r1)))*sa;
   
   Double_t r2=x(2)*fX - x(3);
   if (TMath::Abs(r2) >= 0.999) {
@@ -46,7 +46,7 @@ static int Rotate(TVector &x, Double_t fX, Double_t alpha) {
     return 0;
   }
   
-  Double_t y0=x(0) + sqrt(1.- r2*r2)/x(2);
+  Double_t y0=x(0) + sqrt((1.-r2)*(1.+r2))/x(2);
   if ((x(0)-y0)*x(2) >= 0.) {
     //cerr<<"Rotation failed !!!\n";
     return 0;
index ca093c9..e00da09 100644 (file)
@@ -526,7 +526,7 @@ CDECK  ID>, GGRUN.
           e3     = xkin(5)
           e4     = xmgg - e3
         END IF
-        sinthe = sqrt (1 - costhe*costhe)
+        sinthe = sqrt ((1.-costhe)*(1.+costhe))
         p3(1) = p3abs * cos(phi) * sinthe
         p3(2) = p3abs * sin(phi) * sinthe
         p3(3) = p3abs * costhe
@@ -826,10 +826,10 @@ CDECK  ID>, GGDECY.
 *         Decay chi_1^+- --> chi_1^0 W^+- in CMS, uniformly
         eb = (amprt(1)**2 + amprt(2)**2 - amprt(4)**2) / (2 * amprt(1))
         ec = (amprt(1)**2 - amprt(2)**2 + amprt(4)**2) / (2 * amprt(1))
-        pb = sqrt (eb*eb - amprt(2)*amprt(2))
+        pb = sqrt ((eb-amprt(2))*(eb+amprt(2)))
         pc = pb
         costhe = 2*ggrnd(0) - 1.
-        sinthe = sqrt (1 - costhe*costhe)
+        sinthe = sqrt((1.-costhe)*(1.+costhe))
         phi = 2*pi*ggrnd(0)
         pcm(1) = pb * sinthe * cos(phi)
         pcm(2) = pb * sinthe * sin(phi)
@@ -878,7 +878,7 @@ CDECK  ID>, GGDECY.
 *
         phi    = 2.*pi * ggrnd(0)
         costhe = 2.*ggrnd(0) - 1.
-        sinthe = sqrt (1. - costhe*costhe)
+        sinthe = sqrt ((1.-costhe)*(1.+costhe))
 *
         pp = xm23 / 2.
         p2(1) = pp * sinthe * cos(phi)
@@ -895,7 +895,7 @@ CDECK  ID>, GGDECY.
 *       3-momenta p2, p3 are along z-axis
 *
         gamma = e23 / xm23
-        gambe = sqrt (gamma*gamma - 1.)
+        gambe = sqrt ((gamma-1.)*(gamma+1.))
 *
         p2z = gamma*p2(3) + gambe*p2(4)
         e2  = gamma*p2(4) + gambe*p2(3)
@@ -911,7 +911,7 @@ CDECK  ID>, GGDECY.
 *
         phi    = 2.*pi * ggrnd(0)
         costhe = 2.*ggrnd(0) - 1.
-        sinthe = sqrt (1. - costhe*costhe)
+        sinthe = sqrt ((1.-costhe)*(1.+costhe))
         cosphi = cos(phi)
         sinphi = sin(phi)
 *
@@ -976,7 +976,7 @@ CDECK  ID>, GGDECY.
         p12 = am1 * p2(4)
 *
         e4 = am1 - e23
-        pp =sqrt (e4*e4 - am4*am4)
+        pp =sqrt ((e4-am4)*(e4+am4))
         p4(1) =  pp * sinthe * cos(phi)
         p4(2) =  pp * sinthe * sin(phi)
         p4(3) = -pp * costhe
@@ -1184,7 +1184,7 @@ C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 C
       pa(1)= 0D0
       pa(2)= 0D0
-      pa(3)= dsqrt(1D0*(eb*eb-amas*amas))
+      pa(3)= dsqrt(1D0*((eb-amas)*(eb+amas)))
       pa(4)= eb*1D0
       pa(5)= amas*1D0
 C
index 645d2bc..4925f95 100644 (file)
@@ -759,7 +759,7 @@ Bool_t AliTRDCalibraFillHisto::FindP1TrackPHtracklet(AliTRDtrack *t, Int_t index
   Double_t tgl                        = t->GetTglPlane(GetLayer(detector)); // dz/dl and not dz/dx!  
   Double_t tnp                        = 0.0;                                // tan angle in the plan xy track
   if( TMath::Abs(snp) <  1.){
-    tnp = snp / (TMath::Sqrt(1-(snp*snp)));
+    tnp = snp / TMath::Sqrt((1.-snp)*(1.+snp));
   } 
   Float_t dzdx                        = tgl*TMath::Sqrt(1+tnp*tnp);         // dz/dx now from dz/dl
   // tilting pad and cross row
@@ -912,7 +912,7 @@ Bool_t AliTRDCalibraFillHisto::FindP1TrackPHtrackletV1(const AliTRDseedV1 *track
   Double_t snp = tracklet->GetSnp();             // sin dy/dx at the end of the chamber
   Double_t tnp = 0.0;                            // dy/dx at the end of the chamber 
   if( TMath::Abs(snp) <  1.){
-    tnp = snp / (TMath::Sqrt(1-(snp*snp)));
+    tnp = snp / TMath::Sqrt((1.-snp)*(1.+snp));
   } 
   Double_t tgl  = tracklet->GetTgl();           // dz/dl
   Double_t dzdx = tgl*TMath::Sqrt(1+tnp*tnp);   // dz/dx calculated from dz/dl
@@ -1056,7 +1056,7 @@ Bool_t AliTRDCalibraFillHisto::HandlePRFtracklet(AliTRDtrack *t, Int_t index0, I
   Float_t  dzdx = 0.0;                                // dzdx
   Float_t  tnp  = 0.0;
   if(TMath::Abs(snp) < 1.0){
-    tnp = snp / (TMath::Sqrt(1-snp*snp));
+    tnp = snp / TMath::Sqrt((1.-snp)*(1.+snp));
     dzdx = tgl*TMath::Sqrt(1+tnp*tnp);
   }
   // linear fitter
@@ -1353,7 +1353,7 @@ Bool_t AliTRDCalibraFillHisto::HandlePRFtrackletV1(const AliTRDseedV1 *tracklet,
   Double_t snp = tracklet->GetSnp();             // sin dy/dx at the end of the chamber
   Double_t tnp = 0.0;                            // dy/dx at the end of the chamber 
   if( TMath::Abs(snp) <  1.){
-    tnp = snp / (TMath::Sqrt(1-(snp*snp)));
+    tnp = snp / TMath::Sqrt((1.-snp)*(1.+snp));
   } 
   Double_t tgl  = tracklet->GetTgl();           // dz/dl
   Double_t dzdx = tgl*TMath::Sqrt(1+tnp*tnp);   // dz/dx calculated from dz/dl
index db169f3..6a77664 100644 (file)
@@ -638,7 +638,7 @@ Float_t AliTRDseed::FitRiemanTilt(AliTRDseed * cseed, Bool_t terror)
     if (-params[2]*params[0] + params[1]*params[1] + 1 > 0) {
       Double_t rm1 = params[0] / TMath::Sqrt(-params[2]*params[0] + params[1]*params[1] + 1); 
       if (1.0/(rm1*rm1) - (x-x0) * (x-x0) > 0.0) {
-                               Double_t res = (x - x0) / TMath::Sqrt(1.0 / (rm1*rm1) - (x-x0)*(x-x0));
+                               Double_t res = (x - x0) / TMath::Sqrt((1./rm1-(x-x0))*(1./rm1+(x-x0)));
                                if (params[0] < 0) res *= -1.0;
                                dy = res;
       }
index eb00d32..e9ab7a6 100644 (file)
@@ -3119,7 +3119,7 @@ Int_t AliTRDtracker::FindClusters(Int_t sector, Int_t t0, Int_t t1
 
   AliTRDtrack track2(* track);
   Float_t  snpy      = track->GetSnp();
-  Float_t  tany      = TMath::Sqrt(snpy*snpy / (1.0 - snpy*snpy)); 
+  Float_t  tany      = TMath::Sqrt(snpy*snpy / ((1.-snpy)*(1.+snpy))); 
   if (snpy < 0.0) {
     tany *= -1.0;
   }
index d33d9d1..d7f854f 100644 (file)
@@ -1304,7 +1304,7 @@ Double_t AliTRDtrackerV1::FitRiemanTilt(const AliTRDtrackV1 *track, AliTRDseedV1
     Float_t xyz[3];
     for(int ip=0; ip<np; ip++){
       points[ip].GetXYZ(xyz);
-      xyz[1] = TMath::Abs(xyz[0] - x0) > R ? 100. : y0 - (y0>0.?1.:-1.)*TMath::Sqrt(R*R-(xyz[0]-x0)*(xyz[0]-x0));
+      xyz[1] = TMath::Abs(xyz[0] - x0) > R ? 100. : y0 - (y0>0.?1.:-1.)*TMath::Sqrt((R-(xyz[0]-x0))*(R+(xyz[0]-x0)));
       xyz[2] = z0 + dzdx * (xyz[0] - xref);
       points[ip].SetXYZ(xyz);
     }
index 0f2c420..28331c8 100644 (file)
@@ -34,7 +34,7 @@
 void GetProlongation(Double_t xk, Double_t &x, Double_t *param, Double_t &y, Double_t &z){
   Double_t dx=xk-x;  
   Double_t f1=param[2], f2=f1 + param[4]*dx;
-  Double_t r1=TMath::Sqrt(1.- f1*f1), r2=TMath::Sqrt(1.- f2*f2);
+  Double_t r1=TMath::Sqrt((1.-f1)*(1.+f1)), r2=TMath::Sqrt((1.-f2)*(1.+f2));
   y  = param[0] + dx*(f1+f2)/(r1+r2);
   //z  = param[1] + dx*(r2 + f2*(f1+f2)/(r1+r2))*param[3];
   //z    = param[1] + dx*(f1+f2)/(f1*r2 + f2*r1)*param[3];