Removing .cvsignore files
[u/mrichter/AliRoot.git] / THerwig / THerwig6.cxx
index 5c8b112..8fc42c9 100644 (file)
@@ -64,60 +64,117 @@ extern "C" {
 }
 
 
-THerwig6::THerwig6() : TGenerator("Herwig6","Herwig6") {
+THerwig6::THerwig6() : TGenerator("Herwig6","Herwig6"),
+  fHepevt((Hepevt_t*) herwig6_common_block_address_((char*)"HEPEVT",6)),
+  fHwbeam((Hwbeam_t*) herwig6_common_block_address_((char*)"HWBEAM",6)),
+  fHwbmch((Hwbmch_t*) herwig6_common_block_address_((char*)"HWBMCH",6)),
+  fHwproc((Hwproc_t*) herwig6_common_block_address_((char*)"HWPROC",6)),
+  fHwpram((Hwpram_t*) herwig6_common_block_address_((char*)"HWPRAM",6)),
+  fHwprch((Hwprch_t*) herwig6_common_block_address_((char*)"HWPRCH",6)),
+  fHwpart((Hwpart_t*) herwig6_common_block_address_((char*)"HWPART",6)),
+  fHwparp((Hwparp_t*) herwig6_common_block_address_((char*)"HWPARP",6)),
+  fHwbosc((Hwbosc_t*) herwig6_common_block_address_((char*)"HWBOSC",6)),
+  fHwparc((Hwparc_t*) herwig6_common_block_address_((char*)"HWPARC",6)),
+  fHwbrch((Hwbrch_t*) herwig6_common_block_address_((char*)"HWBRCH",6)),
+  fHwevnt((Hwevnt_t*) herwig6_common_block_address_((char*)"HWEVNT",6)),
+  fHwhard((Hwhard_t*) herwig6_common_block_address_((char*)"HWHARD",6)),
+  fHwprop((Hwprop_t*) herwig6_common_block_address_((char*)"HWPROP",6)),
+  fHwunam((Hwunam_t*) herwig6_common_block_address_((char*)"HWUNAM",6)),
+  fHwupdt((Hwupdt_t*) herwig6_common_block_address_((char*)"HWUPDT",6)),
+  fHwuwts((Hwuwts_t*) herwig6_common_block_address_((char*)"HWUWTS",6)),
+  fHwuclu((Hwuclu_t*) herwig6_common_block_address_((char*)"HWUCLU",6)),
+  fHwdist((Hwdist_t*) herwig6_common_block_address_((char*)"HWDIST",6)),
+  fHwqdks((Hwqdks_t*) herwig6_common_block_address_((char*)"HWQDKS",6)),
+  fHwusud((Hwusud_t*) herwig6_common_block_address_((char*)"HWUSUD",6)),
+  fHwsusy((Hwsusy_t*) herwig6_common_block_address_((char*)"HWSUSY",6)),
+  fHwrpar((Hwrpar_t*) herwig6_common_block_address_((char*)"HWRPAR",6)),
+  fHwminb((Hwminb_t*) herwig6_common_block_address_((char*)"HWMINB",6)),
+  fHwclus((Hwclus_t*) herwig6_common_block_address_((char*)"HWCLUS",6)),
+  fHwgrav((Hwgrav_t*) herwig6_common_block_address_((char*)"HWGRAV",6)),
+  fHw6202((Hw6202_t*) herwig6_common_block_address_((char*)"HW6202",6)),
+  fHw6203((Hw6203_t*) herwig6_common_block_address_((char*)"HW6203",6)),
+  fHw6300((Hw6300_t*) herwig6_common_block_address_((char*)"HW6300",6)),
+  fHwpmrs((Hwpmrs_t*) herwig6_common_block_address_((char*)"HWPMRS",6)),
+  fHwcirc((Hwcirc_t*) herwig6_common_block_address_((char*)"HWCIRC",6)),
+  fHwdspb((Hwdspb_t*) herwig6_common_block_address_((char*)"HWDSPB",6)),
+  fHwdsp2((Hwdsp2_t*) herwig6_common_block_address_((char*)"HWDSP2",6)),
+  fHwdsp3((Hwdsp3_t*) herwig6_common_block_address_((char*)"HWDSP3",6)),
+  fHwdsp4((Hwdsp4_t*) herwig6_common_block_address_((char*)"HWDSP4",6)),
+  fHwdspn((Hwdspn_t*) herwig6_common_block_address_((char*)"HWDSPN",6)),
+  fHwspin((Hwspin_t*) herwig6_common_block_address_((char*)"HWSPIN",6)),
+  fHwstau((Hwstau_t*) herwig6_common_block_address_((char*)"HWSTAU",6)),
+  fHwgupr((Hwgupr_t*) herwig6_common_block_address_((char*)"HWGUPR",6)),
+  fHw6500((Hw6500_t*) herwig6_common_block_address_((char*)"HW6500",6)),
+  fHw6504((Hw6504_t*) herwig6_common_block_address_((char*)"HW6504",6)),
+  fHw6506((Hw6506_t*) herwig6_common_block_address_((char*)"HW6506",6))
+{
 
 // THerwig6 constructor: creates a TClonesArray in which it will store all
 // particles. Note that there may be only one functional THerwig6 object
 // at a time, so it's not use to create more than one instance of it.
 
   delete fParticles; // was allocated as TObjArray in TGenerator
-
   fParticles = new TClonesArray("TParticle",50);
 
   // initialize common-blocks
-  fHepevt = (Hepevt_t*) herwig6_common_block_address_((char*)"HEPEVT",6);
-  fHwbeam = (Hwbeam_t*) herwig6_common_block_address_((char*)"HWBEAM",6);
-  fHwbmch = (Hwbmch_t*) herwig6_common_block_address_((char*)"HWBMCH",6);
-  fHwproc = (Hwproc_t*) herwig6_common_block_address_((char*)"HWPROC",6);
-  fHwpram = (Hwpram_t*) herwig6_common_block_address_((char*)"HWPRAM",6);
-  fHwprch = (Hwprch_t*) herwig6_common_block_address_((char*)"HWPRCH",6);
-  fHwpart = (Hwpart_t*) herwig6_common_block_address_((char*)"HWPART",6);
-  fHwparp = (Hwparp_t*) herwig6_common_block_address_((char*)"HWPARP",6);
-  fHwbosc = (Hwbosc_t*) herwig6_common_block_address_((char*)"HWBOSC",6);
-  fHwparc = (Hwparc_t*) herwig6_common_block_address_((char*)"HWPARC",6);
-  fHwbrch = (Hwbrch_t*) herwig6_common_block_address_((char*)"HWBRCH",6);
-  fHwevnt = (Hwevnt_t*) herwig6_common_block_address_((char*)"HWEVNT",6);
-  fHwhard = (Hwhard_t*) herwig6_common_block_address_((char*)"HWHARD",6);
-  fHwprop = (Hwprop_t*) herwig6_common_block_address_((char*)"HWPROP",6);
-  fHwunam = (Hwunam_t*) herwig6_common_block_address_((char*)"HWUNAM",6);
-  fHwupdt = (Hwupdt_t*) herwig6_common_block_address_((char*)"HWUPDT",6);
-  fHwuwts = (Hwuwts_t*) herwig6_common_block_address_((char*)"HWUWTS",6);
-  fHwuclu = (Hwuclu_t*) herwig6_common_block_address_((char*)"HWUCLU",6);
-  fHwdist = (Hwdist_t*) herwig6_common_block_address_((char*)"HWDIST",6);
-  fHwqdks = (Hwqdks_t*) herwig6_common_block_address_((char*)"HWQDKS",6);
-  fHwusud = (Hwusud_t*) herwig6_common_block_address_((char*)"HWUSUD",6);
-  fHwsusy = (Hwsusy_t*) herwig6_common_block_address_((char*)"HWSUSY",6);
-  fHwrpar = (Hwrpar_t*) herwig6_common_block_address_((char*)"HWRPAR",6);
-  fHwminb = (Hwminb_t*) herwig6_common_block_address_((char*)"HWMINB",6);
-  fHwclus = (Hwclus_t*) herwig6_common_block_address_((char*)"HWCLUS",6);
  }
 
+THerwig6::THerwig6(const THerwig6 & source): TGenerator(source),
+  fHepevt((Hepevt_t*) herwig6_common_block_address_((char*)"HEPEVT",6)),
+  fHwbeam((Hwbeam_t*) herwig6_common_block_address_((char*)"HWBEAM",6)),
+  fHwbmch((Hwbmch_t*) herwig6_common_block_address_((char*)"HWBMCH",6)),
+  fHwproc((Hwproc_t*) herwig6_common_block_address_((char*)"HWPROC",6)),
+  fHwpram((Hwpram_t*) herwig6_common_block_address_((char*)"HWPRAM",6)),
+  fHwprch((Hwprch_t*) herwig6_common_block_address_((char*)"HWPRCH",6)),
+  fHwpart((Hwpart_t*) herwig6_common_block_address_((char*)"HWPART",6)),
+  fHwparp((Hwparp_t*) herwig6_common_block_address_((char*)"HWPARP",6)),
+  fHwbosc((Hwbosc_t*) herwig6_common_block_address_((char*)"HWBOSC",6)),
+  fHwparc((Hwparc_t*) herwig6_common_block_address_((char*)"HWPARC",6)),
+  fHwbrch((Hwbrch_t*) herwig6_common_block_address_((char*)"HWBRCH",6)),
+  fHwevnt((Hwevnt_t*) herwig6_common_block_address_((char*)"HWEVNT",6)),
+  fHwhard((Hwhard_t*) herwig6_common_block_address_((char*)"HWHARD",6)),
+  fHwprop((Hwprop_t*) herwig6_common_block_address_((char*)"HWPROP",6)),
+  fHwunam((Hwunam_t*) herwig6_common_block_address_((char*)"HWUNAM",6)),
+  fHwupdt((Hwupdt_t*) herwig6_common_block_address_((char*)"HWUPDT",6)),
+  fHwuwts((Hwuwts_t*) herwig6_common_block_address_((char*)"HWUWTS",6)),
+  fHwuclu((Hwuclu_t*) herwig6_common_block_address_((char*)"HWUCLU",6)),
+  fHwdist((Hwdist_t*) herwig6_common_block_address_((char*)"HWDIST",6)),
+  fHwqdks((Hwqdks_t*) herwig6_common_block_address_((char*)"HWQDKS",6)),
+  fHwusud((Hwusud_t*) herwig6_common_block_address_((char*)"HWUSUD",6)),
+  fHwsusy((Hwsusy_t*) herwig6_common_block_address_((char*)"HWSUSY",6)),
+  fHwrpar((Hwrpar_t*) herwig6_common_block_address_((char*)"HWRPAR",6)),
+  fHwminb((Hwminb_t*) herwig6_common_block_address_((char*)"HWMINB",6)),
+  fHwclus((Hwclus_t*) herwig6_common_block_address_((char*)"HWCLUS",6)),
+  fHwgrav((Hwgrav_t*) herwig6_common_block_address_((char*)"HWGRAV",6)),
+  fHw6202((Hw6202_t*) herwig6_common_block_address_((char*)"HW6202",6)),
+  fHw6203((Hw6203_t*) herwig6_common_block_address_((char*)"HW6203",6)),
+  fHw6300((Hw6300_t*) herwig6_common_block_address_((char*)"HW6300",6)),
+  fHwpmrs((Hwpmrs_t*) herwig6_common_block_address_((char*)"HWPMRS",6)),
+  fHwcirc((Hwcirc_t*) herwig6_common_block_address_((char*)"HWCIRC",6)),
+  fHwdspb((Hwdspb_t*) herwig6_common_block_address_((char*)"HWDSPB",6)),
+  fHwdsp2((Hwdsp2_t*) herwig6_common_block_address_((char*)"HWDSP2",6)),
+  fHwdsp3((Hwdsp3_t*) herwig6_common_block_address_((char*)"HWDSP3",6)),
+  fHwdsp4((Hwdsp4_t*) herwig6_common_block_address_((char*)"HWDSP4",6)),
+  fHwdspn((Hwdspn_t*) herwig6_common_block_address_((char*)"HWDSPN",6)),
+  fHwspin((Hwspin_t*) herwig6_common_block_address_((char*)"HWSPIN",6)),
+  fHwstau((Hwstau_t*) herwig6_common_block_address_((char*)"HWSTAU",6)),
+  fHwgupr((Hwgupr_t*) herwig6_common_block_address_((char*)"HWGUPR",6)),
+  fHw6500((Hw6500_t*) herwig6_common_block_address_((char*)"HW6500",6)),
+  fHw6504((Hw6504_t*) herwig6_common_block_address_((char*)"HW6504",6)),
+  fHw6506((Hw6506_t*) herwig6_common_block_address_((char*)"HW6506",6))
+{
+    Fatal("THerwig6","Copy constructor not implemented yet");
+}
 //------------------------------------------------------------------------------
  THerwig6::~THerwig6()
  {
-// Destroys the object, deletes and disposes all TParticles currently on list.
-
-    if (fParticles) {
-      fParticles->Delete();
-      delete fParticles;
-      fParticles = 0;
-   }
+   // Destructor. The data members of TGenerator are delete by itself
  }
 
 //______________________________________________________________________________
-void THerwig6::GenerateEvent() 
+void THerwig6::GenerateEvent()
 {
-  
+
   //initialize event
   hwuine_();
   // generate hard subprocess
@@ -139,7 +196,6 @@ void THerwig6::GenerateEvent()
   // finish event
   hwufne_();
 }
-
 //______________________________________________________________________________
 void THerwig6::OpenFortranFile(int lun, char* name) {
   herwig6_open_fortran_file_(&lun, name, strlen(name));
@@ -154,7 +210,90 @@ void THerwig6::Initialize(const char *beam, const char *target, double pbeam1, d
 
 {
   // perform the initialization for Herwig6
-  // sets correct title. 
+  // sets correct title.
+  // after calling this method all parameters are set to their default
+  // values. If you want to modify any parameter you have to set the new
+  // value after calling Initialize and before PrepareRun.
+
+   char  cbeam[8];
+   strncpy(cbeam,beam,8);
+   char  ctarget[8];
+   strncpy(ctarget,target,8);
+   printf("\n Initializing Herwig !! \n");
+   if ( (!strncmp(beam, "E+"    ,2)) &&
+        (!strncmp(beam, "E-"    ,2)) &&
+        (!strncmp(beam, "MU+"   ,3)) &&
+        (!strncmp(beam, "MU-"   ,3)) &&
+        (!strncmp(beam, "NUE"   ,3)) &&
+        (!strncmp(beam, "NUEB"  ,4)) &&
+        (!strncmp(beam, "NUMU"  ,4)) &&
+        (!strncmp(beam, "NMUB"  ,4)) &&
+        (!strncmp(beam, "NTAU"  ,4)) &&
+        (!strncmp(beam, "NTAB"  ,4)) &&
+        (!strncmp(beam, "GAMA"  ,4)) &&
+        (!strncmp(beam, "P       ",8)) &&
+        (!strncmp(beam, "PBAR    ",8)) &&
+        (!strncmp(beam, "N"     ,1)) &&
+        (!strncmp(beam, "NBAR"  ,4)) &&
+        (!strncmp(beam, "PI+"   ,3)) &&
+        (!strncmp(beam, "PI-"   ,3)) ) {
+      printf("WARNING! In THerwig6:Initialize():\n");
+      printf(" specified beam=%s is unrecognized .\n",beam);
+      printf(" resetting to \"P\" .");
+      sprintf(cbeam,"P");
+   }
+
+   if ( (!strncmp(target, "E+"    ,2)) &&
+        (!strncmp(target, "E-"    ,2)) &&
+        (!strncmp(target, "MU+"   ,3)) &&
+        (!strncmp(target, "MU-"   ,3)) &&
+        (!strncmp(target, "NUE"   ,3)) &&
+        (!strncmp(target, "NUEB"  ,4)) &&
+        (!strncmp(target, "NUMU"  ,4)) &&
+        (!strncmp(target, "NMUB"  ,4)) &&
+        (!strncmp(target, "NTAU"  ,4)) &&
+        (!strncmp(target, "NTAB"  ,4)) &&
+        (!strncmp(target, "GAMA"  ,4)) &&
+        (!strncmp(target, "P       ",8)) &&
+        (!strncmp(target, "PBAR    ",8)) &&
+        (!strncmp(target, "N"     ,1)) &&
+        (!strncmp(target, "NBAR"  ,4)) &&
+        (!strncmp(target, "PI+"   ,3)) &&
+        (!strncmp(target, "PI-"   ,3)) ) {
+      printf("WARNING! In THerwig6:Initialize():\n");
+      printf(" specified target=%s is unrecognized .\n",target);
+      printf(" resetting to \"P\" .");
+      sprintf(ctarget,"P");
+   }
+
+   // initialization:
+   // type of beams
+   strncpy(fHwbmch->PART1,beam,8);
+   strncpy(fHwbmch->PART2,target,8);
+   // momentum of beams
+   fHwproc->PBEAM1=pbeam1;
+   fHwproc->PBEAM2=pbeam2;
+   // process to generate
+   fHwproc->IPROC=iproc;
+   // not used in the class definition
+   fHwproc->MAXEV=1;
+
+   // reset all parameters
+   hwigin_();
+
+   // set correct title
+   char atitle[132];
+   double win=pbeam1+pbeam2;
+   printf("\n %s - %s at %g GeV",beam,target,win);
+   sprintf(atitle,"%s-%s at %g GeV",cbeam,ctarget,win);
+   SetTitle(atitle);
+}
+
+void THerwig6::InitializeJimmy(const char *beam, const char *target, double pbeam1, double pbeam2, int iproc)
+
+{
+  // perform the initialization for Herwig6
+  // sets correct title.
   // after calling this method all parameters are set to their default
   // values. If you want to modify any parameter you have to set the new
   // value after calling Initialize and before PrepareRun.
@@ -219,18 +358,20 @@ void THerwig6::Initialize(const char *beam, const char *target, double pbeam1, d
    fHwproc->PBEAM2=pbeam2;
    // process to generate
    fHwproc->IPROC=iproc;
-   // not used in the class definition 
+   // not used in the class definition
    fHwproc->MAXEV=1;
 
    // reset all parameters
    hwigin_();
-   
+   // JIMMY initialization
+   jimmin_();
+
    // set correct title
    char atitle[132];
    double win=pbeam1+pbeam2;
    printf("\n %s - %s at %g GeV",beam,target,win);
    sprintf(atitle,"%s-%s at %g GeV",cbeam,ctarget,win);
-   SetTitle(atitle); 
+   SetTitle(atitle);
 }
 
 void THerwig6::PrepareRun()
@@ -241,6 +382,15 @@ void THerwig6::PrepareRun()
   hweini_();
 }
 
+void THerwig6::PrepareRunJimmy()
+{
+  // compute parameter dependent constants
+  hwuinc_();
+  // initialize elementary processes
+  hweini_();
+  // more initializations for JIMMY
+  jminit_();
+}
 //______________________________________________________________________________
 TObjArray* THerwig6::ImportParticles(Option_t *option)
 {
@@ -257,7 +407,7 @@ TObjArray* THerwig6::ImportParticles(Option_t *option)
   Int_t numpart = fHepevt->NHEP;
   TClonesArray &a = *((TClonesArray*)fParticles);
   if (!strcmp(option,"") || !strcmp(option,"Final")) {
-    for (Int_t i = 0; i<=numpart; i++) {
+    for (Int_t i = 0; i < numpart; i++) {
       if (fHepevt->ISTHEP[i] == 1) {
 //
 //  Use the common block values for the TParticle constructor
@@ -282,7 +432,7 @@ TObjArray* THerwig6::ImportParticles(Option_t *option)
      }
   }
   else if (!strcmp(option,"All")) {
-    for (Int_t i = 0; i<=numpart; i++) {
+    for (Int_t i = 0; i < numpart; i++) {
       new(a[i]) TParticle(
                                    fHepevt->IDHEP[i],
                                    fHepevt->ISTHEP[i],
@@ -323,7 +473,7 @@ Int_t THerwig6::ImportParticles(TClonesArray *particles, Option_t *option)
   refParticles.Clear();
   Int_t numpart = fHepevt->NHEP;
   if (!strcmp(option,"") || !strcmp(option,"Final")) {
-    for (Int_t i = 0; i< numpart; i++) {
+    for (Int_t i = 0; i < numpart; i++) {
       if (fHepevt->ISTHEP[i] == 1) {
 //
 //  Use the common block values for the TParticle constructor
@@ -458,6 +608,12 @@ void THerwig6::Hwefin()
   hwefin_();
 }
 
+void THerwig6::Hwiodk(int iopt)
+
+{
+  hwiodk_(iopt);
+}
+
 void THerwig6::SetupTest()
 {
   // exampe of running herwig and generating one event
@@ -485,6 +641,24 @@ void THerwig6::SetupTest()
     };
 }
 
+// Jimmy subroutines
+
+void THerwig6::Jminit()
+{
+  jminit_();
+}
+
+void THerwig6::Jimmin()
+{
+  jimmin_();
+}
+
+void THerwig6::Jmefin()
+{
+  jmefin_();
+}
+
+