
// -*- C++ -*- Tells Emacs this is really C++ code

//
// Pibero Djawotho <pibero@indiana.edu>
// Indiana University
// 20 May 2007
//
// StEventMixer.h
//
// Event mixing class for background subtraction in e+e- pair production.
// This class is fashioned after the NA49 event mixer:
//
// http://na49info.cern.ch/na49/Software/minidst/ana/html/T49Mixing.html
//

#ifndef StEventMixer_h
#define StEventMixer_h

// C++ STL
#include <deque>
using namespace std;

// Local
class Event;

class StEventMixer : public TObject {
public:
  StEventMixer() {}
  ~StEventMixer() {}

  int numberOfEvents(int refmult) const;
  bool ready(int refmult) const;
  void addEvent(Event* event);
  Event* getEvent(int refmult);

private:
  //enum { MAX_EVENTS = 100, MAX_REFMULT = 50 };//for pp pibero hardcut
  enum { MAX_EVENTS = 10, MAX_REFMULT = 700 };//for AuAu run7 lets put 700

  deque<Event*> mEvents[MAX_REFMULT];

  ClassDef(StEventMixer, 1);
};

inline int StEventMixer::numberOfEvents(int refmult) const { return mEvents[refmult].size(); }

inline bool StEventMixer::ready(int refmult) const { return mEvents[refmult].size() >= MAX_EVENTS; }

#endif
