ATLAS Offline Software
TFCSParametrizationChain.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "ISF_FastCaloSimEvent/TFCSParametrization.h"
6 
7 inline FCSReturnCode TFCSParametrizationChain::simulate_and_retry(
8  TFCSParametrizationBase *parametrization, TFCSSimulationState &simulstate,
9  const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const {
10  int retry_warning = 1;
11  int retry = 0;
12  for (int i = 0; i <= retry; i++) {
13  if (i >= retry_warning)
14  ATH_MSG_WARNING(
15  "TFCSParametrizationChain::simulate_and_retry(): Retry simulate call "
16  << i << "/" << retry);
17 
18  FCSReturnCode status =
19  parametrization->simulate(simulstate, truth, extrapol);
20 
21  if (status == FCSSuccess)
22  return FCSSuccess;
23  if (status == FCSFatal)
24  return FCSFatal;
25  if (status >= FCSRetry) {
26  retry = status - FCSRetry;
27  retry_warning = retry >> 1;
28  if (retry_warning < 1)
29  retry_warning = 1;
30  }
31 
32  if (RetryChainFromStart())
33  return status;
34  }
35 
36  ATH_MSG_FATAL("TFCSParametrizationChain::simulate_and_retry(): Simulate call "
37  "failed after "
38  << retry << " retries");
39 
40  return FCSFatal;
41 }