//________________________________________________________________________
void AliCorrectionMatrix::SetAxisTitles(const Char_t* titleX, const Char_t* titleY, const Char_t* titleZ)
-{
+{
//
// method for setting the axis titles of the histograms
//
}
//____________________________________________________________________
-Bool_t AliCorrectionMatrix::LoadHistograms(Char_t* fileName, Char_t* dir)
+Bool_t AliCorrectionMatrix::LoadHistograms(const Char_t* fileName, const Char_t* dir)
{
//
// loads the histograms from a file
if(fhCorr) {delete fhCorr; fhCorr=0;}
if(fhMeas) {delete fhMeas; fhMeas=0;}
- fhMeas = (TH2F*)fin->Get(Form("%s/meas_%s", dir,GetName()));
+ fhMeas = dynamic_cast<TH1*> (fin->Get(Form("%s/meas_%s", dir,GetName())));
if(!fhMeas) Info("LoadHistograms","No meas hist available");
-
- fhGene = (TH2F*)fin->Get(Form("%s/gene_%s",dir, GetName()));
+
+ fhGene = dynamic_cast<TH1*> (fin->Get(Form("%s/gene_%s",dir, GetName())));
if(!fhGene) Info("LoadHistograms","No gene hist available");
-
- fhCorr = (TH2F*)fin->Get(Form("%s/corr_%s",dir, GetName()));
+
+ fhCorr = dynamic_cast<TH1*> (fin->Get(Form("%s/corr_%s",dir, GetName())));
if(!fhCorr)
{
Info("LoadHistograms","No corr hist available");
// add: draw here the stat. errors of the correction histogram
}
+
+//____________________________________________________________________
+void AliCorrectionMatrix::ReduceInformation()
+{
+ // this function deletes the measured and generated histograms to reduce the amount of data
+ // in memory
+
+ if (fhMeas)
+ {
+ delete fhMeas;
+ fhMeas = 0;
+ }
+
+ if (fhGene)
+ {
+ delete fhGene;
+ fhGene = 0;
+ }
+}
void SetAxisTitles(const Char_t* titleX="", const Char_t* titleY="", const Char_t* titleZ="");
- virtual Bool_t LoadHistograms(Char_t* fileName, Char_t* dir = ".");
+ virtual Bool_t LoadHistograms(const Char_t* fileName, const Char_t* dir = ".");
virtual void SaveHistograms();
virtual void DrawHistograms();
+ virtual void ReduceInformation();
+
protected:
TH1* fhMeas; // histogram of measured particles (or tracks)
TH1* fhGene; // histogram of generated particles
}
//____________________________________________________________________
-void AliPWG0Helper::CreateDividedProjections(TH3* hist, TH3* hist2, const char* axis)
+void AliPWG0Helper::CreateDividedProjections(TH3* hist, TH3* hist2, const char* axis, Bool_t putErrors)
{
// create projections of the 3d hists divides them
// axis decides to which plane, if axis is 0 to all planes
if (axis == 0)
{
- CreateDividedProjections(hist, hist2, "yx");
- CreateDividedProjections(hist, hist2, "zx");
- CreateDividedProjections(hist, hist2, "zy");
+ CreateDividedProjections(hist, hist2, "yx", putErrors);
+ CreateDividedProjections(hist, hist2, "zx", putErrors);
+ CreateDividedProjections(hist, hist2, "zy", putErrors);
return;
}
TH1* proj = hist->Project3D(axis);
- proj->SetYTitle(GetAxisTitle(hist, axis[0]));
- proj->SetXTitle(GetAxisTitle(hist, axis[1]));
+
+ if (strlen(axis) == 2)
+ {
+ proj->SetYTitle(GetAxisTitle(hist, axis[0]));
+ proj->SetXTitle(GetAxisTitle(hist, axis[1]));
+ }
+ else if (strlen(axis) == 1)
+ proj->SetXTitle(GetAxisTitle(hist, axis[0]));
TH1* proj2 = hist2->Project3D(axis);
- proj2->SetYTitle(GetAxisTitle(hist2, axis[0]));
- proj2->SetXTitle(GetAxisTitle(hist2, axis[1]));
+ if (strlen(axis) == 2)
+ {
+ proj2->SetYTitle(GetAxisTitle(hist2, axis[0]));
+ proj2->SetXTitle(GetAxisTitle(hist2, axis[1]));
+ }
+ else if (strlen(axis) == 1)
+ proj2->SetXTitle(GetAxisTitle(hist2, axis[0]));
TH1* division = dynamic_cast<TH1*> (proj->Clone(Form("%s_div_%s", proj->GetName(), proj2->GetName())));
division->Divide(proj2);
+
+ if (putErrors)
+ {
+ division->Sumw2();
+ if (division->GetDimension() == 1)
+ {
+ Int_t nBins = division->GetNbinsX();
+ for (Int_t i = 0; i <= nBins; ++i)
+ if (proj2->GetBinContent(i) != 0)
+ division->SetBinError(i, TMath::Sqrt(proj->GetBinContent(i)) / proj2->GetBinContent(i));
+ }
+ else if (division->GetDimension() == 2)
+ {
+ Int_t nBinsX = division->GetNbinsX();
+ Int_t nBinsY = division->GetNbinsY();
+ for (Int_t i = 0; i <= nBinsX; ++i)
+ for (Int_t j = 0; j <= nBinsY; ++j)
+ if (proj2->GetBinContent(i, j) != 0)
+ division->SetBinError(i, j, TMath::Sqrt(proj->GetBinContent(i, j)) / proj2->GetBinContent(i, j));
+ }
+ }
}
//____________________________________________________________________
static Bool_t IsPrimaryCharged(TParticle* aParticle, Int_t aTotalPrimaries, Bool_t debug = kFALSE);
static void CreateProjections(TH3* hist);
- static void CreateDividedProjections(TH3* hist, TH3* hist2, const char* axis = 0);
+ static void CreateDividedProjections(TH3* hist, TH3* hist2, const char* axis = 0, Bool_t putErrors = kFALSE);
static const char* GetAxisTitle(TH3* hist, const char axis);
protected:
//
// Constructor. Initialization of pointers
//
-
- AliLog::SetClassDebugLevel("AliSelector", AliLog::kDebug);
}
AliSelector::~AliSelector()
// When running with PROOF Begin() is only called on the client.
// The tree argument is deprecated (on PROOF 0 is passed).
+ TString option = GetOption();
+
+ if (option.Contains("debug"))
+ {
+ AliLog::SetClassDebugLevel("AliSelector", AliLog::kDebug);
+ AliInfo(Form("Called with option %s.", option.Data()));
+ }
+
AliDebug(AliLog::kDebug, "============BEGIN===========");
}
// Helper macros for creating chains
-TChain* CreateESDChainFromDir(const char* aDataDir, Int_t aRuns = 20, Int_t offset = 0)
+TChain* CreateESDChain(const char* aDataDir, Int_t aRuns = 20, Int_t offset = 0)
{
- // creates chain of files in a given directory. The structure is expected as:
+ // creates chain of files in a given directory or file containing a list.
+ // In case of directory the structure is expected as:
// <aDataDir>/<dir0>/AliESDs.root
// <aDataDir>/<dir1>/AliESDs.root
// ...
if (!aDataDir)
return 0;
+ Long_t id, size, flags, modtime;
+ if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime))
+ {
+ print("%s not found.\n", aDataDir);
+ return 0;
+ }
+
TChain* chain = new TChain("esdTree");
TChain* chaingAlice = 0;
- TString execDir(gSystem->pwd());
- TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
- TList* dirList = baseDir->GetListOfFiles();
- Int_t nDirs = dirList->GetEntries();
- gSystem->cd(execDir);
-
- Int_t count = 0;
-
- for (Int_t iDir=0; iDir<nDirs; ++iDir)
+ if (flags & 2)
{
- TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
- if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
- continue;
+ TString execDir(gSystem->pwd());
+ TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
+ TList* dirList = baseDir->GetListOfFiles();
+ Int_t nDirs = dirList->GetEntries();
+ gSystem->cd(execDir);
- if (offset > 0)
- {
- --offset;
- continue;
- }
+ Int_t count = 0;
- if (count++ == aRuns)
- break;
+ for (Int_t iDir=0; iDir<nDirs; ++iDir)
+ {
+ TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
+ if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
+ continue;
- TString presentDirName(aDataDir);
- presentDirName += "/";
- presentDirName += presentDir->GetName();
+ if (offset > 0)
+ {
+ --offset;
+ continue;
+ }
- chain->Add(presentDirName + "/AliESDs.root/esdTree");
- }
+ if (count++ == aRuns)
+ break;
- return chain;
-}
+ TString presentDirName(aDataDir);
+ presentDirName += "/";
+ presentDirName += presentDir->GetName();
-TChain* CreateESDChainFromList(const char* listFile, Int_t aRuns = 20, Int_t offset = 0)
-{
- // Creates a chain from a file which contains a list of ESD files
+ chain->Add(presentDirName + "/AliESDs.root/esdTree");
+ }
+ }
+ else
+ {
+ // Open the input stream
+ ifstream in;
+ in.open(aDataDir);
- if (!listFile)
- return 0;
+ Int_t count = 0;
- TChain* chain = new TChain("esdTree");
- TChain* chaingAlice = 0;
-
- // Open the input stream
- ifstream in;
- in.open(listFile);
+ // Read the input list of files and add them to the chain
+ TString esdfile;
+ while(in.good()) {
+ in >> esdfile;
+ if (!esdfile.Contains("root")) continue; // protection
- Int_t count = 0;
+ if (offset > 0)
+ {
+ --offset;
+ continue;
+ }
- // Read the input list of files and add them to the chain
- TString esdfile;
- while(in.good()) {
- in >> esdfile;
- if (!esdfile.Contains("root")) continue; // protection
+ if (count++ == aRuns)
+ break;
- if (offset > 0)
- {
- --offset;
- continue;
+ // add esd file
+ chain->Add(esdfile);
}
- if (count++ == aRuns)
- break;
+ in.close();
- // add esd file
- chain->Add(esdfile);
+ chain->Lookup();
}
- in.close();
-
- chain->Lookup();
-
return chain;
}
$(PACKAGE)/Makefile.arch: $(ROOTSYS)/test/Makefile.arch
@echo Copying $< to $@
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
- @cp $^ $@
+ @cp -a $^ $@
$(PACKAGE)/PROOF-INF: PROOF-INF.$(PACKAGE)
@echo Copying $< to $@
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
- @cp -r $^ $@
+ @cp -a -r $^ $@
$(PACKAGE)/%: %
@echo Copying $< to $@
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
- @cp $< $@
+ @cp -a $< $@
test-%.par: %.par
@echo "INFO: The file $< is now tested, in case of an error check in par-tmp."
#pragma link C++ class AlidNdEtaAnalysisMCSelector+;
#pragma link C++ class AlidNdEtaAnalysisESDSelector+;
#pragma link C++ class AlidNdEtaVertexRecEffSelector+;
+#pragma link C++ class AliMultiplicityESDSelector+;
#endif
--- /dev/null
+/* $Id$ */
+
+#include "AliMultiplicityESDSelector.h"
+
+#include <TStyle.h>
+#include <TSystem.h>
+#include <TCanvas.h>
+#include <TVector3.h>
+#include <TChain.h>
+#include <TFile.h>
+#include <TH1F.h>
+
+#include <AliLog.h>
+#include <AliESD.h>
+
+#include "esdTrackCuts/AliESDtrackCuts.h"
+#include "AliPWG0Helper.h"
+
+ClassImp(AliMultiplicityESDSelector)
+
+AliMultiplicityESDSelector::AliMultiplicityESDSelector() :
+ AliSelector(),
+ fMultiplicity(0),
+ fEsdTrackCuts(0)
+{
+ //
+ // Constructor. Initialization of pointers
+ //
+
+ AliLog::SetClassDebugLevel("AliMultiplicityESDSelector", AliLog::kDebug);
+}
+
+AliMultiplicityESDSelector::~AliMultiplicityESDSelector()
+{
+ //
+ // Destructor
+ //
+
+ // histograms are in the output list and deleted when the output
+ // list is deleted by the TSelector dtor
+}
+
+void AliMultiplicityESDSelector::Begin(TTree* tree)
+{
+ // Begin function
+
+ ReadUserObjects(tree);
+}
+
+void AliMultiplicityESDSelector::ReadUserObjects(TTree* tree)
+{
+ // read the user objects, called from slavebegin and begin
+
+ if (!fEsdTrackCuts && fInput)
+ fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (fInput->FindObject("AliESDtrackCuts"));
+
+ if (!fEsdTrackCuts && tree)
+ fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (tree->GetUserInfo()->FindObject("AliESDtrackCuts"));
+
+ if (!fEsdTrackCuts)
+ AliDebug(AliLog::kError, "ERROR: Could not read EsdTrackCuts from input list.");
+}
+
+void AliMultiplicityESDSelector::SlaveBegin(TTree* tree)
+{
+ // The SlaveBegin() function is called after the Begin() function.
+ // When running with PROOF SlaveBegin() is called on each slave server.
+ // The tree argument is deprecated (on PROOF 0 is passed).
+
+ AliSelector::SlaveBegin(tree);
+
+ ReadUserObjects(tree);
+
+ fMultiplicity = new TH1F("multiplicity", "multiplicity", 100, 0, 100);
+}
+
+Bool_t AliMultiplicityESDSelector::Process(Long64_t entry)
+{
+ // The Process() function is called for each entry in the tree (or possibly
+ // keyed object in the case of PROOF) to be processed. The entry argument
+ // specifies which entry in the currently loaded tree is to be processed.
+ // It can be passed to either TTree::GetEntry() or TBranch::GetEntry()
+ // to read either all or the required parts of the data. When processing
+ // keyed objects with PROOF, the object is already loaded and is available
+ // via the fObject pointer.
+ //
+ // This function should contain the "body" of the analysis. It can contain
+ // simple or elaborate selection criteria, run algorithms on the data
+ // of the event and typically fill histograms.
+
+ // WARNING when a selector is used with a TChain, you must use
+ // the pointer to the current TTree to call GetEntry(entry).
+ // The entry is always the local entry number in the current tree.
+ // Assuming that fTree is the pointer to the TChain being processed,
+ // use fTree->GetTree()->GetEntry(entry).
+
+ if (AliSelector::Process(entry) == kFALSE)
+ return kFALSE;
+
+ // Check prerequisites
+ if (!fESD)
+ {
+ AliDebug(AliLog::kError, "ESD branch not available");
+ return kFALSE;
+ }
+
+ if (!fEsdTrackCuts)
+ {
+ AliDebug(AliLog::kError, "fESDTrackCuts not available");
+ return kFALSE;
+ }
+
+ if (AliPWG0Helper::IsEventTriggered(fESD) == kFALSE)
+ return kTRUE;
+
+ if (AliPWG0Helper::IsVertexReconstructed(fESD) == kFALSE)
+ return kTRUE;
+
+ // get number of "good" tracks
+ TObjArray* list = fEsdTrackCuts->GetAcceptedTracks(fESD);
+ Int_t nGoodTracks = list->GetEntries();
+ delete list;
+ list = 0;
+
+ fMultiplicity->Fill(nGoodTracks);
+
+
+ return kTRUE;
+}
+
+void AliMultiplicityESDSelector::SlaveTerminate()
+{
+ // The SlaveTerminate() function is called after all entries or objects
+ // have been processed. When running with PROOF SlaveTerminate() is called
+ // on each slave server.
+
+ AliSelector::SlaveTerminate();
+
+ // Add the histograms to the output on each slave server
+ if (!fOutput)
+ {
+ AliDebug(AliLog::kError, Form("ERROR: Output list not initialized."));
+ return;
+ }
+
+ fOutput->Add(fMultiplicity);
+}
+
+void AliMultiplicityESDSelector::Terminate()
+{
+ // The Terminate() function is the last function to be called during
+ // a query. It always runs on the client, it can be used to present
+ // the results graphically or save the results to file.
+
+ AliSelector::Terminate();
+
+ fMultiplicity = dynamic_cast<TH1F*> (fOutput->FindObject("multiplicity"));
+
+ if (!fMultiplicity)
+ {
+ AliDebug(AliLog::kError, Form("ERROR: Histograms not available %p", (void*) fMultiplicity));
+ return;
+ }
+
+ new TCanvas;
+ fMultiplicity->Draw();
+}
--- /dev/null
+/* $Id$ */
+
+#ifndef ALIMULTIPLICITYESDSELECTOR_H
+#define ALIMULTIPLICITYESDSELECTOR_H
+
+#include "AliSelector.h"
+
+class AliESDtrackCuts;
+class TH1F;
+
+class AliMultiplicityESDSelector : public AliSelector {
+ public:
+ AliMultiplicityESDSelector();
+ virtual ~AliMultiplicityESDSelector();
+
+ virtual void Begin(TTree* tree);
+ virtual void SlaveBegin(TTree *tree);
+ virtual Bool_t Process(Long64_t entry);
+ virtual void SlaveTerminate();
+ virtual void Terminate();
+
+ protected:
+ void ReadUserObjects(TTree* tree);
+
+ TH1F* fMultiplicity; // multiplicity histogram
+
+ AliESDtrackCuts* fEsdTrackCuts; // Object containing the parameters of the esd track cuts
+
+ private:
+
+ ClassDef(AliMultiplicityESDSelector, 0);
+};
+
+#endif
// Constructor. Initialization of pointers
//
- //AliLog::SetClassDebugLevel("AlidNdEtaAnalysisESDSelector", AliLog::kDebug);
+ AliLog::SetClassDebugLevel("AlidNdEtaAnalysisESDSelector", AliLog::kDebug);
}
AlidNdEtaAnalysisESDSelector::~AlidNdEtaAnalysisESDSelector()
// list is deleted by the TSelector dtor
}
-void AlidNdEtaAnalysisESDSelector::SlaveBegin(TTree* tree)
+void AlidNdEtaAnalysisESDSelector::Begin(TTree* tree)
{
- // The SlaveBegin() function is called after the Begin() function.
- // When running with PROOF SlaveBegin() is called on each slave server.
- // The tree argument is deprecated (on PROOF 0 is passed).
+ // Begin function
- AliSelector::SlaveBegin(tree);
+ ReadUserObjects(tree);
+}
- if (fInput)
- {
- printf("Printing input list:\n");
- fInput->Print();
- }
+void AlidNdEtaAnalysisESDSelector::ReadUserObjects(TTree* tree)
+{
+ // read the user objects, called from slavebegin and begin
if (!fEsdTrackCuts && fInput)
fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (fInput->FindObject("AliESDtrackCuts"));
if (!fdNdEtaCorrection && fInput)
fdNdEtaCorrection = dynamic_cast<AlidNdEtaCorrection*> (fInput->FindObject("dndeta_correction"));
- if (!fdNdEtaCorrection && fTree)
- fdNdEtaCorrection = dynamic_cast<AlidNdEtaCorrection*> (fTree->GetUserInfo()->FindObject("dndeta_correction"));
+ if (!fdNdEtaCorrection && tree)
+ fdNdEtaCorrection = dynamic_cast<AlidNdEtaCorrection*> (tree->GetUserInfo()->FindObject("dndeta_correction"));
if (!fdNdEtaCorrection)
AliDebug(AliLog::kError, "ERROR: Could not read dndeta_correction from input list.");
+}
+void AlidNdEtaAnalysisESDSelector::SlaveBegin(TTree* tree)
+{
+ // The SlaveBegin() function is called after the Begin() function.
+ // When running with PROOF SlaveBegin() is called on each slave server.
+ // The tree argument is deprecated (on PROOF 0 is passed).
+
+ AliSelector::SlaveBegin(tree);
+
+ ReadUserObjects(tree);
fdNdEtaAnalysisMBVtx = new dNdEtaAnalysis("dndeta_mbvtx", "dndeta_mbvtx");
fdNdEtaAnalysisMB = new dNdEtaAnalysis("dndeta_mb", "dndeta_mb");
}
fOutput->Add(fdNdEtaAnalysis);
+ fOutput->Add(fdNdEtaAnalysisMB);
+ fOutput->Add(fdNdEtaAnalysisMBVtx);
}
void AlidNdEtaAnalysisESDSelector::Terminate()
AliSelector::Terminate();
fdNdEtaAnalysis = dynamic_cast<dNdEtaAnalysis*> (fOutput->FindObject("dndeta"));
+ fdNdEtaAnalysisMB = dynamic_cast<dNdEtaAnalysis*> (fOutput->FindObject("dndeta_mb"));
+ fdNdEtaAnalysisMBVtx = dynamic_cast<dNdEtaAnalysis*> (fOutput->FindObject("dndeta_mbvtx"));
- if (!fdNdEtaAnalysis)
+ if (!fdNdEtaAnalysis || !fdNdEtaAnalysisMB || !fdNdEtaAnalysisMBVtx)
{
- AliDebug(AliLog::kError, Form("ERROR: Histograms not available %p", (void*) fdNdEtaAnalysis));
+ AliDebug(AliLog::kError, Form("ERROR: Histograms not available %p %p %p", (void*) fdNdEtaAnalysis, (void*) fdNdEtaAnalysisMB, (void*) fdNdEtaAnalysisMBVtx));
return;
}
- fdNdEtaAnalysis->Finish(fdNdEtaCorrection, 0.3);
- fdNdEtaAnalysisMB->Finish(fdNdEtaCorrection, 0.3);
- fdNdEtaAnalysisMBVtx->Finish(fdNdEtaCorrection, 0.3);
+ if (fdNdEtaAnalysis)
+ fdNdEtaAnalysis->Finish(fdNdEtaCorrection, 0.3);
+
+ if (fdNdEtaAnalysisMB)
+ fdNdEtaAnalysisMB->Finish(fdNdEtaCorrection, 0.3);
+
+ if (fdNdEtaAnalysisMBVtx)
+ fdNdEtaAnalysisMBVtx->Finish(fdNdEtaCorrection, 0.3);
TFile* fout = new TFile("analysis_esd.root","RECREATE");
AlidNdEtaAnalysisESDSelector();
virtual ~AlidNdEtaAnalysisESDSelector();
+ virtual void Begin(TTree* tree);
virtual void SlaveBegin(TTree *tree);
virtual void Init(TTree *tree);
virtual Bool_t Process(Long64_t entry);
virtual void Terminate();
protected:
+ void ReadUserObjects(TTree* tree);
+
dNdEtaAnalysis* fdNdEtaAnalysisMBVtx; // contains the histograms for the triggered events with vertex
dNdEtaAnalysis* fdNdEtaAnalysisMB; // contains the histograms corrected with vtx recon eff
dNdEtaAnalysis* fdNdEtaAnalysis; // contains the histograms corrected with vtx recon eff and trigger bias eff
//____________________________________________________________________
Bool_t
-AlidNdEtaCorrection::LoadHistograms(Char_t* fileName, Char_t* dir) {
+AlidNdEtaCorrection::LoadHistograms(const Char_t* fileName, const Char_t* dir) {
//
// loads the histograms
//
return fraction;
}
+void AlidNdEtaCorrection::ReduceInformation()
+{
+ // this function deletes the measured and generated histograms from the corrections to reduce the amount of data
+ // in memory
+
+ // these are needed for GetMeasuredFraction(): fTrack2ParticleCorrection->ReduceInformation();
+ fVertexRecoCorrection->ReduceInformation();
+ fTriggerCorrection->ReduceInformation();
+ fTriggerBiasCorrection->ReduceInformation();
+}
virtual Long64_t Merge(TCollection* list);
void SaveHistograms();
- Bool_t LoadHistograms(Char_t* fileName, Char_t* dir = "dndeta_correction");
- Bool_t LoadCorrection(Char_t* fileName, Char_t* dir = "dndeta_correction")
+ Bool_t LoadHistograms(const Char_t* fileName, const Char_t* dir = "dndeta_correction");
+ Bool_t LoadCorrection(const Char_t* fileName, const Char_t* dir = "dndeta_correction")
{return LoadHistograms(fileName, dir);}
void DrawHistograms();
void SetNEvents(Long64_t events) { fNEvents = events; }
+ void ReduceInformation();
+
protected:
AliCorrectionMatrix3D* fTrack2ParticleCorrection; //-> handles the track-to-particle correction, function of vtx_z, eta, pt
AliCorrectionMatrix2D* fVertexRecoCorrection; //-> handles the vertex reconstruction efficiency, function of n_clustersITS and vtx_z
fData->SetXTitle("vtx z [cm]");
fData->SetYTitle("#eta");
fData->SetZTitle("p_{T}");
+ fData->Sumw2();
fDataUncorrected = dynamic_cast<TH3F*> (fData->Clone(Form("%s_analysis_uncorrected", name)));
fDataUncorrected->SetTitle(Form("%s uncorrected", fData->GetTitle()));
fVtx->SetName(Form("%s_vtx", name));
fVtx->SetTitle("Vertex distribution");
fVtx->GetXaxis()->SetTitle(fData->GetXaxis()->GetTitle());
+ //fVtx->Sumw2();
fdNdEta[0] = dynamic_cast<TH1D*> (fData->Project3D("y"));
fdNdEta[0]->SetName(Form("%s_dNdEta", name));
fPtDist->SetTitle("p_{T} [GeV/c]");
fPtDist->GetXaxis()->SetTitle(fData->GetZaxis()->GetTitle());
fPtDist->SetYTitle("#frac{dN}{d#eta dp_{T}} [c/GeV]");
-
- fData->Sumw2();
- fVtx->Sumw2();
}
//____________________________________________________________________
{
// destructor
- delete fData;
- fData = 0;
+ if (fData)
+ {
+ delete fData;
+ fData = 0;
+ }
- delete fDataUncorrected;
- fDataUncorrected = 0;
+ if (fDataUncorrected)
+ {
+ delete fDataUncorrected;
+ fDataUncorrected = 0;
+ }
- delete fVtx;
- fVtx = 0;
+ if (fVtx)
+ {
+ delete fVtx;
+ fVtx = 0;
+ }
for (Int_t i=0; i<kVertexBinning; ++i)
{
- delete fdNdEta[i];
- fdNdEta[i] = 0;
- delete fdNdEtaPtCutOffCorrected[i];
- fdNdEtaPtCutOffCorrected[i] = 0;
+ if (fdNdEta[i])
+ {
+ delete fdNdEta[i];
+ fdNdEta[i] = 0;
+ }
+ if (fdNdEtaPtCutOffCorrected[i])
+ {
+ delete fdNdEtaPtCutOffCorrected[i];
+ fdNdEtaPtCutOffCorrected[i] = 0;
+ }
}
- delete fPtDist;
- fPtDist = 0;
+ if (fPtDist)
+ {
+ delete fPtDist;
+ fPtDist = 0;
+ }
}
//_____________________________________________________________________________
// In fData we have the track2particle and vertex reconstruction efficiency correction already applied
-
// create pt hist
{
// reset all ranges
fdNdEtaPtCutOffCorrected[i] = dynamic_cast<TH1D*> (gDirectory->Get(fdNdEtaPtCutOffCorrected[i]->GetName()));
}
+ fPtDist = dynamic_cast<TH1D*> (gDirectory->Get(fPtDist->GetName()));
+
gDirectory->cd("../");
}
continue;
collections[0]->Add(entry->fData);
- collections[1]->Add(entry->fDataUncorrected);
+ if (fDataUncorrected)
+ collections[1]->Add(entry->fDataUncorrected);
collections[2]->Add(entry->fVtx);
collections[3]->Add(entry->fPtDist);
}
fData->Merge(collections[0]);
- fDataUncorrected->Merge(collections[1]);
+ if (fDataUncorrected)
+ fDataUncorrected->Merge(collections[1]);
fVtx->Merge(collections[2]);
fPtDist->Merge(collections[3]);
for (Int_t i=0; i<kVertexBinning; ++i)
TH3F* GetHistogram() { return fData; }
TH3F* GetUncorrectedHistogram() { return fDataUncorrected; }
TH1D* GetVtxHistogram() { return fVtx; }
+ TH1D* GetPtHistogram() { return fPtDist; }
TH1D* GetdNdEtaHistogram(Int_t i = 0) { return fdNdEta[i]; }
+ TH1D* GetdNdEtaPtCutOffCorrectedHistogram(Int_t i = 0) { return fdNdEtaPtCutOffCorrected[i]; }
protected:
TH3F* fData; // histogram Eta vs vtx (track count)
/* $Id$ */
+#if !defined(__CINT__) || defined(__MAKECINT__)
+
+#include "AliPWG0Helper.h"
+#include "dNdEtaAnalysis.h"
+#include "AlidNdEtaCorrection.h"
+
+#include <TCanvas.h>
+#include <TFile.h>
+#include <TH1.h>
+#include <TH2F.h>
+#include <TH3F.h>
+#include <TLine.h>
+#include <TSystem.h>
+
+#endif
+
Int_t gMax = 5;
-void drawPlots()
+extern TSystem* gSystem;
+
+void SetRanges(TAxis* axis)
{
- drawPlots(5);
- drawPlots(2);
+ if (strcmp(axis->GetTitle(), "#eta") == 0)
+ axis->SetRangeUser(-1.7999, 1.7999);
+ if (strcmp(axis->GetTitle(), "p_{T} [GeV/c]") == 0)
+ axis->SetRangeUser(0, 9.9999);
+ if (strcmp(axis->GetTitle(), "vtx z [cm]") == 0)
+ axis->SetRangeUser(-15, 14.9999);
+ if (strcmp(axis->GetTitle(), "Ntracks") == 0)
+ axis->SetRangeUser(0, 99.9999);
}
-void drawPlots(Int_t max)
+void SetRanges(TH1* hist)
{
- gMax = max;
+ SetRanges(hist->GetXaxis());
+ SetRanges(hist->GetYaxis());
+ SetRanges(hist->GetZaxis());
+}
- ptCutoff();
- TriggerBias();
- VtxRecon();
- Track2Particle2D();
- Track2Particle3D();
- ptSpectrum();
- dNdEta();
+
+void Prepare3DPlot(TH3* hist)
+{
+ hist->GetXaxis()->SetTitleOffset(1.5);
+ hist->GetYaxis()->SetTitleOffset(1.5);
+ hist->GetZaxis()->SetTitleOffset(1.5);
+
+ hist->SetStats(kFALSE);
+}
+
+void Prepare2DPlot(TH2* hist)
+{
+ hist->SetStats(kFALSE);
+ hist->GetYaxis()->SetTitleOffset(1.4);
+
+ hist->SetMinimum(0);
+ hist->SetMaximum(gMax);
+
+ SetRanges(hist);
+}
+
+void Prepare1DPlot(TH1* hist)
+{
+ hist->SetLineWidth(2);
+ hist->SetStats(kFALSE);
+
+ SetRanges(hist);
+}
+
+void InitPad()
+{
+ gPad->Range(0, 0, 1, 1);
+ gPad->SetLeftMargin(0.15);
+ //gPad->SetRightMargin(0.05);
+ //gPad->SetTopMargin(0.13);
+ //gPad->SetBottomMargin(0.1);
+
+ //gPad->SetGridx();
+ //gPad->SetGridy();
+}
+
+void InitPadCOLZ()
+{
+ gPad->Range(0, 0, 1, 1);
+ gPad->SetRightMargin(0.15);
+ gPad->SetLeftMargin(0.12);
+
+ gPad->SetGridx();
+ gPad->SetGridy();
}
-void dNdEta()
+void dNdEta(Bool_t onlyESD = kFALSE)
{
TFile* file = TFile::Open("analysis_esd.root");
- TH1* histESD = file->Get("dndeta/dndeta_dNdEta_corrected_2");
- TH1* histESDNoPt = file->Get("dndeta/dndeta_dNdEta_2");
- TH1* histESDMB = file->Get("dndeta_mb/dndeta_mb_dNdEta_corrected_2");
- TH1* histESDMBVtx = file->Get("dndeta_mbvtx/dndeta_mbvtx_dNdEta_corrected_2");
+ TH1* histESD = (TH1*) file->Get("dndeta/dndeta_dNdEta_corrected_2");
+ TH1* histESDNoPt = (TH1*) file->Get("dndeta/dndeta_dNdEta_2");
+ TH1* histESDMB = (TH1*) file->Get("dndeta_mb/dndeta_mb_dNdEta_corrected_2");
+ TH1* histESDMBVtx = (TH1*) file->Get("dndeta_mbvtx/dndeta_mbvtx_dNdEta_corrected_2");
TCanvas* canvas = new TCanvas("dNdEta1", "dNdEta1", 500, 500);
histESD->GetXaxis()->SetRangeUser(-0.7999, 0.7999);
histESDNoPt->GetXaxis()->SetRangeUser(-0.7999, 0.7999);
- dummy->Draw();
+ dummy->DrawCopy();
histESDMBVtx->Draw("SAME");
histESDMB->Draw("SAME");
histESD->Draw("SAME");
canvas->SaveAs("dNdEta1.gif");
+ canvas->SaveAs("dNdEta1.eps");
+
+ if (onlyESD)
+ return;
TFile* file2 = TFile::Open("analysis_mc.root");
- TH1* histMC = file2->Get("dndeta/dndeta_dNdEta_corrected_2")->Clone("cloned");
+ TH1* histMC = (TH1*) file2->Get("dndeta/dndeta_dNdEta_corrected_2")->Clone("cloned");
gSystem->Load("libPWG0base");
- fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
+ dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
fdNdEtaAnalysis->LoadHistograms();
fdNdEtaAnalysis->Finish(0, 0.3);
TH1* histMCPtCut = fdNdEtaAnalysis->GetdNdEtaHistogram(2);
histMCPtCut->SetLineColor(104);
histESDNoPt->SetLineColor(102);
- TH2* dummy2 = dummy->Clone("dummy2");
+ TH2* dummy2 = (TH2F*) dummy->Clone("dummy2");
dummy2->GetYaxis()->SetRangeUser(0, histESD->GetMaximum() * 1.1);
- dummy2->Draw();
+ dummy2->DrawCopy();
histMC->Draw("SAME");
// histMC->Draw();
histESD->Draw("SAME");
histMCPtCut->Draw("SAME");
canvas2->SaveAs("dNdEta2.gif");
+ canvas2->SaveAs("dNdEta2.eps");
+
+ TCanvas* canvas3 = new TCanvas("dNdEta", "dNdEta", 1000, 500);
+ canvas3->Divide(2, 1);
+
+ dummy->SetTitle("a)");
+ dummy2->SetTitle("b)");
+
+ canvas3->cd(1);
+ dummy->Draw();
+ histESDMBVtx->Draw("SAME");
+ histESDMB->Draw("SAME");
+ histESD->Draw("SAME");
+
+ canvas3->cd(2);
+ dummy2->Draw();
+ histMC->Draw("SAME");
+ histESD->Draw("SAME");
+ histESDNoPt->Draw("SAME");
+ histMCPtCut->Draw("SAME");
+
+ canvas3->SaveAs("dNdEta.gif");
+ canvas3->SaveAs("dNdEta.eps");
}
void ptSpectrum()
{
TFile* file = TFile::Open("analysis_esd.root");
- TH1* histESD = file->Get("dndeta/dndeta_pt");
+ TH1* histESD = (TH1*) file->Get("dndeta/dndeta_pt");
TFile* file2 = TFile::Open("analysis_mc.root");
- TH1* histMC = file2->Get("dndeta/dndeta_pt");
+ TH1* histMC = (TH1*) file2->Get("dndeta/dndeta_pt");
TCanvas* canvas = new TCanvas("ptSpectrum", "ptSpectrum", 500, 500);
InitPad();
histMC->Draw("SAME");
canvas->SaveAs("ptSpectrum.gif");
+ canvas->SaveAs("ptSpectrum.eps");
}
void ptCutoff()
line->Draw();
canvas->SaveAs("ptCutoff.gif");
+ canvas->SaveAs("ptCutoff.eps");
}
-void TriggerBias()
+void TriggerBiasVtxRecon(const char* fileName = "correction_map.root")
{
- TFile* file = TFile::Open("correction_map.root");
+ TFile* file = TFile::Open(fileName);
+
+ TH2* corrTrigger = dynamic_cast<TH2*> (file->Get("dndeta_correction/corr_trigger"));
+ TH2* corrVtx = dynamic_cast<TH2*> (file->Get("dndeta_correction/corr_vtxReco"));
+
+ Prepare2DPlot(corrTrigger);
+ corrTrigger->SetTitle("a) Trigger bias correction");
+
+ Prepare2DPlot(corrVtx);
+ corrVtx->SetTitle("b) Vertex reconstruction correction");
+
+ TCanvas* canvas = new TCanvas("TriggerBiasVtxRecon", "TriggerBiasVtxRecon", 1000, 500);
+ canvas->Divide(2, 1);
+
+ canvas->cd(1);
+ InitPadCOLZ();
+ corrTrigger->DrawCopy("COLZ");
+
+ canvas->cd(2);
+ InitPadCOLZ();
+ corrVtx->DrawCopy("COLZ");
+
+ canvas->SaveAs(Form("TriggerBiasVtxRecon_%d.gif", gMax));
+ canvas->SaveAs(Form("TriggerBiasVtxRecon_%d.eps", gMax));
+
+ canvas = new TCanvas("TriggerBiasVtxReconZoom", "TriggerBiasVtxReconZoom", 1000, 500);
+ canvas->Divide(2, 1);
+
+ corrTrigger->GetYaxis()->SetRangeUser(0, 5);
+ corrVtx->GetYaxis()->SetRangeUser(0, 5);
+
+ canvas->cd(1);
+ InitPadCOLZ();
+ corrTrigger->DrawCopy("COLZ");
+
+ canvas->cd(2);
+ InitPadCOLZ();
+ corrVtx->DrawCopy("COLZ");
+
+ canvas->SaveAs(Form("TriggerBiasVtxReconZoom_%d.gif", gMax));
+ canvas->SaveAs(Form("TriggerBiasVtxReconZoom_%d.eps", gMax));
+}
+
+void TriggerBias(const char* fileName = "correction_map.root")
+{
+ TFile* file = TFile::Open(fileName);
TH2* corr = dynamic_cast<TH2*> (file->Get("dndeta_correction/corr_trigger"));
corr->DrawCopy("COLZ");
canvas->SaveAs(Form("TriggerBias_%d.gif", gMax));
+ canvas->SaveAs(Form("TriggerBias_%d.eps", gMax));
corr->GetYaxis()->SetRangeUser(0, 5);
corr->DrawCopy("COLZ");
canvas->SaveAs(Form("TriggerBiasZoom_%d.gif", gMax));
+ canvas->SaveAs(Form("TriggerBiasZoom_%d.eps", gMax));
}
void VtxRecon()
InitPadCOLZ();
corr->DrawCopy("COLZ");
- canvas->SaveAs(Form("VtxRecon_%d.gif", gMax));
-
+ canvas->SaveAs(Form("VtxRecon_%d.eps", gMax));
+ canvas->SaveAs(Form("VtxRecon_%d.eps", gMax));
corr->GetYaxis()->SetRangeUser(0, 5);
- TCanvas* canvas = new TCanvas("VtxReconZoom", "VtxReconZoom", 500, 500);
+ canvas = new TCanvas("VtxReconZoom", "VtxReconZoom", 500, 500);
InitPadCOLZ();
corr->DrawCopy("COLZ");
canvas->SaveAs(Form("VtxReconZoom_%d.gif", gMax));
+ canvas->SaveAs(Form("VtxReconZoom_%d.eps", gMax));
}
-void Track2Particle2D()
+void Track2ParticleAsNumber(const char* fileName = "correction_map.root")
{
gSystem->Load("libPWG0base");
- TFile* file = TFile::Open("correction_map.root");
+ TFile::Open(fileName);
AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction");
- dNdEtaCorrection->LoadHistograms("correction_map.root","dndeta_correction");
+ dNdEtaCorrection->LoadHistograms(fileName, "dndeta_correction");
+
+ TH3F* gene = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetGeneratedHistogram();
+ TH3F* meas = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetMeasuredHistogram();
+
+ TH3F* gene = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetGeneratedHistogram();
+ TH3F* meas = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetMeasuredHistogram();
+
+ gene->GetYaxis()->SetRangeUser(-0.8, 0.8);
+ meas->GetYaxis()->SetRangeUser(-0.8, 0.8);
+ gene->GetXaxis()->SetRangeUser(-10, 10);
+ meas->GetXaxis()->SetRangeUser(-10, 10);
+
+ Float_t eff1 = gene->Integral() / meas->Integral();
+ Float_t error1 = TMath::Sqrt(gene->Integral()) / meas->Integral();
+
+ printf("Correction without pT cut: %f +- %f\n", eff1, error1);
+
+ gene->GetZaxis()->SetRangeUser(0.3, 10);
+ meas->GetZaxis()->SetRangeUser(0.3, 10);
+
+ Float_t eff2 = gene->Integral() / meas->Integral();
+ Float_t error2 = TMath::Sqrt(gene->Integral()) / meas->Integral();
+
+ printf("Correction with pT cut: %f +- %f\n", eff2, error2);
+
+ gene->GetZaxis()->SetRangeUser(0.3, 1);
+ meas->GetZaxis()->SetRangeUser(0.3, 1);
+
+ Float_t eff3 = gene->Integral() / meas->Integral();
+ Float_t error3 = TMath::Sqrt(gene->Integral()) / meas->Integral();
+
+ printf("Correction with 0.3 < pT < 0.5: %f +- %f\n", eff3, error3);
+}
+
+void Track2Particle1DCreatePlots(const char* fileName = "correction_map.root", Float_t upperPtLimit = 10)
+{
+ TFile::Open(fileName);
+ AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction");
+ dNdEtaCorrection->LoadHistograms(fileName, "dndeta_correction");
+
+ TH3F* gene = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetGeneratedHistogram();
+ TH3F* meas = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetMeasuredHistogram();
+
+ gene->GetZaxis()->SetRangeUser(0.3, upperPtLimit);
+ meas->GetZaxis()->SetRangeUser(0.3, upperPtLimit);
+ gene->GetYaxis()->SetRangeUser(-0.8, 0.8);
+ meas->GetYaxis()->SetRangeUser(-0.8, 0.8);
+ AliPWG0Helper::CreateDividedProjections(gene, meas, "x", kTRUE);
+ gene->GetYaxis()->SetRange(0, 0);
+ meas->GetYaxis()->SetRange(0, 0);
+
+ gene->GetXaxis()->SetRangeUser(-10, 10);
+ meas->GetXaxis()->SetRangeUser(-10, 10);
+ AliPWG0Helper::CreateDividedProjections(gene, meas, "y", kTRUE);
+ gene->GetZaxis()->SetRange(0, 0);
+ meas->GetZaxis()->SetRange(0, 0);
+
+ gene->GetYaxis()->SetRangeUser(-0.8, 0.8);
+ meas->GetYaxis()->SetRangeUser(-0.8, 0.8);
+ AliPWG0Helper::CreateDividedProjections(gene, meas, "z", kTRUE);
+}
- TH3* gene = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetGeneratedHistogram();
- TH3* meas = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetMeasuredHistogram();
+void Track2Particle1D(const char* fileName = "correction_map.root", Float_t upperPtLimit = 9.9)
+{
+ gSystem->Load("libPWG0base");
+
+ Track2Particle1DCreatePlots(fileName, upperPtLimit);
+
+ TH1* corrX = dynamic_cast<TH1*> (gROOT->FindObject("gene_nTrackToNPart_x_div_meas_nTrackToNPart_x"));
+ TH1* corrY = dynamic_cast<TH1*> (gROOT->FindObject("gene_nTrackToNPart_y_div_meas_nTrackToNPart_y"));
+ TH1* corrZ = dynamic_cast<TH1*> (gROOT->FindObject("gene_nTrackToNPart_z_div_meas_nTrackToNPart_z"));
+
+ Prepare1DPlot(corrX);
+ Prepare1DPlot(corrY);
+ Prepare1DPlot(corrZ);
+
+ const char* title = "Track2Particle Correction";
+ corrX->SetTitle(title);
+ corrY->SetTitle(title);
+ corrZ->SetTitle(title);
+
+ corrZ->GetXaxis()->SetRangeUser(0, upperPtLimit);
+
+ TCanvas* canvas = new TCanvas("Track2Particle2D", "Track2Particle2D", 1200, 400);
+ canvas->Divide(3, 1);
+
+ canvas->cd(1);
+ InitPad();
+ corrX->Draw();
+
+ canvas->cd(2);
+ InitPad();
+ corrY->Draw();
+
+ canvas->cd(3);
+ InitPad();
+ corrZ->Draw();
+
+ canvas->SaveAs(Form("Track2Particle1D_%s_%d_%f.gif", fileName, gMax, upperPtLimit));
+ canvas->SaveAs(Form("Track2Particle1D_%s_%d_%f.eps", fileName, gMax, upperPtLimit));
+}
+
+void CompareTrack2Particle1D(Float_t upperPtLimit = 9.9)
+{
+ gSystem->Load("libPWG0base");
+
+ Track2Particle1DCreatePlots("correction_maponly-positive.root", upperPtLimit);
+
+ TH1* posX = dynamic_cast<TH1*> (gROOT->FindObject("gene_nTrackToNPart_x_div_meas_nTrackToNPart_x")->Clone("pos_x"));
+ TH1* posY = dynamic_cast<TH1*> (gROOT->FindObject("gene_nTrackToNPart_y_div_meas_nTrackToNPart_y")->Clone("pos_y"));
+ TH1* posZ = dynamic_cast<TH1*> (gROOT->FindObject("gene_nTrackToNPart_z_div_meas_nTrackToNPart_z")->Clone("pos_z"));
+
+ Track2Particle1DCreatePlots("correction_maponly-negative.root", upperPtLimit);
+
+ TH1* negX = dynamic_cast<TH1*> (gROOT->FindObject("gene_nTrackToNPart_x_div_meas_nTrackToNPart_x")->Clone("neg_x"));
+ TH1* negY = dynamic_cast<TH1*> (gROOT->FindObject("gene_nTrackToNPart_y_div_meas_nTrackToNPart_y")->Clone("neg_y"));
+ TH1* negZ = dynamic_cast<TH1*> (gROOT->FindObject("gene_nTrackToNPart_z_div_meas_nTrackToNPart_z")->Clone("neg_z"));
+
+ //printf("%f %f %f %f\n", posX->GetBinContent(20), posX->GetBinError(20), negX->GetBinContent(20), negX->GetBinError(20));
+
+ posX->Divide(negX);
+ posY->Divide(negY);
+ posZ->Divide(negZ);
+
+ //printf("%f %f\n", posX->GetBinContent(20), posX->GetBinError(20));
+
+ Prepare1DPlot(posX);
+ Prepare1DPlot(posY);
+ Prepare1DPlot(posZ);
+
+ Float_t min = 0.8;
+ Float_t max = 1.2;
+
+ posX->SetMinimum(min);
+ posX->SetMaximum(max);
+ posY->SetMinimum(min);
+ posY->SetMaximum(max);
+ posZ->SetMinimum(min);
+ posZ->SetMaximum(max);
+
+ posZ->GetXaxis()->SetRangeUser(0, upperPtLimit);
+
+ posX->GetYaxis()->SetTitleOffset(1.7);
+ posX->GetYaxis()->SetTitle("C_{+} / C_{-}");
+ posY->GetYaxis()->SetTitleOffset(1.7);
+ posY->GetYaxis()->SetTitle("C_{+} / C_{-}");
+ posZ->GetYaxis()->SetTitleOffset(1.7);
+ posZ->GetYaxis()->SetTitle("C_{+} / C_{-}");
+
+ TCanvas* canvas = new TCanvas("CompareTrack2Particle1D", "CompareTrack2Particle1D", 1200, 400);
+ canvas->Divide(3, 1);
+
+ canvas->cd(1);
+ InitPad();
+ posX->Draw();
+
+ canvas->cd(2);
+ InitPad();
+ posY->Draw();
+
+ canvas->cd(3);
+ InitPad();
+ posZ->Draw();
+
+ canvas->SaveAs(Form("CompareTrack2Particle1D_%f.gif", upperPtLimit));
+ canvas->SaveAs(Form("CompareTrack2Particle1D_%f.eps", upperPtLimit));
+}
+
+void Track2Particle2DCreatePlots(const char* fileName = "correction_map.root")
+{
+ TFile::Open(fileName);
+ AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction");
+ dNdEtaCorrection->LoadHistograms(fileName, "dndeta_correction");
+
+ TH3F* gene = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetGeneratedHistogram();
+ TH3F* meas = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetMeasuredHistogram();
gene->GetZaxis()->SetRangeUser(0.3, 10);
meas->GetZaxis()->SetRangeUser(0.3, 10);
AliPWG0Helper::CreateDividedProjections(gene, meas, "yx");
- gene->GetZaxis()->UnZoom();
- meas->GetZaxis()->UnZoom();
+ gene->GetZaxis()->SetRange(0, 0);
+ meas->GetZaxis()->SetRange(0, 0);
gene->GetYaxis()->SetRangeUser(-0.8, 0.8);
meas->GetYaxis()->SetRangeUser(-0.8, 0.8);
AliPWG0Helper::CreateDividedProjections(gene, meas, "zx");
- gene->GetYaxis()->UnZoom();
- meas->GetYaxis()->UnZoom();
+ gene->GetYaxis()->SetRange(0, 0);
+ meas->GetYaxis()->SetRange(0, 0);
gene->GetXaxis()->SetRangeUser(-10, 10);
meas->GetXaxis()->SetRangeUser(-10, 10);
AliPWG0Helper::CreateDividedProjections(gene, meas, "zy");
- gene->GetXaxis()->UnZoom();
- meas->GetXaxis()->UnZoom();
+ gene->GetXaxis()->SetRange(0, 0);
+ meas->GetXaxis()->SetRange(0, 0);
+}
+
+void Track2Particle2D(const char* fileName = "correction_map.root")
+{
+ gSystem->Load("libPWG0base");
+
+ Track2Particle2DCreatePlots(fileName);
TH2* corrYX = dynamic_cast<TH2*> (gROOT->FindObject("gene_nTrackToNPart_yx_div_meas_nTrackToNPart_yx"));
TH2* corrZX = dynamic_cast<TH2*> (gROOT->FindObject("gene_nTrackToNPart_zx_div_meas_nTrackToNPart_zx"));
Prepare2DPlot(corrZX);
Prepare2DPlot(corrZY);
- const char* title = "Track2Particle Correction";
+ const char* title = "";
corrYX->SetTitle(title);
corrZX->SetTitle(title);
corrZY->SetTitle(title);
corrZY->Draw("COLZ");
canvas->SaveAs(Form("Track2Particle2D_%d.gif", gMax));
+ canvas->SaveAs(Form("Track2Particle2D_%d.eps", gMax));
+}
+
+void CompareTrack2Particle2D()
+{
+ gSystem->Load("libPWG0base");
+
+ Track2Particle2DCreatePlots("correction_maponly-positive.root");
+
+ TH2* posYX = dynamic_cast<TH2*> (gROOT->FindObject("gene_nTrackToNPart_yx_div_meas_nTrackToNPart_yx")->Clone("pos_yx"));
+ TH2* posZX = dynamic_cast<TH2*> (gROOT->FindObject("gene_nTrackToNPart_zx_div_meas_nTrackToNPart_zx")->Clone("pos_zx"));
+ TH2* posZY = dynamic_cast<TH2*> (gROOT->FindObject("gene_nTrackToNPart_zy_div_meas_nTrackToNPart_zy")->Clone("pos_zy"));
+
+ Track2Particle2DCreatePlots("correction_maponly-negative.root");
+
+ TH2* negYX = dynamic_cast<TH2*> (gROOT->FindObject("gene_nTrackToNPart_yx_div_meas_nTrackToNPart_yx")->Clone("neg_yx"));
+ TH2* negZX = dynamic_cast<TH2*> (gROOT->FindObject("gene_nTrackToNPart_zx_div_meas_nTrackToNPart_zx")->Clone("neg_zx"));
+ TH2* negZY = dynamic_cast<TH2*> (gROOT->FindObject("gene_nTrackToNPart_zy_div_meas_nTrackToNPart_zy")->Clone("neg_zy"));
+
+ posYX->Divide(negYX);
+ posZX->Divide(negZX);
+ posZY->Divide(negZY);
+
+ Prepare2DPlot(posYX);
+ Prepare2DPlot(posZX);
+ Prepare2DPlot(posZY);
+
+ Float_t min = 0.8;
+ Float_t max = 1.2;
+
+ posYX->SetMinimum(min);
+ posYX->SetMaximum(max);
+ posZX->SetMinimum(min);
+ posZX->SetMaximum(max);
+ posZY->SetMinimum(min);
+ posZY->SetMaximum(max);
+
+ TCanvas* canvas = new TCanvas("CompareTrack2Particle2D", "CompareTrack2Particle2D", 1200, 400);
+ canvas->Divide(3, 1);
+
+ canvas->cd(1);
+ InitPadCOLZ();
+ posYX->Draw("COLZ");
+
+ canvas->cd(2);
+ InitPadCOLZ();
+ posZX->Draw("COLZ");
+
+ canvas->cd(3);
+ InitPadCOLZ();
+ posZY->Draw("COLZ");
+
+ canvas->SaveAs("CompareTrack2Particle2D.gif");
+ canvas->SaveAs("CompareTrack2Particle2D.eps");
}
void Track2Particle3D()
corr->Draw();
canvas->SaveAs("Track2Particle3D.gif");
+ canvas->SaveAs("Track2Particle3D.eps");
}
void Track2Particle3DAll()
corr->Draw();
canvas->SaveAs("Track2Particle3DAll.gif");
+ canvas->SaveAs("Track2Particle3DAll.eps");
}
-void SetRanges(TH1* hist)
-{
- SetRanges(hist->GetXaxis());
- SetRanges(hist->GetYaxis());
- SetRanges(hist->GetZaxis());
-}
-
-void SetRanges(TAxis* axis)
-{
- if (strcmp(axis->GetTitle(), "#eta") == 0)
- axis->SetRangeUser(-1.7999, 1.7999);
- if (strcmp(axis->GetTitle(), "p_{T} [GeV/c]") == 0)
- axis->SetRangeUser(0, 9.9999);
- if (strcmp(axis->GetTitle(), "vtx z [cm]") == 0)
- axis->SetRangeUser(-15, 14.9999);
- if (strcmp(axis->GetTitle(), "Ntracks") == 0)
- axis->SetRangeUser(0, 99.9999);
-}
-
-void Prepare3DPlot(TH3* hist)
-{
- hist->GetXaxis()->SetTitleOffset(1.5);
- hist->GetYaxis()->SetTitleOffset(1.5);
- hist->GetZaxis()->SetTitleOffset(1.5);
-
- hist->SetStats(kFALSE);
-}
-
-void Prepare2DPlot(TH2* hist)
-{
- hist->SetStats(kFALSE);
- hist->GetYaxis()->SetTitleOffset(1.4);
-
- hist->SetMinimum(0);
- hist->SetMaximum(gMax);
-
- SetRanges(hist);
-}
-
-void Prepare1DPlot(TH1* hist)
-{
- hist->SetLineWidth(2);
- hist->SetStats(kFALSE);
-}
-
-void InitPad()
+void drawPlots(Int_t max)
{
- gPad->Range(0, 0, 1, 1);
- gPad->SetLeftMargin(0.15);
- //gPad->SetRightMargin(0.05);
- //gPad->SetTopMargin(0.13);
- //gPad->SetBottomMargin(0.1);
+ gMax = max;
- //gPad->SetGridx();
- //gPad->SetGridy();
+ ptCutoff();
+ TriggerBias();
+ VtxRecon();
+ Track2Particle2D();
+ Track2Particle3D();
+ ptSpectrum();
+ dNdEta();
}
-void InitPadCOLZ()
+void drawPlots()
{
- gPad->Range(0, 0, 1, 1);
- gPad->SetRightMargin(0.15);
- gPad->SetLeftMargin(0.12);
-
- gPad->SetGridx();
- gPad->SetGridy();
+ drawPlots(5);
+ drawPlots(2);
}
gSystem->Load("libPWG0base");
gSystem->Load("libPWG0dep");
- TChain* chain = CreateESDChainFromDir(dataDir, nRuns, offset);
+ TChain* chain = CreateESDChain(dataDir, nRuns, offset);
fEsdTrackCuts = new AliESDtrackCuts();
fEsdTrackCuts->DefineHistograms(1);
--- /dev/null
+/* $Id$ */
+
+//
+// script to run the AliMultiplicityESDSelector
+//
+
+#include "../CreateESDChain.C"
+
+void runMultiplicitySelector(Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aMC = kFALSE, Bool_t aDebug = kFALSE, Bool_t aProof = kFALSE)
+{
+ /*gSystem->Load("libEG");
+ gSystem->Load("libGeom");
+ gSystem->Load("libESD");*/
+ gSystem->cd("ESD");
+ gROOT->ProcessLine(".x PROOF-INF/SETUP.C");
+ gSystem->cd("..");
+ gSystem->cd("PWG0base");
+ gROOT->ProcessLine(".x PROOF-INF/SETUP.C");
+ gSystem->cd("..");
+ //gSystem->Load("libPWG0base");
+ if (aMC != kFALSE)
+ gSystem->Load("libPWG0dep");
+
+ gROOT->ProcessLine(".L CreatedNdEta.C");
+ gROOT->ProcessLine(".L CreateCuts.C");
+ gROOT->ProcessLine(".L drawPlots.C");
+
+ TChain* chain = CreateESDChain(data, nRuns, offset);
+ TVirtualProof* proof = 0;
+
+ if (aProof != kFALSE)
+ {
+ proof = TProof::Open("jgrosseo@lxb6043");
+
+ if (!proof)
+ {
+ printf("ERROR: PROOF connection not established.\n");
+ return;
+ }
+
+ if (proof->EnablePackage("ESD"))
+ {
+ printf("ERROR: ESD package could not be enabled.\n");
+ return;
+ }
+
+ if (proof->EnablePackage("PWG0base"))
+ {
+ printf("ERROR: PWG0base package could not be enabled.\n");
+ return;
+ }
+
+ if (aMC != kFALSE)
+ {
+ if (proof->EnablePackage("PWG0dep"))
+ {
+ printf("ERROR: PWG0dep package could not be enabled.\n");
+ return;
+ }
+ }
+
+ //chain->SetProof(proof);
+ }
+
+ // ########################################################
+ // selection of esd tracks
+ AliESDtrackCuts* esdTrackCuts = CreateTrackCuts();
+ if (!esdTrackCuts)
+ {
+ printf("ERROR: esdTrackCuts could not be created\n");
+ return;
+ }
+
+ chain->GetUserInfo()->Add(esdTrackCuts);
+ if (proof)
+ proof->AddInput(esdTrackCuts);
+
+ TString selectorName = ((aMC == kFALSE) ? "AliMultiplicityESDSelector" : "AliMultiplicityMCSelector");
+ AliLog::SetClassDebugLevel(selectorName, AliLog::kInfo);
+
+ selectorName += ".cxx++";
+
+ if (aDebug != kFALSE)
+ selectorName += "g";
+
+ TStopwatch timer;
+ timer.Start();
+
+ Long64_t result = -1;
+
+ if (proof != kFALSE)
+ result = chain->MakeTDSet()->Process(selectorName);
+ else
+ result = chain->Process(selectorName);
+
+ if (result != 0)
+ {
+ printf("ERROR: Executing process failed with %d.\n", result);
+ return;
+ }
+
+ timer.Stop();
+ timer.Print();
+}
+
gSystem->Load("libPWG0base");
gSystem->Load("libPWG0dep");
- TChain* chain = CreateESDChainFromDir(dataDir, nRuns, offset);
+ TChain* chain = CreateESDChain(dataDir, nRuns, offset);
TString selectorName = "AlidNdEtaVertexRecEffSelector";
HDRS = dNdEta/AlidNdEtaCorrectionSelector.h \
dNdEta/AlidNdEtaAnalysisMCSelector.h \
dNdEta/AlidNdEtaAnalysisESDSelector.h \
- dNdEta/AlidNdEtaVertexRecEffSelector.h
+ dNdEta/AlidNdEtaVertexRecEffSelector.h \
+ dNdEta/AliMultiplicityESDSelector.h
SRCS = $(HDRS:.h=.cxx)
gSystem->Load("libESD");
gSystem->Load("libPWG0base");
- // create chain, CreateESDChainFromDir() is defined in CreateESDChain.C
- TChain* chain = CreateESDChainFromDir(dataDir, nRuns, offset);
+ // create chain, CreateESDChain() is defined in CreateESDChain.C
+ TChain* chain = CreateESDChain(dataDir, nRuns, offset);
// enable debugging
AliLog::SetClassDebugLevel("AliSelector", AliLog::kInfo);