ROOT logo
/**************************************************************************
 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/

/* $Id$ */
 

// Realisation of an AliVEventPool which allows the user to
// run the analysis in a loop, i.e. passing several times over 
// the same event chain.
// Author Andreas Morsch
// andreas.morsch@cern.ch


#include "AliEventPoolLoop.h"
#include <TChain.h>
#include <TFile.h>
#include <TObjArray.h>

ClassImp(AliEventPoolLoop)


////////////////////////////////////////////////////////////////////////

AliEventPoolLoop::AliEventPoolLoop():
    AliVEventPool(),
    fMaxIterations(0),
    fNIteration(1),
    fChainClone(0)
{
  // Default constructor
}

AliEventPoolLoop::AliEventPoolLoop(Int_t nit):
    AliVEventPool(),
    fMaxIterations(nit),
    fNIteration(1),
    fChainClone(0)
{
  // Default constructor
}

AliEventPoolLoop::AliEventPoolLoop(const char* name, const char* title):
    AliVEventPool(name, title),
    fMaxIterations(0),
    fNIteration(1),
    fChainClone(0)
{
  // Constructor
}


AliEventPoolLoop::AliEventPoolLoop(const AliEventPoolLoop& obj):
    AliVEventPool(obj),
    fMaxIterations(obj.fMaxIterations),
    fNIteration(obj.fNIteration),
    fChainClone(0)
{
    // Copy constructor
}

AliEventPoolLoop& AliEventPoolLoop::operator=(const AliEventPoolLoop& other)
{
// Assignment operator
    AliVEventPool::operator=(other);
    fMaxIterations = other.fMaxIterations;
    fNIteration    = other.fNIteration;
    return *this;
}


void AliEventPoolLoop::Init()
{
// Initialisation

    fMaxIterations = 0;
    fNIteration    = 1;
}

TChain* AliEventPoolLoop::GetNextChain()
{
    // Get the next chain
    if (fNIteration > fMaxIterations) {
	return (0);
    } else {
	fNIteration++;
	/*
	if (fChainClone) {
	  fChainClone->Reset();
	  new (fChainClone) TChain(fChain->GetName());
	} else {
	  fChainClone = new TChain(fChain->GetName());
	}
	TObjArray* files = fChain->GetListOfFiles();
	Int_t n = files->GetEntriesFast();
	for (Int_t i = 0; i < n; i++) {
	  TFile* file = (TFile*) (files->At(i));
	  fChainClone->AddFile(file->GetTitle());
	  printf("Adding %s %s %s\n", fChainClone->GetName(), file->GetName(), file->GetTitle());

	}
	*/
	fChainClone = (TChain*) (fChain->Clone());
	return fChainClone;
    }
}

void  AliEventPoolLoop::GetCurrentBin(Float_t* /*bin*/)
{
    //
}

Int_t AliEventPoolLoop::GetDimension()
{
    //
    return (0);
}

 AliEventPoolLoop.cxx:1
 AliEventPoolLoop.cxx:2
 AliEventPoolLoop.cxx:3
 AliEventPoolLoop.cxx:4
 AliEventPoolLoop.cxx:5
 AliEventPoolLoop.cxx:6
 AliEventPoolLoop.cxx:7
 AliEventPoolLoop.cxx:8
 AliEventPoolLoop.cxx:9
 AliEventPoolLoop.cxx:10
 AliEventPoolLoop.cxx:11
 AliEventPoolLoop.cxx:12
 AliEventPoolLoop.cxx:13
 AliEventPoolLoop.cxx:14
 AliEventPoolLoop.cxx:15
 AliEventPoolLoop.cxx:16
 AliEventPoolLoop.cxx:17
 AliEventPoolLoop.cxx:18
 AliEventPoolLoop.cxx:19
 AliEventPoolLoop.cxx:20
 AliEventPoolLoop.cxx:21
 AliEventPoolLoop.cxx:22
 AliEventPoolLoop.cxx:23
 AliEventPoolLoop.cxx:24
 AliEventPoolLoop.cxx:25
 AliEventPoolLoop.cxx:26
 AliEventPoolLoop.cxx:27
 AliEventPoolLoop.cxx:28
 AliEventPoolLoop.cxx:29
 AliEventPoolLoop.cxx:30
 AliEventPoolLoop.cxx:31
 AliEventPoolLoop.cxx:32
 AliEventPoolLoop.cxx:33
 AliEventPoolLoop.cxx:34
 AliEventPoolLoop.cxx:35
 AliEventPoolLoop.cxx:36
 AliEventPoolLoop.cxx:37
 AliEventPoolLoop.cxx:38
 AliEventPoolLoop.cxx:39
 AliEventPoolLoop.cxx:40
 AliEventPoolLoop.cxx:41
 AliEventPoolLoop.cxx:42
 AliEventPoolLoop.cxx:43
 AliEventPoolLoop.cxx:44
 AliEventPoolLoop.cxx:45
 AliEventPoolLoop.cxx:46
 AliEventPoolLoop.cxx:47
 AliEventPoolLoop.cxx:48
 AliEventPoolLoop.cxx:49
 AliEventPoolLoop.cxx:50
 AliEventPoolLoop.cxx:51
 AliEventPoolLoop.cxx:52
 AliEventPoolLoop.cxx:53
 AliEventPoolLoop.cxx:54
 AliEventPoolLoop.cxx:55
 AliEventPoolLoop.cxx:56
 AliEventPoolLoop.cxx:57
 AliEventPoolLoop.cxx:58
 AliEventPoolLoop.cxx:59
 AliEventPoolLoop.cxx:60
 AliEventPoolLoop.cxx:61
 AliEventPoolLoop.cxx:62
 AliEventPoolLoop.cxx:63
 AliEventPoolLoop.cxx:64
 AliEventPoolLoop.cxx:65
 AliEventPoolLoop.cxx:66
 AliEventPoolLoop.cxx:67
 AliEventPoolLoop.cxx:68
 AliEventPoolLoop.cxx:69
 AliEventPoolLoop.cxx:70
 AliEventPoolLoop.cxx:71
 AliEventPoolLoop.cxx:72
 AliEventPoolLoop.cxx:73
 AliEventPoolLoop.cxx:74
 AliEventPoolLoop.cxx:75
 AliEventPoolLoop.cxx:76
 AliEventPoolLoop.cxx:77
 AliEventPoolLoop.cxx:78
 AliEventPoolLoop.cxx:79
 AliEventPoolLoop.cxx:80
 AliEventPoolLoop.cxx:81
 AliEventPoolLoop.cxx:82
 AliEventPoolLoop.cxx:83
 AliEventPoolLoop.cxx:84
 AliEventPoolLoop.cxx:85
 AliEventPoolLoop.cxx:86
 AliEventPoolLoop.cxx:87
 AliEventPoolLoop.cxx:88
 AliEventPoolLoop.cxx:89
 AliEventPoolLoop.cxx:90
 AliEventPoolLoop.cxx:91
 AliEventPoolLoop.cxx:92
 AliEventPoolLoop.cxx:93
 AliEventPoolLoop.cxx:94
 AliEventPoolLoop.cxx:95
 AliEventPoolLoop.cxx:96
 AliEventPoolLoop.cxx:97
 AliEventPoolLoop.cxx:98
 AliEventPoolLoop.cxx:99
 AliEventPoolLoop.cxx:100
 AliEventPoolLoop.cxx:101
 AliEventPoolLoop.cxx:102
 AliEventPoolLoop.cxx:103
 AliEventPoolLoop.cxx:104
 AliEventPoolLoop.cxx:105
 AliEventPoolLoop.cxx:106
 AliEventPoolLoop.cxx:107
 AliEventPoolLoop.cxx:108
 AliEventPoolLoop.cxx:109
 AliEventPoolLoop.cxx:110
 AliEventPoolLoop.cxx:111
 AliEventPoolLoop.cxx:112
 AliEventPoolLoop.cxx:113
 AliEventPoolLoop.cxx:114
 AliEventPoolLoop.cxx:115
 AliEventPoolLoop.cxx:116
 AliEventPoolLoop.cxx:117
 AliEventPoolLoop.cxx:118
 AliEventPoolLoop.cxx:119
 AliEventPoolLoop.cxx:120
 AliEventPoolLoop.cxx:121
 AliEventPoolLoop.cxx:122
 AliEventPoolLoop.cxx:123
 AliEventPoolLoop.cxx:124
 AliEventPoolLoop.cxx:125
 AliEventPoolLoop.cxx:126
 AliEventPoolLoop.cxx:127
 AliEventPoolLoop.cxx:128
 AliEventPoolLoop.cxx:129