]>
Commit | Line | Data |
---|---|---|
405be8ef | 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" | |
325a20c4 | 27 | #include <TChain.h> |
28 | #include <TFile.h> | |
29 | #include <TObjArray.h> | |
405be8ef | 30 | |
31 | ClassImp(AliEventPoolLoop) | |
32 | ||
33 | ||
34 | //////////////////////////////////////////////////////////////////////// | |
35 | ||
36 | AliEventPoolLoop::AliEventPoolLoop(): | |
37 | AliVEventPool(), | |
38 | fMaxIterations(0), | |
63f0d8f3 | 39 | fNIteration(1), |
325a20c4 | 40 | fChainClone(0) |
405be8ef | 41 | { |
42 | // Default constructor | |
43 | } | |
44 | ||
45 | AliEventPoolLoop::AliEventPoolLoop(Int_t nit): | |
46 | AliVEventPool(), | |
47 | fMaxIterations(nit), | |
63f0d8f3 | 48 | fNIteration(1), |
325a20c4 | 49 | fChainClone(0) |
405be8ef | 50 | { |
51 | // Default constructor | |
52 | } | |
53 | ||
54 | AliEventPoolLoop::AliEventPoolLoop(const char* name, const char* title): | |
55 | AliVEventPool(name, title), | |
56 | fMaxIterations(0), | |
63f0d8f3 | 57 | fNIteration(1), |
325a20c4 | 58 | fChainClone(0) |
405be8ef | 59 | { |
60 | // Constructor | |
61 | } | |
62 | ||
63 | ||
64 | AliEventPoolLoop::AliEventPoolLoop(const AliEventPoolLoop& obj): | |
65 | AliVEventPool(obj), | |
66 | fMaxIterations(obj.fMaxIterations), | |
e7c71df0 | 67 | fNIteration(obj.fNIteration), |
68 | fChainClone(0) | |
405be8ef | 69 | { |
70 | // Copy constructor | |
71 | } | |
72 | ||
73 | AliEventPoolLoop& AliEventPoolLoop::operator=(const AliEventPoolLoop& other) | |
74 | { | |
75 | // Assignment operator | |
76 | AliVEventPool::operator=(other); | |
77 | fMaxIterations = other.fMaxIterations; | |
78 | fNIteration = other.fNIteration; | |
79 | return *this; | |
80 | } | |
81 | ||
82 | ||
83 | void AliEventPoolLoop::Init() | |
84 | { | |
85 | // Initialisation | |
86 | ||
87 | fMaxIterations = 0; | |
63f0d8f3 | 88 | fNIteration = 1; |
405be8ef | 89 | } |
90 | ||
91 | TChain* AliEventPoolLoop::GetNextChain() | |
92 | { | |
f690bf48 | 93 | // Get the next chain |
376d9ad8 | 94 | if (fNIteration > fMaxIterations) { |
405be8ef | 95 | return (0); |
96 | } else { | |
97 | fNIteration++; | |
325a20c4 | 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 | fChainClone = (TChain*) (fChain->Clone()); | |
115 | return fChainClone; | |
405be8ef | 116 | } |
117 | } | |
118 | ||
119 | void AliEventPoolLoop::GetCurrentBin(Float_t* /*bin*/) | |
120 | { | |
121 | // | |
122 | } | |
123 | ||
124 | Int_t AliEventPoolLoop::GetDimension() | |
125 | { | |
126 | // | |
127 | return (0); | |
128 | } | |
129 |