Line data Source code
1 : /**************************************************************************
2 : * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 : * *
4 : * Author: The ALICE Off-line Project. *
5 : * Contributors are mentioned in the code where appropriate. *
6 : * *
7 : * Permission to use, copy, modify and distribute this software and its *
8 : * documentation strictly for non-commercial purposes is hereby granted *
9 : * without fee, provided that the above copyright notice appears in all *
10 : * copies and that both the copyright notice and this permission notice *
11 : * appear in the supporting documentation. The authors make no claims *
12 : * about the suitability of this software for any purpose. It is *
13 : * provided "as is" without express or implied warranty. *
14 : **************************************************************************/
15 :
16 : /* $Id$ */
17 :
18 :
19 : // Realisation of an AliVEventPool which allows the user to
20 : // run the analysis in a loop, i.e. passing several times over
21 : // the same event chain.
22 : // Author Andreas Morsch
23 : // andreas.morsch@cern.ch
24 :
25 :
26 : #include "AliEventPoolLoop.h"
27 : #include <TChain.h>
28 : #include <TFile.h>
29 : #include <TObjArray.h>
30 :
31 170 : ClassImp(AliEventPoolLoop)
32 :
33 :
34 : ////////////////////////////////////////////////////////////////////////
35 :
36 : AliEventPoolLoop::AliEventPoolLoop():
37 0 : AliVEventPool(),
38 0 : fMaxIterations(0),
39 0 : fNIteration(1),
40 0 : fChainClone(0)
41 0 : {
42 : // Default constructor
43 0 : }
44 :
45 : AliEventPoolLoop::AliEventPoolLoop(Int_t nit):
46 0 : AliVEventPool(),
47 0 : fMaxIterations(nit),
48 0 : fNIteration(1),
49 0 : fChainClone(0)
50 0 : {
51 : // Default constructor
52 0 : }
53 :
54 : AliEventPoolLoop::AliEventPoolLoop(const char* name, const char* title):
55 0 : AliVEventPool(name, title),
56 0 : fMaxIterations(0),
57 0 : fNIteration(1),
58 0 : fChainClone(0)
59 0 : {
60 : // Constructor
61 0 : }
62 :
63 :
64 : AliEventPoolLoop::AliEventPoolLoop(const AliEventPoolLoop& obj):
65 0 : AliVEventPool(obj),
66 0 : fMaxIterations(obj.fMaxIterations),
67 0 : fNIteration(obj.fNIteration),
68 0 : fChainClone(0)
69 0 : {
70 : // Copy constructor
71 0 : }
72 :
73 : AliEventPoolLoop& AliEventPoolLoop::operator=(const AliEventPoolLoop& other)
74 : {
75 : // Assignment operator
76 0 : AliVEventPool::operator=(other);
77 0 : fMaxIterations = other.fMaxIterations;
78 0 : fNIteration = other.fNIteration;
79 0 : return *this;
80 : }
81 :
82 :
83 : void AliEventPoolLoop::Init()
84 : {
85 : // Initialisation
86 :
87 0 : fMaxIterations = 0;
88 0 : fNIteration = 1;
89 0 : }
90 :
91 : TChain* AliEventPoolLoop::GetNextChain()
92 : {
93 : // Get the next chain
94 0 : if (fNIteration > fMaxIterations) {
95 0 : return (0);
96 : } else {
97 0 : fNIteration++;
98 : /*
99 : if (fChainClone) {
100 : fChainClone->Reset();
101 : new (fChainClone) TChain(fChain->GetName());
102 : } else {
103 : fChainClone = new TChain(fChain->GetName());
104 : }
105 : TObjArray* files = fChain->GetListOfFiles();
106 : Int_t n = files->GetEntriesFast();
107 : for (Int_t i = 0; i < n; i++) {
108 : TFile* file = (TFile*) (files->At(i));
109 : fChainClone->AddFile(file->GetTitle());
110 : printf("Adding %s %s %s\n", fChainClone->GetName(), file->GetName(), file->GetTitle());
111 :
112 : }
113 : */
114 0 : fChainClone = (TChain*) (fChain->Clone());
115 0 : return fChainClone;
116 : }
117 0 : }
118 :
119 : void AliEventPoolLoop::GetCurrentBin(Float_t* /*bin*/)
120 : {
121 : //
122 0 : }
123 :
124 : Int_t AliEventPoolLoop::GetDimension()
125 : {
126 : //
127 0 : return (0);
128 : }
129 :
|