TPacketizerMulti.h

Go to the documentation of this file.
00001 // $Id: TPacketizerMulti.h 32204 2010-02-03 19:17:40Z ganis $
00002 // Author: G. Ganis  Jan 2010
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TPacketizerMulti
00013 #define ROOT_TPacketizerMulti
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      //
00017 // TPacketizerMulti                                                     //
00018 //                                                                      //
00019 // This class allows to do multiple runs in the same query; each run    //
00020 // can be a, for example, different dataset or the same dataset with    //
00021 // entry list.                                                          //
00022 // The multiple packetizer conatins a list of packetizers which are     //
00023 // processed in turn.                                                   //
00024 // The bit TSelector::kNewRun is set in the TSelector object when a new //
00025 // packetizer is used.                                                  //
00026 //                                                                      //
00027 //////////////////////////////////////////////////////////////////////////
00028 
00029 #ifndef ROOT_TVirtualPacketizer
00030 #include "TVirtualPacketizer.h"
00031 #endif
00032 
00033 
00034 class TIter;
00035 class TList;
00036 class TMap;
00037 class TMessage;
00038 class TProofProgressStatus;
00039 class TSlave;
00040 
00041 class TPacketizerMulti : public TVirtualPacketizer {
00042 
00043 private:
00044    TList              *fPacketizers;     // Packetizers to be processed
00045    TIter              *fPacketizersIter; // Iterator on fPacketizers
00046    TVirtualPacketizer *fCurrent;         // Packetizer being currently processed
00047    TMap               *fAssignedPack;    // Map {worker,packetizer} of lat assignement
00048 
00049    TPacketizerMulti();
00050    TPacketizerMulti(const TPacketizerMulti&);     // no implementation, will generate
00051    void operator=(const TPacketizerMulti&);  // error on accidental usage
00052 
00053    TVirtualPacketizer *CreatePacketizer(TDSet *dset, TList *wrks, Long64_t first, Long64_t num,
00054                                         TList *input, TProofProgressStatus *st);
00055 
00056 public:
00057    TPacketizerMulti(TDSet *dset, TList *slaves, Long64_t first, Long64_t num,
00058                     TList *input, TProofProgressStatus *st);
00059    virtual ~TPacketizerMulti();
00060 
00061    TDSetElement *GetNextPacket(TSlave *wrk, TMessage *r);
00062 
00063    Int_t    GetEstEntriesProcessed(Float_t f, Long64_t &ent, Long64_t &bytes, Long64_t &calls)
00064                     { if (fCurrent) return fCurrent->GetEstEntriesProcessed(f,ent,bytes,calls);
00065                       return 1; }
00066    Float_t  GetCurrentRate(Bool_t &all) { all = kTRUE;
00067                                           return (fCurrent? fCurrent->GetCurrentRate(all) : 0.); }
00068    void     StopProcess(Bool_t abort) { if (fCurrent) fCurrent->StopProcess(abort);
00069                                         TVirtualPacketizer::StopProcess(abort); }
00070    void     MarkBad(TSlave *wrk, TProofProgressStatus *st, TList **missing)
00071                     { if (fCurrent) fCurrent->MarkBad(wrk, st, missing); return; }
00072    Int_t    AddProcessed(TSlave *wrk, TProofProgressStatus *st, Double_t lat, TList **missing)
00073                     { if (fCurrent) return fCurrent->AddProcessed(wrk, st, lat, missing);
00074                       return -1; }
00075 
00076    Int_t    GetActiveWorkers() { if (fCurrent) return fCurrent->GetActiveWorkers(); return 0; }
00077 
00078    ClassDef(TPacketizerMulti,0)  //Generate work packets for parallel processing
00079 };
00080 
00081 #endif

Generated on Tue Jul 5 14:27:42 2011 for ROOT_528-00b_version by  doxygen 1.5.1