+++ /dev/null
-# -*- mode: CMake -*-
-#--------------------------------------------------------------------------------#
-# Package File for PWGLFforward #
-# Author : Johny Jose (johny.jose@cern.ch) #
-# Variables Defined : #
-# #
-# SRCS - C++ source files #
-# HDRS - C++ header files #
-# DHDR - ROOT Dictionary Linkdef header file #
-# CSRCS - C source files #
-# CHDRS - C header files #
-# EINCLUDE - Include directories #
-# EDEFINE - Compiler definitions #
-# ELIBS - Extra libraries to link #
-# ELIBSDIR - Extra library directories #
-# PACKFFLAGS - Fortran compiler flags for package #
-# PACKCXXFLAGS - C++ compiler flags for package #
-# PACKCFLAGS - C compiler flags for package #
-# PACKSOFLAGS - Shared library linking flags #
-# PACKLDFLAGS - Module linker flags #
-# PACKBLIBS - Libraries to link (Executables only) #
-# EXPORT - Header files to be exported #
-# CINTHDRS - Dictionary header files #
-# CINTAUTOLINK - Set automatic dictionary generation #
-# ARLIBS - Archive Libraries and objects for linking (Executables only) #
-# SHLIBS - Shared Libraries and objects for linking (Executables only) #
-#--------------------------------------------------------------------------------#
-
-set ( SRCS
- FORWARD/analysis/AliFMDAnaParameters.cxx
- FORWARD/analysis/AliFMDAnaCalibEnergyDistribution.cxx
- FORWARD/analysis/AliFMDAnaCalibBackgroundCorrection.cxx
- FORWARD/analysis/AliFMDAnaCalibEventSelectionEfficiency.cxx
- FORWARD/analysis/AliFMDAnaCalibSharingEfficiency.cxx
- FORWARD/analysis/AliFMDAnalysisTaskESDReader.cxx
- FORWARD/analysis/AliFMDAnalysisTaskSharing.cxx
- FORWARD/analysis/AliFMDAnalysisTaskDensity.cxx
- FORWARD/analysis/AliFMDAnalysisTaskBackgroundCorrection.cxx
- FORWARD/analysis/AliFMDAnalysisTaskCollector.cxx
- FORWARD/analysis/AliFMDAnalysisTaskDndeta.cxx
- FORWARD/analysis/AliFMDAnalysisTaskSE.cxx
- FORWARD/analysis/AliFMDAnalysisTaskGenerateCorrection.cxx
- FORWARD/analysis/AliFMDDndeta.cxx
- FORWARD/analysis/AliFMDAnalysisTaskBFCorrelation.cxx
- )
-
-string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
-
-set ( EINCLUDE ANALYSIS FMD STEER/ESD STEER/STEERBase)
-
-set ( DHDR PWGLFforwardLinkDef.h)
# -*- mode: CMake -*-
#------------------------------------------------------------------------#
-# Package File for PWGLFforward2 #
+# Package File for PWGLFforward2 #
# Author : Christian Holm Christensen (cholm@nbi.dk) #
# Variables Defined : #
# #
FORWARD/analysis2/AliFMDMCSharingFilter.cxx
FORWARD/analysis2/AliFMDMCTrackDensity.cxx
# Forward tasks
+ FORWARD/analysis2/AliBaseESDTask.cxx
+ FORWARD/analysis2/AliBaseAODTask.cxx
+ FORWARD/analysis2/AliBaseMCCorrectionsTask.cxx
FORWARD/analysis2/AliFMDEnergyFitterTask.cxx
FORWARD/analysis2/AliFMDEventPlaneTask.cxx
FORWARD/analysis2/AliForwarddNdetaTask.cxx
add_custom_command( OUTPUT FORWARD/doc/html/index.html
COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/FORWARD/doc
- COMMAND sed -e 's,../analysis2,${CMAKE_CURRENT_SOURCE_DIR}/FORWARD/analysis2,' -e 's,OUTPUT_DIRECTORY *=.*,OUTPUT_DIRECTORY = FORWARD/doc/,' < ${CMAKE_CURRENT_SOURCE_DIR}/FORWARD/doc/Doxyfile > ${CMAKE_CURRENT_BINARY_DIR}/FORWARD/doc/Doxyfile
+ COMMAND sed -e 's,\\.\\./,${CMAKE_CURRENT_SOURCE_DIR}/FORWARD/,' -e 's,OUTPUT_DIRECTORY *=.*,OUTPUT_DIRECTORY = FORWARD/doc/,' < ${CMAKE_CURRENT_SOURCE_DIR}/FORWARD/doc/Doxyfile > ${CMAKE_CURRENT_BINARY_DIR}/FORWARD/doc/Doxyfile
COMMAND doxygen ${CMAKE_CURRENT_BINARY_DIR}/FORWARD/doc/Doxyfile
DEPENDS ${SRCS} ${HDRS})
DESTINATION PWGLF/FORWARD/analysis2 )
# Install corrections
-install ( DIRECTORY FORWARD/corrections/DoubleHit
- FORWARD/corrections/ELossFits
- FORWARD/corrections/Empirical
- FORWARD/corrections/MergingEfficiency
- FORWARD/corrections/SecondaryMap
- FORWARD/corrections/VertexBias
- FORWARD/corrections/Acceptance
+install ( DIRECTORY FORWARD/corrections/Empirical
FORWARD/corrections/Normalization
- FORWARD/corrections/CentralAcceptance
- FORWARD/corrections/CentralSecMap
DESTINATION PWGLF/FORWARD/corrections
PATTERN "*~" EXCLUDE
PATTERN ".svn" EXCLUDE)
+++ /dev/null
-// This is the macro to include the FMD analysis in the train. It
-// depends on two libraries: libFMDanalysis.so in AliRoot and
-// libPhysics.so in ROOT. It has been tested to work with the example
-// scripts in the ANALYSIS webpages.
-//
-// Author: Hans Hjersing Dalsgaard <hans.dalsgaard@cern.ch>
-
-
-AliAnalysisTask* AddTaskCorrection(Float_t blow =0,
- Float_t bhigh =100,
- Float_t cmsGeV=900.F,
- const char* col="p-p",
- Float_t bkG=5.F)
-{
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
- if (!mgr) {
- Error("AddTaskESDFilter", "No analysis manager to connect to.");
- return NULL;
- }
-
-
- // --- Generate parameter manager ----------------------------------
- /* AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- pars->SetEnergy(cmsGeV);
- pars->SetCollisionSystem(col);
- pars->SetMagField(bkG);
- pars->SetProcessPrimary(kFALSE);
- pars->SetProcessHits(kFALSE);
- pars->SetRealData(kTRUE);
- */
- // --- Check if we have an MC handler ------------------------------
- //AliMCEventHandler* eventHandler =
- // dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()
- // ->GetMCtruthEventHandler());
- //if(eventHandler) {
- // pars->SetRealData(kFALSE);
- // pars->SetProcessPrimary(kTRUE);
- // pars->SetProcessHits(kFALSE);
- // }
- //pars->Init();
- //pars->PrintStatus();
- const Char_t* outFile = AliAnalysisManager::GetCommonFileName();
- // --- Make the task -----------------------------------------------
- AliFMDAnalysisTaskGenerateCorrection *taskfmd = new AliFMDAnalysisTaskGenerateCorrection("TaskFMD");
- taskfmd->SetBLow(blow);
- taskfmd->SetBHigh(bhigh);
- mgr->AddTask(taskfmd);
-
- // --- Connect input/output ----------------------------------------
- AliAnalysisDataContainer *cout_fmd1 = mgr->CreateContainer("Hits",
- TList::Class(),
- AliAnalysisManager::kOutputContainer, outFile);
- AliAnalysisDataContainer *cout_fmd2 = mgr->CreateContainer("Primaries",
- TList::Class(),
- AliAnalysisManager::kOutputContainer, outFile);
-
- AliAnalysisDataContainer *cout_fmd3 = mgr->CreateContainer("vertex",
- TH1F::Class(),
- AliAnalysisManager::kOutputContainer, outFile);
- AliAnalysisDataContainer *cout_fmd4 = mgr->CreateContainer("Correction",
- TList::Class(),
- AliAnalysisManager::kOutputContainer, outFile);
-
-
- // Dummy AOD output container for jet analysis (no client yet)
- //AliAnalysisDataContainer *c_aodfmd = mgr->CreateContainer("cAODfmd",
- // TTree::Class(),
- // AliAnalysisManager::kExchangeContainer);
- // Connect to data containers
- // mgr->ConnectInput (taskfmd, 0, cin_esd );
- // mgr->ConnectOutput (fmdana, 0, c_aodfmd );
- mgr->ConnectOutput (taskfmd, 1, cout_fmd1 );
- mgr->ConnectOutput (taskfmd, 2, cout_fmd2 );
- mgr->ConnectOutput (taskfmd, 3, cout_fmd3 );
- mgr->ConnectOutput (taskfmd, 4, cout_fmd4 );
-
-
- TString outputfile = Form("%s:%s",
- AliAnalysisManager::GetCommonFileName(),
- "Background");
-
- // AliAnalysisDataContainer *cout_fmd =
- // mgr->CreateContainer("BackgroundCorrected", TList::Class(),
- // AliAnalysisManager::kOutputContainer,outputfile);
- mgr->ConnectInput(taskfmd, 0, mgr->GetCommonInputContainer());
- //mgr->ConnectOutput(taskfmd, 1, cout_fmd);
-
- return taskfmd;
-}
-//
-// EOF
-//
-
+++ /dev/null
-// This is the macro to include the FMD analysis in the train. It
-// depends on two libraries: libFMDanalysis.so in AliRoot and
-// libPhysics.so in ROOT. It has been tested to work with the example
-// scripts in the ANALYSIS webpages.
-//
-// Author: Hans Hjersing Dalsgaard <hans.dalsgaard@cern.ch>
-
-
-AliFMDAnalysisTaskSE* AddTaskFMD(Float_t cmsGeV=900.F,
- const char* col="p-p",
- Float_t bkG=5.F)
-{
- AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
- if (!mgr) {
- Error("AddTaskESDFilter", "No analysis manager to connect to.");
- return NULL;
- }
-
-
- // --- Generate parameter manager ----------------------------------
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- pars->SetEnergy(cmsGeV);
- pars->SetCollisionSystem(col);
- pars->SetMagField(bkG);
- pars->SetProcessPrimary(kFALSE);
- pars->SetProcessHits(kFALSE);
- pars->SetRealData(kTRUE);
-
- // --- Check if we have an MC handler ------------------------------
- AliMCEventHandler* eventHandler =
- dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()
- ->GetMCtruthEventHandler());
- if(eventHandler) {
- pars->SetRealData(kFALSE);
- pars->SetProcessPrimary(kTRUE);
- pars->SetProcessHits(kFALSE);
- }
- pars->Init();
- pars->PrintStatus();
-
- // --- Make the task -----------------------------------------------
- AliFMDAnalysisTaskSE *taskfmd = new AliFMDAnalysisTaskSE("TaskFMD");
- mgr->AddTask(taskfmd);
-
- // --- Connect input/output ----------------------------------------
- TString outputfile = Form("%s:%s",
- AliAnalysisManager::GetCommonFileName(),
- pars->GetDndetaAnalysisName());
-
- AliAnalysisDataContainer *cout_fmd =
- mgr->CreateContainer("BackgroundCorrected", TList::Class(),
- AliAnalysisManager::kOutputContainer,outputfile);
- mgr->ConnectInput(taskfmd, 0, mgr->GetCommonInputContainer());
- mgr->ConnectOutput(taskfmd, 1, cout_fmd);
-
- return taskfmd;
-}
-//
-// EOF
-//
-
+++ /dev/null
-//
-// Calibration/Correction object that stores the secondary to primary
-// correction used in the FMD analysis.
-//
-#include "AliFMDAnaCalibBackgroundCorrection.h"
-#include <TH2F.h>
-#include <TH1F.h>
-#include <TBrowser.h>
-
-ClassImp(AliFMDAnaCalibBackgroundCorrection)
-#if 0
-; // For Emacs
-#endif
-
-//____________________________________________________________________
-AliFMDAnaCalibBackgroundCorrection::AliFMDAnaCalibBackgroundCorrection()
- : TObject(),
- fArray(),
- fAxis(),
- fIsInit(kFALSE),
- fListOfDoubleHitCorrection(),
- fListOfNSDBgMaps()
-{
-}
-
-
-//____________________________________________________________________
-AliFMDAnaCalibBackgroundCorrection::AliFMDAnaCalibBackgroundCorrection(const AliFMDAnaCalibBackgroundCorrection& o)
- : TObject(o),
- fArray(o.fArray),
- fAxis(o.fAxis),
- fIsInit(o.fIsInit),
- fListOfDoubleHitCorrection(),
- fListOfNSDBgMaps()
-{
- // Copy ctor
-}
-//____________________________________________________________________
-AliFMDAnaCalibBackgroundCorrection&
-AliFMDAnaCalibBackgroundCorrection::operator=(const AliFMDAnaCalibBackgroundCorrection& o)
-{
- // Assignment operator
-
- fArray = o.fArray;
-
- return (*this);
-}
-
-//____________________________________________________________________
-void
-AliFMDAnaCalibBackgroundCorrection::SetBgCorrection(Int_t det,
- Char_t ring,
- Int_t vtxbin,
- TH2F* hCorrection)
-{
- if(!fIsInit) Init();
-
- TObjArray* ringArray = GetRingArray(det,ring);
- if (!ringArray) return;
-
- ringArray->AddAtAndExpand(hCorrection,vtxbin);
-
-}
-//____________________________________________________________________
-TH2F*
-AliFMDAnaCalibBackgroundCorrection::GetBgCorrection(Int_t det,
- Char_t ring,
- Int_t vtxbin) const
-{
- TObjArray* ringArray = GetRingArray(det,ring);
- if (!ringArray) return 0;
-
- TH2F* hCorrection = static_cast<TH2F*>(ringArray->At(vtxbin));
- return hCorrection;
-}
-//____________________________________________________________________
-void
-AliFMDAnaCalibBackgroundCorrection::SetNSDBgCorrection(Int_t det,
- Char_t ring,
- Int_t vtxbin,
- TH2F* hCorrection)
-{
- if(!fIsInit) Init();
- hCorrection->SetName(Form("FMDNSD%d%c_vtxbin_%d_correction",det,ring,vtxbin));
- fListOfNSDBgMaps.Add(hCorrection);
-
-}
-//____________________________________________________________________
-TH2F*
-AliFMDAnaCalibBackgroundCorrection::GetNSDBgCorrection(Int_t det,
- Char_t ring,
- Int_t vtxbin) const
-{
- TH2F* hCorrection =
- static_cast<TH2F*>(fListOfNSDBgMaps
- .FindObject(Form("FMDNSD%d%c_vtxbin_%d_correction",
- det,ring,vtxbin)));
- return hCorrection;
-}
-//____________________________________________________________________
-TH1F*
-AliFMDAnaCalibBackgroundCorrection::GetDoubleHitCorrection(Int_t det,
- Char_t ring) const
-{
- TH1F* hCorrection =
- static_cast<TH1F*>(fListOfDoubleHitCorrection
- .FindObject(Form("hDoubleHitCorrection_FMD%d%c",
- det,ring)));
- return hCorrection;
-}
-
-//____________________________________________________________________
-void
-AliFMDAnaCalibBackgroundCorrection::SetDoubleHitCorrection(Int_t det,
- Char_t ring,
- TH1F* hCorrection)
-{
- hCorrection->SetName(Form("hDoubleHitCorrection_FMD%d%c",det,ring));
- fListOfDoubleHitCorrection.Add(hCorrection);
-}
-//____________________________________________________________________
-TH1F*
-AliFMDAnaCalibBackgroundCorrection::GetSPDDeadCorrection(Int_t vtxbin) const
-{
- TH1F* hCorrection =
- static_cast<TH1F*>(fListOfDoubleHitCorrection
- .FindObject(Form("hSPDDeadCorrection_vtx%d",vtxbin)));
- return hCorrection;
-}
-
-//____________________________________________________________________
-void
-AliFMDAnaCalibBackgroundCorrection::SetSPDDeadCorrection(Int_t vtxbin,
- TH1F* hCorrection)
-{
- hCorrection->SetName(Form("hSPDDeadCorrection_vtx%d",vtxbin));
- fListOfDoubleHitCorrection.Add(hCorrection);
-}
-
-//____________________________________________________________________
-TH1F*
-AliFMDAnaCalibBackgroundCorrection::GetFMDDeadCorrection(Int_t vtxbin)
-{
- TH1F* hCorrection =
- static_cast<TH1F*>(fListOfDoubleHitCorrection
- .FindObject(Form("hFMDDeadCorrection_vtx%d",vtxbin)));
- return hCorrection;
-}
-
-//____________________________________________________________________
-void
-AliFMDAnaCalibBackgroundCorrection::SetFMDDeadCorrection(Int_t vtxbin,
- TH1F* hCorrection)
-{
- hCorrection->SetName(Form("hFMDDeadCorrection_vtx%d",vtxbin));
- fListOfDoubleHitCorrection.Add(hCorrection);
-}
-
-//____________________________________________________________________
-void
-AliFMDAnaCalibBackgroundCorrection::SetRefAxis(TAxis* axis)
-{
- // Set the reference axis
- fAxis.Set(axis->GetNbins(),axis->GetXmin(),axis->GetXmax());
-}
-//____________________________________________________________________
-void AliFMDAnaCalibBackgroundCorrection::Init()
-{
- // Initialize
- fArray.SetOwner();
-
- TObjArray* spdArray = new TObjArray();
- spdArray->SetOwner();
- fArray.AddAtAndExpand(spdArray,0);
-
- for(Int_t det = 1; det<=3;det++) {
- TObjArray* detArray = new TObjArray();
- detArray->SetOwner();
- detArray->SetName(Form("FMD%d", det));
- // detArray->SetTitle(Form("Array of FMD%d corrections", det));
- fArray.AddAtAndExpand(detArray,det);
- Int_t nRings = (det == 1 ? 1 : 2);
- for(Int_t ring = 0;ring<nRings;ring++) {
- TObjArray* ringArray = new TObjArray();
- Char_t r = (ring == 0 ? 'I' : 'O');
- ringArray->SetOwner();
- ringArray->SetName(Form("FMD%d%c", det, r));
- // ringArray->SetTitle(Form("Array of FMD%d%c corrections", det, r));
- detArray->AddAtAndExpand(ringArray,ring);
-
- }
- }
- fIsInit = kTRUE;
-
-}
-//____________________________________________________________________
-TObjArray* AliFMDAnaCalibBackgroundCorrection::GetRingArray(Int_t det,
- Char_t ring) const
-{
- // Find array corresponding to det, ring.
- // Note, 0 and 4 refers to the SPD arrays
- if(det==0 || det == 4) {
- TObjArray* spdArray = (TObjArray*)fArray.At(det);
- return spdArray;
- }
-
- if (det < 0 || det >= fArray.GetEntriesFast()) return 0;
-
- Int_t ringNumber = (ring == 'I' ? 0 : 1);
- TObjArray* detArray = static_cast<TObjArray*>(fArray.At(det));
- TObjArray* ringArray = static_cast<TObjArray*>(detArray->At(ringNumber));
-
- return ringArray;
-}
-
-//____________________________________________________________________
-void
-AliFMDAnaCalibBackgroundCorrection::Browse(TBrowser* b)
-{
- // Browse
- b->Add(&fAxis, "Vertex bins");
- b->Add(&fArray, "Array of histograms w/BG corrections");
-}
-
-//____________________________________________________________________
-//
-// EOF
-//
+++ /dev/null
-#ifndef ALIFMDANACALIBBACKGROUNDCORRECTION_H
-#define ALIFMDANACALIBBACKGROUNDCORRECTION_H
-
-#include <TObject.h>
-#include <TObjArray.h>
-// #include <TH2F.h>
-#include <TAxis.h>
-#include <TList.h>
-class TH2F;
-class TH1F;
-class TBrowser;
-
-/**
- * @ingroup FMD_ana
- * @brief Object to store secondary corrections.
- *
- * Objects of this class contains 1 2D histogram per detector,ring
- * per vertex bin. The histogram is an (eta,phi) histogram of the ratio
- * of total number of particles (seconary+primary) to the number of
- * primary particles.
- *
- * Objects of this class are generated by
- * @todo expand documentation
- *
- */
-class AliFMDAnaCalibBackgroundCorrection : public TObject
-{
-public:
- /**
- * Constructor
- */
- AliFMDAnaCalibBackgroundCorrection();
- /**
- * Copy constructor
- *
- * @param o Object to copy from
- */
- AliFMDAnaCalibBackgroundCorrection(const AliFMDAnaCalibBackgroundCorrection& o);
- /**
- * Assignment operator
- *
- * @param o Object to assign from
- *
- * @return Reference to this object
- */
- AliFMDAnaCalibBackgroundCorrection& operator=(const AliFMDAnaCalibBackgroundCorrection& o);
-
- /**
- * Get the background (secondary) correction
- *
- * @param det Detector
- * @param ring Ring
- * @param vtxbin Vertex bin
- *
- * @return 2D Histogram (eta,phi) secondary correction map
- */
- TH2F* GetBgCorrection(Int_t det, Char_t ring, Int_t vtxbin) const;
- /**
- * Set the background correction
- *
- * @param det Detector
- * @param ring Ring
- * @param vtxbin Vertex bin
- * @param hCorrection 2D Histogram (eta,phi) secondary correction map
- */
- void SetBgCorrection(Int_t det, Char_t ring, Int_t vtxbin,
- TH2F* hCorrection);
- /**
- * Get the Non-single-diffractive secondary correction map
- *
- * @param det Detector
- * @param ring Ring
- * @param vtxbin Vertex bin
- *
- * @return 2D Histogram (eta,phi) secondary correction map
- */
- TH2F* GetNSDBgCorrection(Int_t det, Char_t ring, Int_t vtxbin) const;
- /**
- * Set the Non-single-diffractive secondary correction map
- *
- * @param det Detector
- * @param ring Ring
- * @param vtxbin Vertex bin
- * @param hCorrection 2D Histogram (eta,phi) secondary correction map
- */
- void SetNSDBgCorrection(Int_t det, Char_t ring, Int_t vtxbin,
- TH2F* hCorrection);
-
- /**
- * Get the double hit correction
- *
- * @param det Detector
- * @param ring Ring
- *
- * @return 1D histogram (eta) of correction
- */
- TH1F* GetDoubleHitCorrection(Int_t det, Char_t ring) const;
- /**
- * Set the double hit correction
- *
- * @param det Detector
- * @param ring Ring
- * @param hCorrection 1D histogram (eta) of correction
- */
- void SetDoubleHitCorrection(Int_t det, Char_t ring, TH1F* hCorrection);
- /**
- * Get the SPD dead correction
- *
- * @param vtxbin Vertext bin
- *
- * @return 1D Histogram (eta) of SPD dead correction
- */
- TH1F* GetSPDDeadCorrection(Int_t vtxbin) const;
- /**
- * Set the SPD dead correction
- *
- * @param vtxbin Vertex bin
- * @param hCorrection 1D Histogram (eta) of SPD dead correction
- */
- void SetSPDDeadCorrection(Int_t vtxbin, TH1F* hCorrection);
- /**
- * Get the FMD dead correction
- *
- * @param vtxbin Vertext bin
- *
- * @return 1D Histogram (eta) of FMD dead correction
- */
- TH1F* GetFMDDeadCorrection(Int_t vtxbin);
- /**
- * Set the FMD dead correction
- *
- * @param vtxbin Vertex bin
- * @param hCorrection 1D Histogram (eta) of FMD dead correction
- */
- void SetFMDDeadCorrection(Int_t vtxbin, TH1F* hCorrection);
- /**
- * Set the reference axis
- *
- * @param axis Axis of vertex bins
- */
- void SetRefAxis(TAxis* axis);
- /**
- * Get the vertex axis
- *
- * @return Constant reference to vertex axis
- */
- const TAxis& GetRefAxis() const { return fAxis; }
- /**
- * Get the number of vertex bins
- *
- * @return Number of vertex bins
- */
- Int_t GetNvtxBins() const { return fAxis.GetNbins(); }
- /**
- * Get the maximum vertex cut (in cm)
- *
- * @return Maximum absolute value of the Z position of the vertex
- */
- Float_t GetVtxCutZ() const { return fAxis.GetXmax(); }
- /**
- * Initialize
- *
- */
- void Init();
- /**
- * Nice browsing
- *
- *
- * @return
- */
- Bool_t IsFolder() const { return kTRUE; }
- /**
- * Nice browsing
- *
- * @param b Browser
- */
- void Browse(TBrowser* b);
-protected:
- /**
- * Get the ring array
- *
- * @param det Detector
- * @param ring Ring
- *
- * @return
- */
- TObjArray* GetRingArray(Int_t det, Char_t ring) const;
- TObjArray fArray; // Array
- TAxis fAxis; // Vertex axis
- Bool_t fIsInit; // Whether this has been init
- TList fListOfDoubleHitCorrection; // Double hit corrections
- TList fListOfNSDBgMaps; // NSD bg maps
- ClassDef(AliFMDAnaCalibBackgroundCorrection,3);
-};
-
-#endif
-// Local Variables:
-// mode: C++
-// End:
+++ /dev/null
-//
-// Object to store energy distribution corrections as used in the FMD
-// analysis.
-//
-//
-#include "AliFMDAnaCalibEnergyDistribution.h"
-#include "TAxis.h"
-#include <AliLog.h>
-#include <iostream>
-#include "TH2F.h"
-#include <TBrowser.h>
-#include "AliFMDAnaParameters.h"
-ClassImp(AliFMDAnaCalibEnergyDistribution)
-#if 0
-; // This is for Emacs
-#endif
-
-//____________________________________________________________________
-AliFMDAnaCalibEnergyDistribution::AliFMDAnaCalibEnergyDistribution()
-: TObject(),
- fArray(),
- fEmptyArray(),
- fRingArray(),
- fIsInit(kFALSE),
- fNetaBins(0),
- fEtaMax(0),
- fEtaMin(0)
-{
-
-
-}
-//____________________________________________________________________
-void AliFMDAnaCalibEnergyDistribution::Init()
-{
- //Init object
- if(fNetaBins == 0)
- AliFatal("Set Eta bins before doing Init or anything else");
-
- fArray.SetOwner();
- fArray.SetName("etaBins");
- fEmptyArray.SetOwner();
- fEmptyArray.SetName("empty");
- fRingArray.SetName("rings");
-
- for(Int_t i = 0; i<fNetaBins; i++) {
- TObjArray* etaArray = new TObjArray();
- etaArray->SetName(Form("etabin_%03d", i+1));
- fArray.AddAtAndExpand(etaArray,i);
- for(Int_t det = 1; det<=3;det++) {
- TObjArray* detArray = new TObjArray();
- detArray->SetName(Form("FMD%d", det));
- etaArray->AddAtAndExpand(detArray,det);
- }
- }
-
-
-
- for(Int_t det = 1; det<=3;det++) {
- TObjArray* detArray = new TObjArray();
- detArray->SetName(Form("FMD%d", det));
- fEmptyArray.AddAtAndExpand(detArray,det);
- }
-
- for(Int_t det = 1; det<=3;det++) {
- TObjArray* detArray = new TObjArray();
- detArray->SetName(Form("FMD%d", det));
- fRingArray.AddAtAndExpand(detArray,det);
- }
-
-
- fIsInit = kTRUE;
-}
-
-
-//____________________________________________________________________
-TH1F*
-AliFMDAnaCalibEnergyDistribution::GetEnergyDistribution(Int_t det,
- Char_t ring,
- Float_t eta) {
-
- //Get Energy dist
- //TAxis testaxis(fNetaBins,fEtaMin,fEtaMax);
- // Int_t binnumber = testaxis.FindBin(eta);
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
- Int_t binnumber = pars->GetEtaBin(eta);
-
- Int_t ringNumber = (ring == 'I' ? 0 : 1);
- TObjArray* etaArray = (TObjArray*)fArray.At(binnumber);
- TObjArray* detArray = (TObjArray*)etaArray->At(det);
- TH1F* hEdist = (TH1F*)detArray->At(ringNumber);
-
- return hEdist;
-}
-//____________________________________________________________________
-TH1F*
-AliFMDAnaCalibEnergyDistribution::GetEmptyEnergyDistribution(Int_t det,
- Char_t ring)
-{
- //Get e dist of empty
- Int_t ringNumber = (ring == 'I' ? 0 : 1);
-
- TObjArray* detArray = (TObjArray*)fEmptyArray.At(det);
- TH1F* hEdist = (TH1F*)detArray->At(ringNumber);
-
- return hEdist;
-}
-//____________________________________________________________________
-TH1F*
-AliFMDAnaCalibEnergyDistribution::GetRingEnergyDistribution(Int_t det,
- Char_t ring) {
- // Get E dist of ring
- Int_t ringNumber = (ring == 'I' ? 0 : 1);
-
- TObjArray* detArray = (TObjArray*)fRingArray.At(det);
- TH1F* hEdist = (TH1F*)detArray->At(ringNumber);
-
- return hEdist;
-}
-//____________________________________________________________________
-void
-AliFMDAnaCalibEnergyDistribution::SetEnergyDistributionUser(Int_t det,
- Char_t ring,
- Float_t eta,
- TH1F* edist)
-{
- //Set E dist (user)
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- Int_t binnumber = pars->GetEtaBin(eta);
- //std::cout<<binnumber<<std::endl;
- SetEnergyDistribution(det, ring, binnumber, edist );
-}
-//____________________________________________________________________
-void
-AliFMDAnaCalibEnergyDistribution::SetEnergyDistribution(Int_t det,
- Char_t ring,
- Int_t etabin,
- TH1F* edist)
-{
- //Set E dist
- if(!fIsInit) Init();
-
- Int_t ringNumber = (ring == 'I' ? 0 : 1);
- TObjArray* etaArray = (TObjArray*)fArray.At(etabin);
- TObjArray* detArray = (TObjArray*)etaArray->At(det);
-
- detArray->AddAtAndExpand(edist,ringNumber);
-}
-
-//____________________________________________________________________
-void
-AliFMDAnaCalibEnergyDistribution::SetEmptyEnergyDistribution(Int_t det,
- Char_t ring,
- TH1F* edist)
-{
- //Set the empty dist
- if(!fIsInit)
- Init();
-
- Int_t ringNumber = (ring == 'I' ? 0 : 1);
- TObjArray* detArray = (TObjArray*)fEmptyArray.At(det);
-
- detArray->AddAtAndExpand(edist,ringNumber);
-
-
-}
-//____________________________________________________________________
-void AliFMDAnaCalibEnergyDistribution::SetRingEnergyDistribution(Int_t det,
- Char_t ring,
- TH1F* edist)
-{
- // Set E dist of ring
- if(!fIsInit) Init();
-
- Int_t ringNumber = (ring == 'I' ? 0 : 1);
- TObjArray* detArray = (TObjArray*)fRingArray.At(det);
-
- detArray->AddAtAndExpand(edist,ringNumber);
-}
-//____________________________________________________________________
-void AliFMDAnaCalibEnergyDistribution::Browse(TBrowser* b)
-{
- //Browse object
- for(Int_t i = 0; i<fNetaBins; i++) {
- TObjArray* etaArray = static_cast<TObjArray*>(fArray.At(i));
- etaArray->SetName(Form("etabin_%03d", i+1));
- for(Int_t det = 1; det<=3;det++) {
- TObjArray* detArray = static_cast<TObjArray*>(etaArray->At(det));
- detArray->SetName(Form("FMD%d", det));
- }
- }
-
- for(Int_t det = 1; det<=3;det++) {
- TObjArray* detArray = static_cast<TObjArray*>(fEmptyArray.At(det));
- detArray->SetName(Form("FMD%d", det));
- }
-
- for(Int_t det = 1; det<=3;det++) {
- TObjArray* detArray = static_cast<TObjArray*>(fRingArray.At(det));
- detArray->SetName(Form("FMD%d", det));
- }
-
- b->Add(&fArray, "etabins");
- b->Add(&fEmptyArray,"empty");
- b->Add(&fRingArray, "rings");
-}
-
-//____________________________________________________________________
-//
-// EOF
-//
+++ /dev/null
-#ifndef ALIFMDANACALIBENERGYDISTRIBUTION_H
-#define ALIFMDANACALIBENERGYDISTRIBUTION_H
-#include <TObject.h>
-#include <TObjArray.h>
-#include <TH1F.h>
-class TBrowser;
-/**
- * @ingroup FMD_ana
- * @brief Find most-probable value of MIP peak for one or more
- * particles.
- *
- */
-class AliFMDAnaCalibEnergyDistribution : public TObject
-{
-
- public:
-
- AliFMDAnaCalibEnergyDistribution();
- void SetNetaBins(Int_t nbins) {fNetaBins = nbins;}
- Int_t GetNetaBins() const { return fNetaBins;}
- void SetEtaLimits(Float_t eta_min, Float_t eta_max) {fEtaMin = eta_min; fEtaMax = eta_max;}
- void SetEnergyDistributionUser(Int_t det, Char_t ring, Float_t eta, TH1F* edist);
- void SetEnergyDistribution(Int_t det, Char_t ring, Int_t etabin, TH1F* edist);
-
- TH1F* GetEnergyDistribution(Int_t det, Char_t ring, Float_t eta);
- void SetEmptyEnergyDistribution(Int_t det, Char_t ring, TH1F* edist);
- TH1F* GetEmptyEnergyDistribution(Int_t det, Char_t ring);
- void SetRingEnergyDistribution(Int_t det, Char_t ring, TH1F* edist);
- TH1F* GetRingEnergyDistribution(Int_t det, Char_t ring);
- Bool_t IsFolder() const { return kTRUE; }
- void Browse(TBrowser* b);
- protected:
- void Init();
- TObjArray fArray; // Overall array
- TObjArray fEmptyArray; // Array of empty events energy dep
- TObjArray fRingArray; // Array of rings
- Bool_t fIsInit; // Are we init?
- Int_t fNetaBins; // Number of eta bins (intervals)
- Float_t fEtaMax; // Max Eta
- Float_t fEtaMin; // Min Eta
-
- ClassDef(AliFMDAnaCalibEnergyDistribution,3);
-};
-
-#endif
-// Local Variables:
-// mode: C++
-// End:
+++ /dev/null
-
-#include "AliFMDAnaCalibEventSelectionEfficiency.h"
-
-#include <TH1F.h>
-#include <TBrowser.h>
-#include "AliLog.h"
-#include "iostream"
-
-ClassImp(AliFMDAnaCalibEventSelectionEfficiency)
-#if 0
-; // For Emacs
-#endif
-
-//____________________________________________________________________
-AliFMDAnaCalibEventSelectionEfficiency::AliFMDAnaCalibEventSelectionEfficiency() : TObject(),
- fCorrection(),
- fCorrectionList(),
- fIsInit(kFALSE),
- fVtxEff(1)
-{
-
-
-
-}
-
-
-//____________________________________________________________________
-AliFMDAnaCalibEventSelectionEfficiency::
-AliFMDAnaCalibEventSelectionEfficiency(const AliFMDAnaCalibEventSelectionEfficiency& o) : TObject(o),
- fCorrection(o.fCorrection),
- fCorrectionList(),
- fIsInit(o.fIsInit),
- fVtxEff(o.fVtxEff)
-{
- // Copy ctor
-}
-//____________________________________________________________________
-AliFMDAnaCalibEventSelectionEfficiency&
-AliFMDAnaCalibEventSelectionEfficiency::operator=(const AliFMDAnaCalibEventSelectionEfficiency& /*o*/)
-{
- // Assignment operator
-
- return (*this);
-}
-//____________________________________________________________________
-void AliFMDAnaCalibEventSelectionEfficiency::Init() {
-
- fCorrection.SetName("EventSelectionEffCorrection");
-
- fIsInit = kTRUE;
-
-}
-//____________________________________________________________________
-void AliFMDAnaCalibEventSelectionEfficiency::SetCorrection(TH1F* hCorrection) {
-
- fCorrection.SetBins(hCorrection->GetNbinsX(),
- hCorrection->GetXaxis()->GetXmin(),
- hCorrection->GetXaxis()->GetXmax());
- for(Int_t i=1; i<=hCorrection->GetNbinsX(); i++) {
- fCorrection.SetBinContent(i,hCorrection->GetBinContent(i));
- fCorrection.SetBinError(i,hCorrection->GetBinError(i));
- }
-
-
-}
-//____________________________________________________________________
-void AliFMDAnaCalibEventSelectionEfficiency::SetCorrection(TString trig,
- Int_t vtxbin,
- Char_t ring,
- TH2F* hCorrection) {
- //TString test = trig;
- if(!trig.Contains("INEL") && !trig.Contains("NSD"))
- AliWarning("Please choose NSD or INEL!");
-
- if(trig.Contains("INEL"))
- hCorrection->SetName(Form("correction_%c_%d",ring,vtxbin));
- if(trig.Contains("NSD"))
- hCorrection->SetName(Form("correction%s_%c_%d","NSD",ring,vtxbin));
-
- fCorrectionList.Add(hCorrection);
-
-}
-//____________________________________________________________________
-TH2F* AliFMDAnaCalibEventSelectionEfficiency::GetCorrection(TString name,
- Int_t vtxbin,
- Char_t ring) {
-
- //TString name = trig;
-
- if(name.Contains("INEL"))
- name.Form("correction_%c_%d",ring,vtxbin);
- if(name.Contains("NSD"))
- name.Form("correction%s_%c_%d","NSD",ring,vtxbin);
-
- TH2F* hCorrection = (TH2F*)fCorrectionList.FindObject(name);
-
- return hCorrection;
-
-}
-
-//____________________________________________________________________
-Float_t AliFMDAnaCalibEventSelectionEfficiency::GetCorrection(Int_t vtxbin) {
-
- if( (vtxbin-1) > fCorrection.GetNbinsX() || vtxbin < 0)
- return 0;
-
- Float_t correction = fCorrection.GetBinContent(vtxbin+1);
-
- return correction;
-
-}
-
-//____________________________________________________________________
-void AliFMDAnaCalibEventSelectionEfficiency::Browse(TBrowser* /*b*/)
-{
-
-}
-
-//____________________________________________________________________
-//
-// EOF
-//
+++ /dev/null
-#ifndef ALIFMDANACALIBEVENTSELECTIONEFFICIENCY_H
-#define ALIFMDANACALIBEVENTSELECTIONEFFICIENCY_H
-
-#include <TObject.h>
-#include <TObjArray.h>
-#include <TH1F.h>
-#include <TAxis.h>
-#include <TList.h>
-#include <TH2F.h>
-#include <TString.h>
-class TBrowser;
-
-class AliFMDAnaCalibEventSelectionEfficiency : public TObject
-{
-
- public:
-
- AliFMDAnaCalibEventSelectionEfficiency();
- AliFMDAnaCalibEventSelectionEfficiency(const AliFMDAnaCalibEventSelectionEfficiency& o);
- AliFMDAnaCalibEventSelectionEfficiency& operator=(const AliFMDAnaCalibEventSelectionEfficiency& o);
-
- void Init();
- Bool_t IsFolder() const { return kTRUE; }
- void Browse(TBrowser* b);
- void SetCorrection(TH1F* hCorrection);
- Float_t GetCorrection(Int_t vtxbin);
- void SetCorrection(TString trig, Int_t vtxbin, Char_t ring, TH2F* hCorrection);
- TH2F* GetCorrection(TString trig, Int_t vtxbin, Char_t ring);
- Float_t GetVtxToTriggerRatio() {return fVtxEff; }
- void SetVtxToTriggerRatio(Float_t vtxEff) {fVtxEff = vtxEff;}
- protected:
-
- TH1F fCorrection;
- TList fCorrectionList;
- Bool_t fIsInit;
- Float_t fVtxEff;
- ClassDef(AliFMDAnaCalibEventSelectionEfficiency,3);
-};
-
-#endif
+++ /dev/null
-
-#include "AliFMDAnaCalibSharingEfficiency.h"
-#include <TH2F.h>
-#include <TH1F.h>
-#include <TBrowser.h>
-
-ClassImp(AliFMDAnaCalibSharingEfficiency)
-#if 0
-; // For Emacs
-#endif
-
-//____________________________________________________________________
-AliFMDAnaCalibSharingEfficiency::AliFMDAnaCalibSharingEfficiency() : TObject(),
- fArray(),
- fArrayTrVtx(),
- fIsInit(kFALSE)
-{
-
-
-
-}
-
-
-//____________________________________________________________________
-AliFMDAnaCalibSharingEfficiency::AliFMDAnaCalibSharingEfficiency(const AliFMDAnaCalibSharingEfficiency& o)
- : TObject(o), fArray(o.fArray), fArrayTrVtx(o.fArrayTrVtx), fIsInit(o.fIsInit)
-{
- // Copy ctor
-}
-//____________________________________________________________________
-AliFMDAnaCalibSharingEfficiency&
-AliFMDAnaCalibSharingEfficiency::operator=(const AliFMDAnaCalibSharingEfficiency& o)
-{
- // Assignment operator
-
- fArray = o.fArray;
- fArrayTrVtx = o.fArrayTrVtx;
-
- return (*this);
-}
-//____________________________________________________________________
-void AliFMDAnaCalibSharingEfficiency::Init() {
-
- fArray.SetOwner();
- for(Int_t det = 1; det<=3;det++) {
- TObjArray* detArray = new TObjArray();
- detArray->SetOwner();
- fArray.AddAtAndExpand(detArray,det);
- Int_t nRings = (det == 1 ? 1 : 2);
- for(Int_t ring = 0;ring<nRings;ring++) {
- TObjArray* ringArray = new TObjArray();
- ringArray->SetOwner();
- detArray->AddAtAndExpand(ringArray,ring);
-
- }
- }
- fArrayTrVtx.SetOwner();
- for(Int_t det = 1; det<=3;det++) {
- TObjArray* detArrayTrVtx = new TObjArray();
- detArrayTrVtx->SetOwner();
- fArrayTrVtx.AddAtAndExpand(detArrayTrVtx,det);
- Int_t nRings = (det == 1 ? 1 : 2);
- for(Int_t ring = 0;ring<nRings;ring++) {
- TObjArray* ringArrayTrVtx = new TObjArray();
- ringArrayTrVtx->SetOwner();
- detArrayTrVtx->AddAtAndExpand(ringArrayTrVtx,ring);
-
- }
- }
- fIsInit = kTRUE;
-
-}
-//____________________________________________________________________
-TObjArray* AliFMDAnaCalibSharingEfficiency::GetRingArrayTrVtx(Int_t det,
- Char_t ring) {
-
- Int_t ringNumber = (ring == 'I' ? 0 : 1);
- TObjArray* detArray = (TObjArray*)fArrayTrVtx.At(det);
- TObjArray* ringArray = (TObjArray*)detArray->At(ringNumber);
-
- return ringArray;
-}
-//____________________________________________________________________
-void AliFMDAnaCalibSharingEfficiency::SetSharingEffTrVtx(Int_t det,
- Char_t ring,
- Int_t vtxbin,
- TH1F* hCorrection) {
- if(!fIsInit)
- Init();
-
- TObjArray* ringArray = GetRingArrayTrVtx(det,ring);
- ringArray->AddAtAndExpand(hCorrection,vtxbin);
-
-}
-//____________________________________________________________________
-TH1F* AliFMDAnaCalibSharingEfficiency::GetSharingEffTrVtx(Int_t det,
- Char_t ring,
- Int_t vtxbin) {
- TObjArray* ringArray = GetRingArrayTrVtx(det,ring);
- TH1F* hCorrection = (TH1F*)ringArray->At(vtxbin);
- return hCorrection;
-}
-
-//____________________________________________________________________
-TObjArray* AliFMDAnaCalibSharingEfficiency::GetRingArray(Int_t det,
- Char_t ring) {
-
- Int_t ringNumber = (ring == 'I' ? 0 : 1);
- TObjArray* detArray = (TObjArray*)fArray.At(det);
- TObjArray* ringArray = (TObjArray*)detArray->At(ringNumber);
-
- return ringArray;
-}
-//____________________________________________________________________
-void AliFMDAnaCalibSharingEfficiency::SetSharingEff(Int_t det,
- Char_t ring,
- Int_t vtxbin,
- TH1F* hCorrection) {
- if(!fIsInit)
- Init();
-
- TObjArray* ringArray = GetRingArray(det,ring);
- ringArray->AddAtAndExpand(hCorrection,vtxbin);
-
-}
-//____________________________________________________________________
-TH1F* AliFMDAnaCalibSharingEfficiency::GetSharingEff(Int_t det,
- Char_t ring,
- Int_t vtxbin) {
- TObjArray* ringArray = GetRingArray(det,ring);
- TH1F* hCorrection = (TH1F*)ringArray->At(vtxbin);
- return hCorrection;
-}
-
-//____________________________________________________________________
-void
-AliFMDAnaCalibSharingEfficiency::Browse(TBrowser* b)
-{
- b->Add(&fArray, "Array of histograms w/sharing eff corrections");
-}
-
-//____________________________________________________________________
-//
-// EOF
-//
+++ /dev/null
-#ifndef ALIFMDANACALIBSHARINGEFFICIENCY_H
-#define ALIFMDANACALIBSHARINGEFFICIENCY_H
-
-#include <TObject.h>
-#include <TAxis.h>
-#include <TObjArray.h>
-class TH2F;
-class TH1F;
-class TBrowser;
-
-/**
- * @ingroup FMD_ana
- * @brief Do the background correction
- *
- */
-class AliFMDAnaCalibSharingEfficiency : public TObject
-{
-
- public:
-
- AliFMDAnaCalibSharingEfficiency();
- AliFMDAnaCalibSharingEfficiency(const AliFMDAnaCalibSharingEfficiency& o);
- AliFMDAnaCalibSharingEfficiency& operator=(const AliFMDAnaCalibSharingEfficiency& o);
-
- void SetSharingEff(Int_t det, Char_t ring, Int_t vtxbin, TH1F* hCorrection);
- TH1F* GetSharingEff(Int_t det, Char_t ring, Int_t vtxbin);
- void SetSharingEffTrVtx(Int_t det, Char_t ring, Int_t vtxbin, TH1F* hCorrection);
- TH1F* GetSharingEffTrVtx(Int_t det, Char_t ring, Int_t vtxbin);
- void Init();
- Bool_t IsFolder() const { return kTRUE; }
- void Browse(TBrowser* b);
- protected:
-
- TObjArray* GetRingArray(Int_t det, Char_t ring);
- TObjArray* GetRingArrayTrVtx(Int_t det, Char_t ring);
-
- TObjArray fArray;
- TObjArray fArrayTrVtx;
- Bool_t fIsInit;
-
- ClassDef(AliFMDAnaCalibSharingEfficiency,1);
-};
-
-#endif
-// Local Variables:
-// mode: C++
-// End:
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-//
-//The design of this class is based on the AliFMDParameters class. Its purpose
-//is to hold parameters for the analysis such as background correction and
-//fit functions.
-//
-//Author: Hans Hjersing Dalsgaard, NBI, hans.dalsgaard@cern.ch
-//
-
-// #include "AliFMDDebug.h" // ALILOG_H
-#include "AliFMDAnaParameters.h" // ALIFMDPARAMETERS_H
-//#include <AliCDBManager.h> // ALICDBMANAGER_H
-//#include <AliCDBEntry.h> // ALICDBMANAGER_H
-//#include "AliFMDRing.h"
-#include <AliLog.h>
-#include <Riostream.h>
-#include <sstream>
-#include <TSystem.h>
-#include <TH2D.h>
-#include <TF1.h>
-#include <TMath.h>
-#include "AliTriggerAnalysis.h"
-#include "AliPhysicsSelection.h"
-#include "AliBackgroundSelection.h"
-#include "AliMultiplicity.h"
-#include "AliESDEvent.h"
-#include "AliESDVertex.h"
-#include "AliFMDAnaCalibBackgroundCorrection.h"
-#include "AliFMDAnaCalibEnergyDistribution.h"
-#include "AliFMDAnaCalibEventSelectionEfficiency.h"
-#include "AliFMDAnaCalibSharingEfficiency.h"
-#include "TFile.h"
-
-//====================================================================
-ClassImp(AliFMDAnaParameters)
-#if 0
- ; // This is here to keep Emacs for indenting the next line
-#endif
-
-//const char* AliFMDAnaParameters::fgkBackgroundCorrection = "FMD/Correction/Background";
-//const char* AliFMDAnaParameters::fgkEnergyDists = "FMD/Correction/EnergyDistribution";
-const char* AliFMDAnaParameters::fgkBackgroundID = "background";
-const char* AliFMDAnaParameters::fgkEnergyDistributionID = "energydistributions";
-const char* AliFMDAnaParameters::fgkEventSelectionEffID = "eventselectionefficiency";
-const char* AliFMDAnaParameters::fgkSharingEffID = "sharingefficiency";
-//____________________________________________________________________
-AliFMDAnaParameters* AliFMDAnaParameters::fgInstance = 0;
-
-//____________________________________________________________________
-
-AliFMDAnaParameters*
-AliFMDAnaParameters::Instance()
-{
- // Get static instance
- if (!fgInstance) fgInstance = new AliFMDAnaParameters;
- return fgInstance;
-}
-
-//____________________________________________________________________
-AliFMDAnaParameters::AliFMDAnaParameters() :
- fIsInit(kFALSE),
- fBackground(0),
- fEnergyDistribution(0),
- fEventSelectionEfficiency(0),
- fSharingEfficiency(0),
- fCorner1(4.2231, 26.6638),
- fCorner2(1.8357, 27.9500),
- fEnergyPath("$ALICE_ROOT/PWGLF/FORWARD/corrections/EnergyDistribution"),
- fBackgroundPath("$ALICE_ROOT/PWGLF/FORWARD/corrections/Background"),
- fEventSelectionEffPath("$ALICE_ROOT/PWGLF/FORWARD/corrections/EventSelectionEfficiency"),
- fSharingEffPath("$ALICE_ROOT/PWGLF/FORWARD/corrections/SharingEfficiency"),
- fProcessPrimary(kFALSE),
- fProcessHits(kFALSE),
- fTrigger(kMB1),
- fEnergy(k900),
- fMagField(k5G),
- fSpecies(kPP),
- fPhysicsSelection(0),
- fRealData(kFALSE),
- fSPDlowLimit(0),
- fSPDhighLimit(999999999),
- fCentralSelection(kFALSE),
- fSharingObjectPresent(kTRUE),
- fNumberOfEtaBinsToCut(1),
- fEtaLowBinLimits(),
- fEtaHighBinLimits(),
- fTriggerInel(kFALSE),
- fTriggerNSD(kFALSE),
- fTriggerEmpty(kFALSE),
- fUseBuiltInNSD(kFALSE),
- fInelGtZero(kFALSE),
- fRunDndeta(kTRUE),
- fRunBFCorrelation(kTRUE),
- fRunMultiplicity(kTRUE)
-{
- // Default constructor
- // fPhysicsSelection = new AliPhysicsSelection;
- // fPhysicsSelection->SetAnalyzeMC(kTRUE); //For the background correction. This is reset in Init if relevant
- // fPhysicsSelection->SetUseBXNumbers(kFALSE);
-
-
- // AliBackgroundSelection* backgroundSelection = new AliBackgroundSelection("bg","bg");
- // backgroundSelection->Init();
- // fPhysicsSelection->AddBackgroundIdentification(backgroundSelection);
- //fPhysicsSelection->Initialize(104792);
- // Do not use this - it is only for IO
- fgInstance = this;
-
-}
-//____________________________________________________________________
-const char* AliFMDAnaParameters::GetPath(const char* species) const
-{
- //Get path of object
- static TString* path = new TString();
-
- if(species == fgkBackgroundID)
- path->Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
- fBackgroundPath.Data(),
- fgkBackgroundID,
- fEnergy,
- fTrigger,
- fMagField,
- fSpecies,
- fInelGtZero,
- 0);
- if(species == fgkEnergyDistributionID)
- path->Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
- fEnergyPath.Data(),
- fgkEnergyDistributionID,
- fEnergy,
- fTrigger,
- fMagField,
- fSpecies,
- fRealData,
- 0);
- if(species == fgkEventSelectionEffID)
- path->Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
- fEventSelectionEffPath.Data(),
- fgkEventSelectionEffID,
- fEnergy,
- fTrigger,
- fMagField,
- fSpecies,
- fInelGtZero,
- 0);
- if(species == fgkSharingEffID)
- path->Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
- fSharingEffPath.Data(),
- fgkSharingEffID,
- fEnergy,
- fTrigger,
- fMagField,
- fSpecies,
- 0,
- 0);
- return path->Data();
-}
-//____________________________________________________________________
-void AliFMDAnaParameters::Init(Bool_t forceReInit, UInt_t what)
-{
- // Initialize the parameters manager. We need to get stuff from files here.
-
- /* AliPhysicsSelection* test = (AliPhysicsSelection*)((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->GetEventSelection();
-
- if(fPhysicsSelection) {
- if(!fRealData) {
- fPhysicsSelection->SetAnalyzeMC(kTRUE);
- }
- else fPhysicsSelection->SetAnalyzeMC(kFALSE);
- }
- */
- if (forceReInit) fIsInit = kFALSE;
- if (fIsInit) return;
- if (what & kBackgroundCorrection) InitBackground();
- if (what & kEnergyDistributions) InitEnergyDists();
- if (what & kEventSelectionEfficiency) InitEventSelectionEff();
- if (what & kSharingEfficiency) InitSharingEff();
-
- fIsInit = kTRUE;
-
- if(fBackground)
- FindEtaLimits();
-
-
-
-}
-//____________________________________________________________________
-
-void AliFMDAnaParameters::InitBackground() {
- //Init background correction objects.
-
- TFile* fin = TFile::Open(GetPath(fgkBackgroundID));
-
- if (!fin) return;
-
- fBackground = dynamic_cast<AliFMDAnaCalibBackgroundCorrection*>(fin->Get(fgkBackgroundID));
- if (!fBackground) AliFatal("Invalid background object from CDB");
-
-
-
-}
-
-//____________________________________________________________________
-
-void AliFMDAnaParameters::InitEnergyDists() {
- //Init energy distributions
-
- TFile* fin = TFile::Open(GetPath(fgkEnergyDistributionID));
-
- if (!fin) return;
-
- fEnergyDistribution = dynamic_cast<AliFMDAnaCalibEnergyDistribution*>(fin->Get(fgkEnergyDistributionID));
-
- if (!fEnergyDistribution) AliFatal("Invalid background object from CDB");
-
-}
-
-//____________________________________________________________________
-
-void AliFMDAnaParameters::InitEventSelectionEff() {
- //Init event selection objects
-
- TFile* fin = TFile::Open(GetPath(fgkEventSelectionEffID));
-
- if (!fin) return;
-
- fEventSelectionEfficiency = dynamic_cast<AliFMDAnaCalibEventSelectionEfficiency*>(fin->Get(fgkEventSelectionEffID));
- if (!fEventSelectionEfficiency) AliFatal("Invalid background object from CDB");
-
-}
-
-//____________________________________________________________________
-
-void AliFMDAnaParameters::InitSharingEff() {
- //Initialize the sharing efficiency
- fSharingObjectPresent = kTRUE;
- TFile* fin = TFile::Open(GetPath(fgkSharingEffID));
-
- if (!fin) {
- fSharingObjectPresent = kFALSE;
- return;
- }
-
- fSharingEfficiency = dynamic_cast<AliFMDAnaCalibSharingEfficiency*>(fin->Get(fgkSharingEffID));
- if (!fSharingEfficiency) {
- fSharingObjectPresent = kFALSE;
- return;
- }
-
-}
-//____________________________________________________________________
-void AliFMDAnaParameters::FindEtaLimits() {
- //Find eta limits for analysis
- fEtaLowBinLimits.SetBins(4,0,4,2,0,2,GetNvtxBins(),0,GetNvtxBins());
- fEtaHighBinLimits.SetBins(4,0,4,2,0,2,GetNvtxBins(),0,GetNvtxBins());
- for(Int_t det=0; 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');
- for(Int_t v =0; v<GetNvtxBins(); v++) {
- fEtaLowBinLimits.SetBinContent(det,ir,v,GetFirstEtaBinFromMap(v, det, ringChar));
- fEtaHighBinLimits.SetBinContent(det,ir,v,GetLastEtaBinFromMap(v, det, ringChar));
- //std::cout<<det<<" "<<ringChar<<" "<<fEtaLowBinLimits.GetBinContent(det,ir,v)<<" "<<fEtaHighBinLimits.GetBinContent(det,ir,v)<<std::endl;
- }
- }
- }
-
-}
-//____________________________________________________________________
-void AliFMDAnaParameters::SetEnergy(Float_t cmsNNGeV)
-{
- //Set energy
- if (TMath::Abs(cmsNNGeV - 900.) < 10) fEnergy = k900;
- if (TMath::Abs(cmsNNGeV - 2400.) < 10) fEnergy = k2400;
- if (TMath::Abs(cmsNNGeV - 2750.) < 10) fEnergy = k2750;
- if (TMath::Abs(cmsNNGeV - 5500.) < 40) fEnergy = k5500;
- if (TMath::Abs(cmsNNGeV - 7000.) < 10) fEnergy = k7000;
- if (TMath::Abs(cmsNNGeV - 10000.) < 10) fEnergy = k10000;
- if (TMath::Abs(cmsNNGeV - 14000.) < 10) fEnergy = k14000;
-}
-//____________________________________________________________________
-void AliFMDAnaParameters::SetMagField(Float_t bkG)
-{
- //Set magnetic field
- if (TMath::Abs(bkG - 5.) < 1 ) fMagField = k5G;
- if (TMath::Abs(bkG + 5.) < 1 ) fMagField = k5Gnegative;
- if (TMath::Abs(bkG) < 1) fMagField = k0G;
-}
-//____________________________________________________________________
-void AliFMDAnaParameters::SetCollisionSystem(const TString& sys)
-{
- //Set the collision system
- TString s(sys);
- s.ToLower();
- if (s.Contains("p-p") || s.Contains("pp")) fSpecies = kPP;
- else if (s.Contains("pb-pb") || s.Contains("pbpb")) fSpecies = kPbPb;
- else if (s.Contains("a-a") || s.Contains("aa")) fSpecies = kPbPb;
-}
-
-//____________________________________________________________________
-void AliFMDAnaParameters::SetParametersFromESD(AliESDEvent* esd)
-{
- //Set the parameters from the ESD header information
-
- SetCollisionSystem(esd->GetBeamType());
-
- Float_t energy = esd->GetBeamEnergy();
- // Correct to center of mass per nucleon (cmsNN) - LHC gives it as
- // cmsNN * Z / 2
- if (fSpecies == kPbPb) energy = energy / 208 * 82;
- SetEnergy(2*energy);
- SetMagField(esd->GetMagneticField());
-
- // Float_t magfield = esd->GetCurrentL3();
- // if (TMath::Abs(magfield - 30000.) < 10 ) fMagField = k5G;
- // if (TMath::Abs(magfield + 30000.) < 10 ) fMagField = k5Gnegative;
- // if (TMath::Abs(magfield) < 10 ) fMagField = k0G;
-
-
-
- Init(kTRUE);
-
-}
-
-//____________________________________________________________________
-
-void AliFMDAnaParameters::PrintStatus(Bool_t showpaths) const
-{
- //Print current status
- TString energystring;
- switch(fEnergy) {
- case k900:
- energystring.Form("900 GeV"); break;
- case k2400:
- energystring.Form("2400 GeV"); break;
- case k2750:
- energystring.Form("2750 GeV"); break;
- case k5500:
- energystring.Form("5500 GeV"); break;
- case k7000:
- energystring.Form("7000 GeV"); break;
- case k10000:
- energystring.Form("10000 GeV"); break;
- case k14000:
- energystring.Form("14000 GeV"); break;
- default:
- energystring.Form("invalid energy"); break;
- }
- TString triggerstring;
- switch(fTrigger) {
- case kMB1:
- triggerstring.Form("Minimum bias 1"); break;
- case kMB2:
- triggerstring.Form("Minimum bias 2"); break;
- case kSPDFASTOR:
- triggerstring.Form("SPD FAST OR"); break;
- case kNOCTP:
- triggerstring.Form("NO TRIGGER TEST"); break;
- default:
- energystring.Form("invalid trigger"); break;
- }
- TString magstring;
- switch(fMagField) {
- case k5G:
- magstring.Form("+5 kGaus"); break;
- case k0G:
- magstring.Form("0 kGaus"); break;
- case k5Gnegative:
- magstring.Form("-5 kGaus"); break;
- default:
- magstring.Form("invalid mag field %d", fMagField); break;
- }
- TString collsystemstring;
- switch(fSpecies) {
- case kPP:
- collsystemstring.Form("p-p"); break;
- case kPbPb:
- collsystemstring.Form("Pb-Pb"); break;
- default:
- collsystemstring.Form("invalid collision system"); break;
- }
-
- TString datastring;
-
- if(fRealData)
- datastring.Form("Nature");
- else
- datastring.Form("MC");
-
- TString inelString;
- if(fInelGtZero) inelString = "INEL > 0";
- else inelString = "INEL";
-
- std::cout<<"Energy = "<<energystring.Data()<<std::endl;
- std::cout<<"Trigger = "<<triggerstring.Data()<<std::endl;
- std::cout<<"Mag Field = "<<magstring.Data()<<std::endl;
- std::cout<<"Coll System = "<<collsystemstring.Data()<<std::endl;
- std::cout<<"Data origin = "<<datastring.Data()<<std::endl;
- std::cout<<"Basic trigger: "<<inelString.Data()<<std::endl;
-
- if (showpaths) {
- TString bg = GetPath(fgkBackgroundID);
- TString es = GetPath(fgkEventSelectionEffID);
- TString ed = GetPath(fgkEnergyDistributionID);
- TString me = GetPath(fgkSharingEffID);
- std::cout << "2nd maps: " << bg << "\n"
- << "Event sel.: " << es << "\n"
- << "Energy dist.: " << ed << "\n"
- << "Merge eff.: " << me << std::endl;
- }
-
-}
-
-//____________________________________________________________________
-Float_t AliFMDAnaParameters::GetVtxCutZ() {
- //Get the z vtx cut in analysis
- if(!fIsInit) {
- AliWarning("Not initialized yet. Call Init() to remedy");
- return -1;
- }
-
- return fBackground->GetVtxCutZ();
-}
-
-//____________________________________________________________________
-Int_t AliFMDAnaParameters::GetNvtxBins() {
- //Get number of vtx bins
- if(!fIsInit) {
- AliWarning("Not initialized yet. Call Init() to remedy");
- return -1;
- }
-
- return fBackground->GetNvtxBins();
-}
-//____________________________________________________________________
-TH1F* AliFMDAnaParameters::GetEnergyDistribution(Int_t det, Char_t ring, Float_t eta) {
-
- return fEnergyDistribution->GetEnergyDistribution(det, ring, eta);
-}
-//____________________________________________________________________
-TH1F* AliFMDAnaParameters::GetEmptyEnergyDistribution(Int_t det, Char_t ring) {
-
- return fEnergyDistribution->GetEmptyEnergyDistribution(det, ring);
-}
-//____________________________________________________________________
-TH1F* AliFMDAnaParameters::GetRingEnergyDistribution(Int_t det, Char_t ring) {
-
- return fEnergyDistribution->GetRingEnergyDistribution(det, ring);
-}
-//____________________________________________________________________
-Float_t AliFMDAnaParameters::GetSigma(Int_t det, Char_t ring, Float_t eta) {
- //Get sigma of Landau fits
- if(!fIsInit) {
- AliWarning("Not initialized yet. Call Init() to remedy");
- return 0;
- }
-
- TH1F* hEnergyDist = GetEnergyDistribution(det,ring, eta);
- TF1* fitFunc = hEnergyDist->GetFunction("FMDfitFunc");
- if(!fitFunc) {
- //AliWarning(Form("No function for FMD%d%c, eta %f",det,ring,eta));
- return 1024;
- }
- Float_t sigma = fitFunc->GetParameter(2);
- return sigma;
-}
-
-
-//____________________________________________________________________
-Float_t AliFMDAnaParameters::GetMPV(Int_t det, Char_t ring, Float_t eta) {
- //Get MPV of landau fits
- if(!fIsInit) {
- AliWarning("Not initialized yet. Call Init() to remedy");
- return 0;
- }
- //AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- TH1F* hEnergyDist = GetEnergyDistribution(det,ring,eta);
- TF1* fitFunc = hEnergyDist->GetFunction("FMDfitFunc");
-
- if(!fitFunc) {
- AliWarning(Form("No function for FMD%d%c, eta %f (%d)",det,ring,eta,
- GetEtaBin(eta)));
- return 1024;
- }
-
- Float_t mpv = fitFunc->GetParameter(1);
- return mpv;
-}
-//____________________________________________________________________
-Float_t AliFMDAnaParameters::GetConstant(Int_t det, Char_t ring, Float_t eta) {
- //Get constant parameter of Landau fits
- if(!fIsInit) {
- AliWarning("Not initialized yet. Call Init() to remedy");
- return 0;
- }
-
- TH1F* hEnergyDist = GetEnergyDistribution(det,ring,eta);
- TF1* fitFunc = hEnergyDist->GetFunction("FMDfitFunc");
- if(!fitFunc) {
- AliWarning(Form("No function for FMD%d%c, eta %f",det,ring,eta));
- return 0;
- }
-
- Float_t mpv = fitFunc->GetParameter(0);
- return mpv;
-}
-//____________________________________________________________________
-Float_t
-AliFMDAnaParameters::Get2MIPWeight(Int_t det, Char_t ring, Float_t eta)
-{
- //Get 2 MIP weights of convoluted Landau fits
- if(!fIsInit) {
- AliWarning("Not initialized yet. Call Init() to remedy");
- return 0;
- }
-
- TH1F* hEnergyDist = GetEnergyDistribution(det,ring,eta);
- TF1* fitFunc = hEnergyDist->GetFunction("FMDfitFunc");
- if(!fitFunc) return 0;
- Float_t twoMIPweight = fitFunc->GetParameter(3);
-
-
-
- if(twoMIPweight < 1e-05)
- twoMIPweight = 0;
-
- return twoMIPweight;
-}
-//____________________________________________________________________
-Float_t
-AliFMDAnaParameters::Get3MIPWeight(Int_t det, Char_t ring, Float_t eta)
-{
- //Get 3 MIP weights of convoluted Landau fits
- if(!fIsInit) {
- AliWarning("Not initialized yet. Call Init() to remedy");
- return 0;
- }
-
- TH1F* hEnergyDist = GetEnergyDistribution(det,ring,eta);
- TF1* fitFunc = hEnergyDist->GetFunction("FMDfitFunc");
- if(!fitFunc) return 0;
- Float_t threeMIPweight = fitFunc->GetParameter(4);
-
- if(threeMIPweight < 1e-05)
- threeMIPweight = 0;
-
- Float_t twoMIPweight = fitFunc->GetParameter(3);
-
- if(twoMIPweight < 1e-05)
- threeMIPweight = 0;
-
- return threeMIPweight;
-}
-//____________________________________________________________________
-Int_t AliFMDAnaParameters::GetNetaBins()
-{
- return GetBackgroundCorrection(1,'I',5)->GetNbinsX();
-}
-//____________________________________________________________________
-Float_t AliFMDAnaParameters::GetEtaMin()
-{
- return GetBackgroundCorrection(1,'I',5)->GetXaxis()->GetXmin();
-}
-//____________________________________________________________________
-Float_t AliFMDAnaParameters::GetEtaMax()
-{
- return GetBackgroundCorrection(1,'I',5)->GetXaxis()->GetXmax();
-}
-//____________________________________________________________________
-Int_t AliFMDAnaParameters::GetEtaBin(Float_t eta)
-{
- TAxis testaxis(GetNetaBins(),GetEtaMin(),GetEtaMax());
- Int_t binnumber = testaxis.FindBin(eta) ;
-
- return binnumber;
-}
-//____________________________________________________________________
-
-TH2F* AliFMDAnaParameters::GetBackgroundCorrection(Int_t det,
- Char_t ring,
- Int_t vtxbin) {
- //Get background correction histogram
- if(!fIsInit) {
- AliWarning("Not initialized yet. Call Init() to remedy");
- return 0;
- }
-
-
-
- if(vtxbin > fBackground->GetNvtxBins()) {
- AliWarning(Form("No background object for vertex bin %d", vtxbin));
- return 0;
- }
-
- return fBackground->GetBgCorrection(det,ring,vtxbin);
-}
-//____________________________________________________________________
-TH2F* AliFMDAnaParameters::GetBackgroundCorrectionNSD(Int_t det,
- Char_t ring,
- Int_t vtxbin) {
- //Get background correction histogram for NSD event class
- if(!fIsInit) {
- AliWarning("Not initialized yet. Call Init() to remedy");
- return 0;
- }
-
- if(vtxbin > fBackground->GetNvtxBins()) {
- AliWarning(Form("No background object for vertex bin %d", vtxbin));
- return 0;
- }
-
- if(fBackground->GetNSDBgCorrection(det,ring,vtxbin))
- return fBackground->GetNSDBgCorrection(det,ring,vtxbin);
- else
- AliWarning("No NSD background map. You get usual one. "
- "Difference is probably negligible");
-
- return fBackground->GetBgCorrection(det,ring,vtxbin);
-}
-//____________________________________________________________________
-
-TH1F* AliFMDAnaParameters::GetDoubleHitCorrection(Int_t det,
- Char_t ring) {
- //Get correction for several hits in strips for p+p
- if(!fIsInit) {
- AliWarning("Not initialized yet. Call Init() to remedy");
- return 0;
- }
-
- return fBackground->GetDoubleHitCorrection(det,ring);
-}
-//_____________________________________________________________________
-TH1F* AliFMDAnaParameters::GetSPDDeadCorrection(Int_t vtxbin) {
-
- //Get correction for several hits in strips for p+p
- if(!fIsInit) {
- AliWarning("Not initialized yet. Call Init() to remedy");
- return 0;
- }
-
- return fBackground->GetSPDDeadCorrection(vtxbin);
-}
-//_____________________________________________________________________
-TH1F* AliFMDAnaParameters::GetFMDDeadCorrection(Int_t vtxbin) {
-
- //Get correction for several hits in strips for p+p
- if(!fIsInit) {
- AliWarning("Not initialized yet. Call Init() to remedy");
- return 0;
- }
-
- return fBackground->GetFMDDeadCorrection(vtxbin);
-}
-//_____________________________________________________________________
-Float_t AliFMDAnaParameters::GetEventSelectionEfficiency(Int_t vtxbin) {
- //Get event selection efficiency object
- if(!fIsInit) {
- AliWarning("Not initialized yet. Call Init() to remedy");
- return 0;
- }
- return fEventSelectionEfficiency->GetCorrection(vtxbin);
-
-}
-//_____________________________________________________________________
-Float_t AliFMDAnaParameters::GetVtxSelectionEffFromMC() {
- //Get the vtx selection from MC calculation
- if(!fIsInit) {
- AliWarning("Not initialized yet. Call Init() to remedy");
- return 0;
- }
- return fEventSelectionEfficiency->GetVtxToTriggerRatio();
-
-
-}
-//_____________________________________________________________________
-TH2F* AliFMDAnaParameters::GetEventSelectionEfficiency(TString trig, Int_t vtxbin, Char_t ring) {
- //Get event selection efficiency object
-
- //TString test = trig;
- if(!trig.Contains("NSD") && !trig.Contains("INEL")) {
- AliWarning("Event selection efficiency only available for INEL and NSD");
- return 0;
- }
- if(!fIsInit) {
- AliWarning("Not initialized yet. Call Init() to remedy");
- return 0;
- }
- return fEventSelectionEfficiency->GetCorrection(trig,vtxbin,ring);
-
-}
-//_____________________________________________________________________
-TH1F* AliFMDAnaParameters::GetSharingEfficiency(Int_t det, Char_t ring, Int_t vtxbin) {
- //Get sharing efficiency object
- if(!fIsInit) {
- AliWarning("Not initialized yet. Call Init() to remedy");
- return 0;
- }
-
- return fSharingEfficiency->GetSharingEff(det,ring,vtxbin);
-
-}
-//_____________________________________________________________________
-TH1F* AliFMDAnaParameters::GetSharingEfficiencyTrVtx(Int_t det, Char_t ring, Int_t vtxbin) {
- //Get sharing efficiency object TrVtx
- if(!fIsInit) {
- AliWarning("Not initialized yet. Call Init() to remedy");
- return 0;
- }
-
- return fSharingEfficiency->GetSharingEffTrVtx(det,ring,vtxbin);
-
-}
-//_____________________________________________________________________
-Float_t AliFMDAnaParameters::GetMaxR(Char_t ring) const {
- //Get max R of ring
- Float_t radius = 0;
- if(ring == 'I')
- radius = 17.2;
- else if(ring == 'O')
- radius = 28.0;
- else
- AliWarning("Unknown ring - must be I or O!");
-
- return radius;
-}
-//_____________________________________________________________________
-Float_t AliFMDAnaParameters::GetMinR(Char_t ring) const{
- //Get min R of ring
- Float_t radius = 0;
- if(ring == 'I')
- radius = 4.5213;
- else if(ring == 'O')
- radius = 15.4;
- else
- AliWarning("Unknown ring - must be I or O!");
-
- return radius;
-
-}
-//_____________________________________________________________________
-void AliFMDAnaParameters::SetCorners(Char_t ring) {
- //Set corners (taken from nominal geometry)
- if(ring == 'I') {
- fCorner1.Set(4.9895, 15.3560);
- fCorner2.Set(1.8007, 17.2000);
- }
- else {
- fCorner1.Set(4.2231, 26.6638);
- fCorner2.Set(1.8357, 27.9500);
- }
-
-}
-//_____________________________________________________________________
-Float_t AliFMDAnaParameters::GetPhiFromSector(UShort_t det, Char_t ring, UShort_t sec) const
-{
- //Get phi from sector
- Int_t nsec = (ring == 'I' ? 20 : 40);
- Float_t basephi = 0;
- if(det == 1)
- basephi = 1.72787594;
- if(det == 2 && ring == 'I')
- basephi = 0.15707963;
- if(det == 2 && ring == 'O')
- basephi = 0.078539818;
- if(det == 3 && ring == 'I')
- basephi = 2.984513044;
- if(det == 3 && ring == 'O')
- basephi = 3.06305289;
-
- Float_t step = 2*TMath::Pi() / nsec;
- Float_t phi = 0;
- if(det == 3)
- phi = basephi - sec*step;
- else
- phi = basephi + sec*step;
-
- if(phi < 0)
- phi = phi +2*TMath::Pi();
- if(phi > 2*TMath::Pi() )
- phi = phi - 2*TMath::Pi();
-
- return phi;
-}
-//_____________________________________________________________________
-Float_t AliFMDAnaParameters::GetEtaFromStrip(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip, Float_t zvtx) const
-{
- //Calculate eta from strip with vertex (redundant with AliESDFMD::Eta)
- Float_t rad = GetMaxR(ring)-GetMinR(ring);
- Float_t nStrips = (ring == 'I' ? 512 : 256);
- Float_t segment = rad / nStrips;
- Float_t r = GetMinR(ring) + segment*strip;
- Float_t z = 0;
- Int_t hybrid = sec / 2;
-
- if(det == 1) {
- if(!(hybrid%2)) z = 320.266; else z = 319.766;
- }
- if(det == 2 && ring == 'I' ) {
- if(!(hybrid%2)) z = 83.666; else z = 83.166;
- }
- if(det == 2 && ring == 'O' ) {
- if(!(hybrid%2)) z = 74.966; else z = 75.466;
- }
- if(det == 3 && ring == 'I' ) {
- if(!(hybrid%2)) z = -63.066; else z = -62.566;
- }
- if(det == 3 && ring == 'O' ) {
- if(!(hybrid%2)) z = -74.966; else z = -75.466;
- }
-
- //std::cout<<det<<" "<<ring<<" "<<sec<<" "<<hybrid<<" "<<z<<std::endl;
-
- // Float_t r = TMath::Sqrt(TMath::Power(x,2)+TMath::Power(y,2));
- Float_t theta = TMath::ATan2(r,z-zvtx);
- Float_t eta = -1*TMath::Log(TMath::Tan(0.5*theta));
-
- return eta;
-}
-
-//_____________________________________________________________________
-
-Bool_t AliFMDAnaParameters::GetVertex(const AliESDEvent* esd, Double_t* vertexXYZ)
-{
- //Get the vertex from the ESD
- const AliESDVertex* vertex = esd->GetPrimaryVertexSPD();
-
- if (!vertex) return kFALSE;
-
- vertex->GetXYZ(vertexXYZ);
-
- //if(vertexXYZ[0] == 0 || vertexXYZ[1] == 0 )
- // return kFALSE;
-
- if(vertex->GetNContributors() <= 0)
- return kFALSE;
-
- if(vertex->GetZRes() > 0.1 )
- return kFALSE;
-
- return vertex->GetStatus();
-
-}
-//____________________________________________________________________
-void AliFMDAnaParameters::SetTriggerStatus(const AliESDEvent *esd) {
-
- //ULong64_t triggerMask = esd->GetTriggerMask();
-
- AliPhysicsSelection* centralPhysicsSelection = (AliPhysicsSelection*)((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->GetEventSelection();
-
- if(!centralPhysicsSelection && !fPhysicsSelection) {
-
- std::cout<<"Creating AliPhysicsSelection object due to absence of central object"<<std::endl;
- fPhysicsSelection = new AliPhysicsSelection;
- fPhysicsSelection->SetAnalyzeMC(!fRealData);
- // fPhysicsSelection->SetUseBXNumbers(kFALSE);
-
-
- AliBackgroundSelection* backgroundSelection = new AliBackgroundSelection("bg","bg");
- backgroundSelection->Init();
- fPhysicsSelection->AddBackgroundIdentification(backgroundSelection);
-
- }
-
- TString triggers = esd->GetFiredTriggerClasses();
-
- AliTriggerAnalysis tAna;
-
- fTriggerInel = kFALSE;
- fTriggerNSD = kFALSE;
- fTriggerEmpty = kFALSE;
-
- UInt_t inel = kFALSE;
-
- if(centralPhysicsSelection) {
- inel= ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
- }
- else
- inel = fPhysicsSelection->IsCollisionCandidate(esd);
-
-
-
- if(fInelGtZero && inel) {
- const AliMultiplicity* spdmult = esd->GetMultiplicity();
- Int_t nCentralTracklets = 0;
- Int_t j = 0;
- while( nCentralTracklets < 1 && j< spdmult->GetNumberOfTracklets() ) {
- if(TMath::Abs(spdmult->GetEta(j)) < 1) nCentralTracklets++;
- j++;
- }
- if(nCentralTracklets < 1) inel = kFALSE;
- }
-
- //std::cout<<fTriggerInel<<std::endl;
- if(inel) {
- fTriggerInel = kTRUE;
- }
-
- Bool_t nsd = kFALSE;
- if(fUseBuiltInNSD) {
- if ((tAna.FMDTrigger(esd, AliTriggerAnalysis::kASide) || tAna.V0Trigger(esd, AliTriggerAnalysis::kASide, kFALSE) == AliTriggerAnalysis::kV0BB) && (tAna.FMDTrigger(esd, AliTriggerAnalysis::kCSide) || tAna.V0Trigger(esd, AliTriggerAnalysis::kCSide, kFALSE) == AliTriggerAnalysis::kV0BB))
- nsd = kTRUE;
- }
- else nsd = tAna.IsOfflineTriggerFired(esd,AliTriggerAnalysis::kNSD1);
-
- if(fTriggerInel && nsd) {
- fTriggerNSD = kTRUE;
- }
- if(triggers.Contains("CBEAMB-ABCE-NOPF-ALL")) {
- fTriggerEmpty = kTRUE;
- }
-
-
- /*switch (fTrigger) {
- case kMB1: {
- if( fPhysicsSelection->IsCollisionCandidate(esd)) {
- fTriggerInel = kTRUE;
- }
- break;
-
- }
- case kMB2: {
- if (triggerMask & spdFO && ((triggerMask & v0left) || (triggerMask & v0right)))
- return kTRUE;
- break;
- }
- case kSPDFASTOR: {
- if (triggerMask & spdFO)
- return kTRUE;
- break;
- }
- case kNOCTP: {
- return kTRUE;
- break;
- }
- case kEMPTY: {
- if(triggers.Contains("CBEAMB-ABCE-NOPF-ALL"))
- return kTRUE;
- break;
- }
- case kNSD: {
- if(fPhysicsSelection->IsCollisionCandidate(esd) && tAna.IsOfflineTriggerFired(esd,AliTriggerAnalysis::kNSD1))
- return kTRUE;
- break;
- }
-
- }//switch
- */
-
-}
-/*
-//____________________________________________________________________
-Bool_t AliFMDAnaParameters::IsEventTriggered(const AliESDEvent *esd, Trigger trig) {
- //Did we have trig trigger ?
- Trigger old = fTrigger;
- fTrigger = trig;
- Bool_t retval = IsEventTriggered(esd);
- fTrigger = old;
- return retval;
-
-}
-*/
-//____________________________________________________________________
-Bool_t AliFMDAnaParameters::IsEventTriggered(Trigger trigger) {
- // check if the event was triggered
-
- if (fCentralSelection) return kTRUE;
- switch (trigger) {
-
- case kMB1:
- return fTriggerInel;
- break;
- case kNSD:
- return fTriggerNSD;
- break;
- case kEMPTY:
- return fTriggerEmpty;
- break;
- case kNOCTP:
- return kTRUE;
- break;
- default:
- AliWarning("Trigger not implemented!!!");
- break;
-
-
- }
- return kFALSE;
-
-}
-
-//____________________________________________________________________
-Float_t
-AliFMDAnaParameters::GetStripLength(Char_t ring, UShort_t strip)
-{
- //Get length of a strip
-
- Float_t rad = GetMaxR(ring)-GetMinR(ring);
- Float_t nStrips = (ring == 'I' ? 512 : 256);
- Float_t segment = rad / nStrips;
-
- //TVector2* corner1 = fmdring.GetVertex(2);
- // TVector2* corner2 = fmdring.GetVertex(3);
-
- SetCorners(ring);
- /*
- std::cout<<GetMaxR(ring)<<" "<<fmdring.GetMaxR()<<std::endl;
- std::cout<<GetMinR(ring)<<" "<<fmdring.GetMinR()<<std::endl;
- std::cout<<corner1->X()<<" "<<fCorner1.X()<<std::endl;
- std::cout<<corner2->X()<<" "<<fCorner2.X()<<std::endl;
- std::cout<<corner1->Y()<<" "<<fCorner1.Y()<<std::endl;
- std::cout<<corner2->Y()<<" "<<fCorner2.Y()<<std::endl;*/
- Float_t slope = (fCorner1.Y() - fCorner2.Y()) / (fCorner1.X() - fCorner2.X());
- Float_t constant = (fCorner2.Y()*fCorner1.X()-(fCorner2.X()*fCorner1.Y())) / (fCorner1.X() - fCorner2.X());
- Float_t radius = GetMinR(ring) + strip*segment;
-
- Float_t d = TMath::Power(TMath::Abs(radius*slope),2) + TMath::Power(radius,2) - TMath::Power(constant,2);
-
- Float_t arclength = GetBaseStripLength(ring,strip);
- if(d>0) {
-
- Float_t x = (-1*TMath::Sqrt(d) -slope*constant) / (1+TMath::Power(slope,2));
- Float_t y = slope*x + constant;
- Float_t theta = TMath::ATan2(x,y);
-
- if(x < fCorner1.X() && y > fCorner1.Y()) {
- arclength = radius*theta; //One sector since theta is by definition half-hybrid
-
- }
-
- }
-
- return arclength;
-
-
-}
-//____________________________________________________________________
-Float_t
-AliFMDAnaParameters::GetBaseStripLength(Char_t ring, UShort_t strip) const
-{
- //Get length of strip assuming that corners are not cut away
- Float_t rad = GetMaxR(ring)-GetMinR(ring);
- Float_t nStrips = (ring == 'I' ? 512 : 256);
- Float_t nSec = (ring == 'I' ? 20 : 40);
- Float_t segment = rad / nStrips;
- Float_t basearc = 2*TMath::Pi() / (0.5*nSec); // One hybrid: 36 degrees inner, 18 outer
- Float_t radius = GetMinR(ring) + strip*segment;
- Float_t basearclength = 0.5*basearc * radius; // One sector
-
- return basearclength;
-}
-//____________________________________________________________________
-Int_t AliFMDAnaParameters::GetFirstEtaBinFromMap(Int_t vtxbin, Int_t det, Char_t ring)
-{
- //Get the first eta bin from the bg map
- TH2F* hBg = GetBackgroundCorrection(det,ring,vtxbin);
-
- if(det == 0) return hBg->GetXaxis()->FindBin(-1.95);
-
- Int_t firstbin = -1;
- Int_t nNonZeroFirst = 0;
-
- for(Int_t i=1;i<=hBg->GetNbinsX();i++) {
- if(nNonZeroFirst == fNumberOfEtaBinsToCut && firstbin==-1) firstbin = i;
-
- for(Int_t j=1;j<=hBg->GetNbinsY();j++) {
-
- Float_t value = hBg->GetBinContent(i,j);
-
- if(value > 0.001 && nNonZeroFirst<fNumberOfEtaBinsToCut)
- {nNonZeroFirst++; break;}
-
-
- }
- }
-
- return firstbin;
-
-}
-//____________________________________________________________________
-Int_t AliFMDAnaParameters::GetLastEtaBinFromMap(Int_t vtxbin, Int_t det, Char_t ring)
-{
- //Get the last eta bin from the map
- TH2F* hBg = GetBackgroundCorrection(det,ring,vtxbin);
- Int_t lastbin=-1;
- Int_t nNonZeroLast = 0;
-
- if(det == 0) return hBg->GetXaxis()->FindBin(1.95);
-
- for(Int_t i=hBg->GetNbinsX();i>0;i--) {
- if(nNonZeroLast == fNumberOfEtaBinsToCut && lastbin==-1) lastbin = i;
-
- for(Int_t j=1;j<=hBg->GetNbinsY();j++) {
-
- Float_t value = hBg->GetBinContent(i,j);
-
- if(value > 0.001 && nNonZeroLast<fNumberOfEtaBinsToCut)
- {nNonZeroLast++; break; }
-
-
- }
- }
-
- return lastbin;
-}
-
-//____________________________________________________________________
-Int_t AliFMDAnaParameters::GetFirstEtaBinToInclude(Int_t vtxbin, Int_t det, Char_t ring)
-{
- Int_t ringNumber = (ring == 'I' ? 0 : 1);
- return (Int_t)fEtaLowBinLimits.GetBinContent(det,ringNumber,vtxbin);
-
-}
-
-//____________________________________________________________________
-Int_t AliFMDAnaParameters::GetLastEtaBinToInclude(Int_t vtxbin, Int_t det, Char_t ring)
-{
- Int_t ringNumber = (ring == 'I' ? 0 : 1);
- return (Int_t)fEtaHighBinLimits.GetBinContent(det,ringNumber,vtxbin);
-
-}
-//____________________________________________________________________
-//
-// EOF
-//
+++ /dev/null
-#ifndef ALIFMDANAPARAMETERS_H
-#define ALIFMDANAPARAMETERS_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
- * reserved.
- *
- * Latest changes by Hans Hjersing Dalsgaard, NBI, hans.dalsgaard@cern.ch
- *
- * See cxx source for full Copyright notice
- */
-//
-//The design of this class is based on the AliFMDParameters class. Its purpose
-//is to hold parameters for the analysis such as background correction and
-//fit functions.
-//
-//Author: Hans Hjersing Dalsgaard, NBI, hans.dalsgaard@cern.ch
-//
-//____________________________________________________________________
-
-#ifndef ROOT_TNamed
-# include <TNamed.h>
-#endif
-#ifndef ROOT_TArrayI
-# include <TArrayI.h>
-#endif
-
-// #include "TFile.h"
-// #include "TObjArray.h"
-#include "TH2F.h"
-#include "TAxis.h"
-#include "TH1F.h"
-#include "TH3F.h"
-#include "AliPhysicsSelection.h"
-#include <TVector2.h>
-#include <TString.h>
-//#include "AliPWG0Helper.h"
-// #include "AliESDEvent.h"
-#include "AliInputEventHandler.h"
-#include "AliAnalysisManager.h"
-class AliESDEvent;
-class TObjArray;
-class AliFMDAnaCalibBackgroundCorrection;
-class AliFMDAnaCalibEnergyDistribution;
-class AliFMDAnaCalibEventSelectionEfficiency;
-class AliFMDAnaCalibSharingEfficiency;
-
-/**
- * @ingroup FMD_ana
- */
-class AliFMDAnaParameters : public TNamed
-{
-public:
- /** Enumeration of things to initialize */
- enum What {
- /** Pulser gain */
- kBackgroundCorrection = 0x1, // Background Correction
- kEnergyDistributions = 0x2, // Energy Distributions
- kEventSelectionEfficiency = 0x4, // Event Selection Efficiency
- kSharingEfficiency = 0x8 // Sharing algorithm efficiency
- };
-
- enum Trigger { kMB1 = 0, kMB2, kSPDFASTOR, kNOCTP, kEMPTY , kNSD};
-
- enum Energy { k900 , k10000, k14000 , k7000, k2400, k5500, k2750};
-
- enum MagField {k0G, k5G, k5Gnegative};
-
- enum Species {kPP, kPbPb};
-
- /** DO NOT USE THIS - ONLY FOR IO */
- AliFMDAnaParameters();
-
- /** Singleton access
- @return single to */
- static AliFMDAnaParameters* Instance();
-
- void Init(Bool_t forceReInit=kTRUE, UInt_t what=kBackgroundCorrection|kEnergyDistributions|kEventSelectionEfficiency|kSharingEfficiency);
- Float_t GetVtxCutZ();
- Int_t GetNvtxBins();
- Int_t GetNetaBins();
- Float_t GetEtaMin();
- Float_t GetEtaMax();
- Int_t GetEtaBin(Float_t eta);
- Float_t GetMPV(Int_t det, Char_t ring, Float_t eta);
- Float_t GetConstant(Int_t det, Char_t ring, Float_t eta);
- Float_t GetSigma(Int_t det, Char_t ring, Float_t eta);
- Float_t Get2MIPWeight(Int_t det, Char_t ring, Float_t eta);
- Float_t Get3MIPWeight(Int_t det, Char_t ring, Float_t eta);
- //static const char* GetBackgroundPath() { return fgkBackgroundCorrection;}
- // static const char* GetEdistPath() { return fgkEnergyDists;}
- static const char* GetBackgroundID() { return fgkBackgroundID;}
- static const char* GetEdistID() { return fgkEnergyDistributionID;}
- static const char* GetEventSelectionEffID() { return fgkEventSelectionEffID;}
- static const char* GetSharingEffID() { return fgkSharingEffID;}
- TH2F* GetBackgroundCorrection(Int_t det, Char_t ring, Int_t vtxbin);
- TH2F* GetBackgroundCorrectionNSD(Int_t det, Char_t ring, Int_t vtxbin);
- TH1F* GetDoubleHitCorrection(Int_t det, Char_t ring);
- TH1F* GetSPDDeadCorrection(Int_t vtxbin);
- TH1F* GetFMDDeadCorrection(Int_t vtxbin);
-
- TH1F* GetSharingEfficiency(Int_t det, Char_t ring, Int_t vtxbin);
- TH1F* GetSharingEfficiencyTrVtx(Int_t det, Char_t ring, Int_t vtxbin);
-
- void SetParametersFromESD(AliESDEvent* esd);
- Float_t GetEventSelectionEfficiency(Int_t vtxbin);
- TH2F* GetEventSelectionEfficiency(TString trig, Int_t vtxbin, Char_t ring);
- Float_t GetPhiFromSector(UShort_t det, Char_t ring, UShort_t sec) const;
- Float_t GetEtaFromStrip(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip, Float_t zvtx) const;
- Float_t GetStripLength(Char_t ring, UShort_t strip) ;
- Float_t GetBaseStripLength(Char_t ring, UShort_t strip) const ;
- Float_t GetMaxR(Char_t ring) const;
- Float_t GetMinR(Char_t ring) const;
- void SetBackgroundPath(const Char_t* bgpath) {fBackgroundPath = bgpath;}
- void SetEnergyPath(const Char_t* epath) {fEnergyPath = epath;}
- void SetEventSelectionPath(const Char_t* evpath) {fEventSelectionEffPath = evpath;}
- void SetSharingEfficiencyPath(const Char_t* sharpath) {fSharingEffPath = sharpath;}
- void SetInelGtZero(Bool_t InelGtZero) {fInelGtZero = InelGtZero;}
- void SetProcessPrimary(Bool_t prim=kTRUE) {fProcessPrimary = prim;}
- void SetProcessHits(Bool_t hits=kTRUE) {fProcessHits = hits;}
- Bool_t GetProcessPrimary() const {return fProcessPrimary;}
- Bool_t GetProcessHits() const {return fProcessHits;}
- Bool_t GetVertex(const AliESDEvent* esd, Double_t* vertexXYZ);
- void SetTriggerDefinition(Trigger trigger) {fTrigger = trigger;}
- Trigger GetTriggerDefinition() const {return fTrigger;}
- void SetRunDndeta(Bool_t rundndeta) { fRunDndeta = rundndeta; }
- void SetRunBFCorrelation(Bool_t runBFcor) { fRunBFCorrelation = runBFcor; }
- void SetRunMultiplicity(Bool_t runMultiplicity) { fRunMultiplicity = runMultiplicity; }
-
- Bool_t GetRunDndeta() const {return fRunDndeta;}
- Bool_t GetRunBFCorrelation() const {return fRunBFCorrelation;}
- Bool_t GetRunMultiplicity() const {return fRunMultiplicity;}
-
- //Bool_t IsEventTriggered(const AliESDEvent *esd) ;
- Bool_t IsEventTriggered(Trigger trigger) ;
- void SetTriggerStatus(const AliESDEvent *esd) ;
- void SetEnergy(Energy energy) {fEnergy = energy;}
- void SetEnergy(Float_t cmsNNGeV);
- Energy GetEnergy() const {return fEnergy;}
- void SetMagField(MagField magfield) {fMagField = magfield;}
- void SetMagField(Float_t bkG);
- const char* GetPath(const char* species) const;
- void SetCollisionSystem(Species collsystem) {fSpecies = collsystem;}
- void SetCollisionSystem(const TString& collsystem);
- Species GetCollisionSystem() const {return fSpecies;}
- void PrintStatus(Bool_t showPaths=true) const;
- void Print(Option_t* /* option */) const { PrintStatus(); }
- const Char_t* GetDndetaAnalysisName() const {return "PWGLFforwardDnDeta";}
- TH1F* GetEnergyDistribution(Int_t det, Char_t ring, Float_t eta);
- TH1F* GetEmptyEnergyDistribution(Int_t det, Char_t ring);
- TH1F* GetRingEnergyDistribution(Int_t det, Char_t ring);
- AliPhysicsSelection* GetPhysicsSelection() const { return fPhysicsSelection ? fPhysicsSelection : (AliPhysicsSelection*)((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->GetEventSelection(); /*return fPhysicsSelection;*/ }
- Bool_t IsRealData() const {return fRealData; }
- void SetRealData(Bool_t realdata) {fRealData = realdata;}
- Float_t GetLowSPDLimit() const {return fSPDlowLimit;}
- Float_t GetHighSPDLimit() const {return fSPDhighLimit;}
- void SetLowSPDLimit(Float_t cut) {fSPDlowLimit = cut;}
- void SetHighSPDLimit(Float_t cut) {fSPDhighLimit = cut;}
- void SetCentralTriggerSelection(Bool_t selection) {fCentralSelection = selection;}
- Bool_t SharingEffPresent() const {return fSharingObjectPresent;}
- Int_t GetFirstEtaBinToInclude(Int_t vtxbin, Int_t det, Char_t ring) ;
- Int_t GetLastEtaBinToInclude(Int_t vtxbin, Int_t det, Char_t ring) ;
- void SetUseInternalNSDTrigger(Bool_t internalNSD) {fUseBuiltInNSD = internalNSD;}
-
- void SetNumberOfEtaBinsToCut(Int_t nbins) {fNumberOfEtaBinsToCut = nbins;}
- Int_t GetNumberOfEtaBinsToCut() const {return fNumberOfEtaBinsToCut;}
- Float_t GetVtxSelectionEffFromMC() ;
-
-protected:
-
- AliFMDAnaParameters(const AliFMDAnaParameters& o)
- : TNamed(o),
- fIsInit(o.fIsInit),
- fBackground(o.fBackground),
- fEnergyDistribution(o.fEnergyDistribution),
- fEventSelectionEfficiency(o.fEventSelectionEfficiency),
- fSharingEfficiency(o.fSharingEfficiency),
- fCorner1(o.fCorner1),
- fCorner2(o.fCorner2),
- fEnergyPath(o.fEnergyPath),
- fBackgroundPath(o.fBackgroundPath),
- fEventSelectionEffPath(o.fEventSelectionEffPath),
- fSharingEffPath(o.fSharingEffPath),
- fProcessPrimary(o.fProcessPrimary),
- fProcessHits(o.fProcessHits),
- fTrigger(o.fTrigger),
- fEnergy(o.fEnergy),
- fMagField(o.fMagField),
- fSpecies(o.fSpecies),
- fPhysicsSelection(o.fPhysicsSelection),
- fRealData(o.fRealData),
- fSPDlowLimit(o.fSPDlowLimit),
- fSPDhighLimit(o.fSPDhighLimit),
- fCentralSelection(o.fCentralSelection),
- fSharingObjectPresent(o.fSharingObjectPresent),
- fNumberOfEtaBinsToCut(o.fNumberOfEtaBinsToCut),
- fEtaLowBinLimits(o.fEtaLowBinLimits),
- fEtaHighBinLimits(o.fEtaHighBinLimits),
- fTriggerInel(o.fTriggerInel),
- fTriggerNSD(o.fTriggerNSD),
- fTriggerEmpty(o.fTriggerEmpty),
- fUseBuiltInNSD(o.fUseBuiltInNSD),
- fInelGtZero(o.fInelGtZero),
- fRunDndeta(o.fRunDndeta),
- fRunBFCorrelation(o.fRunBFCorrelation),
- fRunMultiplicity(o.fRunMultiplicity)
- {}
- AliFMDAnaParameters& operator=(const AliFMDAnaParameters&) { return *this; }
- virtual ~AliFMDAnaParameters() {}
-
- static AliFMDAnaParameters* fgInstance; // Static singleton instance
-
- // AliCDBEntry* GetEntry(const char* path, Bool_t fatal=kTRUE) const ;
- void InitBackground();
- void InitEnergyDists();
- void InitEventSelectionEff();
- void InitSharingEff();
-
- void FindEtaLimits();
- Int_t GetFirstEtaBinFromMap(Int_t vtxbin, Int_t det, Char_t ring) ;
- Int_t GetLastEtaBinFromMap(Int_t vtxbin, Int_t det, Char_t ring) ;
-
- TObjArray* GetBackgroundArray();
-
- TAxis* GetRefAxis();
- void SetCorners(Char_t ring) ;
-
- Bool_t fIsInit; //Have we been init ?
- //TObjArray* fBackgroundArray;
- // TObjArray* fEdistArray;
- AliFMDAnaCalibBackgroundCorrection* fBackground; //BG correction object
- AliFMDAnaCalibEnergyDistribution* fEnergyDistribution; //Energy dist object
- AliFMDAnaCalibEventSelectionEfficiency* fEventSelectionEfficiency; //Event selection correction object
- AliFMDAnaCalibSharingEfficiency* fSharingEfficiency; //Sharing efficiency correction object
- //static const char* fgkBackgroundCorrection;
- //static const char* fgkEnergyDists;
- static const char* fgkBackgroundID; // BG cor ID
- static const char* fgkEnergyDistributionID ; // Energy dist ID
- static const char* fgkEventSelectionEffID ; // Event selection ID
- static const char* fgkSharingEffID ; // Sharing efficiency ID
-
- TVector2 fCorner1; //First corner of hybrid
- TVector2 fCorner2; //Second corner of hybrid
- TString fEnergyPath; //Path of energy calib
- TString fBackgroundPath; //Path of BG correction
- TString fEventSelectionEffPath; //Path of event selection eff
- TString fSharingEffPath; //Path of sharing eff
- Bool_t fProcessPrimary; //Do we process primary ?
- Bool_t fProcessHits; //Do we process hits ?
- Trigger fTrigger; //Which trigger are we using ?
- Energy fEnergy; // CM energy
- MagField fMagField; //Magnetic field
- Species fSpecies; //PbPb or pp ?
- AliPhysicsSelection* fPhysicsSelection; //Physics selection
- Bool_t fRealData; // real or simulated
- Float_t fSPDlowLimit ; // low limit of SPD tracklets
- Float_t fSPDhighLimit ; // high limit of SPD tracklets
- Bool_t fCentralSelection; //if event selection is done centrally
- Bool_t fSharingObjectPresent ; //Do we have a sharing object ?
- Int_t fNumberOfEtaBinsToCut; //Number of eta bins to remove from edge effects
- TH3F fEtaLowBinLimits; //Histogram of low eta bin limits
- TH3F fEtaHighBinLimits; //Histogram of high eta bin limits
- Bool_t fTriggerInel; //If the selected INEL trigger fired
- Bool_t fTriggerNSD; //If the NSD trigger fired
- Bool_t fTriggerEmpty; //Event should be empty (empty bunches)
- Bool_t fUseBuiltInNSD; //Should we use the internal NSD trigger by A. Hansen
- Bool_t fInelGtZero; //Should INEL be INEL>0
- Bool_t fRunDndeta; //Run the Dndeta analysis ?
- Bool_t fRunBFCorrelation; //Run the BF correlation analysis ?
- Bool_t fRunMultiplicity; //Run the multiplicity analysis ?
-
- ClassDef(AliFMDAnaParameters,1) // Manager of parameters
-
-};
-
-#endif
-//____________________________________________________________________
-//
-// Local Variables:
-// mode: C++
-// End:
-//
-// EOF
-//
-
+++ /dev/null
-#include <TROOT.h>
-#include <TSystem.h>
-#include <TInterpreter.h>
-#include <TChain.h>
-#include <TFile.h>
-#include <TList.h>
-#include <iostream>
-#include <string>
-#include <TCanvas.h>
-#include "TH1F.h"
-#include "TH2F.h"
-#include "TProfile.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),
- fInternalList(0),
- fVertexString(0x0),
- fStandalone(kTRUE),
- fEvent(0),
- fnBinsX(0),
- fXmin(0),
- fXmax(0),
- fnBinsY(0),
- fYmin(0),
- fYmax(0)
-
-{
- // 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),
- fInternalList(0),
- fVertexString(0x0),
- fStandalone(kTRUE),
- fEvent(0),
- fnBinsX(0),
- fXmin(0),
- fXmax(0),
- fnBinsY(0),
- fYmin(0),
- fYmax(0)
-{
- fStandalone = SE;
- if(fStandalone) {
- DefineInput (0, TList::Class());
- DefineInput(1, TObjString::Class());
- DefineOutput(0, TList::Class());
- }
-}
-
-//_____________________________________________________________________
-void AliFMDAnalysisTaskBFCorrelation::CreateOutputObjects()
-{
-
- // Nomenclature for naming histograms
- // SE - Used in histogram names if used for containing Single Event information
- // Rebin - Used in histogram names if they have been rebinned for analysis purposes
-
- // Setup the list for storing results, if it does not exist
-
- if(!fOutputList) {
- fOutputList = new TList();
- fOutputList->SetName("BackgroundCorrected");
- }
-
- // Setup the list for temporary storage during the analysis
-
- if(!fInternalList) {
- fInternalList = new TList();
- fInternalList->SetName("InternalBFList");
- }
-
- // Get the bounds for the input histogram.
- // This version is optimized for 200 bins in the eta range (-4, 6)
-
- AliFMDAnaParameters *pars = AliFMDAnaParameters::Instance();
- TH2F *hDefault = (TH2F*)pars->GetBackgroundCorrection(1, 'I', 1);
-
- fnBinsX = hDefault->GetNbinsX();
- fnBinsY = hDefault->GetNbinsY();
- fXmin = hDefault->GetXaxis()->GetXmin();
- fXmax = hDefault->GetXaxis()->GetXmax();
- fYmin = hDefault->GetYaxis()->GetXmin();
- fYmax = hDefault->GetYaxis()->GetXmax();
-
- // Histogram to contain an event of MC data. Same dimension as ESD event
-
- TH2F *hEtaPhiParticleMap = new TH2F("hEtaPhiParticleMap",
- "Distributions of MC particles (Eta,Phi)",
- fnBinsX, fXmin, fXmax,
- fnBinsY, fYmin, fYmax);
- hEtaPhiParticleMap->Sumw2();
-
- fInternalList->Add(hEtaPhiParticleMap);
-
- // Create histograms with same binning as input for Response analysis
- // and control histograms. One temporary histogram is also created to
- // avoid the new and delete call. Must be reset after use !
-
- TH1D *hSEMultESD = new TH1D("hSEMultESD", "Multiplicity", fnBinsX, fXmin, fXmax);
- TH1D *hSEMultMC = new TH1D("hSEMultMC", "Multiplicity", fnBinsX, fXmin, fXmax);
-
- TH1D *hTemp = new TH1D("hTemp", "Temporary histogram", fnBinsX, fXmin, fXmax);
-
- fInternalList->Add(hSEMultESD);
- fInternalList->Add(hSEMultMC);
- fInternalList->Add(hTemp);
-
- TH1F *hMultvsEtaESD = new TH1F("hMultvsEtaESD", "Multiplicity vs Eta (ESD)", fnBinsX, fXmin, fXmax);
- TH1F *hMultvsEtaMC = new TH1F("hMultvsEtaMC", "Multiplicity vs Eta (MC)", fnBinsX, fXmin, fXmax);
-
- TH2F *hResponseMatrix = new TH2F("hResponseMatrix", "Response matrix", 151, -0.5, 150.5, 151, -0.5, 150.5);
-
- fOutputList->Add(hMultvsEtaESD);
- fOutputList->Add(hMultvsEtaMC);
- fOutputList->Add(hResponseMatrix);
-
- // Set up histograms for analysis and storage. 3 different binnings
-
- for (Int_t i = 1; i <= 4; i++) {
- if (i == 3) continue;
-
- Int_t nBinsX = fnBinsX/(5*i);
-
- // Histograms for the event-by-event analysis
-
- TH1D *hSERebinMultESD = new TH1D(Form("hSERebinMultESD_binning%d", i),
- Form("Multiplicity per event vs eta ESD (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1D *hSERebinMultMC = new TH1D(Form("hSERebinMultMC_binning%d", i),
- Form("Multiplicity per event vs eta MC-truth (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1D *hSERebinMultMirrorESD = new TH1D(Form("hSERebinMultMirrorESD_binning%d", i),
- Form("Multiplicity per event vs eta ESD Mirrored (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1D *hSERebinMultMirrorMC = new TH1D(Form("hSERebinMultMirrorMC_binning%d", i),
- Form("Multiplicity per event vs eta MC-truth Mirrored (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
-
- TH1D *hSERebinMultWESD = new TH1D(Form("hSERebinMultWESD_binning%d", i),
- Form("Multiplicity per event vs eta ESD (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1D *hSERebinMultWMC = new TH1D(Form("hSERebinMultWMC_binning%d", i),
- Form("Multiplicity per event vs eta MC-truth (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1D *hSERebinMultMirrorWESD = new TH1D(Form("hSERebinMultMirrorWESD_binning%d", i),
- Form("Multiplicity per event vs eta ESD Mirrored (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1D *hSERebinMultMirrorWMC = new TH1D(Form("hSERebinMultMirrorWMC_binning%d", i),
- Form("Multiplicity per event vs eta MC-truth Mirrored (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- fInternalList->Add(hSERebinMultESD);
- fInternalList->Add(hSERebinMultMC);
- fInternalList->Add(hSERebinMultMirrorESD);
- fInternalList->Add(hSERebinMultMirrorMC);
-
- fInternalList->Add(hSERebinMultWESD);
- fInternalList->Add(hSERebinMultWMC);
- fInternalList->Add(hSERebinMultMirrorWESD);
- fInternalList->Add(hSERebinMultMirrorWMC);
-
- // Histograms for storing the acummulated parameters.
-
- TH1F *hRebinnESD = new TH1F(Form("hRebinnESD_binning%d", i),
- Form("Counts ESD (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1F *hRebinnMirrorESD = new TH1F(Form("hRebinnMirrorESD_binning%d", i),
- Form("Counts ESD Mirrored (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1F *hRebinn2ESD = new TH1F(Form("hRebinn2ESD_binning%d", i),
- Form("Counts^2 ESD (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1F *hRebinn2MirrorESD = new TH1F(Form("hRebinn2MirrorESD_binning%d", i),
- Form("Counts^2 ESD Mirrored (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1F *hRebinnfbESD = new TH1F(Form("hRebinnfbESD_binning%d", i),
- Form("Fwd*bwd ESD (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
-
- TH1F *hRebinnMC = new TH1F(Form("hRebinnMC_binning%d", i),
- Form("Counts MC (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1F *hRebinnMirrorMC = new TH1F(Form("hRebinnMirrorMC_binning%d", i),
- Form("Counts MC Mirrored (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1F *hRebinn2MC = new TH1F(Form("hRebinn2MC_binning%d", i),
- Form("Counts^2 MC (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1F *hRebinn2MirrorMC = new TH1F(Form("hRebinn2MirrorMC_binning%d", i),
- Form("Counts^2 MC Mirrored (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1F *hRebinnfbMC = new TH1F(Form("hRebinnfbMC_binning%d", i),
- Form("Fwd*bwd MC (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- fOutputList->Add(hRebinnESD);
- fOutputList->Add(hRebinnMirrorESD);
- fOutputList->Add(hRebinn2ESD);
- fOutputList->Add(hRebinn2MirrorESD);
- fOutputList->Add(hRebinnfbESD);
-
- fOutputList->Add(hRebinnMC);
- fOutputList->Add(hRebinnMirrorMC);
- fOutputList->Add(hRebinn2MC);
- fOutputList->Add(hRebinn2MirrorMC);
- fOutputList->Add(hRebinnfbMC);
-
- // Histograms for storing the weights for the acummulated parameters.
-
- TH1F *hRebinnWESD = new TH1F(Form("hRebinnWESD_binning%d", i),
- Form("Counts ESD Weights (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1F *hRebinnMirrorWESD = new TH1F(Form("hRebinnMirrorWESD_binning%d", i),
- Form("Counts ESD Weights (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1F *hRebinn2WESD = new TH1F(Form("hRebinn2WESD_binning%d", i),
- Form("Counts^2 ESD Weights (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1F *hRebinn2MirrorWESD = new TH1F(Form("hRebinn2MirrorWESD_binning%d", i),
- Form("Counts^2 ESD Weights (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1F *hRebinnfbWESD = new TH1F(Form("hRebinnfbWESD_binning%d", i),
- Form("Fwd*bwd ESD Weights (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
-
- TH1F *hRebinnWMC = new TH1F(Form("hRebinnWMC_binning%d", i),
- Form("Counts MC weights (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1F *hRebinnMirrorWMC = new TH1F(Form("hRebinnMirrorWMC_binning%d", i),
- Form("Counts MC weights (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1F *hRebinn2WMC = new TH1F(Form("hRebinn2WMC_binning%d", i),
- Form("Counts^2 MC weights (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1F *hRebinn2MirrorWMC = new TH1F(Form("hRebinn2MirrorWMC_binning%d", i),
- Form("Counts^2 MC weights (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- TH1F *hRebinnfbWMC = new TH1F(Form("hRebinnfbWMC_binning%d", i),
- Form("Fwd*bwd MC weights (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- fOutputList->Add(hRebinnWESD);
- fOutputList->Add(hRebinnMirrorWESD);
- fOutputList->Add(hRebinn2WESD);
- fOutputList->Add(hRebinn2MirrorWESD);
- fOutputList->Add(hRebinnfbWESD);
-
- fOutputList->Add(hRebinnWMC);
- fOutputList->Add(hRebinnMirrorWMC);
- fOutputList->Add(hRebinn2WMC);
- fOutputList->Add(hRebinn2MirrorWMC);
- fOutputList->Add(hRebinnfbWMC);
-
- // Histograms for the final result
- /*
- TH1D *hBFFcor = new TH1D(Form("hBFFcor_binning%d", i),
- Form("Forward - backward correlations F (%d bins)", nBinsXBF),
- nBinsXBF, 0, fXmax);
- hBFFcor->GetXaxis()->SetTitle("#eta");
- hBFFcor->GetXaxis()->SetTitle("b");
- TH1D *hBFBcor = new TH1D(Form("hBFBcor_binning%d", i),
- Form("Forward - backward correlations B (%d bins)", nBinsXBF),
- nBinsXBF, 0, fXmax);
- hBFBcor->GetXaxis()->SetTitle("#eta");
- hBFBcor->GetXaxis()->SetTitle("b");
-
- TH1D *hBFFcor_MC = new TH1D(Form("hBFFcor_MC_binning%d", i),
- Form("Forward - backward correlations F (%d bins) MC", nBinsXBF),
- nBinsXBF, 0, fXmax);
- hBFFcor_MC->GetXaxis()->SetTitle("#eta");
- hBFFcor_MC->GetXaxis()->SetTitle("b");
- TH1D *hBFBcor_MC = new TH1D(Form("hBFBcor_MC_binning%d", i),
- Form("Forward - backward correlations B (%d bins) MC", nBinsXBF),
- nBinsXBF, 0, fXmax);
- hBFBcor_MC->GetXaxis()->SetTitle("#eta");
- hBFBcor_MC->GetXaxis()->SetTitle("b");
-
- fOutputList->Add(hBFFcor);
- fOutputList->Add(hBFBcor);
- fOutputList->Add(hBFFcor_MC);
- fOutputList->Add(hBFBcor_MC);
- */
-
- // Temporary histogram to avoid new-delete
-
- TH1D* hRebinTemp = new TH1D(Form("hRebinTemp_binning%d", i),
- Form("Temporary histogram (%d bins)", nBinsX),
- nBinsX, fXmin, fXmax);
-
- fInternalList->Add(hRebinTemp);
- }
-}
-
-//_____________________________________________________________________
-void AliFMDAnalysisTaskBFCorrelation::ConnectInputData(Option_t */*option*/)
-{
- if(fStandalone) {
- fInputList = (TList*)GetInputData(0);
- fVertexString = (TObjString*)GetInputData(1);
- }
-}
-
-//_____________________________________________________________________
-void AliFMDAnalysisTaskBFCorrelation::Exec(Option_t */*option*/) {
-
- fEvent++;
- //if (fEvent % 1000 == 0)
- // std::cout << "Event # " << fEvent << std::endl;
-
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
- fVertexString = (TObjString*)fInputList->At(0);
-
- //Int_t vtxbin = fVertexString->GetString().Atoi();
- //if (vtxbin != 5) return;
-
- ProjectAndMirror("ESD");
- CalculateValues("ESD");
-
- if(pars->GetProcessPrimary()) {
-
- ProcessPrimary();
-
- CreateResponseMatrix();
- }
-
-
- if(fStandalone) {
- PostData(0, fOutputList);
- }
-}
-
-//_____________________________________________________________________
-void AliFMDAnalysisTaskBFCorrelation::ProjectAndMirror(TString sType) {
-
- sType.ToUpper();
-
- if (!sType.Contains("ESD") && !sType.Contains("MC")) {
- std::cout << "Wrong type specification for 'ProjectAndMirror'" << std::endl;
- return;
- }
-
- // Get Single Event histograms for storing hits without rebinning
-
- TH1D *hMult = dynamic_cast<TH1D*>(fInternalList->FindObject(Form("hSEMult%s", sType.Data())));
- if(!hMult) {
- AliWarning("no hist - returning");
- return;
- }
- hMult->Reset();
-
- // Create generic names for retrieving histograms
-
- TList *list = 0; // List for getting either ESD or MC "hit map"
-
- TString sEtaPhiMap;
-
- if (sType.Contains("ESD")) {
-
- list = fInputList;
-
- sEtaPhiMap = "dNdetadphiHistogramSPDTrVtx";
- }
-
- if (sType.Contains("MC")) {
-
- list = fInternalList;
-
- sEtaPhiMap = "hEtaPhiParticleMap";
- }
-
- TString sMult("hSERebinMult");
- TString sMultMirror("hSERebinMultMirror");
- TString sMultW("hSERebinMultW");
- TString sMultMirrorW("hSERebinMultMirrorW");
-
- sType += "_binning";
-
- sMult += sType;
- sMultMirror += sType;
- sMultW += sType;
- sMultMirrorW += sType;
-
- // Get the 2D histogram containing the particles of the event being analyzed
-
- TH2F *hEtaPhiMap = dynamic_cast<TH2F*>(list->FindObject(sEtaPhiMap));
-
- TH1D *hProjection = hEtaPhiMap->ProjectionX("hTemporary");
- hMult->Add(hProjection);
-
- // Loop over the 3 binnings
-
- for (Int_t i = 1; i<=4; i++) {
- if (i == 3) continue;
-
- // Project the 2D "hit map" onto the eta-axis and rebin
-
- TH1D *hProjRebin = hEtaPhiMap->ProjectionX("hProjRebin");
- hProjRebin->Rebin(i*5);
-
- // Retrieve the histograms to store the Singe Event information and reset
-
- TH1D *hSEMult = static_cast<TH1D*>(fInternalList->FindObject(Form("%s%d", sMult.Data(), i)));
- hSEMult->Reset();
-
- TH1D *hSEMultMirror = static_cast<TH1D*>(fInternalList->FindObject(Form("%s%d", sMultMirror.Data(), i)));
- hSEMultMirror->Reset();
-
- TH1D *hSEMultW = static_cast<TH1D*>(fInternalList->FindObject(Form("%s%d", sMultW.Data(), i)));
- hSEMultW->Reset();
-
- TH1D *hSEMultMirrorW = static_cast<TH1D*>(fInternalList->FindObject(Form("%s%d", sMultMirrorW.Data(), i)));
- hSEMultMirrorW->Reset();
-
- // Fill the histograms with the Single Event information
-
- hSEMult->Add(hProjRebin);
-
- for (Int_t bin = 1; bin <= hSEMult->GetNbinsX(); bin++) {
-
- hSEMultMirror->SetBinContent(hSEMultMirror->FindBin(-hProjRebin->GetBinCenter(bin)), hProjRebin->GetBinContent(bin));
- hSEMultMirror->SetBinError(hSEMultMirror->FindBin(-hProjRebin->GetBinCenter(bin)), hProjRebin->GetBinError(bin));
-
- // hMultDist->Fill(bin, hMultTemp->GetBinContent(bin));
- }
- hProjRebin->Delete();
- }
-}
-
-//_____________________________________________________________________
-void AliFMDAnalysisTaskBFCorrelation::CalculateValues(TString sType) {
-
- sType.ToUpper();
-
- if (!sType.Contains("ESD") && !sType.Contains("MC")) {
- std::cout << "Wrong type specification for 'CalculateValues'" << std::endl;
- return;
- }
-
- TString sMult("hSERebinMult");
- TString sMultMirror("hSERebinMultMirror");
- // TString_t *sMultW("hSEMultW");
- // TString_t *sMultMirrorW("hSEMultMirrorW");
-
- TString sn("hRebinn");
- TString snMirror("hRebinnMirror");
- TString sn2("hRebinn2");
- TString sn2Mirror("hRebinn2Mirror");
- TString snfb("hRebinnfb");
-
- sType += "_binning";
-
- sMult += sType;
- sMultMirror += sType;
-
- sn += sType;
- snMirror += sType;
- sn2 += sType;
- sn2Mirror += sType;
- snfb += sType;
-
- for (Int_t i = 1; i <= 4; i++) {
- if (i == 3) continue;
-
- TH1D *hSEMult = (TH1D*)fInternalList->FindObject(Form("%s%d", sMult.Data(), i));
- TH1D *hSEMultMirror = (TH1D*)fInternalList->FindObject(Form("%s%d", sMultMirror.Data(), i));
- /*
- TH1D *hSEMultW = (TH1D*)fInternalList->FindObject(Form("%s%d", cMultW, cType, i));
- TH1D *hSEMultMirrorW = (TH1D*)fInternalList->FindObject(Form("%s%d", cMultMirrorW, cType, i));
- */
-
- TH1F *hn = (TH1F*)fOutputList->FindObject(Form("%s%d", sn.Data(), i));
- TH1F *hnMirror = (TH1F*)fOutputList->FindObject(Form("%s%d", snMirror.Data(), i));
- TH1F *hn2 = (TH1F*)fOutputList->FindObject(Form("%s%d", sn2.Data(), i));
- TH1F *hn2Mirror = (TH1F*)fOutputList->FindObject(Form("%s%d", sn2Mirror.Data(), i));
- TH1F *hnfb = (TH1F*)fOutputList->FindObject(Form("%s%d", snfb.Data(), i));
- /*
- TH1F *hnW = (TH1F*)fOutputList->FindObject(Form("%sW%s_binning%d", cn, cType, i));
- TH1F *hnMirrorW = (TH1F*)fOutputList->FindObject(Form("%sW%s_binning%d", cnMirror, cType, i));
- TH1F *hn2W = (TH1F*)fOutputList->FindObject(Form("%sW%s_binning%d", cn2, cType, i));
- TH1F *hn2MirrorW = (TH1F*)fOutputList->FindObject(Form("%sW%s_binning%d", cn2Mirror, cType, i));
- TH1F *hnfbW = (TH1F*)fOutputList->FindObject(Form("%sW%s_binning%d", cnfb, cType, i));
- */
- TH1D *hTemp = (TH1D*)fInternalList->FindObject(Form("hRebinTemp_binning%d", i));
-
- hn->Add(hSEMult);
-
- hnMirror->Add(hSEMultMirror);
-
- hTemp->Reset();
- hTemp->Add(hSEMult);
- hTemp->Multiply(hSEMult);
- hn2->Add(hTemp);
-
- hTemp->Reset();
- hTemp->Add(hSEMultMirror);
- hTemp->Multiply(hSEMultMirror);
- hn2Mirror->Add(hTemp);
-
- hSEMultMirror->Multiply(hSEMult);
- hnfb->Add(hSEMultMirror);
- }
-}
-
-//_____________________________________________________________________
-void AliFMDAnalysisTaskBFCorrelation::MultiplicityVsEta(TString sType) {
-
- sType.ToUpper();
-
- if (!sType.Contains("ESD") && !sType.Contains("MC")) {
- std::cout << "Wrong type specification for 'MultiplicityVsEta'" << std::endl;
- return;
- }
-}
-
-
-//_____________________________________________________________________
-void AliFMDAnalysisTaskBFCorrelation::CreateResponseMatrix() {
-
- TH2F *hResponseMatrix = (TH2F*)fOutputList->FindObject("hResponseMatrix");
-
- TH1D *hSEMultESD = (TH1D*)fInternalList->FindObject("hSEMultESD");
- TH1D *hSEMultMC = (TH1D*)fInternalList->FindObject("hSEMultMC");
-
- Float_t HitsESD = 0;
- Float_t HitsMC = 0;
-
- for (Int_t bin = 1; bin<= fnBinsX; bin++) {
-
- if ((hSEMultMC->GetBinLowEdge(bin) > -3.4) &&
- (hSEMultMC->GetBinLowEdge(bin+1) < 5.)) {
-
- HitsESD += hSEMultESD->GetBinContent(bin);
- HitsMC += hSEMultMC->GetBinContent(bin);
- }
- }
-
- hResponseMatrix->Fill(HitsMC, HitsESD);
-}
-
-//_____________________________________________________________________
-void AliFMDAnalysisTaskBFCorrelation::Terminate(Option_t */*option*/) {
- /*
- std::cout << "Terminating !" << std::endl;
-
- TH1I *hnEvents = (TH1I*)fOutputList->FindObject("nEvents");
- TH1I *hnMCEvents = (TH1I*)fOutputList->FindObject("nEvents");
-
- Int_t nEvents = hnEvents->GetEntries();
- Int_t nMCEvents = hnMCEvents->GetEntries();
-
- for (Int_t i = 1; i <= 4; i++) {
- if (i == 3) continue;
-
- TH1F *hnFnB = (TH1F*)fOutputList->FindObject(Form("hnFnB_binning%d", i));
- TH1F *hnF2 = (TH1F*)fOutputList->FindObject(Form("hnF2_binning%d", i));
- TH1F *hnB2 = (TH1F*)fOutputList->FindObject(Form("hnB2_binning%d", i));
- TH1F *hnF = (TH1F*)fOutputList->FindObject(Form("hnF_binning%d", i));
- TH1F *hnB = (TH1F*)fOutputList->FindObject(Form("hnB_binning%d", i));
-
- TH1F *hnFnB_MC = (TH1F*)fOutputList->FindObject(Form("hnFnB_MC_binning%d", i));
- TH1F *hnF2_MC = (TH1F*)fOutputList->FindObject(Form("hnF2_MC_binning%d", i));
- TH1F *hnB2_MC = (TH1F*)fOutputList->FindObject(Form("hnB2_MC_binning%d", i));
- TH1F *hnF_MC = (TH1F*)fOutputList->FindObject(Form("hnF_MC_binning%d", i));
- TH1F *hnB_MC = (TH1F*)fOutputList->FindObject(Form("hnB_MC_binning%d", i));
-
- hnFnB->Scale(1./Float_t(nEvents));
- hnF2->Scale(1./Float_t(nEvents));
- hnB2->Scale(1./Float_t(nEvents));
- hnF->Scale(1./Float_t(nEvents));
- hnB->Scale(1./Float_t(nEvents));
-
- hnFnB_MC->Scale(1./Float_t(nMCEvents));
- hnF2_MC->Scale(1./Float_t(nMCEvents));
- hnB2_MC->Scale(1./Float_t(nMCEvents));
- hnF_MC->Scale(1./Float_t(nMCEvents));
- hnB_MC->Scale(1./Float_t(nMCEvents));
-
- for (Int_t bin = 1; bin <= hnFnB->GetNbinsX(); bin++) {
-
- Double_t nFnBav = hnFnB->GetBinContent(bin);
- Double_t nF2av = hnF2->GetBinContent(bin);
- Double_t nB2av = hnB2->GetBinContent(bin);
- Double_t nFav = hnF->GetBinContent(bin);
- Double_t nBav = hnB->GetBinContent(bin);
-
- Double_t nFnB_MCav = hnFnB_MC->GetBinContent(bin);
- Double_t nF2_MCav = hnF2_MC->GetBinContent(bin);
- Double_t nB2_MCav = hnB2_MC->GetBinContent(bin);
- Double_t nF_MCav = hnF_MC->GetBinContent(bin);
- Double_t nB_MCav = hnB_MC->GetBinContent(bin);
-
- Double_t bF = ((nF2av-nFav*nFav) == 0 ? 0. : (nFnBav-nFav*nBav)/(nF2av-nFav*nFav));
- Double_t bB = ((nF2av-nFav*nFav) == 0 ? 0. : (nFnBav-nFav*nBav)/(nB2av-nBav*nBav));
-
- Double_t bF_MC = ((nF2_MCav-nF_MCav*nF_MCav) == 0 ? 0. :
- (nFnB_MCav-nF_MCav*nB_MCav)/(nF2_MCav-nF_MCav*nF_MCav));
- Double_t bB_MC = ((nF2_MCav-nF_MCav*nF_MCav) == 0 ? 0. :
- (nFnB_MCav-nF_MCav*nB_MCav)/(nB2_MCav-nB_MCav*nB_MCav));
-
- TH1D *hBFFcor = (TH1D*)fOutputList->FindObject(Form("hBFFcor_binning%d", i));
- TH1D *hBFBcor = (TH1D*)fOutputList->FindObject(Form("hBFBcor_binning%d", i));
- TH1D *hBFFcor_MC = (TH1D*)fOutputList->FindObject(Form("hBFFcor_MC_binning%d", i));
- TH1D *hBFBcor_MC = (TH1D*)fOutputList->FindObject(Form("hBFBcor_MC_binning%d", i));
-
- hBFFcor->SetBinContent(bin, bF);
- hBFBcor->SetBinContent(bin, bB);
- hBFFcor_MC->SetBinContent(bin, bF_MC);
- hBFBcor_MC->SetBinContent(bin, bB_MC);
- }
- }*/
-}
-
-//_____________________________________________________________________
-void AliFMDAnalysisTaskBFCorrelation::ProcessPrimary() {
-
- AliMCEventHandler* eventHandler =
- dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()
- ->GetMCtruthEventHandler());
- if (!eventHandler) return;
-
- 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();
- /*
- AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);
-
- if (!pythiaGenHeader) {
- std::cout<<" no pythia header!"<<std::endl;
- return;
- }
-
- Int_t pythiaType = pythiaGenHeader->ProcessType();
-
- if(pythiaType==92||pythiaType==93){
- std::cout<<"single diffractive"<<std::endl;
- return;
- }
- if(pythiaType==94){
- std::cout<<"double diffractive"<<std::endl;
- return;
- }
- */
- 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;
-
- //if (vertexBin != 5) return;
-
- //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();
-
- TH2F *hEtaPhiParticleMap = (TH2F*)fInternalList->FindObject("hEtaPhiParticleMap");
- hEtaPhiParticleMap->Reset();
-
- for(Int_t i= 0; i < nTracks; i++) {
- particle = (AliMCParticle*) mcEvent->GetTrack(i);
- if(!particle) continue;
-
- if((stack->IsPhysicalPrimary(i)) && (particle->Charge() != 0)) {
- hEtaPhiParticleMap->Fill(particle->Eta(), particle->Phi());
- //std::cout << "Hans er nederen" << std::endl;
- }
- }
- ProjectAndMirror("MC");
- CalculateValues("MC");
-}
-
-//_____________________________________________________________________
-//
-//
-// EOF
+++ /dev/null
-#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 "TH2.h"
-#include "AliMCEvent.h"
-#include "AliFMDFloatMap.h"
-#include "TCanvas.h"
-
-/**
- * Task to do the backward/forward correlation analysis
- *
- * Input:
- * List of histograms from AliFMDAnaysisTaskBackground
- *
- * Output:
- * List of histograms of ...
- *
- * Used correction objects:
- *
- *
- * @ingroup FMD_ana
- */
-class AliFMDAnalysisTaskBFCorrelation : public AliAnalysisTask
-{
-public:
- /**
- * Constructor
- *
- *
- */
- AliFMDAnalysisTaskBFCorrelation();
- /**
- * Constructor
- *
- * @param name Name of task
- * @param SE Whether we're run from SE task
- */
- AliFMDAnalysisTaskBFCorrelation(const char* name, Bool_t SE = kTRUE);
- /**
- * Destructor
- */
- virtual ~AliFMDAnalysisTaskBFCorrelation() {;}
- /**
- * Copy constructor
- *
- * @param o Object to copy from
- */
- AliFMDAnalysisTaskBFCorrelation(const AliFMDAnalysisTaskBFCorrelation& o)
- : AliAnalysisTask(),
- fDebug(o.fDebug),
- fOutputList(0),
- fInputList(0),
- fInternalList(0),
- fVertexString(o.fVertexString),
- fStandalone(o.fStandalone),
- fEvent(0),
- fnBinsX(0),
- fXmin(0),
- fXmax(0),
- fnBinsY(0),
- fYmin(0),
- fYmax(0)
- {}
- /**
- * Assignment operator
- *
- *
- * @return Reference to this.
- */
- AliFMDAnalysisTaskBFCorrelation&
- operator=(const AliFMDAnalysisTaskBFCorrelation&) { return *this; }
- /**
- * @{
- * @name 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;}
- /**
- * @}
- */
- /**
- * Set the input list of histograms
- *
- * @param inputList Input list
- */
- void SetInputList(TList* inputList) {fInputList = inputList;}
- /**
- * Set the input vertex
- *
- * @param vtxString String
- */
- void SetInputVertex(TObjString* vtxString) {fVertexString = vtxString;}
- /**
- * Set the output list
- *
- * @param outputList Output list
- */
- void SetOutputList(TList* outputList) {fOutputList = outputList;}
- /**
- * Project the data, and mirror it.
- *
- * @param sType
- */
- void ProjectAndMirror(TString sType);
- /**
- * Calculate values
- *
- * @param sType
- */
- void CalculateValues(TString sType);
- // void ProjectAndMirror(TString type);
- // void CalculateParameters(TString type);
- /**
- * The multiplicity versus eta
- *
- * @param type
- */
- void MultiplicityVsEta(TString type);
- /**
- * Create the response matrix
- *
- */
- void CreateResponseMatrix();
- /**
- * Process a primary hit
- *
- */
- void ProcessPrimary();
- /**
- * Get the list out out objects
- *
- *
- * @return
- */
- TList* GetOutputList() {return fOutputList;}
-private:
-
- Int_t fDebug; // Debug flag
- TList* fOutputList; // output list
- TList* fInputList; // Input list
- TList* fInternalList; // Internal list
- TObjString* fVertexString; // Vertex string
- Bool_t fStandalone; // Running standalone?
-
- Int_t fEvent; // Event number
- Int_t fnBinsX; // Number of bins
- Float_t fXmin; // Minimum
- Float_t fXmax; // Maximum
- Int_t fnBinsY; // Number of bins
- Float_t fYmin; // Minumum
- Float_t fYmax; // Maximum
-
- ClassDef(AliFMDAnalysisTaskBFCorrelation, 0); // Analysis task for FMD analysis
-};
-
-#endif
-// Local Variables:
-// mode: C++
-// End:
+++ /dev/null
-
-#include <TROOT.h>
-#include <TSystem.h>
-#include <TInterpreter.h>
-#include <TChain.h>
-#include <TFile.h>
-#include <TList.h>
-#include <iostream>
-#include "TH2F.h"
-#include "AliFMDAnalysisTaskBackgroundCorrection.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 "AliESDInputHandler.h"
-#include "AliMultiplicity.h"
-#include "TProfile2D.h"
-//#include "AliFMDGeometry.h"
-
-ClassImp(AliFMDAnalysisTaskBackgroundCorrection)
-
-
-AliFMDAnalysisTaskBackgroundCorrection::AliFMDAnalysisTaskBackgroundCorrection()
-: fDebug(0),
- fOutputList(0),
- fInputList(0),
- fHitList(0),
- fVertexString(0x0),
- fNevents(),
- fStandalone(kTRUE),
- fOutputVertexString(0)
-{
- // Default constructor
- DefineInput (0, TList::Class());
- DefineOutput(0, TList::Class());
-
-}
-//_____________________________________________________________________
-AliFMDAnalysisTaskBackgroundCorrection::AliFMDAnalysisTaskBackgroundCorrection(const char* name, Bool_t SE):
- AliAnalysisTask(name, "Density"),
- fDebug(0),
- fOutputList(0),
- fInputList(0),
- fHitList(0),
- fVertexString(0x0),
- fNevents(),
- fStandalone(kTRUE),
- fOutputVertexString(0)
-{
- fStandalone = SE;
- if(fStandalone) {
- DefineInput (0, TList::Class());
- DefineOutput(0, TList::Class());
- }
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskBackgroundCorrection::CreateOutputObjects()
-{
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
- if(!fOutputList)
- fOutputList = new TList();
- fOutputList->SetName("BackgroundCorrectedPerEvent");
- if(!fHitList)
- fHitList = new TList();
- fHitList->SetName("HitsList");
-
- //if(fStandalone) {
- fOutputVertexString = new TObjString();
- // }
- fOutputList->Add(fOutputVertexString);
-
-
-
- TH2F* hMult = 0;
- TH2F* hMultTrVtx = 0;
- TH2F* hMultNSD = 0;
- TH2F* hHits = 0;
- TH2F* hSPDMult = 0;
- TH2F* hSPDMultTrVtx = 0;
- TH2F* hSPDMultNSD = 0;
- // TH2F* hHitsNoCuts = 0;
- Int_t nVtxbins = pars->GetNvtxBins();
- for(Int_t i = 0; i< nVtxbins; i++) {
- for(Int_t det =1; det<=3;det++)
- {
- Int_t nRings = (det==1 ? 1 : 2);
- for(Int_t ring = 0;ring<nRings;ring++)
- {
- Char_t ringChar = (ring == 0 ? 'I' : 'O');
- Int_t nSec = (ring == 0 ? 20 : 40);
-
-
- TH2F* hBg = pars->GetBackgroundCorrection(det, ringChar, i);
- hMult = new TH2F(Form("mult_FMD%d%c_vtxbin%d",det,ringChar,i),Form("mult_FMD%d%c_vtxbin%d",det,ringChar,i),
- hBg->GetNbinsX(),
- hBg->GetXaxis()->GetXmin(),
- hBg->GetXaxis()->GetXmax(),
- nSec, 0, 2*TMath::Pi());
- hMult->Sumw2();
- fOutputList->Add(hMult);
- hMultTrVtx = new TH2F(Form("multTrVtx_FMD%d%c_vtxbin%d",det,ringChar,i),Form("multTrVtx_FMD%d%c_vtxbin%d",det,ringChar,i),
- hBg->GetNbinsX(),
- hBg->GetXaxis()->GetXmin(),
- hBg->GetXaxis()->GetXmax(),
- nSec, 0, 2*TMath::Pi());
- hMultTrVtx->Sumw2();
-
- fOutputList->Add(hMultTrVtx);
-
- hMultNSD = new TH2F(Form("multNSD_FMD%d%c_vtxbin%d",det,ringChar,i),Form("multNSD_FMD%d%c_vtxbin%d",det,ringChar,i),
- hBg->GetNbinsX(),
- hBg->GetXaxis()->GetXmin(),
- hBg->GetXaxis()->GetXmax(),
- nSec, 0, 2*TMath::Pi());
- hMultNSD->Sumw2();
-
- fOutputList->Add(hMultNSD);
-
- hHits = new TH2F(Form("hits_FMD%d%c_vtxbin%d",det,ringChar,i),Form("hits_FMD%d%c_vtxbin%d",det,ringChar,i),
- hBg->GetNbinsX(),
- hBg->GetXaxis()->GetXmin(),
- hBg->GetXaxis()->GetXmax(),
- nSec, 0, 2*TMath::Pi());
-
- /* hHitsNoCuts = new TH2F(Form("hits_NoCuts_FMD%d%c_vtxbin%d",det,ringChar,i),Form("hits_NoCuts_FMD%d%c_vtxbin%d",det,ringChar,i),
- hBg->GetNbinsX(),
- hBg->GetXaxis()->GetXmin(),
- hBg->GetXaxis()->GetXmax(),
- nSec, 0, 2*TMath::Pi());
-
- */
- hHits->Sumw2();
- fHitList->Add(hHits);
-
- }
- }
- //HHD SPD hists
- TH2F* hBg = pars->GetBackgroundCorrection(1, 'I', i);
- hSPDMult = new TH2F(Form("mult_SPD_vtxbin%d",i),Form("mult_SPD_vtxbin%d",i),
- hBg->GetNbinsX(),
- hBg->GetXaxis()->GetXmin(),
- hBg->GetXaxis()->GetXmax(),
- 20, 0, 2*TMath::Pi());
- hSPDMult->Sumw2();
- fOutputList->Add(hSPDMult);
- hSPDMultTrVtx = new TH2F(Form("multTrVtx_SPD_vtxbin%d",i),Form("multTrVtx_SPD_vtxbin%d",i),
- hBg->GetNbinsX(),
- hBg->GetXaxis()->GetXmin(),
- hBg->GetXaxis()->GetXmax(),
- 20, 0, 2*TMath::Pi());
- hSPDMultTrVtx->Sumw2();
- fOutputList->Add(hSPDMultTrVtx);
- hSPDMultNSD = new TH2F(Form("multNSD_SPD_vtxbin%d",i),Form("multNSD_SPD_vtxbin%d",i),
- hBg->GetNbinsX(),
- hBg->GetXaxis()->GetXmin(),
- hBg->GetXaxis()->GetXmax(),
- 20, 0, 2*TMath::Pi());
- hSPDMultNSD->Sumw2();
- fOutputList->Add(hSPDMultNSD);
-
-
- }
- TH2F* hBg = pars->GetBackgroundCorrection(1, 'I', 5);
- TH2F* dNdetadphiHistogram = new TH2F("dNdetadphiHistogramTrVtx","dNdetadphiHistogramTrVtx;#eta;#Phi",pars->GetNetaBins(),hBg->GetXaxis()->GetXmin(),hBg->GetXaxis()->GetXmax(),20,0,2*TMath::Pi());
- TH2F* dNdetadphiHistogramSPD = new TH2F("dNdetadphiHistogramSPDTrVtx","dNdetadphiHistogramSPDTrVtx;#eta;#Phi",pars->GetNetaBins(),hBg->GetXaxis()->GetXmin(),hBg->GetXaxis()->GetXmax(),20,0,2*TMath::Pi());
- //dNdetadphiHistogram->SetErrorOption("g");
-
- fHitList->Add(dNdetadphiHistogram);
- fOutputList->Add(dNdetadphiHistogram);
- fHitList->Add(dNdetadphiHistogramSPD);
- fOutputList->Add(dNdetadphiHistogramSPD);
-
-
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskBackgroundCorrection::ConnectInputData(Option_t */*option*/)
-{
- if(fStandalone) {
- fInputList = (TList*)GetInputData(0);
-
- }
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskBackgroundCorrection::Exec(Option_t */*option*/)
-{
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
- fVertexString = (TObjString*)fInputList->At(0);
-
- Int_t vtxbin = fVertexString->GetString().Atoi();
- fOutputVertexString->SetString(Form("%d",vtxbin));
-
- fNevents.Fill(vtxbin);
- //Reset everything
- 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* hMult = (TH2F*)fOutputList->FindObject(Form("mult_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
- hMult->Reset();
- TH2F* hMultTrVtx = (TH2F*)fOutputList->FindObject(Form("multTrVtx_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
- hMultTrVtx->Reset();
- TH2F* hMultNSD = (TH2F*)fOutputList->FindObject(Form("multNSD_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
- hMultNSD->Reset();
-
- TH2F* hSPDMult = (TH2F*)fOutputList->FindObject(Form("mult_SPD_vtxbin%d",vtxbin));
- hSPDMult->Reset();
- TH2F* hSPDMultTrVtx = (TH2F*)fOutputList->FindObject(Form("multTrVtx_SPD_vtxbin%d",vtxbin));
- hSPDMultTrVtx->Reset();
- TH2F* hSPDMultNSD = (TH2F*)fOutputList->FindObject(Form("multNSD_SPD_vtxbin%d",vtxbin));
- hSPDMultNSD->Reset();
- }
-
- }
-
-
- Bool_t nsd = pars->IsEventTriggered(AliFMDAnaParameters::kNSD);
- 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* hMult = (TH2F*)fOutputList->FindObject(Form("mult_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
- TH2F* hMultTrVtx = (TH2F*)fOutputList->FindObject(Form("multTrVtx_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
- TH2F* hMultNSD = (TH2F*)fOutputList->FindObject(Form("multNSD_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
- TH2F* hMultInput = (TH2F*)fInputList->FindObject(Form("FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
- TH2F* hHits = (TH2F*)fHitList->FindObject(Form("hits_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
-
- //if(pars->GetProcessHits())
- hHits->Add(hMultInput);
-
- TH2F* hBg = pars->GetBackgroundCorrection(det, ringChar, vtxbin);
- TH2F* hBgNSD = pars->GetBackgroundCorrectionNSD(det, ringChar, vtxbin);
- hMult->Add(hMultInput);
- hMultTrVtx->Add(hMultInput);
-
- hMult->Divide(hBg);//,"B");
- hMultTrVtx->Divide(hBg);//,"B");
-
- if(nsd) {
- hMultNSD->Add(hMultInput);
- hMultNSD->Divide(hBgNSD);
- }
-
- //sharing efficiency correction ?
- if(pars->SharingEffPresent()) {
- TH1F* hSharingEff = pars->GetSharingEfficiencyTrVtx(det,ringChar,vtxbin);
- TH1F* hSharingEffTrVtx = pars->GetSharingEfficiencyTrVtx(det,ringChar,vtxbin);
-
- for(Int_t nx=1; nx<=hMult->GetNbinsX(); nx++) {
- Float_t correction = hSharingEff->GetBinContent(nx);
- Float_t correctionTrVtx = hSharingEffTrVtx->GetBinContent(nx);
- //FIXME : This should be for NSD events
- Float_t correctionNSD = hSharingEff->GetBinContent(nx);
-
- for(Int_t ny=1; ny<=hMult->GetNbinsY(); ny++) {
-
- if(correction != 0){
- hMult->SetBinContent(nx,ny,hMult->GetBinContent(nx,ny)/correction);
- Float_t error = TMath::Sqrt(TMath::Power(hMult->GetBinError(nx,ny),2) + TMath::Power(hMult->GetBinContent(nx,ny)*hSharingEff->GetBinError(nx),2)) / correction;
- hMult->SetBinError(nx,ny,error);
- }
- if(correctionTrVtx != 0){
- hMultTrVtx->SetBinContent(nx,ny,hMultTrVtx->GetBinContent(nx,ny)/correctionTrVtx);
- Float_t error = TMath::Sqrt(TMath::Power(hMultTrVtx->GetBinError(nx,ny),2) + TMath::Power(hMultTrVtx->GetBinContent(nx,ny)*hSharingEffTrVtx->GetBinError(nx),2)) / correctionTrVtx;
- hMultTrVtx->SetBinError(nx,ny,error);
- }
- if(correctionNSD != 0 && nsd) {
- hMultNSD->SetBinContent(nx,ny,hMultNSD->GetBinContent(nx,ny)/correctionNSD);
- Float_t error = TMath::Sqrt(TMath::Power(hMultNSD->GetBinError(nx,ny),2) + TMath::Power(hMultNSD->GetBinContent(nx,ny)*hSharingEff->GetBinError(nx),2)) / correctionNSD;
- hMultNSD->SetBinError(nx,ny,error);
- }
-
-
- }
-
- }
- }
-
- // if(pars->GetEventSelectionEfficiency(vtxbin) > 0)
- // hMult->Scale(1/pars->GetEventSelectionEfficiency(vtxbin));
- //else
- // hMult->Scale(0);
- hMult->Divide(pars->GetEventSelectionEfficiency("INEL",vtxbin,ringChar));
- hMultNSD->Divide(pars->GetEventSelectionEfficiency("NSD",vtxbin,ringChar));
-
-
- }
- }
-
- //HHD SPD code
-
- TH2F* hSPDMult = (TH2F*)fOutputList->FindObject(Form("mult_SPD_vtxbin%d",vtxbin));
- TH2F* hSPDMultTrVtx = (TH2F*)fOutputList->FindObject(Form("multTrVtx_SPD_vtxbin%d",vtxbin));
- TH2F* hSPDMultNSD = (TH2F*)fOutputList->FindObject(Form("multNSD_SPD_vtxbin%d",vtxbin));
-
- AliESDInputHandler* eventHandler =
- dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()
- ->GetInputEventHandler());
- if (!eventHandler) return;
-
- AliESDEvent* esd = eventHandler->GetEvent();
-
- const AliMultiplicity* spdmult = esd->GetMultiplicity();
- for(Int_t j = 0; j< spdmult->GetNumberOfTracklets();j++) {
- hSPDMult->Fill(spdmult->GetEta(j),spdmult->GetPhi(j));
- hSPDMultTrVtx->Fill(spdmult->GetEta(j),spdmult->GetPhi(j));
- hSPDMultNSD->Fill(spdmult->GetEta(j),spdmult->GetPhi(j));
- }
- for(Int_t j = 0; j< spdmult->GetNumberOfSingleClusters();j++) {
- hSPDMult->Fill(-TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)),spdmult->GetPhiSingle(j));
- hSPDMultTrVtx->Fill(-TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)),spdmult->GetPhiSingle(j));
- hSPDMultNSD->Fill(-TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)),spdmult->GetPhiSingle(j));
- }
-
- TH2F* hBgSPD = pars->GetBackgroundCorrection(0, 'Q', vtxbin);
- if(hBgSPD) {
-
- hSPDMult->Divide(hBgSPD);
- hSPDMultTrVtx->Divide(hBgSPD);
- hSPDMultNSD->Divide(hBgSPD);
-
- TH1F* hDead = pars->GetSPDDeadCorrection(vtxbin);
- for(Int_t i=1; i<=hSPDMult->GetNbinsX(); i++) {
- for(Int_t j=1; j<=hSPDMult->GetNbinsY(); j++) {
- Float_t mult = hSPDMult->GetBinContent(i,j);
- Float_t correction = hBgSPD->GetBinContent(i,j);
- Float_t correctedMult = 0;
- Float_t correctedError = 0;
-
-
- if( mult > 0 && correction > 0.) {
- correctedMult = mult;///correction;
- //std::cout<<correction<<" "<<hSPDMult->GetXaxis()->GetBinCenter(i)<<std::endl;
- // correctedMult = mult/correction;
-
- if(hDead->GetBinContent(i) > 0)
- correctedMult = correctedMult/hDead->GetBinContent(i);
- correctedError = correctedMult*TMath::Sqrt( TMath::Power(hSPDMult->GetBinError(i,j)/hSPDMult->GetBinContent(i,j),2) +
- TMath::Power(hBgSPD->GetBinError(i,j)/hBgSPD->GetBinContent(i,j),2));
-
- }
-
- if(correctedMult > 0) {
- hSPDMult->SetBinContent(i,j,correctedMult);
- hSPDMultTrVtx->SetBinContent(i,j,correctedMult);
- hSPDMult->SetBinError(i,j,correctedError);
- hSPDMultTrVtx->SetBinError(i,j,correctedError);
- if(nsd) {
- hSPDMultNSD->SetBinContent(i,j,correctedMult);
- hSPDMultNSD->SetBinError(i,j,correctedError);
- }
-
- }
- }
- }
- hSPDMult->Divide(pars->GetEventSelectionEfficiency("INEL",vtxbin,'I'));
- hSPDMultNSD->Divide(pars->GetEventSelectionEfficiency("NSD",vtxbin,'I'));
- }
- else
- AliWarning("No SPD background map found");
-
- //std::cout<<spdmult->GetNumberOfTracklets()<<" "<<spdmult->GetNumberOfITSClusters(0)<<" "<< spdmult->GetNumberOfSingleClusters()<<std::endl;
-
- CreatePerEventHistogram(vtxbin);
-
- if(fStandalone) {
- PostData(0, fOutputList);
- }
-
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskBackgroundCorrection::Terminate(Option_t */*option*/) {
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
- Int_t nVtxbins = pars->GetNvtxBins();
-
- 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');
- for(Int_t i =0; i<nVtxbins; i++) {
- TH2F* hHits = (TH2F*)fHitList->FindObject(Form("hits_FMD%d%c_vtxbin%d",det,ringChar,i));
- TH1D* hHitsproj = hHits->ProjectionX(Form("hits_FMD%d%c_vtxbin%d_proj",det,ringChar,i),1,hHits->GetNbinsY());
- TH1D* hHitsNoCuts = (TH1D*)hHitsproj->Clone(Form("hits_NoCuts_FMD%d%c_vtxbin%d_proj",det,ringChar,i));
- if(pars->GetEventSelectionEfficiency(i) > 0)
- hHitsNoCuts->Scale(1/pars->GetEventSelectionEfficiency(i));
- else
- hHitsNoCuts->Scale(0);
- fHitList->Add(hHitsproj);
- fHitList->Add(hHitsNoCuts);
-
- }
- }
- }
-}
-
-//_____________________________________________________________________
-void AliFMDAnalysisTaskBackgroundCorrection::CreatePerEventHistogram(Int_t vtxbin) {
-
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- TH2F* dNdetadphiHistogram = (TH2F*)fHitList->FindObject("dNdetadphiHistogramTrVtx");
- TH2F* dNdetadphiHistogramSPD = (TH2F*)fHitList->FindObject("dNdetadphiHistogramSPDTrVtx");
-
- dNdetadphiHistogram->Reset();
- dNdetadphiHistogramSPD->Reset();
-
- for(Int_t det = 0; det<=3; det++) {
- Int_t maxRing = (det<= 1 ? 0 : 1);
-
-
-
- for(Int_t ring = 0;ring<=maxRing;ring++) {
-
- Char_t ringChar = (ring == 0 ? 'I' : 'O');
-
- TH2F* multhistoriginal = 0;
-
- if(det == 0)
- multhistoriginal = (TH2F*)fOutputList->FindObject(Form("multTrVtx_SPD_vtxbin%d",vtxbin));
- else
- multhistoriginal = (TH2F*)fOutputList->FindObject(Form("multTrVtx_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
-
- TH2F* multhist = (TH2F*)multhistoriginal->Clone("tmp");
-
-
-
- if(ringChar == 'O' && det > 0)
- multhist->RebinY(2);
-
- for(Int_t i=pars->GetFirstEtaBinToInclude(vtxbin,det,ringChar); i<=pars->GetLastEtaBinToInclude(vtxbin,det,ringChar); i++) {
- for(Int_t j=1; j<=multhist->GetNbinsY(); j++) {
- if(multhist->GetBinContent(i,j) < 0.0001) continue;
-
- Bool_t overlapFMD = kFALSE;
- Bool_t overlapSPD = kFALSE;
-
- if(det == 1 && ringChar =='I')
- if(i<=pars->GetLastEtaBinToInclude(vtxbin,2,'I'))
- overlapFMD = kTRUE;
-
- if(det == 2 && ringChar =='O') {
- if(i>=pars->GetFirstEtaBinToInclude(vtxbin,2,'I'))
- overlapFMD = kTRUE;
- if(i<=pars->GetLastEtaBinToInclude(vtxbin,0,'I'))// && TMath::Abs(multhist->GetXaxis()->GetBinCenter(i)) < 2)
- overlapSPD = kTRUE;
- }
- if(det == 2 && ringChar =='I')
- if(i<=pars->GetLastEtaBinToInclude(vtxbin,2,'O') || i>=pars->GetFirstEtaBinToInclude(vtxbin,1,'I'))
- overlapFMD = kTRUE;
-
- if(det == 3 && ringChar =='I')
- if(i>=pars->GetFirstEtaBinToInclude(vtxbin,3,'O'))
- overlapFMD = kTRUE;
-
- if(det == 3 && ringChar =='O') {
- if(i<=pars->GetLastEtaBinToInclude(vtxbin,3,'I'))
- overlapFMD = kTRUE;
- if(i>=pars->GetFirstEtaBinToInclude(vtxbin,0,'I'))// && TMath::Abs(multhist->GetXaxis()->GetBinCenter(i)) < 2)
- overlapSPD = kTRUE;
- }
-
- if(det == 0) {
- if(i<=pars->GetLastEtaBinToInclude(vtxbin,3,'O') || i>=pars->GetFirstEtaBinToInclude(vtxbin,2,'O'))
- overlapSPD = kTRUE;
- }
- //std::cout<<overlapFMD<<" "<<overlapSPD<<std::endl;
-
-
- if(det > 0) {
- if(overlapFMD) {
- dNdetadphiHistogram->SetBinContent(i,j,dNdetadphiHistogram->GetBinContent(i,j)+0.5*multhist->GetBinContent(i,j));
- dNdetadphiHistogram->SetBinError(i,j,TMath::Sqrt(TMath::Power(dNdetadphiHistogram->GetBinError(i,j),2)+TMath::Power(0.5*multhist->GetBinError(i,j),2)));
- }
- else {
- dNdetadphiHistogram->SetBinContent(i,j,multhist->GetBinContent(i,j));
- dNdetadphiHistogram->SetBinError(i,j,multhist->GetBinError(i,j));
- }
- }
-
- if( overlapFMD && overlapSPD) {
- dNdetadphiHistogramSPD->SetBinContent(i,j,dNdetadphiHistogramSPD->GetBinContent(i,j)+0.33*multhist->GetBinContent(i,j));
- dNdetadphiHistogramSPD->SetBinError(i,j,TMath::Sqrt(TMath::Power(dNdetadphiHistogramSPD->GetBinError(i,j),2)+TMath::Power(0.33*multhist->GetBinError(i,j),2)));
- }
- else if( overlapFMD || overlapSPD) {
- dNdetadphiHistogramSPD->SetBinContent(i,j,dNdetadphiHistogramSPD->GetBinContent(i,j)+0.5*multhist->GetBinContent(i,j));
- dNdetadphiHistogramSPD->SetBinError(i,j,TMath::Sqrt(TMath::Power(dNdetadphiHistogramSPD->GetBinError(i,j),2)+TMath::Power(0.5*multhist->GetBinError(i,j),2)));
- }
- else {
- dNdetadphiHistogramSPD->SetBinContent(i,j,multhist->GetBinContent(i,j));
- dNdetadphiHistogramSPD->SetBinError(i,j,multhist->GetBinError(i,j));
- }
-
-
-
-
-
- }
- }
- delete multhist;
- }
- }
-}
-//_____________________________________________________________________
-//
-//
-// EOF
+++ /dev/null
-#ifndef ALIFMDANALYSISTASKBACKGROUNDCORRECTION_H
-#define ALIFMDANALYSISTASKBACKGROUNDCORRECTION_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"
-
-/**
- * @ingroup FMD_ana
- * @brief Applu the background correction
- * particles.
- *
- */
-class AliFMDAnalysisTaskBackgroundCorrection : public AliAnalysisTask
-{
- public:
- AliFMDAnalysisTaskBackgroundCorrection();
- AliFMDAnalysisTaskBackgroundCorrection(const char* name, Bool_t SE = kTRUE);
- virtual ~AliFMDAnalysisTaskBackgroundCorrection() {;}
- AliFMDAnalysisTaskBackgroundCorrection(const AliFMDAnalysisTaskBackgroundCorrection& o) : AliAnalysisTask(),
- fDebug(o.fDebug),
- fOutputList(0),
- fInputList(0),
- fHitList(0),
- fVertexString(o.fVertexString),
- fNevents(o.fNevents),
- fStandalone(o.fStandalone),
- fOutputVertexString(o.fOutputVertexString) {}
- AliFMDAnalysisTaskBackgroundCorrection& operator=(const AliFMDAnalysisTaskBackgroundCorrection&) { 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 SetOutputVertex(TObjString* vtxString) {fOutputVertexString = vtxString;}
- //void SetInputVtx(TObjString* vtxString) {fVertexString = vtxString;}
- void SetOutputList(TList* outputList) {fOutputList = outputList;}
- void SetHitList(TList* hitList) {fHitList = hitList;}
- void CreatePerEventHistogram(Int_t vtxbin);
- private:
- Int_t fDebug; // Debug flag
- TList* fOutputList;
- TList* fInputList;
- TList* fHitList;
- TObjString* fVertexString;
- TH1I fNevents;
- Bool_t fStandalone;
- TObjString* fOutputVertexString;
- ClassDef(AliFMDAnalysisTaskBackgroundCorrection, 0); // Analysis task for FMD analysis
-};
-
-#endif
-// Local Variables:
-// mode: C++
-// End:
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-/* $Id:$ */
-
-///////////////////////////////////////////////////////////////////////////////
-// //
-// Here some comments on what this task does //
-
-#include <TChain.h>
-#include <TF1.h>
-#include <TFile.h>
-#include <TInterpreter.h>
-#include <TList.h>
-#include <TMath.h>
-#include <TROOT.h>
-#include <TSystem.h>
-#include <iostream>
-
-#include "AliFMDAnalysisTaskCollector.h"
-#include "AliAnalysisManager.h"
-#include "AliESDFMD.h"
-#include "AliESDEvent.h"
-#include "AliAODEvent.h"
-#include "AliAODHandler.h"
-#include "AliMCEventHandler.h"
-#include "AliStack.h"
-#include "AliMultiplicity.h"
-#include "AliESDVertex.h"
-#include "AliFMDAnaParameters.h"
-#include "AliFMDAnaCalibBackgroundCorrection.h"
-#include "AliFMDAnaCalibEnergyDistribution.h"
-#include "AliFMDAnaCalibEventSelectionEfficiency.h"
-#include "AliFMDAnaCalibSharingEfficiency.h"
-
-//#include "AliFMDGeometry.h"
-
-
-ClassImp(AliFMDAnalysisTaskCollector)
-
-//____________________________________________________________________
-Double_t AliFMDAnalysisTaskCollector::TripleLandau(const Double_t *x, Double_t *par) {
- //A convolution of three landaus to fit three MIP peaks
-
- Double_t energy = x[0];
- Double_t constant = par[0];
- Double_t mpv = par[1];
- Double_t sigma = par[2];
- Double_t alpha = par[3];
- Double_t beta = par[4];
-
- Double_t f = constant*(TMath::Landau(energy,mpv,sigma,kTRUE)+
- alpha*TMath::Landau(energy,2*mpv+2*sigma*TMath::Log(2),2*sigma,kTRUE)+
- beta*TMath::Landau(energy,3*mpv+3*sigma*TMath::Log(3),3*sigma,kTRUE) );
-
- return f;
-}
-//____________________________________________________________________
-
-AliFMDAnalysisTaskCollector::AliFMDAnalysisTaskCollector()
- : //fDebug(0),
- fOutputList(0),
- fArray(0),
- fZvtxDist(0),
- fEvents(0),
- fEmptyEvents(0),
- fClusters(0),
- fClustersEmpty(0),
- fFirstEvent(kTRUE),
- fParam(0)
-{
- // Default constructor
-
-
-}
-//____________________________________________________________________
-AliFMDAnalysisTaskCollector::AliFMDAnalysisTaskCollector(const char* name):
- AliAnalysisTaskSE(name),
- //fDebug(0),
- fOutputList(0),
- fArray(0),
- fZvtxDist(0),
- fEvents(0),
- fEmptyEvents(0),
- fClusters(0),
- fClustersEmpty(0),
- fFirstEvent(kTRUE),
- fParam(0)
-{
- // Default constructor
-
- DefineOutput(1, TList::Class());
- fParam = AliFMDAnaParameters::Instance();
-}
-//____________________________________________________________________
-void AliFMDAnalysisTaskCollector::UserCreateOutputObjects()
-{
- // Create the output container
- printf("AnalysisTaskFMD::CreateOutPutData() \n");
- fFirstEvent = kTRUE;
- fOutputList = new TList();//(TList*)GetOutputData(0);
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
- fArray = new TObjArray();
- fArray->SetName("FMD");
- fArray->SetOwner();
- TH1F* hEdist = 0;
- TH1F* hEmptyEdist = 0;
- TH1F* hRingEdist = 0;
- for(Int_t nEta = 0; nEta < pars->GetNetaBins(); nEta++) {
- TObjArray* etaArray = new TObjArray();
- fArray->AddAtAndExpand(etaArray,nEta);
- for(Int_t det =1; det<=3;det++)
- {
- TObjArray* detArray = new TObjArray();
- detArray->SetName(Form("FMD%d",det));
- etaArray->AddAtAndExpand(detArray,det);
- Int_t nRings = (det==1 ? 1 : 2);
- for(Int_t ring = 0;ring<nRings;ring++)
- {
- Char_t ringChar = (ring == 0 ? 'I' : 'O');
- hEdist = new TH1F(Form("FMD%d%c_etabin%d",det,ringChar,nEta),Form("FMD%d%c_etabin%d",det,ringChar,nEta),200,0,6);
- hEdist->SetXTitle("#Delta E / E_{MIP}");
- fOutputList->Add(hEdist);
- detArray->AddAtAndExpand(hEdist,ring);
-
- }
- }
-
- }
-
- for(Int_t det =1; det<=3;det++)
- {
- Int_t nRings = (det==1 ? 1 : 2);
- for(Int_t ring = 0;ring<nRings;ring++)
- {
- Char_t ringChar = (ring == 0 ? 'I' : 'O');
- hRingEdist = new TH1F(Form("ringFMD%d%c",det,ringChar),Form("ringFMD%d%c",det,ringChar),200,0,6);
- hRingEdist->SetXTitle("#Delta E / E_{MIP}");
- fOutputList->Add(hRingEdist);
- hEmptyEdist = new TH1F(Form("emptyFMD%d%c",det,ringChar),Form("emptyFMD%d%c",det,ringChar),200,0,6);
- hEmptyEdist->SetXTitle("#Delta E / E_{MIP}");
- fOutputList->Add(hEmptyEdist);
-
- }
- }
- fZvtxDist = new TH1F("ZvtxDist","Vertex distribution",100,-30,30);
- fZvtxDist->SetXTitle("z vertex");
- fOutputList->Add(fZvtxDist);
-}
-
-//____________________________________________________________________
-void AliFMDAnalysisTaskCollector::UserExec(Option_t */*option*/)
-{
- //Collect data for fitting
- AliESDEvent* esd = (AliESDEvent*)InputEvent();
- AliESD* old = esd->GetAliESDOld();
- if (old) {
- esd->CopyFromOldESD();
- }
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- pars->SetTriggerStatus(esd);
- if (fFirstEvent) {
- pars->SetParametersFromESD(esd);
- pars->PrintStatus();
- fFirstEvent = kFALSE;
- }
-
- TString triggers = esd->GetFiredTriggerClasses();
- //if(!triggers.IsNull()) return;
- //Bool_t trigger = pars->IsEventTriggered(esd);
-
- Bool_t physics = pars->IsEventTriggered(AliFMDAnaParameters::kMB1);
- Bool_t empty = pars->IsEventTriggered(AliFMDAnaParameters::kEMPTY);
- //std::cout<<physics<<" "<<empty<<std::endl;
- //if(!trigger)
- // physics = kFALSE;
- Double_t vertex[3] ={0,0,0};
-
- Bool_t vtxStatus = pars->GetVertex(esd,vertex);
-
- if(!vtxStatus)
- physics = kFALSE;
-
- if(physics) {
- fZvtxDist->Fill(vertex[2]);
- if(TMath::Abs(vertex[2]) > pars->GetVtxCutZ())
- physics = kFALSE;
- }
- //std::cout<<"Bananer "<<vtxStatus<<" "<<physics<<std::endl;
- AliESDFMD* fmd = esd->GetFMDData();
- if (!fmd) return;
- if(physics)
- fEvents++;
- else if(empty)
- fEmptyEvents++;
-
- if(!physics && !empty)
- return;
-
- const AliMultiplicity* spdMult = esd->GetMultiplicity();
- if(physics)
- fClusters+= (spdMult->GetNumberOfSingleClusters() + spdMult->GetNumberOfTracklets());
-
- if(empty)
- fClustersEmpty+= (spdMult->GetNumberOfSingleClusters() + spdMult->GetNumberOfTracklets());
-
- if(empty)
- std::cout<<spdMult->GetNumberOfSingleClusters()<<" "<<spdMult->GetNumberOfTracklets()<<std::endl;
-
- TH1F* edist = 0;
- TH1F* emptyEdist = 0;
- TH1F* ringEdist = 0;
- 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 ring = (ir == 0 ? 'I' : 'O');
- emptyEdist = (TH1F*)fOutputList->FindObject(Form("emptyFMD%d%c",det,ring));
- ringEdist = (TH1F*)fOutputList->FindObject(Form("ringFMD%d%c",det,ring));
- UShort_t nsec = (ir == 0 ? 20 : 40);
- UShort_t nstr = (ir == 0 ? 512 : 256);
-
- for(UShort_t sec =0; sec < nsec; sec++) {
- for(UShort_t strip = 0; strip < nstr; strip++) {
-
-
- Float_t mult = fmd->Multiplicity(det,ring,sec,strip);
- if(mult == AliESDFMD::kInvalidMult || mult == 0) continue;
-
- Float_t eta = pars->GetEtaFromStrip(det,ring,sec,strip,vertex[2]);
-
- Int_t nEta = pars->GetEtaBin(eta);
-
- // std::cout<<det<<" "<<ring<<" "<<sec<<" "<<strip<<" "<<vertex[2]<<" "<<eta<<" "<<nEta<<std::endl;
- if(physics) {
- edist = (TH1F*)fOutputList->FindObject(Form("FMD%d%c_etabin%d",det,ring,nEta));
- edist->Fill(mult);
- ringEdist->Fill(mult);
- }
- else if(empty) {
- emptyEdist->Fill(mult);
-
- }
- else {
- AliWarning("Something is wrong - wrong trigger");
- continue;
- }
-
-
- }
- }
- }
-
- PostData(1, fOutputList);
-
- }
-}
-//____________________________________________________________________
-
-void AliFMDAnalysisTaskCollector::Terminate(Option_t */*option*/) {
- //Terminate
-
- std::cout<<"Analysed "<<fEvents<<" events and "<<fEmptyEvents<<" empty"<<std::endl;
- std::cout<<fClusters / fEvents << " clusters per physics event and "<<fClustersEmpty / fEmptyEvents<< " clusters per empty event"<<std::endl;
-
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
-
- for(Int_t det = 1; det<=3; det++) {
- Int_t nRings = (det == 1 ? 1 : 2);
- for(Int_t ring = 0;ring<nRings; ring++) {
-
- Char_t ringChar = (ring == 0 ? 'I' : 'O');
- TH1F* hRingEdist = (TH1F*)fOutputList->FindObject(Form("ringFMD%d%c",det,ringChar));
- TH1F* hEmptyEdist = (TH1F*)fOutputList->FindObject(Form("emptyFMD%d%c",det,ringChar));
- if(fEmptyEvents)
- hEmptyEdist->Scale(1./(Float_t)fEmptyEvents);
-
- if(fEvents)
- hRingEdist->Scale(1./(Float_t)fEvents);
- for(Int_t nEta = 0; nEta < pars->GetNetaBins(); nEta++) {
- TH1F* hEdist = (TH1F*)fOutputList->FindObject(Form("FMD%d%c_etabin%d",det,ringChar,nEta));
- if(fEvents)
- hEdist->Scale(1./(Float_t)fEvents);
-
-
- }
- }
- }
-
-}
-//____________________________________________________________________
-void AliFMDAnalysisTaskCollector::ReadFromFile(const Char_t* filename, Bool_t store, Int_t speciesOption) {
-
- //speciesOption:
- //0: p+p Landau fit
- //1: Pb+Pb triple landau convolution fit
-
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- //pars->Init(kTRUE,AliFMDAnaParameters::kBackgroundCorrection);
-
- TFile fin(filename,"UPDATE");
-
- TList* list = (TList*)fin.Get("energyDist");
-
- AliFMDAnaCalibEnergyDistribution* energyDist = new AliFMDAnaCalibEnergyDistribution();
-
- energyDist->SetNetaBins(pars->GetNetaBins());
- energyDist->SetEtaLimits(pars->GetEtaMin(),pars->GetEtaMax());
-
- TF1* fitFunc = 0;
-
- for(Int_t det = 1; det<=3; det++) {
- Int_t nRings = (det == 1 ? 1 : 2);
- for(Int_t ring = 0;ring<nRings; ring++) {
- Char_t ringChar = (ring == 0 ? 'I' : 'O');
- TH1F* hEmptyEdist = (TH1F*)list->FindObject(Form("emptyFMD%d%c",det,ringChar));
- TH1F* hRingEdist = (TH1F*)list->FindObject(Form("ringFMD%d%c",det,ringChar));
- fitFunc = FitEnergyDistribution(hEmptyEdist, speciesOption) ;
- if(fitFunc)
- fitFunc->Write(Form("emptyFMD%d%c_fitfunc",det,ringChar),TObject::kWriteDelete);
- fitFunc = FitEnergyDistribution(hRingEdist, speciesOption) ;
- if(fitFunc)
- fitFunc->Write(Form("FMD%d%c_fitfunc",det,ringChar),TObject::kWriteDelete);
-
-
- energyDist->SetEmptyEnergyDistribution(det,ringChar,hEmptyEdist);
- energyDist->SetRingEnergyDistribution(det,ringChar,hRingEdist);
- for(Int_t nEta = 0; nEta < pars->GetNetaBins(); nEta++) {
- TH1F* hEdist = (TH1F*)list->FindObject(Form("FMD%d%c_etabin%d",det,ringChar,nEta));
-
- fitFunc = FitEnergyDistribution(hEdist, speciesOption) ;
- if(fitFunc)
- fitFunc->Write(Form("FMD%d%c_etabin%d_fitfunc",det,ringChar,nEta),TObject::kWriteDelete);
- energyDist->SetEnergyDistribution(det,ringChar,nEta,hEdist);
-
- }
-
- }
-
- }
-
- fin.Write();
- fin.Close();
-
- if(store) {
- TFile fcalib(pars->GetPath(pars->GetEdistID() ),"RECREATE");
- energyDist->Write(AliFMDAnaParameters::GetEdistID());
- fcalib.Close();
- }
-
-
-
-}
-//____________________________________________________________________
-TF1* AliFMDAnalysisTaskCollector::FitEnergyDistribution(TH1F* hEnergy, Int_t /*speciesOption*/) {
- //Fit energy distribution
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- TF1* fitFunc = 0;
- if(hEnergy->GetEntries() != 0) {
-
- hEnergy->GetXaxis()->SetRangeUser(0.2,hEnergy->GetXaxis()->GetXmax());
-
- if(pars->GetCollisionSystem() == 0)
- fitFunc = new TF1("FMDfitFunc","landau",hEnergy->GetBinCenter(hEnergy->GetMaximumBin())-0.2,3);
- if(pars->GetCollisionSystem() == 1) {
- fitFunc = new TF1("FMDfitFunc",TripleLandau,hEnergy->GetBinCenter(hEnergy->GetMaximumBin())-0.2,5,5);
- fitFunc->SetParNames("constant","MPV","sigma","2-Mip weight","3-Mip weight");
- fitFunc->SetParameters(10,0.8,0.1,0.05,0.01);
- fitFunc->SetParLimits(1,0.6,1.2);
- fitFunc->SetParLimits(3,0,1);
- fitFunc->SetParLimits(4,0,1);
-
- }
- hEnergy->Fit(fitFunc,"","",hEnergy->GetBinCenter(hEnergy->GetMaximumBin())-0.2,3);
-
- }
- return fitFunc;
-
-}
-//____________________________________________________________________
-//
-// EOF
-//
-// EOF
+++ /dev/null
-#ifndef ALIFMDANALYSISTASKCOLLECTOR_H
-#define ALIFMDANALYSISTASKCOLLECTOR_H
-
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-#include "AliAnalysisTaskSE.h"
-#include "TH1F.h"
-#include "TObjArray.h"
-
-class AliESDEvent;
-class TChain;
-class AliAODEvent;
-class AliFMDAnaParameters;
-//
-//Class to fit energy distributions in the FMD
-//
-class AliFMDAnalysisTaskCollector : public AliAnalysisTaskSE
-{
- public:
- AliFMDAnalysisTaskCollector();
- AliFMDAnalysisTaskCollector(const char* name);
- AliFMDAnalysisTaskCollector(const AliFMDAnalysisTaskCollector& o) :
- AliAnalysisTaskSE(),
- // fDebug(o.fDebug),
- fOutputList(o.fOutputList),
- fArray(o.fArray),
- fZvtxDist(o.fZvtxDist),
- fEvents(0),
- fEmptyEvents(0),
- fClusters(0),
- fClustersEmpty(0),
- fFirstEvent(kTRUE),
- fParam(0)
- {}
-
- AliFMDAnalysisTaskCollector& operator=(const AliFMDAnalysisTaskCollector&) { return *this; }
- virtual ~AliFMDAnalysisTaskCollector() {;}
- // Implementation of interface methods
-
- virtual void UserCreateOutputObjects();
- virtual void UserExec(Option_t *option);
- virtual void SetDebugLevel(Int_t level) {fDebug = level;}
- virtual void Terminate(Option_t */*option*/);
- void ReadFromFile(const Char_t* filename, Bool_t store=kFALSE, Int_t speciesOption = 0);
- static Double_t TripleLandau(const Double_t *x, Double_t *par);
- TF1* FitEnergyDistribution(TH1F* hEnergy, Int_t speciesOption);
-
-private:
- void GetVertex(Double_t* vertexXYZ);
- //Int_t fDebug; // Debug flag
- TList* fOutputList; //Output list
- TObjArray* fArray; //Array for storage
- TH1F* fZvtxDist; //Dist of z vertex
- Int_t fEvents; //Number of events
- Int_t fEmptyEvents; //Number of events with empty trigger
- Float_t fClusters; //Number of clusters
- Float_t fClustersEmpty; //Number of clusters in empty events
- Bool_t fFirstEvent; //Have we had events yet ?
- AliFMDAnaParameters* fParam; //The parameters class for IO
-
- ClassDef(AliFMDAnalysisTaskCollector, 1); // Analysis task for FMD analysis
-};
-
-#endif
-// Local Variables:
-// mode: C++
-// End:
-// EOF
+++ /dev/null
-
-#include <TROOT.h>
-#include <TSystem.h>
-#include <TInterpreter.h>
-#include <TChain.h>
-#include <TFile.h>
-#include <TList.h>
-#include <iostream>
-#include "TAxis.h"
-#include "TH2F.h"
-#include "TF1.h"
-#include "AliFMDAnalysisTaskDensity.h"
-#include "AliAnalysisManager.h"
-#include "AliESDFMD.h"
-#include "AliESDEvent.h"
-#include "AliAODEvent.h"
-#include "AliAODHandler.h"
-#include "AliMCEventHandler.h"
-#include "AliStack.h"
-#include "AliFMDAnaCalibEnergyDistribution.h"
-#include "AliESDVertex.h"
-#include "TMath.h"
-#include "AliFMDAnaParameters.h"
-//#include "AliFMDParameters.h"
-//#include "AliFMDGeometry.h"
-//#include "AliFMDRing.h"
-
-ClassImp(AliFMDAnalysisTaskDensity)
-
-//_____________________________________________________________________
-AliFMDAnalysisTaskDensity::AliFMDAnalysisTaskDensity()
-: fDebug(0),
- fOutputList(),
- fESD(0x0),
- fVertexString(),
- fVertex(0),
- fStandalone(kTRUE),
- fStatus(kTRUE)
-{
- // Default constructor
- DefineInput (0, AliESDFMD::Class());
- DefineInput (1, AliESDVertex::Class());
- DefineOutput(0,TList::Class());
-}
-//_____________________________________________________________________
-AliFMDAnalysisTaskDensity::AliFMDAnalysisTaskDensity(const char* name, Bool_t SE):
- AliAnalysisTask(name, "Density"),
- fDebug(0),
- fOutputList(0),
- fESD(0x0),
- fVertexString(),
- fVertex(0),
- fStandalone(kTRUE),
- fStatus(kTRUE)
-{
- fStandalone = SE;
- if(fStandalone) {
- DefineInput (0, AliESDFMD::Class());
- DefineInput (1, AliESDVertex::Class());
- DefineOutput(0, TList::Class());
- }
-
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskDensity::CreateOutputObjects()
-{
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
-
-
- if(!fOutputList)
- fOutputList = new TList();
- fOutputList->SetName("density_list");
-
- fOutputList->Add(&fVertexString);
-
-
-
- TH2F* hMult = 0;
-
- Int_t nVtxbins = pars->GetNvtxBins();
-
-
- for(Int_t det =1; det<=3;det++)
- {
- Int_t nRings = (det==1 ? 1 : 2);
- for(Int_t ring = 0;ring<nRings;ring++)
- {
- Char_t ringChar = (ring == 0 ? 'I' : 'O');
- Int_t nSec = (ring == 0 ? 20 : 40);
-
- for(Int_t i = 0; i< nVtxbins; i++) {
- TH2F* hBg = pars->GetBackgroundCorrection(det, ringChar, i);
-
- hMult = new TH2F(Form("FMD%d%c_vtxbin%d",det,ringChar,i),Form("FMD%d%c_vtxbin%d",det,ringChar,i),
- hBg->GetNbinsX(),
- hBg->GetXaxis()->GetXmin(),
- hBg->GetXaxis()->GetXmax(),
- nSec, 0, 2*TMath::Pi());
- hMult->Sumw2();
-
- fOutputList->Add(hMult);
- }
- }
- }
-
-
-
-
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskDensity::ConnectInputData(Option_t */*option*/)
-{
- if(fStandalone) {
- fESD = (AliESDFMD*)GetInputData(0);
- fVertex = (AliESDVertex*)GetInputData(1);
- }
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskDensity::Init() {
- //TFile f("/home/canute/ALICE/FMDanalysis/FirstAnalysis/energydistributions_0_0_1_0_0_0.root");
- //fEnergyDistribution = dynamic_cast<AliFMDAnaCalibEnergyDistribution*>(f.Get("energydistributions"));
-
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskDensity::Exec(Option_t */*option*/)
-{
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- // AliFMDGeometry* geo = AliFMDGeometry::Instance();
-
- //AliESDFMD* fmd = fESD->GetFMDData();
-
-
- Double_t vertex[3];
- fVertex->GetXYZ(vertex);
- // Z Vtx cut
-
- if( TMath::Abs(vertex[2]) > pars->GetVtxCutZ()) {
- fStatus = kFALSE;
- return;
- }
- else
- fStatus = kTRUE;
-
- Double_t delta = 2*pars->GetVtxCutZ()/pars->GetNvtxBins();
- Double_t vertexBinDouble = (vertex[2] + pars->GetVtxCutZ()) / delta;
-
- Int_t vtxbin = (Int_t)vertexBinDouble;
-
- fVertexString.SetString(Form("%d",vtxbin));
- //Reset everything
- 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 ring = (ir == 0 ? 'I' : 'O');
- TH2F* hMult = (TH2F*)fOutputList->FindObject(Form("FMD%d%c_vtxbin%d",det,ring,vtxbin));
- hMult->Reset();
- }
-
- }
-
-
- 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 ring = (ir == 0 ? 'I' : 'O');
- TH2F* hMult = (TH2F*)fOutputList->FindObject(Form("FMD%d%c_vtxbin%d",det,ring,vtxbin));
-
- UShort_t nsec = (ir == 0 ? 20 : 40);
- UShort_t nstr = (ir == 0 ? 512 : 256);
- /*
- TH1F* hEnergyDist = pars->GetEmptyEnergyDistribution(det,ring);
- TF1* fitFunc = hEnergyDist->GetFunction("FMDfitFunc");
- TH1F* hSignalDist = pars->GetRingEnergyDistribution(det, ring);
- TF1* fitFuncSignal = hSignalDist->GetFunction("FMDfitFunc");
- */
- for(UShort_t sec =0; sec < nsec; sec++) {
- for(UShort_t strip = 0; strip < nstr; strip++) {
- Float_t mult = fESD->Multiplicity(det,ring,sec,strip);
-
- if(mult == 0 || mult == AliESDFMD::kInvalidMult) continue;
-
- Float_t phi = pars->GetPhiFromSector(det,ring,sec);
- Float_t eta = pars->GetEtaFromStrip(det,ring,sec,strip,vertex[2]);
-
- Float_t mult_cut = 0.3;//pars->GetMPV(det,ring,eta);// - pars->GetSigma(det,ring,eta);//0.25;//0.15;//m-2*s;//0.15;//0.2;//m-3*s;// 0.2;//0.01;//m-2*s;//0.2;
- // if(ring == 'I')
- // mult_cut = 0.10;
- //Float_t mult_cut = pars->GetMPV(det,ring,eta) - 5*pars->GetSigma(det,ring,eta);
- Float_t nParticles = 0;
- if(fESD->GetUniqueID() == kTRUE) {
- //proton + proton
-
- if(mult > mult_cut) {
- nParticles = 1.;
- }
- }
- else {
-
- //Pb+Pb
- Float_t mpv = pars->GetMPV(det,ring,eta);
- Float_t sigma = pars->GetSigma(det,ring,eta);
- Float_t alpha = pars->Get2MIPWeight(det,ring,eta);
- Float_t beta = pars->Get3MIPWeight(det,ring,eta);
-
- Float_t sumCor = TMath::Landau(mult,mpv,sigma,kTRUE)+
- alpha*TMath::Landau(mult,2*mpv+2*sigma*TMath::Log(2),2*sigma,kTRUE)+
- beta*TMath::Landau(mult,3*mpv+3*sigma*TMath::Log(3),3*sigma,kTRUE);
- Float_t weight = TMath::Landau(mult,mpv,sigma,kTRUE)+
- 2*alpha*TMath::Landau(mult,2*mpv+2*sigma*TMath::Log(2),2*sigma,kTRUE)+
- 3*beta*TMath::Landau(mult,3*mpv+3*sigma*TMath::Log(3),3*sigma,kTRUE);
-
-
- if(mult > mult_cut) {
- if(sumCor) nParticles = weight / sumCor;
- else nParticles = 1;
-
- }
- //std::cout<<sumCor<<" "<<weight<<" "<<" "<<mult<<" "<<nParticles<<std::endl;
-
- }
-
-
-
-
-
- Float_t correction = GetAcceptanceCorrection(ring,strip);
-
- //std::cout<<"before "<<correction<<std::endl;
- if(fESD->GetUniqueID() == kTRUE) {
- TH1F* hDoubleHitCorrection = pars->GetDoubleHitCorrection(det,ring);
-
- if(hDoubleHitCorrection->GetBinContent(hDoubleHitCorrection->FindBin(eta)) != 0)
- correction = correction*hDoubleHitCorrection->GetBinContent(hDoubleHitCorrection->FindBin(eta));
-
- }
-
- //Dead channel correction:
- TH1F* hFMDDeadCorrection = pars->GetFMDDeadCorrection(vtxbin);
- if(hFMDDeadCorrection)
- if(hFMDDeadCorrection->GetBinContent(hFMDDeadCorrection->FindBin(eta)) != 0)
- correction = correction*hFMDDeadCorrection->GetBinContent(hFMDDeadCorrection->FindBin(eta));
-
-
- //std::cout<<det<<" "<<ring<<" "<<sec<<" "<<strip<<" "<<vertex[2]<<" "<<eta<<std::endl;
-
- //Float_t signal = hSignalDist->Integral(hSignalDist->FindBin(0.5),hSignalDist->FindBin(2)) ;//pars->GetConstant(det,ring,eta);
- //Float_t bkg = hEnergyDist->GetBinContent(hEnergyDist->FindBin(mult));
- //Float_t signal = hSignalDist->GetBinContent(hSignalDist->FindBin(mult));
- /*
- if(fitFunc && fitFuncSignal && pars->IsRealData()) {
- Float_t bkg = fitFunc->Eval(mult);
- Float_t signal = fitFuncSignal->Eval(mult);
-
- if(signal > 0) {
- correction = correction/(1-(bkg/signal));
- //test
- // if(TMath::Abs(eta)<3) correction = 1.15*correction;
- // if(det == 2 && ring == 'I') correction = correction/(1-bkg/signal);
- //if(det == 2 && ring == 'O') correction = correction/(1-bkg/signal);
- //if(det == 3 && ring == 'I') correction = correction/(1-bkg/signal);
- //if(det == 3 && ring == 'O') correction = correction/(1-bkg/signal);
-
- }
- }*/
- if(correction) nParticles = nParticles / correction;
- if(nParticles > 0)
- hMult->Fill(eta,phi,nParticles);
-
-
- }
- }
-
- }
-
-
-
- }
-
-
-
- if(fStandalone) {
- PostData(0, fOutputList);
- }
-
-}
-//_____________________________________________________________________
-Float_t AliFMDAnalysisTaskDensity::GetAcceptanceCorrection(Char_t ring, UShort_t strip)
-{
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
- //AliFMDRing fmdring(ring);
- //fmdring.Init();
- Float_t rad = pars->GetMaxR(ring)-pars->GetMinR(ring);
- Float_t nstrips = (ring == 'I' ? 512 : 256);
- Float_t segment = rad / nstrips;
- Float_t radius = pars->GetMinR(ring) + segment*strip;
-
- Float_t basearea1 = 0.5*pars->GetBaseStripLength(ring,strip)*TMath::Power(radius,2);
- Float_t basearea2 = 0.5*pars->GetBaseStripLength(ring,strip)*TMath::Power((radius-segment),2);
- Float_t basearea = basearea1 - basearea2;
-
- Float_t area1 = 0.5*pars->GetStripLength(ring,strip)*TMath::Power(radius,2);
- Float_t area2 = 0.5*pars->GetStripLength(ring,strip)*TMath::Power((radius-segment),2);
- Float_t area = area1 - area2;
-
- Float_t correction = area/basearea;
-
- return correction;
-}
-//_____________________________________________________________________
-//
-//EOF
-//
+++ /dev/null
-#ifndef ALIFMDANALYSISTASKDENSITY_H
-#define ALIFMDANALYSISTASKDENSITY_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 "AliESDFMD.h"
-#include "AliESDVertex.h"
-#include "TObjString.h"
-#include "TTree.h"
-
-class AliESDEvent;
-class TChain;
-class AliAODEvent;
-class TF1;
-class AliFMDAnaCalibEnergyDistribution;
-
-/**
- * @ingroup FMD_ana
- */
-class AliFMDAnalysisTaskDensity : public AliAnalysisTask
-{
- public:
- AliFMDAnalysisTaskDensity();
- AliFMDAnalysisTaskDensity(const char* name, Bool_t SE = kTRUE);
- virtual ~AliFMDAnalysisTaskDensity() {;}
- AliFMDAnalysisTaskDensity(const AliFMDAnalysisTaskDensity& o) : AliAnalysisTask(),
- fDebug(o.fDebug),
- fOutputList(),
- fESD(o.fESD),
- fVertexString(o.fVertexString),
- fVertex(o.fVertex),
- fStandalone(o.fStandalone),
- fStatus(o.fStatus) {}
- AliFMDAnalysisTaskDensity& operator=(const AliFMDAnalysisTaskDensity&) { 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;}
-
- Float_t GetAcceptanceCorrection(Char_t ring, UShort_t strip);
- void SetOutputList(TList* outlist) {fOutputList = outlist;}
- void SetInputESDFMD(AliESDFMD* esdfmd) {fESD = esdfmd;}
- void SetInputVertex(AliESDVertex* vertex) {fVertex = vertex;}
- Bool_t GetEventStatus() { return fStatus; }
- Float_t GetPhiFromSector(UShort_t det, Char_t ring, UShort_t sec);
- private:
-
- Int_t fDebug; // Debug flag
- TList* fOutputList;
- AliESDFMD* fESD;
- TObjString fVertexString;
- AliESDVertex* fVertex;
- Bool_t fStandalone;
- Bool_t fStatus;
- //AliFMDAnaCalibEnergyDistribution* fEnergyDistribution;
- // TF1* fFuncPos;
- // TF1* fFuncNeg;
-
- ClassDef(AliFMDAnalysisTaskDensity, 0); // Analysis task for FMD analysis
-};
-
-#endif
-// Local Variables:
-// mode: C++
-// End:
+++ /dev/null
-
-#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 "AliFMDAnalysisTaskDndeta.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 "AliFMDStripIndex.h"
-#include "AliESDInputHandler.h"
-#include "AliGenDPMjetEventHeader.h"
-#include "AliLog.h"
-ClassImp(AliFMDAnalysisTaskDndeta)
-
-
-AliFMDAnalysisTaskDndeta::AliFMDAnalysisTaskDndeta()
-: fDebug(0),
- fOutputList(0),
- fInputList(0),
- fVertexString(0x0),
- fNevents(),
- fNNSDevents(),
- fNMCevents(),
- fNMCNSDevents(),
- fStandalone(kTRUE),
- fLastTrackByStrip(0),
- fVtxEff(1),
- fVtxEffNSD(1)
-{
- // Default constructor
- DefineInput (0, TList::Class());
- DefineOutput(0, TList::Class());
-}
-//_____________________________________________________________________
-AliFMDAnalysisTaskDndeta::AliFMDAnalysisTaskDndeta(const char* name, Bool_t SE):
- AliAnalysisTask(name, "Density"),
- fDebug(0),
- fOutputList(0),
- fInputList(0),
- fVertexString(0x0),
- fNevents(),
- fNNSDevents(),
- fNMCevents(),
- fNMCNSDevents(),
- fStandalone(kTRUE),
- fLastTrackByStrip(0),
- fVtxEff(1),
- fVtxEffNSD(1)
-{
- fStandalone = SE;
- if(fStandalone) {
- DefineInput (0, TList::Class());
- DefineInput(1, TObjString::Class());
- DefineOutput(0, TList::Class());
-
- }
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskDndeta::CreateOutputObjects()
-{
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
- if(!fOutputList)
- fOutputList = new TList();
- fOutputList->SetName("BackgroundCorrected");
-
-
- TH2F* hMult = 0;
- TH2F* hMultNSD = 0;
- TH1F* hHits = 0;
- TH2F* hMultTrVtx = 0;
- TH1F* hPrimVertexBin = 0;
- TH1F* hPrimVertexBinNSD = 0;
-
- TH2F* hBgTmp = pars->GetBackgroundCorrection(1, 'I', 0);
- TH1F* hPrimary = new TH1F("hMultvsEta","hMultvsEta",
- hBgTmp->GetNbinsX(),
- hBgTmp->GetXaxis()->GetXmin(),
- hBgTmp->GetXaxis()->GetXmax());
- hPrimary->Sumw2();
- fOutputList->Add(hPrimary);
- TH1F* hPrimaryNSD = new TH1F("hMultvsEtaNSD","hMultvsEtaNSD",
- hBgTmp->GetNbinsX(),
- hBgTmp->GetXaxis()->GetXmin(),
- hBgTmp->GetXaxis()->GetXmax());
- hPrimaryNSD->Sumw2();
- fOutputList->Add(hPrimaryNSD);
- Int_t nVtxbins = pars->GetNvtxBins();
- TH2F* hBg = 0;
- for(Int_t i = 0; i< nVtxbins; i++) {
-
- for(Int_t det =1; det<=3;det++)
- {
- Int_t nRings = (det==1 ? 1 : 2);
- for(Int_t ring = 0;ring<nRings;ring++)
- {
- Char_t ringChar = (ring == 0 ? 'I' : 'O');
- Int_t nSec = (ring == 0 ? 20 : 40);
-
-
-
- hBg = pars->GetBackgroundCorrection(det, ringChar, i);
- hMult = new TH2F(Form("dNdeta_FMD%d%c_vtxbin%d",det,ringChar,i),Form("dNdeta_FMD%d%c_vtxbin%d",det,ringChar,i),
- hBg->GetNbinsX(),
- hBg->GetXaxis()->GetXmin(),
- hBg->GetXaxis()->GetXmax(),
- nSec, 0, 2*TMath::Pi());
- hMultTrVtx = new TH2F(Form("dNdetaTrVtx_FMD%d%c_vtxbin%d",det,ringChar,i),Form("dNdetaTrVtx_FMD%d%c_vtxbin%d",det,ringChar,i),
- hBg->GetNbinsX(),
- hBg->GetXaxis()->GetXmin(),
- hBg->GetXaxis()->GetXmax(),
- nSec, 0, 2*TMath::Pi());
- hMultNSD = new TH2F(Form("dNdetaNSD_FMD%d%c_vtxbin%d",det,ringChar,i),Form("dNdetaNSD_FMD%d%c_vtxbin%d",det,ringChar,i),
- hBg->GetNbinsX(),
- hBg->GetXaxis()->GetXmin(),
- hBg->GetXaxis()->GetXmax(),
- nSec, 0, 2*TMath::Pi());
- hHits = new TH1F(Form("hMCHits_FMD%d%c_vtxbin%d",det,ringChar,i),Form("hMCHits_FMD%d%c_vtxbin%d",det,ringChar,i),
- hBg->GetNbinsX(),
- hBg->GetXaxis()->GetXmin(),
- hBg->GetXaxis()->GetXmax());
- hHits->Sumw2();
- fOutputList->Add(hHits);
-
- hMult->Sumw2();
- fOutputList->Add(hMult);
-
- hMultTrVtx->Sumw2();
- fOutputList->Add(hMultTrVtx);
-
- hMultNSD->Sumw2();
- fOutputList->Add(hMultNSD);
-
- }
- }
- }
-
- for(Int_t i = 0; i< nVtxbins; i++) {
-
- hPrimVertexBin = new TH1F(Form("primmult_vtxbin%d",i),
- Form("primmult_vtxbin%d",i),
- hBgTmp->GetNbinsX(),
- hBgTmp->GetXaxis()->GetXmin(),
- hBgTmp->GetXaxis()->GetXmax());
- hPrimVertexBin->Sumw2();
- fOutputList->Add(hPrimVertexBin);
-
- hPrimVertexBinNSD = new TH1F(Form("primmult_NSD_vtxbin%d",i),
- Form("primmult_NSD_vtxbin%d",i),
- hBgTmp->GetNbinsX(),
- hBgTmp->GetXaxis()->GetXmin(),
- hBgTmp->GetXaxis()->GetXmax());
- hPrimVertexBinNSD->Sumw2();
- fOutputList->Add(hPrimVertexBinNSD);
-
-
- //SPD part
- TH2F* hSPDMult = new TH2F(Form("dNdeta_SPD_vtxbin%d",i),Form("dNdeta_SPD_vtxbin%d",i),
- hBgTmp->GetNbinsX(),
- hBgTmp->GetXaxis()->GetXmin(),
- hBgTmp->GetXaxis()->GetXmax(),
- 20, 0, 2*TMath::Pi());
- hSPDMult->Sumw2();
- fOutputList->Add(hSPDMult);
- TH2F* hSPDMultTrVtx = new TH2F(Form("dNdetaTrVtx_SPD_vtxbin%d",i),Form("dNdetaTrVtx_SPD_vtxbin%d",i),
- hBgTmp->GetNbinsX(),
- hBgTmp->GetXaxis()->GetXmin(),
- hBgTmp->GetXaxis()->GetXmax(),
- 20, 0, 2*TMath::Pi());
- hSPDMultTrVtx->Sumw2();
- fOutputList->Add(hSPDMultTrVtx);
-
- TH2F* hSPDMultNSD = new TH2F(Form("dNdetaNSD_SPD_vtxbin%d",i),Form("dNdetaNSD_SPD_vtxbin%d",i),
- hBgTmp->GetNbinsX(),
- hBgTmp->GetXaxis()->GetXmin(),
- hBgTmp->GetXaxis()->GetXmax(),
- 20, 0, 2*TMath::Pi());
- hSPDMultNSD->Sumw2();
- fOutputList->Add(hSPDMultNSD);
-
- }
-
- //AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
- // TH2F* dNdetadphiHistogramTotal = new TH2F("dNdetadphiHistogramTotal","dNdetadphiHistogram;#eta;#Phi",pars->GetNetaBins(),-6,6,20,0,2*TMath::Pi());
- //dNdetadphiHistogramTotal->SetErrorOption("g");
- //fOutputList->Add(dNdetadphiHistogramTotal);
-
-
-
- fNevents.SetBins(nVtxbins,0,nVtxbins);
- fNevents.SetName("nEvents");
- fNNSDevents.SetBins(nVtxbins,0,nVtxbins);
- fNNSDevents.SetName("nNSDEvents");
-
- fNMCevents.SetBins(nVtxbins,0,nVtxbins);
- fNMCevents.SetName("nMCEvents");
- fNMCNSDevents.SetBins(nVtxbins,0,nVtxbins);
- fNMCNSDevents.SetName("nMCNSDEvents");
- fOutputList->Add(&fNevents);
- fOutputList->Add(&fNNSDevents);
- fOutputList->Add(&fNMCevents);
- fOutputList->Add(&fNMCNSDevents);
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskDndeta::ConnectInputData(Option_t */*option*/)
-{
- if(fStandalone) {
- fInputList = (TList*)GetInputData(0);
- }
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskDndeta::Exec(Option_t */*option*/)
-{
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- fVertexString = (TObjString*)fInputList->At(0);
-
- Int_t vtxbin = fVertexString->GetString().Atoi();
-
- fNevents.Fill(vtxbin);
-
- //AliESDInputHandler* eventHandler = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
- //AliESDEvent* esd = eventHandler->GetEvent();
- Bool_t nsd = pars->IsEventTriggered(AliFMDAnaParameters::kNSD);
- if(nsd) fNNSDevents.Fill(vtxbin);
-
- 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));
- TH2F* hMultTotalNSD = (TH2F*)fOutputList->FindObject(Form("dNdetaNSD_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
-
-
- TH2F* hMultInput = (TH2F*)fInputList->FindObject(Form("mult_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
- TH2F* hMultInputTrVtx = (TH2F*)fInputList->FindObject(Form("multTrVtx_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
- TH2F* hMultInputNSD = (TH2F*)fInputList->FindObject(Form("multNSD_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
-
- hMultTotal->Add(hMultInput);
- hMultTotalTrVtx->Add(hMultInputTrVtx);
- if(nsd)
- hMultTotalNSD->Add(hMultInputNSD);
-
- }
- }
-
- //SPD code
- TH2F* hMultSPDTotal = (TH2F*)fOutputList->FindObject(Form("dNdeta_SPD_vtxbin%d",vtxbin));
- TH2F* hMultSPDTotalTrVtx = (TH2F*)fOutputList->FindObject(Form("dNdetaTrVtx_SPD_vtxbin%d",vtxbin));
- TH2F* hMultSPDTotalNSD = (TH2F*)fOutputList->FindObject(Form("dNdetaNSD_SPD_vtxbin%d",vtxbin));
- TH2F* hMultSPDInput = (TH2F*)fInputList->FindObject(Form("mult_SPD_vtxbin%d",vtxbin));
- TH2F* hMultSPDInputTrVtx = (TH2F*)fInputList->FindObject(Form("multTrVtx_SPD_vtxbin%d",vtxbin));
- TH2F* hMultSPDInputNSD = (TH2F*)fInputList->FindObject(Form("multNSD_SPD_vtxbin%d",vtxbin));
-
- hMultSPDTotal->Add(hMultSPDInput);
- hMultSPDTotalTrVtx->Add(hMultSPDInputTrVtx);
- if(nsd)
- hMultSPDTotalNSD->Add(hMultSPDInputNSD);
-
- if(pars->GetProcessPrimary())
- ProcessPrimary();
-
- //TH2F* dNdetadphiHistogram = (TH2F*)fOutputList->FindObject("dNdetadphiHistogramSPDTrVtx");
-
- // TH2F* dNdetadphiHistogramTotal = (TH2F*)fOutputList->FindObject("dNdetadphiHistogramTotal");
-
- // if(vtxbin == 4)
- // dNdetadphiHistogramTotal->Add(dNdetadphiHistogram);
-
-
-
-
- if(fStandalone) {
- PostData(0, fOutputList);
- }
-
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskDndeta::Terminate(Option_t */*option*/) {
-
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
- Int_t nVtxbins = pars->GetNvtxBins();
-
- 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');
- for(Int_t i =0; i<nVtxbins; i++) {
-
- TH2F* hMultTotal = (TH2F*)fOutputList->FindObject(Form("dNdeta_FMD%d%c_vtxbin%d",det,ringChar,i));
- fOutputList->Add(hMultTotal->Clone(Form("%s_orig", hMultTotal->GetName())));
- if(fVtxEff) {
- hMultTotal->Scale(fVtxEff);
- }
-
- TH2F* hMultTotalNSD = (TH2F*)fOutputList->FindObject(Form("dNdetaNSD_FMD%d%c_vtxbin%d",det,ringChar,i));
- fOutputList->Add(hMultTotalNSD->Clone(Form("%s_orig", hMultTotalNSD->GetName())));
- if(fVtxEffNSD) {
- hMultTotalNSD->Scale(fVtxEffNSD);
- }
-
- //TH2F* hMultTrVtx = (TH2F*)hMultTotal->Clone(Form("dNdeta_FMD%d%c_TrVtx_vtxbin%d",det,ringChar,i));
- TH2F* hMultTrVtx = (TH2F*)fOutputList->FindObject(Form("dNdetaTrVtx_FMD%d%c_vtxbin%d",det,ringChar,i));
-
- TH1D* hMultProj = hMultTotal->ProjectionX(Form("dNdeta_FMD%d%c_vtxbin%d_proj",det,ringChar,i),1,hMultTotal->GetNbinsY());
- TH1D* hMultProjTrVtx = hMultTrVtx->ProjectionX(Form("dNdeta_FMD%d%c_TrVtx_vtxbin%d_proj",det,ringChar,i),1,hMultTrVtx->GetNbinsY());
- TH1D* hMultProjNSD = hMultTotalNSD->ProjectionX(Form("dNdetaNSD_FMD%d%c_vtxbin%d_proj",det,ringChar,i),1,hMultTotalNSD->GetNbinsY());
-
- //fOutputList->Add(hMultTrVtx);
- fOutputList->Add(hMultProj);
- fOutputList->Add(hMultProjTrVtx);
- fOutputList->Add(hMultProjNSD);
- }
- }
- }
-
- for(Int_t i =0; i<nVtxbins; i++) {
-
- TH2F* hSPDMult = (TH2F*)fOutputList->FindObject(Form("dNdeta_SPD_vtxbin%d",i));
- TH2F* hSPDMultTrVtx = (TH2F*)fOutputList->FindObject(Form("dNdetaTrVtx_SPD_vtxbin%d",i));
- TH2F* hSPDMultNSD = (TH2F*)fOutputList->FindObject(Form("dNdetaNSD_SPD_vtxbin%d",i));
-
- if(fVtxEff)
- hSPDMult->Scale(fVtxEff);
-
- if(fVtxEffNSD)
- hSPDMultNSD->Scale(fVtxEffNSD);
-
- TH1D* hMultProj = hSPDMult->ProjectionX(Form("dNdeta_SPD_vtxbin%d_proj",i),1,hSPDMult->GetNbinsY());
- TH1D* hMultProjTrVtx = hSPDMultTrVtx->ProjectionX(Form("dNdetaTrVtx_SPD_vtxbin%d_proj",i),1,hSPDMultTrVtx->GetNbinsY());
- TH1D* hMultProjNSD = hSPDMultNSD->ProjectionX(Form("dNdetaNSD_SPD_vtxbin%d_proj",i),1,hSPDMultNSD->GetNbinsY());
- fOutputList->Add(hMultProj);
- fOutputList->Add(hMultProjTrVtx);
- fOutputList->Add(hMultProjNSD);
-
- }
-
- std::cout<<"FMD analysis accepted "<<fNevents.GetEntries()<<" INEL events and "<<fNNSDevents.GetEntries()<<" NSD events"<<std::endl;
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskDndeta::ProcessPrimary() {
-
- AliMCEventHandler* eventHandler =
- dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()
- ->GetMCtruthEventHandler());
- if (!eventHandler) return;
-
- AliMCEvent* mcEvent = eventHandler->MCEvent();
- if(!mcEvent) return;
-
- fLastTrackByStrip.Reset(-1);
-
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
- AliMCParticle* particle = 0;
- AliStack* stack = mcEvent->Stack();
-
- TH1F* hPrimary = (TH1F*)fOutputList->FindObject("hMultvsEta");
- TH1F* hPrimaryNSD = (TH1F*)fOutputList->FindObject("hMultvsEtaNSD");
- AliHeader* header = mcEvent->Header();
- AliGenEventHeader* genHeader = header->GenEventHeader();
-
- AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);
- AliGenDPMjetEventHeader* dpmHeader = dynamic_cast<AliGenDPMjetEventHeader*>(header->GenEventHeader());
- Bool_t nsd = kTRUE;
-
- if (!pythiaGenHeader && !dpmHeader) {
- std::cout<<" no pythia or dpm header!"<<std::endl;
- }
- else {
- if(pythiaGenHeader) {
- Int_t pythiaType = pythiaGenHeader->ProcessType();
-
- if(pythiaType==92||pythiaType==93)
- nsd = kFALSE;
-
- }
- if(dpmHeader) {
- Int_t processType = dpmHeader->ProcessType();
- if(processType == 5 || processType == 6)
- nsd = kFALSE;
-
- }
- }
-
- 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;
- Bool_t firstTrackNSD = kTRUE;
-
- TH1F* hPrimVtxBinNSD = (TH1F*)fOutputList->FindObject(Form("primmult_NSD_vtxbin%d",vertexBin));
- TH1F* hPrimVtxBin = (TH1F*)fOutputList->FindObject(Form("primmult_vtxbin%d",vertexBin));
-
- // 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());
- hPrimVtxBin->Fill(particle->Eta());
- if(firstTrack) {
- fNMCevents.Fill(vertexBin);
- firstTrack = kFALSE;
- }
-
- if(nsd) {
- hPrimaryNSD->Fill(particle->Eta());
- hPrimVtxBinNSD->Fill(particle->Eta());
- if(firstTrackNSD) {
- fNMCNSDevents.Fill(vertexBin);
- firstTrackNSD = kFALSE;
- }
- }
-
-
-
- }
- if(pars->GetProcessHits()) {
-
- for(Int_t j=0; j<particle->GetNumberOfTrackReferences();j++) {
-
- AliTrackReference* ref = particle->GetTrackReference(j);
- UShort_t det,sec,strip;
- Char_t ring;
- if(ref->DetectorId() != AliTrackReference::kFMD)
- continue;
- AliFMDStripIndex::Unpack(ref->UserId(),det,ring,sec,strip);
- Float_t thisStripTrack = fLastTrackByStrip(det,ring,sec,strip);
- if(particle->Charge() != 0 && i != thisStripTrack ) {
- //Double_t x,y,z;
-
- Float_t eta = pars->GetEtaFromStrip(det,ring,sec,strip,vertex.At(2));//-1*TMath::Log(TMath::Tan(0.5*theta));
- TH1F* hHits = (TH1F*)fOutputList->FindObject(Form("hMCHits_FMD%d%c_vtxbin%d",det,ring,vertexBin));
-
-
- hHits->Fill(eta);
-
- Float_t nstrips = (ring =='O' ? 256 : 512);
-
- fLastTrackByStrip(det,ring,sec,strip) = (Float_t)i;
-
- if(strip >0)
- fLastTrackByStrip(det,ring,sec,strip-1) = (Float_t)i;
- if(strip < (nstrips - 1))
- fLastTrackByStrip(det,ring,sec,strip+1) = (Float_t)i;
-
- }
-
-
- }
-
-
- }
-
-
-
- }
-}
-//_____________________________________________________________________
-//
-//
-// EOF
-// EOF
+++ /dev/null
-#ifndef ALIFMDANALYSISTASKDNDETA_H
-#define ALIFMDANALYSISTASKDNDETA_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 AliFMDAnalysisTaskDndeta : public AliAnalysisTask
-{
- public:
- AliFMDAnalysisTaskDndeta();
- AliFMDAnalysisTaskDndeta(const char* name, Bool_t SE = kTRUE);
- virtual ~AliFMDAnalysisTaskDndeta() {;}
- AliFMDAnalysisTaskDndeta(const AliFMDAnalysisTaskDndeta& o) : AliAnalysisTask(),
- fDebug(o.fDebug),
- fOutputList(0),
- fInputList(0),
- fVertexString(o.fVertexString),
- fNevents(o.fNevents),
- fNNSDevents(o.fNNSDevents),
- fNMCevents(o.fNMCevents),
- fNMCNSDevents(o.fNMCNSDevents),
- fStandalone(o.fStandalone),
- fLastTrackByStrip(o.fLastTrackByStrip),
- fVtxEff(o.fVtxEff),
- fVtxEffNSD(o.fVtxEffNSD)
- {}
- AliFMDAnalysisTaskDndeta& operator=(const AliFMDAnalysisTaskDndeta&) { 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;}
- void SetVtxEfficiency(Float_t vtxeff) {fVtxEff = vtxeff;}
- void SetVtxEfficiencyNSD(Float_t vtxeff) {fVtxEffNSD = vtxeff;}
-
- private:
- Int_t fDebug; // Debug flag
- TList* fOutputList;
- TList* fInputList;
- TObjString* fVertexString;
- TH1I fNevents;
- TH1I fNNSDevents;
- TH1I fNMCevents;
- TH1I fNMCNSDevents;
- Bool_t fStandalone;
- AliFMDFloatMap fLastTrackByStrip;
- Float_t fVtxEff; //Efficiency of vertex sel.
- Float_t fVtxEffNSD; //Efficiency of vertex sel., NSD
-
- ClassDef(AliFMDAnalysisTaskDndeta, 0); // Analysis task for FMD analysis
-};
-
-#endif
-// Local Variables:
-// mode: C++
-// End:
+++ /dev/null
-
-#include <TROOT.h>
-#include <TSystem.h>
-#include <TInterpreter.h>
-#include <TChain.h>
-#include <TFile.h>
-#include <TList.h>
-#include <iostream>
-
-#include "AliFMDAnalysisTaskESDReader.h"
-#include "AliAnalysisManager.h"
-#include "AliESDFMD.h"
-#include "AliESDEvent.h"
-#include "AliAODEvent.h"
-#include "AliAODHandler.h"
-#include "AliMCEventHandler.h"
-#include "AliStack.h"
-#include "AliESDVertex.h"
-#include "AliFMDAnaParameters.h"
-
-ClassImp(AliFMDAnalysisTaskESDReader)
-
-//_____________________________________________________________________
-AliFMDAnalysisTaskESDReader::AliFMDAnalysisTaskESDReader()
-: fDebug(0),
- fChain(0x0),
- fESD(0x0),
- fOutputESD(0x0)
-{
- // Default constructor
- DefineInput (0, TTree::Class());
- DefineOutput(0, AliESDEvent::Class());
-
-}
-//_____________________________________________________________________
-AliFMDAnalysisTaskESDReader::AliFMDAnalysisTaskESDReader(const char* name):
- AliAnalysisTask(name, "AnalysisTaskFMD"),
- fDebug(0),
- fChain(0x0),
- fESD(0x0),
- fOutputESD(0x0)
-{
- DefineInput (0, TTree::Class());
- DefineOutput(0, AliESDEvent::Class());
-
-}
-
-//_____________________________________________________________________
-void AliFMDAnalysisTaskESDReader::ConnectInputData(Option_t */*option*/)
-{
- fChain = (TChain*)GetInputData(0);
- fESD = new AliESDEvent();
- fESD->ReadFromTree(fChain);
-
-}
-//_____________________________________________________________________
-
-void AliFMDAnalysisTaskESDReader::Exec(Option_t */*option*/)
-{
- // std::cout<<fOutputESD<<std::endl;
- fOutputESD = fESD;
- PostData(0, fOutputESD);
-
-}
-//_____________________________________________________________________
-
+++ /dev/null
-#ifndef ALIFMDANALYSISTASKESDREADER_H
-#define ALIFMDANALYSISTASKESDREADER_H
-
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-#include "AliAnalysisTask.h"
-#include "TH1F.h"
-#include "TObjString.h"
-#include "AliESDFMD.h"
-#include "TTree.h"
-#include "AliESDVertex.h"
-class AliESDEvent;
-class TChain;
-class AliAODEvent;
-
-
-
-/**
- * @ingroup FMD_ana
- */
-class AliFMDAnalysisTaskESDReader : public AliAnalysisTask
-{
- public:
- AliFMDAnalysisTaskESDReader();
- AliFMDAnalysisTaskESDReader(const char* name);
- AliFMDAnalysisTaskESDReader(const AliFMDAnalysisTaskESDReader& o) : AliAnalysisTask(),
- fDebug(o.fDebug),fChain(o.fChain), fESD(o.fESD),fOutputESD(o.fOutputESD) {}
-
- virtual ~AliFMDAnalysisTaskESDReader() {;}
- AliFMDAnalysisTaskESDReader& operator=(const AliFMDAnalysisTaskESDReader&) { 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;}
-
- private:
- Int_t fDebug; // Debug flag
- TChain* fChain; //! chained files
- AliESDEvent* fESD; //! ESD
- AliESDEvent* fOutputESD;
-
- ClassDef(AliFMDAnalysisTaskESDReader, 0); // Analysis task for FMD analysis
-};
-
-#endif
-// Local Variables:
-// mode: C++
-// End:
+++ /dev/null
-#include "AliFMDAnalysisTaskGenerateCorrection.h"
-#include "AliESDEvent.h"
-#include "iostream"
-#include "AliESDFMD.h"
-#include "TH2F.h"
-#include "AliTrackReference.h"
-#include "AliStack.h"
-#include "AliFMDAnaParameters.h"
-#include "AliFMDStripIndex.h"
-#include "AliStack.h"
-#include "AliMCParticle.h"
-#include "AliMCEvent.h"
-//#include "AliFMDGeometry.h"
-#include "TArray.h"
-#include "AliGenEventHeader.h"
-#include "AliMultiplicity.h"
-#include "AliHeader.h"
-#include "AliFMDAnaCalibBackgroundCorrection.h"
-#include "AliFMDAnaCalibEventSelectionEfficiency.h"
-#include "AliGenPythiaEventHeader.h"
-//#include "AliCDBManager.h"
-//#include "AliCDBId.h"
-//#include "AliCDBMetaData.h"
-#include "TSystem.h"
-#include "TROOT.h"
-#include "TAxis.h"
-#include "AliGenDPMjetEventHeader.h"
-#include <TFile.h>
-
-ClassImp(AliFMDAnalysisTaskGenerateCorrection)
-#if 0
-; // This is for emacs - do not delete
-#endif
-
-//_____________________________________________________________________
-AliFMDAnalysisTaskGenerateCorrection::AliFMDAnalysisTaskGenerateCorrection():
-AliAnalysisTaskSE(),
- fListOfHits(),
- fListOfPrimaries(),
- fListOfCorrection(),
- fVertexBins(),
- fLastTrackByStrip(0),
- fHitsByStrip(0),
- fZvtxCut(10),
- fNvtxBins(10),
- fNbinsEta(240),
- fBackground(0),
-fEventSelectionEff(0),
-fEtaLow(-6),
-fEtaHigh(6)
-{
- // Default constructor
-}
-//_____________________________________________________________________
-AliFMDAnalysisTaskGenerateCorrection::AliFMDAnalysisTaskGenerateCorrection(const char* name):
- AliAnalysisTaskSE(name),
- fListOfHits(),
- fListOfPrimaries(),
- fListOfCorrection(),
- fVertexBins(),
- fLastTrackByStrip(0),
- fHitsByStrip(0),
- fZvtxCut(10),
- fNvtxBins(10),
- fNbinsEta(240),
- fBackground(0),
- fEventSelectionEff(0),
- fEtaLow(-6),
- fEtaHigh(6)
-{
-
- DefineOutput(1, TList::Class());
- DefineOutput(2, TList::Class());
- DefineOutput(3, TH1F::Class());
- DefineOutput(4, TList::Class());
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskGenerateCorrection::UserCreateOutputObjects()
-{
-// Create the output containers
-//
-
- std::cout<<"Creating output objects"<<std::endl;
-
- // SelectCollisionCandidates(AliVEvent::kAny);
-
- for(Int_t v=0; v<fNvtxBins;v++) {
-
- TH2F* hSPDhits = new TH2F(Form("hSPDhits_vtx%d",v),
- Form("hSPDhits_vtx%d",v),
- fNbinsEta, fEtaLow,fEtaHigh, 20, 0,2*TMath::Pi());
- hSPDhits->Sumw2();
- fListOfHits.Add(hSPDhits);
-
- TH1F* hReadChannels = new TH1F(Form("hFMDReadChannels_vtx%d",v),
- Form("hFMDReadChannels_vtx%d",v),
- fNbinsEta,fEtaLow,fEtaHigh);
- hReadChannels->Sumw2();
- fListOfHits.Add(hReadChannels);
- TH1F* hAllChannels = new TH1F(Form("hFMDAllChannels_vtx%d",v),
- Form("hFMDAllChannels_vtx%d",v),
- fNbinsEta,fEtaLow,fEtaHigh);
- hAllChannels->Sumw2();
- fListOfHits.Add(hAllChannels);
-
-
-
- for(Int_t iring = 0; iring<2;iring++) {
- Char_t ringChar = (iring == 0 ? 'I' : 'O');
- Int_t nSec = (iring == 1 ? 40 : 20);
-
- TH2F* hPrimary = new TH2F(Form("hPrimary_FMD_%c_vtx%d",ringChar,v),
- Form("hPrimary_FMD_%c_vtx%d",ringChar,v),
- fNbinsEta, fEtaLow,fEtaHigh, nSec, 0,2*TMath::Pi());
- hPrimary->Sumw2();
- fListOfPrimaries.Add(hPrimary);
- TH2F* hPrimaryNSD = new TH2F(Form("hPrimaryNSD_FMD_%c_vtx%d",ringChar,v),
- Form("hPrimaryNSD_FMD_%c_vtx%d",ringChar,v),
- fNbinsEta, fEtaLow,fEtaHigh, nSec, 0,2*TMath::Pi());
- hPrimaryNSD->Sumw2();
- fListOfPrimaries.Add(hPrimaryNSD);
-
-
-
- }
- }
-
-
-
-
- for(Int_t det =1; det<=3;det++) {
- Int_t nRings = (det==1 ? 1 : 2);
- for(Int_t ring = 0;ring<nRings;ring++) {
- Int_t nSec = (ring == 1 ? 40 : 20);
- Char_t ringChar = (ring == 0 ? 'I' : 'O');
- TH1F* doubleHits = new TH1F(Form("DoubleHits_FMD%d%c",det,ringChar),
- Form("DoubleHits_FMD%d%c",det,ringChar),fNbinsEta, fEtaLow,fEtaHigh);
- TH1F* allHits = new TH1F(Form("allHits_FMD%d%c",det,ringChar),
- Form("allHits_FMD%d%c",det,ringChar), fNbinsEta, fEtaLow,fEtaHigh);
-
- doubleHits->Sumw2();
- allHits->Sumw2();
- fListOfHits.Add(allHits);
- fListOfHits.Add(doubleHits);
-
- for(Int_t v=0; v<fNvtxBins;v++) {
- TH2F* hHits = new TH2F(Form("hHits_FMD%d%c_vtx%d", det,ringChar,v),
- Form("hHits_FMD%d%c_vtx%d", det,ringChar,v),
- fNbinsEta, fEtaLow,fEtaHigh, nSec, 0, 2*TMath::Pi());
- hHits->Sumw2();
- fListOfHits.Add(hHits);
- TH2F* hHitsNSD = new TH2F(Form("hHitsNSD_FMD%d%c_vtx%d", det,ringChar,v),
- Form("hHitsNSD_FMD%d%c_vtx%d", det,ringChar,v),
- fNbinsEta, fEtaLow,fEtaHigh, nSec, 0, 2*TMath::Pi());
- hHitsNSD->Sumw2();
- fListOfHits.Add(hHitsNSD);
-
-
- }
- }
- }
-
- TH1F* hEventsSelected = new TH1F("EventsSelected","EventsSelected",fNvtxBins,0,fNvtxBins);
- TH1F* hEventsAll = new TH1F("EventsAll","EventsAll",fNvtxBins,0,fNvtxBins);
- TH1F* hEventsAllNSD = new TH1F("EventsAllNSD","EventsAllNSD",fNvtxBins,0,fNvtxBins);
- TH1F* hEventsSelectedVtx = new TH1F("EventsSelectedVtx","EventsSelectedVtx",fNvtxBins,0,fNvtxBins);
- TH1F* hEventsSelectedTrigger = new TH1F("EventsSelectedTrigger","EventsSelectedTrigger",fNvtxBins,0,fNvtxBins);
-
- TH1F* hEventsSelectedNSDVtx = new TH1F("EventsSelectedNSDVtx","EventsSelectedNSDVtx",fNvtxBins,0,fNvtxBins);
- TH1F* hEventsSelectedNSD = new TH1F("EventsSelectedNSD","EventsSelectedNSD",fNvtxBins,0,fNvtxBins);
-
- TH1F* hXvtx = new TH1F("hXvtx","x vertex distribution",100,-2,2);
- TH1F* hYvtx = new TH1F("hYvtx","y vertex distribution",100,-2,2);
- TH1F* hZvtx = new TH1F("hZvtx","z vertex distribution",4*fNvtxBins,-4*fZvtxCut,4*fZvtxCut);
-
- fListOfPrimaries.Add(hXvtx);
- fListOfPrimaries.Add(hYvtx);
- fListOfPrimaries.Add(hZvtx);
-
- hEventsSelected->Sumw2();
- hEventsAll->Sumw2();
- hEventsAllNSD->Sumw2();
-
- fListOfHits.Add(hEventsSelected);
- fListOfHits.Add(hEventsSelectedVtx);
- fListOfHits.Add(hEventsSelectedTrigger);
- fListOfHits.Add(hEventsSelectedNSDVtx);
- fListOfHits.Add(hEventsSelectedNSD);
-
-
- fListOfPrimaries.Add(hEventsAll);
- fListOfPrimaries.Add(hEventsAllNSD);
-
- for(Int_t v=0; v<fNvtxBins;v++) {
-
- for(Int_t iring = 0; iring<2;iring++) {
- Char_t ringChar = (iring == 0 ? 'I' : 'O');
- Int_t nSec = (iring == 1 ? 40 : 20);
- TH2F* hAnalysed = new TH2F(Form("Analysed_FMD%c_vtx%d",ringChar,v),
- Form("Analysed_FMD%c_vtx%d",ringChar,v),
- fNbinsEta, fEtaLow,fEtaHigh, nSec, 0,2*TMath::Pi());
-
- hAnalysed->Sumw2();
- fListOfPrimaries.Add(hAnalysed);
-
- TH2F* hAnalysedNSD = new TH2F(Form("AnalysedNSD_FMD%c_vtx%d",ringChar,v),
- Form("AnalysedNSD_FMD%c_vtx%d",ringChar,v),
- fNbinsEta, fEtaLow,fEtaHigh, nSec, 0,2*TMath::Pi());
-
- hAnalysedNSD->Sumw2();
- fListOfPrimaries.Add(hAnalysedNSD);
-
- TH2F* hInel = new TH2F(Form("Inel_FMD%c_vtx%d",ringChar,v),
- Form("Inel_FMD%c_vtx%d",ringChar,v),
- fNbinsEta, fEtaLow,fEtaHigh, nSec, 0,2*TMath::Pi());
-
- hInel->Sumw2();
- fListOfPrimaries.Add(hInel);
-
- TH2F* hNSD = new TH2F(Form("NSD_FMD%c_vtx%d",ringChar,v),
- Form("NSD_FMD%c_vtx%d",ringChar,v),
- fNbinsEta, fEtaLow,fEtaHigh, nSec, 0,2*TMath::Pi());
-
- hNSD->Sumw2();
- fListOfPrimaries.Add(hNSD);
-
- }
- }
-
- fVertexBins.SetName("VertexBins");
- fVertexBins.GetXaxis()->Set(fNvtxBins,-1*fZvtxCut,fZvtxCut);
-
-
-
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskGenerateCorrection::Init()
-{
- fLastTrackByStrip.Reset(-1);
-
-
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskGenerateCorrection::UserExec(Option_t */*option*/)
-{
-
- fLastTrackByStrip.Reset(-1);
- fHitsByStrip.Reset(0);
- AliMCEvent* mcevent = MCEvent();
-
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
-
- AliESDEvent* esdevent = (AliESDEvent*)InputEvent();
-
- pars->SetTriggerStatus(esdevent);
-
- Double_t esdvertex[3];
- Bool_t vtxStatus = pars->GetVertex(esdevent,esdvertex);
-
- /* Double_t deltaEsd = 2*fZvtxCut/fNvtxBins;
- Double_t vertexBinDoubleEsd = (esdvertex[2] + fZvtxCut) / deltaEsd;
- Int_t vertexBinEsd = (Int_t)vertexBinDoubleEsd;*/
-
- AliMCParticle* particle = 0;
- AliStack* stack = mcevent->Stack();
-
- UShort_t det,sec,strip;
- Char_t ring;
-
- Int_t nTracks = mcevent->GetNumberOfTracks();
- AliHeader* header = mcevent->Header();
- AliGenEventHeader* genHeader = header->GenEventHeader();
-
- AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);
- AliGenDPMjetEventHeader* dpmHeader = dynamic_cast<AliGenDPMjetEventHeader*>(header->GenEventHeader());
-
- if (!pythiaGenHeader && !dpmHeader) {
- std::cout<<" no pythia or dpm header! - NSD selection unusable"<<std::endl;
- //return;
- }
- Bool_t nsd = kTRUE;
- if(pythiaGenHeader) {
- Int_t pythiaType = pythiaGenHeader->ProcessType();
-
- if(pythiaType==92 || pythiaType==93)
- nsd = kFALSE;
- }
- if(dpmHeader) {
- Int_t processType = dpmHeader->ProcessType();
- if(processType == 5 || processType == 6)
- nsd = kFALSE;
-
- }
-
-
- TArrayF vertex;
- genHeader->PrimaryVertex(vertex);
-
- TH1F* hXvtx = (TH1F*)fListOfPrimaries.FindObject("hXvtx");
- hXvtx->Fill(vertex.At(0));
- TH1F* hYvtx = (TH1F*)fListOfPrimaries.FindObject("hYvtx");
- hYvtx->Fill(vertex.At(1));
- TH1F* hZvtx = (TH1F*)fListOfPrimaries.FindObject("hZvtx");
- hZvtx->Fill(vertex.At(2));
-
-
-
-
- Double_t delta = 2*fZvtxCut/fNvtxBins;
- Double_t vertexBinDouble = (vertex.At(2) + fZvtxCut) / delta;
- Int_t vertexBin = (Int_t)vertexBinDouble;
-
- // Vertex determination correction
- TH1F* hEventsSelected = (TH1F*)fListOfHits.FindObject("EventsSelected");
- TH1F* hEventsSelectedVtx = (TH1F*)fListOfHits.FindObject("EventsSelectedVtx");
- TH1F* hEventsSelectedTrigger = (TH1F*)fListOfHits.FindObject("EventsSelectedTrigger");
- TH1F* hEventsSelectedNSDVtx = (TH1F*)fListOfHits.FindObject("EventsSelectedNSDVtx");
- TH1F* hEventsSelectedNSD = (TH1F*)fListOfHits.FindObject("EventsSelectedNSD");
- TH1F* hEventsAll = (TH1F*)fListOfPrimaries.FindObject("EventsAll");
- TH1F* hEventsAllNSD = (TH1F*)fListOfPrimaries.FindObject("EventsAllNSD");
-
- // TH1F* hTriggered = (TH1F*)fListOfHits.FindObject("Triggered");
- // TH1F* hTriggeredAll = (TH1F*)fListOfPrimaries.FindObject("TriggeredAll");
-
- Bool_t vtxFound = kTRUE;
- if(!vtxStatus)
- vtxFound = kFALSE;
-
- //if(TMath::Abs(vertex.At(2)) > fZvtxCut) {
- // vtxFound = kFALSE;
-
- //}
-
- if(TMath::Abs(vertex.At(2)) > fZvtxCut) {
- return;
- }
-
-
- Bool_t isTriggered = pars->IsEventTriggered(AliFMDAnaParameters::kMB1);
- Bool_t isTriggeredNSD = pars->IsEventTriggered(AliFMDAnaParameters::kNSD);
- if(vtxFound && isTriggered) hEventsSelected->Fill(vertexBin);
-
- if(vtxFound) hEventsSelectedVtx->Fill(vertexBin);
- if(isTriggered) hEventsSelectedTrigger->Fill(vertexBin);
-
- if(vtxFound && isTriggeredNSD) hEventsSelectedNSDVtx->Fill(vertexBin);
- if(isTriggeredNSD) hEventsSelectedNSD->Fill(vertexBin);
-
-
- hEventsAll->Fill(vertexBin);
- if(nsd) hEventsAllNSD->Fill(vertexBin);
-
- // FMD dead channels
-
- TH1F* hFMDReadChannels = (TH1F*)fListOfHits.FindObject(Form("hFMDReadChannels_vtx%d",vertexBin));
- TH1F* hFMDAllChannels = (TH1F*)fListOfHits.FindObject(Form("hFMDAllChannels_vtx%d",vertexBin));
-
- AliESDFMD* fmd = esdevent->GetFMDData();
-
- for(UShort_t d=1;d<=3;d++) {
- Int_t nRings = (d==1 ? 1 : 2);
- for (UShort_t ir = 0; ir < nRings; ir++) {
- Char_t r = (ir == 0 ? 'I' : 'O');
- UShort_t nsec = (ir == 0 ? 20 : 40);
- UShort_t nstr = (ir == 0 ? 512 : 256);
- for(UShort_t s =0; s < nsec; s++) {
- for(UShort_t str = 0; str < nstr; str++) {
- Float_t mult = fmd->Multiplicity(d,r,s,str);
-
- hFMDAllChannels->Fill(pars->GetEtaFromStrip(d,r,s,str,esdvertex[2]));
-
- if(mult != AliESDFMD::kInvalidMult)
- hFMDReadChannels->Fill(pars->GetEtaFromStrip(d,r,s,str,esdvertex[2]));
- }
- }
- }
- }
- // End, FMD dead channels
-
- for(Int_t i = 0 ;i<nTracks;i++) {
- particle = (AliMCParticle*) mcevent->GetTrack(i);
-
- if(!particle)
- continue;
-
- if(stack->IsPhysicalPrimary(i) && particle->Charge() != 0) {
-
- //if(vtxFound && isTriggered) {
- TH2F* hPrimaryInner = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimary_FMD_%c_vtx%d",'I',vertexBin));
- TH2F* hPrimaryOuter = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimary_FMD_%c_vtx%d",'O',vertexBin));
- hPrimaryInner->Fill(particle->Eta(),particle->Phi());
- hPrimaryOuter->Fill(particle->Eta(),particle->Phi());
- if( isTriggeredNSD) {
- TH2F* hPrimaryInnerNSD = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimaryNSD_FMD_%c_vtx%d",'I',vertexBin));
- TH2F* hPrimaryOuterNSD = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimaryNSD_FMD_%c_vtx%d",'O',vertexBin));
- hPrimaryInnerNSD->Fill(particle->Eta(),particle->Phi());
- hPrimaryOuterNSD->Fill(particle->Eta(),particle->Phi());
- // }
- }
- TH2F* hAnalysedInner = (TH2F*)fListOfPrimaries.FindObject( Form("Analysed_FMD%c_vtx%d",'I',vertexBin));
- TH2F* hAnalysedOuter = (TH2F*)fListOfPrimaries.FindObject( Form("Analysed_FMD%c_vtx%d",'O',vertexBin));
- TH2F* hAnalysedNSDInner = (TH2F*)fListOfPrimaries.FindObject( Form("AnalysedNSD_FMD%c_vtx%d",'I',vertexBin));
- TH2F* hAnalysedNSDOuter = (TH2F*)fListOfPrimaries.FindObject( Form("AnalysedNSD_FMD%c_vtx%d",'O',vertexBin));
- TH2F* hInelInner = (TH2F*)fListOfPrimaries.FindObject( Form("Inel_FMD%c_vtx%d",'I',vertexBin));
- TH2F* hInelOuter = (TH2F*)fListOfPrimaries.FindObject( Form("Inel_FMD%c_vtx%d",'O',vertexBin));
- TH2F* hNSDInner = (TH2F*)fListOfPrimaries.FindObject( Form("NSD_FMD%c_vtx%d",'I',vertexBin));
- TH2F* hNSDOuter = (TH2F*)fListOfPrimaries.FindObject( Form("NSD_FMD%c_vtx%d",'O',vertexBin));
-
- //if(vtxFound && isTriggered) {
- if(isTriggeredNSD) {
- hAnalysedNSDInner->Fill(particle->Eta(),particle->Phi());
- hAnalysedNSDOuter->Fill(particle->Eta(),particle->Phi());
- }
- if(isTriggered && vtxFound) {
- hAnalysedInner->Fill(particle->Eta(),particle->Phi());
- hAnalysedOuter->Fill(particle->Eta(),particle->Phi());
- }
- hInelInner->Fill(particle->Eta(),particle->Phi());
- hInelOuter->Fill(particle->Eta(),particle->Phi());
-
- if(nsd) {
- hNSDInner->Fill(particle->Eta(),particle->Phi());
- hNSDOuter->Fill(particle->Eta(),particle->Phi());
- }
- }
- //if(!vtxFound || !isTriggered) continue;
-
- for(Int_t j=0; j<particle->GetNumberOfTrackReferences();j++) {
-
- AliTrackReference* ref = particle->GetTrackReference(j);
-
- if(ref->DetectorId() != AliTrackReference::kFMD)
- continue;
-
- AliFMDStripIndex::Unpack(ref->UserId(),det,ring,sec,strip);
- Float_t thisStripTrack = fLastTrackByStrip(det,ring,sec,strip);
- if(particle->Charge() != 0 && i != thisStripTrack ) {
-
- Float_t phi = pars->GetPhiFromSector(det,ring,sec);
- Float_t eta = pars->GetEtaFromStrip(det,ring,sec,strip,vertex.At(2));
-
- TH2F* hHits = (TH2F*)fListOfHits.FindObject(Form("hHits_FMD%d%c_vtx%d", det,ring,vertexBin));
- hHits->Fill(eta,phi);
- if( isTriggeredNSD) {
- TH2F* hHitsNSD = (TH2F*)fListOfHits.FindObject(Form("hHitsNSD_FMD%d%c_vtx%d", det,ring,vertexBin));
- hHitsNSD->Fill(eta,phi);
- }
-
- Float_t nstrips = (ring =='O' ? 256 : 512);
- fHitsByStrip(det,ring,sec,strip) +=1;
- TH1F* allHits = (TH1F*)fListOfHits.FindObject(Form("allHits_FMD%d%c",det,ring));
- TH1F* doubleHits = (TH1F*)fListOfHits.FindObject(Form("DoubleHits_FMD%d%c",det,ring));
-
- if(fHitsByStrip(det,ring,sec,strip) == 1)
- allHits->Fill(eta);
-
- doubleHits->Fill(eta);
-
- fLastTrackByStrip(det,ring,sec,strip) = (Float_t)i;
- if(strip >0)
- fLastTrackByStrip(det,ring,sec,strip-1) = (Float_t)i;
- if(strip < (nstrips - 1))
- fLastTrackByStrip(det,ring,sec,strip+1) = (Float_t)i;
- }
- }
-
- }
-
-
- if(vtxFound && isTriggered) {
- //SPD part HHD
- TH2F* hSPDMult = (TH2F*)fListOfHits.FindObject(Form("hSPDhits_vtx%d", vertexBin));
-
- const AliMultiplicity* spdmult = esdevent->GetMultiplicity();
- for(Int_t j = 0; j< spdmult->GetNumberOfTracklets();j++)
- hSPDMult->Fill(spdmult->GetEta(j),spdmult->GetPhi(j));
-
- for(Int_t j = 0; j< spdmult->GetNumberOfSingleClusters();j++)
- hSPDMult->Fill(-TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)),spdmult->GetPhiSingle(j));
-
- }
-
- PostData(1, &fListOfHits);
- PostData(2, &fListOfPrimaries);
- PostData(3, &fVertexBins);
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskGenerateCorrection::Terminate(Option_t */*option*/)
-{
- /* TH1F* allHits = (TH1F*)fListOfHits.FindObject("allHits");
- TH1F* doubleHits = (TH1F*)fListOfHits.FindObject("DoubleHits");
-
- doubleHits->Divide(allHits);
- GenerateCorrection();
- PostData(1, &fListOfHits);
- PostData(4, &fListOfCorrection);*/
-
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskGenerateCorrection::GenerateCorrection() {
-
- fBackground = new AliFMDAnaCalibBackgroundCorrection();
- fEventSelectionEff = new AliFMDAnaCalibEventSelectionEfficiency();
-
- //Event selection
- TH1F* hEventsSelected = (TH1F*)fListOfHits.FindObject("EventsSelected");
- TH1F* hEventsSelectedVtx = (TH1F*)fListOfHits.FindObject("EventsSelectedVtx");
- TH1F* hEventsSelectedTrigger = (TH1F*)fListOfHits.FindObject("EventsSelectedTrigger");
- TH1F* hEventsSelectedNSDVtx = (TH1F*)fListOfHits.FindObject("EventsSelectedNSDVtx");
- TH1F* hEventsSelectedNSD = (TH1F*)fListOfHits.FindObject("EventsSelectedNSD");
-
- TH1F* hEventsAll = (TH1F*)fListOfPrimaries.FindObject("EventsAll");
- TH1F* hEventsAllNSD = (TH1F*)fListOfPrimaries.FindObject("EventsAllNSD");
- TH1F* hEventsSelectedVtxDivByTr = (TH1F*)hEventsSelectedVtx->Clone("hEventsSelectedVtxDivByTr");
- TH1F* hEventsSelectedNSDVtxDivByNSD = (TH1F*)hEventsSelectedNSDVtx->Clone("hEventsSelectedNSDVtxDivByNSD");
-
- fListOfHits.Add(hEventsSelectedVtxDivByTr);
- fListOfHits.Add(hEventsSelectedNSDVtxDivByNSD);
- hEventsSelectedNSDVtxDivByNSD->Divide(hEventsSelectedNSD);
- hEventsSelectedVtxDivByTr->Divide(hEventsSelectedTrigger);
-
- for(Int_t v=0;v<fNvtxBins ; v++) {
- TH2F* hAnalysedInner = (TH2F*)fListOfPrimaries.FindObject(Form("Analysed_FMD%c_vtx%d",'I',v));
- TH2F* hAnalysedOuter = (TH2F*)fListOfPrimaries.FindObject(Form("Analysed_FMD%c_vtx%d",'O',v));
- TH2F* hAnalysedNSDInner = (TH2F*)fListOfPrimaries.FindObject( Form("AnalysedNSD_FMD%c_vtx%d",'I',v));
- TH2F* hAnalysedNSDOuter = (TH2F*)fListOfPrimaries.FindObject( Form("AnalysedNSD_FMD%c_vtx%d",'O',v));
-
- TH2F* hInelInner = (TH2F*)fListOfPrimaries.FindObject(Form("Inel_FMD%c_vtx%d",'I',v));
- TH2F* hInelOuter = (TH2F*)fListOfPrimaries.FindObject(Form("Inel_FMD%c_vtx%d",'O',v));
- TH2F* hNSDInner = (TH2F*)fListOfPrimaries.FindObject( Form("NSD_FMD%c_vtx%d",'I',v));
- TH2F* hNSDOuter = (TH2F*)fListOfPrimaries.FindObject( Form("NSD_FMD%c_vtx%d",'O',v));
- // hAnalysedInner->Scale((hEventsSelected->GetBinContent(v+1) == 0 ? 0 : 1/hEventsSelected->GetBinContent(v+1)));
- //hAnalysedOuter->Scale((hEventsSelected->GetBinContent(v+1) == 0 ? 0 : 1/hEventsSelected->GetBinContent(v+1)));
-
- hAnalysedInner->Scale((hEventsSelectedTrigger->GetBinContent(v+1) == 0 ? 0 : 1/hEventsSelectedTrigger->GetBinContent(v+1)));
-
- hAnalysedOuter->Scale((hEventsSelectedTrigger->GetBinContent(v+1) == 0 ? 0 : 1/hEventsSelectedTrigger->GetBinContent(v+1)));
- hAnalysedNSDInner->Scale((hEventsSelectedNSD->GetBinContent(v+1) == 0 ? 0 : 1/hEventsSelectedNSD->GetBinContent(v+1)));
-
- hAnalysedNSDOuter->Scale((hEventsSelectedNSD->GetBinContent(v+1) == 0 ? 0 : 1/hEventsSelectedNSD->GetBinContent(v+1)));
-
-
-
- hInelInner->Scale((hEventsAll->GetBinContent(v+1) == 0 ? 0 : 1/hEventsAll->GetBinContent(v+1)));
- hInelOuter->Scale((hEventsAll->GetBinContent(v+1) == 0 ? 0 : 1/hEventsAll->GetBinContent(v+1)));
-
- hNSDInner->Scale((hEventsAllNSD->GetBinContent(v+1) == 0 ? 0 : 1/hEventsAllNSD->GetBinContent(v+1)));
- hNSDOuter->Scale((hEventsAllNSD->GetBinContent(v+1) == 0 ? 0 : 1/hEventsAllNSD->GetBinContent(v+1)));
-
-
- hAnalysedInner->Divide(hInelInner);
- hAnalysedOuter->Divide(hInelOuter);
-
- hAnalysedNSDInner->Divide(hNSDInner);
- hAnalysedNSDOuter->Divide(hNSDOuter);
-
- fEventSelectionEff->SetCorrection("INEL",v,'I',hAnalysedInner);
- fEventSelectionEff->SetCorrection("INEL",v,'O',hAnalysedOuter);
- //NSD
- fEventSelectionEff->SetCorrection("NSD",v,'I',hAnalysedNSDInner);
- fEventSelectionEff->SetCorrection("NSD",v,'O',hAnalysedNSDOuter);
-
- //FMD dead channels
- TH1F* hFMDReadChannels = (TH1F*)fListOfHits.FindObject(Form("hFMDReadChannels_vtx%d",v));
-
- TH1F* hFMDAllChannels = (TH1F*)fListOfHits.FindObject(Form("hFMDAllChannels_vtx%d",v));
- if(hFMDReadChannels) {
- TH1F* hFMDDeadCorrection = (TH1F*)hFMDReadChannels->Clone("hFMDDeadCorrection");
- hFMDDeadCorrection->Divide(hFMDAllChannels);
- fBackground->SetFMDDeadCorrection(v,hFMDDeadCorrection);
- fListOfCorrection.Add(hFMDDeadCorrection);
- }
- else AliWarning("No Dead Channel Correction generated");
-
- }
-
- Float_t vtxEff = 1;
- if(hEventsSelectedTrigger->GetEntries())
- vtxEff = hEventsSelectedVtx->GetEntries() / hEventsSelectedTrigger->GetEntries();
- fEventSelectionEff->SetVtxToTriggerRatio(vtxEff);
-
- // hEventsAll->Divide(hEventsAll,hEventsSelected,1,1,"B");
- hEventsSelectedVtx->Divide(hEventsAll);
- hEventsSelectedTrigger->Divide(hEventsAll);
-
- hEventsSelectedNSDVtx->Divide(hEventsAllNSD);
- hEventsSelectedNSD->Divide(hEventsAllNSD);
-
- for(Int_t i = 1; i<=hEventsSelected->GetNbinsX(); i++) {
- if(hEventsSelected->GetBinContent(i) == 0 )
- continue;
- Float_t b = hEventsSelected->GetBinContent(i);
- // Float_t b = hEventsSelected->GetBinContent(i)*hEventsSelectedTrigger->GetBinContent(i);
- Float_t db = hEventsSelected->GetBinError(i);
- Float_t sum = hEventsAll->GetBinContent(i);
- Float_t dsum = hEventsAll->GetBinError(i);
- Float_t a = sum-b;
- Float_t da = TMath::Sqrt(TMath::Power(db,2) + TMath::Power(dsum,2));
-
- Float_t cor = sum / b;
- Float_t ecor = TMath::Sqrt(TMath::Power(da,2) + TMath::Power(a/(b*db),2)) / b;
-
- hEventsAll->SetBinContent(i,cor);
- hEventsAll->SetBinError(i,ecor);
-
- }
-
- //TH1F* hEventTest = (TH1F*)hEventsAll->Clone("hEventTest");
-
-
-
- fEventSelectionEff->SetCorrection(hEventsAll);
-
- for(Int_t det= 1; det <=3; det++) {
- Int_t nRings = (det==1 ? 1 : 2);
-
- for(Int_t iring = 0; iring<nRings; iring++) {
- Char_t ring = (iring == 0 ? 'I' : 'O');
- TH1F* allHits = (TH1F*)fListOfHits.FindObject(Form("allHits_FMD%d%c",det,ring));
- TH1F* doubleHits = (TH1F*)fListOfHits.FindObject(Form("DoubleHits_FMD%d%c",det,ring));
- allHits->Divide(doubleHits);
-
- fBackground->SetDoubleHitCorrection(det,ring,allHits);
-
- for(Int_t vertexBin=0;vertexBin<fNvtxBins ;vertexBin++) {
- TH2F* hHits = (TH2F*)fListOfHits.FindObject(Form("hHits_FMD%d%c_vtx%d", det,ring,vertexBin));
- TH2F* hPrimary = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimary_FMD_%c_vtx%d",ring,vertexBin));
- TH2F* hCorrection = (TH2F*)hHits->Clone(Form("FMD%d%c_vtxbin_%d_correction",det,ring,vertexBin));
- hCorrection->Divide(hPrimary);
-
- TH2F* hHitsNSD = (TH2F*)fListOfHits.FindObject(Form("hHitsNSD_FMD%d%c_vtx%d", det,ring,vertexBin));
- TH2F* hPrimaryNSD = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimaryNSD_FMD_%c_vtx%d",ring,vertexBin));
- TH2F* hCorrectionNSD = 0;
- if(hHitsNSD && hPrimaryNSD) {
- hCorrectionNSD = (TH2F*)hHitsNSD->Clone(Form("FMDNSD%d%c_vtxbin_%d_correction",det,ring,vertexBin));
- hCorrectionNSD->Divide(hPrimaryNSD);
- }
-
- hCorrection->SetTitle(hCorrection->GetName());
- fListOfCorrection.Add(hCorrection);
- fBackground->SetBgCorrection(det,ring,vertexBin,hCorrection);
-
- if(hCorrectionNSD) {
- fBackground->SetNSDBgCorrection(det,ring,vertexBin,hCorrectionNSD);
- hCorrectionNSD->SetTitle(hCorrectionNSD->GetName());
- fListOfCorrection.Add(hCorrectionNSD);
- }
-
- }
-
- }
- }
- for(Int_t vertexBin=0;vertexBin<fNvtxBins ;vertexBin++) {
- TH2F* hPrimary = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimary_FMD_%c_vtx%d",'I',vertexBin));
- TH2F* hSPDMult = (TH2F*)fListOfHits.FindObject(Form("hSPDhits_vtx%d", vertexBin));
- if(!hSPDMult) continue;
-
- TH2F* hCorrection = (TH2F*)hSPDMult->Clone(Form("SPD_vtxbin_%d_correction",vertexBin));
- hCorrection->SetTitle(hCorrection->GetName());
- fListOfCorrection.Add(hCorrection);
- hCorrection->Divide(hPrimary);
-
-
- TH1F* hAlive = new TH1F(Form("hAliveSPD_vtxbin%d",vertexBin),Form("hAliveSPD_vtxbin%d",vertexBin),hSPDMult->GetNbinsX(),hSPDMult->GetXaxis()->GetXmin(), hSPDMult->GetXaxis()->GetXmax());
- TH1F* hPresent = new TH1F(Form("hPresentSPD_vtxbin%d",vertexBin),Form("hPresentSPD_vtxbin%d",vertexBin),hSPDMult->GetNbinsX(),hSPDMult->GetXaxis()->GetXmin(), hSPDMult->GetXaxis()->GetXmax());
- for(Int_t xx = 1; xx <=hSPDMult->GetNbinsX(); xx++) {
-
-
-
- for(Int_t yy = 1; yy <=hSPDMult->GetNbinsY(); yy++) {
- if(TMath::Abs(hCorrection->GetXaxis()->GetBinCenter(xx)) > 1.9) {
- hCorrection->SetBinContent(xx,yy,0.);
- hCorrection->SetBinError(xx,yy,0.);
- }
-
- if(hCorrection->GetBinContent(xx,yy) > 0.9) {
- hAlive->Fill(hCorrection->GetXaxis()->GetBinCenter(xx) );
- }
- else {
- hCorrection->SetBinContent(xx,yy,0.);
- hCorrection->SetBinError(xx,yy,0.);
- }
-
- hPresent->Fill(hCorrection->GetXaxis()->GetBinCenter(xx));
-
- }
- }
- TH1F* hDeadCorrection = (TH1F*)hAlive->Clone(Form("hSPDDeadCorrection_vtxbin%d",vertexBin));
- hDeadCorrection->Divide(hPresent);
- fBackground->SetSPDDeadCorrection(vertexBin,hDeadCorrection);
- fListOfCorrection.Add(hDeadCorrection);
-
- fBackground->SetBgCorrection(0,'Q',vertexBin,hCorrection);
- }
-
-
- TAxis refAxis(fNvtxBins,-1*fZvtxCut,fZvtxCut);
- fBackground->SetRefAxis(&refAxis);
-
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskGenerateCorrection::ReadFromFile(const Char_t* filename, Bool_t storeInOCDB, Int_t /*runNo*/) {
-
- TFile infile(filename);
- TH1F* hVertex = (TH1F*)infile.Get("VertexBins");
- fZvtxCut = hVertex->GetXaxis()->GetXmax();
- fNvtxBins = hVertex->GetXaxis()->GetNbins();
- fVertexBins.SetName("VertexBins");
- fVertexBins.GetXaxis()->Set(fNvtxBins,-1*fZvtxCut,fZvtxCut);
-
- TList* listOfHits = (TList*)infile.Get("Hits");
- TList* listOfPrim = (TList*)infile.Get("Primaries");
-
- TH1F* hEventsSelected = (TH1F*)listOfHits->FindObject("EventsSelected");
- TH1F* hEventsSelectedVtx = (TH1F*)listOfHits->FindObject("EventsSelectedVtx");
- TH1F* hEventsSelectedTrigger = (TH1F*)listOfHits->FindObject("EventsSelectedTrigger");
- TH1F* hEventsSelectedNSDVtx = (TH1F*)listOfHits->FindObject("EventsSelectedNSDVtx");
- TH1F* hEventsSelectedNSD = (TH1F*)listOfHits->FindObject("EventsSelectedNSD");
- TH1F* hEventsAll = (TH1F*)listOfPrim->FindObject("EventsAll");
- TH1F* hEventsAllNSD = (TH1F*)listOfPrim->FindObject("EventsAllNSD");
-
- fListOfHits.Add(hEventsSelected);
- fListOfHits.Add(hEventsSelectedVtx);
- fListOfHits.Add(hEventsSelectedNSD);
- fListOfHits.Add(hEventsSelectedNSDVtx);
- fListOfHits.Add(hEventsSelectedTrigger);
- fListOfPrimaries.Add(hEventsAll);
- fListOfPrimaries.Add(hEventsAllNSD);
-
- TH1F* hXvtx = (TH1F*)listOfPrim->FindObject("hXvtx");
- TH1F* hYvtx = (TH1F*)listOfPrim->FindObject("hYvtx");
- TH1F* hZvtx = (TH1F*)listOfPrim->FindObject("hZvtx");
- fListOfPrimaries.Add(hXvtx);
- fListOfPrimaries.Add(hYvtx);
- fListOfPrimaries.Add(hZvtx);
-
- for(Int_t det =1; det<=3;det++)
- {
- Int_t nRings = (det==1 ? 1 : 2);
- for(Int_t ring = 0;ring<nRings;ring++)
- {
- Char_t ringChar = (ring == 0 ? 'I' : 'O');
- TH1F* allHits = (TH1F*)listOfHits->FindObject(Form("allHits_FMD%d%c",det,ringChar));
- TH1F* doubleHits = (TH1F*)listOfHits->FindObject(Form("DoubleHits_FMD%d%c",det,ringChar));
- fListOfHits.Add(allHits);
- fListOfHits.Add(doubleHits);
- for(Int_t v=0; v<fNvtxBins;v++)
- {
-
- TH2F* hHits = (TH2F*)listOfHits->FindObject(Form("hHits_FMD%d%c_vtx%d", det,ringChar,v));
- fListOfHits.Add(hHits);
- TH2F* hHitsNSD = (TH2F*)listOfHits->FindObject(Form("hHitsNSD_FMD%d%c_vtx%d", det,ringChar,v));
- if(hHitsNSD)
- fListOfHits.Add(hHitsNSD);
- }
- }
- }
- for(Int_t v=0; v<fNvtxBins;v++) {
- TH2F* hSPDHits = (TH2F*)listOfHits->FindObject(Form("hSPDhits_vtx%d", v));
- fListOfHits.Add(hSPDHits);
- TH1F* hFMDReadChannels = (TH1F*)listOfHits->FindObject(Form("hFMDReadChannels_vtx%d",v));
- TH1F* hFMDAllChannels = (TH1F*)listOfHits->FindObject(Form("hFMDAllChannels_vtx%d",v));
-
- if(hFMDReadChannels && hFMDAllChannels) {
- fListOfHits.Add(hFMDReadChannels);
- fListOfHits.Add(hFMDAllChannels);
- }
- for(Int_t iring = 0; iring<2;iring++) {
- Char_t ringChar = (iring == 0 ? 'I' : 'O');
-
-
- TH2F* hPrimary = (TH2F*)listOfPrim->FindObject( Form("hPrimary_FMD_%c_vtx%d",ringChar,v));
- TH2F* hPrimaryNSD = (TH2F*)listOfPrim->FindObject( Form("hPrimaryNSD_FMD_%c_vtx%d",ringChar,v));
-
- TH2F* hAnalysed = (TH2F*)listOfPrim->FindObject(Form("Analysed_FMD%c_vtx%d",ringChar,v));
- TH2F* hAnalysedNSD = (TH2F*)listOfPrim->FindObject(Form("AnalysedNSD_FMD%c_vtx%d",ringChar,v));
- TH2F* hInel = (TH2F*)listOfPrim->FindObject(Form("Inel_FMD%c_vtx%d",ringChar,v));
- TH2F* hNSD = (TH2F*)listOfPrim->FindObject(Form("NSD_FMD%c_vtx%d",ringChar,v));
-
- fListOfPrimaries.Add(hPrimary);
- if(hPrimaryNSD)
- fListOfPrimaries.Add(hPrimaryNSD);
- fListOfPrimaries.Add(hAnalysed);
- fListOfPrimaries.Add(hInel);
- fListOfPrimaries.Add(hAnalysedNSD);
- fListOfPrimaries.Add(hNSD);
- }
- }
- GenerateCorrection();
-
- TFile fout("backgroundFromFile.root","recreate");
- fListOfHits.Write();
- fListOfPrimaries.Write();
- fListOfCorrection.Write();
- fVertexBins.Write();
-
- fout.Close();
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- if (!storeInOCDB) {
- pars->SetBackgroundPath(".");
- pars->SetEnergyPath(".");
- pars->SetEventSelectionPath(".");
- pars->SetSharingEfficiencyPath(".");
- }
- AliInfo(Form("Generating %s", pars->GetPath(pars->GetBackgroundID())));
- TFile fbg(pars->GetPath(pars->GetBackgroundID()),"RECREATE");
- fBackground->Write(AliFMDAnaParameters::GetBackgroundID());
- fbg.Close();
-
- AliInfo(Form("Generating %s", pars->GetPath(pars->GetEventSelectionEffID())));
- TFile feselect(pars->GetPath(pars->GetEventSelectionEffID()),"RECREATE");
- fEventSelectionEff->Write(AliFMDAnaParameters::GetEventSelectionEffID());
- feselect.Close();
-}
-//_____________________________________________________________________
-//
-// EOF
-//
+++ /dev/null
-#ifndef ALIFMDANALYSISTASKGENERATECORRECTION_H
-#define ALIFMDANALYSISTASKGENERATECORRECTION_H
-
-#include "AliAnalysisTaskSE.h"
-#include "TList.h"
-#include "AliFMDFloatMap.h"
-#include "TH1F.h"
-
-class AliFMDAnaCalibBackgroundCorrection;
-class AliFMDAnaCalibEventSelectionEfficiency;
-
-class AliFMDAnalysisTaskGenerateCorrection : public AliAnalysisTaskSE
-{
- public:
- AliFMDAnalysisTaskGenerateCorrection();
- AliFMDAnalysisTaskGenerateCorrection(const char* name);
- ~AliFMDAnalysisTaskGenerateCorrection() {;}
- AliFMDAnalysisTaskGenerateCorrection(const AliFMDAnalysisTaskGenerateCorrection& o) : AliAnalysisTaskSE(),
- fListOfHits(),
- fListOfPrimaries(),
- fListOfCorrection(),
- fVertexBins(o.fVertexBins),
- fLastTrackByStrip(o.fLastTrackByStrip),
- fHitsByStrip(o.fHitsByStrip),
- fZvtxCut(o.fZvtxCut),
- fNvtxBins(o.fNvtxBins),
- fNbinsEta(o.fNbinsEta),
- fBackground(o.fBackground),
- fEventSelectionEff(o.fEventSelectionEff),
- fEtaLow(o.fEtaLow),
- fEtaHigh(o.fEtaHigh)
- {}
- AliFMDAnalysisTaskGenerateCorrection& operator=(const AliFMDAnalysisTaskGenerateCorrection&) { return *this; }
-
- virtual void Init();
- virtual void UserCreateOutputObjects();
- virtual void UserExec(Option_t* /*option*/);
- void Terminate(Option_t */*option*/);
- void SetZvtxCut(Float_t vtxcut) {fZvtxCut = vtxcut;}
- void SetNvtxBins(Int_t nvtxbins) {fNvtxBins = nvtxbins;}
- void SetNbinsEta(Int_t netabins) {fNbinsEta = netabins;}
- void SetEtaLimits(Double_t low, Double_t high) {fEtaLow = low; fEtaHigh = high;}
- void ReadFromFile(const Char_t* filename = "background.root", Bool_t storeInOCDB = kFALSE, Int_t runNo=0);
- private:
-
- void GenerateCorrection();
-
- TList fListOfHits;
- TList fListOfPrimaries;
- TList fListOfCorrection;
- TH1F fVertexBins;
- AliFMDFloatMap fLastTrackByStrip;
- AliFMDFloatMap fHitsByStrip;
- Float_t fZvtxCut;
- Int_t fNvtxBins;
- Int_t fNbinsEta;
- AliFMDAnaCalibBackgroundCorrection* fBackground;
- AliFMDAnaCalibEventSelectionEfficiency* fEventSelectionEff;
- Double_t fEtaLow;
- Double_t fEtaHigh;
- ClassDef(AliFMDAnalysisTaskGenerateCorrection, 1);
-
-};
-#endif
+++ /dev/null
-#include "AliFMDAnalysisTaskSE.h"
-#include "AliESDEvent.h"
-#include "iostream"
-#include "AliESDFMD.h"
-#include "AliMCEventHandler.h"
-#include "AliAnalysisManager.h"
-#include "AliFMDAnaParameters.h"
-#include "AliLog.h"
-#include "AliFMDDndeta.h"
-#include "TDirectory.h"
-#include "TProfile2D.h"
-ClassImp(AliFMDAnalysisTaskSE)
-//
-// This task controls the running of the FMD analysis. The current version is made for
-// dN/deta analysis but multiplicity and correlation tasks will be added here as well.
-//
-// To get the dN/detadphi per selected event as a TH2F* object connect to the
-// output list of this task in the analysis framework and do
-//
-// TH2F* hFMDdNdetadphi = (TH2F*)list->FindObject("dNdetadphiHistogramTrVtx");
-//_____________________________________________________________________
-AliFMDAnalysisTaskSE::AliFMDAnalysisTaskSE():
-AliAnalysisTaskSE(),
- fListOfHistos(0),
- fSharing("Sharing",kFALSE),
- fDensity("Density",kFALSE),
- fBackground("BackgroundCorrected",kFALSE),
- fDndeta("dNdeta",kFALSE),
- fBFCorrelation("BFCorrelation",kFALSE),
- fParams(0),
- fFirstEvent(kTRUE),
- fCentralityLow(0),
- fCentralityHigh(100)
-{
- // Default constructor
-}
-//_____________________________________________________________________
-AliFMDAnalysisTaskSE::AliFMDAnalysisTaskSE(const char* name):
- AliAnalysisTaskSE(name),
- fListOfHistos(0),
- fSharing("Sharing",kFALSE),
- fDensity("Density",kFALSE),
- fBackground("BackgroundCorrected",kFALSE),
- fDndeta("dNdeta",kFALSE),
- fBFCorrelation("BFCorrelation",kFALSE),
- fParams(0),
- fFirstEvent(kTRUE),
- fCentralityLow(0),
- fCentralityHigh(100)
-{
- SetParams(AliFMDAnaParameters::Instance());
- DefineOutput(1, TList::Class());
- // DefineOutput(2, TH2F::Class());
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskSE::UserCreateOutputObjects()
-{
-// Create the output containers
-//
-
-
- fListOfHistos = new TList();
-
- AliESDFMD* fmd = new AliESDFMD();
- AliESDVertex* vertex = new AliESDVertex();
-
- TList* densitylist = new TList();
-
- TList* bgcorlist = new TList();
-
- fSharing.SetFMDData(fmd);
- fSharing.SetVertex(vertex);
- fSharing.SetOutputList(fListOfHistos);
-
- fDensity.Init();
- fDensity.SetOutputList(densitylist);
- fDensity.SetInputESDFMD(fmd) ;
- fDensity.SetInputVertex(vertex);
-
- fBackground.SetInputList(densitylist);
- fBackground.SetOutputList(bgcorlist);
- fBackground.SetHitList(fListOfHistos);
-
- fDndeta.SetInputList(bgcorlist);
- fDndeta.SetOutputList(fListOfHistos);
- fBFCorrelation.SetInputList(bgcorlist);
- fBFCorrelation.SetOutputList(fListOfHistos);
-
- fSharing.CreateOutputObjects();
- fDensity.CreateOutputObjects();
- fBackground.CreateOutputObjects();
- fDndeta.CreateOutputObjects();
- fBFCorrelation.CreateOutputObjects();
-
-
- PostData(1, fListOfHistos);
-
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskSE::Init()
-{
- std::cout<<"Init"<<std::endl;
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskSE::UserExec(Option_t */*option*/)
-{
- // Execute analysis for current event
- //
- AliESDEvent* fESD = (AliESDEvent*)InputEvent();
-
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
- // Centrality selection - work in progress
- Float_t centrality = 1;
- if( centrality < fCentralityLow || centrality > fCentralityHigh ) return;
-
- //End of centrality selection
-
- if(fFirstEvent) {
- pars->SetParametersFromESD(fESD);
- pars->PrintStatus();
- fFirstEvent = kFALSE;
- }
-
- pars->SetTriggerStatus(fESD);
- fSharing.SetInputESD(fESD);
-
- fSharing.Exec("");
- if(fSharing.GetEventStatus()) {
- fDensity.Exec("");
- if(fDensity.GetEventStatus()) {
- fBackground.Exec("");
- if(pars->GetRunDndeta()) fDndeta.Exec("");
- if(pars->GetRunBFCorrelation()) fBFCorrelation.Exec("");
- }
- else return;
- }
- else return;
-
-
- PostData(1, fListOfHistos);
-
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskSE::Terminate(Option_t */*option*/)
-{
-
- TList* outputList = (TList*)GetOutputData(1);
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
- if(outputList) {
- fSharing.SetOutputList(outputList);
- fBackground.SetHitList(outputList);
- fDndeta.SetOutputList(outputList);
- //fBFCorrelation.SetOutputList(outputList);
- fSharing.Terminate("");
- fBackground.Terminate("");
- if(fSharing.GetVtxEfficiencyFromData() > 0)
- fDndeta.SetVtxEfficiency(fSharing.GetVtxEfficiencyFromData());
- else
- fDndeta.SetVtxEfficiency(pars->GetVtxSelectionEffFromMC());
-
- AliInfo(Form("Vertex efficiencies: NSD_data=%f, INEL_data=%f, INEL_mc=%f",
- fSharing.GetNSDVtxEfficiencyFromData(),
- fSharing.GetVtxEfficiencyFromData(),
- pars->GetVtxSelectionEffFromMC()));
-
- if(fSharing.GetNSDVtxEfficiencyFromData() > 0)
- fDndeta.SetVtxEfficiencyNSD(fSharing.GetNSDVtxEfficiencyFromData());
- else
- fDndeta.SetVtxEfficiencyNSD(pars->GetVtxSelectionEffFromMC());
-
- fDndeta.Terminate("");
- //fBFCorrelation.Terminate("");
-
- AliFMDDndeta t;
- t.SetNbinsToCut(2);
- t.Init(outputList);
- t.GenerateMult(AliFMDDndeta::kMult);
-
- TList* dNdetalist = t.GetMultList(AliFMDDndeta::kMult);
- TList* cloneList = (TList*)dNdetalist->Clone("dNdeta");
- cloneList->SetName("dNdeta");
- outputList->Add(cloneList);
-
- t.GenerateMult(AliFMDDndeta::kMultTrVtx);
- TList* dNdetalist2 = t.GetMultList(AliFMDDndeta::kMultTrVtx);
- TList* cloneList2 = (TList*)dNdetalist2->Clone("dNdetaTrVtx");
- cloneList2->SetName("dNdetaTrVtx");
- outputList->Add(cloneList2);
-
- t.GenerateMult(AliFMDDndeta::kHits);
- TList* dNdetalist3 = t.GetMultList(AliFMDDndeta::kHits);
- TList* cloneList3 = (TList*)dNdetalist3->Clone("Hits");
- cloneList3->SetName("Hits");
- outputList->Add(cloneList3);
-
- t.GenerateMult(AliFMDDndeta::kHitsTrVtx);
- TList* dNdetalist4 = t.GetMultList(AliFMDDndeta::kHits);
- TList* cloneList4 = (TList*)dNdetalist4->Clone("HitsTrVtx");
- cloneList4->SetName("HitsTrVtx");
- outputList->Add(cloneList4);
-
- t.GenerateMult(AliFMDDndeta::kMultNSD);
- TList* dNdetalist5 = t.GetMultList(AliFMDDndeta::kMultNSD);
- TList* cloneList5 = (TList*)dNdetalist5->Clone("MultNSD");
- cloneList5->SetName("MultNSD");
- outputList->Add(cloneList5);
-
- // TFile file("fmd_ana_histos_tmp.root","RECREATE");
- // fListOfHistos->Write();
- // file.Close();
- }
- else
- AliWarning("no merged output from manager");
-
-
-}
-
-//_____________________________________________________________________
-void AliFMDAnalysisTaskSE::Print(Option_t* option) const
-{
- AliInfo(Form("FMD Single Event Analysis Task\n"
- "Parameters set to %p", fParams));
- TString opt(option);
- opt.ToLower();
- if (opt.Contains("s")) {
- fSharing.Print(option);
- fDensity.Print(option);
- fBackground.Print(option);
- fDndeta.Print(option);
- fBFCorrelation.Print(option);
- }
- if (opt.Contains("p") && fParams)
- fParams->Print(option);
-}
-
-//_____________________________________________________________________
-//
-// EOF
-//
-// EOF
+++ /dev/null
-#ifndef ALIFMDANALYSISTASKSE_H
-#define ALIFMDANALYSISTASKSE_H
-
-#include "AliAnalysisTaskSE.h"
-#include "AliFMDAnalysisTaskSharing.h"
-#include "AliFMDAnalysisTaskDensity.h"
-#include "AliFMDAnalysisTaskBackgroundCorrection.h"
-#include "AliFMDAnalysisTaskDndeta.h"
-#include "AliFMDAnalysisTaskBFCorrelation.h"
-
-class AliFMDAnaParameters;
-
-/** @defgroup FMD_ana Analysis tasks
- @brief Various classes to do analysis tasks
-*/
-
-/**
- * @class AliFMDAnalysisTaskSE
- * @brief Collected analysis task
- * @ingroup FMD_ana
- *
- * Collector of various analysis tasks. It will do the full chain of
- * analysis tasks:
- *
- * - AliFMDAnalysisTaskSharing
- * - AliFMDAnalysisTaskDensity
- * - AliFMDAnalysisTaskBackgroundCorrection
- * - AliFMDAnalysisTaskDndeta
- * - AliFMDAnalysisTaskBFCorrelation
- */
-
-class AliFMDAnalysisTaskSE : public AliAnalysisTaskSE
-{
-public: //
- AliFMDAnalysisTaskSE();
- AliFMDAnalysisTaskSE(const char* name);
- virtual ~AliFMDAnalysisTaskSE() {;}
- AliFMDAnalysisTaskSE(const AliFMDAnalysisTaskSE& o)
- : AliAnalysisTaskSE(),
- fListOfHistos(o.fListOfHistos),
- fSharing(o.fSharing),
- fDensity(o.fDensity),
- fBackground(o.fBackground),
- fDndeta(o.fDndeta),
- fBFCorrelation(o.fBFCorrelation),
- fParams(o.fParams),
- fFirstEvent(o.fFirstEvent),
- fCentralityLow(o.fCentralityLow),
- fCentralityHigh(o.fCentralityHigh)
- {}
- AliFMDAnalysisTaskSE& operator=(const AliFMDAnalysisTaskSE&) { return *this; }
-
- virtual void Init();
- virtual void UserCreateOutputObjects();
- virtual void UserExec(Option_t* /*option*/);
- void Terminate(Option_t */*option*/);
- void SetParams(AliFMDAnaParameters* p) { fParams = p; }
- 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
- AliFMDAnalysisTaskBFCorrelation fBFCorrelation; // BF correlation task
- AliFMDAnaParameters* fParams; // Analysis parameters
- Bool_t fFirstEvent; // Is the next event the first event ?
- Float_t fCentralityLow; // Low centrality
- Float_t fCentralityHigh; // High centrality
-
- ClassDef(AliFMDAnalysisTaskSE, 1);
-
-};
-#endif
-// Local Variables:
-// mode: C++
-// End:
+++ /dev/null
-
-#include <TROOT.h>
-#include <TSystem.h>
-#include <TInterpreter.h>
-#include <TChain.h>
-#include <TFile.h>
-#include <TList.h>
-#include <iostream>
-#include <TMath.h>
-//#include "AliFMDDebug.h"
-#include "AliFMDAnalysisTaskSharing.h"
-#include "AliAnalysisManager.h"
-#include "AliESDFMD.h"
-//#include "AliFMDGeometry.h"
-#include "AliMCEventHandler.h"
-#include "AliMCEvent.h"
-#include "AliStack.h"
-#include "AliESDVertex.h"
-#include "AliMultiplicity.h"
-#include "AliFMDAnaParameters.h"
-#include "TH1F.h"
-#include "TObjString.h"
-//#include "/home/canute/ALICE/AliRoot/PWG0/AliPWG0Helper.h"
-//#include "AliFMDParameters.h"
-#include "AliGenEventHeader.h"
-#include "AliGenPythiaEventHeader.h"
-#include "AliHeader.h"
-#include "AliStack.h"
-#include "AliMCParticle.h"
-#include "AliFMDStripIndex.h"
-#include "AliESDVZERO.h"
-#include "AliESDtrack.h"
-#include "AliGenDPMjetEventHeader.h"
-#include "AliLog.h"
-
-// This is the task to do the FMD sharing or hit merging.
-// It reads the input ESDFMD data and posts an ESDFMD object to
-// the tasks that must be performed after this task ie.
-// Density, BackgroundCorrection and Dndeta.
-// Author: Hans Hjersing Dalsgaard, hans.dalsgaard@cern.ch
-
-
-ClassImp(AliFMDAnalysisTaskSharing)
-
-//_____________________________________________________________________
-AliFMDAnalysisTaskSharing::AliFMDAnalysisTaskSharing()
-: fDebug(0),
- fESD(0x0),
- foutputESDFMD(),
- fSharedThis(kFALSE),
- fSharedPrev(kFALSE),
- fDiagList(0),
- fStandalone(kTRUE),
- fEsdVertex(0),
- fStatus(kTRUE),
- fLastTrackByStrip(0),
- fLastOrbit(0)
-{
- // Default constructor
- DefineInput (0, AliESDEvent::Class());
- DefineOutput(0, AliESDFMD::Class());
- DefineOutput(1, AliESDVertex::Class());
- DefineOutput(2, AliESDEvent::Class());
- DefineOutput(3, TList::Class());
-}
-//_____________________________________________________________________
-AliFMDAnalysisTaskSharing::AliFMDAnalysisTaskSharing(const char* name,
- Bool_t SE):
- AliAnalysisTask(name, "AnalysisTaskFMD"),
- fDebug(0),
- fESD(0x0),
- foutputESDFMD(),
- fSharedThis(kFALSE),
- fSharedPrev(kFALSE),
- fDiagList(0),
- fStandalone(kTRUE),
- fEsdVertex(0),
- fStatus(kTRUE),
- fLastTrackByStrip(0),
- fLastOrbit(0)
-{
- // named constructor
- fStandalone = SE;
- if(fStandalone) {
- DefineInput (0, AliESDEvent::Class());
- DefineOutput(0, AliESDFMD::Class());
- DefineOutput(1, AliESDVertex::Class());
- DefineOutput(2, AliESDEvent::Class());
- DefineOutput(3, TList::Class());
- }
-}
-//_____________________________________________________________________
-Float_t AliFMDAnalysisTaskSharing::GetVtxEfficiencyFromData(){
-
- TH1F* hEventsVtx = (TH1F*)fDiagList->FindObject("hEventsVtx");
- TH1F* hEventsTr = (TH1F*)fDiagList->FindObject("hEventsTr");
-
- if(hEventsTr->GetEntries() != 0 &&
- hEventsVtx->GetEntries() != 0 &&
- hEventsTr->GetEntries() != hEventsVtx->GetEntries())
- return hEventsVtx->GetEntries() / hEventsTr->GetEntries();
- else return -1;
-
-}
-//_____________________________________________________________________
-Float_t AliFMDAnalysisTaskSharing::GetNSDVtxEfficiencyFromData()
-{
-
- TH1F* hEventsNSDVtx = (TH1F*)fDiagList->FindObject("hEventsNSDVtx");
- TH1F* hEventsNSD = (TH1F*)fDiagList->FindObject("hEventsNSD");
-
- if(hEventsNSD->GetEntries() != 0 &&
- hEventsNSDVtx->GetEntries() != 0 &&
- hEventsNSD->GetEntries() != hEventsNSDVtx->GetEntries())
- return hEventsNSDVtx->GetEntries() / hEventsNSD->GetEntries();
- else return -1;
-
-}
-
-
-//_____________________________________________________________________
-void AliFMDAnalysisTaskSharing::CreateOutputObjects()
-{
- // Create the output objects
- if(!foutputESDFMD)
- foutputESDFMD = new AliESDFMD();
-
- if(!fEsdVertex)
- fEsdVertex = new AliESDVertex();
- //Diagnostics
- if(!fDiagList)
- fDiagList = new TList();
-
- fDiagList->SetName("Sharing diagnostics");
-
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- TH2F* hBg = pars->GetBackgroundCorrection(1, 'I', 0);
- TH1F* hPrimary = new TH1F("hMultvsEtaNoCuts","hMultvsEtaNoCuts",
- hBg->GetNbinsX(),
- hBg->GetXaxis()->GetXmin(),
- hBg->GetXaxis()->GetXmax());
- hPrimary->Sumw2();
- fDiagList->Add(hPrimary);
-
- TH1F* hPrimaryNSD = new TH1F("hMultvsEtaNSDNoCuts","hMultvsEtaNSDNoCuts",
- hBg->GetNbinsX(),
- hBg->GetXaxis()->GetXmin(),
- hBg->GetXaxis()->GetXmax());
- hPrimaryNSD->Sumw2();
- fDiagList->Add(hPrimaryNSD);
-
- TH1F* hXvtx = new TH1F("hXvtx","x vertex distribution",100,-2,2);
- TH1F* hYvtx = new TH1F("hYvtx","y vertex distribution",100,-2,2);
- TH1F* hZvtx = new TH1F("hZvtx","z vertex distribution",
- 4*pars->GetNvtxBins(),
- -4*pars->GetVtxCutZ(),
- +4*pars->GetVtxCutZ());
-
- fDiagList->Add(hXvtx);
- fDiagList->Add(hYvtx);
- fDiagList->Add(hZvtx);
-
- TH1F* hPrimVertexBin = 0;
- TH1F* hHits = 0;
- for(Int_t i = 0; i< pars->GetNvtxBins(); i++) {
-
- hPrimVertexBin = new TH1F(Form("primmult_NoCuts_vtxbin%d",i),
- Form("primmult_NoCuts_vtxbin%d",i),
- hBg->GetNbinsX(),
- hBg->GetXaxis()->GetXmin(),
- hBg->GetXaxis()->GetXmax());
- hPrimVertexBin->Sumw2();
- fDiagList->Add(hPrimVertexBin);
-
- }
-
- for(Int_t det = 1; det<=3; det++) {
- Int_t nRings = (det==1 ? 1 : 2);
-
- for(Int_t iring = 0;iring<nRings; iring++) {
- Char_t ringChar = (iring == 0 ? 'I' : 'O');
- TH1F* hEdist = new TH1F(Form("Edist_before_sharing_FMD%d%c", det, ringChar),
- Form("Edist_before_sharing_FMD%d%c", det, ringChar),
- 1000,0,25);
- TH1F* hEdistAfter = new TH1F(Form("Edist_after_sharing_FMD%d%c", det, ringChar),
- Form("Edist_after_sharing_FMD%d%c", det, ringChar),
- 1000,0,25);
-
-
- //TH1F* hNstripsHit = new TH1F(Form("N_strips_hit_FMD%d%c",det,ringChar),
- // Form("N_strips_hit_FMD%d%c",det,ringChar),
- // 25,0,25);
- fDiagList->Add(hEdist);
- fDiagList->Add(hEdistAfter);
- //fDiagList->Add(hNstripsHit);
-
- for(Int_t i = 0; i< pars->GetNvtxBins(); i++) {
- hHits = new TH1F(Form("hMCHits_nocuts_FMD%d%c_vtxbin%d",det,ringChar,i),Form("hMCHits_FMD%d%c_vtxbin%d",det,ringChar,i),
- hBg->GetNbinsX(),
- hBg->GetXaxis()->GetXmin(),
- hBg->GetXaxis()->GetXmax());
- hHits->Sumw2();
- fDiagList->Add(hHits);
-
- }
-
- }
- }
- TH2F* hCorrelationFMDSPDhits = new TH2F("hCorrelationFMDSPDhits","hCorrelationFMDSPDhits;SPD;FMD ",100,0,200,100,0,500);
- TH2F* hCorrelationFMDSPD = new TH2F("hCorrelationFMDSPD","hCorrelationFMDSPD;SPD;FMD ",100,0,200,100,0,500);
- TH2F* hCorrelationFMD1SPD = new TH2F("hCorrelationFMD1SPD","hCorrelationFMD1SPD;SPD;FMD1 ",100,0,200,100,0,200);
- TH2F* hCorrelationFMD2ISPD = new TH2F("hCorrelationFMD2ISPD","hCorrelationFMD2ISPD;SPD;FMD2I ",100,0,200,100,0,200);
- TH2F* hCorrelationFMD2OSPD = new TH2F("hCorrelationFMD2OSPD","hCorrelationFMD2OSPD;SPD;FMD2O ",100,0,200,100,0,200);
- TH2F* hCorrelationFMD3ISPD = new TH2F("hCorrelationFMD3ISPD","hCorrelationFMD3ISPD;SPD;FMD3I ",100,0,200,100,0,200);
- TH2F* hCorrelationFMD3OSPD = new TH2F("hCorrelationFMD3OSPD","hCorrelationFMD3OSPD;SPD;FMD3O ",100,0,200,100,0,200);
- TH2F* hCorrelationFMDGoodtracks = new TH2F("hCorrelationFMDGoodtracks","hCorrelationGoodtracks;good tracks;FMD ",100,0,200,100,0,200);
- TH2F* hCorrelationFMDBadtracks = new TH2F("hCorrelationFMDBadtracks","hCorrelationBadtracks;bad tracks;FMD ",100,0,200,100,0,200);
- TH2F* hCorrelationGoodbadtracks = new TH2F("hCorrelationGoodbadtracks","hCorrelationGoodbadtracks;good tracks;bad tracks ",100,0,200,100,0,200);
- TH2F* hCorrelationSPDTracklets = new TH2F("hCorrelationSPDTracklets","hCorrelationSPDTracklets;hits ; tracklets ",100,0,500,100,0,200);
- TH2F* hCorrelationClustersTracklets = new TH2F("hCorrelationClustersTracklets","hCorrelationClustersTracklets;clusters ; tracklets ",500,0,500,100,0,100);
- TH2F* hCorrelationHitsRadius = new TH2F("hCorrelationHitsRadius","hCorrelationHitsRadius;hits ; radius ",100,0,500,100,0,10);
- TH2F* hCorrelationHitsX = new TH2F("hCorrelationHitsX","hCorrelationHitsX;hits ; X ",100,0,500,100,-5,5);
- TH2F* hCorrelationHitsY = new TH2F("hCorrelationHitsY","hCorrelationHitsY;hits ; Y ",100,0,500,100,-5,5);
- fDiagList->Add(hCorrelationHitsRadius);
- fDiagList->Add(hCorrelationHitsX);
- fDiagList->Add(hCorrelationHitsY);
- fDiagList->Add(hCorrelationFMDSPD);
- fDiagList->Add(hCorrelationFMD1SPD);
- fDiagList->Add(hCorrelationFMD2ISPD);
- fDiagList->Add(hCorrelationFMD2OSPD);
- fDiagList->Add(hCorrelationFMD3ISPD);
- fDiagList->Add(hCorrelationFMD3OSPD);
- fDiagList->Add(hCorrelationFMDGoodtracks);
- fDiagList->Add(hCorrelationFMDBadtracks);
- fDiagList->Add(hCorrelationGoodbadtracks);
-fDiagList->Add(hCorrelationFMDSPDhits);
- fDiagList->Add(hCorrelationClustersTracklets);
- fDiagList->Add(hCorrelationSPDTracklets);
- TH2F* hCorrelationFMD23 = new TH2F("hCorrelationFMD23","hCorrelationFMD23;FMD2 ;FMD3 ",100,0,500,100,0,500);
- TH2F* hCorrelationFMD2diff23 = new TH2F("hCorrelationFMD2diff23","hCorrelationFMD2diff23;FMD2 ;diff FMD23 ",100,0,100,100,0,100);
- TH2F* hCorrelationFMD3diff23 = new TH2F("hCorrelationFMD3diff23","hCorrelationFMD3diff23;FMD3 ;diff FMD23 ",100,0,100,100,0,100);
- TH2F* hCorrelationFMD1diff13 = new TH2F("hCorrelationFMD1diff13","hCorrelationFMD1diff13;FMD1 ;diff FMD13 ",100,0,100,100,0,100);
- TH2F* hCorrelationFMD1diff12 = new TH2F("hCorrelationFMD1diff12","hCorrelationFMD1diff12;FMD1 ;diff FMD12 ",100,0,100,100,0,100);
- TH2F* hCorrelationFMD12 = new TH2F("hCorrelationFMD12","hCorrelationFMD12;FMD1 ;FMD2 ",100,0,500,100,0,500);
- TH2F* hCorrelationFMDBgCand = new TH2F("hCorrelationFMDBgCand","hCorrelationFMDBgCand;Bg Tr ;FMD ",100,0,100,500,0,500);
-
- TH2F* hCorrelationFMDFlatTr = new TH2F("hCorrelationFMDFlatTr","hCorrelationFMDFlatTr;Bg Tr ;FMD ",100,0,100,500,0,500);
- TH2F* hCorrelationFMDRatioFlatTr = new TH2F("hCorrelationFMDRatioFlatTr","hCorrelationFMDRatioFlatTr;Bg Tr ;FMD ",100,0,1,500,0,500);
- fDiagList->Add(hCorrelationFMDBgCand);
- fDiagList->Add(hCorrelationFMDFlatTr);
- fDiagList->Add(hCorrelationFMDRatioFlatTr);
- TH2F* hCorrelationFMDBgCandRelative = new TH2F("hCorrelationFMDBgCandRelative","hCorrelationFMDBgCandRelative;Bg Tr ;FMD ",100,0,2,500,0,500);
- fDiagList->Add(hCorrelationFMDBgCandRelative);
- fDiagList->Add(hCorrelationFMD2diff23);
- fDiagList->Add(hCorrelationFMD3diff23);
- fDiagList->Add(hCorrelationFMD1diff13);
- fDiagList->Add(hCorrelationFMD1diff12);
- fDiagList->Add(hCorrelationFMD23);
- fDiagList->Add(hCorrelationFMD12);
- TH2F* hTimeCorrelation = new TH2F("hCorrelationTime","hCorrelationTime ; time ; FMD hits",500,0,500,100,0,200);
- fDiagList->Add(hTimeCorrelation);
- TH1F* hHitDistribution = new TH1F("hFMDHitDistribution","hFMDHitDistribution ; FMD hits",500,0,500);
-
- TH1F* hHitDistributionFMD1 = new TH1F("hFMDHitDistributionFMD1","hFMDHitDistributionFMD1 ; FMD1 hits",500,0,500);
- TH1F* hHitDistributionFMD2I = new TH1F("hFMDHitDistributionFMD2I","hFMDHitDistributionFMD2I ; FMD2I hits",500,0,500);
- TH1F* hHitDistributionFMD2O = new TH1F("hFMDHitDistributionFMD2O","hFMDHitDistributionFMD2O ; FMD2O hits",500,0,500);
- TH1F* hHitDistributionFMD3I = new TH1F("hFMDHitDistributionFMD3I","hFMDHitDistributionFMD3I ; FMD3I hits",500,0,500);
- TH1F* hHitDistributionFMD3O = new TH1F("hFMDHitDistributionFMD3O","hFMDHitDistributionFMD3O ; FMD3O hits",500,0,500);
- TH1F* hTrVtxDistribution = new TH1F("hTrVtxDistribution","hTrVtxDistribution ; TrVtx",200,-500,500);
- TH1F* hTrEtaDistribution = new TH1F("hTrEtaDistribution","hTrEtaDistribution ; TrEta",200,-9,9);
- TH1F* hTrEtaDistribution2 = new TH1F("hTrEtaDistribution2","hTrEtaDistribution2 ; TrEta",200,-9,9);
-
- TH1F* hFlatTracks = new TH1F("hFlatTracks","hFlatTracks ; Horizontal tracks",100,0,100);
-
- TH1F* hEnergyOfParticles = new TH1F("hEnergyOfParticles","hEnergyOfParticles",1000000,0,10);
- fDiagList->Add(hEnergyOfParticles);
- fDiagList->Add(hTrVtxDistribution);
- fDiagList->Add(hTrEtaDistribution);
- fDiagList->Add(hTrEtaDistribution2);
- fDiagList->Add(hFlatTracks);
- fDiagList->Add(hHitDistribution);
- fDiagList->Add(hHitDistributionFMD1);
- fDiagList->Add(hHitDistributionFMD2I);
- fDiagList->Add(hHitDistributionFMD2O);
- fDiagList->Add(hHitDistributionFMD3I);
- fDiagList->Add(hHitDistributionFMD3O);
- TH1F* nMCevents = new TH1F("nMCEventsNoCuts","nMCEventsNoCuts",pars->GetNvtxBins(),0,pars->GetNvtxBins());
- TH1F* nMCeventsNSD= new TH1F("nMCEventsNSDNoCuts","nMCEventsNSDNoCuts",pars->GetNvtxBins(),0,pars->GetNvtxBins());
- fDiagList->Add(nMCevents);
- fDiagList->Add(nMCeventsNSD);
-
- TH1F* hEventsVtx = new TH1F("hEventsVtx","hEventsVtx",pars->GetNvtxBins(),0,pars->GetNvtxBins());
- TH1F* hEventsTr = new TH1F("hEventsTr","hEventsTr",pars->GetNvtxBins(),0,pars->GetNvtxBins());
- TH1F* hEventsNSD = new TH1F("hEventsNSD","hEventsNSD",pars->GetNvtxBins(),0,pars->GetNvtxBins());
- TH1F* hEventsNSDVtx = new TH1F("hEventsNSDVtx","hEventsNSDVtx",pars->GetNvtxBins(),0,pars->GetNvtxBins());
- fDiagList->Add(hEventsVtx);
- fDiagList->Add(hEventsTr);
- fDiagList->Add(hEventsNSD);
- fDiagList->Add(hEventsNSDVtx);
-
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskSharing::ConnectInputData(Option_t */*option*/)
-{
- // connect the input data
- if(fStandalone)
- fESD = (AliESDEvent*)GetInputData(0);
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskSharing::Exec(Option_t */*option*/)
-{
- //perform analysis on one event
- AliESD* old = fESD->GetAliESDOld();
- if (old) {
- fESD->CopyFromOldESD();
- }
-
- foutputESDFMD->Clear();
-
-
- Int_t delta = fESD->GetOrbitNumber() - fLastOrbit;
- fLastOrbit = fESD->GetOrbitNumber();
-
-
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- Double_t vertex[3]={0,0,0};
- Bool_t vtxStatus = pars->GetVertex(fESD,vertex);
- fEsdVertex->SetXYZ(vertex);
-
- // std::cout<<vtxStatus<<" "<<vertex[0]<<" "<<vertex[1]<<" "<<vertex[2]<<std::endl;
-
- // Process primaries here to get true MC distribution
- if(pars->GetProcessPrimary())
- ProcessPrimary();
- const AliMultiplicity* testmult = fESD->GetMultiplicity();
- Int_t nTrackLets = testmult->GetNumberOfTracklets();
- TH2F* hCorrelationClustersTracklets = (TH2F*)fDiagList->FindObject("hCorrelationClustersTracklets");
- hCorrelationClustersTracklets->Fill(testmult->GetNumberOfSingleClusters(),nTrackLets);
-
-
-
- Bool_t isTriggered = pars->IsEventTriggered(AliFMDAnaParameters::kMB1);
- Bool_t nsd = pars->IsEventTriggered(AliFMDAnaParameters::kNSD);
-
- Double_t delta2 = 2*pars->GetVtxCutZ()/pars->GetNvtxBins();
- Double_t vertexBinDouble = (vertex[2] + pars->GetVtxCutZ()) / delta2;
- Int_t vtxbin = (Int_t)vertexBinDouble;
- TH1F* hEventsVtx = (TH1F*)fDiagList->FindObject("hEventsVtx");
- TH1F* hEventsTr = (TH1F*)fDiagList->FindObject("hEventsTr");
- TH1F* hEventsNSD = (TH1F*)fDiagList->FindObject("hEventsNSD");
- TH1F* hEventsNSDVtx = (TH1F*)fDiagList->FindObject("hEventsNSDVtx");
-
- if( TMath::Abs(vertex[2]) > pars->GetVtxCutZ()) {
- fStatus = kFALSE;
- return;
- }
-
- if(vtxStatus) hEventsVtx->Fill(vtxbin);
- if(isTriggered) hEventsTr->Fill(vtxbin);
-
- if(vtxStatus && nsd) hEventsNSDVtx->Fill(vtxbin);
- if(nsd) hEventsNSD->Fill(vtxbin);
-
- if(!isTriggered || !vtxStatus ) {
- fStatus = kFALSE;
- return;
- }
- else
- fStatus = kTRUE;
-
- TH1F* hXvtx = (TH1F*)fDiagList->FindObject("hXvtx");
- if(vtxStatus ) hXvtx->Fill(vertex[0]);
- TH1F* hYvtx = (TH1F*)fDiagList->FindObject("hYvtx");
- if(vtxStatus ) hYvtx->Fill(vertex[1]);
- TH1F* hZvtx = (TH1F*)fDiagList->FindObject("hZvtx");
- hZvtx->Fill(vertex[2]);
- //const AliMultiplicity* testmult = fESD->GetMultiplicity();
- //std::cout<<vertex[2]<<std::endl;
- //Int_t nTrackLets = testmult->GetNumberOfTracklets();
-
-
-
- if(nTrackLets < 1000) foutputESDFMD->SetUniqueID(kTRUE);
- else foutputESDFMD->SetUniqueID(kFALSE);
-
- AliESDFMD* fmd = fESD->GetFMDData();
-
- if (!fmd) return;
- Int_t nHits[3][2] = {{0,0},{0,0},{0,0}};
- //Int_t nDead = 0;
- 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 ring = (ir == 0 ? 'I' : 'O');
- UShort_t nsec = (ir == 0 ? 20 : 40);
- UShort_t nstr = (ir == 0 ? 512 : 256);
-
- TH1F* hEdist = (TH1F*)fDiagList->FindObject(Form("Edist_before_sharing_FMD%d%c",det,ring));
-
- for(UShort_t sec =0; sec < nsec; sec++) {
- fSharedThis = kFALSE;
- fSharedPrev = kFALSE;
-
- for(UShort_t strip = 0; strip < nstr; strip++) {
- foutputESDFMD->SetMultiplicity(det,ring,sec,strip,0.);
- Float_t mult = fmd->Multiplicity(det,ring,sec,strip);
- //if(mult == AliESDFMD::kInvalidMult)
- // nDead++;
- // if(mult > 0)
- // std::cout<<mult<<std::endl;
-
- if(mult == AliESDFMD::kInvalidMult || mult == 0 || mult > 20) continue;
-
- //Double_t eta = fmd->Eta(det,ring,sec,strip);
- Float_t eta = pars->GetEtaFromStrip(det,ring,sec,strip,vertex[2]);
-
- hEdist->Fill(mult);
-
-
- if(fmd->IsAngleCorrected())
- mult = mult/TMath::Cos(Eta2Theta(eta));
- Float_t prevE = 0;
- Float_t nextE = 0;
- if(strip != 0)
- if(fmd->Multiplicity(det,ring,sec,strip-1) != AliESDFMD::kInvalidMult) {
- prevE = fmd->Multiplicity(det,ring,sec,strip-1);
- if(fmd->IsAngleCorrected())
- prevE = prevE/TMath::Cos(Eta2Theta(fmd->Eta(det,ring,sec,strip-1)));
- }
- if(strip != nstr - 1)
- if(fmd->Multiplicity(det,ring,sec,strip+1) != AliESDFMD::kInvalidMult) {
- nextE = fmd->Multiplicity(det,ring,sec,strip+1);
- if(fmd->IsAngleCorrected())
- nextE = nextE/TMath::Cos(Eta2Theta(fmd->Eta(det,ring,sec,strip+1)));
- }
-
- Float_t mergedEnergy = GetMultiplicityOfStrip(mult,eta,prevE,nextE,det,ring,sec,strip);
-
- if(mergedEnergy > 0.3 )
- nHits[det-1][ir]++;
- foutputESDFMD->SetMultiplicity(det,ring,sec,strip,mergedEnergy);
- foutputESDFMD->SetEta(det,ring,sec,strip,eta);
-
- }
- }
- }
- }
-
- //std::cout<<nDead<<std::endl;
-
- //cluster cut
- //if(testmult->GetNumberOfSingleClusters() > 15 + nTrackLets)
- // {fStatus = kFALSE; std::cout<<"FMD : "<<nHits[0][0]<<" "<<nHits[1][0]<<" "<<nHits[1][1]<<" "<<nHits[2][0]<<" "<<nHits[2][1]<<" tracks "<<testmult->GetNumberOfSingleClusters()<<" "<<nTrackLets<<std::endl; return;}
-
- TH2F* hCorrelationFMD23 = (TH2F*)fDiagList->FindObject("hCorrelationFMD23");
- TH2F* hCorrelationFMD12 = (TH2F*)fDiagList->FindObject("hCorrelationFMD12");
- TH2F* hCorrelationFMD2diff23 = (TH2F*)fDiagList->FindObject("hCorrelationFMD2diff23");
- TH2F* hCorrelationFMD3diff23 = (TH2F*)fDiagList->FindObject("hCorrelationFMD3diff23");
- TH2F* hCorrelationFMD1diff13 = (TH2F*)fDiagList->FindObject("hCorrelationFMD1diff13");
- TH2F* hCorrelationFMD1diff12 = (TH2F*)fDiagList->FindObject("hCorrelationFMD1diff12");
-
- TH2F* hCorrelationFMDSPD = (TH2F*)fDiagList->FindObject("hCorrelationFMDSPD");
- TH2F* hCorrelationFMD1SPD = (TH2F*)fDiagList->FindObject("hCorrelationFMD1SPD");
- TH2F* hCorrelationFMD2ISPD = (TH2F*)fDiagList->FindObject("hCorrelationFMD2ISPD");
- TH2F* hCorrelationFMD2OSPD = (TH2F*)fDiagList->FindObject("hCorrelationFMD2OSPD");
- TH2F* hCorrelationFMD3ISPD = (TH2F*)fDiagList->FindObject("hCorrelationFMD3ISPD");
- TH2F* hCorrelationFMD3OSPD = (TH2F*)fDiagList->FindObject("hCorrelationFMD3OSPD");
-
- TH2F* hCorrelationFMDSPDhits = (TH2F*)fDiagList->FindObject("hCorrelationFMDSPDhits");
-
- TH2F* hCorrelationSPDTracklets = (TH2F*)fDiagList->FindObject("hCorrelationSPDTracklets");
- TH2F* hTimeCorrelation = (TH2F*)fDiagList->FindObject("hCorrelationTime");
- TH2F* hHitsRadius = (TH2F*)fDiagList->FindObject("hCorrelationHitsRadius");
- TH2F* hHitsX = (TH2F*)fDiagList->FindObject("hCorrelationHitsX");
- TH2F* hHitsY = (TH2F*)fDiagList->FindObject("hCorrelationHitsY");
- TH1F* hFMDHitDistribution = (TH1F*)fDiagList->FindObject("hFMDHitDistribution");
- TH1F* hFMD1HitDistribution = (TH1F*)fDiagList->FindObject("hFMDHitDistributionFMD1");
- TH1F* hFMD2IHitDistribution = (TH1F*)fDiagList->FindObject("hFMDHitDistributionFMD2I");
- TH1F* hFMD2OHitDistribution = (TH1F*)fDiagList->FindObject("hFMDHitDistributionFMD2O");
- TH1F* hFMD3IHitDistribution = (TH1F*)fDiagList->FindObject("hFMDHitDistributionFMD3I");
- TH1F* hFMD3OHitDistribution = (TH1F*)fDiagList->FindObject("hFMDHitDistributionFMD3O");
- TH1F* hCorrelationFMDGoodtracks = (TH1F*)fDiagList->FindObject("hCorrelationFMDGoodtracks");
- TH1F* hCorrelationFMDBadtracks = (TH1F*)fDiagList->FindObject("hCorrelationFMDBadtracks");
- TH1F* hCorrelationGoodbadtracks = (TH1F*)fDiagList->FindObject("hCorrelationGoodbadtracks");
- TH2F* hCorrelationFMDBgCand = (TH2F*)fDiagList->FindObject("hCorrelationFMDBgCand");
- TH2F* hCorrelationFMDBgCandRelative = (TH2F*)fDiagList->FindObject("hCorrelationFMDBgCandRelative");
-
- TH2F* hCorrelationFMDFlatTr = (TH2F*)fDiagList->FindObject("hCorrelationFMDFlatTr");
- TH2F* hCorrelationFMDRatioFlatTr = (TH2F*)fDiagList->FindObject("hCorrelationFMDRatioFlatTr");
- TH1F* hTrVtxDistribution = (TH1F*)fDiagList->FindObject("hTrVtxDistribution");
- TH1F* hTrEtaDistribution = (TH1F*)fDiagList->FindObject("hTrEtaDistribution");
- TH1F* hTrEtaDistribution2 = (TH1F*)fDiagList->FindObject("hTrEtaDistribution2");
- hCorrelationFMDSPD->Fill(nTrackLets,nHits[0][0]+nHits[1][0]+nHits[1][1]+nHits[2][0]+nHits[2][1]);
- TH1F* hFlatTracks = (TH1F*)fDiagList->FindObject("hFlatTracks");
- hCorrelationFMD1SPD->Fill(nTrackLets,nHits[0][0]);
- hCorrelationFMD2ISPD->Fill(nTrackLets,nHits[1][0]);
- hCorrelationFMD2OSPD->Fill(nTrackLets,nHits[1][1]);
- hCorrelationFMD3ISPD->Fill(nTrackLets,nHits[2][0]);
- hCorrelationFMD3OSPD->Fill(nTrackLets,nHits[2][1]);
- hCorrelationFMDSPDhits->Fill(testmult->GetNumberOfFiredChips(0),nHits[0][0]+nHits[1][0]+nHits[1][1]+nHits[2][0]+nHits[2][1]);
- hCorrelationSPDTracklets->Fill(testmult->GetNumberOfFiredChips(0),nTrackLets);
-
- hTimeCorrelation->Fill(delta,nHits[0][0]+nHits[1][0]+nHits[1][1]+nHits[2][0]+nHits[2][1]);
- hCorrelationFMD23->Fill(nHits[1][0]+nHits[1][1],nHits[2][0]+nHits[2][1]);
- hCorrelationFMD12->Fill(nHits[0][0],nHits[1][0]+nHits[1][1]);
-
- // if(TMath::Abs(nHits[1]-nHits[2]) > 15 && (nHits[1]+nHits[2]) > 35) {fStatus = kFALSE; std::cout<<"difference : "<<TMath::Abs(nHits[1]-nHits[2])<<std::endl; return;}
-
- // if(testmult->GetNumberOfFiredChips(0))
- // if(testmult->GetNumberOfFiredChips(0) > 15 && ((Float_t)nTrackLets / (Float_t)testmult->GetNumberOfFiredChips(0)) < 0.4)
- // {fStatus = kFALSE; std::cout<<nTrackLets<<" "<<testmult->GetNumberOfFiredChips(0)<<" "<<nHits[0]<<" "<<nHits[1]<<" "<<nHits[2]<<std::endl; return;}
-
-
- Float_t diff23 = (Float_t)TMath::Abs(nHits[2][1] + nHits[2][0] - nHits[1][1] - nHits[1][0]);
-
- Float_t diff13 = TMath::Abs(nHits[2][1] + nHits[2][0] - nHits[1][1] - nHits[1][0] - nHits[0][0]);
- Float_t diff12 = TMath::Abs(nHits[1][0] - nHits[0][0]);
-
- hCorrelationFMD1diff12->Fill(nHits[0][0], diff12);
- hCorrelationFMD1diff13->Fill(nHits[0][0], diff13);
- hCorrelationFMD2diff23->Fill(nHits[1][1], diff23);
- hCorrelationFMD3diff23->Fill(nHits[2][1], diff23);
-
- //
- Float_t nTotalFMDhits = nHits[0][0]+nHits[1][0]+nHits[1][1]+nHits[2][0]+nHits[2][1] ;
- Float_t radius = TMath::Sqrt(TMath::Power(vertex[0] + 0.03715,2) + TMath::Power(vertex[1] - 0.1659,2));
-
- if(vertex[1] !=0 || vertex[1] !=0) {
- hHitsRadius->Fill(nTotalFMDhits,radius);
- hHitsX->Fill(nTotalFMDhits,vertex[0]);
- hHitsY->Fill(nTotalFMDhits,vertex[1]); }
-
- hFMDHitDistribution->Fill(nTotalFMDhits);
- hFMD1HitDistribution->Fill(nHits[0][0]);
- hFMD2IHitDistribution->Fill(nHits[1][0]);
- hFMD2OHitDistribution->Fill(nHits[1][1]);
- hFMD3IHitDistribution->Fill(nHits[2][0]);
- hFMD3OHitDistribution->Fill(nHits[2][0]);
-
- // if(radius > 0.5) {fStatus = kFALSE; std::cout<<"FMD : "<<nTotalFMDhits<<std::endl; foutputESDFMD->Clear(); return;}
- //if(TMath::Abs(vertex[1] - 0.1659) > 0.1 ) {fStatus = kFALSE; std::cout<<"FMD : "<<nTotalFMDhits<<std::endl; foutputESDFMD->Clear(); return;}
-
- if(nTrackLets < pars->GetLowSPDLimit() || nTrackLets > pars->GetHighSPDLimit())
- {fStatus = kFALSE; std::cout<<nTrackLets<<" "<<" "<<nHits[0][0]<<" "<<nHits[1][0]<<" "<<nHits[1][1]<<" "<<nHits[2][0]<<" "<<nHits[2][1]<<std::endl; return;}
-
-
- AliESDtrack* track = 0;
- Int_t ntracks = fESD->GetNumberOfTracks();
- Float_t ngood =0, nbad = 0;
- //std::cout<<" Primary vtx : "<<vertex[0]<<" "<<vertex[1]<<" "<<vertex[2]<<" "<<nTotalFMDhits<<std::endl;
- Int_t nBgCandidates = 0;
- Float_t nFlat = 0;
- for(Int_t i=0;i<ntracks;i++) {
- track = fESD->GetTrack(i);
- //std::cout<<track->GetX()-vertex[0]<<" "<<track->GetY()-vertex[1]<<" "<<track->GetZ()-vertex[2]<<std::endl;
- //std::cout<<track->GetX()<<" "<<track->GetY()<<" "<<track->GetZ()<<std::endl;
- hTrVtxDistribution->Fill(track->GetZ());
-
- if(TMath::Abs( track->GetZ()) > 50 && TMath::Abs(track->GetZ()) < 300) { // && TMath::Abs( track->GetY()) < 1)
- nBgCandidates++;
- hTrEtaDistribution->Fill(track->Eta());
- }
-
-
-
- if(TMath::Abs(track->GetX()-vertex[0]) > 0.3 || TMath::Abs(track->GetY()-vertex[1]) > 0.3 || TMath::Abs(track->GetZ()-vertex[2]) > 0.3) {
- nbad++;
- hTrEtaDistribution2->Fill(track->Eta()); }
- else ngood++;
-
- if(TMath::Abs(track->Pt()) < 0.1)
- nFlat++;
- }
-
- Float_t ratioFlat = 0;
- if(fESD->GetNumberOfTracks())
- ratioFlat = nFlat/(Float_t)fESD->GetNumberOfTracks();
- hCorrelationFMDFlatTr->Fill(nFlat,nTotalFMDhits);
- hCorrelationFMDRatioFlatTr->Fill(ratioFlat,nTotalFMDhits);
- hFlatTracks->Fill(nFlat);
-
- // std::cout<<fESD->GetT0zVertex()<<" "<<vertex[2]<<std::endl;
- Float_t ratioBg = 0;
- //if(fESD->GetNumberOfTracks() > 0)
-
- if(fESD->GetNumberOfTracks() > 0)
- ratioBg = (Float_t)nBgCandidates/(Float_t)fESD->GetNumberOfTracks();
- hCorrelationFMDBgCand->Fill(nBgCandidates,nTotalFMDhits);
- hCorrelationFMDBgCandRelative->Fill(ratioBg,nTotalFMDhits);
-
-
- // Float_t ratio = (nbad > 0 ? ngood / nbad : 0);
-
- hCorrelationFMDGoodtracks->Fill(ngood,nTotalFMDhits);
- hCorrelationFMDBadtracks->Fill(nbad,nTotalFMDhits);
- hCorrelationGoodbadtracks->Fill(ngood,nbad);
-
- if(fStandalone) {
- PostData(0, foutputESDFMD);
- PostData(1, fEsdVertex);
- PostData(2, fESD);
- PostData(3, fDiagList);
- }
-}
-
-//_____________________________________________________________________
-Float_t AliFMDAnalysisTaskSharing::GetMultiplicityOfStrip(Float_t mult,
- Float_t eta,
- Float_t prevE,
- Float_t nextE,
- UShort_t det,
- Char_t ring,
- UShort_t /*sec*/,
- UShort_t /*strip*/) {
- //analyse and perform sharing on one strip
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
- Float_t mergedEnergy = 0;
- //Float_t nParticles = 0;
- Float_t cutLow = 0.3;//0.15;
-
- Double_t mpv = pars->GetMPV(det,ring,eta);
-
- Double_t w = pars->GetSigma(det,ring,eta);
- if (mpv > 100)
- AliError(Form("FMD%d%c, eta=%f, MPV=%f w=%f", det, ring, eta, mpv, w));
-
- Float_t cutHigh = mpv - 2 * w;
-
- // if(ring == 'I')
- // cutLow = 0.1;
-
- //cutLow = 0;
- //AliFMDParameters* recopars = AliFMDParameters::Instance();
- //cutLow = (5*recopars->GetPedestalWidth(det,ring,sec,strip))/(recopars->GetPulseGain(det,ring,sec,strip)*recopars->GetDACPerMIP());
- //if(foutputESDFMD->GetUniqueID() == kFALSE ) {
-
- if(mult > 12 || mult < cutLow)
- {
- // std::cout<<"rejecting hit in FMD "<<det<<" "<<ring<<std::endl;
- fSharedThis = kFALSE;
- fSharedPrev = kFALSE;
- return 0;
- }
-
-
-
-
- // Float_t cutPart = pars->GetMPV(det,ring,eta) - 5*pars->GetSigma(det,ring,eta);
- Float_t totalE = mult;
-
-
- //std::cout<<det<<ring<<" "<<sec<<" "<<strip<<" "<<cutLow<<std::endl;
- if(fSharedThis) {
- fSharedThis = kFALSE;
- fSharedPrev = kTRUE;
- return 0.;
- }
-
- /* if(mult < 0.33*pars->GetMPV(det,ring,eta)) {
- fSharedThis = kFALSE;
- fSharedPrev = kFALSE;
- return 0;
- }*/
- if(mult<nextE && nextE>cutHigh && foutputESDFMD->GetUniqueID() == kTRUE)
- {
- fSharedThis = kFALSE;
- fSharedPrev = kFALSE;
- return 0;
- }
-
-
- if(prevE > cutLow && prevE < cutHigh && !fSharedPrev ) {
- totalE += prevE;
- }
-
- if(nextE > cutLow && nextE < cutHigh ) {
- totalE += nextE;
- fSharedThis = kTRUE;
- }
- totalE = totalE*TMath::Cos(Eta2Theta(eta));
- TH1F* hEdist = (TH1F*)fDiagList->FindObject(Form("Edist_after_sharing_FMD%d%c",det,ring));
- if(totalE > cutLow)
- hEdist->Fill(totalE);
-
-
- if(totalE > 0) {
-
- mergedEnergy = totalE;
- fSharedPrev = kTRUE;
- // if(det == 1 && ring =='I')
- }
- else{
- fSharedThis = kFALSE;
- fSharedPrev = kFALSE;
- }
-
- // mergedEnergy = mult;
-
-
- /* }
-else {
- TH1F* hEdist = (TH1F*)fDiagList->FindObject(Form("Edist_after_sharing_FMD%d%c",det,ring));
- if(mult > cutLow)
- fEtotal+=mult;
- if(mult < cutLow) {
- mergedEnergy = fEtotal;
- fEtotal = 0;
- hEdist->Fill(mergedEnergy);
-
- }
-
- }*/
-
- return mergedEnergy;
- //}
-}
-//_____________________________________________________________________
-void AliFMDAnalysisTaskSharing::Terminate(Option_t* /* option*/) {
-
- TH1F* hFMDHitDistribution = (TH1F*)fDiagList->FindObject("hFMDHitDistribution");
- TH1F* hFMD1HitDistribution = (TH1F*)fDiagList->FindObject("hFMDHitDistributionFMD1");
- TH1F* hFMD2IHitDistribution = (TH1F*)fDiagList->FindObject("hFMDHitDistributionFMD2I");
- TH1F* hFMD2OHitDistribution = (TH1F*)fDiagList->FindObject("hFMDHitDistributionFMD2O");
- TH1F* hFMD3IHitDistribution = (TH1F*)fDiagList->FindObject("hFMDHitDistributionFMD3I");
- TH1F* hFMD3OHitDistribution = (TH1F*)fDiagList->FindObject("hFMDHitDistributionFMD3O");
-
- TH1F* hZvtx = (TH1F*)fDiagList->FindObject("hZvtx");
- 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 ring = (ir == 0 ? 'I' : 'O');
-
- TH1F* hEdist = (TH1F*)fDiagList->FindObject(Form("Edist_before_sharing_FMD%d%c",det,ring));
- TH1F* hEdistAfter = (TH1F*)fDiagList->FindObject(Form("Edist_after_sharing_FMD%d%c",det,ring));
- if(hZvtx->GetEntries()) {
- hEdist->Scale(1./(Float_t)hZvtx->GetEntries());
- hEdistAfter->Scale(1./(Float_t)hZvtx->GetEntries());
- }
-
- }
-
- }
- TH1F* hFlatTracks = (TH1F*)fDiagList->FindObject("hFlatTracks");
- TH1F* hTrVtxDistribution = (TH1F*)fDiagList->FindObject("hTrVtxDistribution");
- TH1F* hTrEtaDistribution = (TH1F*)fDiagList->FindObject("hTrEtaDistribution");
- TH1F* hTrEtaDistribution2 = (TH1F*)fDiagList->FindObject("hTrEtaDistribution2");
- if(hZvtx->GetEntries()) {
- hFMDHitDistribution->Scale(1./(Float_t)hZvtx->GetEntries());
- hFMD1HitDistribution->Scale(1./(Float_t)hZvtx->GetEntries());
- hFMD2IHitDistribution->Scale(1./(Float_t)hZvtx->GetEntries());
- hFMD2OHitDistribution->Scale(1./(Float_t)hZvtx->GetEntries());
- hFMD3IHitDistribution->Scale(1./(Float_t)hZvtx->GetEntries());
- hFMD3OHitDistribution->Scale(1./(Float_t)hZvtx->GetEntries());
- hFlatTracks->Scale(1./(Float_t)hZvtx->GetEntries());
- hTrVtxDistribution->Scale(1./(Float_t)hZvtx->GetEntries());
- hTrEtaDistribution->Scale(1./(Float_t)hZvtx->GetEntries());
- hTrEtaDistribution2->Scale(1./(Float_t)hZvtx->GetEntries());
- }
-
- //TH1F* hEventsVtx = (TH1F*)fDiagList->FindObject("hEventsVtx");
- //TH1F* hEventsTr = (TH1F*)fDiagList->FindObject("hEventsTr");
- //hEventsVtx->Divide(hEventsTr);
-
-
-}
-//_____________________________________________________________________
-Float_t AliFMDAnalysisTaskSharing::Eta2Theta(Float_t eta) const{
- //convert the eta of a strip to a theta
- Float_t theta = 2*TMath::ATan(TMath::Exp(-1*eta));
-
- if(eta < 0)
- theta = theta-TMath::Pi();
-
- // std::cout<<"From eta2Theta: "<<theta<<" "<<eta<<std::endl;
- return theta;
-
-
-
-}
-
-
-
-//_____________________________________________________________________
-void AliFMDAnalysisTaskSharing::ProcessPrimary() {
- //Get the unspoiled MC dN/deta before event cuts
-
- AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
- if(!eventHandler)
- return;
- AliMCEvent* mcEvent = eventHandler->MCEvent();
- if(!mcEvent)
- return;
- fLastTrackByStrip.Reset(-1);
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
- AliMCParticle* particle = 0;
-
- AliStack* stack = mcEvent->Stack();
-
- TH1F* hPrimary = (TH1F*)fDiagList->FindObject("hMultvsEtaNoCuts");
- TH1F* hPrimaryNSD = (TH1F*)fDiagList->FindObject("hMultvsEtaNSDNoCuts");
- TH1F* hEnergyOfParticles = (TH1F*)fDiagList->FindObject("hEnergyOfParticles");
- AliHeader* header = mcEvent->Header();
- AliGenEventHeader* genHeader = header->GenEventHeader();
-
- AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);
- AliGenDPMjetEventHeader* dpmHeader = dynamic_cast<AliGenDPMjetEventHeader*>(header->GenEventHeader());
-
-
- Bool_t nsd = kTRUE;
-
-
- if (!pythiaGenHeader && !dpmHeader) {
- std::cout<<" no pythia or dpm header!"<<std::endl;
- }
- else {
- if(pythiaGenHeader) {
- Int_t pythiaType = pythiaGenHeader->ProcessType();
-
- if(pythiaType==92||pythiaType==93)
- nsd = kFALSE;
-
- }
- if(dpmHeader) {
- Int_t processType = dpmHeader->ProcessType();
- if(processType == 5 || processType == 6)
- nsd = kFALSE;
-
- }
- }
-
- 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;
- Bool_t firstTrackNSD = kTRUE;
-
- Int_t nTracks = stack->GetNprimary();
- if(pars->GetProcessHits())
- nTracks = stack->GetNtrack();
- TH1F* nMCevents = (TH1F*)fDiagList->FindObject("nMCEventsNoCuts");
- TH1F* nMCeventsNSD = (TH1F*)fDiagList->FindObject("nMCEventsNSDNoCuts");
- 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());
- if(nsd) {
- hPrimaryNSD->Fill(particle->Eta());
-
- if(firstTrackNSD) {
- nMCeventsNSD->Fill(vertexBin);
- firstTrackNSD = kFALSE;
- }
- }
-
- TH1F* hPrimVtxBin = (TH1F*)fDiagList->FindObject(Form("primmult_NoCuts_vtxbin%d",vertexBin));
- hPrimVtxBin->Fill(particle->Eta());
-
- if(firstTrack) {
- nMCevents->Fill(vertexBin);
- firstTrack = kFALSE;
- }
-
- }
- if(pars->GetProcessHits()) {
-
- for(Int_t j=0; j<particle->GetNumberOfTrackReferences();j++) {
-
- AliTrackReference* ref = particle->GetTrackReference(j);
- UShort_t det,sec,strip;
- Char_t ring;
- if(ref->DetectorId() != AliTrackReference::kFMD)
- continue;
- if(particle->Charge() != 0)
- hEnergyOfParticles->Fill(particle->E());
-
- AliFMDStripIndex::Unpack(ref->UserId(),det,ring,sec,strip);
- Float_t thisStripTrack = fLastTrackByStrip(det,ring,sec,strip);
- if(particle->Charge() != 0 && i != thisStripTrack ) {
- //Double_t x,y,z;
-
- Float_t eta = pars->GetEtaFromStrip(det,ring,sec,strip,vertex.At(2));//-1*TMath::Log(TMath::Tan(0.5*theta));
- TH1F* hHits = (TH1F*)fDiagList->FindObject(Form("hMCHits_nocuts_FMD%d%c_vtxbin%d",det,ring,vertexBin));
-
-
- hHits->Fill(eta);
-
- Float_t nstrips = (ring =='O' ? 256 : 512);
-
- fLastTrackByStrip(det,ring,sec,strip) = (Float_t)i;
-
- if(strip >0)
- fLastTrackByStrip(det,ring,sec,strip-1) = (Float_t)i;
- if(strip < (nstrips - 1))
- fLastTrackByStrip(det,ring,sec,strip+1) = (Float_t)i;
-
- }
-
-
- }
-
-
- }
-
- }
-
-}
-
-//_____________________________________________________________________
-//
-// EOF
-//
-// EOF
+++ /dev/null
-#ifndef ALIFMDANALYSISTASKSHARING_H
-#define ALIFMDANALYSISTASKSHARING_H
-
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice
- **/
-
-#include "AliAnalysisTask.h"
-
-#include "AliESDFMD.h"
-//#include "TTree.h"
-#include "AliESDEvent.h"
-#include "AliFMDFloatMap.h"
-class TChain;
-class AliAODEvent;
-class AliESDVertex;
-
-/**
- * Do the sharing correction.
- *
- * This is the task to do the FMD sharing or hit merging.
- * It reads the input ESDFMD data and posts an ESDFMD object to
- * the tasks that must be performed after this task ie.
- * Density, BackgroundCorrection and Dndeta.
- *
- * Inputs: An AliESDFMD object
- *
- * Output:
- * An AliESDFMD object, but with hits merged according to algorithm.
- *
- * Used correction objects:
- * Energy distribution fits (MPV and width of 1st landau)
- * Hard low cut on 'mult' of 0.3
- *
- * Simplications:
- * Remove all diagnostics histograms except a few. The histograms
- * needed for subsequent use are the ones for the sharing correction -
- * but only from MC data.
- *
- * Remove calculation vertex efficiency. This is best taken care of
- * elsewhere.
- *
- * Open issues:
- * The ESD signal is un-angle-corrected and the after merging,
- * Re-angle-corrected. I think this is wrong and will cause a
- * problem for the low-eta (low-theta) bins where the correction is
- * largets. Essentially, a particle that traverses two strips at
- * low theta will have a relatively large path through and will,
- * all things equal, deposite more energy. The sharing filter may
- * then not pick this hit as steming from the same particle, but
- * but rather from 2 particles. This is especially true of the MPV
- * and width of the 1st Landau is determined from a full
- * detector/ring spectra.
- *
- * @ingroup FMD_ana
- *
- *
- */
-class AliFMDAnalysisTaskSharing : public AliAnalysisTask
-{
-public:
- /**
- * Constructor
- */
- AliFMDAnalysisTaskSharing();
- /**
- * Constrictor
- *
- * @param name Name of task
- * @param SE Whether we're run from an SE task or not
- */
- AliFMDAnalysisTaskSharing(const char* name, Bool_t SE = kTRUE);
- /**
- * Destructor
- *
- */
- virtual ~AliFMDAnalysisTaskSharing() {;}
- /**
- * Copy constructor
- *
- * @param o Object to copy from
- */
- AliFMDAnalysisTaskSharing(const AliFMDAnalysisTaskSharing& o)
- : AliAnalysisTask(),
- fDebug(o.fDebug),
- fESD(o.fESD),
- // fOutputESD(),
- foutputESDFMD(o.foutputESDFMD),
- fSharedThis(o.fSharedThis),
- fSharedPrev(o.fSharedPrev),
- fDiagList(),
- fStandalone(o.fStandalone),
- fEsdVertex(o.fEsdVertex),
- fStatus(o.fStatus),
- fLastTrackByStrip(o.fLastTrackByStrip),
- fLastOrbit(o.fLastOrbit) {}
- /**
- * Assignment operator
- *
- * @return Reference to this object
- */
- AliFMDAnalysisTaskSharing&
- operator=(const AliFMDAnalysisTaskSharing&) { return *this; }
-
- /**
- * @{
- * @name 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;}
- /**
- * @}
- */
- /**
- * Get the multiplicity of a strip
- *
- * @param mult Previous(?) multiplicty
- * @param eta Pseudo rapidity of strip
- * @param Eprev Previous energy deposition
- * @param Enext Next energy deposition
- * @param det Detector
- * @param ring Ring
- * @param sec Sector
- * @param strip Strip
- *
- * @return
- */
- Float_t GetMultiplicityOfStrip(Float_t mult,
- Float_t eta,
- Float_t Eprev,
- Float_t Enext,
- UShort_t det,
- Char_t ring,
- UShort_t sec,
- UShort_t strip);
- // void GetVertex(Double_t* vertexXYZ) ;
- /**
- * Set the Output data
- *
- * @param fmd Output data
- */
- void SetFMDData(AliESDFMD* fmd) {foutputESDFMD = fmd;}
- /**
- * Set the output list
- *
- * @param outlist
- */
- void SetOutputList(TList* outlist) {fDiagList = outlist;}
- /**
- * Set the vertex
- *
- * @param vertex
- */
- void SetVertex(AliESDVertex* vertex) {fEsdVertex = vertex;}
- /**
- * Set the input data
- *
- * @param esd Input
- */
- void SetInputESD(AliESDEvent* esd) {fESD = esd;}
- /**
- * Get status flag
- *
- * @return @c true on success
- */
- Bool_t GetEventStatus() const {return fStatus;}
- /**
- * Get the vertex efficiency from data. This is calculated as
- *
- * @f[
- * e_{vtx} = \frac{# events with vertex}{# of events with trigger}
- * @f]
- *
- * @return
- */
- Float_t GetVtxEfficiencyFromData() ;
- /**
- * Get the vertex efficiency from the data for NSD triggers
- *
- * @return
- */
- Float_t GetNSDVtxEfficiencyFromData() ;
-
- private:
- /**
- * Calculate eta from theta
- *
- * @param eta Input eta
- *
- * @return Theta corresponding to eta
- */
- Float_t Eta2Theta(Float_t eta) const ;
- /**
- * Get the psuedo-rapidity of a strip
- *
- * @param det Detector
- * @param ring Ring
- * @param sector Sector
- * @param strip Strip
- * @param zvtx Vertex position along beam-axis
- *
- * @return Eta
- */
- Double_t EtaFromStrip(UShort_t det,
- Char_t ring,
- UShort_t sector,
- UShort_t strip,
- Double_t zvtx);
- /**
- * Process a primary particle (MC only)
- *
- */
- void ProcessPrimary();
-
- Int_t fDebug; // Debug flag
- AliESDEvent* fESD; //! ESD
- AliESDFMD* foutputESDFMD; // the output ESDFMD object
- Bool_t fSharedThis; // was this strip shared?
- Bool_t fSharedPrev; // was the previous strip shared?
- TList* fDiagList; // list of diag histos
- Bool_t fStandalone; // do we run standalone or in SE task
- AliESDVertex* fEsdVertex; // vtx info from the ESD
- Bool_t fStatus; // event status
- AliFMDFloatMap fLastTrackByStrip; // the last track to hit this strip
- UInt_t fLastOrbit;
-
- ClassDef(AliFMDAnalysisTaskSharing, 0); // Analysis task for FMD analysis
-};
-
-#endif
-// Local Variables:
-// mode: C++
-// End Variables:
+++ /dev/null
-// Code to analyse dN/deta from the forward analysis
-// This can plot the results
-// Also works for MC data
-//
-// -- Author: Hans Hjersing Dalsgaard <canute@gmail.com>
-#include "AliFMDDndeta.h"
-#include "TFile.h"
-#include "AliLog.h"
-#include "TH1.h"
-#include "AliFMDAnaParameters.h"
-#include "AliFMDAnaCalibSharingEfficiency.h"
-#include "TStyle.h"
-//#include "TObjArray.h"
-#include "TCanvas.h"
-#include "TLine.h"
-#include "TGraphErrors.h"
-#include "TGraphAsymmErrors.h"
-#include "TPad.h"
-#include "iostream"
-#include "TH3.h"
-#include "TMath.h"
-#include "TProfile.h"
-#include "TProfile2D.h"
-#include "TProfile3D.h"
-#include "TLegend.h"
-#include "TPad.h"
-#include "TLatex.h"
-#include "TStyle.h"
-#include "TF1.h"
-
-#define SMALLNUMBER 0.0001
-
-ClassImp(AliFMDDndeta)
-//_____________________________________________________________________
-
-AliFMDDndeta::AliFMDDndeta()
-: TObject(),
- fList(0),
- fMultList(),
- fNbinsToCut(2),
- fVtxCut1(-10),
- fVtxCut2(10),
- fIsInit(kFALSE),
- fIsGenerated(),
- fPrimEvents(),
- fEvents(),
- fPrimdNdeta(),
- fDrawAll(kFALSE)
-{
- //AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- /* fDataObject = new TProfile3D("dataObject","dataObject",
- pars->GetNetaBins(),-6,6,
- 20,0,2*TMath::Pi(),
- pars->GetNvtxBins(),-0.5,pars->GetNvtxBins()-0.5);
- fDataObject->SetXTitle("#eta");
- fDataObject->SetYTitle("#varphi [radians]");
- fDataObject->SetZTitle("v_{z} [cm]");*/
-
- fAnalysisNames[0] = "Hits";
- fAnalysisNames[1] = "HitsTrVtx";
- fAnalysisNames[2] = "dNdeta";
- fAnalysisNames[3] = "dNdetaTrVtx";
- fAnalysisNames[4] = "dNdetaNSD";
-
- for(Int_t i=0; i<5;i++)
- fMultList[i] = new TList();
-}
-//_____________________________________________________________________
-void AliFMDDndeta::SetNames(Analysis what) {
- // Set names of histograms from analysis
-
- switch(what) {
- case kHits :
- fPrimEvents.Form("nMCEventsNoCuts"); //was nMCEvents
- fEvents.Form("nEvents");
- fPrimdNdeta.Form("hMultvsEtaNoCuts");
- break;
- case kHitsTrVtx :
- fPrimEvents.Form("nMCEvents");
- fEvents.Form("nEvents");
- fPrimdNdeta.Form("hMultvsEtaNoCuts");
- break;
- case kMult :
- fPrimEvents.Form("nMCEventsNoCuts");
- fEvents.Form("nEvents");
- fPrimdNdeta.Form("hMultvsEtaNoCuts");
- break;
- case kMultTrVtx :
- fPrimEvents.Form("nMCEvents");
- fEvents.Form("nEvents");
- fPrimdNdeta.Form("hMultvsEta");
- break;
- case kMultNSD :
- fPrimEvents.Form("nMCEventsNSDNoCuts");
- fEvents.Form("nNSDEvents");
- fPrimdNdeta.Form("hMultvsEtaNSDNoCuts");
- break;
-
- default:
- break;
- }
-}
-//_____________________________________________________________________
-const char* AliFMDDndeta::GetAnalysisName(Analysis what, UShort_t det, Char_t ring, Int_t vtxbin) {
- //Get names of histograms
- const char* name = "";
-
- switch(what) {
- case kHits :
- name = Form("hits_NoCuts_FMD%d%c_vtxbin%d_proj",det,ring,vtxbin); //NoCuts added
- break;
- case kHitsTrVtx :
- name = Form("hits_FMD%d%c_vtxbin%d_proj",det,ring,vtxbin);
- break;
- case kMult :
- name = Form("dNdeta_FMD%d%c_vtxbin%d_proj",det,ring,vtxbin);
- break;
- case kMultTrVtx :
- name = Form("dNdeta_FMD%d%c_TrVtx_vtxbin%d_proj",det,ring,vtxbin);
- break;
- case kMultNSD :
- name = Form("dNdetaNSD_FMD%d%c_vtxbin%d_proj",det,ring,vtxbin);
- break;
-
- default:
- break;
- }
- //std::cout<<name.Data()<<std::endl;
- return name;
-}
-//_____________________________________________________________________
-const char* AliFMDDndeta::GetPrimName(Analysis what, UShort_t det, Char_t ring, Int_t vtxbin) {
- //Get names of primaries
- const char* name = "";
-
- switch(what) {
- case kHits :
- name = Form("hMCHits_nocuts_FMD%d%c_vtxbin%d",det,ring,vtxbin); //nocuts added
- break;
- case kHitsTrVtx :
- name = Form("hMCHits_FMD%d%c_vtxbin%d",det,ring,vtxbin);
- break;
- case kMult :
- name = Form("primmult_vtxbin%d",vtxbin);
- break;
- case kMultTrVtx :
- name = Form("primmult_NoCuts_vtxbin%d",vtxbin);
- break;
- case kMultNSD :
- name = Form("primmult_NSD_vtxbin%d",vtxbin);
- break;
- default:
- break;
- }
- return name;
-}
-//_____________________________________________________________________
-void AliFMDDndeta::GenerateHits(Analysis what) {
- //Generate the hits distributions
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- TH2F* hTmp = pars->GetBackgroundCorrection(1,'I',0);
- Int_t nVertexBins = pars->GetNvtxBins();
- Int_t nEtaBins = hTmp->GetNbinsX();
- Float_t etaMin = hTmp->GetXaxis()->GetXmin();
- Float_t etaMax = hTmp->GetXaxis()->GetXmax();
-
- for(Int_t i = 0; i<nVertexBins;i++) { //
- TH1F* hHits = new TH1F(Form("hMCHits_vtxbin%d_%s",i,fAnalysisNames[what].Data()),Form("hHits_vtxbin%d_%s",i,fAnalysisNames[what].Data()),nEtaBins,etaMin,etaMax);
- hHits->Sumw2();
- fMultList[what]->Add(hHits);
- }
-
- for(Int_t det = 1; det<=3; det++) {
- Int_t maxRing = (det == 1 ? 0 : 1);
- for(Int_t ring = 0;ring<=maxRing;ring++) {
-
- Char_t ringChar = (ring == 0 ? 'I' : 'O');
- for(Int_t v=0; v< nVertexBins; v++) {
- TH1F* hits = (TH1F*)fList->FindObject(GetPrimName(what,det,ringChar,v));
-
- Int_t nNonZero = 0, nNonZeroInData = 0;
-
- //removing edges
- for(Int_t i =1;i<=hits->GetNbinsX();i++) {
- if(hits->GetBinContent(i) !=0)
- nNonZero++;
- }
-
- TH1F* sumMultHist = (TH1F*)fMultList[what]->FindObject(Form("hMCHits_vtxbin%d_%s",v,fAnalysisNames[what].Data()));
- for(Int_t i =1;i<=sumMultHist->GetNbinsX();i++) {
- if(hits->GetBinContent(i) == 0 ) continue;
-
- nNonZeroInData++;
-
- if(nNonZeroInData <=fNbinsToCut || nNonZeroInData > (nNonZero - fNbinsToCut)) {
- continue;
- }
- if(sumMultHist->GetBinContent(i) < SMALLNUMBER && TMath::Abs(hits->GetBinContent(i)) > 0){
- sumMultHist->SetBinContent(i,hits->GetBinContent(i));
- sumMultHist->SetBinError(i,hits->GetBinError(i));
- }
- else {
-
-
- Float_t sumofw = (1/TMath::Power(hits->GetBinError(i),2)) + (1/TMath::Power(sumMultHist->GetBinError(i),2));
- Float_t wav = (hits->GetBinContent(i)*(1/TMath::Power(hits->GetBinError(i),2)) + sumMultHist->GetBinContent(i)*(1/TMath::Power(sumMultHist->GetBinError(i),2)))/sumofw;
- Float_t error = 1/TMath::Sqrt(sumofw);
- sumMultHist->SetBinContent(i, wav);
- sumMultHist->SetBinError(i, error);
- }
- }
- }
- }
- }
-}
-
-//_____________________________________________________________________
-void AliFMDDndeta::Init(const Char_t* filename) {
- //Initialize everything from file
- TFile* fin = TFile::Open(filename);
-
- if(!fin) {
- AliWarning("No file - exiting !");
- return;
- }
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- //pars->Init();
-
- TList* list = (TList*)fin->Get(Form("%s/BackgroundCorrected",pars->GetDndetaAnalysisName()));
-
- if(!list) //an old file ? Perhaps...
- list = (TList*)fin->Get("BackgroundCorrected");
-
- Init(list);
-
-}
-//_____________________________________________________________________
-void AliFMDDndeta::Init(TList* list) {
- //Initialize everything from TList
-
- if(!list) {
- AliWarning("No list - exiting !");
- return;
- }
-
- fList = (TList*)list->Clone("inputList");
-
- fIsGenerated[kHits] = kFALSE;
- fIsGenerated[kMult] = kFALSE;
- fIsGenerated[kMultTrVtx] = kFALSE;
- fIsGenerated[kHitsTrVtx] = kFALSE;
- fIsGenerated[kMultNSD] = kFALSE;
-
- fIsInit = kTRUE;
-}
-//_____________________________________________________________________
-void AliFMDDndeta::GenerateMult(Analysis what) {
- //Generate dNdeta
-
- if(!fIsInit) {
- AliWarning("Not initialised - call Init to remedy");
- return;
- }
-
- if(fIsGenerated[what]) {
- AliWarning("Already generated - have a look at the results!");
- return;
- }
- else fIsGenerated[what] = kTRUE;
-
- SetNames(what);
-
- if(what == kHits || what == kHitsTrVtx)
- GenerateHits(what);
-
- TH1I* hMCEvents = (TH1I*)fList->FindObject(fPrimEvents.Data());
-
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
- TH2F* hTmp = pars->GetBackgroundCorrection(1,'I',0);
- Int_t nVertexBins = pars->GetNvtxBins();
- Int_t nEtaBins = hTmp->GetNbinsX();
- Float_t etaMin = hTmp->GetXaxis()->GetXmin();
- Float_t etaMax = hTmp->GetXaxis()->GetXmax();
-
- for(Int_t i = 0; i<nVertexBins;i++) {
- TH1F* hMult = new TH1F(Form("hMult_vtxbin%d_%s",i,fAnalysisNames[what].Data()),Form("hMult_vtxbin%d_%s",i,fAnalysisNames[what].Data()),nEtaBins,etaMin,etaMax);
- hMult->Sumw2();
- fMultList[what]->Add(hMult);
- }
-
- for(Int_t det = 1; det<=3;det++) {
- Int_t maxRing = (det == 1 ? 0 : 1);
- for(Int_t iring = 0; iring<=maxRing; iring++) {
- Char_t ringChar = (iring == 0 ? 'I' : 'O');
- //Int_t nsec = (iring == 0 ? 20 : 40);
- TH1F* hRingMult= new TH1F(Form("hRingMult_FMD%d%c_%s",det,ringChar,fAnalysisNames[what].Data()),Form("hRingMult_FMD%d%c_%s",det,ringChar,fAnalysisNames[what].Data()),nEtaBins,etaMin,etaMax);
- fMultList[what]->Add(hRingMult);
- // TProfile* phiprofile = new TProfile(Form("dNdphiFMD%d%c",det,ringChar), Form("dNdphiFMD%d%c;#Phi",det,ringChar), nsec , 0, 2*TMath::Pi());
- //fMultList[what]->Add(phiprofile);
- }
- }
- TH1I* hEvents = (TH1I*)fList->FindObject(fEvents.Data());
- TH1F* hPrimVtx = 0;
-
-
-
- for(Int_t det = 1; det<=3; det++) {
- Int_t maxRing = (det == 1 ? 0 : 1);
- for(Int_t ring = 0;ring<=maxRing;ring++) {
-
- Char_t ringChar = (ring == 0 ? 'I' : 'O');
- for(Int_t v=0; v< nVertexBins; v++) {
- if(det == 1) {
- if(what == kHits || what == kHitsTrVtx)
- hPrimVtx = (TH1F*)fMultList[what]->FindObject(Form("hMCHits_vtxbin%d_%s",v,fAnalysisNames[what].Data()));
- else
- hPrimVtx = (TH1F*)fList->FindObject(GetPrimName(what,det,ringChar,v));
-
-
- Float_t nPrimevents = hMCEvents->GetBinContent(v+1);
- Float_t xb = hPrimVtx->GetNbinsX();
- Float_t xr = hPrimVtx->GetXaxis()->GetXmax() - hPrimVtx->GetXaxis()->GetXmin();
- hPrimVtx->Scale(xb / xr );
- if(nPrimevents > 0)
- hPrimVtx->Scale(1/nPrimevents);
-
- }
-
- Double_t delta = 2*pars->GetVtxCutZ()/pars->GetNvtxBins();
- Float_t vtxZ1 = (delta*v) - pars->GetVtxCutZ();
- Float_t vtxZ2 = (delta*(v+1)) - pars->GetVtxCutZ();
-
- if(vtxZ1< fVtxCut1 || vtxZ2 >fVtxCut2)
- continue;
- Float_t nEvents = (Float_t)hEvents->GetBinContent(v+1);
-
- //TH1F* multhistproj = (TH1F*)fList->FindObject(Form("dNdeta_FMD%d%c_vtxbin%d_proj",det,ringChar,v));
-
-
-
-
-
-
- TH1F* multhistproj = (TH1F*)fList->FindObject(GetAnalysisName(what,det,ringChar,v));
- if(nEvents)
- multhistproj->Scale(1/nEvents);
- Float_t xnBins = multhistproj->GetNbinsX();
- Float_t xrange = multhistproj->GetXaxis()->GetXmax() - multhistproj->GetXaxis()->GetXmin();
- multhistproj->Scale(xnBins / xrange);
-
- //TH2F* multhist = (TH2F*)fList->FindObject(Form("dNdeta_FMD%d%c_vtxbin%d",det,ringChar,v));
-
-
- //if(nEvents)
- // multhist->Scale(1/nEvents);
- /* for(Int_t i=1;i<=multhist->GetNbinsX();i++) {
- for(Int_t j=1;j<=multhist->GetNbinsY();j++) {
-
- if (multhist->GetBinContent(i,j) <= 0.0001) continue;
- //std::cout<<multhist->GetBinContent(i,j)<<std::endl;
- fDataObject->Fill(multhist->GetXaxis()->GetBinCenter(i),
- multhist->GetYaxis()->GetBinCenter(j),
- v,
- multhist->GetBinContent(i,j), multhist->GetBinError(i,j));
- //fDataObject->SetBinContent(i,j,v,multhist->GetBinContent(i,j));
- //fDataObject->SetBinError(i,j,v,multhist->GetBinError(i,j));
- }
- }
- */
- //if(nEvents)
- // multhist->Scale(1/nEvents);
- //if(ringChar == 'O')
- // multhist->RebinY(2);
- //removing edges
-
- Int_t nNonZero = 0, nNonZeroInData = 0;
-
- for(Int_t i =1;i<=multhistproj->GetNbinsX();i++) {
- if(multhistproj->GetBinContent(i) !=0)
- nNonZero++;
- }
- Int_t nBinsOld = fNbinsToCut;
- //if(det == 1 && ringChar =='I') {
- // fNbinsToCut = 0;
- // }
- TH1F* hRingMult = (TH1F*)fMultList[what]->FindObject(Form("hRingMult_FMD%d%c_%s",det,ringChar,fAnalysisNames[what].Data()));
-
- for(Int_t i=1; i<=hRingMult->GetNbinsX(); i++) {
- if(multhistproj->GetBinContent(i)!=0) {
- nNonZeroInData++;
- if(nNonZeroInData <=fNbinsToCut || nNonZeroInData > (nNonZero - fNbinsToCut)) {
- continue;
- }
- Float_t oldweight = 0;
- Float_t oldwav = 0;
- if(hRingMult->GetBinError(i)>0) {
- oldweight = 1/TMath::Power(hRingMult->GetBinError(i),2);
- oldwav = oldweight*hRingMult->GetBinContent(i);
- }
- Float_t weight = 1/TMath::Power(multhistproj->GetBinError(i),2);
- Float_t wav = oldwav + weight*multhistproj->GetBinContent(i);
- Float_t sumofw = oldweight + weight;
- if(sumofw) {
- Float_t error = 1/TMath::Sqrt(sumofw);
-
- hRingMult->SetBinContent(i,wav/sumofw);
- hRingMult->SetBinError(i,error);
-
- }
- }
- }
- nNonZeroInData = 0;
-
- TH1F* sumMultHist = (TH1F*)fMultList[what]->FindObject(Form("hMult_vtxbin%d_%s",v,fAnalysisNames[what].Data()));
-
- for(Int_t i =1;i<=sumMultHist->GetNbinsX();i++) {
- if(multhistproj->GetBinContent(i) != 0 ) {
- nNonZeroInData++;
-
- if(nNonZeroInData <=fNbinsToCut || nNonZeroInData > (nNonZero - fNbinsToCut)) {
- continue;
- }
- if(sumMultHist->GetBinContent(i) < SMALLNUMBER && TMath::Abs(multhistproj->GetBinContent(i)) > 0){
- sumMultHist->SetBinContent(i,multhistproj->GetBinContent(i));
- sumMultHist->SetBinError(i,multhistproj->GetBinError(i));
- }
- else {
-
-
- Float_t sumofw = (1/TMath::Power(multhistproj->GetBinError(i),2)) + (1/TMath::Power(sumMultHist->GetBinError(i),2));
- Float_t wav = (multhistproj->GetBinContent(i)*(1/TMath::Power(multhistproj->GetBinError(i),2)) + sumMultHist->GetBinContent(i)*(1/TMath::Power(sumMultHist->GetBinError(i),2)))/sumofw;
- Float_t error = 1/TMath::Sqrt(sumofw);
- sumMultHist->SetBinContent(i, wav);
- sumMultHist->SetBinError(i, error);
- }
-
-
- }
- }
- fNbinsToCut = nBinsOld;
- }
-
- }
- }
-
- TH1F* sumMult = new TH1F(Form("dNdeta_%s",fAnalysisNames[what].Data()),Form("dNdeta_%s",fAnalysisNames[what].Data()),nEtaBins,etaMin,etaMax);
- sumMult->Sumw2();
- fMultList[what]->Add(sumMult);
- TH1F* primMult = new TH1F(Form("primary_%s",fAnalysisNames[what].Data()),Form("primary_%s",fAnalysisNames[what].Data()),nEtaBins,etaMin,etaMax);
- primMult->Sumw2();
- fMultList[what]->Add(primMult);
-
- Float_t wav = 0, sumofw=0, weight = 0, primwav = 0, primsumofw=0, primweight = 0;//, etaofbin = 0;
- for(Int_t i =1; i<=sumMult->GetNbinsX();i++) {
-
- for(Int_t v = 0; v<nVertexBins;v++) {
- if(what == kHits || what == kHitsTrVtx)
- hPrimVtx = (TH1F*)fMultList[what]->FindObject(Form("hMCHits_vtxbin%d_%s",v,fAnalysisNames[what].Data()));
- else
- hPrimVtx = (TH1F*)fList->FindObject(GetPrimName(what,0,0,v));
- TH1F* sumMultHist = (TH1F*)fMultList[what]->FindObject(Form("hMult_vtxbin%d_%s",v,fAnalysisNames[what].Data()));
- //etaofbin += sumMultHist->GetBinCenter(i);
- // if( hPrimVtx->GetBinContent(i)!=0 && hPrimVtx->GetBinError(i)>0.001 && sumMultHist->GetBinContent(i)!=0) {
- if( TMath::Abs(hPrimVtx->GetBinContent(i)) > 0) {
- primweight = 1/TMath::Power(hPrimVtx->GetBinError(i),2);
- primwav = primwav + primweight*hPrimVtx->GetBinContent(i);
- primsumofw = primsumofw + primweight;
- }
- if(TMath::Abs(sumMultHist->GetBinContent(i)) > 0) {
-
- weight = 1/TMath::Power(sumMultHist->GetBinError(i),2);
- wav = wav + weight*sumMultHist->GetBinContent(i);
- sumofw = sumofw + weight;
- }
-
- }
- if( primsumofw !=0 ) {// && sumofw !=0) {
- Float_t primerror = 1/TMath::Sqrt(primsumofw);
-
- primMult->SetBinContent(i,primwav/primsumofw);
- primMult->SetBinError(i,primerror);
- }
- else {
- primMult->SetBinContent(i,0);
- primMult->SetBinError(i,0);
- }
-
- if(sumofw) {
-
- Float_t error = 1/TMath::Sqrt(sumofw);
-
- sumMult->SetBinContent(i,wav/sumofw);
- sumMult->SetBinError(i,error);
- }
-
-
- wav = 0;
- sumofw = 0;
- weight = 0;
- primwav = 0;
- primsumofw = 0;
- primweight = 0;
-
- }
-
-}
-//_____________________________________________________________________
-void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin, Bool_t realdata, TString pythiafile) {
- //Draw everything
- if(!fIsInit) {
- AliWarning("Not initialised - call Init to remedy");
- return;
- }
-
- if(!fIsGenerated[what]) {
- AliWarning("Not generated - generate first then draw!");
- return;
- }
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- SetNames(what);
- //UA5 data NSD
- Float_t x[19] = {0.125,0.375,0.625,0.875,1.125,1.375,1.625,1.875,2.125,2.375,
- 2.625,2.875,3.125,3.375,3.625,3.875,4.125,4.375,4.625};
- Float_t x2[19] = {-0.125,-0.375,-0.625,-0.875,-1.125,-1.375,-1.625,-1.875,
- -2.125,-2.375,-2.625,-2.875,-3.125,-3.375,-3.625,-3.875,
- -4.125,-4.375,-4.625};
-
-
- Float_t y[19] = {3.48, 3.38, 3.52, 3.68, 3.71, 3.86, 3.76, 3.66, 3.72 ,3.69,
- 3.56, 3.41, 3.15, 3.09, 2.74, 2.73, 2.32, 1.99, 1.69};
-
- Float_t ey[19] = {0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,
- 0.07,0.07,0.08,0.08,0.09,0.09,0.1,0.13};
-
- TGraphErrors* graph = new TGraphErrors(19,x,y,NULL,ey);
- TGraphErrors* graph2 = new TGraphErrors(19,x2,y,NULL,ey);
- //UA5 data INEL
- Float_t xinel[19] = {0.125, 0.375, 0.625, 0.875, 1.125, 1.375, 1.625, 1.875, 2.125, 2.375, 2.625, 2.875, 3.125, 3.375, 3.625, 3.875, 4.125, 4.375, 4.625};
- Float_t xinel2[19] = {-0.125, -0.375, -0.625, -0.875, -1.125, -1.375, -1.625, -1.875, -2.125, -2.375, -2.625, -2.875, -3.125, -3.375, -3.625, -3.875, -4.125, -4.375, -4.625};
- Float_t yinel[19] = {3.14, 3.04, 3.17, 3.33, 3.33, 3.53, 3.46, 3.41, 3.45, 3.39, 3.07, 3.07, 2.93, 2.93, 2.55, 2.48, 2.18, 1.91, 1.52};
- Float_t eyinel[19] = {0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.08, 0.08, 0.09, 0.09, 0.1, 0.13};
- TGraphErrors* graphinel = new TGraphErrors(19,xinel,yinel,NULL,eyinel);
- TGraphErrors* graphinel2 = new TGraphErrors(19,xinel2,yinel,NULL,eyinel);
-
- graph->SetMarkerStyle(22);
- graph->SetMarkerColor(kBlue);
- graphinel->SetMarkerStyle(20);
- graphinel->SetMarkerColor(kGreen);
- graphinel2->SetMarkerStyle(24);
- graphinel2->SetMarkerColor(kGreen);
- //graph->Draw("P");
- graph2->SetMarkerStyle(26);
- graph2->SetMarkerColor(kBlue);
- graphinel->GetHistogram()->SetStats(kFALSE);
- graphinel2->GetHistogram()->SetStats(kFALSE);
-
-
- //End UA5 data
-
- //Published ALICE data
- // Plot: p7742_d1x1y1
-
- // INEL
-
- TGraphAsymmErrors* p7742D1x1y1 = 0;
- double p7742D1x1y1xval[] = { -1.3, -1.1, -0.9, -0.7, -0.5, -0.3, -0.1, 0.1, 0.3,
- 0.5, 0.7, 0.9, 1.1, 1.3 };
- double p7742D1x1y1xerrminus[] = { 0.09999999999999987, 0.09999999999999987, 0.09999999999999998, 0.10000000000000009, 0.09999999999999998, 0.10000000000000003, 0.1, 0.1, 0.09999999999999998,
- 0.09999999999999998, 0.09999999999999998, 0.09999999999999998, 0.10000000000000009, 0.10000000000000009 };
- double p7742D1x1y1xerrplus[] = { 0.10000000000000009, 0.10000000000000009, 0.09999999999999998, 0.09999999999999998, 0.09999999999999998, 0.09999999999999998, 0.1, 0.1, 0.10000000000000003,
- 0.09999999999999998, 0.10000000000000009, 0.09999999999999998, 0.09999999999999987, 0.09999999999999987 };
- double p7742D1x1y1yval[] = { 3.28, 3.28, 3.22, 3.12, 3.06, 3.02, 2.98, 3.02, 3.02,
- 3.05, 3.15, 3.21, 3.26, 3.33 };
- double p7742D1x1y1yerrminus[] = { 0.06324555320336758, 0.06324555320336758, 0.06324555320336758, 0.06324555320336758, 0.06324555320336758, 0.05385164807134505, 0.05385164807134505, 0.05385164807134505, 0.05385164807134505,
- 0.06324555320336758, 0.06324555320336758, 0.06324555320336758, 0.06324555320336758, 0.06324555320336758 };
- double p7742D1x1y1yerrplus[] = { 0.08246211251235322, 0.08246211251235322, 0.08246211251235322, 0.08246211251235322, 0.08246211251235322, 0.08246211251235322, 0.07280109889280519, 0.08246211251235322, 0.08246211251235322,
- 0.08246211251235322, 0.08246211251235322, 0.08246211251235322, 0.08246211251235322, 0.08246211251235322 };
- int p7742D1x1y1numpoints = 14;
- p7742D1x1y1 = new TGraphAsymmErrors(p7742D1x1y1numpoints, p7742D1x1y1xval, p7742D1x1y1yval, p7742D1x1y1xerrminus, p7742D1x1y1xerrplus, p7742D1x1y1yerrminus, p7742D1x1y1yerrplus);
- p7742D1x1y1->SetName("/HepData/7742/d1x1y1");
- p7742D1x1y1->SetTitle("/HepData/7742/d1x1y1");
- p7742D1x1y1->SetMarkerStyle(21);
- p7742D1x1y1->SetMarkerColor(kRed);
- // p7742D1x1y1->Draw("Psame");
-
-
- //NSD
- TGraphAsymmErrors* p7742D2x1y1 = 0;
- double p7742D2x1y1xval[] = { -1.3, -1.1, -0.9, -0.7, -0.5, -0.3, -0.1, 0.1, 0.3,
- 0.5, 0.7, 0.9, 1.1, 1.3 };
- double p7742D2x1y1xerrminus[] = { 0.09999999999999987, 0.09999999999999987, 0.09999999999999998, 0.10000000000000009, 0.09999999999999998, 0.10000000000000003, 0.1, 0.1, 0.09999999999999998,
- 0.09999999999999998, 0.09999999999999998, 0.09999999999999998, 0.10000000000000009, 0.10000000000000009 };
- double p7742D2x1y1xerrplus[] = { 0.10000000000000009, 0.10000000000000009, 0.09999999999999998, 0.09999999999999998, 0.09999999999999998, 0.09999999999999998, 0.1, 0.1, 0.10000000000000003,
- 0.09999999999999998, 0.10000000000000009, 0.09999999999999998, 0.09999999999999987, 0.09999999999999987 };
- double p7742D2x1y1yval[] = { 3.9, 3.89, 3.81, 3.7, 3.64, 3.59, 3.53, 3.58, 3.59,
- 3.61, 3.74, 3.8, 3.87, 3.95 };
- double p7742D2x1y1yerrminus[] = { 0.13341664064126335, 0.13152946437965907, 0.13152946437965907, 0.1216552506059644, 0.1216552506059644, 0.1216552506059644, 0.1216552506059644, 0.1216552506059644, 0.1216552506059644,
- 0.1216552506059644, 0.1216552506059644, 0.13152946437965907, 0.13152946437965907, 0.13341664064126335 };
- double p7742D2x1y1yerrplus[] = { 0.13341664064126335, 0.13152946437965907, 0.13152946437965907, 0.1216552506059644, 0.1216552506059644, 0.1216552506059644, 0.1216552506059644, 0.1216552506059644, 0.1216552506059644,
- 0.1216552506059644, 0.1216552506059644, 0.13152946437965907, 0.13152946437965907, 0.13341664064126335 };
- int p7742D2x1y1numpoints = 14;
-
- p7742D2x1y1 = new TGraphAsymmErrors(p7742D2x1y1numpoints, p7742D2x1y1xval, p7742D2x1y1yval, p7742D2x1y1xerrminus, p7742D2x1y1xerrplus, p7742D2x1y1yerrminus, p7742D2x1y1yerrplus);
- p7742D2x1y1->SetName("/HepData/7742/d2x1y1");
- p7742D2x1y1->SetTitle("/HepData/7742/d2x1y1");
- p7742D2x1y1->SetMarkerStyle(21);
- p7742D2x1y1->SetMarkerColor(kRed);
- //p7742D2x1y1.Draw("AP");
-
-
-
-
-
-
- //End official data
-
- // CMS published NSD data
-
- TGraphAsymmErrors* p7743D8x1y1 = 0;
- double p7743D8x1y1xval[] = { -2.25, -1.75, -1.25, -0.75, -0.25, 0.25, 0.75, 1.25, 1.75,
- 2.25 };
- double p7743D8x1y1xerrminus[] = { 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25 };
- double p7743D8x1y1xerrplus[] = { 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25 };
- double p7743D8x1y1yval[] = { 3.6, 3.73, 3.62, 3.54, 3.48, 3.48, 3.54, 3.62, 3.73, 3.6 };
- double p7743D8x1y1yerrminus[] = { 0.13, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.14,0.13 };
- double p7743D8x1y1yerrplus[] = { 0.13, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.14, 0.13 };
- int p7743D8x1y1numpoints = 10;
- p7743D8x1y1 = new TGraphAsymmErrors(p7743D8x1y1numpoints, p7743D8x1y1xval, p7743D8x1y1yval, p7743D8x1y1xerrminus, p7743D8x1y1xerrplus, p7743D8x1y1yerrminus, p7743D8x1y1yerrplus);
-
- p7743D8x1y1->SetMarkerStyle(20);
- p7743D8x1y1->SetMarkerColor(kBlack);
-
- //End CMS
-
-
- TH1I* hEvents = (TH1I*)fList->FindObject(fEvents.Data());
-
- TH1I* hMCEvents = (TH1I*)fList->FindObject(fPrimEvents.Data());
-
- //SPD part
- TH1D* hSPDana = (TH1D*)fList->FindObject(Form("dNdeta_SPD_vtxbin%d_proj",5));
-
- for(Int_t nn = 0; nn < pars->GetNvtxBins() ; nn++) {
- TH1D* hSPDanalysis = (TH1D*)fList->FindObject(Form("dNdeta_SPD_vtxbin%d_proj",nn));
- TH1D* hSPDanalysisTrVtx = (TH1D*)fList->FindObject(Form("dNdetaTrVtx_SPD_vtxbin%d_proj",nn));
- TH1D* hSPDanalysisNSD = (TH1D*)fList->FindObject(Form("dNdetaNSD_SPD_vtxbin%d_proj",nn));
-
- Float_t nEventsSPD = (Float_t)hEvents->GetBinContent(nn+1);
- if(!nEventsSPD) continue;
- hSPDanalysis->Scale(1/nEventsSPD);
- hSPDanalysisTrVtx->Scale(1/nEventsSPD);
- hSPDanalysisNSD->Scale(1/nEventsSPD);
- }
- Float_t lowlimits[10] = {-1,-1.25,-1.5,-1.75,-1.9,-1.9,-1.9,-1.9,-1.9,-1.9};
- Float_t highlimits[10] = {1.9,1.9,1.9,1.9,1.9,1.9,1.75,1.5,1.25,1};
-
- TH1F* hSPDcombi = new TH1F("SPDcombi","SPDcombi",hSPDana->GetNbinsX(),hSPDana->GetXaxis()->GetXmin(),hSPDana->GetXaxis()->GetXmax());
- TH1D* hSPDanalysis = 0;
- for(Int_t kk = 1; kk <=hSPDana->GetNbinsX(); kk++) {
-
- Float_t weight = 0, wav=0,sumofw = 0;
-
- // if(hSPDana->GetBinCenter(kk) < lowlimits[nn])
- // continue;
- //if(hSPDana->GetBinCenter(kk) > highlimits[nn])
- // continue;
-
- for(Int_t nn =0; nn < pars->GetNvtxBins() ; nn++) {
- Double_t delta = 2*pars->GetVtxCutZ()/pars->GetNvtxBins();
- Float_t vtxZ1 = (delta*nn) - pars->GetVtxCutZ();
- Float_t vtxZ2 = (delta*(nn+1)) - pars->GetVtxCutZ();
-
- if(vtxZ1<fVtxCut1 || vtxZ2 >fVtxCut2)
- continue;
-
- //std::cout<<vtxZ1<<" "<<vtxZ2<<std::endl;
-
- if(what == kMult)
- hSPDanalysis = (TH1D*)fList->FindObject(Form("dNdeta_SPD_vtxbin%d_proj",nn));
- else if(what == kMultNSD)
- hSPDanalysis = (TH1D*)fList->FindObject(Form("dNdetaNSD_SPD_vtxbin%d_proj",nn));
- else if(what == kMultTrVtx)
- hSPDanalysis = (TH1D*)fList->FindObject(Form("dNdetaTrVtx_SPD_vtxbin%d_proj",nn));
- else continue;
- if(hSPDanalysis->GetBinCenter(kk) < lowlimits[nn])
- continue;
- if(hSPDanalysis->GetBinCenter(kk) > highlimits[nn])
- continue;
- //std::cout<<hSPDanalysis->GetBinCenter(kk)<<" "<<lowlimits[nn]<<std::endl;
-
- Float_t mult = hSPDanalysis->GetBinContent(kk);
- Float_t error = hSPDanalysis->GetBinError(kk);
- /*
- if(mult > 0 && hSPDanalysis->GetBinContent(kk-1) < SMALLNUMBER)
- continue;
- if(mult > 0 && hSPDanalysis->GetBinContent(kk-2) < SMALLNUMBER)
- continue;
-
- if(mult > 0 && hSPDanalysis->GetBinContent(kk+1) < SMALLNUMBER)
- continue;
- if(mult > 0 && hSPDanalysis->GetBinContent(kk+2) < SMALLNUMBER)
- continue;
- */
- if(mult > 0) {
- weight = 1/TMath::Power(error,2);
- wav = wav + weight*mult;
- sumofw = sumofw + weight;
- }
-
- }
-
- if(sumofw && wav) {
- Float_t errorTotal = 1/TMath::Sqrt(sumofw);
- hSPDcombi->SetBinContent(kk,wav/sumofw);
- hSPDcombi->SetBinError(kk,errorTotal);
- }
- }
-
-
- Float_t xb1 = hSPDcombi->GetNbinsX();
- Float_t xr1 = hSPDcombi->GetXaxis()->GetXmax() - hSPDcombi->GetXaxis()->GetXmin();
- hSPDcombi->Scale(xb1 / xr1);
- //hSPDcombi->Rebin(rebin);
- //hSPDcombi->Scale(1/(Float_t)rebin);
- //RebinHistogram(hSPDcombi,rebin);
- hSPDcombi->SetMarkerStyle(29);
- hSPDcombi->SetMarkerColor(kBlue);
- //hSPDcombi->DrawCopy("same");
-
-
- TCanvas* c1 = new TCanvas("cvertexbins","Overlaps",1400,800);
- c1->Divide(5,2);
- TCanvas* cCorrections = 0;
- TCanvas* cCorrectionsPhi = 0;
- if(fDrawAll) {
- cCorrections = new TCanvas("corrections","Correction vs Eta",1400,800);
- cCorrections->Divide(5,2);
-
- cCorrectionsPhi = new TCanvas("correctionsPhi","Correction vs Phi",1400,800);
- cCorrectionsPhi->Divide(5,2);
- }
- //TCanvas* cphi = new TCanvas("dNdphi","dNdphi",1280,1024);
- // cphi->Divide(3,2);
-
- Int_t nVertexBins = pars->GetNvtxBins();
-
-
- //Int_t npadphi = 0;
- TH1F* hPrimVtx = 0;
- for(Int_t det = 1; det<=3; det++) {
- Int_t maxRing = (det == 1 ? 0 : 1);
- for(Int_t ring = 0;ring<=maxRing;ring++) {
- // npadphi++;
-
- for(Int_t v=0; v< nVertexBins; v++) {
- Char_t ringChar = (ring == 0 ? 'I' : 'O');
- Double_t delta = 2*pars->GetVtxCutZ()/pars->GetNvtxBins();
- Float_t vtxZ1 = (delta*v) - pars->GetVtxCutZ();
- Float_t vtxZ2 = (delta*(v+1)) - pars->GetVtxCutZ();
-
- if(vtxZ1<fVtxCut1 || vtxZ2 >fVtxCut2)
- continue;
- Float_t nEvents = (Float_t)hEvents->GetBinContent(v+1);
- if(fDrawAll) {
- TH2F* hBgCor = pars->GetBackgroundCorrection(det,ringChar,v);
- if(hBgCor) {
- TH1D* hBgProj = hBgCor->ProjectionX(Form("hBgProj_FMD%d%c_vtxbin%d",det,ringChar,v));
- TH1D* hBgProjPhi = hBgCor->ProjectionY(Form("hBgProjPhi_FMD%d%c_vtxbin%d",det,ringChar,v));
-
- hBgProjPhi->SetName(Form("FMD%d%c",det,ringChar));
- hBgProjPhi->SetTitle("");//Form("FMD%d",det));
- hBgProj->SetTitle("");
- //Float_t scalefactor = (hBgProj->GetXaxis()->GetXmax() - hBgProj->GetXaxis()->GetXmin()) / (Float_t)hBgProj->GetNbinsX();
- Float_t scalefactor = 1/(Float_t)hBgCor->GetNbinsY();
-
- Float_t nFilledEtaBins = 0;
-
- for(Int_t jj = 1; jj<=hBgProj->GetNbinsX(); jj++) {
- if(hBgProj->GetBinContent(jj) > 0.01)
- nFilledEtaBins++;
- }
-
- Float_t scalefactorPhi = 1/nFilledEtaBins;
-
-
- hBgProj->Scale(scalefactor);
- cCorrections->cd(v+1);
-
- hBgProj->SetMarkerColor(det + 2*ring);
- hBgProj->SetMarkerStyle(19 + det + 2*ring );
-
- if((det + 2*ring) == 5) hBgProj->SetMarkerColor(det + 2*ring+1);
- if((19 + det + 2*ring ) == 24) hBgProj->SetMarkerStyle(29 );
-
- if(det == 1) {
- hBgProj->GetYaxis()->SetRangeUser(0,4);
- hBgProj->SetStats(kFALSE);
- hBgProj->SetXTitle("#eta");
- hBgProj->DrawCopy("PE");
- TLatex* l = new TLatex(0.14,0.92,Form("Vtx range [%.1f, %.1f]",vtxZ1,vtxZ2));
- l->SetNDC(kTRUE);
- l->Draw();
- }
- else
- hBgProj->DrawCopy("PEsame");
-
- hBgProjPhi->Scale(scalefactorPhi);
- cCorrectionsPhi->cd(v+1);
- hBgProjPhi->SetMarkerColor(det + 2*ring);
- hBgProjPhi->SetMarkerStyle(19 + det + 2*ring );
- if((det + 2*ring) == 5) hBgProjPhi->SetMarkerColor(det + 2*ring+1);
- if((19 + det + 2*ring ) == 24) hBgProjPhi->SetMarkerStyle(29 );
- if(det == 1) {
- hBgProjPhi->GetYaxis()->SetRangeUser(1,5);
- hBgProjPhi->SetStats(kFALSE);
-
- hBgProjPhi->SetXTitle("#Phi");
- hBgProjPhi->DrawCopy("PE");
-
-
- }
- else
- hBgProjPhi->DrawCopy("PEsame");
-
- }
-
- }
-
- TH1F* multhistproj = (TH1F*)fList->FindObject(GetAnalysisName(what,det,ringChar,v));
-
- c1->cd(v+1);
-
- if(det==1) {
- multhistproj->SetMarkerStyle(20);
- multhistproj->SetMarkerColor(1);
- }
- if(det==2 && ringChar=='I') {
- multhistproj->SetMarkerStyle(21);
- multhistproj->SetMarkerColor(2);
- }
- if(det==2 && ringChar=='O') {
- multhistproj->SetMarkerStyle(3);
- multhistproj->SetMarkerColor(3);
- }
- if(det==3 && ringChar=='I') {
- multhistproj->SetMarkerStyle(22);
- multhistproj->SetMarkerColor(4);
- }
- if(det==3 && ringChar=='O') {
- multhistproj->SetMarkerStyle(23);
- multhistproj->SetMarkerColor(6);
- }
-
-
-
- if(det == 1) {
- if(what == kHits || what == kHitsTrVtx)
- hPrimVtx = (TH1F*)fMultList[what]->FindObject(Form("hMCHits_vtxbin%d_%s",v,fAnalysisNames[what].Data()));
- else
- hPrimVtx = (TH1F*)fList->FindObject(GetPrimName(what,det,ringChar,v));
- // std::cout<<hPrimVtx<<" "<<kHits<<" "<<kHitsTrVtx<<" "<<what<<std::endl;
- //std::cout<<Form("hMCHits_vtxbin%d_%s",v,fAnalysisNames[what].Data())<<std::endl;
- hPrimVtx->SetTitle("");
- TLatex* l = new TLatex(0.14,0.92,Form("Vtx range [%.1f, %.1f], %d events",vtxZ1,vtxZ2,(Int_t)nEvents));
- l->SetNDC(kTRUE);
- hPrimVtx->SetFillColor(kGray);
- hPrimVtx->SetLabelFont(132,"xyz");
- hPrimVtx->SetStats(0000);
- hPrimVtx->GetXaxis()->SetTitle("#eta");
- hPrimVtx->GetYaxis()->SetRangeUser(0,6);
- hPrimVtx->DrawCopy("E3");
- l->Draw();
- multhistproj->DrawCopy("same");
- TH1D* hSPDanavtxbin = 0;
- if(what == kMult || what == kMultTrVtx || what == kMultNSD) {
-
- if(what == kMult)
- hSPDanavtxbin = (TH1D*)fList->FindObject(Form("dNdeta_SPD_vtxbin%d_proj",v));
- if(what == kMultTrVtx)
- hSPDanavtxbin = (TH1D*)fList->FindObject(Form("dNdetaTrVtx_SPD_vtxbin%d_proj",v));
-
- if(what == kMultNSD)
- hSPDanavtxbin = (TH1D*)fList->FindObject(Form("dNdetaNSD_SPD_vtxbin%d_proj",v));
-
- hSPDanavtxbin->SetMarkerColor(kBlue);
- hSPDanavtxbin->SetMarkerStyle(kStar);
- hSPDanavtxbin->Scale(xb1 / xr1);
- hSPDanavtxbin->DrawCopy("same");
-
- if(what != kMultNSD) {
- graphinel->Draw("sameP");
- graphinel2->Draw("sameP");
- }
- else
- {
- graph->Draw("sameP");
- graph2->Draw("sameP");
- }
- }
- }
- else
- multhistproj->DrawCopy("same");
-
-
- }
- }
- }
-
- //Legends for corrections
- if(fDrawAll) {
- for(Int_t v=0; v< nVertexBins; v++) {
- TPad* pad= (TPad*)cCorrectionsPhi->cd(v+1);
- pad->BuildLegend(0.15,0.45,0.45,0.9);
- Double_t delta = 2*pars->GetVtxCutZ()/pars->GetNvtxBins();
- Float_t vtxZ1 = (delta*v) - pars->GetVtxCutZ();
- Float_t vtxZ2 = (delta*(v+1)) - pars->GetVtxCutZ();
- TLatex* l = new TLatex(0.14,0.92,Form("Vtx range [%.1f, %.1f]",vtxZ1,vtxZ2));
- l->SetNDC(kTRUE);
- l->Draw();
- }
- }
- for(Int_t v=0; v< nVertexBins; v++) {
- TH1F* sumMultHist = (TH1F*)fMultList[what]->FindObject(Form("hMult_vtxbin%d_%s",v,fAnalysisNames[what].Data()));
- c1->cd(v+1);
- sumMultHist->SetMarkerStyle(25);
- sumMultHist->DrawCopy("same");
-
- }
- TH1F* primMult = (TH1F*)fMultList[what]->FindObject(Form("primary_%s",fAnalysisNames[what].Data()));
- TH1F* sumMult = (TH1F*)fMultList[what]->FindObject(Form("dNdeta_%s",fAnalysisNames[what].Data()));
- sumMult->SetMarkerStyle(23);
- sumMult->SetMarkerColor(kRed);
- for(Int_t det = 1; det<=3;det++) {
- Int_t maxRing = (det == 1 ? 0 : 1);
- for(Int_t iring = 0; iring<=maxRing; iring++) {
- Char_t ringChar = (iring == 0 ? 'I' : 'O');
- TH1F* hRingMult= (TH1F*)fMultList[what]->FindObject(Form("hRingMult_FMD%d%c_%s",det,ringChar,fAnalysisNames[what].Data()));
- hRingMult->Add(primMult,-1);
- hRingMult->Divide(primMult);
- }
- }
-
-
- // End of SPD
-
-
- //TH1F* hPrim = (TH1F*)fList->FindObject(fPrimEvents.Data());
- // TFile testhit("/home/canute/ALICE/Simulations/TestOfAnalysis2/hitsdist.root");
- // TH1F* hHitCor = (TH1F*)testhit.Get("selectedHits");
- // hHitCor->Sumw2();
- // sumMult->Divide(hHitCor);
- TH1F* hPrim = (TH1F*)fList->FindObject(fPrimdNdeta.Data());
- Float_t nPrimevents = hMCEvents->GetEntries();
- //std::cout<<hMCEvents->GetEntries()<<std::endl;
- Float_t xb = hPrim->GetNbinsX();
- Float_t xr = hPrim->GetXaxis()->GetXmax() - hPrim->GetXaxis()->GetXmin();
- //std::cout<<xb/xr<<std::endl;
- hPrim->Scale(xb / xr );
- if(nPrimevents > 0)
- hPrim->Scale(1/nPrimevents);
-
-
- // primMult->Rebin(rebin);
- // primMult->Scale(1/rebin);
- // hPrim->Rebin(rebin);
- // hPrim->Scale(1/rebin);
- if(what != kHits && what != kHitsTrVtx)
- primMult = hPrim;
-
- // hReldif->Add(hPrim,-1);
- // hReldif->Divide(hPrim);
-
-
-
- /////////////*******************New thing!!!
-
- //TH3D* hist3d = (TH3D*)fDataObject->ProjectionXYZ("hist3d");
- // fDataObject->Sumw2();
- //TH2F* projeta = (TH2F*)fDataObject->Project3D("yx");
-
- // TProfile2D* projeta = fDataObject->Project3DProfile("yx");
- // projeta->SetSumw2();
- //TProfile* etaprofile = projeta->ProfileX("dNdeta_profile");
- //TProfile* etaprofile = projeta->ProfileX("dNdeta_profile");
- // TH1* etaprofile = projeta->ProjectionX("dNdeta_profile");
- //TProfile* etaprofile = fDataObject->ProfileX();
- /*
- TCanvas* ctest = new TCanvas("test","test",1200,600);
- ctest->Divide(3);
- ctest->cd(1);
- fDataObject->DrawCopy("box");
- ctest->cd(2);
- projeta->DrawCopy("colz");
- ctest->cd(3);
- etaprofile->DrawCopy();
- */
- //sumMult->Rebin(rebin);
- TH1F* hReldif = (TH1F*)sumMult->Clone("hReldif");
- if(rebin != 1) {
- RebinHistogram(sumMult,rebin);
- if(!realdata) {
- RebinHistogram(primMult,rebin);
- RebinHistogram(hReldif,rebin);
- }
- }
- hReldif->Add(primMult,-1);
- hReldif->Divide(primMult);
- TCanvas* c2 = new TCanvas("dN/deta","dN/deta",640,960);
- c2->Divide(1,2);//,0,0);
- c2->cd(2);
- gPad->Divide(1,2);
- gPad->cd(1);
- gPad->SetGridy();
- gPad->SetGridx();
- hReldif->SetTitle("");
- hReldif->GetYaxis()->SetTitle("Relative difference");
- hReldif->GetYaxis()->SetRangeUser(-0.2,0.2);
- hReldif->SetStats(0000);
- hReldif->GetXaxis()->SetTitle("#eta");
-
- hReldif->DrawCopy();
- //SPD Rel dif
- TH1F* hReldifSPD = (TH1F*)hSPDcombi->Clone("hReldifSPD");
- if(rebin != 1) {
- RebinHistogram(hSPDcombi,rebin);
- if(!realdata) {
- RebinHistogram(hReldifSPD,rebin);
- }
- }
- hReldifSPD->Add(primMult,-1);
- hReldifSPD->Divide(primMult);
- hReldifSPD->DrawCopy("same");
-
- TLine* zeroLine = new TLine(-4,0,6,0);
- zeroLine->SetLineWidth(2);
- zeroLine->SetLineColor(kBlack);
- zeroLine->Draw();
- hPrim->SetTitle("");
- hPrim->SetLabelFont(132,"xyz");
- hPrim->SetFillColor(kGray);
- primMult->SetFillColor(kBlue);
-
-
- c2->cd(1);
- gPad->SetGridy();
- gPad->SetGridx();
- hPrim->GetYaxis()->SetRangeUser(2,10);
- //hPrim->GetYaxis()->SetRangeUser(0,20);
- hPrim->SetStats(0000);
- hPrim->GetXaxis()->SetTitle("#eta");
- sumMult->SetTitle("");
- sumMult->SetStats(kFALSE);
- sumMult->SetXTitle("#eta");
- sumMult->SetYTitle("#frac{dN}{d#eta_{ch}}");
- // sumMult->GetYaxis()->SetRangeUser
- //sumMult->Scale(1/(Float_t)rebin);
- sumMult->DrawCopy("PE");
- //Syst errors
- TH1F* sumMultSystPos = (TH1F*)sumMult->Clone("systerrorsPos");
- TH1F* sumMultSystNeg = (TH1F*)sumMult->Clone("systerrorsNeg");
- for(Int_t jj = 1;jj <=sumMultSystPos->GetNbinsX();jj++) {
- if(sumMultSystPos->GetBinCenter(jj) < 0) {
- sumMultSystPos->SetBinError(jj,0);
- sumMultSystPos->SetBinContent(jj,0);
- continue;
- }
-
- if(sumMultSystPos->GetBinContent(jj) > 0)
- sumMultSystPos->SetBinError(jj,TMath::Sqrt(TMath::Power(sumMultSystPos->GetBinError(jj),2)+TMath::Power(0.1*sumMultSystPos->GetBinContent(jj),2)));
- }
- for(Int_t jj = 1;jj <=sumMultSystNeg->GetNbinsX();jj++) {
- if(sumMultSystNeg->GetBinCenter(jj) > 0) {
- sumMultSystNeg->SetBinError(jj,0);
- sumMultSystNeg->SetBinContent(jj,0);
- continue;
- }
-
- if(sumMultSystNeg->GetBinContent(jj) > 0)
- sumMultSystNeg->SetBinError(jj,TMath::Sqrt(TMath::Power(sumMultSystNeg->GetBinError(jj),2)+TMath::Power(0.1*sumMultSystNeg->GetBinContent(jj),2)));
- }
-
-
-
- sumMultSystPos->SetFillColor(18);
- sumMultSystNeg->SetFillColor(18);
- //sumMultSystPos->DrawCopy("sameE5");
- //sumMultSystNeg->DrawCopy("sameE5");
- //End syst errors
-
-
-
- if(what != kHits && what != kHitsTrVtx && hPrim->GetEntries())
- hPrim->DrawCopy("E3same");
- if(what == kHits || what == kHitsTrVtx)
- primMult->DrawCopy("E3same");
- hPrim->GetXaxis()->SetTitle("#eta");
-
- TH1F* hMirror = new TH1F("hMirror","mirrored",sumMult->GetNbinsX(),sumMult->GetXaxis()->GetXmin(),sumMult->GetXaxis()->GetXmax());
-
- for(Int_t i= (Int_t)0.5*sumMult->GetNbinsX(); i<=sumMult->GetNbinsX(); i++) {
- Float_t eta = sumMult->GetBinCenter(i);
- Float_t value = sumMult->GetBinContent(i);
- Float_t error = sumMult->GetBinError(i);
- if(value > 0) {
- hMirror->SetBinContent(hMirror->FindBin(-1*eta),value);
- hMirror->SetBinError(hMirror->FindBin(-1*eta),error);
- }
- }
- TH1F* hReldifLR = (TH1F*)sumMult->Clone("hReldifLeftRight");
- hReldifLR->Add(hMirror,-1);
- hReldifLR->Divide(hMirror);
- c2->cd(2);
- gPad->cd(1);
- hReldifLR->GetYaxis()->SetRangeUser(-0.2,0.2);
-
- hReldifLR->SetYTitle("Relative difference left-right");
- hReldifLR->SetLabelSize(2*hReldifLR->GetLabelSize("X"),"X");
- hReldifLR->SetLabelSize(2*hReldifLR->GetLabelSize("Y"),"Y");
- hReldifLR->SetTitleSize(2*hReldifLR->GetTitleSize("X"),"X");
- hReldifLR->SetTitleSize(2*hReldifLR->GetTitleSize("Y"),"Y");
- hReldifLR->SetTitleOffset(0.7*hReldifLR->GetTitleOffset("X"),"X");
- hReldifLR->SetTitleOffset(0.5*hReldifLR->GetTitleOffset("Y"),"Y");
-
-
- if(realdata)
- hReldifLR->DrawCopy();
- zeroLine->Draw();
- c2->cd(1);
- hMirror->SetMarkerStyle(25);
-
- hPrim->SetMarkerStyle(8);
-
- //graph2->Draw("P");
- TH1F* hPythiaMB = 0;
-
- TFile* fpyt = 0;
-
- if(!pythiafile.Contains("none"))
- fpyt = TFile::Open(pythiafile);
-
- if(realdata ) {
- if(fpyt && !pythiafile.Contains("none")) {
- hPythiaMB = (TH1F*)fpyt->Get("hPythiaMB");
- }
- else
- std::cout<<"no pythia for this energy"<<std::endl;
- }
- if(what != kHits && what != kHitsTrVtx) {
- if(hPrim->GetEntries() != 0 && !realdata)
- hPrim->DrawCopy("PE3same");
- if(realdata) {
- //graph->Draw("PEsame");
- //graph2->Draw("PEsame");
- if(what != kMultNSD) {
- graphinel->Draw("PEsame");
- graphinel2->Draw("PEsame");
- p7742D1x1y1->Draw("PEsame");
- }
- else{
- graph->Draw("PEsame");
- graph2->Draw("PEsame");
- p7742D2x1y1->Draw("PEsame");
- p7743D8x1y1->Draw("PEsame");
-
- }
-
- }
-
- }
-
-
- sumMult->DrawCopy("PEsame");
-
-
-
- hSPDcombi->DrawCopy("same");
- if(realdata)
- hMirror->DrawCopy("PEsame");
-
- TLegend* leg = new TLegend(0.3,0.2,0.7,0.45,"");
- if(!realdata) {
- if(what != kHits && what != kHitsTrVtx)
- leg->AddEntry(hPrim,"Primary","pf");
- else
- leg->AddEntry(primMult,"Hits","pf");
- }
-
- if(what == kMult)
- leg->AddEntry(sumMult,"FMD INEL","p");
- else if(what == kMultTrVtx)
- leg->AddEntry(sumMult,"FMD TrVtx","p");
- else if(what == kMultNSD)
- leg->AddEntry(sumMult,"FMD NSD","p");
-
-
- if(realdata) {
- if(what == kMult)
- leg->AddEntry(hMirror,"Mirror FMD INEL","p");
- else if(what == kMultTrVtx)
- leg->AddEntry(hMirror,"Mirror FMD TrVtx","p");
- else if(what == kMultNSD)
- leg->AddEntry(hMirror,"Mirror FMD NSD","p");
-
- if(what == kMultNSD) {
- leg->AddEntry(graph,"UA5 NSD","p");
- leg->AddEntry(graph2,"Mirror UA5 NSD","p"); }
- else if(what == kMult) {
- leg->AddEntry(graphinel,"UA5 INEL","p");
- leg->AddEntry(graphinel2,"Mirror UA5 INEL","p");
- }
- //leg->AddEntry(hPythiaMB,"Pythia MB","l");
- leg->AddEntry(hSPDcombi,"HHD SPD clusters","p");
- if(what == kMult)
- leg->AddEntry(p7742D1x1y1,"ALICE INEL published","p");
- if(what == kMultNSD) {
- leg->AddEntry(p7742D2x1y1,"ALICE NSD published","p");
- leg->AddEntry(p7743D8x1y1, "CMS NSD published","p");
- }
- }
- leg->Draw();
-
- c2->cd(2);
- gPad->cd(2);
- TH1F* hRatioMultPythia = 0;
- TH1F* hRatioMultUA5 = 0;
- TH1F* hRatioMultUA5_rebin5 = new TH1F("hRatioMultUA5_rebin5","hRatioMultUA5_rebin5",sumMult->GetNbinsX(),sumMult->GetXaxis()->GetXmin(),sumMult->GetXaxis()->GetXmax());
-
- Double_t xval=0, yval=0;
- Int_t ipos=0;
- for(Int_t bb =hRatioMultUA5_rebin5->FindBin(0); bb<=hRatioMultUA5_rebin5->GetNbinsX();bb++) {
-
-
-
- xval=yval=0;
-
- if(hRatioMultUA5_rebin5->GetBinCenter(bb) >= 0) {
- if(what == kMultNSD)
- graph->GetPoint(ipos,xval,yval);
- else
- graphinel->GetPoint(ipos,xval,yval);
-
- if(yval>0) {
- hRatioMultUA5_rebin5->SetBinContent(bb,yval);
- hRatioMultUA5_rebin5->SetBinError(bb,graphinel->GetErrorY(ipos));
- if(hRatioMultUA5_rebin5->GetBinCenter(bb) < 4) {
- hRatioMultUA5_rebin5->SetBinContent(hRatioMultUA5_rebin5->FindBin(-1*hRatioMultUA5_rebin5->GetBinCenter(bb)),yval);
- hRatioMultUA5_rebin5->SetBinError(hRatioMultUA5_rebin5->FindBin(-1*hRatioMultUA5_rebin5->GetBinCenter(bb)),(what == kMultNSD ? graph->GetErrorY(ipos) : graph->GetErrorY(ipos)));
-
- }
- ipos++;
- }
- }
- }
-
-
-
- if(realdata) {
-
- Float_t ratio = 1;
- if(hPythiaMB) {
- if(hPythiaMB->GetNbinsX() != sumMult->GetNbinsX())
- ratio = (Float_t)sumMult->GetNbinsX() / (Float_t)hPythiaMB->GetNbinsX();
- }
-
- hRatioMultPythia = (TH1F*)sumMult->Clone("hRatioMultPythia");
- hRatioMultUA5 = (TH1F*)sumMult->Clone("hRatioMultUA5");
- if(ratio > 1) {
- hRatioMultPythia->Rebin((Int_t)ratio);
- hRatioMultPythia->Scale(1/ratio);
- }
- if(ratio < 1 && hPythiaMB) {
- hPythiaMB->Rebin((Int_t)(1/ratio));
- hPythiaMB->Scale(ratio);
- }
-
- if(rebin !=5) {
- TGraphErrors* tmp1;
- if(what == kMultNSD)
- tmp1 = (TGraphErrors*)graph->Clone("UA5tmp");
- else
- tmp1 = (TGraphErrors*)graphinel->Clone("UA5tmp");
-
- tmp1->Fit("pol8","Q0","Q0",1.5,6);
- TF1* hFit = tmp1->GetFunction("pol8");
- for(Int_t ii = hRatioMultUA5->GetNbinsX() / 2; ii<hRatioMultUA5->GetNbinsX();ii++) {
- if(hRatioMultUA5->GetBinContent(ii) > 0) {
- Float_t errorratio = hRatioMultUA5->GetBinError(ii) / hRatioMultUA5->GetBinContent(ii);
- hRatioMultUA5->SetBinContent(ii,
- hRatioMultUA5->GetBinContent(ii) /
- ((hRatioMultUA5->GetBinCenter(ii) > 4.8) ? hFit->Eval(hRatioMultUA5->GetBinCenter(ii-1)) : hFit->Eval(hRatioMultUA5->GetBinCenter(ii))));
- hRatioMultUA5->SetBinError(ii,hRatioMultUA5->GetBinContent(ii) * TMath::Sqrt(0.02*0.02 + TMath::Power(errorratio,2)));
-
-
- }
-
- }
-
- TGraphErrors* tmp2;
- if(what == kMultNSD)
- tmp2 = (TGraphErrors*)graph2->Clone("UA5tmp2");
- else
- tmp2 = (TGraphErrors*)graphinel2->Clone("UA5tmp2");
-
- //tmp2->Fit("pol8","Q0","Q0",-3.7,-1.5);
- tmp2->Fit("pol7","Q0","Q0",-3.7,0);
- hFit = tmp2->GetFunction("pol7");
- for(Int_t ii = 0; ii<hRatioMultUA5->GetNbinsX()/2;ii++) {
- if(hRatioMultUA5->GetBinContent(ii) > 0) {
- Float_t errorratio = hRatioMultUA5->GetBinError(ii) / hRatioMultUA5->GetBinContent(ii);
- hRatioMultUA5->SetBinContent(ii,hRatioMultUA5->GetBinContent(ii) / hFit->Eval(hRatioMultUA5->GetBinCenter(ii)) );
- hRatioMultUA5->SetBinError(ii,hRatioMultUA5->GetBinContent(ii) * TMath::Sqrt(0.02*0.02 + TMath::Power(errorratio,2)));
-
- }
-
-
- graphinel->GetHistogram()->SetStats(kFALSE);
- graphinel2->GetHistogram()->SetStats(kFALSE);
-
- }
- }
- else hRatioMultUA5->Divide(hRatioMultUA5_rebin5);
- //}
-
-
-
- gPad->SetGridx();
- gPad->SetGridy();
- TLine* oneLine = new TLine(-4,1,6,1);
- oneLine->SetLineWidth(2);
-
- hRatioMultUA5->SetMarkerColor(kGreen);
- hRatioMultUA5->SetMarkerStyle(20);
- hRatioMultUA5->GetYaxis()->SetRangeUser(0.75,1.25);
-
- hRatioMultUA5->SetYTitle("Ratio FMD/UA5");
- hRatioMultUA5->SetLabelSize(2*hRatioMultUA5->GetLabelSize("X"),"X");
- hRatioMultUA5->SetLabelSize(2*hRatioMultUA5->GetLabelSize("Y"),"Y");
- hRatioMultUA5->SetTitleSize(2*hRatioMultUA5->GetTitleSize("X"),"X");
- hRatioMultUA5->SetTitleSize(2*hRatioMultUA5->GetTitleSize("Y"),"Y");
- hRatioMultUA5->SetTitleOffset(0.7*hRatioMultUA5->GetTitleOffset("X"),"X");
- hRatioMultUA5->SetTitleOffset(0.5*hRatioMultUA5->GetTitleOffset("Y"),"Y");
-
-
-
- hRatioMultUA5->DrawCopy();
- //hRatioMultPythia->DrawCopy("same");
- oneLine->Draw("same");
- }
-
- TCanvas* cPaper = new TCanvas("FMD_SPD_UA5","FMD_SPD_UA5",800,600);
- cPaper->cd();
-
- sumMult->DrawCopy();
- //sumMultSystPos->DrawCopy("sameE5");
- // sumMultSystNeg->DrawCopy("sameE5");
- //hTestdNdeta->DrawCopy("same");
- //hSPDcombi->DrawCopy("same");
- if(what == kMult)
- p7742D1x1y1->Draw("PEsame");
- if(what == kMultNSD) {
- p7742D2x1y1->Draw("PEsame");
- p7743D8x1y1->Draw("PEsame");
- }
-
- TLegend* leg2 = new TLegend(0.3,0.2,0.7,0.45,"");
- if(what == kMult)
- leg2->AddEntry(sumMult,"FMD INEL","p");
- else if(what == kMultTrVtx)
- leg2->AddEntry(sumMult,"FMD TrVtx","p");
- else if(what == kMultNSD)
- leg2->AddEntry(sumMult,"FMD NSD","p");
-
- if(realdata) {
-
- /* if(what == kMult)
- leg2->AddEntry(hMirror,"Mirror FMD INEL","p");
- else if(what == kMultTrVtx)
- leg2->AddEntry(hMirror,"FMD TrVtx","p");
- else if(what == kMultNSD)
- leg2->AddEntry(hMirror,"FMD NSD","p");*/
-
- if(what == kMultNSD) {
- leg2->AddEntry(graph,"UA5 NSD","p");
- leg2->AddEntry(graph2,"Mirror UA5 NSD","p"); }
- else if(what == kMult) {
- leg2->AddEntry(graphinel,"UA5 INEL","p");
- leg2->AddEntry(graphinel2,"Mirror UA5 INEL","p");
- }
- //leg2->AddEntry(hPythiaMB,"Pythia MB","l");
- //leg2->AddEntry(hSPDcombi,"HHD SPD clusters","p");
- if(what == kMult)
- leg2->AddEntry(p7742D1x1y1,"ALICE INEL published","p");
- if(what == kMultNSD) {
- leg2->AddEntry(p7742D2x1y1,"ALICE NSD published","p");
- leg2->AddEntry(p7743D8x1y1,"CMS NSD published","p");
- }
- }
- leg2->Draw();
-
-
-
- if(what != kMultNSD) {
- graphinel->Draw("PEsame");
- graphinel2->Draw("PEsame");
- }
- else {
- graph->Draw("PEsame");
- graph2->Draw("PEsame");
- }
-
- sumMult->DrawCopy("PEsame");
- c2->cd(1);
-
- c2->Print("fmdana.png");
- TString species;
-
- switch(what) {
- case kMult:
- species = "mult";
- break;
- case kMultTrVtx:
- species = "mult_TrVtx";
- break;
- case kHits:
- species = "hits";
- break;
- case kHitsTrVtx:
- species = "hits_TrVtx";
- break;
- case kMultNSD:
- species = "mult_NSD";
- break;
-
- default:
- AliWarning("no valid Analysis entry!");
- break;
- }
- TFile fout(Form("fmd_dNdeta_%s.root",species.Data()),"recreate");
- if(hRatioMultPythia)
- hRatioMultPythia->Write();
- hPrim->Write();
- graph->Write("UA5nsd");
- graph2->Write("UA5mirrornsd");
- graphinel->Write("UA5inel");
- graphinel2->Write("UA5mirrorinel");
- sumMult->Write();
- hSPDcombi->Write();
- hReldif->Write();
- fMultList[what]->Write();
- c2->Write();
- //fDataObject->Write();
- fout.Close();
-
-}
-//_____________________________________________________________________
-void AliFMDDndeta::CreateSharingEfficiency(const Char_t* filename, Bool_t store) {
- //Generate sharing efficiency
- Init(filename);
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- //pars->Init(kTRUE,AliFMDAnaParameters::kBackgroundCorrection);
- Int_t nVertexBins = pars->GetNvtxBins();
-
- SetNames(kHits);
- // "nEvents";
- TH1I* hEvents = (TH1I*)fList->FindObject(fEvents.Data());
- // "nMCEventsNoCuts"
- TH1I* hPrimEvents = (TH1I*)fList->FindObject(fPrimEvents.Data());
-
- SetNames(kHitsTrVtx);
- // "nEvents";
- TH1I* hEventsTrVtx = (TH1I*)fList->FindObject(fEvents.Data());
- // "nMCEvents"
- TH1I* hPrimEventsTrVtx = (TH1I*)fList->FindObject(fPrimEvents.Data());
-
- AliFMDAnaCalibSharingEfficiency* sharEff = new AliFMDAnaCalibSharingEfficiency();
-
- for(Int_t det = 1; det<=3; det++) {
- Int_t maxRing = (det == 1 ? 0 : 1);
- for(Int_t ring = 0;ring<=maxRing;ring++) {
- Char_t ringChar = (ring == 0 ? 'I' : 'O');
- for(Int_t v=0; v< nVertexBins; v++) {
- // Get histograms like hits_NoCuts_FMD%d%c_vtxbin%d_proj
- // - from AliFMDAnalysisTaskBackgroundCorrection.cxx
- TH1F* hHits = (TH1F*)fList->FindObject(GetAnalysisName(kHits,det, ringChar, v));
- // Get histograms like hits_FMD%d%c_vtxbin%d_proj
- // - from AliFMDAnalysisTaskBackgroundCorrection.cxx
- TH1F* hHitsTrVtx = (TH1F*)fList->FindObject(GetAnalysisName(kHitsTrVtx,det, ringChar, v));
- // Get histograms like "hMCHits_nocuts_FMD%d%c_vtxbin%d"
- // - from AliFMDAnalysisTaskSharing.cxx
- TH1F* hMCHits = (TH1F*)fList->FindObject(GetPrimName(kHits,det, ringChar, v));
- // Get histograms like "hMCHits_FMD%d%c_vtxbin%d"
- // - from AliFMDAnalysisTaskSharing.cxx
- TH1F* hMCHitsTrVtx = (TH1F*)fList->FindObject(GetPrimName(kHitsTrVtx,det, ringChar, v));
-
- TH1F* hCorrection = (TH1F*)hHits->Clone(Form("hCorrection_FMD%d%c_vtx%d",det, ringChar, v));
- TH1F* hCorrectionTrVtx = (TH1F*)hHitsTrVtx->Clone(Form("hCorrection_FMD%d%c_vtx%d",det, ringChar, v));
- if(hEvents->GetBinContent(v+1))
- hCorrection->Scale(1./(Float_t)hEvents->GetBinContent(v+1));
- if(hPrimEvents->GetBinContent(v+1))
- hMCHits->Scale(1./(Float_t)hPrimEvents->GetBinContent(v+1));
- if(hEventsTrVtx->GetBinContent(v+1))
- hCorrectionTrVtx->Scale(1./(Float_t)hEventsTrVtx->GetBinContent(v+1));
- if(hPrimEventsTrVtx->GetBinContent(v+1))
- hMCHitsTrVtx->Scale(1./(Float_t)hPrimEventsTrVtx->GetBinContent(v+1));
-
- hCorrection->Divide(hMCHits);
- hCorrectionTrVtx->Divide(hMCHitsTrVtx);
-
- //sharEff->SetSharingEff(det,ringChar,v,hCorrection);
- sharEff->SetSharingEff(det,ringChar,v,hCorrection);
- sharEff->SetSharingEffTrVtx(det,ringChar,v,hCorrectionTrVtx);
-
- // std::cout<<hHits<<" "<<hHitsTrVtx<<" "<<hPrim<<" "<<hPrimTrVtx<<std::endl;
-
- }
- }
- }
-
- if(store) {
- TFile fsharing(pars->GetPath(pars->GetSharingEffID()),"RECREATE");
- sharEff->Write(AliFMDAnaParameters::GetSharingEffID());
- fsharing.Close();
- }
-
-}
-//_____________________________________________________________________
-void AliFMDDndeta::RebinHistogram(TH1F* hist, Int_t rebin) {
- //Clever rebinner
-
- if(hist->GetNbinsX()%rebin) {
- std::cout<<"cannot rebin "<<hist->GetNbinsX()%rebin<< "is not zero"<<std::endl;
- return;
-
- }
- TH1F* cloneHist = (TH1F*)hist->Clone();
- cloneHist->Rebin(rebin);
-
- Int_t nBinsNew = hist->GetNbinsX() / rebin;
-
- for(Int_t i =1;i<=nBinsNew; i++) {
- Float_t bincontent = 0;
- Float_t sumofw = 0;
- Float_t sumformean = 0;
- Int_t nBins = 0;
- for(Int_t j=1; j<=rebin;j++) {
- if(hist->GetBinContent((i-1)*rebin + j) > 0) {
- bincontent = bincontent + hist->GetBinContent((i-1)*rebin + j);
- nBins++;
- Float_t weight = 1 / TMath::Power(hist->GetBinError((i-1)*rebin + j),2);
- sumofw = sumofw + weight;
- sumformean = sumformean + weight*hist->GetBinContent((i-1)*rebin + j);
-
- }
- }
-
- if(bincontent > 0 ) {
- cloneHist->SetBinContent(i,sumformean / sumofw);
- cloneHist->SetBinError(i,TMath::Sqrt(sumformean));//TMath::Sqrt(1/sumofw));
- }
- }
- hist->Rebin(rebin);
- for(Int_t i =1;i<=nBinsNew; i++) {
- hist->SetBinContent(i,cloneHist->GetBinContent(i));
- }
-
-
-}
-//_____________________________________________________________________
-//
-// EOF
-//
-// EOF
+++ /dev/null
-// Code to analyse dN/deta from the forward analysis
-// This can plot the results
-// Also works for MC data
-#ifndef ALIFMDDNDETA_H
-#define ALIFMDDNDETA_H
-
-#include "TObject.h"
-// #include "TList.h"
-#include "TString.h"
-class TList;
-class TH1F;
-class TH3F;
-class TProfile3D;
-class TProfile2D;
-class TH3D;
-/**
- * This class creates dN/deta for the FMD from the analysis objects.
- * The contents of this class should probably go into a task at some point
- */
-class AliFMDDndeta : public TObject
-{
- public:
- /**
- *
- *
- */
- AliFMDDndeta();
- /**
- *
- *
- * @param o
- */
- AliFMDDndeta(const AliFMDDndeta& o)
- : TObject(),
- fList(0),
- fMultList(),
- fNbinsToCut(o.fNbinsToCut),
- fVtxCut1(o.fVtxCut1),
- fVtxCut2(o.fVtxCut2),
- fIsInit(o.fIsInit),
- fIsGenerated(),
- fPrimEvents(o.fPrimEvents),
- fEvents(o.fEvents),
- fPrimdNdeta(o.fPrimdNdeta),
- fDrawAll(kFALSE)
- {
- for (int i = 0; i < 5; i++) fAnalysisNames[i] = "";
- }
- /**
- *
- *
- *
- * @return
- */
- AliFMDDndeta& operator=(const AliFMDDndeta& /*o*/)
- {
- // Assignment operator
- return (*this);
- }
- /**
- * Enumeration of analysis types
- *
- */
- enum Analysis {kHits, kHitsTrVtx, kMult, kMultTrVtx, kMultNSD};
-
- /**
- * Initialise
- *
- * @param filename
- */
- void Init(const Char_t* filename);
- /**
- * Initialise
- *
- * @param list
- */
- void Init(TList* list);
- /**
- * Generate the multiplicity for analysis type @a what
- *
- * @param what
- */
- void GenerateMult(Analysis what);
- /**
- * Draw the result.
- *
- * @param what
- * @param rebin
- * @param realdata
- * @param filename
- */
- void DrawDndeta(Analysis what,
- Int_t rebin = 1,
- Bool_t realdata = kFALSE,
- TString filename = "none");
- /**
- * Set the number of bins to cut
- *
- * @param nbins
- */
- void SetNbinsToCut(Int_t nbins) {fNbinsToCut = nbins;}
- /**
- * Set the vertex cut
- *
- * @param vtxcut
- */
- void SetVtxCut1(Int_t vtxcut) {fVtxCut1 = vtxcut;}
- /**
- * Set the vertex cut
- *
- * @param vtxcut
- */
- void SetVtxCut2(Int_t vtxcut) {fVtxCut2 = vtxcut;}
- /**
- * Whether to draw all
- *
- * @param drawall
- */
- void SetDrawAll(Bool_t drawall) {fDrawAll = drawall;}
- /**
- * Create sharing efficiency from file
- *
- * @param filename
- * @param store
- */
- void CreateSharingEfficiency(const Char_t* filename, Bool_t store = kFALSE);
- /**
- * Get the list of multiplicities for a given type of analysis.
- *
- * @param what
- *
- * @return
- */
- TList* GetMultList(Analysis what) const {return fMultList[what];}
- private:
- void GenerateHits(Analysis what);
- void SetNames(Analysis what);
- const char* GetAnalysisName(Analysis what, UShort_t det,
- Char_t ring, Int_t vtxbin);
- const char* GetPrimName(Analysis what, UShort_t det,
- Char_t ring, Int_t vtxbin);
- void RebinHistogram(TH1F* hist, Int_t rebin);
- TList* fList; // A list of input histograms
- TList* fMultList[5]; // A list of mult histograms
- Int_t fNbinsToCut; // The number of bins to cut
- Int_t fVtxCut1; // Vtx low
- Int_t fVtxCut2; // Vtx high
- Bool_t fIsInit; // Are we init ?
- Bool_t fIsGenerated[5]; // Have we generated ?
- TString fPrimEvents; // Number of prim events
- TString fEvents; // Number of events
- TString fPrimdNdeta; // the primary dNdeta from MC
- TString fAnalysisNames[5]; // Names of analysis
- // TProfile3D* fDataObject; // New data object
- Bool_t fDrawAll; //Draw relevant or all
- //TH3D* fDataObject; // New data object
-
- ClassDef(AliFMDDndeta,2);
-};
-
-
-#endif
-// Local Variables:
-// mode: C++
-// End:
+++ /dev/null
-#!/bin/sh
-
-nev=10000
-noanal=0
-nodraw=0
-rebin=1
-vzmin=-10
-vzmax=10
-type=
-cms=900
-
-usage()
-{
-cat<<EOF
-Usage: $0 [OPTIONS]
-
-Run analysis and visualize it using HHD analysis code
-
-Options:
- -h,--help This help
- -N,--no-analysis Do not analyse, just draw ($noanal)
- -D,--no-draw Do not draw, just analysis ($nodraw)
- -n,--events N Number of events ($nev)
- -r,--rebin N Rebin by N ($rebin)
- -v,--vz-min CM Minimum value of vz ($vzmin)
- -V,--vz-max CM Maximum value of vz ($vzmax)
- -t,--trigger TYPE Select trigger TYPE ($type)
- -e,--energy CMS Center of mass energy ($cms)
-
-TYPE is one of
-
- INEL
- INEL>0
- NSD
-EOF
-}
-
-while test $# -gt 0 ; do
- case $1 in
- -h|--help) usage ; exit 0;;
- -n|--events) nev=$2 ; shift ;;
- -N|--no-analysis) noanal=$((($noanal+1)%2)) ;;
- -D|--no-draw) nodraw=$((($nodraw+1)%2)) ;;
- -r|--rebin) rebin=$2 ; shift ;;
- -v|--vz-min) vzmin=$2 ; shift ;;
- -V|--vz-max) vzmax=$2 ; shift ;;
- -e|--energy) cms=$2 ; shift ;;
- -t|--type) type="$2" ; shift ;;
- *) echo "$0: Unknown option '$1'" >> /dev/stderr ; exit 1 ;;
- esac
- shift
-done
-
-base=`printf hhd_%07d $nev`
-
-keep_file()
-{
- file=$1
- if test -f $file ; then
- mv $file ${file}.keep
- fi
-}
-restore_file()
-{
- file=$1
- if test -f ${file}.keep ; then
- mv ${file}.keep ${file}
- fi
-}
-
-if test $noanal -lt 1 ; then
- keep_file AnalysisResult.root
- keep_file AliAODs.root
-
- aliroot -l -b -q -x RunManager.C\(\".\",$nev\) 2>&1 | tee $base.log
-
- if test ! -f AnalysisResults.root ; then
- echo "Analysis failed"
- restore_file AnalysisResult.root
- restore_file AliAODs.root
- exit 1
- fi
- echo "Analysis done"
- rm -f event_stat.root EventStat_temp.root outputs_valid
- mv AnalysisResults.root ${base}_hists.root
- if test -f AliAODs.root ; then
- mv AliAODs.root ${base}_aods.root
- fi
- restore_file AnalysisResult.root
- restore_file AliAODs.root
-fi
-
-
-if test $nodraw -lt 1 ; then
- rm -f fmd_dNdeta_mult.root
-
- samp=0
- tt=`echo $type | tr '[a-z]' '[A-Z]'`
- case "x$tt" in
- "xINEL") n="inel"; s="" ; samp=0 ;;
- "xINEL>0") n="inelgt0"; s="_NSD"; samp=4 ; echo "Using NSD for $tt";;
- "xNSD") n="nsd"; s="_NSD"; samp=4 ;;
- *) echo "Unknown type $tt" > /dev/stderr ; exit 1 ;;
- esac
-
- aliroot -l -b -q -x \
- $ALICE_ROOT/PWGLF/FORWARD/analysis/drawdNdeta.C\(\"${base}_hists.root\",$samp,$rebin,$vzmin,$vzmax,1,$cms\)
- tmin=`printf %+03d $vzmin | tr '+-' 'pm'`
- tmax=`printf %+03d $vzmax | tr '+-' 'pm'`
- out=`printf "hhd_%04dGeV_%s-%scm_rb%02d_%s.root" $cms $tmin $tmax $rebin $n`
- mv fmd_dNdeta_mult${s}.root $out
-
- mv fmdana.png `basename $out .root`.png
-fi
-#
-# EOF
-#
+++ /dev/null
-void RunAliEnFMDAnalysis(const Char_t* collectionfile = "collection.xml",
- const Char_t* cdbPath = "local://$ALICE_ROOT/OCDB",
- const Char_t* outFile = "fmd_analysis.root"){
-
- gSystem->Load("libANALYSIS");
- gSystem->Load("libANALYSISalice");
- gSystem->Load("libFMDanalysis");
-
- AliCDBManager* cdb = AliCDBManager::Instance();
- cdb->SetDefaultStorage(cdbPath);
- cdb->SetSpecificStorage("FMD/*","local://$ALICE_ROOT");
- cdb->SetRun(0);
-
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- pars->Init();
- if (AliGeomManager::GetGeometry() == NULL)
- AliGeomManager::LoadGeometry();
- AliFMDGeometry* geo = AliFMDGeometry::Instance();
- geo->Init();
- geo->InitTransformations();
-
- cout<<"Creating task for analysis"<<endl;
- AliFMDAnalysisTaskESDReader *FMDana0 = new AliFMDAnalysisTaskESDReader("reader");
- FMDana0->SetDebugLevel(10);
- AliFMDAnalysisTaskSharing *FMDana1 = new AliFMDAnalysisTaskSharing("sharing");
- AliFMDAnalysisTaskDensity *FMDana2 = new AliFMDAnalysisTaskDensity("density");
- AliFMDAnalysisTaskBackgroundCorrection *FMDana3 = new AliFMDAnalysisTaskBackgroundCorrection("background");
- AliFMDAnalysisTaskDndeta *FMDana4 = new AliFMDAnalysisTaskDndeta("dNdeta");
-
- cout<<"Creating the manager"<<endl;
- AliAnalysisManager* mgr = new AliAnalysisManager("fmd_analysis","fmd_analysis");
- mgr->AddTask(FMDana0);
- mgr->AddTask(FMDana1);
- mgr->AddTask(FMDana2);
- mgr->AddTask(FMDana3);
- mgr->AddTask(FMDana4);
-
-
- AliAnalysisDataContainer* cin_esd = mgr->CreateContainer("esdTree",TTree::Class(),AliAnalysisManager::kInputContainer,"AliESDs.root");
- AliAnalysisDataContainer* cexchangevertex = mgr->CreateContainer("esdvertex",AliESDVertex::Class(),AliAnalysisManager::kExchangeContainer);
- AliAnalysisDataContainer* cexchange0 = mgr->CreateContainer("exchangeESDFMD0",AliESDEvent::Class(),AliAnalysisManager::kExchangeContainer);
- AliAnalysisDataContainer* cdiag1 = mgr->CreateContainer("diagSharing1",AliESDEvent::Class(),AliAnalysisManager::kExchangeContainer);
- AliAnalysisDataContainer* cdiag2 = mgr->CreateContainer("diagSharing2",TList::Class(),AliAnalysisManager::kOutputContainer,"edists.root");
- AliAnalysisDataContainer* cexchange1 = mgr->CreateContainer("exchangeESDFMD1",AliESDFMD::Class(),AliAnalysisManager::kExchangeContainer);
- AliAnalysisDataContainer* cexchange2 = mgr->CreateContainer("listOfhists",TList::Class(),AliAnalysisManager::kExchangeContainer);
- AliAnalysisDataContainer* cvertex = mgr->CreateContainer("vertex",TObjString::Class(),AliAnalysisManager::kExchangeContainer);
- AliAnalysisDataContainer* cexchange3 = mgr->CreateContainer("BackgroundCorrectedperevent",TList::Class(),AliAnalysisManager::kOutputContainer,"testOut.root");
- AliAnalysisDataContainer* coutput = mgr->CreateContainer("BackgroundCorrected",TList::Class(),AliAnalysisManager::kOutputContainer,outFile);
-
- mgr->ConnectInput(FMDana0, 0 , cin_esd);
- mgr->ConnectOutput(FMDana0, 0 , cexchange0);
-
- mgr->ConnectInput(FMDana1, 0 , cexchange0);
-
- mgr->ConnectOutput(FMDana1, 0 , cexchange1);
- mgr->ConnectOutput(FMDana1, 1 , cexchangevertex);
- mgr->ConnectOutput(FMDana1, 2 , cdiag1);
- mgr->ConnectOutput(FMDana1, 3 , cdiag2);
-
-
- mgr->ConnectInput(FMDana2, 0 , cexchange1);
- mgr->ConnectInput(FMDana2, 1 , cexchangevertex);
- mgr->ConnectOutput(FMDana2, 0 , cexchange2);
-
- mgr->ConnectInput(FMDana3, 0 , cexchange2);
- mgr->ConnectOutput(FMDana3, 0 , cexchange3);
- mgr->ConnectOutput(FMDana3, 1 , cvertex);
-
- mgr->ConnectInput(FMDana4, 0 , cexchange3);
- mgr->ConnectInput(FMDana4, 1 , cvertex);
- mgr->ConnectOutput(FMDana4, 0 , coutput);
-
- TGrid::Connect("alien://",0,0,"t");
-
-
- TChain* chain = new TChain("esdTree","esdTree");
-
- TAlienCollection* coll = TAlienCollection::Open(collectionfile);
- coll->Reset();
- Int_t nFiles = 0;
- while(coll->Next() && nFiles<10) {
- cout<<coll->GetTURL("")<<endl;
- TString test(coll->GetTURL(""));
- chain->Add(coll->GetTURL(""));
-
- nFiles++;
- }
-
- mgr->InitAnalysis();
- mgr->PrintStatus();
- TStopwatch timer;
- timer.Start();
- cout<<"Executing analysis"<<endl;
- mgr->StartAnalysis("local",chain);
- timer.Stop();
- timer.Print();
-}
+++ /dev/null
-void RunAliEnFMDAnalysisSE(const Char_t* collectionName="collection.xml", const Char_t* cdbPath="local://$ALICE_ROOT/OCDB") {
-
- gSystem->Load("libANALYSIS");
- gSystem->Load("libANALYSISalice");
- gSystem->Load("libFMDanalysis");
-
- TGrid::Connect("alien://",0,0,"t");
- TChain* chain = CreateChainSingle(collectionName);
-
- if (!chain) return;
-
- //
- // Make the analysis manager
- AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train", "A test setup for the analysis train");
- // ESD input handler
- AliESDInputHandler *esdHandler = new AliESDInputHandler();
- mgr->SetInputEventHandler(esdHandler);
-
- AliMCEventHandler *mcHandler = new AliMCEventHandler();
- mgr->SetMCtruthEventHandler(mcHandler);
-
- AliAODHandler* aodHandler = new AliAODHandler();
- mgr->SetOutputEventHandler(aodHandler);
- aodHandler->SetOutputFileName("AliAODs.root");
-
-
- AliAnalysisDataContainer *cin_esd = mgr->GetCommonInputContainer();
- // Output AOD container. Pointer to AOD put here only by filter task.
- // This container is managed by the AOD handler
- AliAnalysisDataContainer *cout_aod = mgr->GetCommonOutputContainer();
-
- AliFMDAnalysisTaskSE *fmdana = new AliFMDAnalysisTaskSE("FMDAnalysis");
- mgr->AddTask(fmdana);
- // Output histograms list for jet analysis
- AliAnalysisDataContainer *cout_fmd = mgr->CreateContainer("BackgroundCorrected",
- TList::Class(),
- AliAnalysisManager::kOutputContainer, "fmd_analysis.root");
- // Dummy AOD output container for jet analysis (no client yet)
- AliAnalysisDataContainer *c_aodfmd = mgr->CreateContainer("cAODfmd",
- TTree::Class(),
- AliAnalysisManager::kExchangeContainer);
- // Connect to data containers
- mgr->ConnectInput (fmdana, 0, cin_esd );
- mgr->ConnectOutput (fmdana, 0, c_aodfmd );
- mgr->ConnectOutput (fmdana, 1, cout_fmd );
-
-
- AliCDBManager* cdb = AliCDBManager::Instance();
- cdb->SetDefaultStorage(cdbPath);
-
- cdb->SetRun(0);
-
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- pars->Init();
- if (AliGeomManager::GetGeometry() == NULL)
- AliGeomManager::LoadGeometry();
-
- AliFMDGeometry* geo = AliFMDGeometry::Instance();
- geo->Init();
- geo->InitTransformations();
-
- TStopwatch timer;
- timer.Start();
- if (mgr->InitAnalysis()) {
- mgr->PrintStatus();
- mgr->StartAnalysis("local",chain, 5000);
- }
- timer.Stop();
- timer.Print();
-}
-//______________________________________________________________________________
-TChain* CreateChainSingle(const char* xmlfile, const char *treeName="esdTree")
-{
- printf("*******************************\n");
- printf("*** Getting the ESD Chain ***\n");
- printf("*******************************\n");
- TAlienCollection * myCollection = TAlienCollection::Open(xmlfile);
-
- if (!myCollection) {
- ::Error("CreateChainSingle", "Cannot create an AliEn collection from %s", xmlfile) ;
- return NULL ;
- }
-
- TChain* chain = new TChain(treeName);
- myCollection->Reset() ;
- Int_t nFiles = 0;
- while ( myCollection->Next() && nFiles <20) {
- chain->Add(myCollection->GetTURL("")) ;
- nFiles++;
- }
- chain->ls();
- return chain;
-}
+++ /dev/null
-void RunLocalFMDAnalysis(const Char_t* filename= "AliESDs.root",
- const Char_t* cdbPath = "local://$ALICE_ROOT/OCDB",
- const Char_t* outFile = "fmd_analysis.root"){
-
- gSystem->Load("libANALYSIS");
- gSystem->Load("libANALYSISalice");
- gSystem->Load("libFMDanalysis");
-
- AliCDBManager* cdb = AliCDBManager::Instance();
- cdb->SetDefaultStorage(cdbPath);
- // cdb->SetSpecificStorage("FMD/*","local://$ALICE_ROOT");
- cdb->SetRun(0);
- //AliFMDParameters* recopars = AliFMDParameters::Instance();
- // recopars->Init();
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- pars->Init();
- if (AliGeomManager::GetGeometry() == NULL)
- AliGeomManager::LoadGeometry();
-
- AliFMDGeometry* geo = AliFMDGeometry::Instance();
- geo->Init();
- geo->InitTransformations();
-
- cout<<"Creating task for analysis"<<endl;
- AliFMDAnalysisTaskESDReader *FMDana0 = new AliFMDAnalysisTaskESDReader("reader");
- FMDana0->SetDebugLevel(10);
- AliFMDAnalysisTaskSharing *FMDana1 = new AliFMDAnalysisTaskSharing("sharing");
- AliFMDAnalysisTaskDensity *FMDana2 = new AliFMDAnalysisTaskDensity("density");
- AliFMDAnalysisTaskBackgroundCorrection *FMDana3 = new AliFMDAnalysisTaskBackgroundCorrection("background");
- AliFMDAnalysisTaskDndeta *FMDana4 = new AliFMDAnalysisTaskDndeta("dNdeta");
-
- cout<<"Creating the manager"<<endl;
- AliAnalysisManager* mgr = new AliAnalysisManager("fmd_analysis","fmd_analysis");
- mgr->AddTask(FMDana0);
- mgr->AddTask(FMDana1);
- mgr->AddTask(FMDana2);
- mgr->AddTask(FMDana3);
- mgr->AddTask(FMDana4);
-
-
- AliAnalysisDataContainer* cin_esd = mgr->CreateContainer("esdTree",TTree::Class(),AliAnalysisManager::kInputContainer,"AliESDs.root");
- AliAnalysisDataContainer* cexchangevertex = mgr->CreateContainer("esdvertex",AliESDVertex::Class(),AliAnalysisManager::kExchangeContainer);
- AliAnalysisDataContainer* cexchange0 = mgr->CreateContainer("exchangeESDFMD0",AliESDEvent::Class(),AliAnalysisManager::kExchangeContainer);
- AliAnalysisDataContainer* cdiag1 = mgr->CreateContainer("diagSharing1",AliESDEvent::Class(),AliAnalysisManager::kExchangeContainer);
- AliAnalysisDataContainer* cdiag2 = mgr->CreateContainer("diagSharing2",TList::Class(),AliAnalysisManager::kOutputContainer,"edists.root");
- AliAnalysisDataContainer* cexchange1 = mgr->CreateContainer("exchangeESDFMD1",AliESDFMD::Class(),AliAnalysisManager::kExchangeContainer);
- AliAnalysisDataContainer* cexchange2 = mgr->CreateContainer("list_of_hits",TList::Class(),AliAnalysisManager::kExchangeContainer);
- AliAnalysisDataContainer* cvertex = mgr->CreateContainer("vertex",TObjString::Class(),AliAnalysisManager::kExchangeContainer);
- AliAnalysisDataContainer* cexchange3 = mgr->CreateContainer("list_of_hits_and_mult",TList::Class(),AliAnalysisManager::kOutputContainer,"testOut.root");
- AliAnalysisDataContainer* coutput = mgr->CreateContainer("BackgroundCorrected",TList::Class(),AliAnalysisManager::kOutputContainer,outFile);
-
- mgr->ConnectInput(FMDana0, 0 , cin_esd);
- mgr->ConnectOutput(FMDana0, 0 , cexchange0);
-
- mgr->ConnectInput(FMDana1, 0 , cexchange0);
-
- mgr->ConnectOutput(FMDana1, 0 , cexchange1);
- mgr->ConnectOutput(FMDana1, 1 , cexchangevertex);
- mgr->ConnectOutput(FMDana1, 2 , cdiag1);
- mgr->ConnectOutput(FMDana1, 3 , cdiag2);
-
-
- mgr->ConnectInput(FMDana2, 0 , cexchange1);
- mgr->ConnectInput(FMDana2, 1 , cexchangevertex);
- mgr->ConnectOutput(FMDana2, 0 , cexchange2);
-
- mgr->ConnectInput(FMDana3, 0 , cexchange2);
- mgr->ConnectOutput(FMDana3, 0 , cexchange3);
- mgr->ConnectOutput(FMDana3, 1 , cvertex);
-
- mgr->ConnectInput(FMDana4, 0 , cexchange3);
- mgr->ConnectInput(FMDana4, 1 , cvertex);
- mgr->ConnectOutput(FMDana4, 0 , coutput);
-
-
- TFile::Open(filename);
- TChain* chain = (TChain*)gFile->Get("esdTree");
-
-
- mgr->InitAnalysis();
- mgr->PrintStatus();
-
- TStopwatch timer;
- timer.Start();
- cout<<"Executing analysis"<<endl;
- mgr->StartAnalysis("local",chain);
- timer.Stop();
- timer.Print();
-}
+++ /dev/null
-void RunLocalFMDAnalysisSE(const Char_t* filename= "AliESDs.root", const Char_t* cdbPath="local://$ALICE_ROOT/OCDB", const Char_t* outFile = "fmd_analysis.root") {
-
- gSystem->Load("libANALYSIS");
- gSystem->Load("libANALYSISalice");
- gSystem->Load("libFMDanalysis");
-
- //TGrid::Connect("alien://",0,0,"t");
-
- //TChain* chain = CreateChainSingle(collectionName);
- //TFile::Open(filename);
- TChain* chain = new TChain("esdTree");
- chain->Add(filename);
-
- ///chain->Add("/home/canute/ALICE/Simulations/TestOfAnalysis/AliESDs.root");
-
- //(TChain*)gFile->Get("esdTree");
- if (!chain) return;
-
- //
- // Make the analysis manager
- AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train", "A test setup for the analysis train");
- // ESD input handler
- AliESDInputHandler *esdHandler = new AliESDInputHandler();
- mgr->SetInputEventHandler(esdHandler);
-
- AliMCEventHandler *mcHandler = new AliMCEventHandler();
- mgr->SetMCtruthEventHandler(mcHandler);
-
- AliAODHandler* aodHandler = new AliAODHandler();
- mgr->SetOutputEventHandler(aodHandler);
- aodHandler->SetOutputFileName("AliAODs.root");
-
-
- AliAnalysisDataContainer *cin_esd = mgr->GetCommonInputContainer();
- // Output AOD container. Pointer to AOD put here only by filter task.
- // This container is managed by the AOD handler
- AliAnalysisDataContainer *cout_aod = mgr->GetCommonOutputContainer();
-
- AliFMDAnalysisTaskSE *fmdana = new AliFMDAnalysisTaskSE("FMDAnalysis");
- mgr->AddTask(fmdana);
- // Output histograms list for jet analysis
- AliAnalysisDataContainer *cout_fmd = mgr->CreateContainer("BackgroundCorrected",
- TList::Class(),
- AliAnalysisManager::kOutputContainer, outFile);
- // Dummy AOD output container for jet analysis (no client yet)
- AliAnalysisDataContainer *c_aodfmd = mgr->CreateContainer("cAODfmd",
- TTree::Class(),
- AliAnalysisManager::kExchangeContainer);
- // Connect to data containers
- mgr->ConnectInput (fmdana, 0, cin_esd );
- mgr->ConnectOutput (fmdana, 0, c_aodfmd );
- mgr->ConnectOutput (fmdana, 1, cout_fmd );
-
-
- AliCDBManager* cdb = AliCDBManager::Instance();
- cdb->SetDefaultStorage(cdbPath);
- // cdb->SetSpecificStorage("FMD/*","local://$ALICE_ROOT");
- cdb->SetRun(0);
-
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- pars->Init();
- //if (AliGeomManager::GetGeometry() == NULL)
- // AliGeomManager::LoadGeometry("geometry.root");
-
- if (AliGeomManager::GetGeometry() == NULL)
- AliGeomManager::LoadGeometry();
- AliFMDParameters* recopars = AliFMDParameters::Instance();
- recopars->Init();
-
- AliFMDGeometry* geo = AliFMDGeometry::Instance();
- geo->Init();
- geo->InitTransformations();
-
- TStopwatch timer;
- timer.Start();
- if (mgr->InitAnalysis()) {
- mgr->PrintStatus();
- mgr->StartAnalysis("local",chain);
- }
- timer.Stop();
- timer.Print();
-}
-//______________________________________________________________________________
-TChain* CreateChainSingle(const char* xmlfile, const char *treeName="esdTree")
-{
- printf("*******************************\n");
- printf("*** Getting the ESD Chain ***\n");
- printf("*******************************\n");
- TAlienCollection * myCollection = TAlienCollection::Open(xmlfile);
-
- if (!myCollection) {
- ::Error("CreateChainSingle", "Cannot create an AliEn collection from %s", xmlfile) ;
- return NULL ;
- }
-
- TChain* chain = new TChain(treeName);
- myCollection->Reset() ;
- while ( myCollection->Next() ) chain->Add(myCollection->GetTURL("")) ;
- chain->ls();
- return chain;
-}
+++ /dev/null
-//
-// Run an analysis job
-//
-void RunManager(const char* esddir=".",
- Int_t nEvents=1000,
- Float_t cmsGeV=900.,
- const char* col="p-p",
- Float_t bkG=5.,
- Bool_t proof=false)
-{
- gSystem->Load("libVMC");
- gSystem->Load("libTree");
-
- gSystem->Load("libSTEERBase");
-
- gSystem->Load("libESD") ;
- gSystem->Load("libAOD") ;
- gSystem->Load("libANALYSIS");
- gSystem->Load("libANALYSISalice");
-
- gSystem->Load("libPhysics");
- gSystem->Load("libPWG0base");
- gSystem->Load("libPWG0dep");
- gSystem->Load("libPWGLFforward");
-
- // --- Check for proof mode, and possibly upload pars --------------
- if (proof) {
- TProof::Open("workers=2");
- const char* pkgs[] = { "STEERBase", "ESD", "AOD", "ANALYSIS",
- "ANALYSISalice", "PWGLFforward", 0};
- const char** pkg = pkgs;
- while (*pkg) {
- gProof->UploadPackage(Form("${ALICE_ROOT}/%s.par",*pkg));
- gProof->EnablePackage(*pkg);
- pkg++;
- }
- }
-
-
- // --- Our data chain ----------------------------------------------
- TChain* chain = new TChain("esdTree");
-
- // --- Get list of ESDs --------------------------------------------
- // Open source directory, and make sure we go back to were we were
- TString oldDir(gSystem->WorkingDirectory());
- TSystemDirectory d(esddir, esddir);
- TList* files = d.GetListOfFiles();
- gSystem->ChangeDirectory(oldDir);
-
- // Sort list of files and check if we should add it
- files->Sort();
- TIter next(files);
- TSystemFile* file = 0;
- while ((file = static_cast<TSystemFile*>(next()))) {
- if (file->IsDirectory()) continue;
- TString name(file->GetName());
- if (!name.EndsWith(".root")) continue;
- if (!name.Contains("AliESDs")) continue;
- TString esd(Form("%s/%s", file->GetTitle(), name.Data()));
- Info("RunManager", "Adding %s to chain", esd.Data());
- chain->Add(esd);
- }
-
- // --- Creating the manager and handlers ---------------------------
- AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train",
- "The Analysis Train");
- AliESDInputHandler *esdHandler = new AliESDInputHandler();
- esdHandler->SetInactiveBranches("AliESDACORDE "
- "AliRawDataErrorLogs "
- "CaloClusters "
- "Cascades "
- "EMCALCells "
- "EMCALTrigger "
- "Kinks "
- "Cascades "
- "MuonTracks "
- "TrdTracks "
- "CaloClusters "
- "HLTGlobalTrigger");
- mgr->SetInputEventHandler(esdHandler);
-
- AliMCEventHandler* mcHandler = new AliMCEventHandler();
- mgr->SetMCtruthEventHandler(mcHandler);
- //mcHandler->SetReadTR(readTR);
-
- AliAODHandler* aodHandler = new AliAODHandler();
- mgr->SetOutputEventHandler(aodHandler);
- aodHandler->SetOutputFileName("AliAODs.root");
-
- // --- Add our task -----------------------------------------------
- gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis/AddTaskFMD.C");
- AliFMDAnalysisTaskSE *fmdtask = AddTaskFMD(energy, col, bkG);
-
- // --- Run the analysis --------------------------------------------
- TStopwatch t;
- if (!mgr->InitAnalysis()) {
- Error("RunManager", "Failed to initialize analysis train!");
- return;
- }
- // Some informative output
- mgr->PrintStatus();
- // mgr->SetDebugLevel(3);
- if (mgr->GetDebugLevel() < 1 && !proof)
- mgr->SetUseProgressBar(kTRUE);
-
- // Run the train
- t.Start();
- mgr->StartAnalysis(proof ? "proof" : "local", chain, nEvents);
- t.Stop();
- t.Print();
-}
-//
-// EOF
-//
+++ /dev/null
-void SubmitFMDCorrections(const Char_t* filename, Bool_t store, Float_t energy, Int_t trigger, Float_t mag, Int_t collsystem,Bool_t inelGtZero=kFALSE) {
-
- gSystem->Load("libANALYSIS");
- gSystem->Load("libANALYSISalice");
- gSystem->Load("libPWG0base");
- gSystem->Load("libPWGLFforward");
-
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
- if(energy == 900)
- pars->SetEnergy(AliFMDAnaParameters::k900);
- else if(energy == 10000)
- pars->SetEnergy(AliFMDAnaParameters::k10000);
- else if(energy == 14000)
- pars->SetEnergy(AliFMDAnaParameters::k14000);
- else if(energy == 7000)
- pars->SetEnergy(AliFMDAnaParameters::k7000);
- else if(energy == 2400)
- pars->SetEnergy(AliFMDAnaParameters::k2400);
- else if(energy == 5500)
- pars->SetEnergy(AliFMDAnaParameters::k5500);
- else if(energy == 2750)
- pars->SetEnergy(AliFMDAnaParameters::k2750);
-
- if(trigger == 0)
- pars->SetTriggerDefinition(AliFMDAnaParameters::kMB1);
- else if(trigger == 1)
- pars->SetTriggerDefinition(AliFMDAnaParameters::kMB2);
- else if(trigger == 2)
- pars->SetTriggerDefinition(AliFMDAnaParameters::kSPDFASTOR);
- else if(trigger == 3)
- pars->SetTriggerDefinition(AliFMDAnaParameters::kNOCTP);
- else if(trigger == 4)
- pars->SetTriggerDefinition(AliFMDAnaParameters::kEMPTY);
- else if(trigger == 5)
- pars->SetTriggerDefinition(AliFMDAnaParameters::kNSD);
-
- if(mag==0)
- pars->SetMagField(AliFMDAnaParameters::k0G);
- else if(mag==1)
- pars->SetMagField(AliFMDAnaParameters::k5G);
- else if(mag==-1)
- pars->SetMagField(AliFMDAnaParameters::k5Gnegative);
-
- if(collsystem == 0)
- pars->SetCollisionSystem(AliFMDAnaParameters::kPP);
- else if(collsystem == 1)
- pars->SetCollisionSystem(AliFMDAnaParameters::kPbPb);
-
- pars->SetInelGtZero(inelGtZero);
- pars->PrintStatus();
-
- std::cout<<"creating background object"<<std::endl;
- AliFMDAnalysisTaskGenerateCorrection t;
-
- t.ReadFromFile(filename,store,0);
- std::cout<<"object created in backgroundFromFile.root "<<std::flush;
- if(store)
- std::cout<<" - and stored!"<<std::endl;
- else
- std::cout<<" - and not stored!"<<std::endl;
-}
-
-
-//
-// EOF
-//
-
+++ /dev/null
-void SubmitFMDCorrections(const Char_t* filename, Bool_t store, Float_t energy, Int_t trigger, Float_t mag, Int_t collsystem, Bool_t realdata=kTRUE) {
-
- gSystem->Load("libANALYSIS");
- gSystem->Load("libANALYSISalice");
- gSystem->Load("libPWG0base");
- gSystem->Load("libPWGLFforward");
-
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-
- if(energy == 900)
- pars->SetEnergy(AliFMDAnaParameters::k900);
- else if(energy == 7000)
- pars->SetEnergy(AliFMDAnaParameters::k7000);
- else if(energy == 10000)
- pars->SetEnergy(AliFMDAnaParameters::k10000);
- else if(energy == 14000)
- pars->SetEnergy(AliFMDAnaParameters::k14000);
- else if(energy == 5500)
- pars->SetEnergy(AliFMDAnaParameters::k5500);
-
- if(trigger == 0)
- pars->SetTriggerDefinition(AliFMDAnaParameters::kMB1);
- else if(trigger == 1)
- pars->SetTriggerDefinition(AliFMDAnaParameters::kMB2);
-
- if(mag==0)
- pars->SetMagField(AliFMDAnaParameters::k0G);
- else if(mag==1)
- pars->SetMagField(AliFMDAnaParameters::k5G);
-
- if(collsystem == 0)
- pars->SetCollisionSystem(AliFMDAnaParameters::kPP);
- else if(collsystem == 1)
- pars->SetCollisionSystem(AliFMDAnaParameters::kPbPb);
-
- pars->SetRealData(realdata);
-
- pars->PrintStatus();
- pars->Init(kTRUE,AliFMDAnaParameters::kBackgroundCorrection);
- std::cout<<"creating energy distribution object"<<std::endl;
- AliFMDAnalysisTaskCollector t;
-
- t.ReadFromFile(filename,store,-1);
- //std::cout<<"object created in b.root "<<std::flush;
- if(store)
- std::cout<<" - and stored!"<<std::endl;
- else
- std::cout<<" - and not stored!"<<std::endl;
-}
+++ /dev/null
-void SubmitSharingEffCorrection(const Char_t* filename="fmdana.root", Bool_t store, Float_t energy, Int_t trigger, Float_t mag, Int_t collsystem)){
-
- gSystem->Load("libANALYSIS");
- gSystem->Load("libANALYSISalice");
- gSystem->Load("libPWGLFforward");
-
- gStyle->SetTextFont(132);
- gStyle->SetLabelFont(132,"X");
- gStyle->SetLabelFont(132,"Y");
- gStyle->SetLabelFont(132,"Z");
- gStyle->SetTitleFont(132,"X");
- gStyle->SetTitleFont(132,"Y");
- gStyle->SetTitleFont(132,"Z");
-
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- pars->Init(kTRUE,AliFMDAnaParameters::kBackgroundCorrection);
- if(energy == 900)
- pars->SetEnergy(AliFMDAnaParameters::k900);
- else if(energy == 7000)
- pars->SetEnergy(AliFMDAnaParameters::k7000);
- else if(energy == 10000)
- pars->SetEnergy(AliFMDAnaParameters::k10000);
- else if(energy == 14000)
- pars->SetEnergy(AliFMDAnaParameters::k14000);
-
- if(trigger == 0)
- pars->SetTriggerDefinition(AliFMDAnaParameters::kMB1);
- else if(trigger == 1)
- pars->SetTriggerDefinition(AliFMDAnaParameters::kMB2);
-
- if(mag==0)
- pars->SetMagField(AliFMDAnaParameters::k0G);
- else if(mag==1)
- pars->SetMagField(AliFMDAnaParameters::k5G);
-
- if(collsystem == 0)
- pars->SetCollisionSystem(AliFMDAnaParameters::kPP);
- else if(collsystem == 1)
- pars->SetCollisionSystem(AliFMDAnaParameters::kPbPb);
-
- pars->PrintStatus();
-
- std::cout<<"creating sharing efficiency object"<<std::endl;
- AliFMDDndeta t;
- t.SetNbinsToCut(2);
- // t.SetVtxCut(2);
- t.Init(filename);
-
- t.CreateSharingEfficiency(filename,store);
- if(store)
- std::cout<<" - and stored!"<<std::endl;
- else
- std::cout<<" - and not stored!"<<std::endl;
-
-}
+++ /dev/null
-void drawdNdeta(const Char_t* filename="fmdana.root",
- Int_t sample = 0,
- Int_t rebin =1,
- Float_t v1 = -10,
- Float_t v2 = 10,
- Bool_t realdata=kTRUE,
- Float_t energy = 900,
- Int_t magfield=1){
-
- gSystem->Load("libANALYSIS");
- gSystem->Load("libANALYSISalice");
- gSystem->Load("libPWG0base");
- gSystem->Load("libPWG0dep");
- gSystem->Load("libPWGLFforward");
- gStyle->SetTextFont(132);
- gStyle->SetLabelFont(132,"X");
- gStyle->SetLabelFont(132,"Y");
- gStyle->SetLabelFont(132,"Z");
- gStyle->SetTitleFont(132,"X");
- gStyle->SetTitleFont(132,"Y");
- gStyle->SetTitleFont(132,"Z");
-
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- if(energy == 900)
- pars->SetEnergy(AliFMDAnaParameters::k900);
- else if(energy == 10000)
- pars->SetEnergy(AliFMDAnaParameters::k10000);
- else if(energy == 7000)
- pars->SetEnergy(AliFMDAnaParameters::k7000);
- else {
- std::cout<<"invalid energy - quitting"<<std::endl;
- return; }
-
- if(magfield == 0)
- pars->SetMagField(AliFMDAnaParameters::k0G);
- else if(magfield == 1)
- pars->SetMagField(AliFMDAnaParameters::k5G);
- else
- return;
- pars->SetRealData(realdata);
- pars->Init();
- pars->Print();
- AliFMDDndeta t;
- t.SetNbinsToCut(2);
- t.SetVtxCut1(v1);
- t.SetVtxCut2(v2);
- // t.SetVtxCut(6);
- t.Init(filename);
- if(sample == 0) {
- t.GenerateMult(AliFMDDndeta::kMult);
- t.DrawDndeta(AliFMDDndeta::kMult,rebin,realdata);
- }
- if(sample == 1) {
- t.GenerateMult(AliFMDDndeta::kMultTrVtx);
- t.DrawDndeta(AliFMDDndeta::kMultTrVtx,rebin,realdata);
- }
- if(sample == 2) {
- t.GenerateMult(AliFMDDndeta::kHits);
- t.DrawDndeta(AliFMDDndeta::kHits,rebin);
- }
- if(sample == 3) {
- t.GenerateMult(AliFMDDndeta::kHitsTrVtx);
- t.DrawDndeta(AliFMDDndeta::kHitsTrVtx,rebin);
- }
- if(sample == 4) {
- t.GenerateMult(AliFMDDndeta::kMultNSD);
- t.DrawDndeta(AliFMDDndeta::kMultNSD,rebin,realdata);
- }
-
-
- if(sample == 10)
- t.CreateSharingEfficiency(filename,kTRUE);
-}
+++ /dev/null
-alienmerge(const char* path,
- const char* pattern,
- const char* outfile=0,
- Int_t nFiles = 10000,
- const char* blacklist1 ="roskilde",
- const char* blacklist2 = "hvidovre"){
-
- TGrid::Connect("alien://",0,0,"t");
- TGridResult* result = gGrid->Query(path,pattern);
- result->Print();
-
- TFileMerger m;
-
- if (outfile) m.OutputFile(outfile);
- Int_t i=0;
-
- TObjArray* outArray = new TObjArray();
- //TList list;
-
- while (result->GetKey(i,"turl") && i<nFiles) {
- // TAlienFile* file = TAlienFile::Open(result->GetKey(i,"turl"),"READ");
- //file->ls();
- // TList* list = (TList*)file->Get("listOfhists");
-
-
- // std::cout << list;// << std::endl;
-
- //
- // TObjArray* tmp = (TObjArray*)file.Get("FMD");
- // list.Add(tmp);
-
- // if(i!=blacklist1 && i!=blacklist2) {
- TString test(result->GetKey(i,"turl"));
- test.ToLower();
- if(test.Contains(blacklist1) || test.Contains(blacklist2) ) {
- i++;
- continue;
- }
- m.AddFile(result->GetKey(i,"turl"));
- cout<<i<<" "<<result->GetKey(i,"turl")<<endl;
-
- // }
- i++;
- }
- if (i)
- m.Merge();
-
- //outArray->Merge(list);
- //TFile fout("MergeTest.root","RECREATE");
- //outArray->Write();
- //fout.Close();
-}
+++ /dev/null
-void
-LoadLibs()
-{
- gSystem->Load("libANALYSIS");
- gSystem->Load("libANALYSISalice");
- gSystem->Load("libPWG0base");
- gSystem->Load("libPWGLFforward");
-}
-
+++ /dev/null
-void
-TestTaskIO(bool read=false)
-{
- gSystem->Load("libANALYSIS.so");
- gSystem->Load("libANALYSISalice.so");
- gSystem->Load("libPWGLFforward.so");
-
- TFile* file = TFile::Open("task.root", (read ? "READ" : "RECREATE"));
-
- if (!read) TestTaskIOWrite(file);
- else TestTaskIORead(file);
-
- file->Close();
-}
-
-void
-TestTaskIOWrite(TFile* f)
-{
- AliFMDAnaParameters* p = AliFMDAnaParameters::Instance();
- p->SetEnergy(AliFMDAnaParameters::k900);
- p->Init();
- p->Dump();
-
- f->cd();
-
- AliFMDAnalysisTaskSE* t = new AliFMDAnalysisTaskSE("FMD");
- t->Write();
- t->Print("p");
-}
-
-
-void
-TestTaskIORead(TFile* f)
-{
- AliFMDAnalysisTaskSE* t = static_cast<AliFMDAnalysisTaskSE*>(f->Get("FMD"));
- t->Print("p");
-
- AliFMDAnaParameters* p = AliFMDAnaParameters::Instance();
- p->Dump();
-}
+++ /dev/null
-AliFMDAnaCalibBackgroundCorrection*
-ViewBGCor(const char* filename)
-{
- // gSystem->Load("libANALYSIS");
- // gSystem->Load("libANALYSISalice");
- // gSystem->Load("libPWG0base");
- // gSystem->Load("libPWGLFforward");
-
-
- TFile* file = TFile::Open(filename, "READ");
- if (!file) {
- Error("ViewBgCor", "Cannot open file %s", filename);
- return 0;
- }
-
- AliFMDAnaCalibBackgroundCorrection* bg =
- static_cast<AliFMDAnaCalibBackgroundCorrection*>(file->Get("background"));
-
- return bg;
-}
-
+++ /dev/null
-//____________________________________________________________________
-AliFMDAnaCalibEnergyDistribution*
-ViewEDCor(const char* filename)
-{
- // gSystem->Load("libANALYSIS");
- // gSystem->Load("libANALYSISalice");
- // gSystem->Load("libPWG0base");
- // gSystem->Load("libPWGLFforward");
-
- AliFMDAnaParameters* param = AliFMDAnaParameters::Instance();
- param->SetEnergy(900.F);
- param->SetCollisionSystem("pp");
- param->SetMagField(+5.F);
- param->Init(kTRUE,AliFMDAnaParameters::kBackgroundCorrection);
-
- TFile* file = TFile::Open(filename, "READ");
- if (!file) {
- Error("ViewEDCor", "Cannot open file %s", filename);
- return 0;
- }
-
- AliFMDAnaCalibEnergyDistribution* bg =
- static_cast<AliFMDAnaCalibEnergyDistribution*>(file->Get("energydistributions"));
-
- return bg;
-}
-
-
-//____________________________________________________________________
-struct RingHistos
-{
- TH1D* MakeHisto(const char* name, const char* title,
- const TAxis* etaAxis)
- {
- TH1D* ret = new TH1D(Form(name, fD, fR),
- Form(title, fD, fR),
- etaAxis->GetNbins(),
- etaAxis->GetXmin(),
- etaAxis->GetXmax());
- ret->SetDirectory(0);
- ret->SetLineColor(fC);
- ret->SetMarkerColor(fC);
- ret->SetMarkerStyle(20+2*fD+(fR == 'I' || fR == 'i' ? 0 : 1));
- ret->SetFillColor(fC);
- ret->SetFillStyle(3001);
- ret->SetXTitle("#eta");
- ret->SetYTitle(title);
- ret->SetStats(0);
- return ret;
- }
-
-
- RingHistos(UShort_t d, Char_t r, const TAxis* etaAxis, Int_t c)
- : fD(d), fR(r), fC(c)
- {
- fHists.AddAt(MakeHisto("c%d%c", "Constant FMD%d%c", etaAxis),0);
- fHists.AddAt(MakeHisto("mpv%d%c", "MPV FMD%d%c", etaAxis),1);
- fHists.AddAt(MakeHisto("w%d%c", "Width FMD%d%c", etaAxis),2);
- fHists.AddAt(MakeHisto("alpha%d%c", "#alpha FMD%d%c", etaAxis),3);
- fHists.AddAt(MakeHisto("beta%d%c", "#beta FMD%d%c", etaAxis),4);
- fHists.AddAt(MakeHisto("chi%d%c", "#chi^{2}/#nu FMD%d%c", etaAxis),5);
- fHists.AddAt(MakeHisto("acc%d%c", "Acceptance in FMD%d%c", etaAxis),6);
- }
- void Fill(Int_t iEta, Int_t p, Double_t v, Double_t e=0)
- {
- TH1D* h = Get(p);
- if (!h) return;
- h->SetBinContent(iEta, v);
- h->SetBinError(iEta, e);
- }
- TH1D* Get(Int_t p) const
- {
- return static_cast<TH1D*>(fHists.At(p));
- }
- UShort_t fD;
- Char_t fR;
- Int_t fC;
- TObjArray fHists;
-};
-
-//____________________________________________________________________
-struct All
-{
- All(const TAxis* etaAxis)
- {
- fFMD1i = new RingHistos(1,'i', etaAxis, kRed+1);
- fFMD2i = new RingHistos(2,'i', etaAxis, kGreen+1);
- fFMD2o = new RingHistos(2,'o', etaAxis, kGreen+7);
- fFMD3i = new RingHistos(3,'i', etaAxis, kBlue+1);
- fFMD3o = new RingHistos(3,'o', etaAxis, kBlue+7);
- }
- RingHistos* Get(UShort_t d, Char_t r) const
- {
- switch (d) {
- case 1: return fFMD1i;
- case 2: return (r == 'I' || r == 'i' ? fFMD2i : fFMD2o);
- case 3: return (r == 'I' || r == 'i' ? fFMD3i : fFMD3o);
- }
- return 0;
- }
- RingHistos* fFMD1i;
- RingHistos* fFMD2i;
- RingHistos* fFMD2o;
- RingHistos* fFMD3i;
- RingHistos* fFMD3o;
-};
-
-//____________________________________________________________________
-PlotEDCor(const char* filename)
-{
- AliFMDAnaCalibEnergyDistribution* ed = ViewEDCor(filename);
-
- AliFMDAnaParameters* param = AliFMDAnaParameters::Instance();
-
- TAxis* etaAxis = param->GetBackgroundCorrection(1,'I',4)->GetXaxis();
- All* all = new All(etaAxis);
-
- for (Int_t iEta = 1; iEta < etaAxis->GetNbins(); iEta++) {
- Float_t eta = etaAxis->GetBinCenter(iEta);
- Info("PlotEDCor", "eta bin %3d, eta=%f", iEta, eta);
-
- for (UShort_t d=1; d <= 3; d++) {
- UShort_t nq = d == 1 ? 1 : 2;
- for (UShort_t q = 0; q < nq; q++) {
- Char_t r = q == 0 ? 'I' : 'O';
- RingHistos* hists = all->Get(d, r);
- if (!hists) continue;
-
- TH1F* hed = ed->GetEnergyDistribution(d, r, eta);
- if (!hed) continue;
-
- if (hed->GetEntries() > 0)
- hists->Fill(iEta, 6, 1);
-
- TF1* fed = hed->GetFunction("FMDfitFunc");
- if (!fed) continue;
-
- Int_t npar = fed->GetNpar();
- for (Int_t i = 0; i < npar; i++) {
- Double_t par = fed->GetParameter(i);
- Double_t err = fed->GetParError(i);
- hists->Fill(iEta, i, par, err);
- }
- Double_t chi2 = fed->GetChisquare();
- Double_t ndf = fed->GetNDF();
- if (ndf != 0)
- hists->Fill(iEta, 5, chi2/ndf);
- }
- }
- }
-
- TCanvas* c = new TCanvas("c", "c", 800, 800);
- c->SetFillColor(0);
- c->SetBorderMode(0);
- c->SetBorderSize(0);
- c->Divide(1,7,0,0);
-
- THStack* stack = 0;
-
- const char* yTitles[] = { "Constant", "#Delta_{p}", "w",
- "#alpha", "#beta", "#chi^2/NDF",
- "Acceptance" };
- for (Int_t i = 0; i < 7; i++) {
- TVirtualPad* p = c->cd(i+1);
- p->SetFillColor(0);
- p->SetFillStyle(0);
- THStack* stack = new THStack;
- stack->Add(all->Get(1,'i')->Get(i));
- stack->Add(all->Get(2,'i')->Get(i));
- stack->Add(all->Get(2,'o')->Get(i));
- stack->Add(all->Get(3,'i')->Get(i));
- stack->Add(all->Get(3,'o')->Get(i));
- stack->Draw("nostack");
- stack->GetHistogram()->SetYTitle(yTitles[i]);
- stack->GetHistogram()->SetXTitle("#eta");
- TAxis* yaxis = stack->GetHistogram()->GetYaxis();
- yaxis->SetTitleSize(0.15);
- yaxis->SetLabelSize(0.08);
- yaxis->SetTitleOffset(0.35);
- yaxis->SetNdivisions(10);
- TAxis* xaxis = stack->GetHistogram()->GetXaxis();
- xaxis->SetTitleSize(0.15);
- xaxis->SetLabelSize(0.08);
- xaxis->SetTitleOffset(0.35);
- xaxis->SetNdivisions(320);
- p->cd();
- }
- c->cd();
- c->Print("energyDist.png");
-}
-//____________________________________________________________________
-//
-// EOF
-//
-
+++ /dev/null
-void runFMDbackground() {
-
- // Mandatory fields for the background correction
- TString runMode = "full";
- TString anaSource = "";
- TString anaType = "background";
- TString dataDir = "/alice/sim/LHC10f6/126437";
- TString anaName = "Correction";
- TString colSys = "p-p";
- Float_t cmsNNGeV = 900;
- Float_t bkG = 5;
-
-
- /**
- * Run an FMD corrections job.
- *
- * @param runMode Running mode (full, test, terminate, submit, offline)
- * @param anaType What to do (background, collector, sharing)
- * @param dataDir Input data directory
- * @param anaSource Analysis source (if any)
- * @param addLibs Libraries to add
- * @param anaName Analysis name
- * @param colSys Collision system (p-p, Pb-Pb, A-A)
- * @param cmsNNGeV Center of mass energy per nucleon in GeV
- * @param bkG Magnetic field in kilo gaus
- * @param aliceTag AliROOT tag to use
- * @param rootTag ROOT tag to use
- * @param apiTag API tag to use
- */
- gROOT->LoadMacro("runFMDjob.C");
- runFMDjob(runMode,
- anaType,
- dataDir,
- anaSource,
- anaName,
- colSys,
- cmsNNGeV,
- bkG);
-}
-
-
-//
-// EOF
-//
+++ /dev/null
-void runFMDcollector()
-{
- // Mandatory fields for the collector analysis
- TString runMode = "full";
- TString anaSource = "";
- TString anaType = "collector";
- TString dataDir = "/alice/sim/LHC10e13/";
- TString anaName = "FMDCollector900GeVPythia";
- TString colSys = "p-p";
- Float_t cmsNNGeV = 900;
- Float_t bkG = 5;
-
-
- /**
- * Run an FMD corrections job.
- *
- * @param runMode Running mode (full, test, terminate, submit, offline)
- * @param anaType What to do (background, collector, sharing)
- * @param dataDir Input data directory
- * @param anaSource Analysis source (if any)
- * @param addLibs Libraries to add
- * @param anaName Analysis name
- * @param colSys Collision system (p-p, Pb-Pb, A-A)
- * @param cmsNNGeV Center of mass energy per nucleon in GeV
- * @param bkG Magnetic field in kilo gaus
- * @param aliceTag AliROOT tag to use
- * @param rootTag ROOT tag to use
- * @param apiTag API tag to use
- */
- gROOT->LoadMacro("runFMDjob.C");
- runFMDjob(runMode,
- anaType,
- dataDir,
- anaSource,
- anaName,
- colSys,
- cmsNNGeV,
- bkG);
-}
-//
-// EOF
-//
+++ /dev/null
-//____________________________________________________________________
-/**
- * Run an FMD corrections job.
- *
- * @param runMode Running mode (full, test, terminate, submit, offline)
- * @param anaType What to do (background, collector, sharing)
- * @param dataDir Input data directory
- * @param anaSource Analysis source (if any)
- * @param anaName Analysis name
- * @param colSys Collision system (p-p, Pb-Pb, A-A)
- * @param cmsNNGeV Center of mass energy per nucleon in GeV
- * @param bkG Magnetic field in kilo gaus
- * @param aliceTag AliROOT tag to use
- * @param rootTag ROOT tag to use
- * @param apiTag API tag to use
- */
-void
-runFMDjob(const TString& runMode = "",
- const TString& anaType = "background",
- const TString& dataDir = "",
- const TString& anaSource = "",
- const TString& anaName = "",
- const TString& colSys = "p-p",
- Float_t cmsNNGeV = 900,
- Float_t bkG = 5,
- const TString& aliceTag = "v4-21-04-AN",
- const TString& rootTag = "v5-27-06b",
- const TString& apiTag = "V1.1x")
-{
- // --- Load libraries needed -------------------------------------
- gSystem->Load("libANALYSIS");
- gSystem->Load("libANALYSISalice");
- gSystem->Load("libPWGLFforward");
- gSystem->AddIncludePath("-I$ALICE_ROOT/PWGLF/FORWARD/analysis");
-
- // --- Some initial checks and setup -------------------------------
- TString outFileName = anaName;
- outFileName.ToLower();
- outFileName += ".root";
-
- // --- Manager setup -----------------------------------------------
- // Create the analysis manager
- AliAnalysisManager *mgr = new AliAnalysisManager(anaName.Data());
-
-
- // --- ESD setup ---------------------------------------------------
- // Connect the EDS's to the manager and switch off unused branches
- AliESDInputHandler* esdH = new AliESDInputHandler();
- esdH->SetInactiveBranches("AliESDACORDE "
- "AliRawDataErrorLogs "
- "CaloClusters "
- "Cascades "
- "EMCALCells "
- "EMCALTrigger "
- "ESDfriend "
- "Kinks "
- "Cascades "
- "ALIESDACORDE "
- "MuonTracks "
- "TrdTracks");
- mgr->SetInputEventHandler(esdH);
-
- // --- Task setup --------------------------------------------------
- // Configure the analysis manager to the specific task
- TString type = anaType.ToLower();
- TString addLibs;
- if (type.Contains("background"))
- addLibs = AddBackgroundTask(outFileName);
- else if (type.Contains("collector"))
- addLibs = AddCollectorTask(outFileName, colSys, cmsNNGeV, bkG);
- else if (type.Contains("sharing"))
- addLibs = AddSharingTask(outFileName, colsys, cmsNNGeV, bkG);
- else {
- Error("runFMDjob", "Unknown type '%s', please fix this macro",
- anaType);
- return;
- }
-
- // --- AliEN handler setup -----------------------------------------
- // Create and configure the alien handler plugin, and connect to manager
- if (!CreateAlienHandler(runMode,
- dataDir,
- anaSource,
- addLibs,
- anaName,
- outFileName,
- aliceTag,
- rootTag,
- apiTag)) {
- Error("runFMDjob", "Failed to set up alien handler");
- return;
- }
- mgr->SetGridHandler(alienHandler);
-
- // --- final job setup and execution -------------------------------
- // Enable debug printouts
- mgr->SetDebugLevel(2);
-
- if (!mgr->InitAnalysis()) {
- Error("runFMDjob", "Failed to initialise the train");
- return;
- }
- mgr->PrintStatus();
- mgr->StartAnalysis("grid");
-
- // --- We are done -------------------------------------------------
- Info("runFMDjob", "Job is done");
-}
-
-
-//____________________________________________________________________
-/**
- * Create a background correction task
- *
- * @param outFileName
- *
- * @return A list of additional files that should be uploaded
- */
-void
-AddBackgroundTask(const TString& outFileName)
-{
- AliAnalysisManager* mgr = AliAnalysisManager::Instance();
-
- // --- Make and configure task -------------------------------------
- AliFMDAnalysisTaskGenerateCorrection *task =
- new AliFMDAnalysisTaskGenerateCorrection("background");
- task->SetNbinsEta(200);
- mgr->AddTask(task);
-
- // --- Add the MC handler ------------------------------------------
- AliMCEventHandler* mcHandler = new AliMCEventHandler();
- mgr->SetMCtruthEventHandler(mcHandler);
-
- // --- Create and connect container for input ----------------------
- AliAnalysisDataContainer *cin_esd = mgr->GetCommonInputContainer();
- mgr->ConnectInput(task, 0, cin_esd);
-
- // --- Create and connect containers for output --------------------
- const char* outList[] = { "Hits", "Primaries", "vertex", "Correction", 0 };
- const char** ptr = outList;
- Int_t i = 1;
- while (*ptr) {
- AliAnalysisDataContainer* outCont =
- mgr->CreateContainer(*ptr, TList::Class(),
- AliAnalysisManager::kOutputContainer,
- outFileName.Data());
- mgr->ConnectOutput(task, i, outCont);
- i++;
- ptr++;
- }
-
- return "";
-}
-
-
-//_______________________________________________________________
-/**
- * Create and add collector task.
- *
- * @param outFileName Output file name
- * @param col Collision system (one of "p-p", "Pb-Pb", or "A-A")
- * @param cmsNNGeV Center of mass energy per nucleon in GeV
- * @param bkG Magnetic field in kilo gauss
- *
- * @return A list of additional files that should be uploaded
- */
-void AddCollectorTask(const TString& outFileName,
- const TString& col,
- Float_t cmsNNGeV,
- Float_t bkG)
-{
- AliAnalysisManager* mgr = AliAnalysisManager::Instance();
-
- // --- Initialize the analysis parameters --------------------------
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- pars->SetCollisionSystem(col);
- pars->SetEnergy(cmsNNGeV);
- pars->SetMagField(bkG);
- pars->SetBackgroundPath("./");
- pars->Init(kTRUE,AliFMDAnaParameters::kBackgroundCorrection);
- TString bgFile = pars->GetPath(AliFMDAnaParameters::GetBackgroundID());
-
- // --- Create and add our task -------------------------------------
- AliFMDAnalysisTaskCollector *task =
- new AliFMDAnalysisTaskCollector("collector");
- mgr->AddTask(task);
-
- // --- Add the MC handler ------------------------------------------
- AliMCEventHandler* mcHandler = new AliMCEventHandler();
- mgr->SetMCtruthEventHandler(mcHandler);
-
- // --- Create containers for input/output --------------------------
- AliAnalysisDataContainer *cin_esd = mgr->GetCommonInputContainer();
- AliAnalysisDataContainer *cout_fmd1 =
- mgr->CreateContainer("energyDist",
- TList::Class(),
- AliAnalysisManager::kOutputContainer,
- outFileName.Data());
-
- // --- Connect input/output ----------------------------------------
- mgr->ConnectInput(task, 0, cin_esd);
- mgr->ConnectOutput(task, 1, cout_fmd1);
-
- return bgFile;
-}
-
-//_______________________________________________________________
-/**
- * Create and add sharing task.
- *
- * @param outFileName Output file name
- * @param col Collision system (one of "p-p", "Pb-Pb", or "A-A")
- * @param cmsNNGeV Center of mass energy per nucleon in GeV
- * @param bkG Magnetic field in kilo gauss
- *
- * @return A list of additional files that should be uploaded
- */
-TString
-AddSharingTask(const TString& outFileName,
- const TString& col,
- Float_t cmsNNGeV,
- Float_t bkG)
-{
- AliAnalysisManager* mgr = AliAnalysisManager::Instance();
-
- // --- Initialize the analysis parameters --------------------------
- AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- pars->SetCollisionSystem(col);
- pars->SetEnergy(cmsNNGeV);
- pars->SetMagField(bkG);
- pars->SetBackgroundPath("./");
- pars->SetEnergyPath("./");
- pars->SetEventSelectionPath("./");
- pars->Init(kTRUE,
- AliFMDAnaParameters::kBackgroundCorrection|
- AliFMDAnaParameters::kEnergyDistributions|
- AliFMDAnaParameters::kEventSelectionEfficiency);
- TString files;
- files.Append(pars->GetPath(AliFMDAnaParameters::GetBackgroundID()));
- files.Append(" ");
- files.Append(pars->GetPath(AliFMDAnaParameters::GetEdistID()));
- files.Append(" ");
- files.Append(pars->GetPath(AliFMDAnaParameters::GetEventSelectionEffID()));
-
- // --- Create and add our task -------------------------------------
- AliFMDAnalysisTaskSE *task = new AliFMDAnalysisTaskSE("sharing");
- mgr->AddTask(task);
-
- // --- Add the MC handler ------------------------------------------
- AliMCEventHandler* mcHandler = new AliMCEventHandler();
- mgr->SetMCtruthEventHandler(mcHandler);
-
-
-
- // --- Create and connect containers for output --------------------
- AliAnalysisDataContainer *cout_fmd =
- mgr->CreateContainer("BackgroundCorrected", TList::Class(),
- AliAnalysisManager::kOutputContainer,outputfile);
-
- mgr->ConnectInput(taskfmd, 0, mgr->GetCommonInputContainer());
- mgr->ConnectOutput(taskfmd, 1, cout_fmd);
-
- return files;
-}
-
-//____________________________________________________________________
-/**
- * Create an AliAnalysisGrid parameter object
- *
- * @param runMode Running mode (full, test, terminate, submit, offline)
- * @param dataDir Input data directory
- * @param anaSource Possible source to compile on worker node
- * (must also be compiled and addet to train on
- * submitter machine)
- * @param addLibs Extra libraries to add
- * @param anaName Analysis name (i.e., script created)
- * @param outFileName Output file name
- *
- * @return Valid object or null
- */
-Bool_t
-CreateAlienHandler(const TString& runMode,
- const TString& dataDir,
- const TString& anaSource,
- const TString& addLibs,
- const TString& anaName,
- const TString& outFileName,
- const TString& aliceTag,
- const TString& rootTag,
- const TString& apiTag)
-{
- AliAnalysisAlien *plugin = new AliAnalysisAlien();
-
- // Overwrite all generated files, datasets and output
- // results from a previous session
- plugin->SetOverwriteMode();
-
- // Set the running mode
- plugin->SetRunMode(runMode.Data());
-
- // Add path to our headers
- plugin->AddIncludePath("-I$ALICE_ROOT/PWGLF/FORWARD/analysis");
-
- // Set versions of used packages
- plugin->SetAPIVersion(apiTag);
- plugin->SetROOTVersion(rootTag);
- plugin->SetAliROOTVersion(aliceTag);
-
- // Define production directory LFN
- plugin->SetGridDataDir(dataDir.Data());
-
- // Set data search pattern
- plugin->SetDataPattern("AliESDs.root");
-
- // Use ESD tags (same applies for AOD's)
- //plugin->SetDataPattern("*tag.root");
-
- // ...then add run numbers to be considered
- // If not set all runs proccessed
- //plugin->AddRunNumber(126437);
-
- // Set events to run over for each file !!!
- //plugin->SetRunRange(0, 10);
-
- // Define alien work directory where all files will be copied.
- // Relative to alien $HOME.
- plugin->SetGridWorkingDir("work");
-
- // Declare alien output directory. Relative to working directory.
- TString outputDir = anaName;
- outputDir += "_out";
- plugin->SetGridOutputDir(outputDir.Data());
-
- // Declare the analysis source files names separated by blancs.
- // To be compiled runtime using ACLiC on the worker nodes.
- if (!anaSource.IsNull())
- plugin->SetAnalysisSource(anaSource.Data());
-
- // Declare all libraries (other than the default ones for the framework.
- // These will be loaded by the generated analysis macro.
- // Add all extra files (task .cxx/.h) here.
- if (!addLibs.IsNull())
- plugin->SetAdditionalLibs(addLibs.Data());
-
- // No need for output file names. Procedure is automatic.
- // It's works better this way
- plugin->SetDefaultOutputs(kFALSE);
- plugin->SetOutputFiles(outFileName.Data());
-
- // Set a name for the generated analysis macro (default MyAnalysis.C).
- // Make this unique !!!
- TString macroName = anaName;
- macroName += "Task.C";
- plugin->SetAnalysisMacro(macroName.Data());
-
- // Optionally set maximum number of input files/subjob (default 100,
- // put 0 to ignore)
- plugin->SetSplitMaxInputFileNumber(100);
-
- // Optionally set number of failed jobs that will trigger killing
- // waiting sub-jobs.
- plugin->SetMaxInitFailed(5);
-
- // Optionally resubmit threshold.
- plugin->SetMasterResubmitThreshold(90);
-
- // Optionally set time to live (default 30000 sec)
- plugin->SetTTL(20000);
-
- // Optionally set input format (default xml-single)
- plugin->SetInputFormat("xml-single");
-
- // Optionally modify the name of the generated JDL (default analysis.jdl)
- TString jdlName = anaName;
- jdlName += ".jdl";
- plugin->SetJDLName(jdlName.Data());
-
- // Optionally modify job price (default 1)
- plugin->SetPrice(1);
-
- // Optionally modify split mode (default 'se')
- plugin->SetSplitMode("se");
-
- // connect to manager
- AliAnalysisManager* mgr = AliAnalysisManager::Instance();
- mgr->SetGridHandler(alienHandler);
-
- return kTRUE
-}
-//____________________________________________________________________
-//
-// EOF
-//
+++ /dev/null
-void runFMDsharing()
-{
- // Mandatory fields for the collector analysis
- TString runMode = "full";
- TString anaSource = "";
- TString anaType = "sharing";
- TString dataDir = "/alice/sim/LHC10e13/";
- TString anaName = "FMDCollector900GeVPythia";
- TString colSys = "p-p";
- Float_t cmsNNGeV = 900;
- Float_t bkG = 5;
-
-
- /**
- * Run an FMD corrections job.
- *
- * @param runMode Running mode (full, test, terminate, submit, offline)
- * @param anaType What to do (background, collector, sharing)
- * @param dataDir Input data directory
- * @param anaSource Analysis source (if any)
- * @param addLibs Libraries to add
- * @param anaName Analysis name
- * @param colSys Collision system (p-p, Pb-Pb, A-A)
- * @param cmsNNGeV Center of mass energy per nucleon in GeV
- * @param bkG Magnetic field in kilo gaus
- * @param aliceTag AliROOT tag to use
- * @param rootTag ROOT tag to use
- * @param apiTag API tag to use
- */
- gROOT->LoadMacro("runFMDjob.C");
- runFMDjob(runMode,
- anaType,
- dataDir,
- anaSource,
- anaName,
- colSys,
- cmsNNGeV,
- bkG);
-}
-//
-// EOF
-//
# path before files name in the file list and in the header files. If set
# to NO the shortest path that makes the file name unique will be used.
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH = /home/cholm/alice/aliroot.trunk/ \
- /home/cholm/alice/aliroot/trunk/
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH = /home/cholm/alice/aliroot.trunk/ \
- /home/cholm/alice/aliroot/trunk/
+FULL_PATH_NAMES = NO
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
# (but less readable) file names. This can be useful if your file system
TYPEDEF_HIDES_STRUCT = YES
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penalty.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will roughly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols.
-
-SYMBOL_CACHE_SIZE = 0
# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
return chain;
}
//------------------------------------------------------------------
+ /**
+ * Create a collection
+ *
+ * @param output Output file
+ * @param url Input url
+ */
static void CreateCollection(const TString& output,
const TUrl& url)
{
CreateCollection(output, chain);
}
//------------------------------------------------------------------
+ /**
+ * Create a collection
+ *
+ * @param output Input url
+ * @param chain Chain to make collection from
+ */
static void CreateCollection(const TString& output,
const TChain* chain)
{
out->Close();
}
//------------------------------------------------------------------
+ /**
+ * Exrtact the anchor
+ *
+ * @param src Source url
+ * @param anchor On return, contains the anchor
+ */
static void ExtractAnchor(TString& src, TString& anchor)
{
anchor = "";
* Create a chain consiting of a single file
*
* @param chain The chain
+ * @param anchor Anchor (tree name)
* @param src File name.
+ * @param flags Flags
*
* @return Chain or null
*/
* Check if we can add a file to the chain
*
* @param path Full path to file
+ * @param anchor Anchor (tree name)
* @param chain Chain
+ * @param flags Some flags
*
* @return true on success, false otherwise
*/
* @param dir Directory to scan
* @param chain Chain to add to
* @param pattern File name pattern
- * @param mc Simulation input
- * @param recursive Scan recursive
+ * @param anchor Anchor (tree name)
+ * @param flags Flags
*
* @return true if any files where added
*/
/**
* Get one file
*
- * @param base Base name
- * @param dir Directory
+ * @param base Base name
+ * @param dir Directory
+ * @param unpack If true, also unzip the retrieved archive
*
* @return true on success
*/
Info("GridTerminate","Loaded package %s",parName);
return true;
}
+
/**
- * Submit the terminate job
+ * Load the analysis handler if needed
+ *
+ * @param name
+ *
+ * @return
+ */
+Bool_t LoadHandler(const TString& name)
+{
+ // Load plugin
+ TFile* file = TFile::Open(Form("%s_plugin.root",name.Data()),"READ");
+ // TFile* plug = TFile::Open("plugin.root","READ");
+ if (!file) {
+ // Error("GridTerminate","Failed to open %s_plugin.root",name.Data());
+ Error("GridTerminate","Failed to open %s_plugin.root",
+ name.Data());
+ return false;
+ }
+ AliAnalysisAlien* handler =
+ static_cast<AliAnalysisAlien*>(file->Get("plugin"));
+ if (!handler) {
+ Error("GridTerminate","Failed to load plugin");
+ return false;
+ }
+ Info("GridTerminate","Setting grid handler");
+ handler->SetRunMode("terminate");
+ handler->SetMergeViaJDL(false);
+ AliAnalysisManager::GetAnalysisManager()->SetGridHandler(handler);
+
+ return true;
+}
+
+/**
+ * Setup our manager et al
*
- * @param name Name of the job
- * @param libs Libraries to load (space separated string)
- * @param pars PARs to load (space separated string)
- * @param srcs Sources to load (space separated string)
+ * @param name Name of the job
+ * @param libs Libraries to load (space separated string)
+ * @param pars PARs to load (space separated string)
+ * @param srcs Sources to load (space separated string)
+ * @param local If true, run local terminate job on already
+ * merged and downloaded files.
+ * @param localLibsNotPar if @a local is true and this is true, then
+ * we load the corresponding locally compiled
+ * library for each specified PAR file.
*
* @return true on success
*/
-Bool_t GridTerminate(const TString& name,
- const TString& libs,
- const TString& pars,
- const TString& srcs,
- Bool_t local=false)
+Bool_t Setup(const TString& name,
+ const TString& libs,
+ const TString& pars,
+ const TString& srcs,
+ Bool_t local=false,
+ Bool_t localLibsNotPar=true)
{
// Load basic ROOT libraries
gSystem->AddDynamicPath("/usr/lib");
parName.Contains("ANALYSIS") ||
parName.Contains("OADB") ||
parName.Contains("ANALYSISalice")) continue;
- if (!LoadPar(parName.Data())) return false;
+ Bool_t ret = true;
+ if (local && localLibsNotPar)
+ ret = LoadLib(Form("lib%s.so", parName.Data()));
+ else
+ ret = LoadPar(parName.Data());
+ if (!ret) return false;
}
}
}
Info("GridTerminate","Loaded analysis manager");
- // Load plugin
- TFile* plug = TFile::Open(Form("%s_plugin.root",name.Data()),"READ");
- // TFile* plug = TFile::Open("plugin.root","READ");
- if (!plug) {
- // Error("GridTerminate","Failed to open %s_plugin.root",name.Data());
- Error("GridTerminate","Failed to open plugin.root");
- return false;
- }
- AliAnalysisAlien* handler =
- static_cast<AliAnalysisAlien*>(plug->Get("plugin"));
- if (!handler) {
- Error("GridTerminate","Failed to load plugin");
- return false;
- }
- Info("GridTerminate","Setting grid handler");
- handler->SetRunMode("terminate");
- if (local) handler->SetMergeViaJDL(false);
- mgr->SetGridHandler(handler);
+ // If we do a local merge, do not do any else
+ if (local) return true;
+
+ return LoadHandler(name);
+}
+
+/**
+ * Submit the terminate job
+ *
+ * @param name Name of the job
+ * @param libs Libraries to load (space separated string)
+ * @param pars PARs to load (space separated string)
+ * @param srcs Sources to load (space separated string)
+ * @param local If true, run local terminate job on already
+ * merged and downloaded files.
+ * @param localLibsNotPar if @a local is true and this is true, then
+ * we load the corresponding locally compiled
+ * library for each specified PAR file.
+ *
+ * @return true on success
+ */
+Bool_t GridTerminate(const TString& name,
+ const TString& libs,
+ const TString& pars,
+ const TString& srcs,
+ Bool_t local=false,
+ Bool_t localLibsNotPar=true)
+{
+ if (!Setup(name, libs, pars, srcs, local, localLibsNotPar)) return false;
// Run the terminate job
Info("GridTerminate","Starting terminate job");
- if (mgr->StartAnalysis("grid") < 0) return false;
-#if 1
- std::ofstream outJobs(Form("%s_merge.jobid", mgr->GetName()));
- outJobs << handler->GetGridJobIDs() << std::endl;
- outJobs.close();
-
- std::ofstream outStages(Form("%s_merge.stage", mgr->GetName()));
- outStages << handler->GetGridStages() << std::endl;
- outStages.close();
-#endif
+ AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!local) {
+ if (mgr->StartAnalysis("grid") < 0) return false;
+ std::ofstream outJobs(Form("%s_merge.jobid", mgr->GetName()));
+ outJobs << handler->GetGridJobIDs() << std::endl;
+ outJobs.close();
+
+ std::ofstream outStages(Form("%s_merge.stage", mgr->GetName()));
+ outStages << handler->GetGridStages() << std::endl;
+ outStages.close();
+
+ return true;
+ }
+
+ // mgr->SetDebugLevel(2);
+ mgr->SetSkipTerminate(false);
+ if (mgr->StartAnalysis("gridterminate", dummy, -1, 0) < 0) return false;
+
return true;
}
+
//
// EOF
//
* @param jobs List of jobs
* @param stages Stages
* @param delay Delay for check
+ * @param batch If true, do not prompt
*
* @return true on success, false otherwise
*
* Watch Grid for termination of main job, and submit merging jobs as needed.
*
* @param name Name of the job
+ * @param batch If true, do not prompt
* @param delay Delay between updates in seconds
*
* @ingroup pwglf_forward_trains_helper
# include <AliAnalysisManager.h>
# include <AliESDEvent.h>
# include <AliMultiplicity.h>
+# include <AliVEventHandler.h>
# include <AliESDVertex.h>
+# include <AliProdInfo.h>
# include <TH1D.h>
# include <TH2D.h>
#else
class TH1D;
class TH2D;
+class AliProdInfo;
#endif
#include <AliAnalysisTaskSE.h>
class MyAnalysis : public AliAnalysisTaskSE
{
public:
MyAnalysis()
- : AliAnalysisTaskSE(), fList(0), fMult(0), fVz(0)
+ : AliAnalysisTaskSE(), fList(0), fMult(0), fVz(0), fProd(0)
{}
MyAnalysis(const char* name)
- : AliAnalysisTaskSE(name), fList(0), fMult(0), fVz(0)
+ : AliAnalysisTaskSE(name), fList(0), fMult(0), fVz(0), fProd(0)
{
DefineOutput(1, TList::Class());
DefineOutput(2, TList::Class()); // For output from Terminate
}
virtual void UserExec(Option_t* )
{
+ if (!fProd) {
+ AliAnalysisManager *mgr=AliAnalysisManager::GetAnalysisManager();
+ AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
+ if (inputHandler) {
+ Info("", "Got input handler");
+ TList *uiList = inputHandler->GetUserInfo();
+ if (uiList) {
+ Info("", "Got user list:");
+ uiList->ls();
+
+ fProd = new AliProdInfo(uiList);
+ Info("", "Lising production information");
+ fProd->List();
+ }
+ }
+ }
+
AliESDEvent* event = dynamic_cast<AliESDEvent*>(InputEvent());
if (!event) return;
if (event->IsPileupFromSPD(3,0.8)) return;
TList* fList;
TH2D* fMult;
TH1D* fVz;
+ AliProdInfo* fProd;
ClassDef(MyAnalysis, 1);
};
//
}
void CreateTasks(AliAnalysisManager* mgr)
{
- if (!ParUtilities::MakeScriptPAR(fHelper->Mode() != Helper::kLocal,
+ if (!ParUtilities::MakeScriptPAR(fHelper->Mode() == Helper::kLocal,
"MyAnalysis.C",
"STEERBase,ESD,AOD,ANALYSIS,"
"OADB,ANALYSISalice", fHelper))
* #endif
* @endcode
*
- * @param script Script to upload and compile in the PAR
- * @param deps Dependency pars
+ * @param script Script to upload and compile in the PAR
+ * @param deps Dependency pars
* @param isLocal Local build
+ * @param helper Helper
*
* @return true on success.
*/
- static Bool_t MakeScriptPAR(Bool_t isLocal,
+ static Bool_t MakeScriptPAR(Bool_t isLocal,
const TString& script,
const TString& deps,
Helper* helper)
helper->LoadLibrary(dep->GetName());
// AcLic and load
- Info("", "Loading macro %s", script.Data());
+ Info("ParUtilities::MakeScriptPAR", "Loading macro %s", script.Data());
if (gROOT->LoadMacro(Form("%s++g", script.Data())) < 0) {
Error("ParUtilities::MakeScriptPAR",
"Failed to build local library %s", script.Data());
main(int argc, char** argv)
{
TList optList;
+ TList paths;
TString name;
TString cls;
TString where;
if (eq != kNPOS) val = arg(eq+1, arg.Length()-eq-1);
if (arg.BeginsWith("--class")) cls = val;
else if (arg.BeginsWith("--name")) name = val;
- else if (arg.BeginsWith("--include")) AppendPath(val);
+ else if (arg.BeginsWith("--include")) paths.Add(new TObjString(val));
+ // AppendPath(val);
else if (arg.BeginsWith("--batch")) batch = true;
else if (arg.BeginsWith("--help")) help = true;
else if (arg.BeginsWith("--where")) where = val;
}
}
}
+ // --- Set batch mode early ----------------------------------------
+ // Info("main", "Batch mode is set to %d", batch);
+ gROOT->SetBatch(batch);
+
+ // --- Add to load paths -------------------------------------------
+ // Info("main", "Adding load paths");
+ TIter nextP(&paths);
+ TObject* path = 0;
+ while ((path = nextP())) AppendPath(path->GetName());
+
// --- Initial check or URI/WHERE ----------------------------------
if (!where.IsNull()) {
if (urlSeen) {
// --- Set-up Application ------------------------------------------
TApplication* app = 0;
- gROOT->SetBatch(batch);
if (spawn) {
// Info("main", "Creating interpreter application");
TRint* rint = new TRint("runTrain", 0, 0, 0, 0, true);
app = new TGApplication("runTrain", 0, 0);
}
if (app && !batch) app->InitializeGraphics();
-
+
// --- run, possibly in a timer ------------------------------------
Bool_t ret = true;
if (!app)
#pragma link C++ class AliFMDMCTrackDensity+;
// Forward (FMD) tasks
+#pragma link C++ class AliBaseESDTask+;
+#pragma link C++ class AliBaseAODTask+;
+#pragma link C++ class AliBaseMCCorrectionsTask+;
+#pragma link C++ class AliBaseMCCorrectionsTask::VtxBin+;
#pragma link C++ class AliFMDEnergyFitterTask+;
#pragma link C++ class AliFMDEventPlaneTask+;
#pragma link C++ class AliForwarddNdetaTask+;
+++ /dev/null
-// -*- mode: c++ -*-
-/* Copyright (C) 2007 Christian Holm Christensen <cholm@nbi.dk>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#ifdef __CINT__
-/* $Id: FMDflowLinkDef.h 23165 2007-12-19 01:36:20Z cholm $ */
-/** @file FMDbaseLinkDef.h
- @author Christian Holm Christensen <cholm@nbi.dk>
- @date Mon Mar 27 14:18:46 2006
- @brief Link specifications for base library
-*/
-#pragma link off all globals;
-#pragma link off all classes;
-#pragma link off all functions;
-
-#pragma link C++ class AliFMDAnalysisTaskSE+;
-#pragma link C++ class AliFMDAnalysisTaskDndeta+;
-#pragma link C++ class AliFMDAnaCalibBackgroundCorrection+;
-#pragma link C++ class AliFMDAnaCalibEnergyDistribution+;
-#pragma link C++ class AliFMDAnaCalibEventSelectionEfficiency+;
-#pragma link C++ class AliFMDAnaCalibSharingEfficiency+;
-#pragma link C++ class AliFMDAnaParameters+;
-#pragma link C++ class AliFMDAnalysisTaskESDReader+;
-#pragma link C++ class AliFMDAnalysisTaskSharing+;
-#pragma link C++ class AliFMDAnalysisTaskDensity+;
-#pragma link C++ class AliFMDAnalysisTaskBackgroundCorrection+;
-#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
-#endif
-//
-// EOF
-//