Add Cerenkov photons to TVirtualMCStack.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Jul 2004 20:42:06 +0000 (20:42 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Jul 2004 20:42:06 +0000 (20:42 +0000)
TFluka/Fopphst.h [new file with mode: 0644]
TFluka/TFluka.cxx
TFluka/crnkvp.f
TFluka/mgdraw.cxx

diff --git a/TFluka/Fopphst.h b/TFluka/Fopphst.h
new file mode 100644 (file)
index 0000000..0adaf79
--- /dev/null
@@ -0,0 +1,92 @@
+#ifndef OPPHST
+#define OPPHST_H 1
+
+#include "Rtypes.h"
+#include "cfortran.h"
+#include "Fdimpar.h"
+
+extern "C" {
+
+//*$ CREATE OPPHST.ADD
+//*COPY OPPHST
+//*
+//*=== Opphst ===========================================================//*
+//*
+//*----------------------------------------------------------------------//*
+//*                                                                      //*
+//*     OPtical PHoton STack:                                            //*
+//*                                                                      //*
+//*     Created on 19 september 1997 by    Alfredo Ferrari & Paola Sala  //*
+//*                                                   Infn - Milan       //*
+//*                                                                      //*
+//*     Last change on 13-oct-98     by    Alfredo Ferrari               //*
+//*                                                                      //*
+//*        wtopph = weight of the photon                                 //*
+//*        poptph = laboratory momentum of the photon in GeV/c           //*
+//*        xoptph = x-coordinate of the photon                           //*
+//*        yoptph = y-coordinate of the photon                           //*
+//*        zoptph = z-coordinate of the photon                           //*
+//*        txopph = direction cosine of the photon                       //*
+//*                 with respect to x-axis                               //*
+//*        tyopph = direction cosine of the photon                       //*
+//*                 with respect to y-axis                               //*
+//*        tzopph = direction cosine of the photon                       //*
+//*                 with respect to z-axis                               //*
+//*        txpopp = direction cosine of the photon polarization          //*
+//*        typopp = direction cosine of the photon polarization          //*
+//*        tzpopp = direction cosine of the photon polarization          //*
+//*        donear = distance to the nearest boundary                     //*
+//*        agopph = age of the photon (seconds)                          //*
+//*        cmpopp = total path length of the photon (cm)                 //*
+//*        loopph = generation of the photon                             //*
+//*        louopp = user flag                                            //*
+//*        nregop = number of the region of the photon                   //*
+//*        nlatop = number of the lattice cell of the photon             //*
+//*        tpropp = kinetic energy of parent particle of the photon      //*
+//*        apropp = age of the parent particle of the photon (seconds)   //*
+//*        ipropp = id (paprop) of the parent particle of the photon     //*
+//*        lpropp = generation of the parent particle of the photon      //*
+//*        npropp = # of the primary track which generated the photon    //*
+//*                 (not used for the moment)                            //*
+//*        lstopp = stack pointer                                        //*
+//*        lmxopp = highest value of the stack pointer encountered       //*
+//*                 in the run                                           //*
+//*                                                                      //*
+//*----------------------------------------------------------------------//*
+//*
+typedef struct {
+    Double_t WTOPPH [mostck];
+    Double_t POPTPH [mostck];
+    Double_t XOPTPH [mostck];
+    Double_t YOPTPH [mostck];
+    Double_t ZOPTPH [mostck];
+    Double_t TXOPPH [mostck];
+    Double_t TYOPPH [mostck];
+    Double_t TZOPPH [mostck];
+    Double_t TXPOPP [mostck];
+    Double_t TYPOPP [mostck];
+    Double_t TZPOPP [mostck];
+    Double_t DONEAR [mostck];
+    Double_t AGOPPH [mostck];
+    Double_t TPROPP [mostck];
+    Double_t APROPP [mostck];
+    Double_t CMPOPP [mostck];
+    Double_t SPAROK [mkbmx1][mostck];
+    Int_t    ISPORK [mkbmx2][mostck];
+    Int_t    LOOPPH [mostck];
+    Int_t    LOUOPP [mostck];
+    Int_t    NREGOP [mostck];
+    Int_t    NLATOP [mostck];
+    Int_t    IPROPP [mostck];
+    Int_t    LPROPP [mostck];
+    Int_t    NPROPP [mostck];
+    Int_t    LSTOPP;
+    Int_t    LMXOPP;
+} opphstCommon;
+
+#define OPPHST COMMON_BLOCK(OPPHST,opphst)
+COMMON_BLOCK_DEF(opphstCommon, OPPHST);
+
+}
+#endif
+
index 4212b62..73f2251 100644 (file)
 #include "Ftrackr.h"       //(TRACKR) fluka common
 #include "Fpaprop.h"       //(PAPROP) fluka common
 #include "Ffheavy.h"       //(FHEAVY) fluka common
+#include "Fopphst.h"       //(OPPHST) fluka common
 
 #include "TVirtualMC.h"
+#include "TMCProcess.h"
 #include "TGeoManager.h"
 #include "TGeoMaterial.h"
 #include "TGeoMedium.h"
@@ -52,6 +54,7 @@
 #include "TFlukaCerenkov.h"
 #include "TLorentzVector.h"
 
+
 // Fluka methods that may be needed.
 #ifndef WIN32 
 # define flukam  flukam_
@@ -2605,5 +2608,28 @@ void TFluka::SetMreg(Int_t l)
 }
 
 
+#define pushcerenkovphoton pushcerenkovphoton_
+
+
+extern "C" {
+    void pushcerenkovphoton(Double_t & px, Double_t & py, Double_t & pz, Double_t & e,
+                           Double_t & vx, Double_t & vy, Double_t & vz, Double_t & tof,
+                           Double_t & polx, Double_t & poly, Double_t & polz, Double_t & wgt, Int_t& ntr)
+    {
+       //
+       // Pushes one cerenkov photon to the stack
+       //
+       
+       TFluka* fluka =  (TFluka*) gMC;
+       TVirtualMCStack* cppstack = fluka->GetStack();
+       Int_t parent = cppstack->GetCurrentTrackNumber();
+       
+       cppstack->PushTrack(1, parent, 50000050,
+                           px, py, pz, e,
+                            vx, vy, vz, tof,
+                           polx, poly, polz,
+                           kPCerenkov, ntr, wgt, 0); 
+    }
+}
 
 
index 55d7884..9f59676 100644 (file)
@@ -410,8 +410,23 @@ D    &              SCADOT
          AGOPPH (LSTOPP) = ATRKCR
          CMPOPP (LSTOPP) = ZERZER
          LOOPPH (LSTOPP) = LTRACK + 1
+*
+*
+*        Hook to TFluka
+*
+         PXCR =  EPHSMP * TXOPPH (LSTOPP)
+         PYCR =  EPHSMP * TYOPPH (LSTOPP)
+         PZCR =  EPHSMP * TZOPPH (LSTOPP)
+         POX  = TXPOPP(LSTOPP)
+         POY  = TYPOPP(LSTOPP)
+         POZ  = TZPOPP(LSTOPP)
+         CALL PushCerenkovPhoton(PXCR, PYCR, PZCR, EPHSMP, XTRKCR, 
+     &        YTRKCR , ZTRKCR, ATRKCR, POX, POY, POZ, WTRACK, ITFL)
+*
+*
+*
 *  |  !!!!!! Here Stuprf should be used !!!!!!
-         LOUOPP (LSTOPP) = LLOUSE
+         LOUOPP (LSTOPP) = ITFL
          DO 2100 ISPR = 1, MKBMX1
             SPAROK (ISPR,LSTOPP) = SPAUSR (ISPR)
  2100    CONTINUE
index 570eb8f..bf1405e 100644 (file)
@@ -8,6 +8,7 @@
 #include "Fdimpar.h"  //(DIMPAR) fluka include
 #include "Fdblprc.h"  //(DBLPRC) fluka common
 #include "Ftrackr.h"  //(TRACKR) fluka common
+#include "Fopphst.h"  //(OPPHST) fluka common
 
 #ifndef WIN32
 # define mgdraw mgdraw_
@@ -22,8 +23,16 @@ void mgdraw(Int_t& icode, Int_t& mreg)
 //    Int_t verbosityLevel = fluka->GetVerbosityLevel();
 //
 //  Make sure that stack has currrent track Id
-    Int_t trackId = TRACKR.ispusr[mkbmx2-1];
+    Int_t trackId = -1;
     TVirtualMCStack* cppstack = fluka->GetStack();
+    
+    if (TRACKR.jtrack == -1) {
+       trackId = OPPHST.LOUOPP[OPPHST.LSTOPP - 1];
+
+    } else {
+       trackId = TRACKR.ispusr[mkbmx2-1];
+    }
+    
     cppstack->SetCurrentTrack(trackId);
 //
 //    
@@ -36,9 +45,7 @@ void mgdraw(Int_t& icode, Int_t& mreg)
 //      cout << endl << " !!! I am in mgdraw - calling Stepping()" << endl;
 //      cout << endl << " Track Id =" << trackId << endl;
 //    }
-    if (TRACKR.jtrack == -1)
-    printf("Cerenkov photon: region# %6d icode %6d \n", mreg, icode);
-
+    
     
     (TVirtualMCApplication::Instance())->Stepping();
     fluka->SetTrackIsNew(kFALSE);