00001 #ifndef StTpcHitErrors_h
00002 #define StTpcHitErrors_h
00003 #include "TMDFParameters.h"
00004
00005 class StTpcHitErrors : public TObject {
00006 public:
00007 static StTpcHitErrors* instance();
00008
00009 StTpcHitErrors(Int_t nXZ = 2, Int_t Sec = 2, Int_t Row = 2, Int_t MS = 2, Int_t Prompt = 2) :
00010 fXZ(nXZ), fSec(Sec), fRow(Row), fMS(MS), fPrompt(Prompt),
00011 fNxz(fXZ*fSec*fRow*fMS*fPrompt), fMDFXZ(fNxz) {
00012 fgInstance = this; fMDFXZ.SetOwner(kTRUE);
00013 }
00014 virtual ~StTpcHitErrors() {fgInstance = 0;}
00015 Int_t Index(Int_t iXZ, Int_t sec, Int_t row, Int_t ms, Int_t prompt) {
00016 Int_t indx = prompt + fPrompt*(ms + fMS*(row + fRow*(sec + fSec*iXZ)));
00017 return indx;
00018 }
00019 TMDFParameters *Get(Int_t iXZ, Int_t sec, Int_t row, Int_t ms, Int_t prompt) {
00020 Int_t indx = Index(iXZ,sec,row,ms,prompt);
00021 TMDFParameters::SetCurrent((TMDFParameters *) fMDFXZ[indx]);
00022 return (TMDFParameters *) fMDFXZ[indx];
00023 }
00024 TMDFParameters *GetMu (Int_t iXZ, Int_t sec, Int_t row, Int_t prompt) {return Get(iXZ,sec,row,0,prompt);}
00025 TMDFParameters *GetSigmaSQ(Int_t iXZ, Int_t sec, Int_t row, Int_t prompt) {return Get(iXZ,sec,row,1,prompt);}
00026 Double_t calcError(Int_t iXZ, Int_t sec, Int_t row, Double_t _z, Double_t _eta, Double_t _tanl, Int_t Npads, Int_t Ntmbks, Double_t AdcL, Double_t xPad);
00027 void Set(Int_t iXZ, Int_t sec, Int_t row, Int_t ms, Int_t prompt, TMDFParameters *mdfX) {fMDFXZ.AddAtAndExpand(mdfX,Index(iXZ,sec,row,ms,prompt));}
00028 private:
00029 Int_t fXZ;
00030 Int_t fSec;
00031 Int_t fRow;
00032 Int_t fMS;
00033 Int_t fPrompt;
00034 Int_t fNxz;
00035 TObjArray fMDFXZ;
00036 static StTpcHitErrors* fgInstance;
00037 ClassDef(StTpcHitErrors,1)
00038 };
00039 #endif