]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - T0/AliT0Parameters.cxx
Fix (Yifei)
[u/mrichter/AliRoot.git] / T0 / AliT0Parameters.cxx
index b2e278dd59d140259d5aca5bfbd2e2c8efeaa858..74f24c2f2ef1cbb998d983230ada56dbc3ec8ed0 100644 (file)
@@ -30,6 +30,7 @@
 #include "AliT0CalibData.h"   
 #include "AliT0CalibWalk.h"   
 #include "AliT0CalibTimeEq.h"   
+#include "AliT0CalibLatency.h"   
 #include "AliT0LookUpKey.h"
 #include "AliT0LookUpValue.h"
 #include <AliCDBManager.h>        
@@ -37,7 +38,7 @@
 #include <AliCDBStorage.h>  
 #include <TMath.h>
 #include <TSystem.h>
-#include <Riostream.h>
+//#include <Riostream.h>
 #include <TGeoManager.h>
 #include <TGeoPhysicalNode.h>
 #include <TGeoMatrix.h>
@@ -46,6 +47,7 @@
 AliT0CalibTimeEq* AliT0Parameters::fgCalibData = 0;
 AliT0CalibData* AliT0Parameters::fgLookUp = 0;
 AliT0CalibWalk* AliT0Parameters::fgSlewCorr =0;
+AliT0CalibLatency *AliT0Parameters::fgLatency=0;
 //====================================================================
 ClassImp(AliT0Parameters)
 #if 0
@@ -73,14 +75,23 @@ AliT0Parameters::AliT0Parameters()
    fAmpLEDRec(0), 
    fPMTeff(),
    fWalk(0),
+   fQTC(0),
+   fAmpLED(0),
    fTimeDelayCFD(0), 
  //  fTimeV0(0), 
    fTimeDelayTVD(0),
    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 
@@ -137,7 +148,18 @@ AliT0Parameters::Init()
     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;
 }
 
 
@@ -149,7 +171,7 @@ void AliT0Parameters::InitIfOnline()
 // for switching to this one should write
   // AliT0RawReader myrawreader(rawReader);
 //     myrawreader.SetOnlineMode(kTRUE);
-cout<<" AliT0Parameters::InitIfOnline() "<<endl;
+
   if (fIsInit) return;
    //standart configuration (used for simulation)
    //Int_t trm=0; Int_t tdc=0; Int_t chain=0; Int_t channel=0;
@@ -193,6 +215,59 @@ AliT0Parameters::GetTimeDelayCFD(Int_t ipmt)
    
   return fgCalibData->GetTimeEq(ipmt);
 }
+
+//__________________________________________________________________
+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) 
+    {
+      fMeanVertex=0;
+      return fMeanVertex;
+    }
+   
+  return fgCalibData->GetMeanVertex();
+}
 //__________________________________________________________________
 
 TGraph *AliT0Parameters::GetAmpLEDRec(Int_t ipmt) const
@@ -217,14 +292,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