]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ZDC/AliZDCFragment.cxx
Fixes for Coverity warnings
[u/mrichter/AliRoot.git] / ZDC / AliZDCFragment.cxx
index 08c585c4fa7328590c2f98e98ba27539a8904b45..5652a3764a242a8a4ad41f2923eced0f2191afaa 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
+
+// ******************************************************************
+//
+//     Class for nuclear fragments formation
+//
+// ******************************************************************
+
 // --- Standard libraries
 #include <stdlib.h>
 
@@ -29,38 +36,45 @@ int comp(const void *i,const void *j) {return *(int *)i - *(int *)j;}
 
 
 //_____________________________________________________________________________
-AliZDCFragment::AliZDCFragment()
+AliZDCFragment::AliZDCFragment():
+  fB(0),
+  fZbAverage(0),
+  fNimf(0),
+  fZmax(0),
+  fTau(0),
+  fNalpha(0),
+  fZtot(0),
+  fNtot(0)
 {
   //
   // Default constructor
   //
-  fB = 0;
 }
 
 //_____________________________________________________________________________
-AliZDCFragment::AliZDCFragment(Float_t b)
-     : TNamed(" "," ")
+AliZDCFragment::AliZDCFragment(Float_t b): 
+  TNamed(" "," "),
+  fB(b),
+  fZbAverage(0),
+  fNimf(0),
+  fZmax(0),
+  fTau(0),
+  fNalpha(0),
+  fZtot(0),
+  fNtot(0)
 {
   //
   // Standard constructor
   //
-  fB = b;
-  fZbAverage = 0;
-  fNimf = 0;
-  fZmax = 0;
-  fTau = 0;
   for(Int_t i=0; i<=99; i++){
      fZZ[i] = 0;
      fNN[i] = 0;
   }
-  fNalpha = 0;
-  fZtot = 0;
-  fNtot = 0;
   
 }
 
 //_____________________________________________________________________________
-void AliZDCFragment::GenerateIMF(Int_t* fZZ, Int_t &fNalpha)
+void AliZDCFragment::GenerateIMF()
 {
 
    // Loop variables
@@ -71,7 +85,8 @@ void AliZDCFragment::GenerateIMF(Int_t* fZZ, Int_t &fNalpha)
    // Coefficients of polynomial for fluctuations on average number of IMF
    const Float_t  kParamFluctNimf[4]={-0.13176,2.9392,-5.2147,2.3092}; 
    // Coefficients of polynomial for average maximum Z of fragments
-   const Float_t  kParamZmax[4]={0.16899,14.203,-2.8284,65.036}; 
+   //const Float_t  kParamZmax[4]={0.16899,14.203,-2.8284,65.036}; 
+   const Float_t  kParamZmax[4]={0.16899,14.203,-2.8284,70.5}; 
    // Coefficients of polynomial for fluctuations on maximum Z of fragments
    const Float_t  kParamFluctZmax[5]={0.013782,-0.17282,1.5065,1.0654,-2.4317}; 
    // Coefficients of polynomial for exponent tau of fragments Z distribution
@@ -88,11 +103,13 @@ void AliZDCFragment::GenerateIMF(Int_t* fZZ, Int_t &fNalpha)
    // Maximum impact parameter for U [r0*A**(1/3)]
    const Float_t  kbMaxU = 14.87;
    // Maximum impact parameter for Pb [r0*A**(1/3)]
-   const Float_t  kbMaxPb = 14.22;
+   const Float_t  kbMaxPb = 14.22+4*kNuclearThick;
    // Z of the projectile
    const Float_t  kZProj = 82.;
    
    // From b(Pb) to b(U)
+   if(fB>kbMaxPb) fB = 2*kbMaxPb-fB;
+   
    Float_t  bU = fB*kbMaxU/kbMaxPb;
     
    // From b(U) to Zbound(U) 
@@ -109,10 +126,10 @@ void AliZDCFragment::GenerateIMF(Int_t* fZZ, Int_t &fNalpha)
    // Zbound is proportional to b**2 up to b < kbMaxPb-2*kNuclearThick
    // and then it is an increasing exponential, imposing that at 
    // b=kbMaxPb-2kNuclearThick the two functions have the same derivative
-   Float_t bCore = kbMaxPb-2*kNuclearThick;
+   /*Float_t bCore = kbMaxPb-2*kNuclearThick;
    if(fB>bCore){
      fZbAverage=kZProj*(1.-TMath::Exp(-kParamSkinPb[0]*(fB-kParamSkinPb[1])));
-   }
+   }*/
    if(fZbAverage>kZProj) fZbAverage = kZProj;
    Float_t zbNorm = fZbAverage/kZProj;
    Float_t bNorm = fB/kbMaxPb;
@@ -146,7 +163,7 @@ void AliZDCFragment::GenerateIMF(Int_t* fZZ, Int_t &fNalpha)
    fluctZmax = fluctZmax*kZProj/6.;
    Float_t xg = gRandom->Gaus(0.0,1.0);
    fluctZmax = fluctZmax*xg;
-   fZmax = averageZmax+fluctZmax;
+   fZmax = (averageZmax+fluctZmax);
    if(fZmax>kZProj) fZmax = kZProj;
    
 //   printf("\n\n ------------------------------------------------------------");   
@@ -286,7 +303,7 @@ void AliZDCFragment::GenerateIMF(Int_t* fZZ, Int_t &fNalpha)
 }
 
 //_____________________________________________________________________________
-void AliZDCFragment::AttachNeutrons(Int_t *fZZ, Int_t *fNN, Int_t &fZtot,Int_t &fNtot)
+void AliZDCFragment::AttachNeutrons()
 {
 //
 // Prepare nuclear fragment by attaching a suitable number of neutrons
@@ -347,3 +364,14 @@ void AliZDCFragment::AttachNeutrons(Int_t *fZZ, Int_t *fNN, Int_t &fZtot,Int_t &
    
 
 }
+
+//_____________________________________________________________________________
+Float_t AliZDCFragment::DeuteronNumber()
+{
+    // Calculates the fraction of deuterum nucleus produced
+    //
+    Float_t deuteronProdPar[2] = {-0.068,0.0385};
+    Float_t deutNum = deuteronProdPar[0] + deuteronProdPar[1]*fB;
+    if(deutNum<0.) deutNum = 0.;
+    return deutNum;
+}