reading latency from OCDB
authoralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Apr 2010 11:12:02 +0000 (11:12 +0000)
committeralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Apr 2010 11:12:02 +0000 (11:12 +0000)
T0/AliT0Parameters.cxx
T0/AliT0Parameters.h
T0/AliT0Reconstructor.cxx
T0/AliT0Reconstructor.h
T0/T0baseLinkDef.h
T0/libT0base.pkg

index d6070c1..05f15f6 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>        
@@ -46,6 +47,7 @@
 AliT0CalibTimeEq* AliT0Parameters::fgCalibData = 0;
 AliT0CalibData* AliT0Parameters::fgLookUp = 0;
 AliT0CalibWalk* AliT0Parameters::fgSlewCorr =0;
+AliT0CalibLatency *AliT0Parameters::fgLatency=0;
 //====================================================================
 ClassImp(AliT0Parameters)
 #if 0
@@ -140,7 +142,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;
 }
 
 
@@ -196,6 +209,46 @@ 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
index 2a2282f..fbdc396 100644 (file)
@@ -23,6 +23,7 @@ class AliT0CalibData;
 class AliCDBEntry;
 class AliT0CalibWalk;
 class AliT0CalibTimeEq;
+class AliT0CalibLatency;
 
 class AliT0Parameters : public TNamed
 {
@@ -62,13 +63,14 @@ public:
   Double_t GetZPositionShift(const char* symname);
 
 
+
   TGraph *  GetPMTeff(Int_t ipmt) const  
   {return (TGraph*)fPMTeff.At(ipmt);}
   Float_t GetpmtEFF(Int_t ipmt, Float_t lambda) const
   {return((TGraph*)fPMTeff.At(ipmt))->Eval(lambda);} 
 
 
-  TGraph *  GetAmpLEDRec(Int_t ipmt) const;  
+  TGraph *GetAmpLEDRec(Int_t ipmt) const;  
   TGraph *GetWalk(Int_t ipmt )  const;
   TGraph *GetQTC(Int_t ipmt) const;
   TGraph *GetAmpLED(Int_t ipmt) const;
@@ -85,7 +87,17 @@ public:
   Int_t GetChannel(Int_t trm,  Int_t tdc, Int_t chain, Int_t channel);
   Int_t GetNumberOfTRMs();
   void SetNumberOfTRMs(Int_t ntrms=2) {fNumberOfTRMs = ntrms;}
-  
+  Float_t GetLatencyHPTDC();
+  Float_t GetLatencyL1();/* {return fLatencyL1;} */
+  Float_t GetLatencyL1A(); /* {return fLatencyL1A;}*/ 
+  Float_t GetLatencyL1C(); /* {return fLatencyL1C;} */
+  void SetLatencyHPTDC(Float_t lat) {fLatencyHPTDC=lat;} 
+  void SetLatencyL1(Float_t lat) {fLatencyL1=lat;} 
+  void SetLatencyL1A(Float_t lat) { fLatencyL1A=lat;} 
+  void  SetLatencyL1C(Float_t lat) { fLatencyL1C=lat;} 
+
  protected:
   static AliT0Parameters* fgInstance; // Static singleton instance
   
@@ -109,24 +121,33 @@ public:
   Float_t   fTimeDelayTVD;  //time delay for TVD (vertex trigger channel)
   Float_t     fMeanT0; //mean of T0distribution with vertex=0;
   Float_t     fMeanVertex; // mean of vertex distribution;
-  
+   
+  Float_t  fLatencyHPTDC; // all latencies;
+  Float_t  fLatencyL1; // all latencies;
+  Float_t  fLatencyL1A; // all latencies;
+  Float_t  fLatencyL1C; // all latencies;
+    
   TMap      fLookUp;           //lookup table
   Int_t     fNumberOfTRMs;    // number of TRMs in setup
   
+  //latency
+
 
   static AliT0CalibTimeEq * fgCalibData; // singleton for Calibration data
   static AliT0CalibData * fgLookUp; // singleton for Calibration data
   static AliT0CalibWalk * fgSlewCorr; // singleton for Calibration data
+  static AliT0CalibLatency * fgLatency; // singleton for Calibration data
   
   AliCDBEntry*   fCalibentry ;  // pointer to T0 calibration object
   AliCDBEntry*   fLookUpentry ;  // pointer to T0 lokkup table
   AliCDBEntry*   fSlewCorr ;  // pointer to slewing correction
+  AliCDBEntry*   fLatency ;  // pointer to latency
 
  private:
   AliT0Parameters(const  AliT0Parameters&);
   AliT0Parameters& operator=(const AliT0Parameters&);
   
-  ClassDef(AliT0Parameters,5)
+  ClassDef(AliT0Parameters,6)
  
 };
 
index 3618b00..dec3748 100644 (file)
@@ -30,6 +30,7 @@
 #include "AliT0Reconstructor.h"
 #include "AliT0Parameters.h"
 #include "AliT0Calibrator.h"
+#include "AliESDfriend.h"
 
 #include <TArrayI.h>
 #include <TGraph.h>
@@ -46,7 +47,12 @@ ClassImp(AliT0Reconstructor)
                                             fAmpLEDrec(),
                                             fQTC(0),
                                             fAmpLED(0),
-                                            fCalib()
+                                             fCalib(),
+                                             fLatencyHPTDC(9000),
+                                             fLatencyL1(0),
+                                             fLatencyL1A(0),
+                                             fLatencyL1C(0)
+
 {
   //constructor
 
@@ -62,6 +68,11 @@ ClassImp(AliT0Reconstructor)
          if (gr2) fQTC.AddAtAndExpand(gr2,i) ;         
   }
 
+  fLatencyL1 = fParam->GetLatencyL1();
+  fLatencyL1A = fParam->GetLatencyL1A();
+  fLatencyL1C = fParam->GetLatencyL1C();
+  fLatencyHPTDC = fParam->GetLatencyHPTDC();
+  AliDebug(10,Form(" LatencyL1 %f latencyL1A %f latencyL1C %f latencyHPTDC %f \n",fLatencyL1, fLatencyL1A, fLatencyL1C, fLatencyHPTDC));
   
   // fdZonC = TMath::Abs(fParam->GetZPositionShift("T0/C/PMT1"));
   //fdZonA = TMath::Abs(fParam->GetZPositionShift("T0/A/PMT15"));
@@ -222,11 +233,7 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
 
   Int_t refAmp = GetRecoParam()->GetRefAmp();
   Int_t refPoint = GetRecoParam()->GetRefPoint();
-  Float_t latencyL1 = GetRecoParam()->GetLatencyL1();
-  Float_t latencyL1A = GetRecoParam()->GetLatencyL1A();
-  Float_t latencyL1C = GetRecoParam()->GetLatencyL1C();
-  Float_t latencyHPTDC = GetRecoParam()->GetLatencyHPTDC();
-  AliDebug(10,Form(" LatencyL1 %f latencyL1A %f latencyL1C %f latencyHPTDC %f \n",latencyL1,latencyL1A,latencyL1C, latencyHPTDC));
+
   Int_t allData[110][5];
   
   Int_t timeCFD[24], timeLED[24], chargeQT0[24], chargeQT1[24];
@@ -237,6 +244,7 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
   // Float_t meanVertex = fParam->GetMeanVertex();
   Float_t meanVertex = 0;
 
+  cout<<" @@@@ Latency "<<fLatencyL1<<endl;
   for (Int_t i0=0; i0<105; i0++)
     {
       for (Int_t j0=0; j0<5; j0++) allData[i0][j0]=0;  
@@ -354,14 +362,14 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
         }
        }
        if(besttimeA < 999999) 
-        frecpoints->SetTimeBestA(0.001* besttimeA * channelWidth - latencyHPTDC + latencyL1A);
+        frecpoints->SetTimeBestA(0.001* besttimeA * channelWidth - fLatencyHPTDC + fLatencyL1A);
        if( besttimeC < 999999 ) 
-        frecpoints->SetTimeBestC( 0.001 *besttimeC * channelWidth - latencyHPTDC + latencyL1C);
+        frecpoints->SetTimeBestC( 0.001 *besttimeC * channelWidth - fLatencyHPTDC + fLatencyL1C);
        AliDebug(10,Form(" pmtA %i besttimeA %f ps, pmtC %i besttimeC %f ps",
                       pmtBestA,besttimeA, pmtBestC,  besttimeC));
         if(besttimeA <999999 && besttimeC < 999999 ){
-        timeDiff = ( besttimeA - besttimeC) *0.001 * channelWidth + latencyL1A - latencyL1C;
-        timeclock = 0.001*channelWidth * Float_t( besttimeA+besttimeC)/2. - latencyHPTDC + latencyL1;  
+        timeDiff = ( besttimeA - besttimeC) *0.001 * channelWidth + fLatencyL1A - fLatencyL1C;
+        timeclock = 0.001*channelWidth * Float_t( besttimeA+besttimeC)/2. - fLatencyHPTDC + fLatencyL1;  
         meanTime = (besttimeA+besttimeC-2.*Float_t(ref))/2.;
         vertex =  meanVertex - c*(timeDiff)/2. ; //+ (fdZonA - fdZonC)/2; 
        }
@@ -380,15 +388,11 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
        if(allData[trchan[itr]][0]>0) tr[itr]=true;
        frecpoints->SetT0Trig(tr);
       }
-      for (Int_t i=0; i<5; i++) 
-       printf(" T0 trigers %i ",tr[i]);
-      printf(" \n ");
       
-      
-      } // if (else )raw data
-      recTree->Fill();
-      if(frecpoints) delete frecpoints;
-    }
+    } // if (else )raw data
+  recTree->Fill();
+  if(frecpoints) delete frecpoints;
+}
   
   
   //____________________________________________________________
@@ -401,7 +405,7 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
   ****************************************************/
   
   AliDebug(1,Form("Start FillESD T0"));
-
+  Float_t channelWidth = fParam->GetChannelWidth() ;  
   Float_t c = 29.9792458; // cm/ns
   Float_t currentVertex=0, shift=0;
   Int_t ncont=0;
@@ -417,8 +421,7 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
     
     ncont = vertex->GetNContributors();
     // cout<<" spdver "<<spdver<<" ncont "<<ncont<<endl;
-    if(ncont>1 ) {
-      //     hVertexSPD->Fill(spdver);
+    if(ncont>2 ) {
       shift = currentVertex/c;
       //         cout<<" vertex shif "<<shift<<" vertex "<<spdver<<" IsFromVertexer3D  "<<fverSPD->IsFromVertexer3D()<<endl;
     }
@@ -441,7 +444,7 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
   } 
     
     brRec->GetEntry(0);
-    Double32_t amp[24], time[24];  
+    Double32_t amp[24], time[24], ampQTC[24], timecorr[24];  
     Double32_t timeClock[3];
     Double32_t zPosition = frecpoints -> GetVertex();
     Double32_t timeStart = frecpoints -> GetMeanTime();
@@ -451,6 +454,7 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
     for ( Int_t i=0; i<24; i++) {
       time[i] =  frecpoints -> GetTime(i); // ps to ns
       amp[i] = frecpoints -> GetAmp(i);
+      ampQTC[i] = frecpoints -> AmpLED(i);
     }
     Int_t trig= frecpoints ->GetT0Trig();
     pESD->SetT0Trig(trig);
@@ -463,6 +467,24 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
     pESD->SetT0amplitude(amp);     // number of particles(MIPs) on each PMT
     
     AliDebug(1,Form("T0: Vertex %f (T0A+T0C)/2 %f #channels T0signal %f ns OrA %f ns OrC %f T0trig %i\n",zPosition, timeStart, timeClock[0], timeClock[1], timeClock[2], trig));
+
+    /* if (pESD) {
+     AliESDfriend *fr = (AliESDfriend*)pESD->FindListObject("AliESDfriend");
+     if (fr) {
+        AliDebug(1, Form("Writing TZERO friend data to ESD tree"));
+
+       if (ncont>2) {
+         for ( Int_t i=0; i<24; i++) {
+           if(i<12) timecorr[i]=time[i]-shift*channelWidth;
+           if(i>11) timecorr[i]=time[i]-shift*channelWidth;
+           fr->SetT0timeCorr(timecorr) ;
+         }
+            fr->SetT0ampLEDminCFD(amp);
+            fr->SetT0ampQTC(ampQTC);
+       }
+    }
+  }
+    */
     
     
 } // vertex in 3 sigma
index ebaccef..e48b034 100644 (file)
@@ -42,6 +42,10 @@ class AliT0Reconstructor: public AliReconstructor {
   TObjArray           fQTC;        // QTC vs #MIPs
   TObjArray           fAmpLED;        // LED-CFD vs #MIPs
   AliT0Calibrator     *fCalib;           //pointer to T0 Calibrator     
+  Float_t fLatencyHPTDC;  //latency HPTDC
+  Float_t fLatencyL1;     //  latency for (T0A+T0C)/2
+  Float_t fLatencyL1A;    // latency for T0A
+  Float_t fLatencyL1C;    //latency for T0C
 
  private:
   AliT0Reconstructor( const AliT0Reconstructor&r ); //Not implemented
index c4ddaac..71fb876 100644 (file)
@@ -26,5 +26,7 @@
 #pragma link C++ class  AliT0Digitizer+;
 #pragma link C++ class  AliT0MisAligner+;
 #pragma link C++ class  AliT0TriggerParameters+;
+#pragma link C++ class  AliT0CalibAmp+;
+#pragma link C++ class  AliT0CalibLatency+;
 
 #endif
index e274ead..9b4eb84 100644 (file)
@@ -3,10 +3,13 @@
 
 SRCS=  AliT0.cxx AliT0digit.cxx AliT0Trigger.cxx \
        AliT0CalibData.cxx AliT0CalibTimeEq.cxx AliT0CalibWalk.cxx \
-       AliT0Parameters.cxx AliT0LookUpValue.cxx AliT0LookUpKey.cxx \
+       AliT0CalibLatency.cxx \
+       AliT0Parameters.cxx AliT0LookUpValue.cxx \
+        AliT0LookUpKey.cxx \
        AliT0Align.cxx AliT0QAChecker.cxx AliT0RecPoint.cxx AliT0hit.cxx \
        AliT0RawReader.cxx   AliT0RawData.cxx AliT0Digitizer.cxx \
-       AliT0MisAligner.cxx AliT0TriggerParameters.cxx
+       AliT0MisAligner.cxx AliT0TriggerParameters.cxx \
+       AliT0CalibAmp.cxx
 
 HDRS= $(SRCS:.cxx=.h)