//////////////////////////////////////////////////////////////////////////////////////
/**************************************************************************/
+#include <TROOT.h>
#include <TString.h>
#include <TFolder.h>
+#include <TTask.h>
#include <TFile.h>
#include <TTree.h>
-#include <TROOT.h>
#include <TBranch.h>
#include <TGeometry.h>
-#include <TTask.h>
#include <TError.h>
+#include <TObjArray.h>
#include "AliRun.h"
#include "AliConfig.h"
#include "AliLoader.h"
#include "AliHeader.h"
#include "AliStack.h"
-#include "TObjArray.h"
#include "AliDetector.h"
#include "AliRunDigitizer.h"
AliRunLoader::~AliRunLoader()
{
//dtor
+ if (fgRunLoader == this) fgRunLoader = 0x0;
+
UnloadHeader();
UnloadgAlice();
else
{
GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
- loaders = &arr;//get the pointer array
+ loaders = &arr;//get the pointer to array
}
TIter next(loaders);
}
return 0;
}
-
/**************************************************************************/
Int_t AliRunLoader::LoadRecPoints(Option_t* detectors,Option_t* opt)
}
return 0;
}
+/**************************************************************************/
+Int_t AliRunLoader::LoadRecParticles(Option_t* detectors,Option_t* opt)
+{
+//LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
+
+ TObjArray* Loaders;
+ TObjArray arr;
+
+ const char* oAll = strstr(detectors,"all");
+ if (oAll)
+ {
+ Loaders = fLoaders;
+ }
+ else
+ {
+ GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
+ Loaders = &arr;//get the pointer array
+ }
+
+ TIter next(Loaders);
+ AliLoader *Loader;
+ while((Loader = (AliLoader*)next()))
+ {
+ Loader->LoadRecParticles(opt);
+ }
+ return 0;
+}
/**************************************************************************/
Int_t AliRunLoader::LoadTracks(Option_t* detectors,Option_t* opt)
}
return 0;
}
+/**************************************************************************/
+
+void AliRunLoader::UnloadHits(Option_t* detectors)
+{
+ //unloads hits for detectors specified in parameter
+ TObjArray* loaders;
+ TObjArray arr;
+
+ const char* oAll = strstr(detectors,"all");
+ if (oAll)
+ {
+ loaders = fLoaders;
+ }
+ else
+ {
+ GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
+ loaders = &arr;//get the pointer to array
+ }
+
+ TIter next(loaders);
+ AliLoader *loader;
+ while((loader = (AliLoader*)next()))
+ {
+ loader->UnloadHits();
+ }
+}
+/**************************************************************************/
+
+void AliRunLoader::UnloadSDigits(Option_t* detectors)
+{
+ //unloads SDigits for detectors specified in parameter
+ TObjArray* loaders;
+ TObjArray arr;
+
+ const char* oAll = strstr(detectors,"all");
+ if (oAll)
+ {
+ loaders = fLoaders;
+ }
+ else
+ {
+ GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
+ loaders = &arr;//get the pointer to array
+ }
+
+ TIter next(loaders);
+ AliLoader *loader;
+ while((loader = (AliLoader*)next()))
+ {
+ loader->UnloadSDigits();
+ }
+}
+/**************************************************************************/
+
+void AliRunLoader::UnloadDigits(Option_t* detectors)
+{
+ //unloads Digits for detectors specified in parameter
+ TObjArray* loaders;
+ TObjArray arr;
+
+ const char* oAll = strstr(detectors,"all");
+ if (oAll)
+ {
+ loaders = fLoaders;
+ }
+ else
+ {
+ GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
+ loaders = &arr;//get the pointer to array
+ }
+
+ TIter next(loaders);
+ AliLoader *loader;
+ while((loader = (AliLoader*)next()))
+ {
+ loader->UnloadDigits();
+ }
+}
+/**************************************************************************/
+
+void AliRunLoader::UnloadRecPoints(Option_t* detectors)
+{
+ //unloads RecPoints for detectors specified in parameter
+ TObjArray* loaders;
+ TObjArray arr;
+
+ const char* oAll = strstr(detectors,"all");
+ if (oAll)
+ {
+ loaders = fLoaders;
+ }
+ else
+ {
+ GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
+ loaders = &arr;//get the pointer to array
+ }
+
+ TIter next(loaders);
+ AliLoader *loader;
+ while((loader = (AliLoader*)next()))
+ {
+ loader->UnloadRecPoints();
+ }
+}
+/**************************************************************************/
+
+void AliRunLoader::UnloadAll(Option_t* detectors)
+{
+ //calls UnloadAll for detectors names specified in parameter
+ // option "all" passed can be passed
+ TObjArray* loaders;
+ TObjArray arr;
+
+ const char* oAll = strstr(detectors,"all");
+ if (oAll)
+ {
+ loaders = fLoaders;
+ }
+ else
+ {
+ GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
+ loaders = &arr;//get the pointer to array
+ }
+ TIter next(loaders);
+ AliLoader *loader;
+ while((loader = (AliLoader*)next()))
+ {
+ loader->UnloadAll();
+ }
+}
+/**************************************************************************/
+
+void AliRunLoader::UnloadTracks(Option_t* detectors)
+{
+ //unloads Tracks for detectors specified in parameter
+ TObjArray* loaders;
+ TObjArray arr;
+
+ const char* oAll = strstr(detectors,"all");
+ if (oAll)
+ {
+ loaders = fLoaders;
+ }
+ else
+ {
+ GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
+ loaders = &arr;//get the pointer to array
+ }
+
+ TIter next(loaders);
+ AliLoader *loader;
+ while((loader = (AliLoader*)next()))
+ {
+ loader->UnloadTracks();
+ }
+}
+/**************************************************************************/
+
+void AliRunLoader::UnloadRecParticles(Option_t* detectors)
+{
+ //unloads Particles for detectors specified in parameter
+ TObjArray* loaders;
+ TObjArray arr;
+
+ const char* oAll = strstr(detectors,"all");
+ if (oAll)
+ {
+ loaders = fLoaders;
+ }
+ else
+ {
+ GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
+ loaders = &arr;//get the pointer to array
+ }
+
+ TIter next(loaders);
+ AliLoader *loader;
+ while((loader = (AliLoader*)next()))
+ {
+ loader->UnloadRecParticles();
+ }
+}
/**************************************************************************/
AliRunLoader* AliRunLoader::GetRunLoader(const char* eventfoldername)
}
/**************************************************************************/
-AliLoader* AliRunLoader::GetDetectorLoader(const char* detname)
+AliLoader* AliRunLoader::GetDetectorLoader(const char* detname, const char* eventfoldername)
{
//get the loader of the detector with the given name from the global
//run loader object
- AliRunLoader* runLoader = GetRunLoader();
+ AliRunLoader* runLoader = GetRunLoader(eventfoldername);
if (!runLoader) {
- cerr << "AliRunLoader::GetDetectorLoader: no run loader found\n";
+ ::Error("AliRunLoader::GetDetectorLoader","No run loader found");
return NULL;
}
+ return runLoader->GetDetectorLoader(detname);
+}
+/**************************************************************************/
+
+AliLoader* AliRunLoader::GetDetectorLoader(const char* detname)
+{
+//get the loader of the detector with the given name from the global
+//run loader object
+
char loadername[256];
sprintf(loadername, "%sLoader", detname);
- AliLoader* loader = runLoader->GetLoader(loadername);
+ AliLoader* loader = GetLoader(loadername);
if (!loader) {
- runLoader->Error("GetDetectorLoader", "no loader for %s found", detname);
+ Error("GetDetectorLoader", "No loader for %s found", detname);
return NULL;
}
return loader;
}
+/**************************************************************************/
+
+TTree* AliRunLoader::GetTreeH(const char* detname, Bool_t maketree, const char* eventfoldername)
+{
+//get the tree with hits of the detector with the given name
+//if maketree is true and the tree does not exist, the tree is created
+ AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
+ if (!loader) return NULL;
+ if (!loader->TreeH() && maketree) loader->MakeTree("H");
+ return loader->TreeH();
+}
/**************************************************************************/
if (!loader->TreeH() && maketree) loader->MakeTree("H");
return loader->TreeH();
}
+/**************************************************************************/
+TTree* AliRunLoader::GetTreeS(const char* detname, Bool_t maketree,const char* eventfoldername)
+{
+//get the tree with summable digits of the detector with the given name
+//if maketree is true and the tree does not exist, the tree is created
+ AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
+ if (!loader) return NULL;
+ if (!loader->TreeS() && maketree) loader->MakeTree("S");
+ return loader->TreeS();
+}
/**************************************************************************/
TTree* AliRunLoader::GetTreeS(const char* detname, Bool_t maketree)
if (!loader->TreeS() && maketree) loader->MakeTree("S");
return loader->TreeS();
}
+/**************************************************************************/
+TTree* AliRunLoader::GetTreeD(const char* detname, Bool_t maketree,const char* eventfoldername)
+{
+//get the tree with digits of the detector with the given name
+//if maketree is true and the tree does not exist, the tree is created
+ AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
+ if (!loader) return NULL;
+ if (!loader->TreeD() && maketree) loader->MakeTree("D");
+ return loader->TreeD();
+}
/**************************************************************************/
TTree* AliRunLoader::GetTreeD(const char* detname, Bool_t maketree)
if (!loader->TreeD() && maketree) loader->MakeTree("D");
return loader->TreeD();
}
-
+/**************************************************************************/
+TTree* AliRunLoader::GetTreeR(const char* detname, Bool_t maketree,const char* eventfoldername)
+{
+//get the tree with clusters of the detector with the given name
+//if maketree is true and the tree does not exist, the tree is created
+ AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
+ if (!loader) return NULL;
+ if (!loader->TreeR() && maketree) loader->MakeTree("R");
+ return loader->TreeR();
+}
/**************************************************************************/
TTree* AliRunLoader::GetTreeR(const char* detname, Bool_t maketree)
if (!loader->TreeR() && maketree) loader->MakeTree("R");
return loader->TreeR();
}
+/**************************************************************************/
+TTree* AliRunLoader::GetTreeT(const char* detname, Bool_t maketree,const char* eventfoldername)
+{
+//get the tree with tracks of the detector with the given name
+//if maketree is true and the tree does not exist, the tree is created
+ AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
+ if (!loader) return NULL;
+ if (!loader->TreeT() && maketree) loader->MakeTree("T");
+ return loader->TreeT();
+}
/**************************************************************************/
TTree* AliRunLoader::GetTreeT(const char* detname, Bool_t maketree)
if (!loader->TreeT() && maketree) loader->MakeTree("T");
return loader->TreeT();
}
+/**************************************************************************/
+TTree* AliRunLoader::GetTreeP(const char* detname, Bool_t maketree,const char* eventfoldername)
+{
+//get the tree with particles of the detector with the given name
+//if maketree is true and the tree does not exist, the tree is created
+ AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
+ if (!loader) return NULL;
+ if (!loader->TreeP() && maketree) loader->MakeTree("P");
+ return loader->TreeP();
+}
/**************************************************************************/
TTree* AliRunLoader::GetTreeP(const char* detname, Bool_t maketree)
Int_t LoadDigits(Option_t* detectors = "all",Option_t* opt = "RAED");
Int_t LoadRecPoints(Option_t* detectors = "all",Option_t* opt = "RAED");
Int_t LoadTracks(Option_t* detectors = "all",Option_t* opt = "RAED");
+ Int_t LoadRecParticles(Option_t* detectors = "all",Option_t* opt = "RAED");
+ void UnloadHits(Option_t* detectors = "all");
+ void UnloadSDigits(Option_t* detectors = "all");
+ void UnloadDigits(Option_t* detectors = "all");
+ void UnloadRecPoints(Option_t* detectors = "all");
+ void UnloadTracks(Option_t* detectors = "all");
+ void UnloadRecParticles(Option_t* detectors = "all");
+ void UnloadAll(Option_t* detectors = "all");
void AddLoader(AliLoader* loader);
void AddLoader(AliDetector* det);
void cd(){fgRunLoader = this;}
void Synchronize();
+ AliLoader* GetDetectorLoader(const char* detname);
+ TTree* GetTreeH(const char* detname, Bool_t maketree);
+ TTree* GetTreeS(const char* detname, Bool_t maketree);
+ TTree* GetTreeD(const char* detname, Bool_t maketree);
+ TTree* GetTreeR(const char* detname, Bool_t maketree);
+ TTree* GetTreeT(const char* detname, Bool_t maketree);
+ TTree* GetTreeP(const char* detname, Bool_t maketree);
+
protected:
/**********************************************/
/************ PROTECTED ***************/
/******************************************/
static AliRunLoader* GetRunLoader(const char* eventfoldername);
static AliRunLoader* GetRunLoader(){return fgRunLoader;}
- static AliLoader* GetDetectorLoader(const char* detname);
- static TTree* GetTreeH(const char* detname, Bool_t maketree);
- static TTree* GetTreeS(const char* detname, Bool_t maketree);
- static TTree* GetTreeD(const char* detname, Bool_t maketree);
- static TTree* GetTreeR(const char* detname, Bool_t maketree);
- static TTree* GetTreeT(const char* detname, Bool_t maketree);
- static TTree* GetTreeP(const char* detname, Bool_t maketree);
+ static AliLoader* GetDetectorLoader(const char* detname, const char* eventfoldername);
+ static TTree* GetTreeH(const char* detname, Bool_t maketree, const char* eventfoldername);
+ static TTree* GetTreeS(const char* detname, Bool_t maketree, const char* eventfoldername);
+ static TTree* GetTreeD(const char* detname, Bool_t maketree, const char* eventfoldername);
+ static TTree* GetTreeR(const char* detname, Bool_t maketree, const char* eventfoldername);
+ static TTree* GetTreeT(const char* detname, Bool_t maketree, const char* eventfoldername);
+ static TTree* GetTreeP(const char* detname, Bool_t maketree, const char* eventfoldername);
// static AliRunDigitizer* GetRunDigitizer();
// Tasks are supposed to be singletons, that is why following methods are static