All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
TupleObj.cpp
Go to the documentation of this file.
1 // ============================================================================
2 // Include files
3 // ============================================================================
4 // STD & STL
5 // ============================================================================
6 #include <cstdarg>
7 #include <algorithm>
8 #include <map>
9 // ============================================================================
10 // GaudiKernel
11 // ============================================================================
12 #include "GaudiKernel/GaudiException.h"
13 // ============================================================================
14 // GaudiAlg
15 // ============================================================================
16 #include "GaudiAlg/Tuples.h"
17 #include "GaudiAlg/TupleObj.h"
18 // ============================================================================
19 // Boost
20 // ============================================================================
21 #include "boost/integer_traits.hpp"
22 // ============================================================================
30 // ============================================================================
31 
32 namespace {
33 
34  template <typename T> struct tuple_type_ ;
35 
36  template <> struct tuple_type_<typename Tuples::TupleObj::Float>
37  { static constexpr const char* fmt = "F";
38  static constexpr const char* typ = "floats"; };
39  template <> struct tuple_type_<typename Tuples::TupleObj::Double>
40  { static constexpr const char* fmt = "D";
41  static constexpr const char* typ = "doubles"; };
42  template <> struct tuple_type_<typename Tuples::TupleObj::Bool>
43  { static constexpr const char* fmt = "I";
44  static constexpr const char* typ = "bools";};
45  template <> struct tuple_type_<typename Tuples::TupleObj::Char>
46  { static constexpr const char* fmt = "I";
47  static constexpr const char* typ = "chars";};
48  template <> struct tuple_type_<typename Tuples::TupleObj::UChar>
49  { static constexpr const char* fmt = "I";
50  static constexpr const char* typ = "uchars";};
51  template <> struct tuple_type_<typename Tuples::TupleObj::Short>
52  { static constexpr const char* fmt = "I";
53  static constexpr const char* typ = "shorts";};
54  template <> struct tuple_type_<typename Tuples::TupleObj::UShort>
55  { static constexpr const char* fmt = "I";
56  static constexpr const char* typ = "ushorts";};
57  template <> struct tuple_type_<typename Tuples::TupleObj::Int>
58  { static constexpr const char* fmt = "I";
59  static constexpr const char* typ = "ints";};
60  template <> struct tuple_type_<typename Tuples::TupleObj::UInt>
61  { static constexpr const char* fmt = "I";
62  static constexpr const char* typ = "uints";};
63  template <> struct tuple_type_<typename Tuples::TupleObj::LongLong>
64  { static constexpr const char* fmt = "ULL";
65  static constexpr const char* typ = "longlongs";};
66  template <> struct tuple_type_<typename Tuples::TupleObj::ULongLong>
67  { static constexpr const char* fmt = "ULL";
68  static constexpr const char* typ = "ulonglongs";};
69  template <> struct tuple_type_<typename Tuples::TupleObj::Address>
70  { static constexpr const char* fmt = "IOpaqueAddress*" ;
71  static constexpr const char* typ = "addresses";};
72  template <> struct tuple_type_<typename Tuples::TupleObj::FArray>
73  { static constexpr const char* fmt = "FArray";
74  static constexpr const char* typ = "farray";};
75  template <> struct tuple_type_<typename Tuples::TupleObj::FMatrix>
76  { static constexpr const char* fmt = "FMatrix";
77  static constexpr const char* typ = "fmatrix"; };
78 
79  // helper function to simplify things...
80  template <typename C, typename AddItem>
81  typename C::mapped_type::pointer create_(Tuples::TupleObj* parent, C& container, const std::string& name, AddItem addItem ) {
82  using element_t = typename C::mapped_type::element_type;
83  using map_t = struct tuple_type_<element_t> ;
84  auto item = container.emplace( name , std::unique_ptr<element_t>{new element_t()} ) ;
85  if (!item.second)
86  { parent->Error ( std::string{map_t::typ} + " ('" + name + "'): item is not inserted" ) ; }
87  StatusCode sc = addItem( name , *(item.first->second) );
88  if ( sc.isFailure() )
89  { parent->Error ( std::string{map_t::typ} + " ('" + name + "'): item is not added", sc ) ; }
90  if ( !parent->addItem(name,map_t::fmt) )
91  { parent->Error ( std::string{map_t::typ} + " ('" + name + "'): item is not unique" ) ; }
92  return item.first->second.get() ;
93  }
94 }
95 namespace Tuples
96 {
97  namespace Local
98  {
99  class Counter final
100  {
101  public:
102  // constructor
103  Counter ( std::string msg = " Misbalance ")
104  : m_message ( std::move(msg) )
105  {}
106  // destructor
107  ~Counter() { report(); }
108  // make the increment
109  long increment ( const std::string& object ) { return ++m_map[object]; }
110  // make the decrement
111  long decrement ( const std::string& object ) { return --m_map[object]; }
112  // current count
113  long counts ( const std::string& object ) const { return m_map.at(object); }
114  // make a report
115  void report() const
116  {
117  for ( auto& entry : m_map )
118  {
119  if( entry.second != 0 ) std::cout
120  << "Tuples::TupleObj WARNING " << m_message
121  << "'" << entry.first << "' Counts = " << entry.second
122  << std::endl ;
123  }
124  };
125 
126  private:
127  std::map<std::string,long> m_map;
128  std::string m_message ;
129  };
130 
136  static Counter s_InstanceCounter{ " Create/Destroy (mis)balance " };
137 
138  }
139 }
140 // ============================================================================
141 // Standard constructor
142 // ============================================================================
144 ( std::string name ,
145  NTuple::Tuple* tuple ,
146  const CLID& clid ,
147  const Tuples::Type type )
148 //
149  : m_name ( std::move(name) )
150  , m_tuple ( tuple )
151  , m_clid ( clid )
152  , m_type ( type )
153 {
154  // make counts
155  Tuples::Local::s_InstanceCounter.increment ( m_name ) ;
156 }
157 // ============================================================================
158 // destructor
159 // ============================================================================
161 {
162  // make counts
163  Tuples::Local::s_InstanceCounter.decrement ( m_name ) ;
164 }
165 // ============================================================================
166 // release the reference to TupleObj
167 // if reference counter becomes zero,
168 // object will be automatically deleted
169 // ============================================================================
171 {
172  // decrease the reference counter
173  if( refCount() > 0 ) { --m_refCount; }
174  // check references -- delete if needed
175  if( 0 == refCount() ) delete this;
176 }
177 // ============================================================================
178 // write a record to NTuple
179 // ============================================================================
181 {
182  if ( invalid() ) { return InvalidTuple ; }
183  return tuple()->write() ;
184 }
185 // ============================================================================
186 namespace
187 {
192  std::vector<std::string> tokenize( const std::string& value ,
193  const std::string& separators = " " )
194  {
195  std::vector<std::string> tokens;
196  auto it1 = value.begin() ;
197  auto it2 = value.begin() ;
198  while( value.end() != it1 && value.end() != it2 )
199  {
200  it2 = std::find_first_of( it1 ,
201  value.end () ,
202  separators.begin () ,
203  separators.end () ) ;
204  if( it2 != it1 ) {
205  tokens.emplace_back( value , it1 - value.begin() , it2 - it1 ) ;
206  it1 = it2 ;
207  }
208  else { ++it1 ; }
209  }
210  return tokens;
211  }
212 }
213 // ============================================================================
215 {
216  // check the underlying tuple
217  if ( invalid() ) { return InvalidTuple ; }
218  // decode format string into tokens
219  auto tokens = tokenize( format , " ,;" );
221  va_list valist ;
222  va_start( valist , format ) ;
223  // loop over all tokens
225  for( auto token = tokens.cbegin() ;
226  tokens.cend() != token && status.isSuccess() ; ++token )
227  {
228  double val = va_arg( valist , double );
229  status = column( *token , val );
230  if( status.isFailure() )
231  { Error ( "fill(): Can not add column '" + *token + "' " ) ; }
232  }
233  // mandatory !!!
234  va_end( valist );
235  //
236  return status ;
237 }
238 
239 // ============================================================================
240 // put IOpaqueAddress in NTuple (has sense only for Event tag collection Ntuples)
241 // ============================================================================
243 ( const std::string& name ,
244  IOpaqueAddress* address )
245 {
246  if ( !evtColType () ) { return InvalidOperation ; }
247  if ( !address )
248  { return Error ( "column('" + name +
249  "') IOpaqueAddress* is NULL!" , InvalidObject ) ; }
250  return column_<IOpaqueAddress*,&Tuples::TupleObj::addresses>(name, address);
251 }
252 
253 // ============================================================================
254 // put IOpaqueAddress in NTuple (has sense only for Event tag collection Ntuples)
255 // ============================================================================
257 ( IOpaqueAddress* address )
258 {
259  return column ( "Address" , address ) ;
260 }
261 
262 // ============================================================================
263 StatusCode Tuples::TupleObj::column ( const std::string& name ,
264  float value )
265 {
266  return column_<float,&Tuples::TupleObj::floats>(name,value);
267 }
268 // ============================================================================
269 StatusCode Tuples::TupleObj::column ( const std::string& name ,
270  double value )
271 {
272  return column_<double,&Tuples::TupleObj::doubles>(name,value);
273 }
274 // ============================================================================
275 StatusCode Tuples::TupleObj::column ( const std::string& name ,
276  char value )
277 {
278  return column_<char,&Tuples::TupleObj::chars>(name,value);
279 }
280 // ============================================================================
281 StatusCode Tuples::TupleObj::column ( const std::string& name ,
282  char value ,
283  char minv ,
284  char maxv )
285 {
286  return column_<char,&Tuples::TupleObj::chars>(name,value,minv,maxv);
287 }
288 // ============================================================================
289 StatusCode Tuples::TupleObj::column ( const std::string& name ,
290  unsigned char value )
291 {
292  return column_<unsigned char,&Tuples::TupleObj::uchars>(name,value);
293 }
294 // ============================================================================
295 StatusCode Tuples::TupleObj::column ( const std::string& name ,
296  unsigned char value ,
297  unsigned char minv ,
298  unsigned char maxv )
299 {
300  return column_<unsigned char,&Tuples::TupleObj::uchars>(name,value,minv,maxv);
301 }
302 // ============================================================================
303 StatusCode Tuples::TupleObj::column ( const std::string& name ,
304  short value )
305 {
306  return column_<short,&Tuples::TupleObj::shorts>(name,value);
307 }
308 // ============================================================================
309 StatusCode Tuples::TupleObj::column ( const std::string& name ,
310  const short value ,
311  const short minv ,
312  const short maxv )
313 {
314  return column_<short,&Tuples::TupleObj::shorts>(name,value,minv,maxv);
315 }
316 // ============================================================================
317 StatusCode Tuples::TupleObj::column ( const std::string& name ,
318  const unsigned short value )
319 {
320  return column_<unsigned short,&Tuples::TupleObj::ushorts>( name, value );
321 }
322 // ============================================================================
323 StatusCode Tuples::TupleObj::column ( const std::string& name ,
324  unsigned short value ,
325  unsigned short minv ,
326  unsigned short maxv )
327 {
328  return column_<unsigned short,&Tuples::TupleObj::ushorts>( name, value, minv, maxv );
329 }
330 // ============================================================================
331 StatusCode Tuples::TupleObj::column ( const std::string& name ,
332  int value )
333 {
334  return column_<int,&Tuples::TupleObj::ints>( name, value );
335 }
336 // ============================================================================
337 StatusCode Tuples::TupleObj::column ( const std::string& name ,
338  int value ,
339  int minv ,
340  int maxv )
341 {
342  return column_<int,&Tuples::TupleObj::ints>(name,value,minv,maxv);
343 }
344 // ============================================================================
345 StatusCode Tuples::TupleObj::column ( const std::string& name ,
346  unsigned int value )
347 {
348  return column_<unsigned int,&Tuples::TupleObj::uints>(name,value);
349 }
350 // ============================================================================
351 StatusCode Tuples::TupleObj::column ( const std::string& name ,
352  unsigned int value ,
353  unsigned int minv ,
354  unsigned int maxv )
355 {
356  return column_<unsigned int, &Tuples::TupleObj::uints>(name,value,minv,maxv);
357 }
358 // ============================================================================
359 StatusCode Tuples::TupleObj::column ( const std::string& name ,
360  const long value )
361 {
362  Warning( "'long' has different sizes on 32/64 bit systems. Casting '" +
363  name + "' to 'long long'", StatusCode::SUCCESS ).ignore();
364  return column( name, (long long)value );
365 }
366 // ============================================================================
367 StatusCode Tuples::TupleObj::column ( const std::string& name ,
368  const long value ,
369  const long minv ,
370  const long maxv )
371 {
372  Warning( "'long' has different sizes on 32/64 bit systems. Casting '" +
373  name + "' to 'long long'", StatusCode::SUCCESS ).ignore();
374  return column( name,
375  (long long)value,
376  (long long)minv,
377  (long long)maxv );
378 }
379 // ============================================================================
380 StatusCode Tuples::TupleObj::column ( const std::string& name ,
381  const unsigned long value )
382 {
383  Warning( "'unsigned long' has different sizes on 32/64 bit systems. Casting '" +
384  name + "' to 'unsigned long long'", StatusCode::SUCCESS ).ignore();
385  return column( name, (unsigned long long)value );
386 }
387 // ============================================================================
388 StatusCode Tuples::TupleObj::column ( const std::string& name ,
389  const unsigned long value ,
390  const unsigned long minv ,
391  const unsigned long maxv )
392 {
393  Warning( "'unsigned long' has different sizes on 32/64 bit systems. Casting '" +
394  name + "' to 'unsigned long long'", StatusCode::SUCCESS ).ignore();
395  return column( name,
396  (unsigned long long)value,
397  (unsigned long long)minv,
398  (unsigned long long)maxv );
399 }
400 // ============================================================================
401 StatusCode Tuples::TupleObj::column ( const std::string& name ,
402  const long long value )
403 {
404  return column_<long long,&Tuples::TupleObj::longlongs>(name,value);
405 }
406 // ============================================================================
407 StatusCode Tuples::TupleObj::column ( const std::string& name ,
408  long long value ,
409  long long minv ,
410  long long maxv )
411 {
412  return column_<long long,&Tuples::TupleObj::longlongs>(name,value,minv,maxv);
413 }
414 // ============================================================================
415 StatusCode Tuples::TupleObj::column ( const std::string& name ,
416  unsigned long long value )
417 {
418  return column_<unsigned long long,&Tuples::TupleObj::ulonglongs>(name,value);
419 }
420 // ============================================================================
421 StatusCode Tuples::TupleObj::column ( const std::string& name ,
422  unsigned long long value ,
423  unsigned long long minv ,
424  unsigned long long maxv )
425 {
426  return column_<unsigned long long,&Tuples::TupleObj::ulonglongs>(name,value,minv,maxv);
427 }
428 // ============================================================================
429 StatusCode Tuples::TupleObj::column ( const std::string& name ,
430  bool value )
431 {
432  return column_<bool,&Tuples::TupleObj::bools>(name,value);
433 }
434 // ============================================================================
436 ( const std::string& name )
437 {
438  auto found = m_floats.find( name ) ;
439  if ( m_floats.end() != found ) { return found->second.get() ; }
440  return create_(this, m_floats,name,
441  [&](const std::string& n, Float& i)
442  { return this->tuple()->addItem(n,i); });
443 }
444 // ============================================================================
446 ( const std::string& name )
447 {
448  auto found = m_doubles.find( name ) ;
449  if ( m_doubles.end() != found ) { return found->second.get() ; }
450  return create_(this, m_doubles,name,
451  [&](const std::string& n, Double& i)
452  { return this->tuple()->addItem(n,i); });
453 }
454 // ============================================================================
456 ( const std::string& name )
457 {
458  auto found = m_bools.find( name ) ;
459  if( m_bools.end() != found ) { return found->second.get() ; }
460  return create_(this, m_bools, name,
461  [&](const std::string& n, Bool& i)
462  { return this->tuple()->addItem(n,i); });
463 }
464 // ============================================================================
466 ( const std::string& name )
467 {
468  auto found = m_chars.find( name ) ;
469  if( m_chars.end() != found ) { return found->second.get() ; }
470  return create_(this, m_chars, name,
471  [&](const std::string& n, Char& i)
472  { return this->tuple()->addItem(n,i); });
473 }
474 // ============================================================================
476 ( const std::string& name , char minv , char maxv )
477 {
478  auto found = m_chars.find( name ) ;
479  return ( found != m_chars.end() ) ? found->second.get()
480  : create_(this, m_chars, name,
481  [&](const std::string& n, Char& i)
482  { return this->tuple()->addItem(n,i,minv,maxv); });
483 }
484 // ============================================================================
486 ( const std::string& name )
487 {
488  auto found = m_uchars.find( name ) ;
489  return ( found != m_uchars.end() ) ? found->second.get()
490  : create_(this, m_uchars, name,
491  [&](const std::string& n, UChar& i)
492  { return this->tuple()->addItem(n,i); });
493 }
494 // ============================================================================
496 ( const std::string& name , unsigned char minv , unsigned char maxv )
497 {
498  auto found = m_uchars.find( name ) ;
499  return ( found != m_uchars.end() ) ? found->second.get()
500  : create_(this, m_uchars, name,
501  [&](const std::string& n, UChar& i)
502  { return this->tuple()->addItem(n,i,minv,maxv); });
503 }
504 // ============================================================================
506 ( const std::string& name )
507 {
508  auto found = m_shorts.find( name ) ;
509  if( m_shorts.end() != found ) { return found->second.get() ; }
510  return create_(this, m_shorts, name,
511  [&](const std::string& n, Short& i)
512  { return this->tuple()->addItem(n,i); });
513 }
514 // ============================================================================
516 ( const std::string& name ,
517  const short minv ,
518  const short maxv )
519 {
520  auto found = m_shorts.find( name ) ;
521  if( m_shorts.end() != found ) { return found->second.get(); }
522  return create_(this, m_shorts, name,
523  [&](const std::string& n, Short& i)
524  { return this->tuple()->addItem(n,i,minv,maxv); });
525 }
526 // ============================================================================
528 ( const std::string& name )
529 {
530  auto found = m_ushorts.find( name ) ;
531  if( m_ushorts.end() != found ) { return found->second.get() ; }
532  return create_(this, m_ushorts, name,
533  [&](const std::string& n, UShort& i)
534  { return this->tuple()->addItem(n,i); });
535 }
536 // ============================================================================
538 ( const std::string& name ,
539  const unsigned short minv ,
540  const unsigned short maxv )
541 {
542  auto found = m_ushorts.find( name ) ;
543  if( m_ushorts.end() != found ) { return found->second.get() ; }
544  return create_(this, m_ushorts, name,
545  [&](const std::string& n, UShort& i)
546  { return this->tuple()->addItem(n,i,minv,maxv); });
547 }
548 // ============================================================================
550 ( const std::string& name )
551 {
552  auto found = m_ints.find( name ) ;
553  if( m_ints.end() != found ) { return found->second.get() ; }
554  return create_(this, m_ints, name,
555  [&](const std::string& n, Int& i)
556  { return this->tuple()->addItem(n,i); });
557 }
558 // ============================================================================
560 ( const std::string& name ,
561  const int minv ,
562  const int maxv )
563 {
564  auto found = m_ints.find( name ) ;
565  if( m_ints.end() != found ) { return found->second.get() ; }
566  return create_(this, m_ints, name,
567  [&](const std::string& n, Int& i)
568  { return this->tuple()->addItem(n,i,minv,maxv); });
569 }
570 // ============================================================================
572 ( const std::string& name )
573 {
574  auto found = m_uints.find( name ) ;
575  if( m_uints.end() != found ) { return found->second.get() ; }
576  return create_(this, m_uints, name,
577  [&](const std::string& n, UInt& i)
578  { return this->tuple()->addItem(n,i); });
579 }
580 // ============================================================================
582 ( const std::string& name ,
583  const unsigned int minv ,
584  const unsigned int maxv )
585 {
586  auto found = m_uints.find( name ) ;
587  if( m_uints.end() != found ) { return found->second.get() ; }
588  return create_(this, m_uints, name,
589  [&](const std::string& n, UInt& i)
590  { return this->tuple()->addItem(n,i,minv,maxv); });
591 }
592 // ============================================================================
594 ( const std::string& name )
595 {
596  auto found = m_longlongs.find( name ) ;
597  if( m_longlongs.end() != found ) { return found->second.get() ; }
598  return create_(this, m_longlongs, name,
599  [&](const std::string& n, LongLong& i)
600  { return this->tuple()->addItem(n,i); });
601 }
602 // ============================================================================
604 ( const std::string& name ,
605  const long long minv ,
606  const long long maxv )
607 {
608  auto found = m_longlongs.find( name ) ;
609  if( m_longlongs.end() != found ) { return found->second.get() ; }
610  return create_(this, m_longlongs, name,
611  [&](const std::string& n, LongLong& i)
612  { return this->tuple()->addItem(n,i,minv,maxv); });
613 }
614 // ============================================================================
616 ( const std::string& name )
617 {
618  auto found = m_ulonglongs.find( name ) ;
619  if( m_ulonglongs.end() != found ) { return found->second.get() ; }
620  return create_(this, m_ulonglongs, name,
621  [&](const std::string& n, ULongLong& i)
622  { return this->tuple()->addItem(n,i); });
623 }
624 // ============================================================================
626 ( const std::string& name ,
627  const unsigned long long minv ,
628  const unsigned long long maxv )
629 {
630  auto found = m_ulonglongs.find( name ) ;
631  if( m_ulonglongs.end() != found ) { return found->second.get() ; }
632  return create_(this, m_ulonglongs, name,
633  [&](const std::string& n, ULongLong& i)
634  { return this->tuple()->addItem(n,i,minv,maxv); });
635 }
636 // ============================================================================
638 ( const std::string& name )
639 {
640  auto found = m_addresses.find( name ) ;
641  if( m_addresses.end() != found ) { return found->second.get() ; }
642  return create_(this, m_addresses, name,
643  [&](const std::string& n, Address& i)
644  { return this->tuple()->addItem(n,i); });
645 }
646 // ============================================================================
647 // retrieve (book on demand) array-items for ntuple
648 // ============================================================================
650 ( const std::string& name ,
651  Tuples::TupleObj::Int* length )
652 {
653  // existing array ?
654  auto found = m_farrays.find( name ) ;
655  if( m_farrays.end() != found ) { return found->second.get() ; }
656  return create_(this, m_farrays, name,
657  [&](const std::string& n, FArray& i)
658  { return this->tuple()->addIndexedItem(n,*length,i); });
659 }
660 // ============================================================================
661 // retrieve (book on demand) array-items for ntuple (fixed)
662 // ============================================================================
664 ( const std::string& name ,
665  const Tuples::TupleObj::MIndex& rows )
666 {
667  // existing array ?
668  auto found = m_arraysf.find( name ) ;
669  if( m_arraysf.end() != found ) { return found->second.get() ; }
670  return create_(this, m_arraysf, name,
671  [&](const std::string& n, FArray& i)
672  { return this->tuple()->addItem(n,rows,i); });
673 }
674 // ============================================================================
675 // retrieve (book on demand) matrix-items for ntuple
676 // ============================================================================
679 ( const std::string& name ,
680  Tuples::TupleObj::Int* length ,
681  const Tuples::TupleObj::MIndex& cols )
682 {
683  // existing array ?
684  auto found = m_fmatrices.find( name ) ;
685  if( m_fmatrices.end() != found ) { return found->second.get() ; }
686  return create_(this, m_fmatrices, name,
687  [&](const std::string& n, FMatrix& i)
688  { return this->tuple()->addIndexedItem(n,*length,cols,i); });
689 }
690 // ============================================================================
691 // retrieve (book on demand) matrix-items for ntuple (fixed)
692 // ============================================================================
695 ( const std::string& name ,
696  const Tuples::TupleObj::MIndex& rows ,
697  const Tuples::TupleObj::MIndex& cols )
698 {
699  // existing array ?
700  auto found = m_matricesf.find( name ) ;
701  if( m_matricesf.end() != found ) { return found->second.get() ; }
702  return create_(this, m_matricesf, name,
703  [&](const std::string& n, FMatrix& i)
704  { return this->tuple()->addItem(n,rows,cols,i); });
705 }
706 // ============================================================================
707 // The END
708 // ============================================================================
virtual StatusCode write()=0
Write record of the NTuple (Shortcut of writeRecord)
Address * addresses(const std::string &name)
get the column
Definition: TupleObj.cpp:638
void release()
release the reference to TupleObj if reference counter becomes zero, object will be automatically del...
Definition: TupleObj.cpp:170
long decrement(const std::string &object)
Definition: TupleObj.cpp:111
Float * floats(const std::string &name)
get the column
Definition: TupleObj.cpp:436
long counts(const std::string &object) const
Definition: TupleObj.cpp:113
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:44
StatusCode fill(const char *format...)
Set the values for several columns simultaneously.
Definition: TupleObj.cpp:214
void report() const
Definition: TupleObj.cpp:115
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
StatusCode column(const std::string &name, float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:263
Bool * bools(const std::string &name)
get the column
Definition: TupleObj.cpp:456
TupleObj()=delete
delete the default/copy constructor and assignment
STL namespace.
UShort * ushorts(const std::string &name)
get the column
Definition: TupleObj.cpp:528
unsigned short MIndex
Definition: TupleObj.h:243
std::map< std::string, long > m_map
Definition: TupleObj.cpp:124
UChar * uchars(const std::string &name)
get the column
Definition: TupleObj.cpp:486
std::string m_name
name
Definition: TupleObj.h:2230
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
UInt * uints(const std::string &name)
get the column
Definition: TupleObj.cpp:572
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.
Definition: NTuple.h:743
Counter(std::string msg=" Misbalance ")
Definition: TupleObj.cpp:103
ULongLong * ulonglongs(const std::string &name)
get the column
Definition: TupleObj.cpp:616
bool addItem(std::string name, std::string type)
add the item name into the list of known items
Definition: TupleObj.h:2039
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
A simple wrapper class over standard Gaudi NTuple::Tuple facility.
Definition: TupleObj.h:196
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode write()
write a record to NTuple
Definition: TupleObj.cpp:180
Specialization acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:297
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:370
virtual ~TupleObj()
destructor is protected
Definition: TupleObj.cpp:160
FArray * fArray(const std::string &name, Int *item)
get the column
Definition: TupleObj.cpp:650
Short * shorts(const std::string &name)
get the column
Definition: TupleObj.cpp:506
Char * chars(const std::string &name)
get the column
Definition: TupleObj.cpp:466
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:554
FMatrix * fMatrix(const std::string &name, Int *item, const MIndex &cols)
get the column
Definition: TupleObj.cpp:679
Double * doubles(const std::string &name)
get the column
Definition: TupleObj.cpp:446
Int * ints(const std::string &name)
get the column
Definition: TupleObj.cpp:550
Opaque address interface definition.
void ignore() const
Definition: StatusCode.h:108
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:42
std::string m_message
Definition: TupleObj.cpp:128
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:43
list i
Definition: ana.py:128
Type
the list of available types for ntuples
Definition: TupleObj.h:79
long increment(const std::string &object)
Definition: TupleObj.cpp:109
string type
Definition: gaudirun.py:151
LongLong * longlongs(const std::string &name)
get the column
Definition: TupleObj.cpp:594
General namespace for Tuple properties.
Definition: Maps.h:34