]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
software update to include time corrections during reconstruction.
authorrpreghen <rpreghen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 14 Feb 2010 23:15:54 +0000 (23:15 +0000)
committerrpreghen <rpreghen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 14 Feb 2010 23:15:54 +0000 (23:15 +0000)
time corrections added are:

- DeltaBC (from raw data)
- L0L1Latency (from raw data)
- CTPLatency (from config stored OCDB)
- TDCLatencyWindow (from config stored in OCDB)
- T0Fill (from PreProcessor measurement stored in OCDB)

added files to local OCDB for simulation

- DeltaBCOffset (set to 0)
- CTPLatency (set to 0)
- T0Fill (set to 0)

modified local OCDB Status object to include TDCLatencyWindow (set to 0)

32 files changed:
OCDB/TOF/Calib/CTPLatency/Run0_999999999_v0_s0.root [new file with mode: 0644]
OCDB/TOF/Calib/DeltaBCOffset/Run0_999999999_v0_s0.root [new file with mode: 0644]
OCDB/TOF/Calib/Status/Run0_999999999_v0_s1.root [new file with mode: 0644]
OCDB/TOF/Calib/T0Fill/Run0_999999999_v0_s0.root [new file with mode: 0644]
TOF/AliTOFCTPLatency.cxx [new file with mode: 0644]
TOF/AliTOFCTPLatency.h [new file with mode: 0644]
TOF/AliTOFChannelOnlineStatusArray.cxx
TOF/AliTOFClusterFinder.cxx
TOF/AliTOFDRMStatusHeader3.h [new file with mode: 0644]
TOF/AliTOFDecoder.cxx
TOF/AliTOFDeltaBCOffset.cxx [new file with mode: 0644]
TOF/AliTOFDeltaBCOffset.h [new file with mode: 0644]
TOF/AliTOFGeometry.cxx
TOF/AliTOFGeometry.h
TOF/AliTOFHitData.cxx
TOF/AliTOFHitData.h
TOF/AliTOFRawDataFormat.h
TOF/AliTOFRawStream.cxx
TOF/AliTOFReconstructor.cxx
TOF/AliTOFT0Fill.cxx [new file with mode: 0644]
TOF/AliTOFT0Fill.h [new file with mode: 0644]
TOF/AliTOFcalib.cxx
TOF/AliTOFcalib.h
TOF/AliTOFcluster.cxx
TOF/AliTOFcluster.h
TOF/AliTOFrawData.cxx
TOF/AliTOFrawData.h
TOF/MakeCDBEntryCTPLatency.C [new file with mode: 0644]
TOF/MakeCDBEntryDeltaBCOffset.C [new file with mode: 0644]
TOF/MakeCDBEntryT0Fill.C [new file with mode: 0644]
TOF/TOFbaseLinkDef.h
TOF/libTOFbase.pkg

diff --git a/OCDB/TOF/Calib/CTPLatency/Run0_999999999_v0_s0.root b/OCDB/TOF/Calib/CTPLatency/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..91dee68
Binary files /dev/null and b/OCDB/TOF/Calib/CTPLatency/Run0_999999999_v0_s0.root differ
diff --git a/OCDB/TOF/Calib/DeltaBCOffset/Run0_999999999_v0_s0.root b/OCDB/TOF/Calib/DeltaBCOffset/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..6d8cce0
Binary files /dev/null and b/OCDB/TOF/Calib/DeltaBCOffset/Run0_999999999_v0_s0.root differ
diff --git a/OCDB/TOF/Calib/Status/Run0_999999999_v0_s1.root b/OCDB/TOF/Calib/Status/Run0_999999999_v0_s1.root
new file mode 100644 (file)
index 0000000..2b9975a
Binary files /dev/null and b/OCDB/TOF/Calib/Status/Run0_999999999_v0_s1.root differ
diff --git a/OCDB/TOF/Calib/T0Fill/Run0_999999999_v0_s0.root b/OCDB/TOF/Calib/T0Fill/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..08e961c
Binary files /dev/null and b/OCDB/TOF/Calib/T0Fill/Run0_999999999_v0_s0.root differ
diff --git a/TOF/AliTOFCTPLatency.cxx b/TOF/AliTOFCTPLatency.cxx
new file mode 100644 (file)
index 0000000..d5abc4c
--- /dev/null
@@ -0,0 +1,75 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/*
+ *
+ *
+ * this class defines the CTPLatency object to be stored
+ * in OCDB in order to apply CTPLatency correction during 
+ * reconstruction. 
+ *
+ *
+ */
+
+#include "AliTOFCTPLatency.h"
+
+ClassImp(AliTOFCTPLatency)
+
+//_________________________________________________________
+
+AliTOFCTPLatency::AliTOFCTPLatency() :
+  TObject(),
+  fCTPLatency(0.)
+{
+  /*
+   * default constructor
+   */
+}
+
+//_________________________________________________________
+
+AliTOFCTPLatency::~AliTOFCTPLatency()
+{
+  /*
+   * default destructor
+   */
+}
+
+//_________________________________________________________
+
+AliTOFCTPLatency::AliTOFCTPLatency(const AliTOFCTPLatency &source) :
+  TObject(source),
+  fCTPLatency(source.fCTPLatency)
+{
+  /*
+   * copy constructor
+   */
+}
+
+//_________________________________________________________
+
+AliTOFCTPLatency &
+AliTOFCTPLatency::operator=(const AliTOFCTPLatency &source)
+{
+  /*
+   * operator=
+   */
+
+  if (this == &source) return *this;
+  TObject::operator=(source);
+  fCTPLatency = source.fCTPLatency;
+  return *this;
+}
+
diff --git a/TOF/AliTOFCTPLatency.h b/TOF/AliTOFCTPLatency.h
new file mode 100644 (file)
index 0000000..5f3d122
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef ALITOFCTPLATENCY_H
+#define ALITOFCTPLATENCY_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+/* $Id$ */
+
+/*
+ *
+ *
+ * this class defines the CTPLatency object to be stored
+ * in OCDB in order to apply CTPLatency correction during 
+ * reconstruction. 
+ *
+ *
+ */
+
+#include "TObject.h"
+
+class AliTOFCTPLatency :
+public TObject
+{
+
+ public:
+
+  AliTOFCTPLatency(); // default constructor
+  virtual ~AliTOFCTPLatency(); // default destructor
+  AliTOFCTPLatency(const AliTOFCTPLatency &source); // copy constructor
+  AliTOFCTPLatency &operator=(const AliTOFCTPLatency &source); // operator=
+  Float_t GetCTPLatency() const {return fCTPLatency;}; // getter
+  void SetCTPLatency(Float_t value) {fCTPLatency = value;}; // setter
+
+ private:
+
+  Float_t fCTPLatency; // CTP latency (ps)
+
+  ClassDef(AliTOFCTPLatency, 1);
+};
+
+#endif /* ALITOFCTPLATENCY_H */
index 4bb403c1b8ebfee9461109a052a17d1fbfc818aa..c131b238db45e4358486988c806ee76cbd81e676 100644 (file)
@@ -53,7 +53,7 @@ AliTOFChannelOnlineStatusArray::AliTOFChannelOnlineStatusArray(Int_t size):
        // ctor with size
        for (Int_t ich = 0; ich<size; ich ++){
          SetStatus(ich,kTOFOnlineUnknown);
-         SetLatencyWindow(ich, -1);
+         SetLatencyWindow(ich, 0);
        }
 }
 //________________________________________________________________
@@ -179,7 +179,7 @@ UChar_t AliTOFChannelOnlineStatusArray::GetNoiseStatus(Int_t pos) const
 Int_t AliTOFChannelOnlineStatusArray::GetLatencyWindow(Int_t pos) const 
 {
        // getting the latency window for channel at position = pos 
-  Int_t lw = -1
+  Int_t lw = 0
   if (!fLatencyWindow) {
     AliWarning("cannot get latency window");
     return lw;
index 3e640205fbae0c96df85729e3d931349e1292f5e..3b333c64ed9f2c400b0af1fc596c0c6a0d12070a 100644 (file)
@@ -131,6 +131,10 @@ Revision 0.01  2005/07/25 A. De Caro
 #include "AliTOFrawData.h"
 //#include "AliTOFRawStream.h"
 
+#include "AliTOFDeltaBCOffset.h"
+#include "AliTOFCTPLatency.h"
+#include "AliTOFT0Fill.h"
+
 //extern TFile *gFile;
 
 ClassImp(AliTOFClusterFinder)
@@ -284,7 +288,7 @@ void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent)
 
   Int_t ii;
   Int_t dig[5]; //cluster detector indeces
-  Int_t  parTOF[5]; //The TOF signal parameters
+  Int_t  parTOF[7]; //The TOF signal parameters
   Bool_t status=kTRUE; // assume all sim channels ok in the beginning...
   for (ii=0; ii<nDigits; ii++) {
     AliTOFdigit *d = (AliTOFdigit*)digits->UncheckedAt(ii);
@@ -312,6 +316,8 @@ void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent)
     parTOF[2] = d->GetAdc(); // the adc charge
     parTOF[3] = d->GetTdcND(); // non decalibrated sim time
     parTOF[4] = d->GetTdc(); // raw time, == Tdc time for the moment
+    parTOF[5] = 0; // deltaBC
+    parTOF[6] = 0; // L0-L1 latency
     Double_t posClus[3];
     Double_t covClus[6];
     UShort_t volIdClus=GetClusterVolIndex(dig);
@@ -381,7 +387,7 @@ void AliTOFClusterFinder::Digits2RecPoints(TTree* digitsTree, TTree* clusterTree
 
   Int_t ii;
   Int_t dig[5]; //cluster detector indeces
-  Int_t  parTOF[5]; //The TOF signal parameters
+  Int_t  parTOF[7]; //The TOF signal parameters
   Bool_t status=kTRUE; // assume all sim channels ok in the beginning...
   for (ii=0; ii<nDigits; ii++) {
     AliTOFdigit *d = (AliTOFdigit*)digits->UncheckedAt(ii);
@@ -409,6 +415,8 @@ void AliTOFClusterFinder::Digits2RecPoints(TTree* digitsTree, TTree* clusterTree
     parTOF[2] = d->GetAdc(); // the adc charge
     parTOF[3] = d->GetTdcND(); // non decalibrated sim time
     parTOF[4] = d->GetTdc(); // raw time, == Tdc time for the moment
+    parTOF[5] = 0; // deltaBC
+    parTOF[6] = 0; // L0-L1 latency
     
     Double_t posClus[3];
     Double_t covClus[6];
@@ -458,7 +466,7 @@ void AliTOFClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
   Int_t dummy = -1;
 
   Int_t detectorIndex[5];
-  Int_t parTOF[5];
+  Int_t parTOF[7];
 
   ofstream ftxt;
   if (fVerbose==2) ftxt.open("TOFdigitsRead.txt",ios::app);
@@ -531,6 +539,8 @@ void AliTOFClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
       parTOF[2] = tofRawDatum->GetTOT(); //ADC==TOF
       parTOF[3] = -1;//raw data: no track of undecalib sim time
       parTOF[4] = tofRawDatum->GetTOF(); // RAW time
+      parTOF[5] = tofRawDatum->GetDeltaBC(); // deltaBC
+      parTOF[6] = tofRawDatum->GetL0L1Latency(); // L0-L1 latency
       Double_t posClus[3];
       Double_t covClus[6];
       UShort_t volIdClus=GetClusterVolIndex(detectorIndex);
@@ -606,7 +616,7 @@ void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent, AliRawReader *rawReader
   Int_t dummy = -1;
 
   Int_t detectorIndex[5] = {-1, -1, -1, -1, -1};
-  Int_t parTOF[5];
+  Int_t parTOF[7];
   ofstream ftxt;
   if (fVerbose==2) ftxt.open("TOFdigitsRead.txt",ios::app);
 
@@ -678,6 +688,8 @@ void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent, AliRawReader *rawReader
       parTOF[2] = tofRawDatum->GetTOT(); // raw data have ADC=TOT
       parTOF[3] = -1; //raw data: no track of the undecalib sim time
       parTOF[4] = tofRawDatum->GetTOF(); // Raw time == TDC
+      parTOF[5] = tofRawDatum->GetDeltaBC(); // deltaBC
+      parTOF[6] = tofRawDatum->GetL0L1Latency(); // L0-L1 latency
       Double_t posClus[3];
       Double_t covClus[6];
       UShort_t volIdClus=GetClusterVolIndex(detectorIndex);
@@ -963,7 +975,7 @@ void AliTOFClusterFinder::FillRecPoint()
   Int_t ii, jj;
 
   Int_t detectorIndex[5];
-  Int_t parTOF[5];
+  Int_t parTOF[7];
   Int_t trackLabels[3];
   Int_t digitIndex = -1;
   Bool_t status=kTRUE;
@@ -980,6 +992,8 @@ void AliTOFClusterFinder::FillRecPoint()
     parTOF[2] = fTofClusters[ii]->GetADC(); // ADC=TOT
     parTOF[3] = fTofClusters[ii]->GetTDCND(); // TDCND
     parTOF[4] = fTofClusters[ii]->GetTDCRAW();//RAW
+    parTOF[5] = fTofClusters[ii]->GetDeltaBC();//deltaBC
+    parTOF[6] = fTofClusters[ii]->GetL0L1Latency();//L0-L1 latency
     status=fTofClusters[ii]->GetStatus();
     Double_t posClus[3];
     Double_t covClus[6];
@@ -1020,11 +1034,19 @@ void AliTOFClusterFinder::CalibrateRecPoint()
   Double_t tToT;
   Double_t timeCorr;
   Int_t   tdcCorr;
+  Float_t tdcLatencyWindow;
   AliDebug(1," Calibrating TOF Clusters");
 
   AliTOFChannelOnlineArray *calDelay = fTOFcalib->GetTOFOnlineDelay();  
   AliTOFChannelOnlineStatusArray *calStatus = fTOFcalib->GetTOFOnlineStatus();  
   TObjArray *calTOFArrayOffline = fTOFcalib->GetTOFCalArrayOffline();
+  
+  AliTOFDeltaBCOffset *deltaBCOffsetObj = fTOFcalib->GetDeltaBCOffset();
+  Int_t deltaBCOffset = deltaBCOffsetObj->GetDeltaBCOffset();
+  AliTOFCTPLatency *ctpLatencyObj = fTOFcalib->GetCTPLatency();
+  Float_t ctpLatency = ctpLatencyObj->GetCTPLatency();
+  AliTOFT0Fill *t0FillObj = fTOFcalib->GetT0Fill();
+  Float_t t0Fill = t0FillObj->GetT0Fill();
 
   TString validity = (TString)fTOFcalib->GetOfflineValidity();
   Int_t calibration = -1;
@@ -1046,7 +1068,8 @@ void AliTOFClusterFinder::CalibrateRecPoint()
     UChar_t statusNoise=calStatus->GetNoiseStatus(index);
     UChar_t statusHW=calStatus->GetHWStatus(index);
     UChar_t status=calStatus->GetStatus(index);
-
+    tdcLatencyWindow = calStatus->GetLatencyWindow(index) * 1.e3; /* ns -> ps */
+    
     //check the status, also unknown is fine!!!!!!!
 
     AliDebug(2, Form(" Status for channel %d = %d",index, (Int_t)status));
@@ -1082,6 +1105,38 @@ void AliTOFClusterFinder::CalibrateRecPoint()
     timeCorr=(Double_t)(fTofClusters[ii]->GetTDC())*AliTOFGeometry::TdcBinWidth()*1.E-3-timeCorr;//redefine the time
     timeCorr*=1.E3;
     AliDebug(2,Form(" The channel time, corr (ps)= %e",timeCorr ));
+
+    /* here timeCorr should be already corrected for calibration. 
+     * we now go into further corrections keeping in mind that timeCorr
+     * is in ps.
+     *
+     * the following corrections are performed in this way:
+     *
+     *    time = timeRaw - deltaBC + L0L1Latency + CTPLatency - TDCLatencyWindow - T0Fill
+     *
+     */
+
+    AliDebug(2, Form("applying further corrections (DeltaBC): DeltaBC=%d (BC bins), DeltaBCoffset=%d (BC bins)", fTofClusters[ii]->GetDeltaBC(), deltaBCOffset));
+    AliDebug(2, Form("applying further corrections (L0L1Latency): L0L1Latency=%d (BC bins)", fTofClusters[ii]->GetL0L1Latency()));
+    AliDebug(2, Form("applying further corrections (CTPLatency): CTPLatency=%f (ps)", ctpLatency));
+    AliDebug(2, Form("applying further corrections (TDCLatencyWindow): TDCLatencyWindow=%f (ps)", tdcLatencyWindow));
+    AliDebug(2, Form("applying further corrections (T0Fill): T0Fill=%f (ps)", t0Fill));
+
+    /* deltaBC correction */
+    timeCorr -= (fTofClusters[ii]->GetDeltaBC() - deltaBCOffset) * AliTOFGeometry::BunchCrossingBinWidth();
+    /* L0L1-latency correction */
+    timeCorr += fTofClusters[ii]->GetL0L1Latency() * AliTOFGeometry::BunchCrossingBinWidth();
+    /* CTP-latency correction (from OCDB) */
+    timeCorr += ctpLatency;
+    /* TDC latency-window correction (from OCDB) */
+    timeCorr -= tdcLatencyWindow;
+    /* T0Fill correction (from OCDB) */
+    timeCorr -= t0Fill;
+
+    /*
+     * end of furhter corrections
+     */
+
     tdcCorr=(Int_t)(timeCorr/AliTOFGeometry::TdcBinWidth()); //the corrected time (tdc counts)
     fTofClusters[ii]->SetTDC(tdcCorr);
   } // loop on clusters
diff --git a/TOF/AliTOFDRMStatusHeader3.h b/TOF/AliTOFDRMStatusHeader3.h
new file mode 100644 (file)
index 0000000..3b2e2ad
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef ALITOFDRMSTATUSHEADER3_H
+#define ALITOFDRMSTATUSHEADER3_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: AliTOFRawDataFormat.h 23881 2008-02-12 16:46:22Z decaro $ */
+
+///////////////////////////////////////////////////////////////
+//                                                           //
+//   This classes provide the TOF raw data bit fields.       //
+//                                                           //
+///////////////////////////////////////////////////////////////
+
+#include "TROOT.h"
+
+class AliTOFDRMStatusHeader3
+{
+ public:
+  UInt_t GetSlot() {return fSlotID;};
+  UInt_t GetL0BCID() {return fL0BCID;};
+  UInt_t GetRunTimeInfo() {return fRunTimeInfo;};
+  UInt_t GetWordType() {return fWordType;};
+ private:
+  UInt_t fSlotID: 4;
+  UInt_t fL0BCID: 12;
+  UInt_t fRunTimeInfo: 12;
+  UInt_t fWordType: 4;
+};
+
+#endif
index 0f060893471d0508bb63be12c19a49ffa2889663..2474322d75c090e0734a1a0f4277269de94405ca 100644 (file)
@@ -173,6 +173,7 @@ AliTOFDecoder::Decode(const UInt_t *rawData, Int_t nWords, const AliRawDataHeade
    * classes.
    */
 
+  AliTOFDRMStatusHeader3 *lDRMStatusHeader3;
   AliTOFTRMGlobalHeader          *lTRMGlobalHeader; //TRM global header
   AliTOFTRMGlobalTrailer         *lTRMGlobalTrailer; //TRM global trailer
   AliTOFTRMChainHeader           *lTRMChainHeader; //TRM chain header
@@ -199,6 +200,7 @@ AliTOFDecoder::Decode(const UInt_t *rawData, Int_t nWords, const AliRawDataHeade
   Short_t  currentACQ = -1;
   Short_t  currentChain = -1;
   Short_t  currentBunchID = -1;
+  Short_t  currentL0BCID = -1;
   Short_t  currentMiniEventID = cdh ? cdh->GetMiniEventID() : (Short_t)-1;
   Short_t  currentEventID1 = cdh ? cdh->GetEventID1() : (Short_t)-1;
   AliDebug(1, Form("EvID1 = %d, EvID2 = %d, currentMiniEventID = %d", currentEventID1, cdh->GetEventID2(), currentMiniEventID));
@@ -251,9 +253,18 @@ AliTOFDecoder::Decode(const UInt_t *rawData, Int_t nWords, const AliRawDataHeade
        decodeStatus = decodeStatus | DRM_BIT;
        
        //skip DRM data
-       for (Int_t i = 0; i < DRM_DATA_WORDS; i++, iWord++, rawData++){
+       for (Int_t i = 0; i < DRM_DATA_WORDS; i++, iWord++){
+         rawData++;
          if (fVerbose)
            AliInfo(Form("  %02x - 0x%08x \t  DRM data",decodeStatus,*rawData));
+         switch (i) {
+         case 2:
+           lDRMStatusHeader3 = (AliTOFDRMStatusHeader3*)rawData;
+           currentL0BCID = lDRMStatusHeader3->GetL0BCID();
+           break;
+         default:
+           break;
+         }
        }
        break;
        
@@ -271,7 +282,8 @@ AliTOFDecoder::Decode(const UInt_t *rawData, Int_t nWords, const AliRawDataHeade
        decodeStatus = decodeStatus | LTM_BIT;
        
        //skip LTM data
-       for (Int_t i = 0; i < LTM_DATA_WORDS; i++, iWord++, rawData++){
+       for (Int_t i = 0; i < LTM_DATA_WORDS; i++, iWord++){
+         rawData++;
          if (fVerbose)
            AliInfo(Form("  %02x - 0x%08x \t  LTM data",decodeStatus,*rawData));
        }
@@ -458,6 +470,7 @@ AliTOFDecoder::Decode(const UInt_t *rawData, Int_t nWords, const AliRawDataHeade
        hitData.SetTOT((float)lTDCPackedHit->GetTOTWidth() * TOT_BIN_WIDTH);
        hitData.SetTOTBin(lTDCPackedHit->GetTOTWidth());
        hitData.SetDeltaBunchID(currentBunchID - currentEventID1);
+       hitData.SetL0L1Latency(currentMiniEventID - currentL0BCID);
        //orphane leading hit
        if (hitData.GetPS()==LEADING_HIT_PS){
          hitData.SetTime((float)lTDCUnpackedHit->GetHitTime() * TIME_BIN_WIDTH);
@@ -552,6 +565,7 @@ AliTOFDecoder::Decode(const UInt_t *rawData, Int_t nWords, const AliRawDataHeade
        hitData.SetTOT(-1.);
        hitData.SetTOTBin(-1);
        hitData.SetDeltaBunchID(currentBunchID - currentEventID1);
+       hitData.SetL0L1Latency(currentMiniEventID - currentL0BCID);
        //push hit data in data buffer
          if (fDataBuffer != 0x0)
            fDataBuffer->Add(hitData);
@@ -589,6 +603,7 @@ AliTOFDecoder::Decode(const UInt_t *rawData, Int_t nWords, const AliRawDataHeade
        hitData.SetTOT(-1.);
        hitData.SetTOTBin(-1);
        hitData.SetDeltaBunchID(currentBunchID - currentEventID1);
+       hitData.SetL0L1Latency(currentMiniEventID - currentL0BCID);
        //push hit data in data buffer
          if (fDataBuffer != 0x0)
            fDataBuffer->Add(hitData);
diff --git a/TOF/AliTOFDeltaBCOffset.cxx b/TOF/AliTOFDeltaBCOffset.cxx
new file mode 100644 (file)
index 0000000..25aec19
--- /dev/null
@@ -0,0 +1,75 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/*
+ *
+ *
+ * this class defines the DeltaBCOffset object to be stored
+ * in OCDB in order to apply DeltaBC correction during 
+ * reconstruction. 
+ *
+ *
+ */
+
+#include "AliTOFDeltaBCOffset.h"
+
+ClassImp(AliTOFDeltaBCOffset)
+
+//_________________________________________________________
+
+AliTOFDeltaBCOffset::AliTOFDeltaBCOffset() :
+  TObject(),
+  fDeltaBCOffset(0)
+{
+  /*
+   * default constructor
+   */
+}
+
+//_________________________________________________________
+
+AliTOFDeltaBCOffset::~AliTOFDeltaBCOffset()
+{
+  /*
+   * default destructor
+   */
+}
+
+//_________________________________________________________
+
+AliTOFDeltaBCOffset::AliTOFDeltaBCOffset(const AliTOFDeltaBCOffset &source) :
+  TObject(source),
+  fDeltaBCOffset(source.fDeltaBCOffset)
+{
+  /*
+   * copy constructor
+   */
+}
+
+//_________________________________________________________
+
+AliTOFDeltaBCOffset &
+AliTOFDeltaBCOffset::operator=(const AliTOFDeltaBCOffset &source)
+{
+  /*
+   * operator=
+   */
+
+  if (this == &source) return *this;
+  TObject::operator=(source);
+  fDeltaBCOffset = source.fDeltaBCOffset;
+  return *this;
+}
+
diff --git a/TOF/AliTOFDeltaBCOffset.h b/TOF/AliTOFDeltaBCOffset.h
new file mode 100644 (file)
index 0000000..e195940
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef ALITOFDELTABCOFFSET_H
+#define ALITOFDELTABCOFFSET_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+/* $Id$ */
+
+/*
+ *
+ *
+ * this class defines the DeltaBCOffset object to be stored
+ * in OCDB in order to apply DeltaBC correction during 
+ * reconstruction. 
+ *
+ *
+ */
+
+#include "TObject.h"
+
+class AliTOFDeltaBCOffset :
+public TObject
+{
+
+ public:
+
+  AliTOFDeltaBCOffset(); // default constructor
+  virtual ~AliTOFDeltaBCOffset(); // default destructor
+  AliTOFDeltaBCOffset(const AliTOFDeltaBCOffset &source); // copy constructor
+  AliTOFDeltaBCOffset &operator=(const AliTOFDeltaBCOffset &source); // operator=
+  Int_t GetDeltaBCOffset() const {return fDeltaBCOffset;}; // getter
+  void SetDeltaBCOffset(Int_t value) {fDeltaBCOffset = value;}; // setter
+
+ private:
+
+  Int_t fDeltaBCOffset; // deltaBC offset (BC bins)
+
+  ClassDef(AliTOFDeltaBCOffset, 1);
+};
+
+#endif /* ALITOFDELTABCOFFSET_H */
index 829e640eb13d5c2910738e6d36d7071fd9df4397..5dfd0b7b57b3b69d6499622884ee3b78d9a33d44 100644 (file)
@@ -149,6 +149,7 @@ const Float_t AliTOFGeometry::fgkPhiSec= 20;//sector Phi width (deg)
 
 const Float_t AliTOFGeometry::fgkTdcBin = 24.4;     // time-of-flight bin width [ps]
 const Float_t AliTOFGeometry::fgkToTBin = 48.8;     // time-over-threshold bin width [ps]
+const Float_t AliTOFGeometry::fgkBunchCrossingBin = fgkTdcBin * 1024; // bunch-crossing bin width [ps]
 
 const Float_t AliTOFGeometry::fgkDeadTime = 25E+03;        // Single channel dead time (ps)
 const Float_t AliTOFGeometry::fgkMatchingWindow = fgkTdcBin*TMath::Power(2,13); // Matching window  (ps)
index fb40dec3e3bb3008b526ce058543d704b0542b95..07d9b2ba5647d4a056f763c409aa78c9cff655e4 100644 (file)
@@ -71,6 +71,7 @@ class AliTOFGeometry: public TObject{
  
   static Float_t TdcBinWidth() {return fgkTdcBin;};
   static Float_t ToTBinWidth() {return fgkToTBin;};
+  static Float_t BunchCrossingBinWidth() {return fgkBunchCrossingBin;};
 
   virtual void    ImportGeometry();
   virtual void    SetHoles(Bool_t holes) {fHoles = holes;};
@@ -171,6 +172,7 @@ class AliTOFGeometry: public TObject{
 
   static const Float_t fgkTdcBin;   // time-of-flight bin width [ps]
   static const Float_t fgkToTBin;   // time-over-threshold bin width [ps]
+  static const Float_t fgkBunchCrossingBin; // bunch-crossing bin width [ps]
 
   ClassDef(AliTOFGeometry,8) // TOF Geometry base class
 };
index 1edd800e9c34250d808efd7df86935772d8557fc..2ff601a9844aef18b61213e98175a1ed961a87b0 100644 (file)
@@ -45,6 +45,7 @@ AliTOFHitData::AliTOFHitData():
   fTOT(-1),
   fTOTBin(-1),
   fDeltaBunchID(-1),
+  fL0L1Latency(-1),
   fDeltaEventCounter(-1)
 {
   //ctor
@@ -66,6 +67,7 @@ AliTOFHitData::AliTOFHitData(const AliTOFHitData &source):
   fTOT(source.fTOT),
   fTOTBin(source.fTOTBin),
   fDeltaBunchID(source.fDeltaBunchID),
+  fL0L1Latency(source.fL0L1Latency),
   fDeltaEventCounter(source.fDeltaEventCounter)
 { 
   // copy constructor 
@@ -90,6 +92,7 @@ AliTOFHitData& AliTOFHitData::operator=(const AliTOFHitData & source) {
     fTOT= source.fTOT;
     fTOTBin= source.fTOTBin;
     fDeltaBunchID=source.fDeltaBunchID;
+    fL0L1Latency=source.fL0L1Latency;
     fDeltaEventCounter=source.fDeltaEventCounter;
   }
   return *this;
index 3c6977a9be0425f6f1fd5684186684aa867b9057..ead4067770dd3870d1764b3797493fddbd29f812 100644 (file)
@@ -37,6 +37,7 @@ class AliTOFHitData : public TObject{
   Float_t GetTOT() const {return fTOT;};
   Int_t GetTOTBin() const {return fTOTBin;};
   Int_t GetDeltaBunchID() const {return fDeltaBunchID;};
+  Int_t GetL0L1Latency() const {return fL0L1Latency;};
   Int_t GetDeltaEventCounter() const {return fDeltaEventCounter;};
 
   void SetVolume(Int_t *Volume);
@@ -53,6 +54,7 @@ class AliTOFHitData : public TObject{
   void SetTOT(Float_t TOT)        { fTOT=TOT;};
   void SetTOTBin(Int_t TOTBin) {fTOTBin=TOTBin;};
   void SetDeltaBunchID(Int_t Value) {fDeltaBunchID=Value;};
+  void SetL0L1Latency(Int_t Value) {fL0L1Latency=Value;};
   void SetDeltaEventCounter(Int_t Value) {fDeltaEventCounter=Value;};
   
  private:
@@ -69,9 +71,10 @@ class AliTOFHitData : public TObject{
   Float_t fTOT;       // tot [ns]
   Int_t fTOTBin;       // TOT [TOT bin = 48.4ps]
   Int_t fDeltaBunchID; // TRM bunchID - miniEventID
+  Int_t fL0L1Latency; // L0BCID - miniEventID
   Int_t fDeltaEventCounter; // TRM event counter - DRM local event counter
 
-  ClassDef(AliTOFHitData, 1);
+  ClassDef(AliTOFHitData, 2);
 };
 
 #endif
index e14e91c310741a42f484105a3b7d8f9730d02e0a..0a0208cbecf76eb131ec348d41baf2bf67226255 100644 (file)
@@ -12,6 +12,7 @@
 //                                                           //
 ///////////////////////////////////////////////////////////////
 
+#include "AliTOFDRMStatusHeader3.h"
 #include "AliTOFTRMGlobalHeader.h"
 #include "AliTOFTRMGlobalTrailer.h"
 #include "AliTOFTRMChainHeader.h"
index 4f45f2bbb026bc79f8cefcde3fa4e394e72eb150..19e0181f8fd8686460f86b3221bf1db05f694a17 100644 (file)
@@ -1540,20 +1540,15 @@ AliTOFRawStream::LoadRawDataBuffers(Int_t indexDDL, Int_t verbose)
     Int_t   hitChan = hitData->GetChan();
     Int_t   hitTimeBin = hitData->GetTimeBin();
     Int_t   hitTOTBin = hitData->GetTOTBin();
-
-    if (fgApplyBCCorrections) {
-      /* DDL BC shift time correction */
-      hitTimeBin += 1024 * fgkddlBCshift[indexDDL];
-      /* deltaBC shift time correction */
-      hitTimeBin += 1024 * (hitData->GetDeltaBunchID() - 37);
-    }
+    Int_t   hitDeltaBC = hitData->GetDeltaBunchID();
+    Int_t   hitL0L1Latency = hitData->GetL0L1Latency();
 
     Int_t hitLeading = hitData->GetTimeBin();
     Int_t hitTrailing = -1;
     Int_t hitError = -1;
     
     TClonesArray &arrayTofRawData =  *fTOFrawData;
-    new (arrayTofRawData[fPackedDigits++]) AliTOFrawData(hitSlotID, hitChain, hitTDC, hitChan, hitTimeBin, hitTOTBin, hitLeading, hitTrailing, hitPS, hitACQ, hitError);
+    new (arrayTofRawData[fPackedDigits++]) AliTOFrawData(hitSlotID, hitChain, hitTDC, hitChan, hitTimeBin, hitTOTBin, hitLeading, hitTrailing, hitPS, hitACQ, hitError, hitDeltaBC, hitL0L1Latency);
   }
 
   if (verbose > 0)
index bdbf7e1898b55721855372b4f86ab4f67d362b76..23bd66c5f542f51e4f7c0b5a3fc10b69b936a8f2 100644 (file)
@@ -59,6 +59,11 @@ AliTOFReconstructor::AliTOFReconstructor()
   if(!fTOFcalib->ReadParOnlineStatusFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
 
   if(!fTOFcalib->ReadParOfflineFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
+
+
+  if(!fTOFcalib->ReadDeltaBCOffsetFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
+  if(!fTOFcalib->ReadCTPLatencyFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
+  if(!fTOFcalib->ReadT0FillFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
 }
 
 //_____________________________________________________________________________
diff --git a/TOF/AliTOFT0Fill.cxx b/TOF/AliTOFT0Fill.cxx
new file mode 100644 (file)
index 0000000..6f02350
--- /dev/null
@@ -0,0 +1,75 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/*
+ *
+ *
+ * this class defines the T0Fill object to be stored
+ * in OCDB in order to apply T0Fill correction during 
+ * reconstruction. 
+ *
+ *
+ */
+
+#include "AliTOFT0Fill.h"
+
+ClassImp(AliTOFT0Fill)
+
+//_________________________________________________________
+
+AliTOFT0Fill::AliTOFT0Fill() :
+  TObject(),
+  fT0Fill(0.)
+{
+  /*
+   * default constructor
+   */
+}
+
+//_________________________________________________________
+
+AliTOFT0Fill::~AliTOFT0Fill()
+{
+  /*
+   * default destructor
+   */
+}
+
+//_________________________________________________________
+
+AliTOFT0Fill::AliTOFT0Fill(const AliTOFT0Fill &source) :
+  TObject(source),
+  fT0Fill(source.fT0Fill)
+{
+  /*
+   * copy constructor
+   */
+}
+
+//_________________________________________________________
+
+AliTOFT0Fill &
+AliTOFT0Fill::operator=(const AliTOFT0Fill &source)
+{
+  /*
+   * operator=
+   */
+
+  if (this == &source) return *this;
+  TObject::operator=(source);
+  fT0Fill = source.fT0Fill;
+  return *this;
+}
+
diff --git a/TOF/AliTOFT0Fill.h b/TOF/AliTOFT0Fill.h
new file mode 100644 (file)
index 0000000..b768c6d
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef ALITOFT0FILL_H
+#define ALITOFT0FILL_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+/* $Id$ */
+
+/*
+ *
+ *
+ * this class defines the T0Fill object to be stored
+ * in OCDB in order to apply T0Fill correction during 
+ * reconstruction. 
+ *
+ *
+ */
+
+#include "TObject.h"
+
+class AliTOFT0Fill :
+public TObject
+{
+
+ public:
+
+  AliTOFT0Fill(); // default constructor
+  virtual ~AliTOFT0Fill(); // default destructor
+  AliTOFT0Fill(const AliTOFT0Fill &source); // copy constructor
+  AliTOFT0Fill &operator=(const AliTOFT0Fill &source); // operator=
+  Float_t GetT0Fill() const {return fT0Fill;}; // getter
+  void SetT0Fill(Float_t value) {fT0Fill = value;}; // setter
+
+ private:
+
+  Float_t fT0Fill; // event time (ps)
+
+  ClassDef(AliTOFT0Fill, 1);
+};
+
+#endif /* ALITOFT0FILL_H */
index a03a70194f4f09425fb48f088d86357d9965bc48..422483352fe21c9971fdab7c645df69db57df10d 100644 (file)
@@ -113,6 +113,10 @@ author: Chiara Zampolli, zampolli@bo.infn.it
 #include "AliTOFChannelOffline.h"
 #include "AliTOFGeometry.h"
 #include "AliTOFRecoParam.h"
+#include "AliTOFDeltaBCOffset.h"
+#include "AliTOFCTPLatency.h"
+#include "AliTOFT0Fill.h"
+
 
 class TROOT;
 class TStyle;
@@ -140,7 +144,10 @@ AliTOFcalib::AliTOFcalib():
   fNruns(0),
   fFirstRun(0),
   fLastRun(AliCDBRunRange::Infinity()),
-  fConfigMap(new TMap)
+  fConfigMap(new TMap),
+  fDeltaBCOffset(NULL),
+  fCTPLatency(NULL),
+  fT0Fill(NULL)
 { 
   //TOF Calibration Class ctor
   fNChannels = AliTOFGeometry::NSectors()*(2*(AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB())+AliTOFGeometry::NStripA())*AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX();
@@ -164,7 +171,10 @@ AliTOFcalib::AliTOFcalib(const AliTOFcalib & calib):
   fNruns(calib.fNruns),
   fFirstRun(calib.fFirstRun),
   fLastRun(calib.fLastRun),
-  fConfigMap(calib.fConfigMap)
+  fConfigMap(calib.fConfigMap),
+  fDeltaBCOffset(NULL),
+  fCTPLatency(NULL),
+  fT0Fill(NULL)
 {
   //TOF Calibration Class copy ctor
   for (Int_t iarray = 0; iarray<fNChannels; iarray++){
@@ -179,6 +189,10 @@ AliTOFcalib::AliTOFcalib(const AliTOFcalib & calib):
     fTOFCalOnlineHW->AddAt(calChOnlineStHW,iarray);
     fTOFCalOffline->AddAt(calChOffline,iarray);
   }
+
+  if (calib.fDeltaBCOffset) fDeltaBCOffset = new AliTOFDeltaBCOffset(*calib.fDeltaBCOffset);
+  if (calib.fCTPLatency) fCTPLatency = new AliTOFCTPLatency(*calib.fCTPLatency);
+  if (calib.fT0Fill) fT0Fill = new AliTOFT0Fill(*calib.fT0Fill);
 }
 
 //____________________________________________________________________________ 
@@ -213,6 +227,22 @@ AliTOFcalib& AliTOFcalib::operator=(const AliTOFcalib &calib)
     fTOFCalOnlineHW->AddAt(calChOnlineStHW,iarray);
     fTOFCalOffline->AddAt(calChOffline,iarray);
   }
+
+  if (calib.fDeltaBCOffset) {
+    if (fDeltaBCOffset) *fDeltaBCOffset = *calib.fDeltaBCOffset;
+    else fDeltaBCOffset = new AliTOFDeltaBCOffset(*calib.fDeltaBCOffset);
+  }
+
+  if (calib.fCTPLatency) {
+    if (fCTPLatency) *fCTPLatency = *calib.fCTPLatency;
+    else fCTPLatency = new AliTOFCTPLatency(*calib.fCTPLatency);
+  }
+
+  if (calib.fT0Fill) {
+    if (fT0Fill) *fT0Fill = *calib.fT0Fill;
+    else fT0Fill = new AliTOFT0Fill(*calib.fT0Fill);
+  }
+
   return *this;
 }
 
@@ -246,9 +276,13 @@ AliTOFcalib::~AliTOFcalib()
     if (fConfigMap){
       delete fConfigMap;
     }
+    if (fDeltaBCOffset) delete fDeltaBCOffset;
+    if (fCTPLatency) delete fCTPLatency;
+    if (fT0Fill) delete fT0Fill;
   }
   if (fTree!=0x0) delete fTree;
   if (fChain!=0x0) delete fChain;
+
 }
 //_____________________________________________________________________________
 void AliTOFcalib::CreateCalArrays(){
@@ -1793,3 +1827,179 @@ Int_t AliTOFcalib::FindBins(TH1F* h, Double_t *binsProfile) const{
   }
   return nusefulbins;
 }
+
+
+//----------------------------------------------------------------------------
+
+void
+AliTOFcalib::CreateDeltaBCOffset()
+{
+  /*
+   * create deltaBC offset
+   */
+
+  if (fDeltaBCOffset) {
+    AliWarning("DeltaBCOffset object already defined, cannot create a new one");
+    return;
+  }
+  fDeltaBCOffset = new AliTOFDeltaBCOffset();
+}
+  
+//----------------------------------------------------------------------------
+
+void
+AliTOFcalib::CreateCTPLatency()
+{
+  /*
+   * create CTP latency
+   */
+
+  if (fCTPLatency) {
+    AliWarning("CTPLatency object already defined, cannot create a new one");
+    return;
+  }
+  fCTPLatency = new AliTOFCTPLatency();
+}
+  
+//----------------------------------------------------------------------------
+
+void
+AliTOFcalib::CreateT0Fill()
+{
+  /*
+   * create event-time
+   */
+
+  if (fT0Fill) {
+    AliWarning("T0Fill object already defined, cannot create a new one");
+    return;
+  }
+  fT0Fill = new AliTOFT0Fill();
+}
+  
+//----------------------------------------------------------------------------
+
+void
+AliTOFcalib::WriteDeltaBCOffsetOnCDB(const Char_t *sel , Int_t minrun, Int_t maxrun)
+{
+  /*
+   * deltaBC offset on CDB 
+   */
+  
+  if (!fDeltaBCOffset) return;
+  AliCDBId id(Form("%s/DeltaBCOffset", sel), minrun, maxrun);
+  AliCDBMetaData *md = new AliCDBMetaData();
+  md->SetResponsible("Roberto Preghenella");
+  AliCDBManager *man = AliCDBManager::Instance();
+  man->Put(fDeltaBCOffset, id, md);
+  AliDebug(2,Form("DeltaBCOffset written on CDB with run range [%i, %i] ",minrun ,maxrun));
+  delete md;
+}
+
+//----------------------------------------------------------------------------
+
+void
+AliTOFcalib::WriteCTPLatencyOnCDB(const Char_t *sel , Int_t minrun, Int_t maxrun)
+{
+  /*
+   * write CTP latency on CDB 
+   */
+  
+  if (!fCTPLatency) return;
+  AliCDBId id(Form("%s/CTPLatency", sel), minrun, maxrun);
+  AliCDBMetaData *md = new AliCDBMetaData();
+  md->SetResponsible("Roberto Preghenella");
+  AliCDBManager *man = AliCDBManager::Instance();
+  man->Put(fCTPLatency, id, md);
+  AliDebug(2,Form("CTPLatency written on CDB with run range [%i, %i] ",minrun ,maxrun));
+  delete md;
+}
+
+//----------------------------------------------------------------------------
+
+void
+AliTOFcalib::WriteT0FillOnCDB(const Char_t *sel , Int_t minrun, Int_t maxrun)
+{
+  /*
+   * write event-time on CDB 
+   */
+  
+  if (!fT0Fill) return;
+  AliCDBId id(Form("%s/T0Fill", sel), minrun, maxrun);
+  AliCDBMetaData *md = new AliCDBMetaData();
+  md->SetResponsible("Roberto Preghenella");
+  AliCDBManager *man = AliCDBManager::Instance();
+  man->Put(fT0Fill, id, md);
+  AliDebug(2,Form("T0Fill written on CDB with run range [%i, %i] ",minrun ,maxrun));
+  delete md;
+}
+
+//----------------------------------------------------------------------------
+
+Bool_t
+AliTOFcalib::ReadDeltaBCOffsetFromCDB(const Char_t *sel , Int_t nrun)
+{
+  /*
+   * read deltaBC offset from CDB
+   */
+  
+  AliCDBManager *man = AliCDBManager::Instance();
+  AliCDBEntry *entry = man->Get(Form("%s/DeltaBCOffset", sel),nrun);
+  if (!entry) { 
+    AliFatal("No DeltaBCOffset entry found in CDB");
+    exit(0);  
+  }
+  fDeltaBCOffset =(AliTOFDeltaBCOffset *)entry->GetObject();
+  if(!fDeltaBCOffset){
+    AliFatal("No DeltaBCOffset object found in CDB entry");
+    exit(0);  
+  }  
+  return kTRUE; 
+}
+
+//----------------------------------------------------------------------------
+
+Bool_t
+AliTOFcalib::ReadCTPLatencyFromCDB(const Char_t *sel , Int_t nrun)
+{
+  /*
+   * read CTP latency from CDB
+   */
+  
+  AliCDBManager *man = AliCDBManager::Instance();
+  AliCDBEntry *entry = man->Get(Form("%s/CTPLatency", sel),nrun);
+  if (!entry) { 
+    AliFatal("No CTPLatency entry found in CDB");
+    exit(0);  
+  }
+  fCTPLatency =(AliTOFCTPLatency *)entry->GetObject();
+  if(!fCTPLatency){
+    AliFatal("No CTPLatency object found in CDB entry");
+    exit(0);  
+  }  
+  return kTRUE; 
+}
+
+//----------------------------------------------------------------------------
+
+Bool_t
+AliTOFcalib::ReadT0FillFromCDB(const Char_t *sel , Int_t nrun)
+{
+  /*
+   * read event-time from CDB
+   */
+  
+  AliCDBManager *man = AliCDBManager::Instance();
+  AliCDBEntry *entry = man->Get(Form("%s/T0Fill", sel),nrun);
+  if (!entry) { 
+    AliFatal("No T0Fill entry found in CDB");
+    exit(0);  
+  }
+  fT0Fill =(AliTOFT0Fill *)entry->GetObject();
+  if(!fT0Fill){
+    AliFatal("No T0Fill object found in CDB entry");
+    exit(0);  
+  }  
+  return kTRUE; 
+}
+
index 3263622be6a47fe6c9964876e5305e6af884a2c7..5df86d9b6d12ae25a7896cbf83874c256513d338 100644 (file)
@@ -40,6 +40,9 @@ class AliTOFCal;
 class AliTOFRecoParam;
 class AliTOFChannelOnlineStatusArray;
 class AliTOFChannelOnlineArray;
+class AliTOFDeltaBCOffset;
+class AliTOFCTPLatency;
+class AliTOFT0Fill;
 
 class AliTOFcalib:public TTask{
 public:
@@ -64,6 +67,13 @@ public:
   void SetOfflineValidity(const char* validity) {fkValidity = validity;}
   Int_t NChannels()const{return fNChannels;}
 
+  void CreateDeltaBCOffset();
+  void CreateCTPLatency();
+  void CreateT0Fill();
+  AliTOFDeltaBCOffset *GetDeltaBCOffset() const {return fDeltaBCOffset;};
+  AliTOFCTPLatency *GetCTPLatency() const {return fCTPLatency;};
+  AliTOFT0Fill *GetT0Fill() const {return fT0Fill;};
+
   // Methods to retrieve/write parameters from/on CDB
   // writing
 
@@ -87,6 +97,10 @@ public:
   void WriteParOnlineHWOnCDB(const Char_t *sel);      // old, before unification of status info
   void WriteParOfflineOnCDB(const Char_t *sel, const Char_t *validity);
 
+  void WriteDeltaBCOffsetOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun);
+  void WriteCTPLatencyOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun);
+  void WriteT0FillOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun);
+
   // reading
   Bool_t ReadSimHistoFromCDB(const Char_t *sel, Int_t nrun);
   Bool_t ReadConfigMapFromCDB(const Char_t *sel, Int_t nrun);
@@ -119,6 +133,10 @@ public:
   void SetLastRun(Int_t lastRun) {fLastRun=lastRun;}
   Int_t GetLastRun() const {return fLastRun;}
 
+  Bool_t ReadDeltaBCOffsetFromCDB(const Char_t *sel, Int_t nrun);
+  Bool_t ReadCTPLatencyFromCDB(const Char_t *sel, Int_t nrun);
+  Bool_t ReadT0FillFromCDB(const Char_t *sel, Int_t nrun);
+
 private:
   Int_t fNChannels; // number of TOF channels
 
@@ -142,7 +160,11 @@ private:
   Int_t fLastRun;            // last run for calib obj validity
   TMap* fConfigMap;          // map holding configuration obj
 
-  ClassDef(AliTOFcalib,7);
+  AliTOFDeltaBCOffset *fDeltaBCOffset; // deltaBC offset
+  AliTOFCTPLatency *fCTPLatency; // CTP latency
+  AliTOFT0Fill *fT0Fill; // T0 fill
+
+  ClassDef(AliTOFcalib,8);
 };
 
 #endif // AliTOFcalib_H
index e371a95e2efe0a492dd45762264d13d482f803cb..0a7bb1ccdb6db01ae02339bfc046bd9594d6a474 100644 (file)
@@ -48,7 +48,9 @@ AliTOFcluster::AliTOFcluster():
   fADC(0),
   fTdcND(0),
   fTdcRAW(0),
-  fStatus(kTRUE) 
+  fStatus(kTRUE),
+  fDeltaBC(0),
+  fL0L1Latency(0)
  {
   //
   // default ctor
@@ -76,7 +78,9 @@ AliTOFcluster::AliTOFcluster(UShort_t volId,
   fADC(par[2]),
   fTdcND(par[3]),
   fTdcRAW(par[4]),
-  fStatus(status) 
+  fStatus(status),
+  fDeltaBC(par[5]),
+  fL0L1Latency(par[6])
  {
   //
   // constructor
@@ -103,7 +107,9 @@ AliTOFcluster::AliTOFcluster(const AliTOFcluster & cluster):
   fADC(cluster.fADC),
   fTdcND(cluster.fTdcND),
   fTdcRAW(cluster.fTdcRAW),
-  fStatus(cluster.fStatus) 
+  fStatus(cluster.fStatus),
+  fDeltaBC(cluster.fDeltaBC),
+  fL0L1Latency(cluster.fL0L1Latency)
  {
   //
   // copy ctor for AliTOFcluster object
index 921063662214f0a4496c30fdf1a3e22f611884f4..9b5bbc49f8c9ebd721b95cc023cd2a127bd62a47 100644 (file)
@@ -42,6 +42,8 @@ class AliTOFcluster : public AliCluster3D {
   Int_t IsUsed()    const {return (fADC<0) ? 1 : 0;} // Flagging
   Int_t GetDetInd(Int_t n) const {return fdetIndex[n];} // Cluster Detector Indices getter
   Int_t GetIndex()  const {return fIdx;} // Digit Index getter
+  Int_t GetDeltaBC() const {return fDeltaBC;}; // deltaBC
+  Int_t GetL0L1Latency() const {return fL0L1Latency;}; // L0L1 latency
 
   void  Use(Int_t = 0) {fADC=-fADC;}        //  setter
   void  SetQuality(Double_t quality) {fQuality = quality;} // Cluster quality setter
@@ -50,6 +52,8 @@ class AliTOFcluster : public AliCluster3D {
   void  SetTDC(Int_t Tdc) {fTDC = Tdc;}       // Cluster ToF setter
   void  SetTDCND(Int_t Tdc) {fTdcND = Tdc;}   // Cluster ToFnd setter
   void  SetTDCRAW(Int_t Tdc) {fTdcRAW = Tdc;} // Cluster ToF-raw setter
+  void SetDeltaBC(Int_t value) {fDeltaBC = value;}; // deltaBC
+  void SetL0L1Latency(Int_t value) {fL0L1Latency = value;}; // L0-L1 latency
 
  private:
 
@@ -70,8 +74,10 @@ class AliTOFcluster : public AliCluster3D {
   Int_t  fTdcND;      // TDC count
   Int_t  fTdcRAW;     // RAW TDC count
   Bool_t fStatus;     // cluster online status 
+  Int_t fDeltaBC; // deltaBC
+  Int_t fL0L1Latency; // L0L1 latency
 
-  ClassDef(AliTOFcluster, 6) // TOF cluster
+  ClassDef(AliTOFcluster, 7) // TOF cluster
 };
 
 #endif
index c8480d099ecd02f7a7c3f6e49192c8bd3fb72585..0378f577b02845574ca831de891aea93cc9cdfcf 100644 (file)
@@ -51,7 +51,9 @@ AliTOFrawData::AliTOFrawData() :
   fTrailing(-1),
   fToT(-1),
   fTime(-1),
-  fError(-1)
+  fError(-1),
+  fDeltaBC(-1),
+  fL0L1Latency(-1)
 {
 
   // default ctr
@@ -72,7 +74,9 @@ AliTOFrawData::AliTOFrawData(Int_t a, Int_t b, Int_t c, Int_t d, Int_t e,
   fTrailing(-1),
   fToT(f),
   fTime(e),
-  fError(l)
+  fError(l),
+  fDeltaBC(0),
+  fL0L1Latency(0)
 {
 
 // ctr
@@ -81,7 +85,7 @@ AliTOFrawData::AliTOFrawData(Int_t a, Int_t b, Int_t c, Int_t d, Int_t e,
 
 //_____________________________________________________________________________
 AliTOFrawData::AliTOFrawData(Int_t a, Int_t b, Int_t c, Int_t d, Int_t e,
-                            Int_t f, Int_t ee, Int_t ff, Int_t g, Int_t h, Int_t l) :
+                            Int_t f, Int_t ee, Int_t ff, Int_t g, Int_t h, Int_t l, Int_t deltaBC, Int_t l0l1) :
   TObject(),
   fACQflag(h),
   fPSbit(g),
@@ -93,7 +97,9 @@ AliTOFrawData::AliTOFrawData(Int_t a, Int_t b, Int_t c, Int_t d, Int_t e,
   fTrailing(ff),
   fToT(f),
   fTime(e),
-  fError(l)
+  fError(l),
+  fDeltaBC(deltaBC),
+  fL0L1Latency(l0l1)
 {
 
   // ctr
@@ -113,7 +119,9 @@ AliTOFrawData::AliTOFrawData(const AliTOFrawData& r) :
   fTrailing(-1),
   fToT(-1),
   fTime(-1),
-  fError(-1)
+  fError(-1),
+  fDeltaBC(-1),
+  fL0L1Latency(-1)
 {
 
   // dummy copy constructor
@@ -129,6 +137,8 @@ AliTOFrawData::AliTOFrawData(const AliTOFrawData& r) :
   fToT        = r.fToT;
   fTime       = r.fTime;
   fError      = r.fError;
+  fDeltaBC      = r.fDeltaBC;
+  fL0L1Latency      = r.fL0L1Latency;
 
 }
 
@@ -149,6 +159,8 @@ AliTOFrawData& AliTOFrawData::operator=(const AliTOFrawData& r)
   this->fToT        = r.fToT;
   this->fTime       = r.fTime;
   this->fError      = r.fError;
+  this->fDeltaBC      = r.fDeltaBC;
+  this->fL0L1Latency      = r.fL0L1Latency;
   return *this;
 
 }
index 7f7db69aae687a2d6f5cf8240933e4f9e3c3839a..4ad50961ef661d893e16a38280be45e5ff0787b4 100644 (file)
@@ -18,7 +18,7 @@ class AliTOFrawData : public TObject {
  public:
   AliTOFrawData(); // default ctr
   AliTOFrawData(Int_t a, Int_t b, Int_t c, Int_t d, Int_t e, Int_t f, Int_t g, Int_t h, Int_t l); // ctr
-  AliTOFrawData(Int_t a, Int_t b, Int_t c, Int_t d, Int_t e, Int_t f, Int_t ee, Int_t ff, Int_t g, Int_t h, Int_t l); // ctr
+  AliTOFrawData(Int_t a, Int_t b, Int_t c, Int_t d, Int_t e, Int_t f, Int_t ee, Int_t ff, Int_t g, Int_t h, Int_t l, Int_t deltaBC = 0, Int_t l0l1 = 0); // ctr
   ~AliTOFrawData() {}; // default dtr
   AliTOFrawData(const AliTOFrawData& r);     // dummy copy constructor
   AliTOFrawData& operator=(const AliTOFrawData& r); // dummy assignment operator
@@ -33,6 +33,12 @@ class AliTOFrawData : public TObject {
   Int_t GetTOT() const;
   Int_t GetLeading() const {return fLeading;};
   Int_t GetTrailing() const {return fTrailing;};
+
+  Int_t GetDeltaBC() const {return fDeltaBC;};
+  Int_t GetL0L1Latency() const {return fL0L1Latency;};
+
+  void SetDeltaBC(Int_t value) {fDeltaBC = value;};
+  void SetL0L1Latency(Int_t value) {fL0L1Latency = value;};
   
  private:
   Int_t fACQflag;    // ACQ flag
@@ -47,10 +53,13 @@ class AliTOFrawData : public TObject {
   Int_t fTrailing; // Trailing Edge
   Int_t fToT;      // Time-Over-Threashould
   Int_t fTime;     // Time
-  
+
   Int_t fError;      // Error flag
   
-  ClassDef(AliTOFrawData, 1)  // class for TOF raw data
+  Int_t fDeltaBC; // delta BC
+  Int_t fL0L1Latency; // L0-L1 latency
+  
+  ClassDef(AliTOFrawData, 2)  // class for TOF raw data
 };
 
 #endif
diff --git a/TOF/MakeCDBEntryCTPLatency.C b/TOF/MakeCDBEntryCTPLatency.C
new file mode 100644 (file)
index 0000000..b33205a
--- /dev/null
@@ -0,0 +1,21 @@
+MakeCDBEntryCTPLatency(Float_t value = 0., Int_t startRun = 0, Int_t endRun = AliCDBRunRange::Infinity())
+{
+
+  /* create object */
+  AliTOFCTPLatency *obj = new AliTOFCTPLatency();
+  obj->SetCTPLatency(value);
+
+  /* create cdb info */
+  AliCDBId id("TOF/Calib/CTPLatency", startRun, endRun);
+  AliCDBMetaData *md = new AliCDBMetaData();
+  md->SetResponsible("Roberto Preghenella");
+  md->SetComment("CTPLatency (ps)");
+  md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
+  md->SetBeamPeriod(0);
+
+  /* put object in cdb */
+  AliCDBManager *cdb = AliCDBManager::Instance();
+  cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+  cdb->GetDefaultStorage()->Put(obj, id, md);
+
+}
diff --git a/TOF/MakeCDBEntryDeltaBCOffset.C b/TOF/MakeCDBEntryDeltaBCOffset.C
new file mode 100644 (file)
index 0000000..37469eb
--- /dev/null
@@ -0,0 +1,21 @@
+MakeCDBEntryDeltaBCOffset(Int_t value = 0, Int_t startRun = 0, Int_t endRun = AliCDBRunRange::Infinity())
+{
+
+  /* create object */
+  AliTOFDeltaBCOffset *obj = new AliTOFDeltaBCOffset();
+  obj->SetDeltaBCOffset(value);
+
+  /* create cdb info */
+  AliCDBId id("TOF/Calib/DeltaBCOffset", startRun, endRun);
+  AliCDBMetaData *md = new AliCDBMetaData();
+  md->SetResponsible("Roberto Preghenella");
+  md->SetComment("DeltaBCOffset (BC bins)");
+  md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
+  md->SetBeamPeriod(0);
+
+  /* put object in cdb */
+  AliCDBManager *cdb = AliCDBManager::Instance();
+  cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+  cdb->GetDefaultStorage()->Put(obj, id, md);
+
+}
diff --git a/TOF/MakeCDBEntryT0Fill.C b/TOF/MakeCDBEntryT0Fill.C
new file mode 100644 (file)
index 0000000..ded07dd
--- /dev/null
@@ -0,0 +1,21 @@
+MakeCDBEntryT0Fill(Float_t value = 0., Int_t startRun = 0, Int_t endRun = AliCDBRunRange::Infinity())
+{
+
+  /* create object */
+  AliTOFT0Fill *obj = new AliTOFT0Fill();
+  obj->SetT0Fill(value);
+
+  /* create cdb info */
+  AliCDBId id("TOF/Calib/T0Fill", startRun, endRun);
+  AliCDBMetaData *md = new AliCDBMetaData();
+  md->SetResponsible("Roberto Preghenella");
+  md->SetComment("T0Fill (ps)");
+  md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
+  md->SetBeamPeriod(0);
+
+  /* put object in cdb */
+  AliCDBManager *cdb = AliCDBManager::Instance();
+  cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+  cdb->GetDefaultStorage()->Put(obj, id, md);
+
+}
index ec9a4faa7df5a91e7532a67a6f55c70cddda3c80..0c55ba0739da2c49f991735bf1a27663a32afe8f 100644 (file)
@@ -35,6 +35,9 @@
 #pragma link C++ class  AliTOFcalibHisto+;
 #pragma link C++ class  AliTOFArray+;
 #pragma link C++ class  AliTOFDaConfigHandler+;
+#pragma link C++ class  AliTOFDeltaBCOffset+;
+#pragma link C++ class  AliTOFCTPLatency+;
+#pragma link C++ class  AliTOFT0Fill+;
 
 
 #endif
index 7cf63dfa444d75c07de3e76709d6791e4bd36eb1..7442382f1d659ab07867b35a86cab7d16c35287b 100644 (file)
@@ -28,6 +28,9 @@ SRCS  = AliTOFGeometry.cxx  \
        AliTOFcalibHisto.cxx \
        AliTOFArray.cxx \
        AliTOFDaConfigHandler.cxx \
+       AliTOFDeltaBCOffset.cxx \
+       AliTOFCTPLatency.cxx \
+       AliTOFT0Fill.cxx \
 
 
 HDRS:= $(SRCS:.cxx=.h)