ATLAS Offline Software
TFCSParametrizationEtaSelectChain.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 #include <iostream>
10 
11 //=============================================
12 //======= TFCSParametrizationEtaSelectChain =========
13 //=============================================
14 
16  clear();
17  if (size() == 0)
18  return;
19 
23 
24  chain().shrink_to_fit();
25 }
26 
28  TFCSParametrizationBase *param) {
29  push_back_in_bin(param, param->eta_min(), param->eta_max());
30 }
31 
34  const TFCSExtrapolationState *extrapol) const {
35  return val_to_bin(extrapol->IDCaloBoundary_eta());
36 }
37 
40  const TFCSExtrapolationState *extrapol) const {
41  return std::string(Form("eta=%2.2f", extrapol->IDCaloBoundary_eta()));
42 }
43 
44 const std::string
46  if (bin == -1 || bin >= (int)get_number_of_bins()) {
47  return std::string(Form("bin=%d not in [%2.2f<=eta<%2.2f)", bin,
48  m_bin_low_edge[0],
50  }
51  return std::string(Form("bin=%d, %2.2f<=eta<%2.2f", bin, m_bin_low_edge[bin],
52  m_bin_low_edge[bin + 1]));
53 }
54 
56  TFCSSimulationState *simulstate, TFCSTruthState *truth,
59  if (!simulstate)
60  simulstate = new TFCSSimulationState();
61  if (!truth)
62  truth = new TFCSTruthState();
63  if (!extrapol)
65 
66  TFCSParametrizationEtaSelectChain chain("chain", "chain");
67  chain.setLevel(MSG::DEBUG);
68 
69  TFCSParametrization *param;
70  param = new TFCSParametrization("A begin all", "A begin all");
71  param->setLevel(MSG::DEBUG);
72  param->set_eta_nominal(2);
73  param->set_eta_min(2);
74  param->set_eta_max(3);
75  chain.push_before_first_bin(param);
76  param = new TFCSParametrization("A end all", "A end all");
77  param->setLevel(MSG::DEBUG);
78  param->set_eta_nominal(2);
79  param->set_eta_min(2);
80  param->set_eta_max(3);
81  chain.push_back(param);
82 
83  const int n_params = 5;
84  for (int i = 2; i < n_params; ++i) {
85  param = new TFCSParametrization(Form("A%d", i), Form("A %d", i));
86  param->setLevel(MSG::DEBUG);
87  param->set_eta_nominal(i * i + 0.1);
88  param->set_eta_min(i * i);
89  param->set_eta_max((i + 1) * (i + 1));
90  chain.push_back_in_bin(param);
91  }
92  for (int i = n_params; i >= 1; --i) {
93  param = new TFCSParametrization(Form("B%d", i), Form("B %d", i));
94  param->setLevel(MSG::DEBUG);
95  param->set_eta_nominal(i * i + 0.1);
96  param->set_eta_min(i * i);
97  param->set_eta_max((i + 1) * (i + 1));
98  chain.push_back_in_bin(param);
99  }
100 
101  ATH_MSG_NOCLASS(logger, "==== Chain setup ====");
102  chain.Print();
103 
104  param = new TFCSParametrization("B end all", "B end all");
105  param->setLevel(MSG::DEBUG);
106  chain.push_back(param);
107  param = new TFCSParametrization("B begin all", "B begin all");
108  param->setLevel(MSG::DEBUG);
109  chain.push_before_first_bin(param);
110 
111  ATH_MSG_NOCLASS(logger, "==== Chain setup ====");
112  chain.Print();
113  ATH_MSG_NOCLASS(logger, "==== Simulate with eta=0.1 ====");
114  extrapol->set_IDCaloBoundary_eta(0.1);
115  chain.simulate(*simulstate, truth, extrapol);
116  ATH_MSG_NOCLASS(logger, "==== Simulate with eta=1.1 ====");
117  extrapol->set_IDCaloBoundary_eta(1.1);
118  chain.simulate(*simulstate, truth, extrapol);
119  ATH_MSG_NOCLASS(logger, "==== Simulate with eta=2.1 ====");
120  extrapol->set_IDCaloBoundary_eta(2.1);
121  chain.simulate(*simulstate, truth, extrapol);
122  ATH_MSG_NOCLASS(logger, "==== Simulate with eta=4.1 ====");
123  extrapol->set_IDCaloBoundary_eta(4.1);
124  chain.simulate(*simulstate, truth, extrapol);
125  ATH_MSG_NOCLASS(logger, "==== Simulate with eta=100 ====");
126  extrapol->set_IDCaloBoundary_eta(100);
127  chain.simulate(*simulstate, truth, extrapol);
128  ATH_MSG_NOCLASS(logger, "===================================" << std::endl);
129 }
TFCSParametrizationEtaSelectChain::get_variable_text
virtual const std::string get_variable_text(TFCSSimulationState &simulstate, const TFCSTruthState *, const TFCSExtrapolationState *) const override
Definition: TFCSParametrizationEtaSelectChain.cxx:38
ISF_FCS::MLogging
Cut down AthMessaging.
Definition: MLogging.h:176
bin
Definition: BinsDiffFromStripMedian.h:43
TFCSExtrapolationState
Definition: TFCSExtrapolationState.h:13
RunActsMaterialValidation.extrapol
extrapol
Definition: RunActsMaterialValidation.py:90
TFCSParametrizationChain::recalc_eta_union
void recalc_eta_union()
Definition: TFCSParametrizationChain.cxx:98
TFCSParametrization::set_eta_max
virtual void set_eta_max(double max)
Definition: TFCSParametrization.cxx:53
TFCSParametrizationEtaSelectChain::push_back_in_bin
virtual void push_back_in_bin(TFCSParametrizationBase *param)
Definition: TFCSParametrizationEtaSelectChain.cxx:27
TFCSParametrizationBase
Definition: TFCSParametrizationBase.h:46
TFCSParametrizationBinnedChain::get_number_of_bins
virtual unsigned int get_number_of_bins() const
Definition: TFCSParametrizationBinnedChain.h:22
TFCSParametrizationEtaSelectChain::recalc
virtual void recalc() override
Default is to call recalc_pdgid_intersect() and recalc_Ekin_eta_intersect()
Definition: TFCSParametrizationEtaSelectChain.cxx:15
TFCSParametrizationEtaSelectChain::unit_test
static void unit_test(TFCSSimulationState *simulstate=nullptr, TFCSTruthState *truth=nullptr, TFCSExtrapolationState *extrapol=nullptr)
Definition: TFCSParametrizationEtaSelectChain.cxx:55
lumiFormat.i
int i
Definition: lumiFormat.py:85
TFCSParametrizationChain::chain
const Chain_t & chain() const
Definition: TFCSParametrizationChain.h:53
TFCSParametrization::TFCSParametrization
TFCSParametrization(const char *name=nullptr, const char *title=nullptr)
Definition: TFCSParametrization.cxx:12
TFCSParametrizationBase::eta_min
virtual double eta_min() const
Definition: TFCSParametrizationBase.h:80
TFCSParametrizationBase::eta_max
virtual double eta_max() const
Definition: TFCSParametrizationBase.h:81
TFCSParametrizationChain::recalc_pdgid_intersect
void recalc_pdgid_intersect()
Definition: TFCSParametrizationChain.cxx:20
TFCSParametrizationChain::recalc_Ekin_intersect
void recalc_Ekin_intersect()
Definition: TFCSParametrizationChain.cxx:45
TFCSParametrizationEtaSelectChain::get_bin
virtual int get_bin(TFCSSimulationState &, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const override
this method should determine in derived classes which bin to simulate, so that the simulate method ca...
Definition: TFCSParametrizationEtaSelectChain.cxx:32
TFCSParametrization
Definition: TFCSParametrization.h:10
TFCSParametrization::set_eta_nominal
virtual void set_eta_nominal(double min)
Definition: TFCSParametrization.cxx:47
ISF_FCS::MLogging::setLevel
virtual void setLevel(MSG::Level lvl)
Update outputlevel.
Definition: MLogging.cxx:105
TFCSParametrizationEtaSelectChain
Definition: TFCSParametrizationEtaSelectChain.h:11
TFCSParametrization::clear
void clear()
Definition: TFCSParametrization.cxx:18
TFCSParametrizationFloatSelectChain::val_to_bin
int val_to_bin(float val) const
Definition: TFCSParametrizationFloatSelectChain.cxx:92
TFCSParametrizationEtaSelectChain::get_bin_text
virtual const std::string get_bin_text(int bin) const override
print the range of a bin; for bin -1, print the allowed range
Definition: TFCSParametrizationEtaSelectChain.cxx:45
TFCSTruthState.h
ATH_MSG_NOCLASS
#define ATH_MSG_NOCLASS(logger_name, x)
Definition: MLogging.h:52
TFCSExtrapolationState.h
DEBUG
#define DEBUG
Definition: page_access.h:11
TFCSParametrization::set_eta_min
virtual void set_eta_min(double min)
Definition: TFCSParametrization.cxx:51
TFCSSimulationState.h
TFCSParametrizationEtaSelectChain.h
TFCSTruthState
Definition: TFCSTruthState.h:13
TFCSSimulationState
Definition: TFCSSimulationState.h:32
TFCSParametrizationFloatSelectChain::m_bin_low_edge
std::vector< float > m_bin_low_edge
Definition: TFCSParametrizationFloatSelectChain.h:41
python.iconfTool.gui.pad.logger
logger
Definition: pad.py:14
TFCSParametrizationChain::size
virtual unsigned int size() const override
Some derived classes have daughter instances of TFCSParametrizationBase objects The size() and operat...
Definition: TFCSParametrizationChain.h:41