- id=gMC->CurrentVolID(copy);
- iChamber = GetChamberId(id);
- idvol = iChamber -1;
-
- if (idvol == -1) return;
-
- // Filling TrackRefs file for MUON. Our Track references are the active volume of the chambers
- if ( (gMC->IsTrackEntering() || gMC->IsTrackExiting() ) )
- AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
-
- if( gMC->IsTrackEntering() ) {
- Float_t theta = fTrackMomentum.Theta();
- if ((TMath::Pi()-theta)*kRaddeg>=15.) gMC->SetMaxStep(fStepMaxInActiveGas); // We use Pi-theta because z is negative
- }
-
-// if (GetDebug()) {
-// Float_t z = ( (AliMUONChamber*)(*fChambers)[idvol])->Z() ;
-// Info("StepManager Step","Active volume found %d chamber %d Z chamber is %f ",idvol,iChamber, z);
-// }
- // Particule id and mass,
- Int_t ipart = gMC->TrackPid();
- Float_t mass = gMC->TrackMass();
-
- fDestepSum[idvol]+=gMC->Edep();
- // Get current particle id (ipart), track position (pos) and momentum (mom)
- if ( fStepSum[idvol]==0.0 ) gMC->TrackMomentum(fTrackMomentum);
- fStepSum[idvol]+=gMC->TrackStep();
-
-// if (GetDebug()) {
-// Info("StepManager Step","iChamber %d, Particle %d, theta %f phi %f mass %f StepSum %f eloss %g",
-// iChamber,ipart, fTrackMomentum.Theta()*kRaddeg, fTrackMomentum.Phi()*kRaddeg, mass, fStepSum[idvol], gMC->Edep());// Info("StepManager Step","Track Momentum %f %f %f", fTrackMomentum.X(), fTrackMomentum.Y(), fTrackMomentum.Z()) ;
-// gMC->TrackPosition(fTrackPosition);
-// Info("StepManager Step","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
-// }
-
- // Track left chamber or StepSum larger than fStepMaxInActiveGas
- if ( gMC->IsTrackExiting() ||
- gMC->IsTrackStop() ||
- gMC->IsTrackDisappeared()||
- (fStepSum[idvol]>fStepMaxInActiveGas) ) {
-
- if ( gMC->IsTrackExiting() ||
- gMC->IsTrackStop() ||
- gMC->IsTrackDisappeared() ) gMC->SetMaxStep(kBig);
-
- gMC->TrackPosition(fTrackPosition);
- Float_t theta = fTrackMomentum.Theta();
- Float_t phi = fTrackMomentum.Phi();
-
- TLorentzVector backToWire( fStepSum[idvol]/2.*sin(theta)*cos(phi),
- fStepSum[idvol]/2.*sin(theta)*sin(phi),
- fStepSum[idvol]/2.*cos(theta),0.0 );
- // if (GetDebug())
- // Info("StepManager Exit","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
- // if (GetDebug())
- // Info("StepManager Exit ","Track backToWire %f %f %f",backToWire.X(),backToWire.Y(),backToWire.Z()) ;
- fTrackPosition-=backToWire;
-
- //-------------- Angle effect
- // Ratio between energy loss of particle and Mip as a function of BetaGamma of particle (Energy/Mass)
-
- Float_t betaxGamma = fTrackMomentum.P()/mass;// pc/mc2
- Float_t sigmaEffect10degrees;
- Float_t sigmaEffectThetadegrees;
- Float_t eLossParticleELossMip;
- Float_t yAngleEffect=0.;
- Float_t thetawires = TMath::Abs( TMath::ASin( TMath::Sin(TMath::Pi()-theta) * TMath::Sin(phi) ) );// We use Pi-theta because z is negative
-
-
- if (fAngleEffect){
- if ( (betaxGamma >3.2) && (thetawires*kRaddeg<=15.) ) {
- betaxGamma=TMath::Log(betaxGamma);
- eLossParticleELossMip = fElossRatio->Eval(betaxGamma);
- // 10 degrees is a reference for a model (arbitrary)
- sigmaEffect10degrees=fAngleEffect10->Eval(eLossParticleELossMip);// in micrometers
- // Angle with respect to the wires assuming that chambers are perpendicular to the z axis.
- sigmaEffectThetadegrees = sigmaEffect10degrees/fAngleEffectNorma->Eval(thetawires*kRaddeg); // For 5mm gap
- if ( (iChamber==1) || (iChamber==2) )
- sigmaEffectThetadegrees/=(1.09833e+00+1.70000e-02*(thetawires*kRaddeg)); // The gap is different (4mm)
- yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees); // Error due to the angle effect in cm
- }
- }