#ifndef AliEventPoolManager_h
#define AliEventPoolManager_h
#include <vector>
#include <deque>
#include <Rtypes.h>
#include <Riostream.h>
#include <TObjArray.h>
#include <TFile.h>
#include <TMath.h>
#include <TRandom.h>
#include <TSystem.h>
using std::deque;
class AliEventPool : public TObject
{
public:
AliEventPool(Int_t d)
: fEvents(0),
fNTracksInEvent(0),
fEventIndex(0),
fMixDepth(d),
fMultMin(-999),
fMultMax(+999),
fZvtxMin(-999),
fZvtxMax(+999),
fPsiMin(-999),
fPsiMax(+999),
fWasUpdated(0),
fMultBinIndex(0),
fZvtxBinIndex(0),
fPsiBinIndex(0),
fDebug(0),
fTargetTrackDepth(0),
fFirstFilled(0),
fNTimes(0),
fTargetFraction(1),
fTargetEvents(0) {;}
AliEventPool(Int_t d, Double_t multMin, Double_t multMax,
Double_t zvtxMin, Double_t zvtxMax,
Double_t psiMin=-999., Double_t psiMax=999.)
: fEvents(0),
fNTracksInEvent(0),
fEventIndex(0),
fMixDepth(d),
fMultMin(multMin),
fMultMax(multMax),
fZvtxMin(zvtxMin),
fZvtxMax(zvtxMax),
fPsiMin(psiMin),
fPsiMax(psiMax),
fWasUpdated(0),
fMultBinIndex(0),
fZvtxBinIndex(0),
fPsiBinIndex(0),
fDebug(0),
fTargetTrackDepth(0),
fFirstFilled(0),
fNTimes(0),
fTargetFraction(1),
fTargetEvents(0) {;}
~AliEventPool() {;}
Bool_t EventMatchesBin(Int_t mult, Double_t zvtx, Double_t psi=0.) const;
Bool_t EventMatchesBin(Double_t mult, Double_t zvtx, Double_t psi=0.) const;
Bool_t IsReady() const { return IsReady(NTracksInPool(), GetCurrentNEvents()); }
Bool_t IsFirstReady() const { return fFirstFilled; }
Int_t GetNTimes() const { return fNTimes; }
Int_t GetCurrentNEvents() const { return fEvents.size(); }
Int_t GlobalEventIndex(Int_t j) const;
TObject *GetRandomTrack() const;
TObjArray *GetRandomEvent() const;
TObjArray *GetEvent(Int_t i) const;
Int_t MultBinIndex() const { return fMultBinIndex; }
Int_t NTracksInEvent(Int_t iEvent) const;
Int_t NTracksInCurrentEvent() const { return fNTracksInEvent.back(); }
void PrintInfo() const;
Int_t PsiBinIndex() const { return fPsiBinIndex; }
Int_t NTracksInPool() const;
Bool_t WasUpdated() const { return fWasUpdated; }
Int_t ZvtxBinIndex() const { return fZvtxBinIndex; }
void SetDebug(Bool_t b) { fDebug = b; }
void SetTargetTrackDepth(Int_t d, Float_t fraction = 1.0) { fTargetTrackDepth = d; fTargetFraction = fraction; }
void SetTargetEvents(Int_t ev) { fTargetEvents = ev; }
Int_t SetEventMultRange(Int_t multMin, Int_t multMax);
Int_t SetEventMultRange(Double_t multMin, Double_t multMax);
Int_t SetEventZvtxRange(Double_t zvtxMin, Double_t zvtxMax);
Int_t SetEventPsiRange(Double_t psiMin, Double_t psiMax);
void SetMultBinIndex(Int_t iM) { fMultBinIndex = iM; }
void SetZvtxBinIndex(Int_t iZ) { fZvtxBinIndex = iZ; }
void SetPsiBinIndex(Int_t iP) { fPsiBinIndex = iP; }
Int_t UpdatePool(TObjArray *trk);
protected:
Bool_t IsReady(Int_t tracks, Int_t events) const { return (tracks >= fTargetFraction * fTargetTrackDepth) || ((fTargetEvents > 0) && (events >= fTargetEvents)); }
deque<TObjArray*> fEvents;
deque<int> fNTracksInEvent;
deque<int> fEventIndex;
Int_t fMixDepth;
Double_t fMultMin, fMultMax;
Double_t fZvtxMin, fZvtxMax;
Double_t fPsiMin, fPsiMax;
Bool_t fWasUpdated;
Int_t fMultBinIndex;
Int_t fZvtxBinIndex;
Int_t fPsiBinIndex;
Int_t fDebug;
Int_t fTargetTrackDepth;
Bool_t fFirstFilled;
Int_t fNTimes;
Float_t fTargetFraction;
Int_t fTargetEvents;
ClassDef(AliEventPool,3)
};
class AliEventPoolManager : public TObject
{
public:
AliEventPoolManager()
: fDebug(0),
fNMultBins(0),
fNZvtxBins(0),
fNPsiBins(0),
fEvPool(0),
fTargetTrackDepth(0) {;}
AliEventPoolManager(Int_t maxEvts, Int_t minNTracks,
Int_t nMultBins, Double_t *multbins,
Int_t nZvtxBins, Double_t *zvtxbins);
AliEventPoolManager(Int_t maxEvts, Int_t minNTracks,
Int_t nMultBins, Double_t *multbins,
Int_t nZvtxBins, Double_t *zvtxbins,
Int_t nPsiBins, Double_t *psibins);
~AliEventPoolManager() {;}
AliEventPool *GetEventPool(Int_t iMult, Int_t iZvtx, Int_t iPsi=0) const;
AliEventPool *GetEventPool(Int_t centVal, Double_t zvtxVal, Double_t psiVal=0.) const;
AliEventPool *GetEventPool(Double_t centVal, Double_t zvtxVal, Double_t psiVal=0.) const;
Int_t InitEventPools(Int_t depth,
Int_t nmultbins, Double_t *multbins,
Int_t nzvtxbins, Double_t *zvtxbins,
Int_t npsibins, Double_t *psibins);
void SetTargetTrackDepth(Int_t d) { fTargetTrackDepth = d;}
Int_t UpdatePools(TObjArray *trk);
void SetDebug(Bool_t b) { fDebug = b; }
void SetTargetValues(Int_t trackDepth, Float_t fraction, Int_t events);
protected:
Int_t fDebug;
Int_t fNMultBins;
Int_t fNZvtxBins;
Int_t fNPsiBins;
std::vector<AliEventPool*> fEvPool;
Int_t fTargetTrackDepth;
ClassDef(AliEventPoolManager,2)
};
#endif
AliEventPoolManager.h:100 AliEventPoolManager.h:101 AliEventPoolManager.h:102 AliEventPoolManager.h:103 AliEventPoolManager.h:104 AliEventPoolManager.h:105 AliEventPoolManager.h:106 AliEventPoolManager.h:107 AliEventPoolManager.h:108 AliEventPoolManager.h:109 AliEventPoolManager.h:110 AliEventPoolManager.h:111 AliEventPoolManager.h:112 AliEventPoolManager.h:113 AliEventPoolManager.h:114 AliEventPoolManager.h:115 AliEventPoolManager.h:116 AliEventPoolManager.h:117 AliEventPoolManager.h:118 AliEventPoolManager.h:119 AliEventPoolManager.h:120 AliEventPoolManager.h:121 AliEventPoolManager.h:122 AliEventPoolManager.h:123 AliEventPoolManager.h:124 AliEventPoolManager.h:125 AliEventPoolManager.h:126 AliEventPoolManager.h:127 AliEventPoolManager.h:128 AliEventPoolManager.h:129 AliEventPoolManager.h:130 AliEventPoolManager.h:131 AliEventPoolManager.h:132 AliEventPoolManager.h:133 AliEventPoolManager.h:134 AliEventPoolManager.h:135 AliEventPoolManager.h:136 AliEventPoolManager.h:137 AliEventPoolManager.h:138 AliEventPoolManager.h:139 AliEventPoolManager.h:140 AliEventPoolManager.h:141 AliEventPoolManager.h:142 AliEventPoolManager.h:143 AliEventPoolManager.h:144 AliEventPoolManager.h:145 AliEventPoolManager.h:146 AliEventPoolManager.h:147 AliEventPoolManager.h:148 AliEventPoolManager.h:149 AliEventPoolManager.h:150 AliEventPoolManager.h:151 AliEventPoolManager.h:152 AliEventPoolManager.h:153 AliEventPoolManager.h:154 AliEventPoolManager.h:155 AliEventPoolManager.h:156 AliEventPoolManager.h:157 AliEventPoolManager.h:158 AliEventPoolManager.h:159 AliEventPoolManager.h:160 AliEventPoolManager.h:161 AliEventPoolManager.h:162 AliEventPoolManager.h:163 AliEventPoolManager.h:164 AliEventPoolManager.h:165 AliEventPoolManager.h:166 AliEventPoolManager.h:167 AliEventPoolManager.h:168 AliEventPoolManager.h:169 AliEventPoolManager.h:170 AliEventPoolManager.h:171 AliEventPoolManager.h:172 AliEventPoolManager.h:173 AliEventPoolManager.h:174 AliEventPoolManager.h:175 AliEventPoolManager.h:176 AliEventPoolManager.h:177 AliEventPoolManager.h:178 AliEventPoolManager.h:179