]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenCorrHF.cxx
Updates by Constantin Loizides.
[u/mrichter/AliRoot.git] / EVGEN / AliGenCorrHF.cxx
index 34c63de9665a4436f7b700d77e066910a96b421b..bc3482598460482ee0ecf31820d852661da32d6b 100644 (file)
 // Sept 09: added hadron pair composition probabilities via 2D histo (X.M. Zhang)
 // Oct 09: added energy choice between 7, 10, 14 TeV (for p-p), 4 TeV (for Pb-Pb),
 // 9 TeV (for p-Pb) and -9 TeV (for Pb-p) (S. Grigoryan)
+// April 10: removed "static" from definition of some variables (B. Vulpescu)
 //-------------------------------------------------------------------------
 // How it works (for the given flavor and p-p energy):
 //
-// 1) Reads QQbar kinematical grid from the Input file and generates
+// 1) Reads QQbar kinematical grid (TTree) from the Input file and generates
 // quark pairs according to the weights of the cells.
 // It is a 5D grid in y1,y2,pt1,pt2 and deltaphi, with occupancy weights
 // of the cells obtained from Pythia (see details in GetQuarkPair).
@@ -123,8 +124,6 @@ Int_t AliGenCorrHF::fgnptbins = 12;
 Double_t AliGenCorrHF::fgptbmin[12] = {0, 0.5, 1, 1.5, 2, 2.5, 3, 4, 5, 6, 7, 9};
 Double_t AliGenCorrHF::fgptbmax[12] = {0.5, 1, 1.5, 2, 2.5, 3, 4, 5, 6, 7, 9, 100};
 
-Double_t* AliGenCorrHF::fgIntegral = 0;
-
 //____________________________________________________________
     AliGenCorrHF::AliGenCorrHF():
        fFileName(0),
@@ -133,7 +132,8 @@ Double_t* AliGenCorrHF::fgIntegral = 0;
        fEnergy(0),
        fBias(0.),
        fTrials(0),
-       fDecayer(0)
+       fDecayer(0),
+       fgIntegral(0)
 {
 // Default constructor
 }
@@ -148,7 +148,8 @@ AliGenCorrHF::AliGenCorrHF(Int_t npart, Int_t idquark, Int_t energy):
     fBias(0.),
     fTrials(0),
     //    fDecayer(new AliDecayerPythia())
-    fDecayer(0)
+    fDecayer(0),
+    fgIntegral(0)
 {
 // Constructor using particle number, quark type, energy & default InputFile
 //
@@ -202,7 +203,8 @@ AliGenCorrHF::AliGenCorrHF(char* tname, Int_t npart, Int_t idquark, Int_t energy
     fBias(0.),
     fTrials(0),
     //    fDecayer(new AliDecayerPythia())
-    fDecayer(0)
+    fDecayer(0),
+    fgIntegral(0)
 {
 // Constructor using particle number, quark type, energy & user-defined InputFile
 //
@@ -292,9 +294,7 @@ void AliGenCorrHF::Generate()
   if (fQuark == 4) qm = 1.20;
   else             qm = 4.75;
 
-  static TClonesArray *particles;
-  //
-  if(!particles) particles = new TClonesArray("TParticle",1000);
+  TClonesArray *particles = new TClonesArray("TParticle",1000);
   
   TDatabasePDG *pDataBase = TDatabasePDG::Instance();
   //
@@ -580,6 +580,8 @@ void AliGenCorrHF::Generate()
   header->SetNProduced(fNprimaries);
   AddHeader(header);
 
+  delete particles;
+
 }
 //____________________________________________________________________________________
 void AliGenCorrHF::IpCharm(TH2F *hProbHH, Int_t &pdg3, Int_t &pdg4)
@@ -741,9 +743,10 @@ void AliGenCorrHF::GetHadronPair(TFile* fG, Int_t idq, Double_t y1, Double_t y2,
       y3 = 0.5 * TMath::Log((e1 + pz3 + 1.e-13)/(e1 - pz3 + 1.e-13));
       y4 = 0.5 * TMath::Log((e2 + pz4 + 1.e-13)/(e2 - pz4 + 1.e-13));
       if(TMath::Abs(y3)<ycorr && TMath::Abs(y4)<ycorr && rand[0]>0.5) {
-       ptemp = TMath::Sqrt(e1*e1 - pz3*pz3);
+       ptemp = TMath::Sqrt((e1-pz3)*(e1+pz3));
        y3  = 4*(1 - 2*rand[1]);
        pz3 = ptemp*TMath::SinH(y3);
        pz4 = pz3;
       }
 }
+