]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Data base generation class for temperature sensors (Haavard)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 18 Jul 2007 10:20:27 +0000 (10:20 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 18 Jul 2007 10:20:27 +0000 (10:20 +0000)
TPC/AliTPCGenDBTemp.cxx [new file with mode: 0644]
TPC/AliTPCGenDBTemp.h [new file with mode: 0644]

diff --git a/TPC/AliTPCGenDBTemp.cxx b/TPC/AliTPCGenDBTemp.cxx
new file mode 100644 (file)
index 0000000..c58f498
--- /dev/null
@@ -0,0 +1,113 @@
+
+// .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
+// AliTPCGenDBTemp db
+// db->Init(run,"TPC/Config/Temperature","TPC/*/*")
+// db->MakeCalib("TempSensor.txt","DCSMap.root",startTime,endTime,run)
+
+
+#include "AliTPCGenDBTemp.h"
+
+ClassImp(AliTPCGenDBTemp)
+
+const Int_t kValCut = 100;         // discard temperatures > 100 degrees
+const Int_t kDiffCut = 5;         // discard temperature differences > 5 degrees
+
+//______________________________________________________________________________________________
+
+AliTPCGenDBTemp::AliTPCGenDBTemp():
+   AliDCSGenDB()
+{
+}
+
+//______________________________________________________________________________________________
+
+AliTPCGenDBTemp::AliTPCGenDBTemp(const AliTPCGenDBTemp& org):
+  AliDCSGenDB(org)
+{
+
+//
+//  Copy constructor
+//
+
+ ((AliTPCGenDBTemp &) org).Copy(*this);
+}
+
+//______________________________________________________________________________________________
+AliTPCGenDBTemp::~AliTPCGenDBTemp(){
+//
+// destructor
+//
+
+}
+//______________________________________________________________________________________________
+AliTPCGenDBTemp& AliTPCGenDBTemp::operator= (const AliTPCGenDBTemp& org )
+{
+ //
+ // assignment operator
+ //
+ if (&org == this) return *this;
+
+ new (this) AliTPCGenDBTemp(org);
+ return *this;
+}
+
+
+//______________________________________________________________________________________________
+
+void AliTPCGenDBTemp::MakeCalib(const char *fList, const char *fMap,
+                             const TTimeStamp& startTime,
+                            const TTimeStamp& endTime,
+                            Int_t run )
+{
+   // 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);
+   temperature->SetStartTime(startTime);
+   temperature->SetEndTime(endTime);
+   temperature->SetValCut(kValCut);
+   temperature->SetDiffCut(kDiffCut);
+   TMap* map = SetGraphFile(fMap);
+   if (map) {
+     temperature->MakeSplineFit(map);
+   }
+   delete map;
+   map=0;
+   fMap=0;
+
+   SetFirstRun(run);
+   SetLastRun(run);
+   SetSensorArray(temperature);
+   StoreObject("TPC/Calib/Temperature",temperature, fMetaData);
+}
+
+//______________________________________________________________________________________________
+
+TClonesArray * AliTPCGenDBTemp::ReadList(const char *fname) {
+  //
+  // read values from ascii file
+  //
+  TTree* tree = new TTree("tempConf","tempConf");
+  tree->ReadFile(fname,"");
+  TClonesArray *arr = AliTPCSensorTemp::ReadTree(tree);
+  delete tree;
+  return arr;
+}
+
+//______________________________________________________________________________________________
+
+TTree * AliTPCGenDBTemp::ReadListTree(const char *fname) {
+  //
+  // read values from ascii file
+  //
+  TTree* tree = new TTree("tempConf","tempConf");
+  tree->ReadFile(fname,"");
+  TClonesArray *arr = AliTPCSensorTemp::ReadTree(tree);
+  arr->Delete();
+  delete arr;
+  return tree;
+}
diff --git a/TPC/AliTPCGenDBTemp.h b/TPC/AliTPCGenDBTemp.h
new file mode 100644 (file)
index 0000000..b41c4be
--- /dev/null
@@ -0,0 +1,46 @@
+/////////////////////////////////////////////////////////////////
+// Class to generate temperature sensor data base entries.
+//
+// Existing data base structure read at start of processsing.
+// 20/12-2006 HH.
+// Modification log:
+/////////////////////////////////////////////////////////////////
+
+#ifndef AliTPCGenDBTemp_h
+#define AliTPCGenDBTemp_h
+
+#include <TROOT.h>
+#include <TFile.h>
+#include <TObjArray.h>
+
+#include "AliTPCSensorTempArray.h"
+#include "AliLog.h"
+#include "AliDCSGenDB.h"
+
+class AliTPCGenDBTemp : public AliDCSGenDB {
+
+public:
+
+// constructors
+
+  AliTPCGenDBTemp();
+  AliTPCGenDBTemp(const AliTPCGenDBTemp& org);
+  ~AliTPCGenDBTemp();
+  AliTPCGenDBTemp& operator= (const AliTPCGenDBTemp& org);
+  void            MakeCalib(const char *file, const char *fMap,
+                            const TTimeStamp& startTime,
+                           const TTimeStamp& endTime, Int_t run);
+
+// functionality
+
+  static TClonesArray *  ReadList(const char* fname);
+  static TTree        *  ReadListTree(const char* fname);
+
+// getters/setters
+
+
+private:
+
+   ClassDef(AliTPCGenDBTemp,1)
+};
+#endif