|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #include "CLHEP/Random/RandFlat.h"
25 if (Ekin_bin >= 1 && Ekin_bin <=
n_bins())
31 for (
int id :
pdgid()) {
65 int id, std::vector<float>
prob) {
68 ATH_MSG_ERROR(
"TFCSEnergyBinParametrization::set_pdgid_Ekin_bin_"
69 "probability(): size of vectors does not match! in.size()="
75 for (
int iEbin = 0; iEbin <=
n_bins(); ++iEbin)
78 for (
int iEbin = 0; iEbin <=
n_bins(); ++iEbin) {
79 p +=
prob[iEbin] / ptot;
85 int id, TFile *
file, std::string prob_object_name) {
90 dynamic_cast<TVectorF *
>(
gDirectory->Get(prob_object_name.c_str()));
92 std::vector<float>
prob;
94 if (probFromFile ==
nullptr) {
95 ATH_MSG_INFO(
"TFCSEnergyBinParametrization::load_pdgid_Ekin_bin_"
96 "probability_from_file(): "
98 <<
" is null. Using equal PCA probabilities.");
104 auto size =
static_cast<size_t>(probFromFile->GetNoElements());
107 "TFCSEnergyBinParametrization::load_pdgid_Ekin_bin_probability_from_"
108 "file(): size of prob array does not match! in.size()="
113 const float *probArray = probFromFile->GetMatrixArray();
114 for (
size_t i = 0;
i <
size;
i++) {
115 prob.push_back(probArray[
i]);
120 for (
int iEbin = 0; iEbin <=
n_bins(); ++iEbin)
123 for (
int iEbin = 0; iEbin <=
n_bins(); ++iEbin) {
124 p +=
prob[iEbin] / ptot;
133 bool shortprint =
opt.Index(
"short") >= 0;
135 TString optprint =
opt;
136 optprint.ReplaceAll(
"short",
"");
143 for (
int iEbin = 0; iEbin <=
n_bins(); ++iEbin) {
148 << (mapit->second[iEbin] -
p) / mapit->second.back() * 100
150 p = mapit->second[iEbin];
164 const int truth_pdgid = truth->
pdgid();
173 "TFCSEnergyBinParametrization::simulate(): cannot simulate pdgid="
178 const float searchRand = CLHEP::RandFlat::shoot(simulstate.
randomEngine());
181 TMath::BinarySearch(
n_bins() + 1, Ebin_probability.data(), searchRand) +
184 ATH_MSG_WARNING(
"TFCSEnergyBinParametrization::simulate(): chosenBin<0 "
185 "(will use chosenBin=0)");
186 std::string
array =
"";
187 for (
const auto &
prob : Ebin_probability) {
192 <<
" rnd=" << searchRand <<
" array=" <<
array);
194 }
else if (chosenBin >
n_bins()) {
196 "chosenBin>n_bins() (will use chosenBin=n_bins())");
197 std::string
array =
"";
198 for (
const auto &
prob : Ebin_probability) {
203 <<
" rnd=" << searchRand <<
" array=" <<
array);
JetConstituentVector::iterator iterator
FCSReturnCode
Base class for all FastCaloSim parametrizations Functionality in derivde classes is provided through ...
const std::set< int > & pdgid() const override
virtual bool is_match_pdgid(int id) const override
int m_number_of_Ekin_bins
virtual void add_pdgid(int id)
virtual void clear_pdgid() override
virtual bool load_pdgid_Ekin_bin_probability_from_file(int id, TFile *file, std::string prob_object_name)
CLHEP::HepRandomEngine * randomEngine()
#define ATH_MSG_VERBOSE(x)
virtual bool is_match_Ekin_bin(int Ekin_bin) const override
virtual int n_bins() const override
virtual void set_pdgid(int id) override
virtual void set_pdgid(int id)
virtual void clear_pdgid()
void Print(Option_t *option="") const
Print object information.
virtual void add_pdgid(int id) override
virtual void set_pdgid_Ekin_bin_probability(int id, std::vector< float > prob)
set_pdgid_Ekin_bin_probability(): format of probability should be a vector of float with probability ...
#define ATH_MSG_WARNING(x)
void Print(Option_t *option="") const override
virtual FCSReturnCode simulate(TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const override
Method in all derived classes to do some simulation.
virtual unsigned int size() const
Some derived classes have daughter instances of TFCSParametrizationBase objects The size() and operat...
bool msgLvl(const MSG::Level lvl) const
Check whether the logging system is active at the provided verbosity level.
std::map< int, std::vector< float > > m_pdgid_Ebin_probability
TFCSEnergyBinParametrization(const char *name=nullptr, const char *title=nullptr)