]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RALICE/AliCollider.cxx
bug fixed while filling the object AliPMDcluster
[u/mrichter/AliRoot.git] / RALICE / AliCollider.cxx
index 6882859ed513c1814ce4430eaa287c4ee50f002b..ba1d16c6bc728d9759013f0083efdaf0543c06e5 100644 (file)
@@ -1,4 +1,19 @@
-// $Id: AliCollider.cxx,v 1.1 2002/11/27 21:25:52 nick Exp $
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+// $Id: AliCollider.cxx,v 1.5 2003/02/03 13:19:44 nick Exp $
 
 ///////////////////////////////////////////////////////////////////////////
 // Class AliCollider
@@ -81,7 +96,7 @@
 //
 //   AliEvent* evt=gen->GetEvent();
 //  
-//   evt->Info();
+//   evt->Data();
 //  }
 //
 //  gen->EndRun();
 //
 //
 //--- Author: Nick van Eijndhoven 22-nov-2002 Utrecht University
-//- Modified: NvE $Date: 2002/11/27 21:25:52 $ Utrecht University
+//- Modified: NvE $Date: 2003/02/03 13:19:44 $ Utrecht University
 ///////////////////////////////////////////////////////////////////////////
 
 #include "AliCollider.h"
+#include "Riostream.h"
  
 ClassImp(AliCollider) // Class implementation to enable ROOT I/O
  
-AliCollider::AliCollider()
+AliCollider::AliCollider() : TPythia6()
 {
 // Default constructor.
 // All variables initialised to default values.
@@ -282,6 +298,11 @@ void AliCollider::Init(char* frame,char* beam,char* target,Float_t win)
  fFrame=frame;
  fWin=win;
  Initialize(frame,beam,target,win);
+
+ cout << " *AliCollider::Init* Standard Pythia initialisation." << endl;
+ cout << " Beam particle : " << beam << " Target particle : " << target
+      << " Frame = " << frame << " Energy = " << win
+      << endl;
 }
 ///////////////////////////////////////////////////////////////////////////
 void AliCollider::Init(char* frame,Int_t zp,Int_t ap,Int_t zt,Int_t at,Float_t win)
@@ -289,8 +310,11 @@ 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.
 // In addition to the Pythia standard arguments 'frame' and 'win', the user
-// can specify here (Z,A) values of the projectile and target nuclei and the number
-// 'npart' of the participant nucleons for this collision.
+// 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.
  fEventnum=0;
  fNucl=1;
@@ -351,16 +375,29 @@ void AliCollider::MakeEvent(Int_t npt,Int_t mlist,Int_t medit)
 // the number of participant nucleons.
 // In case of a standard Pythia run for 'elementary' particle interactions,
 // the value of npt is totally irrelevant.
+//
+// The argument 'mlist' denotes the list mode used for Pylist().
+// Note : mlist<0 suppresses the invokation of Pylist().
+// By default, no listing is produced (i.e. mlist=-1).
+//
 // The argument 'medit' denotes the edit mode used for Pyedit().
+// Note : medit<0 suppresses the invokation of Pyedit().
 // By default, only 'stable' final particles are kept (i.e. medit=1). 
-// The argument 'mlist' denotes the list mode used for Pylist().
-// By default, no listing is produced (i.e. mlist=0).
+//
+// In the case of a standard Pythia run concerning 'elementary' particle
+// interactions, the projectile and target particle ID's for the created
+// event structure are set to the corresponding Pythia KF codes.
+// All the A and Z values are in that case set to zero.
+// In case of a nucleus-nucleus interaction, the proper A and Z values for 
+// the projectile and target particles are set in the event structure.
+// However, in this case both particle ID's are set to zero.
 
  fEventnum++; 
 
  // Counters for the various (proj,targ) combinations : p+p, n+p, p+n and n+n
  Int_t ncols[4]={0,0,0,0};
 
+ Int_t ncol=1;
  if (fNucl)
  {
   if (npt<1 || npt>(fAproj+fAtarg))
@@ -371,7 +408,7 @@ void AliCollider::MakeEvent(Int_t npt,Int_t mlist,Int_t medit)
   }
 
   // Determine the number of nucleon-nucleon collisions
-  Int_t ncol=npt/2.;
+  ncol=npt/2;
   if (npt%2 && fRan.Uniform()>0.5) ncol+=1;
 
   // Determine the number of the various types of N+N interactions
@@ -442,18 +479,20 @@ void AliCollider::MakeEvent(Int_t npt,Int_t mlist,Int_t medit)
    }
   }
   delete [] rans;
+ }
 
   if (!(fEventnum%fPrintfreq))
   {
    cout << " *AliCollider::MakeEvent* Run : " << fRunnum << " Event : " << fEventnum
         << endl;
-   cout << " npart = " << npt << " ncol = " << ncol 
-        << " ncolpp = " << ncols[0] << " ncolnp = " << ncols[1]
-        << " ncolpn = " << ncols[2] << " ncolnn = " << ncols[3] << endl;
+   if (fNucl)
+   {
+    cout << " npart = " << npt << " ncol = " << ncol 
+         << " ncolpp = " << ncols[0] << " ncolnp = " << ncols[1]
+         << " ncolpn = " << ncols[2] << " ncolnn = " << ncols[3] << endl;
+   }
   }
 
- }
-
  if (!fEvent)
  {
   fEvent=new AliEvent();
@@ -464,26 +503,34 @@ void AliCollider::MakeEvent(Int_t npt,Int_t mlist,Int_t medit)
  fEvent->SetRunNumber(fRunnum);
  fEvent->SetEventNumber(fEventnum);
 
+ AliTrack t;
+ Ali3Vector p;
+ AliPosition r,rx;
+ Float_t v[3];
  AliVertex vert;
+
  if (fVertexmode)
  {
   // Make sure the primary vertex gets correct location and Id=1
+  v[0]=0;
+  v[1]=0;
+  v[2]=0;
+  r.SetPosition(v,"car");
+  v[0]=fResolution;
+  v[1]=fResolution;
+  v[2]=fResolution;
+  r.SetPositionErrors(v,"car");
+
   vert.SetId(1);
   vert.SetTrackCopy(0);
   vert.SetVertexCopy(0);
+  vert.SetPosition(r);
   fEvent->AddVertex(vert,0);
  }
 
- AliTrack t;
- Ali3Vector p;
- AliPosition r,rx;
- Float_t v[3];
-
- Int_t kf=0,kc=0;
+ Int_t kf=0;
  Float_t charge=0,mass=0;
 
- TMCParticle* part=0;
-
  Int_t ntypes=4;
 
  // Singular settings for a normal Pythia elementary particle interation 
@@ -494,6 +541,8 @@ void AliCollider::MakeEvent(Int_t npt,Int_t mlist,Int_t medit)
  }
 
  // Generate all the various collisions
+ Int_t first=1; // Flag to indicate the first collision process
+ Double_t pnucl;
  Int_t npart=0,ntk=0;
  Double_t dist=0;
  for (Int_t itype=0; itype<ntypes; itype++)
@@ -509,37 +558,61 @@ void AliCollider::MakeEvent(Int_t npt,Int_t mlist,Int_t medit)
   {
    GenerateEvent();
 
-   Pyedit(medit); // Define which particles are to be kept
+   if (first) // Store projectile and target information in the event structure
+   {
+    if (fNucl)
+    {
+     v[0]=GetP(1,1);
+     v[1]=GetP(1,2);
+     v[2]=GetP(1,3);
+     pnucl=sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]);
+     fEvent->SetProjectile(fAproj,fZproj,pnucl);
+     v[0]=GetP(2,1);
+     v[1]=GetP(2,2);
+     v[2]=GetP(2,3);
+     pnucl=sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]);
+     fEvent->SetTarget(fAtarg,fZtarg,pnucl);
+    }
+    else
+    {
+     v[0]=GetP(1,1);
+     v[1]=GetP(1,2);
+     v[2]=GetP(1,3);
+     pnucl=sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]);
+     kf=GetK(1,2);
+     fEvent->SetProjectile(0,0,pnucl,kf);
+     v[0]=GetP(2,1);
+     v[1]=GetP(2,2);
+     v[2]=GetP(2,3);
+     pnucl=sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]);
+     kf=GetK(2,2);
+     fEvent->SetTarget(0,0,pnucl,kf);
+    }
+    first=0;
+   }
 
-   if (mlist) Pylist(mlist);
+   if (medit >= 0) Pyedit(medit); // Define which particles are to be kept
 
-   ImportParticles();
-   npart=0;
-   if (fParticles) npart=fParticles->GetEntries();
+   if (mlist >= 0) Pylist(mlist);
 
-   for (Int_t jpart=0; jpart<npart; jpart++)
+   npart=GetN();
+   for (Int_t jpart=1; jpart<=npart; jpart++)
    {
-    part=(TMCParticle*)fParticles->At(jpart);
-    if (!part) continue;
-
-    kf=part->GetKF();
-    kc=Pycomp(kf);
-
-    charge=GetKCHG(kc,1)/3.;
-    if (kf<0) charge*=-1;
-    mass=GetPMAS(kc,1);
+    kf=GetK(jpart,2);
+    charge=Pychge(kf)/3.;
+    mass=GetP(jpart,5);
 
     // 3-momentum in GeV/c
-    v[0]=part->GetPx();
-    v[1]=part->GetPy();
-    v[2]=part->GetPz();
+    v[0]=GetP(jpart,1);
+    v[1]=GetP(jpart,2);
+    v[2]=GetP(jpart,3);
     p.SetVector(v,"car");
 
     // Production location in cm.
-    v[0]=(part->GetVx())/10;
-    v[1]=(part->GetVy())/10;
-    v[2]=(part->GetVz())/10;
-    r.SetVector(v,"car");
+    v[0]=GetV(jpart,1)/10;
+    v[1]=GetV(jpart,2)/10;
+    v[2]=GetV(jpart,3)/10;
+    r.SetPosition(v,"car");
 
     ntk++;
 
@@ -585,6 +658,10 @@ void AliCollider::MakeEvent(Int_t npt,Int_t mlist,Int_t medit)
       AliTrack* tx=fEvent->GetIdTrack(ntk);
       if (tx)
       {
+       v[0]=fResolution;
+       v[1]=fResolution;
+       v[2]=fResolution;
+       r.SetPositionErrors(v,"car");
        vert.Reset();
        vert.SetTrackCopy(0);
        vert.SetVertexCopy(0);
@@ -617,7 +694,7 @@ void AliCollider::MakeEvent(Int_t npt,Int_t mlist,Int_t medit)
   }
  }
 
- if (mlist) cout << endl; // Create empty output line after the event
+ if (mlist && !(fEventnum%fPrintfreq)) cout << endl; // Create empty output line after the event
  if (fOutTree) fOutTree->Fill();
 }
 ///////////////////////////////////////////////////////////////////////////