]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RALICE/AliCollider.cxx
data/transform_slat.dat Updated for changes in geometr. Geometry framework classes...
[u/mrichter/AliRoot.git] / RALICE / AliCollider.cxx
index 7d570706edc176cd1ebc5345b261ef6706d6dd4a..7f549c1f2fe575996e9e3b03375124785593dbf1 100644 (file)
@@ -13,7 +13,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-// $Id: AliCollider.cxx,v 1.8 2003/12/18 09:28:06 nick Exp $
+// $Id: AliCollider.cxx,v 1.12 2004/05/04 15:33:04 nick Exp $
 
 ///////////////////////////////////////////////////////////////////////////
 // Class AliCollider
 //
 //
 //--- Author: Nick van Eijndhoven 22-nov-2002 Utrecht University
-//- Modified: NvE $Date: 2003/12/18 09:28:06 $ Utrecht University
+//- Modified: NvE $Date: 2004/05/04 15:33:04 $ Utrecht University
 ///////////////////////////////////////////////////////////////////////////
 
 #include "AliCollider.h"
@@ -120,11 +120,25 @@ AliCollider::AliCollider() : TPythia6()
 {
 // Default constructor.
 // All variables initialised to default values.
+//
+// Some Pythia default MC parameters are automatically modified to provide
+// more suitable running conditions for soft processes in view of
+// nucleus-nucleus interactions and astrophysical processes.
+// The user may initialise the generator with all the default Pythia
+// parameters and obtain full user control to modify the settings by means
+// of the SetUserControl memberfunction.
+//
+// Refer to the SetElastic memberfunction for the inclusion of elastic
+// and diffractive processes.
+// By default these processes are not included.
+
  fVertexmode=0;    // No vertex structure creation
  fResolution=1e-5; // Standard resolution is 0.1 micron
  fRunnum=0;
  fEventnum=0;
  fPrintfreq=1;
+ fUserctrl=0; // Automatic optimisation of some MC parameters 
+ fElastic=0;  // No elastic and diffractive processes
 
  fEvent=0;
 
@@ -258,7 +272,7 @@ void AliCollider::SetVertexMode(Int_t mode)
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-Int_t AliCollider::GetVertexMode()
+Int_t AliCollider::GetVertexMode() const
 {
 // Provide the current mode for vertex structure creation.
  return fVertexmode;
@@ -273,7 +287,7 @@ void AliCollider::SetResolution(Double_t res)
  fResolution=fabs(res);
 }
 ///////////////////////////////////////////////////////////////////////////
-Double_t AliCollider::GetResolution()
+Double_t AliCollider::GetResolution() const
 {
 // Provide the current resolution (in cm) for resolving (sec.) vertices.
  return fResolution;
@@ -286,7 +300,7 @@ void AliCollider::SetRunNumber(Int_t run)
  fRunnum=run;
 }
 ///////////////////////////////////////////////////////////////////////////
-Int_t AliCollider::GetRunNumber()
+Int_t AliCollider::GetRunNumber() const
 {
 // Provide the user defined run number.
  return fRunnum;
@@ -299,24 +313,82 @@ void AliCollider::SetPrintFreq(Int_t n)
  fPrintfreq=n;
 }
 ///////////////////////////////////////////////////////////////////////////
-Int_t AliCollider::GetPrintFreq()
+Int_t AliCollider::GetPrintFreq() const
 {
 // Provide the user selected print frequency.
  return fPrintfreq;
 }
 ///////////////////////////////////////////////////////////////////////////
+void AliCollider::SetUserControl(Int_t flag)
+{
+// Set the user control flag w.r.t. disabling automatic optimisation
+// of some Pythia default MC parameters for soft interactions in view of
+// nucleus-nucleus collisions and astrophysical processes.
+// Flag = 0 : Limited user control (automatic optimisation enabled)
+//        1 : Full user control (automatic optimisation disabled)
+// By default the user control is set to 0 (i.e. automatic optimisation).
+// See the Init() memberfunctions for further details w.r.t. the optimisations.
+ fUserctrl=flag;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliCollider::GetUserControl() const
+{
+// Provide the value of the user control flag.
+ return fUserctrl;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliCollider::SetElastic(Int_t flag)
+{
+// Set the flag w.r.t. inclusion of elastic and diffractive processes.
+// By default these processes are not included.
+// Flag = 0 : Do not include elastic and diffractive processes
+//        1 : Elastic and diffractive processes will be included
+ fElastic=flag;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliCollider::GetElastic() const
+{
+// Provide the value of the control flag for elastic and diffractive processes.
+ return fElastic;
+}
+///////////////////////////////////////////////////////////////////////////
 void AliCollider::Init(char* frame,char* beam,char* target,Float_t win)
 {
 // Initialisation of the underlying Pythia generator package.
+// The event number is reset to 0.
 // This routine just invokes TPythia6::Initialize(...) and the arguments
 // have the corresponding meaning.
-// The event number is reset to 0.
+// Some Pythia default MC parameters are automatically modified to provide
+// more suitable running conditions for soft processes in view of
+// astrophysical processes.
+// The optimisations consist of : 
+// * Usage of real photons for photon beams of targets
+// * Minimum CMS energy of 3 GeV for the event
+// * Activation of the default K factor values
+//   with separate settings for ordinary and color annihilation graphs.
+// The user may initialise the generator with all the default Pythia
+// parameters and obtain full user control to modify the settings by means
+// of invoking the SetUserControl memberfunction before this initialisation.
+// Note that the inclusion of elastic and diffractive processes is controlled
+// by invokation of the SetElastic memberfunction before this initialisation,
+// irrespective of the UserControl selection.
+
+ if (!fUserctrl) // Optimisation of some MC parameters
+ {
+  SetMSTP(14,10); // Real photons for photon beams or targets
+  SetPARP(2,3.);  // Minimum CMS energy for the event
+  SetMSTP(33,2);  // Activate K factor. Separate for ordinary and color annih. graphs
+ }
+
+ if (fElastic) SetMSEL(2); // Include low-Pt, elastic and diffractive events
+
  fEventnum=0;
  fNucl=0;
  fFrame=frame;
  fWin=win;
  Initialize(frame,beam,target,win);
 
+ cout << endl;
  cout << " *AliCollider::Init* Standard Pythia initialisation." << endl;
  cout << " Beam particle : " << beam << " Target particle : " << target
       << " Frame = " << frame << " Energy = " << win
@@ -327,13 +399,35 @@ void AliCollider::Init(char* frame,Int_t zp,Int_t ap,Int_t zt,Int_t at,Float_t w
 {
 // Initialisation of the underlying Pythia generator package for the generation
 // of nucleus-nucleus interactions.
+// The event number is reset to 0.
 // In addition to the Pythia standard arguments 'frame' and 'win', the user
 // can specify here (Z,A) values of the projectile and target nuclei.
 //
 // Note : The 'win' value denotes either the cms energy per nucleon-nucleon collision
 //        (i.e. frame="cms") or the momentum per nucleon in all other cases.
 //
-// The event number is reset to 0.
+// Some Pythia default MC parameters are automatically modified to provide
+// more suitable running conditions for soft processes in view of
+// nucleus-nucleus interactions and astrophysical processes.
+// The optimisations consist of : 
+// * Minimum CMS energy of 3 GeV for the event
+// * Activation of the default K factor values
+//   with separate settings for ordinary and color annihilation graphs.
+// The user may initialise the generator with all the default Pythia
+// parameters and obtain full user control to modify the settings by means
+// of invoking the SetUserControl memberfunction before this initialisation.
+// Note that the inclusion of elastic and diffractive processes is controlled
+// by invokation of the SetElastic memberfunction before this initialisation,
+// irrespective of the UserControl selection.
+
+ if (!fUserctrl) // Optimisation of some MC parameters
+ {
+  SetPARP(2,3.);  // Minimum CMS energy for the event
+  SetMSTP(33,2);  // Activate K factor. Separate for ordinary and color annih. graphs
+ }
+
+ if (fElastic) SetMSEL(2); // Include low-Pt, elastic and diffractive events
+
  fEventnum=0;
  fNucl=1;
  fFrame=frame;
@@ -349,6 +443,7 @@ void AliCollider::Init(char* frame,Int_t zp,Int_t ap,Int_t zt,Int_t at,Float_t w
 
  if (ap<1 || at<1 || zp>ap || zt>at)
  {
+  cout << endl;
   cout << " *AliCollider::Init* Invalid input value(s). Zproj = " << zp
        << " Aproj = " << ap << " Ztarg = " << zt << " Atarg = " << at << endl;
   return;
@@ -359,6 +454,7 @@ void AliCollider::Init(char* frame,Int_t zp,Int_t ap,Int_t zt,Int_t at,Float_t w
  fZtarg=zt;
  fAtarg=at;
 
+ cout << endl;
  cout << " *AliCollider::Init* Nucleus-Nucleus generator initialisation." << endl;
  cout << " Zproj = " << zp << " Aproj = " << ap << " Ztarg = " << zt << " Atarg = " << at
       << " Frame = " << frame << " Energy = " << win
@@ -573,7 +669,7 @@ void AliCollider::MakeEvent(Int_t npt,Int_t mlist,Int_t medit)
 
  Int_t kf=0;
  Float_t charge=0,mass=0;
char* name="";
TString name;
 
  Int_t ntypes=4;
 
@@ -651,8 +747,8 @@ void AliCollider::MakeEvent(Int_t npt,Int_t mlist,Int_t medit)
    {
     kf=GetK(jpart,2);
     charge=Pychge(kf)/3.;
-    Pyname(kf,name);
     mass=GetP(jpart,5);
+    name=GetPyname(kf);
 
     // 3-momentum in GeV/c
     v[0]=GetP(jpart,1);
@@ -671,7 +767,7 @@ void AliCollider::MakeEvent(Int_t npt,Int_t mlist,Int_t medit)
     t.Reset();
     t.SetId(ntk);
     t.SetParticleCode(kf);
-    t.SetName(name);
+    t.SetName(name.Data());
     t.SetCharge(charge);
     t.SetMass(mass);
     t.Set3Momentum(p);
@@ -750,8 +846,6 @@ void AliCollider::MakeEvent(Int_t npt,Int_t mlist,Int_t medit)
  // Include the spectator tracks in the event structure.
  if (fNucl && specmode)
  {
-  Float_t pmass=0.938272;
-  Float_t nmass=0.93956533;
   v[0]=0;
   v[1]=0;
   v[2]=0;
@@ -772,15 +866,15 @@ void AliCollider::MakeEvent(Int_t npt,Int_t mlist,Int_t medit)
   {
    kf=2212; // Projectile spectator protons
    charge=Pychge(kf)/3.;
-   mass=pmass;
-   Pyname(kf,name);
+   mass=GetPMAS(Pycomp(kf),1);
+   name=GetPyname(kf);
    for (Int_t iprojp=1; iprojp<=zp; iprojp++)
    {
     nspec++;
     t.Reset();
     t.SetId(-nspec);
     t.SetParticleCode(kf);
-    t.SetName(name);
+    t.SetName(name.Data());
     t.SetTitle("Projectile spectator proton");
     t.SetCharge(charge);
     t.SetMass(mass);
@@ -792,15 +886,15 @@ void AliCollider::MakeEvent(Int_t npt,Int_t mlist,Int_t medit)
 
    kf=2112; // Projectile spectator neutrons
    charge=Pychge(kf)/3.;
-   mass=nmass;
-   Pyname(kf,name);
+   mass=GetPMAS(Pycomp(kf),1);
+   name=GetPyname(kf);
    for (Int_t iprojn=1; iprojn<=(ap-zp); iprojn++)
    {
     nspec++;
     t.Reset();
     t.SetId(-nspec);
     t.SetParticleCode(kf);
-    t.SetName(name);
+    t.SetName(name.Data());
     t.SetTitle("Projectile spectator neutron");
     t.SetCharge(charge);
     t.SetMass(mass);
@@ -815,15 +909,15 @@ void AliCollider::MakeEvent(Int_t npt,Int_t mlist,Int_t medit)
   {
    kf=2212; // Target spectator protons
    charge=Pychge(kf)/3.;
-   mass=pmass;
-   Pyname(kf,name);
+   mass=GetPMAS(Pycomp(kf),1);
+   name=GetPyname(kf);
    for (Int_t itargp=1; itargp<=zt; itargp++)
    {
     nspec++;
     t.Reset();
     t.SetId(-nspec);
     t.SetParticleCode(kf);
-    t.SetName(name);
+    t.SetName(name.Data());
     t.SetTitle("Target spectator proton");
     t.SetCharge(charge);
     t.SetMass(mass);
@@ -835,15 +929,15 @@ void AliCollider::MakeEvent(Int_t npt,Int_t mlist,Int_t medit)
 
    kf=2112; // Target spectator neutrons
    charge=Pychge(kf)/3.;
-   mass=nmass;
-   Pyname(kf,name);
+   mass=GetPMAS(Pycomp(kf),1);
+   name=GetPyname(kf);
    for (Int_t itargn=1; itargn<=(at-zt); itargn++)
    {
     nspec++;
     t.Reset();
     t.SetId(-nspec);
     t.SetParticleCode(kf);
-    t.SetName(name);
+    t.SetName(name.Data());
     t.SetTitle("Target spectator neutron");
     t.SetCharge(charge);
     t.SetMass(mass);
@@ -869,12 +963,20 @@ void AliCollider::MakeEvent(Int_t npt,Int_t mlist,Int_t medit)
  }
 }
 
- if (mlist && !(fEventnum%fPrintfreq)) cout << endl; // Create empty output line after the event
+ if (!(fEventnum%fPrintfreq) && (mlist || fEvent))
+ {
+  if (fEvent)
+  {
+   cout << " Number of tracks in the event structure : "
+        << fEvent->GetNtracks() << endl;
+  }
+  cout << endl; // Create empty output line after the event
+ }
 
  if (fOutTree && fSelect) fOutTree->Fill();
 }
 ///////////////////////////////////////////////////////////////////////////
-AliEvent* AliCollider::GetEvent(Int_t select)
+AliEvent* AliCollider::GetEvent(Int_t select) const
 {
 // Provide pointer to the generated event structure.
 //
@@ -1009,7 +1111,7 @@ void AliCollider::SelectEvent(Int_t id)
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-Int_t AliCollider::GetSelectionFlag()
+Int_t AliCollider::GetSelectionFlag() const
 {
 // Return the value of the selection flag for the total event.
 // When the event passed the selection criteria as specified via
@@ -1062,9 +1164,30 @@ void AliCollider::SetSpectatorPmin(Float_t pmin)
  fSpecpmin=pmin;
 }
 ///////////////////////////////////////////////////////////////////////////
-Float_t AliCollider::GetSpectatorPmin()
+Float_t AliCollider::GetSpectatorPmin() const
 {
 // Provide the minimal spectator momentum in GeV/c.
  return fSpecpmin;
 }
 ///////////////////////////////////////////////////////////////////////////
+TString AliCollider::GetPyname(Int_t kf)
+{
+// Provide the correctly truncated Pythia particle name for PGD code kf
+//
+// The TPythia6::Pyname returned name is copied into a TString and truncated
+// at the first blank to prevent funny trailing characters due to incorrect
+// stripping of empty characters in TPythia6::Pyname.
+// The truncation at the first blank is allowed due to the Pythia convention
+// that particle names never contain blanks.
+ char name[16];
+ TString sname;
+ Pyname(kf,name);
+ sname=name[0];
+ for (Int_t i=1; i<16; i++)
+ {
+  if (name[i]==' ') break;
+  sname=sname+name[i];
+ }
+ return sname;
+}
+///////////////////////////////////////////////////////////////////////////