reading - writing CDB
authoralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Feb 2007 12:40:42 +0000 (12:40 +0000)
committeralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Feb 2007 12:40:42 +0000 (12:40 +0000)
T0/AliT0Parameters.cxx
T0/AliT0SetCDB.C

index 83db0b48bb1cb24e54455a15a32faf46666572d6..3f39f5b8976cdc402d603244edac5bbcee8cc7df 100644 (file)
@@ -90,13 +90,17 @@ AliT0Parameters::Init()
   // CDB here. 
   //   if (fIsInit) return;
   
-  AliCDBManager* cdb      = AliCDBManager::Instance();
-  //  AliCDBStorage *stor = cdb->GetStorage("local://$ALICE_ROOT");
-  fCalibentry  = cdb->Get("T0/Calib/Gain_TimeDelay_Slewing_Walk");
-  if (fCalibentry){
+  // AliCDBManager* cdb      = AliCDBManager::Instance();
+  // fCalibentry  = cdb->Get("T0/Calib/Gain_TimeDelay_Slewing_Walk");
+
+  AliCDBStorage *stor =AliCDBManager::Instance()->GetStorage("local://$ALICE_ROOT");
+  AliCDBEntry* fCalibentry  = stor->Get("T0/Calib/Gain_TimeDelay_Slewing_Walk",0);
+ if (fCalibentry){
    fgCalibData  = (AliT0CalibData*)fCalibentry->GetObject();
   }
- fLookUpentry  = cdb->Get("T0/Calib/LookUp_Table");
+ // fLookUpentry  = cdb->Get("T0/Calib/LookUp_Table");
+  fLookUpentry  = stor->Get("T0/Calib/LookUp_Table",0);
   if (fLookUpentry){
     fgLookUp  = (AliT0CalibData*)fLookUpentry->GetObject();
     //   fgLookUp->Dump();
index ea89c20130b290513958ece7436e30909533f620..93b3e521280a5f951dae389b964c25a8046fce5c 100644 (file)
@@ -31,10 +31,14 @@ void AliT0SetCDB()
                  "Set calibration coefficients");
   menu->AddButton("Set Align","SetAC()",
                  "Set alignment coefficients");
+  menu->AddButton("Set LookUpTable","SetLookUp()",
+                  "Set LookUp table");
   menu->AddButton("Read calibration CC","GetCC()",
                  "Read calibration  coefficients");
   menu->AddButton("Read alignment CC","GetAC()",
                  "Read face detector position ");
+  menu->AddButton("Read Lookup","GetLookUp()",
+                 "Read Lookup table ");
   menu->Show();
 }
 
@@ -74,7 +78,7 @@ void SetAC()
 
   //  AliCDBStorage* storage = AliCDBManager::Instance()->GetSpecificStorage("T0");
   AliCDBStorage* storage = AliCDBManager::Instance()->GetDefaultStorage();
- if(storage) {
 if(storage) {
    AliCDBId id(fPath.Data(),firstRun,lastRun);
 
    storage->Put(alignda, id, &md);
@@ -174,3 +178,69 @@ void GetAC()
   AliT0AlignData *aln = (AliT0AlignData*)entry->GetObject();
   aln->Print();
 }
+//------------------------------------------------------------------------
+void SetLookUp()
+{
+  // Writing Lookup table into the Calibration DB
+  // Arguments:
+
+  TString DBFolder;
+  Int_t firstRun   =  0;
+  Int_t lastRun    = 10;
+  Int_t beamPeriod =  1;
+  char* objFormat  = "";
+
+  DBFolder  ="local://Calib";
+  firstRun  =  0;
+  lastRun   =  10;
+  objFormat = "T0 Lookup Table";
+
+  AliT0CalibData *calibda=new AliT0CalibData("T0");
+
+  calibda->ReadAsciiLookup("lookUpTable.txt");
+//calibda->SetA(5);
+  //Store calibration data into database
+  AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
+
+  //  AliCDBManager::Instance()->SetSpecificStorage("T0",DBFolder.Data());
+
+  AliCDBMetaData md;
+  md.SetComment(objFormat);
+  md.SetBeamPeriod(beamPeriod);
+  md.SetResponsible("Alla");
+  TString fPath="T0/Calib/LookUp_Table";
+
+
+  // AliCDBStorage* storage = AliCDBManager::Instance()->GetSpecificStorage("T0");
+  AliCDBStorage* storage = AliCDBManager::Instance()->GetDefaultStorage();
+  if(storage) {
+    AliCDBId id(fPath.Data(),firstRun,lastRun);
+    storage->Put(calibda, id, &md);
+  }
+}
+//------------------------------------------------------------------------
+void GetLookUp()
+{
+  // Read calibration coefficients into the Calibration DB
+  // Arguments:
+
+  TString DBFolder;
+
+  //  DBFolder  ="local://Calib";
+  //   Int_t nRun=gAlice->GetRunNumber();
+  AliCDBManager* cdb      = AliCDBManager::Instance();
+  AliCDBStorage *stor = cdb->GetStorage("local://$ALICE_ROOT");
+  // cout<<" GetLookUp :: "<<stor<<endl;
+  AliCDBEntry *entry;
+  //entry = stor->Get("T0/Calib/LookUp_Table",2,0,0);
+  entry = stor->Get("T0/Calib/LookUp_Table",1);
+  //cout<<"entry="<<entry<<endl;
+   cout<<" AliT0CalibData ::GetLookUp :: "<<entry<<endl;
+  AliT0CalibData *clb = (AliT0CalibData*)entry->GetObject();
+  cout<<" AliT0CalibData *clb "<<clb <<endl;
+  //cout<<"clb->a="<<clb->GetA()<<endl;
+  //  clb->Dump();
+  for (Int_t i=0; i<6; i++) 
+    clb->PrintLookup("all",0,i,4);
+
+}