]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSv1.cxx
Bug correction
[u/mrichter/AliRoot.git] / PHOS / AliPHOSv1.cxx
index ac1cc9f6a4df037fa8a4b770832c66f630806151..d8cc5f0d9dce57d17248f06ca5f0f7242fca3997 100644 (file)
@@ -292,7 +292,8 @@ void AliPHOSv1::StepManager(void)
 
   Int_t moduleNumber ;
   
-  if( gMC->CurrentVolID(copy) == gMC->VolId("PCPQ") &&
+  static Int_t idPCPQ = gMC->VolId("PCPQ");
+  if( gMC->CurrentVolID(copy) == idPCPQ &&
       (gMC->IsTrackEntering() ) &&
       gMC->TrackCharge() != 0) {      
     
@@ -387,8 +388,8 @@ void AliPHOSv1::StepManager(void)
   }
 
  
-  
-  if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") ) { //  We are inside a PBWO crystal
+  static Int_t idPXTL = gMC->VolId("PXTL");  
+  if(gMC->CurrentVolID(copy) == idPXTL ) { //  We are inside a PBWO crystal
 
     gMC->TrackPosition(pos) ;
     xyzte[0] = pos[0] ;
@@ -405,13 +406,20 @@ void AliPHOSv1::StepManager(void)
     if ( gMC->IsTrackEntering() ){
       Float_t xyzd[3] ;
       gMC -> Gmtod (xyzte, xyzd, 1);    // transform coordinate from master to daughter system    
-      if (xyzd[1] < -GetGeometry()->GetCrystalSize(1)/2.+0.001){   //Entered close to forward surface  
-       TParticle * part = 0 ; 
+      if (xyzd[1] < -GetGeometry()->GetCrystalSize(1)/2.+0.1){   //Entered close to forward surface  
        Int_t parent = gAlice->GetMCApp()->GetCurrentTrackNumber() ; 
-       while ( parent != -1 ) {
-         part = gAlice->GetMCApp()->Particle(parent) ; 
-         part->SetBit(kKeepBit);
-         parent = part->GetFirstMother() ; 
+       TParticle * part = gAlice->GetMCApp()->Particle(parent) ; 
+       Float_t vert[3],vertd[3] ;
+       vert[0]=part->Vx() ;
+       vert[1]=part->Vy() ;
+       vert[2]=part->Vz() ;
+       gMC -> Gmtod (vert, vertd, 1);    // transform coordinate from master to daughter system
+       if(vertd[1]<-GetGeometry()->GetCrystalSize(1)/2.-0.1){ //Particle is created in foront of PHOS 0.1 to get rid of numerical errors 
+         while ( parent != -1 ) {
+           part = gAlice->GetMCApp()->Particle(parent) ; 
+           part->SetBit(kKeepBit);
+           parent = part->GetFirstMother() ; 
+         }
        }
       }
     }