ATLAS Offline Software
RingerDiscriminatorWrapper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id: RingerDiscriminatorWrapper.h 713527 2015-12-09 08:58:16Z wsfreund $
6 #ifndef RINGERSELECTORTOOLS_PROCEDURES_RINGERDISCRIMINATIONWRAPPER_H
7 #define RINGERSELECTORTOOLS_PROCEDURES_RINGERDISCRIMINATIONWRAPPER_H
8 
9 #define RINGER_PROCEDURE_INCLUDE
11 #undef RINGER_PROCEDURE_INCLUDE
12 
13 //#undef NDEBUG
14 
15 #define RINGER_DISCRIMINATOR_WRAPPER_INCLUDE
16 // We are also dependent on the PreProcessorWrapper, but we want only to define
17 // the collection for now:
19 #undef RINGER_DISCRIMINATOR_WRAPPER_INCLUDE
20 
22 #include "RingerSelectorTools/ExtraDescriptionPatterns.h"
23 #include <type_traits>
24 
28 namespace Ringer {
29 
34 template<>
35 class IRingerProcedureWrapper< Discrimination::IDiscriminator > :
36  virtual public IRedirectMsgStream,
37  virtual public IRingerProcedureWrapperBase
38 {
39  public:
43  typedef typename std::vector< IRingerProcedureWrapper* > WrapperCollection;
44 
47 #ifndef RINGER_STANDALONE
48 
57  virtual void execute(
58  const DepVarStruct &depVar,
59  const xAOD::CaloRings *clrings,
60  const TrackPatternsHolder *trackPat,
61  std::vector<float> &output) const = 0;
62 
66  virtual void setRawConfCol(
67  const xAOD::RingSetConf::RawConfCollection *crRawConfCol) = 0;
68 
72  virtual void getRawConfCol(
73  const xAOD::RingSetConf::RawConfCollection *&crRawConfCol) const = 0;
74 
78  virtual SegmentationType getSegType() const = 0;
79 
83  virtual const Ringer::ExtraDescriptionPatterns& getExtraDescriptionPatterns() const = 0;
84 
85 #endif
86 
97  virtual void execute(
98  const DepVarStruct &depVar,
99  const std::vector<float> &input,
100  std::vector<float> &output) const = 0;
102 
106  virtual const char* name() const final override {
107  return wrapName;
108  }
109 
110  static constexpr const char* wrapName = "RingerDiscriminatorWrapper";
111 
115  virtual bool hasPP() const = 0;
116 
120  static void writeCol(const WrapperCollection &discrWrapperCol,
121  const char *fileName);
122 
127  static void read(WrapperCollection &discrWrapperCol,
128  const char* fileName);
129 
130  protected:
131 
133 
134 };
135 
139 typedef IRingerProcedureWrapper< Discrimination::IDiscriminator >
141 
146 
151 template < class procedure_t,
152  /*EtaDependency*/int etaDependency,
153  /*EtDependency*/int etDependency,
154  /*SegmentationType*/int segType>
156  procedure_t,
157  etaDependency,
158  etDependency,
159  segType,
160  false, // isPreProcessor
161  true, // isDiscriminator
162  false> : // isThreshold
163  public IDiscrWrapper,
164  public RedirectMsgStream
165 {
166  static_assert(
168  "RingerProcedureWrapper procedure_t type must have IVariableDependecy inheritance.");
169  public:
172 
175  //typedef typename RingerProcedureWrapper::template
176  // IRingerProcedureWrapper< Discrimination::IDiscriminator >
177  // wrapper_t;
178 
185  typedef typename std::vector<
186  std::vector <
187  std::vector < procedure_t* > >
189 
195  typedef typename std::vector<
196  std::vector< Ringer::PreProcessing::Norm::ExtraPatternsNorm* >
199 
202 
206  const DiscrDepProcCollection &discrDepCol):
207  m_ppWrapperCol(IPreProcWrapperCollection(0)),
208  m_discrCol(discrDepCol),
209  m_discr(nullptr),
210  m_rsRawConfCol(nullptr),
211  m_nRings(0)
212  {
213  checkDiscrCol();
214  }
215 
220  const IPreProcWrapperCollection &ppCol,
221  const DiscrDepProcCollection &discrDepCol):
222  m_ppWrapperCol(ppCol),
223  m_discrCol(discrDepCol),
224  m_discr(nullptr),
225  m_rsRawConfCol(nullptr),
226  m_nRings(0)
227  {
228  checkPPWrapperCol();
229  checkDiscrCol();
230  }
232 
235 #ifndef RINGER_STANDALONE
236 
245  virtual void execute(
246  const DepVarStruct &depVar,
247  const xAOD::CaloRings *clrings,
248  const TrackPatternsHolder *trackPat,
249  std::vector<float> &output) const override final;
250 #endif
251 
262  virtual void execute(
263  const DepVarStruct &depVar,
264  const std::vector<float> &input,
265  std::vector<float> &output) const override final;
267 
270 #ifndef RINGER_STANDALONE
271 
274  virtual void setRawConfCol(
275  const xAOD::RingSetConf::RawConfCollection *crRawConfCol)
276  final override
277  {
278  for ( auto &ppWrapper : m_ppWrapperCol ) {
279  ppWrapper->setRawConfCol( crRawConfCol );
280  }
281  m_rsRawConfCol = crRawConfCol;
282  m_nRings = xAOD::RingSetConf::totalNumberOfRings( *crRawConfCol );
283  }
284 
288  virtual void getRawConfCol(
289  const xAOD::RingSetConf::RawConfCollection *&crRawConfCol) const override final
290  {
291  crRawConfCol = m_rsRawConfCol;
292  }
293 #endif
294 
298  virtual const Ringer::ExtraDescriptionPatterns& getExtraDescriptionPatterns() const override final
299  {
300  return m_extraDescriptionPatterns;
301  }
302 
306  void setExtraDescriptionPatterns( const Ringer::ExtraDescriptionPatterns &extraPat )
307  {
308  m_extraDescriptionPatterns = extraPat;
309  }
310 
314  ExtraPatternsNormCollection& getExtraDescriptionNorms() { return m_extraDescriptionNorms; }
315 
320  m_extraDescriptionNorms = extraNorms;
321  checkExtraPatNorm();
322  }
323 
327  virtual SegmentationType getSegType() const override final
328  {
329  return static_cast<SegmentationType>(segType);
330  }
331 
335  virtual bool empty() const override { return m_discrCol.empty();}
336 
340  virtual bool hasPP() const override { return !m_ppWrapperCol.empty();}
341 
345  virtual void setMsgStream(MsgStream *msg) const override;
346 
350  void write(TDirectory *baseDir, const char *idxStr = "") const override final;
351 
355  EtaDependency etaDep() const override final
356  {
357  return static_cast<EtaDependency>(etaDependency);
358  }
359 
363  EtDependency etDep() const override final
364  {
365  return static_cast<EtDependency>(etDependency);
366  }
367 
371  void releaseMemory() override final;
372 
376  static std::string staticFullName();
377 
381  void print(MSG::Level lvl = MSG::DEBUG) const override final;
382 
386  std::string fullName() const override final;
387 
391  static RingerProcedureWrapper* read(TDirectory *configDir,
392  unsigned version);
394 
395  private:
398 
402  void checkPPWrapperCol() const;
407  void checkExtraPatNorm() const;
412  void checkDiscrCol() const;
414 
422  ExtraPatternsNormCollection m_extraDescriptionNorms;
424  ExtraDescriptionPatterns m_extraDescriptionPatterns;
426  procedure_t *m_discr;
427 
428 #ifndef RINGER_STANDALONE
429  const xAOD::RingSetConf::RawConfCollection *m_rsRawConfCol;
433  unsigned m_nRings;
434 #endif
435 
437 };
438 
439 } // namespace Ringer
440 
441 #endif // RINGERSELECTORTOOLS_PROCEDURES_RINGERDISCRIMINATIONWRAPPER_H
442 
443 #ifndef INCLUDE_HEADER_ONLY // Use to avoid circular includes
445 #endif // INCLUDE_HEADER_ONLY
read
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)
Definition: openCoraCool.cxx:569
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::getSegType
virtual SegmentationType getSegType() const override final
Get segmentation type for this pre-processor.
Definition: RingerDiscriminatorWrapper.h:327
Ringer::IRingerProcedureWrapper< Discrimination::IDiscriminator >::execute
virtual void execute(const DepVarStruct &depVar, const xAOD::CaloRings *clrings, const TrackPatternsHolder *trackPat, std::vector< float > &output) const =0
Main methods:
xAOD::RingSetConf_v1::RawConfCollection
std::vector< RawConf > RawConfCollection
typedef The raw configuration structure data holder
Definition: RingSetConf_v1.h:124
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::empty
virtual bool empty() const override
Returns whether holden interface collection is empty.
Definition: RingerDiscriminatorWrapper.h:335
RingerProcedureWrapper.h
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::getExtraDescriptionPatterns
virtual const Ringer::ExtraDescriptionPatterns & getExtraDescriptionPatterns() const override final
Get extra description patterns being used.
Definition: RingerDiscriminatorWrapper.h:298
Ringer::IRingerProcedureWrapper< Discrimination::IDiscriminator >::read
static void read(WrapperCollection &discrWrapperCol, const char *fileName)
Read all discriminator on file at the path and append them to IPreProcWrapperCollection.
Ringer::IRingerProcedureWrapper< Discrimination::IDiscriminator >::IRingerProcedureWrapper
IRingerProcedureWrapper()
Definition: RingerDiscriminatorWrapper.h:132
WriteCellNoiseToCool.fullName
fullName
Definition: WriteCellNoiseToCool.py:461
Ringer::IDiscrWrapper
IRingerProcedureWrapper< Discrimination::IDiscriminator > IDiscrWrapper
Facilitate access into Discrimination Wrappers.
Definition: RingerDiscriminatorWrapper.h:140
Ringer::IRingerProcedureWrapper< Discrimination::IDiscriminator >::setRawConfCol
virtual void setRawConfCol(const xAOD::RingSetConf::RawConfCollection *crRawConfCol)=0
Set the holden CaloRings raw configuration collection.
Ringer::IRingerProcedureWrapper< Discrimination::IDiscriminator >::WrapperCollection
std::vector< IRingerProcedureWrapper * > WrapperCollection
Collection type of Discriminators Wrappers.
Definition: RingerDiscriminatorWrapper.h:43
Ringer::IRingerProcedureWrapper< Discrimination::IDiscriminator >
Definition: RingerDiscriminatorWrapper.h:38
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::setExtraDescriptionPatterns
void setExtraDescriptionPatterns(const Ringer::ExtraDescriptionPatterns &extraPat)
Get extra description patterns being used.
Definition: RingerDiscriminatorWrapper.h:306
Normalizations.h
athena.value
value
Definition: athena.py:124
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::DiscrDepProcCollection
std::vector< std::vector< std::vector< procedure_t * > > > DiscrDepProcCollection
RingerProcedureWrapper for Discrimination procedures typedefs:
Definition: RingerDiscriminatorWrapper.h:168
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::execute
virtual void execute(const DepVarStruct &depVar, const std::vector< float > &input, std::vector< float > &output) const override final
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
Ringer::SegmentationType
SegmentationType
the possible procedure longitudinal segmentation types.
Definition: RingerSelectorToolsEnums.h:64
Ringer::IPreProcWrapperCollection
IPreProcWrapper::WrapperCollection IPreProcWrapperCollection
Facilitate access into Threshold Wrappers collection.
Definition: RingerPreProcessorWrapper.h:118
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::RingerProcedureWrapper
RingerProcedureWrapper(const DiscrDepProcCollection &discrDepCol)
Ctors:
Definition: RingerDiscriminatorWrapper.h:205
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::ExtraPatternsNormCollection
std::vector< std::vector< Ringer::PreProcessing::Norm::ExtraPatternsNorm * > > ExtraPatternsNormCollection
Extra patterns normalization vector.
Definition: RingerDiscriminatorWrapper.h:197
RingerPreProcessorWrapper.h
Ringer::IRingerProcedureWrapper< Discrimination::IDiscriminator >::execute
virtual void execute(const DepVarStruct &depVar, const std::vector< float > &input, std::vector< float > &output) const =0
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::m_nRings
unsigned m_nRings
contains the total number of rings in the vectorized representation
Definition: RingerDiscriminatorWrapper.h:433
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::execute
virtual void execute(const DepVarStruct &depVar, const xAOD::CaloRings *clrings, const TrackPatternsHolder *trackPat, std::vector< float > &output) const override final
Main methods:
Ringer::EtDependency
EtDependency
Specify et position dependency.
Definition: RingerSelectorToolsEnums.h:95
MSG
Definition: MsgLevel.h:28
Ringer::IRingerProcedureWrapper< Discrimination::IDiscriminator >::name
virtual const char * name() const final override
Returns this wrapper name.
Definition: RingerDiscriminatorWrapper.h:106
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
xAOD::CaloRings_v1
Class summarizing the particle interaction throughout the Calorimeter (its shower shape).
Definition: CaloRings_v1.h:51
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::getRawConfCol
virtual void getRawConfCol(const xAOD::RingSetConf::RawConfCollection *&crRawConfCol) const override final
Get the holden CaloRings raw configuration collection.
Definition: RingerDiscriminatorWrapper.h:288
Ringer::IDiscrWrapperCollection
IDiscrWrapper::WrapperCollection IDiscrWrapperCollection
Facilitate access into Discrimination Wrappers.
Definition: RingerDiscriminatorWrapper.h:145
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::setMsgStream
virtual void setMsgStream(MsgStream *msg) const override
Overloads the setMsgStream from RedirectMsgStream.
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::RingerProcedureWrapper
RingerProcedureWrapper(const IPreProcWrapperCollection &ppCol, const DiscrDepProcCollection &discrDepCol)
Build RProc Wrapper with all functionallities.
Definition: RingerDiscriminatorWrapper.h:219
RingerDiscriminatorWrapper.icc
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::setExtraDescriptionNorms
void setExtraDescriptionNorms(const ExtraPatternsNormCollection &extraNorms)
Get extra description patterns being used.
Definition: RingerDiscriminatorWrapper.h:319
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::etDep
EtDependency etDep() const override final
Returns et dependecy for this wrapper.
Definition: RingerDiscriminatorWrapper.h:363
merge.output
output
Definition: merge.py:17
Ringer::IRingerProcedureWrapper< Discrimination::IDiscriminator >::getExtraDescriptionPatterns
virtual const Ringer::ExtraDescriptionPatterns & getExtraDescriptionPatterns() const =0
Get extra description patterns being used.
Ringer::IRingerProcedureWrapper< Discrimination::IDiscriminator >::getSegType
virtual SegmentationType getSegType() const =0
Get segmentation type for this pre-processing.
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
Ringer::EtaDependency
EtaDependency
Specify eta position dependency.
Definition: RingerSelectorToolsEnums.h:81
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::hasPP
virtual bool hasPP() const override
Returns whether it has pre-processing Collection Wrapper.
Definition: RingerDiscriminatorWrapper.h:340
Ringer::IRingerProcedureWrapper< Discrimination::IDiscriminator >::hasPP
virtual bool hasPP() const =0
Returns whether it has Pre-Processing Collection Wrapper.
get_generator_info.version
version
Definition: get_generator_info.py:33
Ringer::IRingerProcedureWrapperBase
Used as base for all IRingerProcedureWrapper template specializations.
Definition: RingerProcedureWrapper.h:74
DEBUG
#define DEBUG
Definition: page_access.h:11
Ringer::IRingerProcedureWrapper< Discrimination::IDiscriminator >::writeCol
static void writeCol(const WrapperCollection &discrWrapperCol, const char *fileName)
Write all wrappers on discrWrapperCol to TDirectory.
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::releaseMemory
void releaseMemory() override final
Release all holden pointer memory.
Ringer::DepVarStruct
Definition: VariableDependency.h:32
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::getExtraDescriptionNorms
ExtraPatternsNormCollection & getExtraDescriptionNorms()
Get extra description patterns being used.
Definition: RingerDiscriminatorWrapper.h:314
Ringer::IRingerProcedureWrapper< Discrimination::IDiscriminator >::getRawConfCol
virtual void getRawConfCol(const xAOD::RingSetConf::RawConfCollection *&crRawConfCol) const =0
Get the holden CaloRings raw configuration collection.
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::write
void write(TDirectory *baseDir, const char *idxStr="") const override final
Write collection to TDirectory.
Ringer::RingerProcedureWrapper
Specialization for Discriminator procedure.
Definition: RingerProcedureWrapper.h:171
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
xAOD::RingSetConf_v1::totalNumberOfRings
static unsigned totalNumberOfRings(const RawConfCollection &clRingsConf)
Get the totalNumber of Rings contained in this configuration:
Definition: RingSetConf_v1.cxx:227
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
Ringer::RingerProcedureWrapper< procedure_t, etaDependency, etDependency, segType, false, true, false >::setRawConfCol
virtual void setRawConfCol(const xAOD::RingSetConf::RawConfCollection *crRawConfCol) final override
Other utilities:
Definition: RingerDiscriminatorWrapper.h:274
Ringer::IRingerProcedureWrapper
Specialization for Discriminator procedure.
Definition: RingerProcedureWrapper.h:140
Ringer
Namespace dedicated for Ringer utilities.
Definition: CaloRingsDefs.h:9