Fixes
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 17 Nov 2010 15:04:18 +0000 (15:04 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 17 Nov 2010 15:04:18 +0000 (15:04 +0000)
PWG2/FORWARD/analysis2/AliAODForwardMult.h
PWG2/FORWARD/analysis2/DrawRes.C

index 9387c76a9aeb6f275507ab2346d6f09665d11522..6aadbb19ac69f118ca41d28b5c9e7627dd1d2414 100644 (file)
@@ -20,16 +20,26 @@ class TBrowser;
  * should of course also do proper book-keeping of the accepted event.
  *
  * @code 
- *   TH2D*              sum        = 0;                   // Summed hist
- *   TTree*             tree       = GetAODTree();        // AOD tree
- *   AliAODForwardMult* mult       = 0;                   // AOD object
- *   Int_t              nTriggered = 0;                   // # of triggered ev.
- *   Int_t              nAccepted  = 0;                   // # of ev. w/vertex
- *   Int_t              nAvailable = tree->GetEntries();  // How many entries
- *   Float_t            vzLow      = -10;                 // Lower ip cut
- *   Float_t            vzHigh     =  10;                 // Upper ip cut
- *   Int_t              mask       = AliAODForward::kINEL;// Trigger mask
- *   tree->SetBranchAddress("forward", &forward);         // Set the address
+ * TTree* GetAODTree()
+ * { 
+ *    TFile* file = TFile::Open("AliAODs.root","READ");
+ *    TTree* tree = static_cast<TTree*>(file->Get("aodTree"));
+ *    return tree;
+ * }
+ * 
+ * void Analyse()
+ * { 
+ *   TH2D*              sum        = 0;                  // Summed hist
+ *   TTree*             tree       = GetAODTree();       // AOD tree
+ *   AliAODForwardMult* mult       = 0;                  // AOD object
+ *   Int_t              nTriggered = 0;                  // # of triggered ev.
+ *   Int_t              nWithVertex= 0;                  // # of ev. w/vertex
+ *   Int_t              nAccepted  = 0;                  // # of ev. used
+ *   Int_t              nAvailable = tree->GetEntries(); // How many entries
+ *   Float_t            vzLow      = -10;                // Lower ip cut
+ *   Float_t            vzHigh     =  10;                // Upper ip cut
+ *   Int_t              mask       = AliAODForwardMult::kInel;// Trigger mask
+ *   tree->SetBranchAddress("forward", &forward);        // Set the address
  * 
  *   for (int i = 0; i < nAvailable; i++) { 
  *     // Create sum histogram on first event - to match binning to input
@@ -40,6 +50,10 @@ class TBrowser;
  *     // Other trigger/event requirements could be defined 
  *     if (!mult->IsTriggerBits(mask)) continue; 
  *     nTriggered++;
+ *
+ *     // Check if we have vertex 
+ *     if (!mult->HasIpZ()) continue;
+ *     nWithVertex++;
  * 
  *     // Select vertex range (in centimeters) 
  *     if (!mult->InRange(vzLow, vzHigh) continue; 
@@ -56,9 +70,10 @@ class TBrowser;
  *   // Normalize to the acceptance 
  *   dndeta->Divide(norm);
  *   // Scale by the vertex efficiency 
- *   dndeta->Scale(Double_t(nAccepted)/nTriggered, "width");
+ *   dndeta->Scale(Double_t(nWithVertex)/nTriggered, "width");
  *   // And draw the result
  *   dndeta->Draw();
+ * }
  * @endcode   
  *     
  * The above code will draw the final @f$ dN_{ch}/d\eta@f$ for the
index f3ba838de371e8578a1fba510607fdc1255789e8..8b540f49d80689a9b9341d8e314aa7d0257b3042 100644 (file)
@@ -172,9 +172,10 @@ public:
    */
   Bool_t Process(Double_t vzMin, Double_t vzMax, Int_t mask) 
   {
-    Int_t nTriggered = 0;                    // # of triggered ev.
-    Int_t nAccepted  = 0;                    // # of ev. w/vertex
-    Int_t nAvailable = fTree->GetEntries();  // How many entries
+    Int_t nTriggered  = 0;                    // # of triggered ev.
+    Int_t nWithVertex = 0;                    // # of ev. w/vertex
+    Int_t nAccepted   = 0;                    // # of ev. used
+    Int_t nAvailable  = fTree->GetEntries();  // How many entries
  
     for (int i = 0; i < nAvailable; i++) { 
       fTree->GetEntry(i);
@@ -195,7 +196,11 @@ public:
       // Other trigger/event requirements could be defined 
       if (!fAOD->IsTriggerBits(mask)) continue; 
       nTriggered++;
+
+      // Check if there's a vertex 
+      if (!fAOD->HasIpZ()) continue; 
+      nWithVertex++;
+
       // Select vertex range (in centimeters) 
       if (!fAOD->InRange(vzMin, vzMax)) continue; 
       nAccepted++;
@@ -203,10 +208,13 @@ public:
       // Add contribution from this event
       fSum->Add(&(fAOD->GetHistogram()));
     }
-    fVtxEff = Double_t(nAccepted)/nTriggered;
+    fVtxEff = Double_t(nWithVertex)/nTriggered;
 
-    Info("Process", "Got %6d triggers, accepted %6d out of %6d events", 
-        nTriggered, nAccepted, nAvailable);
+    Info("Process", "Total of %9d events\n"
+        "               %9d has a trigger\n" 
+        "               %9d has a vertex\n" 
+        "               %9d was used\n",
+        nAvailable, nTriggered, nWithVertex, nAccepted);
 
     return kTRUE;
   }
@@ -291,6 +299,21 @@ public:
       ratios->Add(Ratio(hhd,    o));
       ratios->Add(Ratio(hhdsym, o));
     }
+    if (hhd && hhdsym) { 
+      TH1F* t1 = static_cast<TH1F*>(dndeta->Clone(Form("%s_%s", 
+                                                      dndeta->GetName(), 
+                                                      hhd->GetName())));
+      t1->SetTitle(Form("%s / %s", dndeta->GetTitle(), hhd->GetTitle()));
+      TH1F* t2 = static_cast<TH1F*>(sym->Clone(Form("%s_%s", 
+                                                   sym->GetName(), 
+                                                   hhdsym->GetName())));
+      t2->SetTitle(Form("%s / %s", sym->GetTitle(), hhdsym->GetTitle()));
+      t1->Divide(hhd);
+      t2->Divide(hhdsym);
+      ratios->Add(t1);
+      ratios->Add(t2);
+    }
+
     // Make a legend
     TString trigs(AliAODForwardMult::GetTriggerString(mask));
     TLegend* l = p1->BuildLegend(.3,p1->GetBottomMargin()+.01,.7,.4,