]>
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), | |
325a20c4 | 39 | fNIteration(0), |
40 | fChainClone(0) | |
405be8ef | 41 | { |
42 | // Default constructor | |
43 | } | |
44 | ||
45 | AliEventPoolLoop::AliEventPoolLoop(Int_t nit): | |
46 | AliVEventPool(), | |
47 | fMaxIterations(nit), | |
325a20c4 | 48 | fNIteration(0), |
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), | |
325a20c4 | 57 | fNIteration(0), |
58 | fChainClone(0) | |
405be8ef | 59 | { |
60 | // Constructor | |
61 | } | |
62 | ||
63 | ||
64 | AliEventPoolLoop::AliEventPoolLoop(const AliEventPoolLoop& obj): | |
65 | AliVEventPool(obj), | |
66 | fMaxIterations(obj.fMaxIterations), | |
67 | fNIteration(obj.fNIteration) | |
68 | { | |
69 | // Copy constructor | |
70 | } | |
71 | ||
72 | AliEventPoolLoop& AliEventPoolLoop::operator=(const AliEventPoolLoop& other) | |
73 | { | |
74 | // Assignment operator | |
75 | AliVEventPool::operator=(other); | |
76 | fMaxIterations = other.fMaxIterations; | |
77 | fNIteration = other.fNIteration; | |
78 | return *this; | |
79 | } | |
80 | ||
81 | ||
82 | void AliEventPoolLoop::Init() | |
83 | { | |
84 | // Initialisation | |
85 | ||
86 | fMaxIterations = 0; | |
87 | fNIteration = 0; | |
88 | } | |
89 | ||
90 | TChain* AliEventPoolLoop::GetNextChain() | |
91 | { | |
92 | // | |
93 | if (fNIteration >= fMaxIterations) { | |
94 | return (0); | |
95 | } else { | |
96 | fNIteration++; | |
325a20c4 | 97 | /* |
98 | if (fChainClone) { | |
99 | fChainClone->Reset(); | |
100 | new (fChainClone) TChain(fChain->GetName()); | |
101 | } else { | |
102 | fChainClone = new TChain(fChain->GetName()); | |
103 | } | |
104 | TObjArray* files = fChain->GetListOfFiles(); | |
105 | Int_t n = files->GetEntriesFast(); | |
106 | for (Int_t i = 0; i < n; i++) { | |
107 | TFile* file = (TFile*) (files->At(i)); | |
108 | fChainClone->AddFile(file->GetTitle()); | |
109 | printf("Adding %s %s %s\n", fChainClone->GetName(), file->GetName(), file->GetTitle()); | |
110 | ||
111 | } | |
112 | */ | |
113 | fChainClone = (TChain*) (fChain->Clone()); | |
114 | return fChainClone; | |
405be8ef | 115 | } |
116 | } | |
117 | ||
118 | void AliEventPoolLoop::GetCurrentBin(Float_t* /*bin*/) | |
119 | { | |
120 | // | |
121 | } | |
122 | ||
123 | Int_t AliEventPoolLoop::GetDimension() | |
124 | { | |
125 | // | |
126 | return (0); | |
127 | } | |
128 |