]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Refactoring for dN/deta tasks, more diagnostics histograms in event selector
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 21 Feb 2011 08:48:22 +0000 (08:48 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 21 Feb 2011 08:48:22 +0000 (08:48 +0000)
PWG2/FORWARD/analysis2/AddTaskFMD.C
PWG2/FORWARD/analysis2/AliCentraldNdetaTask.cxx
PWG2/FORWARD/analysis2/AliCentraldNdetaTask.h
PWG2/FORWARD/analysis2/AliFMDEventInspector.cxx
PWG2/FORWARD/analysis2/AliFMDEventInspector.h
PWG2/FORWARD/analysis2/AliForwarddNdetaTask.cxx
PWG2/FORWARD/analysis2/AliForwarddNdetaTask.h
PWG2/FORWARD/analysis2/DrawdNdeta.C
PWG2/FORWARD/analysis2/MakeELossFits.C

index 9ed8eacb162fd0edc8c9c92616196cce72f1d2ab..eab2982a0fa76cf71d32d9eaf0cf4673d7fcf19a 100644 (file)
@@ -66,11 +66,11 @@ AddTaskFMD(Bool_t mc, UShort_t sys=0, UShort_t sNN=0, Short_t field)
   // trying to fit to the data
   task->GetEnergyFitter().SetMinEntries(1000);
   // Set the low cut used for sharing - overrides settings in eloss fits
-    task->GetSharingFilter().SetLowCut(0.3);
+  task->GetSharingFilter().SetLowCut(0.3);
   // Set the number of xi's (width of landau peak) to stop at 
   task->GetSharingFilter().SetNXi(1);
   // Set the maximum number of particle to try to reconstruct 
-  task->GetDensityCalculator().SetMaxParticles(2);
+  task->GetDensityCalculator().SetMaxParticles(3);
   // Set the lower multiplicity cut.  Overrides setting in energy loss fits.
   task->GetDensityCalculator().SetMultCut(0.3); //was 0.3
   // Whether to use the secondary map correction
index 7a39c5f9321cdb914cd15a4569ccd4f5f3acf35e..0a5d83171511c97adde080e79e7a8ffbc23dc3a1 100644 (file)
 #include "AliAODForwardMult.h"
 #include "AliAODCentralMult.h"
 
-//____________________________________________________________________
-AliCentraldNdetaTask::AliCentraldNdetaTask()
-  : AliAnalysisTaskSE(), 
-    fSumCentral(0),    //  Sum of histograms 
-    fSumCentralMC(0),  //  Sum of MC histograms (if any)
-    fSums(0),          // Container of sums 
-    fOutput(0),                // Container of outputs 
-    fTriggers(0),      // Histogram of triggers 
-    fVtxMin(0),                // Minimum v_z
-    fVtxMax(0),                // Maximum v_z
-    fTriggerMask(0),    // Trigger mask 
-    fRebin(0),         // Rebinning factor 
-    fCutEdges(false)
-{}
-
-//____________________________________________________________________
-AliCentraldNdetaTask::AliCentraldNdetaTask(const char* /* name */)
-  : AliAnalysisTaskSE("Central"), 
-    fSumCentral(0),    //  Sum of histograms 
-    fSumCentralMC(0),  //  Sum of MC histograms (if any)
-    fSums(0),          // Container of sums 
-    fOutput(0),                // Container of outputs 
-    fTriggers(0),      // Histogram of triggers 
-    fVtxMin(-10),      // Minimum v_z
-    fVtxMax(10),       // Maximum v_z
-    fTriggerMask(AliAODForwardMult::kInel), 
-    fRebin(5),         // Rebinning factor 
-    fCutEdges(false)
-{
-  // Output slot #1 writes into a TH1 container
-  DefineOutput(1, TList::Class()); 
-  DefineOutput(2, TList::Class()); 
-}
-
-//____________________________________________________________________
-AliCentraldNdetaTask::AliCentraldNdetaTask(const AliCentraldNdetaTask& o)
-  : AliAnalysisTaskSE(o), 
-    fSumCentral(o.fSumCentral),        // TH2D* -  Sum of histograms 
-    fSumCentralMC(o.fSumCentralMC),// TH2D* -  Sum of MC histograms (if any)
-    fSums(o.fSums),            // TList* - Container of sums 
-    fOutput(o.fOutput),                // TList* - Container of outputs 
-    fTriggers(o.fTriggers),    // TH1D* - Histogram of triggers 
-    fVtxMin(o.fVtxMin),                // Double_t - Minimum v_z
-    fVtxMax(o.fVtxMax),                // Double_t - Maximum v_z
-    fTriggerMask(o.fTriggerMask),// Int_t - Trigger mask 
-    fRebin(o.fRebin),          // Int_t - Rebinning factor 
-    fCutEdges(o.fCutEdges)     // Bool_t - Whether to cut edges when rebinning
-{}
-
-//____________________________________________________________________
-AliCentraldNdetaTask::~AliCentraldNdetaTask()
-{
-  if (fSums) { 
-    fSums->Delete();
-    delete fSums;
-    fSums = 0;
-  }
-  if (fOutputs) { 
-    fOutputs->Delete();
-    delete fOutputs;
-    fOutputs = 0;
-  }
-}
-
-//________________________________________________________________________
-void 
-AliCentraldNdetaTask::SetTriggerMask(const char* mask)
-{
-  UShort_t    trgMask = 0;
-  TString     trgs(mask);
-  trgs.ToUpper();
-  TObjString* trg;
-  TIter       next(trgs.Tokenize(" ,|"));
-  while ((trg = static_cast<TObjString*>(next()))) { 
-    TString s(trg->GetString());
-    if      (s.IsNull()) continue;
-    if      (s.CompareTo("INEL")  == 0) trgMask = AliAODForwardMult::kInel;
-    else if (s.CompareTo("INEL>0")== 0) trgMask = AliAODForwardMult::kInelGt0;
-    else if (s.CompareTo("NSD")   == 0) trgMask = AliAODForwardMult::kNSD;
-    else 
-      Warning("SetTriggerMask", "Unknown trigger %s", s.Data());
-  }
-  if (trgMask == 0) trgMask = 1;
-  SetTriggerMask(trgMask);
-}
-
-//________________________________________________________________________
-void 
-AliCentraldNdetaTask::UserCreateOutputObjects()
-{
-  // Create histograms
-  // Called once (on the worker node)
-
-  fOutput = new TList;
-  fOutput->SetName(Form("%s_result", GetName()));
-  fOutput->SetOwner();
-
-  fSums = new TList;
-  fSums->SetName(Form("%s_sums", GetName()));
-  fSums->SetOwner();
-
-
-  fTriggers = new TH1D("triggers", "Number of triggers", 
-                      kAccepted, 1, kAccepted);
-  fTriggers->SetYTitle("# of events");
-  fTriggers->GetXaxis()->SetBinLabel(kAll,         "All events");
-  fTriggers->GetXaxis()->SetBinLabel(kB,           "w/B trigger");
-  fTriggers->GetXaxis()->SetBinLabel(kA,           "w/A trigger");
-  fTriggers->GetXaxis()->SetBinLabel(kC,           "w/C trigger");
-  fTriggers->GetXaxis()->SetBinLabel(kE,           "w/E trigger");
-  fTriggers->GetXaxis()->SetBinLabel(kMB,          "w/Collision trigger");
-  fTriggers->GetXaxis()->SetBinLabel(kWithVertex,  "w/Vertex");
-  fTriggers->GetXaxis()->SetBinLabel(kWithTrigger, "w/Selected trigger");
-  fTriggers->GetXaxis()->SetBinLabel(kAccepted,    "Accepted by cut");
-  fTriggers->GetXaxis()->SetNdivisions(kAccepted, false);
-  fTriggers->SetFillColor(kRed+1);
-  fTriggers->SetFillStyle(3001);
-  fTriggers->SetStats(0);
-  fSums->Add(fTriggers);
-
-  // Check that we have an AOD input handler 
-  AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
-  AliAODInputHandler* ah = 
-    dynamic_cast<AliAODInputHandler*>(am->GetInputEventHandler());
-  if (!ah) AliFatal("No AOD input handler set in analysis manager");
-
-  // Post data for ALL output slots >0 here, to get at least an empty histogram
-  PostData(1, fSums); 
-}
 
 //____________________________________________________________________
 TH2D*
-AliCentraldNdetaTask::CloneHist(TH2D* in, const char* name) 
-{
-  if (!in) return 0;
-  TH2D* ret = static_cast<TH2D*>(in->Clone(name));
-  ret->SetDirectory(0);
-  ret->Sumw2();
-  fSums->Add(ret);
-
-  return ret;
-}
-
-//____________________________________________________________________
-void 
-AliCentraldNdetaTask::UserExec(Option_t *) 
+AliCentraldNdetaTask::GetHistogram(AliAODEvent* aod, Bool_t mc) 
 {
-  // Main loop
-  AliAODEvent* aod = dynamic_cast<AliAODEvent*>(InputEvent());
-  if (!aod) {
-    AliError("Cannot get the AOD event");
-    return;
-  }  
-
   // Get objects from the event structure 
-  TObject* oCentral   = aod->FindListObject("CentralClusters");
-  TObject* oCentralMC = aod->FindListObject("CentralClustersMC");
-  TObject* oForward   = aod->FindListObject("Forward");
+  TObject* obj = 0;
+  if (mc) obj = aod->FindListObject("CentralClustersMC");
+  else    obj = aod->FindListObject("CentralClusters");
 
   // We should have a central object at least 
-  if (!oCentral) { 
-    AliWarning("No Central object found AOD");
-    return;
+  if (!obj) { 
+    if (!mc) AliWarning("No Central object found AOD");
+    return 0;
   }
 
   // Cast to good types 
-  AliAODCentralMult* central   = static_cast<AliAODCentralMult*>(oCentral);
-  AliAODCentralMult* centralMC = static_cast<AliAODCentralMult*>(oCentralMC);
-  AliAODForwardMult* forward   = static_cast<AliAODForwardMult*>(oForward);
-  
-  // Create our sum histograms 
-  if (!fSumCentral) fSumCentral =CloneHist(&central->GetHistogram(),"central");
-  if (!fSumCentralMC && centralMC) 
-    fSumCentralMC = CloneHist(&centralMC->GetHistogram(),"centralMC");
+  AliAODCentralMult* central   = static_cast<AliAODCentralMult*>(obj);
 
-  // Count event 
-  fTriggers->AddBinContent(kAll);
-  if (forward->IsTriggerBits(AliAODForwardMult::kB)) 
-    fTriggers->AddBinContent(kB);
-  if (forward->IsTriggerBits(AliAODForwardMult::kA)) 
-    fTriggers->AddBinContent(kA);
-  if (forward->IsTriggerBits(AliAODForwardMult::kC)) 
-    fTriggers->AddBinContent(kC);
-  if (forward->IsTriggerBits(AliAODForwardMult::kE)) 
-    fTriggers->AddBinContent(kE);
-  if (forward->IsTriggerBits(AliAODForwardMult::kInel)) 
-    fTriggers->AddBinContent(kMB);
-
-  // Check if we have an event of interest. 
-  if (!forward->IsTriggerBits(fTriggerMask)) return;
-  fTriggers->AddBinContent(kWithTrigger);
-
-  // Check that we have a valid vertex
-  if (!forward->HasIpZ()) return;
-  fTriggers->AddBinContent(kWithVertex);
-
-  // Check that vertex is within cuts 
-  if (!forward->InRange(fVtxMin, fVtxMax)) return;
-  fTriggers->AddBinContent(kAccepted);
-
-  // Add contribution 
-  fSumCentral->Add(&(central->GetHistogram()));
-  if (fSumCentralMC) fSumCentralMC->Add(&(centralMC->GetHistogram()));
-
-  PostData(1, fSums);
+  return &(central->GetHistogram());
 }
 
-//________________________________________________________________________
-void 
-AliCentraldNdetaTask::SetHistogramAttributes(TH1D* h, Int_t colour, Int_t marker,
-                                         const char* title, const char* ytitle)
-{
-  h->SetTitle(title);
-  h->SetMarkerColor(colour);
-  h->SetMarkerStyle(marker);
-  h->SetMarkerSize(1);
-  h->SetFillStyle(0);
-  h->SetYTitle(ytitle);
-  h->GetXaxis()->SetTitleFont(132);
-  h->GetXaxis()->SetLabelFont(132);
-  h->GetXaxis()->SetNdivisions(10);
-  h->GetYaxis()->SetTitleFont(132);
-  h->GetYaxis()->SetLabelFont(132);
-  h->GetYaxis()->SetNdivisions(10);
-  h->GetYaxis()->SetDecimals();
-  h->SetStats(0);
-}
-  
-//________________________________________________________________________
-void 
-AliCentraldNdetaTask::Terminate(Option_t *) 
-{
-  // Draw result to screen, or perform fitting, normalizations Called
-  // once at the end of the query
-        
-  fSums = dynamic_cast<TList*> (GetOutputData(1));
-  if(!fSums) {
-    AliError("Could not retrieve TList fSums"); 
-    return; 
-  }
-  
-  if (!fOutput) { 
-    fOutput = new TList;
-    fOutput->SetName(Form("%s_result", GetName()));
-    fOutput->SetOwner();
-  }
-
-  fSumCentral     = static_cast<TH2D*>(fSums->FindObject("central"));
-  fSumCentralMC   = static_cast<TH2D*>(fSums->FindObject("centralMC"));
-  fTriggers       = static_cast<TH1D*>(fSums->FindObject("triggers"));
-
-  if (!fTriggers) { 
-    AliError("Couldn't find histogram 'triggers' in list");
-    return;
-  }
-  if (!fSumCentral) { 
-    AliError("Couldn't find histogram 'central' in list");
-    return;
-  }
-
-  Int_t nAll        = Int_t(fTriggers->GetBinContent(kAll));
-  Int_t nB          = Int_t(fTriggers->GetBinContent(kB));
-  Int_t nA          = Int_t(fTriggers->GetBinContent(kA));
-  Int_t nC          = Int_t(fTriggers->GetBinContent(kC));
-  Int_t nE          = Int_t(fTriggers->GetBinContent(kE));
-  Int_t nMB         = Int_t(fTriggers->GetBinContent(kMB));
-  Int_t nTriggered  = Int_t(fTriggers->GetBinContent(kWithTrigger));
-  Int_t nWithVertex = Int_t(fTriggers->GetBinContent(kWithVertex));
-  Int_t nAccepted   = Int_t(fTriggers->GetBinContent(kAccepted));
-  Int_t nGood       = nB - nA - nC + 2 * nE;
-  Double_t vtxEff   = Double_t(nMB) / nTriggered * Double_t(nAccepted) / nGood;
-  AliInfo(Form("Total of %9d events\n"
-              "                   of these %9d are minimum bias\n"
-              "                   of these %9d has a %s trigger\n" 
-              "                   of these %9d has a vertex\n" 
-              "                   of these %9d were in [%+4.1f,%+4.1f]cm\n"
-              "                   Triggers by type:\n"
-              "                     B   = %9d\n"
-              "                     A|C = %9d (%9d+%-9d)\n"
-              "                     E   = %9d\n"
-              "                   Implies %9d good triggers\n"
-              "                   Vertex efficiency: %f",
-              nAll, nMB, nTriggered, 
-              AliAODForwardMult::GetTriggerString(fTriggerMask),
-              nWithVertex, nAccepted,
-              fVtxMin, fVtxMax, 
-              nB, nA+nC, nA, nC, nE, nGood, vtxEff));
-  
-  // Get acceptance normalisation from underflow bins 
-  TH1D* normCentral   = fSumCentral->ProjectionX("normCentral", 0, 1, "");
-  // Project onto eta axis - _ignoring_underflow_bins_!
-  TH1D* dndetaCentral = fSumCentral->ProjectionX("dndetaCentral", 1, -1, "e");
-  // Normalize to the acceptance 
-  dndetaCentral->Divide(normCentral);
-  // Scale by the vertex efficiency 
-  dndetaCentral->Scale(vtxEff, "width");
-
-  SetHistogramAttributes(dndetaCentral, kRed+1, 20, "ALICE Central");
-  SetHistogramAttributes(normCentral, kRed+1, 20, "ALICE Central", 
-                        "Normalisation");
-
-  fOutput->Add(fTriggers->Clone());
-  fOutput->Add(dndetaCentral);
-  fOutput->Add(normCentral);
-  fOutput->Add(Rebin(dndetaCentral));
-
-  if (fSumCentralMC) { 
-    // Get acceptance normalisation from underflow bins 
-    TH1D* normCentralMC   = 
-      fSumCentralMC->ProjectionX("normCentralMC", 0, 1, "");
-    // Project onto eta axis - _ignoring_underflow_bins_!
-    TH1D* dndetaCentralMC = 
-      fSumCentralMC->ProjectionX("dndetaCentralMC", 1, -1, "e");
-    // Normalize to the acceptance 
-    dndetaCentralMC->Divide(normCentralMC);
-    // Scale by the vertex efficiency 
-    dndetaCentralMC->Scale(vtxEff, "width");
-
-    SetHistogramAttributes(dndetaCentralMC, kRed+3, 21, "ALICE Central (MC)");
-    SetHistogramAttributes(normCentralMC, kRed+3, 21, "ALICE Central (MC)", 
-                          "Normalisation");
-
-    fOutput->Add(dndetaCentralMC);
-    fOutput->Add(normCentralMC);
-    fOutput->Add(Rebin(dndetaCentralMC));
-  }
-
-  PostData(2, fOutput);
-}
-
-//________________________________________________________________________
-TH1D*
-AliCentraldNdetaTask::Rebin(const TH1D* h) const
-{
-  if (fRebin <= 1) return 0;
-
-  Int_t nBins = h->GetNbinsX();
-  if(nBins % fRebin != 0) {
-    Warning("Rebin", "Rebin factor %d is not a devisor of current number "
-           "of bins %d in the histogram %s", fRebin, nBins, h->GetName());
-    return 0;
-  }
-    
-  // Make a copy 
-  TH1D* tmp = static_cast<TH1D*>(h->Clone(Form("%s_rebin%02d", 
-                                              h->GetName(), fRebin)));
-  tmp->Rebin(fRebin);
-  tmp->SetDirectory(0);
-
-  // The new number of bins 
-  Int_t nBinsNew = nBins / fRebin;
-  for(Int_t i = 1;i<= nBinsNew; i++) {
-    Double_t content = 0;
-    Double_t sumw    = 0;
-    Double_t wsum    = 0;
-    Int_t    nbins   = 0;
-    for(Int_t j = 1; j<=fRebin;j++) {
-      Int_t    bin = (i-1)*fRebin + j;
-      Double_t c   =  h->GetBinContent(bin);
-
-      if (c <= 0) continue;
-
-      if (fCutEdges) {
-       if (h->GetBinContent(bin+1)<=0 || 
-           h->GetBinContent(bin-1)) {
-         Warning("Rebin", "removing bin %d=%f of %s (%d=%f,%d=%f)", 
-                 bin, c, h->GetName(), 
-                 bin+1, h->GetBinContent(bin+1), 
-                 bin-1, h->GetBinContent(bin-1));
-         continue;
-       }       
-      }
-      Double_t e =  h->GetBinError(bin);
-      Double_t w =  1 / (e*e); // 1/c/c
-      content    += c;
-      sumw       += w;
-      wsum       += w * c;
-      nbins++;
-    }
-      
-    if(content > 0 && nbins > 0) {
-      tmp->SetBinContent(i, wsum / sumw);
-      tmp->SetBinError(i,1./TMath::Sqrt(sumw));
-    }
-  }
-  
-  return tmp;
-}
+//
+// EOF
+//
index fe12903de0d7cdc54f6567e0db24fc758c2fc986..b1cf4f77ea32e87a69b1cd7df7bc95e0fb60de45 100644 (file)
@@ -3,8 +3,7 @@
 //
 #ifndef ALICENTRALDNDETATASK_H
 #define ALICENTRALDNDETATASK_H
-#include <AliAnalysisTaskSE.h>
-// #include <AliAODCentralMult.h>
+#include "AliBasedNdetaTask.h"
 class TList;
 class TH2D;
 class TH1D;
@@ -12,117 +11,47 @@ class TH1D;
 /**
  * Task to determine the 
  */
-class AliCentraldNdetaTask : public AliAnalysisTaskSE
+class AliCentraldNdetaTask : public AliBasedNdetaTask
 {
 public:
   /** 
    * Constructor 
    * 
    */
-  AliCentraldNdetaTask();
+  AliCentraldNdetaTask() : AliBasedNdetaTask() {}
   /** 
    * Constructor
    * 
    * @param name    Name of task 
    * @param maxVtx  Set @f$v_z@f$ range
    */
-  AliCentraldNdetaTask(const char* name);
-  
-  void SetVertexRange(Double_t min, Double_t max) { fVtxMin=min; fVtxMax=max; }
-  void SetRebinning(Int_t rebin) { fRebin = rebin; }
-  void SetTriggerMask(UShort_t mask) { fTriggerMask = mask; }
-  void SetTriggerMask(const char* mask);
+ AliCentraldNdetaTask(const char*) 
+   : AliBasedNdetaTask("Central") 
+  { 
+    fSymmetrice = false; 
+    fCorrEmpty  = false;
+  }
   /**
    * Destructor
    * 
    */
-  virtual ~AliCentraldNdetaTask();
-  /** 
-   * Initialise on master - does nothing
-   * 
-   */
-  virtual void   Init() {}
-  /** 
-   * Create output objects.  
-   *
-   * This is called once per slave process 
-   */
-  virtual void UserCreateOutputObjects();
-  /** 
-   * Process a single event 
-   * 
-   * @param option Not used
-   */
-  virtual void UserExec(Option_t* option);
-  /** 
-   * Called at end of event processing.. 
-   *
-   * This is called once in the master 
-   * 
-   * @param option Not used 
-   */
-  virtual void Terminate(Option_t* option);
+  virtual ~AliCentraldNdetaTask() {}
 protected:
-  AliCentraldNdetaTask(const AliCentraldNdetaTask&);
-  AliCentraldNdetaTask& operator=(const AliCentraldNdetaTask&) { return *this; }
   /** 
-   * Clone a 2D histogram
+   * Get the histogram 
    * 
-   * @param in    Histogram to clone.
-   * @param name  New name of clone.
+   * @param aod 
+   * @param mc 
    * 
-   * @return The clone
+   * @return 
    */
-  TH2D* CloneHist(TH2D* in, const char* name);
-  /** 
-   * Make a copy of the input histogram and rebin that histogram
-   * 
-   * @param h  Histogram to rebin
-   * 
-   * @return New (rebinned) histogram
-   */
-  TH1D* Rebin(const TH1D* h) const;
-  /** 
-   * Set histogram graphical options, etc. 
-   * 
-   * @param h       Histogram to modify
-   * @param colour  Marker color 
-   * @param marker  Marker style
-   * @param title   Title of histogram
-   * @param ytitle  Title on y-axis. 
-   */
-  void  SetHistogramAttributes(TH1D* h, Int_t colour, Int_t marker, const char* title, 
-                              const char* ytitle="#frac{1}{N} #frac{dN_{ch}}{d#eta}");
-  /** 
-   * Trigger histogram bins 
-   */
-  enum { 
-    kAll        = 1, 
-    kB          = 2, 
-    kA          = 3, 
-    kC          = 4, 
-    kE          = 5,
-    kMB         = 6, 
-    kWithTrigger= 7,
-    kWithVertex = 8, 
-    kAccepted   = 9 
-  };
-
-  TH2D*           fSumCentral;    //  Sum of histograms 
-  TH2D*           fSumCentralMC;  //  Sum of MC histograms (if any)
-
-  TList*          fSums;          // Container of sums 
-  TList*          fOutput;        // Container of outputs 
-
-  TH1D*           fTriggers;      // Histogram of triggers 
-  
-  Double_t        fVtxMin;        // Minimum v_z
-  Double_t        fVtxMax;        // Maximum v_z
-  Int_t           fTriggerMask;   // Trigger mask 
-  Int_t           fRebin;         // Rebinning factor 
-  Bool_t          fCutEdges;      // Whether to cut edges when rebinning
+  TH2D* GetHistogram(AliAODEvent* aod, Bool_t mc=false);
 
   ClassDef(AliCentraldNdetaTask,1); // Determine multiplicity in central area
 };
 
 #endif
+// Local Variables:
+//   mode: C++
+// End:
index 578a61c31ef4559901be224e6d4f26034dedf7e6..a6d9a6abc6496132e292ae2fa057cb1f9f8fcf36 100644 (file)
@@ -38,6 +38,7 @@ AliFMDEventInspector::AliFMDEventInspector()
     fHEventsTrVtx(0),
     fHTriggers(0),
     fHType(0),
+    fHWords(0),
     fLowFluxCut(1000),
     fMaxVzErr(0.1),
     fList(0),
@@ -58,6 +59,7 @@ AliFMDEventInspector::AliFMDEventInspector(const char* name)
     fHEventsTrVtx(0), 
     fHTriggers(0),
     fHType(0),
+    fHWords(0),
     fLowFluxCut(1000),
     fMaxVzErr(0.1),
     fList(0),
@@ -81,6 +83,7 @@ AliFMDEventInspector::AliFMDEventInspector(const AliFMDEventInspector& o)
     fHEventsTrVtx(o.fHEventsTrVtx), 
     fHTriggers(o.fHTriggers),
     fHType(o.fHType),
+    fHWords(o.fHWords),
     fLowFluxCut(o.fLowFluxCut),
     fMaxVzErr(o.fMaxVzErr),
     fList(o.fList),
@@ -107,6 +110,7 @@ AliFMDEventInspector::~AliFMDEventInspector()
   if (fHEventsTrVtx) delete fHEventsTrVtx;
   if (fHTriggers)    delete fHTriggers;  
   if (fHType)        delete fHType;
+  if (fHWords)       delete fHWords;
   if (fList)         delete fList;
 }
 //____________________________________________________________________
@@ -127,6 +131,7 @@ AliFMDEventInspector::operator=(const AliFMDEventInspector& o)
   fHEventsTrVtx      = o.fHEventsTrVtx;
   fHTriggers         = o.fHTriggers;
   fHType             = o.fHType;
+  fHWords            = o.fHWords;
   fLowFluxCut        = o.fLowFluxCut;
   fMaxVzErr          = o.fMaxVzErr;
   fDebug             = o.fDebug;
@@ -140,6 +145,7 @@ AliFMDEventInspector::operator=(const AliFMDEventInspector& o)
     if (fHEventsTrVtx) fList->Add(fHEventsTrVtx);
     if (fHTriggers)    fList->Add(fHTriggers);
     if (fHType)        fList->Add(fHType);
+    if (fHWords)       fList->Add(fHWords);
   }
   return *this;
 }
@@ -238,7 +244,15 @@ AliFMDEventInspector::Init(const TAxis& vtxAxis)
   fHType->GetXaxis()->SetBinLabel(1,"Low-flux");
   fHType->GetXaxis()->SetBinLabel(2,"High-flux");
   fList->Add(fHType);
-  
+
+
+  fHWords = new TH1I("words", "Trigger words seen", 1, 0, 0); 
+  fHWords->SetFillColor(kBlue+1);
+  fHWords->SetFillStyle(3001);
+  fHWords->SetStats(0);
+  fHWords->SetDirectory(0);
+  fHWords->SetBit(TH1::kCanRebin);
+  fList->Add(fHWords);
 }
 
 //____________________________________________________________________
@@ -410,6 +424,16 @@ AliFMDEventInspector::ReadTriggers(const AliESDEvent* esd, UInt_t& triggers)
 
   // Get trigger stuff 
   TString trigStr = esd->GetFiredTriggerClasses();
+  // AliWarning(Form("Fired trigger classes: %s", trigStr.Data()));
+  fHWords->Fill(trigStr.Data(), 1);
+#if 0
+  if (trigStr.Contains("MB1") || trigStr.Contains("MBBG3"))
+      triggers |= AliAOODForwardMult::kB;
+  if (trigStr.Contains("COTA")) 
+    triggers |= AliAODForwardMult::kA;
+  if (trigStr.Contains("COTC")) 
+    triggers |= AliAODForwardMult::kC;
+#endif
   if (trigStr.Contains("CBEAMB-ABCE-NOPF-ALL")) {
     triggers |= AliAODForwardMult::kEmpty;
     fHTriggers->Fill(kEmpty+.5);
index a2bf52c33291bd18c9386055d952e8d10cbdaf4a..16c65209d9d13b194cd8b3e609f9d4ca558f6ecd 100644 (file)
@@ -223,6 +223,7 @@ protected:
   TH1I*    fHEventsTrVtx; //! Events w/trigger and vertex 
   TH1I*    fHTriggers;    //! Triggers
   TH1I*    fHType;        //! Type (low/high flux) of event
+  TH1I*    fHWords;       //! Trigger words 
   Int_t    fLowFluxCut;   //  Low flux cut
   Double_t fMaxVzErr;     //  Maximum error on v_z
   TList*   fList;         //! Histogram container 
index 2414a013b53846115a4ee8888ac7c6757ea2fe12..9507db1ff2d5c51a4a018fc514b5b8b297c0801e 100644 (file)
 
 //____________________________________________________________________
 AliForwarddNdetaTask::AliForwarddNdetaTask()
-  : AliAnalysisTaskSE(), 
-    fSumForward(0),    //  Sum of histograms 
-    fSumForwardMC(0),  //  Sum of MC histograms (if any)
+  : AliBasedNdetaTask(),
     fSumPrimary(0),    //  Sum of primary histograms
-    fSumCentral(0),    //  Sum of central histograms
-    fCentral(0),       // Cache of central histogram
-    fPrimary(0),       // Cache of primary histogram
-    fSums(0),          // Container of sums 
-    fOutput(0),                // Container of outputs 
-    fTriggers(0),      // Histogram of triggers 
-    fVtxMin(0),                // Minimum v_z
-    fVtxMax(0),                // Maximum v_z
-    fTriggerMask(0),    // Trigger mask 
-    fRebin(0),         // Rebinning factor 
-    fCutEdges(false),
     fSNNString(0),
     fSysString(0)
 {}
 
 //____________________________________________________________________
 AliForwarddNdetaTask::AliForwarddNdetaTask(const char* /* name */)
-  : AliAnalysisTaskSE("Forward"), 
-    fSumForward(0),    //  Sum of histograms 
-    fSumForwardMC(0),  //  Sum of MC histograms (if any)
+  : AliBasedNdetaTask("Forward"), 
     fSumPrimary(0),    //  Sum of primary histograms
-    fSumCentral(0),    //  Sum of central histograms
-    fCentral(0),       // Cache of central histogram
-    fPrimary(0),       // Cache of primary histogram
-    fSums(0),          // Container of sums 
-    fOutput(0),                // Container of outputs 
-    fTriggers(0),      // Histogram of triggers 
-    fVtxMin(-10),      // Minimum v_z
-    fVtxMax(10),       // Maximum v_z
-    fTriggerMask(AliAODForwardMult::kInel), 
-    fRebin(5),         // Rebinning factor 
-    fCutEdges(false),
     fSNNString(0),
     fSysString(0)
 {
-  // Output slot #1 writes into a TH1 container
-  DefineOutput(1, TList::Class()); 
-  DefineOutput(2, TList::Class()); 
 }
 
 //____________________________________________________________________
 AliForwarddNdetaTask::AliForwarddNdetaTask(const AliForwarddNdetaTask& o)
-  : AliAnalysisTaskSE(o), 
-    fSumForward(o.fSumForward),           // Sum of histograms 
-    fSumForwardMC(o.fSumForwardMC),// Sum of MC histograms (if any)
+  : AliBasedNdetaTask(o),
     fSumPrimary(o.fSumPrimary),           // Sum of primary histograms
-    fSumCentral(o.fSumCentral),           // Sum of central histograms
-    fCentral(o.fCentral),          // Cache of central histogram
-    fPrimary(o.fPrimary),          // Cache of primary histogram
-    fSums(o.fSums),               // Container of sums 
-    fOutput(o.fOutput),                   // Container of outputs 
-    fTriggers(o.fTriggers),       // Histogram of triggers 
-    fVtxMin(o.fVtxMin),                   // Minimum v_z
-    fVtxMax(o.fVtxMax),                   // Maximum v_z
-    fTriggerMask(o.fTriggerMask),  // Trigger mask 
-    fRebin(o.fRebin),             // Rebinning factor 
-    fCutEdges(o.fCutEdges),       // Whether to cut edges when rebinning
     fSNNString(o.fSNNString),     //  
     fSysString(o.fSysString)      //  
 {}
 
-//____________________________________________________________________
-AliForwarddNdetaTask::~AliForwarddNdetaTask()
-{
-  if (fSums) { 
-    fSums->Delete();
-    delete fSums;
-    fSums = 0;
-  }
-  if (fOutputs) { 
-    fOutputs->Delete();
-    delete fOutputs;
-    fOutputs = 0;
-  }
-  if (fCentral)    delete fCentral;
-  if (fPrimary)    delete fPrimary;
-}
-
-//________________________________________________________________________
-void 
-AliForwarddNdetaTask::SetTriggerMask(const char* mask)
-{
-  UShort_t    trgMask = 0;
-  TString     trgs(mask);
-  trgs.ToUpper();
-  TObjString* trg;
-  TIter       next(trgs.Tokenize(" ,|"));
-  while ((trg = static_cast<TObjString*>(next()))) { 
-    TString s(trg->GetString());
-    if      (s.IsNull()) continue;
-    if      (s.CompareTo("INEL")  == 0) trgMask = AliAODForwardMult::kInel;
-    else if (s.CompareTo("INEL>0")== 0) trgMask = AliAODForwardMult::kInelGt0;
-    else if (s.CompareTo("NSD")   == 0) trgMask = AliAODForwardMult::kNSD;
-    else 
-      Warning("SetTriggerMask", "Unknown trigger %s", s.Data());
-  }
-  if (trgMask == 0) trgMask = 1;
-  SetTriggerMask(trgMask);
-}
-
-//________________________________________________________________________
-void 
-AliForwarddNdetaTask::UserCreateOutputObjects()
-{
-  // Create histograms
-  // Called once (on the worker node)
-
-  fOutput = new TList;
-  fOutput->SetName(Form("%s_result", GetName()));
-  fOutput->SetOwner();
-
-  fSums = new TList;
-  fSums->SetName(Form("%s_sums", GetName()));
-  fSums->SetOwner();
-
-
-  fTriggers = new TH1D("triggers", "Number of triggers", 
-                      kAccepted, 1, kAccepted);
-  fTriggers->SetYTitle("# of events");
-  fTriggers->GetXaxis()->SetBinLabel(kAll,         "All events");
-  fTriggers->GetXaxis()->SetBinLabel(kB,           "w/B trigger");
-  fTriggers->GetXaxis()->SetBinLabel(kA,           "w/A trigger");
-  fTriggers->GetXaxis()->SetBinLabel(kC,           "w/C trigger");
-  fTriggers->GetXaxis()->SetBinLabel(kE,           "w/E trigger");
-  fTriggers->GetXaxis()->SetBinLabel(kMB,          "w/Collision trigger");
-  fTriggers->GetXaxis()->SetBinLabel(kWithVertex,  "w/Vertex");
-  fTriggers->GetXaxis()->SetBinLabel(kWithTrigger, "w/Selected trigger");
-  fTriggers->GetXaxis()->SetBinLabel(kAccepted,    "Accepted by cut");
-  fTriggers->GetXaxis()->SetNdivisions(kAccepted, false);
-  fTriggers->SetFillColor(kRed+1);
-  fTriggers->SetFillStyle(3001);
-  fTriggers->SetStats(0);
-  fSums->Add(fTriggers);
-
-  fSNNString = new TNamed("sNN", "");
-  fSysString = new TNamed("sys", "");
-  fSums->Add(fSNNString);
-  fSums->Add(fSysString);
-
-  // Check that we have an AOD input handler 
-  AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
-  AliAODInputHandler* ah = 
-    dynamic_cast<AliAODInputHandler*>(am->GetInputEventHandler());
-  if (!ah) AliFatal("No AOD input handler set in analysis manager");
-
-  // Post data for ALL output slots >0 here, to get at least an empty histogram
-  PostData(1, fSums); 
-}
-
 //____________________________________________________________________
 TH2D*
-AliForwarddNdetaTask::CloneHist(TH2D* in, const char* name) 
-{
-  if (!in) return 0;
-  TH2D* ret = static_cast<TH2D*>(in->Clone(name));
-  ret->SetDirectory(0);
-  ret->Sumw2();
-  fSums->Add(ret);
-
-  return ret;
-}
-
-//____________________________________________________________________
-void 
-AliForwarddNdetaTask::UserExec(Option_t *) 
+AliForwarddNdetaTask::GetHistogram(AliAODEvent* aod, Bool_t mc)
 {
-  // Main loop
-  AliAODEvent* aod = dynamic_cast<AliAODEvent*>(InputEvent());
-  if (!aod) {
-    AliError("Cannot get the AOD event");
-    return;
-  }  
-
-  // Get objects from the event structure 
-  TObject* oForward   = aod->FindListObject("Forward");
-  TObject* oForwardMC = aod->FindListObject("ForwardMC");
-  TObject* oPrimary   = aod->FindListObject("primary");
-  TObject* oCentral   = aod->FindListObject("Central");
+  TObject* obj = 0;
+  if (mc) obj = aod->FindListObject("ForwardMC");
+  else    obj = aod->FindListObject("Forward");
 
   // We should have a forward object at least 
-  if (!oForward) { 
-    AliWarning("No Forward object found AOD");
-    return;
+  if (!obj) {
+    if (!mc) AliWarning("No Forward object found AOD");
+    return 0;
+  }
+  AliAODForwardMult* forward = static_cast<AliAODForwardMult*>(obj);
+
+  // Here, we update the primary stuff 
+  if (mc) { 
+    TObject* oPrimary   = aod->FindListObject("primary");
+    if (oPrimary) {
+      TH2D* primary   = static_cast<TH2D*>(oPrimary);
+      // Add contribtion from MC 
+      if (primary && !fSumPrimary) fSumPrimary = CloneHist(primary, "truth");
+      if (primary) fSumPrimary->Add(primary);
+    }    
   }
 
-  // Cast to good types 
-  AliAODForwardMult* forward   = static_cast<AliAODForwardMult*>(oForward);
-  AliAODForwardMult* forwardMC = static_cast<AliAODForwardMult*>(oForwardMC);
-  TH2D*              primary   = static_cast<TH2D*>(oPrimary);
-  TH2D*              central   = static_cast<TH2D*>(oCentral);
-
-  static bool first = true;
-  if (first) { 
+  // Here, we get the update 
+  if (!fSNNString) { 
     UShort_t sNN = forward->GetSNN();
-    UShort_t sys = forward->GetSystem();
+    fSNNString = new TNamed("sNN", "");
     fSNNString->SetTitle(AliForwardUtil::CenterOfMassEnergyString(sNN));
     fSNNString->SetUniqueID(sNN);
+    fSums->Add(fSNNString);
+  
+    UShort_t sys = forward->GetSystem();
+    fSysString = new TNamed("sys", "");
     fSysString->SetTitle(AliForwardUtil::CollisionSystemString(sys));
     fSysString->SetUniqueID(sys);
-    first = false;
+    fSums->Add(fSysString);
   }
 
-  // Create our sum histograms 
-  if (!fSumForward) fSumForward = CloneHist(&forward->GetHistogram(),"forward");
-  if (!fSumForwardMC && forwardMC) 
-    fSumForwardMC = CloneHist(&forwardMC->GetHistogram(),"forwardMC");
-  if (!fSumPrimary && primary) fSumPrimary = CloneHist(primary, "primary");
-  if (!fSumCentral && central) fSumCentral = CloneHist(central, "central");
-
-  // Add contribtion from MC 
-  if (primary) fSumPrimary->Add(primary);
-  
-  // Count event 
-  fTriggers->AddBinContent(kAll);
-  if (forward->IsTriggerBits(AliAODForwardMult::kB)) 
-    fTriggers->AddBinContent(kB);
-  if (forward->IsTriggerBits(AliAODForwardMult::kA)) 
-    fTriggers->AddBinContent(kA);
-  if (forward->IsTriggerBits(AliAODForwardMult::kC)) 
-    fTriggers->AddBinContent(kC);
-  if (forward->IsTriggerBits(AliAODForwardMult::kE)) 
-    fTriggers->AddBinContent(kE);
-  if (forward->IsTriggerBits(AliAODForwardMult::kInel)) 
-    fTriggers->AddBinContent(kMB);
-
-  // Check if we have an event of interest. 
-  if (!forward->IsTriggerBits(fTriggerMask)) return;
-  fTriggers->AddBinContent(kWithTrigger);
-
-  // Check that we have a valid vertex
-  if (!forward->HasIpZ()) return;
-  fTriggers->AddBinContent(kWithVertex);
-
-  // Check that vertex is within cuts 
-  if (!forward->InRange(fVtxMin, fVtxMax)) return;
-  fTriggers->AddBinContent(kAccepted);
-
-  // Add contribution 
-  fSumForward->Add(&(forward->GetHistogram()));
-  if (fSumForwardMC) fSumForwardMC->Add(&(forwardMC->GetHistogram()));
-  if (fSumPrimary)   fSumPrimary->Add(primary);
-  if (fSumCentral)   fSumCentral->Add(central);
-
-  PostData(1, fSums);
+  return &(forward->GetHistogram());
 }
 
-//________________________________________________________________________
-void 
-AliForwarddNdetaTask::SetHistogramAttributes(TH1D* h, Int_t colour, Int_t marker,
-                                         const char* title, const char* ytitle)
-{
-  h->SetTitle(title);
-  h->SetMarkerColor(colour);
-  h->SetMarkerStyle(marker);
-  h->SetMarkerSize(1);
-  h->SetFillStyle(0);
-  h->SetYTitle(ytitle);
-  h->GetXaxis()->SetTitleFont(132);
-  h->GetXaxis()->SetLabelFont(132);
-  h->GetXaxis()->SetNdivisions(10);
-  h->GetYaxis()->SetTitleFont(132);
-  h->GetYaxis()->SetLabelFont(132);
-  h->GetYaxis()->SetNdivisions(10);
-  h->GetYaxis()->SetDecimals();
-  h->SetStats(0);
-}
-  
 //________________________________________________________________________
 void 
 AliForwarddNdetaTask::Terminate(Option_t *) 
 {
   // Draw result to screen, or perform fitting, normalizations Called
   // once at the end of the query
-        
-  fSums = dynamic_cast<TList*> (GetOutputData(1));
+  AliBasedNdetaTask::Terminate("");
   if(!fSums) {
     AliError("Could not retrieve TList fSums"); 
     return; 
   }
-  
   if (!fOutput) { 
-    fOutput = new TList;
-    fOutput->SetName(Form("%s_result", GetName()));
-    fOutput->SetOwner();
+    AliError("Could not retrieve TList fOutput"); 
+    return; 
   }
 
-  fSumForward     = static_cast<TH2D*>(fSums->FindObject("forward"));
-  fSumForwardMC   = static_cast<TH2D*>(fSums->FindObject("forwardMC"));
-  fSumPrimary     = static_cast<TH2D*>(fSums->FindObject("primary"));
-  fSumCentral     = static_cast<TH2D*>(fSums->FindObject("central"));
-  fTriggers       = static_cast<TH1D*>(fSums->FindObject("triggers"));
+  fSumPrimary     = static_cast<TH2D*>(fSums->FindObject("truth"));
   fSNNString      = static_cast<TNamed*>(fSums->FindObject("sNN"));
   fSysString      = static_cast<TNamed*>(fSums->FindObject("sys"));
 
-  if (!fTriggers) { 
-    AliError("Couldn't find histogram 'triggers' in list");
-    return;
-  }
-  if (!fSumForward) { 
-    AliError("Couldn't find histogram 'forward' in list");
-    return;
-  }
-
-  Int_t nAll        = Int_t(fTriggers->GetBinContent(kAll));
-  Int_t nB          = Int_t(fTriggers->GetBinContent(kB));
-  Int_t nA          = Int_t(fTriggers->GetBinContent(kA));
-  Int_t nC          = Int_t(fTriggers->GetBinContent(kC));
-  Int_t nE          = Int_t(fTriggers->GetBinContent(kE));
-  Int_t nMB         = Int_t(fTriggers->GetBinContent(kMB));
-  Int_t nTriggered  = Int_t(fTriggers->GetBinContent(kWithTrigger));
-  Int_t nWithVertex = Int_t(fTriggers->GetBinContent(kWithVertex));
-  Int_t nAccepted   = Int_t(fTriggers->GetBinContent(kAccepted));
-  Int_t nGood       = nB - nA - nC + 2 * nE;
-  Double_t vtxEff   = Double_t(nMB) / nTriggered * Double_t(nAccepted) / nGood;
-  AliInfo(Form("Total of %9d events\n"
-              "                   of these %9d are minimum bias\n"
-              "                   of these %9d has a %s trigger\n" 
-              "                   of these %9d has a vertex\n" 
-              "                   of these %9d were in [%+4.1f,%+4.1f]cm\n"
-              "                   Triggers by type:\n"
-              "                     B   = %9d\n"
-              "                     A|C = %9d (%9d+%-9d)\n"
-              "                     E   = %9d\n"
-              "                   Implies %9d good triggers\n"
-              "                   Vertex efficiency: %f",
-              nAll, nMB, nTriggered, 
-              AliAODForwardMult::GetTriggerString(fTriggerMask),
-              nWithVertex, nAccepted,
-              fVtxMin, fVtxMax, 
-              nB, nA+nC, nA, nC, nE, nGood, vtxEff));
-  
-  // Get acceptance normalisation from underflow bins 
-  TH1D* normForward   = fSumForward->ProjectionX("normForward", 0, 1, "");
-  // Project onto eta axis - _ignoring_underflow_bins_!
-  TH1D* dndetaForward = fSumForward->ProjectionX("dndetaForward", 1, -1, "e");
-  // Normalize to the acceptance 
-  dndetaForward->Divide(normForward);
-  // Scale by the vertex efficiency 
-  dndetaForward->Scale(vtxEff, "width");
-
-  SetHistogramAttributes(dndetaForward, kRed+1, 20, "ALICE Forward");
-  SetHistogramAttributes(normForward, kRed+1, 20, "ALICE Forward", "Normalisation");
-
-  fOutput->Add(fTriggers->Clone());
   fOutput->Add(fSNNString->Clone());
   fOutput->Add(fSysString->Clone());
-  fOutput->Add(dndetaForward);
-  fOutput->Add(normForward);
-  fOutput->Add(Rebin(dndetaForward));
-
-  if (fSumForwardMC) { 
-    // Get acceptance normalisation from underflow bins 
-    TH1D* normForwardMC   = fSumForwardMC->ProjectionX("normForwardMC", 0, 1, "");
-    // Project onto eta axis - _ignoring_underflow_bins_!
-    TH1D* dndetaForwardMC = fSumForwardMC->ProjectionX("dndetaForwardMC", 1, -1, "e");
-    // Normalize to the acceptance 
-    dndetaForwardMC->Divide(normForwardMC);
-    // Scale by the vertex efficiency 
-    dndetaForwardMC->Scale(vtxEff, "width");
-
-    SetHistogramAttributes(dndetaForwardMC, kRed+3, 21, "ALICE Forward (MC)");
-    SetHistogramAttributes(normForwardMC, kRed+3, 21, "ALICE Forward (MC)", 
-                          "Normalisation");
-
-    fOutput->Add(dndetaForwardMC);
-    fOutput->Add(normForwardMC);
-    fOutput->Add(Rebin(dndetaForwardMC));
-  }
 
   if (fSumPrimary) { 
-    TH1D* dndetaTruth = fSumPrimary->ProjectionX("dndetaTruth",-1,-1,"e");
+    Int_t nAll        = Int_t(fTriggers->GetBinContent(kAll));
+    TH1D* dndetaTruth = ProjectX(fSumPrimary,"dndetaTruth",
+                                1,fSumPrimary->GetNbinsY());
     dndetaTruth->Scale(1./nAll, "width");
 
     SetHistogramAttributes(dndetaTruth, kGray+3, 22, "Monte-Carlo truth");
@@ -396,27 +115,6 @@ AliForwarddNdetaTask::Terminate(Option_t *)
     fOutput->Add(dndetaTruth);
     fOutput->Add(Rebin(dndetaTruth));
   }
-  if (fSumCentral) { 
-    TH1D* dndetaCentral = fSumCentral->ProjectionX("dndetaCentral",-1,-1,"e");
-    dndetaCentral->Scale(1./nGood, "width");
-
-    SetHistogramAttributes(dndetaCentral, kGray+3, 22, "ALICE Central - track(let)s");
-
-    dndetaCentral->GetXaxis()->SetRangeUser(-1,1);
-    fOutput->Add(dndetaCentral);
-    fOutput->Add(Rebin(dndetaCentral));
-  }
-
-  TNamed* trigString = 
-    new TNamed("trigString", AliAODForwardMult::GetTriggerString(fTriggerMask));
-  trigString->SetUniqueID(fTriggerMask);
-  fOutput->Add(trigString);
-
-  TAxis* vtxAxis = new TAxis(1,fVtxMin,fVtxMax);
-  vtxAxis->SetName("vtxAxis");
-  vtxAxis->SetTitle(Form("v_{z}#in[%+5.1f,%+5.1f]cm", fVtxMin,fVtxMax));
-  fOutput->Add(vtxAxis);
-
   // If only there was a away to get sqrt{s_NN} and beam type 
   
 
@@ -424,60 +122,6 @@ AliForwarddNdetaTask::Terminate(Option_t *)
 }
 
 //________________________________________________________________________
-TH1D*
-AliForwarddNdetaTask::Rebin(const TH1D* h) const
-{
-  if (fRebin <= 1) return 0;
-
-  Int_t nBins = h->GetNbinsX();
-  if(nBins % fRebin != 0) {
-    Warning("Rebin", "Rebin factor %d is not a devisor of current number "
-           "of bins %d in the histogram %s", fRebin, nBins, h->GetName());
-    return 0;
-  }
-    
-  // Make a copy 
-  TH1D* tmp = static_cast<TH1D*>(h->Clone(Form("%s_rebin%02d", 
-                                              h->GetName(), fRebin)));
-  tmp->Rebin(fRebin);
-  tmp->SetDirectory(0);
-
-  // The new number of bins 
-  Int_t nBinsNew = nBins / fRebin;
-  for(Int_t i = 1;i<= nBinsNew; i++) {
-    Double_t content = 0;
-    Double_t sumw    = 0;
-    Double_t wsum    = 0;
-    Int_t    nbins   = 0;
-    for(Int_t j = 1; j<=fRebin;j++) {
-      Int_t    bin = (i-1)*fRebin + j;
-      Double_t c   =  h->GetBinContent(bin);
-
-      if (c <= 0) continue;
-
-      if (fCutEdges) {
-       if (h->GetBinContent(bin+1)<=0 || 
-           h->GetBinContent(bin-1)) {
-         Warning("Rebin", "removing bin %d=%f of %s (%d=%f,%d=%f)", 
-                 bin, c, h->GetName(), 
-                 bin+1, h->GetBinContent(bin+1), 
-                 bin-1, h->GetBinContent(bin-1));
-         continue;
-       }       
-      }
-      Double_t e =  h->GetBinError(bin);
-      Double_t w =  1 / (e*e); // 1/c/c
-      content    += c;
-      sumw       += w;
-      wsum       += w * c;
-      nbins++;
-    }
-      
-    if(content > 0 && nbins > 0) {
-      tmp->SetBinContent(i, wsum / sumw);
-      tmp->SetBinError(i,1./TMath::Sqrt(sumw));
-    }
-  }
-  
-  return tmp;
-}
+//
+// EOF
+//
index 7d65c71144c5ce1f6e360e197963b5eee3c36eea..13a4c19e6bac7a1ccb29bbfb95679a58d0a855f0 100644 (file)
@@ -3,8 +3,7 @@
 //
 #ifndef ALIFORWARDDNDETATASK_H
 #define ALIFORWARDDNDETATASK_H
-#include <AliAnalysisTaskSE.h>
-//#include <AliAODForwardMult.h>
+#include <AliBasedNdetaTask.h>
 class TList;
 class TH2D;
 class TH1D;
@@ -12,7 +11,7 @@ class TH1D;
 /**
  * Task to determine the 
  */
-class AliForwarddNdetaTask : public AliAnalysisTaskSE
+class AliForwarddNdetaTask : public AliBasedNdetaTask
 {
 public:
   /** 
@@ -27,33 +26,11 @@ public:
    * @param maxVtx  Set @f$v_z@f$ range
    */
   AliForwarddNdetaTask(const char* name);
-  
-  void SetVertexRange(Double_t min, Double_t max) { fVtxMin=min; fVtxMax=max; }
-  void SetRebinning(Int_t rebin) { fRebin = rebin; }
-  void SetTriggerMask(UShort_t mask) { fTriggerMask = mask; }
-  void SetTriggerMask(const char* mask);
   /**
    * Destructor
    * 
    */
-  virtual ~AliForwarddNdetaTask();
-  /** 
-   * Initialise on master - does nothing
-   * 
-   */
-  virtual void   Init() {}
-  /** 
-   * Create output objects.  
-   *
-   * This is called once per slave process 
-   */
-  virtual void UserCreateOutputObjects();
-  /** 
-   * Process a single event 
-   * 
-   * @param option Not used
-   */
-  virtual void UserExec(Option_t* option);
+  virtual ~AliForwarddNdetaTask() {}
   /** 
    * Called at end of event processing.. 
    *
@@ -63,72 +40,36 @@ public:
    */
   virtual void Terminate(Option_t* option);
 protected:
-  AliForwarddNdetaTask(const AliForwarddNdetaTask&);
-  AliForwarddNdetaTask& operator=(const AliForwarddNdetaTask&) { return *this; }
   /** 
-   * Clone a 2D histogram
-   * 
-   * @param in    Histogram to clone.
-   * @param name  New name of clone.
-   * 
-   * @return The clone
+   * Copy constructor 
    */
-  TH2D* CloneHist(TH2D* in, const char* name);
+  AliForwarddNdetaTask(const AliForwarddNdetaTask& o);
   /** 
-   * Make a copy of the input histogram and rebin that histogram
+   * Assigmement operator
    * 
-   * @param h  Histogram to rebin
-   * 
-   * @return New (rebinned) histogram
+   * @return Reference to this
    */
-  TH1D* Rebin(const TH1D* h) const;
+  AliForwarddNdetaTask& operator=(const AliForwarddNdetaTask&) { return *this; }
+
   /** 
-   * Set histogram graphical options, etc. 
+   * Retrieve the histogram 
    * 
-   * @param h       Histogram to modify
-   * @param colour  Marker color 
-   * @param marker  Marker style
-   * @param title   Title of histogram
-   * @param ytitle  Title on y-axis. 
-   */
-  void  SetHistogramAttributes(TH1D* h, Int_t colour, Int_t marker, const char* title, 
-                              const char* ytitle="#frac{1}{N} #frac{dN_{ch}}{d#eta}");
-  /** 
-   * Trigger histogram bins 
+   * @param aod AOD event 
+   * @param mc  Whether to get the MC histogram or not
+   * 
+   * @return Retrieved histogram or null
    */
-  enum { 
-    kAll        = 1, 
-    kB          = 2, 
-    kA          = 3, 
-    kC          = 4, 
-    kE          = 5,
-    kMB         = 6, 
-    kWithTrigger= 7,
-    kWithVertex = 8, 
-    kAccepted   = 9 
-  };
-
-  TH2D*           fSumForward;    //  Sum of histograms 
-  TH2D*           fSumForwardMC;  //  Sum of MC histograms (if any)
+  TH2D* GetHistogram(AliAODEvent* aod, Bool_t mc);
   TH2D*           fSumPrimary;    //  Sum of primary histograms
-  TH2D*           fSumCentral;    //  Sum of central histograms
-  TH2D*           fCentral;       //! Cache of central histogram
-  TH2D*           fPrimary;       //! Cache of primary histogram
-
-  TList*          fSums;          // Container of sums 
-  TList*          fOutput;        // Container of outputs 
-
-  TH1D*           fTriggers;      // Histogram of triggers 
-  
-  Double_t        fVtxMin;        // Minimum v_z
-  Double_t        fVtxMax;        // Maximum v_z
-  Int_t           fTriggerMask;   // Trigger mask 
-  Int_t           fRebin;         // Rebinning factor 
-  Bool_t          fCutEdges;      // Whether to cut edges when rebinning
   TNamed*         fSNNString;     // 
   TNamed*         fSysString;     // 
 
-  ClassDef(AliForwarddNdetaTask,1); // Determine multiplicity in central area
+  ClassDef(AliForwarddNdetaTask,1); // Determine multiplicity in forward region
 };
 
 #endif
+//
+// Local Variables:
+//  mode: C++
+// End:
+//
index 560d05435bf84b3cba01791708ee294618a0fa8d..fa0fbea5fd65bd59e4bf66579d33c4a7d8fa39ca 100644 (file)
@@ -160,9 +160,9 @@ struct dNdetaDrawer
    */
   void SetSys(UShort_t sys)
   {
-    fSNNString = new TNamed("sys", (sys == 1 ? "pp" : 
+    fSysString = new TNamed("sys", (sys == 1 ? "pp" : 
                                    sys == 2 ? "PbPb" : "unknown"));
-    fSNNString->SetUniqueID(sys);
+    fSysString->SetUniqueID(sys);
   }
   //__________________________________________________________________
   /** 
@@ -247,13 +247,14 @@ struct dNdetaDrawer
     fForward   = GetResult(results, "dndetaForward");
     fForwardMC = GetResult(results, "dndetaForwardMC");
     fTruth     = GetResult(results, "dndetaTruth");
+    if (!fTruth) results->ls();
 
     TList* clusters = static_cast<TList*>(file->Get("CentralResults"));
     if (!clusters) 
       Warning("Open", "Couldn't find list CentralResults");
     else {
       fCentral   = GetResult(clusters, "dndetaCentral");
-      fCentral->SetMarkerColor(kGreen+1);
+      if (fCentral) fCentral->SetMarkerColor(kGreen+1);
     }
     if (!fTrigString) 
       fTrigString = static_cast<TNamed*>(results->FindObject("trigString"));
@@ -273,6 +274,17 @@ struct dNdetaDrawer
       fVtxAxis->SetTitle("v_{z} range unspecified");
     }
 
+    Info("Open", 
+        "Initialized for\n"
+        "   Trigger:    %s  (%d)\n"
+        "   sqrt(sNN):  %s  (%dGeV)\n"
+        "   System:     %s  (%d)\n"
+        "   Vz range:   %s  (%f,%f)",
+        fTrigString->GetTitle(), fTrigString->GetUniqueID(), 
+        fSNNString->GetTitle(),  fSNNString->GetUniqueID(), 
+        fSysString->GetTitle(),  fSysString->GetUniqueID(), 
+        fVtxAxis->GetTitle(), fVtxAxis->GetXmin(), fVtxAxis->GetXmax());
+
     TList* sums = static_cast<TList*>(file->Get("ForwardSums"));
     if (sums) 
       fTriggers = GetResult(sums, "triggers");
@@ -378,6 +390,13 @@ struct dNdetaDrawer
       if (cms   && alice) ratios->Add(Ratio(alice, cms,   max));
     }
 
+    // Check if we have a primaries from MC 
+    if (fTruth) {
+      ratios->Add(Ratio(fForward,    fTruth, max));
+      ratios->Add(Ratio(fForwardSym, fTruth, max));
+      ratios->Add(Ratio(fCentral,    fTruth, max));
+    }
+
     // If we have data from HHD's analysis, then do the ratio of 
     // our result to that data. 
     if (fForwardHHD) { 
@@ -1401,7 +1420,12 @@ DrawdNdeta(const char* filename="forward_dndeta.root",
           Int_t       flags=0xf,
           const char* title="",
           UShort_t    rebin=5, 
-          Bool_t      cutEdges=false)
+          Bool_t      cutEdges=false,
+          UShort_t    sNN=0, 
+          UShort_t    sys=0,
+          UShort_t    trg=1,
+          Float_t     vzMin=999, 
+          Float_t     vzMax=-999)
 {
   dNdetaDrawer d;
   d.SetRebin(rebin);
@@ -1413,10 +1437,11 @@ DrawdNdeta(const char* filename="forward_dndeta.root",
   d.SetShowRatios(flags & 0x4);
   d.SetShowLeftRight(flags & 0x8);
   // Do the below if your input data does not contain these settings 
-  // d.SetSNN(900);            // Collision energy per nucleon pair (GeV)
-  // d.SetSys(1);              // Collision system (1:pp, 2:PbPB)
-  // d.SetTrigger(1);          // Collision trigger (1:INEL, 2:INEL>0, 4:NSD)
-  // d.SetVertexRange(-10,10); // Collision vertex range (cm)
+  if (sNN > 0) d.SetSNN(sNN);     // Collision energy per nucleon pair (GeV)
+  if (sys > 0) d.SetSys(sys);     // Collision system (1:pp, 2:PbPB)
+  if (trg > 0) d.SetTrigger(trg); // Collision trigger (1:INEL, 2:INEL>0, 4:NSD)
+  if (vzMin < 999 && vzMax > -999) 
+    d.SetVertexRange(vzMin,vzMax); // Collision vertex range (cm)
   d.Run(filename);
 }
 //____________________________________________________________________
index 3d8978aefb8bed73f98ce5c978ec75ba3e59a343..14e124a9ea2bd728d77b60b51fe1e4bb9ad1ca24 100644 (file)
@@ -105,7 +105,7 @@ void MakeELossFits(const char* esddir,
   // Least weight to use 
   AliFMDCorrELossFit::ELossFit::fgLeastWeight = 1e-5;
   // Maximum value of reduced chi^2 
-  AliFMDCorrELossFit::ELossFit::fgMaxChi2nu   = 5;
+  AliFMDCorrELossFit::ELossFit::fgMaxChi2nu   = 10;
   
   // --- Run the analysis --------------------------------------------
   TStopwatch t;