SFrame 3.6
core/include/SCycleBaseExec.h
Go to the documentation of this file.
00001 // Dear emacs, this is -*- c++ -*-
00002 // $Id: SCycleBaseExec.h 318 2012-06-22 16:32:42Z krasznaa $
00003 /***************************************************************************
00004  * @Project: SFrame - ROOT-based analysis framework for ATLAS
00005  * @Package: Core
00006  *
00007  * @author Stefan Ask       <Stefan.Ask@cern.ch>           - Manchester
00008  * @author David Berge      <David.Berge@cern.ch>          - CERN
00009  * @author Johannes Haller  <Johannes.Haller@cern.ch>      - Hamburg
00010  * @author A. Krasznahorkay <Attila.Krasznahorkay@cern.ch> - CERN/Debrecen
00011  *
00012  ***************************************************************************/
00013 
00014 #ifndef SFRAME_CORE_SCycleBaseExec_H
00015 #define SFRAME_CORE_SCycleBaseExec_H
00016 
00017 // STL include(s):
00018 #include <vector>
00019 
00020 // ROOT include(s):
00021 #include <TSelector.h>
00022 #include <TString.h>
00023 
00024 // Local include(s):
00025 #include "ISCycleBaseConfig.h"
00026 #include "ISCycleBaseHist.h"
00027 #include "ISCycleBaseNTuple.h"
00028 #include "SCycleBaseBase.h"
00029 
00030 // Forward declaration(s):
00031 class TTree;
00032 class SInputData;
00033 class TFile;
00034 class TList;
00035 
00047 class SCycleBaseExec : public TSelector,
00048                        public virtual ISCycleBaseConfig,
00049                        public virtual ISCycleBaseHist,
00050                        public virtual ISCycleBaseNTuple,
00051                        public virtual SCycleBaseBase {
00052 
00053 public:
00055    SCycleBaseExec();
00056 
00058    //                                                                       //
00059    //   The following are the functions inherited from TSelector.           //
00060    //                                                                       //
00062 
00063    virtual void   Begin( TTree* );
00064    virtual void   SlaveBegin( TTree* );
00065    virtual void   Init( TTree* main_tree );
00066    virtual Bool_t Notify();
00067    virtual Bool_t Process( Long64_t entry );
00068    virtual void   SlaveTerminate();
00069    virtual void   Terminate();
00071    virtual Int_t  Version() const { return 2; }
00072 
00074    //                                                                       //
00075    //   The following are the functions to be implemented in the derived    //
00076    //   classes.                                                            //
00077    //                                                                       //
00079 
00081 
00085    virtual void BeginCycle() throw( SError ) = 0;
00087 
00091    virtual void EndCycle() throw( SError ) = 0;
00092 
00094 
00099    virtual void BeginInputData( const SInputData& ) throw( SError ) = 0;
00101 
00105    virtual void EndInputData  ( const SInputData& ) throw( SError ) = 0;
00106 
00108 
00112    virtual void BeginMasterInputData( const SInputData& ) throw( SError ) {}
00114 
00118    virtual void EndMasterInputData( const SInputData& ) throw( SError ) {}
00119 
00121 
00125    virtual void BeginInputFile( const SInputData& ) throw( SError ) = 0;
00126 
00128 
00133    virtual void ExecuteEvent( const SInputData&, Double_t weight ) throw( SError ) = 0;
00134 
00135 private:
00137    void ReadConfig() throw( SError );
00139    virtual void ExecuteEvent( Int_t event, Int_t px, Int_t py );
00140 
00142    Long64_t m_nProcessedEvents;
00144    Long64_t m_nSkippedEvents;
00145 
00146    // variable used for the case of multiple InputData objects with
00147    // the same type, that are written to the same output file
00148    Bool_t m_keepOutputFile;
00149    Bool_t m_firstInputDataOfMany;
00150 
00152    Bool_t m_firstInit;
00153 
00154    TTree*                m_inputTree; 
00155    SInputData*           m_inputData; 
00156    std::vector< TTree* > m_outputTrees; 
00157    TFile*                m_outputFile; 
00158 
00159 #ifndef DOXYGEN_IGNORE
00160    ClassDef( SCycleBaseExec, 0 );
00161 #endif // DOXYGEN_IGNORE
00162 
00163 }; // class SCycleBaseExec
00164 
00165 #endif // SFRAME_CORE_SCycleBaseExec_H