CMS 3D CMS Logo

TFWLiteSelector< TWorker > Class Template Reference

Description: A 'safe' form of a TSelector which uses a Worker helper class to do the processing. More...

#include <FWCore/TFWLiteSelector/interface/TFWLiteSelector.h>

Inheritance diagram for TFWLiteSelector< TWorker >:

TFWLiteSelectorBasic examples::TrackTSelector tfwliteselectortest::ThingsTSelector2

List of all members.

Public Member Functions

 TFWLiteSelector ()
virtual ~TFWLiteSelector ()

Private Member Functions

const TFWLiteSelectoroperator= (const TFWLiteSelector &)
virtual void postProcessing (TList &out)
 Called each time the 'slave' has seen all the events.
virtual void preProcessing (const TList *in, TList &out)
 Called each time the 'slave' is about to start processing.
virtual void process (const edm::Event &iEvent)
 Call each time the 'slave' gets a new Event.
 TFWLiteSelector (const TFWLiteSelector &)

Private Attributes

TWorker * worker_


Detailed Description

template<class TWorker>
class TFWLiteSelector< TWorker >

Description: A 'safe' form of a TSelector which uses a Worker helper class to do the processing.

Usage: This is a safe form of a TSelector which separates the processing (which could happen on many computers when using PROOF) from the handling of the final result (which only happens on the original computer which is running the ROOT job).

The processing is handled by a worker class. This class is expected to have the following methods 1) a constructor which takes a 'const TList*' and a 'TList&' as its arguments. The 'const TList*' holds objects The 'TList&' is used to hold all the 'TObject' items (e.g. histograms) you want to access for the final result (e.g. the sum of all histograms created by the many Workers running on different computers). You should create the items in the constructor, hold onto them as member data in the Worker and 'Add' them to the TList. In addition, the 'TList&' can hold items sent to the workers from the TFWLiteSelector. 2) a method called 'process(const edm::Event&)' this is called for each Event 3) a destructor which does what ever you want to have done after all the Events have finished

You should inherit from TFWLiteSelector<...> where the template argument should be the worker you want to use. You need to implement the following methods 1) 'begin(const TList*& itemsForProcessing)' this is called before processing has started and before any workers get created. If you want to pass data to your workers, you can create a new TList and assign it to 'itemsForProcessing' and then add the objects you want passed into that list. NOTE: you are responsible for deleting the created TList and for deleting all items held by the TList. The easiest way to do this is to add a 'stdauto_ptr<TList>' member data to your Selector and then call 'SetOwner()' on the TList. 2) 'terminate(TList&)' this is called after all processing has finished. The TList& contains all the accumulated information from all the workers.

Definition at line 54 of file TFWLiteSelector.h.


Constructor & Destructor Documentation

template<class TWorker>
TFWLiteSelector< TWorker >::TFWLiteSelector (  )  [inline]

Definition at line 58 of file TFWLiteSelector.h.

00058 : worker_(0) {}

template<class TWorker>
virtual TFWLiteSelector< TWorker >::~TFWLiteSelector (  )  [inline, virtual]

Definition at line 59 of file TFWLiteSelector.h.

00059                                  {
00060         delete worker_;
00061       }

template<class TWorker>
TFWLiteSelector< TWorker >::TFWLiteSelector ( const TFWLiteSelector< TWorker > &   )  [private]


Member Function Documentation

template<class TWorker>
const TFWLiteSelector& TFWLiteSelector< TWorker >::operator= ( const TFWLiteSelector< TWorker > &   )  [private]

template<class TWorker>
virtual void TFWLiteSelector< TWorker >::postProcessing ( TList &  out  )  [inline, private, virtual]

Called each time the 'slave' has seen all the events.

Parameters:
out the list of objects that will be sent to 'terminate'. You can Add() additional objects to 'out' at this point as well.

Implements TFWLiteSelectorBasic.

Definition at line 84 of file TFWLiteSelector.h.

00084                                               {
00085         worker_->postProcess(out);
00086       }

template<class TWorker>
virtual void TFWLiteSelector< TWorker >::preProcessing ( const TList *  in,
TList &  out 
) [inline, private, virtual]

Called each time the 'slave' is about to start processing.

Parameters:
in a pointer to the list of objects created in 'begin()'. The pointer can be 0
out a list of objects that are the result of processing (e.g. histograms). You should call 'Add()' for each object you want sent to the 'terminate' method.

Implements TFWLiteSelectorBasic.

Definition at line 74 of file TFWLiteSelector.h.

00074                                                              {
00075         //need to remove all output so that when we delete the worker
00076         // we are not left with a stale pointer
00077         out.Clear();
00078         delete worker_;
00079         worker_= new TWorker(in,out);
00080       }

template<class TWorker>
virtual void TFWLiteSelector< TWorker >::process ( const edm::Event event  )  [inline, private, virtual]

Call each time the 'slave' gets a new Event.

Parameters:
event a standard edm::Event which works just like it does in cmsRun

Implements TFWLiteSelectorBasic.

Definition at line 81 of file TFWLiteSelector.h.

00081                                                    {
00082         worker_->process(iEvent);
00083       }


Member Data Documentation

template<class TWorker>
TWorker* TFWLiteSelector< TWorker >::worker_ [private]

Definition at line 89 of file TFWLiteSelector.h.

Referenced by TFWLiteSelector< examples::TrackAnalysisAlgorithm >::postProcessing(), TFWLiteSelector< examples::TrackAnalysisAlgorithm >::preProcessing(), TFWLiteSelector< examples::TrackAnalysisAlgorithm >::process(), and TFWLiteSelector< examples::TrackAnalysisAlgorithm >::~TFWLiteSelector().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:33:23 2009 for CMSSW by  doxygen 1.5.4