Minor things
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 26 Apr 2011 20:25:25 +0000 (20:25 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 26 Apr 2011 20:25:25 +0000 (20:25 +0000)
PWG2/FORWARD/analysis2/AddTaskCentraldNdeta.C
PWG2/FORWARD/analysis2/AddTaskForwarddNdeta.C
PWG2/FORWARD/analysis2/DrawdNdeta.C
PWG2/FORWARD/analysis2/ForwardAODConfig.C
PWG2/FORWARD/analysis2/MakeEvaluateTriggers.C
PWG2/FORWARD/analysis2/OtherData.C

index e34704a..fc5477c 100644 (file)
@@ -39,6 +39,7 @@ AddTaskCentraldNdeta(const char* trig     = "INEL",
   // Set the vertex range to use 
   task->SetVertexRange(vzMin, vzMax);
   // Set the trigger mask to use (INEL,INEL>0,NSD)
+  task->SetTriggerEff(0.997535);
   task->SetTriggerMask(trig);
   // Whether to cut edges when re-binning 
   task->SetCutEdges(cutEdges);
index 2d0de44..347dcc9 100644 (file)
@@ -40,6 +40,8 @@ AddTaskForwarddNdeta(const char* trig     = "INEL",
   task->SetVertexRange(vzMin, vzMax);
   // Set the trigger mask to use (INEL,INEL>0,NSD)
   task->SetTriggerMask(trig);
+  // Set the trigger efficiency 
+  // task->SetTriggerEff(0.997535);
   // Whether to cut edges when re-binning 
   task->SetCutEdges(cutEdges);
   // Whether to correct for empty bins when projecting 
index 3308653..e60538a 100644 (file)
@@ -14,6 +14,7 @@
  * @ingroup pwg2_forward_dndeta
  */
 #include <TH1.h>
+#include <TColor.h>
 #include <THStack.h>
 #include <TGraphErrors.h>
 #include <TGraphAsymmErrors.h>
@@ -62,6 +63,7 @@ struct dNdetaDrawer
       fShowAlice(false),        // Bool_t
       fShowRatios(false),      // Bool_t 
       fShowLeftRight(false),   // Bool_t
+      fShowRings(false),        // Bool_t 
       fRebin(5),               // UShort_t
       fCutEdges(false),                // Bool_t
       fTitle(""),              // TString
@@ -134,6 +136,7 @@ struct dNdetaDrawer
    * @param x To show or not 
    */
   void SetShowLeftRight(Bool_t x) { fShowLeftRight = x; }
+  void SetShowRings(Bool_t x) { fShowRings = x; }
   //__________________________________________________________________
   /** 
    * Set the rebinning factor 
@@ -372,12 +375,13 @@ struct dNdetaDrawer
     if (!fShowOthers && !fShowAlice) return 0;
 
     Bool_t   onlya = (fShowOthers ? false : true);
+    Bool_t   nomc  = true;
     UShort_t sys   = (fSysString  ? fSysString->GetUniqueID() : 0);
     UShort_t trg   = (fTrigString ? fTrigString->GetUniqueID() : 0);
     UShort_t snn   = (fSNNString  ? fSNNString->GetUniqueID() : 0);
-    Long_t   ret   = gROOT->ProcessLine(Form("GetData(%d,%d,%d,%d,%d,%d);",
+    Long_t   ret   = gROOT->ProcessLine(Form("GetData(%d,%d,%d,%d,%d,%d,%d);",
                                             sys,snn,trg,
-                                            centLow,centHigh,onlya));
+                                            centLow,centHigh,onlya,nomc));
     if (!ret) { 
 #if 0
       Warning("FetchResults", "No other data found for sys=%d, sNN=%d, "
@@ -526,12 +530,14 @@ struct dNdetaDrawer
     max = TMath::Max(max, AddHistogram(fResults, dndeta,      dndetaSym));
     max = TMath::Max(max, AddHistogram(fResults, tracks));
 
-    THStack* rings = static_cast<THStack*>(list->FindObject("dndetaRings"));
-    if (rings) { 
-      TIter next(rings->GetHists());
-      TH1*  hist = 0;
-      while ((hist = static_cast<TH1*>(next()))) 
-       max = TMath::Max(max, AddHistogram(fResults, hist));
+    if (fShowRings) {
+      THStack* rings = static_cast<THStack*>(list->FindObject("dndetaRings"));
+      if (rings) { 
+       TIter next(rings->GetHists());
+       TH1*  hist = 0;
+       while ((hist = static_cast<TH1*>(next()))) 
+         max = TMath::Max(max, AddHistogram(fResults, hist));
+      }
     }
     // Info("FetchResults", "Got %p, %p, %p from %s with name %s, max=%f", 
     //      dndeta, dndetaMC, dndetaTruth, list->GetName(), name, max);
@@ -622,6 +628,8 @@ struct dNdetaDrawer
     Int_t   nev  = 0;
     if (fTriggers) nev = fTriggers->GetBinContent(1);
     trg          = trg.Strip(TString::kBoth);
+    trg.ReplaceAll(" ", "_");
+    trg.ReplaceAll(">", "Gt");
     TString base(Form("dndeta_%s_%s_%s_%c%02d%c%02dcm_%09dev",
                      fSysString->GetTitle(), 
                      fSNNString->GetTitle(), 
@@ -682,7 +690,7 @@ struct dNdetaDrawer
        // l->AddEntry(hist, hist->GetTitle(), "pl");
       }
     }
-    unique.ls();
+    // unique.ls();
     TIter nextu(&unique);
     TObject* s = 0;
     Int_t i = 0;
@@ -765,7 +773,8 @@ struct dNdetaDrawer
     fResults->SetMaximum(1.15*max);
     fResults->SetMinimum(yd > 0.00001 ? -0.1 : 0);
 
-    FixAxis(fResults, 1/(1-yd)/1.7, "#frac{1}{N} #frac{dN_{ch}}{d#eta}");
+    Double_t s = (yd > 0.00001 ? 1/(1-yd)/1.7 : 1.2);
+    FixAxis(fResults, s, "#frac{1}{N} #frac{dN_{ch}}{d#eta}");
 
     p1->Clear();
     fResults->DrawClone("nostack e1");
@@ -799,6 +808,7 @@ struct dNdetaDrawer
     tit->SetTextSize(0.05);
     tit->Draw();
 
+    Int_t aliceBlue = TColor::GetColor(41,73,156);
     // Put a nice label in the plot
     TString     eS;
     UShort_t    snn = fSNNString->GetUniqueID();
@@ -812,6 +822,7 @@ struct dNdetaDrawer
                                           eS.Data(), 
                                           fCentAxis ? "by centrality" : 
                                           fTrigString->GetTitle()));
+    tt->SetTextColor(aliceBlue);
     tt->SetNDC();
     tt->SetTextFont(132);
     tt->SetTextAlign(33);
@@ -821,6 +832,7 @@ struct dNdetaDrawer
     Int_t nev = 0;
     if (fTriggers) nev = fTriggers->GetBinContent(1);
     TLatex* et = new TLatex(.93, .83, Form("%d events", nev));
+    et->SetTextColor(aliceBlue);
     et->SetNDC();
     et->SetTextFont(132);
     et->SetTextAlign(33);
@@ -832,6 +844,7 @@ struct dNdetaDrawer
       vt->SetNDC();
       vt->SetTextFont(132);
       vt->SetTextAlign(33);
+      vt->SetTextColor(aliceBlue);
       vt->Draw();
     }
     // results->Draw("nostack e1 same");
@@ -841,22 +854,29 @@ struct dNdetaDrawer
 
 
     // Mark the plot as preliminary
-    TLatex* pt = new TLatex(.12, .93, "Preliminary");
+    TLatex* pt = new TLatex(.12, .93, "Work in progress");
     pt->SetNDC();
     pt->SetTextFont(22);
-    pt->SetTextSize(0.07);
-    pt->SetTextColor(kRed+1);
+    // pt->SetTextSize();
+    pt->SetTextColor(TColor::GetColor(234,26,46));
     pt->SetTextAlign(13);
     pt->Draw();
 
-    if (!gSystem->AccessPathName("ALICE.png")) { 
-      TPad* logo = new TPad("logo", "logo", .12, .65, .25, .85, 0, 0, 0);
-      logo->SetFillStyle(0);
-      logo->Draw();
-      logo->cd();
+    const char*  logos[] = { "ALICE.png", "FMD.png", 0 };
+    const char** logo    = logos;
+    while (*logo) {
+      if (gSystem->AccessPathName(*logo)) {
+       logo++;
+       continue;
+      }
+      TPad* pad = new TPad("logo", "logo", .12, .65, .25, .85, 0, 0, 0);
+      pad->SetFillStyle(0);
+      pad->Draw();
+      pad->cd();
       TImage* i = TImage::Create();
-      i->ReadImage("ALICE.png");
+      i->ReadImage(*logo);
       i->Draw();
+      break;
     }
     p1->cd();
   }
@@ -1568,6 +1588,7 @@ struct dNdetaDrawer
   Bool_t       fShowAlice;    // Show ALICE published data
   Bool_t       fShowRatios;   // Show ratios 
   Bool_t       fShowLeftRight;// Show asymmetry 
+  Bool_t       fShowRings;    // Show rings too
   UShort_t     fRebin;        // Rebinning factor 
   Bool_t       fCutEdges;     // Whether to cut edges
   TString      fTitle;        // Title on plot
@@ -1679,6 +1700,7 @@ DrawdNdeta(const char* filename="forward_dndeta.root",
   d.SetShowAlice(flags & 0x2);
   d.SetShowRatios(flags & 0x4);
   d.SetShowLeftRight(flags & 0x8);
+  d.SetShowRings(flags & 0x10);
   // Do the below if your input data does not contain these settings 
   if (sNN > 0) d.SetSNN(sNN);     // Collision energy per nucleon pair (GeV)
   if (sys > 0) d.SetSys(sys);     // Collision system (1:pp, 2:PbPB)
index 50a8e15..314dc49 100644 (file)
@@ -31,8 +31,10 @@ ForwardAODConfig(AliForwardMultiplicityBase* task)
   // Would like to use dynamic cast but CINT interprets that as a 
   // static cast - sigh!
   Bool_t mc = false;
-  if (task->IsA() == AliForwardMCMultiplicityTask::Class()) 
+  if (task->IsA() == AliForwardMCMultiplicityTask::Class()) {
+    Info("ForwardAODConfig", "Setting up assuming Monte-Carlo input");
     mc = true;
+  }
 
 #if 0 
   if (mc) {
@@ -41,7 +43,7 @@ ForwardAODConfig(AliForwardMultiplicityBase* task)
     mcTask->SetOnlyPrimary(true);
   }
 #endif
-  Double_t nXi = mc ? 1 : .5;
+  Double_t nXi = 1; // mc ? 1 : .5;
   Bool_t   includeSigma = true;
 
   // --- Event inspector ---------------------------------------------
@@ -53,7 +55,7 @@ ForwardAODConfig(AliForwardMultiplicityBase* task)
 
   // --- Sharing filter ----------------------------------------------
   // Set the low cut used for sharing - overrides settings in eloss fits
-  task->GetSharingFilter().SetLowCut(0.15);
+  task->GetSharingFilter().SetLowCut(mc ? 0.15 : 0.2);
   // Set the number of xi's (width of landau peak) to stop at 
   task->GetSharingFilter().SetNXi(nXi);
   // Set whether or not to include sigma in cut
index 4e5481c..bc2a448 100644 (file)
@@ -33,6 +33,9 @@ public:
     kESD  = 0x1, 
     kMC   = 0x2
   };
+  enum { 
+    kMaxN = 9
+  };
   /** 
    * Constructor
    */
@@ -41,6 +44,7 @@ public:
       fInel(),
       fInelGt0(),
       fNSD(),
+      fNClusterGt0(),
       fInspector(), 
       fFirstEvent(true),
       fData(0), 
@@ -60,6 +64,7 @@ public:
       fInel(AliAODForwardMult::kInel),
       fInelGt0(AliAODForwardMult::kInelGt0),
       fNSD(AliAODForwardMult::kNSD),
+      fNClusterGt0(AliAODForwardMult::kNClusterGt0),
       fInspector("eventInspector"), 
       fFirstEvent(true), 
       fData(0), 
@@ -91,11 +96,10 @@ public:
   {
     fList = new TList;
     fList->SetOwner();
-    fList->SetName(GetName());
+    fList->SetName("triggerSums");
 
-    Double_t mb[] = { 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 1000 };
-    Int_t    nM   = 10;
-    TAxis mAxis(nM, mb);
+    // Double_t mb[] = { 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11 };
+    // Int_t    nM   = 10;
     TAxis eAxis(200, -4, 6);
     TAxis pAxis(40, 0, 2*TMath::Pi());
 
@@ -108,7 +112,7 @@ public:
     fData->SetZTitle("N_{ch}(#eta,#varphi)");
     fData->Sumw2();
     
-    fM = new TH1D("m", "Distribution of N_{ch}|_{|#eta|<1}",nM+1, -0.5, nM+.5); 
+    fM = new TH1D("m", "Distribution of N_{ch}|_{|#eta|<1}", kMaxN+1,0,kMaxN+1);
     fM->SetXTitle("N_{ch}|_{|#eta|<1}");
     fM->SetYTitle("Events");
     fM->SetFillColor(kRed+1);
@@ -116,22 +120,24 @@ public:
     fM->SetDirectory(0);
     fList->Add(fM);
 
-    for (Int_t i = 0; i <= nM; i++) { 
+    for (Int_t i = 0; i <= kMaxN; i++) { 
       TString lbl;
-      if (i == 0)       lbl = "all";
-      else if (i == nM) lbl = Form("%d+",int(mAxis.GetBinLowEdge(i)+.5));
-      else              lbl = Form("<%d",int(mAxis.GetBinUpEdge(i)+.5));
+      if (i == 0)          lbl = "all";
+      else if (i == kMaxN) lbl = Form("%d+",i-1);
+      else                 lbl = Form("<%d",i);
       fM->GetXaxis()->SetBinLabel(i+1, lbl);
     }
 
-    fTriggers = new TH1I("triggers", "Triggers", 6, -.5, 5.5);
+    fTriggers = new TH1I("triggers", "Triggers", 8, -.5, 7.5);
     fTriggers->SetDirectory(0);
     fTriggers->GetXaxis()->SetBinLabel(1, "INEL (MC)");
     fTriggers->GetXaxis()->SetBinLabel(2, "INEL (ESD)");
-    fTriggers->GetXaxis()->SetBinLabel(3, "INEL>0 (MC)");
-    fTriggers->GetXaxis()->SetBinLabel(4, "INEL>0 (ESD)");
-    fTriggers->GetXaxis()->SetBinLabel(5, "NSD (MC)");
-    fTriggers->GetXaxis()->SetBinLabel(6, "NSD (ESD)");
+    fTriggers->GetXaxis()->SetBinLabel(3, "INEL & N_{cluster}>0 (MC)");
+    fTriggers->GetXaxis()->SetBinLabel(4, "INEL & N_{cluster}>0 (ESD)");
+    fTriggers->GetXaxis()->SetBinLabel(5, "INEL>0 (MC)");
+    fTriggers->GetXaxis()->SetBinLabel(6, "INEL>0 (ESD)");
+    fTriggers->GetXaxis()->SetBinLabel(7, "NSD (MC)");
+    fTriggers->GetXaxis()->SetBinLabel(8, "NSD (ESD)");
     fTriggers->SetFillColor(kYellow+1);
     fTriggers->SetFillStyle(3001);
     fList->Add(fTriggers);
@@ -161,6 +167,7 @@ public:
     fInel.CreateObjects(fList, fM, fData);
     fInelGt0.CreateObjects(fList, fM, fData);
     fNSD.CreateObjects(fList, fM, fData);
+    fNClusterGt0.CreateObjects(fList, fM, fData);
 
 
     fInspector.DefineOutput(fList);
@@ -220,9 +227,10 @@ public:
     Int_t    nPart;    // Number of participants 
     Int_t    nBin;     // Number of binary collisions 
     Double_t phiR;     // Reaction plane from MC
-    
+    UShort_t nClusters;// Number of clisters 
     // Process the data 
-    Int_t retESD = fInspector.Process(esd, triggers, lowFlux, iVz, vZ, cent);
+    Int_t retESD = fInspector.Process(esd, triggers, lowFlux, iVz, vZ, cent,
+                                     nClusters);
     Int_t retMC  = fInspector.ProcessMC(mcEvent, triggers, iVzMc, 
                                        vZMc, b, nPart, nBin, phiR);
 
@@ -291,16 +299,22 @@ public:
       if (triggered) fTriggers->Fill(1);
       fInel.AddEvent(triggered, hasVertex, m, fData);
     }
-    if (isMcInelGt0) {
+    if (isMcInel) { // && nClusters > 0) {
       fTriggers->Fill(2);
-      bool triggered = (triggers & AliAODForwardMult::kInelGt0);
+      bool triggered = (triggers & AliAODForwardMult::kNClusterGt0);
       if (triggered) fTriggers->Fill(3);
+      fNClusterGt0.AddEvent(triggered, hasVertex, m, fData);
+    }
+    if (isMcInelGt0) {
+      fTriggers->Fill(4);
+      bool triggered = (triggers & AliAODForwardMult::kInelGt0);
+      if (triggered) fTriggers->Fill(5);
       fInelGt0.AddEvent(triggered, hasVertex, m, fData);
     }
     if (isMcNSD) {
-      fTriggers->Fill(4);
+      fTriggers->Fill(6);
       bool triggered = (triggers & AliAODForwardMult::kNSD);
-      if (triggered) fTriggers->Fill(5);
+      if (triggered) fTriggers->Fill(7);
       fNSD.AddEvent(triggered, hasVertex, m, fData);
     }
     PostData(1, fList);
@@ -319,7 +333,7 @@ public:
 
 
     TList* output = new TList;
-    output->SetName(GetName());
+    output->SetName("triggerResults");
     output->SetOwner();
 
     fVertexMC = static_cast<TH1D*>(fList->FindObject("vertexMC"));
@@ -328,26 +342,43 @@ public:
     if (fVertexMC) { 
       TH1D* vtxMC = static_cast<TH1D*>(fVertexMC->Clone("vertexMC"));
       vtxMC->SetDirectory(0);
-      vtxMC->Scale(1. / vtxMC->GetEntries());
+      if (vtxMC->GetEntries() > 0)
+       vtxMC->Scale(1. / vtxMC->GetEntries());
+      else 
+       vtxMC->Scale(0);
       output->Add(vtxMC);
     }
     if (fVertexESD) { 
       TH1D* vtxESD = static_cast<TH1D*>(fVertexESD->Clone("vertexESD"));
       vtxESD->SetDirectory(0);
-      vtxESD->Scale(1. / vtxESD->GetEntries());
+      if (vtxESD->GetEntries() > 0)
+       vtxESD->Scale(1. / vtxESD->GetEntries());
+      else 
+       vtxESD->Scale(0);
       output->Add(vtxESD);
     }
     if (fM) { 
       TH1D* m = static_cast<TH1D*>(fM->Clone("m"));
       m->SetDirectory(0);
       m->SetYTitle("P(N_{ch}|_{|#eta|<1} < X)");
-      m->Scale(1. / m->GetBinContent(1));
+      if (m->GetBinContent(1) > 0)
+       m->Scale(1. / m->GetBinContent(1));
+      else 
+       m->Scale(0);
       output->Add(m);
     }      
 
+    TString vtxReq;
+    if (fVertexRequirement & kMC)  vtxReq.Append("MC ");
+    if (fVertexRequirement & kESD) vtxReq.Append("ESD ");
+    output->Add(new TNamed("vtxReq", vtxReq.Data()));
+    output->Add(new TNamed("trkReq",
+                          fTrackletRequirement == kMC ? "MC" : "ESD"));
+
     fInel.Finish(fList, output);
     fInelGt0.Finish(fList, output);
     fNSD.Finish(fList, output);
+    fNClusterGt0.Finish(fList, output);
 
     PostData(2, output);
   }
@@ -371,6 +402,8 @@ protected:
       TH1I*     fCounts;
       UShort_t  fLow;
       UShort_t  fHigh;
+      Bool_t IsAll() const { return fLow > fHigh; }
+      Bool_t IsLast() const { return fHigh >= kMaxN; }
       /** 
        * Constructor 
        */
@@ -394,8 +427,19 @@ protected:
          fLow(low), 
          fHigh(high)
       {
-       if (low >= high) SetName("all");
-       else             SetName(Form("m%03d_%03d", fLow, fHigh));
+       if (IsAll()) {
+         SetName("all");
+         SetTitle("All");
+       }
+       else if (IsLast()) { 
+         SetName(Form("m%03dplus", fLow));
+         SetTitle(Form("%d #leq N_{tracklets}|_{|#eta|<1}", fLow));
+       }
+       else {
+         SetName(Form("m%03d_%03d", fLow, fHigh));
+         SetTitle(Form("%d #leq N_{tracklets}|_{|#eta|<1} < %d", fLow,fHigh));
+       }
+
        TList* l = new TList;
        l->SetOwner();
        l->SetName(GetName());
@@ -405,7 +449,7 @@ protected:
        fTruth->SetTitle("MC truth");
        fTruth->SetDirectory(0);
        fTruth->SetZTitle("#sum_i^{N_X} N_{ch}(#eta,#varphi)");
-       fTruth->Sumw2();
+       // fTruth->Sumw2();
        fTruth->Reset();
        l->Add(fTruth);
 
@@ -413,7 +457,7 @@ protected:
        fTriggered->SetTitle("Triggered");
        fTriggered->SetDirectory(0);
        fTriggered->SetZTitle("#sum_i^{N_T} N_{ch}(#eta,#varphi)");
-       fTriggered->Sumw2();
+       // fTriggered->Sumw2();
        fTriggered->Reset();
        l->Add(fTriggered);
 
@@ -421,7 +465,7 @@ protected:
        fAccepted->SetTitle("Accepted");
        fAccepted->SetDirectory(0);
        fAccepted->SetZTitle("#sum_i^{N_T} N_{ch}(#eta,#varphi)");
-       fAccepted->Sumw2();
+       // fAccepted->Sumw2();
        fAccepted->Reset();
        l->Add(fAccepted);
        
@@ -484,13 +528,19 @@ protected:
        if (nTriggered > 0) fTriggered->Scale(1. / nTriggered);
        if (nAccepted > 0)  fAccepted->Scale(1. / nAccepted);
 
-       if (fLow >= fHigh) 
-         Info("Finish", "%-6s  [all]  E_X=N_T/N_X=%9d/%-9d=%f "
+       if (IsAll()) 
+         Info("Finish", "%-12s  [all]  E_X=N_T/N_X=%9d/%-9d=%f "
               "E_V=N_A/N_T=%9d/%-9d=%f", 
               p->GetName(), nTriggered, nTruth, eff, nAccepted, nTriggered, 
               (nTriggered > 0 ? double(nAccepted) / nTriggered: 0));
+       else if (IsLast()) 
+         Info("Finish", "%-12s  [%2d+]  E_X=N_T/N_X=%9d/%-9d=%f "
+              "E_V=N_A/N_T=%9d/%-9d=%f", 
+              p->GetName(), fLow, nTriggered, nTruth, eff, 
+              nAccepted, nTriggered, 
+              (nTriggered > 0 ? double(nAccepted) / nTriggered: 0));
        else
-         Info("Finish", "%-6s [%2d-%2d] E_X=N_T/N_X=%9d/%-9d=%f "
+         Info("Finish", "%-12s [%2d-%2d] E_X=N_T/N_X=%9d/%-9d=%f "
               "E_V=N_A/N_T=%9d/%-9d=%f", 
               p->GetName(), fLow, fHigh, nTriggered, nTruth, eff, 
               nAccepted, nTriggered, 
@@ -511,9 +561,9 @@ protected:
        bias->SetZTitle("Trigger bias (accepted/truth)");
        out->Add(bias);
 
+       TString title = GetTitle();
        TH1D* truth_px = static_cast<TH1D*>(fTruth->ProjectionX("truth_eta"));
-       truth_px->SetTitle(Form("%d #leq N_{tracklets}|_{|#eta|<1} < %d", 
-                              fLow, fHigh));
+       truth_px->SetTitle(title);
        truth_px->Scale(1. / fTruth->GetNbinsY());
        truth_px->SetDirectory(0);
        truth_px->SetLineColor(kRed+1);
@@ -524,8 +574,7 @@ protected:
 
        TH1D* triggered_px = 
          static_cast<TH1D*>(fTriggered->ProjectionX("triggered_eta"));
-       triggered_px->SetTitle(Form("%d #leq N_{tracklets}|_{|#eta|<1} < %d", 
-                              fLow, fHigh));
+       triggered_px->SetTitle(title);
        triggered_px->Scale(1. / fTriggered->GetNbinsY());
        triggered_px->SetDirectory(0);
        triggered_px->SetLineColor(kGreen+1);
@@ -536,8 +585,7 @@ protected:
 
        TH1D* accepted_px = 
          static_cast<TH1D*>(fAccepted->ProjectionX("accepted_eta"));
-       accepted_px->SetTitle(Form("%d #leq N_{tracklets}|_{|#eta|<1} < %d", 
-                                  fLow, fHigh));
+       accepted_px->SetTitle(title);
        accepted_px->Scale(1. / fAccepted->GetNbinsY());
        accepted_px->SetLineColor(kBlue+1);
        accepted_px->SetMarkerColor(kBlue+1);
@@ -553,8 +601,7 @@ protected:
 
 #if 0
        TH1D* bias_px = static_cast<TH1D*>(bias->ProjectionX("bias_eta"));
-       bias_px->SetTitle(Form("%d #leq N_{tracklets}|_{|#eta|<1} < %d", 
-                              fLow, fHigh));
+       bias_px->SetTitle(title);
        bias_px->Scale(1. / bias->GetNbinsY());
 #else
        TH1D* bias_px = static_cast<TH1D*>(accepted_px->Clone("bias_px"));
@@ -595,6 +642,9 @@ protected:
        fM(0), 
        fBins(0)
     {
+      TString n(GetName());
+      n = n.Strip(TString::kBoth);
+      SetName(n);
     }
     /** 
      * Create objects 
@@ -618,12 +668,13 @@ protected:
       ours->Add(fM);
       
       fBins = new TObjArray;
-      fBins->AddAt(new MBin(ours, 0, 0, dHist), 0);
-      for (Int_t i = 1; i <= fM->GetNbinsX(); i++) { 
+      fBins->AddAt(new MBin(ours, 1000, 0, dHist), 0);
+      for (Int_t i = 1; i < fM->GetNbinsX(); i++) { 
        Double_t low  = fM->GetXaxis()->GetBinLowEdge(i);
        Double_t high = fM->GetXaxis()->GetBinUpEdge(i);
-
-       fBins->AddAt(new MBin(ours, low, high, dHist), i);
+       Info("CreatePbjects", "Adding bin [%3d,%3d] @ %d", 
+            int(low), int(high), i);
+       fBins->AddAt(new MBin(ours, UShort_t(low), UShort_t(high), dHist), i);
       }
     }
     /** 
@@ -635,10 +686,20 @@ protected:
      */
     MBin* FindBin(UShort_t m) 
     { 
+#if 0
+      for (Int_t i = 1; i < fBins->GetEntries(); i++) {
+       MBin* b = static_cast<MBin*>(fBins->At(i));
+       if (m >= b->fLow && m < b->fHigh) return b;
+      }
+      Warning("FindBin", "Found no bin for m=%d", m);
+      return 0;
+#else
       Int_t b = fM->GetXaxis()->FindBin(m);
       if (b <= 0) return 0;
       if (b >= fM->GetNbinsX()+1) b = fM->GetNbinsX();
-      return static_cast<MBin*>(fBins->At(b));
+      MBin* bin = static_cast<MBin*>(fBins->At(b));
+      return bin;
+#endif
     }
     /** 
      * Add event observation 
@@ -656,6 +717,7 @@ protected:
       all->AddEvent(triggered, hasVtx, data);
       
       MBin* bin = FindBin(m);
+      if (!bin) return;
       bin->AddEvent(triggered, hasVtx, data);      
     }      
     /** 
@@ -699,7 +761,7 @@ protected:
       gStyle->SetPalette(1);
       Int_t   nCol = gStyle->GetNumberOfColors();
       THStack* stack = new THStack("biases", "Trigger biases");
-      for (Int_t i = 0; i <= nBin; i++) { 
+      for (Int_t i = 0; i < nBin; i++) { 
        MBin* bin = static_cast<MBin*>(fBins->At(i));
        effs->SetBinContent(i+1, bin->Finish(l, ours, stack));
        TH1* h = static_cast<TH1*>(stack->GetHists()->At(i));
@@ -724,6 +786,7 @@ protected:
   TriggerType            fInel;
   TriggerType            fInelGt0;
   TriggerType            fNSD;
+  TriggerType            fNClusterGt0;
   AliFMDMCEventInspector fInspector;
   TList*                 fList;
   Bool_t                 fFirstEvent;
@@ -741,9 +804,9 @@ protected:
 //====================================================================
 void MakeEvaluateTriggers(const char* esddir, 
                          Int_t       nEvents    = -1, 
-                         UInt_t      vtx        = 0x1,
+                         UInt_t      vtx        = 0x2,
                          UInt_t      trk        = 0x1,
-                         UInt_t      vz         = 10,
+                         Int_t       vz         = 10,
                          Int_t       proof      = 0)
 {
   // --- Libraries to load -------------------------------------------
@@ -848,4 +911,149 @@ void MakeEvaluateTriggers(const char* esddir,
   t.Stop();
   t.Print();
 }
+//====================================================================
+void DrawEvaluateTriggers(const char* filename="triggers.root")
+{
+  TFile* file = TFile::Open(filename, "READ");
+  if (!file) { 
+    Error("DrawEvaluteTriggers", "Failed to open %s", filename);
+    return;
+  }
+
+  TList* list = static_cast<TList*>(file->Get("triggerResults"));
+  if (!list) { 
+    Error("DrawEvaluateTriggers", "Faield to get triggerResults from %s", 
+         list->GetName());
+    return;
+  }
+
+  TCanvas* c = new TCanvas("c", "c", 1200, 900);
+  c->SetFillColor(0);
+  c->SetBorderSize(0);
+  c->SetBorderMode(0);
+
+  TPad* p = new TPad("top", "Top", 0, .9, 1, 1, 0, 0, 0); 
+  p->SetFillColor(0);
+  p->SetFillStyle(0);
+  p->SetBorderSize(0);
+  p->SetBorderMode(0);
+  c->cd();
+  p->Draw();
+  p->cd();
+  TObject* vtxReq = list->FindObject("vtxReq");
+  TObject* trkReq = list->FindObject("trkReq");
+  if (!vtxReq) vtxReq = new TNamed("vtxReq", "Unknown");
+  if (!trkReq) trkReq = new TNamed("trkReq", "Unknown");
+  TLatex* ltx = new TLatex(0.5, 0.5, 
+                          Form("Trigger bias and efficiency. " 
+                               "Vertex requirement: %s, "
+                               "Tracklet requirement %s",
+                               vtxReq->GetTitle(), trkReq->GetTitle()));
+  ltx->Draw();
+  ltx->SetTextAlign(22);
+  ltx->SetTextSize(0.4);
+
+  const char*  trigs[] = { "INEL", "NCluster>0", "INEL>0", "NSD", 0 };
+  const char** trig    = trigs;
+  Int_t n = 4;
+  Int_t i = 0;
+  while (*trig) { 
+    TList* lt = static_cast<TList*>(list->FindObject(*trig));
+    if (!lt) { 
+      Warning("DrawEvaluteTriggers", "No list for '%s' in '%s'", 
+             *trig, list->GetName());
+      // list->ls();
+      TIter next(triggerResults);
+      TObject* o ;
+      while ((o = next())) Printf("'%s'", o->GetName());
+      trig++;
+      i++;
+      continue;
+    }
+
+    Double_t y1 = 1-double(i+1)/n;
+    Double_t y2 = 1-double(i)/n;
+    Double_t x1 = double(i)/n;
+    Double_t x2 = double(i+1)/n;
+    p = new TPad(Form("p%d", 2*i), Form("%s biases", *trig), 
+                x1, .3, x2, .9, 0, 0);
+    p->SetFillColor(0);
+    p->SetFillStyle(0);
+    p->SetBorderSize(0);
+    p->SetBorderMode(0);
+    p->SetTopMargin(0.01);
+    p->SetBottomMargin(0.05);
+    p->SetRightMargin(0.01);
+    c->cd();
+    p->Draw();
+    p->cd();
+    
+    THStack* biases = static_cast<THStack*>(lt->FindObject("biases"));
+    biases->SetTitle(*trig);
+    TLegend* l = new TLegend(.1, .15, .95, .35, 
+                            Form("1/N_{T}#sum N_{ch}}/"
+                                 "1/N_{X}#sum N_{ch} - %s", *trig));
+    l->SetFillColor(0);
+    l->SetFillStyle(0);
+    l->SetBorderSize(0);
+    l->SetNColumns(2);
+    
+    gStyle->SetOptTitle(0);
+    TIter next(biases->GetHists());
+    TH1*  frame = 0;
+    TH1*  hist = 0;
+    Int_t j = 1;
+    while ((hist = static_cast<TH1*>(next()))) { 
+      if (!frame) { 
+       
+       frame = new TH2D("frame", "", 
+                        hist->GetXaxis()->GetNbins(),
+                        hist->GetXaxis()->GetXmin(),
+                        hist->GetXaxis()->GetXmax(),
+                        100, 0, 4);
+       frame->SetDirectory(0);
+       frame->SetXTitle(hist->GetXaxis()->GetTitle());
+       frame->SetYTitle(hist->GetYaxis()->GetTitle());
+       frame->SetStats(0);
+       frame->Draw();
+      }
+      // hist->Scale(j);
+      // hist->Draw("same p hist");
+      // if (j == 1) hist->SetTitle("all");
+      l->AddEntry(hist, hist->GetTitle(), "p");
+      j++;
+    }
+    // biases->SetMaximum(3.5);
+    biases->Draw("p hist nostack");
+    l->Draw();
+    
+    p = new TPad(Form("p%d", 2*i+1), Form("%s efficiencies", *trig), 
+                x1, 0, x2, .3, 0, 0, 0);
+    p->SetFillColor(0);
+    p->SetFillStyle(0);
+    p->SetBorderSize(0);
+    p->SetBorderMode(0);
+    p->SetTopMargin(0.01);
+    p->SetRightMargin(0.01);
+    c->cd();
+    p->Draw();
+    p->cd();
+    
+    TH1* effs = static_cast<TH1*>(lt->FindObject("effs"));
+    effs->SetTitle(*trig);
+    effs->SetStats(0);
+    effs->SetMinimum(0);
+    effs->SetMaximum(1.4);
+    effs->SetMarkerSize(2.5);
+    effs->Draw("hist text");
+
+
+    i++;
+    trig++;
+  }
+  c->cd();
+
+  c->SaveAs("triggers.png");
+}
+
 #endif
index 47164ff..c40ca51 100644 (file)
@@ -1084,7 +1084,8 @@ GetData(UShort_t sys,
        UShort_t type=0x1, 
        UShort_t centLow=0, 
        UShort_t centHigh=0, 
-       bool     aliceOnly=false)
+       bool     aliceOnly=false,
+       bool     nomc=false)
 {
   TMultiGraph* mp = new TMultiGraph(Form("dndeta_%dGeV_%d_%03d_%03d", 
                                         energy, type, centLow, centHigh),"");
@@ -1104,14 +1105,14 @@ GetData(UShort_t sys,
     if (TMath::Abs(energy-900) < 10) {
       if (type & 0x1) { 
        tn.Append(" INEL");
-       if (!aliceOnly) mp->Add(Pythia900INEL());
+       if (!aliceOnly && !nomc) mp->Add(Pythia900INEL());
        if (!aliceOnly) mp->Add(UA5Inel(false));
        if (!aliceOnly) mp->Add(UA5Inel(true));
        mp->Add(AliceCentralInel900());
       }      
       if (type & 0x4) { 
        tn.Append(" NSD");
-       if (!aliceOnly) mp->Add(Pythia900NSD());
+       if (!aliceOnly && !nomc) mp->Add(Pythia900NSD());
        if (!aliceOnly) mp->Add(UA5Nsd(false));
        if (!aliceOnly) mp->Add(UA5Nsd(true));
        mp->Add(AliceCentralNsd900());