]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TGeant3/gucode.cxx
Update GetSecondary arguments
[u/mrichter/AliRoot.git] / TGeant3 / gucode.cxx
index f20be0dbc6f28ce31607c359e73b8b8e609b2f80..0e924e2162cbab6e5f58e7079f3af5c5277f5370 100644 (file)
@@ -1,3 +1,22 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/*
+$Log$
+*/
+
 #include "AliCallf77.h"
 #include "TGeant3.h"
 #include "AliRun.h"
@@ -89,7 +108,6 @@ extern "C" type_of_call void gtrack();
 extern "C" type_of_call void gtreve_root();
 extern "C" type_of_call void glast();
 
-
 extern "C" type_of_call {
 
 //______________________________________________________________________
@@ -122,7 +140,7 @@ void guhadr()
 //
 //    ------------------------------------------------------------------
 //
-      TGeant3 *geant3=(TGeant3*)AliMC::GetMC();
+      TGeant3* geant3 = (TGeant3*) gMC;
       Int_t ihadr=geant3->Gcphys()->ihadr;
       if (ihadr<4)       gheish();
       else if (ihadr==4) flufin();
@@ -144,14 +162,6 @@ void guout()
 //
 //    ------------------------------------------------------------------
 //
-
-  Int_t ndet = gAlice->Modules()->GetLast();
-  TObjArray &dets = *gAlice->Modules();
-  AliModule *module;
-  Int_t i;
-  for(i=0; i<=ndet; i++)
-    if((module = (AliModule*)dets[i]))
-      module->FinishEvent();
 }
 
 //______________________________________________________________________
@@ -169,7 +179,7 @@ void guphad()
 //
 //    ------------------------------------------------------------------
 //
-      TGeant3 *geant3=(TGeant3*)AliMC::GetMC();
+      TGeant3* geant3 = (TGeant3*) gMC;
       Int_t ihadr=geant3->Gcphys()->ihadr;
       if (ihadr<4)       gpghei();
       else if (ihadr==4) fldist();
@@ -307,7 +317,7 @@ void guswim(Float_t& CHARGE, Float_t& STEP, Float_t* VECT, Float_t* VOUT)
 //
 //    ------------------------------------------------------------------
 //
-  TGeant3 *geant3=(TGeant3*)AliMC::GetMC();
+  TGeant3* geant3 = (TGeant3*) gMC;
   Int_t ifield=geant3->Gctmed()->ifield;
   Float_t fieldm=geant3->Gctmed()->fieldm;
 
@@ -471,39 +481,52 @@ void gustep()
 //    ******************************************************************
 //
 
-  AliMC* pMC = AliMC::GetMC();
-  TGeant3 *geant3=(TGeant3*)pMC;
 
-  Float_t x[3];
+  TLorentzVector x;
   Float_t r;
   Int_t ipp, jk, id, nt;
   Float_t polar[3]={0,0,0};
+  Float_t mom[3];
   char chproc[11];
   
   // --- Standard GEANT debug routine 
+  TGeant3* geant3 = (TGeant3*) gMC;
   if(geant3->Gcflag()->idebug) geant3->Gdebug();
 
   //     Stop particle if outside user defined tracking region 
-  pMC->TrackPosition(x);
+  gMC->TrackPosition(x);
   r=TMath::Sqrt(x[0]*x[0]+x[1]*x[1]);
   if (r > gAlice->TrackingRmax() || TMath::Abs(x[2]) > gAlice->TrackingZmax()) {
-       pMC->StopTrack();
+       gMC->StopTrack();
   }
   // --- Add new created particles 
-  if (pMC->NSecondaries() > 0) {
-    pMC->ProdProcess(chproc);
+  if (gMC->NSecondaries() > 0) {
+    gMC->ProdProcess(chproc);
     for (jk = 0; jk < geant3->Gcking()->ngkine; ++jk) {
       ipp = Int_t (geant3->Gcking()->gkin[jk][4]+0.5);
       // --- Skip neutrinos! 
       if (ipp != 4) {
-       gAlice->SetTrack(1,gAlice->CurrentTrack(),ipp, geant3->Gcking()->gkin[jk], 
+       gAlice->SetTrack(1,gAlice->CurrentTrack(),gMC->PDGFromId(ipp), geant3->Gcking()->gkin[jk], 
                         geant3->Gckin3()->gpos[jk], polar,geant3->Gctrak()->tofg, chproc, nt);
       }
     }
   }
-
+  // Cherenkov photons here
+  if ( geant3->Gckin2()->ngphot ) {
+    for (jk = 0; jk < geant3->Gckin2()->ngphot; ++jk) {
+      mom[0]=geant3->Gckin2()->xphot[jk][3]*geant3->Gckin2()->xphot[jk][6];
+      mom[1]=geant3->Gckin2()->xphot[jk][4]*geant3->Gckin2()->xphot[jk][6];
+      mom[2]=geant3->Gckin2()->xphot[jk][5]*geant3->Gckin2()->xphot[jk][6];
+      gAlice->SetTrack(1, gAlice->CurrentTrack(), gMC->PDGFromId(50),
+                      mom,                             //momentum
+                      geant3->Gckin2()->xphot[jk],     //position
+                      &geant3->Gckin2()->xphot[jk][7], //polarisation
+                      geant3->Gckin2()->xphot[jk][10], //time of flight
+                      "Cherenkov", nt);
+      }
+  }
   // --- Particle leaving the setup ?
-  if (!pMC->TrackOut()) 
+  if (!gMC->IsTrackOut()) 
     if ((id=gAlice->DetFromMate(geant3->Gctmed()->numed)) >= 0) gAlice->StepManager(id);
 }