Introduced HBT and conversion cuts for standard BF analysis; Move from Vectors to...
authormiweber <miweber@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 13 May 2012 11:41:35 +0000 (11:41 +0000)
committermiweber <miweber@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 13 May 2012 11:41:35 +0000 (11:41 +0000)
PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskBF.cxx
PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskTriggeredBF.cxx
PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskTriggeredBF.h
PWGCF/EBYE/BalanceFunctions/AliBalance.cxx
PWGCF/EBYE/BalanceFunctions/AliBalance.h
PWGCF/EBYE/BalanceFunctions/AliBalanceTriggered.cxx
PWGCF/EBYE/BalanceFunctions/AliBalanceTriggered.h
PWGCF/EBYE/macros/AddTaskBalanceCentralityTrain.C
PWGCF/EBYE/macros/AddTaskBalanceTriggered.C
PWGCF/EBYE/macros/configBalanceFunctionAnalysis.C
PWGCF/PWGCFebyeLinkDef.h

index 9e9b50c..8626450 100755 (executable)
@@ -368,6 +368,9 @@ void AliAnalysisTaskBF::UserExec(Option_t *) {
   Int_t gNumberOfAcceptedTracks = 0;\r
   Float_t fCentrality           = 0.;\r
 \r
+  // for HBT like cuts need magnetic field sign\r
+  Float_t bSign = 0; // only used in AOD so far\r
+\r
   // vector holding the charges/kinematics of all tracks (charge,y,eta,phi,p0,p1,p2,pt,E)\r
   vector<Double_t> *chargeVectorShuffle[9];   // this will be shuffled\r
   vector<Double_t> *chargeVector[9];          // original charge\r
@@ -632,6 +635,9 @@ void AliAnalysisTaskBF::UserExec(Option_t *) {
       return;\r
     }\r
 \r
+    // for HBT like cuts need magnetic field sign\r
+    bSign = (gAOD->GetMagneticField() > 0) ? 1 : -1;\r
+\r
     AliAODHeader *aodHeader = gAOD->GetHeader();\r
 \r
     // store offline trigger bits\r
@@ -1132,20 +1138,20 @@ void AliAnalysisTaskBF::UserExec(Option_t *) {
       return;\r
   }\r
   fHistNumberOfAcceptedTracks->Fill(gNumberOfAcceptedTracks);\r
-  \r
+\r
   // calculate balance function\r
   if(fUseMultiplicity) \r
-    fBalance->CalculateBalance(gNumberOfAcceptedTracks,chargeVector);\r
+    fBalance->CalculateBalance(gNumberOfAcceptedTracks,chargeVector,bSign);\r
   else                 \r
-    fBalance->CalculateBalance(fCentrality,chargeVector);\r
+    fBalance->CalculateBalance(fCentrality,chargeVector,bSign);\r
 \r
   if(fRunShuffling) {\r
     // shuffle charges\r
     random_shuffle( chargeVectorShuffle[0]->begin(), chargeVectorShuffle[0]->end() );\r
     if(fUseMultiplicity) \r
-      fShuffledBalance->CalculateBalance(gNumberOfAcceptedTracks,chargeVectorShuffle);\r
+      fShuffledBalance->CalculateBalance(gNumberOfAcceptedTracks,chargeVectorShuffle,bSign);\r
     else                 \r
-      fShuffledBalance->CalculateBalance(fCentrality,chargeVectorShuffle);\r
+      fShuffledBalance->CalculateBalance(fCentrality,chargeVectorShuffle,bSign);\r
   }\r
 }      \r
 \r
index 1ddedf3..228a26a 100755 (executable)
@@ -45,6 +45,8 @@ AliAnalysisTaskTriggeredBF::AliAnalysisTaskTriggeredBF(const char *name)
   fBalance(0),\r
   fRunShuffling(kFALSE),\r
   fShuffledBalance(0),\r
+  fRunMixing(kFALSE),\r
+  fMixedBalance(0),\r
   fList(0),\r
   fListTriggeredBF(0),\r
   fListTriggeredBFS(0),\r
@@ -121,6 +123,12 @@ void AliAnalysisTaskTriggeredBF::UserCreateOutputObjects() {
       fShuffledBalance->SetAnalysisLevel("AOD");\r
     }\r
   }\r
+  if(fRunMixing) {\r
+    if(!fMixedBalance) {\r
+      fMixedBalance = new AliBalanceTriggered();\r
+      fMixedBalance->SetAnalysisLevel("AOD");\r
+    }\r
+  }\r
 \r
   //QA list\r
   fList = new TList();\r
@@ -137,6 +145,11 @@ void AliAnalysisTaskTriggeredBF::UserCreateOutputObjects() {
     fListTriggeredBFS->SetName("listTriggeredBFShuffled");\r
     fListTriggeredBFS->SetOwner();\r
   }\r
+  if(fRunMixing) {\r
+    fListTriggeredBFM = new TList();\r
+    fListTriggeredBFM->SetName("listTriggeredBFMixed");\r
+    fListTriggeredBFM->SetOwner();\r
+  }\r
   \r
   \r
   //Event stats.\r
@@ -217,6 +230,14 @@ void AliAnalysisTaskTriggeredBF::UserCreateOutputObjects() {
     }\r
   }\r
 \r
+  if(fRunMixing) {\r
+    if(!fMixedBalance->GetHistNp()) {\r
+      AliWarning("Histograms (mixing) not yet initialized! --> Will be done now");\r
+      AliWarning("--> Add 'gBalance->InitHistograms()' in your configBalanceFunction");\r
+      fMixedBalance->InitHistograms();\r
+    }\r
+  }\r
+\r
   fListTriggeredBF->Add(fBalance->GetHistNp());\r
   fListTriggeredBF->Add(fBalance->GetHistNn());\r
   fListTriggeredBF->Add(fBalance->GetHistNpn());\r
@@ -233,13 +254,41 @@ void AliAnalysisTaskTriggeredBF::UserCreateOutputObjects() {
     fListTriggeredBFS->Add(fShuffledBalance->GetHistNnp());\r
   }  \r
 \r
+  if(fRunMixing) {\r
+    fListTriggeredBFM->Add(fMixedBalance->GetHistNp());\r
+    fListTriggeredBFM->Add(fMixedBalance->GetHistNn());\r
+    fListTriggeredBFM->Add(fMixedBalance->GetHistNpn());\r
+    fListTriggeredBFM->Add(fMixedBalance->GetHistNnn());\r
+    fListTriggeredBFM->Add(fMixedBalance->GetHistNpp());\r
+    fListTriggeredBFM->Add(fMixedBalance->GetHistNnp());\r
+  }  \r
 \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
+   \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
+  \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
+\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
+\r
+  // fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nCentralityBins, centralityBins, nZvtxBins, zvtxbin);\r
 \r
   // Post output data.\r
   PostData(1, fList);\r
   PostData(2, fListTriggeredBF);\r
   if(fRunShuffling) PostData(3, fListTriggeredBFS);\r
+  if(fRunMixing) PostData(4, fListTriggeredBFM);\r
 }\r
 \r
 //________________________________________________________________________\r
@@ -248,206 +297,277 @@ void AliAnalysisTaskTriggeredBF::UserExec(Option_t *) {
   // Called for each event\r
 \r
   TString gAnalysisLevel = fBalance->GetAnalysisLevel();\r
-\r
-  Float_t fCentrality           = 0.;\r
-  \r
-  // vector holding the charges/kinematics of all tracks (charge,y,eta,phi,p0,p1,p2,pt,E)\r
-  vector<Double_t> *chargeVector[9];          // original charge\r
-  vector<Double_t> *chargeVectorShuffled[9];  // shuffled charge\r
-\r
-  for(Int_t i = 0; i < 9; i++){\r
-    chargeVector[i]         = new vector<Double_t>;\r
-    chargeVectorShuffled[i] = new vector<Double_t>;\r
-  }\r
-  \r
-  Double_t v_charge;\r
-  Double_t v_y;\r
-  Double_t v_eta;\r
-  Double_t v_phi;\r
-  Double_t v_p[3];\r
-  Double_t v_pt;\r
-  Double_t v_E;\r
+  Float_t fCentrality = 0.;  \r
 \r
   // -------------------------------------------------------------                  \r
   // AOD analysis (vertex and track cuts also here!!!!)\r
   if(gAnalysisLevel == "AOD") {\r
-    AliAODEvent* aodEventMain = dynamic_cast<AliAODEvent*>(InputEvent()); \r
-    if(!aodEventMain) {\r
-      AliError("aodEventMain not available");\r
+    AliVEvent* eventMain = dynamic_cast<AliVEvent*>(InputEvent()); \r
+    if(!eventMain) {\r
+      AliError("eventMain not available");\r
+      return;\r
+    }\r
+\r
+    // check event cuts and fill event histograms\r
+    if((fCentrality = IsEventAccepted(eventMain)) < 0){\r
       return;\r
     }\r
     \r
+    // get the accepted tracks in main event\r
+    TObjArray *tracksMain = GetAcceptedTracks(eventMain);\r
+\r
+    // store charges of all accepted tracks, shuffle and reassign (two extra loops!)\r
+    TObjArray* tracksShuffled = NULL;\r
+    if(fRunShuffling){\r
+      tracksShuffled = GetShuffledTracks(tracksMain);\r
+    }\r
     \r
-    AliAODHeader *aodHeaderMain = aodEventMain->GetHeader();\r
-    \r
-    // event selection done in AliAnalysisTaskSE::Exec() --> this is not used\r
-    fHistEventStats->Fill(1); //all events\r
+    //   if (fFillMixed)\r
+    //   {\r
+    //     // event mixing\r
     \r
-    Bool_t isSelectedMain = kTRUE;\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(fUseOfflineTrigger)\r
-      isSelectedMain = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();\r
+//     if (!pool)\r
+//       AliFatal(Form("No pool found for centrality = %f, zVtx = %f", centrality, zVtx));\r
     \r
-    if(isSelectedMain) {\r
-      fHistEventStats->Fill(2); //triggered events\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
-      //Centrality stuff (centrality in AOD header)\r
-      if(fUseCentrality) {\r
-       fCentrality = aodHeaderMain->GetCentralityP()->GetCentralityPercentile(fCentralityEstimator.Data());\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
        \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
+    // calculate balance function\r
+    fBalance->FillBalance(fCentrality,tracksMain);//,chargeVectorMixed); // here comes the mixing... in some time\r
+    \r
+    // calculate shuffled balance function\r
+    if(fRunShuffling && tracksShuffled != NULL) {\r
+       fShuffledBalance->FillBalance(fCentrality,tracksShuffled);\r
+    }\r
+    \r
+    \r
+  }//AOD analysis\r
+  else{\r
+    AliError("Triggered Balance Function analysis only for AODs!");\r
+  }\r
+}     \r
+\r
+//________________________________________________________________________\r
+Float_t AliAnalysisTaskTriggeredBF::IsEventAccepted(AliVEvent *event){\r
+  // Checks the Event cuts\r
+  // Fills Event statistics histograms\r
+  \r
+  // event selection done in AliAnalysisTaskSE::Exec() --> this is not used\r
+  fHistEventStats->Fill(1); //all events\r
+\r
+  Bool_t isSelectedMain = kTRUE;\r
+  Float_t fCentrality = -1.;\r
+  TString gAnalysisLevel = fBalance->GetAnalysisLevel();\r
+  \r
+  if(fUseOfflineTrigger)\r
+    isSelectedMain = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();\r
+  \r
+  if(isSelectedMain) {\r
+    fHistEventStats->Fill(2); //triggered events\r
+    \r
+    //Centrality stuff \r
+    if(fUseCentrality) {\r
+      if(gAnalysisLevel == "AOD") { //centrality in AOD header\r
+       AliAODHeader *header = (AliAODHeader*) event->GetHeader();\r
+       fCentrality = header->GetCentralityP()->GetCentralityPercentile(fCentralityEstimator.Data());\r
+\r
        // QA for centrality estimators\r
-       fHistCentStats->Fill(0.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("V0M"));\r
-       fHistCentStats->Fill(1.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("FMD"));\r
-       fHistCentStats->Fill(2.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("TRK"));\r
-       fHistCentStats->Fill(3.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("TKL"));\r
-       fHistCentStats->Fill(4.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("CL0"));\r
-       fHistCentStats->Fill(5.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("CL1"));\r
-       fHistCentStats->Fill(6.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("V0MvsFMD"));\r
-       fHistCentStats->Fill(7.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("TKLvsV0M"));\r
-       fHistCentStats->Fill(8.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("ZEMvsZDC"));\r
-       \r
-       // take only events inside centrality class\r
-       if((fCentrality < fCentralityPercentileMin) || (fCentrality > fCentralityPercentileMax)) \r
-         return;\r
+       fHistCentStats->Fill(0.,header->GetCentralityP()->GetCentralityPercentile("V0M"));\r
+       fHistCentStats->Fill(1.,header->GetCentralityP()->GetCentralityPercentile("FMD"));\r
+       fHistCentStats->Fill(2.,header->GetCentralityP()->GetCentralityPercentile("TRK"));\r
+       fHistCentStats->Fill(3.,header->GetCentralityP()->GetCentralityPercentile("TKL"));\r
+       fHistCentStats->Fill(4.,header->GetCentralityP()->GetCentralityPercentile("CL0"));\r
+       fHistCentStats->Fill(5.,header->GetCentralityP()->GetCentralityPercentile("CL1"));\r
+       fHistCentStats->Fill(6.,header->GetCentralityP()->GetCentralityPercentile("V0MvsFMD"));\r
+       fHistCentStats->Fill(7.,header->GetCentralityP()->GetCentralityPercentile("TKLvsV0M"));\r
+       fHistCentStats->Fill(8.,header->GetCentralityP()->GetCentralityPercentile("ZEMvsZDC"));\r
        \r
        // centrality QA (V0M)\r
-       fHistV0M->Fill(aodEventMain->GetVZEROData()->GetMTotV0A(), aodEventMain->GetVZEROData()->GetMTotV0C());\r
+       fHistV0M->Fill(event->GetVZEROData()->GetMTotV0A(), event->GetVZEROData()->GetMTotV0C());\r
        \r
        // centrality QA (reference tracks)\r
-       fHistRefTracks->Fill(0.,aodHeaderMain->GetRefMultiplicity());\r
-       fHistRefTracks->Fill(1.,aodHeaderMain->GetRefMultiplicityPos());\r
-       fHistRefTracks->Fill(2.,aodHeaderMain->GetRefMultiplicityNeg());\r
-       fHistRefTracks->Fill(3.,aodHeaderMain->GetTPConlyRefMultiplicity());\r
-       fHistRefTracks->Fill(4.,aodHeaderMain->GetNumberOfITSClusters(0));\r
-       fHistRefTracks->Fill(5.,aodHeaderMain->GetNumberOfITSClusters(1));\r
-       fHistRefTracks->Fill(6.,aodHeaderMain->GetNumberOfITSClusters(2));\r
-       fHistRefTracks->Fill(7.,aodHeaderMain->GetNumberOfITSClusters(3));\r
-       fHistRefTracks->Fill(8.,aodHeaderMain->GetNumberOfITSClusters(4));\r
+       fHistRefTracks->Fill(0.,header->GetRefMultiplicity());\r
+       fHistRefTracks->Fill(1.,header->GetRefMultiplicityPos());\r
+       fHistRefTracks->Fill(2.,header->GetRefMultiplicityNeg());\r
+       fHistRefTracks->Fill(3.,header->GetTPConlyRefMultiplicity());\r
+       fHistRefTracks->Fill(4.,header->GetNumberOfITSClusters(0));\r
+       fHistRefTracks->Fill(5.,header->GetNumberOfITSClusters(1));\r
+       fHistRefTracks->Fill(6.,header->GetNumberOfITSClusters(2));\r
+       fHistRefTracks->Fill(7.,header->GetNumberOfITSClusters(3));\r
+       fHistRefTracks->Fill(8.,header->GetNumberOfITSClusters(4));\r
       }\r
-      \r
-      const AliAODVertex *vertexMain = aodEventMain->GetPrimaryVertex();\r
-      \r
-      if(vertexMain) {\r
-       Double32_t fCovMain[6];\r
-       vertexMain->GetCovarianceMatrix(fCovMain);\r
-       \r
-       if(vertexMain->GetNContributors() > 0) {\r
-         if(fCovMain[5] != 0) {\r
-           fHistEventStats->Fill(3); //events with a proper vertex\r
-           if(TMath::Abs(vertexMain->GetX()) < fVxMax) {\r
-             if(TMath::Abs(vertexMain->GetY()) < fVyMax) {\r
-               if(TMath::Abs(vertexMain->GetZ()) < fVzMax) {\r
-                 fHistEventStats->Fill(4); //analyzed events\r
-                 fHistVx->Fill(vertexMain->GetX());\r
-                 fHistVy->Fill(vertexMain->GetY());\r
-                 fHistVz->Fill(vertexMain->GetZ());\r
-                 \r
-                 // Loop over tracks in main event\r
-                 for (Int_t iTracksMain = 0; iTracksMain < aodEventMain->GetNumberOfTracks(); iTracksMain++) {\r
-                   AliAODTrack* aodTrackMain = dynamic_cast<AliAODTrack *>(aodEventMain->GetTrack(iTracksMain));\r
-                   if (!aodTrackMain) {\r
-                     AliError(Form("Could not receive track %d", iTracksMain));\r
-                     continue;\r
-                   }\r
-                   \r
-                   // AOD track cuts\r
-                   \r
-                   // For ESD Filter Information: ANALYSIS/macros/AddTaskESDfilter.C\r
-                   // take only TPC only tracks \r
-                   fHistTrackStats->Fill(aodTrackMain->GetFilterMap());\r
-                   if(!aodTrackMain->TestFilterBit(nAODtrackCutBit)) continue;\r
-                   \r
-                   v_charge = aodTrackMain->Charge();\r
-                   v_y      = aodTrackMain->Y();\r
-                   v_eta    = aodTrackMain->Eta();\r
-                   v_phi    = aodTrackMain->Phi() * TMath::RadToDeg();\r
-                   v_E      = aodTrackMain->E();\r
-                   v_pt     = aodTrackMain->Pt();\r
-                   aodTrackMain->PxPyPz(v_p);\r
-                   \r
-                   Float_t DCAxy = aodTrackMain->DCA();      // this is the DCA from global track (not exactly what is cut on)\r
-                   Float_t DCAz  = aodTrackMain->ZAtDCA();   // this is the DCA from global track (not exactly what is cut on)\r
-                   \r
-                   \r
-                   // Kinematics cuts from ESD track cuts\r
-                   if( v_pt < fPtMin || v_pt > fPtMax)      continue;\r
-                   if( v_eta < fEtaMin || v_eta > fEtaMax)  continue;\r
-                   \r
-                   // Extra DCA cuts (for systematic studies [!= -1])\r
-                   if( fDCAxyCut != -1 && fDCAzCut != -1){\r
-                     if(TMath::Sqrt((DCAxy*DCAxy)/(fDCAxyCut*fDCAxyCut)+(DCAz*DCAz)/(fDCAzCut*fDCAzCut)) > 1 ){\r
-                       continue;  // 2D cut\r
-                     }\r
-                   }\r
-                   \r
-                   // Extra TPC cuts (for systematic studies [!= -1])\r
-                   if( fTPCchi2Cut != -1 && aodTrackMain->Chi2perNDF() > fTPCchi2Cut){\r
-                     continue;\r
-                   }\r
-                   if( fNClustersTPCCut != -1 && aodTrackMain->GetTPCNcls() < fNClustersTPCCut){\r
-                     continue;\r
-                   }\r
-                   \r
-                   // fill QA histograms\r
-                   fHistClus->Fill(aodTrackMain->GetITSNcls(),aodTrackMain->GetTPCNcls());\r
-                   fHistDCA->Fill(DCAz,DCAxy);\r
-                   fHistChi2->Fill(aodTrackMain->Chi2perNDF());\r
-                   fHistPt->Fill(v_pt);\r
-                   fHistEta->Fill(v_eta);\r
-                   fHistPhi->Fill(v_phi);\r
-                   \r
-                   // fill charge vector\r
-                   chargeVector[0]->push_back(v_charge);\r
-                   chargeVector[1]->push_back(v_y);\r
-                   chargeVector[2]->push_back(v_eta);\r
-                   chargeVector[3]->push_back(v_phi);\r
-                   chargeVector[4]->push_back(v_p[0]);\r
-                   chargeVector[5]->push_back(v_p[1]);\r
-                   chargeVector[6]->push_back(v_p[2]);\r
-                   chargeVector[7]->push_back(v_pt);\r
-                   chargeVector[8]->push_back(v_E);\r
-\r
-                   if(fRunShuffling) {\r
-                     chargeVectorShuffled[0]->push_back(v_charge);\r
-                     chargeVectorShuffled[1]->push_back(v_y);\r
-                     chargeVectorShuffled[2]->push_back(v_eta);\r
-                     chargeVectorShuffled[3]->push_back(v_phi);\r
-                     chargeVectorShuffled[4]->push_back(v_p[0]);\r
-                     chargeVectorShuffled[5]->push_back(v_p[1]);\r
-                     chargeVectorShuffled[6]->push_back(v_p[2]);\r
-                     chargeVectorShuffled[7]->push_back(v_pt);\r
-                     chargeVectorShuffled[8]->push_back(v_E);\r
-                   }\r
-                   \r
-                 } //track loop\r
-                 \r
-                 // calculate balance function\r
-                 fBalance->FillBalance(fCentrality,chargeVector);\r
-                 \r
-                 // calculate shuffled balance function\r
-                 if(fRunShuffling) {\r
-                   random_shuffle(chargeVectorShuffled[0]->begin(), chargeVectorShuffled[0]->end());\r
-                   fShuffledBalance->FillBalance(fCentrality,chargeVectorShuffled);\r
-                 }\r
-\r
-                 // clean charge vector afterwards\r
-                 for(Int_t i = 0; i < 9; i++){                \r
-                   chargeVector[i]->clear();\r
-                   chargeVectorShuffled[i]->clear();\r
-                 }\r
-\r
-               }//Vz cut\r
-             }//Vy cut\r
-           }//Vx cut\r
-         }//proper vertex resolution\r
-       }//proper number of contributors\r
-      }//vertex object valid\r
-    }//triggered event \r
-  }//AOD analysis\r
-  else{\r
-    AliError("Triggered Balance Function analysis only for AODs!");\r
+    }\r
+    \r
+    \r
+    const AliVVertex *vertex = event->GetPrimaryVertex();\r
+    \r
+    if(vertex) {\r
+      Double32_t fCov[6];\r
+      vertex->GetCovarianceMatrix(fCov);\r
+      if(vertex->GetNContributors() > 0) {\r
+       if(fCov[5] != 0) {\r
+         fHistEventStats->Fill(3); //events with a proper vertex\r
+         if(TMath::Abs(vertex->GetX()) < fVxMax) {\r
+           if(TMath::Abs(vertex->GetY()) < fVyMax) {\r
+             if(TMath::Abs(vertex->GetZ()) < fVzMax) {\r
+               fHistEventStats->Fill(4); //analyzed events\r
+               fHistVx->Fill(vertex->GetX());\r
+               fHistVy->Fill(vertex->GetY());\r
+               fHistVz->Fill(vertex->GetZ());\r
+\r
+               // take only events inside centrality class\r
+               if((fCentrality > fCentralityPercentileMin) && (fCentrality < fCentralityPercentileMax)){\r
+                 return fCentrality;           \r
+               }//centrality class\r
+             }//Vz cut\r
+           }//Vy cut\r
+         }//Vx cut\r
+       }//proper vertex resolution\r
+      }//proper number of contributors\r
+    }//vertex object valid\r
+  }//triggered event \r
+  \r
+  // in all other cases return -1 (event not accepted)\r
+  return -1;\r
+}\r
+\r
+//________________________________________________________________________\r
+TObjArray* AliAnalysisTaskTriggeredBF::GetAcceptedTracks(AliVEvent *event){\r
+  // Returns TObjArray with tracks after all track cuts (only for AOD!)\r
+  // Fills QA histograms\r
+\r
+  //output TObjArray holding all good tracks\r
+  TObjArray* tracksAccepted = new TObjArray;\r
+  tracksAccepted->SetOwner(kTRUE);\r
+\r
+  Double_t v_charge;\r
+  Double_t v_eta;\r
+  Double_t v_phi;\r
+  Double_t v_pt;\r
+  \r
+  // Loop over tracks in event\r
+  for (Int_t iTracks = 0; iTracks < event->GetNumberOfTracks(); iTracks++) {\r
+    AliAODTrack* aodTrack = dynamic_cast<AliAODTrack *>(event->GetTrack(iTracks));\r
+    if (!aodTrack) {\r
+      AliError(Form("Could not receive track %d", iTracks));\r
+      continue;\r
+    }\r
+    \r
+    // AOD track cuts\r
+    \r
+    // For ESD Filter Information: ANALYSIS/macros/AddTaskESDfilter.C\r
+    // take only TPC only tracks \r
+    fHistTrackStats->Fill(aodTrack->GetFilterMap());\r
+    if(!aodTrack->TestFilterBit(nAODtrackCutBit)) continue;\r
+    \r
+    v_charge = aodTrack->Charge();\r
+    v_eta    = aodTrack->Eta();\r
+    v_phi    = aodTrack->Phi() * TMath::RadToDeg();\r
+    v_pt     = aodTrack->Pt();\r
+    \r
+    Float_t DCAxy = aodTrack->DCA();      // this is the DCA from global track (not exactly what is cut on)\r
+    Float_t DCAz  = aodTrack->ZAtDCA();   // this is the DCA from global track (not exactly what is cut on)\r
+    \r
+    \r
+    // Kinematics cuts from ESD track cuts\r
+    if( v_pt < fPtMin || v_pt > fPtMax)      continue;\r
+    if( v_eta < fEtaMin || v_eta > fEtaMax)  continue;\r
+    \r
+    // Extra DCA cuts (for systematic studies [!= -1])\r
+    if( fDCAxyCut != -1 && fDCAzCut != -1){\r
+      if(TMath::Sqrt((DCAxy*DCAxy)/(fDCAxyCut*fDCAxyCut)+(DCAz*DCAz)/(fDCAzCut*fDCAzCut)) > 1 ){\r
+       continue;  // 2D cut\r
+      }\r
+    }\r
+    \r
+    // Extra TPC cuts (for systematic studies [!= -1])\r
+    if( fTPCchi2Cut != -1 && aodTrack->Chi2perNDF() > fTPCchi2Cut){\r
+      continue;\r
+    }\r
+    if( fNClustersTPCCut != -1 && aodTrack->GetTPCNcls() < fNClustersTPCCut){\r
+      continue;\r
+    }\r
+    \r
+    // fill QA histograms\r
+    fHistClus->Fill(aodTrack->GetITSNcls(),aodTrack->GetTPCNcls());\r
+    fHistDCA->Fill(DCAz,DCAxy);\r
+    fHistChi2->Fill(aodTrack->Chi2perNDF());\r
+    fHistPt->Fill(v_pt);\r
+    fHistEta->Fill(v_eta);\r
+    fHistPhi->Fill(v_phi);\r
+    \r
+    // add the track to the TObjArray\r
+    tracksAccepted->Add(new AliBFBasicParticle(v_eta, v_phi, v_pt, v_charge));\r
   }\r
-}     \r
+\r
+  return tracksAccepted;\r
+}\r
+\r
+//________________________________________________________________________\r
+TObjArray* AliAnalysisTaskTriggeredBF::GetShuffledTracks(TObjArray *tracks){\r
+  // Clones TObjArray and returns it with tracks after shuffling the charges\r
+\r
+  TObjArray* tracksShuffled = new TObjArray;\r
+  tracksShuffled->SetOwner(kTRUE);\r
+\r
+  vector<Short_t> *chargeVector = new vector<Short_t>;   //original charge of accepted tracks \r
+\r
+  for (Int_t i=0; i<tracks->GetEntriesFast(); i++)\r
+  {\r
+    AliVParticle* track = (AliVParticle*) tracks->At(i);\r
+    chargeVector->push_back(track->Charge());\r
+  }  \r
\r
+  random_shuffle(chargeVector->begin(), chargeVector->end());\r
+  \r
+  for(Int_t i = 0; i < tracks->GetEntriesFast(); i++){\r
+    AliVParticle* track = (AliVParticle*) tracks->At(i);\r
+    tracksShuffled->Add(new AliBFBasicParticle(track->Eta(), track->Phi(), track->Pt(),chargeVector->at(i)));\r
+  }\r
+   \r
+  return tracksShuffled;\r
+}\r
 \r
 //________________________________________________________________________\r
 void  AliAnalysisTaskTriggeredBF::FinishTaskOutput(){\r
index 3da0a2b..d1d8fb8 100755 (executable)
@@ -4,18 +4,16 @@
 // Analysis task for the TriggeredBF code\r
 // Authors: Panos Cristakoglou@cern.ch, m.weber@cern.ch\r
 \r
+#include "AliLog.h"\r
+#include "AliAnalysisTaskSE.h"\r
+#include "AliBalanceTriggered.h"\r
+\r
 class TList;\r
 class TH1F;\r
 class TH2F;\r
-class TF1;\r
 \r
 class AliBalanceTriggered;\r
-class AliESDtrackCuts;\r
-\r
-#include "AliAnalysisTaskSE.h"\r
-#include "AliBalanceTriggered.h"\r
 \r
\r
 \r
 class AliAnalysisTaskTriggeredBF : public AliAnalysisTaskSE {\r
  public:\r
@@ -36,6 +34,10 @@ class AliAnalysisTaskTriggeredBF : public AliAnalysisTaskSE {
     fRunShuffling = kTRUE;\r
     fShuffledBalance = analysisShuffled;\r
   }\r
+  void SetMixingObject(AliBalanceTriggered *const analysisMixed) {\r
+    fRunMixing = kTRUE;\r
+    fMixedBalance = analysisMixed;\r
+  }\r
  \r
   void SetVertexDiamond(Double_t vx, Double_t vy, Double_t vz) {\r
     fVxMax = vx;\r
@@ -90,12 +92,19 @@ class AliAnalysisTaskTriggeredBF : public AliAnalysisTaskSE {
   \r
 \r
  private:\r
+  Float_t    IsEventAccepted(AliVEvent* event);\r
+  TObjArray* GetAcceptedTracks(AliVEvent* event);\r
+  TObjArray* GetShuffledTracks(TObjArray* tracks);\r
+\r
   AliBalanceTriggered *fBalance; //TriggeredBF object\r
   Bool_t fRunShuffling;//run shuffling or not\r
   AliBalanceTriggered *fShuffledBalance; //TriggeredBF object (shuffled)\r
+  Bool_t fRunMixing;//run mixing or not\r
+  AliBalanceTriggered *fMixedBalance; //TriggeredBF object (mixed)\r
   TList *fList; //fList object\r
   TList *fListTriggeredBF; //fList object\r
-  TList *fListTriggeredBFS; //fList object\r
+  TList *fListTriggeredBFS; //fList object (shuffling)\r
+  TList *fListTriggeredBFM; //fList object (mixing)\r
   TList *fHistListPIDQA;  //! list of histograms\r
 \r
   TH1F *fHistEventStats; //event stats\r
@@ -156,4 +165,54 @@ class AliAnalysisTaskTriggeredBF : public AliAnalysisTaskSE {
   ClassDef(AliAnalysisTaskTriggeredBF, 1); // example of analysis\r
 };\r
 \r
+// class used for io with AliBalance (taken from AliAnalysisTaskPhiCorrelations)\r
+class AliBFBasicParticle : public AliVParticle\r
+{ \r
+  public:\r
+    AliBFBasicParticle(Float_t eta, Float_t phi, Float_t pt, Short_t charge)\r
+      : fEta(eta), fPhi(phi), fpT(pt), fCharge(charge)\r
+    {\r
+    }\r
+    ~AliBFBasicParticle() {}\r
+    \r
+    // kinematics\r
+    virtual Double_t Px() const { AliFatal("Not implemented"); return 0; }\r
+    virtual Double_t Py() const { AliFatal("Not implemented"); return 0; }\r
+    virtual Double_t Pz() const { AliFatal("Not implemented"); return 0; }\r
+    virtual Double_t Pt() const { return fpT; }\r
+    virtual Double_t P() const { AliFatal("Not implemented"); return 0; }\r
+    virtual Bool_t   PxPyPz(Double_t[3]) const { AliFatal("Not implemented"); return 0; }\r
+\r
+    virtual Double_t Xv() const { AliFatal("Not implemented"); return 0; }\r
+    virtual Double_t Yv() const { AliFatal("Not implemented"); return 0; }\r
+    virtual Double_t Zv() const { AliFatal("Not implemented"); return 0; }\r
+    virtual Bool_t   XvYvZv(Double_t[3]) const { AliFatal("Not implemented"); return 0; }\r
+\r
+    virtual Double_t OneOverPt()  const { AliFatal("Not implemented"); return 0; }\r
+    virtual Double_t Phi()        const { return fPhi; }\r
+    virtual Double_t Theta()      const { AliFatal("Not implemented"); return 0; }\r
+\r
+\r
+    virtual Double_t E()          const { AliFatal("Not implemented"); return 0; }\r
+    virtual Double_t M()          const { AliFatal("Not implemented"); return 0; }\r
+    \r
+    virtual Double_t Eta()        const { return fEta; }\r
+    virtual Double_t Y()          const { AliFatal("Not implemented"); return 0; }\r
+    \r
+    virtual Short_t Charge()      const { return fCharge; }\r
+    virtual Short_t SetCharge(Short_t charge)   { fCharge = charge; }\r
+    virtual Int_t   GetLabel()    const { AliFatal("Not implemented"); return 0; }\r
+    // PID\r
+    virtual Int_t   PdgCode()     const { AliFatal("Not implemented"); return 0; }      \r
+    virtual const Double_t *PID() const { AliFatal("Not implemented"); return 0; }\r
+    \r
+  private:\r
+    Float_t fEta;      // eta\r
+    Float_t fPhi;      // phi\r
+    Float_t fpT;       // pT\r
+    Short_t fCharge;   // charge\r
+    \r
+    ClassDef( AliBFBasicParticle, 1); // class which contains only quantities requires for this analysis to reduce memory consumption for event mixing\r
+};\r
+\r
 #endif\r
index 611ed65..9cf48c8 100644 (file)
@@ -44,6 +44,7 @@ AliBalance::AliBalance() :
   TObject(), 
   bShuffle(kFALSE),
   bHBTcut(kFALSE),
+  bConversionCut(kFALSE),
   fAnalysisLevel("ESD"),
   fAnalyzedEvents(0) ,
   fCentralityId(0) ,
@@ -100,6 +101,7 @@ AliBalance::AliBalance(const AliBalance& balance):
   TObject(balance), 
   bShuffle(balance.bShuffle),
   bHBTcut(balance.bHBTcut), 
+  bConversionCut(balance.bConversionCut), 
   fAnalysisLevel(balance.fAnalysisLevel),
   fAnalyzedEvents(balance.fAnalyzedEvents), 
   fCentralityId(balance.fCentralityId),
@@ -240,12 +242,12 @@ void AliBalance::PrintAnalysisSettings() {
 }
 
 //____________________________________________________________________//
-void AliBalance::CalculateBalance(Float_t fCentrality,vector<Double_t> **chargeVector) {
+void AliBalance::CalculateBalance(Float_t fCentrality,vector<Double_t> **chargeVector,Float_t bSign) {
   // Calculates the balance function
   fAnalyzedEvents++;
   Int_t i = 0 , j = 0;
   Int_t iBin = 0;
-  
+
   // Initialize histograms if not done yet
   if(!fHistPN[0]){
     AliWarning("Histograms not yet initialized! --> Will be done now");
@@ -393,11 +395,75 @@ void AliBalance::CalculateBalance(Float_t fCentrality,vector<Double_t> **chargeV
 
        // HBT like cut
        if(bHBTcut){
-         if( dphi < 3 || deta < 0.01 ){
-           continue;
-         }
+         //if( dphi < 3 || deta < 0.01 ){   // VERSION 1
+         //  continue;
+         
+         // VERSION 2 (Taken from DPhiCorrelations)
+         // the variables & cuthave been developed by the HBT group 
+         // see e.g. https://indico.cern.ch/materialDisplay.py?contribId=36&sessionId=6&materialId=slides&confId=142700
+         
+         // optimization
+         if (TMath::Abs(deta) < 0.02 * 2.5 * 3) //twoTrackEfficiencyCutValue = 0.02 [default for dphicorrelations]
+           {
+             // check first boundaries to see if is worth to loop and find the minimum
+             Float_t dphistar1 = GetDPhiStar(phi1*TMath::DegToRad(), pt1, charge1, phi2*TMath::DegToRad(), pt2, charge2, 0.8, bSign);
+             Float_t dphistar2 = GetDPhiStar(phi1*TMath::DegToRad(), pt1, charge1, phi2*TMath::DegToRad(), pt2, charge2, 2.5, bSign);
+             
+             const Float_t kLimit = 0.02 * 3;
+             
+             Float_t dphistarminabs = 1e5;
+             Float_t dphistarmin = 1e5;
+             if (TMath::Abs(dphistar1) < kLimit || TMath::Abs(dphistar2) < kLimit || dphistar1 * dphistar2 < 0)
+               {
+                 for (Double_t rad=0.8; rad<2.51; rad+=0.01) 
+                   {
+                     Float_t dphistar = GetDPhiStar(phi1*TMath::DegToRad(), pt1, charge1, phi2*TMath::DegToRad(), pt2, charge2, rad, bSign);
+                     
+                     Float_t dphistarabs = TMath::Abs(dphistar);
+                     
+                     if (dphistarabs < dphistarminabs)
+                       {
+                         dphistarmin = dphistar;
+                         dphistarminabs = dphistarabs;
+                       }
+                   }
+                 
+                 if (dphistarminabs < 0.02 && TMath::Abs(deta) < 0.02)
+                   {
+                     //Printf("Removed track pair %d %d with %f %f %f %f %d %f %f %d %f", i, j, deta, dphistarminabs, phi1, pt1, charge1, phi2, pt2, charge2, bSign);
+                     continue;
+                   }
+               }
+           }
        }
-
+       
+       // conversions
+       if(bConversionCut){
+         if (charge1 * charge2 < 0)
+           {
+             Float_t m0 = 0.510e-3;
+             Float_t tantheta1 = 1e10;
+             
+             if (eta1 < -1e-10 || eta1 > 1e-10)
+               tantheta1 = 2 * TMath::Exp(-eta1) / ( 1 - TMath::Exp(-2*eta1));
+             
+             Float_t tantheta2 = 1e10;
+             if (eta2 < -1e-10 || eta2 > 1e-10)
+               tantheta2 = 2 * TMath::Exp(-eta2) / ( 1 - TMath::Exp(-2*eta2));
+             
+             Float_t e1squ = m0 * m0 + pt1 * pt1 * (1.0 + 1.0 / tantheta1 / tantheta1);
+             Float_t e2squ = m0 * m0 + pt2 * pt2 * (1.0 + 1.0 / tantheta2 / tantheta2);
+             
+             Float_t mass = 2 * m0 * m0 + 2 * ( TMath::Sqrt(e1squ * e2squ) - ( pt1 * pt2 * ( TMath::Cos(phi1 - phi2) + 1.0 / tantheta1 / tantheta2 ) ) );
+             
+             if (mass < 0.04*0.04){
+               //Printf("Removed track pair %d %d with %f %f %d %d ", i, j, deta, mass, charge1, charge2);
+               continue;
+             }
+           }
+       }
+       
+       
        //0:y - 1:eta - 2:Qlong - 3:Qout - 4:Qside - 5:Qinv - 6:phi
        if((rap1 >= fP1Start[kRapidity]) && (rap1 <= fP1Stop[kRapidity]) && (rap2 >= fP1Start[kRapidity]) && (rap2 <= fP1Stop[kRapidity])) {
 
index 54a7ed8..36f1fdc 100644 (file)
@@ -47,6 +47,7 @@ class AliBalance : public TObject {
     fAnalysisLevel = analysisLevel;}
   void SetShuffle(Bool_t shuffle) {bShuffle = shuffle;}
   void SetHBTcut(Bool_t HBTcut) {bHBTcut = HBTcut;}
+  void SetConversionCut(Bool_t ConversionCut) {bConversionCut = ConversionCut;}
   void SetInterval(Int_t iAnalysisType, Double_t p1Start, Double_t p1Stop,
                   Int_t ibins, Double_t p2Start, Double_t p2Stop);
   void SetCentralityInterval(Double_t cStart, Double_t cStop)  { fCentStart = cStart; fCentStop = cStop;};
@@ -79,7 +80,7 @@ class AliBalance : public TObject {
   Double_t GetNnp(Int_t analysisType, Int_t p2) const { 
     return 1.0*fNnp[analysisType][p2]; }
 
-  void CalculateBalance(Float_t fCentrality, vector<Double_t> **chargeVector);
+  void CalculateBalance(Float_t fCentrality, vector<Double_t> **chargeVector,Float_t bSign = 0.);
   
   Double_t GetBalance(Int_t a, Int_t p2);
   Double_t GetError(Int_t a, Int_t p2);
@@ -111,8 +112,11 @@ class AliBalance : public TObject {
   void PrintResults(Int_t iAnalysisType, TH1D *gHist);
 
  private:
+  inline Float_t GetDPhiStar(Float_t phi1, Float_t pt1, Float_t charge1, Float_t phi2, Float_t pt2, Float_t charge2, Float_t radius, Float_t bSign);
+
   Bool_t bShuffle; // shuffled balance function object
   Bool_t bHBTcut;  // apply HBT like cuts
+  Bool_t bConversionCut;  // apply conversion cuts
 
   TString fAnalysisLevel; //ESD, AOD or MC
   Int_t fAnalyzedEvents; //number of events that have been analyzed
@@ -145,9 +149,37 @@ class AliBalance : public TObject {
   TH2D *fHistPP[ANALYSIS_TYPES]; //N++
   TH2D *fHistNN[ANALYSIS_TYPES]; //N--
 
+
+
   AliBalance & operator=(const AliBalance & ) {return *this;}
 
   ClassDef(AliBalance, 3)
 };
 
+Float_t AliBalance::GetDPhiStar(Float_t phi1, Float_t pt1, Float_t charge1, Float_t phi2, Float_t pt2, Float_t charge2, Float_t radius, Float_t bSign)
+{ 
+  //
+  // calculates dphistar
+  //
+  
+  Float_t dphistar = phi1 - phi2 - charge1 * bSign * TMath::ASin(0.075 * radius / pt1) + charge2 * bSign * TMath::ASin(0.075 * radius / pt2);
+  
+  static const Double_t kPi = TMath::Pi();
+  
+  // circularity
+//   if (dphistar > 2 * kPi)
+//     dphistar -= 2 * kPi;
+//   if (dphistar < -2 * kPi)
+//     dphistar += 2 * kPi;
+  
+  if (dphistar > kPi)
+    dphistar = kPi * 2 - dphistar;
+  if (dphistar < -kPi)
+    dphistar = -kPi * 2 - dphistar;
+  if (dphistar > kPi) // might look funny but is needed
+    dphistar = kPi * 2 - dphistar;
+  
+  return dphistar;
+}
+
 #endif
index 03db96d..3a1dbe6 100644 (file)
@@ -45,7 +45,6 @@ ClassImp(AliBalanceTriggered)
 //____________________________________________________________________//
 AliBalanceTriggered::AliBalanceTriggered() :
   TObject(), 
-  bShuffle(kFALSE),
   fAnalysisLevel("AOD"),
   fHistP(0x0),
   fHistN(0x0),
@@ -61,7 +60,7 @@ AliBalanceTriggered::AliBalanceTriggered() :
 
 //____________________________________________________________________//
 AliBalanceTriggered::AliBalanceTriggered(const AliBalanceTriggered& balance):
-  TObject(balance), bShuffle(balance.bShuffle), 
+  TObject(balance), 
   fAnalysisLevel(balance.fAnalysisLevel),
   fHistP(balance.fHistP),
   fHistN(balance.fHistN),
@@ -246,7 +245,7 @@ void AliBalanceTriggered::InitHistograms() {
 }
 
 //____________________________________________________________________//
-void AliBalanceTriggered::FillBalance(Float_t fCentrality,vector<Double_t> **chargeVector) {
+void AliBalanceTriggered::FillBalance(Float_t fCentrality,TObjArray *particles) {
   // Calculates the balance function
 
  
@@ -257,19 +256,21 @@ void AliBalanceTriggered::FillBalance(Float_t fCentrality,vector<Double_t> **cha
     InitHistograms();
   }
 
-  Int_t gNtrack = chargeVector[0]->size();
+  Int_t gNtrack = particles->GetEntriesFast();
   Double_t trackVarsSingle[nTrackVarsSingle];
   Double_t trackVarsPair[nTrackVarsPair];
 
   // 1st particle loop
   for(Int_t i = 0; i < gNtrack;i++){
 
-    Short_t  charge = (Short_t) chargeVector[0]->at(i);
-    trackVarsSingle[0]    =  chargeVector[2]->at(i);  //eta
-    trackVarsSingle[1]    =  chargeVector[3]->at(i);  //phi
-    trackVarsSingle[2]    =  chargeVector[7]->at(i);  //pt trigger
-    trackVarsSingle[3]    =  fCentrality;             //centrality (really as variable here????)
+    AliVParticle* firstParticle = (AliVParticle*) particles->At(i);
 
+    Short_t  charge = (Short_t) firstParticle->Charge();
+    trackVarsSingle[0]    =  firstParticle->Eta(); //eta
+    trackVarsSingle[1]    =  firstParticle->Phi(); //phi
+    trackVarsSingle[2]    =  firstParticle->Pt();  //pt trigger
+    trackVarsSingle[3]    =  fCentrality;          //centrality (really as variable here????)
+    
     //fill single particle histograms
     if(charge > 0)  fHistP->Fill(trackVarsSingle,0,1.); 
     else            fHistN->Fill(trackVarsSingle,0,1.); 
@@ -280,17 +281,19 @@ void AliBalanceTriggered::FillBalance(Float_t fCentrality,vector<Double_t> **cha
     //                          --> can be handled afterwards by using assoc. as trigger as well ?!
 
     for(Int_t j = 0; j < i; j++) {
+
+      AliVParticle* secondParticle = (AliVParticle*) particles->At(j);
       
-      Short_t charge2 = (Short_t) chargeVector[0]->at(j);
-      trackVarsPair[0]    =  chargeVector[2]->at(i) - chargeVector[2]->at(j) ;  // delta eta
-      trackVarsPair[1]    =  chargeVector[3]->at(i) - chargeVector[3]->at(j);   // delta phi
+      Short_t charge2 = (Short_t) secondParticle->Charge();
+      trackVarsPair[0]    =  firstParticle->Eta() - secondParticle->Eta();  // delta eta
+      trackVarsPair[1]    =  firstParticle->Phi() - secondParticle->Phi();  // delta phi
       if (trackVarsPair[1] > 180)   // delta phi between -180 and 180 
        trackVarsPair[1] -= 360;
       if (trackVarsPair[1] <  - 180) 
        trackVarsPair[1] += 360;
  
-      trackVarsPair[2]    =  chargeVector[7]->at(j);  // pt
-      trackVarsPair[3]    =  chargeVector[7]->at(i);  // pt trigger
+      trackVarsPair[2]    =  firstParticle->Pt();  // pt
+      trackVarsPair[3]    =  secondParticle->Pt();  // pt trigger
       trackVarsPair[4]    =  fCentrality;             // centrality
 
       if( charge > 0 && charge2 < 0)  fHistPN->Fill(trackVarsPair,0,1.); 
index 5d90fe6..dda88b4 100644 (file)
@@ -31,11 +31,9 @@ class AliBalanceTriggered : public TObject {
   // analysis setters
   void SetAnalysisLevel(const char* analysisLevel) {
     fAnalysisLevel = analysisLevel;}
-  void SetShuffle(Bool_t shuffle) {bShuffle = shuffle;}
 
   // analysis getters
   const char* GetAnalysisLevel() {return fAnalysisLevel.Data();}
-  Bool_t GetShuffle() {return bShuffle;}
 
   // initialize histograms
   void InitHistograms(void);
@@ -57,7 +55,7 @@ class AliBalanceTriggered : public TObject {
   AliTHn *GetHistNnn() { return fHistNN;}
 
   // Fill balance function histograms
-  void FillBalance(Float_t fCentrality,vector<Double_t> **chargeVector);
+  void FillBalance(Float_t fCentrality,TObjArray* particles);
  
   // Get the balance function histogram 
   TH1D *GetBalanceFunctionHistogram1D(Int_t var, Double_t pTMinTrigger, Double_t pTMaxTrigger, Double_t pTMin, Double_t pTMax, Double_t centrMin, Double_t centrMax);
@@ -72,7 +70,6 @@ class AliBalanceTriggered : public TObject {
   TH2D* GetHistogram2D(Int_t histo, Int_t var1, Int_t var2, Double_t pTMinTrigger, Double_t pTMaxTrigger, Double_t pTMin, Double_t pTMax, Double_t centrMin, Double_t centrMax);
 
  private:
-  Bool_t bShuffle; //shuffled balance function object
   TString fAnalysisLevel; // ESD, AOD or MC
 
   AliTHn *fHistP;  //N+
index 6a0fb7e..f6d7d8e 100644 (file)
@@ -32,6 +32,7 @@ AliAnalysisTaskBF *AddTaskBalanceCentralityTrain(Double_t centrMin=0.,
                                                 Int_t AODfilterBit = 128,\r
                                                 Bool_t bCentralTrigger = kFALSE,\r
                                                 Bool_t bHBTcut = kFALSE,\r
+                                                Bool_t bConversionCut = kFALSE,\r
                                                 TString fileNameBase="AnalysisResults") {\r
 \r
   // Creates a balance function analysis task and adds it to the analysis manager.\r
@@ -64,6 +65,7 @@ AliAnalysisTaskBF *AddTaskBalanceCentralityTrain(Double_t centrMin=0.,
   centralityName+=Form("%d",AODfilterBit);\r
   if(bCentralTrigger)   centralityName+="_withCentralTrigger";\r
   if(bHBTcut)   centralityName+="_withHBTcut";\r
+  if(bConversionCut)   centralityName+="_withConversionCut";\r
 \r
 \r
 \r
@@ -95,16 +97,16 @@ AliAnalysisTaskBF *AddTaskBalanceCentralityTrain(Double_t centrMin=0.,
   AliBalance *bfs = 0;  // shuffled Balance function object\r
 \r
   if (analysisType=="ESD"){\r
-    bf  = GetBalanceFunctionObject("ESD",centralityEstimator,centrMin,centrMax,kFALSE,bHBTcut);\r
-    if(gRunShuffling) bfs = GetBalanceFunctionObject("ESD",centralityEstimator,centrMin,centrMax,kTRUE,bHBTcut);\r
+    bf  = GetBalanceFunctionObject("ESD",centralityEstimator,centrMin,centrMax,kFALSE,bHBTcut,bConversionCut);\r
+    if(gRunShuffling) bfs = GetBalanceFunctionObject("ESD",centralityEstimator,centrMin,centrMax,kTRUE,bHBTcut,bConversionCut);\r
   }\r
   else if (analysisType=="AOD"){\r
-    bf  = GetBalanceFunctionObject("AOD",centralityEstimator,centrMin,centrMax,kFALSE,bHBTcut);\r
-    if(gRunShuffling) bfs = GetBalanceFunctionObject("AOD",centralityEstimator,centrMin,centrMax,kTRUE,bHBTcut);\r
+    bf  = GetBalanceFunctionObject("AOD",centralityEstimator,centrMin,centrMax,kFALSE,bHBTcut,bConversionCut);\r
+    if(gRunShuffling) bfs = GetBalanceFunctionObject("AOD",centralityEstimator,centrMin,centrMax,kTRUE,bHBTcut,bConversionCut);\r
   }\r
   else if (analysisType=="MC"){\r
-    bf  = GetBalanceFunctionObject("MC",centralityEstimator,centrMin,centrMax,kFALSE,bHBTcut);\r
-    if(gRunShuffling) bfs = GetBalanceFunctionObject("MC",centralityEstimator,centrMin,centrMax,kTRUE,bHBTcut);\r
+    bf  = GetBalanceFunctionObject("MC",centralityEstimator,centrMin,centrMax,kFALSE,bHBTcut,bConversionCut);\r
+    if(gRunShuffling) bfs = GetBalanceFunctionObject("MC",centralityEstimator,centrMin,centrMax,kTRUE,bHBTcut,bConversionCut);\r
   }\r
   else{\r
     ::Error("AddTaskBF", "analysis type NOT known.");\r
index 46fbfe8..9fbe296 100644 (file)
@@ -10,6 +10,7 @@ Double_t gMinAcceptedProbability = 0.7;
 AliAnalysisTaskTriggeredBF *AddTaskBalanceTriggered(Double_t centrMin=0.,\r
                                                 Double_t centrMax=100.,\r
                                                 Bool_t gRunShuffling=kFALSE,\r
+                                                Bool_t gRunMixing=kFALSE,\r
                                                 TString centralityEstimator="V0M",\r
                                                 Double_t vertexZ=10.,\r
                                                 Double_t DCAxy=-1,\r
@@ -79,20 +80,24 @@ AliAnalysisTaskTriggeredBF *AddTaskBalanceTriggered(Double_t centrMin=0.,
   // setup the balance function objects\r
   AliBalanceTriggered *bf  = 0;  // Balance Function object\r
   AliBalanceTriggered *bfs = 0;  // shuffled Balance function object\r
+  AliBalanceTriggered *bfm = 0;  // mixing Balance function object\r
   \r
   if (analysisType=="AOD"){\r
     \r
     bf = new AliBalanceTriggered();\r
     bf->SetAnalysisLevel(analysisType);\r
-    bf->SetShuffle(kFALSE);\r
     bf->InitHistograms();\r
     \r
     if(gRunShuffling){\r
       bfs = new AliBalanceTriggered();\r
       bfs->SetAnalysisLevel(analysisType);\r
-      bfs->SetShuffle(kTRUE);\r
       bfs->InitHistograms();\r
     }\r
+    if(gRunMixing){\r
+      bfm = new AliBalanceTriggered();\r
+      bfm->SetAnalysisLevel(analysisType);\r
+      bfm->InitHistograms();\r
+    }\r
   }\r
   else{\r
     ::Error("AddTaskTriggeredBF", "analysis type NOT supported.");\r
@@ -104,6 +109,7 @@ AliAnalysisTaskTriggeredBF *AddTaskBalanceTriggered(Double_t centrMin=0.,
   AliAnalysisTaskTriggeredBF *taskTriggeredBF = new AliAnalysisTaskTriggeredBF("TaskTriggeredBF");\r
   taskTriggeredBF->SetAnalysisObject(bf);\r
   if(gRunShuffling) taskTriggeredBF->SetShufflingObject(bfs);\r
+  if(gRunMixing) taskTriggeredBF->SetMixingObject(bfm);\r
 \r
   taskTriggeredBF->SetCentralityPercentileRange(centrMin,centrMax);\r
   if(analysisType == "AOD") {\r
index f1f5d37..d5ed4db 100644 (file)
@@ -4,12 +4,14 @@ AliBalance *GetBalanceFunctionObject(const char* analysisLevel = "ESD",
                                     Double_t centrMin = 0.,\r
                                     Double_t centrMax = 100.,\r
                                     Bool_t bShuffle = kFALSE,\r
-                                    Bool_t bHBTcut = kFALSE) {\r
+                                    Bool_t bHBTcut = kFALSE,\r
+                                    Bool_t bConversionCut = kFALSE) {\r
   //Function to setup the AliBalance object and return it\r
   AliBalance *gBalance = new AliBalance();\r
   gBalance->SetAnalysisLevel(analysisLevel);\r
   gBalance->SetShuffle(bShuffle);\r
   gBalance->SetHBTcut(bHBTcut);\r
+  gBalance->SetConversionCut(bConversionCut);\r
   if(centralityName) gBalance->SetCentralityIdentifier(centralityName);\r
   gBalance->SetCentralityInterval(centrMin,centrMax);\r
 \r
index 6b9ed1a..deb1132 100644 (file)
@@ -8,6 +8,7 @@
 #pragma link C++ class AliBalancePsi+;
 #pragma link C++ class AliBalanceEventMixing+;
 #pragma link C++ class AliBalanceTriggered+;
+#pragma link C++ class AliBFBasicParticle+;
 #pragma link C++ class AliAnalysisTaskBF+;
 #pragma link C++ class AliAnalysisTaskBFPsi+;
 #pragma link C++ class AliAnalysisTaskEventMixingBF+;