diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyAndHitGAN.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyAndHitGAN.cxx index 4b10b666c962f9a28dddfb96ba1e547720236bc2..362a6b30533a7268c6e29012181d473d8b5bcbd0 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyAndHitGAN.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyAndHitGAN.cxx @@ -288,6 +288,13 @@ bool TFCSEnergyAndHitGAN::fillEnergy(TFCSSimulationState& simulstate, const TFCS } } + for(unsigned int ichain=m_bin_start.back();ichainGetName()); + if (simulate_and_retry(chain()[ichain], simulstate, truth, extrapol) != FCSSuccess) { + return FCSFatal; + } + } + vox = 0; for (auto element : binsInLayers){ int layer = element.first; @@ -506,14 +513,6 @@ FCSReturnCode TFCSEnergyAndHitGAN::simulate(TFCSSimulationState& simulstate,cons return FCSSuccess; } - - for(unsigned int ichain=m_bin_start.back();ichainGetName()); - if (simulate_and_retry(chain()[ichain], simulstate, truth, extrapol) != FCSSuccess) { - return FCSFatal; - } - } - return FCSSuccess; } diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSPredictExtrapWeights.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSPredictExtrapWeights.cxx index 63127f6836f87ca4f525dc27a2d88c2f06594dd3..ab700b587f6e880b81e824ebe556b55f7cbd277a 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSPredictExtrapWeights.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSPredictExtrapWeights.cxx @@ -136,6 +136,7 @@ bool TFCSPredictExtrapWeights::getNormInputs(std::string etaBin, std::string Fas inputTXT.close(); } else { ATH_MSG_ERROR(" Unable to open file "); + return false; } return true; @@ -183,12 +184,9 @@ FCSReturnCode TFCSPredictExtrapWeights::simulate(TFCSSimulationState& simulstate // Get predicted extrapolation weights auto outputs = m_nn->compute(inputVariables); - std::vector layers = {0,1,2,3,12}; - if(is_match_pdgid(211) || is_match_pdgid(-211)){ // charged pion - layers.push_back(13); - layers.push_back(14); - } - for(int ilayer : layers){ // loop over layers and decorate simulstate with corresponding predicted extrapolation weight + for (unsigned int i = 0; i < m_relevantLayers->size(); i++) { + int ilayer = m_relevantLayers->at(i); + ATH_MSG_DEBUG("TFCSPredictExtrapWeights::simulate: layer: " << ilayer << " weight: " << outputs["extrapWeight_"+std::to_string(ilayer)]); simulstate.setAuxInfo(ilayer,outputs["extrapWeight_"+std::to_string(ilayer)]); } return FCSSuccess; @@ -206,8 +204,8 @@ FCSReturnCode TFCSPredictExtrapWeights::simulate_hit(Hit& hit, TFCSSimulationSta if(simulstate.hasAuxInfo(cs)){ extrapWeight = simulstate.getAuxInfo(cs); } else{ // missing AuxInfo - simulate(simulstate, truth, extrapol); // decorate simulstate with extrapolation weights - extrapWeight = simulstate.getAuxInfo(cs); // retrieve corresponding extrapolation weight + ATH_MSG_FATAL("Simulstate is not decorated with extrapolation weights"); + return FCSFatal; } double r = (1.-extrapWeight)*extrapol->r(cs, SUBPOS_ENT) + extrapWeight*extrapol->r(cs, SUBPOS_EXT); @@ -255,7 +253,7 @@ bool TFCSPredictExtrapWeights::initializeNetwork(int pid, std::string etaBin, st sin << input.rdbuf(); input.close(); auto config = lwt::parse_json(sin); - m_nn = new lwt::LightweightNeuralNetwork(config.inputs, config.layers, config.outputs); + m_nn = new lwt::LightweightNeuralNetwork(config.inputs, config.layers, config.outputs); if(m_nn==nullptr){ ATH_MSG_ERROR("Could not create LightWeightNeuralNetwork from " << inputFileName ); return false;