Radiotherapy with particles is getting more attention in Europe. New facilities for protons and heavier ions are finished, or near to the final status, some more are planed. Particle therapy with heavy ions is a challenge to dosimetry, since mixed particle fields occur in the peak region of the depth dose curves. Solid state detectors, such as diamond detectors, radiochromic films, TLDs and the amino acid alanine are used due to there good spatial resolution. If used in particle beams their response often exhibits a dependence on particle energy and type, so the acquired signal is not always proportional to absorbed dose. A model by Hansen and Olsen, based on the Track Structure Theory is available, which can predict the relative efficiency of some detectors, when the particle spectrum is known. For alanine detectors the model was successfully validated by Hansen and Olsen for several ion species at energies below 20 MeV/u. We implemented this model in the Monte Carlo code FLUKA. At the GSI heavy ion facility in Darmstadt, Germany, alanine has been irradiated with carbon ions at energies between 88 an 400 MeV/u, which is the energy range used for therapy. The irradiation and the detector response have been simulated with FLUKA. We found an agreement between measured values of the relative efficiency with values predicted by the Hansen and Olsen model with divergence less than 4%. With the implementation in FLUKA we are able to simulate the detector response in the depth dose curves with precisions better than 10%. With alanine we have a detector whose behavior in mixed particle environments can be predicted using the Hansen and Olsen model for a clinical setting. However, further experiments with lower energies and higher doses will be useful to validate fundamental principles of track structure theory.