--- /dev/null
+/**************************************************************************
+ * 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 pressure sensors (including pointers to graphs/fits //
+// Authors: Marian Ivanov and Haavard Helstrup //
+// //
+////////////////////////////////////////////////////////////////////////////////
+
+// Running instructions:
+/*
+ TClonesArray * arr = AliTPCSensorPressure::ReadList("PressureSensor.txt");
+ TFile f("PressureSensors.root","RECREATE");
+ TTree * tree = new TTree("PressureSensor", "PressureSensor");
+ tree->Branch("Pressure",&arr);
+ tree->Fill();
+ tree->Write();
+
+ */
+//
+
+
+#include "AliTPCSensorPressure.h"
+ClassImp(AliTPCSensorPressure)
+
+
+
+AliTPCSensorPressure::AliTPCSensorPressure(): AliDCSSensor(),
+ fType(0),
+ fSide(0),
+ fSector(0),
+ fNum(0)
+{
+ //
+ // Standard constructor
+ //
+}
+
+AliTPCSensorPressure::AliTPCSensorPressure(const AliTPCSensorPressure& source) :
+ AliDCSSensor(source),
+ fType(source.fType),
+ fSide(source.fSide),
+ fSector(source.fSector),
+ fNum(source.fNum)
+
+//
+// Copy constructor
+//
+{ }
+
+AliTPCSensorPressure& AliTPCSensorPressure::operator=(const AliTPCSensorPressure& source){
+//
+// assignment operator
+//
+ if (&source == this) return *this;
+ new (this) AliTPCSensorPressure(source);
+
+ return *this;
+}
+
+TClonesArray * AliTPCSensorPressure::ReadList(const char *fname) {
+
+ Int_t firstSensor, lastSensor;
+ return ReadListInd(fname,firstSensor,lastSensor);
+}
+
+TClonesArray * AliTPCSensorPressure::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",§or);
+ 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("AliTPCSensorPressure",nentries);
+
+ for (Int_t isensor=0; isensor<nentries; isensor++){
+ AliTPCSensorPressure * temp = new ((*array)[isensor])AliTPCSensorPressure;
+ 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(280.);
+ temp->SetY(0.);
+ temp->SetZ(0.);
+
+ //temp->SetX(x);
+
+/* if (temp->GetType()==0){
+// temp->SetX(TMath::Cos((2*sector+1)*0.1745)*(83+(num+1)*30));
+ if (side[0]=='C') {
+ temp->SetX(kCSideX[sector][num]);
+ } else {
+ temp->SetX(kASideX[sector][num]);
+ }
+ }
+ if ((temp->GetType()==1) || (temp->GetType()==4)){
+ temp->SetX(TMath::Cos((2*sector+1)*0.1745)*278);
+ }
+ if ((temp->GetType()==2) || (temp->GetType()==3)){
+ temp->SetX(TMath::Cos((2*sector+1)*0.1745)*kIFCrad[num]);
+ }
+ 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 (side[0]=='C') {
+ temp->SetY(kCSideY[sector][num]);
+ } else {
+ temp->SetY(kASideY[sector][num]);
+ }
+ }
+ if ((temp->GetType()==1) || (temp->GetType()==4)){
+ temp->SetY(TMath::Sin((2*sector+1)*0.1745)*278);
+ }
+ if ((temp->GetType()==2) || (temp->GetType()==3)){
+ temp->SetY(TMath::Sin((2*sector+1)*0.1745)*kIFCrad[num]);
+ }
+ 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(250);
+ }
+ if ((temp->GetType()==0 || temp->GetType()==3 || temp->GetType()==4 || temp->GetType()==5 || temp->GetType()==6) && temp->GetSide()==1){
+ temp->SetZ(-250);
+ }
+ if((temp->GetType()==1 || temp->GetType()==2) && (num==0)) {
+ temp->SetZ(240);
+ }
+ if((temp->GetType()==1 || temp->GetType()==2) && (num==1)) {
+ temp->SetZ(168.4);
+ }
+ if((temp->GetType()==1 || temp->GetType()==2) && (num==2)) {
+ temp->SetZ(51);
+ }
+ if((temp->GetType()==1 || temp->GetType()==2) && (num==3)) {
+ temp->SetZ(-51);
+ }
+ if((temp->GetType()==1 || temp->GetType()==2) && (num==4)) {
+ temp->SetZ(-168.4);
+ }
+ if((temp->GetType()==1 || temp->GetType()==2) && (num==5)) {
+ temp->SetZ(-240);
+ }
+
+ */
+ }
+ delete tree;
+ return array;
+}
--- /dev/null
+#ifndef AliTPCSensorPressure_H
+#define AliTPCSensorPressure_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 AliTPCSensorPressure
+////////////////////////////////////////////////////////////////////////
+
+class AliTPCSensorPressure : public AliDCSSensor {
+
+public:
+ AliTPCSensorPressure();
+ AliTPCSensorPressure(const AliTPCSensorPressure& source);
+ virtual ~AliTPCSensorPressure(){}
+ AliTPCSensorPressure& operator=(const AliTPCSensorPressure& 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(AliTPCSensorPressure,1);
+};
+#endif
--- /dev/null
+/**************************************************************************
+ * 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 pressure sensors //
+// Authors: Marian Ivanov and Haavard Helstrup //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTPCSensorPressureArray.h"
+
+ClassImp(AliTPCSensorPressureArray)
+
+const char kFname[] = "PressureSensor.txt";
+const char kAmandaString[] = "system:gcs-ALITPC-ALITPC-AnalogInput-0%d.ProcessInput.PosSt";
+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
+
+//_____________________________________________________________________________
+AliTPCSensorPressureArray::AliTPCSensorPressureArray():AliDCSSensorArray(),
+ fAmandaString(kAmandaString)
+{
+ //
+ // AliTPCSensorPressureArray default constructor
+ //
+
+}
+//_____________________________________________________________________________
+AliTPCSensorPressureArray::AliTPCSensorPressureArray(Int_t prevRun) :
+ AliDCSSensorArray(prevRun,"TPC/Calib/Pressure"),
+ fAmandaString(kAmandaString)
+{
+}
+//_____________________________________________________________________________
+AliTPCSensorPressureArray::AliTPCSensorPressureArray(UInt_t startTime, UInt_t endTime,
+ const char *filepath)
+ :AliDCSSensorArray(),
+ fAmandaString(kAmandaString)
+{
+ //
+ // AliTPCSensorPressureArray default constructor
+ //
+ char *expPath = gSystem->ExpandPathName(filepath);
+ TString filename(expPath);
+ filename.Append('/');
+ filename.Append(kFname);
+ fSensors = AliTPCSensorPressure::ReadListInd(filename.Data(),fFirstSensor,fLastSensor);
+ fStartTime = TTimeStamp(startTime);
+ fEndTime = TTimeStamp(endTime);
+ delete expPath;
+}
+
+//_____________________________________________________________________________
+AliTPCSensorPressureArray::AliTPCSensorPressureArray(const char *fname) :
+ AliDCSSensorArray(),
+ fAmandaString(kAmandaString)
+{
+ //
+ // AliTPCSensorPressureArray constructor
+ //
+ fSensors = AliTPCSensorPressure::ReadListInd(fname,fFirstSensor,fLastSensor);
+ fSensors->BypassStreamer(kFALSE);
+}
+
+
+//_____________________________________________________________________________
+AliTPCSensorPressureArray::AliTPCSensorPressureArray(const AliTPCSensorPressureArray &c):
+ AliDCSSensorArray(c),
+ fAmandaString(c.fAmandaString)
+{
+ //
+ // AliTPCSensorPressureArray copy constructor
+ //
+
+}
+
+///_____________________________________________________________________________
+AliTPCSensorPressureArray::~AliTPCSensorPressureArray()
+{
+ //
+ // AliTPCSensorPressureArray destructor
+ //
+}
+
+//_____________________________________________________________________________
+AliTPCSensorPressureArray &AliTPCSensorPressureArray::operator=(const AliTPCSensorPressureArray &c)
+{
+ //
+ // Assignment operator
+ //
+
+ if (this != &c) ((AliTPCSensorPressureArray &) c).Copy(*this);
+ return *this;
+
+}
+
+//_____________________________________________________________________________
+void AliTPCSensorPressureArray::Copy(TObject &c) const
+{
+ //
+ // Copy function
+ //
+
+ TObject::Copy(c);
+}
+//_____________________________________________________________________________
+void AliTPCSensorPressureArray::ReadSensors(const char *fname)
+{
+ //
+ // Read list of temperature sensors from text file
+ //
+ fSensors = AliTPCSensorPressure::ReadListInd(fname,fFirstSensor,fLastSensor);
+}
+//_____________________________________________________________________________
+void AliTPCSensorPressureArray::SetGraph(TMap *map)
+{
+ //
+ // Read graphs from DCS maps
+ //
+ AliDCSSensorArray::SetGraph(map,fAmandaString.Data());
+}
+//_____________________________________________________________________________
+void AliTPCSensorPressureArray::MakeSplineFit(TMap *map)
+{
+ //
+ // Make spline fits from DCS maps
+ //
+ AliDCSSensorArray::MakeSplineFit(map,fAmandaString.Data());
+}
+
+
+//_____________________________________________________________________________
+TMap* AliTPCSensorPressureArray::ExtractDCS(TMap *dcsMap)
+{
+ //
+ // Extract temperature graphs from DCS maps
+ //
+
+ TMap *values = AliDCSSensorArray::ExtractDCS(dcsMap,fAmandaString.Data());
+ return values;
+}
+
+//_____________________________________________________________________________
+AliTPCSensorPressure* AliTPCSensorPressureArray::GetSensor(Int_t type, Int_t side, Int_t sector, Int_t num)
+{
+ //
+ // Return sensor information for sensor specified by type, side, sector and num
+ //
+ Int_t nsensors = fSensors->GetEntries();
+ for (Int_t isensor=0; isensor<nsensors; isensor++) {
+ AliTPCSensorPressure *entry = (AliTPCSensorPressure*)fSensors->At(isensor);
+ if (entry->GetSide() == side &&
+ entry->GetType() == type &&
+ entry->GetSector() == sector &&
+ entry->GetNum() == num ) return entry;
+ }
+ return 0;
+}
+//_____________________________________________________________________________
+AliTPCSensorPressure* AliTPCSensorPressureArray::GetSensor(Int_t IdDCS){
+ return dynamic_cast<AliTPCSensorPressure*>(AliDCSSensorArray::GetSensor(IdDCS));
+}
+//_____________________________________________________________________________
+AliTPCSensorPressure* AliTPCSensorPressureArray::GetSensor(Double_t x, Double_t y, Double_t z){
+ return dynamic_cast<AliTPCSensorPressure*>(AliDCSSensorArray::GetSensor(x,y,z));
+}
--- /dev/null
+#ifndef AliTPCSensorPressureArray_H
+#define AliTPCSensorPressureArray_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// TPC calibration class for pressure sensors //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TSystem.h"
+
+#include "AliDCSSensorArray.h"
+#include "AliTPCSensorPressure.h"
+
+class TTimeStamp;
+class TMap;
+class TGraph;
+class TObjString;
+class AliSplineFit;
+class AliDCSSensor;
+
+#include "TString.h"
+
+
+class AliTPCSensorPressureArray : public AliDCSSensorArray {
+ public:
+ AliTPCSensorPressureArray();
+ AliTPCSensorPressureArray(Int_t prevRun);
+ AliTPCSensorPressureArray(const char *fname);
+ AliTPCSensorPressureArray (UInt_t startTime, UInt_t endTime, const char *filepath=".");
+ AliTPCSensorPressureArray(const AliTPCSensorPressureArray &c);
+ virtual ~AliTPCSensorPressureArray();
+ AliTPCSensorPressureArray &operator=(const AliTPCSensorPressureArray &c);
+ virtual void Copy (TObject &c) const;
+ void SetGraph (TMap *map);
+ void MakeSplineFit(TMap *map);
+ void ReadSensors (const char *fname);
+ const char* GetAmandaString() { return fAmandaString.Data(); }
+ void SetAmandaString(const char* string) {fAmandaString=string;}
+ TMap* ExtractDCS (TMap *dcsMap);
+ AliTPCSensorPressure* GetSensor (Int_t type, Int_t side, Int_t sector, Int_t num);
+ AliTPCSensorPressure* GetSensor (Int_t IdDCS);
+ AliTPCSensorPressure* GetSensor (Double_t x, Double_t y, Double_t z);
+
+ protected:
+
+ TString fAmandaString; //! Amanda string to identify temperature entries
+ ClassDef(AliTPCSensorPressureArray,1) // TPC calibration class for parameters which are saved per pad
+
+};
+
+#endif