]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGPP/TPC/macros/ConfigOCDB.C
Moving PWG1 to PWGPP
[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
32   // geometry
33   printf("Loading geometry...\n");
34   AliGeomManager::LoadGeometry();
35   if( !AliGeomManager::ApplyAlignObjsFromCDB("GRP ITS TPC") ) {
36     printf("Problem with align objects\n"); 
37   }
38
39 }