Loading [MathJax]/extensions/tex2jax.js
Go to the documentation of this file.
25 class NTupleDirectory;
84 static TYP
min() {
return std::numeric_limits<TYP>::min(); }
86 static TYP
max() {
return std::numeric_limits<TYP>::max(); }
93 Range(
const bool ,
const bool ) {}
99 bool lower()
const {
return false; }
105 static bool min() {
return false; }
107 static bool max() {
return true; }
125 TYP* m_buffer =
nullptr;
142 static _Item* create(
INTuple* tup,
const std::string&
name,
const std::type_info& info, TYP min, TYP max,
147 *this->m_buffer = copy.
get();
151 void set(
const TYP& item ) { *this->m_buffer = item; }
153 virtual TYP
get()
const {
return *this->m_buffer; }
159 class GAUDI_API _Array :
virtual public _Data<TYP> {
162 static _Array* create(
INTuple* tup,
const std::string&
name,
const std::type_info& info,
const std::string&
index,
163 long len, TYP min, TYP max, TYP def );
167 long len = this->length();
168 if ( len == copy.length() ) {
169 const T* source = (
const T*)copy.buffer();
170 std::copy_n( source, len, this->m_buffer );
173 throw std::out_of_range(
"N-tuple matrix cannot be copied! The index range does not match!" );
177 const TYP&
data(
long i )
const {
return this->m_buffer[i]; }
179 TYP&
data(
long i ) {
return this->m_buffer[i]; }
181 TYP*
begin() {
return this->m_buffer; }
182 TYP*
end() {
return this->m_buffer + this->length(); }
188 class GAUDI_API _Matrix :
virtual public _Data<TYP> {
195 static _Matrix* create(
INTuple* tup,
const std::string&
name,
const std::type_info& info,
const std::string&
index,
196 long ncol,
long nrow, TYP min, TYP max, TYP def );
200 long len = this->length();
201 if ( len == copy.length() ) {
202 const T* source = (
const T*)copy.buffer();
203 std::copy_n( source, len, this->m_buffer );
206 throw std::out_of_range(
"N-tuple matrix cannot be copied! The index range does not match!" );
210 TYP*
column(
long i ) {
return this->m_buffer + i * m_rows; }
212 const TYP*
column(
long i )
const {
return this->m_buffer + i * m_rows; }
239 operator const void*()
const {
return m_ptr; }
251 class Item :
virtual public _Accessor<_Item<TYP>> {
258 operator const TYP()
const {
return this->m_ptr->get(); }
262 const TYP
operator*()
const {
return this->m_ptr->get(); }
270 this->m_ptr->set( data );
276 this->m_ptr->set( data->get() );
280 this->m_ptr->set( this->m_ptr->get() + data );
284 this->m_ptr->set( this->m_ptr->get() - data );
288 this->m_ptr->set( this->m_ptr->get() * data );
292 this->m_ptr->set( this->m_ptr->get() / data );
307 operator bool()
const {
return this->m_ptr->get(); }
310 this->m_ptr->set( data );
316 this->m_ptr->set( data->get() );
324 class Array :
virtual public _Accessor<_Array<TYP>> {
331 *( this->m_ptr ) = *( copy.operator->() );
337 return this->m_ptr->data( i );
342 return this->m_ptr->data( i );
345 TYP*
begin() {
return this->m_ptr->begin(); }
346 TYP*
end() {
return this->m_ptr->end(); }
352 class Matrix :
virtual public _Accessor<_Matrix<TYP>> {
359 *( this->m_ptr ) = *( copy.operator->() );
365 return this->m_ptr->column( i );
370 return this->m_ptr->column( i );
384 template <
class TYPE>
388 }
catch ( ... ) { result =
nullptr; }
392 template <
class TYPE>
397 }
catch ( ... ) { result =
nullptr; }
404 }
catch ( ... ) { result =
nullptr; }
408 template <
class TYPE>
412 }
catch ( ... ) { result =
nullptr; }
416 template <
class TYPE>
420 }
catch ( ... ) { result =
nullptr; }
424 template <
class TYPE>
435 template <
class TYPE>
444 template <
class TYPE>
453 template <
class TYPE>
463 template <
class TYPE>
468 template <
class TYPE>
473 template <
class TYPE>
478 template <
class TYPE>
483 template <
class TYPE>
489 template <
class TYPE>
507 template <
class TYPE>
510 return i_addItem(
name, 1,
"", _R::min(), _R::max(), itm.m_ptr );
521 template <
class TYPE>
536 return i_addItem(
name, 1,
"", _R::min(), _R::max(), itm.m_ptr );
556 template <
class TYPE,
class RANGE>
558 return i_addItem(
name, 1,
"", TYPE( low ), TYPE( high ), itm.m_ptr );
574 template <
class TYPE>
598 template <
class TYPE,
class RANGE>
633 template <
class TYPE,
class INDEX,
class RANGE>
664 template <
class TYPE,
class INDEX,
class RANGE>
694 template <
class TYPE,
class INDEX>
719 template <
class TYPE,
class INDEX>
742 template <
class TYPE>
769 template <
class TYPE,
class RANGE>
772 return i_addItem(
name, cols, rows,
"", TYPE( low ), TYPE( high ), result.m_ptr );
800 template <
class TYPE,
class INDEX>
826 template <
class TYPE,
class INDEX>
864 template <
class TYPE,
class INDEX,
class RANGE>
867 return i_addItem(
name,
index->range().distance(), rows,
index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
897 template <
class TYPE,
class INDEX,
class RANGE>
899 const RANGE low,
const RANGE high ) {
900 return i_addItem(
name,
index->range().distance(), rows,
index->name(), TYPE( low ), TYPE( high ), matrix.m_ptr );
973 #ifndef ALLOW_ALL_TYPES
1014 return s << T( obj );
StatusCode addIndexedItem(const std::string &name, Item< INDEX > &index, Array< TYPE > &array, const RANGE low, const RANGE high)
Add an indexed Array of data to a column wise N tuple with a range.
virtual const ItemRange & range() const =0
Access the range if specified.
_Array< TYP > & operator=(const _Array< T > ©)
Assignment operator.
Range(const bool, const bool)
Standard constructor.
Item & operator=(const bool data)
Assignment operator.
const Range< TYP > & range() const
Access the range.
KeyedObjectManager< array > Array
Forward declaration of specialized redirection array object manager.
const std::string & name() const
Retreive DataObject name. It is the name when registered in the store.
Small class representing an N tuple file in the transient store.
Item()=default
Standard Constructor.
TYP & operator[](const T i)
Array operator.
StatusCode i_item(const std::string &name, _Item< IOpaqueAddress * > *&result) const
Locate a _Column of data to the N tuple type safe.
TYP * m_ptr
Pointer to instance.
bool lower() const
Lower boundary of range.
virtual INTupleItem * i_find(const std::string &name) const =0
Internally used by abstract classes.
void setLogicalName(std::string l)
Small class representing an N tuple directory in the transient store.
StatusCode i_addObject(const std::string &name, _Item< TYPE * > *&result, const std::type_info &)
StatusCode i_item(const std::string &name, _Array< TYPE > *&result) const
Locate a _Array of data to the N tuple type safe.
File(long type, std::string name, std::string logName)
Standard constructor.
virtual ~Range()=default
Destructor.
_Accessor()=default
Standard Constructor.
StatusCode i_addItem(const std::string &name, long dim1, long dim2, const std::string &index, TYPE low, TYPE high, _Matrix< TYPE > *&result)
Add a _Item of data to the N tuple.
const CLID & clID() const override
class ID of the object
std::ostream & operator<<(std::ostream &s, const Item< T > &obj)
StatusCode i_addItem(const std::string &name, long dim, const std::string &index, TYPE low, TYPE high, _Array< TYPE > *&result)
Add a _Item of data to the N tuple.
Item()=default
Standard Constructor.
StatusCode addItem(const std::string &name, Item< IOpaqueAddress * > &itm)
Add an address object item to an N tuple: specialized call.
Class acting as a smart pointer holding a N tuple entry.
const TYP * operator[](const T i) const
Array operator.
TYP * operator[](const T i)
Array operator.
Abstract class describing a column in a N tuple.
const TYP & data(long i) const
Access to data by reference (CONST)
virtual TYP get() const
Access to data by reference (CONST)
Array & operator=(const Array< T > ©)
Assignment operator.
const TYP * column(long i) const
Access to data by reference (CONST)
std::string m_name
Physical file name.
static const CLID & classID()
class ID of the object
SmartDataPtr< NTuple::Directory > NTupleDirPtr
bool m_isOpen
Flag to indicate wether the file was opened already.
StatusCode i_item(const std::string &name, _Item< TYPE * > *&result) const
Locate a _Column of data to the N tuple type unsafe for objects.
TYP lower() const
Lower boundary of range.
Matrix & operator=(const Matrix< T > ©)
Assignment operator.
StatusCode item(const std::string &name, Item< TYPE > &result)
Locate a scalar Item of data to the N tuple type safe.
StatusCode item(const std::string &name, Matrix< TYPE > &result)
Locate a Matrix of data to the N tuple type safe.
TYP & data(long i)
Access to data by reference (CONST)
bool distance() const
Distance between lower and upper range.
const std::string & logicalName() const
Item< TYP > & operator-=(const TYP data)
_Accessor(const _Accessor &)=default
Default copy constructor.
Abstract class describing basic data in an Ntuple.
_Matrix< TYP > & operator=(const _Matrix< T > ©)
Assignment operator.
SmartDataPtr< NTuple::Tuple > NTuplePtr
static const CLID & classID()
class ID of the object
long m_rows
Number of rows per column.
const TYP & operator[](const T i) const
Array operator.
void setType(const long typ)
Set access type.
long type() const
Return access type.
Item & operator=(const Item< T > &data)
Assignment operator.
Item< TYP > & operator*=(const TYP data)
Item< TYP > & operator/=(const TYP data)
virtual void setDefault(const TYP d)=0
Set default value.
void set(const TYP &item)
Access to data by reference.
static bool max()
Maximal number of data.
Range(const Range< bool > &)
Copy constructor.
TYP * operator->()
Dereference operator.
StatusCode addIndexedItem(const std::string &name, Item< INDEX > &index, Array< TYPE > &array)
Add an indexed Array of data to a column wise N tuple.
StatusCode addItem(const std::string &name, Item< TYPE * > &itm)
Add an simple object item to an N tuple.
StatusCode i_addItem(const std::string &name, long, const std::string &, TYPE low, TYPE high, _Item< TYPE > *&result)
Add a _Item of data to the N tuple.
const TYP * operator->() const
Dereference operator (CONST)
StatusCode addItem(const std::string &name, Item< INDEX > &index, Matrix< TYPE > &matrix, long rows, const RANGE low, const RANGE high)
Add an variable size Matrix of data to a column wise N tuple.
StatusCode i_item(const std::string &name, _Item< TYPE > *&result) const
Locate a _Column of data to the N tuple type safe.
unsigned int CLID
Class ID definition.
TYP distance() const
Distance between lower and upper range.
virtual StatusCode add(INTupleItem *item)=0
Add an item row to the N tuple.
StatusCode addItem(const std::string &name, long cols, long rows, Matrix< TYPE > &matrix)
Add an fixed size Matrix of data to a column wise N tuple.
SmartDataPtr< NTuple::File > NTupleFilePtr
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Range(const Range< TYP > ©)
Copy constructor.
StatusCode addItem(const std::string &name, Item< TYPE > &itm, const RANGE low, const RANGE high)
Add a scalar data item a N tuple with a range.
TYP upper() const
Upper boundary of range.
Range & operator=(const Range< TYP > ©)
Adjust ranges.
virtual ~Range()=default
Destructor.
static TYP max()
Maximal number of data.
Abstract class describing a column-array in a N tuple.
StatusCode item(const std::string &name, const Item< TYPE > &result) const
Locate a scalar Item of data to the N tuple type safe (CONST)
Class acting as a smart pointer holding a N tuple _Item.
const TYP operator*() const
Dereference operator for pointers(CONST)
constexpr static const auto SUCCESS
Abstract class describing a matrix column in a N tuple.
StatusCode addItem(const std::string &name, Item< INDEX > &index, Array< TYPE > &array)
Add an indexed Array of data to a column wise N tuple.
virtual ~_Accessor()=default
Standard Destructor.
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
void setName(std::string nam)
Set access type.
A small class used to access easily (and efficiently) data items residing in data stores.
Abstract base class which allows the user to interact with the actual N tuple implementation.
static bool min()
Minimal number of data.
const std::string & name() const
Retrun physical file name.
StatusCode addItem(const std::string &name, Item< INDEX > &index, Matrix< TYPE > &matrix, long rows)
Add an variable size Matrix of data to a column wise N tuple.
Item & operator=(const Item< T > &data)
Assignment operator.
StatusCode addIndexedItem(const std::string &name, Item< INDEX > &index, long rows, Matrix< TYPE > &matrix, const RANGE low, const RANGE high)
Add an variable size Matrix of data to a column wise N tuple.
virtual ~Matrix()=default
_Accessor< TYP > & operator=(const _Accessor< TYP > &)=delete
Needs to be implemented in derived classes.
StatusCode item(const std::string &name, const Array< TYPE > &result) const
Locate a Array of data to the N tuple type safe (CONST)
std::vector< Row > Matrix
void setOpen(bool flag)
Set "open" flag.
bool isOpen() const
Access "open" flag.
Item< TYP > & operator+=(const TYP data)
_Item< TYP > & operator=(const _Item< T > ©)
Assignment operator.
Matrix()=default
Standard Constructor.
StatusCode addItem(const std::string &name, long cols, long rows, Matrix< TYPE > &result, const RANGE low, const RANGE high)
Add an fixed size Matrix of data to a column wise N tuple.
bool operator!() const
Check if column is present.
Specialization acting as a smart pointer holding a N tuple _Item.
constexpr static const auto FAILURE
StatusCode item(const std::string &name, const Matrix< TYPE > &result) const
Locate a Matrix of data to the N tuple type safe (CONST)
StatusCode addItem(const std::string &name, long dim, Array< TYPE > &array)
Add an fixed-size Array of data to a column wise N tuple.
Range(TYP low, TYP upper)
Standard constructor.
TYP m_upper
Upper boundary of range.
TYP m_lower
Lower boundary of range.
StatusCode addItem(const std::string &name, long dim, Array< TYPE > &array, const RANGE low, const RANGE high)
Add an fixed-size Array of data to a column wise N tuple with a range.
Item & operator=(const TYP data)
Assignment operator.
const CLID & clID() const override
class ID of the object
Class acting as a smart pointer holding a N tuple _Item.
StatusCode addItem(const std::string &name, Item< INDEX > &index, Array< TYPE > &array, const RANGE low, const RANGE high)
Add an indexed Array of data to a column wise N tuple with a range.
TYP * column(long i)
Access to data by reference.
Range< TYP > ItemRange
Set type definition to make life more easy easy.
virtual const CLID & clID() const
Retrieve reference to class definition structure.
Array()=default
Standard Constructor.
static TYP min()
Minimal number of data.
TYP operator*()
Dereference operator for pointers.
bool upper() const
Upper boundary of range.
size_t index(const Gaudi::ParticleProperty *property, const Gaudi::Interfaces::IParticlePropertySvc *service)
helper utility for mapping of Gaudi::ParticleProperty object into non-negative integral sequential id...
StatusCode item(const std::string &name, Array< TYPE > &result)
Locate a Array of data to the N tuple type safe.
Class acting as a smart pointer holding a N tuple _Item.
StatusCode i_item(const std::string &name, _Matrix< TYPE > *&result) const
Locate a _Matrix of data to the N tuple type safe.
std::string m_logName
Logical file name.
StatusCode addIndexedItem(const std::string &name, Item< INDEX > &col_index, long rows, Matrix< TYPE > &matrix)
Add an variable size Matrix of data to a column wise N tuple.