#include "TNamed.h"
class AliTPCCalDet : public TNamed {
-
- public:
-
+ public:
enum { kNdet = 72 };
AliTPCCalDet();
AliTPCCalDet(const Text_t* name, const Text_t* title);
AliTPCCalDet(const AliTPCCalDet &c);
virtual ~AliTPCCalDet();
AliTPCCalDet &operator=(const AliTPCCalDet &c);
-
virtual void Copy(TObject &c) const;
Float_t GetValue(Int_t d) { return fData[d]; };
void SetValue(Int_t d, Float_t value) { fData[d] = value; };
-
- protected:
-
- Float_t fData[kNdet]; //[kNdet] Data
-
- ClassDef(AliTPCCalDet,1) // TPC calibration class for parameters which are saved per detector
-
+ protected:
+ Float_t fData[kNdet]; // [kNdet] Data
+ ClassDef(AliTPCCalDet,1) // TPC calibration class for parameters which are saved per detector
};
#endif
#include "AliTPCCalPad.h"
#include "AliTPCCalROC.h"
-//#include "AliTPCCalDet.h"
ClassImp(AliTPCCalPad)
class AliTPCCalDet;
class AliTPCCalPad : public TNamed {
-
public:
-
enum { kNsec = 72 };
-
AliTPCCalPad();
AliTPCCalPad(const Text_t* name, const Text_t* title);
AliTPCCalPad(const AliTPCCalPad &c);
protected:
AliTPCCalROC *fROC[kNsec]; // Array of ROC objects which contain the values per pad
ClassDef(AliTPCCalPad,1) // TPC calibration class for parameters which are saved per pad
-
};
#endif
// //
// Calibration base class for a single ROC //
// Contains one float value per pad //
+// mapping of the pads taken form AliTPCROC //
// //
///////////////////////////////////////////////////////////////////////////////
#include "AliTPCCalROC.h"
#include "TMath.h"
+#include "TClass.h"
+#include "TFile.h"
ClassImp(AliTPCCalROC)
- Int_t AliTPCCalROC::fgNSectorsAll =0;
-Int_t AliTPCCalROC::fgNSectors[2]={0,0};
-Int_t AliTPCCalROC::fgNRows[2]={0,0};
-Int_t *AliTPCCalROC::fgNPads[2]={0,0};
-Int_t *AliTPCCalROC::fgRowPosIndex[2] ={0,0};
-Int_t AliTPCCalROC::fgNChannels[2]={0,0};
-
-void AliTPCCalROC::Init(){
- //
- // initialize static variables
- //
- if (AliTPCCalROC::fgNSectorsAll>0) return;
- fgNSectorsAll =72;
- fgNSectors[0] =36;
- fgNSectors[1] =36;
- //
- fgNRows[0]= 63;
- fgNRows[1]= 96;
- //
- // number of pads in padrow
- fgNPads[0] = new Int_t[fgNRows[0]];
- fgNPads[1] = new Int_t[fgNRows[1]];
- //
- // padrow index in array
- //
- fgRowPosIndex[0] = new Int_t[fgNRows[0]];
- fgRowPosIndex[1] = new Int_t[fgNRows[1]];
- //
- // inner sectors
- //
- Int_t index =0;
- for (Int_t irow=0; irow<fgNRows[0];irow++){
- Int_t npads = (irow==0) ? 68 : 2 *Int_t(Double_t(irow)/3. +33.67);
- fgNPads[0][irow] = npads;
- fgRowPosIndex[0][irow] = index;
- index+=npads;
- }
- fgNChannels[0] = index;
- //
- index =0;
- Double_t k1 = 10.*TMath::Tan(10*TMath::DegToRad())/6.;
- Double_t k2 = 15.*TMath::Tan(10*TMath::DegToRad())/6.;
- for (Int_t irow=0; irow<fgNRows[1];irow++){
- Int_t npads = (irow<64) ?
- 2*Int_t(k1*Double_t(irow)+37.75):
- 2*Int_t(k2*Double_t(irow-64)+56.66);
- fgNPads[1][irow] = npads;
- fgRowPosIndex[1][irow] = index;
- index+=npads;
- }
- fgNChannels[1] = index;
-}
//_____________________________________________________________________________
//
// Default constructor
//
- fSector = -1;
- fIndex = 0;
- fData = 0;
+ fSector = 0;
+ fNChannels = 0;
+ fNRows = 0;
+ fData = 0;
}
//_____________________________________________________________________________
-AliTPCCalROC::AliTPCCalROC(Int_t sector):TObject()
+AliTPCCalROC::AliTPCCalROC(UInt_t sector):TObject()
{
//
// Constructor that initializes a given sector
//
- Init();
fSector = sector;
- fIndex = (sector<fgNSectors[0]) ? 0:1;
- fData = new Float_t[fgNChannels[fIndex]];
+ fNChannels = AliTPCROC::Instance()->GetNChannels(fSector);
+ fNRows = AliTPCROC::Instance()->GetNRows(fSector);
+ fIndexes = AliTPCROC::Instance()->GetRowIndexes(fSector);
+ fData = new Float_t[fNChannels];
+ for (UInt_t idata = 0; idata< fNChannels; idata++) fData[idata] = 0.;
}
//_____________________________________________________________________________
// AliTPCCalROC copy constructor
//
fSector = c.fSector;
- fIndex = c.fIndex;
- Int_t nchannels = fgNChannels[fIndex];
- fData = new Float_t[nchannels];
- for (Int_t idata = 0; idata< nchannels; idata++) fData[idata] = c.fData[idata];
+ fNChannels = AliTPCROC::Instance()->GetNChannels(fSector);
+ fNRows = AliTPCROC::Instance()->GetNRows(fSector);
+ fIndexes = AliTPCROC::Instance()->GetRowIndexes(fSector);
+ //
+ fData = new Float_t[fNChannels];
+ for (UInt_t idata = 0; idata< fNChannels; idata++) fData[idata] = c.fData[idata];
}
//_____________________________________________________________________________
//
// AliTPCCalROC destructor
//
-
if (fData) {
delete [] fData;
fData = 0;
}
}
+
+
+void AliTPCCalROC::Streamer(TBuffer &R__b)
+{
+ // Stream an object of class AliTPCCalROC.
+ if (R__b.IsReading()) {
+ AliTPCCalROC::Class()->ReadBuffer(R__b, this);
+ fIndexes = AliTPCROC::Instance()->GetRowIndexes(fSector);
+ } else {
+ AliTPCCalROC::Class()->WriteBuffer(R__b,this);
+ }
+}
+
+
+
+void AliTPCCalROC::Test(){
+ //
+ // example function to show functionality and tes AliTPCCalROC
+ //
+ AliTPCCalROC roc0(0);
+ for (UInt_t irow = 0; irow <roc0.GetNrows(); irow++){
+ for (UInt_t ipad = 0; ipad <roc0.GetNPads(irow); ipad++){
+ Float_t value = irow+ipad/1000.;
+ roc0.SetValue(irow,ipad,value);
+ }
+ }
+ //
+ AliTPCCalROC roc1(roc0);
+ for (UInt_t irow = 0; irow <roc1.GetNrows(); irow++){
+ for (UInt_t ipad = 0; ipad <roc1.GetNPads(irow); ipad++){
+ Float_t value = irow+ipad/1000.;
+ if (roc1.GetValue(irow,ipad)!=value){
+ printf("Read/Write error\trow=%d\tpad=%d\n",irow,ipad);
+ }
+ }
+ }
+ TFile f("calcTest.root","recreate");
+ roc0.Write("Roc0");
+ AliTPCCalROC * roc2 = (AliTPCCalROC*)f.Get("Roc0");
+ f.Close();
+ //
+ for (UInt_t irow = 0; irow <roc0.GetNrows(); irow++){
+ if (roc0.GetNPads(irow)!=roc2->GetNPads(irow))
+ printf("NPads - Read/Write error\trow=%d\n",irow);
+ for (UInt_t ipad = 0; ipad <roc1.GetNPads(irow); ipad++){
+ Float_t value = irow+ipad/1000.;
+ if (roc2->GetValue(irow,ipad)!=value){
+ printf("Read/Write error\trow=%d\tpad=%d\n",irow,ipad);
+ }
+ }
+ }
+}
+
//////////////////////////////////////////////////
#include <TObject.h>
+#include <AliTPCROC.h>
//_____________________________________________________________________________
class AliTPCCalROC : public TObject {
public:
AliTPCCalROC();
- AliTPCCalROC(Int_t sector);
+ AliTPCCalROC(UInt_t sector);
AliTPCCalROC(const AliTPCCalROC &c);
virtual ~AliTPCCalROC();
- Int_t GetNrows() const { return fgNRows[fIndex]; };
- Int_t GetNchannels() const { return fgNChannels[fIndex]; };
- Float_t GetValue(Int_t row, Int_t pad) { return fData[fgRowPosIndex[fIndex][row]+pad]; };
- void SetValue(Int_t row, Int_t pad, Float_t vd)
- { fData[fgRowPosIndex[fIndex][row]+pad]= vd; };
- static void Init();
- public:
- Int_t fSector; // sector number
- Int_t fIndex; // 0- if inner 1- outer
- Float_t *fData; //[fNchannels] Data
- //
- static Int_t fgNSectorsAll; // number of sectors
- static Int_t fgNSectors[2]; // number of sectors - inner outer
- static Int_t fgNRows[2]; // number of row - inner outer
- static Int_t fgNChannels[2]; // total number of pads - inner sector - outer sector
- static Int_t *fgNPads[2]; // number of pads in row - inner - outer
- static Int_t *fgRowPosIndex[2]; // index array - inner - outer
- //
+ UInt_t GetNrows() const { return fNRows;};
+ UInt_t GetNchannels() const { return fNChannels;};
+ UInt_t GetNPads(UInt_t row) const { return (row<fNRows)? AliTPCROC::Instance()->GetNPads(fSector,row):0;};
+ Float_t GetValue(UInt_t row, UInt_t pad) const { return ( (row<fNRows) && (fIndexes[row]+pad)<fNChannels)? fData[fIndexes[row]+pad]: 0; };
+ Float_t GetValue(UInt_t channel) const { return fData[channel]; };
+ void SetValue(UInt_t row, UInt_t pad, Float_t vd) { if ( row<fNRows && (fIndexes[row]+pad)<fNChannels)fData[fIndexes[row]+pad]= vd; };
+ void SetValue(UInt_t channel, Float_t vd) {fData[channel]= vd; };
+ static void Test();
+ protected:
+ UInt_t fSector; // sector number
+ UInt_t fNChannels; // number of channels
+ UInt_t fNRows; // number of rows
+ const UInt_t* fIndexes; //!indexes
+ Float_t *fData; //[fNChannels] Data
ClassDef(AliTPCCalROC,1) // TPC ROC calibration class
};
fNRows[1]= 96;
//
// number of pads in padrow
- fNPads[0] = new Int_t[fNRows[0]];
- fNPads[1] = new Int_t[fNRows[1]];
+ fNPads[0] = new UInt_t[fNRows[0]];
+ fNPads[1] = new UInt_t[fNRows[1]];
//
// padrow index in array
//
- fRowPosIndex[0] = new Int_t[fNRows[0]];
- fRowPosIndex[1] = new Int_t[fNRows[1]];
+ fRowPosIndex[0] = new UInt_t[fNRows[0]];
+ fRowPosIndex[1] = new UInt_t[fNRows[1]];
//
// inner sectors
//
- Int_t index =0;
- for (Int_t irow=0; irow<fNRows[0];irow++){
- Int_t npads = (irow==0) ? 68 : 2 *Int_t(Double_t(irow)/3. +33.67);
+ UInt_t index =0;
+ for (UInt_t irow=0; irow<fNRows[0];irow++){
+ UInt_t npads = (irow==0) ? 68 : 2 *Int_t(Double_t(irow)/3. +33.67);
fNPads[0][irow] = npads;
fRowPosIndex[0][irow] = index;
index+=npads;
index =0;
Double_t k1 = 10.*TMath::Tan(10*TMath::DegToRad())/6.;
Double_t k2 = 15.*TMath::Tan(10*TMath::DegToRad())/6.;
- for (Int_t irow=0; irow<fNRows[1];irow++){
- Int_t npads = (irow<64) ?
+ for (UInt_t irow=0; irow<fNRows[1];irow++){
+ UInt_t npads = (irow<64) ?
2*Int_t(k1*Double_t(irow)+37.75):
2*Int_t(k2*Double_t(irow-64)+56.66);
fNPads[1][irow] = npads;
const Float_t kInnerWireMount = 1.2;
const Float_t kOuterWireMount = 1.4;
const Float_t kZLength =250.;
- const Int_t kNRowLow = 63;
- const Int_t kNRowUp1 = 64;
- const Int_t kNRowUp2 = 32;
- const Int_t kNRowUp = 96;
+ const UInt_t kNRowLow = 63;
+ const UInt_t kNRowUp1 = 64;
+ const UInt_t kNRowUp2 = 32;
+ const UInt_t kNRowUp = 96;
const Float_t kInnerAngle = 20; // 20 degrees
const Float_t kOuterAngle = 20; // 20 degrees
//
//
//wires default parameters
//
-// const Int_t kNInnerWiresPerPad = 3;
-// const Int_t kInnerDummyWire = 2;
+// const UInt_t kNInnerWiresPerPad = 3;
+// const UInt_t kInnerDummyWire = 2;
// const Float_t kInnerWWPitch = 0.25;
// const Float_t kRInnerFirstWire = 84.475;
// const Float_t kRInnerLastWire = 132.475;
// const Float_t kInnerOffWire = 0.5;
-// const Int_t kNOuter1WiresPerPad = 4;
-// const Int_t kNOuter2WiresPerPad = 6;
+// const UInt_t kNOuter1WiresPerPad = 4;
+// const UInt_t kNOuter2WiresPerPad = 6;
// const Float_t kOuterWWPitch = 0.25;
// const Float_t kROuterFirstWire = 134.225;
// const Float_t kROuterLastWire = 246.975;
-// const Int_t kOuterDummyWire = 2;
+// const UInt_t kOuterDummyWire = 2;
// const Float_t kOuterOffWire = 0.5;
//
//set sector parameters
{
//
// Default constructor
- for (Int_t i=0;i<2;i++){
+ for (UInt_t i=0;i<2;i++){
fNSectors[i] = 0;
fNRows[i] = 0;
fNChannels[i] = 0;
fNChannels[1]= roc.fNChannels[1];
//
// number of pads in padrow
- fNPads[0] = new Int_t[fNRows[0]];
- fNPads[1] = new Int_t[fNRows[1]];
+ fNPads[0] = new UInt_t[fNRows[0]];
+ fNPads[1] = new UInt_t[fNRows[1]];
//
// padrow index in array
//
- fRowPosIndex[0] = new Int_t[fNRows[0]];
- fRowPosIndex[1] = new Int_t[fNRows[1]];
+ fRowPosIndex[0] = new UInt_t[fNRows[0]];
+ fRowPosIndex[1] = new UInt_t[fNRows[1]];
//
- for (Int_t irow =0; irow<fNRows[0];irow++){
+ for (UInt_t irow =0; irow<fNRows[0];irow++){
fNPads[0][irow] = roc.fNPads[0][irow];
fRowPosIndex[0][irow] = roc.fRowPosIndex[0][irow];
}
- for (Int_t irow =0; irow<fNRows[1];irow++){
+ for (UInt_t irow =0; irow<fNRows[1];irow++){
fNPads[1][irow] = roc.fNPads[1][irow];
fRowPosIndex[1][irow] = roc.fRowPosIndex[1][irow];
}
//
// numbering
- Int_t GetNSectors() const { return fNSectorsAll;}
- Int_t GetNRows(Int_t sector) const { return (sector<fNSectors[1]) ? fNRows[0]:fNRows[1];}
- Int_t GetNChannels(Int_t sector) const { return (sector<fNSectors[1]) ? fNChannels[0]:fNChannels[1];}
- Int_t GetNPads(Int_t sector,Int_t row) const { return (sector<fNSectors[1]) ? fNPads[0][row]:fNPads[1][row];}
- const Int_t * GetRowIndexes(Int_t sector) const {return (sector<fNSectors[1]) ? fRowPosIndex[0]:fRowPosIndex[1];}
+ UInt_t GetNSectors() const { return fNSectorsAll;}
+ UInt_t GetNRows(UInt_t sector) const { return (sector<fNSectors[1]) ? fNRows[0]:fNRows[1];}
+ UInt_t GetNChannels(UInt_t sector) const { return (sector<fNSectors[1]) ? fNChannels[0]:fNChannels[1];}
+ UInt_t GetNPads(UInt_t sector,UInt_t row) const { return (sector<fNSectors[1]) ? fNPads[0][row]:fNPads[1][row];}
+ const UInt_t * GetRowIndexes(UInt_t sector) const {return (sector<fNSectors[1]) ? fRowPosIndex[0]:fRowPosIndex[1];}
//
//get sector parameters
//
Float_t GetOuterWireMount() const {return fOuterWireMount;}
Float_t GetInnerAngle() const {return fInnerAngle;}
Float_t GetOuterAngle() const {return fOuterAngle;}
- Int_t GetNInnerSector() const {return fNSectors[0];}
- Int_t GetNOuterSector() const {return fNSectors[1];}
- Int_t GetNSector() const {return fNSectorsAll;}
+ UInt_t GetNInnerSector() const {return fNSectors[0];}
+ UInt_t GetNOuterSector() const {return fNSectors[1];}
+ UInt_t GetNSector() const {return fNSectorsAll;}
Float_t GetZLength() const {return fZLength;}
//
// number of pads
//
void SetGeometry(); // set geometry parameters
- Int_t fNSectorsAll; // number of sectors
- Int_t fNSectors[2]; // number of sectors - inner outer
- Int_t fNRows[2]; // number of row - inner outer
- Int_t fNChannels[2]; // total number of pads - inner sector - outer sector
- Int_t *fNPads[2]; // number of pads in row - inner - outer
- Int_t *fRowPosIndex[2]; // index array - inner - outer
+ UInt_t fNSectorsAll; // number of sectors
+ UInt_t fNSectors[2]; // number of sectors - inner outer
+ UInt_t fNRows[2]; // number of row - inner outer
+ UInt_t fNChannels[2]; // total number of pads - inner sector - outer sector
+ UInt_t *fNPads[2]; // number of pads in row - inner - outer
+ UInt_t *fRowPosIndex[2]; // index array - inner - outer
//
//
//---------------------------------------------------------------------
//---------------------------------------------------------------------
// ALICE TPC wires geometry - for GEM we can consider that it is gating
//--------------------------------------------------------------------
- Int_t fNInnerWiresPerPad; //Number of wires per pad
+ UInt_t fNInnerWiresPerPad; //Number of wires per pad
Float_t fInnerWWPitch; //pitch between wires in inner sector - calculated
- Int_t fInnerDummyWire; //number of wires without pad readout
+ UInt_t fInnerDummyWire; //number of wires without pad readout
Float_t fInnerOffWire; //oofset of first wire to the begining of the sector
Float_t fRInnerFirstWire; //position of the first wire -calculated
Float_t fRInnerLastWire; //position of the last wire -calculated
Float_t fLastWireUp1; //position of the last wire in outer1 sector
- Int_t fNOuter1WiresPerPad; //Number of wires per pad
- Int_t fNOuter2WiresPerPad; // Number of wires per pad
+ UInt_t fNOuter1WiresPerPad; //Number of wires per pad
+ UInt_t fNOuter2WiresPerPad; // Number of wires per pad
Float_t fOuterWWPitch; //pitch between wires in outer sector -calculated
- Int_t fOuterDummyWire; //number of wires without pad readout
+ UInt_t fOuterDummyWire; //number of wires without pad readout
Float_t fOuterOffWire; //oofset of first wire to the begining of the sector
Float_t fROuterFirstWire; //position of the first wire -calulated
Float_t fROuterLastWire; //position of the last wire -calculated
Float_t fOuter2PadLength; //Outer pad length
Float_t fOuterPadWidth; //Outer pad width
//
- Int_t fNRowLow; //number of pad rows per low sector -set
- Int_t fNRowUp1; //number of short pad rows per sector up -set
- Int_t fNRowUp2; //number of long pad rows per sector up -set
- Int_t fNRowUp; //number of pad rows per sector up -calculated
- Int_t fNtRows; //total number of rows in TPC -calculated
+ UInt_t fNRowLow; //number of pad rows per low sector -set
+ UInt_t fNRowUp1; //number of short pad rows per sector up -set
+ UInt_t fNRowUp2; //number of long pad rows per sector up -set
+ UInt_t fNRowUp; //number of pad rows per sector up -calculated
+ UInt_t fNtRows; //total number of rows in TPC -calculated
Float_t fPadRowLow[600]; //Lower sector, pad row radii -calculated
Float_t fPadRowUp[600]; //Upper sector, pad row radii -calculated
- Int_t fNPadsLow[600]; //Lower sector, number of pads per row -calculated
- Int_t fNPadsUp[600]; //Upper sector, number of pads per row -calculated
+ UInt_t fNPadsLow[600]; //Lower sector, number of pads per row -calculated
+ UInt_t fNPadsUp[600]; //Upper sector, number of pads per row -calculated
Float_t fYInner[600]; //Inner sector, wire-length
Float_t fYOuter[600]; //Outer sector, wire-length
protected:
--- /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. *
+ **************************************************************************/
+
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Class providing the calibration parameters by accessing the CDB //
+// //
+// Request an instance with AliTPCcalibDB::Instance() //
+// If a new event is processed set the event number with SetRun //
+// Then request the calibration data //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+
+#include <AliCDBManager.h>
+#include <AliCDBStorage.h>
+#include <AliCDBEntry.h>
+#include <AliLog.h>
+
+#include "AliTPCcalibDB.h"
+
+#include "AliTPCCalROC.h"
+#include "AliTPCCalPad.h"
+#include "AliTPCCalDet.h"
+
+ClassImp(AliTPCcalibDB)
+
+AliTPCcalibDB* AliTPCcalibDB::fgInstance = 0;
+Bool_t AliTPCcalibDB::fgTerminated = kFALSE;
+
+
+//_ singleton implementation __________________________________________________
+AliTPCcalibDB* AliTPCcalibDB::Instance()
+{
+ //
+ // Singleton implementation
+ // Returns an instance of this class, it is created if neccessary
+ //
+
+ if (fgTerminated != kFALSE)
+ return 0;
+
+ if (fgInstance == 0)
+ fgInstance = new AliTPCcalibDB();
+
+ return fgInstance;
+}
+
+void AliTPCcalibDB::Terminate()
+{
+ //
+ // Singleton implementation
+ // Deletes the instance of this class and sets the terminated flag, instances cannot be requested anymore
+ // This function can be called several times.
+ //
+
+ fgTerminated = kTRUE;
+
+ if (fgInstance != 0)
+ {
+ delete fgInstance;
+ fgInstance = 0;
+ }
+}
+
+//_____________________________________________________________________________
+AliTPCcalibDB::AliTPCcalibDB()
+{
+ //
+ // constructor
+ //
+ // TODO Default runnumber is set to 0, this should be changed later to an invalid value (e.g. -1) to prevent
+ // TODO invalid calibration data to be used.
+ fRun = 0;
+
+ AliCDBManager* manager = AliCDBManager::Instance();
+ if (!manager)
+ {
+ AliFatal("AliTRDcalibDB: CRITICAL: Failed to get instance of AliCDBManager.");
+ fLocator = 0;
+ }
+ else
+ fLocator = manager->GetStorage("local://$ALICE_ROOT");
+
+ //
+ //
+ //
+ fPadGainFactor = 0;
+ fPadTime0 = 0;
+ fPadPRFWidth = 0;
+ fPadNoise = 0;
+ Update(); // temporary
+}
+
+//_____________________________________________________________________________
+AliTPCcalibDB::~AliTPCcalibDB()
+{
+ //
+ // destructor
+ //
+ if (fPadGainFactor) delete fPadGainFactor;
+ if (fPadTime0) delete fPadTime0;
+ if (fPadPRFWidth) delete fPadPRFWidth;
+ if (fPadNoise) delete fPadNoise;
+}
+
+
+//_____________________________________________________________________________
+AliCDBEntry* AliTPCcalibDB::GetCDBEntry(const char* cdbPath)
+{
+ //
+ // Retrieves an entry with path <cdbPath> from the CDB.
+ //
+ char chinfo[1000];
+
+ if (fRun < 0)
+ {
+ AliFatal("AliTPCcalibDB: Run number not set! Use AliTPCcalibDB::SetRun.");
+ return 0;
+ }
+ if (!fLocator)
+ {
+ AliError("AliTPCcalibDB: Storage Locator not available.");
+ return 0;
+ }
+ AliCDBEntry* entry = fLocator->Get(cdbPath, fRun);
+ if (!entry)
+ {
+ sprintf(chinfo,"AliTPCcalibDB: Failed to get entry:\t%s ", cdbPath);
+ AliError(chinfo);
+ return 0;
+ }
+ return entry;
+}
+
+
+//_____________________________________________________________________________
+void AliTPCcalibDB::SetRun(Long64_t run)
+{
+ //
+ // Sets current run number. Calibration data is read from the corresponding file.
+ //
+ if (fRun == run)
+ return;
+ fRun = run;
+ Update();
+}
+
+
+
+void AliTPCcalibDB::Update(){
+ //
+ AliCDBEntry * entry=0;
+ //
+ entry = GetCDBEntry("TPC/Calib/PadGainFactor");
+ if (entry){
+ if (fPadGainFactor) delete fPadGainFactor;
+ entry->SetOwner(kTRUE);
+ fPadGainFactor = (AliTPCCalPad*)entry->GetObject();
+ }
+ //
+ entry = GetCDBEntry("TPC/Calib/PadTime0");
+ if (entry){
+ if (fPadTime0) delete fPadTime0;
+ entry->SetOwner(kTRUE);
+ fPadTime0 = (AliTPCCalPad*)entry->GetObject();
+ }
+ //
+ entry = GetCDBEntry("TPC/Calib/PadPRF");
+ if (entry){
+ if (fPadPRFWidth) delete fPadPRFWidth;
+ entry->SetOwner(kTRUE);
+ fPadPRFWidth = (AliTPCCalPad*)entry->GetObject();
+ }
+ //
+ entry = GetCDBEntry("TPC/Calib/PadNoise");
+ if (entry){
+ if (fPadNoise) delete fPadNoise;
+ entry->SetOwner(kTRUE);
+ fPadNoise = (AliTPCCalPad*)entry->GetObject();
+ }
+ //
+
+}
--- /dev/null
+#ifndef ALITPCCALIBDB_H
+#define ALITPCCALIBDB_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Class providing the calibration parameters by accessing the CDB //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+
+#include "TObject.h"
+class AliTPCCalPad;
+class AliCDBEntry;
+class AliCDBStorage;
+
+class AliTPCcalibDB : public TObject
+{
+ public:
+ static AliTPCcalibDB* Instance();
+ AliTPCcalibDB();
+ virtual ~AliTPCcalibDB();
+ static void Terminate();
+ void SetRun(Long64_t run);
+ //
+ AliTPCCalPad* GetPadGainFactor() {return fPadGainFactor;}
+ AliTPCCalPad* GetPadTime0() {return fPadTime0;}
+ AliTPCCalPad* GetPadPRFWidth() {return fPadPRFWidth;}
+ AliTPCCalPad* GetPadNoise() {return fPadNoise;}
+ //
+protected:
+ void Update(); //update entries
+ AliCDBEntry* GetCDBEntry(const char* cdbPath);
+ Long64_t fRun; // current run number
+ AliCDBStorage* fLocator; // Storage locator retrieved from AliCDBManager
+ //
+ // calibration parameters per pad
+ //
+ AliTPCCalPad* fPadGainFactor;
+ AliTPCCalPad* fPadTime0;
+ AliTPCCalPad* fPadPRFWidth;
+ AliTPCCalPad* fPadNoise;
+ //
+ static AliTPCcalibDB* fgInstance;
+ static Bool_t fgTerminated;
+ ClassDef(AliTPCcalibDB, 0)
+};
+
+
+#endif
#pragma link C++ class AliTPCDigitsArray+;
#pragma link C++ class AliTPCROC+;
-#pragma link C++ class AliTPCCalROC+;
+#pragma link C++ class AliTPCCalROC-;
#pragma link C++ class AliTPCCalPad+;
#pragma link C++ class AliTPCCalDet+;
+#pragma link C++ class AliTPCcalibDB+;
#pragma link C++ class AliTPCAltroMapping+;
#pragma link C++ class AliTPCRawStream+;
AliTPCdigit.cxx \
AliSimDigits.cxx AliDigitsArray.cxx AliTPCDigitsArray.cxx \
AliTPCROC.cxx AliTPCCalROC.cxx AliTPCCalPad.cxx AliTPCCalDet.cxx \
+ AliTPCcalibDB.cxx \
AliTPCAltroMapping.cxx AliTPCRawStream.cxx