#include <AliLog.h>
#include <AliESD.h>
-#include <AliHeader.h>
ClassImp(AliSelector)
AliSelector::AliSelector() :
TSelector(),
- fChain(0),
+ fTree(0),
fESD(0),
fCountFiles(0),
- fKineFile(0),
- fHeaderFile(0),
- fHeaderTree(0),
- fHeader(0)
+ fKineFile(0)
{
//
// Constructor. Initialization of pointers
//
+
+ AliLog::SetClassDebugLevel("AliSelector", AliLog::kDebug);
}
AliSelector::~AliSelector()
// list is deleted by the TSelector dtor
}
-void AliSelector::Begin(TTree *)
+void AliSelector::Begin(TTree*)
{
// The Begin() function is called at the start of the query.
// When running with PROOF Begin() is only called on the client.
// The tree argument is deprecated (on PROOF 0 is passed).
}
-void AliSelector::SlaveBegin(TTree * tree)
+void AliSelector::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).
- Init(tree);
-
AliDebug(AliLog::kDebug, "=======SLAVEBEGIN========");
AliDebug(AliLog::kDebug, Form("Hostname: %s", gSystem->HostName()));
AliDebug(AliLog::kDebug, Form("Time: %s", gSystem->Now().AsString()));
- TString option = GetOption();
+ if (tree != 0)
+ Init(tree);
}
void AliSelector::Init(TTree *tree)
AliDebug(AliLog::kDebug, "=========Init==========");
- // Set branch addresses
- if (tree == 0)
- {
- AliDebug(AliLog::kError, "ERROR: tree argument is 0.");
- return;
- }
+ fTree = tree;
- fChain = dynamic_cast<TChain*> (tree);
- if (fChain == 0)
+ if (fTree == 0)
{
- AliDebug(AliLog::kDebug, "ERROR: tree argument could not be casted to TChain.");
+ AliDebug(AliLog::kError, "ERROR: tree argument is 0.");
return;
}
- fChain->SetBranchAddress("ESD", &fESD);
+ // Set branch address
+ fTree->SetBranchAddress("ESD", &fESD);
if (fESD != 0)
AliDebug(AliLog::kInfo, "INFO: Found ESD branch in chain.");
-
- /*fChain->SetBranchAddress("Header", &fHeader);
- if (fHeader != 0)
- AliDebug(AliLog::kInfo, "INFO: Found event header branch in chain.");*/
}
Bool_t AliSelector::Notify()
AliDebug(AliLog::kDebug, Form("Time: %s", gSystem->Now().AsString()));
++fCountFiles;
- TFile *f = fChain->GetCurrentFile();
- AliDebug(AliLog::kInfo, Form("Processing %d. file %s", fCountFiles, f->GetName()));
+ if (fTree)
+ {
+ TFile *f = fTree->GetCurrentFile();
+ AliDebug(AliLog::kInfo, Form("Processing %d. file %s", fCountFiles, f->GetName()));
+ }
+ else
+ {
+ AliDebug(AliLog::kError, "fTree not available");
+ }
DeleteKinematicsFile();
- DeleteHeaderFile();
return kTRUE;
}
// 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 fChain is the pointer to the TChain being processed,
- // use fChain->GetTree()->GetEntry(entry).
+ // Assuming that fTree is the pointer to the TChain being processed,
+ // use fTree->GetTree()->GetEntry(entry).
AliDebug(AliLog::kDebug, Form("=========PROCESS========== Entry %lld", entry));
- if (!fChain)
+ if (!fTree)
{
- AliDebug(AliLog::kError, "ERROR: fChain is 0.");
+ AliDebug(AliLog::kError, "ERROR: fTree is 0.");
return kFALSE;
}
- fChain->GetTree()->GetEntry(entry);
+ fTree->GetTree()->GetEntry(entry);
/*
// debugging
// on each slave server.
DeleteKinematicsFile();
- DeleteHeaderFile();
}
void AliSelector::Terminate()
TTree* AliSelector::GetKinematics()
{
- // Returns kinematics tree corresponding to current ESD active in fChain
+ // Returns kinematics tree corresponding to current ESD active in fTree
// Loads the kinematics from the kinematics file, the file is identified by replacing "AliESDs" to
// "Kinematics" in the file path of the ESD file. This is a hack, to be changed!
if (!fKineFile)
{
- if (!fChain->GetCurrentFile())
+ if (!fTree->GetCurrentFile())
return 0;
- TString fileName(fChain->GetCurrentFile()->GetName());
+ TString fileName(fTree->GetCurrentFile()->GetName());
fileName.ReplaceAll("AliESDs", "Kinematics");
AliDebug(AliLog::kInfo, Form("Opening %s", fileName.Data()));
return 0;
}
- return dynamic_cast<TTree*> (fKineFile->Get(Form("Event%d/TreeK", fChain->GetTree()->GetReadEntry())));
+ return dynamic_cast<TTree*> (fKineFile->Get(Form("Event%d/TreeK", fTree->GetTree()->GetReadEntry())));
}
void AliSelector::DeleteKinematicsFile()
}
}
-AliHeader* AliSelector::GetHeader()
-{
- // Returns header corresponding to current ESD active in fChain
- // Loads the header from galice.root, the file is identified by replacing "AliESDs" to
- // "galice" in the file path of the ESD file. This is a hack, to be changed!
-
- if (!fHeaderFile || !fHeaderTree)
- {
- if (!fChain->GetCurrentFile())
- return 0;
-
- TString fileName(fChain->GetCurrentFile()->GetName());
- fileName.ReplaceAll("AliESDs", "galice");
-
- AliDebug(AliLog::kInfo, Form("Opening %s", fileName.Data()));
-
- fHeaderFile = TFile::Open(fileName);
- if (!fHeaderFile)
- return 0;
-
- fHeaderTree = dynamic_cast<TTree*> (fHeaderFile->Get("TE"));
- if (!fHeaderTree)
- return 0;
-
- fHeaderTree->SetBranchAddress("Header", &fHeader);
- }
-
- fHeaderTree->GetEntry(fChain->GetTree()->GetReadEntry());
-
- return fHeader;
-}
-
-void AliSelector::DeleteHeaderFile()
-{
- //
- // Closes the kinematics file and deletes the pointer.
- //
-
- if (fHeaderFile)
- {
- fHeaderFile->Close();
- delete fHeaderFile;
- fHeaderTree = 0;
- fHeader = 0;
- }
-}
-
Bool_t AliSelector::IsPrimaryCharged(TParticle* aParticle, Int_t aTotalPrimaries) const
{
//
class TParticle;
class AliESD;
-class AliHeader;
class AliSelector : public TSelector {
public:
virtual ~AliSelector();
virtual Int_t Version() const {return 1;}
- virtual void Begin(TTree *tree);
- virtual void SlaveBegin(TTree *tree);
+ virtual void Begin(TTree*);
+ virtual void SlaveBegin(TTree* tree);
virtual void Init(TTree *tree);
virtual Bool_t Notify();
virtual Bool_t Process(Long64_t entry);
protected:
TTree* GetKinematics();
- AliHeader* GetHeader();
Bool_t IsPrimaryCharged(TParticle* aParticle, Int_t aTotalPrimaries) const;
- TChain *fChain; //! pointer to the analyzed TTree or TChain
-
+ TTree *fTree; //! pointer to the TTree containing the events
AliESD* fESD; //! "ESD" branch in fChain
-
Int_t fCountFiles; // number of processed file
private:
void DeleteKinematicsFile();
- void DeleteHeaderFile();
TFile* fKineFile; //! pointer to Kinematics.root if the file was opened
- TFile* fHeaderFile; //! pointer to galice.root, if the file was opened
- TTree* fHeaderTree; //! holds TE tree of current galice.root
- AliHeader* fHeader; //! holds pointer to current header
-
ClassDef(AliSelector,0);
};
#include <AliLog.h>
#include <AliRunLoader.h>
+#include <AliHeader.h>
#include <TChain.h>
#include <TFile.h>
AliSelectorRL::AliSelectorRL() :
AliSelector(),
- fRunLoader(0)
+ fRunLoader(0),
+ fHeaderFile(0),
+ fHeaderTree(0),
+ fHeader(0)
{
//
// Constructor. Initialization of pointers
return kFALSE;
DeleteRunLoader();
+ DeleteHeaderFile();
return kTRUE;
}
AliSelector::SlaveTerminate();
DeleteRunLoader();
+ DeleteHeaderFile();
}
AliRunLoader* AliSelectorRL::GetAliRunLoader()
{
- // Returns AliRun instance corresponding to current ESD active in fChain
+ // Returns AliRun instance corresponding to current ESD active in fTree
// Loads galice.root, the file is identified by replacing "AliESDs" to
// "galice" in the file path of the ESD file. This is a hack, to be changed!
if (!fRunLoader)
{
- if (!fChain->GetCurrentFile())
+ if (!fTree->GetCurrentFile())
return 0;
- TString fileName(fChain->GetCurrentFile()->GetName());
+ TString fileName(fTree->GetCurrentFile()->GetName());
fileName.ReplaceAll("AliESDs", "galice");
fRunLoader = AliRunLoader::Open(fileName);
fRunLoader = 0;
}
}
+
+AliHeader* AliSelectorRL::GetHeader()
+{
+ // Returns header corresponding to current ESD active in fTree
+ // Loads the header from galice.root, the file is identified by replacing "AliESDs" to
+ // "galice" in the file path of the ESD file. This is a hack, to be changed!
+
+ if (!fHeaderFile || !fHeaderTree)
+ {
+ if (!fTree->GetCurrentFile())
+ return 0;
+
+ TString fileName(fTree->GetCurrentFile()->GetName());
+ fileName.ReplaceAll("AliESDs", "galice");
+
+ AliDebug(AliLog::kInfo, Form("Opening %s", fileName.Data()));
+
+ fHeaderFile = TFile::Open(fileName);
+ if (!fHeaderFile)
+ return 0;
+
+ fHeaderTree = dynamic_cast<TTree*> (fHeaderFile->Get("TE"));
+ if (!fHeaderTree)
+ return 0;
+
+ fHeaderTree->SetBranchAddress("Header", &fHeader);
+ }
+
+ fHeaderTree->GetEntry(fTree->GetTree()->GetReadEntry());
+
+ return fHeader;
+}
+
+void AliSelectorRL::DeleteHeaderFile()
+{
+ //
+ // Closes the kinematics file and deletes the pointer.
+ //
+
+ if (fHeaderFile)
+ {
+ fHeaderFile->Close();
+ delete fHeaderFile;
+ fHeaderTree = 0;
+ fHeader = 0;
+ }
+}
#include "AliSelector.h"
class AliRunLoader;
+class AliHeader;
class AliSelectorRL : public AliSelector {
public:
protected:
AliRunLoader* GetAliRunLoader();
+ AliHeader* GetHeader();
private:
void DeleteRunLoader();
+ void DeleteHeaderFile();
+
AliRunLoader* fRunLoader; //! pointer to the RunLoader if galice.root was opened
+ TFile* fHeaderFile; //! pointer to galice.root, if the file was opened
+ TTree* fHeaderTree; //! holds TE tree of current galice.root
+ AliHeader* fHeader; //! holds pointer to current header
+
ClassDef(AliSelectorRL,0);
};
return chain;
}
-TChain* CreateESDChainFromList(const char* listFile, Int_t aRuns = 20)
+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
in >> esdfile;
if (!esdfile.Contains("root")) continue; // protection
+ if (offset > 0)
+ {
+ --offset;
+ continue;
+ }
+
if (count++ == aRuns)
break;
PACKAGE = PWG0base
+default-target: libPWG0base.so
+
include $(ROOTSYS)/test/Makefile.arch
include lib$(PACKAGE).pkg
ifneq ($(ALICE_ROOT),)
ALICEINC += -I$(ALICE_ROOT)/include
else
- ifneq ($(STEER_INCLUDE),)
- ALICEINC += -I../$(STEER_INCLUDE)
- endif
ifneq ($(ESD_INCLUDE),)
ALICEINC += -I../$(ESD_INCLUDE)
endif
endif
-CXXFLAGS += $(ALICEINC)
+CXXFLAGS += $(ALICEINC) -g
SRCS += dict.cxx
OBJS = $(SRCS:.cxx=.o)
PARFILE = $(PACKAGE).par
void SETUP()
{
+ gSystem->Load("libPWG0base");
+
// Set the Inlucde paths
gSystem->SetIncludePath("-I$ROOTSYS/include -IPWG0base");
gROOT->ProcessLine(".include PWG0base");
#pragma link off all functions;
#pragma link C++ class AliSelector+;
-#pragma link C++ class AliSelectorRL+;
-#pragma link C++ class AlidNdEtaAnalysisSelector+;
#pragma link C++ class dNdEtaAnalysis+;
#pragma link C++ class dNdEtaCorrection+;
--- /dev/null
+#ifdef __CINT__
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ class AliSelectorRL+;
+
+#endif
#include <TCanvas.h>
#include <TVector3.h>
#include <TChain.h>
+#include <TFile.h>
#include <AliLog.h>
#include <AliESDVertex.h>
#include <AliESD.h>
#include "esdTrackCuts/AliESDtrackCuts.h"
-#include "dNdEtaAnalysis.h"
+#include "dNdEta/dNdEtaAnalysis.h"
ClassImp(AlidNdEtaAnalysisESDSelector)
AlidNdEtaAnalysisESDSelector::AlidNdEtaAnalysisESDSelector() :
- AlidNdEtaAnalysisSelector(),
+ AliSelector(),
fEsdTrackCuts(0)
{
//
// Constructor. Initialization of pointers
//
+
+ AliLog::SetClassDebugLevel("AlidNdEtaAnalysisESDSelector", AliLog::kDebug);
}
AlidNdEtaAnalysisESDSelector::~AlidNdEtaAnalysisESDSelector()
// list is deleted by the TSelector dtor
}
-void AlidNdEtaAnalysisESDSelector::SlaveBegin(TTree * tree)
+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).
- AlidNdEtaAnalysisSelector::SlaveBegin(tree);
+ AliSelector::SlaveBegin(tree);
- if (fChain)
+ if (fInput)
{
- fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (fChain->GetUserInfo()->FindObject("AliESDtrackCuts"));
+ printf("Printing input list:\n");
+ fInput->Print();
}
+ if (!fEsdTrackCuts && fInput)
+ fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (fInput->FindObject("AliESDtrackCuts"));
+
+ if (!fEsdTrackCuts)
+ AliDebug(AliLog::kError, "ERROR: Could not read EsdTrackCuts from input list.");
+
+ fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
+}
+
+void AlidNdEtaAnalysisESDSelector::Init(TTree* tree)
+{
+ // read the user objects
+
+ AliSelector::Init(tree);
+
+ if (!fEsdTrackCuts && fTree)
+ fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (fTree->GetUserInfo()->FindObject("AliESDtrackCuts"));
+
if (!fEsdTrackCuts)
AliDebug(AliLog::kError, "ERROR: Could not read EsdTrackCuts from user info.");
}
// 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 fChain is the pointer to the TChain being processed,
- // use fChain->GetTree()->GetEntry(entry).
+ // Assuming that fTree is the pointer to the TChain being processed,
+ // use fTree->GetTree()->GetEntry(entry).
- if (AlidNdEtaAnalysisSelector::Process(entry) == kFALSE)
+ if (AliSelector::Process(entry) == kFALSE)
return kFALSE;
// Check prerequisites
return kTRUE;
}
-void AlidNdEtaAnalysisESDSelector::WriteObjects()
+void AlidNdEtaAnalysisESDSelector::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(fdNdEtaAnalysis);
+}
+
+void AlidNdEtaAnalysisESDSelector::Terminate()
{
- AlidNdEtaAnalysisSelector::WriteObjects();
+ // 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();
+
+ fdNdEtaAnalysis = dynamic_cast<dNdEtaAnalysis*> (fOutput->FindObject("dndeta"));
+
+ if (!fdNdEtaAnalysis)
+ {
+ AliDebug(AliLog::kError, Form("ERROR: Histograms not available %p", (void*) fdNdEtaAnalysis));
+ return;
+ }
+
+ TFile* fout = new TFile("analysis_esd.root","RECREATE");
+
+ if (fdNdEtaAnalysis)
+ fdNdEtaAnalysis->SaveHistograms();
if (fEsdTrackCuts)
fEsdTrackCuts->SaveHistograms("esd_tracks_cuts");
+
+ fout->Write();
+ fout->Close();
}
#ifndef ALIDNDETAANALYSISESDSELECTOR_H
#define ALIDNDETAANALYSISESDSELECTOR_H
-#include "AlidNdEtaAnalysisSelector.h"
+#include "AliSelectorRL.h"
class AliESDtrackCuts;
+class dNdEtaAnalysis;
-class AlidNdEtaAnalysisESDSelector : public AlidNdEtaAnalysisSelector {
+class AlidNdEtaAnalysisESDSelector : public AliSelector {
public:
AlidNdEtaAnalysisESDSelector();
virtual ~AlidNdEtaAnalysisESDSelector();
virtual void SlaveBegin(TTree *tree);
+ virtual void Init(TTree *tree);
virtual Bool_t Process(Long64_t entry);
+ virtual void SlaveTerminate();
+ virtual void Terminate();
protected:
- virtual void WriteObjects();
-
+ dNdEtaAnalysis* fdNdEtaAnalysis; // contains the target histograms
AliESDtrackCuts* fEsdTrackCuts; // Object containing the parameters of the esd track cuts
private:
#include <TH1F.h>
#include <TH3F.h>
#include <TTree.h>
+#include <TFile.h>
#include <AliLog.h>
#include <AliGenEventHeader.h>
#include <AliHeader.h>
-#include "dNdEtaAnalysis.h"
+#include "dNdEta/dNdEtaAnalysis.h"
ClassImp(AlidNdEtaAnalysisMCSelector)
AlidNdEtaAnalysisMCSelector::AlidNdEtaAnalysisMCSelector() :
- AlidNdEtaAnalysisSelector(),
+ AliSelectorRL(),
+ fdNdEtaAnalysis(0),
fVertex(0),
fPartEta(0),
fEvents(0)
//
}
+void AlidNdEtaAnalysisMCSelector::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).
+
+ AliSelectorRL::SlaveBegin(tree);
+
+ fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
+}
+
void AlidNdEtaAnalysisMCSelector::Init(TTree *tree)
{
- AlidNdEtaAnalysisSelector::Init(tree);
+ AliSelectorRL::Init(tree);
tree->SetBranchStatus("ESD", 0);
Bool_t AlidNdEtaAnalysisMCSelector::Process(Long64_t entry)
{
- //
+ // fill the dNdEtaAnalysis class from the monte carlo
- if (AliSelector::Process(entry) == kFALSE)
+ if (AliSelectorRL::Process(entry) == kFALSE)
return kFALSE;
TTree* particleTree = GetKinematics();
return kTRUE;
}
+void AlidNdEtaAnalysisMCSelector::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.
+
+ AliSelectorRL::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(fdNdEtaAnalysis);
+}
+
void AlidNdEtaAnalysisMCSelector::Terminate()
{
- AlidNdEtaAnalysisSelector::Terminate();
+ //
+
+ AliSelectorRL::Terminate();
+
+ fdNdEtaAnalysis = dynamic_cast<dNdEtaAnalysis*> (fOutput->FindObject("dndeta"));
+
+ if (!fdNdEtaAnalysis)
+ {
+ AliDebug(AliLog::kError, Form("ERROR: Histograms not available %p", (void*) fdNdEtaAnalysis));
+ return;
+ }
+
+ TFile* fout = new TFile("analysis_mc.root","RECREATE");
+
+ fdNdEtaAnalysis->SaveHistograms();
+
+ fout->Write();
+ fout->Close();
fPartEta->Scale(1.0/fEvents);
fPartEta->Scale(1.0/fPartEta->GetBinWidth(1));
#ifndef ALIDNDETAANALYSISSELECTORMC_H
#define ALIDNDETAANALYSISSELECTORMC_H
-#include "AlidNdEtaAnalysisSelector.h"
+#include "AliSelectorRL.h"
class TH3F;
class TH1F;
+class dNdEtaAnalysis;
-class AlidNdEtaAnalysisMCSelector : public AlidNdEtaAnalysisSelector {
+class AlidNdEtaAnalysisMCSelector : public AliSelectorRL {
public:
AlidNdEtaAnalysisMCSelector();
virtual ~AlidNdEtaAnalysisMCSelector();
+ virtual void SlaveBegin(TTree *tree);
+ virtual void SlaveTerminate();
virtual void Init(TTree *tree);
virtual Bool_t Process(Long64_t entry);
virtual void Terminate();
protected:
private:
+ dNdEtaAnalysis* fdNdEtaAnalysis; // contains the intermediate histograms (on each slave)
+
TH3F* fVertex; //! vertex of counted particles
TH1F* fPartEta; //! counted particles as function of eta
Int_t fEvents; //! number of processed events
+++ /dev/null
-/* $Id$ */
-
-#include "AlidNdEtaAnalysisSelector.h"
-
-#include <TStyle.h>
-#include <TSystem.h>
-#include <TCanvas.h>
-#include <TVector3.h>
-#include <TH2F.h>
-#include <TChain.h>
-#include <TFile.h>
-
-#include <AliLog.h>
-#include <AliGenEventHeader.h>
-#include <AliHeader.h>
-
-#include "dNdEtaAnalysis.h"
-
-ClassImp(AlidNdEtaAnalysisSelector)
-
-AlidNdEtaAnalysisSelector::AlidNdEtaAnalysisSelector() :
- AliSelector(),
- fdNdEtaAnalysis(0)
-{
- //
- // Constructor. Initialization of pointers
- //
-}
-
-AlidNdEtaAnalysisSelector::~AlidNdEtaAnalysisSelector()
-{
- //
- // Destructor
- //
-
- // histograms are in the output list and deleted when the output
- // list is deleted by the TSelector dtor
-}
-
-void AlidNdEtaAnalysisSelector::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);
-
- fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
-}
-
-void AlidNdEtaAnalysisSelector::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(fdNdEtaAnalysis);
-}
-
-void AlidNdEtaAnalysisSelector::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();
-
- fdNdEtaAnalysis = dynamic_cast<dNdEtaAnalysis*> (fOutput->FindObject("dndeta"));
-
- if (!fdNdEtaAnalysis)
- {
- AliDebug(AliLog::kError, Form("ERROR: Histograms not available %p", (void*) fdNdEtaAnalysis));
- return;
- }
-
- TFile* fout = new TFile("out.root","RECREATE");
- WriteObjects();
- fout->Write();
- fout->Close();
-}
-
-void AlidNdEtaAnalysisSelector::WriteObjects()
-{
- // Write objects to output file
- // this is an extra function to be overloaded...
- //
-
- fdNdEtaAnalysis->SaveHistograms();
-}
+++ /dev/null
-/* $Id$ */
-
-#ifndef ALIDNDETAANALYSISSELECTOR_H
-#define ALIDNDETAANALYSISSELECTOR_H
-
-#include "AliSelector.h"
-
-class dNdEtaAnalysis;
-class dNdEtaCorrection;
-
-class AlidNdEtaAnalysisSelector : public AliSelector {
- public:
- AlidNdEtaAnalysisSelector();
- virtual ~AlidNdEtaAnalysisSelector();
-
- virtual void SlaveBegin(TTree *tree);
- virtual void SlaveTerminate();
- virtual void Terminate();
-
- protected:
- virtual void WriteObjects();
-
- dNdEtaAnalysis* fdNdEtaAnalysis; // contains the intermediate histograms (on each slave)
- dNdEtaCorrection* fdNdEtaCorrection; // correction map
-
- private:
- ClassDef(AlidNdEtaAnalysisSelector, 0);
-};
-
-#endif
ClassImp(AlidNdEtaCorrectionSelector)
AlidNdEtaCorrectionSelector::AlidNdEtaCorrectionSelector() :
- AliSelector(),
+ AliSelectorRL(),
fEsdTrackCuts(0),
fdNdEtaCorrection(0),
fdNdEtaCorrectionFinal(0)
// When running with PROOF Begin() is only called on the client.
// The tree argument is deprecated (on PROOF 0 is passed).
- AliSelector::Begin(tree);
+ AliSelectorRL::Begin(tree);
}
void AlidNdEtaCorrectionSelector::SlaveBegin(TTree * tree)
// When running with PROOF SlaveBegin() is called on each slave server.
// The tree argument is deprecated (on PROOF 0 is passed).
- AliSelector::SlaveBegin(tree);
+ AliSelectorRL::SlaveBegin(tree);
fdNdEtaCorrection = new dNdEtaCorrection();
- if (fChain)
- fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (fChain->GetUserInfo()->FindObject("AliESDtrackCuts"));
+ if (fTree)
+ fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (fTree->GetUserInfo()->FindObject("AliESDtrackCuts"));
if (!fEsdTrackCuts)
AliDebug(AliLog::kError, "ERROR: Could not read EsdTrackCuts from user info");
// 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 fChain is the pointer to the TChain being processed,
- // use fChain->GetTree()->GetEntry(entry).
+ // Assuming that fTree is the pointer to the TChain being processed,
+ // use fTree->GetTree()->GetEntry(entry).
- if (AliSelector::Process(entry) == kFALSE)
+ if (AliSelectorRL::Process(entry) == kFALSE)
return kFALSE;
// check prerequesites
// have been processed. When running with PROOF SlaveTerminate() is called
// on each slave server.
- AliSelector::SlaveTerminate();
+ AliSelectorRL::SlaveTerminate();
// Add the histograms to the output on each slave server
if (!fOutput)
// 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();
+ AliSelectorRL::Terminate();
fdNdEtaCorrectionFinal = dynamic_cast<dNdEtaCorrection*> (fOutput->FindObject("dndeta_correction"));
#ifndef ALIDNDETACORRECTIONSELECTOR_H
#define ALIDNDETACORRECTIONSELECTOR_H
-#include "AliSelector.h"
+#include "AliSelectorRL.h"
class AliESDtrackCuts;
class dNdEtaCorrection;
-class AlidNdEtaCorrectionSelector : public AliSelector {
+class AlidNdEtaCorrectionSelector : public AliSelectorRL {
public:
AlidNdEtaCorrectionSelector();
virtual ~AlidNdEtaCorrectionSelector();
const Float_t AlidNdEtaVertexRecEffSelector::fkEtaRange = 0.9;
AlidNdEtaVertexRecEffSelector::AlidNdEtaVertexRecEffSelector() :
- AliSelector(),
+ AliSelectorRL(),
fdNGen(0),
fdNRec(0),
fVtxGen(0),
{
// initializes the histograms
- AliSelector::SlaveBegin(tree);
+ AliSelectorRL::SlaveBegin(tree);
fdNGen = new TH1F("dNGen", "dNGen", 90, 0, 50);
fdNRec = dynamic_cast<TH1F*>(fdNGen->Clone("dNRec"));
// fills fdNGen and fdNRec
//
- if (AliSelector::Process(entry) == kFALSE)
+ if (AliSelectorRL::Process(entry) == kFALSE)
return kFALSE;
// check prerequisites
// have been processed. When running with PROOF SlaveTerminate() is called
// on each slave server.
- AliSelector::SlaveTerminate();
+ AliSelectorRL::SlaveTerminate();
// Add the histograms to the output on each slave server
if (!fOutput)
// 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();
+ AliSelectorRL::Terminate();
if (!fOutput)
{
// This class plots the vertex reconstruction efficiency
-#include "AliSelector.h"
+#include "AliSelectorRL.h"
class TH1F;
-class AlidNdEtaVertexRecEffSelector : public AliSelector {
+class AlidNdEtaVertexRecEffSelector : public AliSelectorRL {
public:
AlidNdEtaVertexRecEffSelector();
virtual ~AlidNdEtaVertexRecEffSelector();
--- /dev/null
+/* $Id$ */
+
+// this macro creates the track and event cuts used in this analysis
+
+AliESDtrackCuts* CreateTrackCuts()
+{
+ AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts();
+ esdTrackCuts->DefineHistograms(1);
+
+ esdTrackCuts->SetMinNClustersTPC(50);
+ esdTrackCuts->SetMaxChi2PerClusterTPC(3.5);
+ esdTrackCuts->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
+ esdTrackCuts->SetRequireTPCRefit(kTRUE);
+
+ esdTrackCuts->SetMinNsigmaToVertex(3);
+ esdTrackCuts->SetAcceptKingDaughters(kFALSE);
+
+ return esdTrackCuts;
+}
fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
- TFile::Open("out.root");
+ TFile* file = TFile::Open("out.root");
+ if (!file)
+ {
+ cout << "Error. File out.root not found" << endl;
+ return;
+ }
fdNdEtaAnalysis->LoadHistograms();
fdNdEtaAnalysis->Finish(dNdEtaCorrection);
//____________________________________________________________________
dNdEtaAnalysis::dNdEtaAnalysis(Char_t* name, Char_t* title) :
-TNamed(name, title)
+ TNamed(name, title),
+ fEtaVsVtx(0),
+ fEtaVsVtxUncorrected(0),
+ fVtx(0)
{
// constructor
fVtx->Sumw2();
}
+//____________________________________________________________________
+dNdEtaAnalysis::~dNdEtaAnalysis()
+{
+ // destructor
+
+ delete fEtaVsVtx;
+ fEtaVsVtx = 0;
+
+ delete fEtaVsVtxUncorrected;
+ fEtaVsVtxUncorrected = 0;
+
+ delete fVtx;
+ fVtx = 0;
+
+ for (Int_t i=0; i<kVertexBinning; ++i)
+ {
+ delete fdNdEta[i];
+ fdNdEta[i] = 0;
+ }
+}
+
+//_____________________________________________________________________________
+dNdEtaAnalysis::dNdEtaAnalysis(const dNdEtaAnalysis &c) :
+ TNamed(c),
+ fEtaVsVtx(0),
+ fEtaVsVtxUncorrected(0),
+ fVtx(0)
+{
+ //
+ // dNdEtaAnalysis copy constructor
+ //
+
+ ((dNdEtaAnalysis &) c).Copy(*this);
+}
+
+//_____________________________________________________________________________
+dNdEtaAnalysis &dNdEtaAnalysis::operator=(const dNdEtaAnalysis &c)
+{
+ //
+ // Assignment operator
+ //
+
+ if (this != &c) ((dNdEtaAnalysis &) c).Copy(*this);
+ return *this;
+}
+
+//_____________________________________________________________________________
+void dNdEtaAnalysis::Copy(TObject &c) const
+{
+ //
+ // Copy function
+ //
+
+ dNdEtaAnalysis& target = (dNdEtaAnalysis &) c;
+
+ target.fEtaVsVtx = dynamic_cast<TH2F*> (fEtaVsVtx->Clone());
+ target.fEtaVsVtxUncorrected = dynamic_cast<TH2F*> (fEtaVsVtxUncorrected->Clone());
+ target.fVtx = dynamic_cast<TH1D*> (fVtx->Clone());
+
+ for (Int_t i=0; i<kVertexBinning; ++i)
+ target.fdNdEta[i] = dynamic_cast<TH1D*> (fdNdEta[i]->Clone());
+
+ TNamed::Copy((TNamed &) c);
+}
+
//____________________________________________________________________
void dNdEtaAnalysis::FillTrack(Float_t vtx, Float_t eta)
{
enum { kVertexBinning = 1+4 }; // the first is for the whole vertex range, the others divide the vertex range
dNdEtaAnalysis(Char_t* name, Char_t* title);
+ virtual ~dNdEtaAnalysis();
+
+ dNdEtaAnalysis(const dNdEtaAnalysis &c);
+ dNdEtaAnalysis &operator=(const dNdEtaAnalysis &c);
+ virtual void Copy(TObject &c) const;
void FillTrack(Float_t vtx, Float_t eta);
void FillEvent(Float_t vtx);
--- /dev/null
+/* $Id$ */
+
+//
+// Script to test the class AlidNdEtaVertexRecEffSelector that creates
+// a vertex reconstruction efficiency plot
+//
+// implementation with TSelector
+//
+
+#include "../CreateESDChain.C"
+
+runVertexRecEff(Char_t* dataDir, Int_t nRuns=20, Int_t offset=0)
+{
+ gSystem->Load("libPWG0base");
+ gSystem->Load("libPWG0dep");
+
+ TChain* chain = CreateESDChainFromDir(dataDir, nRuns, offset);
+
+ TString selectorName = "AlidNdEtaVertexRecEffSelector";
+
+ AliLog::SetClassDebugLevel(selectorName, AliLog::kInfo);
+
+ TStopwatch timer;
+ timer.Start();
+
+ chain->Process(selectorName + ".cxx+");
+
+ timer.Stop();
+ timer.Print();
+}
//
#include "../CreateESDChain.C"
-#include "CreatedNdEta.C"
-testAnalysis2(Char_t* dataDir, Int_t nRuns=20, Int_t offset=0, Bool_t aMC = kFALSE, Bool_t aDebug = kFALSE)
+void testAnalysis2(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->Load("libPWG0base");
+ if (aMC != kFALSE)
+ gSystem->Load("libPWG0dep");
- TChain* chain = CreateESDChainFromDir(dataDir, nRuns, offset);
+ gROOT->ProcessLine(".L CreatedNdEta.C");
+ gROOT->ProcessLine(".L CreateCuts.C");
+
+ TChain* chain = 0;
+ TVirtualProof* proof = 0;
+ if (aProof == kFALSE)
+ chain = CreateESDChainFromDir(data, nRuns, offset);
+ else
+ {
+ chain = CreateESDChainFromList(data, nRuns, offset);
+ proof = gROOT->Proof("alicecaf@lxb6041");
+
+ 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 = new AliESDtrackCuts();
- esdTrackCuts->DefineHistograms(1);
-
- esdTrackCuts->SetMinNClustersTPC(50);
- esdTrackCuts->SetMaxChi2PerClusterTPC(3.5);
- esdTrackCuts->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
- esdTrackCuts->SetRequireTPCRefit(kTRUE);
-
- esdTrackCuts->SetMinNsigmaToVertex(3);
- esdTrackCuts->SetAcceptKingDaughters(kFALSE);
-
- chain->GetUserInfo()->Add(esdTrackCuts);
-
- if (aMC == kFALSE)
+ AliESDtrackCuts* esdTrackCuts = CreateTrackCuts();
+ if (!esdTrackCuts)
{
- dNdEtaCorrection* dNdEtaCorrection = new dNdEtaCorrection();
- dNdEtaCorrection->LoadHistograms("correction_map.root","dndeta_correction");
- dNdEtaCorrection->RemoveEdges(2, 0, 2);
-
- chain->GetUserInfo()->Add(dNdEtaCorrection);
+ printf("ERROR: esdTrackCuts could not be created\n");
+ return;
}
+ chain->GetUserInfo()->Add(esdTrackCuts);
+ if (proof)
+ proof->AddInput(esdTrackCuts);
+
TString selectorName = ((aMC == kFALSE) ? "AlidNdEtaAnalysisESDSelector" : "AlidNdEtaAnalysisMCSelector");
AliLog::SetClassDebugLevel(selectorName, AliLog::kInfo);
- selectorName += ".cxx++";
+ // workaround for a bug in PROOF that only allows header files for .C files
+ // please create symlink from <selector>.cxx to <selector>.C
+ if (proof != kFALSE)
+ selectorName += ".C+";
+ else
+ selectorName += ".cxx+";
+
if (aDebug != kFALSE)
selectorName += "g";
TStopwatch timer;
timer.Start();
- chain->Process(selectorName);
+ Long64_t result = chain->Process(selectorName);
+ if (result != 0)
+ {
+ printf("ERROR: Executing process failed with %d.\n", result);
+ return;
+ }
timer.Stop();
timer.Print();
CreatedNdEta(aMC ? kFALSE : kTRUE);
}
+
# $Id$
HDRS = AliSelector.h \
- AliSelectorRL.h \
- dNdEta/AlidNdEtaAnalysisSelector.h \
dNdEta/dNdEtaAnalysis.h \
dNdEta/dNdEtaCorrection.h \
esdTrackCuts/AliESDtrackCuts.h \
EINCLUDE=
-all-PWG0: all-PWG0base all-PWG0selectors
\ No newline at end of file
+all-PWG0: all-PWG0base all-PWG0selectors all-PWG0dep
--- /dev/null
+# $Id$
+
+# this library contains classed that depend on STEER
+
+HDRS = AliSelectorRL.h
+
+SRCS = $(HDRS:.h=.cxx)
+
+DHDR= PWG0depLinkDef.h
+
+EINCLUDE=