]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGPP/TPC/macros/ConfigOCDB.C
add the script to make calib trees for expert QA
[u/mrichter/AliRoot.git] / PWGPP / TPC / macros / ConfigOCDB.C
1 /*
2
3  Macro to initialize: 
4  - the OCDB (run number required as input argument)
5  - the geometry and mag. field initialized from GRP
6  
7  Example:
8  .L $ALICE_ROOT/PWGPP/TPC/macros/ConfigOCDB.C
9  ConfigOCDB(129160,"raw://");
10
11 */
12
13 void ConfigOCDB(Int_t run, const char *ocdb="raw://") {
14
15   // OCDB
16   printf("setting run to %d\n",run);
17   AliCDBManager::Instance()->SetDefaultStorage(ocdb);
18   AliCDBManager::Instance()->SetRun(run); 
19
20   // magnetic field
21   if ( !TGeoGlobalMagField::Instance()->GetField() ) {
22     printf("Loading field map...\n");
23     AliGRPManager grpMan;
24     if( !grpMan.ReadGRPEntry() ) { 
25       printf("Cannot get GRP entry\n"); 
26     }
27     if( !grpMan.SetMagField() ) { 
28       printf("Problem with magnetic field setup\n"); 
29     }
30   }
31   if ( !TGeoGlobalMagField::Instance()->GetField()){
32     AliMagF::BMap_t smag = AliMagF::k5kG;
33     Double_t bzfac = 1;
34     AliMagF* magF= new AliMagF("Maps","Maps", bzfac, 1., smag);
35     TGeoGlobalMagField::Instance()->SetField(magF);
36   }
37
38   // geometry
39   printf("Loading geometry...\n");
40   AliGeomManager::LoadGeometry();
41   if( !AliGeomManager::ApplyAlignObjsFromCDB("GRP ITS TPC") ) {
42     printf("Problem with align objects\n"); 
43   }
44   
45   if (gSystem->AccessPathName("localOCDBaccessConfig.C", kFileExists)==0) {        
46     printf("loading localOCDBaccessConfig.C\n");
47     gROOT->LoadMacro("localOCDBaccessConfig.C");
48     localOCDBaccessConfig();
49   }
50 }