Update master to aliroot
[u/mrichter/AliRoot.git] / HLT / programs / downloadCDB.C
1 // $Id$
2 ///
3 /// @file downloadCDB.C
4 /// @brief Download a snapshot of the CDB to another folder
5 ///
6 /// <pre>
7 /// Usage: aliroot -b -q -l \
8 ///     downloadCDB.C'(runno, "from", "to", "path")'
9 ///
10 /// Examples:
11 ///     downloadCDB.C'(144991, "alien://folder=/alice/data/2011/OCDB", "local:///tmp/144991/OCDB")'
12 ///
13 /// Defaults
14 ///     path="*/*/*"  -> download everything
15 ///
16 /// </pre>
17 ///
18 ///
19 void downloadCDB(Int_t runnr,
20       const char* from,
21       const char* to,
22       const char* path="*/*/*") 
23 {
24   AliCDBManager* man=AliCDBManager::Instance();
25   man->SetDefaultStorage(from);
26   man->SetDrain(to);
27   AliCDBPath cdbpath(path);
28   man->GetAll(path, runnr);
29 }
30
31 void downloadCDB()
32 {
33   cout << " Usage:" << endl;
34   cout << "   aliroot -b -q -l \\" << endl;
35   cout << "     downloadCDB.C'(runno, \"from\", \"to\", \"path\")'" << endl;
36   cout << "" << endl;
37   cout << " Examples:" << endl;
38   cout << "   aliroot -b -q -l \\" << endl;
39   cout << "     downloadCDB.C'(144991, \"alien://folder=/alice/data/2011/OCDB\", \"local:///tmp/144991/OCDB\")'" << endl;
40   cout << "" << endl;
41   cout << " Defaults" << endl;
42   cout << "     path=\"*/*/*\"  -> download everything" << endl;
43 }