void KVGeoImport::ImportGeometry(Double_t dTheta, Double_t dPhi, Double_t ThetaMin, Double_t PhiMin, Double_t ThetaMax, Double_t PhiMax) { // Scan the geometry in order to find all detectors and detector alignments. // This is done by sending out "particles" from (0,0,0) in all directions between // (ThetaMin,ThetaMax) - with respect to Z-axis - and (PhiMin,PhiMax) - cylindrical // angle in the (X,Y)-plane, over a grid of step dTheta in Theta and dPhi in Phi. KVEvent* evt = new KVEvent(); KVNucleus* nuc = evt->AddParticle(); nuc->SetZAandE(1,1,1); Double_t theta,phi; Int_t count=0; // note that ImportGeometry can be called for a KVMultiDetArray // which already contains detectors, groups and id telescopes fGroupNumber=fArray->GetStructureTypeList("GROUP")->GetEntries(); Int_t ndets0 = fArray->GetDetectors()->GetEntries(); Int_t idtels0 = fArray->GetListOfIDTelescopes()->GetEntries(); for(theta=ThetaMin; theta<=ThetaMax; theta+=dTheta){ for(phi=PhiMin; phi<=PhiMax; phi+=dPhi){ nuc->SetTheta(theta); nuc->SetPhi(phi); fCurrentGroup = 0; fLastDetector = 0; PropagateEvent(evt); count++; } } // make sure detector nodes are correct TIter next(fArray->GetDetectors()); KVDetector*d; while( (d=(KVDetector*)next()) ) d->GetNode()->RehashLists(); // set up all detector node trajectories //fArray->CalculateGeoNodeTrajectories(); if(fCreateArray){ fArray->SetGeometry(GetGeometry()); KVGeoNavigator* nav = fArray->GetNavigator(); nav->SetDetectorNameFormat(fDetNameFmt); for(register int i=0; i<fStrucNameFmt.GetEntries(); i++){ KVNamedParameter* fmt = fStrucNameFmt.GetParameter(i); nav->SetStructureNameFormat(fmt->GetName(), fmt->GetString()); } nav->SetNameCorrespondanceList(fDetStrucNameCorrespList); fArray->CalculateDetectorSegmentationIndex(); } Info("ImportGeometry", "Tested %d directions - Theta=[%f,%f:%f] Phi=[%f,%f:%f]",count,ThetaMin,ThetaMax,dTheta,PhiMin,PhiMax,dPhi); Info("ImportGeometry", "Imported %d detectors into array", fArray->GetDetectors()->GetEntries()-ndets0); if(fCreateArray){ fArray->CreateIDTelescopesInGroups(); Info("ImportGeometry", "Created %d identification telescopes in array", fArray->GetListOfIDTelescopes()->GetEntries()-idtels0); } }