예제 #1
0
TObjArray* KVRangeYanez::GetListOfMaterials()
{
   // Create and fill a list of all materials for which range tables exist.
   // Each entry is a TNamed with the name and type (title) of the material.
   // User's responsibility to delete list after use (it owns its objects).

   TObjArray* list = new TObjArray(fMaterials->GetEntries());
   list->SetOwner(kTRUE);
   TIter next(fMaterials);
   KVIonRangeTableMaterial* mat;
   while ((mat = (KVIonRangeTableMaterial*)next())) {
      list->Add(new TNamed(mat->GetName(), mat->GetType()));
   }
   return list;
}
void KVVAMOSReconGeoNavigator::ParticleEntersNewVolume(KVNucleus* nuc)
{
   // Overrides method in KVGeoNavigator base class.
   // Every time a particle enters a new volume, we check the material to see
   // if it is known (i.e. contained in the range table fRangeTable).
   // If so, then we calculate the step through the material (STEP) of the nucleus
   // and the distance (DPATH in cm) between the intersection point at the focal plane
   // and the point at the entrance of the volume if it is the first active volume of a detector.
   // DPATH has the sign + if the volume is behind the focal plane or - if it
   // is at the front of it.
   //

   KVVAMOSReconNuc* rnuc = (KVVAMOSReconNuc*)nuc;

   // stop the propagation if the current volume is the stopping detector
   // of the nucleus but after the process of this volume
   if (rnuc->GetStoppingDetector()) {
      TGeoVolume* stopVol = (TGeoVolume*)((KVVAMOSDetector*)rnuc->GetStoppingDetector())->GetActiveVolumes()->Last();

      if (GetCurrentVolume() == stopVol) SetStopPropagation();
   }

   if (fDoNothing) return;


   TGeoMaterial* material = GetCurrentVolume()->GetMaterial();
   KVIonRangeTableMaterial* irmat = 0;

   // skip the process if the current material is unkown
   if ((irmat = fRangeTable->GetMaterial(material))) {

      KVString dname;
      Bool_t multi;
      TString absorber_name;
      Bool_t is_active = kFALSE;
      if (GetCurrentDetectorNameAndVolume(dname, multi)) {
         is_active = kTRUE;
         if (multi) {
            absorber_name.Form("%s/%s", dname.Data(), GetCurrentNode()->GetName());
            is_active = absorber_name.Contains("ACTIVE_");
         } else absorber_name = dname;
      } else
         absorber_name = irmat->GetName();

      // Coordinates of the vector between the intersection point at the
      // focal plane and the point at the entrance of the current detector
      Double_t X = GetEntryPoint().X() - fOrigine.X();
      Double_t Y = GetEntryPoint().Y() - fOrigine.Y();
      Double_t Z = GetEntryPoint().Z() - fOrigine.Z();

      // Norm of this vector. The signe gives an infomation about the detector position
      // (1: behind; -1: in front of) with respect to the focal plane.
      Double_t Delta = TMath::Sign(1., Z) * TMath::Sqrt(X * X + Y * Y + Z * Z);

      if ((fCalib & kECalib) || (fCalib & kTCalib)) {
         if (fE > 1e-3) {

            // velocity before material
            Double_t Vi = nuc->GetVelocity().Mag();

            // energy lost in the material
            Double_t DE = irmat->GetLinearDeltaEOfIon(
                             nuc->GetZ(), nuc->GetA(), fE, GetStepSize(), 0.,
                             material->GetTemperature(),
                             material->GetPressure());
            fE -= DE;
            nuc->SetEnergy(fE);

            //set flag to say that particle has been slowed down
            nuc->SetIsDetected();

            // velocity after material
            Double_t Vf = nuc->GetVelocity().Mag();

            if (fCalib & kTCalib) {
               //from current start point to the entrance point
               fTOF += (Delta - fStartPath) / Vi;
               fStartPath = Delta;

               //nuc->GetParameters()->SetValue(Form("TOF:%s",absorber_name.Data()), fTOF);
               if (is_active) nuc->GetParameters()->SetValue(Form("TOF:%s", dname.Data()), fTOF);
               else if ((fCalib & kFullTCalib) == kFullTCalib) nuc->GetParameters()->SetValue(Form("TOF:%s", absorber_name.Data()), fTOF);


               // from the entrance to the exit of the material
               Double_t step = GetStepSize();
               fTOF += CalculateLinearDeltaT(Vi, Vf, step);
               fStartPath += step;
            }

            if (fCalib & kECalib) {
               if (is_active) nuc->GetParameters()->SetValue(Form("DE:%s", dname.Data()), DE);
               else if ((fCalib & kFullECalib) == kFullECalib) nuc->GetParameters()->SetValue(Form("DE:%s", absorber_name.Data()), DE);
            }
         }
      }

      if (is_active)  nuc->GetParameters()->SetValue(Form("DPATH:%s", dname.Data()), Delta);
      else if ((fCalib & kFullTCalib) == kFullTCalib) nuc->GetParameters()->SetValue(Form("DPATH:%s", absorber_name.Data()), Delta);
      nuc->GetParameters()->SetValue(Form("STEP:%s", absorber_name.Data()), GetStepSize());

   }
}