From 965fa008a0c1db32f2940b8b5cd8fd71d688b2f1 Mon Sep 17 00:00:00 2001 From: rpreghen Date: Thu, 4 Jun 2009 12:50:13 +0000 Subject: [PATCH] TOF preprocessor behaviour modified when trying to compute online delays with not enough statistics. in this case now it stores the previous value, retrieved from last valid CDB file --- TOF/AliTOFPreprocessor.cxx | 46 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/TOF/AliTOFPreprocessor.cxx b/TOF/AliTOFPreprocessor.cxx index e8a6d3fd3ae..a846db62e84 100644 --- a/TOF/AliTOFPreprocessor.cxx +++ b/TOF/AliTOFPreprocessor.cxx @@ -200,6 +200,7 @@ UInt_t AliTOFPreprocessor::ProcessOnlineDelays() { // Processing data from DAQ for online calibration + Bool_t updateOCDB = kFALSE; Log("Processing DAQ delays"); // reading configuration map @@ -270,7 +271,25 @@ UInt_t AliTOFPreprocessor::ProcessOnlineDelays() Log(Form("ComputingDelays = %s, StartingRun = %i",compDelays.Data(),startingRun)); - fCal = new AliTOFChannelOnlineArray(fNChannels); + /* init array with current calibration, if any */ + fCal = new AliTOFChannelOnlineArray(fNChannels); + AliTOFChannelOnlineArray *curCal = NULL; + + AliCDBEntry *cdbEntry2 = GetFromOCDB("Calib","ParOnlineDelay"); + if (!cdbEntry2 || !cdbEntry2->GetObject()) { + /* no CDB entry found. set update flag */ + Log(" ************ WARNING ************"); + Log("No CDB ParOnlineDelay entry found, creating a new one!"); + Log(" *********************************"); + updateOCDB = kTRUE; + } + else { + Log("Found previous ParOnlineDelay entry. Using it to init calibration"); + curCal = (AliTOFChannelOnlineArray *)cdbEntry2->GetObject(); + for (Int_t i = 0; i < fNChannels; i++) + fCal->SetDelay(i, curCal->GetDelay(i)); + } + TH1::AddDirectory(0); @@ -381,10 +400,25 @@ UInt_t AliTOFPreprocessor::ProcessOnlineDelays() Log(" Not computing delays according to flag set in Config entry in OCDB!"); FillWithCosmicCalibration(fCal); - + + /* check whether the new calibration is different from the previous one */ + if (curCal) { /* well, check also whether we have a previous calibration */ + for (Int_t i = 0; i < fNChannels; i++) { + if (fCal->GetDelay(i) != curCal->GetDelay(i)) { + updateOCDB = kTRUE; + break; + } + } + } + else /* otherwise update OCDB */ + updateOCDB = kTRUE; + } else { // computing delays if not in FDR runs + + updateOCDB = kTRUE; /* always update OCDB when computing delays */ + for (Int_t ich=0;ich