KVINDRATelescope* KVINDRA::BuildTelescope(const Char_t* prefix, Int_t module) { // Build telescope from infos in file "$KVROOT/KVFiles/data/indra-struct.[dataset].env" //Info("BuildTelescope", "Building telescope %s",name); KVINDRATelescope* kvt = new KVINDRATelescope; KVString telescopes = fStrucInfos.GetValue(Form("%s.Telescope", prefix), ""); telescopes.Begin(" "); KVString name; while (!telescopes.End()) { name = telescopes.Next(); KVNumberList mods = fStrucInfos.GetValue(Form("%s.Telescope.%s.Modules", prefix, name.Data()), "1-100"); if (mods.Contains(module)) break; } KVString detectors = fStrucInfos.GetValue(Form("INDRA.Telescope.%s.Detectors", name.Data()), ""); Double_t aziwidth = fStrucInfos.GetValue(Form("INDRA.Telescope.%s.AziWidth", name.Data()), 1.0); Double_t dist = fStrucInfos.GetValue(Form("%s.Dist", prefix), 0.0); kvt->SetDistance(dist); detectors.Begin(" "); Int_t idet = 1; while (!detectors.End()) { KVString detector = detectors.Next(); detector.Begin("()"); KVString dettype = detector.Next(); Double_t detthick = detector.Next().Atof(); KVDetector* det = KVDetector::MakeDetector(Form("%s.%s", fDataSet.Data(), dettype.Data()), detthick); kvt->Add(det); Double_t depth = fStrucInfos.GetValue(Form("INDRA.Telescope.%s.Depth.%s", name.Data(), dettype.Data()), 0.); kvt->SetDepth(idet, depth); idet++; } kvt->SetAzimuthalWidth(aziwidth); return kvt; }
KVRing* KVINDRA::BuildRing(Int_t number, const Char_t* prefix) { // Build ring with infos in file "$KVROOT/KVFiles/data/indra-struct.[dataset].env" KVRing* ring = new KVRing; Info("BuildRing", "Building ring %d (%s)", number, prefix); Double_t thmin = fStrucInfos.GetValue(Form("%s.ThMin", prefix), 0.0); Double_t thmax = fStrucInfos.GetValue(Form("%s.ThMax", prefix), 0.0); Double_t phi_0 = fStrucInfos.GetValue(Form("%s.Phi0", prefix), 0.0); Int_t ntel = fStrucInfos.GetValue(Form("%s.Ntel", prefix), 0); Int_t step = fStrucInfos.GetValue(Form("%s.Step", prefix), 1); Int_t num_first = fStrucInfos.GetValue(Form("%s.Nfirst", prefix), 1); Double_t dphi = fStrucInfos.GetValue(Form("%s.Dphi", prefix), -1.0); KVNumberList absent = fStrucInfos.GetValue(Form("%s.Absent", prefix), ""); ring->SetPolarMinMax(thmin, thmax); KVINDRATelescope* kvt = BuildTelescope(prefix, num_first); Double_t phi_min = phi_0 - 0.5 * (kvt->GetAzimuthalWidth()); phi_min = (phi_min < 0. ? phi_min + 360. : phi_min); dphi = (dphi < 0. ? 360. / ntel : dphi); Double_t phi_max = phi_0 + ((ntel - 1.0) * dphi) + 0.5 * (kvt->GetAzimuthalWidth()); phi_max = (phi_max > 360. ? phi_max - 360. : phi_max); ring->SetAzimuthalMinMax(phi_min, phi_max); ring->SetNumber(number); Double_t phi = phi_0; UInt_t counter = num_first; for (int i = 0; i < ntel; i++) { kvt->SetPolarMinMax(thmin, thmax); kvt->SetPhi(phi); phi = (phi + dphi > 360. ? (phi + dphi - 360.) : (phi + dphi)); kvt->SetNumber(counter); if (!absent.Contains(counter)) ring->Add(kvt); else delete kvt; counter += step; if (i + 1 < ntel) kvt = BuildTelescope(prefix, counter); } ring->SetName(Form("RING_%d", number)); return ring; }