]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Storing the Altro mapping objects in the CDB. Macro to generate them from the ascii...
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 2 Nov 2007 17:14:44 +0000 (17:14 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 2 Nov 2007 17:14:44 +0000 (17:14 +0000)
EMCAL/Calib/Mapping/Run0_999999999_v0_s0.root [new file with mode: 0644]
EMCAL/MakeEMCALAltroMapping.C [new file with mode: 0644]

diff --git a/EMCAL/Calib/Mapping/Run0_999999999_v0_s0.root b/EMCAL/Calib/Mapping/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..f19dfbb
Binary files /dev/null and b/EMCAL/Calib/Mapping/Run0_999999999_v0_s0.root differ
diff --git a/EMCAL/MakeEMCALAltroMapping.C b/EMCAL/MakeEMCALAltroMapping.C
new file mode 100644 (file)
index 0000000..aec2945
--- /dev/null
@@ -0,0 +1,60 @@
+void MakeEMCALAltroMapping(){
+  // Create TObjArray of EMCAL altro mapping objects and
+  // store it in the CDB
+  //
+  const char* macroname = "MakeEMCALAltroMapping.C";
+
+  TObjArray mappingsArray(6);
+  
+  TString path = gSystem->Getenv("ALICE_ROOT");
+  path += "/EMCAL/mapping/RCU";
+  TString path2;
+  for(Int_t i = 0; i < 2; i++) {
+    path2 = path;
+    path2 += i;
+    path2 += ".data";
+    AliAltroMapping *mapping = new AliCaloAltroMapping(path2.Data());
+    mappingsArray.Add(mapping);
+  }
+
+  if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
+    // save on file
+    const char* filename = "EMCALAltroMapping.root";
+    TFile f(filename,"RECREATE");
+    if(!f){
+      Error(macroname,"cannot open file for output\n");
+      return;
+    }
+    Info(macroname,"Saving altro mapping objects to the file %s", filename);
+    f.cd();
+    f.WriteObject(&mappingsArray,"EMCALAtroMappings","kSingleKey");
+    f.Close();
+  }else{
+    // save in CDB storage
+    TString Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    Info(macroname,"Saving altro mapping objects in CDB storage %s",
+        Storage.Data());
+    AliCDBManager* cdb = AliCDBManager::Instance();
+    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBMetaData* md = new AliCDBMetaData();
+    md->SetResponsible("Jennifer Klay");
+    md->SetComment("Default ALTRO mapping for EMCAL");
+    md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
+    AliCDBId id("EMCAL/Calib/Mapping",0,AliCDBRunRange::Infinity());
+    storage->Put(&mappingsArray,id,md);
+
+    delete md;
+  }
+
+  mappingsArray.Delete();
+
+}
+