Correct mother-daughter relation in particle stack.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 9 Jun 2000 22:22:51 +0000 (22:22 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 9 Jun 2000 22:22:51 +0000 (22:22 +0000)
Include Hijing PROFILE function.

THijing/THijing.cxx

index 1d356ac..6b814b6 100644 (file)
 #ifndef WIN32
 # define hijset hijset_
 # define hijing hijing_
+# define profile profile_
 # define type_of_call
 #else
 # define hijset HIJSET
 # define hijing HIJING
+# define profile PROFILE
 # define type_of_call _stdcall
 #endif
 
@@ -64,9 +66,11 @@ extern "C" void type_of_call hijset(Float_t & , const char *,
                                   Int_t & , Int_t &, Int_t &,
                                   Int_t &, const int, 
                                   const int, const int);
+extern "C" float type_of_call profile(Float_t &);
+
 //extern "C" void type_of_call hijing(const char *frame, float &bmin,
 //                                   float &bmax, Long_t l_frame);
-extern "C" void type_of_call hijing(const char *, Float_t &,
+extern "C" void type_of_call hijing(const char *, Float_t  &,
                                    Float_t &, const int);
 #else
 //extern "C" void type_of_call hijset(float &efrm, const char *frame, 
@@ -79,6 +83,8 @@ extern "C" void type_of_call hijing(const char *, Float_t &,
 //                                float &bmin, float &bmax);
 #endif
 
+
+
 ClassImp(THijing)
 
 // void THijing::Streamer(TBuffer &R__b){}
@@ -228,51 +234,62 @@ Int_t THijing::ImportParticles(TClonesArray *particles, Option_t *option)
   Particles.Clear();
   Int_t numpart = HIMAIN1.natt;
   if (!strcmp(option,"") || !strcmp(option,"Final")) {
-    for (Int_t i = 0; i<=numpart; i++) {
-       if (HIMAIN2.katt[3][i] == 1) {
+      for (Int_t i = 0; i<=numpart; i++) {
+         
+         if (HIMAIN2.katt[3][i] == 1) {
 //
 //  Use the common block values for the TParticle constructor
 //
-         new(Particles[i]) TParticle(
-                             HIMAIN2.katt[0][i] ,
-                             HIMAIN2.katt[1][i] ,
-                             HIMAIN2.katt[2][i] ,
-                             -1,
-                             -1,
-                             -1,
-
-                             HIMAIN2.patt[0][i] ,
-                             HIMAIN2.patt[1][i] ,
-                             HIMAIN2.patt[2][i] ,
-                             HIMAIN2.patt[3][i] ,
-
-                             0,
-                             0,
-                             0,
-                             0);
-       }
-    }
+             new(Particles[i]) TParticle(
+                 HIMAIN2.katt[0][i] ,
+                 HIMAIN2.katt[1][i] ,
+                 HIMAIN2.katt[2][i] ,
+                 -1,
+                 -1,
+                 -1,
+                 
+                 HIMAIN2.patt[0][i] ,
+                 HIMAIN2.patt[1][i] ,
+                 HIMAIN2.patt[2][i] ,
+                 HIMAIN2.patt[3][i] ,
+                 
+                 0,
+                 0,
+                 0,
+                 0);
+         }
+      }
   }
   else if (!strcmp(option,"All")) {
-    for (Int_t i = 0; i<=numpart; i++) {
+      for (Int_t i = 0; i<=numpart; i++) {
+
+         Int_t iParent = HIMAIN2.katt[2][i]-1;
+         
+         if (iParent >= 0) {
+             TParticle *mother = (TParticle*) (Particles.UncheckedAt(iParent));           
+             mother->SetLastDaughter(i);
+             if (mother->GetFirstDaughter()==-1)
+                 mother->SetFirstDaughter(i);
+         }
+
          new(Particles[i]) TParticle(
-                             HIMAIN2.katt[0][i] ,
-                             HIMAIN2.katt[1][i] ,
-                             HIMAIN2.katt[2][i] ,
-                             -1,
-                             -1,
-                             -1,
-
-                             HIMAIN2.patt[0][i] ,
-                             HIMAIN2.patt[1][i] ,
-                             HIMAIN2.patt[2][i] ,
-                             HIMAIN2.patt[3][i] ,
-
-                             0,
-                             0,
-                             0,
-                             0);
-    }
+             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] ,
+             
+             0,
+             0,
+             0,
+             0);
+      }
   }
   return numpart;
 }
@@ -1049,33 +1066,33 @@ void THijing::Initialize()
 // via SetEFRM, SetFRAME, SetPROJ, SetTARG, SetIAP, SetIZP, SetIAT, SetIZT      //
 //////////////////////////////////////////////////////////////////////////////////
 
-   if ( (!strcmp(fFrame.Data(), "CMS"  )) &&
-        (!strcmp(fFrame.Data(), "LAB"  ))){
+   if ( (!strcmp(fFrame.Data(), "CMS     "  )) &&
+        (!strcmp(fFrame.Data(), "LAB     "  ))){
       printf("WARNING! In THijing:Initialize():\n");
       printf(" specified frame=%s is neither CMS or LAB\n",fFrame.Data());
       printf(" resetting to default \"CMS\" .");
       fFrame="CMS";
    }
 
-   if ( (!strcmp(fProj.Data(), "A"     )) &&
-        (!strcmp(fProj.Data(), "P"     )) &&
-        (!strcmp(fProj.Data(), "PBAR"  ))){
+   if ( (!strcmp(fProj.Data(), "A       "     )) &&
+        (!strcmp(fProj.Data(), "P       "     )) &&
+        (!strcmp(fProj.Data(), "PBAR    "  ))){
       printf("WARNING! In THijing:Initialize():\n");
       printf(" specified projectile=%s is neither A, P or PBAR\n",fProj.Data());
       printf(" resetting to default \"A\" .");
       fProj="A";
    }
 
-   if ( (!strcmp(fTarg.Data(), "A"     )) &&
-        (!strcmp(fTarg.Data(), "P"     )) &&
-        (!strcmp(fTarg.Data(), "PBAR"  ))){
+   if ( (!strcmp(fTarg.Data(), "A       "     )) &&
+        (!strcmp(fTarg.Data(), "P       "     )) &&
+        (!strcmp(fTarg.Data(), "PBAR    "  ))){
       printf("WARNING! In THijing:Initialize():\n");
       printf(" specified target=%s is neither A, P or PBAR\n",fTarg.Data());
       printf(" resetting to default \"A\" .");
       fTarg="A";
    }
 
-
+   printf(" %s-%s at %f GeV \n",fProj.Data(),fTarg.Data(),fEfrm);
 
    Hijset(fEfrm,fFrame.Data(),fProj.Data(),fTarg.Data(),fIap,fIzp,fIat,fIzt);
 
@@ -1122,3 +1139,13 @@ void THijing::Hijing(const char *frame, float bmin, float bmax)
   hijing(frame, s1, bmin, bmax);
 #endif
 }
+
+
+Float_t  THijing::Profile(float b)
+{
+// Call HIJING routine PROFILE 
+  return profile(b);
+}
+
+
+