Adding the vertex requirement
authorpchrist <pchrist@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 3 Oct 2010 18:39:54 +0000 (18:39 +0000)
committerpchrist <pchrist@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 3 Oct 2010 18:39:54 +0000 (18:39 +0000)
PWG2/EBYE/AliAnalysisTaskBF.cxx
PWG2/EBYE/AliAnalysisTaskBF.h
PWG2/EBYE/macros/AddTaskBalanceFunction.C

index 594ce38..fcdd836 100755 (executable)
@@ -34,7 +34,10 @@ AliAnalysisTaskBF::AliAnalysisTaskBF(const char *name)
     fBalance(0),
     fList(0),
     fHistEventStats(0),
-    fESDtrackCuts(0) {
+    fESDtrackCuts(0),
+    fVxMax(0.3),
+    fVyMax(0.3),
+    fVzMax(10.) {
   // Constructor
 
   // Define input and output slots here
@@ -99,22 +102,32 @@ void AliAnalysisTaskBF::UserExec(Option_t *) {
 
       const AliESDVertex *vertex = gESD->GetPrimaryVertex();
       if(vertex) {
-       fHistEventStats->Fill(3); //events with a proper vertex
-       fHistEventStats->Fill(4); //analayzed events
+       if(vertex->GetNContributors() > 0) {
+         if(vertex->GetZRes() != 0) {
+           fHistEventStats->Fill(3); //events with a proper vertex
+           if(TMath::Abs(vertex->GetXv()) < fVxMax) {
+             if(TMath::Abs(vertex->GetYv()) < fVyMax) {
+               if(TMath::Abs(vertex->GetZv()) < fVzMax) {
+                 fHistEventStats->Fill(4); //analayzed events
        
-       Printf("There are %d tracks in this event", gESD->GetNumberOfTracks());
-       for (Int_t iTracks = 0; iTracks < gESD->GetNumberOfTracks(); iTracks++) {
-         AliESDtrack* track = gESD->GetTrack(iTracks);
-         if (!track) {
-           Printf("ERROR: Could not receive track %d", iTracks);
-           continue;
-         }
-
-         //ESD track cuts
-         if(fESDtrackCuts) 
-           if(!fESDtrackCuts->AcceptTrack(track)) continue;
-         array->Add(track);
-       } //track loop
+                 Printf("There are %d tracks in this event", gESD->GetNumberOfTracks());
+                 for (Int_t iTracks = 0; iTracks < gESD->GetNumberOfTracks(); iTracks++) {
+                   AliESDtrack* track = gESD->GetTrack(iTracks);
+                   if (!track) {
+                     Printf("ERROR: Could not receive track %d", iTracks);
+                     continue;
+                   }
+                   
+                   //ESD track cuts
+                   if(fESDtrackCuts) 
+                     if(!fESDtrackCuts->AcceptTrack(track)) continue;
+                   array->Add(track);
+                 } //track loop
+               }//Vz cut
+             }//Vy cut
+           }//Vx cut
+         }//proper vertex resolution
+       }//proper number of contributors
       }//vertex object valid
     }//triggered event 
   }//ESD analysis
index 51b9708..a2e74c9 100755 (executable)
@@ -25,7 +25,12 @@ class AliAnalysisTaskBF : public AliAnalysisTaskSE {
     fBalance = analysis;}\r
   void SetAnalysisCutObject(AliESDtrackCuts *const trackCuts) {\r
     fESDtrackCuts = trackCuts;}\r
-  \r
+  void SetVeretxDiamond(Double_t vx, Double_t vy, Double_t vz) {\r
+    fVxMax = vx;\r
+    fVyMax = vy;\r
+    fVzMax = vz;\r
+  }\r
+\r
  private:\r
   AliBalance *fBalance; //BF object\r
   TList *fList; //fList object\r
@@ -33,6 +38,10 @@ class AliAnalysisTaskBF : public AliAnalysisTaskSE {
 \r
   AliESDtrackCuts *fESDtrackCuts; //ESD track cuts\r
 \r
+  Double_t fVxMax;//vxmax\r
+  Double_t fVyMax;//vxmax\r
+  Double_t fVzMax;//vxmax\r
+\r
   AliAnalysisTaskBF(const AliAnalysisTaskBF&); // not implemented\r
   AliAnalysisTaskBF& operator=(const AliAnalysisTaskBF&); // not implemented\r
   \r
index 2da01bf..4267e9d 100644 (file)
@@ -26,6 +26,7 @@ AliAnalysisTaskBF *AddTaskBalanceFunction() {
   AliAnalysisTaskBF *taskBF = new AliAnalysisTaskBF("TaskBF");
   mgr->AddTask(taskBF);
   taskBF->SetAnalysisObject(bf);
+  taskBF->SetVertexDiamond(0.3,0.3,10.);
 
   if (type=="ESD") {
     AliESDtrackCuts *trackCuts = GetTrackCutsObject();