]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGPP/CalibMacros/CPass0/ConfigCalibTrain.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGPP / CalibMacros / CPass0 / ConfigCalibTrain.C
1 /*
2
3  Macro to initialize: 
4  - the OCDB (run number required as input argument)
5  - the geometry (expected to be in the current directory)
6  to run the Calibration train.
7  
8  Example:
9  .L $ALICE_ROOT/ANALYSIS/CalibMacros/MergeCalibration/ConfigCalibTrain.C
10  ConfigCalibTrain(129160,"raw://");
11
12 */
13
14 void ConfigCalibTrain(Int_t run, const char *ocdb="raw://"){
15
16   // OCDB
17   printf("setting run to %d\n",run);
18   if (gSystem->AccessPathName("OCDB.root", kFileExists)==0) {  
19     Printf("ConfigCalibTrain: using OCDB snapshot");
20     AliCDBManager::Instance()->SetSnapshotMode("OCDB.root");
21   }
22   else {
23     Printf("ConfigCalibTrain: NOT using OCDB snapshot");
24   }
25   Printf("Default storage is %s", ocdb);
26
27   AliCDBManager::Instance()->SetDefaultStorage(ocdb);
28   AliCDBManager::Instance()->SetRun(run); 
29
30   // magnetic field
31   if ( !TGeoGlobalMagField::Instance()->GetField() ) {
32     printf("Loading field map...\n");
33     AliGRPManager grpMan;
34     if( !grpMan.ReadGRPEntry() ) { 
35       printf("Cannot get GRP entry\n"); 
36     }
37     if( !grpMan.SetMagField() ) { 
38       printf("Problem with magnetic field setup\n"); 
39     }
40   }
41
42   // geometry
43   printf("Loading geometry...\n");
44   AliGeomManager::LoadGeometry();
45   if( !AliGeomManager::ApplyAlignObjsFromCDB("GRP ITS TPC TRD TOF HMPID") ) {
46     printf("Problem with align objects\n"); 
47   }
48
49   if (gSystem->AccessPathName("localOCDBaccessConfig.C", kFileExists)==0) {        
50     gROOT->LoadMacro("localOCDBaccessConfig.C");
51     localOCDBaccessConfig();
52   }
53
54 }