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