]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenHIJINGpara.cxx
J/Psi from B (kJpsiFromB) added
[u/mrichter/AliRoot.git] / EVGEN / AliGenHIJINGpara.cxx
index 8ea8123168964730347221b25e49c9853dce6311..272a1868d5e9997d747ca0bad5273ccfb67cd9a3 100644 (file)
@@ -43,6 +43,7 @@
 #include <TF1.h>
 #include <TParticle.h>
 #include <TPDGCode.h>
+#include <TVirtualMC.h>
 
 #include "AliConst.h"
 #include "AliDecayer.h"
 
 ClassImp(AliGenHIJINGpara)
 
-AliGenHIJINGpara::AliGenHIJINGpara(const AliGenHIJINGpara & para)
+
+AliGenHIJINGpara::AliGenHIJINGpara(const AliGenHIJINGpara & para):
+    AliGenerator(para)
 {
-// copy constructor
+// Copy constructor
+    para.Copy(*this);
 }
 
 //_____________________________________________________________________________
@@ -218,11 +222,11 @@ void AliGenHIJINGpara::Init()
     fETApic = new TF1("etapic",&etapic,etaMin,etaMax,0);
     fETAkac = new TF1("etakac",&etakac,etaMin,etaMax,0);
 
-    TF1 etaPic0("etapic",&etapic,-7,7,0);
-    TF1 etaKac0("etakac",&etakac,-7,7,0);
+    TF1 etaPic0("etaPic0",&etapic,-7,7,0);
+    TF1 etaKac0("etaKac0",&etakac,-7,7,0);
 
-    TF1 ptPic0("ptpi",&ptpi,0.,15.,0);
-    TF1 ptKac0("ptka",&ptka,0.,15.,0);
+    TF1 ptPic0("ptPic0",&ptpi,0.,15.,0);
+    TF1 ptKac0("ptKac0",&ptka,0.,15.,0);
 
     Float_t intETApi  = etaPic0.Integral(-0.5, 0.5);
     Float_t intETAka  = etaKac0.Integral(-0.5, 0.5);
@@ -242,8 +246,16 @@ void AliGenHIJINGpara::Init()
 //  Fraction of events corresponding to the selected phi-range    
     Float_t phiFrac    = (fPhiMax-fPhiMin)/2/TMath::Pi();
 
+    
     fParentWeight = Float_t(fNpart)/(intETASel*ptFrac*phiFrac);
     
+    if (fAnalog != 0) {
+       fPtWgtPi = (fPtMax - fPtMin) / fPtpi->Integral(0., 20.);
+       fPtWgtKa = (fPtMax - fPtMin) / fPtka->Integral(0., 20.);
+       fParentWeight = Float_t(fNpart)/(intETASel*phiFrac);
+    }
+    
+    
     printf("%s: The number of particles in the selected kinematic region corresponds to %f percent of a full event\n ", 
           ClassName(),100.*fParentWeight);
 
@@ -278,7 +290,7 @@ void AliGenHIJINGpara::Generate()
     const Int_t kKaons[4] = {kK0Long, kK0Short, kKPlus, kKMinus};
     //
     Float_t origin[3];
-    Float_t pt, pl, ptot;
+    Float_t pt, pl, ptot, wgt;
     Float_t phi, theta;
     Float_t p[3];
     Int_t i, part, j;
@@ -299,23 +311,32 @@ void AliGenHIJINGpara::Generate()
     eventVertex[0] = origin[0];
     eventVertex[1] = origin[1];
     eventVertex[2] = origin[2];
-
+     
     for(i=0;i<fNpart;i++) {
        while(1) {
-           Rndm(random,3);
+           Rndm(random,4);
            if(random[0]<kBorne) {
                part=kPions[Int_t (random[1]*3)];
                ptf=fPtpi;
                etaf=fETApic;
+               wgt = fPtWgtPi;
            } else {
                part=kKaons[Int_t (random[1]*4)];
                ptf=fPtka;
                etaf=fETAkac;
+               wgt = fPtWgtKa;
            }
            phi=fPhiMin+random[2]*(fPhiMax-fPhiMin);
            theta=2*TMath::ATan(TMath::Exp(-etaf->GetRandom()));
            if(theta<fThetaMin || theta>fThetaMax) continue;
-           pt=ptf->GetRandom();
+        
+           if (fAnalog == 0) { 
+               pt = ptf->GetRandom();
+           } else {
+               pt = fPtMin + random[3] * (fPtMax - fPtMin);
+           }
+           
+           
            pl=pt/TMath::Tan(theta);
            ptot=TMath::Sqrt(pt*pt+pl*pl);
            if(ptot<fPMin || ptot>fPMax) continue;
@@ -329,6 +350,14 @@ void AliGenHIJINGpara::Generate()
                        TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
                }
            }
+           
+           if (fAnalog == 0) { 
+               wgt = fParentWeight;
+           } else {
+               wgt *= (fParentWeight * ptf->Eval(pt));
+           }
+           
+           
            if (part == kPi0 && fPi0Decays){
 //
 //          Decay pi0 if requested
@@ -353,12 +382,6 @@ void AliGenHIJINGpara::Generate()
     gAlice->SetGenEventHeader(header); 
 }
 
-AliGenHIJINGpara& AliGenHIJINGpara::operator=(const  AliGenHIJINGpara& rhs)
-{
-// Assignment operator
-    return *this;
-}
-
 void AliGenHIJINGpara::SetPtRange(Float_t ptmin, Float_t ptmax) {
     AliGenerator::SetPtRange(ptmin, ptmax);
 }
@@ -398,3 +421,8 @@ void AliGenHIJINGpara::DecayPi0(Float_t* orig, Float_t * p)
     }
     fNt = nt;
 }
+
+void AliGenHIJINGpara::Copy(AliGenHIJINGpara &) const
+{
+  Fatal("Copy","Not implemented!\n");
+}