]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Slow nucleon generator and model.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 24 Mar 2003 16:49:23 +0000 (16:49 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 24 Mar 2003 16:49:23 +0000 (16:49 +0000)
EVGEN/AliGenSlowNucleons.cxx [new file with mode: 0644]
EVGEN/AliGenSlowNucleons.h [new file with mode: 0644]
EVGEN/AliSlowNucleonModel.cxx [new file with mode: 0644]
EVGEN/AliSlowNucleonModel.h [new file with mode: 0644]
EVGEN/AliSlowNucleonModelExp.cxx [new file with mode: 0644]
EVGEN/AliSlowNucleonModelExp.h [new file with mode: 0644]
EVGEN/EVGENLinkDef.h
EVGEN/libEVGEN.pkg

diff --git a/EVGEN/AliGenSlowNucleons.cxx b/EVGEN/AliGenSlowNucleons.cxx
new file mode 100644 (file)
index 0000000..ba03885
--- /dev/null
@@ -0,0 +1,245 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/*
+$Log$
+*/
+
+/*
+  Generator for slow nucluons in pA interactions. 
+  Source is modelled by a relativistic Maxwell distributions.
+  Original code by  Ferenc Sikler  <sikler@rmki.kfki.hu>
+ */
+
+#include <TDatabasePDG.h>
+#include <TPDGCode.h>
+#include <TH2F.h>
+
+#include "AliCollisionGeometry.h"
+#include "AliGenSlowNucleons.h"
+#include "AliSlowNucleonModel.h"
+
+ ClassImp(AliGenSlowNucleons)
+    
+ AliGenSlowNucleons::AliGenSlowNucleons():AliGenerator(-1)
+{
+// Default constructor
+    fSlowNucleonModel = 0;
+    fCollisionGeometry = 0;
+}
+
+AliGenSlowNucleons::AliGenSlowNucleons(Int_t npart)
+    :AliGenerator(npart)
+{
+// Constructor
+    fName  = "SlowNucleons";
+    fTitle = "Generator for gray particles in pA collisions";
+    SetPmax();
+    SetTarget();
+    SetNominalCmsEnergy();
+    SetCharge();
+    SetTemperature();
+    SetBetaSource();
+    fSlowNucleonModel = new AliSlowNucleonModel();
+    fCollisionGeometry = 0;
+    fDebug = 0;
+}
+
+//____________________________________________________________
+AliGenSlowNucleons::~AliGenSlowNucleons()
+{
+// Destructor
+    delete  fSlowNucleonModel;
+}
+
+
+void AliGenSlowNucleons::Init()
+{
+  //
+  // Initialization
+  //
+    Float_t kMass  = TDatabasePDG::Instance()->GetParticle(kProton)->Mass();
+    fMomentum = fCMS/2. * fZTarget / fATarget;
+    fBeta     = fMomentum / TMath::Sqrt(kMass * kMass + fMomentum * fMomentum);
+    if (fDebug) {
+       fDebugHist = new TH2F("DebugHist", "N_heavy vs nu", 50, 0., 50., 50, 0., 50.);
+    }
+}
+
+void AliGenSlowNucleons::FinishRun()
+{
+    if (fDebug) {
+       fDebugHist->Draw();
+    }
+}
+
+
+void AliGenSlowNucleons::Generate()
+{
+  //
+  // Generate one event
+  //
+  //
+  // Communication with Gray Particle Model 
+  // 
+    Int_t ngp, ngn, nbp, nbn;
+
+    Float_t b = fCollisionGeometry->ImpactParameter();
+    Int_t  nn   = fCollisionGeometry->NN();
+    Int_t  nwn  = fCollisionGeometry->NwN();
+    Int_t  nnw  = fCollisionGeometry->NNw();
+    Int_t  nwnw = fCollisionGeometry->NwNw();
+
+    printf("AliGenSlowNucleons: Impact parameter from Collision Geometry %f %d %d %d %d\n", 
+          b, nn, nwn, nnw, nwnw);
+        
+    fSlowNucleonModel->GetNumberOfSlowNucleons(fCollisionGeometry, ngp, ngn, nbp, nbn);
+
+    if (fDebug) {
+       printf("nucleons %d %d %d %d \n", ngp, ngn, nbp, nbn);
+       
+       fDebugHist->Fill(Float_t(ngp + ngn + nbp + nbn), fCollisionGeometry->NwN(), 1.);
+    }
+    
+
+   //
+    Float_t p[3];
+    Float_t origin[3] = {0., 0., 0.};
+    Float_t polar [3] = {0., 0., 0.};    
+    Int_t nt, i;
+    Int_t kf;
+//
+//  Gray protons
+//
+    fCharge = 1;
+    kf = kProton;    
+    for(i = 0; i < ngp; i++) {
+       GenerateSlow(fCharge, fTemperatureG, fBetaSourceG, p);
+       SetTrack(fTrackIt, -1, kf, p, origin, polar,
+                0., kPNoProcess, nt, 1.);
+       KeepTrack(nt);
+    }
+//
+//  Gray neutrons
+//
+    fCharge = 0;
+    kf = kNeutron;    
+    for(i = 0; i < ngn; i++) {
+       GenerateSlow(fCharge, fTemperatureG, fBetaSourceG, p);
+       SetTrack(fTrackIt, -1, kf, p, origin, polar,
+                0., kPNoProcess, nt, 1.);
+       KeepTrack(nt);
+    }
+//
+//  Black protons
+//
+    fCharge = 1;
+    kf = kProton;    
+    for(i = 0; i < nbp; i++) {
+       GenerateSlow(fCharge, fTemperatureB, fBetaSourceB, p);
+       SetTrack(fTrackIt, -1, kf, p, origin, polar,
+                0., kPNoProcess, nt, 1.);
+       KeepTrack(nt);
+    }
+//
+//  Black neutrons
+//
+    fCharge = 0;
+    kf = kNeutron;    
+    for(i = 0; i < nbn; i++) {
+       GenerateSlow(fCharge, fTemperatureB, fBetaSourceB, p);
+       SetTrack(fTrackIt, -1, kf, p, origin, polar,
+                0., kPNoProcess, nt, 1.);
+       KeepTrack(nt);
+    }
+}
+
+
+
+
+void AliGenSlowNucleons::GenerateSlow(Int_t charge, Double_t T, Double_t beta, Float_t* q)
+/* 
+   Emit a slow nucleon with "temperature" T [GeV], 
+   from a source moving with velocity beta         
+   Three-momentum [GeV/c] is given back in q[3]    
+*/
+
+{
+ Double_t m, pmax, p, f, theta, phi;
+ TDatabasePDG * pdg = TDatabasePDG::Instance();
+ const Double_t kMassProton  = pdg->GetParticle(kProton) ->Mass();
+ const Double_t kMassNeutron = pdg->GetParticle(kNeutron)->Mass();
+ /* Select nucleon type */
+ if(charge == 0) m = kMassNeutron;
+ else m = kMassProton;
+
+ /* Momentum at maximum of Maxwell-distribution */
+
+ pmax = TMath::Sqrt(2*T*(T+sqrt(T*T+m*m)));
+
+ /* Try until proper momentum                                  */
+ /* for lack of primitive function of the Maxwell-distribution */
+ /* a brute force trial-accept loop, normalized at pmax        */
+
+ do
+ {
+     p = Rndm() * fPmax;
+     f = Maxwell(m, p, T) / Maxwell(m , pmax, T);
+ }
+ while(f < Rndm());
+
+ /* Spherical symmetric emission */
+ theta = TMath::ACos(2. * Rndm() - 1.);
+ phi   = 2. * TMath::Pi() * Rndm();
+
+ /* Determine momentum components in system of the moving source */
+ q[0] = p * TMath::Sin(theta) * TMath::Cos(phi);
+ q[1] = p * TMath::Sin(theta) * TMath::Sin(phi);
+ q[2] = p * TMath::Cos(theta);
+
+ /* Transform to system of the target nucleus                             */
+ /* beta is passed as negative, because the gray nucleons are slowed down */
+ Lorentz(m, -beta, q);
+
+ /* Transform to laboratory system */
+ Lorentz(m, fBeta, q);
+}
+
+Double_t AliGenSlowNucleons::Maxwell(Double_t m, Double_t p, Double_t T)
+{
+/* Relativistic Maxwell-distribution */
+    Double_t ekin;
+    ekin = TMath::Sqrt(p*p+m*m)-m;
+    return (p*p * exp(-ekin/T));
+}
+
+
+void AliGenSlowNucleons::Lorentz(Double_t m, Double_t beta, Float_t* q)
+{
+/* Lorentz transform in the direction of q[2] */
+    Double_t gamma  = 1/sqrt(1-beta*beta); 
+    Double_t energy = sqrt(m*m + q[0]*q[0] + q[1]*q[1] + q[2]*q[2]);
+    q[2] = gamma * (q[2] + beta*energy);
+}
+
+
+
+
+
+
+
diff --git a/EVGEN/AliGenSlowNucleons.h b/EVGEN/AliGenSlowNucleons.h
new file mode 100644 (file)
index 0000000..aa48c3e
--- /dev/null
@@ -0,0 +1,67 @@
+#ifndef ALIGENSLOWNUCLEONS_H
+#define ALIGENSLOWNUCLEONS_H
+/* Copyright(c) 198-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#include "AliGenerator.h"
+class AliSlowNucleonModel;
+class TH2F;
+
+
+class AliGenSlowNucleons : public AliGenerator
+{
+public:
+    AliGenSlowNucleons();
+    AliGenSlowNucleons(Int_t npart);
+    virtual ~AliGenSlowNucleons();
+    virtual void Init();
+    virtual void FinishRun();
+    virtual void Generate();
+    virtual void SetPmax(Float_t pmax = 10.) {fPmax = pmax;}
+    virtual void SetNominalCmsEnergy(Float_t energy = 14000.) {fCMS = energy;}
+    virtual void SetTarget(Float_t a=208, Float_t z=82) {fATarget = a; fZTarget = z;}
+    virtual void SetCharge(Int_t c = 1) {fCharge = c;}
+    virtual void SetTemperature(Double_t t1 = 0.04, Double_t t2 = 0.004)
+       {fTemperatureG = t1; fTemperatureB = t2;}
+    virtual void SetBetaSource(Double_t b1 = 0.05, Double_t b2 = 0.)
+       {fBetaSourceG = b1; fBetaSourceB = b2;}
+    //
+    virtual void SetSlowNucleonModel(AliSlowNucleonModel* model) 
+       {fSlowNucleonModel = model;}
+    virtual Bool_t NeedsCollisionGeometry() const {return kTRUE;}
+    virtual void   SetCollisionGeometry(AliCollisionGeometry* geom)
+       {fCollisionGeometry = geom;}
+    virtual void   SetDebug(Int_t flag = 0) {fDebug = flag;}
+           
+ protected:
+    void     GenerateSlow(Int_t charge, Double_t T, Double_t beta, Float_t* q);
+    Double_t Maxwell(Double_t m, Double_t p, Double_t t);
+    void     Lorentz(Double_t m, Double_t beta, Float_t* q);
+ protected:
+    Float_t  fCMS;          // Center of mass energy
+    Float_t  fMomentum;     // Target nucleus momentum
+    Float_t  fBeta;         // Target nucleus beta
+    Float_t  fPmax;         // Maximum slow nucleon momentum
+    Float_t  fATarget;      // Target nucleus mass number
+    Float_t  fZTarget;      // Target nucleus charge number
+    Int_t    fCharge;       // Slow nucleon charge
+    Float_t  fTemperatureG; // Source Temperature for gray nucleons
+    Float_t  fBetaSourceG;  // Source beta for gray nucleons
+    Float_t  fTemperatureB; // Source Temperature for black nucleons
+    Float_t  fBetaSourceB;  // Source beta for black nucleons
+    Int_t    fDebug;        // Debug flag
+    TH2F*    fDebugHist;    // Histogram for debugging
+    
+    //
+    AliSlowNucleonModel* fSlowNucleonModel; // The slow nucleon model
+    ClassDef(AliGenSlowNucleons,1) // Slow Nucleon Generator
+};
+#endif
+
+
+
+
+
+
diff --git a/EVGEN/AliSlowNucleonModel.cxx b/EVGEN/AliSlowNucleonModel.cxx
new file mode 100644 (file)
index 0000000..9151717
--- /dev/null
@@ -0,0 +1,23 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/*
+$Log$
+*/
+
+
+#include "AliSlowNucleonModel.h"
+#include "AliCollisionGeometry.h"
+ClassImp(AliSlowNucleonModel)
diff --git a/EVGEN/AliSlowNucleonModel.h b/EVGEN/AliSlowNucleonModel.h
new file mode 100644 (file)
index 0000000..0fc4997
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef ALISLOWNUCLEONMODEL_H
+#define ALISLOWNUCLEONMODEL_H
+/* Copyright(c) 198-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#include "TObject.h"
+class AliCollisionGeometry;
+
+class AliSlowNucleonModel : public TObject
+{
+public:
+    AliSlowNucleonModel() {;}
+    virtual ~AliSlowNucleonModel(){;}
+    virtual void GetNumberOfSlowNucleons(AliCollisionGeometry* geo,
+                                        Int_t& ngp, Int_t& ngn,
+                                        Int_t& nbp, Int_t& nbn) {;}
+    
+ protected:
+  ClassDef(AliSlowNucleonModel,1) // Gray Particle Model
+};
+#endif
+
+
+
+
+
+
diff --git a/EVGEN/AliSlowNucleonModelExp.cxx b/EVGEN/AliSlowNucleonModelExp.cxx
new file mode 100644 (file)
index 0000000..a7f4f3c
--- /dev/null
@@ -0,0 +1,91 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/*
+$Log$
+*/
+
+
+// Experimental data inspired Gray Particle Model for p-Pb collisions
+//
+// The number of gray nucleons  is proportional to the number of collisions.
+// The number of black nucleons is proportional to the number of collisions
+// Fluctuations are calculated from a binomial distribution.
+//
+
+#include "AliSlowNucleonModelExp.h"
+#include "AliCollisionGeometry.h"
+#include <TRandom.h>
+
+ClassImp(AliSlowNucleonModelExp)
+
+AliSlowNucleonModelExp::AliSlowNucleonModelExp()
+{
+// Default constructor
+    fP = 82;
+    fN = 208 - 82;
+    fAlphaGray  = 2.;
+    fAlphaBlack = 4.;
+}
+
+
+void AliSlowNucleonModelExp::GetNumberOfSlowNucleons(AliCollisionGeometry* geo, 
+                                                     Int_t& ngp, Int_t& ngn, Int_t & nbp, Int_t & nbn)
+{
+//
+// Return the number of black and gray nucleons
+//
+// Number of collisions
+
+    Int_t nu  = geo->NwN() +  geo->NNw();
+
+// Mean number of gray nucleons 
+
+    Float_t nGray         = fAlphaGray * nu;
+    Float_t nGrayNeutrons = nGray * fN / (fN + fP);
+    Float_t nGrayProtons  = nGray - nGrayNeutrons;
+
+// Mean number of black nucleons 
+    Float_t nBlack         = fAlphaBlack * nu;
+    Float_t nBlackNeutrons = nBlack * fN / (fN + fP);
+    Float_t nBlackProtons  = nBlack - nBlackNeutrons;
+
+// Actual number (including fluctuations) from binomial distribution
+    Double_t p;
+
+//  gray neutrons
+    p =  nGrayNeutrons/fN;
+    ngn = gRandom->Binomial((Int_t) fN, p);
+    
+//  gray protons
+    p =  nGrayProtons/fP;
+    ngp = gRandom->Binomial((Int_t) fP, p);
+
+//  black neutrons
+    p =  nBlackNeutrons/fN;
+    nbn = gRandom->Binomial((Int_t) fN, p);
+    
+//  black protons
+    p =  nBlackProtons/fP;
+    nbp = gRandom->Binomial((Int_t) fP, p);
+       
+}
+
+void AliSlowNucleonModelExp::SetParameters(Float_t alpha1, Float_t alpha2)
+{
+    // Set the model parameters
+    fAlphaGray  = alpha1;
+    fAlphaBlack = alpha2;
+}
diff --git a/EVGEN/AliSlowNucleonModelExp.h b/EVGEN/AliSlowNucleonModelExp.h
new file mode 100644 (file)
index 0000000..2a14b74
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef ALISLOWNUCLEONMODELEXP_H
+#define ALISLOWNUCLEONMODELEXP_H
+/* Copyright(c) 198-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#include "AliSlowNucleonModel.h"
+
+class AliCollisionGeometry;
+
+class AliSlowNucleonModelExp : public AliSlowNucleonModel
+{
+ public:
+    AliSlowNucleonModelExp();
+    virtual ~AliSlowNucleonModelExp(){;}
+    virtual void GetNumberOfSlowNucleons(AliCollisionGeometry* geo,
+                                        Int_t& ngp, Int_t& ngn, Int_t& nbp, Int_t& nbn);
+    virtual void SetParameters(Float_t alpha1, Float_t alpha2);
+    
+ protected:
+    Float_t  fP;          // Number of protons  in the target 
+    Float_t  fN;          // Number of neutrons in the target
+    Float_t  fAlphaGray;  // Proportionality between gray   particles and number of collisions
+    Float_t  fAlphaBlack; // Proportionality between black  particles and number of collisions
+    
+  ClassDef(AliSlowNucleonModelExp,1) // Gray Particle Model (Experiment inspired)
+};
+#endif
+
+
+
+
+
+
index 5ff8c06a85207c6343a5a699ff2bc4fd898edffc..e031e985258721dfc520db740e4997985ee7558b 100644 (file)
@@ -48,9 +48,9 @@
 #pragma link C++ class  AliGenAfterBurnerFlow+;
 #pragma link C++ class  AliPartonicEnergyLoss+;
 #pragma link C++ class  AliStructFuncType+;
-#pragma link C++ class  AliGenGrayParticles+;
-#pragma link C++ class  AliGrayParticleModel+;
-
+#pragma link C++ class  AliGenSlowNucleons+;
+#pragma link C++ class  AliSlowNucleonModel+;
+#pragma link C++ class  AliSlowNucleonModelExp+;
 #endif
 
 
index 75306a2bfdefb4b988b7a02fa00f58de321f3ee0..1588c317673a8662afdf2908c07fbb0f728ab05c 100644 (file)
@@ -15,9 +15,9 @@ SRCS          = AliGenHIJINGpara.cxx AliGenBox.cxx AliGenFixed.cxx \
                AliGenThetaSlice.cxx AliGenSTRANGElib.cxx AliGenBeamGas.cxx\
                AliGenAfterBurnerFlow.cxx \
                AliPartonicEnergyLoss.cxx\
-               AliStructFuncType.cxx AliGenGrayParticles.cxx \
+               AliStructFuncType.cxx AliGenSlowNucleons.cxx \
                AliGenGeVSimEventHeader.cxx\
-               AliGrayParticleModel.cxx
+               AliSlowNucleonModel.cxx AliSlowNucleonModelExp.cxx
 
 # Headerfiles for this particular package (Path respect to own directory)
 HDRS= $(SRCS:.cxx=.h)