]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
First version of the SHUTTLE preprocessor (Haavard, Marian)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 22 Mar 2007 11:54:22 +0000 (11:54 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 22 Mar 2007 11:54:22 +0000 (11:54 +0000)
TPC/AliTPCDBTemp.C [new file with mode: 0644]
TPC/AliTPCDBTemp.h [new file with mode: 0644]
TPC/AliTPCPreprocessor.cxx [new file with mode: 0644]
TPC/AliTPCPreprocessor.h [new file with mode: 0644]
TPC/AliTPCSensorTemp.cxx [new file with mode: 0644]
TPC/AliTPCSensorTemp.h [new file with mode: 0644]
TPC/AliTPCSensorTempArray.cxx [new file with mode: 0644]
TPC/AliTPCSensorTempArray.h [new file with mode: 0644]
TPC/AliTPCcalibDB.cxx
TPC/AliTPCcalibDB.h

diff --git a/TPC/AliTPCDBTemp.C b/TPC/AliTPCDBTemp.C
new file mode 100644 (file)
index 0000000..7cffba4
--- /dev/null
@@ -0,0 +1,113 @@
+/**
+.L /afs/cern.ch/user/h/haavard/alice/tpc/temperature/AliSplineFit.cxx+
+.L /afs/cern.ch/user/h/haavard/alice/tpc/temperature/AliDCSSensor.cxx+
+.L /afs/cern.ch/user/h/haavard/alice/tpc/temperature/AliDCSSensorArray.cxx+
+.L /afs/cern.ch/user/h/haavard/alice/tpc/temperature/AliTPCSensorTemp.cxx+
+.L /afs/cern.ch/user/h/haavard/alice/tpc/temperature/AliTPCSensorTempArray.cxx+
+.L /afs/cern.ch/user/h/haavard/alice/tpc/temperature/AliTPCDBTemp.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
+AliTPCDBTemp db
+db->Init(run)
+db->MakeCalib("TempSensor.txt","DCSMap.root",startTime,endTime,run)
+
+
+**/
+#include "AliTPCDBTemp.h"
+
+AliTPCDBTemp::AliTPCDBTemp(): 
+   fFirstRun(0),
+   fLastRun(0),
+   fTemperature(0),
+   fStorLoc(0),
+   fCalib(0),
+   fMetaData(0)
+{}
+
+
+
+void AliTPCDBTemp::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 *fTemperature = new AliTPCSensorTempArray(fList);
+   fTemperature->SetStartTime(startTime);
+   fTemperature->SetEndTime(endTime);
+   TMap* map = SetGraphFile(fMap);
+   if (map) {
+     fTemperature->MakeSplineFit(map);
+   }
+   delete map;
+
+   SetFirstRun(run);
+   SetLastRun(run);                
+   StoreObject("TPC/Calib/Temperature",fTemperature, fMetaData);
+}
+
+
+AliCDBMetaData* AliTPCDBTemp::CreateMetaObject(const char* objectClassName)
+{
+  AliCDBMetaData *md1= new AliCDBMetaData(); 
+  md1->SetObjectClassName(objectClassName);
+  md1->SetResponsible("Haavard Helstrup");
+  md1->SetBeamPeriod(2);
+  md1->SetAliRootVersion("05-13-04"); //root version
+  md1->SetComment("Temperature values");
+  
+  return md1;
+}
+
+void AliTPCDBTemp::StoreObject(const char* cdbPath, TObject* object, AliCDBMetaData* metaData)
+{
+
+  AliCDBId id1(cdbPath, fFirstRun, fLastRun); 
+  if (fStorLoc) fStorLoc->Put(object, id1, metaData); 
+}
+
+void AliTPCDBTemp::Init(Int_t run){
+
+//   Int_t kLastRun=4000;
+//   Long64_t longRun;
+   
+   SetFirstRun(run);
+   SetLastRun(run); 
+       
+   InitDB(run);
+//   fCalib = AliTPCcalibDB::Instance();    
+//   longRun=run;
+//   fCalib->SetRun(longRun);
+//   fTemperature = fCalib->GetTemperature();
+     
+}
+
+void AliTPCDBTemp::InitDB(Int_t run)
+{ 
+   //   Data base generation
+   
+//   printf ("Data base creation started.. \n");
+   char   *CDBpath="local:///afs/cern.ch/alice/tpctest/Calib/";
+
+   fMetaData = CreateMetaObject("AliTPCSensorTempArray");
+   AliCDBManager *man = AliCDBManager::Instance();
+   man->SetDefaultStorage("local:///afs/cern.ch/alice/tpctest/AliRoot/HEAD"); 
+   man->SetRun(run);
+   man->SetSpecificStorage("TPC/*/*","local:///afs/cern.ch/alice/tpctest/Calib");
+   fStorLoc = man->GetStorage(CDBpath);
+   if (!fStorLoc)    return;
+}
+//_____________________________________________________________________________
+TMap* AliTPCDBTemp::SetGraphFile(const char *fname)
+{
+  // 
+  // Read DCS maps from file given by fname 
+  //
+  TFile file(fname);
+  TMap * map = (TMap*)file.Get("DCSMap");
+  return map;
+}
diff --git a/TPC/AliTPCDBTemp.h b/TPC/AliTPCDBTemp.h
new file mode 100644 (file)
index 0000000..41bf7d3
--- /dev/null
@@ -0,0 +1,52 @@
+/////////////////////////////////////////////////////////////////
+// Class to generate temperature sensor data base entries. 
+// 
+// Existing data base structure read at start of processsing.
+// 20/12-2006 HH.
+// Modification log:
+/////////////////////////////////////////////////////////////////
+
+#ifndef AliTPCDBTemp_h
+#define AliTPCDBTemp_h
+
+#include <TROOT.h>
+#include <TProfile.h>
+#include <TProfile2D.h>
+#include <TH1F.h>
+#include <TFile.h>
+#include <TObjArray.h>
+
+#include "AliTPCcalibDB.h"
+#include "AliCDBMetaData.h"
+#include "AliCDBManager.h"
+#include "AliCDBId.h"
+#include "AliCDBStorage.h"
+#include "AliTPCSensorTempArray.h"
+#include "AliLog.h"
+
+class AliTPCDBTemp {
+
+public:
+
+  AliTPCDBTemp();
+  void            MakeCalib(const char *file, const char *fMap,
+                            const TTimeStamp& startTime,
+                           const TTimeStamp& endTime, Int_t run);
+  AliCDBMetaData* CreateMetaObject(const char *objectClassName);
+  void            StoreObject(const char* cdbPath, TObject* object, AliCDBMetaData* metaData);
+  void            Init(Int_t run);
+  void            InitDB(Int_t run);
+  void            SetFirstRun(Int_t frun){fFirstRun=frun;}
+  void            SetLastRun(Int_t lrun) {fLastRun=lrun;}
+  TMap*           SetGraphFile(const char* fname);
+
+private:
+
+   Int_t          fFirstRun;
+   Int_t          fLastRun;
+   AliTPCSensorTempArray  *fTemperature;
+   AliCDBStorage  *fStorLoc;
+   AliTPCcalibDB  *fCalib;
+   AliCDBMetaData *fMetaData;
+};
+#endif
diff --git a/TPC/AliTPCPreprocessor.cxx b/TPC/AliTPCPreprocessor.cxx
new file mode 100644 (file)
index 0000000..923cba7
--- /dev/null
@@ -0,0 +1,116 @@
+/**************************************************************************
+ * Copyright(c) 2007, ALICE Experiment at CERN, All rights reserved.      *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+#include "AliTPCPreprocessor.h"
+
+#include "AliCDBMetaData.h"
+#include "AliDCSValue.h"
+#include "AliLog.h"
+#include "AliTPCSensorTempArray.h"
+
+#include <TTimeStamp.h>
+
+//
+// This class is the SHUTTLE preprocessor for the TPC detector.
+// It contains several components, this far the part containing 
+// temperatures is implemented
+//
+
+ClassImp(AliTPCPreprocessor)
+
+//______________________________________________________________________________________________
+AliTPCPreprocessor::AliTPCPreprocessor(const char* detector, AliShuttleInterface* shuttle) :
+  AliPreprocessor(detector, shuttle),
+  fTemp(0)
+{
+  // constructor
+}
+
+//______________________________________________________________________________________________
+AliTPCPreprocessor::~AliTPCPreprocessor()
+{
+  // destructor
+  
+  delete fTemp;
+}
+
+//______________________________________________________________________________________________
+void AliTPCPreprocessor::Initialize(Int_t run, UInt_t startTime,
+       UInt_t endTime)
+{
+  // Creates AliTestDataDCS object
+
+  AliPreprocessor::Initialize(run, startTime, endTime);
+
+       AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
+               TTimeStamp(startTime).AsString(),
+               TTimeStamp(endTime).AsString()));
+
+        fTemp = new AliTPCSensorTempArray(fStartTime, fEndTime);
+}
+
+//______________________________________________________________________________________________
+UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
+{
+  // Fills data into TPC calibrations objects
+
+  if (!dcsAliasMap) return 0;
+
+  // Amanda servers provide information directly through dcsAliasMap
+
+  // Temperature sensors are processed by AliTPCCalTemp
+  
+  UInt_t tempResult = MapTemperature(dcsAliasMap);
+  UInt_t result=tempResult;
+  
+  // Other calibration information will be retrieved through FXS files
+  //  examples: 
+  //    TList* fileSourcesDAQ = GetFile(AliShuttleInterface::kDAQ, "pedestals");
+  //    const char* fileNamePed = GetFile(AliShuttleInterface::kDAQ, "pedestals", "LDC1");
+  //
+  //    TList* fileSourcesHLT = GetFile(AliShuttleInterface::kHLT, "calib");
+  //    const char* fileNameHLT = GetFile(AliShuttleInterface::kHLT, "calib", "LDC1");
+
+
+  return result;
+}
+//______________________________________________________________________________________________
+UInt_t AliTPCPreprocessor::MapTemperature(TMap* dcsAliasMap)
+{
+
+   // extract DCS temperature maps. Perform fits to save space
+
+  TMap *map = fTemp->ExtractDCS(dcsAliasMap);
+  if (map) {
+    fTemp->MakeSplineFit(map);
+    AliInfo(Form("Temperature values extracted, fits performed.\n"));
+  } else {
+    AliError(Form("No temperature map extracted.\n"));
+    Log("AliTPCPreprocsessor: no temperature map extracted. \n");
+  }
+  delete map;
+  // Now store the final CDB file
+  
+  AliCDBMetaData metaData;
+       metaData.SetBeamPeriod(0);
+       metaData.SetResponsible("Haavard Helstrup");
+       metaData.SetComment("Preprocessor AliTPC data base entries.");
+
+       UInt_t result = Store("TPC/Calib/Temperature", "Data", fTemp, &metaData, 0, 0);
+       delete fTemp;
+       fTemp = 0;
+
+   return result;
+}
diff --git a/TPC/AliTPCPreprocessor.h b/TPC/AliTPCPreprocessor.h
new file mode 100644 (file)
index 0000000..5afc601
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef ALI_TPC_PREPROCESSOR_H
+#define ALI_TPC_PREPROCESSOR_H
+
+#include "AliTPCPreprocessor.h"
+
+// test preprocessor that writes data to AliTestDataDCS
+
+class AliTestDataDCS;
+
+class AliTPCPreprocessor : public AliPreprocessor
+{
+  public:
+    AliTPCPreprocessor(const char* detector, AliShuttleInterface* shuttle);
+    virtual ~AliTPCPreprocessor();
+
+  protected:
+    virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+    virtual UInt_t Process(TMap* dcsAliasMap);
+    UInt_t AliTPCPreprocessor::MapTemperature(TMap* dcsAliasMap);
+
+
+  private:
+    AliTPCSensorTempArray  *fTemp;    // CDB class for temperature sensors
+
+    ClassDef(AliTPCPreprocessor, 0);
+};
+
+#endif
diff --git a/TPC/AliTPCSensorTemp.cxx b/TPC/AliTPCSensorTemp.cxx
new file mode 100644 (file)
index 0000000..4a2ed66
--- /dev/null
@@ -0,0 +1,191 @@
+/**************************************************************************
+ * Copyright(c) 2006-07, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+
+////////////////////////////////////////////////////////////////////////////////
+//                                                                            //
+// Class describing TPC temperature sensors (including pointers to graphs/fits//
+// Authors: Marian Ivanov, Haavard Helstrup and Martin Siska                  //
+//                                                                            //
+////////////////////////////////////////////////////////////////////////////////
+
+// Running instructions:
+/*
+  TClonesArray * arr = AliTPCSensorTemp::ReadList("TempSensor.txt");
+  TFile f("TempSensors.root","RECREATE");
+  TTree * tree = new TTree("TempSensor", "TempSensor");
+  tree->Branch("Temp",&arr);
+  tree->Fill();
+  tree->Write();
+  
+ */
+//
+
+
+#include "AliTPCSensorTemp.h"
+ClassImp(AliTPCSensorTemp);
+
+
+AliTPCSensorTemp::AliTPCSensorTemp(): AliDCSSensor(),
+  fType(0),
+  fSide(0),
+  fSector(0),
+  fNum(0)
+{
+  //
+  //  Standard constructor
+  //
+}
+
+AliTPCSensorTemp::AliTPCSensorTemp(const AliTPCSensorTemp& source) :
+  AliDCSSensor(source),
+   fType(source.fType),
+   fSide(source.fSide),
+   fSector(source.fSector),
+   fNum(source.fNum)
+
+//
+//  Copy constructor
+//
+{ }
+
+AliTPCSensorTemp& AliTPCSensorTemp::operator=(const AliTPCSensorTemp& source){
+//
+// assignment operator
+//
+  if (&source == this) return *this;
+  new (this) AliTPCSensorTemp(source);
+  
+  return *this;  
+}
+
+TClonesArray * AliTPCSensorTemp::ReadList(const char *fname) {
+   
+   Int_t firstSensor, lastSensor;
+   return ReadListInd(fname,firstSensor,lastSensor);
+}  
+
+TClonesArray * AliTPCSensorTemp::ReadListInd(const char *fname, 
+                                          Int_t& firstSensor,
+                                         Int_t& lastSensor ){
+  //
+  // read values from ascii file
+  //
+  TTree * tree = new TTree("asci","asci");
+  tree->ReadFile(fname,"");
+  
+  Int_t nentries = tree->GetEntries();
+  Int_t sensor=0;
+  Int_t sector=0;
+  char  type[100];
+  char  side[100];
+  Int_t num=0;
+  Int_t echa=0;
+  //Double_t x=0;
+  //Double_t y=0;
+  //Double_t z=0;
+  //String_t namedtp[100];
+
+  tree->SetBranchAddress("Sensor",&sensor);
+  tree->SetBranchAddress("Type",&type);
+  tree->SetBranchAddress("Side",&side);
+  tree->SetBranchAddress("Sec",&sector);
+  tree->SetBranchAddress("Num",&num);
+  tree->SetBranchAddress("ECha",&echa);
+  //tree->SetBranchAddress("X",&x);
+  //tree->SetBranchAddress("Y",&y);
+  //tree->SetBranchAddress("Z",&z);
+
+  firstSensor = (Int_t)tree->GetMinimum("ECha");
+  lastSensor = (Int_t)tree->GetMaximum("ECha");
+
+  TClonesArray * array = new TClonesArray("AliTPCSensorTemp",nentries);
+
+  for (Int_t isensor=0; isensor<nentries; isensor++){
+    AliTPCSensorTemp * temp = new ((*array)[isensor])AliTPCSensorTemp;
+    tree->GetEntry(isensor);
+    temp->SetId(sensor);
+    temp->SetIdDCS(echa);
+    if (side[0]=='C') temp->SetSide(1);
+    temp->SetSector(sector);
+    temp->SetNum(num);
+    //temp->SetType(type);
+    if (bcmp(type,"ROC",3)==0) temp->SetType(0);
+    if (bcmp(type,"OFC",3)==0) temp->SetType(1);
+    if (bcmp(type,"IFC",3)==0) temp->SetType(2);
+    if (bcmp(type,"TPC",3)==0) temp->SetType(3); 
+    if (bcmp(type,"ELM",3)==0) temp->SetType(4);
+    if (bcmp(type,"TS",2)==0)  temp->SetType(5);
+    if (bcmp(type,"COOL",3)==0)temp->SetType(6);
+    //temp->SetX(x);
+
+    if (temp->GetType()==0){
+       temp->SetX(TMath::Cos((2*sector+1)*0.1745)*(83+(num+1)*30));
+    }
+    if ((temp->GetType()==1) || (temp->GetType()==4)){
+      temp->SetX(TMath::Cos((2*sector+1)*0.1745)*260);
+    }
+    if ((temp->GetType()==2) || (temp->GetType()==3)){
+      temp->SetX(TMath::Cos((2*sector+1)*0.1745)*83);
+    }
+    if ((temp->GetType()==5) || (temp->GetType()==6)){
+      temp->SetX(0);
+    }
+    
+    //temp->SetY(y);
+    if (temp->GetType()==0){
+         temp->SetY(TMath::Sin((2*sector+1)*0.1745)*(83+(num+1)*30));
+    }
+    if ((temp->GetType()==1) || (temp->GetType()==4)){
+      temp->SetY(TMath::Sin((2*sector+1)*0.1745)*260);
+    }
+    if ((temp->GetType()==2) || (temp->GetType()==3)){
+      temp->SetY(TMath::Sin((2*sector+1)*0.1745)*83);
+    }
+    if ((temp->GetType()==5) || (temp->GetType()==6)){
+      temp->SetY(0);
+    }
+    //temp->SetZ(z);
+    if ((temp->GetType()==0 || temp->GetType()==3 || temp->GetType()==4 || temp->GetType()==5 || temp->GetType()==6) && temp->GetSide()==0) {
+      temp->SetZ(260);
+      }
+    if ((temp->GetType()==0 || temp->GetType()==3 || temp->GetType()==4 || temp->GetType()==5 || temp->GetType()==6) && temp->GetSide()==1){
+      temp->SetZ(-260);
+      }
+    if((temp->GetType()==1 || temp->GetType()==2) && (num==0)) {
+      temp->SetZ(250);
+      }
+    if((temp->GetType()==1 || temp->GetType()==2) && (num==1)) {
+      temp->SetZ(180);
+      }
+    if((temp->GetType()==1 || temp->GetType()==2) && (num==2)) {
+      temp->SetZ(60);
+      }
+    if((temp->GetType()==1 || temp->GetType()==2) && (num==3)) {
+      temp->SetZ(-60);
+      }
+    if((temp->GetType()==1 || temp->GetType()==2) && (num==4)) {
+      temp->SetZ(-180);
+      }
+    if((temp->GetType()==1 || temp->GetType()==2) && (num==5)) {
+      temp->SetZ(-250);
+      }
+    Char_t chname[1000];
+    sprintf(chname,"tpc_temp:PT_%i.Temperature",echa);
+    temp->SetName(chname);
+  }
+  delete tree;  
+  return array;
+}
diff --git a/TPC/AliTPCSensorTemp.h b/TPC/AliTPCSensorTemp.h
new file mode 100644 (file)
index 0000000..e5e973e
--- /dev/null
@@ -0,0 +1,71 @@
+#ifndef AliTPCSensorTemp_H
+#define AliTPCSensorTemp_H
+/* Copyright(c) 2006-07, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+
+////////////////////////////////////////////////////////////////////////////
+//              Container class for temperature sensor positions            
+////////////////////////////////////////////////////////////////////////////
+
+
+#include "TMath.h"
+#include "AliSplineFit.h"
+#include "AliDCSSensor.h"
+#include "TTree.h"
+
+class TObject;
+class TClonesArray;
+class TObjArray;
+class TGraph;
+class TVector3;
+class TFile;
+class TString;
+class TTimeStamp;
+
+
+////////////////////////////////////////////////////////////////////////
+//              Class AliTPCSensorTempSensors
+////////////////////////////////////////////////////////////////////////
+
+class AliTPCSensorTemp : public AliDCSSensor {
+
+public:
+  AliTPCSensorTemp();
+  AliTPCSensorTemp(const AliTPCSensorTemp& source);
+  virtual ~AliTPCSensorTemp(){}
+  AliTPCSensorTemp& operator=(const AliTPCSensorTemp& source);
+  
+  Int_t       GetType()   const {return fType;   }
+  Int_t       GetSide()   const {return fSide;  }
+  Int_t       GetSector() const {return fSector;        }
+  Int_t       GetNum()   const {return fNum;    }
+
+  void SetType   (Int_t type)      {fType   = type;   }
+  void SetSide   (Int_t side)      {fSide   = side;     }
+  void SetSector (Int_t sector)    {fSector = sector;}
+  void SetNum    (Int_t num)       {fNum    = num;   }
+
+
+  static TClonesArray * ReadList(const char *fname);
+  static TClonesArray * ReadListInd(const char *fname,
+                                 Int_t& firstSensor, Int_t& lastSensor);
+
+protected:
+  Int_t fType;      // Position of sensors on fieldcage
+                    //  (0=ROC,1=OFC,2=IFC,3=TPC,4=ELM,5=TS,6=COOL)
+  Int_t fSide;      // TPC side; 0:Shaft Side (A) -- 1:Muon Side (C)
+  Int_t fSector;    // Number of sector             (0-17)
+  Int_t fNum;       // Position depands from type of sensor.
+                    //    fType=0(0-4) from inside to outside
+                    //    fType=1(0-5) fom A side to C side
+                    //    fType=2(0-5) fom A side to C side
+                    //    fType=3(0)   one per sector 
+                    //    fType=4()
+                    //    fType=5()
+                    // fType=6(0-1) 0:input -- 1:output
+
+
+  ClassDef(AliTPCSensorTemp,1);
+};
+#endif
diff --git a/TPC/AliTPCSensorTempArray.cxx b/TPC/AliTPCSensorTempArray.cxx
new file mode 100644 (file)
index 0000000..0c0fb89
--- /dev/null
@@ -0,0 +1,161 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TPC calibration class for parameters which saved per pad                 //
+//  Authors: Marian Ivanov and Haavard Helstrup                              //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTPCSensorTempArray.h"
+
+ClassImp(AliTPCSensorTempArray)
+
+const char kFname[] = "TempSensor.txt";
+const Int_t  kMinGraph = 10;       // minimum #points of graph to be fitted
+const Int_t  kMinPoints = 10;      // minimum number of points per knot in fit
+const Int_t  kIter = 10;           // number of iterations for spline fit
+const Double_t  kMaxDelta = 0.00;  // precision parameter for spline fit
+const Int_t  kFitReq = 2;          // fit requirement, 2 = continuous 2nd derivative
+
+//_____________________________________________________________________________
+AliTPCSensorTempArray::AliTPCSensorTempArray():AliDCSSensorArray()
+{
+  //
+  // AliTPCSensorTempArray default constructor
+  //
+  fSensors = 0;
+  fFirstSensor = 0;
+  fLastSensor = 0;
+  TTimeStamp defTime(2000,1,1,0,0,0);
+  fStartTime = defTime;
+  fEndTime = defTime;
+
+}
+//_____________________________________________________________________________
+AliTPCSensorTempArray::AliTPCSensorTempArray(Int_t prevRun) : 
+                AliDCSSensorArray(prevRun,"TPC/Calib/Temperature")
+{
+}
+//_____________________________________________________________________________
+AliTPCSensorTempArray::AliTPCSensorTempArray(UInt_t startTime, UInt_t endTime)
+             :AliDCSSensorArray()
+{
+  //
+  // AliTPCSensorTempArray default constructor
+  //
+  fSensors = AliTPCSensorTemp::ReadListInd(kFname,fFirstSensor,fLastSensor);
+  fStartTime = TTimeStamp(startTime);
+  fEndTime   = TTimeStamp(endTime);
+
+}
+
+//_____________________________________________________________________________
+AliTPCSensorTempArray::AliTPCSensorTempArray(const char *fname) : 
+                                                  AliDCSSensorArray()
+{
+  //
+  // AliTPCSensorTempArray constructor
+  //
+  fSensors = AliTPCSensorTemp::ReadListInd(fname,fFirstSensor,fLastSensor);
+  fSensors->BypassStreamer(kFALSE);
+  TTimeStamp defTime(2000,1,1,0,0,0);
+  fStartTime = defTime;
+  fEndTime = defTime;
+
+}
+
+
+//_____________________________________________________________________________
+AliTPCSensorTempArray::AliTPCSensorTempArray(const AliTPCSensorTempArray &c):
+  AliDCSSensorArray(c)
+{
+  //
+  // AliTPCSensorTempArray copy constructor
+  //
+
+}
+
+///_____________________________________________________________________________
+AliTPCSensorTempArray::~AliTPCSensorTempArray()
+{
+  //
+  // AliTPCSensorTempArray destructor
+  //
+  fSensors->Delete();
+  delete fSensors;
+
+}
+
+//_____________________________________________________________________________
+AliTPCSensorTempArray &AliTPCSensorTempArray::operator=(const AliTPCSensorTempArray &c)
+{
+  //
+  // Assignment operator
+  //
+
+  if (this != &c) ((AliTPCSensorTempArray &) c).Copy(*this);
+  return *this;
+
+}
+
+//_____________________________________________________________________________
+void AliTPCSensorTempArray::Copy(TObject &c) const
+{
+  //
+  // Copy function
+  //
+
+  TObject::Copy(c);
+}
+//_____________________________________________________________________________
+void AliTPCSensorTempArray::ReadSensors(const char *fname) 
+{
+  //
+  // Read list of temperature sensors from text file
+  //
+  fSensors = AliTPCSensorTemp::ReadListInd(fname,fFirstSensor,fLastSensor);
+}  
+//_____________________________________________________________________________
+void AliTPCSensorTempArray::SetGraph(TMap *map) 
+{
+  // 
+  // Read graphs from DCS maps 
+  //
+  AliDCSSensorArray::SetGraph(map,"tpc_temp:PT_%d.Temperature");
+}  
+//_____________________________________________________________________________
+void AliTPCSensorTempArray::MakeSplineFit(TMap *map) 
+{
+  // 
+  // Make spline fits from DCS maps 
+  //
+  AliDCSSensorArray::MakeSplineFit(map,"tpc_temp:PT_%d.Temperature");
+}  
+
+
+//_____________________________________________________________________________
+TMap* AliTPCSensorTempArray::ExtractDCS(TMap *dcsMap) 
+{
+ //
+ // Extract temperature graphs from DCS maps
+ //
+
+ TMap *values = AliDCSSensorArray::ExtractDCS(dcsMap,"tpc_temp:PT_%d.Temperature");
+ return values;
+}
+
diff --git a/TPC/AliTPCSensorTempArray.h b/TPC/AliTPCSensorTempArray.h
new file mode 100644 (file)
index 0000000..35f1847
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef AliTPCSensorTempArray_H
+#define AliTPCSensorTempArray_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TPC calibration class for temperature sensors                            //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+
+#include "AliTPCSensorTemp.h"
+#include "AliDCSSensorArray.h"
+
+class TTimeStamp;
+class TMap;
+class TGraph;
+class TObjString;
+class AliSplineFit;
+class AliDCSSensor;
+
+class AliTPCSensorTempArray : public AliDCSSensorArray {
+ public:
+  AliTPCSensorTempArray();
+  AliTPCSensorTempArray(Int_t prevRun); 
+  AliTPCSensorTempArray(const char *fname);
+  AliTPCSensorTempArray (UInt_t startTime, UInt_t endTime);
+  AliTPCSensorTempArray(const AliTPCSensorTempArray &c);   
+  virtual ~AliTPCSensorTempArray();
+  AliTPCSensorTempArray &operator=(const AliTPCSensorTempArray &c);
+  virtual void Copy (TObject &c) const;
+  void SetGraph     (TMap *map);
+  void MakeSplineFit(TMap *map);
+  void ReadSensors  (const char *fname);
+  TMap* ExtractDCS  (TMap *dcsMap);
+
+ protected:
+
+  ClassDef(AliTPCSensorTempArray,1)       //  TPC calibration class for parameters which are saved per pad
+
+};
+
+#endif
index 50be7ddce0cecee8c8861154cb0b5d5617b01db1..528a17b3887c7f332d29fa3b99aa51b425a34c0e 100644 (file)
 
 #include "AliTPCcalibDB.h"
 
-#include "AliTPCParam.h"
 #include "AliTPCCalROC.h"
 #include "AliTPCCalPad.h"
 #include "AliTPCCalDet.h"
+#include "AliTPCSensorTempArray.h"
 
 ClassImp(AliTPCcalibDB)
 
@@ -79,19 +79,22 @@ void AliTPCcalibDB::Terminate()
 
 //_____________________________________________________________________________
 AliTPCcalibDB::AliTPCcalibDB()
-              :TObject(),
-              fRun(-1),
-              fPadGainFactor(0),
-              fPadTime0(0),
-              fPadPRFWidth(0),
-              fPadNoise(0),
-              fPedestals(0),
-              fParam(0)
 {
   //
   // constructor
   //  
-  fRun = AliCDBManager::Instance()->GetRun();
+  fRun = -1;
+      
+  //
+  //
+  //
+  fPadGainFactor = 0;
+  fPadTime0      = 0;
+  fPadPRFWidth   = 0;
+  fPadNoise      = 0;
+  fPedestals     = 0;
+  fTemperature   = 0;
+  fParam         = 0;
   Update();    // temporary
 }
 
@@ -107,7 +110,6 @@ AliTPCcalibDB::~AliTPCcalibDB()
   //if (fPadTime0) delete fPadTime0;
   //if (fPadPRFWidth) delete fPadPRFWidth;
   //if (fPadNoise) delete fPadNoise;
-  if (fParam) {delete fParam; fParam = 0;}
 }
 
 
@@ -187,9 +189,16 @@ void AliTPCcalibDB::Update(){
     fPedestals = (AliTPCCalPad*)entry->GetObject();
   }
 
+  entry          = GetCDBEntry("TPC/Calib/Temperature");
+  if (entry){
+    //if (fTemperature) delete fTemperature;
+    entry->SetOwner(kTRUE);
+    fTemperature = (AliTPCSensorTempArray*)entry->GetObject();
+  }
+
   entry          = GetCDBEntry("TPC/Calib/Parameters");
   if (entry){
-    if (fParam) {delete fParam; fParam = 0;}
+    //if (fPadNoise) delete fPadNoise;
     entry->SetOwner(kTRUE);
     fParam = (AliTPCParam*)(entry->GetObject()->Clone());
   }
@@ -199,54 +208,3 @@ void AliTPCcalibDB::Update(){
   AliCDBManager::Instance()->SetCacheFlag(cdbCache); // reset original CDB cache
   
 }
-
-
-AliTPCCalPad*  AliTPCcalibDB::GetPadGainFactor() {
-  //
-  // GetPadGainFactor  
-  //
-  if (!fPadGainFactor) AliFatal("Pad gain calibration entry not available\n");  
-  return fPadGainFactor;
-}
-AliTPCCalPad*  AliTPCcalibDB::GetPadTime0() {
-  //
-  //   GetPadTime0
-  //
-  if (!fPadTime0) AliFatal("Time 0 calibration entry not available\n");  
-  return fPadTime0;
-}
-
-AliTPCCalPad*  AliTPCcalibDB::GetPadPRFWidth() {
-  //
-  // GetPRF width  
-  //
-  if (!fPadPRFWidth) AliFatal("PRF calibration entry not available\n");    
-  return fPadPRFWidth;
-}
-
-AliTPCCalPad*  AliTPCcalibDB::GetPadNoise() {
-  //
-  // GetPadNoise  
-  //
-  if (!fPadNoise) AliFatal("Pad noise calibration entry not available\n");  
-  return fPadNoise;
-}
-
-AliTPCCalPad*  AliTPCcalibDB::GetPedestals() {
-  //
-  // GetPedestal  
-  //
-  if (!fPadGainFactor) AliFatal("Pedestal calibration entry not available\n");  
-  return fPedestals;
-}
-
-AliTPCParam*   AliTPCcalibDB::GetParameters(){
-  //
-  // GetParameters
-  //
-  if (!fParam) AliFatal("Parameters calibration entry not available\n");  
-  return fParam;
-}
-
-
-
index 3e64ab413aaad4659b085002e0e54c991ccfd38e..b2455880452408c93d5bb28735eb85de533a3ec0 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "TObject.h"
 class AliTPCCalPad;
+class AliTPCSensorTempArray;
 class AliCDBEntry;
 class AliTPCParam;
 //class AliCDBStorage;
@@ -25,12 +26,13 @@ class AliTPCcalibDB : public TObject
   static void Terminate();
   void   SetRun(Long64_t run);   
   //
-  AliTPCCalPad* GetPadGainFactor();
-  AliTPCCalPad* GetPadTime0();
-  AliTPCCalPad* GetPadPRFWidth();
-  AliTPCCalPad* GetPadNoise();
-  AliTPCCalPad* GetPedestals();
-  AliTPCParam*  GetParameters();
+  AliTPCCalPad* GetPadGainFactor() {return fPadGainFactor;}
+  AliTPCCalPad* GetPadTime0() {return fPadTime0;}
+  AliTPCCalPad* GetPadPRFWidth() {return fPadPRFWidth;}
+  AliTPCCalPad* GetPadNoise() {return fPadNoise;}
+  AliTPCCalPad* GetPedestals() {return fPedestals;}
+  AliTPCSensorTempArray* GetTemperature() {return fTemperature;}
+  AliTPCParam*  GetParameters(){return fParam;}
   //
 protected:
   void         Update();  //update entries
@@ -45,15 +47,13 @@ protected:
   AliTPCCalPad* fPadPRFWidth;
   AliTPCCalPad* fPadNoise;
   AliTPCCalPad* fPedestals;
+  AliTPCSensorTempArray* fTemperature;
   //
   //
   AliTPCParam * fParam;
   //
   static AliTPCcalibDB* fgInstance;
   static Bool_t       fgTerminated;
- private:
-  AliTPCcalibDB(const AliTPCcalibDB &param); // copy constructor
-  AliTPCcalibDB &operator = (const AliTPCcalibDB & param);
   ClassDef(AliTPCcalibDB, 0)
 };