//------------------------------ Double_t KVCsI_e475s::GetEnergy() //------------------------------ { Double_t ELoss = KVDetector::GetEnergy(); if (ELoss > 0) return KVDetector::GetEnergy(); else ELoss = 0; SetEnergy(ELoss); return ELoss; }
static PyObject *PSetEnergy(PyObject *self, PyObject *args) { double e, es; if (spol_file) { SPOLStatement("SetEnergy", args, NULL); Py_INCREF(Py_None); return Py_None; } es = 0.0; if (!PyArg_ParseTuple(args, "d|d", &e, &es)) return NULL; SetEnergy(e, es); Py_INCREF(Py_None); return Py_None; }
Double_t KVChIo::GetEnergy() { //Redefinition of KVDetector::GetEnergy(). //If energy lost in active (gas) layer is already set (e.g. by calculation of energy loss //of charged particles), return its value. //If not, we calculate it and set it using the values read from coders (if fired) //and the channel-volts/volts-energy calibrations, if present // //Returns 0 if (i) no calibration present (ii) calibration present but no data in acquisition parameters //fELoss already set, return its value Double_t ELoss = KVDetector::GetEnergy(); if(IsSimMode()) return ELoss; // in simulation mode, return calculated energy loss in active layer if( ELoss > 0 ) return ELoss; ELoss = GetCalibratedEnergy(); if( ELoss < 0 ) ELoss = 0; SetEnergy(ELoss); return ELoss; }
static int PSetEnergy(int argc, char *argv[], int argt[], ARRAY *variables) { int i; double e, es; if (argc < 1 || argc > 2) return -1; if (argt[0] != NUMBER) return -1; if (argc == 2 && argt[1] != NUMBER) return -1; e = atof(argv[0]); if (argc == 2) { es = atof(argv[1]); } else { es = 0.0; } i = SetEnergy(e, es); return i; }
void CollisionSystem::EatEntity(std::shared_ptr<Entity> eaterEntity, std::shared_ptr<Entity> eatableEntity) { LOG_D("[CollisionSystem] Entity " << eaterEntity->GetId() << " is eating entity " << eatableEntity->GetId()); if (Engine::GetInstance().HasComponent(eaterEntity, "InfectionComponent")) { auto infectionComponent = std::static_pointer_cast<InfectionComponent>(Engine::GetInstance().GetSingleComponentOfClass(eaterEntity, "InfectionComponent")); if (infectionComponent->GetInfectionType() == CannotEat) return; } auto growthComponent = std::static_pointer_cast<GrowthComponent>(Engine::GetInstance().GetSingleComponentOfClass(eaterEntity, "GrowthComponent")); auto energy = growthComponent->GetEnergy(); ++energy; growthComponent->SetEnergy(energy); DestroyEntity(eatableEntity); Engine::GetInstance().PlaySoundEffect(CFG_GETP("EAT_SOUND_EFFECT")); }
Double_t KVBIC::GetEnergy() { //Redefinition of KVChIo::GetEnergy(). //If energy lost in active layer is already set (e.g. by calculation of energy loss //of charged particles), return its value. //If not, we calculate it and set it using the values read from coders //and the linear channel-energy calibration if initialised // //Returns -99 if (i) no calibration present (ii) calibration present but no data in acquisition parameters //fELoss already set, return its value if (KVDetector::GetEnergy()) return KVDetector::GetEnergy(); Double_t ELoss = -99; //is detector calibration available and ready ? if (IsCalibrated()) { ELoss = fLinCal->Compute(-1); if (ELoss > -99.) { SetEnergy(ELoss); } } return ELoss; }