Event Mixing for Triggered BF analysis
[u/mrichter/AliRoot.git] / PWGCF / EBYE / BalanceFunctions / AliAnalysisTaskTriggeredBF.cxx
index 6da8866d20905cf10d91f893572c53b1574588ca..c1c6153cffe3441e6e4fe72783f6dd0ff5f3a41d 100755 (executable)
@@ -50,9 +50,11 @@ AliAnalysisTaskTriggeredBF::AliAnalysisTaskTriggeredBF(const char *name)
   fRunMixing(kFALSE),\r
   fMixingTracks(50000),\r
   fMixedBalance(0),\r
   fRunMixing(kFALSE),\r
   fMixingTracks(50000),\r
   fMixedBalance(0),\r
+  fPoolMgr(0),\r
   fList(0),\r
   fListTriggeredBF(0),\r
   fListTriggeredBFS(0),\r
   fList(0),\r
   fListTriggeredBF(0),\r
   fListTriggeredBFS(0),\r
+  fListTriggeredBFM(0),\r
   fHistListPIDQA(0),\r
   fHistEventStats(0),\r
   fHistCentStats(0),\r
   fHistListPIDQA(0),\r
   fHistEventStats(0),\r
   fHistCentStats(0),\r
@@ -103,6 +105,7 @@ AliAnalysisTaskTriggeredBF::AliAnalysisTaskTriggeredBF(const char *name)
   DefineOutput(1, TList::Class());\r
   DefineOutput(2, TList::Class());\r
   DefineOutput(3, TList::Class());\r
   DefineOutput(1, TList::Class());\r
   DefineOutput(2, TList::Class());\r
   DefineOutput(3, TList::Class());\r
+  DefineOutput(4, TList::Class());\r
 }\r
 \r
 //________________________________________________________________________\r
 }\r
 \r
 //________________________________________________________________________\r
@@ -271,15 +274,15 @@ void AliAnalysisTaskTriggeredBF::UserCreateOutputObjects() {
   Int_t trackDepth = fMixingTracks; \r
   Int_t poolsize   = 1000;  // Maximum number of events, ignored in the present implemented of AliEventPoolManager\r
    \r
   Int_t trackDepth = fMixingTracks; \r
   Int_t poolsize   = 1000;  // Maximum number of events, ignored in the present implemented of AliEventPoolManager\r
    \r
-  Double_t centralityBins[] = {0,1,2,3,4,5,6,7,8,9,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,90,100}; // SHOULD BE DEDUCED FROM CREATED ALITHN!!!\r
-  Double_t* centbins = centralityBins;\r
-  Int_t nCentralityBins  = 26;\r
-\r
+  Double_t centralityBins[] = {0.,1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,15.,20.,25.,30.,35.,40.,45.,50.,55.,60.,65.,70.,75.,80.,90.,100.}; // SHOULD BE DEDUCED FROM CREATED ALITHN!!!\r
+  Double_t* centbins        = centralityBins;\r
+  Int_t nCentralityBins     = sizeof(centralityBins) / sizeof(Double_t) - 1;\r
   \r
   // bins for second buffer are shifted by 100 cm\r
   \r
   // bins for second buffer are shifted by 100 cm\r
-  Double_t vertexBins[] = {-10, -7, -5, -3, -1, 1, 3, 5, 7, 10}; // SHOULD BE DEDUCED FROM CREATED ALITHN!!!\r
-  Double_t* vtxbins = vertexBins;\r
-  Int_t nVertexBins  = 9;\r
+  Double_t vertexBins[] = {-10., -7., -5., -3., -1., 1., 3., 5., 7., 10.}; // SHOULD BE DEDUCED FROM CREATED ALITHN!!!\r
+  Double_t* vtxbins     = vertexBins;\r
+  Int_t nVertexBins     = sizeof(vertexBins) / sizeof(Double_t) - 1;\r
+  cout<<nCentralityBins<<" "<<nVertexBins<<endl;\r
 \r
   fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nCentralityBins, centbins, nVertexBins, vtxbins);\r
 \r
 \r
   fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nCentralityBins, centbins, nVertexBins, vtxbins);\r
 \r
@@ -352,7 +355,7 @@ void AliAnalysisTaskTriggeredBF::UserExec(Option_t *) {
          {\r
            \r
            Int_t nMix = pool->GetCurrentNEvents();\r
          {\r
            \r
            Int_t nMix = pool->GetCurrentNEvents();\r
-           cout << "nMix = " << nMix << " tracks in pool = " << pool->NTracksInPool() << endl;\r
+           //cout << "nMix = " << nMix << " tracks in pool = " << pool->NTracksInPool() << endl;\r
            \r
            //((TH1F*) fListOfHistos->FindObject("eventStat"))->Fill(2);\r
            //((TH2F*) fListOfHistos->FindObject("mixedDist"))->Fill(centrality, pool->NTracksInPool());\r
            \r
            //((TH1F*) fListOfHistos->FindObject("eventStat"))->Fill(2);\r
            //((TH2F*) fListOfHistos->FindObject("mixedDist"))->Fill(centrality, pool->NTracksInPool());\r
@@ -363,17 +366,22 @@ void AliAnalysisTaskTriggeredBF::UserExec(Option_t *) {
            for (Int_t jMix=0; jMix<nMix; jMix++) \r
              {\r
                TObjArray* tracksMixed = pool->GetEvent(jMix);\r
            for (Int_t jMix=0; jMix<nMix; jMix++) \r
              {\r
                TObjArray* tracksMixed = pool->GetEvent(jMix);\r
-               fMixedBalance->FillBalance(fCentrality,tracksMixed); //NOW ONLY THE MIXED EVENT ITSELF IS FILLED --> DO ONE TRACK OF MAIN AND ONE OF MIXED (LIKE UEHISTOGRAMS!!!!)\r
+               fMixedBalance->FillBalance(fCentrality,tracksMain,tracksMixed); \r
              }\r
          }\r
              }\r
          }\r
-      }\r
+\r
+       // Update the Event pool\r
+       pool->UpdatePool(tracksMain);\r
+       //pool->PrintInfo();\r
+       \r
+      }//run mixing\r
     \r
     // calculate balance function\r
     \r
     // calculate balance function\r
-    fBalance->FillBalance(fCentrality,tracksMain);//,chargeVectorMixed); // here comes the mixing... in some time\r
+    fBalance->FillBalance(fCentrality,tracksMain,NULL);\r
     \r
     // calculate shuffled balance function\r
     if(fRunShuffling && tracksShuffled != NULL) {\r
     \r
     // calculate shuffled balance function\r
     if(fRunShuffling && tracksShuffled != NULL) {\r
-       fShuffledBalance->FillBalance(fCentrality,tracksShuffled);\r
+      fShuffledBalance->FillBalance(fCentrality,tracksShuffled,NULL);\r
     }\r
     \r
   }//AOD analysis\r
     }\r
     \r
   }//AOD analysis\r