]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenPairFlat.cxx
Bug correction
[u/mrichter/AliRoot.git] / EVGEN / AliGenPairFlat.cxx
index ac801fd096fda594ab8cabe34d2e58c6e97e697e..a7d3121b94e5d41c07ea6988c0aab1e8dacf0946 100644 (file)
@@ -47,13 +47,25 @@ AliGenPairFlat::AliGenPairFlat()
      fLegPdg1(11),
      fLegPdg2(-11),
      fAlpha(0.),
-     fDebug(0)
+     fDebug(0),
+     fPol(0)
 {
   //
   // Default constructor
   //
 }
 
+
+//_____________________________________________________________________________
+AliGenPairFlat::~AliGenPairFlat()
+{
+  //
+  // Destructor
+  //
+    delete fPol; 
+
+}
+
 //_____________________________________________________________________________
 void AliGenPairFlat::Generate()
 {
@@ -69,14 +81,13 @@ void AliGenPairFlat::Generate()
     Int_t i, j, nt;
     Double_t phi, y, mass, mt, e, pt;
     Float_t weight = 1.;
-    Double_t  pt1, pt2, y1, y2;
+    Double_t  pt1, pt2;
 
     TLorentzVector mother, dau1, dau2;
     Float_t random[6];
 
-//    TF1* fPol = new TF1("fPol","1.+[0]*x*x",-1.,1.);
-    TF1 fPol("fPol","1.+[0]*x*x",-1.,1.);
-    fPol.SetParameter(0,fAlpha);
+    fPol = new TF1("fPol","1.+[0]*x*x",-1.,1.);
+    fPol->SetParameter(0, fAlpha);
 
 
     for (j=0;j<3;j++) origin[j]=fOrigin[j];
@@ -87,6 +98,7 @@ void AliGenPairFlat::Generate()
        time = fTime;
      }
 
+       if(fDebug == 2){
        printf("\n\n------------------GENERATOR SETTINGS------------------\n\n");
        printf("You choosed for the mother the Mass range %f - %f     \n",fPairMassMin,fPairMassMax);
        printf("You choosed for the mother the transverse Momentum range %f - %f \n",fPairPtMin,fPairPtMax);
@@ -101,7 +113,7 @@ void AliGenPairFlat::Generate()
        printf("polarization factor is alpha == %lf \n",fAlpha);
        printf("vertex is at x == %f || y == %f || z == %f   \n",origin[0],origin[1],origin[2]);
        printf("\n----------------------------------------------------------\n");
-
+       }
 
     for(i=0;i<fPairNpart;i++) {
 
@@ -128,8 +140,8 @@ void AliGenPairFlat::Generate()
 
        pt1 = dau1.Pt();
        pt2 = dau2.Pt();
-       y1 = dau1.Rapidity();
-       y2 = dau2.Rapidity();
+       //      y1 = dau1.Rapidity();
+       //      y2 = dau2.Rapidity();
 
        //first daughter
        p[0] = dau1.Px();
@@ -180,7 +192,6 @@ void AliGenPairFlat::Generate()
 }
 
 //_____________________________________________________________________________
-
 void AliGenPairFlat::Init()
 {
        //
@@ -193,15 +204,13 @@ void AliGenPairFlat::Init()
 
 
 //_____________________________________________________________________________
-
-
-Bool_t AliGenPairFlat::Decay(TLorentzVector mother, TLorentzVector &dau1, TLorentzVector &dau2, TF1 polfactor)
+Bool_t AliGenPairFlat::Decay(const TLorentzVector& mother, TLorentzVector &dau1, TLorentzVector &dau2, TF1* polfactor)
 {
        //
        // decay procedure
        //
 
-       Double_t mp, md1, md2, ed1, ed2, pd1, pd2;
+       Double_t mp, md1, md2, ed1, ed2, pd1;
        Double_t costheta, sintheta, phi;
 
        mp = mother.M();
@@ -216,9 +225,9 @@ Bool_t AliGenPairFlat::Decay(TLorentzVector mother, TLorentzVector &dau1, TLoren
   ed1 = (mp*mp + md1*md1 - md2*md2)/(2.*mp);
   ed2 = mp-ed1;
   pd1 = TMath::Sqrt((ed1+md1)*(ed1-md1));
-  pd2 = TMath::Sqrt((mp*mp-(md1+md2)*(md1+md2))*(mp*mp -(md1-md2)*(md1-md2)))/(2.*mp);
+  //  pd2 = TMath::Sqrt((mp*mp-(md1+md2)*(md1+md2))*(mp*mp -(md1-md2)*(md1-md2)))/(2.*mp);
 
-  costheta = polfactor.GetRandom(); //polarization
+  costheta = polfactor->GetRandom(); //polarization
   sintheta = TMath::Sqrt((1.+costheta)*(1.-costheta));
   phi      = 2.0*TMath::Pi()*gRandom->Rndm();