task->SetVertexCut(25.0);
/* setup TOF calib */
task->GetTOFcalib()->SetRemoveMeanT0(kFALSE);
+ task->GetTOFcalib()->SetUseLHCClockPhase(kTRUE);
task->GetTOFcalib()->SetCalibrateTOFsignal(kTRUE);
task->GetTOFcalib()->SetCorrectTExp(kFALSE);
/* setup track cuts */
fInitFlag = kTRUE;
fRunNumber = runNb;
+ Int_t useBPTX = fTOFcalib->GetUseLHCClockPhase() ? 1 : 0;
+
/* set histo title with run-number and start-time */
- fHistoVertexTimestamp->SetTitle(Form("run: %d, startTimestamp: %u", fRunNumber, fStartTime));
- fHistoDeltatTimestamp->SetTitle(Form("run: %d, startTimestamp: %u", fRunNumber, fStartTime));
- fHistoDeltazEta->SetTitle(Form("run: %d, startTimestamp: %u", fRunNumber, fStartTime));
- fHistoDeltazCosTheta->SetTitle(Form("run: %d, startTimestamp: %u", fRunNumber, fStartTime));
- fHistoAcceptedTracksEtaPt->SetTitle(Form("run: %d, startTimestamp: %u", fRunNumber, fStartTime));
- fHistoMatchedTracksEtaPt->SetTitle(Form("run: %d, startTimestamp: %u", fRunNumber, fStartTime));
+ fHistoVertexTimestamp->SetTitle(Form("run: %d, startTimestamp: %u, BPTX: %d", fRunNumber, fStartTime, useBPTX));
+ fHistoDeltatTimestamp->SetTitle(Form("run: %d, startTimestamp: %u, BPTX: %d", fRunNumber, fStartTime, useBPTX));
+ fHistoDeltazEta->SetTitle(Form("run: %d, startTimestamp: %u, BPTX: %d", fRunNumber, fStartTime, useBPTX));
+ fHistoDeltazCosTheta->SetTitle(Form("run: %d, startTimestamp: %u, BPTX: %d", fRunNumber, fStartTime, useBPTX));
+ fHistoAcceptedTracksEtaPt->SetTitle(Form("run: %d, startTimestamp: %u, BPTX: %d", fRunNumber, fStartTime, useBPTX));
+ fHistoMatchedTracksEtaPt->SetTitle(Form("run: %d, startTimestamp: %u, BPTX: %d", fRunNumber, fStartTime, useBPTX));
return kTRUE;
}
TTimeStamp ts = startTimestamp;
AliInfo(Form("got start timestamp: %d (%s)", startTimestamp, ts.AsString()));
+ /* BPTX */
+ ostr = (TObjString *)strarr->At(2);
+ if (!ostr) {
+ AliError("problems while getting BPTX from histogram title");
+ fStatus = kDataError;
+ return kFALSE;
+ }
+ str = ostr->GetString();
+ str.Remove(0, 1); /* remove empty space at the beginning */
+ if (!str.BeginsWith("BPTX:")) {
+ AliError("problems while getting BPTX from histogram title");
+ fStatus = kDataError;
+ return kFALSE;
+ }
+ str.Remove(0, 6);
+ Bool_t useBPTX = atoi(str.Data());
+ AliInfo(Form("got BPTX: %d", useBPTX));
+
/*** CALIBRATION STAGE ***/
/* get fit function */
obj.SetRunNb(run);
obj.SetRunFirstPoint(runFirstPoint);
obj.SetRunLastPoint(runLastPoint);
+ obj.SetUseLHCClockPhase(useBPTX);
/*** CREATE OCDB ENTRY ***/
/* get params from OCDB */
AliCDBEntry *cdbe = NULL;
+ /*
+ * check UseLHCClockPhase flag in RunParams.
+ * if set do nothing and return successfully
+ */
+ cdbe = GetFromOCDB("Calib", "RunParams");
+ if (!cdbe) {
+ Log("cannot get \"RunParams\" entry from OCDB");
+ return 21;
+ }
+ AliTOFRunParams *runparams = (AliTOFRunParams *)cdbe->GetObject();
+ if (runparams->GetUseLHCClockPhase()) {
+ Log("UseLHCClockPhase flag is set in RunParams: online T0-fill not computed");
+ return 0;
+ }
+
/*
* at this stage status object is not on OCDB yet
* since it will be stored later. nevertheless we
runParamsObject->SetT0(t0);
runParamsObject->SetTOFResolution(tofReso);
runParamsObject->SetT0Spread(t0Spread);
+ runParamsObject->SetUseLHCClockPhase(kFALSE);
/* store reference data */
if(fStoreRefData){
fNRuns(0),
fRunNb(NULL),
fRunFirstPoint(NULL),
- fRunLastPoint(NULL)
+ fRunLastPoint(NULL),
+ fUseLHCClockPhase(kFALSE)
{
/*
* default constructor
fNRuns(nRuns),
fRunNb(new UInt_t[nRuns]),
fRunFirstPoint(new UInt_t[nRuns]),
- fRunLastPoint(new UInt_t[nRuns])
+ fRunLastPoint(new UInt_t[nRuns]),
+ fUseLHCClockPhase(kFALSE)
{
/*
* standard constructor
fNRuns(source.fNRuns),
fRunNb(new UInt_t[source.fNRuns]),
fRunFirstPoint(new UInt_t[source.fNRuns]),
- fRunLastPoint(new UInt_t[source.fNRuns])
+ fRunLastPoint(new UInt_t[source.fNRuns]),
+ fUseLHCClockPhase(source.fUseLHCClockPhase)
{
/*
* copy constructor
fRunLastPoint[i] = source.fRunLastPoint[i];
}
+ fUseLHCClockPhase = source.fUseLHCClockPhase;
+
return *this;
}
void SetRunFirstPoint(UInt_t *value) {if (fRunFirstPoint) for (Int_t i = 0; i < fNRuns; i++) fRunFirstPoint[i] = value[i];}; // setter
void SetRunLastPoint(UInt_t *value) {if (fRunLastPoint) for (Int_t i = 0; i < fNRuns; i++) fRunLastPoint[i] = value[i];}; // setter
+ void SetUseLHCClockPhase(Bool_t value) {fUseLHCClockPhase = value;}; // setter
+
Float_t EvalT0(UInt_t timestamp); // eval T0
Float_t EvalTOFResolution(UInt_t timestamp); // eval TOF resolution
Float_t EvalT0Spread(UInt_t timestamp); // eval T0 spread
Float_t AverageTOFResolution(UInt_t runNb) {return Average(fTOFResolution, runNb);}; // average TOF resolution
Float_t AverageT0Spread(UInt_t runNb) {return Average(fT0Spread, runNb);}; // average T0 spread
+ Bool_t GetUseLHCClockPhase() const {return fUseLHCClockPhase;}; // getter
+
TGraph *DrawGraphT0(Option_t *option = "") {return DrawGraph(fT0, option);}; // draw graph t0
TGraph *DrawGraphTOFResolution(Option_t *option = "") {return DrawGraph(fTOFResolution, option);}; // draw graph t0
TGraph *DrawGraphT0Spread(Option_t *option = "") {return DrawGraph(fT0Spread, option);}; // draw graph t0
UInt_t *fRunFirstPoint; //[fNRuns] run start point
UInt_t *fRunLastPoint; //[fNRuns] run last point
+ Bool_t fUseLHCClockPhase; // use LHC clockphase
+
- ClassDef(AliTOFRunParams, 2);
+ ClassDef(AliTOFRunParams, 3);
};
#endif /* ALITOFRUNPARAMS_H */
#include "AliTOFCTPLatency.h"
#include "AliTOFT0Fill.h"
#include "AliTOFRunParams.h"
+#include "AliLHCClockPhase.h"
#include "AliTOFResponseParams.h"
#include "AliESDEvent.h"
#include "AliESDtrack.h"
fCTPLatency(NULL),
fT0Fill(NULL),
fRunParams(NULL),
+ fLHCClockPhase(NULL),
fResponseParams(NULL),
fReadoutEfficiency(NULL),
fProblematic(NULL),
fInitFlag(kFALSE),
fRemoveMeanT0(kTRUE),
+ fUseLHCClockPhase(kFALSE),
fCalibrateTOFsignal(kTRUE),
fCorrectTExp(kFALSE)
{
fCTPLatency(NULL),
fT0Fill(NULL),
fRunParams(NULL),
+ fLHCClockPhase(NULL),
fResponseParams(NULL),
fReadoutEfficiency(NULL),
fProblematic(NULL),
fInitFlag(calib.fInitFlag),
fRemoveMeanT0(calib.fRemoveMeanT0),
+ fUseLHCClockPhase(calib.fUseLHCClockPhase),
fCalibrateTOFsignal(calib.fCalibrateTOFsignal),
fCorrectTExp(calib.fCorrectTExp)
{
}
fInitFlag = calib.fInitFlag;
fRemoveMeanT0 = calib.fRemoveMeanT0;
+ fUseLHCClockPhase = calib.fUseLHCClockPhase;
fCalibrateTOFsignal = calib.fCalibrateTOFsignal;
fCorrectTExp = calib.fCorrectTExp;
//----------------------------------------------------------------------------
+Bool_t
+AliTOFcalib::ReadLHCClockPhaseFromCDB(const Char_t *sel , Int_t nrun)
+{
+ /*
+ * read LHC clock-phase from CDB
+ */
+
+ AliCDBManager *man = AliCDBManager::Instance();
+ AliCDBEntry *entry = man->Get(Form("%s/LHCClockPhase", sel),nrun);
+ if (!entry) {
+ AliFatal("No LHCClockPhase entry found in CDB");
+ exit(0);
+ }
+ fLHCClockPhase =(AliLHCClockPhase *)entry->GetObject();
+ if(!fRunParams){
+ AliFatal("No LHCClockPhase object found in CDB entry");
+ exit(0);
+ }
+ return kTRUE;
+}
+
+//----------------------------------------------------------------------------
+
Bool_t
AliTOFcalib::ReadReadoutEfficiencyFromCDB(const Char_t *sel , Int_t nrun)
{
AliError("cannot get \"RunParams\" object from OCDB");
return kFALSE;
}
+ /* get LHC clock-phase obj */
+ if (!ReadLHCClockPhaseFromCDB("GRP/Calib", run)) {
+ AliError("cannot get \"LHCClockPhase\" object from OCDB");
+ return kFALSE;
+ }
/* get readout efficiency obj */
if (!ReadReadoutEfficiencyFromCDB("TOF/Calib", run)) {
AliError("cannot get \"ReadoutEfficiency\" object from OCDB");
}
responseFile->Close();
+ /* check whether to use the clock phase */
+ if (fRunParams->GetUseLHCClockPhase())
+ fUseLHCClockPhase = kTRUE;
+
+ if (fUseLHCClockPhase)
+ AliInfo("calibration using BPTX LHC clock-phase");
+
/* all done */
fInitFlag = kTRUE;
return kTRUE;
Float_t ctpLatency = fCTPLatency->GetCTPLatency();
Float_t tdcLatencyWindow = fStatus->GetLatencyWindow(index) * 1.e3;
Float_t timezero = fRunParams->EvalT0(timestamp);
+ Float_t clockphase = fLHCClockPhase->GetPhase(timestamp);
/* check whether to remove mean T0.
* useful when one wants to compute mean T0 */
if (!fRemoveMeanT0) timezero = 0.;
+ /* check whether to use the clock phase */
+ if (fUseLHCClockPhase) timezero -= 1.e3 * clockphase;
/* compute correction */
Double_t corr = 0.;
class AliTOFRunParams;
class AliTOFResponseParams;
class AliESDEvent;
+class AliLHCClockPhase;
class AliTOFcalib:public TTask{
public:
Bool_t ReadCTPLatencyFromCDB(const Char_t *sel, Int_t nrun);
Bool_t ReadT0FillFromCDB(const Char_t *sel, Int_t nrun);
Bool_t ReadRunParamsFromCDB(const Char_t *sel, Int_t nrun);
+ Bool_t ReadLHCClockPhaseFromCDB(const Char_t *sel, Int_t nrun);
Bool_t ReadReadoutEfficiencyFromCDB(const Char_t *sel, Int_t nrun);
Bool_t ReadProblematicFromCDB(const Char_t *sel, Int_t nrun);
void CalibrateESD(AliESDEvent *event); // calibrate ESD
void CalibrateTExp(AliESDEvent *event) const; // calibrate TExp
void SetRemoveMeanT0(Bool_t value) {fRemoveMeanT0 = value;}; // setter
+ void SetUseLHCClockPhase(Bool_t value) {fUseLHCClockPhase = value;}; // setter
+ Bool_t GetUseLHCClockPhase() const {return fUseLHCClockPhase;}; // getter
void SetCalibrateTOFsignal(Bool_t value) {fCalibrateTOFsignal = value;}; // setter
void SetCorrectTExp(Bool_t value) {fCorrectTExp = value;}; // setter
Bool_t IsChannelEnabled(Int_t index, Bool_t checkEfficiency = kTRUE, Bool_t checkProblematic = kTRUE); // is channel enabled
AliTOFCTPLatency *fCTPLatency; // CTP latency
AliTOFT0Fill *fT0Fill; // T0 fill
AliTOFRunParams *fRunParams; // run params
+ AliLHCClockPhase *fLHCClockPhase; // LHC clock-phase
AliTOFResponseParams *fResponseParams; // run params
TH1F *fReadoutEfficiency; // readout efficiency
TH1C *fProblematic; // problematic
Bool_t fInitFlag; // init flag
Bool_t fRemoveMeanT0; // remove mean T0
+ Bool_t fUseLHCClockPhase; // use LHC clock-phase
Bool_t fCalibrateTOFsignal; // calibrate TOF signal
Bool_t fCorrectTExp; // correct expected time
obj->SetT0(t0);
obj->SetTOFResolution(tofReso);
obj->SetT0Spread(t0Spread);
+ obj->SetUseLHCClockPhase(kTRUE);
/* create cdb info */
AliCDBId id("TOF/Calib/RunParams", startRun, endRun);