Gamma finder added, all the cuts are optimized
[u/mrichter/AliRoot.git] / ANALYSIS / AliEventPoolOTF.cxx
CommitLineData
2d0a3a45 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 via
20// on the flight (OTF) generation of the bin using AliTagAnalysis.
21// Author Andreas Morsch
22// andreas.morsch@cern.ch
23
24#include "AliEventPoolOTF.h"
25
26#include "AliRunTagCuts.h"
27#include "AliLHCTagCuts.h"
28#include "AliDetectorTagCuts.h"
29#include "AliEventTagCuts.h"
30#include "AliTagAnalysis.h"
31
df5036f6 32#include <TMath.h>
21b8dea4 33#include <TGridResult.h>
df5036f6 34
2d0a3a45 35ClassImp(AliEventPoolOTF)
36
37
38////////////////////////////////////////////////////////////////////////
39
40AliEventPoolOTF::AliEventPoolOTF():
41 AliVEventPool(),
42 fTagAnalysis(0),
43 fRunCuts(0),
44 fLHCCuts(0),
45 fDetectorCuts(0),
46 fEventCuts(0),
21b8dea4 47 fGridTags(0),
9ce6b490 48 fChain(0),
2d0a3a45 49 fTagDirectory(0),
df5036f6 50 fValueMin(),
51 fValueMax(),
52 fValueStep(),
53 fValue(),
54 fBinNumber(0),
55 fNoMore(0)
56
2d0a3a45 57{
58 // Default constructor
df5036f6 59 InitArrays();
2d0a3a45 60}
61
62AliEventPoolOTF::AliEventPoolOTF(const char* name, const char* title):
63 AliVEventPool(name, title),
c08c82c3 64 fTagAnalysis(new AliTagAnalysis(title)),
2d0a3a45 65 fRunCuts(new AliRunTagCuts()),
66 fLHCCuts(new AliLHCTagCuts()),
67 fDetectorCuts(new AliDetectorTagCuts()),
68 fEventCuts(new AliEventTagCuts()),
21b8dea4 69 fGridTags(0),
9ce6b490 70 fChain(0),
2d0a3a45 71 fTagDirectory("."),
df5036f6 72 fValueMin(),
73 fValueMax(),
74 fValueStep(),
75 fValue(),
76 fBinNumber(0),
77 fNoMore(0)
78
2d0a3a45 79{
80 // Constructor
df5036f6 81 InitArrays();
2d0a3a45 82}
83
84
85AliEventPoolOTF::AliEventPoolOTF(const AliEventPoolOTF& obj):
86 AliVEventPool(obj),
87 fTagAnalysis(0),
88 fRunCuts(0),
89 fLHCCuts(0),
90 fDetectorCuts(0),
91 fEventCuts(0),
d7ed11c3 92 fGridTags(0),
9ce6b490 93 fChain(0),
2d0a3a45 94 fTagDirectory(0),
df5036f6 95 fValueMin(),
96 fValueMax(),
97 fValueStep(),
98 fValue(),
99 fBinNumber(0),
100 fNoMore(0)
2d0a3a45 101{
102 // Copy constructor
df5036f6 103 InitArrays();
2d0a3a45 104}
105
106AliEventPoolOTF& AliEventPoolOTF::operator=(const AliEventPoolOTF& other)
107{
108// Assignment operator
109 AliVEventPool::operator=(other);
110 return *this;
111}
112
113
114void AliEventPoolOTF::Init()
115{
116 //
21b8dea4 117 if (!fGridTags) {
118 fTagAnalysis->ChainLocalTags(fTagDirectory);
119 } else {
120 fTagAnalysis->ChainGridTags(fGridTags);
121 }
122
123
df5036f6 124 for (Int_t i = 0; i < 4; i++) fValue[i] = fValueMin[i];
2d0a3a45 125}
126
127TChain* AliEventPoolOTF::GetNextChain()
128{
129 //
9ce6b490 130 if (fChain) {
131 delete fChain;
132 fChain = 0;
133 }
134
a065d8ed 135 fBinNumber++;
df5036f6 136 if (fNoMore) {
2d0a3a45 137 return 0;
138 } else {
df5036f6 139 printf("Current bin (lower) %13.3f %13.3f %13.3f \n", fValue[kMultiplicity], fValue[kZVertex], fValue[kEventPlane]);
140 printf("Current bin (upper) %13.3f %13.3f %13.3f \n", fValue[kMultiplicity] + fValueStep[kMultiplicity],
141 fValue[kZVertex] + fValueStep[kZVertex],
142 fValue[kEventPlane] + fValueStep[kEventPlane]);
143
144 fEventCuts->SetMultiplicityRange(Int_t(fValue[kMultiplicity]) , Int_t(fValue[kMultiplicity] + fValueStep[kMultiplicity]));
145 fEventCuts->SetPrimaryVertexZRange(fValue[kZVertex] , fValue[kZVertex] + fValueStep[kZVertex]);
146 fEventCuts->SetEventPlaneAngleRange(fValue[kEventPlane] , fValue[kEventPlane] + fValueStep[kEventPlane]);
9ce6b490 147 fChain = fTagAnalysis->QueryTags(fRunCuts, fLHCCuts, fDetectorCuts, fEventCuts);
df5036f6 148//
149// Next bin
150//
151 for (Int_t i = 2; i >= 0; i--)
152 {
153 fValue[i] += fValueStep[i];
154 if (i > 0 && fValue[i] >= fValueMax[i]) {
155 fValue[i] = fValueMin[i];
156 } else if (i == 0 && fValue[i] >= fValueMax[i]) {
157 fNoMore = kTRUE;
158 } else {
159 break;
160 }
161 }
9ce6b490 162 return fChain;
2d0a3a45 163 }
164}
165
166void AliEventPoolOTF::GetCurrentBin(Float_t* /*bin*/)
167{
168 //
169}
170
171Int_t AliEventPoolOTF::GetDimension()
172{
173 //
df5036f6 174 return (3);
2d0a3a45 175}
176
df5036f6 177void AliEventPoolOTF::InitArrays()
178{
179 // Initializes the pool axis
180
181 SetMultiplicityBinning(0, 20000, 20000);
182 SetZVertexBinning(-1000., 1000., 2000.);
183 SetEventPlaneBinning(-1000., 1000., 2000.);
184 SetLeadingParticleEtaBinning(-1.0, 1.0, 2.);
185 for (Int_t i = 0; i < 4; i++) fValue[i] = fValueMin[i];
186}
187
188