Added task to do the analysis on track refs in the central
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 7 Apr 2011 12:23:43 +0000 (12:23 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 7 Apr 2011 12:23:43 +0000 (12:23 +0000)
region.

PWG2/CMakelibPWG2forward2.pkg
PWG2/FORWARD/analysis2/AliCentralCorrSecondaryMap.cxx
PWG2/FORWARD/analysis2/AliCentralMCMultiplicityTask.cxx [new file with mode: 0644]
PWG2/FORWARD/analysis2/AliCentralMCMultiplicityTask.h [new file with mode: 0644]
PWG2/FORWARD/analysis2/AliCentralMultiplicityTask.cxx
PWG2/FORWARD/analysis2/AliCentralMultiplicityTask.h
PWG2/PWG2forward2LinkDef.h

index afc28d6..f97f973 100644 (file)
@@ -53,6 +53,7 @@ set ( SRCS
   FORWARD/analysis2/AliForwarddNdetaTask.cxx
   FORWARD/analysis2/AliForwardUtil.cxx
   FORWARD/analysis2/AliCentralMultiplicityTask.cxx
+  FORWARD/analysis2/AliCentralMCMultiplicityTask.cxx
   FORWARD/analysis2/AliAODCentralMult.cxx
   FORWARD/analysis2/AliCentralCorrSecondaryMap.cxx
   FORWARD/analysis2/AliCentralCorrAcceptance.cxx 
@@ -69,7 +70,9 @@ set ( EINCLUDE  ANALYSIS PWG2/FORWARD/analysis2 STEER)
 
 set ( EXPORT FORWARD/analysis2/AliAODForwardMult.h 
              FORWARD/analysis2/AliAODCentralMult.h 
-             FORWARD/analysis2/AliForwardUtil.h  )
+             FORWARD/analysis2/AliForwardUtil.h  
+            FORWARD/analysis2/AliFMDEventInspector.h
+            FORWARD/analysis2/AliFMDMCEventInspector.h)
 
 set ( DHDR  PWG2forward2LinkDef.h)
 
@@ -116,6 +119,7 @@ install ( FILES FORWARD/analysis2/AddTaskCentraldNdeta.C
                 FORWARD/analysis2/MakeAOD.C
                FORWARD/analysis2/MakedNdeta.C
                 FORWARD/analysis2/MakeELossFits.C
+               FORWARD/analysis2/MakeEvaluateTriggers.C
                 FORWARD/analysis2/OtherData.C
                FORWARD/analysis2/TrainSetup.C
            DESTINATION PWG2/FORWARD/analysis2 )
index 2a26358..484d118 100644 (file)
@@ -223,8 +223,10 @@ AliCentralCorrSecondaryMap::Print(Option_t* option) const
   // Parameters:
   //    option 
   //  
-  std::cout << "SecondaryMap correction" << std::endl;
+  std::cout << "  SecondaryMap correction" << std::endl;
+  std::cout << "   " << std::flush;  
   fArray.Print(option);
+  std::cout << "   " << std::flush;
   fVertexAxis.Print(option);
 }
     
diff --git a/PWG2/FORWARD/analysis2/AliCentralMCMultiplicityTask.cxx b/PWG2/FORWARD/analysis2/AliCentralMCMultiplicityTask.cxx
new file mode 100644 (file)
index 0000000..40fbdae
--- /dev/null
@@ -0,0 +1,261 @@
+//====================================================================
+// 
+// Base class for classes that calculate the multiplicity in the
+// central region event-by-event
+// 
+// Inputs: 
+//   - AliESDEvent 
+//
+// Outputs: 
+//   - AliAODCentralMult 
+// 
+// Histograms 
+//   
+// Corrections used 
+#include "AliCentralMCMultiplicityTask.h"
+#include "AliForwardCorrectionManager.h"
+#include "AliForwardUtil.h"
+#include "AliLog.h"
+#include "AliAODHandler.h"
+#include "AliInputEventHandler.h"
+#include "AliESDInputHandler.h"
+#include "AliAnalysisManager.h"
+#include "AliESDEvent.h"
+#include "AliMultiplicity.h"
+#include "AliFMDEventInspector.h"
+#include <AliMCEvent.h>
+#include <AliTrackReference.h>
+#include <AliStack.h>
+#include <TROOT.h>
+#include <TH1D.h>
+#include <TH2D.h>
+#include <TH3D.h>
+#include <TFile.h>
+#include <TError.h>
+#include <iostream>
+#include <iomanip>
+
+//====================================================================
+AliCentralMCMultiplicityTask::AliCentralMCMultiplicityTask(const char* name) 
+  : AliCentralMultiplicityTask(name),
+    fAODMCCentral(kTRUE),
+    fMinR(3.5), 
+    fMaxR(4.5),
+    fMinZ(-14.1), 
+    fMaxZ(+14.1),
+    fRZ(0), 
+    fXYZ(0),
+    fNRefs(0)
+{
+  // 
+  // Constructor 
+  //   
+}
+//____________________________________________________________________
+AliCentralMCMultiplicityTask::AliCentralMCMultiplicityTask() 
+  : AliCentralMultiplicityTask(),
+    fAODMCCentral(kTRUE),
+    fMinR(3.5), 
+    fMaxR(4.5),
+    fMinZ(-14.1), 
+    fMaxZ(+14.1),
+    fRZ(0), 
+    fXYZ(0),
+    fNRefs(0)
+{
+  // 
+  // Constructor 
+  // 
+}
+//____________________________________________________________________
+AliCentralMCMultiplicityTask::AliCentralMCMultiplicityTask(const AliCentralMCMultiplicityTask& o)
+  : AliCentralMultiplicityTask(o),
+    fAODMCCentral(o.fAODMCCentral),
+    fMinR(o.fMinR), 
+    fMaxR(o.fMaxR),
+    fMinZ(o.fMinZ), 
+    fMaxZ(o.fMaxZ),
+    fRZ(o.fRZ), 
+    fXYZ(o.fXYZ),
+    fNRefs(o.fNRefs)
+{
+  //
+  // Copy constructor 
+  // 
+}
+//____________________________________________________________________
+AliCentralMCMultiplicityTask&
+AliCentralMCMultiplicityTask::operator=(const AliCentralMCMultiplicityTask& o)
+{
+  // 
+  // Assignment operator 
+  //
+  AliCentralMultiplicityTask::operator=(o);
+  fAODMCCentral     = o.fAODMCCentral;
+  fMinR             = o.fMinR;
+  fMaxR             = o.fMaxR;
+  fMinZ             = o.fMinZ;
+  fMaxZ             = o.fMaxZ;
+  fRZ               = o.fRZ;
+  fXYZ              = o.fXYZ;
+  fNRefs            = o.fNRefs;
+  return *this;
+}
+//____________________________________________________________________
+void AliCentralMCMultiplicityTask::UserCreateOutputObjects() 
+{
+  // 
+  // Create output objects 
+  // 
+  //
+  AliCentralMultiplicityTask::UserCreateOutputObjects();
+
+  AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
+  AliAODHandler*      ah = 
+    dynamic_cast<AliAODHandler*>(am->GetOutputEventHandler());
+  if (!ah) AliFatal("No AOD output handler set in analysis manager");
+  
+  
+  TObject* obj = &fAODMCCentral;
+  ah->AddBranch("AliAODCentralMult", &obj);
+
+  fRZ = new TH2D("rz", "(r,z) of used track references", 
+                50, 0, 5, 30, -15, 15);
+  fRZ->SetXTitle("z [cm]");
+  fRZ->SetYTitle("r [cm]");
+  fRZ->SetDirectory(0);
+  fList->Add(fRZ);
+
+  fXYZ = new TH3D("xyz", "(x,y,z) of used track references", 
+                 100, -5., 5., 100, -5., 5., 30, -15., 15.);
+  fXYZ->SetXTitle("x [cm]");
+  fXYZ->SetYTitle("y [cm]");
+  fXYZ->SetZTitle("z [cm]");
+  fXYZ->SetDirectory(0);
+  fList->Add(fXYZ);
+
+  fNRefs = new TH1D("nrefs", "Number of references used per track", 
+                   11, -.5, 10.5); 
+  fNRefs->SetXTitle("# of references per track");
+  fNRefs->SetDirectory(0);
+  fList->Add(fNRefs);
+}
+//____________________________________________________________________
+void AliCentralMCMultiplicityTask::UserExec(Option_t* option) 
+{
+  // 
+  // Process each event 
+  // 
+  // Parameters:
+  //    option Not used
+  //  
+  fAODMCCentral.Clear("");
+  
+  // Call base class 
+  AliCentralMultiplicityTask::UserExec(option);
+
+  // check if we need this event 
+  AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
+  AliAODHandler*      ah = 
+    dynamic_cast<AliAODHandler*>(am->GetOutputEventHandler());
+  if (!ah)  
+    AliFatal("No AOD output handler set in analysis manager");
+
+  // if base class did not want this event, then neither to we 
+  if (!ah->GetFillAOD() || fIvz <= 0) return;
+  
+  AliMCEvent*  mcEvent = MCEvent();
+  TH2D&        hist    = fAODMCCentral.GetHistogram();
+
+  ProcessMC(hist, mcEvent);
+  CorrectData(hist, fIvz);
+
+}
+//____________________________________________________________________
+void AliCentralMCMultiplicityTask::ProcessMC(TH2D& hist, 
+                                            const AliMCEvent* event) const
+{
+  Double_t vz = GetManager().GetSecMap()->GetVertexAxis().GetBinCenter(fIvz);
+
+  AliStack* stack = const_cast<AliMCEvent*>(event)->Stack();
+  Int_t nTracks   = stack->GetNtrack();//event.GetNumberOfTracks();
+  // Int_t nPrim     = stack->GetNprimary();//event.GetNumberOfPrimary();
+  for (Int_t iTr = 0; iTr < nTracks; iTr++) { 
+    AliMCParticle* particle = 
+      static_cast<AliMCParticle*>(event->GetTrack(iTr));
+    
+    // Check the returned particle 
+    if (!particle) continue;
+    
+    // Check if this charged and a primary 
+    Bool_t isCharged = particle->Charge() != 0;
+    if (!isCharged) continue;
+
+    // Pseudo rapidity and azimuthal angle 
+    // Double_t eta = particle->Eta();
+    // Double_t phi = particle->Phi();
+
+    Int_t    nTrRef  = particle->GetNumberOfTrackReferences();
+    Int_t    nRef    = 0;
+    for (Int_t iTrRef = 0; iTrRef < nTrRef; iTrRef++) { 
+      AliTrackReference* ref = particle->GetTrackReference(iTrRef);
+      
+      // Check existence 
+      if (!ref) continue;
+
+      // Check that we hit an FMD element 
+      if (ref->DetectorId() != AliTrackReference::kITS) 
+       continue;
+      
+      // Get radius and z where the track reference was made 
+      Double_t r = ref->R();
+      Double_t x = ref->X();
+      Double_t y = ref->Y();
+      Double_t z = ref->Z();
+      if (r > fMaxR || r < fMinR) continue;
+      if (z > fMaxZ || z < fMinZ) continue;
+
+      fRZ->Fill(z,r);
+      fXYZ->Fill(x, y, z);
+      // Only fill first reference 
+      if (nRef == 0) { 
+       Double_t zr = z-vz;
+       Double_t th = TMath::ATan2(r,zr);
+       if (th < 0) th += 2*TMath::Pi();
+       Double_t et = -TMath::Log(TMath::Tan(th/2));
+       Double_t ph = TMath::ATan2(y,x);
+       if (ph < 0) ph += 2*TMath::Pi();
+       hist.Fill(et,ph);
+      }
+      nRef++;
+    }
+    fNRefs->Fill(nRef);
+  }
+}
+
+//____________________________________________________________________
+void AliCentralMCMultiplicityTask::Terminate(Option_t* option) 
+{
+  // 
+  // End of job
+  // 
+  // Parameters:
+  //    option Not used 
+  //
+  AliCentralMultiplicityTask::Terminate(option);
+}
+//____________________________________________________________________
+void
+AliCentralMCMultiplicityTask::Print(Option_t* option) const
+{
+  // 
+  // Print information 
+  // 
+  // Parameters:
+  //    option Not used
+  //
+  AliCentralMultiplicityTask::Print(option);
+}
+//
+// EOF
+//
diff --git a/PWG2/FORWARD/analysis2/AliCentralMCMultiplicityTask.h b/PWG2/FORWARD/analysis2/AliCentralMCMultiplicityTask.h
new file mode 100644 (file)
index 0000000..fd17c48
--- /dev/null
@@ -0,0 +1,126 @@
+// 
+// Base class for classes that calculate the multiplicity in the
+// SPD clusters event-by-event
+// 
+#ifndef ALICENTRALMCMULTIPLICITYTASK_H
+#define ALICENTRALMCMULTIPLICITYTASK_H
+/**
+ * @file   AliCentralMCMultiplicityTask.h
+ * @author Hans Hjersing Dalsgaard
+ * @date   Wed Mar 23 14:00:03 2011
+ * 
+ * @brief  
+ * 
+ * @ingroup pwg2_forward_aod
+ * 
+ */
+#include "AliCentralMultiplicityTask.h"
+//class AliForwardCorrectionManager;
+class AliESDEvent;
+class AliMCEvent;
+class TH1D;
+class TH2D;
+class TH3D;
+class TList;
+class TTree;
+
+/** 
+ * Class that calculates the multiplicity in the
+ * central region event-by-event
+ * 
+ * @par Inputs: 
+ *   - AliESDEvent 
+ *
+ * @par Outputs: 
+ *   - 2 AliAODCentralMult (one from data and one from MC)
+ * 
+ * @par Histograms 
+ *   
+ * @par Corrections used 
+ * 
+ * @ingroup pwg2_forward_tasks
+ * @ingroup pwg2_forward_aod
+ * 
+ */
+class AliCentralMCMultiplicityTask : public AliCentralMultiplicityTask
+{
+public:
+  /** 
+   * @{ 
+   * @name Interface methods 
+   */
+   /** 
+   * Constructor 
+   * 
+   * @param name Name of task 
+   */
+  AliCentralMCMultiplicityTask(const char* name); 
+  /** 
+   * Constructor 
+   *
+   * Reserved for ROOT's I/O system - do not use
+   */
+  AliCentralMCMultiplicityTask();
+  /** 
+   * Copy constructor 
+   * 
+   * @param o Object to copy from 
+   */
+  AliCentralMCMultiplicityTask(const AliCentralMCMultiplicityTask& o);
+  /** 
+   * Assignment operator 
+   * 
+   * @param o Object to assign from 
+   * 
+   * @return Reference to this object 
+   */
+  AliCentralMCMultiplicityTask& operator=(const AliCentralMCMultiplicityTask& o);
+  /** 
+   * Create output objects 
+   * 
+   */
+  virtual void UserCreateOutputObjects();
+  /** 
+   * Process each event 
+   *
+   * @param option Not used
+   */  
+  virtual void UserExec(Option_t* option);
+  /** 
+   * End of job
+   * 
+   * @param option Not used 
+   */
+  virtual void Terminate(Option_t* option);
+  /** 
+   * Print information 
+   * 
+   * @param option Not used
+   */
+  virtual void Print(Option_t* option="") const;
+
+protected: 
+  /** 
+   * Process the MC event
+   * 
+   * @param hist   Histogram to fill 
+   * @param event  Event structure 
+   */
+  void ProcessMC(TH2D& hist, const AliMCEvent* event) const;
+
+  AliAODCentralMult      fAODMCCentral;     // Output object
+  Double_t               fMinR;             // Min radius 
+  Double_t               fMaxR;             // Max radius 
+  Double_t               fMinZ;             // Min z
+  Double_t               fMaxZ;             // Max z
+  TH2D*                  fRZ;               // Location in (r,z)
+  TH3D*                  fXYZ;              // Location in (x,y,z)
+  TH1D*                  fNRefs;            // Refs per track 
+  ClassDef(AliCentralMCMultiplicityTask,1)  // Forward multiplicity class
+};
+
+#endif
+// Local Variables:
+//  mode: C++
+// End:
+
index 27ed95f..82298c0 100644 (file)
 //   
 // Corrections used 
 #include "AliCentralMultiplicityTask.h"
-#include "AliForwardCorrectionManager.h"
+#include "AliAODForwardMult.h"
 #include "AliForwardUtil.h"
 #include "AliLog.h"
 #include "AliAODHandler.h"
-#include "AliInputEventHandler.h"
-#include "AliESDInputHandler.h"
 #include "AliAnalysisManager.h"
 #include "AliESDEvent.h"
 #include "AliMultiplicity.h"
-#include "AliFMDEventInspector.h"
 #include <TROOT.h>
 #include <TFile.h>
 #include <TError.h>
 //====================================================================
 AliCentralMultiplicityTask::AliCentralMultiplicityTask(const char* name) 
   : AliAnalysisTaskSE(name),
+    fInspector("centralEventInspector"),
     fData(0),
     fList(0),
     fAODCentral(kFALSE),
     fManager(),
     fUseSecondary(true),
     fUseAcceptance(true),
-    fFirstEventSeen(false)
+    fFirstEventSeen(false), 
+    fIvz(0)
 {
   // 
   // Constructor 
@@ -51,13 +50,15 @@ AliCentralMultiplicityTask::AliCentralMultiplicityTask(const char* name)
 //____________________________________________________________________
 AliCentralMultiplicityTask::AliCentralMultiplicityTask() 
   : AliAnalysisTaskSE(),
+    fInspector(),
     fData(0),
     fList(0),
     fAODCentral(),
     fManager(),
     fUseSecondary(true),
     fUseAcceptance(true),
-    fFirstEventSeen(false)
+    fFirstEventSeen(false), 
+    fIvz(0)
 {
   // 
   // Constructor 
@@ -66,13 +67,15 @@ AliCentralMultiplicityTask::AliCentralMultiplicityTask()
 //____________________________________________________________________
 AliCentralMultiplicityTask::AliCentralMultiplicityTask(const AliCentralMultiplicityTask& o)
   : AliAnalysisTaskSE(o),
+    fInspector(o.fInspector),
     fData(o.fData),
     fList(o.fList),
     fAODCentral(o.fAODCentral),
     fManager(o.fManager),
     fUseSecondary(o.fUseSecondary),
     fUseAcceptance(o.fUseAcceptance),
-    fFirstEventSeen(o.fFirstEventSeen)
+    fFirstEventSeen(o.fFirstEventSeen), 
+    fIvz(0)
 {
   //
   // Copy constructor 
@@ -85,6 +88,7 @@ AliCentralMultiplicityTask::operator=(const AliCentralMultiplicityTask& o)
   // 
   // Assignment operator 
   //
+  fInspector      = o.fInspector;
   fData           = o.fData;
   fList           = o.fList;
   fAODCentral     = o.fAODCentral;
@@ -92,6 +96,7 @@ AliCentralMultiplicityTask::operator=(const AliCentralMultiplicityTask& o)
   fUseSecondary   = o.fUseSecondary;
   fUseAcceptance  = o.fUseAcceptance;
   fFirstEventSeen = o.fFirstEventSeen;
+  fIvz            = 0; 
   return *this;
 }
 //____________________________________________________________________
@@ -110,13 +115,68 @@ void AliCentralMultiplicityTask::UserCreateOutputObjects()
   
   TObject* obj = &fAODCentral;
   ah->AddBranch("AliAODCentralMult", &obj);
-  
+
+    
   fList = new TList();
   fList->SetOwner();
-  PostData(1,fList);
+
+  fInspector.DefineOutput(fList);
+
+  PostData(1,fList);  
+}
+
+//____________________________________________________________________
+AliESDEvent*
+AliCentralMultiplicityTask::GetESDEvent()
+{
+  //
+  // Get the ESD event. IF this is the first event, initialise
+  //
+  AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent());
+  if (!esd) {
+    AliWarning("No ESD event found for input event");
+    return 0;
+  }
+
+  if (fFirstEventSeen) return esd;
+  if (GetManager().IsInit()) return esd;
   
+  fInspector.ReadRunDetails(esd);
+  GetManager().Init(fInspector.GetCollisionSystem(),
+                   fInspector.GetEnergy(),
+                   fInspector.GetField());
+  AliCentralCorrSecondaryMap* secMap = GetManager().GetSecMap();
+  if (!secMap) 
+    AliFatal("No secondary map defined!");
+  const TAxis& vaxis = secMap->GetVertexAxis();
+
+  std::cout << "Vertex range is " 
+           << vaxis.GetNbins() << "," 
+           << vaxis.GetXmin() << "," 
+           << vaxis.GetXmax()
+           << std::endl;
+  fInspector.Init(vaxis);
+  AliInfo("Manager of corrections in AliCentralMultiplicityTask init");
+  fFirstEventSeen = kTRUE;
+  Print();
+
+  return esd;
 }
 //____________________________________________________________________
+void
+AliCentralMultiplicityTask::MarkEventForStore() const
+{
+  // Make sure the AOD tree is filled 
+  AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
+  AliAODHandler*      ah = 
+    dynamic_cast<AliAODHandler*>(am->GetOutputEventHandler());
+  if (!ah)  
+    AliFatal("No AOD output handler set in analysis manager");
+
+  ah->SetFillAOD(kTRUE);
+}
+
+//____________________________________________________________________
 void AliCentralMultiplicityTask::UserExec(Option_t* /*option*/) 
 {
   // 
@@ -126,66 +186,62 @@ void AliCentralMultiplicityTask::UserExec(Option_t* /*option*/)
   //    option Not used
   //  
   fAODCentral.Clear("");
+  fIvz = 0;
+
+  AliESDEvent* esd = GetESDEvent();
   
-  AliESDInputHandler* eventHandler = 
-    dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()
-                                      ->GetInputEventHandler());
-  if (!eventHandler) {
-    AliWarning("No inputhandler found for this event!");
-    return;}
-  
-  AliESDEvent* esd = eventHandler->GetEvent();
-  
-  if(!GetManager().IsInit() && !fFirstEventSeen) {
-    AliFMDEventInspector inspector;
-    inspector.ReadRunDetails(esd);
-    GetManager().Init(inspector.GetCollisionSystem(),
-                     inspector.GetEnergy(),
-                     inspector.GetField());
-    
-    AliInfo("Manager of corrections in AliCentralMultiplicityTask init");
-    fFirstEventSeen = kTRUE;
-  }
-    
-  //Selecting only events with |valid vertex| < 10 cm
-  const AliESDVertex* vertex = esd->GetPrimaryVertexSPD();
-  if (!vertex) return;
-  if(!(vertex->GetStatus())) return;
-  if(vertex->GetNContributors() <= 0) return ;
-  if(vertex->GetZRes() > 0.1 ) return;
-  Double_t vertexXYZ[3]={0,0,0};
-  vertex->GetXYZ(vertexXYZ);
-  if(TMath::Abs(vertexXYZ[2]) > 10) return;
-  
-  Double_t delta           = 2 ;
-  Double_t vertexBinDouble = (vertexXYZ[2] + 10) / delta;
-  //HHD: The vtxbins are 1-10, not 0-9
-  Int_t    vtxbin          = Int_t(vertexBinDouble + 1) ; 
+  Bool_t   lowFlux   = kFALSE;
+  UInt_t   triggers  = 0;
+  UShort_t ivz       = 0;
+  Double_t vz        = 0;
+  Double_t cent      = -1;
+  UShort_t nClusters = 0;
+  UInt_t   found     = fInspector.Process(esd, triggers, lowFlux, 
+                                         ivz, vz, cent, nClusters);
+
+  // No event or no trigger 
+  if (found & AliFMDEventInspector::kNoEvent)    return;
+  if (found & AliFMDEventInspector::kNoTriggers) return;
   
   // Make sure AOD is filled
-  AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
-  AliAODHandler*      ah = 
-    dynamic_cast<AliAODHandler*>(am->GetOutputEventHandler());
-  if (!ah)  
-    AliFatal("No AOD output handler set in analysis manager");
-  
-  ah->SetFillAOD(kTRUE);
+  MarkEventForStore();
+
+  if (found == AliFMDEventInspector::kNoSPD)      return;
+  if (found == AliFMDEventInspector::kNoVertex)   return;
+  if (triggers & AliAODForwardMult::kPileUp)      return;
+  if (found == AliFMDEventInspector::kBadVertex)  return; // Out of range
   
   //Doing analysis
-  TH2D *aodHist = &(fAODCentral.GetHistogram());
-  
+  fIvz = ivz;
   const AliMultiplicity* spdmult = esd->GetMultiplicity();
+
+  TH2D& aodHist = fAODCentral.GetHistogram();
+
+  ProcessESD(aodHist, spdmult);
+  CorrectData(aodHist, ivz);
+
+  PostData(1,fList);
+}
+//____________________________________________________________________
+void 
+AliCentralMultiplicityTask::ProcessESD(TH2D& aodHist, 
+                                      const AliMultiplicity* spdmult) const
+{
   //Filling clusters in layer 1 used for tracklets...
   for(Int_t j = 0; j< spdmult->GetNumberOfTracklets();j++)
-    aodHist->Fill(spdmult->GetEta(j),spdmult->GetPhi(j));
+    aodHist.Fill(spdmult->GetEta(j),spdmult->GetPhi(j));
 
   //...and then the unused ones in layer 1 
   for(Int_t j = 0; j< spdmult->GetNumberOfSingleClusters();j++) 
-    aodHist->Fill(-TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)),
-                 spdmult->GetPhiSingle(j));
-  
-  
+    aodHist.Fill(-TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)),
+                spdmult->GetPhiSingle(j));
+}
+
+//____________________________________________________________________
+void 
+AliCentralMultiplicityTask::CorrectData(TH2D& aodHist, UShort_t vtxbin) const
+{  
   // Corrections
   TH1D* hAcceptance = fManager.GetAcceptanceCorrection(vtxbin);
   TH2D* hSecMap     = fManager.GetSecMapCorrection(vtxbin);
@@ -193,23 +249,26 @@ void AliCentralMultiplicityTask::UserExec(Option_t* /*option*/)
   if (!hSecMap)     AliFatal("No secondary map!");
   if (!hAcceptance) AliFatal("No acceptance!");
     
-  if (fUseSecondary && hSecMap) aodHist->Divide(hSecMap);
+  if (fUseSecondary && hSecMap) aodHist.Divide(hSecMap);
   
-  for(Int_t nx = 1; nx <= aodHist->GetNbinsX(); nx++) {
+  for(Int_t nx = 1; nx <= aodHist.GetNbinsX(); nx++) {
     Float_t accCor = hAcceptance->GetBinContent(nx);
     Float_t accErr = hAcceptance->GetBinError(nx);
     
     Bool_t etabinSeen = kFALSE;  
-    for(Int_t ny = 1; ny <= aodHist->GetNbinsY(); ny++) {
+    for(Int_t ny = 1; ny <= aodHist.GetNbinsY(); ny++) {
       // Get currrent value 
-      Float_t aodValue = aodHist->GetBinContent(nx,ny);
-      Float_t aodErr   = aodHist->GetBinError(nx,ny);
+      Float_t aodValue = aodHist.GetBinContent(nx,ny);
+      Float_t aodErr   = aodHist.GetBinError(nx,ny);
 
       // Set underflow bin
       Float_t secCor   = 0;
-      if(hSecMap) secCor   = hSecMap->GetBinContent(nx,ny);
+      if(hSecMap)       secCor     = hSecMap->GetBinContent(nx,ny);
       if (secCor > 0.5) etabinSeen = kTRUE;
-      if (aodValue < 0.000001) { aodHist->SetBinContent(nx,ny, 0); continue; }
+      if (aodValue < 0.000001) { 
+       aodHist.SetBinContent(nx,ny, 0); 
+       continue; 
+      }
 
       if (!fUseAcceptance) continue; 
 
@@ -218,18 +277,17 @@ void AliCentralMultiplicityTask::UserExec(Option_t* /*option*/)
       Float_t aodNew   = aodValue / accCor ;
       Float_t error    = aodNew*TMath::Sqrt(TMath::Power(aodErr/aodValue,2) +
                                            TMath::Power(accErr/accCor,2) );
-      aodHist->SetBinContent(nx,ny, aodNew);
+      aodHist.SetBinContent(nx,ny, aodNew);
       //test
-      aodHist->SetBinError(nx,ny,error);
-      aodHist->SetBinError(nx,ny,aodErr);
+      aodHist.SetBinError(nx,ny,error);
+      aodHist.SetBinError(nx,ny,aodErr);
       
     }
     //Filling underflow bin if we eta bin is in range
-    if(etabinSeen) aodHist->SetBinContent(nx,0, 1.);
+    if(etabinSeen) aodHist.SetBinContent(nx,0, 1.);
   }  
-
-  PostData(1,fList);
 }
+
 //____________________________________________________________________
 void AliCentralMultiplicityTask::Terminate(Option_t* /*option*/) 
 {
@@ -242,7 +300,7 @@ void AliCentralMultiplicityTask::Terminate(Option_t* /*option*/)
 }
 //____________________________________________________________________
 void
-AliCentralMultiplicityTask::Print(Option_t* /*option*/) const
+AliCentralMultiplicityTask::Print(Option_t* option) const
 {
   // 
   // Print information 
@@ -250,6 +308,20 @@ AliCentralMultiplicityTask::Print(Option_t* /*option*/) const
   // Parameters:
   //    option Not used
   //
+  std::cout << ClassName() << ": " << GetName() << "\n" 
+           << std::boolalpha
+           << "  Use secondary correction:  " << fUseSecondary << '\n'
+           << "  Use acceptance correction: " << fUseAcceptance << '\n' 
+           << "  Off-line trigger mask:  0x" 
+           << std::hex     << std::setfill('0') 
+           << std::setw (8) << fOfflineTriggerMask 
+           << std::dec     << std::setfill (' ') 
+           << std::noboolalpha << std::endl;
+  gROOT->IncreaseDirLevel();
+  fManager.Print(option);
+  fInspector.Print(option);
+  gROOT->DecreaseDirLevel();
+  
 }
 //====================================================================
 AliCentralMultiplicityTask::Manager::Manager() :
@@ -433,11 +505,29 @@ AliCentralMultiplicityTask::Manager::Init(UShort_t  sys,
   if(fSecmap && fAcceptance) {
     fIsInit = kTRUE;
     ::Info("Init", 
-          "Central Manager initialised for sys %d, energy %d, field %d",sys,sNN,field);
+          "Central Manager initialised for %s, energy %dGeV, field %dkG",
+          sys == 1 ? "pp" : sys == 2 ? "PbPb" : "unknown", sNN,field);
+  }  
+}
 
-  }
-  
+//____________________________________________________________________
+void 
+AliCentralMultiplicityTask::Manager::Print(Option_t* option) const
+{
+  std::cout << " AliCentralMultiplicityTask::Manager\n" 
+           << std::boolalpha 
+           << "  Initialized:     " << fIsInit << '\n'
+           << "  Acceptance path: " << fAcceptancePath << '\n'
+           << "  Acceptance name: " << fAcceptanceName << '\n'
+           << "  Acceptance:      " << fAcceptance << '\n'
+           << "  Secondary path:  " << fSecMapPath << '\n'
+           << "  Secondary name:  " << fSecMapName << '\n'
+           << "  Secondary map:   " << fSecmap 
+           << std::noboolalpha << std::endl;
+  if (fAcceptance) fAcceptance->Print(option);
+  if (fSecmap)     fSecmap->Print(option);
 }
+
 //
 // EOF
 //
index e140b71..339e722 100644 (file)
  * 
  */
 #include <AliAnalysisTaskSE.h>
-#include "AliForwardUtil.h"
+#include "AliFMDEventInspector.h"
 #include "AliAODCentralMult.h"
 #include "AliCentralCorrAcceptance.h"
 #include "AliCentralCorrSecondaryMap.h"
 //class AliForwardCorrectionManager;
 class AliESDEvent;
+class AliMultiplicity;
 class TH2D;
 class TList;
 class TTree;
@@ -112,6 +113,9 @@ public:
    */
   virtual void SetUseAcceptance(Bool_t use) { fUseAcceptance = use; }
 
+  AliFMDEventInspector& GetInspector() { return fInspector; }
+  const AliFMDEventInspector& GetInspector() const { return fInspector; }
+
   //__________________________________________________________________
   /**
    * Manager of corrections 
@@ -228,6 +232,12 @@ public:
      * @return 
      */
     TH1D* GetAcceptanceCorrection(UShort_t vtxbin) const;
+    /** 
+     * Get the secondary correction map object 
+     */
+    AliCentralCorrSecondaryMap* GetSecMap() const { return fSecmap; }
+
+    void Print(Option_t* option="") const;
   private:
     /** 
      * Get the full path name 
@@ -241,7 +251,7 @@ public:
      */
     const char* GetFileName(UShort_t what, UShort_t sys, UShort_t sNN,
                            Short_t field) const;
-    
+
     
     TString                     fAcceptancePath; // Path to acceptance 
     TString                     fSecMapPath;     // Path to secondary map
@@ -253,7 +263,32 @@ public:
 
     ClassDef(Manager,1); // Manager of data 
   };
-
+  /** 
+   * Get the ESD event and initialise manager on first event if not
+   * done already
+   * 
+   * @return Pointer to valid ESD event object 
+   */
+  virtual AliESDEvent* GetESDEvent();
+  /** 
+   * Mark this event for storage in AOD output
+   * 
+   */
+  virtual void MarkEventForStore() const;
+  /** 
+   * Process the ESD SPD information 
+   * 
+   * @param hist    Histogram to fill
+   * @param spdmult SPD multiplicity object
+   */
+  virtual void ProcessESD(TH2D& hist, const AliMultiplicity* spdmult) const;
+  /** 
+   * Corret the data 
+   * 
+   * @param hist    Histogram to correct
+   * @param vtxbin  Vertex bin 
+   */
+  virtual void CorrectData(TH2D& hist, UShort_t vtxbin) const;
   /** 
    * Get a reference to the manager 
    * 
@@ -269,15 +304,16 @@ public:
 
 
 protected: 
-  
-  TH2D*                  fData;           //sum histogram if needed
-  TList*                 fList;           //Output List for diagnostics
+  AliFMDEventInspector   fInspector;      // Inspect events 
+  TH2D*                  fData;           // sum histogram if needed
+  TList*                 fList;           // Output List for diagnostics
   AliAODCentralMult      fAODCentral;     // Output object
-  Manager                fManager;        //Manager object for corrections
+  Manager                fManager;        // Manager object for corrections
   Bool_t                 fUseSecondary;   // Whether to secondary map
   Bool_t                 fUseAcceptance;  // Whether to use acceptance corr.
   Bool_t                 fFirstEventSeen; // Have we seen first event     
-  ClassDef(AliCentralMultiplicityTask,1)  // Forward multiplicity class
+  Int_t                  fIvz;            // Event's vertex bin 
+  ClassDef(AliCentralMultiplicityTask,2)  // Forward multiplicity class
 };
 
 #endif
index c3f38fe..4d693c7 100644 (file)
@@ -70,6 +70,7 @@
 
 #pragma link C++ class AliCentralMultiplicityTask+;
 #pragma link C++ class AliCentralMultiplicityTask::Manager+;
+#pragma link C++ class AliCentralMCMultiplicityTask+;
 #pragma link C++ class AliAODCentralMult+;
 #pragma link C++ class AliCentralCorrSecondaryMap+;
 #pragma link C++ class AliCentralCorrAcceptance+;