]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCGenDBTemp.cxx
Fix for coverity 17562
[u/mrichter/AliRoot.git] / TPC / AliTPCGenDBTemp.cxx
index f4c153eb18a19bc25865db0110d28d2c966236a6..95392c68e2b282f9c96fd8ec34f26b5c3d548898 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/OCDB");
+//  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"
@@ -32,7 +43,7 @@ AliTPCGenDBTemp::AliTPCGenDBTemp(const char *defaultStorage, const char *specifi
 
 //______________________________________________________________________________________________
 
-AliTPCGenDBTemp::AliTPCGenDBTemp(const AliTPCGenDBTemp& org) : AliDCSGenDB(org)
+AliTPCGenDBTemp::AliTPCGenDBTemp(const AliTPCGenDBTemp& ) : AliDCSGenDB()
 {
 
 //
@@ -50,7 +61,7 @@ AliTPCGenDBTemp::~AliTPCGenDBTemp(){
 
 }
 //______________________________________________________________________________________________
-AliTPCGenDBTemp& AliTPCGenDBTemp::operator= (const AliTPCGenDBTemp& org )
+AliTPCGenDBTemp& AliTPCGenDBTemp::operator= (const AliTPCGenDBTemp&  )
 {
  //
  // assignment operator
@@ -65,13 +76,18 @@ AliTPCGenDBTemp& AliTPCGenDBTemp::operator= (const AliTPCGenDBTemp& org )
 void AliTPCGenDBTemp::MakeCalib(const char *fList, const char *fMap,
                              const TTimeStamp& startTime,
                             const TTimeStamp& endTime,
-                            Int_t run )
+                            Int_t run, const TString& amandaString )
 {
    // The Terminate() function is the last function to be called during
    // a query. It always runs on the client, it can be used to present
    // the results graphically or save the results to file.
 
-   AliTPCSensorTempArray *temperature = new AliTPCSensorTempArray(fList);
+   AliTPCSensorTempArray *temperature=0;
+   if ( amandaString.Length()== 0 ) {
+    temperature = new AliTPCSensorTempArray(fList);
+   } else {
+    temperature = new AliTPCSensorTempArray(fList,amandaString);
+   }
    temperature->SetStartTime(startTime);
    temperature->SetEndTime(endTime);
    temperature->SetValCut(kValCut);
@@ -92,27 +108,48 @@ 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) {
   //
   // 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);
-  arr->Delete();
-  delete arr;
   return tree;
 }
+
+//______________________________________________________________________________________________
+void AliTPCGenDBTemp::MakeConfig(const char *file, Int_t firstRun, Int_t lastRun, 
+                             const char *confDir)
+{
+   //
+   // Store Configuration file to OCDB
+   //
+
+   TTree *tree = ReadListTree(file,"tempConf");
+   SetConfTree(tree);
+   SetFirstRun(firstRun);
+   SetLastRun(lastRun);
+
+   StoreObject(confDir, fConfTree, fMetaData);
+}
+
+