- gMC->SetMaxStep(kBig);
-
- // Use only charged tracks
- if (( gMC->TrackCharge() ) &&
- (!gMC->IsTrackStop() ) &&
- (!gMC->IsTrackDisappeared())) {
-
- // Inside a sensitive volume?
- drRegion = kFALSE;
- amRegion = kFALSE;
- cIdCurrent = gMC->CurrentVolName();
- if (cIdSensDr == cIdCurrent[1]) {
- drRegion = kTRUE;
- }
- if (cIdSensAm == cIdCurrent[1]) {
- amRegion = kTRUE;
- }
- if (drRegion || amRegion) {
-
- // The hit coordinates and charge
- gMC->TrackPosition(pos);
- hits[0] = pos[0];
- hits[1] = pos[1];
- hits[2] = pos[2];
-
- // The sector number (0 - 17)
- // The numbering goes clockwise and starts at y = 0
- // Not fully consistent to new corrdinate schema!!!
- Float_t phi = kRaddeg*TMath::ATan2(pos[0],pos[1]);
- if (phi < 90.)
- phi = phi + 270.;
- else
- phi = phi - 90.;
- sec = ((Int_t) (phi / 20));
-
- // The plane and chamber number
- cIdChamber[0] = cIdCurrent[2];
- cIdChamber[1] = cIdCurrent[3];
- Int_t idChamber = (atoi(cIdChamber) % kNdetsec);
- cha = ((Int_t) idChamber / kNplan);
- pla = ((Int_t) idChamber % kNplan);
-
- // Check on selected volumes
- Int_t addthishit = 1;
- if (fSensSelect) {
- if ((fSensPlane >= 0) && (pla != fSensPlane )) addthishit = 0;
- if ((fSensChamber >= 0) && (cha != fSensChamber)) addthishit = 0;
- if (fSensSector >= 0) {
- Int_t sens1 = fSensSector;
- Int_t sens2 = fSensSector + fSensSectorRange;
- sens2 -= ((Int_t) (sens2 / AliTRDgeometry::Nsect()))
- * AliTRDgeometry::Nsect();
- if (sens1 < sens2) {
- if ((sec < sens1) || (sec >= sens2)) addthishit = 0;
- }
- else {
- if ((sec < sens1) && (sec >= sens2)) addthishit = 0;
- }
- }
- }
-
- // Add this hit
- if (addthishit) {
-
- // The detector number
- det = fGeometry->GetDetector(pla,cha,sec);
-
- // Special hits and TR photons only in the drift region
- if (drRegion) {
-
- // Create a track reference at the entrance and
- // exit of each chamber that contain the
- // momentum components of the particle
- if (gMC->IsTrackEntering() || gMC->IsTrackExiting()) {
- gMC->TrackMomentum(mom);
- AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
- }
-
- // Create the hits from TR photons
- if (fTR) CreateTRhit(det);
-
- }
-
- // Calculate the energy of the delta-electrons
- eDelta = TMath::Exp(fDeltaE->GetRandom()) - kPoti;
- eDelta = TMath::Max(eDelta,0.0);
-
- // The number of secondary electrons created
- qTot = ((Int_t) (eDelta / kWion) + 1);