macro to init geom and B field from GRP
authorjotwinow <jotwinow@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 30 Sep 2010 20:20:34 +0000 (20:20 +0000)
committerjotwinow <jotwinow@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 30 Sep 2010 20:20:34 +0000 (20:20 +0000)
PWG1/TPC/macros/ConfigOCDB.C [new file with mode: 0644]

diff --git a/PWG1/TPC/macros/ConfigOCDB.C b/PWG1/TPC/macros/ConfigOCDB.C
new file mode 100644 (file)
index 0000000..d96081b
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+
+ Macro to initialize: 
+ - the OCDB (run number required as input argument)
+ - the geometry and mag. field initialized from GRP
+ Example:
+ .L $ALICE_ROOT/PWG1/TPC/macros/ConfigOCDB.C
+ ConfigOCDB(129160,"raw://");
+
+*/
+
+void ConfigOCDB(Int_t run, const char *ocdb="raw://") {
+
+  // OCDB
+  printf("setting run to %d\n",run);
+  AliCDBManager::Instance()->SetDefaultStorage(ocdb);
+  AliCDBManager::Instance()->SetRun(run); 
+
+  // magnetic field
+  if ( !TGeoGlobalMagField::Instance()->GetField() ) {
+    printf("Loading field map...\n");
+    AliGRPManager grpMan;
+    if( !grpMan.ReadGRPEntry() ) { 
+      printf("Cannot get GRP entry\n"); 
+    }
+    if( !grpMan.SetMagField() ) { 
+      printf("Problem with magnetic field setup\n"); 
+    }
+  }
+
+  // geometry
+  printf("Loading geometry...\n");
+  AliGeomManager::LoadGeometry();
+  if( !AliGeomManager::ApplyAlignObjsFromCDB("GRP ITS TPC") ) {
+    printf("Problem with align objects\n"); 
+  }
+
+}