ROOT logo
// $Id: AEVEventBatch.cxx 2088 2008-11-23 20:26:46Z matevz $

// Copyright (C) 1999-2008, Matevz Tadel. All rights reserved.
// This file is part of GLED, released under GNU General Public License version 2.
// For the licensing terms see $GLEDSYS/LICENSE or http://www.gnu.org/.

//__________________________________________________________________________
// AEVEventBatch
//
//

#include "AEVEventBatch.h"
#include "AEVEventBatch.c7"

#include <TMath.h>

ClassImp(AEVEventBatch);

/**************************************************************************/

void AEVEventBatch::_init()
{
  mNWorkers   = 0;
  mDataSizeMB = mDataDoneMB = 0;

  mTPerEvAvg = 1;
  mTPerEvSgm = 0.05;
  mFracFail  = 0.05;

  mSimEvs    = 10;
  mProcAvg   = 2;

  mRnrMode   = RM_Bar;

  mHDepth = 1;
  mColAll.rgba (0.1, 0.1, 0.8);
  mColOK.rgba  (0,   0.8, 0.2);
  mColFail.rgba(0.8,   0, 0.2);
  mColProc.rgba(0.1, 0.6, 0.6);

  // Enforce usage of scale.
  bUseScale = true;
}

void AEVEventBatch::AdEnlightenment()
{
  PARENT_GLASS::AdEnlightenment();
  mRnd.SetSeed(mSaturnID);
}

/**************************************************************************/

void AEVEventBatch::Reinit()
{
  mEvState.Reinit();
  Stamp(FID());
}

void AEVEventBatch::Reinit(Int_t n_events)
{
  mEvState.Reinit(n_events);
  Stamp(FID());
}

/**************************************************************************/

void AEVEventBatch::FakeInit()
{
  Int_t nall = TMath::Nint( mSimEvs*(0.75 + 0.5*mRnd.Rndm()) );
  // Int_t nx   = TMath::Nint( nall * (2*mFracFail*mRnd.Rndm()) );
  mEvState.SetNAll(nall);
  mEvState.SetNFail(0);
  mEvState.SetNOK(0);
  mEvState.SetNProc(0); // mProcAvg*(0.75 + 0.25*mRnd.Rndm()));
  Stamp(FID());
}

void AEVEventBatch::FakeProc()
{
  SEvTaskState& es( mEvState );

  Int_t nleft = es.GetNLeft();
  Int_t nnew  = TMath::Min(TMath::Nint(mProcAvg*(0.75 + 0.5*mRnd.Rndm())),
                           nleft);
  Int_t nfin  = TMath::Min(TMath::Nint(mProcAvg*(0.75 + 0.5*mRnd.Rndm())),
                           es.GetNProc());
  Int_t nfail = TMath::Min((mRnd.Rndm() < mFracFail ? 1 : 0), nfin);

  es.SetNOK  (es.GetNOK()   + nfin - nfail);
  es.SetNFail(es.GetNFail() + nfail);
  Int_t nproc = es.GetNProc() - nfin + nnew;
  if(nproc > es.GetNToDo())
    nproc = es.GetNToDo();
  if(nproc < 0)
    nproc = 0;
  es.SetNProc(nproc);

  Stamp(FID());
}

/**************************************************************************/
 AEVEventBatch.cxx:1
 AEVEventBatch.cxx:2
 AEVEventBatch.cxx:3
 AEVEventBatch.cxx:4
 AEVEventBatch.cxx:5
 AEVEventBatch.cxx:6
 AEVEventBatch.cxx:7
 AEVEventBatch.cxx:8
 AEVEventBatch.cxx:9
 AEVEventBatch.cxx:10
 AEVEventBatch.cxx:11
 AEVEventBatch.cxx:12
 AEVEventBatch.cxx:13
 AEVEventBatch.cxx:14
 AEVEventBatch.cxx:15
 AEVEventBatch.cxx:16
 AEVEventBatch.cxx:17
 AEVEventBatch.cxx:18
 AEVEventBatch.cxx:19
 AEVEventBatch.cxx:20
 AEVEventBatch.cxx:21
 AEVEventBatch.cxx:22
 AEVEventBatch.cxx:23
 AEVEventBatch.cxx:24
 AEVEventBatch.cxx:25
 AEVEventBatch.cxx:26
 AEVEventBatch.cxx:27
 AEVEventBatch.cxx:28
 AEVEventBatch.cxx:29
 AEVEventBatch.cxx:30
 AEVEventBatch.cxx:31
 AEVEventBatch.cxx:32
 AEVEventBatch.cxx:33
 AEVEventBatch.cxx:34
 AEVEventBatch.cxx:35
 AEVEventBatch.cxx:36
 AEVEventBatch.cxx:37
 AEVEventBatch.cxx:38
 AEVEventBatch.cxx:39
 AEVEventBatch.cxx:40
 AEVEventBatch.cxx:41
 AEVEventBatch.cxx:42
 AEVEventBatch.cxx:43
 AEVEventBatch.cxx:44
 AEVEventBatch.cxx:45
 AEVEventBatch.cxx:46
 AEVEventBatch.cxx:47
 AEVEventBatch.cxx:48
 AEVEventBatch.cxx:49
 AEVEventBatch.cxx:50
 AEVEventBatch.cxx:51
 AEVEventBatch.cxx:52
 AEVEventBatch.cxx:53
 AEVEventBatch.cxx:54
 AEVEventBatch.cxx:55
 AEVEventBatch.cxx:56
 AEVEventBatch.cxx:57
 AEVEventBatch.cxx:58
 AEVEventBatch.cxx:59
 AEVEventBatch.cxx:60
 AEVEventBatch.cxx:61
 AEVEventBatch.cxx:62
 AEVEventBatch.cxx:63
 AEVEventBatch.cxx:64
 AEVEventBatch.cxx:65
 AEVEventBatch.cxx:66
 AEVEventBatch.cxx:67
 AEVEventBatch.cxx:68
 AEVEventBatch.cxx:69
 AEVEventBatch.cxx:70
 AEVEventBatch.cxx:71
 AEVEventBatch.cxx:72
 AEVEventBatch.cxx:73
 AEVEventBatch.cxx:74
 AEVEventBatch.cxx:75
 AEVEventBatch.cxx:76
 AEVEventBatch.cxx:77
 AEVEventBatch.cxx:78
 AEVEventBatch.cxx:79
 AEVEventBatch.cxx:80
 AEVEventBatch.cxx:81
 AEVEventBatch.cxx:82
 AEVEventBatch.cxx:83
 AEVEventBatch.cxx:84
 AEVEventBatch.cxx:85
 AEVEventBatch.cxx:86
 AEVEventBatch.cxx:87
 AEVEventBatch.cxx:88
 AEVEventBatch.cxx:89
 AEVEventBatch.cxx:90
 AEVEventBatch.cxx:91
 AEVEventBatch.cxx:92
 AEVEventBatch.cxx:93
 AEVEventBatch.cxx:94
 AEVEventBatch.cxx:95
 AEVEventBatch.cxx:96
 AEVEventBatch.cxx:97
 AEVEventBatch.cxx:98
 AEVEventBatch.cxx:99
 AEVEventBatch.cxx:100
 AEVEventBatch.cxx:101