| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

GaudiTuples.h
Go to the documentation of this file.
1 #ifndef GAUDIALG_GAUDITUPLES_H
2 #define GAUDIALG_GAUDITUPLES_H 1
3 // ============================================================================
4 /* @file GaudiTuples.h
5 *
6 * Header file for class : GaudiTuples
7 *
8 * @author Chris Jones Christopher.Rob.Jones@cern.ch
9 * @author Vanya BELYAEV Ivan.Belyaev@itep.ru
10 * @date 2005-08-08
11 */
12 // ============================================================================
13 // Include files
14 // ============================================================================
15 #include "boost/algorithm/string/replace.hpp"
16 // ============================================================================
17 // GaudiKernel
18 // ============================================================================
19 #include "GaudiKernel/ClassID.h"
20 // ============================================================================
21 // GaudiAlg
22 // ============================================================================
23 #include "GaudiAlg/Maps.h"
24 #include "GaudiAlg/Tuple.h"
25 #include "GaudiAlg/TupleObj.h"
26 // ============================================================================
35 // ============================================================================
36 template <class PBASE>
37 class GAUDI_API GaudiTuples: public PBASE
38 {
39 public:
40 // ==========================================================================
42 typedef GaudiAlg::HistoID HistoID;
44 typedef Tuples::Tuple Tuple ;
46 typedef GaudiAlg::TupleID TupleID ;
48 typedef GaudiAlg::TupleMapTitle TupleMapTitle ;
50 typedef GaudiAlg::TupleMapID TupleMapID ;
51 // ==========================================================================
52 public:
53 // ==========================================================================
85 Tuple nTuple ( const std::string& title,
86 const CLID& clid = CLID_ColumnWiseTuple ) const ;
87
126 Tuple nTuple ( const TupleID& ID ,
127 const std::string& title ,
128 const CLID& clid = CLID_ColumnWiseTuple ) const ;
129
160 Tuple evtCol ( const std::string& title ,
161 const CLID& clid = CLID_ColumnWiseTuple ) const ;
162
201 Tuple evtCol ( const TupleID& ID ,
202 const std::string& title ,
203 const CLID& clid = CLID_ColumnWiseTuple ) const ;
204 // ==========================================================================
205 public: // trivial accessors
206 // ==========================================================================
208 bool produceNTuples () const { return m_produceNTuples ; }
210 bool splitNTupleDir () const { return m_splitNTupleDir ; }
212 const std::string& nTupleLUN () const { return m_nTupleLUN ; }
214 const std::string& nTupleTopDir () const { return m_nTupleTopDir ; }
216 const std::string& nTupleDir () const { return m_nTupleDir ; }
218 TupleID::NumericID nTupleOffSet () const { return m_nTupleOffSet ; }
220 std::string nTuplePath () const;
222 bool produceEvtCols () const { return m_produceEvtCols ; }
224 bool splitEvtColDir () const { return m_splitEvtColDir ; }
226 const std::string& evtColLUN () const { return m_evtColLUN ; }
228 const std::string& evtColTopDir () const { return m_evtColTopDir ; }
230 const std::string& evtColDir () const { return m_evtColDir ; }
232 TupleID::NumericID evtColOffSet () const { return m_evtColOffSet ; }
234 std::string evtColPath () const;
236 bool tuplesPrint () const { return m_tuplesPrint ; }
238 bool evtColsPrint () const { return m_evtColsPrint ; }
239 // ==========================================================================
240 public :
241 // ==========================================================================
245 long printTuples () const ;
249 long printEvtCols () const ;
250 // ==========================================================================
251 public :
252 // ==========================================================================
254 bool nTupleExists ( const TupleID& ID ) const;
256 bool evtColExists ( const TupleID& ID ) const;
257 // ==========================================================================
258 protected:
259 // ==========================================================================
261 const TupleMapTitle& nTupleMapTitle () const { return m_nTupleMapTitle ; }
263 const TupleMapTitle& evtColMapTitle () const { return m_evtColMapTitle ; }
265 const TupleMapID& nTupleMapID () const { return m_nTupleMapID ; }
267 const TupleMapID& evtColMapID () const { return m_evtColMapID ; }
268 // ==========================================================================
269 protected:
270 // ==========================================================================
278 virtual Tuples::TupleObj*
279 createNTuple ( const std::string& name ,
280 NTuple::Tuple* tuple ,
281 const CLID& clid ) const;
289 virtual Tuples::TupleObj*
290 createEvtCol ( const std::string& name ,
291 NTuple::Tuple* tuple ,
292 const CLID& clid ) const;
293 // ==========================================================================
294 public:
295 // ==========================================================================
297 GaudiTuples ( const std::string& name,
298 ISvcLocator * pSvcLocator );
300 GaudiTuples ( const std::string& type ,
301 const std::string& name ,
302 const IInterface* parent );
304 ~GaudiTuples() override = default;
305 // ==========================================================================
306 protected:
307 // ==========================================================================
311 StatusCode initialize() override
312 #ifdef __ICC
313 { return i_gtInitialize(); }
314 StatusCode i_gtInitialize()
315 #endif
316 ;
320 StatusCode finalize() override
321 #ifdef __ICC
322 { return i_gtFinalize(); }
323 StatusCode i_gtFinalize()
324 #endif
325 ;
326 // ==========================================================================
327 private:
328 // ==========================================================================
330 inline void initGaudiTuplesConstructor()
331 {
332 m_produceNTuples = true ; // Switch ON/OFF ntuple production
333 m_splitNTupleDir = false ; // for HBOOK it is better to use 'true'
334 m_nTupleLUN = "FILE1" ; // logical unit for ntuples
335 m_nTupleTopDir = "" ; // top level ntuple directory
336 m_nTupleDir = boost::algorithm::replace_all_copy( this->name(), ":","_" ); // ntuple directory
337 m_nTupleOffSet = 0 ; // offset for ntuples
338 //
339 m_produceEvtCols = false ; // Switch ON/OFF ntupel production
340 m_splitEvtColDir = false ; // for HBOOK it is better to use 'true'
341 m_evtColLUN = "EVTCOL" ; // logical unit for ntuples
342 m_evtColTopDir = "" ; // top level ntuple directory
343 m_evtColDir = boost::algorithm::replace_all_copy( this->name(), ":", "_"); // ntuple directory
344 m_evtColOffSet = 0 ; // offset for ntuples
345 //
346 m_tuplesPrint = true ; // print tuples at end of job
347 m_evtColsPrint = false ; // print event collections at end of job
348 //
349 this -> declareProperty
350 ( "NTupleProduce" , m_produceNTuples ,
351 "General switch to enable/disable N-tuples" ) ;
352 this -> declareProperty
353 ( "NTuplePrint" , m_tuplesPrint ,
354 "Print N-tuple statistics" )
355 -> declareUpdateHandler ( &GaudiTuples<PBASE>::printNTupleHandler , this ) ;
356 this -> declareProperty
357 ( "NTupleSplitDir" , m_splitNTupleDir ,
358 "Split long directory names into short pieces (suitable for HBOOK)" ) ;
359 this -> declareProperty
360 ( "NTupleOffSet" , m_nTupleOffSet ,
361 "Offset for numerical N-tuple ID" ) ;
362 this -> declareProperty
363 ( "NTupleLUN" , m_nTupleLUN ,
364 "Logical File Unit for N-tuples" ) ;
365 this -> declareProperty
366 ( "NTupleTopDir" , m_nTupleTopDir ,
367 "Top-level directory for N-Tuples") ;
368 this -> declareProperty
369 ( "NTupleDir" , m_nTupleDir ,
370 "Subdirectory for N-Tuples" ) ;
371 // ========================================================================
372 this -> declareProperty
373 ( "EvtColsProduce" , m_produceEvtCols ,
374 "General switch to enable/disable Event Tag Collections" ) ;
375 this -> declareProperty
376 ( "EvtColsPrint" , m_evtColsPrint ,
377 "Print statistics for Event Tag Collections " )
378 -> declareUpdateHandler ( &GaudiTuples<PBASE>::printEvtColHandler , this ) ;
379 this -> declareProperty
380 ( "EvtColSplitDir" , m_splitEvtColDir ,
381 "Split long directory names into short pieces" ) ;
382 this -> declareProperty
383 ( "EvtColOffSet" , m_evtColOffSet ,
384 "Offset for numerical N-tuple ID" ) ;
385 this -> declareProperty
386 ( "EvtColLUN" , m_evtColLUN ,
387 "Logical File Unit for Event Tag Collections" ) ;
388 this -> declareProperty
389 ( "EvtColTopDir" , m_evtColTopDir ,
390 "Top-level directory for Event Tag Collections" ) ;
391 this -> declareProperty
392 ( "EvtColDir" , m_evtColDir ,
393 "Subdirectory for Event Tag Collections" ) ;
394 // ========================================================================
395 }
396 // ==========================================================================
397 private:
398 // ==========================================================================
400 void printNTupleHandler ( Property& /* theProp */ ) ; // "NTuplePrint"
402 void printEvtColHandler ( Property& /* theProp */ ) ; // "EvtcolsPrint"
403 // ==========================================================================
404 private:
405 // ==========================================================================
407 bool m_produceNTuples ;
409 bool m_splitNTupleDir ;
411 std::string m_nTupleLUN ;
413 std::string m_nTupleTopDir ;
415 std::string m_nTupleDir ;
417 TupleID::NumericID m_nTupleOffSet ;
418 // ==========================================================================
420 bool m_produceEvtCols ;
422 bool m_splitEvtColDir ;
424 std::string m_evtColLUN ;
426 std::string m_evtColTopDir ;
428 std::string m_evtColDir ;
430 TupleID::NumericID m_evtColOffSet ;
431 // ==========================================================================
433 bool m_tuplesPrint ; // print tuples at finalization?
435 bool m_evtColsPrint ; // print event collections at finalization
436 // ==========================================================================
438 mutable TupleMapTitle m_nTupleMapTitle ;
440 mutable TupleMapID m_nTupleMapID ;
441 // ==========================================================================
443 mutable TupleMapTitle m_evtColMapTitle ;
445 mutable TupleMapID m_evtColMapID ;
446 // ==========================================================================
447 };
448 // ============================================================================
449 // The END
450 // ============================================================================
451 #endif // GAUDIALG_GAUDITUPLES_H
452 // ============================================================================
ClassID.h
GaudiTuples::m_nTupleTopDir
std::string m_nTupleTopDir
top level tuple directory
Definition: GaudiTuples.h:413
AnalysisTest.initialize
def initialize()
Definition: AnalysisTest.py:12
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
GaudiTuples::m_nTupleMapTitle
TupleMapTitle m_nTupleMapTitle
the actual storage of ntuples by title
Definition: GaudiTuples.h:438
GaudiTuples::m_nTupleLUN
std::string m_nTupleLUN
name of logical unit for tuple directory
Definition: GaudiTuples.h:411
GaudiTuples
Templated base class providing common 'ntupling' methods.
Definition: GaudiTuples.h:37
GaudiTuples::splitEvtColDir
bool splitEvtColDir() const
get the flag for Event Tag Collection path split (property "EvtColsSplitDir")
Definition: GaudiTuples.h:224
GaudiTuples::evtColDir
const std::string & evtColDir() const
get the Event Tag Collection directory (property "EvtColsDir")
Definition: GaudiTuples.h:230
TupleObj.h
Header file for class TupleObj.
GaudiTuples::m_evtColMapTitle
TupleMapTitle m_evtColMapTitle
the actual storage of event collections by title
Definition: GaudiTuples.h:443
GaudiTuples::m_evtColDir
std::string m_evtColDir
local tuple directory
Definition: GaudiTuples.h:428
GaudiTuples::nTupleLUN
const std::string & nTupleLUN() const
get the logical unit for N-Tuples (property "NTupleLUN")
Definition: GaudiTuples.h:212
GaudiTuples::Tuple
Tuples::Tuple Tuple
the actual type of the tuple
Definition: GaudiTuples.h:44
GaudiTuples::TupleMapTitle
GaudiAlg::TupleMapTitle TupleMapTitle
the actual type of (title) -> (tuple) mappping
Definition: GaudiTuples.h:48
GaudiTuples::evtColTopDir
const std::string & evtColTopDir() const
get the top-level Event Tag Collection directory (property "EvtColsTopDir")
Definition: GaudiTuples.h:228
GaudiTuples::m_nTupleOffSet
TupleID::NumericID m_nTupleOffSet
the offset for ntuple numerical ID
Definition: GaudiTuples.h:417
GaudiTuples::nTupleTopDir
const std::string & nTupleTopDir() const
get the top-level N-Tuple directory (property "NTupleTopDir")
Definition: GaudiTuples.h:214
GaudiTuples::evtColsPrint
bool evtColsPrint() const
print event collections at finalization
Definition: GaudiTuples.h:238
GaudiTuples::m_evtColOffSet
TupleID::NumericID m_evtColOffSet
the offset for ntuple numerical ID
Definition: GaudiTuples.h:430
GaudiTuples::m_evtColLUN
std::string m_evtColLUN
name of Logical Unit for tuple directory
Definition: GaudiTuples.h:424
GaudiTuples::m_splitEvtColDir
bool m_splitEvtColDir
flag to indicate splitting of tuple directories (useful for HBOOK)
Definition: GaudiTuples.h:422
std::string
STL class.
GaudiTuples::m_evtColMapID
TupleMapID m_evtColMapID
the actual storage of event collections by ID
Definition: GaudiTuples.h:445
Tuples::Tuple
A simple wrapper class over standard Gaudi NTuple::Tuple facility.
Definition: Tuple.h:116
GaudiTuples::m_evtColTopDir
std::string m_evtColTopDir
top level tuple directory
Definition: GaudiTuples.h:426
GaudiPython.TupleUtils.nTuple
def nTuple
Retrieve (book-on-demand) 'Smart'-N-tuple object.
Definition: TupleUtils.py:65
GaudiTuples::nTupleMapTitle
const TupleMapTitle & nTupleMapTitle() const
access to the all ntuples by title
Definition: GaudiTuples.h:261
GaudiTuples::TupleID
GaudiAlg::TupleID TupleID
the actual type of N-tuple ID
Definition: GaudiTuples.h:46
GaudiTuples::evtColMapTitle
const TupleMapTitle & evtColMapTitle() const
access to the all evet tag collections by title
Definition: GaudiTuples.h:263
gaudirun.type
string type
Definition: gaudirun.py:151
GaudiTuples::m_splitNTupleDir
bool m_splitNTupleDir
flag to indicate splitting of tuple directories (useful for HBOOK)
Definition: GaudiTuples.h:409
Tuples::TupleObj
A simple wrapper class over standard Gaudi NTuple::Tuple facility.
Definition: TupleObj.h:196
GaudiTuples::TupleMapID
GaudiAlg::TupleMapID TupleMapID
the actual type of (Numeric ID) -> (tuple) mappping
Definition: GaudiTuples.h:50
GaudiTuples::nTupleOffSet
TupleID::NumericID nTupleOffSet() const
get the value for N-Tuple offset (property "NTupleOffSet")
Definition: GaudiTuples.h:218
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IInterface
Definition of the basic interface.
Definition: IInterface.h:234
GaudiTuples::HistoID
GaudiAlg::HistoID HistoID
the actual type for histogram identifier
Definition: GaudiTuples.h:42
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
GaudiTuples::tuplesPrint
bool tuplesPrint() const
print tuples at finalization
Definition: GaudiTuples.h:236
GaudiTuples::m_tuplesPrint
bool m_tuplesPrint
print tuples at finalization?
Definition: GaudiTuples.h:433
NTuple::Tuple
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:370
GaudiTuples::m_produceEvtCols
bool m_produceEvtCols
flag to switch ON/OFF the ntuple filling and booking
Definition: GaudiTuples.h:420
GaudiTuples::initGaudiTuplesConstructor
void initGaudiTuplesConstructor()
Constructor initialization and job options.
Definition: GaudiTuples.h:330
Maps.h
Property
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
GaudiTuples::nTupleMapID
const TupleMapID & nTupleMapID() const
access to the all ntuples by numeric ID
Definition: GaudiTuples.h:265
GaudiTuples::m_nTupleMapID
TupleMapID m_nTupleMapID
the actual storage of ntuples by ID
Definition: GaudiTuples.h:440
GaudiTuples::evtColLUN
const std::string & evtColLUN() const
get the logical unit for Event Tag Collections (property "EvtColsLUN")
Definition: GaudiTuples.h:226
GaudiTuples::nTupleDir
const std::string & nTupleDir() const
get the N-Tuple directory (property "NTupleDir")
Definition: GaudiTuples.h:216
GaudiUtils::HashMap
Common class providing an architecture-independent hash map.
Definition: HashMap.h:77
GaudiTuples::produceEvtCols
bool produceEvtCols() const
get the flag for Event Tag Collection production (property "EvtColsProduce")
Definition: GaudiTuples.h:222
GaudiTuples::m_nTupleDir
std::string m_nTupleDir
local tuple directory
Definition: GaudiTuples.h:415
GaudiTuples::m_produceNTuples
bool m_produceNTuples
flag to switch ON/OFF the ntuple filling and booking
Definition: GaudiTuples.h:407
GaudiTuples::evtColOffSet
TupleID::NumericID evtColOffSet() const
get the value for Event Tag Collection offset (property "EvtColsOffSet")
Definition: GaudiTuples.h:232
GaudiTuples::splitNTupleDir
bool splitNTupleDir() const
get the flag for N-Tuple path split (property "NTupleSplitDir")
Definition: GaudiTuples.h:210
GaudiTuples::produceNTuples
bool produceNTuples() const
get the flag for N-Tuple production (property "NTupleProduce")
Definition: GaudiTuples.h:208
GaudiTuples::m_evtColsPrint
bool m_evtColsPrint
print event collections at finalization
Definition: GaudiTuples.h:435
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:107
GaudiAlg::ID
ID class for Histogram and Ntuples.
Definition: GaudiHistoID.h:44
Tuple.h
Header file for class : Tuple.
GaudiTuples::evtColMapID
const TupleMapID & evtColMapID() const
access to the all evet tag collections by numeric ID
Definition: GaudiTuples.h:267