Adding a placeholder class for the backward-forward correlation analysis of the FMD
authorhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 11 Mar 2010 15:04:30 +0000 (15:04 +0000)
committerhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 11 Mar 2010 15:04:30 +0000 (15:04 +0000)
PWG2/FORWARD/analysis/AliFMDAnalysisTaskBFCorrelation.cxx [new file with mode: 0644]
PWG2/FORWARD/analysis/AliFMDAnalysisTaskBFCorrelation.h [new file with mode: 0644]
PWG2/FORWARD/analysis/AliFMDAnalysisTaskSE.cxx
PWG2/FORWARD/analysis/AliFMDAnalysisTaskSE.h
PWG2/PWG2forwardLinkDef.h
PWG2/libPWG2forward.pkg

diff --git a/PWG2/FORWARD/analysis/AliFMDAnalysisTaskBFCorrelation.cxx b/PWG2/FORWARD/analysis/AliFMDAnalysisTaskBFCorrelation.cxx
new file mode 100644 (file)
index 0000000..8acecf3
--- /dev/null
@@ -0,0 +1,168 @@
+#include <TROOT.h>
+#include <TSystem.h>
+#include <TInterpreter.h>
+#include <TChain.h>
+#include <TFile.h>
+#include <TList.h>
+#include <iostream>
+#include "TH1F.h"
+#include "TH2F.h"
+#include "AliFMDAnalysisTaskBFCorrelation.h"
+#include "AliAnalysisManager.h"
+#include "AliESDFMD.h"
+#include "AliESDEvent.h"
+#include "AliAODEvent.h"
+#include "AliAODHandler.h"
+#include "AliMCEventHandler.h"
+#include "AliStack.h"
+#include "AliLog.h"
+#include "AliESDVertex.h"
+#include "TMath.h"
+#include "AliFMDAnaParameters.h"
+//#include "AliFMDGeometry.h"
+#include "AliGenEventHeader.h"
+#include "AliGenPythiaEventHeader.h"
+#include "AliHeader.h"
+//#include "TDatabasePDG.h"
+//#include "TParticlePDG.h"
+#include "AliESDInputHandler.h"
+ClassImp(AliFMDAnalysisTaskBFCorrelation)
+
+
+AliFMDAnalysisTaskBFCorrelation::AliFMDAnalysisTaskBFCorrelation()
+: fDebug(0),
+  fOutputList(0),
+  fInputList(0),
+  fVertexString(0x0),
+  fStandalone(kTRUE)
+{
+  // Default constructor
+  DefineInput (0, TList::Class());
+  DefineOutput(0, TList::Class());
+}
+//_____________________________________________________________________
+AliFMDAnalysisTaskBFCorrelation::AliFMDAnalysisTaskBFCorrelation(const char* name, Bool_t SE):
+  AliAnalysisTask(name,name),
+    fDebug(0),
+    fOutputList(0),
+    fInputList(0),
+    fVertexString(0x0),
+    fStandalone(kTRUE)
+{
+  fStandalone = SE;
+  if(fStandalone) {
+    DefineInput (0, TList::Class());
+    DefineInput(1, TObjString::Class());
+    DefineOutput(0, TList::Class());
+    
+  }
+}
+//_____________________________________________________________________
+void AliFMDAnalysisTaskBFCorrelation::CreateOutputObjects()
+{
+  AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
+  
+  if(!fOutputList) {
+    fOutputList = new TList();
+    fOutputList->SetName("BackgroundCorrected");
+  }
+  
+  TH1F* test = new TH1F("test","test",10,0,10);
+  fOutputList->Add(test);
+}
+//_____________________________________________________________________
+void AliFMDAnalysisTaskBFCorrelation::ConnectInputData(Option_t */*option*/)
+{
+  if(fStandalone) {
+    fInputList   = (TList*)GetInputData(0);
+    fVertexString = (TObjString*)GetInputData(1);
+  }
+}
+//_____________________________________________________________________
+void AliFMDAnalysisTaskBFCorrelation::Exec(Option_t */*option*/)
+{
+  AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
+  
+  fVertexString = (TObjString*)fInputList->At(0);
+  
+  Int_t vtxbin   = fVertexString->GetString().Atoi();
+  //for(UShort_t det=1;det<=3;det++) {
+  //  Int_t nRings = (det==1 ? 1 : 2);
+  //  for (UShort_t ir = 0; ir < nRings; ir++) {
+  //    Char_t ringChar = (ir == 0 ? 'I' : 'O');
+  //TH2F* hMultTotal = (TH2F*)fOutputList->FindObject(Form("dNdeta_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
+  // TH2F* hMultTotalTrVtx = (TH2F*)fOutputList->FindObject(Form("dNdetaTrVtx_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
+  
+  
+  TH1F* test = (TH1F*)fOutputList->FindObject("test");
+  test->Fill(vtxbin);
+  if(pars->GetProcessPrimary())
+    ProcessPrimary();
+  
+  if(fStandalone) {
+    PostData(0, fOutputList); 
+  }
+  
+}
+//_____________________________________________________________________
+void AliFMDAnalysisTaskBFCorrelation::Terminate(Option_t */*option*/) {
+  
+  
+}
+//_____________________________________________________________________
+void AliFMDAnalysisTaskBFCorrelation::ProcessPrimary() {
+  /*
+  AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+  AliMCEvent* mcEvent = eventHandler->MCEvent();
+  if(!mcEvent)
+    return;
+  
+    
+  AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
+  
+  AliMCParticle* particle = 0;
+  AliStack* stack = mcEvent->Stack();
+  
+  TH1F* hPrimary = (TH1F*)fOutputList->FindObject("hMultvsEta");
+  AliHeader* header            = mcEvent->Header();
+  AliGenEventHeader* genHeader = header->GenEventHeader();
+  
+  TArrayF vertex;
+  genHeader->PrimaryVertex(vertex);
+  if(TMath::Abs(vertex.At(2)) > pars->GetVtxCutZ())
+    return;
+  Double_t delta           = 2*pars->GetVtxCutZ()/pars->GetNvtxBins();
+  Double_t vertexBinDouble = (vertex.At(2) + pars->GetVtxCutZ()) / delta;
+  Int_t    vertexBin       = (Int_t)vertexBinDouble;
+    
+  Bool_t firstTrack = kTRUE;
+  
+  // we loop over the primaries only unless we need the hits (diagnostics running slowly)
+  Int_t nTracks = stack->GetNprimary();
+  if(pars->GetProcessHits())
+    nTracks = stack->GetNtrack();
+  
+  for(Int_t i = 0 ;i<nTracks;i++) {
+    particle = (AliMCParticle*) mcEvent->GetTrack(i);
+    if(!particle)
+      continue;
+   
+    if(stack->IsPhysicalPrimary(i) && particle->Charge() != 0) {
+      hPrimary->Fill(particle->Eta());
+      
+
+      TH1F* hPrimVtxBin = (TH1F*)fOutputList->FindObject(Form("primmult_vtxbin%d",vertexBin));
+      hPrimVtxBin->Fill(particle->Eta());
+      if(firstTrack) {
+       fNMCevents.Fill(vertexBin);
+       firstTrack = kFALSE;
+      }
+    }
+  }
+  */
+}
+//_____________________________________________________________________
+//
+//
+// EOF
diff --git a/PWG2/FORWARD/analysis/AliFMDAnalysisTaskBFCorrelation.h b/PWG2/FORWARD/analysis/AliFMDAnalysisTaskBFCorrelation.h
new file mode 100644 (file)
index 0000000..e429d9e
--- /dev/null
@@ -0,0 +1,62 @@
+#ifndef ALIFMDANALYSISTASKBFCORRELATION_H
+#define ALIFMDANALYSISTASKBFCORRELATION_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+#include "AliAnalysisTask.h"
+
+#include "TObjArray.h"
+#include "TObjString.h"
+#include "TArrayI.h"
+#include "TH1I.h"
+#include "AliMCEvent.h"
+#include "AliFMDFloatMap.h"
+
+/**
+ * @ingroup FMD_ana
+ */
+class AliFMDAnalysisTaskBFCorrelation : public AliAnalysisTask
+{
+ public:
+    AliFMDAnalysisTaskBFCorrelation();
+    AliFMDAnalysisTaskBFCorrelation(const char* name, Bool_t SE = kTRUE);
+    virtual ~AliFMDAnalysisTaskBFCorrelation() {;}
+  AliFMDAnalysisTaskBFCorrelation(const AliFMDAnalysisTaskBFCorrelation& o) : AliAnalysisTask(),
+                                                                             fDebug(o.fDebug),
+                                                                             fOutputList(0),
+                                                                             fInputList(0),
+                                                                             fVertexString(o.fVertexString),
+                                                                             fStandalone(o.fStandalone)
+  {}
+  
+  AliFMDAnalysisTaskBFCorrelation& operator=(const AliFMDAnalysisTaskBFCorrelation&) { return *this; }
+  // Implementation of interface methods
+  virtual void ConnectInputData(Option_t *option = "");
+  virtual void CreateOutputObjects();
+  virtual void Init() {}
+  virtual void LocalInit() {Init();}
+  virtual void Exec(Option_t *option);
+  virtual void Terminate(Option_t *option);
+  virtual void SetDebugLevel(Int_t level) {fDebug = level;}
+  void SetInputList(TList* inputList) {fInputList = inputList;}
+  void SetInputVertex(TObjString* vtxString) {fVertexString = vtxString;}
+  void SetOutputList(TList* outputList) {fOutputList = outputList;}
+  
+  void ProcessPrimary();
+  
+  TList* GetOutputList() {return fOutputList;}
+   
+ private:
+  Int_t         fDebug;        //  Debug flag
+  TList*        fOutputList;
+  TList*        fInputList;
+  TObjString*   fVertexString;
+  Bool_t        fStandalone;
+  ClassDef(AliFMDAnalysisTaskBFCorrelation, 0); // Analysis task for FMD analysis
+};
+#endif
+// Local Variables:
+//   mode: C++ 
+// End:
index dae6cc0..707ddd4 100644 (file)
@@ -17,6 +17,7 @@ AliAnalysisTaskSE(),
   fDensity("Density",kFALSE),
   fBackground("BackgroundCorrected",kFALSE),
   fDndeta("dNdeta",kFALSE), 
+  fBFCorrelation("BFCorrelation",kFALSE), 
   fParams(0)
 {
   // Default constructor
@@ -29,6 +30,7 @@ AliFMDAnalysisTaskSE::AliFMDAnalysisTaskSE(const char* name):
   fDensity("Density",kFALSE),
   fBackground("BackgroundCorrected",kFALSE),
   fDndeta("dNdeta",kFALSE), 
+  fBFCorrelation("BFCorrelation",kFALSE), 
   fParams(0)
 {
   SetParams(AliFMDAnaParameters::Instance());
@@ -63,12 +65,14 @@ void AliFMDAnalysisTaskSE::UserCreateOutputObjects()
 
   fDndeta.SetInputList(bgcorlist); 
   fDndeta.SetOutputList(fListOfHistos); 
+  fBFCorrelation.SetInputList(bgcorlist); 
+  fBFCorrelation.SetOutputList(fListOfHistos); 
   
   fSharing.CreateOutputObjects();
   fDensity.CreateOutputObjects();
   fBackground.CreateOutputObjects();
   fDndeta.CreateOutputObjects();
-  
+  fBFCorrelation.CreateOutputObjects();
   
   
 }
@@ -87,7 +91,7 @@ void AliFMDAnalysisTaskSE::UserExec(Option_t */*option*/)
   
   
   AliESDEvent* fESD = (AliESDEvent*)InputEvent();
-  
+  //std::cout<<fESD->GetBeamEnergy()<<"   "<<fESD->GetBeamType()<<"    "<<fESD->GetCurrentL3()<<std::endl;
   fSharing.SetInputESD(fESD);
   
   fSharing.Exec("");
@@ -96,7 +100,7 @@ void AliFMDAnalysisTaskSE::UserExec(Option_t */*option*/)
     if(fDensity.GetEventStatus()) {
       fBackground.Exec("");  
       fDndeta.Exec("");
-      
+      fBFCorrelation.Exec("");
     }
     else return;
   }
@@ -118,10 +122,11 @@ void AliFMDAnalysisTaskSE::Terminate(Option_t */*option*/)
   fSharing.SetOutputList(outputList);
   fBackground.SetHitList(outputList);
   fDndeta.SetOutputList(outputList); 
+  fBFCorrelation.SetOutputList(outputList); 
   fSharing.Terminate("");
   fBackground.Terminate("");
   fDndeta.Terminate("");
-  
+  fBFCorrelation.Terminate("");
   
   // TFile file("fmd_ana_histos_tmp.root","RECREATE");
   //  fListOfHistos->Write();
@@ -139,7 +144,8 @@ void AliFMDAnalysisTaskSE::Print(Option_t* option) const
     fSharing.Print(option);     
     fDensity.Print(option);     
     fBackground.Print(option);  
-    fDndeta.Print(option);      
+    fDndeta.Print(option); 
+    fBFCorrelation.Print(option); 
   }
   if (opt.Contains("p") && fParams) 
     fParams->Print(option);      
index a2d5030..990950e 100644 (file)
@@ -6,6 +6,7 @@
 #include "AliFMDAnalysisTaskDensity.h"
 #include "AliFMDAnalysisTaskBackgroundCorrection.h"
 #include "AliFMDAnalysisTaskDndeta.h"
+#include "AliFMDAnalysisTaskBFCorrelation.h"
 class AliFMDAnaParameters;
 
 /** @defgroup FMD_ana Analysis tasks 
@@ -24,6 +25,7 @@ class AliFMDAnaParameters;
  * - AliFMDAnalysisTaskDensity
  * - AliFMDAnalysisTaskBackgroundCorrection
  * - AliFMDAnalysisTaskDndeta
+ * - AliFMDAnalysisTaskBFCorrelation
  */
 
 class AliFMDAnalysisTaskSE : public AliAnalysisTaskSE
@@ -39,6 +41,7 @@ public:                               //
       fDensity(o.fDensity),
       fBackground(o.fBackground),
       fDndeta(o.fDndeta),   
+      fBFCorrelation(o.fBFCorrelation), 
       fParams(o.fParams)
   {}
   AliFMDAnalysisTaskSE& operator=(const AliFMDAnalysisTaskSE&) { return *this; }
@@ -51,12 +54,13 @@ public:                             //
   void         Print(Option_t* option="") const;
 private:
   
-  TList*                                 fListOfHistos; // Output list
-  AliFMDAnalysisTaskSharing              fSharing;      // Sharing task
-  AliFMDAnalysisTaskDensity              fDensity;      // Density task
-  AliFMDAnalysisTaskBackgroundCorrection fBackground;   // Background task
-  AliFMDAnalysisTaskDndeta               fDndeta;       // dN/deta task
-  AliFMDAnaParameters*                   fParams;       // Analysis parameters
+  TList*                                 fListOfHistos;  // Output list
+  AliFMDAnalysisTaskSharing              fSharing;       // Sharing task
+  AliFMDAnalysisTaskDensity              fDensity;       // Density task
+  AliFMDAnalysisTaskBackgroundCorrection fBackground;    // Background task
+  AliFMDAnalysisTaskDndeta               fDndeta;        // dN/deta task
+  AliFMDAnalysisTaskBFCorrelation        fBFCorrelation; // BF correlation task
+  AliFMDAnaParameters*                   fParams;        // Analysis parameters
 
   
   ClassDef(AliFMDAnalysisTaskSE, 1);
index 4befe5c..2b4a72a 100644 (file)
@@ -41,7 +41,7 @@
 #pragma link C++ class AliFMDAnalysisTaskCollector+;
 #pragma link C++ class AliFMDAnalysisTaskGenerateCorrection+;
 #pragma link C++ class AliFMDDndeta+;
-
+#pragma link C++ class AliFMDAnalysisTaskBFCorrelation+;
 
 #else
 # error Not for compilation 
index faf9dfe..7eb80b7 100644 (file)
@@ -14,7 +14,8 @@ SRCS          =  FORWARD/analysis/AliFMDAnaParameters.cxx     \
                   FORWARD/analysis/AliFMDAnalysisTaskDndeta.cxx         \
                   FORWARD/analysis/AliFMDAnalysisTaskSE.cxx       \
                   FORWARD/analysis/AliFMDAnalysisTaskGenerateCorrection.cxx \
-                  FORWARD/analysis/AliFMDDndeta.cxx
+                  FORWARD/analysis/AliFMDDndeta.cxx           \
+                   FORWARD/analysis/AliFMDAnalysisTaskBFCorrelation.cxx
 
 
 HDRS           =  $(SRCS:.cxx=.h)