Line data Source code
1 : #ifndef ALIMULTIEVENTINPUTHANDLER_H
2 : #define ALIMULTIEVENTINPUTHANDLER_H
3 : /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 : * See cxx source for full Copyright notice */
5 :
6 : /* $Id$ */
7 :
8 : //----------------------------------------------------------------------------
9 : // Multi VEvent Input Handler realisation of the AliVEventHandler interface.
10 : // This class handles multiple events for mixing.
11 : // Author: Andreas Morsch, CERN
12 : //----------------------------------------------------------------------------
13 :
14 : #include "AliInputEventHandler.h"
15 : class AliVEventPool;
16 : class AliVEvent;
17 :
18 : class AliMultiEventInputHandler : public AliInputEventHandler {
19 :
20 : public:
21 : AliMultiEventInputHandler();
22 : AliMultiEventInputHandler(Int_t size, Int_t format = 1);
23 : AliMultiEventInputHandler(const char* name, const char* title, Int_t size, Int_t format = 1);
24 : virtual ~AliMultiEventInputHandler();
25 0 : void SetBufferSize(Int_t size) {fBufferSize = size;}
26 0 : void SetEventPool(AliVEventPool* pool) {fEventPool = pool;}
27 0 : Int_t GetBufferSize() const {return fBufferSize;}
28 0 : Int_t GetNBuffered() const {return fNBuffered;}
29 0 : Bool_t IsBufferReady() const {return (fNBuffered >= (fBufferSize -1));}
30 0 : Bool_t IsFreshBuffer() const {return (fIndex == (fBufferSize - 1));}
31 0 : AliVEventPool *GetEventPool() const {return fEventPool;}
32 0 : virtual AliVEvent *GetEvent() const {return GetLatestEvent();}
33 : virtual AliVEvent *GetEvent(Int_t iev) const;
34 0 : AliVEvent *GetLatestEvent() const {return fEventBuffer[fIndex];}
35 0 : Int_t GetFormat() { return fFormat ;}
36 0 : void EventSkipped() {fEventSkipped = kTRUE;}
37 : // From the interface
38 0 : virtual Bool_t Init(Option_t* /*opt*/) {return kTRUE;}
39 : virtual Bool_t Init(TTree* tree, Option_t* /*opt*/);
40 : virtual Bool_t FinishEvent();
41 : virtual Bool_t BeginEvent(Long64_t /*entry*/);
42 0 : virtual Bool_t Notify() { return AliInputEventHandler::Notify();}
43 : virtual Bool_t Notify(const char */*path*/);
44 : private:
45 : AliMultiEventInputHandler(const AliMultiEventInputHandler& handler);
46 : AliMultiEventInputHandler& operator=(const AliMultiEventInputHandler& handler);
47 : private:
48 : Int_t fBufferSize; // Size of the buffer
49 : Int_t fFormat; // 0: ESD 1: AOD
50 : Int_t fNBuffered; // Number of events actually buffered
51 : Int_t fIndex; // Pointer to most recent event
52 : Int_t fCurrentBin; // Current bin from the pool
53 : Int_t fCurrentEvt; // Current event
54 : Bool_t fInit; // Current event
55 : AliVEventPool* fEventPool; // Pointer to the pool
56 : AliVEvent** fEventBuffer; //! The event buffer
57 : Bool_t fEventSkipped; // User requires event to be skip
58 170 : ClassDef(AliMultiEventInputHandler, 1);
59 : };
60 :
61 : #endif
|