+/**************************************************************************
+ * 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 //
//****************************************************************************//
-#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_
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;
}
//______________________________________________________________________________
}
+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)
{
nump++;
new(particlesR[i]) TParticle(
HIMAIN2.katt[0][i] ,
- HIMAIN2.katt[1][i] ,
+ HIMAIN2.katt[3][i] ,
-1 ,
-1,
-1,
HIMAIN2.vatt[2][i] ,
HIMAIN2.vatt[3][i]
);
+ particlesR[i]->SetUniqueID(HIMAIN2.katt[1][i]);
}
}
}
new(particlesR[i]) TParticle(
HIMAIN2.katt[0][i] ,
- HIMAIN2.katt[1][i] ,
+ HIMAIN2.katt[3][i] ,
iParent,
-1,
-1,
HIMAIN2.vatt[2][i] ,
HIMAIN2.vatt[3][i]
);
+ particlesR[i]->SetUniqueID(HIMAIN2.katt[1][i]);
}
}
return nump;