ATLAS Offline Software
Loading...
Searching...
No Matches
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
28namespace Ringer {
29
34template<>
35class 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
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
132 IRingerProcedureWrapper(){;}
133
134};
135
139typedef IRingerProcedureWrapper< Discrimination::IDiscriminator >
141
145typedef IDiscrWrapper::WrapperCollection IDiscrWrapperCollection;
146
151template < 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(
167 (std::is_base_of<VariableDependency,procedure_t>::value),
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):
208 m_discrCol(discrDepCol),
209 m_discr(nullptr),
210 m_rsRawConfCol(nullptr),
211 m_nRings(0)
212 {
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 {
230 }
231
232
235#ifndef RINGER_STANDALONE
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
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;
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 {
301 }
302
306 void setExtraDescriptionPatterns( const Ringer::ExtraDescriptionPatterns &extraPat )
307 {
309 }
310
315
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
414
424 ExtraDescriptionPatterns m_extraDescriptionPatterns;
426 procedure_t *m_discr;
427
428#ifndef RINGER_STANDALONE
433 unsigned m_nRings;
434#endif
436
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
virtual void setRawConfCol(const xAOD::RingSetConf::RawConfCollection *crRawConfCol) final override
Other utilities:
virtual void setMsgStream(MsgStream *msg) const override
Overloads the setMsgStream from RedirectMsgStream.
virtual SegmentationType getSegType() const override final
Get segmentation type for this pre-processor.
std::vector< std::vector< Ringer::PreProcessing::Norm::ExtraPatternsNorm * > > ExtraPatternsNormCollection
Extra patterns normalization vector.
void checkDiscrCol() const
Check if discriminators interface collection is in good status (Throws otherwise)
virtual void getRawConfCol(const xAOD::RingSetConf::RawConfCollection *&crRawConfCol) const override final
Get the holden CaloRings raw configuration collection.
virtual bool empty() const override
Returns whether holden interface collection is empty.
void setExtraDescriptionPatterns(const Ringer::ExtraDescriptionPatterns &extraPat)
Get extra description patterns being used.
virtual void execute(const DepVarStruct &depVar, const xAOD::CaloRings *clrings, const TrackPatternsHolder *trackPat, std::vector< float > &output) const override final
Main methods:
ExtraDescriptionPatterns m_extraDescriptionPatterns
contains a pointer into the CaloRings configuration
static RingerProcedureWrapper * read(TDirectory *configDir, unsigned version)
Read collection from TDirectory.
virtual bool hasPP() const override
Returns whether it has pre-processing Collection Wrapper.
std::vector< std::vector< std::vector< procedure_t * > > > DiscrDepProcCollection
RingerProcedureWrapper for Discrimination procedures typedefs:
void checkExtraPatNorm() const
Check if exra pattern is in good status (Throws otherwise)
virtual const Ringer::ExtraDescriptionPatterns & getExtraDescriptionPatterns() const override final
Get extra description patterns being used.
void setExtraDescriptionNorms(const ExtraPatternsNormCollection &extraNorms)
Get extra description patterns being used.
ExtraPatternsNormCollection m_extraDescriptionNorms
Hold the normalization to be used by each bin to the extra patterns.
void write(TDirectory *baseDir, const char *idxStr="") const override final
Write collection to TDirectory.
virtual void execute(const DepVarStruct &depVar, const std::vector< float > &input, std::vector< float > &output) const override final
void print(MSG::Level lvl=MSG::DEBUG) const override final
Print wrapper content.
ExtraPatternsNormCollection & getExtraDescriptionNorms()
Get extra description patterns being used.
RingerProcedureWrapper(const IPreProcWrapperCollection &ppCol, const DiscrDepProcCollection &discrDepCol)
Build RProc Wrapper with all functionallities.
const xAOD::RingSetConf::RawConfCollection * m_rsRawConfCol
contains a pointer into the CaloRings configuration
std::vector< RawConf > RawConfCollection
typedef The raw configuration structure data holder
static unsigned totalNumberOfRings(const RawConfCollection &clRingsConf)
Get the totalNumber of Rings contained in this configuration:
Definition MsgLevel.h:28
Namespace dedicated for Ringer utilities.
EtaDependency
Specify eta position dependency.
IPreProcWrapper::WrapperCollection IPreProcWrapperCollection
Facilitate access into Threshold Wrappers collection.
EtDependency
Specify et position dependency.
SegmentationType
the possible procedure longitudinal segmentation types.
IDiscrWrapper::WrapperCollection IDiscrWrapperCollection
Facilitate access into Discrimination Wrappers.
IRingerProcedureWrapper< Discrimination::IDiscriminator > IDiscrWrapper
Facilitate access into Discrimination Wrappers.
STL namespace.
CaloRings_v1 CaloRings
Definition of the current "CaloRings version".
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)
#define DEBUG
Definition page_access.h:11
MsgStream & msg
Definition testRead.cxx:32
#define private