Updates to ease generating TPC/Config/Temperature OCDB entries
authorhaavard <haavard@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 Jan 2008 09:15:31 +0000 (09:15 +0000)
committerhaavard <haavard@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 Jan 2008 09:15:31 +0000 (09:15 +0000)
TPC/AliTPCGenDBTemp.cxx
TPC/AliTPCGenDBTemp.h
TPC/AliTPCSensorTemp.cxx
TPC/AliTPCSensorTemp.h

index f4c153e..27a27a7 100644 (file)
@@ -1,5 +1,4 @@
 
-// .L /afs/cern.ch/user/h/haavard/alice/tpc/temperature/AliTPCGenDBTemp.C+
 // TTimeStamp startTime(2006,10,18,0,0,0,0,kFALSE)
 // TTimeStamp endTime(2006,10,19,0,0,0,0,kFALSE)
 // Int_t run=2546
@@ -7,6 +6,18 @@
 // db->Init(run,"TPC/Config/Temperature","TPC/*/*")
 // db->MakeCalib("TempSensor.txt","DCSMap.root",startTime,endTime,run)
 
+//  Data base entry generation:
+  
+//  AliTPCGenDBTemp db
+//  db->SetDefaultStorage("local://$ALICE_ROOT");
+//  db->SetSpecificStorage("local:///afs/cern.ch/alice/tpctest/Calib/");
+//  db->Init(0,"TPC/Config/Temperature","TPC/*/*")
+//  db->MakeConfig("TempSensor.txt",0,999999999,"TPC/Config/Temperature")
+
+  
+
+
+
 
 #include "AliTPCGenDBTemp.h"
 #include "AliLog.h"
@@ -50,7 +61,7 @@ AliTPCGenDBTemp::~AliTPCGenDBTemp(){
 
 }
 //______________________________________________________________________________________________
-AliTPCGenDBTemp& AliTPCGenDBTemp::operator= (const AliTPCGenDBTemp& org )
+AliTPCGenDBTemp& AliTPCGenDBTemp::operator= (const AliTPCGenDBTemp&  )
 {
  //
  // assignment operator
@@ -92,27 +103,56 @@ void AliTPCGenDBTemp::MakeCalib(const char *fList, const char *fMap,
 
 //______________________________________________________________________________________________
 
-TClonesArray * AliTPCGenDBTemp::ReadList(const char *fname) {
+TClonesArray * AliTPCGenDBTemp::ReadList(const char *fname, const char *title,
+                       const TString& amandaString) {
   //
   // read values from ascii file
   //
-  TTree* tree = new TTree("tempConf","tempConf");
+  TTree* tree = new TTree(title,title);
   tree->ReadFile(fname,"");
-  TClonesArray *arr = AliTPCSensorTemp::ReadTree(tree);
+  TClonesArray *arr;
+  if ( amandaString.Length()== 0 ) {
+    arr = AliTPCSensorTemp::ReadTree(tree);
+  } else {
+    arr = AliTPCSensorTemp::ReadTree(tree,amandaString);
+  }
   delete tree;
   return arr;
 }
 
 //______________________________________________________________________________________________
 
-TTree * AliTPCGenDBTemp::ReadListTree(const char *fname) {
+TTree * AliTPCGenDBTemp::ReadListTree(const char *fname, const char *title,
+                         const TString& amandaString) {
   //
   // read values from ascii file
   //
-  TTree* tree = new TTree("tempConf","tempConf");
+  TTree* tree = new TTree(title,title);
   tree->ReadFile(fname,"");
-  TClonesArray *arr = AliTPCSensorTemp::ReadTree(tree);
+  TClonesArray *arr;
+  if ( amandaString.Length()== 0 ) {
+    arr = AliTPCSensorTemp::ReadTree(tree);
+  } else {
+    arr = AliTPCSensorTemp::ReadTree(tree,amandaString);
+  }
   arr->Delete();
   delete arr;
   return tree;
 }
+//______________________________________________________________________________________________
+void AliTPCGenDBTemp::MakeConfig(const char *file, Int_t firstRun, Int_t lastRun, 
+                             const char *confDir, const TString& amandaString)
+{
+   //
+   // Store Configuration file to OCDB
+   //
+
+   TTree *tree = ReadListTree(file,amandaString);
+   SetConfTree(tree);
+   SetFirstRun(firstRun);
+   SetLastRun(lastRun);
+
+   StoreObject(confDir, fConfTree, fMetaData);
+}
+
+
index 26e6ab8..a5afef2 100644 (file)
@@ -17,6 +17,7 @@
 #include "AliLog.h"
 #include "AliDCSGenDB.h"
 
+
 class AliTPCGenDBTemp : public AliDCSGenDB {
 
 public:
@@ -29,14 +30,18 @@ public:
   void            MakeCalib(const char *file, const char *fMap,
                             const TTimeStamp& startTime,
                            const TTimeStamp& endTime, Int_t run);
+  void            MakeConfig(const char *file, Int_t firstRun, Int_t lastRun, 
+                            const char *confDir, const TString& amandaString=0);
 
 // functionality
 
-  static TClonesArray *  ReadList(const char* fname);
-  static TTree        *  ReadListTree(const char* fname);
+  static TClonesArray* ReadList(const char* fname, const char *title="tempConf", 
+                                 const TString& amandaString=0);
+  static TTree*   ReadListTree(const char* fname, const char *title="tempConf",
+                                 const TString& amandaString=0);
 
 // getters/setters
-
 
 private:
   AliTPCGenDBTemp(const AliTPCGenDBTemp& org);
index 63c5f7a..571d391 100644 (file)
 
 // Running instructions:
 /*
-  TClonesArray * arr = AliTPCSensorTemp::ReadList("TempSensor.txt");
+  TClonesArray * arr = AliTPCSensorTemp::ReadList("TempSensor.txt","tpc_PT_%d.Temperature");
   TFile f("TempSensors.root","RECREATE");
   TTree * tree = new TTree("TempSensor", "TempSensor");
   tree->Branch("Temp",&arr);
   tree->Fill();
   tree->Write();
   
- */
+*/
+
 //
 
 
@@ -162,13 +163,14 @@ AliTPCSensorTemp& AliTPCSensorTemp::operator=(const AliTPCSensorTemp& source){
 }
 //______________________________________________________________________________________________
 
-TClonesArray * AliTPCSensorTemp::ReadList(const char *fname) {
+TClonesArray * AliTPCSensorTemp::ReadList(const char *fname,
+                                          const TString& amandaString) {
   //
   // read values from ascii file
   //
   TTree * tree = new TTree("asci","asci");
   tree->ReadFile(fname,"");
-  TClonesArray *arr = ReadTree(tree);
+  TClonesArray *arr = ReadTree(tree, amandaString);
   delete tree;
   return arr;
 }
index eaff19b..04805ab 100644 (file)
@@ -49,7 +49,8 @@ public:
   void SetNum    (Int_t num)       {fNum    = num;   }
 
 
-  static TClonesArray * ReadList(const char *fname);
+  static TClonesArray * ReadList(const char *fname,
+                                 const TString& amandaString = kAmandaString);
   static TClonesArray * ReadTree(TTree *tree, 
                                  const TString& amandaString = kAmandaString);