]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/FORWARD/analysis2/AliForwarddNdetaTask.cxx
Improvements
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliForwarddNdetaTask.cxx
index 3dcb3bfd5666ecb64f6f97a79cfbf1a17302f9eb..1959827eaf9c62f8b600c85dfcca40f77c946372 100644 (file)
@@ -20,7 +20,7 @@ AliForwarddNdetaTask::AliForwarddNdetaTask()
   //
   // Constructor 
   // 
-  DGUARD(fDebug, 0, "Default CTOR of AliForwarddNdetaTask");
+  DGUARD(fDebug, 3, "Default CTOR of AliForwarddNdetaTask");
 }
 
 //____________________________________________________________________
@@ -32,8 +32,8 @@ AliForwarddNdetaTask::AliForwarddNdetaTask(const char* /* name */)
   // 
   // Paramters
   //   name    Name of task 
-  SetTitle("FMD");
-  DGUARD(fDebug, 0, "Named CTOR of AliForwarddNdetaTask");
+  // SetTitle("FMD");
+  DGUARD(fDebug, 3, "Named CTOR of AliForwarddNdetaTask");
 }
 
 //____________________________________________________________________
@@ -43,12 +43,12 @@ AliForwarddNdetaTask::AliForwarddNdetaTask(const AliForwarddNdetaTask& o)
   // 
   // Copy constructor
   // 
-  DGUARD(fDebug, 0, "Copy CTOR of AliForwarddNdetaTask");
+  DGUARD(fDebug, 3, "Copy CTOR of AliForwarddNdetaTask");
 }
 
 //____________________________________________________________________
 AliBasedNdetaTask::CentralityBin*
-AliForwarddNdetaTask::MakeCentralityBin(const char* name, Short_t l, Short_t h) 
+AliForwarddNdetaTask::MakeCentralityBin(const char* name, Short_t l,Short_t h) 
   const 
 {
   // 
@@ -62,7 +62,8 @@ AliForwarddNdetaTask::MakeCentralityBin(const char* name, Short_t l, Short_t h)
   // Return:
   //    Newly allocated object (of our type)
   //
-  DGUARD(fDebug, 3,"Make a centrality bin for AliForwarddNdetaTask: %s [%d,%d]",
+  DGUARD(fDebug, 3,
+        "Make a centrality bin for AliForwarddNdetaTask: %s [%d,%d]",
         name, l, h);
   return new AliForwarddNdetaTask::CentralityBin(name, l, h);
 }
@@ -70,7 +71,7 @@ AliForwarddNdetaTask::MakeCentralityBin(const char* name, Short_t l, Short_t h)
 
 //____________________________________________________________________
 TH2D*
-AliForwarddNdetaTask::GetHistogram(const AliAODEvent* aod, Bool_t mc)
+AliForwarddNdetaTask::GetHistogram(const AliAODEvent& aod, Bool_t mc)
 {
   // 
   // Retrieve the histogram 
@@ -82,26 +83,107 @@ AliForwarddNdetaTask::GetHistogram(const AliAODEvent* aod, Bool_t mc)
   // Return:
   //    Retrieved histogram or null
   //
-  TObject* obj = 0;
-  if (mc) obj = aod->FindListObject("ForwardMC");
-  else    obj = aod->FindListObject("Forward");
-
   // We should have a forward object at least 
-  if (!obj) {
-    if (!mc) AliWarning("No Forward object found AOD");
-    return 0;
-  }
-  AliAODForwardMult* forward = static_cast<AliAODForwardMult*>(obj);
+  AliAODForwardMult* forward = GetForward(aod, mc, !mc);
+  if (!forward) return 0;
   return &(forward->GetHistogram());
 }
+//____________________________________________________________________
+void
+AliForwarddNdetaTask::CheckEventData(Double_t vtx, 
+                                    TH2*     data, 
+                                    TH2*     dataMC)
+{
+  // Check if this is satellite
+  // if (!fSatelliteVertices) return;
+  Double_t aVtx = TMath::Abs(vtx);
+  if (aVtx < 37.5 || aVtx > 400) return;
+
+  TH2* hists[] = { data, dataMC };
 
+  // In satellite vertices FMD2i is cut away manually at this point
+  // for certain vertices. It could be done in the ESDs, but as of
+  // this writing not for specific vertices.
+  // 
+  // cholm comment: It would be difficult to setup the filter in the
+  // reconstruction pass, but it could perhaps be done in the AOD
+  // filtering.
+  // 
+  // This is what was done for
+  // the Pb-Pb paper (arXiv:1304.0347).
+  for (Int_t iX = 0; iX<=data->GetNbinsX(); iX++) {
+    // Do all checks up front - as soon as we can - branching is
+    // expensive!
+    Double_t x    = data->GetXaxis()->GetBinCenter(iX);
+    Bool_t   zero = false;
+    if (((vtx >  60 && vtx <  90) && x < 3) ||
+       ((vtx > 330 && vtx < 350) && x > -2.5) ||
+       ((vtx < 100 || vtx > 305) && TMath::Abs(x) < 4.5) || 
+       (vtx < 50                 && TMath::Abs(x) < 4.75))
+      zero = true;
+    if (!zero) continue;
+    
+    for (Int_t iH = 0; iH < 2; iH++) {
+      if (!hists[iH]) continue;
+      // if (iX > hists[iH]->GetNbinsX()+1) continue;
+      // Also zero coverage and phi acceptance for this 
+      for (Int_t iY = 0; iY<=hists[iH]->GetNbinsY()+1; iY++) {   
+       hists[iH]->SetBinContent(iX, iY, 0);
+       hists[iH]->SetBinError(iX, iY, 0);
+      }
+    }
+  }
+
+  if (fCorrEmpty) {
+    // Now, since we have some dead areas in FMD2i (sectors 16 and
+    // 17), we need to remove the corresponding bins from the
+    // histogram. However, it is not obvious which bins (in eta) to
+    // remove, so remove everything starting from the most negative to
+    // the middle of the histogram.
+    // 
+    // This hack was first introduced by HHD, but was done at the end of
+    // the event processing (CentralityBin::MakeResults).  That is,
+    // however, not very practical, as we'd like to normalize to the phi
+    // acceptance rather than the eta coverage and then correct for
+    // empty bins. Since the only way to really update the phi
+    // acceptance stored in the overflow bin is on the event level, we
+    // should really do it here.
+    const Int_t phiBin1 = 17; // Sector 16
+    const Int_t phiBin2 = 18; // Sector 17
+    for (Int_t iH = 0; iH < 2; iH++) { 
+      if (!hists[iH]) continue;
+      
+      Int_t midX = hists[iH]->GetNbinsX() / 2;
+      // Int_t nY   = hists[iH]->GetNbinsY();
+      for (Int_t i = 1; i <= midX; i++) { 
+       hists[iH]->SetBinContent(i, phiBin1, 0);
+       hists[iH]->SetBinContent(i, phiBin2, 0);
+       hists[iH]->SetBinError(i, phiBin1, 0);
+       hists[iH]->SetBinError(i, phiBin2, 0);
+       
+       // Here, we should also modify the overflow bin to reflect the
+       // new phi acceptance.  First get the old phi acceptance -
+       // then multiply this on the number of bins. This gives us -
+       // roughly - the number of sectors we had.  Then take out two
+       // from that number, and then calculate the new phi
+       // Acceptance. Note, if the sectors where already taken out in
+       // the AOD production, we _will_ end up with a wrong number,
+       // so we should _not_ do that in the AOD production.  This is
+       // tricky and may not work at all.  For now, we should rely on
+       // the old way of correcting to the eta coverage and
+       // correcting for empty bins.
+      }
+    }
+  }
+}
 //========================================================================
 void
 AliForwarddNdetaTask::CentralityBin::End(TList*      sums, 
                                         TList*      results,
                                         UShort_t    scheme,
-                                        const TH1*  shapeCorr, 
+                                        const TH2F* shapeCorr, 
                                         Double_t    trigEff,
+                                        Double_t    trigEff0,
                                         Bool_t      symmetrice,
                                         Int_t       rebin, 
                                         Bool_t      rootProj,
@@ -113,10 +195,10 @@ AliForwarddNdetaTask::CentralityBin::End(TList*      sums,
                                         TList*      mclist,
                                         TList*      truthlist )
 {
-  DGUARD(fDebug, 1, "In End of %s with corrEmpty=%d, cutEdges=%d, rootProj=%d", 
+  DGUARD(fDebug, 1,"In End of %s with corrEmpty=%d, cutEdges=%d, rootProj=%d", 
         GetName(), corrEmpty, cutEdges, rootProj);
   AliBasedNdetaTask::CentralityBin::End(sums, results, scheme, 
-                                       shapeCorr, trigEff, 
+                                       shapeCorr, trigEff, trigEff0,
                                        symmetrice, rebin, 
                                        rootProj, corrEmpty, cutEdges,
                                        triggerMask, marker, color, mclist, 
@@ -126,7 +208,7 @@ AliForwarddNdetaTask::CentralityBin::End(TList*      sums,
   TFile* file = TFile::Open("forward.root", "READ");
   if (!file) return;
   
-  TList* forward = static_cast<TList*>(file->Get("Forward"));
+  TList* forward = static_cast<TList*>(file->Get("ForwardSums"));
   if (!forward) { 
     AliError("List Forward not found in forward.root");
     return;
@@ -145,21 +227,26 @@ AliForwarddNdetaTask::CentralityBin::End(TList*      sums,
     AliError("Triggers histogram not set");
     return;
   }
+
   Double_t ntotal   = 0;
   Double_t epsilonT = trigEff;
+#if 0
   // TEMPORARY FIX
   if (triggerMask == AliAODForwardMult::kNSD) {
     // This is a local change 
     epsilonT = 0.92; 
     AliWarning(Form("Using hard-coded NSD trigger efficiency of %f",epsilonT));
   }
+#endif
   AliInfo("Adding per-ring histograms to output");
-  Double_t scaler = Normalization(*fTriggers, scheme, epsilonT, ntotal);
+  TString text;
+  Double_t scaler = Normalization(*fTriggers, scheme, epsilonT, ntotal, &text);
   TIter next(res->GetHists());
   TH1*  hist = 0;
   while ((hist = static_cast<TH1*>(next()))) hist->Scale(scaler);
   res->SetName("dndetaRings");
   fOutput->Add(res);
+  fOutput->Add(new TNamed("normCalc", text.Data()));
 }
 
 //________________________________________________________________________