ATLAS Offline Software
TFCSParametrizationBase.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ISF_FASTCALOSIMEVENT_TFCSParametrizationBase_h
6 #define ISF_FASTCALOSIMEVENT_TFCSParametrizationBase_h
7 
8 #include <set>
9 #include <map>
10 #include <mutex>
11 
14 
15 class ICaloGeometry;
17 class TFCSTruthState;
19 
40 enum FCSReturnCode { FCSFatal = 0, FCSSuccess = 1, FCSRetry = 2 };
42 
43 #define FCS_RETRY_COUNT 3
44 
45 
46 class TFCSParametrizationBase : public TNamed, public ISF_FCS::MLogging {
47 public:
48  TFCSParametrizationBase(const char *name = nullptr,
49  const char *title = nullptr);
50 
53  kMatchAllPDGID = BIT(
54  14)
55  };
56 
57  virtual bool is_match_pdgid(int /*id*/) const {
58  return TestBit(kMatchAllPDGID);
59  };
60  virtual bool is_match_Ekin(float /*Ekin*/) const { return false; };
61  virtual bool is_match_eta(float /*eta*/) const { return false; };
62 
63  virtual bool is_match_Ekin_bin(int /*Ekin_bin*/) const { return false; };
64  virtual bool is_match_calosample(int /*calosample*/) const { return false; };
65 
66  virtual bool is_match_all_pdgid() const { return TestBit(kMatchAllPDGID); };
67  virtual bool is_match_all_Ekin() const { return false; };
68  virtual bool is_match_all_eta() const { return false; };
69  virtual bool is_match_all_Ekin_bin() const { return false; };
70  virtual bool is_match_all_calosample() const { return false; };
71 
72  virtual const std::set<int> &pdgid() const {
73  static const std::set<int> empty;
74  return empty;
75  };
76  virtual double Ekin_nominal() const { return init_Ekin_nominal; };
77  virtual double Ekin_min() const { return init_Ekin_min; };
78  virtual double Ekin_max() const { return init_Ekin_max; };
79  virtual double eta_nominal() const { return init_eta_nominal; };
80  virtual double eta_min() const { return init_eta_min; };
81  virtual double eta_max() const { return init_eta_max; };
82 
83  virtual void set_match_all_pdgid() { SetBit(kMatchAllPDGID); };
84  virtual void reset_match_all_pdgid() { ResetBit(kMatchAllPDGID); };
85 
88  virtual void set_geometry(ICaloGeometry *geo);
89 
93  virtual unsigned int size() const { return 0; };
94 
98  virtual const TFCSParametrizationBase *
99  operator[](unsigned int /*ind*/) const {
100  return nullptr;
101  };
102 
106  virtual TFCSParametrizationBase *operator[](unsigned int /*ind*/) {
107  return nullptr;
108  };
109 
113  virtual void set_daughter(unsigned int /*ind*/,
114  TFCSParametrizationBase * /*param*/){};
115 
119  virtual bool operator==(const TFCSParametrizationBase &ref) const {
120  return compare(ref);
121  };
122 
124  virtual FCSReturnCode simulate(TFCSSimulationState &simulstate,
125  const TFCSTruthState *truth,
126  const TFCSExtrapolationState *extrapol) const;
127 
130  virtual void CleanAuxInfo(TFCSSimulationState & /*simulstate*/) const {};
131 
133  void Print(Option_t *option = "") const;
134 
135 
136  struct Duplicate_t {
138  std::vector<TFCSParametrizationBase *> mother;
139  std::vector<unsigned int> index;
140  };
141  typedef std::map<TFCSParametrizationBase *, Duplicate_t> FindDuplicates_t;
142  typedef std::map<std::string, FindDuplicates_t> FindDuplicateClasses_t;
144  void RemoveDuplicates();
145  void RemoveNameTitle();
146 
147 #ifdef USE_GPU
148  // will not compile by default
149  void Copy2GPU(); // copy all the paramterization files to GPU
150 #endif
151 
152 protected:
153  static constexpr double init_Ekin_nominal = 0;
154  static constexpr double init_Ekin_min = 0;
155  static constexpr double init_Ekin_max = 14000000;
156  static constexpr double init_eta_nominal = 0;
157  static constexpr double init_eta_min = -100;
158  static constexpr double init_eta_max = 100;
159 
160 
161  bool compare(const TFCSParametrizationBase &ref) const;
162 
163 #if defined(__FastCaloSimStandAlone__)
164 public:
167  using MLogging::setLevel;
168  virtual void setLevel(int level, bool recursive) {
169  this->setLevel(level);
170  if (recursive)
171  for (unsigned int i = 0; i < size(); ++i)
172  (*this)[i]->setLevel(level, recursive);
173  }
174 #endif
175 
176 private:
177 
178  ClassDef(TFCSParametrizationBase, 3) // TFCSParametrizationBase
179 };
180 
181 #endif // End header guards
TFCSParametrizationBase::set_daughter
virtual void set_daughter(unsigned int, TFCSParametrizationBase *)
Some derived classes have daughter instances of TFCSParametrizationBase objects The set_daughter meth...
Definition: TFCSParametrizationBase.h:113
FCSReturnCode
FCSReturnCode
Base class for all FastCaloSim parametrizations Functionality in derivde classes is provided through ...
Definition: TFCSParametrizationBase.h:41
ISF_FCS::MLogging
Cut down AthMessaging.
Definition: MLogging.h:176
TFCSParametrizationBase::init_Ekin_max
static constexpr double init_Ekin_max
Do not persistify!
Definition: TFCSParametrizationBase.h:155
TFCSParametrizationBase::compare
bool compare(const TFCSParametrizationBase &ref) const
Do not persistify!
Definition: TFCSParametrizationBase.cxx:42
TFCSParametrizationBase::init_eta_nominal
static constexpr double init_eta_nominal
Do not persistify!
Definition: TFCSParametrizationBase.h:156
TFCSParametrizationBase::init_Ekin_min
static constexpr double init_Ekin_min
Do not persistify!
Definition: TFCSParametrizationBase.h:154
TFCSParametrizationBase::is_match_Ekin
virtual bool is_match_Ekin(float) const
Definition: TFCSParametrizationBase.h:60
TFCSParametrizationBase::is_match_all_pdgid
virtual bool is_match_all_pdgid() const
Definition: TFCSParametrizationBase.h:66
TFCSParametrizationBase::init_eta_min
static constexpr double init_eta_min
Do not persistify!
Definition: TFCSParametrizationBase.h:157
TFCSParametrizationBase::eta_nominal
virtual double eta_nominal() const
Definition: TFCSParametrizationBase.h:79
ISF_FCS::MLogging::level
MSG::Level level() const
Retrieve output level.
Definition: MLogging.h:201
TFCSParametrizationBase::operator==
virtual bool operator==(const TFCSParametrizationBase &ref) const
The == operator compares the content of instances.
Definition: TFCSParametrizationBase.h:119
TFCSParametrizationBase::is_match_calosample
virtual bool is_match_calosample(int) const
Definition: TFCSParametrizationBase.h:64
TFCSParametrizationBase::FindDuplicates
void FindDuplicates(FindDuplicateClasses_t &dup)
Definition: TFCSParametrizationBase.cxx:90
TFCSParametrizationBase::Ekin_nominal
virtual double Ekin_nominal() const
Definition: TFCSParametrizationBase.h:76
TFCSParametrizationBase::simulate
virtual FCSReturnCode simulate(TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const
Method in all derived classes to do some simulation.
Definition: TFCSParametrizationBase.cxx:32
TFCSParametrizationBase::init_eta_max
static constexpr double init_eta_max
Do not persistify!
Definition: TFCSParametrizationBase.h:158
TFCSExtrapolationState
Definition: TFCSExtrapolationState.h:13
RunActsMaterialValidation.extrapol
extrapol
Definition: RunActsMaterialValidation.py:90
TFCSParametrizationBase::is_match_all_Ekin
virtual bool is_match_all_Ekin() const
Definition: TFCSParametrizationBase.h:67
empty
bool empty(TH1 *h)
Definition: computils.cxx:294
FCSRetry
@ FCSRetry
Definition: TFCSParametrizationBase.h:41
TFCSParametrizationBase::is_match_eta
virtual bool is_match_eta(float) const
Definition: TFCSParametrizationBase.h:61
pool::DbPrintLvl::setLevel
void setLevel(MsgLevel l)
Definition: DbPrint.h:32
TFCSParametrizationBase
Definition: TFCSParametrizationBase.h:46
TFCSParametrizationBase::is_match_pdgid
virtual bool is_match_pdgid(int) const
Definition: TFCSParametrizationBase.h:57
TFCSParametrizationBase::CleanAuxInfo
virtual void CleanAuxInfo(TFCSSimulationState &) const
Method in all derived classes to delete objects stored in the simulstate AuxInfo.
Definition: TFCSParametrizationBase.h:130
TFCSParametrizationBase::Ekin_max
virtual double Ekin_max() const
Definition: TFCSParametrizationBase.h:78
lumiFormat.i
int i
Definition: lumiFormat.py:85
TFCSParametrizationBase::operator[]
virtual TFCSParametrizationBase * operator[](unsigned int)
Some derived classes have daughter instances of TFCSParametrizationBase objects The size() and operat...
Definition: TFCSParametrizationBase.h:106
TFCSParametrizationBase::pdgid
virtual const std::set< int > & pdgid() const
Definition: TFCSParametrizationBase.h:72
ICaloGeometry
Definition: ICaloGeometry.h:14
TFCSParametrizationBase::eta_min
virtual double eta_min() const
Definition: TFCSParametrizationBase.h:80
TFCSParametrizationBase::FindDuplicateClasses_t
std::map< std::string, FindDuplicates_t > FindDuplicateClasses_t
Definition: TFCSParametrizationBase.h:142
TFCSParametrizationBase::eta_max
virtual double eta_max() const
Definition: TFCSParametrizationBase.h:81
covarianceTool.title
title
Definition: covarianceTool.py:542
TFCSParametrizationBase::set_geometry
virtual void set_geometry(ICaloGeometry *geo)
Method to set the geometry access pointer.
Definition: TFCSParametrizationBase.cxx:24
TFCSParametrizationBase::Duplicate_t
Definition: TFCSParametrizationBase.h:136
TFCSParametrizationBase::Print
void Print(Option_t *option="") const
Print object information.
Definition: TFCSParametrizationBase.cxx:52
TFCSParametrizationBase::Duplicate_t::replace
TFCSParametrizationBase * replace
Definition: TFCSParametrizationBase.h:137
TFCSParametrizationBase::FindDuplicates_t
std::map< TFCSParametrizationBase *, Duplicate_t > FindDuplicates_t
Definition: TFCSParametrizationBase.h:141
TFCSParametrizationBase::set_match_all_pdgid
virtual void set_match_all_pdgid()
Definition: TFCSParametrizationBase.h:83
FCSFatal
@ FCSFatal
Definition: TFCSParametrizationBase.h:41
TFCSParametrizationBase::is_match_all_calosample
virtual bool is_match_all_calosample() const
Definition: TFCSParametrizationBase.h:70
TFCSParametrizationBase::operator[]
virtual const TFCSParametrizationBase * operator[](unsigned int) const
Some derived classes have daughter instances of TFCSParametrizationBase objects The size() and operat...
Definition: TFCSParametrizationBase.h:99
FCSSuccess
@ FCSSuccess
Definition: TFCSParametrizationBase.h:41
TFCSParametrizationBase::RemoveNameTitle
void RemoveNameTitle()
Definition: TFCSParametrizationBase.cxx:200
TFCSParametrizationBase::Ekin_min
virtual double Ekin_min() const
Definition: TFCSParametrizationBase.h:77
TFCSParametrizationBase::RemoveDuplicates
void RemoveDuplicates()
Definition: TFCSParametrizationBase.cxx:142
TFCSParametrizationBase::is_match_all_eta
virtual bool is_match_all_eta() const
Definition: TFCSParametrizationBase.h:68
TFCSParametrizationBase::reset_match_all_pdgid
virtual void reset_match_all_pdgid()
Definition: TFCSParametrizationBase.h:84
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ISF_FCS::MLogging::setLevel
virtual void setLevel(MSG::Level lvl)
Update outputlevel.
Definition: MLogging.cxx:105
TFCSParametrizationBase::init_Ekin_nominal
static constexpr double init_Ekin_nominal
Definition: TFCSParametrizationBase.h:153
TFCSParametrizationBase::is_match_all_Ekin_bin
virtual bool is_match_all_Ekin_bin() const
Definition: TFCSParametrizationBase.h:69
ref
const boost::regex ref(r_ef)
LArCellConditions.geo
bool geo
Definition: LArCellConditions.py:46
TFCSParametrizationBase::Duplicate_t::mother
std::vector< TFCSParametrizationBase * > mother
Definition: TFCSParametrizationBase.h:138
TFCSParametrizationBase::TFCSParametrizationBase
TFCSParametrizationBase(const char *name=nullptr, const char *title=nullptr)
Definition: TFCSParametrizationBase.cxx:20
generateReferenceFile.recursive
recursive
Definition: generateReferenceFile.py:12
TFCSParametrizationBase::kMatchAllPDGID
@ kMatchAllPDGID
Set this bit in the TObject bit field if valid for all PDGID.
Definition: TFCSParametrizationBase.h:53
checker_macros.h
Define macros for attributes used to control the static checker.
TFCSParametrizationBase::FCSStatusBits
FCSStatusBits
Status bit for FCS needs.
Definition: TFCSParametrizationBase.h:52
TFCSTruthState
Definition: TFCSTruthState.h:13
MLogging.h
TFCSParametrizationBase::size
virtual unsigned int size() const
Some derived classes have daughter instances of TFCSParametrizationBase objects The size() and operat...
Definition: TFCSParametrizationBase.h:93
TFCSSimulationState
Definition: TFCSSimulationState.h:32
TFCSParametrizationBase::Duplicate_t::index
std::vector< unsigned int > index
Definition: TFCSParametrizationBase.h:139
TFCSParametrizationBase::is_match_Ekin_bin
virtual bool is_match_Ekin_bin(int) const
Definition: TFCSParametrizationBase.h:63