* 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
* // 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;
* // 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
*/
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);
// 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++;
// 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;
}
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,