*********************************************************************** c SUBROUTINE RPCSTEP c c c Last modified on 11/08/2007 by D. Gonzalez-Diaz c *********************************************************************** IMPLICIT NONE #include "geant321/gcflag.inc" #include "geant321/gckine.inc" #include "geant321/gcsets.inc" #include "geant321/gctmed.inc" #include "geant321/gctrak.inc" #include "geant321/gcvolu.inc" #include "rpctuple.inc" INTEGER NH PARAMETER (NH=14) REAL HITS(NH) REAL XM(3), XD(3), PM(3), PD(3) CHARACTER*4 CHSET EQUIVALENCE (IHSET,CHSET) INTEGER I, IHIT, DETNR REAL ELOS, LENGTH_IN SAVE ELOS, LENGTH_IN IF(CHSET.NE.'RPCG') RETURN ! are we in an RPC gap(active volume)? DETNR = IDTYPE - 500 ! accumulate the energy deposited by the particle IF(INWVOL.EQ.1) THEN ELOS = 0.0 LENGTH_IN = SLENG ENDIF ELOS = ELOS + DESTEP ! condition for storing a hit in the volume: ! "CHARGED PARTICLE GOING OUT, STOPPED OR DECAYED" (Including the ! two last have no visible effect whatsoever in this case) ! In order to store also NEUTRAL particles that may create a hit in EBOX, *any* particle ! can additionally create a hit "WHEN GOING OUT, STOPPED OR DECAYED" from the virtual box ! (DETNR.EQ.-1). There are plenty of neutral particles just 'punching through' that are filtered ! later on in fillrpc.cc IF(((INWVOL.EQ.2 .OR. ISTOP.GE.1) .AND. CHARGE.NE.0).OR. & ((INWVOL.EQ.2 .OR. ISTOP.GE.1) .AND. DETNR.EQ.-1)) THEN DO I=1,3 XM(I) = VECT(I) PM(I) = VECT(I+3) ENDDO NLEVEL=3 ! Geometry level for transforming to module ref system (EBOX) IF(DETNR.EQ.-1) THEN DETNR=0 ! Just because HITS(7) must be positive [??]. This is not relevant since ! the detectorID for EBOX is assigned in rpcdigi.F to -SECTOR. ENDIF CALL GMTOD(PM,PD,2) ! transform momentum into module ref system (EBOX) CALL GMTOD(XM,XD,1) ! transform coordinates into module ref system (EBOX) HITS(1) = -XD(1) ! x of hit in detector coordinates (the minus sign is needed) HITS(2) = -XD(2) ! y " (the minus sign is needed) HITS(3) = XD(3) ! z " HITS(4) = TOFG ! tof of hit HITS(5) = FLOAT(ITRA) ! track nb. HITS(6) = ELOS ! deposited energy HITS(7) = FLOAT(DETNR) ! DETECTOR number HITS(8) = VECT(7) ! total momentum of particle HITS(9) = SLENG ! length of the current track HITS(10) = SLENG - LENGTH_IN ! local track length (used for energy loss estimates) HITS(11) = -PD(1) ! Px/P (the minus sign is needed) HITS(12) = -PD(2) ! Py/P (the minus sign is needed) HITS(13) = PD(3) ! Pz/P CALL GSAHIT(ISET,IDET,ITRA,NUMBV,HITS,IHIT) ! store hit for geant digitization ENDIF RETURN END