diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimSD/src/LArFCS_StepInfoSD.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimSD/src/LArFCS_StepInfoSD.cxx index d895fa64650d5b49602d85a7c5713a32f078866b..f5542701830ea7a67ee7ed9f6324517bbf7d35f1 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimSD/src/LArFCS_StepInfoSD.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimSD/src/LArFCS_StepInfoSD.cxx @@ -150,6 +150,10 @@ G4bool LArFCS_StepInfoSD::ProcessHits(G4Step* a_step,G4TouchableHistory*) maxSubHitEnergyindex = i; } } + if (maxSubHitEnergyindex == -1){//because there were no hits; numberOfProcessedHits ==0 + G4cout << this->GetName()<<" WARNING ProcessHits: numberOfProcessedHits is zero" << G4endl; + continue; + } //Identifier for the subhit with max energy Identifier maxEnergyIdentifier = this->ConvertID(processedHits[maxSubHitEnergyindex].id); const CaloDetDescrElement *maxEnergyCell = m_calo_dd_man.get()->get_element(maxEnergyIdentifier);