a macro with TPC,ITS, ITSSPD vertex, global vertex and v0's
[u/mrichter/AliRoot.git] / ANALYSIS / AliEventPoolOTF.cxx
index 594a8a0..f9aaece 100644 (file)
@@ -30,6 +30,8 @@
 #include "AliTagAnalysis.h"
 
 #include <TMath.h>
+#include <TChain.h>
+#include <TGridResult.h>
 
 ClassImp(AliEventPoolOTF)
 
@@ -43,6 +45,8 @@ AliEventPoolOTF::AliEventPoolOTF():
     fLHCCuts(0),
     fDetectorCuts(0),
     fEventCuts(0),
+    fGridTags(0),
+    fChain(0),
     fTagDirectory(0),
     fValueMin(),
     fValueMax(),
@@ -63,6 +67,8 @@ AliEventPoolOTF::AliEventPoolOTF(const char* name, const char* title):
     fLHCCuts(new AliLHCTagCuts()),
     fDetectorCuts(new AliDetectorTagCuts()),
     fEventCuts(new AliEventTagCuts()),
+    fGridTags(0),
+    fChain(0),
     fTagDirectory("."),
     fValueMin(),
     fValueMax(),
@@ -84,6 +90,8 @@ AliEventPoolOTF::AliEventPoolOTF(const AliEventPoolOTF& obj):
     fLHCCuts(0),
     fDetectorCuts(0),
     fEventCuts(0),
+    fGridTags(0),
+    fChain(0),
     fTagDirectory(0),
     fValueMin(),
     fValueMax(),
@@ -107,31 +115,48 @@ AliEventPoolOTF& AliEventPoolOTF::operator=(const AliEventPoolOTF& other)
 void AliEventPoolOTF::Init()
 {
     //
-    fTagAnalysis->ChainLocalTags(fTagDirectory);
+    if (!fGridTags) {
+       fTagAnalysis->ChainLocalTags(fTagDirectory);
+    } else {
+       fTagAnalysis->ChainGridTags(fGridTags);
+    }
+    
+    
     for (Int_t i = 0; i < 4; i++) fValue[i] = fValueMin[i];    
 }
 
 TChain* AliEventPoolOTF::GetNextChain()
 {
     //
-    TChain* chain = 0;
+    if (fChain) {
+       delete fChain;
+       fChain = 0;
+    }
+
     fBinNumber++;
     if (fNoMore) {
        return 0;
     } else {
-       printf("Current bin (lower) %13.3f %13.3f %13.3f \n", fValue[kMultiplicity], fValue[kZVertex], fValue[kEventPlane]);
-       printf("Current bin (upper) %13.3f %13.3f %13.3f \n", fValue[kMultiplicity] + fValueStep[kMultiplicity], 
-                                                             fValue[kZVertex]      + fValueStep[kZVertex], 
-                                                             fValue[kEventPlane]   + fValueStep[kEventPlane]);
-       
+    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]);
+    printf("Current bin (upper) %13.3f %13.3f %13.3f %13.3f %13.3f \n", fValue[kMultiplicity] + fValueStep[kMultiplicity], 
+          fValue[kZVertex]      + fValueStep[kZVertex], 
+          fValue[kEventPlane]   + fValueStep[kEventPlane],
+          fValue[kLeadingParticleEta]   + fValueStep[kLeadingParticleEta],
+           fValue[kLeadingParticlePhi]   + fValueStep[kLeadingParticlePhi]
+    
+          );
+
        fEventCuts->SetMultiplicityRange(Int_t(fValue[kMultiplicity]) , Int_t(fValue[kMultiplicity] + fValueStep[kMultiplicity]));
        fEventCuts->SetPrimaryVertexZRange(fValue[kZVertex] , fValue[kZVertex] + fValueStep[kZVertex]);
-       fEventCuts->SetEventPlaneAngleRange(fValue[kEventPlane] , fValue[kEventPlane] + fValueStep[kEventPlane]);
-       chain = fTagAnalysis->QueryTags(fRunCuts, fLHCCuts, fDetectorCuts, fEventCuts);
+        fEventCuts->SetEtaLeadingParticleRange(fValue[kLeadingParticleEta] , fValue[kLeadingParticleEta] + fValueStep[kLeadingParticleEta]);
+        fEventCuts->SetPhiLeadingParticleRange(fValue[kLeadingParticlePhi] , fValue[kLeadingParticlePhi] + fValueStep[kLeadingParticlePhi]);
+        fEventCuts->SetEventPlaneAngleRange(fValue[kEventPlane] , fValue[kEventPlane] + fValueStep[kEventPlane]);
+    
+       fChain = fTagAnalysis->QueryTags(fRunCuts, fLHCCuts, fDetectorCuts, fEventCuts);
 //
 //      Next bin 
 //
-       for (Int_t i = 2; i >= 0; i--) 
+       for (Int_t i = 5; i >= 0; i--) 
        {
            fValue[i] += fValueStep[i];
            if (i > 0  && fValue[i] >= fValueMax[i]) {
@@ -142,7 +167,7 @@ TChain* AliEventPoolOTF::GetNextChain()
                break;
            }
        }
-       return chain;
+       return fChain;
     }
 }
 
@@ -154,7 +179,7 @@ void  AliEventPoolOTF::GetCurrentBin(Float_t* /*bin*/)
 Int_t AliEventPoolOTF::GetDimension()
 {
     //
-    return (3);
+    return (5);
 }
 
 void AliEventPoolOTF::InitArrays()
@@ -164,7 +189,9 @@ void AliEventPoolOTF::InitArrays()
     SetMultiplicityBinning(0, 20000, 20000);
     SetZVertexBinning(-1000., 1000., 2000.);
     SetEventPlaneBinning(-1000., 1000., 2000.);
-    SetLeadingParticleEtaBinning(-1.0, 1.0, 2.);    
+    SetEventPlaneBinning(-1000., 1000., 2000.);
+    SetLeadingParticleEtaBinning(-13.0, 13.0, 26.); 
+    SetLeadingParticlePhiBinning(-13.0, 13.0, 26.);   
     for (Int_t i = 0; i < 4; i++) fValue[i] = fValueMin[i];
 }