useful macro to read vertex params from OCDB
authorrpreghen <rpreghen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 28 Jan 2011 10:25:48 +0000 (10:25 +0000)
committerrpreghen <rpreghen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 28 Jan 2011 10:25:48 +0000 (10:25 +0000)
TOF/ReadMeanVertexFromOCDB.C [new file with mode: 0644]

diff --git a/TOF/ReadMeanVertexFromOCDB.C b/TOF/ReadMeanVertexFromOCDB.C
new file mode 100644 (file)
index 0000000..ec3a0a3
--- /dev/null
@@ -0,0 +1,15 @@
+AliESDVertex *
+ReadMeanVertexFromOCDB(Int_t runNb, const Char_t* type = "MeanVertex")
+{
+
+  AliCDBManager *cdb = AliCDBManager::Instance();
+  cdb->SetDefaultStorage("raw://");
+  cdb->SetRun(runNb);
+  AliCDBEntry *cdbe = cdb->Get(Form("GRP/Calib/%s", type));
+  AliESDVertex *vertex = (AliESDVertex *)cdbe->GetObject();
+  Double_t vmean[3], vsigma[3];
+  vertex->GetXYZ(vmean);
+  vertex->GetSigmaXYZ(vsigma);
+  printf("vertex in run %d: z_mean = %f, z_sigma = %f\n", runNb, vmean[2], vsigma[2]);
+  return vertex;
+}