X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=T0%2FAliT0Parameters.cxx;h=4d82cd60756b471c7f40867ca2b6080ad6366f96;hp=fd2f306a69f76dd22151eb45aa1add67ae4f1706;hb=47e3851f79631282dd24227d09365b8ffb22738f;hpb=79e04c5fa0502644177a3928cb91d1f0553f9daf diff --git a/T0/AliT0Parameters.cxx b/T0/AliT0Parameters.cxx index fd2f306a69f..4d82cd60756 100644 --- a/T0/AliT0Parameters.cxx +++ b/T0/AliT0Parameters.cxx @@ -24,23 +24,30 @@ // Eventually, this class will use the Conditions DB to get the // various parameters, which code can then request from here. // +#include "AliT0.h" #include "AliLog.h" #include "AliT0Parameters.h" #include "AliT0CalibData.h" +#include "AliT0CalibWalk.h" +#include "AliT0CalibTimeEq.h" +#include "AliT0CalibLatency.h" +#include "AliT0LookUpKey.h" #include "AliT0LookUpValue.h" #include #include #include #include #include -#include +//#include #include #include +#include #include -AliT0CalibData* AliT0Parameters::fgCalibData = 0; +AliT0CalibTimeEq* AliT0Parameters::fgCalibData = 0; AliT0CalibData* AliT0Parameters::fgLookUp = 0; -AliT0CalibData* AliT0Parameters::fgSlewCorr =0; +AliT0CalibWalk* AliT0Parameters::fgSlewCorr =0; +AliT0CalibLatency *AliT0Parameters::fgLatency=0; //==================================================================== ClassImp(AliT0Parameters) #if 0 @@ -68,14 +75,23 @@ AliT0Parameters::AliT0Parameters() fAmpLEDRec(0), fPMTeff(), fWalk(0), - fTimeDelayDA(0), + fQTC(0), + fAmpLED(0), fTimeDelayCFD(0), + // fTimeV0(0), fTimeDelayTVD(0), - fMeanT0(500), + fMeanT0(512), + fMeanVertex(0), + fLatencyHPTDC(0), + fLatencyL1(0), + fLatencyL1A(0), + fLatencyL1C(0), fLookUp(0), fNumberOfTRMs(2), - fCalibentry(), fLookUpentry(),fSlewCorr() - + fCalibentry(), + fLookUpentry(), + fSlewCorr(), + fLatency() { // Default constructor @@ -103,23 +119,22 @@ AliT0Parameters::Init() if (fIsInit) return; AliCDBManager *stor =AliCDBManager::Instance(); - //time equalizing - fCalibentry = stor->Get("T0/Calib/TimeDelay"); - if (fCalibentry) - fgCalibData = (AliT0CalibData*)fCalibentry->GetObject(); - else { - AliFatal(" ALARM !!!! No time delays in CDB "); - fIsInit = kFALSE; - return; - } + fCalibentry = stor->Get("T0/Calib/TimeDelay"); + if (fCalibentry) + fgCalibData = (AliT0CalibTimeEq*)fCalibentry->GetObject(); + else { + AliFatal(" ALARM !!!! No time delays in CDB "); + fIsInit = kFALSE; + return; + } //slewing correction fSlewCorr = stor->Get("T0/Calib/Slewing_Walk"); if (fSlewCorr){ - fgSlewCorr = (AliT0CalibData*)fSlewCorr->GetObject(); + fgSlewCorr = (AliT0CalibWalk*)fSlewCorr->GetObject(); } else { - AliFatal(" ALARM !!!! No slewing correction in CDB "); + AliFatal(" ALARM !!!! No slewing correction in CDB "); fIsInit = kFALSE; return; } @@ -129,11 +144,22 @@ AliT0Parameters::Init() fgLookUp = (AliT0CalibData*)fLookUpentry->GetObject(); } else { - AliFatal(" ALARM !!!! No Lookup table in CDB "); + AliFatal(" ALARM !!!! No Lookup table in CDB "); fIsInit = kFALSE; return; } - fIsInit = kTRUE; + //latency + + fLatency = stor->Get("T0/Calib/Latency"); + if (fLatency){ + fgLatency = (AliT0CalibLatency*)fLatency->GetObject(); + } + else { + AliWarning(" !!! no latency in CDB "); + return; + } + +fIsInit = kTRUE; } @@ -145,49 +171,53 @@ void AliT0Parameters::InitIfOnline() // for switching to this one should write // AliT0RawReader myrawreader(rawReader); // myrawreader.SetOnlineMode(kTRUE); - + if (fIsInit) return; - //standart configuration (used for simulation) - //Int_t trm=0; Int_t tdc=0; Int_t chain=0; Int_t channel=0; + //standart configuration (used for simulation) + //Int_t trm=0; Int_t tdc=0; Int_t chain=0; Int_t channel=0; // configuration for test Jun07. - fNumberOfTRMs = 2; - Int_t trm=0; Int_t tdc=0; Int_t chain=0; Int_t channel=0; + fgLookUp = new AliT0CalibData("T0"); + + fNumberOfTRMs = 1; + fgLookUp-> SetNumberOfTRMs(fNumberOfTRMs); + Int_t trm=7; Int_t tdc=0; Int_t chain=0; Int_t channel=0; for (Int_t ik=0; ik<105; ik++) - { - AliT0LookUpKey * lookkey= new AliT0LookUpKey(); - AliT0LookUpValue * lookvalue= new AliT0LookUpValue(); - - - lookvalue->SetTRM(trm); - lookvalue->SetTDC(tdc); - lookvalue->SetChain(chain); - lookvalue->SetChannel(channel); - lookkey->SetKey(ik); - if (channel<6) channel +=2; - else {channel = 0; tdc++;} - if(ik==57) { tdc=0; channel=0; trm=1;} - fLookUp.Add((TObject*)lookvalue,(TObject*)lookkey); - } + { + AliT0LookUpKey * lookkey= new AliT0LookUpKey(); + AliT0LookUpValue * lookvalue= new AliT0LookUpValue(); + lookvalue->SetTRM(trm); + lookvalue->SetTDC(tdc); + lookvalue->SetChain(chain); + lookvalue->SetChannel(channel); + lookkey->SetKey(ik); + fgLookUp->GetMapLookup()->Add((TObject*)lookvalue,(TObject*)lookkey); + if (channel<6) channel +=2; + else {channel = 0; tdc++;} + if(ik==56) { tdc=0; channel=0; chain = 1;} + } + //2 recent open channels + trm=7; tdc=14; channel=2; chain=0; + for (Int_t ik=105; ik<107; ik++) + { + AliT0LookUpKey * lookkey= new AliT0LookUpKey(); + AliT0LookUpValue * lookvalue= new AliT0LookUpValue(); + + lookvalue->SetTRM(trm); + lookvalue->SetTDC(tdc); + lookvalue->SetChain(chain); + lookvalue->SetChannel(channel); + lookkey->SetKey(ik); + fgLookUp->GetMapLookup()->Add((TObject*)lookvalue,(TObject*)lookkey); + if (channel<6) channel +=2; + else {channel = 0; tdc++;} + } fIsInit=kTRUE; } //__________________________________________________________________ - -Float_t -AliT0Parameters::GetTimeDelayDA(Int_t ipmt) -{ - // return time delay for LED channel - // - if (!fCalibentry) { - fTimeDelayDA = 500; - return fTimeDelayDA; - } - return fgCalibData ->GetTimeDelayDA(ipmt); -} -//__________________________________________________________________ Float_t AliT0Parameters::GetTimeDelayCFD(Int_t ipmt) -{ + { // return time delay for CFD channel // if (!fCalibentry) @@ -196,21 +226,68 @@ AliT0Parameters::GetTimeDelayCFD(Int_t ipmt) return fTimeDelayCFD; } - return fgCalibData->GetTimeDelayCFD(ipmt); + return fgCalibData->GetTimeEq(ipmt); +} +//__________________________________________________________________ +Float_t +AliT0Parameters::GetCFD(Int_t ipmt) + { + // return CFD channel + + return fgCalibData->GetCFDvalue(ipmt,0); } //__________________________________________________________________ -Int_t -AliT0Parameters::GetMeanT0() -{ - // return mean of T0 distrubution with vertex=0 - // +Float_t +AliT0Parameters::GetLatencyHPTDC() + { + // return LatencyHPTDC for CFD channel + if (!fLatency) + { + fLatencyHPTDC=9000.; + return fLatencyHPTDC; + } + + return fgLatency->GetLatencyHPTDC(); +} +//__________________________________________________________________ +Float_t +AliT0Parameters::GetLatencyL1() + { + // return time delay for CFD channel + + return fgLatency->GetLatencyL1(); +} + +//__________________________________________________________________ +Float_t +AliT0Parameters::GetLatencyL1A() + { + // return time delay for CFD channel + + return fgLatency->GetLatencyL1A(); +} + +//__________________________________________________________________ +Float_t +AliT0Parameters::GetLatencyL1C() + { + // return time delay for CFD channel + + return fgLatency->GetLatencyL1C(); +} +//__________________________________________________________________ + +Float_t +AliT0Parameters:: GetMeanVertex() +{ if (!fCalibentry) { - return fMeanT0; + fMeanVertex=0; + return fMeanVertex; } - return fgCalibData->GetMeanT0(); + return fgCalibData->GetMeanVertex(); } //__________________________________________________________________ @@ -236,14 +313,26 @@ TGraph *AliT0Parameters::GetWalk(Int_t ipmt) const //__________________________________________________________________ -Float_t AliT0Parameters::GetWalkVal(Int_t ipmt, Float_t mv) const +TGraph *AliT0Parameters::GetQTC(Int_t ipmt) const { if (!fSlewCorr) { - return ((TGraph*)fWalk.At(ipmt))->Eval(mv); + AliError("No walk correction is available!"); + // return (TGraph*)fQTC.At(ipmt); + return 0; } - return fgSlewCorr -> GetWalkVal(ipmt, mv) ; + return fgSlewCorr -> GetQTC(ipmt) ; } +//__________________________________________________________________ +TGraph *AliT0Parameters::GetAmpLED(Int_t ipmt) const +{ + if (!fSlewCorr) { + AliError("No walk correction is available!"); + // return (TGraph*)fQTC.At(ipmt); + return 0; + } + return fgSlewCorr -> GetAmpLED(ipmt) ; +} //__________________________________________________________________ void @@ -271,21 +360,21 @@ Int_t AliT0Parameters::GetChannel(Int_t trm, Int_t tdc, Int_t chain, Int_t channel) { - - AliT0LookUpKey * lookkey; //= new AliT0LookUpKey(); - AliT0LookUpValue * lookvalue= new AliT0LookUpValue(trm,tdc,chain,channel); - if (fgLookUp) - lookkey = (AliT0LookUpKey*) fgLookUp->GetMapLookup()->GetValue((TObject*)lookvalue); - else - lookkey = (AliT0LookUpKey*) fLookUp.GetValue((TObject*)lookvalue); - - if (!lookkey ) { - AliInfo(Form("No such address (%d %d %d %d)!",trm,tdc,chain,channel)); + if (fgLookUp) { + AliT0LookUpValue key(trm,tdc,chain,channel); + AliT0LookUpKey *val = (AliT0LookUpKey*) fgLookUp->GetMapLookup()->GetValue((TObject*)&key); + // AliT0LookUpKey *val = (AliT0LookUpKey*) fLookUp.GetValue((TObject*)&key); + if (val ) + return val->GetKey(); + else { + AliWarning(Form("No such address (%d %d %d %d)!",trm,tdc,chain,channel)); + return -1; + } + } + else { + AliError("No look up table has been loader!"); return -1; } - - return lookkey->GetKey(); - } //__________________________________________________________________ @@ -310,6 +399,7 @@ AliT0Parameters::GetNumberOfTRMs() } return fgLookUp ->GetNumberOfTRMs(); } +/* //________________________________________________________________________________ Double_t AliT0Parameters::GetZPosition(const char* symname){ // Get the global z coordinate of the given T0 alignable volume @@ -318,6 +408,31 @@ Double_t AliT0Parameters::GetZPosition(const char* symname){ return tr[2]; } +*/ +//________________________________________________________________________________ +Double_t AliT0Parameters::GetZPosition(const char* symname){ +// Get the global z coordinate of the given T0 alignable volume +// + Double_t *tr; + TGeoPNEntry *pne = gGeoManager->GetAlignableEntry(symname); + if (!pne) return 0; + + + TGeoPhysicalNode *pnode = pne->GetPhysicalNode(); + if(pnode){ + TGeoHMatrix* hm = pnode->GetMatrix(); + tr = hm->GetTranslation(); + }else{ + const char* path = pne->GetTitle(); + if(!gGeoManager->cd(path)){ + AliErrorClass(Form("Volume path %s not valid!",path)); + return 0; + } + tr = gGeoManager->GetCurrentMatrix()->GetTranslation(); + } + return tr[2]; + +} //________________________________________________________________________________ Double_t AliT0Parameters::GetZPositionShift(const char* symname)