Calib/RunParams.
the object allows to take into account and correct for the variation of
average T0 within a run.
update on TOF preprocessor code to handle calibration trigger data.
#include "AliTOFDeltaBCOffset.h"
#include "AliTOFCTPLatency.h"
-#include "AliTOFT0Fill.h"
+#include "AliTOFRunParams.h"
//extern TFile *gFile;
AliDebug(1,Form("Number of found clusters: %d", fNumberOfTofClusters));
- CalibrateRecPoint();
+ CalibrateRecPoint(rawReader->GetTimestamp());
FillRecPoint();
clustersTree->Fill();
AliDebug(1,Form("Number of found clusters: %d for event: %d", fNumberOfTofClusters, iEvent));
- CalibrateRecPoint();
+ CalibrateRecPoint(rawReader->GetTimestamp());
FillRecPoint();
fTreeR->Fill();
}
//_________________________________________________________________________
-void AliTOFClusterFinder::CalibrateRecPoint()
+void AliTOFClusterFinder::CalibrateRecPoint(UInt_t timestamp)
{
//
// Copy the global array of AliTOFcluster, i.e. fTofClusters (sorted
Int_t deltaBCOffset = deltaBCOffsetObj->GetDeltaBCOffset();
AliTOFCTPLatency *ctpLatencyObj = fTOFcalib->GetCTPLatency();
Float_t ctpLatency = ctpLatencyObj->GetCTPLatency();
- AliTOFT0Fill *t0FillObj = fTOFcalib->GetT0Fill();
- Float_t t0Fill = t0FillObj->GetT0Fill();
+ AliTOFRunParams *runParamsObj = fTOFcalib->GetRunParams();
+ Float_t t0 = runParamsObj->EvalT0(timestamp);
TString validity = (TString)fTOFcalib->GetOfflineValidity();
Int_t calibration = -1;
*
* the following corrections are performed in this way:
*
- * time = timeRaw - deltaBC + L0L1Latency + CTPLatency - TDCLatencyWindow - T0Fill
+ * time = timeRaw - deltaBC + L0L1Latency + CTPLatency - TDCLatencyWindow - T0
*
*/
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));
+ AliDebug(2, Form("applying further corrections (T0): T0=%f (ps)", t0));
- /* deltaBC correction */
- timeCorr -= (fTofClusters[ii]->GetDeltaBC() - deltaBCOffset) * AliTOFGeometry::BunchCrossingBinWidth();
+ /* deltaBC correction (inhibited for the time being) */
+ // 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;
+ /* T0 correction (from OCDB) */
+ timeCorr -= t0;
/*
* end of furhter corrections
//Int_t InsertCluster(Int_t *aa, Double_t *bb, Int_t *cc, Int_t d); // Fills TofClusters Array
Int_t InsertCluster(AliTOFcluster *tofCluster); // Fills TofClusters Array
Int_t FindClusterIndex(Double_t z) const; // Returns cluster index
- void CalibrateRecPoint(); // Apply calibration pars to Clusters
+ void CalibrateRecPoint(UInt_t timestamp = 0); // Apply calibration pars to Clusters
Int_t fVerbose; // Verbose level (0:no msg,
// 1:msg, 2:digits in txt files)
#include "TChain.h"
#include "AliTOFDeltaBCOffset.h"
#include "AliTOFCTPLatency.h"
-#include "AliTOFT0Fill.h"
+#include "AliTOFRunParams.h"
#include "AliTOFT0FillOnlineCalib.h"
#include "AliTOFHitField.h"
#include "AliTOFChannelOffline.h"
Float_t t0FillCalibCoefficient = t0FillOnlineCalibObject->GetCoefficient();
Log(Form("got \"T0FillOnlineCalib\" object: offset=%f coeff=%f", t0FillCalibOffset, t0FillCalibCoefficient));
- /* get online status from OCDB */
- cdbe = GetFromOCDB("Calib", "Status");
- if (!cdbe) {
- Log("cannot get \"Status\" entry from OCDB");
- return 21;
- }
- AliTOFChannelOnlineStatusArray *statusArray = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject();
- if (!statusArray) {
- Log("cannot get \"Status\" object from CDB entry");
+ /*
+ * at this stage status object is not on OCDB yet
+ * since it will be stored later. nevertheless we
+ * should have the array in memory since it has been
+ * already setup by ProcessFEF.
+ */
+
+ /* check status and latency window available */
+ if (!fStatus || !fLatencyWindow){
+ AliError("No valid fStatus or fLatencyWindow found, some errors must have occurred!!");
return 21;
}
- Log("got \"Status\" object");
/* get offline calibration from OCDB */
cdbe = GetFromOCDB("Calib", "ParOffline");
totbin = hit->GetTOTBin();
deltaBC = hit->GetDeltaBC();
l0l1latency = hit->GetL0L1Latency();
- latencyWindow = statusArray->GetLatencyWindow(index) * 1.e3;
+ latencyWindow = fLatencyWindow[index] * 1.e3;
/* convert time in ps and tot in ns */
timeps = timebin * AliTOFGeometry::TdcBinWidth();
for (Int_t ipar = 0; ipar < 6; ipar++) corrps += channelOffline->GetSlewPar(ipar) * TMath::Power(totns, ipar);
corrps *= 1.e3;
/* perform time correction */
- timeps = timeps + (deltaBC - deltaBCOffset) * AliTOFGeometry::BunchCrossingBinWidth() + l0l1latency * AliTOFGeometry::BunchCrossingBinWidth() + ctpLatency - latencyWindow - corrps;
+ // timeps = timeps + (deltaBC - deltaBCOffset) * AliTOFGeometry::BunchCrossingBinWidth() + l0l1latency * AliTOFGeometry::BunchCrossingBinWidth() + ctpLatency - latencyWindow - corrps; /* deltaBC correction removed for the time being */
+ timeps = timeps + l0l1latency * AliTOFGeometry::BunchCrossingBinWidth() + ctpLatency - latencyWindow - corrps;
/* compute length and expected time */
tofGeo.GetVolumeIndices(index, det);
tofGeo.GetPosPar(det, pos);
/* rough landau fit of the edge */
TF1 *landau = (TF1 *)gROOT->GetFunction("landau");
landau->SetParameter(1, maxBinCenter);
- Float_t fitMin = maxBinCenter - 1000.; /* fit from 10 ns before max */
+ Float_t fitMin = maxBinCenter - 1000.; /* fit from 1 ns before max */
Float_t fitMax = maxBinCenter + binWidth; /* fit until a bin width above max */
hT0Fill->Fit("landau", "q0", "", fitMin, fitMax);
/* get rough landau mean and sigma to set a better fit range */
/* apply calibration to get T0-fill from egde */
Float_t t0Fill = edge * t0FillCalibCoefficient + t0FillCalibOffset;
Log(Form("estimated T0-fill: %f ps", t0Fill));
+ /* check edge error */
+ if (edgee > 300.) {
+ Log("edge error is large: store default T0-fill value (0 ps)");
+ t0Fill = 0.;
+ }
- /* create T0-fill object */
- AliTOFT0Fill *t0FillObject = new AliTOFT0Fill();
- t0FillObject->SetT0Fill(t0Fill);
+ /* create RunParams object */
+ UInt_t timestamp[1] = {0};
+ Float_t t0[1] = {t0Fill};
+ Float_t tofReso[1] = {-1.};
+ Float_t t0Spread[1] = {-1.};
+ AliTOFRunParams *runParamsObject = new AliTOFRunParams(1);
+ runParamsObject->SetTimestamp(timestamp);
+ runParamsObject->SetT0(t0);
+ runParamsObject->SetTOFResolution(tofReso);
+ runParamsObject->SetT0Spread(t0Spread);
/* store reference data */
if(fStoreRefData){
Log("error while storing reference data");
delete hT0Fill;
delete hit;
- delete t0FillObject;
+ delete runParamsObject;
return 21;
}
Log("reference data successfully stored");
AliCDBMetaData metaData;
metaData.SetBeamPeriod(0);
metaData.SetResponsible("Roberto Preghenella");
- metaData.SetComment("online T0-fill measurement");
- if (!Store("Calib", "T0Fill", t0FillObject, &metaData, 0, kFALSE)) {
- Log("error while storing T0-fill object");
+ metaData.SetComment("online RunParams measurement");
+ if (!Store("Calib", "RunParams", runParamsObject, &metaData, 0, kFALSE)) {
+ Log("error while storing RunParams object");
delete hT0Fill;
delete hit;
- delete t0FillObject;
+ delete runParamsObject;
return 21;
}
- Log("T0-fill object successfully stored");
+ Log("RunParams object successfully stored");
delete hT0Fill;
delete hit;
- delete t0FillObject;
+ delete runParamsObject;
return 0;
}
+//_____________________________________________________________________________
+
+UInt_t
+AliTOFPreprocessor::ProcessNoiseCalibTrg()
+{
+ // Processing data from DAQ using calibration triggers for noise measurement
+
+ Log("Processing Noise (calibration trigger)");
+
+ /* check status and matching window available */
+ if (!fStatus || !fMatchingWindow){
+ AliError("No valid fStatus or fMatchingWindow found, some errors must have occurred!!");
+ return 22;
+ }
+
+ Float_t noiseThr = 1000.; // setting default threshold for noise to 1000 Hz
+ // reading config map
+ AliCDBEntry *cdbEntry = GetFromOCDB("Calib","ConfigNoise");
+ if (!cdbEntry) Log(Form("No Configuration entry found in CDB, using default values: NoiseThr = %d",noiseThr));
+ else {
+ TMap *configMap = (TMap*)cdbEntry->GetObject();
+ if (!configMap) Log(Form("No map found in Config entry in CDB, using default values: NoiseThr = %d", noiseThr));
+ else {
+ TObjString *strNoiseThr = (TObjString*)configMap->GetValue("NoiseThr");
+ if (strNoiseThr) {
+ TString tmpstr = strNoiseThr->GetString();
+ noiseThr = tmpstr.Atoi();
+ }
+ else Log(Form("No NoiseThr value found in Map from ConfigNoise entry in CDB, using default value: NoiseThr = %i",noiseThr));
+ }
+ }
+
+ /* get file sources from FXS */
+ TList *fileList = GetFileSources(kDAQ, "CALIB");
+ if (!fileList || fileList->GetEntries() == 0) {
+ Log("cannot get DAQ source file list or empty list");
+ return 22;
+ }
+ Log(Form("got DAQ source file list: %d files", fileList->GetEntries()));
+ fileList->Print();
+
+ /* open input file (only one expected) */
+ TObjString *str = (TObjString *)fileList->At(0);
+ TString filename = GetFile(kDAQ, "CALIB", str->GetName());
+ Log(Form("opening input file: source=%s, filename=%s", str->String().Data(), filename.Data()));
+ TFile *filein = TFile::Open(filename.Data());
+ if (!filein || !filein->IsOpen()) {
+ Log("cannot open input file");
+ return 22;
+ }
+
+ /* get histo from input file */
+ TH1F *hCalibHit = (TH1F *)filein->Get("hCalibHit");
+ if (!hCalibHit) {
+ Log("cannot get \"hCalibHit\" histo");
+ return 22;
+ }
+
+ /* create and set noise rate histo and check rate */
+ TH1F *hNoiseRate = new TH1F("hNoiseRate", ";index;rate (Hz)", fNChannels, 0., fNChannels);
+ Float_t rate, rate_err;
+ for (Int_t ich = 0; ich < fNChannels; ich++) {
+ /* check channel enabled */
+ if (fStatus->GetHWStatus(ich) == AliTOFChannelOnlineStatusArray::kTOFHWBad) continue;
+ /* set noise rate histo */
+ rate = hCalibHit->GetBinContent(ich + 1);
+ rate_err = hCalibHit->GetBinError(ich + 1);
+ rate /= fMatchingWindow[ich] * 1.e-9;
+ rate_err /= fMatchingWindow[ich] * 1.e-9;
+ hNoiseRate->SetBinContent(ich + 1, rate);
+ hNoiseRate->SetBinError(ich + 1, rate_err);
+ /* check noise rate and set noise flags */
+ if ((rate - 3. * rate_err) > noiseThr) {
+ Log(Form("channel %d detected as noisy: rate = (%f +- %f) Hz", ich, rate, rate_err));
+ if (fStatus->GetNoiseStatus(ich) == AliTOFChannelOnlineStatusArray::kTOFNoiseOk) {
+ Log(Form("channel %d noise status changed from Ok to Bad", ich));
+ fStatus->SetNoiseStatus(ich, AliTOFChannelOnlineStatusArray::kTOFNoiseBad);
+ fIsStatusMapChanged = kTRUE;
+ }
+ else Log(Form("channel %d noise status unchanged", ich));
+ }
+ else {
+ if (fStatus->GetNoiseStatus(ich) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad) {
+ Log(Form("channel %d noise status changed from Bad to Ok", ich));
+ fStatus->SetNoiseStatus(ich, AliTOFChannelOnlineStatusArray::kTOFNoiseOk);
+ fIsStatusMapChanged = kTRUE;
+ }
+ }
+ }
+
+ /* store reference data */
+ if(fStoreRefData){
+ AliCDBMetaData metaDataHisto;
+ metaDataHisto.SetBeamPeriod(0);
+ metaDataHisto.SetResponsible("Roberto Preghenella");
+ metaDataHisto.SetComment("calibration trigger noise rate histogram");
+ if (!StoreReferenceData("Calib","CalibNoise", hNoiseRate, &metaDataHisto)) {
+ Log("error while storing reference data");
+ delete hNoiseRate;
+ filein->Close();
+ return 22;
+ }
+ Log("reference data successfully stored");
+ }
+
+ delete hNoiseRate;
+ filein->Close();
+ return 0;
+}
//_____________________________________________________________________________
if (runType == "PHYSICS") {
// Int_t iresultDAQ = ProcessOnlineDelays();
Int_t iresultDAQ = ProcessT0Fill();
- if (iresultDAQ != 0) {
- return iresultDAQ;
- }
- else {
- Int_t iresultDCS = ProcessDCSDataPoints(dcsAliasMap);
- Int_t iResultHVandLVdps = ProcessHVandLVdps(dcsAliasMap);
- return iresultDCS+iResultHVandLVdps;
- }
+ Int_t iresultNoiseCalib = ProcessNoiseCalibTrg();
+ Int_t iresultDCS = ProcessDCSDataPoints(dcsAliasMap);
+ Int_t iResultHVandLVdps = ProcessHVandLVdps(dcsAliasMap);
+ return iresultDAQ+iresultNoiseCalib+iresultDCS+iResultHVandLVdps;
}
// storing
UInt_t ProcessNoiseData();
UInt_t ProcessFEEData(); // dummy, for the time being
UInt_t ProcessT0Fill();
+ UInt_t ProcessNoiseCalibTrg();
void FillWithCosmicCalibration(AliTOFChannelOnlineArray *cal); // fill with cosmic calibration
void FillWithCableLengthMap(AliTOFChannelOnlineArray *cal); // fill with cable-lenght map
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);}
+ if(!fTOFcalib->ReadRunParamsFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
}
//_____________________________________________________________________________
--- /dev/null
+/**************************************************************************
+ * 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 TOF object to be stored
+// * in OCDB on a run-by-run basis in order to have the measurement
+// * of the time evolution of T0 and of TOF resolution including
+// * average T0 uncertainty
+// *
+// *
+// *
+
+#include "AliTOFRunParams.h"
+
+ClassImp(AliTOFRunParams)
+
+//_________________________________________________________
+
+AliTOFRunParams::AliTOFRunParams() :
+ TObject(),
+ fNPoints(0),
+ fTimestamp(NULL),
+ fT0(NULL),
+ fTOFResolution(NULL),
+ fT0Spread(NULL)
+{
+ /*
+ * default constructor
+ */
+}
+
+//_________________________________________________________
+
+AliTOFRunParams::AliTOFRunParams(Int_t nPoints) :
+ TObject(),
+ fNPoints(nPoints),
+ fTimestamp(new UInt_t[nPoints]),
+ fT0(new Float_t[nPoints]),
+ fTOFResolution(new Float_t[nPoints]),
+ fT0Spread(new Float_t[nPoints])
+{
+ /*
+ * standard constructor
+ */
+}
+
+//_________________________________________________________
+
+AliTOFRunParams::~AliTOFRunParams()
+{
+ /*
+ * default destructor
+ */
+
+ if (fTimestamp) delete [] fTimestamp;
+ if (fT0) delete [] fT0;
+ if (fTOFResolution) delete [] fTOFResolution;
+ if (fT0Spread) delete [] fT0Spread;
+}
+
+//_________________________________________________________
+
+AliTOFRunParams::AliTOFRunParams(const AliTOFRunParams &source) :
+ TObject(source),
+ fNPoints(source.fNPoints),
+ fTimestamp(new UInt_t[source.fNPoints]),
+ fT0(new Float_t[source.fNPoints]),
+ fTOFResolution(new Float_t[source.fNPoints]),
+ fT0Spread(new Float_t[source.fNPoints])
+{
+ /*
+ * copy constructor
+ */
+
+ for (Int_t i = 0; i < fNPoints; i++) {
+ fTimestamp[i] = source.fTimestamp[i];
+ fT0[i] = source.fT0[i];
+ fTOFResolution[i] = source.fTOFResolution[i];
+ fT0Spread[i] = source.fT0Spread[i];
+ }
+
+}
+
+//_________________________________________________________
+
+AliTOFRunParams &
+AliTOFRunParams::operator=(const AliTOFRunParams &source)
+{
+ /*
+ * operator=
+ */
+
+ if (this == &source) return *this;
+ TObject::operator=(source);
+
+ if (fNPoints != source.fNPoints) {
+ if (fTimestamp) delete [] fTimestamp;
+ if (fT0) delete [] fT0;
+ if (fTOFResolution) delete [] fTOFResolution;
+ if (fT0Spread) delete [] fT0Spread;
+ fNPoints = source.fNPoints;
+ fTimestamp = new UInt_t[source.fNPoints];
+ fT0 = new Float_t[source.fNPoints];
+ fTOFResolution = new Float_t[source.fNPoints];
+ fT0Spread = new Float_t[source.fNPoints];
+ }
+
+ for (Int_t i = 0; i < fNPoints; i++) {
+ fTimestamp[i] = source.fTimestamp[i];
+ fT0[i] = source.fT0[i];
+ fTOFResolution[i] = source.fTOFResolution[i];
+ fT0Spread[i] = source.fT0Spread[i];
+ }
+
+ return *this;
+}
+
+//_________________________________________________________
+
+Float_t
+AliTOFRunParams::EvalT0(UInt_t timestamp)
+{
+ /*
+ * eval T0
+ */
+
+ /* critical cases:
+ 1. no measurement -> 0.
+ 2. single measurement -> single value
+ 3. timestamp before first measurement -> first value
+ 4. timestamp after last measurement -> last value
+ */
+ if (fNPoints <= 0 || !fT0 || !fTimestamp) return 0.;
+ if (fNPoints == 1) return fT0[0];
+ if (timestamp <= fTimestamp[0]) return fT0[0];
+ if (timestamp >= fTimestamp[fNPoints - 1]) return fT0[fNPoints - 1];
+
+ /* interpolate value */
+ Int_t ipoint;
+ for (ipoint = 0; ipoint < fNPoints - 1; ipoint++)
+ if (timestamp >= fTimestamp[ipoint] && timestamp < fTimestamp[ipoint + 1])
+ break;
+ Float_t coeff = (fT0[ipoint + 1] - fT0[ipoint]) / (Float_t)(fTimestamp[ipoint + 1] - fTimestamp[ipoint]);
+ Float_t t0 = fT0[ipoint] + coeff * (timestamp - fTimestamp[ipoint]);
+
+ return t0;
+}
+
+//_________________________________________________________
+
+Float_t
+AliTOFRunParams::EvalTOFResolution(UInt_t timestamp)
+{
+ /*
+ * eval TOF resolution
+ */
+
+ /* critical cases:
+ 1. no measurement -> 0.
+ 2. single measurement -> single value
+ 3. timestamp before first measurement -> first value
+ 4. timestamp after last measurement -> last value
+ */
+ if (fNPoints <= 0 || !fTOFResolution || !fTimestamp) return 0.;
+ if (fNPoints == 1) return fTOFResolution[0];
+ if (timestamp <= fTimestamp[0]) return fTOFResolution[0];
+ if (timestamp >= fTimestamp[fNPoints - 1]) return fTOFResolution[fNPoints - 1];
+
+ /* interpolate value */
+ Int_t ipoint;
+ for (ipoint = 0; ipoint < fNPoints - 1; ipoint++)
+ if (timestamp >= fTimestamp[ipoint] && timestamp < fTimestamp[ipoint + 1])
+ break;
+ Float_t coeff = (fTOFResolution[ipoint + 1] - fTOFResolution[ipoint]) / (Float_t)(fTimestamp[ipoint + 1] - fTimestamp[ipoint]);
+ Float_t reso = fTOFResolution[ipoint] + coeff * (timestamp - fTimestamp[ipoint]);
+
+ return reso;
+}
+
+//_________________________________________________________
+
+Float_t
+AliTOFRunParams::EvalT0Spread(UInt_t timestamp)
+{
+ /*
+ * eval T0 spread
+ */
+
+ /* critical cases:
+ 1. no measurement -> 0.
+ 2. single measurement -> single value
+ 3. timestamp before first measurement -> first value
+ 4. timestamp after last measurement -> last value
+ */
+ if (fNPoints <= 0 || !fT0Spread || !fTimestamp) return 0.;
+ if (fNPoints == 1) return fT0Spread[0];
+ if (timestamp <= fTimestamp[0]) return fT0Spread[0];
+ if (timestamp >= fTimestamp[fNPoints - 1]) return fT0Spread[fNPoints - 1];
+
+ /* interpolate value */
+ Int_t ipoint;
+ for (ipoint = 0; ipoint < fNPoints - 1; ipoint++)
+ if (timestamp >= fTimestamp[ipoint] && timestamp < fTimestamp[ipoint + 1])
+ break;
+ Float_t coeff = (fT0Spread[ipoint + 1] - fT0Spread[ipoint]) / (Float_t)(fTimestamp[ipoint + 1] - fTimestamp[ipoint]);
+ Float_t spread = fT0Spread[ipoint] + coeff * (timestamp - fTimestamp[ipoint]);
+
+ return spread;
+}
+
--- /dev/null
+#ifndef ALITOFRUNPARAMS_H
+#define ALITOFRUNPARAMS_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+/* $Id$ */
+
+// *
+// *
+// *
+// * this class defines the TOF object to be stored
+// * in OCDB on a run-by-run basis in order to have the measurement
+// * of the time evolution of T0 and of TOF resolution including
+// * average T0 uncertainty
+// *
+// *
+// *
+
+#include "TObject.h"
+
+class AliTOFRunParams :
+public TObject
+{
+
+ public:
+
+ AliTOFRunParams(); // default constructor
+ AliTOFRunParams(Int_t nPoints); // standard constructor
+ virtual ~AliTOFRunParams(); // default destructor
+ AliTOFRunParams(const AliTOFRunParams &source); // copy constructor
+ AliTOFRunParams &operator=(const AliTOFRunParams &source); // operator=
+
+ Int_t GetNPoints() const {return fNPoints;}; // getter
+ UInt_t GetTimestamp(Int_t i) const {return fTimestamp && i < fNPoints ? fTimestamp[i] : 0.;}; // getter
+ Float_t GetT0(Int_t i) const {return fT0 && i < fNPoints ? fT0[i] : 0.;}; // getter
+ Float_t GetTOFResolution(Int_t i) const {return fTOFResolution && i < fNPoints ? fTOFResolution[i] : 0.;}; // getter
+ Float_t GetT0Spread(Int_t i) const {return fT0Spread && i < fNPoints ? fT0Spread[i] : 0.;}; // getter
+
+ void SetTimestamp(UInt_t *value) {if (fTimestamp) for (Int_t i = 0; i < fNPoints; i++) fTimestamp[i] = value[i];}; // setter
+ void SetT0(Float_t *value) {if (fT0) for (Int_t i = 0; i < fNPoints; i++) fT0[i] = value[i];}; // setter
+ void SetTOFResolution(Float_t *value) {if (fTOFResolution) for (Int_t i = 0; i < fNPoints; i++) fTOFResolution[i] = value[i];}; // setter
+ void SetT0Spread(Float_t *value) {if (fT0Spread) for (Int_t i = 0; i < fNPoints; i++) fT0Spread[i] = value[i];}; // 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
+
+ private:
+
+ Int_t fNPoints;
+ UInt_t *fTimestamp; //[fNPoints] time stamp
+ Float_t *fT0; //[fNPoints] average T0 (ps)
+ Float_t *fTOFResolution; //[fNPoints] average TOF resolution (T0 uncertainty included) (ps)
+ Float_t *fT0Spread; //[fNPoints] estimated T0 spread (from vertex spread z) (ps)
+
+ ClassDef(AliTOFRunParams, 1);
+};
+
+#endif /* ALITOFRUNPARAMS_H */
#include "AliTOFDeltaBCOffset.h"
#include "AliTOFCTPLatency.h"
#include "AliTOFT0Fill.h"
-
+#include "AliTOFRunParams.h"
class TROOT;
class TStyle;
fConfigMap(new TMap),
fDeltaBCOffset(NULL),
fCTPLatency(NULL),
- fT0Fill(NULL)
+ fT0Fill(NULL),
+ fRunParams(NULL)
{
//TOF Calibration Class ctor
fNChannels = AliTOFGeometry::NSectors()*(2*(AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB())+AliTOFGeometry::NStripA())*AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX();
fConfigMap(calib.fConfigMap),
fDeltaBCOffset(NULL),
fCTPLatency(NULL),
- fT0Fill(NULL)
+ fT0Fill(NULL),
+ fRunParams(NULL)
{
//TOF Calibration Class copy ctor
for (Int_t iarray = 0; iarray<fNChannels; 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);
+ if (calib.fRunParams) fRunParams = new AliTOFRunParams(*calib.fRunParams);
}
//____________________________________________________________________________
if (fT0Fill) *fT0Fill = *calib.fT0Fill;
else fT0Fill = new AliTOFT0Fill(*calib.fT0Fill);
}
+ if (calib.fRunParams) {
+ if (fRunParams) *fRunParams = *calib.fRunParams;
+ else fRunParams = new AliTOFRunParams(*calib.fRunParams);
+ }
return *this;
}
if (fDeltaBCOffset) delete fDeltaBCOffset;
if (fCTPLatency) delete fCTPLatency;
if (fT0Fill) delete fT0Fill;
+ if (fRunParams) delete fRunParams;
}
if (fTree!=0x0) delete fTree;
if (fChain!=0x0) delete fChain;
//----------------------------------------------------------------------------
+void
+AliTOFcalib::CreateRunParams()
+{
+ /*
+ * create run params
+ */
+
+ if (fRunParams) {
+ AliWarning("RunParams object already defined, cannot create a new one");
+ return;
+ }
+ fRunParams = new AliTOFRunParams();
+}
+
+//----------------------------------------------------------------------------
+
void
AliTOFcalib::WriteDeltaBCOffsetOnCDB(const Char_t *sel , Int_t minrun, Int_t maxrun)
{
//----------------------------------------------------------------------------
+void
+AliTOFcalib::WriteRunParamsOnCDB(const Char_t *sel , Int_t minrun, Int_t maxrun)
+{
+ /*
+ * write run params on CDB
+ */
+
+ if (!fRunParams) return;
+ AliCDBId id(Form("%s/RunParams", sel), minrun, maxrun);
+ AliCDBMetaData *md = new AliCDBMetaData();
+ md->SetResponsible("Roberto Preghenella");
+ AliCDBManager *man = AliCDBManager::Instance();
+ man->Put(fRunParams, id, md);
+ AliDebug(2,Form("RunParams written on CDB with run range [%i, %i] ",minrun ,maxrun));
+ delete md;
+}
+
+//----------------------------------------------------------------------------
+
Bool_t
AliTOFcalib::ReadDeltaBCOffsetFromCDB(const Char_t *sel , Int_t nrun)
{
return kTRUE;
}
+//----------------------------------------------------------------------------
+
+Bool_t
+AliTOFcalib::ReadRunParamsFromCDB(const Char_t *sel , Int_t nrun)
+{
+ /*
+ * read run params from CDB
+ */
+
+ AliCDBManager *man = AliCDBManager::Instance();
+ AliCDBEntry *entry = man->Get(Form("%s/RunParams", sel),nrun);
+ if (!entry) {
+ AliFatal("No RunParams entry found in CDB");
+ exit(0);
+ }
+ fRunParams =(AliTOFRunParams *)entry->GetObject();
+ if(!fRunParams){
+ AliFatal("No RunParams object found in CDB entry");
+ exit(0);
+ }
+ return kTRUE;
+}
+
class AliTOFDeltaBCOffset;
class AliTOFCTPLatency;
class AliTOFT0Fill;
+class AliTOFRunParams;
class AliTOFcalib:public TTask{
public:
void CreateDeltaBCOffset();
void CreateCTPLatency();
void CreateT0Fill();
+ void CreateRunParams();
AliTOFDeltaBCOffset *GetDeltaBCOffset() const {return fDeltaBCOffset;};
AliTOFCTPLatency *GetCTPLatency() const {return fCTPLatency;};
AliTOFT0Fill *GetT0Fill() const {return fT0Fill;};
+ AliTOFRunParams *GetRunParams() const {return fRunParams;};
// Methods to retrieve/write parameters from/on CDB
// writing
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);
+ void WriteRunParamsOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun);
// reading
Bool_t ReadSimHistoFromCDB(const Char_t *sel, Int_t nrun);
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);
+ Bool_t ReadRunParamsFromCDB(const Char_t *sel, Int_t nrun);
private:
Int_t fNChannels; // number of TOF channels
AliTOFDeltaBCOffset *fDeltaBCOffset; // deltaBC offset
AliTOFCTPLatency *fCTPLatency; // CTP latency
AliTOFT0Fill *fT0Fill; // T0 fill
+ AliTOFRunParams *fRunParams; // run params
- ClassDef(AliTOFcalib,8);
+ ClassDef(AliTOFcalib,9);
};
#endif // AliTOFcalib_H
--- /dev/null
+MakeCDBEntryRunParams(Int_t startRun = 0, Int_t endRun = AliCDBRunRange::Infinity())
+{
+
+ const Int_t nPoints = 1;
+ UInt_t timestamp[nPoints] = {0.};
+ Float_t t0[nPoints] = {0.};
+ Float_t tofReso[nPoints] = {80.};
+ Float_t t0Spread[nPoints] = {0.};
+
+ /* create object */
+ AliTOFRunParams *obj = new AliTOFRunParams(1);
+ obj->SetTimestamp(timestamp);
+ obj->SetT0(t0);
+ obj->SetTOFResolution(tofReso);
+ obj->SetT0Spread(t0Spread);
+
+ /* create cdb info */
+ AliCDBId id("TOF/Calib/RunParams", startRun, endRun);
+ AliCDBMetaData *md = new AliCDBMetaData();
+ md->SetResponsible("Roberto Preghenella");
+ md->SetComment("RunParams");
+ 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);
+
+}
// processing files. for the time being, the files are local.
shuttle->AddInputFile(AliTestShuttle::kDAQ, "TOF", "HITS", "MON", "$ALICE_ROOT/TOF/ShuttleInput/Hits.root");
+ shuttle->AddInputFile(AliTestShuttle::kDAQ, "TOF", "CALIB", "MON", "$ALICE_ROOT/TOF/ShuttleInput/Calib.root");
shuttle->AddInputFile(AliTestShuttle::kDAQ, "TOF", "DELAYS", "MON", "$ALICE_ROOT/TOF/ShuttleInput/Total.root");
shuttle->AddInputFile(AliTestShuttle::kDAQ, "TOF", "RUNLevel", "MON", "$ALICE_ROOT/TOF/ShuttleInput/Partial.root");
shuttle->AddInputFile(AliTestShuttle::kDCS, "TOF", "TofFeeLightMap", "", "$ALICE_ROOT/TOF/ShuttleInput/TOFFEElight.20090616.102605.8000");
#pragma link C++ class AliTOFDeltaBCOffset+;
#pragma link C++ class AliTOFCTPLatency+;
#pragma link C++ class AliTOFT0Fill+;
+#pragma link C++ class AliTOFRunParams+;
#pragma link C++ class AliTOFT0FillOnlineCalib+;
#pragma link C++ class AliTOFDCSmaps+;
#pragma link C++ class AliTOFLvHvDataPoints+;
AliTOFDeltaBCOffset.cxx \
AliTOFCTPLatency.cxx \
AliTOFT0Fill.cxx \
+ AliTOFRunParams.cxx \
AliTOFT0FillOnlineCalib.cxx \
AliTOFLvHvDataPoints.cxx \
AliTOFDCSmaps.cxx