public void MaybeRecreateProperMesh(int run, int ev, Vector3 initialPos, Vector3 heading, float duration, float emrate, float itime) { if (run == runId && ev == evId) { //same event.. return; } foreach (extraData csc in cascades) { if (run == csc.runId && ev == csc.evId) { readCsv(csc); CascadeData[] cdat = new CascadeData[bursts.Length]; float maxEnergy = 0; float minnz = 0; for (int i = 0; i < bursts.Length; i++) { if (bursts[i].energy > maxEnergy) { maxEnergy = (float)bursts[i].energy; } if (minnz == 0 || (bursts[i].energy > 0 && minnz < bursts[i].energy)) { minnz = (float)bursts[i].energy; } } if (minnz * 5000 / maxEnergy < 1000) { maxEnergy = minnz * 1000; } for (int i = 0; i < bursts.Length; i++) { int en = (int)(bursts[i].energy * 5000 / maxEnergy); if (en > 5000) { en = 5000; } cdat[i] = new CascadeData(heading, 1.0f, (int)en, (float)bursts[i].time - itime); cdat[i].location = bursts[i].coords; Debug.Log("ENERGY"); Debug.Log(maxEnergy); Debug.Log(en); Debug.Log((int)bursts[i].energy); //cdat[i].in = bursts[i].coords; } //new CascadeData(heading, 1.0f, 9500); MuonTrack tr = new MuonTrack(initialPos, heading, duration, 0.299792458f, 6000 / maxEnergy, cdat);//emrate data = tr.Simulate(); data.SaveToFile(Application.persistentDataPath + "/" + "trail.gz"); data.LoadFromFile(Application.persistentDataPath + "/" + "trail.gz"); SpawnChildren(); runId = run; evId = ev; break; } } }
public void MaybeRecreateMesh(int run, int ev, Vector3 initialPos, Vector3 heading, float duration, float emrate) { if (run == runId && ev == evId) { //same event.. return; } CascadeData cdat = new CascadeData(heading, 1.0f, 9500, 0); cdat.location = initialPos; MuonTrack tr = new MuonTrack(initialPos, heading, duration, 0.299792458f, emrate, cdat);//emrate data = tr.Simulate(); SpawnChildren(); runId = run; evId = ev; }