]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - THijing/THijing.cxx
Adding macros to create Calibration objects
[u/mrichter/AliRoot.git] / THijing / THijing.cxx
index 18c57ee447ac827b55175ad971dd6ee0faf3abff..0ba5b14b2499bdcf21e603176043199b6e961527 100644 (file)
@@ -1,3 +1,20 @@
+/**************************************************************************
+ * 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: THijing.cxx 64005 2013-08-28 12:23:17Z hristov $ */
+
 ////////////////////////////////////////////////////////////////////////////////
 //                                                                            //
 // THijing                                                                    //
 //****************************************************************************//
 
 
-#include "THijing.h"
+#include <TClonesArray.h>
+#include <TObjArray.h>
+#include <TParticle.h>
+#include <TROOT.h>
+
 #include "Hcommon.h"
-#include "TParticle.h"
-#include "TROOT.h"
+#include "THijing.h"
 
 #ifndef WIN32
 # define hijset hijset_
 # define profile profile_
 # define rluget_hijing rluget_hijing_
 # define rluset_hijing rluset_hijing_
+# define lulist_hijing lulist_hijing_
+# define luupda_hijing luupda_hijing_
+# define opendecaytable_hijing opendecaytable_hijing_
+# define closedecaytable_hijing closedecaytable_hijing_
 # define type_of_call
 #else
 # define hijset HIJSET
 # define profile PROFILE
 # define rluget_hijing RLUGET_HIJING
 # define rluset_hijing RLUSET_HIJING
+# define lulist_hijing LULIST_HIJING
+# define luupda_hijing LUUPDA_HIJING
+# define opendecaytable_hijing OPENDECAYTABLE_HIJING
+# define closedecaytable_hijing CLOSEDECAYTABLE_HIJING
 # define type_of_call _stdcall
 #endif
 
@@ -57,6 +85,12 @@ extern "C" void type_of_call hijing(const char *, Float_t  &,
 extern "C" void type_of_call rluget_hijing(Int_t & lfn, Int_t & move);
 
 extern "C" void type_of_call rluset_hijing(Int_t & lfn, Int_t & move);
+extern "C" void type_of_call lulist_hijing(Int_t &);
+extern "C" void type_of_call luupda_hijing(Int_t &, Int_t &);
+extern "C" void type_of_call 
+          opendecaytable_hijing(Int_t&);
+extern "C" void type_of_call 
+          closedecaytable_hijing(Int_t&);
 
 #else
 #endif
@@ -65,30 +99,50 @@ extern "C" void type_of_call rluset_hijing(Int_t & lfn, Int_t & move);
 
 ClassImp(THijing)
 
-THijing::THijing() : TGenerator("Hijing","Hijing")
+
+THijing::THijing(): 
+    TGenerator("Hijing","Hijing"),
+    fEfrm(5500.),
+    fFrame("CMS"),
+    fProj("A"),
+    fTarg("A"),
+    fIap(208),
+    fIzp(82),
+    fIat(208),
+    fIzt(82),
+    fBmin(0.),
+    fBmax(5.)
 {
 // Default constructor 
 }
 
 //______________________________________________________________________________
 THijing::THijing(Float_t efrm, const char *frame="CMS", 
-       const char *proj="A", const char *targ="A", Int_t iap=207, 
-       Int_t izp=82, Int_t iat=207, Int_t izt=82, Float_t bmin=0, 
-       Float_t bmax=20) : TGenerator("Hijing","Hijing")
+                const char *proj="A", const char *targ="A", 
+                Int_t iap=207, Int_t izp=82, Int_t iat=207, Int_t izt=82,
+                Float_t bmin=0, Float_t bmax=20): 
+    TGenerator("Hijing","Hijing"),
+    fEfrm(efrm),
+    fFrame(frame),
+    fProj(proj),
+    fTarg(targ),
+    fIap(iap),
+    fIzp(izp),
+    fIat(iat),
+    fIzt(izt),
+    fBmin(bmin),
+    fBmax(bmax)
 {
 // THijing constructor: 
 // Note that there may be only one functional THijing object
 // at a time, so it's not use to create more than one instance of it.
-      fEfrm=efrm;
-      fFrame=frame;
-      fProj=proj;
-      fTarg=targ;
-      fIap=iap;
-      fIzp=izp;
-      fIat=iat;
-      fIzt=izt;
-      fBmin=bmin;
-      fBmax=bmax;
+//  
+// Read decaytable
+  Int_t lun = 15;
+  opendecaytable_hijing(lun);
+  Luupda(2,lun);
+  closedecaytable_hijing(lun);
+  
 }
 
 //______________________________________________________________________________
@@ -98,6 +152,69 @@ THijing::~THijing()
 }
 
 
+TObjArray* THijing::ImportParticles(Option_t *option)
+{
+//
+//  Default primary creation method. It reads the /HEPEVT/ common block which
+//  has been filled by the GenerateEvent method. If the event generator does
+//  not use the HEPEVT common block, This routine has to be overloaded by
+//  the subclasses.
+//  The function loops on the generated particles and store them in
+//  the TClonesArray pointed by the argument particles.
+//  The default action is to store only the stable particles (ISTHEP = 1)
+//  This can be demanded explicitly by setting the option = "Final"
+//  If the option = "All", all the particles are stored.
+//
+    fParticles->Clear();
+    Int_t numpart = HIMAIN1.natt;
+    printf("\n THijing: HIJING stack contains %d particles.", numpart);
+    printf("\n THijing: Total energy:         %f           ", HIMAIN1.eatt);
+    printf("\n THijing: Number of hard scatterings: %d     ", HIMAIN1.jatt);
+    Int_t nump = 0;
+    if (!strcmp(option,"") || !strcmp(option,"Final")) {
+       for (Int_t i = 0; i < numpart; i++) {
+         
+           if (HIMAIN2.katt[3][i] == 1) {
+//
+//  Use the common block values for the TParticle constructor
+//
+               nump++;
+               TParticle* p = new TParticle(
+                   HIMAIN2.katt[0][i], HIMAIN2.katt[3][i] ,
+                   -1, -1, -1, -1,
+                   HIMAIN2.patt[0][i], HIMAIN2.patt[1][i], HIMAIN2.patt[2][i], HIMAIN2.patt[3][i] ,
+                   HIMAIN2.vatt[0][i], HIMAIN2.vatt[1][i], HIMAIN2.vatt[2][i], HIMAIN2.vatt[3][i] 
+                 );
+               p->SetUniqueID(HIMAIN2.katt[1][i]);
+               fParticles->Add(p);
+           }
+       }
+    }
+    else if (!strcmp(option,"All")) {
+       nump = numpart; 
+       for (Int_t i = 0; i < numpart; i++) {
+           
+           Int_t iParent = HIMAIN2.katt[2][i]-1;
+           
+           if (iParent >= 0) {
+               TParticle *mother = (TParticle*) (fParticles->UncheckedAt(iParent));       
+               mother->SetLastDaughter(i);
+               if (mother->GetFirstDaughter()==-1)
+                   mother->SetFirstDaughter(i);
+           }
+           
+           TParticle* p = new TParticle(
+               HIMAIN2.katt[0][i], HIMAIN2.katt[3][i], iParent,
+               -1, -1, -1,
+               HIMAIN2.patt[0][i], HIMAIN2.patt[1][i], HIMAIN2.patt[2][i], HIMAIN2.patt[3][i] ,
+               HIMAIN2.vatt[0][i], HIMAIN2.vatt[1][i], HIMAIN2.vatt[2][i], HIMAIN2.vatt[3][i]
+               );
+           p->SetUniqueID(HIMAIN2.katt[1][i]);
+           fParticles->Add(p);
+       }
+    }
+    return fParticles;
+}
 
 Int_t THijing::ImportParticles(TClonesArray *particles, Option_t *option)
 {
@@ -130,7 +247,7 @@ Int_t THijing::ImportParticles(TClonesArray *particles, Option_t *option)
            nump++;
            new(particlesR[i]) TParticle(
                  HIMAIN2.katt[0][i] ,
-                 HIMAIN2.katt[1][i] ,
+                 HIMAIN2.katt[3][i] ,
                  -1 ,
                  -1,
                  -1,
@@ -146,6 +263,7 @@ Int_t THijing::ImportParticles(TClonesArray *particles, Option_t *option)
                  HIMAIN2.vatt[2][i] ,
                  HIMAIN2.vatt[3][i] 
                  );
+           particlesR[i]->SetUniqueID(HIMAIN2.katt[1][i]);
          }
       }
   }
@@ -164,7 +282,7 @@ Int_t THijing::ImportParticles(TClonesArray *particles, Option_t *option)
 
          new(particlesR[i]) TParticle(
              HIMAIN2.katt[0][i] ,
-             HIMAIN2.katt[1][i] ,
+             HIMAIN2.katt[3][i] ,
              iParent,
              -1,
              -1,
@@ -180,6 +298,7 @@ Int_t THijing::ImportParticles(TClonesArray *particles, Option_t *option)
              HIMAIN2.vatt[2][i] ,
              HIMAIN2.vatt[3][i]
              );
+         particlesR[i]->SetUniqueID(HIMAIN2.katt[1][i]);
       }
   }
   return nump;
@@ -405,6 +524,13 @@ Int_t  THijing::GetNATT() const
 
 }
 
+Int_t  THijing::GetNPART() const
+{
+// Get true number of participants
+   return HIMAIN1.npart;
+
+}
+
 //______________________________________________________________________________
 Float_t  THijing::GetEATT() const
 {
@@ -448,6 +574,8 @@ Int_t  THijing::GetN0() const
    return HIMAIN1.n0;
 
 }
+
+
 //______________________________________________________________________________
 Int_t  THijing::GetN01() const
 {
@@ -484,6 +612,7 @@ Float_t  THijing::GetBB() const
 
 }
 
+
 //====================== access to common HIMAIN2 ===============================
 
 //______________________________________________________________________________
@@ -1031,9 +1160,9 @@ void THijing::SetPARJ(Int_t key, Float_t parm)
     if ( key < 1 || key > 200) {
        printf("ERROR in THijing::SetPARJ(key,parm):\n");
        printf("      key=%i is out of range [1..200]\n",key);
+    } else {
+      LUDAT1_HIJING.parj[key-1] = parm;
     }
-    
-    LUDAT1_HIJING.parj[key-1] = parm;
 }
 
 
@@ -1043,12 +1172,71 @@ void THijing::SetMSTJ(Int_t key, Int_t parm)
     if ( key < 1 || key > 200) {
        printf("ERROR in THijing::SetMSTJ(key,parm):\n");
        printf("      key=%i is out of range [1..200]\n",key);
+    } else {
+      LUDAT1_HIJING.mstj[key-1] = parm;
     }
-    
-    LUDAT1_HIJING.mstj[key-1] = parm;
 }
 
+void  THijing::SetMDCY(Int_t key1, Int_t key2, Int_t   parm)
+{
+  // Set value of array MDCY
+  if ( key1 < 1 || key1 > 500) {
+    printf("ERROR in THijing::SetMDCY(key1, key2, parm):\n");
+    printf("      key1=%i is out of range [1..500]\n", key1);
+  } else if ( key2 < 1 || key2 > 3) {
+    printf("ERROR in THijing::SetMDCY(key1, key2, parm):\n");
+    printf("      key2=%i is out of range [1..3]\n", key2);
+  } else {
+    LUDAT3_HIJING.mdcy[key2-1][key1-1] = parm;
+  }
+  
+}
+
+void  THijing::SetMDME(Int_t key1, Int_t key2, Int_t   parm)
+{
+  // Set value of array MDME
+  if ( key1 < 1 || key1 > 2000) {
+    printf("ERROR in THijing::SetMDME(key1, key2, parm):\n");
+    printf("      key1=%i is out of range [1..2000]\n", key1);
+  } else if ( key2 < 1 || key2 > 2) {
+    printf("ERROR in THijing::SetMDME(key1, key2, parm):\n");
+    printf("      key2=%i is out of range [1..3]\n", key2);
+  } else {
+    LUDAT3_HIJING.mdme[key2-1][key1-1] = parm;
+  }
+  
+}
+
+void  THijing::SetBRAT(Int_t key, Float_t   parm)
+{
+  // Set value of array MDME
+  if ( key < 1 || key > 2000) {
+    printf("ERROR in THijing::SetBRAT(key, parm):\n");
+    printf("      key=%i is out of range [1..2000]\n", key);
+  } else {
+    LUDAT3_HIJING.brat[key-1] = parm;
+  }
+  
+}
+
+Int_t THijing::GetMDCY(Int_t key1, Int_t key2) 
+{
+  // Get value of array MDCY
+
+  if ( key1 < 1 || key1 > 500) {
+    printf("ERROR in THijing::GetMDCY(key1, key2, parm):\n");
+    printf("      key1=%i is out of range [1..200]\n", key1);
+    return -1;
+  } else if ( key2 < 1 || key2 > 3) {
+    printf("ERROR in THijing::GetMDCY(key1, key2, parm):\n");
+    printf("      key2=%i is out of range [1..200]\n", key2);
+    return -1;
+  } else {
+    return (LUDAT3_HIJING.mdcy[key2-1][key1-1]);
+  }
+
 
+}
 //====================== access to Hijing subroutines =========================
 
 
@@ -1155,3 +1343,14 @@ void  THijing::Rluset(Int_t lfn, Int_t move)
   rluset_hijing(lfn, move);
 }
 
+void  THijing::Pylist(Int_t flag)
+{
+// call lulist
+  lulist_hijing(flag);
+}
+
+void  THijing::Luupda(Int_t mupda, Int_t lfn)
+{
+// call luupda
+  luupda_hijing(mupda, lfn);
+}