Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:29:17

0001 #ifndef FWCore_TFWLiteSelector_TFWLiteSelectorBasic_h
0002 #define FWCore_TFWLiteSelector_TFWLiteSelectorBasic_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     TFWLiteSelector
0006 // Class  :     TFWLiteSelectorBasic
0007 //
0008 /**\class TFWLiteSelectorBasic TFWLiteSelectorBasic.h FWCore/FWLite/interface/TFWLiteSelectorBasic.h
0009 
0010  Description: A ROOT TSelector which accesses data using an edm::Event
0011 
0012  Usage:
0013     By inheriting from this class one can make a TSelector for ROOT which works with PROOF and which 
0014 allows you to access data using an edm::Event.
0015 
0016 */
0017 //
0018 // Original Author:  Chris Jones
0019 //         Created:  Tue Jun 27 16:37:27 EDT 2006
0020 //
0021 
0022 // system include files
0023 #include <memory>
0024 #include "TSelector.h"
0025 
0026 // user include files
0027 #include "FWCore/Utilities/interface/propagate_const.h"
0028 
0029 // forward declarations
0030 class TFile;
0031 class TList;
0032 class TTree;
0033 
0034 namespace edm {
0035   class Event;
0036 
0037   namespace root {
0038     struct TFWLiteSelectorMembers;
0039   }
0040 }  // namespace edm
0041 
0042 class TFWLiteSelectorBasic : public TSelector {
0043 public:
0044   TFWLiteSelectorBasic();
0045   ~TFWLiteSelectorBasic() override;
0046 
0047   // ---------- const member functions ---------------------
0048 
0049   // ---------- static member functions --------------------
0050 
0051   // ---------- member functions ---------------------------
0052   /**Called each time the 'client' begins processing (remote 'slaves' do not see this message)
0053         \param in an assignable pointer to a list of objects you want passed to 'preProcessing'. This
0054          list is used to communicate with remote slaves. NOTE: you are responsible for deleting this TList
0055          and its content once you are done with it.
0056         */
0057   virtual void begin(TList*& in) = 0;
0058 
0059   /**Called each time the 'slave' is about to start processing
0060         \param in a pointer to the list of objects created in 'begin()'.  The pointer can be 0
0061         \param out a list of objects that are the result of processing (e.g. histograms).
0062         You should call 'Add()' for each object you want sent to the 'terminate' method.
0063         */
0064   virtual void preProcessing(const TList* in, TList& out) = 0;
0065 
0066   /**Call each time the 'slave' gets a new Event
0067         \param event a standard edm::Event which works just like it does in cmsRun
0068         */
0069   virtual void process(const edm::Event& event) = 0;
0070 
0071   /**Called each time the 'slave' has seen all the events
0072         \param out the list of objects that will be sent to 'terminate'.
0073         You can Add() additional objects to 'out' at this point as well.
0074         */
0075   virtual void postProcessing(TList& out) = 0;
0076 
0077   /**Called each time the 'client' has finished processing.
0078         \param out contains the accumulated output of all slaves.
0079         */
0080   virtual void terminate(TList& out) = 0;
0081 
0082 private:
0083   TFWLiteSelectorBasic(const TFWLiteSelectorBasic&);  // stop default
0084 
0085   const TFWLiteSelectorBasic& operator=(const TFWLiteSelectorBasic&);  // stop default
0086 
0087   void Begin(TTree*) override;
0088   void SlaveBegin(TTree*) override;
0089   void Init(TTree*) override;
0090   Bool_t Notify() override;
0091   Bool_t Process(Long64_t /*entry*/) override;
0092   void SlaveTerminate() override;
0093   void Terminate() override;
0094   Int_t Version() const override { return 1; }
0095 
0096   void setupNewFile(TFile&);
0097   // ---------- member data --------------------------------
0098   edm::propagate_const<std::shared_ptr<edm::root::TFWLiteSelectorMembers>> m_;
0099   bool everythingOK_;
0100 
0101   ClassDefOverride(TFWLiteSelectorBasic, 2)
0102 };
0103 
0104 #endif