From: odjuvsla Date: Tue, 7 Dec 2010 11:55:20 +0000 (+0000) Subject: - adding classes to take care of the loading of the correct physics X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=17110fb48e793411f9d8306989daa383d9b97d1b;p=u%2Fmrichter%2FAliRoot.git - adding classes to take care of the loading of the correct physics selections - the physics selection is loaded from a root file containing the relevant physics selections --- diff --git a/PWG4/totEt/AliAnalysisEtSelectionContainer.cxx b/PWG4/totEt/AliAnalysisEtSelectionContainer.cxx new file mode 100644 index 00000000000..0cc1bc16570 --- /dev/null +++ b/PWG4/totEt/AliAnalysisEtSelectionContainer.cxx @@ -0,0 +1,40 @@ +#include "AliAnalysisEtSelectionContainer.h" +#include "TNamed.h" + +ClassImp(AliAnalysisEtSelectionContainer) + +AliAnalysisEtSelectionContainer::AliAnalysisEtSelectionContainer() : TNamed("name", "name") +,fPhysicsSelectionMap() +{ + +} + + +AliAnalysisEtSelectionContainer::AliAnalysisEtSelectionContainer(const char *name): TNamed(name, name) +,fPhysicsSelectionMap() +{ + +} + +AliAnalysisEtSelectionContainer::AliAnalysisEtSelectionContainer(const AliAnalysisEtSelectionContainer& other): + TNamed(other) + ,fPhysicsSelectionMap(other.GetPhysicsSelectionMap()) +{ + // Copy constructor +} + +AliAnalysisEtSelectionContainer& AliAnalysisEtSelectionContainer::operator=(const AliAnalysisEtSelectionContainer& other) +{ + // Assignment operator + if(this != &other) + { + fName = other.GetName(); + fPhysicsSelectionMap = other.GetPhysicsSelectionMap(); + } + return *this; +} + +AliAnalysisEtSelectionContainer::~AliAnalysisEtSelectionContainer() +{ + //Destructor +} diff --git a/PWG4/totEt/AliAnalysisEtSelectionContainer.h b/PWG4/totEt/AliAnalysisEtSelectionContainer.h new file mode 100644 index 00000000000..4a2e2b4739d --- /dev/null +++ b/PWG4/totEt/AliAnalysisEtSelectionContainer.h @@ -0,0 +1,52 @@ +#ifndef ALIANALYSISETSELECTIONCONTAINER_H +#define ALIANALYSISETSELECTIONCONTAINER_H + +#include "TNamed.h" +#include + + +class AliPhysicsSelection; + +class AliAnalysisEtSelectionContainer : public TNamed +{ +public: + + /** Constructor */ + AliAnalysisEtSelectionContainer(); + + /** Constructor */ + AliAnalysisEtSelectionContainer(const char *name); + + /** Destructor */ + virtual ~AliAnalysisEtSelectionContainer(); + + /** Return the physics selection for the current run */ + AliPhysicsSelection* GetPhysicsSelection(Int_t runNumber) { return fPhysicsSelectionMap[runNumber]; } + + /** Return the physics selection for the current run */ + AliPhysicsSelection* GetDefaultPhysicsSelection() { return fPhysicsSelectionMap[0]; } + + /** Get the map */ + std::map GetPhysicsSelectionMap() const { return fPhysicsSelectionMap; } + + /** Add the default selection to the map */ + void AddDefaultSelection(AliPhysicsSelection *selection) { fPhysicsSelectionMap.insert(std::pair(0, selection)); } + + /** Add a physics selection to the map */ + void AddPhysicsSelection(AliPhysicsSelection *selection, Int_t runNumber) { fPhysicsSelectionMap.insert(std::pair(runNumber, selection)); } + + /** Copy constructor */ + AliAnalysisEtSelectionContainer(const AliAnalysisEtSelectionContainer& other); + + /** Assignment operator */ + AliAnalysisEtSelectionContainer& operator=(const AliAnalysisEtSelectionContainer& other); + +private: + + std::map fPhysicsSelectionMap; // The physics selection map + + ClassDef(AliAnalysisEtSelectionContainer, 1); + +}; + +#endif // ALIANALYSISETSELECTIONCONTAINER_H diff --git a/PWG4/totEt/AliAnalysisEtSelectionHandler.cxx b/PWG4/totEt/AliAnalysisEtSelectionHandler.cxx new file mode 100644 index 00000000000..de98aba495d --- /dev/null +++ b/PWG4/totEt/AliAnalysisEtSelectionHandler.cxx @@ -0,0 +1,44 @@ +#include "AliAnalysisEtSelectionHandler.h" +#include "AliAnalysisEtSelectionContainer.h" +#include "AliPhysicsSelection.h" +#include "TFile.h" +#include + +ClassImp(AliAnalysisEtSelectionHandler); + + +AliAnalysisEtSelectionHandler::AliAnalysisEtSelectionHandler() : +fSelections(0) +{ + +} + +AliAnalysisEtSelectionHandler::AliAnalysisEtSelectionHandler(const char* name) : +fSelections(0) +{ + // Constructor + TFile *mapFile = TFile::Open(name); + + //mapFile->Open(name); + std::cout << name << " " << mapFile << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; + mapFile->ls(); + fSelections = dynamic_cast(mapFile->Get("physicsSelections")); + +} + +AliAnalysisEtSelectionHandler::~AliAnalysisEtSelectionHandler() +{ + // Destructor +} + +AliAnalysisEtSelectionHandler::AliAnalysisEtSelectionHandler(const AliAnalysisEtSelectionHandler& other): TObject(other) +,fSelections(other.GetSelectionContainer()) +{ + // Copy constructor +} + +AliAnalysisEtSelectionHandler& AliAnalysisEtSelectionHandler::operator=(const AliAnalysisEtSelectionHandler& /*other*/) +{ + // Assignment operator, not properly implemented + return *this; +} diff --git a/PWG4/totEt/AliAnalysisEtSelectionHandler.h b/PWG4/totEt/AliAnalysisEtSelectionHandler.h new file mode 100644 index 00000000000..10987627176 --- /dev/null +++ b/PWG4/totEt/AliAnalysisEtSelectionHandler.h @@ -0,0 +1,41 @@ +#ifndef ALIANALYSISETSELECTIONHANDLER_H +#define ALIANALYSISETSELECTIONHANDLER_H + +#include "TObject.h" +#include "AliAnalysisEtSelectionContainer.h" + +class AliPhysicsSelection; + +class AliAnalysisEtSelectionHandler : public TObject +{ + +public: + AliAnalysisEtSelectionHandler(); + + AliAnalysisEtSelectionHandler(const char *name); + + virtual ~AliAnalysisEtSelectionHandler(); + + AliPhysicsSelection* GetPhysicsSelection(Int_t runNumber) { return fSelections->GetPhysicsSelection(runNumber); } + + AliPhysicsSelection* GetDefaultPhysicsSelection() { return fSelections->GetDefaultPhysicsSelection(); } + + AliAnalysisEtSelectionContainer* GetSelectionContainer() const { return fSelections; } + + AliAnalysisEtSelectionHandler(const AliAnalysisEtSelectionHandler& other); + + AliAnalysisEtSelectionHandler& operator=(const AliAnalysisEtSelectionHandler& other); + + private: + + AliAnalysisEtSelectionContainer *fSelections; //! The selection container + + + + + ClassDef(AliAnalysisEtSelectionHandler, 1); + + +}; + +#endif // ALIANALYSISETSELECTIONHANDLER_H