AliRoot Core  3dc7879 (3dc7879)
AliExternalInfo.h
Go to the documentation of this file.
1 #ifndef ALIEXTERNALINFO_H
2 #define ALIEXTERNALINFO_H
3 
12 
13 
17 
18 
57 #include <map>
58 
59 #include "TString.h"
60 
61 // forward declarations
62 class TTree;
63 class TChain;
64 
65 class AliExternalInfo : public TObject {
66 public:
67  AliExternalInfo (TString localStorageDirectory = ".", TString configLocation = "", Int_t verbose=1/*, Bool_t copyToLocalStorage = kTRUE*/);
68  virtual ~AliExternalInfo();
69  void ReadConfig( TString configLocation = "$ALICE_ROOT/STAT/Macros/AliExternalInfo.cfg", Int_t verbose=0);
70  void PrintConfig();
71  void PrintConfigSelected(const char *expName="", const char *expValue="");
72  Bool_t Cache(TString type="", TString period = "", TString pass=""); // Downloads the tree in the working directory
73  Bool_t CacheMC() {return Cache("MonALISA.MC", "", "");}
74  Bool_t CacheRCT(TString period, TString pass) {return Cache("MonALISA.RCT", period, pass);}
75  Bool_t CacheDataQA(TString detector, TString period, TString pass) {return Cache("QA." + detector, period, pass);}
76  Bool_t CacheLogbook(TString period) {return Cache("Logbook", period, "");}
77  Bool_t CacheTriggerClasses(TString period) {return Cache("TriggerClasses", period, "");}
78  Bool_t CacheProdCycle() {return Cache("MonALISA.ProductionCycle", "", "");}
79  Bool_t CacheCPass() {return Cache("MonALISA.ProductionCPass", "", "");}
80  Bool_t CacheProdCycleByID(TString ID) {return Cache("MonALISA.ProductionCycleID", ID, "");}
81  static void CacheProduction(TPRegexp select, TPRegexp reject, TString sourceList);
82 
83  TTree* GetTree(TString type, TString period, TString pass, Int_t buildIndex=1);
84  TTree* GetTree(TString type, TString period, TString pass, TString friendList);
85  TTree* GetTreeMC() {return GetTree("MonALISA.MC", "", "");}
86  // TTree* GetTreeMC(TString period = "", TString anchorYear = "", TString productionTag = "") {return GetTree("MonALISA.MC", "", "");} // deprecated; not supported anymore
87  TTree* GetTreeRCT(TString period, TString pass) {return GetTree("MonALISA.RCT", period, pass);}
88  TTree* GetTreeDataQA(TString detector, TString period, TString pass) {return GetTree("QA." + detector, period, pass);}
89  TTree* GetTreeLogbook(TString period) {return GetTree("Logbook", period, "");}
90  TTree* GetTreeTriggerClasses(TString period) {return GetTree("TriggerClasses", period, "");}
91  TTree* GetTreeProdCycle() {return GetTree("MonALISA.ProductionCycle", "", "");}
92  TTree* GetTreeCPass() {return GetTree("MonALISA.ProductionCPass", "", "");}
93  TTree* GetTreeProdCycleByID(TString ID) {return GetTree("MonALISA.ProductionCycleID", ID, "");}
94  TTree* GetCPassTree(const char * period, const char *pass);
95  TTree *GetProductionTree(TString period, TString pass);
96 
97  TTree* GetTreeAliVersRD();
98  TTree* GetTreeAliVersMC();
99  TTree* GetTreeMCPassGuess();
100  TString GetMCPassGuess(TString MCprodname);
101  TString GetMCAnchPerGuess(const char* runlist);
102  TTree* GetLogbookCache();
103  TChain* GetChain(TString type, TString period, TString pass, Int_t buildIndex=1);
104  TChain* GetChain(TString type, TString period, TString pass, TString friendList);
105  TChain* GetChainMC() {return GetChain("MonALISA.MC", "", "");}
106  TChain* GetChainRCT(TString period, TString pass) {return GetChain("MonALISA.RCT", period, pass);}
107  TChain* GetChainDataQA(TString detector, TString period, TString pass){return GetChain("QA." + detector, period, pass);}
108  TChain* GetChainLogbook(TString period) {return GetChain("Logbook", period, "");}
109  TChain* GetChainTriggerClasses(TString period) {return GetChain("TriggerClasses", period, "");}
110  TChain* GetChainProdCycle() {return GetChain("MonALISA.ProductionCycle", "", "");}
111  TChain* GetChainProdCycleByID(TString ID) {return GetChain("MonALISA.ProductionCycleID", ID, "");}
112 
113  TTree* GetFriendsTree() const {return fTree;}
114  TChain* GetFriendsChain() const {return fChain;} // _Not_ working properly!!!
115 
116  void SetMaxCacheSize(Long64_t size) { fMaxCacheSize=size; }
117  Long64_t GetMaxCacheSize() const { return fMaxCacheSize; }
118 
119  static const TString& GetDefaultConfig() { return fgkDefaultConfig; }
120  static void BuildHashIndex(TTree* tree, const char *chbranchName, const char *chindexName);
121  static void PrintMapSelected(std::map<TString, TString> infoMap, const char *expName="", const char *expValue="");
122 public:
123  //private:
124  Bool_t BuildIndex(TTree* tree, TString type);
125  Bool_t AddChain(TString type, TString period, TString pass);
126  void SetupVariables(TString& internalFilename, TString& internalLocation, Bool_t& resourceIsTree, TString& pathStructure, \
127  TString& detector, TString& rootFileName, TString& treeName, const TString& type, const TString& period, const TString& pass, TString &indexName);
128  const TString GetYearFromPeriod(const TString& period);
129  const TString CurlMif(TString& mifFilePath, const TString& internalLocation, TString rootFileName, const TString& externalLocation);
130  const TString CurlTree(const TString internalFilename, const TString& externalLocation);
131  const TString CreatePath(TString type, TString period, TString pass);
132  Bool_t IsDownloadNeeded(TString file, TString type);
133  Int_t fVerbose;
134  Bool_t fLoadMetadata;
135  // Bool_t fCopyDataToLocalStorage;
136  TString fConfigLocation;
138  std::map<TString, TString> fConfigMap;
139  TTree* fTree;
140  TTree* fMCGuessTree;
141  TChain* fChain;
142  std::map<TString, TChain*> fChainMap;
143  Long64_t fMaxCacheSize;
144  TTree* fLogCache;
145  static const TString fgkDefaultConfig;
146 
147  ClassDef(AliExternalInfo, 0); // interface to various trending trees
148 
149 };
150 
151 #endif // ALIEXTERNALINFO_H
const TString CreatePath(TString type, TString period, TString pass)
TTree * GetTreeProdCycleByID(TString ID)
TChain * GetFriendsChain() const
Bool_t fLoadMetadata
flag load metadata
void SetupVariables(TString &internalFilename, TString &internalLocation, Bool_t &resourceIsTree, TString &pathStructure, TString &detector, TString &rootFileName, TString &treeName, const TString &type, const TString &period, const TString &pass, TString &indexName)
Sets up all variables according to period, pass and type. Extracts information from the config file...
TTree * GetTreeMCPassGuess()
Bool_t Cache(TString type="", TString period="", TString pass="")
TTree * GetTreeMC()
TTree * GetProductionTree(TString period, TString pass)
Bool_t AddChain(TString type, TString period, TString pass)
TChain * GetChainRCT(TString period, TString pass)
TTree * GetTreeAliVersMC()
void PrintConfigSelected(const char *expName="", const char *expValue="")
const TString GetYearFromPeriod(const TString &period)
TChain * GetChainProdCycle()
Bool_t CacheProdCycle()
AliExternalInfo(TString localStorageDirectory=".", TString configLocation="", Int_t verbose=1)
TTree * GetTreeRCT(TString period, TString pass)
Bool_t CacheRCT(TString period, TString pass)
static void PrintMapSelected(std::map< TString, TString > infoMap, const char *expName="", const char *expValue="")
static const TString & GetDefaultConfig()
TTree * GetCPassTree(const char *period, const char *pass)
TTree * GetTreeTriggerClasses(TString period)
TTree * tree
Bool_t CacheLogbook(TString period)
Bool_t CacheDataQA(TString detector, TString period, TString pass)
static const TString fgkDefaultConfig
default config file
TTree * GetTreeCPass()
TChain * GetChainDataQA(TString detector, TString period, TString pass)
void SetMaxCacheSize(Long64_t size)
static void BuildHashIndex(TTree *tree, const char *chbranchName, const char *chindexName)
TTree * GetTree(TString type, TString period, TString pass, Int_t buildIndex=1)
TTree * fTree
master tree with friends
Int_t fVerbose
verbosity flag
void PrintConfig()
Prints out the config which was read in previously. Useful to check if anything went wrong...
TTree * GetTreeDataQA(TString detector, TString period, TString pass)
TChain * GetChainLogbook(TString period)
const TString CurlTree(const TString internalFilename, const TString &externalLocation)
Bool_t IsDownloadNeeded(TString file, TString type)
This class gives you an interface to different trees of information spread throughout ALICE...
static void CacheProduction(TPRegexp select, TPRegexp reject, TString sourceList)
Long64_t fMaxCacheSize
maximum chache size for trees and chains
TChain * GetChain(TString type, TString period, TString pass, Int_t buildIndex=1)
TTree * GetTreeLogbook(TString period)
TChain * GetChainProdCycleByID(TString ID)
const TString CurlMif(TString &mifFilePath, const TString &internalLocation, TString rootFileName, const TString &externalLocation)
TArrayI runlist(10000)
TTree * GetTreeAliVersRD()
TString GetMCAnchPerGuess(const char *runlist)
TString fConfigLocation
location of the config file
std::map< TString, TChain * > fChainMap
map of chains
TChain * GetChainTriggerClasses(TString period)
Bool_t CacheProdCycleByID(TString ID)
Bool_t BuildIndex(TTree *tree, TString type)
Bool_t CacheTriggerClasses(TString period)
TString fLocalStorageDirectory
location of the local cache directory
TTree * GetTreeProdCycle()
std::map< TString, TString > fConfigMap
map with tree DB configuration parameters
Long64_t GetMaxCacheSize() const
virtual ~AliExternalInfo()
TChain * fChain
master chain with friends
TTree * GetFriendsTree() const
TTree * fMCGuessTree
tree holding information for Anchor Pass guessing
TChain * GetChainMC()
TString GetMCPassGuess(TString MCprodname)
void ReadConfig(TString configLocation="$ALICE_ROOT/STAT/Macros/AliExternalInfo.cfg", Int_t verbose=0)
TTree * fLogCache
TChain for Logbook.