Included Event Pool for Event Mixing for triggered analysis (full Event Mixing +...
authormiweber <miweber@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 13 May 2012 13:55:10 +0000 (13:55 +0000)
committermiweber <miweber@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 13 May 2012 13:55:10 +0000 (13:55 +0000)
PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskTriggeredBF.cxx
PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskTriggeredBF.h
PWGCF/EBYE/macros/AddTaskBalanceTriggered.C

index 228a26a..6da8866 100755 (executable)
@@ -28,7 +28,9 @@
 #include "AliStack.h"\r
 \r
 #include "TH2D.h"    \r
-#include "AliTHn.h"              \r
+#include "AliTHn.h"             \r
+\r
+#include "AliEventPoolManager.h" \r
 \r
 #include "AliAnalysisTaskTriggeredBF.h"\r
 #include "AliBalanceTriggered.h"\r
@@ -46,6 +48,7 @@ AliAnalysisTaskTriggeredBF::AliAnalysisTaskTriggeredBF(const char *name)
   fRunShuffling(kFALSE),\r
   fShuffledBalance(0),\r
   fRunMixing(kFALSE),\r
+  fMixingTracks(50000),\r
   fMixedBalance(0),\r
   fList(0),\r
   fListTriggeredBF(0),\r
@@ -264,25 +267,22 @@ void AliAnalysisTaskTriggeredBF::UserCreateOutputObjects() {
   }  \r
 \r
 \r
-  //  // event mixing\r
-  // Int_t trackDepth = fMixingTracks; \r
-  // Int_t poolsize   = 1000;  // Maximum number of events, ignored in the present implemented of AliEventPoolManager\r
+  // Event Mixing\r
+  Int_t trackDepth = fMixingTracks; \r
+  Int_t poolsize   = 1000;  // Maximum number of events, ignored in the present implemented of AliEventPoolManager\r
    \r
-  // Int_t nCentralityBins  = fHistos->GetUEHist(2)->GetEventHist()->GetNBins(1);\r
-  // Double_t* centralityBins = (Double_t*) fHistos->GetUEHist(2)->GetEventHist()->GetAxis(1, 0)->GetXbins()->GetArray();\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
   \r
-  // Int_t nZvtxBins  = 7+1+7;\r
-  // // bins for second buffer are shifted by 100 cm\r
-  // Double_t vertexBins[] = { -7, -5, -3, -1, 1, 3, 5, 7, 93, 95, 97, 99, 101, 103, 105, 107 };\r
-  // Double_t* zvtxbin = vertexBins;\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
 \r
-  // if (fHistos->GetUEHist(2)->GetEventHist()->GetNVar() > 2)\r
-  // {\r
-  //   nZvtxBins = fHistos->GetUEHist(2)->GetEventHist()->GetNBins(2);\r
-  //   zvtxbin = (Double_t*) fHistos->GetUEHist(2)->GetEventHist()->GetAxis(2, 0)->GetXbins()->GetArray();\r
-  // }\r
+  fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nCentralityBins, centbins, nVertexBins, vtxbins);\r
 \r
-  // fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nCentralityBins, centralityBins, nZvtxBins, zvtxbin);\r
 \r
   // Post output data.\r
   PostData(1, fList);\r
@@ -322,57 +322,52 @@ void AliAnalysisTaskTriggeredBF::UserExec(Option_t *) {
       tracksShuffled = GetShuffledTracks(tracksMain);\r
     }\r
     \r
-    //   if (fFillMixed)\r
-    //   {\r
-    //     // event mixing\r
-    \r
-    //     // 1. First get an event pool corresponding in mult (cent) and\r
-    //     //    zvertex to the current event. Once initialized, the pool\r
-    //     //    should contain nMix (reduced) events. This routine does not\r
-    //     //    pre-scan the chain. The first several events of every chain\r
-    //     //    will be skipped until the needed pools are filled to the\r
-    //     //    specified depth. If the pool categories are not too rare, this\r
-    //     //    should not be a problem. If they are rare, you could lose\r
-//     //    statistics.\r
-\r
-//     // 2. Collect the whole pool's content of tracks into one TObjArray\r
-//     //    (bgTracks), which is effectively a single background super-event.\r
-\r
-//     // 3. The reduced and bgTracks arrays must both be passed into\r
-//     //    FillCorrelations(). Also nMix should be passed in, so a weight\r
-//     //    of 1./nMix can be applied.\r
-\r
-//     AliEventPool* pool = fPoolMgr->GetEventPool(centrality, zVtx);\r
-    \r
-//     if (!pool)\r
-//       AliFatal(Form("No pool found for centrality = %f, zVtx = %f", centrality, zVtx));\r
-    \r
-//     //pool->SetDebug(1);\r
-     \r
-//     if (pool->IsReady() || pool->NTracksInPool() > fMixingTracks / 10 || pool->GetCurrentNEvents() >= 5) \r
-//     {\r
-      \r
-//       Int_t nMix = pool->GetCurrentNEvents();\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
-//       if (pool->IsReady())\r
-//     ((TH1F*) fListOfHistos->FindObject("eventStat"))->Fill(3);\r
-    \r
-//       // Fill mixed-event histos here  \r
-//       for (Int_t jMix=0; jMix<nMix; jMix++) \r
-//       {\r
-//     TObjArray* bgTracks = pool->GetEvent(jMix);\r
+    // Event mixing --> UPDATE POOL IS MISSING!!!\r
+    if (fRunMixing)\r
+      {\r
+        // 1. First get an event pool corresponding in mult (cent) and\r
+        //    zvertex to the current event. Once initialized, the pool\r
+        //    should contain nMix (reduced) events. This routine does not\r
+        //    pre-scan the chain. The first several events of every chain\r
+        //    will be skipped until the needed pools are filled to the\r
+        //    specified depth. If the pool categories are not too rare, this\r
+        //    should not be a problem. If they are rare, you could lose`\r
+       //    statistics.\r
        \r
-//     if (!fSkipStep6)\r
-//       fHistosMixed->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepReconstructed, tracksClone, bgTracks, 1.0 / nMix, (jMix == 0));\r
-\r
-//     if (fTwoTrackEfficiencyCut > 0)\r
-//       fHistosMixed->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepBiasStudy, tracksClone, bgTracks, 1.0 / nMix, (jMix == 0), kTRUE, bSign, fTwoTrackEfficiencyCut);\r
-//       }\r
-//     }\r
-\r
+       // 2. Collect the whole pool's content of tracks into one TObjArray\r
+       //    (bgTracks), which is effectively a single background super-event.\r
+       \r
+       // 3. The reduced and bgTracks arrays must both be passed into\r
+       //    FillCorrelations(). Also nMix should be passed in, so a weight\r
+       //    of 1./nMix can be applied.\r
+       \r
+       AliEventPool* pool = fPoolMgr->GetEventPool(fCentrality, eventMain->GetPrimaryVertex()->GetZ());\r
+       \r
+       if (!pool)\r
+         AliFatal(Form("No pool found for centrality = %f, zVtx = %f", fCentrality, eventMain->GetPrimaryVertex()->GetZ()));\r
+       \r
+       //pool->SetDebug(1);\r
+       \r
+       if (pool->IsReady() || pool->NTracksInPool() > fMixingTracks / 10 || pool->GetCurrentNEvents() >= 5) \r
+         {\r
+           \r
+           Int_t nMix = pool->GetCurrentNEvents();\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
+           //if (pool->IsReady())\r
+           //((TH1F*) fListOfHistos->FindObject("eventStat"))->Fill(3);\r
+           \r
+           // Fill mixed-event histos here  \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
+             }\r
+         }\r
+      }\r
+    \r
     // calculate balance function\r
     fBalance->FillBalance(fCentrality,tracksMain);//,chargeVectorMixed); // here comes the mixing... in some time\r
     \r
@@ -381,7 +376,6 @@ void AliAnalysisTaskTriggeredBF::UserExec(Option_t *) {
        fShuffledBalance->FillBalance(fCentrality,tracksShuffled);\r
     }\r
     \r
-    \r
   }//AOD analysis\r
   else{\r
     AliError("Triggered Balance Function analysis only for AODs!");\r
index d1d8fb8..cceef25 100755 (executable)
@@ -13,6 +13,7 @@ class TH1F;
 class TH2F;\r
 \r
 class AliBalanceTriggered;\r
+class AliEventPoolManager;\r
 \r
 \r
 class AliAnalysisTaskTriggeredBF : public AliAnalysisTaskSE {\r
@@ -38,6 +39,8 @@ class AliAnalysisTaskTriggeredBF : public AliAnalysisTaskSE {
     fRunMixing = kTRUE;\r
     fMixedBalance = analysisMixed;\r
   }\r
+  void SetMixingTracks(Int_t tracks) { fMixingTracks = tracks; }\r
+\r
  \r
   void SetVertexDiamond(Double_t vx, Double_t vy, Double_t vz) {\r
     fVxMax = vx;\r
@@ -100,7 +103,11 @@ class AliAnalysisTaskTriggeredBF : public AliAnalysisTaskSE {
   Bool_t fRunShuffling;//run shuffling or not\r
   AliBalanceTriggered *fShuffledBalance; //TriggeredBF object (shuffled)\r
   Bool_t fRunMixing;//run mixing or not\r
+  Int_t  fMixingTracks;\r
   AliBalanceTriggered *fMixedBalance; //TriggeredBF object (mixed)\r
+  AliEventPoolManager*     fPoolMgr;         //! event pool manager\r
+    \r
+\r
   TList *fList; //fList object\r
   TList *fListTriggeredBF; //fList object\r
   TList *fListTriggeredBFS; //fList object (shuffling)\r
index 9fbe296..5ba46a0 100644 (file)
@@ -97,6 +97,7 @@ AliAnalysisTaskTriggeredBF *AddTaskBalanceTriggered(Double_t centrMin=0.,
       bfm = new AliBalanceTriggered();\r
       bfm->SetAnalysisLevel(analysisType);\r
       bfm->InitHistograms();\r
+      bfm->SetMixingTracks(50000)\r
     }\r
   }\r
   else{\r
@@ -149,11 +150,13 @@ AliAnalysisTaskTriggeredBF *AddTaskBalanceTriggered(Double_t centrMin=0.,
   AliAnalysisDataContainer *coutQA = mgr->CreateContainer(Form("listQA_%s",centralityName.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());\r
   AliAnalysisDataContainer *coutTriggeredBF = mgr->CreateContainer(Form("listTriggeredBF_%s",centralityName.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());\r
   if(gRunShuffling) AliAnalysisDataContainer *coutTriggeredBFS = mgr->CreateContainer(Form("listTriggeredBFShuffled_%s",centralityName.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());\r
+  if(gRunMixing) AliAnalysisDataContainer *coutTriggeredBFM = mgr->CreateContainer(Form("listTriggeredBFMixed_%s",centralityName.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());\r
 \r
   mgr->ConnectInput(taskTriggeredBF, 0, mgr->GetCommonInputContainer());\r
   mgr->ConnectOutput(taskTriggeredBF, 1, coutQA);\r
   mgr->ConnectOutput(taskTriggeredBF, 2, coutTriggeredBF);\r
   if(gRunShuffling) mgr->ConnectOutput(taskTriggeredBF, 3, coutTriggeredBFS);\r
+  if(gRunMixing) mgr->ConnectOutput(taskTriggeredBF, 4, coutTriggeredBFM);\r
 \r
   return taskTriggeredBF;\r
 }\r