o) AliSelector: Changing the way the header is accessed: Before it was a tree friend, this results in mismatch as soon as one ESD file is corrupt. Now it is accessed similar to the method used for the kinematics tree.
o) Adding second library PWG0selectors, this is only for the build system, because selectors are compiled on-the-fly when they are used in the Process function
o) Analysis now splitted in AnalysisESDSelector and AnalysisMCSelector
+/* $Id$ */
+
// The class definition in esdV0.h has been generated automatically
// by the ROOT utility TTree::MakeSelector(). This class is derived
// from the ROOT class TSelector. For more information on the TSelector
#include <TTime.h>
#include <TParticle.h>
#include <TParticlePDG.h>
+#include <TFriendElement.h>
#include <AliLog.h>
TSelector(),
fChain(0),
fESD(0),
- fHeader(0),
- fKineFile(0)
+ fCountFiles(0),
+ fKineFile(0),
+ fHeaderFile(0),
+ fHeaderTree(0),
+ fHeader(0)
{
//
// Constructor. Initialization of pointers
AliDebug(AliLog::kDebug, "=======SLAVEBEGIN========");
AliDebug(AliLog::kDebug, Form("Hostname: %s", gSystem->HostName()));
AliDebug(AliLog::kDebug, Form("Time: %s", gSystem->Now().AsString()));
- TFile *f = fChain->GetCurrentFile();
- AliDebug(AliLog::kDebug, f->GetName());
TString option = GetOption();
}
if (fESD != 0)
AliDebug(AliLog::kInfo, "INFO: Found ESD branch in chain.");
- fChain->SetBranchAddress("Header", &fHeader);
+ /*fChain->SetBranchAddress("Header", &fHeader);
if (fHeader != 0)
- AliDebug(AliLog::kInfo, "INFO: Found event header branch in chain.");
+ AliDebug(AliLog::kInfo, "INFO: Found event header branch in chain.");*/
}
Bool_t AliSelector::Notify()
AliDebug(AliLog::kDebug, Form("Hostname: %s", gSystem->HostName()));
AliDebug(AliLog::kDebug, Form("Time: %s", gSystem->Now().AsString()));
+ ++fCountFiles;
TFile *f = fChain->GetCurrentFile();
- AliDebug(AliLog::kInfo, Form("Processing file %s", f->GetName()));
+ AliDebug(AliLog::kInfo, Form("Processing %d. file %s", fCountFiles, f->GetName()));
DeleteKinematicsFile();
+ DeleteHeaderFile();
+
+ /*TChain* headerChain = dynamic_cast<TChain*> (((TFriendElement*) fChain->GetListOfFriends()->First())->GetTree());
+ AliDebug(AliLog::kInfo, Form("Header File: %s", headerChain->GetCurrentFile()->GetName()));*/
return kTRUE;
}
fChain->GetTree()->GetEntry(entry);
+ /*
+ // debugging
if (fESD)
AliDebug(AliLog::kDebug, Form("ESD: We have %d tracks.", fESD->GetNumberOfTracks()));
TTree* kinematics = GetKinematics();
if (kinematics)
AliDebug(AliLog::kDebug, Form("Kinematics: We have %lld particles.", kinematics->GetEntries()));
+ */
return kTRUE;
}
// on each slave server.
DeleteKinematicsFile();
+ DeleteHeaderFile();
}
void AliSelector::Terminate()
TString fileName(fChain->GetCurrentFile()->GetName());
fileName.ReplaceAll("AliESDs", "Kinematics");
+ AliDebug(AliLog::kInfo, Form("Opening %s", fileName.Data()));
+
fKineFile = TFile::Open(fileName);
if (!fKineFile)
return 0;
}
}
+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
{
//
// if the particle has a daughter primary, we do not want to count it
if (aParticle->GetFirstDaughter() != -1 && aParticle->GetFirstDaughter() < aTotalPrimaries)
+ {
+ AliDebug(AliLog::kDebug+1, "Dropping particle because it has a daughter among the primaries.");
return kFALSE;
+ }
Int_t pdgCode = TMath::Abs(aParticle->GetPdgCode());
// skip quarks and gluon
if (pdgCode <= 10 || pdgCode == 21)
+ {
+ AliDebug(AliLog::kDebug+1, "Dropping particle because it is a quark or gluon.");
return kFALSE;
+ }
if (strcmp(aParticle->GetName(),"XXX") == 0)
{
}
if (pdgPart->Charge() == 0)
+ {
return kFALSE;
+ AliDebug(AliLog::kDebug+1, "Dropping particle because it is not charged.");
+ }
return kTRUE;
}
+/* $Id$ */
+
#ifndef ALISELECTOR_H
#define ALISELECTOR_H
protected:
TTree* GetKinematics();
+ AliHeader* GetHeader();
Bool_t IsPrimaryCharged(TParticle* aParticle, Int_t aTotalPrimaries) const;
TChain *fChain; //! pointer to the analyzed TTree or TChain
AliESD* fESD; //! "ESD" branch in fChain
- AliHeader* fHeader; //! "TE" branch in fChain, contains event header
+
+ Int_t fCountFiles; // Nr. of current file
private:
void DeleteKinematicsFile();
+ void DeleteHeaderFile();
+
+ TFile* fKineFile; //! pointer to Kinematics.root if the file was opened
- TFile* fKineFile; //! pointer to Kinematics.root if the file was opened
+ TFile* fHeaderFile; //! pointer to galice.root, if the file was opened
+ TTree* fHeaderTree; //!
+ AliHeader* fHeader; //!
ClassDef(AliSelector,0);
};
+/* $Id$ */
+
#include "AliSelectorRL.h"
#include <AliLog.h>
+/* $Id$ */
+
#ifndef ALISELECTORRL_H
#define ALISELECTORRL_H
+/* $Id$ */
+
#include "CorrectionMatrix2D.h"
//____________________________________________________________________
+/* $Id$ */
+
#ifndef CORRECTIONMATRIX2D_H
#define CORRECTIONMATRIX2D_H
-TChain* CreateESDChainFromDir(const char* aDataDir, Int_t aRuns = 20, Bool_t aAddHeader = kTRUE)
+/* $Id$ */
+
+// Helper macros for creating chains
+
+TChain* CreateESDChainFromDir(const char* aDataDir, Int_t aRuns = 20, Int_t offset = 0, Bool_t aAddHeader = kTRUE)
{
+ // creates chain of files in a given directory. The structure is expected as:
+ // <aDataDir>/<dir0>/AliESDs.root
+ // <aDataDir>/<dir0>/galice.root (when <aAddHeader> flag is set)
+ // <aDataDir>/<dir1>/AliESDs.root
+ // <aDataDir>/<dir1>/galice.root (when <aAddHeader> flag is set)
+ // ...
+
if (!aDataDir)
return 0;
if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
continue;
+ if (offset > 0)
+ {
+ --offset;
+ continue;
+ }
+
if (count++ == aRuns)
break;
TChain* CreateESDChainFromList(const char* listFile, Int_t aRuns = 20, Bool_t aAddHeader = kTRUE)
{
+ // Creates a chain from a file which contains a list of ESD files
+ // if <aAddHeader> is set, the filename of the galice.root file is created by replacing
+ // AliESDs to galice in the esd file name
+
if (!listFile)
return 0;
+# $Id$
+
PACKAGE = PWG0base
include $(ROOTSYS)/test/Makefile.arch
#pragma link C++ class AliSelector+;
#pragma link C++ class AliSelectorRL+;
-#pragma link C++ class AlidNdEtaCorrectionSelector+;
#pragma link C++ class AlidNdEtaAnalysisSelector+;
-#pragma link C++ class AlidNdEtaAnalysisMCSelector+;
#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 AlidNdEtaCorrectionSelector+;
+#pragma link C++ class AlidNdEtaAnalysisMCSelector+;
+#pragma link C++ class AlidNdEtaAnalysisESDSelector+;
+
+#endif
--- /dev/null
+/* $Id$ */
+
+#include "AlidNdEtaAnalysisESDSelector.h"
+
+#include <TStyle.h>
+#include <TSystem.h>
+#include <TCanvas.h>
+#include <TVector3.h>
+
+#include <AliLog.h>
+#include <AliGenEventHeader.h>
+
+#include "esdTrackCuts/AliESDtrackCuts.h"
+#include "dNdEtaCorrection.h"
+#include "dNdEtaAnalysis.h"
+
+ClassImp(AlidNdEtaAnalysisESDSelector)
+
+AlidNdEtaAnalysisESDSelector::AlidNdEtaAnalysisESDSelector() :
+ AlidNdEtaAnalysisSelector(),
+ fEsdTrackCuts(0),
+ fdNdEtaCorrection(0)
+{
+ //
+ // Constructor. Initialization of pointers
+ //
+}
+
+AlidNdEtaAnalysisESDSelector::~AlidNdEtaAnalysisESDSelector()
+{
+ //
+ // Destructor
+ //
+
+ // histograms are in the output list and deleted when the output
+ // list is deleted by the TSelector dtor
+}
+
+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);
+
+ if (fChain)
+ {
+ fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (fChain->GetUserInfo()->FindObject("AliESDtrackCuts"));
+ fdNdEtaCorrection = dynamic_cast<dNdEtaCorrection*> (fChain->GetUserInfo()->FindObject("dNdEtaCorrection"));
+ }
+
+ if (!fEsdTrackCuts)
+ AliDebug(AliLog::kError, "ERROR: Could not read EsdTrackCuts from user info.");
+
+ if (!fEsdTrackCuts)
+ AliDebug(AliLog::kError, "ERROR: Could not read dNdEtaCorrection from user info.");
+}
+
+Bool_t AlidNdEtaAnalysisESDSelector::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 fChain is the pointer to the TChain being processed,
+ // use fChain->GetTree()->GetEntry(entry).
+
+ if (AlidNdEtaAnalysisSelector::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;
+ }
+
+ // ########################################################
+ // get the EDS vertex
+ const AliESDVertex* vtxESD = fESD->GetVertex();
+
+ // the vertex should be reconstructed
+ if (strcmp(vtxESD->GetName(),"default")==0)
+ return kTRUE;
+
+ Double_t vtx_res[3];
+ vtx_res[0] = vtxESD->GetXRes();
+ vtx_res[1] = vtxESD->GetYRes();
+ vtx_res[2] = vtxESD->GetZRes();
+
+ // the resolution should be reasonable???
+ if (vtx_res[2]==0 || vtx_res[2]>0.1)
+ return kTRUE;
+
+ Double_t vtx[3];
+ vtxESD->GetXYZ(vtx);
+
+ // ########################################################
+ // loop over esd tracks
+ Int_t nTracks = fESD->GetNumberOfTracks();
+ for (Int_t t=0; t<nTracks; t++)
+ {
+ AliESDtrack* esdTrack = fESD->GetTrack(t);
+ if (!esdTrack)
+ {
+ AliDebug(AliLog::kError, Form("ERROR: Could not retrieve track %d.", t));
+ continue;
+ }
+
+ // cut the esd track?
+ if (!fEsdTrackCuts->AcceptTrack(esdTrack))
+ continue;
+
+ Double_t p[3];
+ esdTrack->GetConstrainedPxPyPz(p); // ### TODO or GetInnerPxPyPy / GetOuterPxPyPy
+ TVector3 vector(p);
+
+ Float_t theta = vector.Theta();
+ Float_t eta = -TMath::Log(TMath::Tan(theta/2.));
+
+ Float_t correction = fdNdEtaCorrection->GetCorrection(vtx[2], eta);
+
+ fdNdEtaAnalysis->FillTrack(vtx[2], eta, correction);
+
+ } // end of track loop
+
+ // for event count per vertex
+ fdNdEtaAnalysis->FillEvent(vtx[2]);
+
+ return kTRUE;
+}
+
+void AlidNdEtaAnalysisESDSelector::WriteObjects()
+{
+ AlidNdEtaAnalysisSelector::WriteObjects();
+
+ if (fEsdTrackCuts)
+ fEsdTrackCuts->SaveHistograms("esd_tracks_cuts");
+
+ if (fdNdEtaCorrection)
+ fdNdEtaCorrection->SaveHistograms();
+}
--- /dev/null
+/* $Id$ */
+
+#ifndef ALIDNDETAANALYSISESDSELECTOR_H
+#define ALIDNDETAANALYSISESDSELECTOR_H
+
+#include "AlidNdEtaAnalysisSelector.h"
+
+class AliESDtrackCuts;
+class dNdEtaCorrection;
+
+class AlidNdEtaAnalysisESDSelector : public AlidNdEtaAnalysisSelector {
+ public:
+ AlidNdEtaAnalysisESDSelector();
+ virtual ~AlidNdEtaAnalysisESDSelector();
+
+ virtual void SlaveBegin(TTree *tree);
+ virtual Bool_t Process(Long64_t entry);
+
+ protected:
+ virtual void WriteObjects();
+
+ AliESDtrackCuts* fEsdTrackCuts; // Object containing the parameters of the esd track cuts
+ dNdEtaCorrection* fdNdEtaCorrection; // correction map
+
+ private:
+
+ ClassDef(AlidNdEtaAnalysisESDSelector, 0);
+};
+
+#endif
+/* $Id$ */
+
#include "AlidNdEtaAnalysisMCSelector.h"
#include <TStyle.h>
#include <TParticle.h>
#include <TParticlePDG.h>
#include <TVector3.h>
+#include <TH3F.h>
#include <AliLog.h>
#include <AliGenEventHeader.h>
#include "dNdEtaAnalysis.h"
+
ClassImp(AlidNdEtaAnalysisMCSelector)
-AlidNdEtaAnalysisMCSelector::AlidNdEtaAnalysisMCSelector(TTree * tree) :
- AlidNdEtaAnalysisSelector(tree)
+AlidNdEtaAnalysisMCSelector::AlidNdEtaAnalysisMCSelector() :
+ AlidNdEtaAnalysisSelector(),
+ fVertex(0)
{
//
// Constructor. Initialization of pointers
AlidNdEtaAnalysisSelector::Init(tree);
tree->SetBranchStatus("ESD", 0);
+
+ fVertex = new TH3F("vertex", "vertex", 50, -50, 50, 50, -50, 50, 50, -50, 50);
}
Bool_t AlidNdEtaAnalysisMCSelector::Process(Long64_t entry)
return kFALSE;
TTree* particleTree = GetKinematics();
- if (!fHeader || !particleTree)
+ if (!particleTree)
+ {
+ AliDebug(AliLog::kError, "Kinematics not available");
return kFALSE;
+ }
+
+ AliHeader* header = GetHeader();
+ if (!header)
+ {
+ AliDebug(AliLog::kError, "Header not available");
+ return kFALSE;
+ }
// get the MC vertex
- AliGenEventHeader* genHeader = fHeader->GenEventHeader();
+ AliGenEventHeader* genHeader = header->GenEventHeader();
TArrayF vtxMC(3);
genHeader->PrimaryVertex(vtxMC);
particleTree->SetBranchStatus("fPx", 1);
particleTree->SetBranchStatus("fPy", 1);
particleTree->SetBranchStatus("fPz", 1);
-
+ particleTree->SetBranchStatus("fVx", 1);
+ particleTree->SetBranchStatus("fVy", 1);
+ particleTree->SetBranchStatus("fVz", 1);
+
TParticle* particle = 0;
particleTree->SetBranchAddress("Particles", &particle);
- Int_t nPrim = fHeader->GetNprimary();
- Int_t nTotal = fHeader->GetNtrack();
+ Int_t nPrim = header->GetNprimary();
+ Int_t nTotal = header->GetNtrack();
for (Int_t i_mc = nTotal - nPrim; i_mc < nTotal; ++i_mc)
{
if (IsPrimaryCharged(particle, nPrim) == kFALSE)
continue;
+ AliDebug(AliLog::kDebug+1, Form("Accepted primary %d, unique ID: %d", i_mc, particle->GetUniqueID()));
+
fdNdEtaAnalysis->FillTrack(vtxMC[2], particle->Eta(), 1);
+ fVertex->Fill(particle->Vx(), particle->Vy(), particle->Vz());
}
fdNdEtaAnalysis->FillEvent(vtxMC[2]);
return kTRUE;
}
+
+void AlidNdEtaAnalysisMCSelector::Terminate()
+{
+ AlidNdEtaAnalysisSelector::Terminate();
+
+ new TCanvas;
+ fVertex->Draw();
+}
+/* $Id$ */
+
#ifndef ALIDNDETAANALYSISSELECTORMC_H
#define ALIDNDETAANALYSISSELECTORMC_H
#include "AlidNdEtaAnalysisSelector.h"
+class TH3F;
+
class AlidNdEtaAnalysisMCSelector : public AlidNdEtaAnalysisSelector {
public:
- AlidNdEtaAnalysisMCSelector(TTree *tree=0);
+ AlidNdEtaAnalysisMCSelector();
virtual ~AlidNdEtaAnalysisMCSelector();
virtual void Init(TTree *tree);
virtual Bool_t Process(Long64_t entry);
+ virtual void Terminate();
protected:
private:
+ TH3F* fVertex;
ClassDef(AlidNdEtaAnalysisMCSelector, 0);
};
+/* $Id$ */
+
#include "AlidNdEtaAnalysisSelector.h"
#include <TStyle.h>
#include <TSystem.h>
#include <TCanvas.h>
#include <TVector3.h>
+#include <TH2F.h>
#include <AliLog.h>
#include <AliGenEventHeader.h>
-#include "esdTrackCuts/AliESDtrackCuts.h"
-#include "dNdEtaCorrection.h"
#include "dNdEtaAnalysis.h"
ClassImp(AlidNdEtaAnalysisSelector)
-AlidNdEtaAnalysisSelector::AlidNdEtaAnalysisSelector(TTree *) :
+AlidNdEtaAnalysisSelector::AlidNdEtaAnalysisSelector() :
AliSelector(),
- fEsdTrackCuts(0),
fdNdEtaAnalysis(0),
- fdNdEtaCorrection(0),
fdNdEtaAnalysisFinal(0)
{
//
AliSelector::SlaveBegin(tree);
fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta");
-
- if (fChain)
- {
- fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (fChain->GetUserInfo()->FindObject("AliESDtrackCuts"));
- fdNdEtaCorrection = dynamic_cast<dNdEtaCorrection*> (fChain->GetUserInfo()->FindObject("dNdEtaCorrection"));
- }
-
- if (!fEsdTrackCuts)
- AliDebug(AliLog::kError, "ERROR: Could not read EsdTrackCuts from user info.");
-
- if (!fEsdTrackCuts)
- AliDebug(AliLog::kWarning, "ERROR: Could not read dNdEtaCorrection from user info.");
-
- AliLog::SetClassDebugLevel("AliESDtrackCuts", 1);
-}
-
-Bool_t AlidNdEtaAnalysisSelector::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 fChain is the pointer to the TChain being processed,
- // use fChain->GetTree()->GetEntry(entry).
-
- if (AliSelector::Process(entry) == kFALSE)
- return kFALSE;
-
- // Check prerequisites
- if (!fESD || !fEsdTrackCuts)
- return kFALSE;
-
- // ########################################################
- // get the EDS vertex
- const AliESDVertex* vtxESD = fESD->GetVertex();
-
- // the vertex should be reconstructed
- if (strcmp(vtxESD->GetName(),"default")==0)
- return kTRUE;
-
- Double_t vtx_res[3];
- vtx_res[0] = vtxESD->GetXRes();
- vtx_res[1] = vtxESD->GetYRes();
- vtx_res[2] = vtxESD->GetZRes();
-
- // the resolution should be reasonable???
- if (vtx_res[2]==0 || vtx_res[2]>0.1)
- return kTRUE;
-
- Double_t vtx[3];
- vtxESD->GetXYZ(vtx);
-
- // ########################################################
- // loop over esd tracks
- Int_t nTracks = fESD->GetNumberOfTracks();
- for (Int_t t=0; t<nTracks; t++)
- {
- AliESDtrack* esdTrack = fESD->GetTrack(t);
- if (!esdTrack)
- {
- AliDebug(AliLog::kError, Form("ERROR: Could not retrieve track %d.", t));
- continue;
- }
-
- // cut the esd track?
- if (!fEsdTrackCuts->AcceptTrack(esdTrack))
- continue;
-
- Double_t p[3];
- esdTrack->GetConstrainedPxPyPz(p); // ### TODO or GetInnerPxPyPy / GetOuterPxPyPy
- TVector3 vector(p);
-
- Float_t theta = vector.Theta();
- Float_t eta = -TMath::Log(TMath::Tan(theta/2.));
-
- Float_t correction = fdNdEtaCorrection->GetCorrection(vtx[2], eta);
-
- fdNdEtaAnalysis->FillTrack(vtx[2], eta, correction);
-
- } // end of track loop
-
- // for event count per vertex
- fdNdEtaAnalysis->FillEvent(vtx[2]);
-
- return kTRUE;
}
void AlidNdEtaAnalysisSelector::SlaveTerminate()
fdNdEtaAnalysisFinal->Finish();
TFile* fout = new TFile("out.root","RECREATE");
-
- if (fEsdTrackCuts)
- fEsdTrackCuts->SaveHistograms("esd_tracks_cuts");
-
- if (fdNdEtaCorrection)
- fdNdEtaCorrection->SaveHistograms();
-
- fdNdEtaAnalysisFinal->SaveHistograms();
-
+ WriteObjects();
fout->Write();
fout->Close();
fdNdEtaAnalysisFinal->DrawHistograms();
}
+
+void AlidNdEtaAnalysisSelector::WriteObjects()
+{
+ // Write objects to output file
+ // this is an extra function to be overloaded...
+ //
+
+ fdNdEtaAnalysisFinal->SaveHistograms();
+}
+/* $Id$ */
+
#ifndef ALIDNDETAANALYSISSELECTOR_H
#define ALIDNDETAANALYSISSELECTOR_H
#include "AliSelector.h"
-class AliESDtrackCuts;
-class dNdEtaCorrection;
class dNdEtaAnalysis;
class AlidNdEtaAnalysisSelector : public AliSelector {
public:
- AlidNdEtaAnalysisSelector(TTree *tree=0);
+ AlidNdEtaAnalysisSelector();
virtual ~AlidNdEtaAnalysisSelector();
virtual void SlaveBegin(TTree *tree);
- virtual Bool_t Process(Long64_t entry);
virtual void SlaveTerminate();
virtual void Terminate();
protected:
- AliESDtrackCuts* fEsdTrackCuts; // Object containing the parameters of the esd track cuts
-
- dNdEtaAnalysis* fdNdEtaAnalysis; // contains the intermediate histograms (on each slave)
+ virtual void WriteObjects();
- dNdEtaCorrection* fdNdEtaCorrection; // correction map
- dNdEtaAnalysis* fdNdEtaAnalysisFinal; // contains the final histograms
+ dNdEtaAnalysis* fdNdEtaAnalysis; // contains the intermediate histograms (on each slave)
+ dNdEtaAnalysis* fdNdEtaAnalysisFinal; // contains the final histograms
private:
-
- ClassDef(AlidNdEtaAnalysisSelector, 0);
+ ClassDef(AlidNdEtaAnalysisSelector, 0);
};
#endif
+/* $Id$ */
+
#include "AlidNdEtaCorrectionSelector.h"
#include <TStyle.h>
return kFALSE;
}
- if (!fHeader)
+ AliHeader* header = GetHeader();
+ if (!header)
{
- AliDebug(AliLog::kError, "Header branch not available");
+ AliDebug(AliLog::kError, "Header not available");
return kFALSE;
}
// ########################################################
// get the MC vertex
- AliGenEventHeader* genHeader = fHeader->GenEventHeader();
+ AliGenEventHeader* genHeader = header->GenEventHeader();
TArrayF vtxMC(3);
genHeader->PrimaryVertex(vtxMC);
TParticle* particle = 0;
particleTree->SetBranchAddress("Particles", &particle);
- Int_t nPrim = fHeader->GetNprimary();
- Int_t nTotal = fHeader->GetNtrack();
+ Int_t nPrim = header->GetNprimary();
+ Int_t nTotal = header->GetNtrack();
for (Int_t i_mc = nTotal - nPrim; i_mc < nTotal; ++i_mc)
{
+/* $Id$ */
+
#ifndef ALIDNDETACORRECTIONSELECTOR_H
#define ALIDNDETACORRECTIONSELECTOR_H
+/* $Id$ */
+
#include "dNdEtaAnalysis.h"
#include <TFile.h>
+/* $Id$ */
+
#ifndef DNDETANALYSIS_H
#define DNDETANALYSIS_H
+/* $Id$ */
+
#include "dNdEtaCorrection.h"
#include <TCanvas.h>
void
dNdEtaCorrection::RemoveEdges(Float_t cut, Int_t nBinsVtx, Int_t nBinsEta) {
- // remove edges of correction histogram by removing
- // - bins with content less than cut
+ // remove edges of correction histogram by removing
+ // - bins with content bigger than cut
// - bins next to bins with zero bin content
-
+
Int_t nBinsX = hEtaVsVtx_corr->GetNbinsX();
Int_t nBinsY = hEtaVsVtx_corr->GetNbinsY();
- // set bin content to zero for bins with content smaller cut
+ // set bin content to zero for bins with content bigger than cut
for (Int_t bx=0; bx<=nBinsX; bx++) {
for (Int_t by=0; by<=nBinsY; by++) {
if (hEtaVsVtx_corr->GetBinContent(bx,by)>cut) {
// set bin content to zero for bins next to bins with zero
TH2F* tmp = (TH2F*)hEtaVsVtx_corr->Clone("tmp");
tmp->Reset();
-
+
Bool_t done = kFALSE;
Int_t nBinsVtxCount = 0;
Int_t nBinsEtaCount = 0;
- while (!done) {
- if (nBinsVtxCount<nBinsVtx)
+ while (!done) {
+ if (nBinsVtxCount<nBinsVtx)
for (Int_t bx=0; bx<=nBinsX; bx++) {
for (Int_t by=0; by<=nBinsY; by++) {
- if ((hEtaVsVtx_corr->GetBinContent(bx+1,by)==0)||
+ if ((hEtaVsVtx_corr->GetBinContent(bx+1,by)==0)||
(hEtaVsVtx_corr->GetBinContent(bx-1,by)==0))
- tmp->SetBinContent(bx,by,1);
-
+ tmp->SetBinContent(bx,by,1);
+
}
}
- if (nBinsEtaCount<nBinsEta)
+ if (nBinsEtaCount<nBinsEta)
for (Int_t bx=0; bx<=nBinsX; bx++) {
for (Int_t by=0; by<=nBinsY; by++) {
- if ((hEtaVsVtx_corr->GetBinContent(bx,by+1)==0)||
+ if ((hEtaVsVtx_corr->GetBinContent(bx,by+1)==0)||
(hEtaVsVtx_corr->GetBinContent(bx,by-1)==0))
- tmp->SetBinContent(bx,by,1);
+ tmp->SetBinContent(bx,by,1);
}
- }
+ }
for (Int_t bx=0; bx<=nBinsX; bx++) {
for (Int_t by=0; by<=nBinsY; by++) {
if (tmp->GetBinContent(bx,by)==1) {
nBinsEtaCount++;
if ((nBinsVtxCount>=nBinsVtx)&&(nBinsEtaCount>=nBinsEta)) done=kTRUE;
}
- tmp->Delete();
+ tmp->Delete();
}
+/* $Id$ */
+
#ifndef DNDETACORRECTION_H
#define DNDETACORRECTION_H
+
// ------------------------------------------------------
//
// Class to handle corrections for dN/dEta measurements
+/* $Id$ */
+
void drawCorrection()
{
- gSystem->Load("libdNdEta.so");
-
+ gSystem->Load("libPWG0base");
+
dNdEtaCorrection* dNdEtaMap = new dNdEtaCorrection();
dNdEtaMap->LoadCorrection("correction_map.root");
+/* $Id$ */
+
//
// Script to make correction maps for dndeta measurements using the
// dNdEtaCorrection class.
#include "../CreateESDChain.C"
-void makeCorrection2(Char_t* dataDir, Int_t nRuns=20)
+void makeCorrection2(Char_t* dataDir, Int_t nRuns=20, Int_t offset = 0)
{
gSystem->Load("libPWG0base");
- gSystem->SetIncludePath("-I$ALICE_ROOT/PWG0");
- TChain* chain = CreateESDChainFromDir(dataDir, nRuns);
+ TChain* chain = CreateESDChainFromDir(dataDir, nRuns, offset, kFALSE);
fEsdTrackCuts = new AliESDtrackCuts();
fEsdTrackCuts->DefineHistograms(1);
+/* $Id$ */
+
//
// Script to test the dN/dEta analysis using the dNdEtaAnalysis and
// dNdEtaCorrection classes. Note that there is a cut on the events,
#include "../CreateESDChain.C"
-testAnalysis2(Char_t* dataDir, Int_t nRuns=20, Bool_t aMC = kFALSE)
+testAnalysis2(Char_t* dataDir, Int_t nRuns=20, Int_t offset=0, Bool_t aMC = kFALSE)
{
gSystem->Load("libPWG0base");
- gSystem->SetIncludePath("-I$ALICE_ROOT/PWG0");
- TChain* chain = CreateESDChainFromDir(dataDir, nRuns);
+ TChain* chain = CreateESDChainFromDir(dataDir, nRuns, offset, kFALSE);
// ########################################################
// selection of esd tracks
{
dNdEtaCorrection* dNdEtaCorrection = new dNdEtaCorrection();
dNdEtaCorrection->LoadHistograms("correction_map.root","dndeta_correction");
- dNdEtaCorrection->RemoveEdges(2,0,2);
+ dNdEtaCorrection->RemoveEdges(2, 0, 2);
chain->GetUserInfo()->Add(dNdEtaCorrection);
}
- TString selectorName = ((aMC == kFALSE) ? "AlidNdEtaAnalysisSelector" : "AlidNdEtaAnalysisMCSelector");
+ TString selectorName = ((aMC == kFALSE) ? "AlidNdEtaAnalysisESDSelector" : "AlidNdEtaAnalysisMCSelector");
AliLog::SetClassDebugLevel(selectorName, AliLog::kInfo);
+/* $Id$ */
+
#include "AliESDtrackCuts.h"
#include <Riostream.h>
//
Float_t nSigmaToVertex = -1;
if (bRes[0]!=0 && bRes[1]!=0)
- nSigmaToVertex = TMath::Sqrt(TMath::Power(b[0]/bRes[0],2) + TMath::Power(b[1]/bRes[1],2));
+ nSigmaToVertex = TMath::Sqrt(TMath::Power(b[0]/bRes[0],2) + TMath::Power(b[1]/bRes[1],2));
// getting the kinematic variables of the track
// (assuming the mass is known)
+/* $Id$ */
+
#ifndef ALIESDTRACKCUTS_H
#define ALIESDTRACKCUTS_H
+/* $Id$ */
+
testESDtrackCuts(Char_t* dataDir=, Int_t nRuns=10) {
Char_t str[256];
+# $Id$
+
HDRS = AliSelector.h \
AliSelectorRL.h \
- dNdEta/AlidNdEtaCorrectionSelector.h \
dNdEta/AlidNdEtaAnalysisSelector.h \
- dNdEta/AlidNdEtaAnalysisMCSelector.h \
dNdEta/dNdEtaAnalysis.h \
dNdEta/dNdEtaCorrection.h \
esdTrackCuts/AliESDtrackCuts.h \
SRCS = $(HDRS:.h=.cxx)
-#PARBLACKLIST = dNdEta/AlidNdEtaCorrectionSelector.h \
-# dNdEta/AlidNdEtaAnalysisSelector.h \
-# dNdEta/AlidNdEtaAnalysisMCSelector.h
-
DHDR= PWG0baseLinkDef.h
EINCLUDE=
--- /dev/null
+# $Id$
+
+# this library contains the selectors, which are loaded on the fly when one uses a given selector
+# thus this library is never used, it just exists for the build system to check if everything compiles
+
+HDRS = dNdEta/AlidNdEtaCorrectionSelector.h \
+ dNdEta/AlidNdEtaAnalysisMCSelector.h \
+ dNdEta/AlidNdEtaAnalysisESDSelector.h
+
+SRCS = $(HDRS:.h=.cxx)
+
+DHDR= PWG0selectorsLinkDef.h
+
+EINCLUDE=
+/* $Id$ */
+
//
// Script to calculate PtvsEta correction map using the CorrectionMatrix2D class.
//