]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenHIJINGpara.cxx
AliRICHDetectV1 added.
[u/mrichter/AliRoot.git] / EVGEN / AliGenHIJINGpara.cxx
index bd0a01d9bc75de07d68d0bd7fdeeef738ae1e486..8086a3ad5d0191f307343d8816865e0657baa0ad 100644 (file)
 
 /*
 $Log$
+Revision 1.11.4.1  2002/07/24 08:56:28  alibrary
+Updating EVGEN on TVirtulaMC
+
+Revision 1.12  2002/06/19 06:56:34  hristov
+Memory leak corrected
+
+Revision 1.11  2002/03/20 10:21:13  hristov
+Set fPtMax to 15 GeV in order to avoid some numerical problems
+
+Revision 1.10  2001/10/15 16:44:46  morsch
+- Possibility for vertex distribution truncation.
+- Write mc header with vertex position.
+
+Revision 1.9  2001/07/27 17:09:36  morsch
+Use local SetTrack, KeepTrack and SetHighWaterMark methods
+to delegate either to local stack or to stack owned by AliRun.
+(Piotr Skowronski, A.M.)
+
+Revision 1.8  2001/07/20 11:03:58  morsch
+Issue warning message if used outside allowed eta range (-8 to 8).
+
 Revision 1.7  2001/07/17 12:41:01  morsch
 - Calculation of fraction of event corresponding to selected pt-range corrected
 (R. Turrisi)
@@ -64,11 +85,14 @@ All coding rule violations except RS3 corrected (AM)
 ///////////////////////////////////////////////////////////////////
 
 #include "AliGenHIJINGpara.h"
-#include "TF1.h"
+#include "AliGenEventHeader.h"
 #include "AliRun.h"
 #include "AliConst.h"
 #include "AliPDG.h"
 
+#include <TF1.h>
+#include <TArrayF.h>
+
 ClassImp(AliGenHIJINGpara)
 
 AliGenHIJINGpara::AliGenHIJINGpara(const AliGenHIJINGpara & para)
@@ -183,6 +207,8 @@ AliGenHIJINGpara::AliGenHIJINGpara()
     fPtka = 0;
     fETApic = 0;
     fETAkac = 0;
+    SetCutVertexZ();
+    SetPtRange();
 }
 
 //_____________________________________________________________________________
@@ -198,6 +224,8 @@ AliGenHIJINGpara::AliGenHIJINGpara(Int_t npart)
     fPtka = 0;
     fETApic = 0;
     fETAkac = 0;
+    SetCutVertexZ();
+    SetPtRange();
 }
 
 //_____________________________________________________________________________
@@ -227,27 +255,27 @@ void AliGenHIJINGpara::Init()
     fETApic = new TF1("etapic",&etapic,etaMin,etaMax,0);
     fETAkac = new TF1("etakac",&etakac,etaMin,etaMax,0);
 
-    TF1 *etaPic0 = new TF1("etapic",&etapic,-7,7,0);
-    TF1 *etaKac0 = new TF1("etakac",&etakac,-7,7,0);
+    TF1 etaPic0("etapic",&etapic,-7,7,0);
+    TF1 etaKac0("etakac",&etakac,-7,7,0);
 
-    TF1 *ptPic0  = new TF1("ptpi",&ptpi,0.,15.,0);
-    TF1 *ptKac0  = new TF1("ptka",&ptka,0.,15.,0);
+    TF1 ptPic0("ptpi",&ptpi,0.,15.,0);
+    TF1 ptKac0("ptka",&ptka,0.,15.,0);
 
-    Float_t intETApi  = etaPic0->Integral(-0.5, 0.5);
-    Float_t intETAka  = etaKac0->Integral(-0.5, 0.5);
+    Float_t intETApi  = etaPic0.Integral(-0.5, 0.5);
+    Float_t intETAka  = etaKac0.Integral(-0.5, 0.5);
     Float_t scalePi   = 7316/(intETApi/1.5);
     Float_t scaleKa   =  684/(intETAka/2.0);
 
 //  Fraction of events corresponding to the selected pt-range    
-    Float_t intPt    = (0.877*ptPic0->Integral(0, 15)+
-                       0.123*ptKac0->Integral(0, 15));
-    Float_t intPtSel = (0.877*ptPic0->Integral(fPtMin, fPtMax)+
-                       0.123*ptKac0->Integral(fPtMin, fPtMax));
+    Float_t intPt    = (0.877*ptPic0.Integral(0, 15)+
+                       0.123*ptKac0.Integral(0, 15));
+    Float_t intPtSel = (0.877*ptPic0.Integral(fPtMin, fPtMax)+
+                       0.123*ptKac0.Integral(fPtMin, fPtMax));
     Float_t ptFrac   = intPtSel/intPt;
 
 //  Fraction of events corresponding to the selected eta-range    
-    Float_t intETASel  = (scalePi*etaPic0->Integral(etaMin, etaMax)+
-                         scaleKa*etaKac0->Integral(etaMin, etaMax));
+    Float_t intETASel  = (scalePi*etaPic0.Integral(etaMin, etaMax)+
+                         scaleKa*etaKac0.Integral(etaMin, etaMax));
 //  Fraction of events corresponding to the selected phi-range    
     Float_t phiFrac    = (fPhiMax-fPhiMin)/2/TMath::Pi();
 
@@ -293,13 +321,25 @@ void AliGenHIJINGpara::Generate()
     Float_t random[6];
     //
     for (j=0;j<3;j++) origin[j]=fOrigin[j];
-    if(fVertexSmear==kPerEvent) {
-       Rndm(random,6);
-       for (j=0;j<3;j++) {
-           origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
-               TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
+
+    if(fVertexSmear == kPerEvent) {
+       Float_t dv[3];
+       dv[2] = 1.e10;
+       while(TMath::Abs(dv[2]) > fCutVertexZ*fOsigma[2]) {
+           Rndm(random,6);
+           for (j=0; j < 3; j++) {
+               dv[j] = fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
+                   TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
+           }
        }
-    }
+       for (j=0; j < 3; j++) origin[j] += dv[j];
+    } // if kPerEvent
+    TArrayF eventVertex;
+    eventVertex.Set(3);
+    eventVertex[0] = origin[0];
+    eventVertex[1] = origin[1];
+    eventVertex[2] = origin[2];
+
     for(i=0;i<fNpart;i++) {
        while(1) {
            Rndm(random,3);
@@ -329,10 +369,15 @@ void AliGenHIJINGpara::Generate()
                        TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
                }
            }
-           gAlice->SetTrack(fTrackIt,-1,part,p,origin,polar,0,kPPrimary,nt,fParentWeight);
+           SetTrack(fTrackIt,-1,part,p,origin,polar,0,kPPrimary,nt,fParentWeight);
            break;
        }
     }
+// Header
+    AliGenEventHeader* header = new AliGenEventHeader("HIJINGparam");
+// Event Vertex
+    header->SetPrimaryVertex(eventVertex);
+    gAlice->SetGenEventHeader(header); 
 }
 
 AliGenHIJINGpara& AliGenHIJINGpara::operator=(const  AliGenHIJINGpara& rhs)
@@ -341,4 +386,7 @@ AliGenHIJINGpara& AliGenHIJINGpara::operator=(const  AliGenHIJINGpara& rhs)
     return *this;
 }
 
+void AliGenHIJINGpara::SetPtRange(Float_t ptmin, Float_t ptmax) {
+  AliGenerator::SetPtRange(ptmin, ptmax);
+}