**************************************************************************/
/*
-$Log$
+$Log: AliTOFChannelOnline.cxx,v $
+Revision 1.2 2007/11/24 14:52:33 zampolli
+Status flag implemented as UChar_t
+
Revision 1.1 2006/10/26 09:13:24 arcelli
TOF Online Calibration channel (C.Zampolli)
//________________________________________________________________
AliTOFChannelOnline::AliTOFChannelOnline():
-fStatus(kTOFOnlineUnknown),
+ //fStatus(kFALSE),
fDelay(0)
{
//default constructor
}
//________________________________________________________________
-AliTOFChannelOnline::AliTOFChannelOnline(UChar_t status, Float_t delay):
-fStatus(status),
+//AliTOFChannelOnline::AliTOFChannelOnline(Bool_t status, Float_t delay):
+AliTOFChannelOnline::AliTOFChannelOnline(Float_t delay):
+ //fStatus(status),
fDelay(delay)
{
// constructor with status and delay
//________________________________________________________________
AliTOFChannelOnline::AliTOFChannelOnline(const AliTOFChannelOnline& channel) :
TObject(channel),
- fStatus(kTOFOnlineUnknown),
+ // fStatus(kFALSE),
fDelay(0)
{
// copy constructor
AliTOFChannelOnline &AliTOFChannelOnline::operator =(const AliTOFChannelOnline& channel)
{
// assignment operator
- fStatus= channel.GetStatus();
+// fStatus= channel.GetStatus();
fDelay=channel.GetDelay();
return *this;
}
public:
AliTOFChannelOnline();
- AliTOFChannelOnline(UChar_t status, Float_t delay);
+ //AliTOFChannelOnline(Bool_t status, Float_t delay);
+ AliTOFChannelOnline(Float_t delay);
AliTOFChannelOnline(const AliTOFChannelOnline &chan);
AliTOFChannelOnline& operator= (const AliTOFChannelOnline &chan);
virtual ~AliTOFChannelOnline(){};
- UChar_t GetStatus() const {return fStatus;}
+ //UChar_t GetStatus() const {return fStatus;}
Float_t GetDelay() const {return fDelay;}
- void SetStatus(UChar_t status) {fStatus=status;}
+ //void SetStatus(Bool_t status) {fStatus=status;}
void SetDelay(Float_t val) {fDelay=val;}
- enum{
- kTOFOnlineUnknown=0x0, kTOFOnlineOk=0x2a, kTOFOnlineBad=0x15,
- kTOFHWOk=0x1, kTOFHWBad=0x2, kTOFHVUnknown=0x0,
- kTOFPulserOk=0x4, kTOFPulserBad=0x8, kTOFPulserUnknown=0x0,
- kTOFNoiseOk=0x10, kTOFNoiseBad=0x20, kTOFNoiseUnknown=0x0
- };
-
- enum{
- kRightShiftHW=0,kRightShiftPulser=2,kRightShiftNoise=4
- };
-
private:
- UChar_t fStatus; // Status of the channel (0:on 1:off)
+ //Bool_t fStatus; // Not Calibrated (kFALSE) / Calibrated (kTRUE) channel
Float_t fDelay; // Delay
//
- ClassDef(AliTOFChannelOnline,2) // TOF Sensor Online Calibration object
+ ClassDef(AliTOFChannelOnline,3) // TOF Sensor Online Calibration object
};
#endif
**************************************************************************/
/*
-$Log$
+$Log: AliTOFClusterFinder.cxx,v $
+Revision 1.31 2007/11/24 14:53:19 zampolli
+Status flag implemented as UChar_t
+
Revision 1.30 2007/10/04 13:08:52 arcelli
updates to comply with AliTOFGeometryV5 becoming AliTOFGeometry
#include "AliTOFcalib.h"
#include "AliTOFChannelOnline.h"
+#include "AliTOFChannelOnlineStatus.h"
#include "AliTOFChannelOffline.h"
#include "AliTOFClusterFinder.h"
#include "AliTOFcluster.h"
AliInfo(" Calibrating TOF Clusters: ")
TObjArray *calTOFArrayOnline = fTOFcalib->GetTOFCalArrayOnline();
+ TObjArray *calTOFArrayOnlinePulser = fTOFcalib->GetTOFCalArrayOnlinePulser();
+ TObjArray *calTOFArrayOnlineNoise = fTOFcalib->GetTOFCalArrayOnlineNoise();
+ TObjArray *calTOFArrayOnlineHW = fTOFcalib->GetTOFCalArrayOnlineHW();
TObjArray *calTOFArrayOffline = fTOFcalib->GetTOFCalArrayOffline();
TString validity = (TString)fTOFcalib->GetOfflineValidity();
AliInfo(Form(" validity = %s",validity.Data()));
Int_t index = AliTOFGeometry::GetIndex(detectorIndex);
- AliTOFChannelOnline * calChannelOnline = (AliTOFChannelOnline* )calTOFArrayOnline->At(index);
+ AliTOFChannelOnlineStatus * calChannelOnlineStPulser = (AliTOFChannelOnlineStatus* )calTOFArrayOnlinePulser->At(index);
+ AliTOFChannelOnlineStatus * calChannelOnlineStNoise = (AliTOFChannelOnlineStatus* )calTOFArrayOnlineNoise->At(index);
+ AliTOFChannelOnlineStatus * calChannelOnlineStHW = (AliTOFChannelOnlineStatus* )calTOFArrayOnlineHW->At(index);
// Get channel status
- UChar_t status=calChannelOnline->GetStatus();
- if((status & AliTOFChannelOnline::kTOFOnlineOk)!=(AliTOFChannelOnline::kTOFOnlineOk))fTofClusters[ii]->SetStatus(kFALSE); //odd convention, to avoid conflict with calibration objects currently in the db (temporary solution).
+ UChar_t statusPulser=calChannelOnlineStPulser->GetStatus();
+ UChar_t statusNoise=calChannelOnlineStNoise->GetStatus();
+ UChar_t statusHW=calChannelOnlineStHW->GetStatus();
+
+ //check the status, also unknow is fine!!!!!!!
+
+ UChar_t status = 0x0;
+ status |= statusPulser;
+ status |= statusNoise;
+ status |= statusHW;
+ // set status of the cluster to false if at least one of the three status (Pulser/Noise/HW) is bad
+ if((statusPulser & AliTOFChannelOnlineStatus::kTOFPulserBad)==(AliTOFChannelOnlineStatus::kTOFPulserBad)||(statusNoise & AliTOFChannelOnlineStatus::kTOFNoiseBad)==(AliTOFChannelOnlineStatus::kTOFNoiseBad)||(statusHW & AliTOFChannelOnlineStatus::kTOFHWBad)==(AliTOFChannelOnlineStatus::kTOFHWBad)){
+ AliDebug(2, Form(" Bad Status for channel %i",index));
+ fTofClusters[ii]->SetStatus(kFALSE); //odd convention, to avoid conflict with calibration objects currently in the db (temporary solution).
+ }
+ else {
+ AliDebug(2, Form(" Good Status for channel %i",index));
+ }
+ // if((status & AliTOFChannelOnlineStatus::kTOFOnlineOk)!=(AliTOFChannelOnline::kTOFOnlineOk))fTofClusters[ii]->SetStatus(kFALSE); //odd convention, to avoid conflict with calibration objects currently in the db (temporary solution).
// Get Rough channel online equalization
+ AliTOFChannelOnline * calChannelOnline = (AliTOFChannelOnline* )calTOFArrayOnline->At(index);
Double_t roughDelay=(Double_t)calChannelOnline->GetDelay(); // in ns
AliDebug(2,Form(" channel delay (ns) = %f", roughDelay));
// Get Refined channel offline calibration parameters
**************************************************************************/
/*
-$Log$
+$Log: AliTOFDataDCS.cxx,v $
+Revision 1.9 2007/05/04 14:02:45 decaro
+AliTOFDataDCS::Draw(Option_t *) method declared const: compiling warning suppression
+
Revision 1.8 2007/05/03 09:45:09 decaro
Coding convention: RN11 violation -> suppression
fRun(0),
fStartTime(0),
fEndTime(0),
- fIsProcessed(kFALSE)
+ fIsProcessed(kFALSE),
+ fFDR(kFALSE)
{
// main constructor
fRun(nRun),
fStartTime(startTime),
fEndTime(endTime),
- fIsProcessed(kFALSE)
+ fIsProcessed(kFALSE),
+ fFDR(kFALSE)
{
// constructor with arguments
fRun(0),
fStartTime(0),
fEndTime(0),
- fIsProcessed(kFALSE)
+ fIsProcessed(kFALSE),
+ fFDR(kFALSE)
{
fStartTime=data.fStartTime;
fEndTime=data.fEndTime;
fIsProcessed=data.fIsProcessed;
+ fFDR=data.fFDR;
for(int i=0;i<kNAliases;i++) {
fAliasNames[i]=data.fAliasNames[i];
}
this->fIsProcessed=data.fIsProcessed;
+ this->fFDR=data.fFDR;
return *this;
}
aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[j].Data());
if(!aliasArr){
AliError(Form("Alias %s not found!", fAliasNames[j].Data()));
- return kFALSE;
+ if (!fFDR){
+ return kFALSE; // returning only in case we are not in a FDR run
+ }
+ else {
+ continue;
+ }
}
Introduce(j, aliasArr);
class AliTOFDataDCS : public TObject {
public:
- enum {kNAliases=10512, kNHV=90, kNLV=576,
+ enum {kNAliases=10944, kNHV=90, kNLV=792,
kNLV33=72, kNLV50=72, kNLV48=72,
kNFEEthr=1152, kNFEEtfeac=576, kNFEEttrm=6840,
kNFunctions=0};
AliTOFFormatDCS* GetFEEttrm(Int_t pos) const
{return pos<kNFEEttrm ? fFEEttrm[pos] : 0;}
+ void SetFDRFlag(Bool_t flag) {fFDR = flag;}
+ Bool_t GetFDRFlag() const {return fFDR;}
+
private:
void Init();
void Introduce(UInt_t numAlias, const TObjArray* aliasArr) const;
Int_t fRun; // Run number
Int_t fStartTime; // start time
- Int_t fEndTime; // end time
-
+ Int_t fEndTime; // end time
TString fAliasNames[kNAliases]; // aliases for DCS data
AliTOFFormatDCS *fHVvp[kNHV]; // HV voltages, positive ch
AliTOFFormatDCS *fFEEttrm[kNFEEttrm]; // FEE trm temperatures
Bool_t fIsProcessed; // bool to know processing status
+ Bool_t fFDR; // bool to know whether we are in a FDR run
- ClassDef(AliTOFDataDCS, 3);
+ ClassDef(AliTOFDataDCS, 4);
};
#endif
#include <TTimeStamp.h>
#include "AliCDBMetaData.h"
+#include "AliCDBEntry.h"
#include "AliLog.h"
#include "AliTOFChannelOnline.h"
+#include "AliTOFChannelOnlineStatus.h"
#include "AliTOFDataDCS.h"
#include "AliTOFGeometry.h"
#include "AliTOFPreprocessor.h"
// analogously, it takes data form DAQ (both at Run level and inclusive -
// of all the runs - level, processes them, and stores both Reference Data
// and Online Calibration files in the CDB.
-
+// Processing of Pulser/Noise Run data and of TOF FEE DCS map
+
+// return codes:
+// return=0 : all ok
+// return=1 : no DCS input data Map
+// return=2 : no DCS input data processing
+// return=3 : no DCS processed data was stored in Ref Data
+// return=4 : no DAQ input for Ref Data
+// return=5 : failed to store DAQ Ref Data
+// return=6 : failed to retrieve DAQ data for calibration
+// return=7 : problems in processing histos in the input DAQ file
+// return=8 : failed to store Online Delays
+// return=9 : failed to store Reference Data for Pulser
+// return=10: failed to retrieve Pulser data
+// return=11: failed to store Pulser map in OCDB
+// return=12: failed to store Reference Data for Noise
+// return=13: failed to retrieve Noise data
+// return=14: failed to store Noise map in OCDB
ClassImp(AliTOFPreprocessor)
-const Int_t AliTOFPreprocessor::fgkBinRangeAve = 13; // number of bins where to calculate the mean
-const Double_t AliTOFPreprocessor::fgkThrPar = 0.013; // parameter used to trigger the calculation of the delay
+const Int_t AliTOFPreprocessor::fgkBinRangeAve = 13; // number of bins where to calculate the mean
+const Double_t AliTOFPreprocessor::fgkIntegralThr = 100; // min number of entries to perform computation of delay per channel
+const Double_t AliTOFPreprocessor::fgkThrPar = 0.013; // parameter used to trigger the calculation of the delay
//_____________________________________________________________________________
fData(0),
fh2(0),
fCal(0),
+ fCalStatus(0),
fNChannels(0),
- fStoreRefData(kTRUE)
+ fStoreRefData(kTRUE),
+ fFDRFlag(kTRUE)
{
// constructor
delete fCal;
fCal = 0;
}
+ if (fCalStatus){
+ delete fCalStatus;
+ fCalStatus = 0;
+ }
}
//______________________________________________________________________________
TTimeStamp(endTime).AsString()));
fData = new AliTOFDataDCS(fRun, fStartTime, fEndTime);
+ fData->SetFDRFlag(fFDRFlag);
fh2 = 0x0;
fNChannels = AliTOFGeometry::NSectors()*(2*(AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB())+AliTOFGeometry::NStripA())*AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX();
fCal = new TObjArray(fNChannels);
AliTOFChannelOnline * calChOnline = new AliTOFChannelOnline();
fCal->AddAt(calChOnline,ich);
}
+ fCalStatus = new TObjArray(fNChannels);
+ fCalStatus->SetOwner();
+ for (Int_t ich = 0; ich<fNChannels; ich ++){
+ AliTOFChannelOnlineStatus * calChOnlineStatus = new AliTOFChannelOnlineStatus();
+ fCalStatus->AddAt(calChOnlineStatus,ich);
+ }
}
+//_____________________________________________________________________________
+Bool_t AliTOFPreprocessor::ProcessDCS(){
+
+ // check whether DCS should be processed or not...
+ TString runType = GetRunType();
+ Log(Form("RunType %s",runType.Data()));
+
+ if ((runType == "PULSER_RUN")||(runType == "NOISE_RUN")) {
+ return kFALSE;
+ }
+
+ return kTRUE;
+}
//_____________________________________________________________________________
UInt_t AliTOFPreprocessor::ProcessDCSDataPoints(TMap* dcsAliasMap)
{
// Fills data into a AliTOFDataDCS object
- // return codes:
- // return=0 : all ok
- // return=1 : no DCS input data Map
- // return=2 : no DCS input data processing
- // return=3 : no DCS processed data was stored in Ref Data
- // return=4 : no DAQ input for Ref Data
- // return=5 : failed to store Ref Data
- // return=6 : failed to retrieve DAQ data for calibration
- // return=7 : problems in histos in the input DAQ file
- // return=8 : failed to store Online Delays
+
+ Log("Processing DCS DP");
TH1::AddDirectory(0);
Bool_t resultDCSMap=kFALSE;
UInt_t AliTOFPreprocessor::ProcessOnlineDelays()
{
- // Fills data into a AliTOFDataDCS object
- // return codes:
- // return=0 : all ok
- // return=1 : no DCS input data Map
- // return=2 : no DCS input data processing
- // return=3 : no DCS processed data was stored in Ref Data
- // return=4 : no DAQ input for Ref Data
- // return=5 : failed to store Ref Data
- // return=6 : failed to retrieve DAQ data for calibration
- // return=7 : problems in histos in the input DAQ file
- // return=8 : failed to store Online Delays
+ // Processing data from DAQ for online calibration
+
+ Log("Processing DAQ delays");
TH1::AddDirectory(0);
Bool_t resultDAQRef=kFALSE;
-
+ Bool_t resultTOFPP=kFALSE;
// processing DAQ
TFile * daqFile=0x0;
for (Int_t ibin=0;ibin<kNBins;ibin++){
h1->SetBinContent(ibin+1,fh2->GetBinContent(ich+1,ibin+1));
}
- Bool_t found=kFALSE;
- Float_t minContent=h1->Integral()*fgkThrPar;
- Int_t nbinsX = h1->GetNbinsX();
- Int_t startBin=1;
- for (Int_t j=1; j<=nbinsX; j++){
- if ((
- h1->GetBinContent(j) +
- h1->GetBinContent(j+1)+
- h1->GetBinContent(j+2)+
- h1->GetBinContent(j+3))>minContent){
- found=kTRUE;
- startBin=j;
- break;
- }
- }
- if(!found) AliInfo(Form("WARNING!!! no start of fit found for histo # %i",ich));
- // Now calculate the mean over the interval.
- Double_t mean = 0;
- Double_t sumw2 = 0;
- Double_t nent = 0;
- for(Int_t k=0;k<fgkBinRangeAve;k++){
- mean=mean+h1->GetBinCenter(startBin+k)*h1->GetBinContent(startBin+k);
- nent=nent+h1->GetBinContent(startBin+k);
- sumw2=sumw2+(h1->GetBinCenter(startBin+k))*(h1->GetBinCenter(startBin+k))*(h1->GetBinContent(startBin+k));
+ if(h1->Integral()<fgkIntegralThr) {
+ Log(Form(" Not enough statistics for bin %i, skipping this channel",ich));
+ delete h1;
+ h1=0x0;
+ continue;
}
- mean= mean/nent; //<x>
- sumw2=sumw2/nent; //<x^2>
- Double_t rmsmean= 0;
- rmsmean = TMath::Sqrt((sumw2-mean*mean)/nent);
- if (ich<fNChannels) {
- AliTOFChannelOnline * ch = (AliTOFChannelOnline *)fCal->At(ich);
- ch->SetDelay((Double_t)mean*AliTOFGeometry::TdcBinWidth()*1.E-3); // delay in ns
+ if (!fFDRFlag) { // not computing delays if in FDR runs
+ Bool_t found=kFALSE;
+ Float_t minContent=h1->Integral()*fgkThrPar;
+ Int_t nbinsX = h1->GetNbinsX();
+ Int_t startBin=1;
+ for (Int_t j=1; j<=nbinsX; j++){
+ if ((
+ h1->GetBinContent(j) +
+ h1->GetBinContent(j+1)+
+ h1->GetBinContent(j+2)+
+ h1->GetBinContent(j+3))>minContent){
+ found=kTRUE;
+ startBin=j;
+ break;
+ }
+ }
+ if(!found) AliInfo(Form("WARNING!!! no start of fit found for histo # %i",ich));
+ // Now calculate the mean over the interval.
+ Double_t mean = 0;
+ Double_t sumw2 = 0;
+ Double_t nent = 0;
+ for(Int_t k=0;k<fgkBinRangeAve;k++){
+ mean=mean+h1->GetBinCenter(startBin+k)*h1->GetBinContent(startBin+k);
+ nent=nent+h1->GetBinContent(startBin+k);
+ sumw2=sumw2+(h1->GetBinCenter(startBin+k))*(h1->GetBinCenter(startBin+k))*(h1->GetBinContent(startBin+k));
+ }
+ mean= mean/nent; //<x>
+ sumw2=sumw2/nent; //<x^2>
+ Double_t rmsmean= 0;
+ rmsmean = TMath::Sqrt((sumw2-mean*mean)/nent);
+ if (ich<fNChannels) {
+ AliTOFChannelOnline * ch = (AliTOFChannelOnline *)fCal->At(ich);
+ ch->SetDelay((Double_t)mean*AliTOFGeometry::TdcBinWidth()*1.E-3); // delay in ns
+ // ch->SetStatus(1); // calibrated channel, removed for the time being from AliTOFChannelOnline
+ }
}
delete h1;
h1=0x0;
}
daqFile=0;
+ AliCDBMetaData metaData;
+ metaData.SetBeamPeriod(0);
+ metaData.SetResponsible("Chiara Zampolli");
+ metaData.SetComment("This preprocessor fills a TObjArray object.");
+ AliInfo("Storing Calibration Data");
+ resultTOFPP = Store("Calib","ParOnline",fCal, &metaData,0,kTRUE);
+ if(!resultTOFPP){
+ Log("Some problems occurred while storing online object resulting from DAQ data processing");
+ return 8;//return error code for problems in storing DAQ data
+ }
return 0;
}
UInt_t AliTOFPreprocessor::ProcessPulserData()
{
- // Fills data into a AliTOFDataDCS object
- // return codes:
- // return=0 : all ok
- // return=1 : no DCS input data Map
- // return=2 : no DCS input data processing
- // return=3 : no DCS processed data was stored in Ref Data
- // return=4 : no DAQ input for Ref Data
- // return=5 : failed to store Ref Data
- // return=6 : failed to retrieve DAQ data for calibration
- // return=7 : problems in histos in the input DAQ file
- // return=8 : failed to store Online Delays
+ // Processing Pulser Run data for TOF channel status
+
+ Log("Processing Pulser");
TH1::AddDirectory(0);
Bool_t resultPulserRef=kFALSE;
+ Bool_t resultPulser=kFALSE;
- static const Int_t kSize = AliTOFGeometry::NPadXSector()*AliTOFGeometry::NSectors();
- TH1S * htofPulser = new TH1S("hTOFpulser","histo with signals on TOF during pulser", kSize,-0.5,kSize-0.5);
- for (Int_t ibin =1;ibin<=kSize;ibin++){
+ static const Int_t size = AliTOFGeometry::NPadXSector()*AliTOFGeometry::NSectors();
+ TH1S * htofPulser = new TH1S("hTOFpulser","histo with signals on TOF during pulser", size,-0.5,size-0.5);
+ for (Int_t ibin =1;ibin<=size;ibin++){
htofPulser->SetBinContent(ibin,-1);
}
+ // retrieving last stored pulser object, and copying
+
+ AliCDBEntry *cdbEntry = GetFromOCDB("Calib","Pulser");
+ if (cdbEntry!=0x0){
+ TObjArray *currentCalStatus = (TObjArray*)cdbEntry->GetObject();
+ for (Int_t ich = 0; ich<fNChannels; ich ++){
+ AliTOFChannelOnlineStatus * calChOnlineSt = (AliTOFChannelOnlineStatus*)fCalStatus->At(ich);
+ calChOnlineSt->SetStatus(((AliTOFChannelOnlineStatus*)currentCalStatus->At(ich))->GetStatus());
+ }
+ }
+
// processing pulser
TFile * daqFile=0x0;
AliInfo(Form("Got the file %s, now we can store the Reference Data for pulser for the current Run.", fileNamePulser.Data()));
daqFile = new TFile(fileNamePulser.Data(),"READ");
h1 = (TH1S*) daqFile->Get("hTOFpulser");
- for (Int_t ibin=0;ibin<kSize;ibin++){
+ for (Int_t ibin=0;ibin<size;ibin++){
if ((h1->GetBinContent(ibin+1))!=-1){
if ((htofPulser->GetBinContent(ibin+1))==-1){
htofPulser->SetBinContent(ibin+1,h1->GetBinContent(ibin+1));
mean/=nread;
AliDebug(1,Form(" nread = %i , mean = %f",nread,mean));
for (Int_t ich =0;ich<fNChannels;ich++){
- AliTOFChannelOnline * ch = (AliTOFChannelOnline *)fCal->At(ich);
+ AliTOFChannelOnlineStatus * chSt = (AliTOFChannelOnlineStatus *)fCalStatus->At(ich);
if (h1->GetBinContent(ich+1)==-1) continue;
AliDebug(1,Form(" channel %i ",ich));
- AliDebug(1,Form(" channel status before pulser = %i",(Int_t)ch->GetStatus()));
+ AliDebug(1,Form(" channel status before pulser = %i",(Int_t)chSt->GetStatus()));
if (h1->GetBinContent(ich+1)<0.05*mean){
- ch->SetStatus(ch->GetStatus()|AliTOFChannelOnline::kTOFPulserBad); // bad status for pulser
- AliDebug(1,Form(" channel status after pulser = %i",(Int_t)ch->GetStatus()));
+ chSt->SetStatus(chSt->GetStatus()|AliTOFChannelOnlineStatus::kTOFPulserBad); // bad status for pulser
+ AliDebug(1,Form(" channel status after pulser = %i",(Int_t)chSt->GetStatus()));
}
else {
- ch->SetStatus(ch->GetStatus()|AliTOFChannelOnline::kTOFPulserOk); // bad status for pulser
- AliDebug(1,Form(" channel status after pulser = %i",(Int_t)ch->GetStatus()));
+ chSt->SetStatus(chSt->GetStatus()|AliTOFChannelOnlineStatus::kTOFPulserOk); // bad status for pulser
+ AliDebug(1,Form(" channel status after pulser = %i",(Int_t)chSt->GetStatus()));
}
}
}
else{
- Log("The input data file from DAQ (pulser) was not found ");
- return 9;//return error code for failure in retrieving Ref Data
+ Log("The input data file from DAQ (pulser) was not found, TOF exiting from Shuttle ");
+ return 10;//return error code for failure in retrieving Ref Data
}
}
delete listPulser;
}
+
else{
- Log("The input data file list from DAQ (pulser) was not found ");
- return 9;//return error code for failure in retrieving Ref Data
+ Log("The input data file list from DAQ (pulser) was not found, TOF exiting from Shuttle ");
+ return 10;//return error code for failure in retrieving Ref Data
}
+
+ //storing in OCDB
+
+ AliCDBMetaData metaData;
+ metaData.SetBeamPeriod(0);
+ metaData.SetResponsible("Chiara Zampolli");
+ metaData.SetComment("This preprocessor fills a TObjArray object for Pulser data.");
+ AliInfo("Storing Calibration Data from Pulser Run");
+ resultPulser = Store("Calib","PulserData",fCalStatus, &metaData,0,kTRUE);
+ if(!resultPulser){
+ Log("Some problems occurred while storing online object resulting from Pulser data processing");
+ return 11;//return error code for problems in storing Pulser data
+ }
+
if(fStoreRefData){
AliCDBMetaData metaDataHisto;
AliInfo("Storing Reference Data");
resultPulserRef = StoreReferenceData("Calib","Pulser",htofPulser, &metaDataHisto);
if (!resultPulserRef){
- Log("some problems occurred::No Reference Data for pulser stored");
- return 8;//return error code for failure in storing Ref Data
+ Log("some problems occurred::No Reference Data for pulser stored, TOF exiting from Shuttle");
+ return 9;//return error code for failure in storing Ref Data
}
}
UInt_t AliTOFPreprocessor::ProcessNoiseData()
{
- // Fills data into a AliTOFDataDCS object
- // return codes:
- // return=0 : all ok
- // return=1 : no DCS input data Map
- // return=2 : no DCS input data processing
- // return=3 : no DCS processed data was stored in Ref Data
- // return=4 : no DAQ input for Ref Data
- // return=5 : failed to store Ref Data
- // return=6 : failed to retrieve DAQ data for calibration
- // return=7 : problems in histos in the input DAQ file
- // return=8 : failed to store Online Delays
+
+ // Processing Noise Run data for TOF channel status
+
+ Log("Processing Noise");
TH1::AddDirectory(0);
Bool_t resultNoiseRef=kFALSE;
+ Bool_t resultNoise=kFALSE;
-
- static const Int_t kSize = AliTOFGeometry::NPadXSector()*AliTOFGeometry::NSectors();
- TH1F * htofNoise = new TH1F("hTOFnoise","histo with signals on TOF during pulser", kSize,-0.5,kSize-0.5);
- for (Int_t ibin =1;ibin<=kSize;ibin++){
+ static const Int_t size = AliTOFGeometry::NPadXSector()*AliTOFGeometry::NSectors();
+ TH1F * htofNoise = new TH1F("hTOFnoise","histo with signals on TOF during pulser", size,-0.5,size-0.5);
+ for (Int_t ibin =1;ibin<=size;ibin++){
htofNoise->SetBinContent(ibin,-1);
}
+ // retrieving last stored noise object, and copying
+
+ AliCDBEntry *cdbEntry = GetFromOCDB("Calib","Noise");
+ if (cdbEntry!=0x0){
+ TObjArray *currentCalStatus = (TObjArray*)cdbEntry->GetObject();
+ for (Int_t ich = 0; ich<fNChannels; ich ++){
+ AliTOFChannelOnlineStatus * calChOnlineSt = (AliTOFChannelOnlineStatus*)fCalStatus->At(ich);
+ calChOnlineSt->SetStatus(((AliTOFChannelOnlineStatus*)currentCalStatus->At(ich))->GetStatus());
+ }
+ }
+
// processing noise
TFile * daqFile=0x0;
AliInfo(Form("Got the file %s, now we can store the Reference Data for noise for the current Run.", fileNameNoise.Data()));
daqFile = new TFile(fileNameNoise.Data(),"READ");
h1 = (TH1F*) daqFile->Get("hTOFnoise");
- for (Int_t ibin=0;ibin<kSize;ibin++){
+ for (Int_t ibin=0;ibin<size;ibin++){
if ((h1->GetBinContent(ibin+1))!=-1){
if ((htofNoise->GetBinContent(ibin+1))==-1){
htofNoise->SetBinContent(ibin+1,h1->GetBinContent(ibin+1));
}
// elaborating infos
for (Int_t ich =0;ich<fNChannels;ich++){
- AliTOFChannelOnline * ch = (AliTOFChannelOnline *)fCal->At(ich);
+ AliTOFChannelOnlineStatus * chSt = (AliTOFChannelOnlineStatus *)fCalStatus->At(ich);
if (h1->GetBinContent(ich+1)==-1) continue;
AliDebug(1,Form( " channel %i",ich));
- AliDebug(1,Form( " channel status before noise = %i",(Int_t)ch->GetStatus()));
+ AliDebug(1,Form( " channel status before noise = %i",(Int_t)chSt->GetStatus()));
if (h1->GetBinContent(ich+1)>=1){ // setting limit for noise to 1 kHz
- ch->SetStatus(ch->GetStatus()|AliTOFChannelOnline::kTOFNoiseBad); // bad status for noise
- AliDebug(1,Form( " channel status after noise = %i",(Int_t)ch->GetStatus()));
+ chSt->SetStatus(chSt->GetStatus()|AliTOFChannelOnlineStatus::kTOFNoiseBad); // bad status for noise
+ AliDebug(1,Form( " channel status after noise = %i",(Int_t)chSt->GetStatus()));
}
else {
- ch->SetStatus(ch->GetStatus()|AliTOFChannelOnline::kTOFNoiseOk); // bad status for noise
- AliDebug(1,Form(" channel status after noise = %i",(Int_t)ch->GetStatus()));
+ chSt->SetStatus(chSt->GetStatus()|AliTOFChannelOnlineStatus::kTOFNoiseOk); // bad status for noise
+ AliDebug(1,Form(" channel status after noise = %i",(Int_t)chSt->GetStatus()));
}
}
daqFile->Close();
delete daqFile;
+ delete h1;
+
}
else{
- Log("The input data file from DAQ (noise) was not found ");
- return 11;//return error code for failure in retrieving Ref Data
+ Log("The input data file from DAQ (noise) was not found, TOF exiting from Shuttle ");
+ return 13;//return error code for failure in retrieving Ref Data
}
}
delete listNoise;
}
else{
- Log("The input data file list from DAQ (noise) was not found ");
- return 11;//return error code for failure in retrieving Ref Data
+ Log("The input data file list from DAQ (noise) was not found, TOF exiting from Shuttle ");
+ return 13;//return error code for failure in retrieving Ref Data
}
daqFile=0;
+ //storing in OCDB
+
+ AliCDBMetaData metaData;
+ metaData.SetBeamPeriod(0);
+ metaData.SetResponsible("Chiara Zampolli");
+ metaData.SetComment("This preprocessor fills a TObjArray object for Noise data.");
+ AliInfo("Storing Calibration Data from Noise Run");
+ resultNoise = Store("Calib","NoiseData",fCalStatus, &metaData,0,kTRUE);
+ if(!resultNoise){
+ Log("Some problems occurred while storing online object resulting from Noise data processing");
+ return 14;//return error code for problems in storing Noise data
+ }
+
if(fStoreRefData){
AliCDBMetaData metaDataHisto;
metaDataHisto.SetBeamPeriod(0);
metaDataHisto.SetResponsible("Chiara Zampolli");
char comment[200];
- sprintf(comment,"This preprocessor stores the result of the noise run");
+ sprintf(comment,"This preprocessor stores the result of the noise run, TOF exiting from Shuttle ");
metaDataHisto.SetComment(comment);
AliInfo("Storing Reference Data");
resultNoiseRef = StoreReferenceData("Calib","Noise",htofNoise, &metaDataHisto);
if (!resultNoiseRef){
Log("some problems occurred::No Reference Data for noise stored");
- return 10;//return error code for failure in storing Ref Data
+ return 12;//return error code for failure in storing Ref Data
}
}
}
//_____________________________________________________________________________
-UInt_t AliTOFPreprocessor::Process(TMap* dcsAliasMap)
+UInt_t AliTOFPreprocessor::ProcessHWData()
{
- // Fills data into a AliTOFDataDCS object
- // return codes:
- // return=0 : all ok
- // return=1 : no DCS input data Map
- // return=2 : no DCS input data processing
- // return=3 : no DCS processed data was stored in Ref Data
- // return=4 : no DAQ input for Ref Data
- // return=5 : failed to store DAQ Ref Data
- // return=6 : failed to retrieve DAQ data for calibration
- // return=7 : problems in histos in the input DAQ file
- // return=8 : failed to store Pulser Ref Data
- // return=9 : failed to retrieve Pulser data for calibration
- // return=10 : failed to store Noise Ref Data
- // return=11 : failed to retrieve Noise data for calibration
- // return=12 : failed to store TOF Online object in CDB
+ // Processing Pulser Run data for TOF channel status
+ // dummy for the time being
- TH1::AddDirectory(0);
+ Log("Processing HW");
- Bool_t resultTOFPP=kFALSE;
+ return 0;
+
+}
+
+//_____________________________________________________________________________
+
+UInt_t AliTOFPreprocessor::Process(TMap* dcsAliasMap)
+{
+
+ TString runType = GetRunType();
+ Log(Form("RunType %s",runType.Data()));
// processing
- Int_t iresultDCS = ProcessDCSDataPoints(dcsAliasMap);
- if ((iresultDCS == 1) || (iresultDCS == 2) || (iresultDCS == 3)) return iresultDCS;
- Int_t iresultDAQ = ProcessOnlineDelays();
- if ((iresultDAQ == 4) || (iresultDAQ == 5) || (iresultDAQ == 6) || (iresultDAQ == 7)) return iresultDAQ;
- Int_t iresultPulser = ProcessPulserData();
- if ((iresultPulser == 4) || (iresultPulser == 5) || (iresultPulser == 6) || (iresultPulser == 7)) return iresultPulser;
- Int_t iresultNoise = ProcessNoiseData();
- if ((iresultNoise == 4) || (iresultNoise == 5) || (iresultNoise == 6) || (iresultNoise == 7)) return iresultNoise;
+ if (runType == "PULSER") {
+ Int_t iresultPulser = ProcessPulserData();
+ return iresultPulser;
+ }
- // storing
-
- AliCDBMetaData metaData;
- metaData.SetBeamPeriod(0);
- metaData.SetResponsible("Chiara Zampolli");
- metaData.SetComment("This preprocessor fills an AliTOFCal object.");
- AliInfo("Storing Calibration Data");
- resultTOFPP = Store("Calib","ParOnline",fCal, &metaData,0,kTRUE);
- if(!resultTOFPP){
- Log("Some problems occurred while storing online object resulting from DAQ data, Pulser data, Noise data processing");
- return 12;//return error code for problems in storing DAQ data
+ if (runType == "NOISE") { // for the time being associating noise runs with pedestal runs; proper run type to be defined
+ Int_t iresultNoise = ProcessNoiseData();
+ return iresultNoise;
+ }
+
+ if (runType == "PHYSICS") {
+ Int_t iresultDCS = ProcessDCSDataPoints(dcsAliasMap);
+ if (iresultDCS != 0) {
+ return iresultDCS;
+ }
+ else {
+ Int_t iresultDAQ = ProcessOnlineDelays();
+ return iresultDAQ;
+ }
}
+ // storing
return 0;
}
AliTOFPreprocessor(AliShuttleInterface* shuttle);
virtual ~AliTOFPreprocessor();
void SetStoreRefData(Bool_t in){fStoreRefData=in;};
- Bool_t GetStoreRefData() const {return fStoreRefData;};
+ Bool_t GetStoreRefData() const {return fStoreRefData;}
+ void SetFDRFlag(Bool_t flag) {fFDRFlag = flag;}
+ Bool_t GetFDRFlag() const {return fFDRFlag;}
protected:
virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
virtual UInt_t Process(TMap* dcsAliasMap);
+ virtual Bool_t ProcessDCS();
private:
AliTOFPreprocessor(const AliTOFPreprocessor & proc); // copy constructor
UInt_t ProcessOnlineDelays();
UInt_t ProcessPulserData();
UInt_t ProcessNoiseData();
-
- static const Int_t fgkBinRangeAve; // number of bins where to
- // calculate the mean
- static const Double_t fgkThrPar; // parameter used to trigger the
- // calculation of the delay
- AliTOFDataDCS *fData; // CDB class that stores the data
- TH2S *fh2; // TH2S from DAQ for histograms
- // for delays
- TObjArray *fCal; // TOF Calibration object
- Int_t fNChannels; // number of TOF channels
- Bool_t fStoreRefData; // Flag to decide storage of Ref Data
- ClassDef(AliTOFPreprocessor, 3);
+ UInt_t ProcessHWData(); // dummy, for the time being
+
+ static const Int_t fgkBinRangeAve; // number of bins where to
+ // calculate the mean
+ static const Double_t fgkIntegralThr; // min number of entries per channel
+ // to perform calculation of delay
+ static const Double_t fgkThrPar; // parameter used to trigger the
+ // calculation of the delay
+ AliTOFDataDCS *fData; // CDB class that stores the data
+ TH2S *fh2; // TH2S from DAQ for histograms
+ // for delays
+ TObjArray *fCal; // TOF Calibration object
+ TObjArray *fCalStatus; // TOF Calibration object from pulser/noise
+ Int_t fNChannels; // number of TOF channels
+ Bool_t fStoreRefData; // Flag to decide storage of Ref Data
+ Bool_t fFDRFlag; // Flag for FDR runs
+ ClassDef(AliTOFPreprocessor, 4);
};
#endif
#include "AliLog.h"
#include "AliRawReader.h"
-#include "AliCDBManager.h"
-#include "AliCDBEntry.h"
#include "AliTOFClusterFinder.h"
#include "AliTOFcalib.h"
#include "AliTOFtracker.h"
#include "AliTOFtrackerV1.h"
#include "AliTOFReconstructor.h"
-#include "AliTOFFormatDCS.h"
class TTree;
//
// ctor
//
-
-//reading DCS DP processing result
-
- AliCDBManager *man = AliCDBManager::Instance();
- Char_t *sel = "TOF/Calib/DCSData" ;
- Char_t out[100];
- sprintf(out,"%s",sel);
- if (!man->Get(out,-1)) {
- AliInfo("No DCS data found in CDB");
- }
- else{
- AliCDBEntry *entry = man->Get(out,-1);
- if(!entry->GetObject()){
- AliInfo("No DCS array found in CDB entry");
- }
-
- else {
- TObjArray *array = (TObjArray*)entry->GetObject();
- TString alias[4]={"tof_lv_i48","tof_lv_v48","tof_lv_i33","tof_lv_v33"};
- for (Int_t jj=0;jj<4;jj++){
- AliInfo(Form("Alias = %s",alias[jj].Data()));
-
- AliTOFFormatDCS *dcs = (AliTOFFormatDCS*)array->At(jj);
- for (Int_t i=0;i<3;i++){
- AliInfo(Form("set value %i to %f at %f",i,dcs->GetFloat(i),dcs->GetTimeStampFloat(i)));
- }
- for (Int_t i=0;i<2;i++){
- AliInfo(Form("set variation %i to %f at %f",i,dcs->GetDelta(i),dcs->GetTimeStampDelta(i)));
- }
-
- }
- }
- }
//Retrieving the TOF calibration info
fTOFcalib = new AliTOFcalib();
**************************************************************************/
/*
-$Log$
+$Log: AliTOFcalib.cxx,v $
+Revision 1.21 2007/11/02 15:41:49 hristov
+Provide return value if the function is not void
+
Revision 1.20 2007/10/26 15:13:50 zampolli
Using a TChain instead of a TTree
#include "AliTOFcalib.h"
#include "AliTOFChannelOnline.h"
+#include "AliTOFChannelOnlineStatus.h"
#include "AliTOFChannelOffline.h"
#include "AliTOFGeometry.h"
#include "AliTOFRecoParam.h"
TTask("AliTOFcalib",""),
fNChannels(-1),
fTOFCalOnline(0x0),
+ fTOFCalOnlinePulser(0x0),
+ fTOFCalOnlineNoise(0x0),
+ fTOFCalOnlineHW(0x0),
fTOFCalOffline(0x0),
fTOFSimToT(0x0),
fkValidity(0x0),
TTask("AliTOFcalib",""),
fNChannels(calib.fNChannels),
fTOFCalOnline(0x0),
+ fTOFCalOnlinePulser(0x0),
+ fTOFCalOnlineNoise(0x0),
+ fTOFCalOnlineHW(0x0),
fTOFCalOffline(0x0),
fTOFSimToT(calib.fTOFSimToT),
fkValidity(calib.fkValidity),
//TOF Calibration Class copy ctor
for (Int_t iarray = 0; iarray<fNChannels; iarray++){
AliTOFChannelOnline * calChOnline = (AliTOFChannelOnline*)calib.fTOFCalOnline->At(iarray);
+ AliTOFChannelOnlineStatus * calChOnlineStPulser = (AliTOFChannelOnlineStatus*)calib.fTOFCalOnlinePulser->At(iarray);
+ AliTOFChannelOnlineStatus * calChOnlineStNoise = (AliTOFChannelOnlineStatus*)calib.fTOFCalOnlineNoise->At(iarray);
+ AliTOFChannelOnlineStatus * calChOnlineStHW = (AliTOFChannelOnlineStatus*)calib.fTOFCalOnlineHW->At(iarray);
AliTOFChannelOffline * calChOffline = (AliTOFChannelOffline*)calib.fTOFCalOffline->At(iarray);
fTOFCalOnline->AddAt(calChOnline,iarray);
+ fTOFCalOnlinePulser->AddAt(calChOnlineStPulser,iarray);
+ fTOFCalOnlineNoise->AddAt(calChOnlineStNoise,iarray);
+ fTOFCalOnlineHW->AddAt(calChOnlineStHW,iarray);
fTOFCalOffline->AddAt(calChOffline,iarray);
}
for (Int_t iarray = 0; iarray<fNChannels; iarray++){
AliTOFChannelOnline * calChOnline = (AliTOFChannelOnline*)calib.fTOFCalOnline->At(iarray);
AliTOFChannelOffline * calChOffline = (AliTOFChannelOffline*)calib.fTOFCalOffline->At(iarray);
+ AliTOFChannelOnlineStatus * calChOnlineStPulser = (AliTOFChannelOnlineStatus*)calib.fTOFCalOnlinePulser->At(iarray);
+ AliTOFChannelOnlineStatus * calChOnlineStNoise = (AliTOFChannelOnlineStatus*)calib.fTOFCalOnlineNoise->At(iarray);
+ AliTOFChannelOnlineStatus * calChOnlineStHW = (AliTOFChannelOnlineStatus*)calib.fTOFCalOnlineHW->At(iarray);
this->fTOFCalOnline->AddAt(calChOnline,iarray);
+ this->fTOFCalOnlinePulser->AddAt(calChOnlineStPulser,iarray);
+ this->fTOFCalOnlineNoise->AddAt(calChOnlineStNoise,iarray);
+ this->fTOFCalOnlineHW->AddAt(calChOnlineStHW,iarray);
this->fTOFCalOffline->AddAt(calChOffline,iarray);
}
return *this;
if (fTOFCalOnline){
delete fTOFCalOnline;
}
+ if (fTOFCalOnlinePulser){
+ delete fTOFCalOnlinePulser;
+ }
+ if (fTOFCalOnlineNoise){
+ delete fTOFCalOnlineNoise;
+ }
+ if (fTOFCalOnlineHW){
+ delete fTOFCalOnlineHW;
+ }
if (fTOFCalOffline){
delete fTOFCalOffline;
}
// creating arrays for online/offline calibration objs
fTOFCalOnline = new TObjArray(fNChannels);
+ fTOFCalOnlinePulser = new TObjArray(fNChannels);
+ fTOFCalOnlineNoise = new TObjArray(fNChannels);
+ fTOFCalOnlineHW = new TObjArray(fNChannels);
fTOFCalOffline = new TObjArray(fNChannels);
fTOFCalOnline->SetOwner();
+ fTOFCalOnlinePulser->SetOwner();
+ fTOFCalOnlineNoise->SetOwner();
+ fTOFCalOnlineHW->SetOwner();
fTOFCalOffline->SetOwner();
for (Int_t iarray = 0; iarray<fNChannels; iarray++){
AliTOFChannelOnline * calChOnline = new AliTOFChannelOnline();
+ AliTOFChannelOnlineStatus * calChOnlineStPulser = new AliTOFChannelOnlineStatus();
+ AliTOFChannelOnlineStatus * calChOnlineStNoise = new AliTOFChannelOnlineStatus();
+ AliTOFChannelOnlineStatus * calChOnlineStHW = new AliTOFChannelOnlineStatus();
AliTOFChannelOffline * calChOffline = new AliTOFChannelOffline();
fTOFCalOnline->AddAt(calChOnline,iarray);
+ fTOFCalOnlinePulser->AddAt(calChOnlineStPulser,iarray);
+ fTOFCalOnlineNoise->AddAt(calChOnlineStNoise,iarray);
+ fTOFCalOnlineHW->AddAt(calChOnlineStHW,iarray);
fTOFCalOffline->AddAt(calChOffline,iarray);
}
}
delete md;
}
//_____________________________________________________________________________
+void AliTOFcalib::WriteParOnlinePulserOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun)
+{
+ //Write calibration parameters from pulser to the CDB
+ SetFirstRun(minrun);
+ SetLastRun(maxrun);
+ AliCDBManager *man = AliCDBManager::Instance();
+ Char_t *sel1 = "Pulser" ; // to be consistent with TOFPreprocessor
+ Char_t out[100];
+ sprintf(out,"%s/%s",sel,sel1);
+ AliDebug(2,Form("Writing TOF online calib obj from pulser on CDB with run range [%i, %i] ",fFirstRun,fLastRun));
+ AliCDBId id(out,fFirstRun,fLastRun);
+ AliCDBMetaData *md = new AliCDBMetaData();
+ md->SetResponsible("Chiara Zampolli");
+ if (!fTOFCalOnlinePulser) {
+ // deve uscire!!
+ }
+ man->Put(fTOFCalOnlinePulser,id,md);
+ delete md;
+}
+//_____________________________________________________________________________
+void AliTOFcalib::WriteParOnlineNoiseOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun)
+{
+ //Write calibration parameters from noise to the CDB
+ SetFirstRun(minrun);
+ SetLastRun(maxrun);
+ AliCDBManager *man = AliCDBManager::Instance();
+ Char_t *sel1 = "Noise" ; // to be consistent with TOFPreprocessor
+ Char_t out[100];
+ sprintf(out,"%s/%s",sel,sel1);
+ AliDebug(2,Form("Writing TOF online calib obj from noise on CDB with run range [%i, %i] ",fFirstRun,fLastRun));
+ AliCDBId id(out,fFirstRun,fLastRun);
+ AliCDBMetaData *md = new AliCDBMetaData();
+ md->SetResponsible("Chiara Zampolli");
+ if (!fTOFCalOnlineNoise) {
+ // deve uscire!!
+ }
+ man->Put(fTOFCalOnlineNoise,id,md);
+ delete md;
+}
+//_____________________________________________________________________________
+void AliTOFcalib::WriteParOnlineHWOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun)
+{
+ //Write calibration parameters from hardware to the CDB
+ SetFirstRun(minrun);
+ SetLastRun(maxrun);
+ AliCDBManager *man = AliCDBManager::Instance();
+ Char_t *sel1 = "HW" ; // to be consistent with TOFPreprocessor
+ Char_t out[100];
+ sprintf(out,"%s/%s",sel,sel1);
+ AliDebug(2,Form("Writing TOF online calib obj from hardware on CDB with run range [%i, %i] ",fFirstRun,fLastRun));
+ AliCDBId id(out,fFirstRun,fLastRun);
+ AliCDBMetaData *md = new AliCDBMetaData();
+ md->SetResponsible("Chiara Zampolli");
+ if (!fTOFCalOnlineHW) {
+ // deve uscire!!
+ }
+ man->Put(fTOFCalOnlineHW,id,md);
+ delete md;
+}
+//_____________________________________________________________________________
void AliTOFcalib::WriteParOnlineOnCDB(Char_t *sel)
{
}
//_____________________________________________________________________________
+void AliTOFcalib::WriteParOnlinePulserOnCDB(Char_t *sel)
+{
+ //Write calibration parameters from pulser to the CDB with infinite validity
+ AliCDBManager *man = AliCDBManager::Instance();
+ Char_t *sel1 = "Pulser" ; // to be consistent with TOFPreprocessor
+ Char_t out[100];
+ sprintf(out,"%s/%s",sel,sel1);
+ AliCDBRunRange runrange(fFirstRun,fLastRun);
+ AliDebug(2,Form("Writing TOF online calib obj from pulser on CDB with run range [%i, %i] ",runrange.GetFirstRun(),runrange.GetLastRun()));
+ AliCDBId id(out,runrange);
+ AliCDBMetaData *md = new AliCDBMetaData();
+ md->SetResponsible("Chiara Zampolli");
+ if (!fTOFCalOnlinePulser) {
+ // deve uscire!!
+ }
+ man->Put(fTOFCalOnlinePulser,id,md);
+ delete md;
+}
+//_____________________________________________________________________________
+
+void AliTOFcalib::WriteParOnlineNoiseOnCDB(Char_t *sel)
+{
+ //Write calibration parameters from noise to the CDB with infinite validity
+ AliCDBManager *man = AliCDBManager::Instance();
+ Char_t *sel1 = "Noise" ; // to be consistent with TOFPreprocessor
+ Char_t out[100];
+ sprintf(out,"%s/%s",sel,sel1);
+ AliCDBRunRange runrange(fFirstRun,fLastRun);
+ AliDebug(2,Form("Writing TOF online calib obj from noise on CDB with run range [%i, %i] ",runrange.GetFirstRun(),runrange.GetLastRun()));
+ AliCDBId id(out,runrange);
+ AliCDBMetaData *md = new AliCDBMetaData();
+ md->SetResponsible("Chiara Zampolli");
+ if (!fTOFCalOnlineNoise) {
+ // deve uscire!!
+ }
+ man->Put(fTOFCalOnlineNoise,id,md);
+ delete md;
+}
+//_____________________________________________________________________________
+
+void AliTOFcalib::WriteParOnlineHWOnCDB(Char_t *sel)
+{
+ //Write calibration parameters from hardware to the CDB with infinite validity
+ AliCDBManager *man = AliCDBManager::Instance();
+ Char_t *sel1 = "HW" ; // to be consistent with TOFPreprocessor
+ Char_t out[100];
+ sprintf(out,"%s/%s",sel,sel1);
+ AliCDBRunRange runrange(fFirstRun,fLastRun);
+ AliDebug(2,Form("Writing TOF online calib obj from harware on CDB with run range [%i, %i] ",runrange.GetFirstRun(),runrange.GetLastRun()));
+ AliCDBId id(out,runrange);
+ AliCDBMetaData *md = new AliCDBMetaData();
+ md->SetResponsible("Chiara Zampolli");
+ if (!fTOFCalOnlineHW) {
+ // deve uscire!!
+ }
+ man->Put(fTOFCalOnlineHW,id,md);
+ delete md;
+}
+//_____________________________________________________________________________
+
void AliTOFcalib::WriteParOfflineOnCDB(Char_t *sel, const Char_t *validity, Int_t minrun, Int_t maxrun)
{
//Write calibration parameters to the CDB
}
//_____________________________________________________________________________
+Bool_t AliTOFcalib::ReadParOnlinePulserFromCDB(Char_t *sel, Int_t nrun)
+{
+ //Read calibration parameters from pulser from the CDB
+ AliCDBManager *man = AliCDBManager::Instance();
+ Char_t *sel1 = "Pulser" ;
+ Char_t out[100];
+ sprintf(out,"%s/%s",sel,sel1);
+ if (!man->Get(out,nrun)) {
+ return kFALSE;
+ }
+ AliCDBEntry *entry = man->Get(out,nrun);
+ if(!entry->GetObject()){
+ return kFALSE;
+ }
+
+ fTOFCalOnlinePulser =(TObjArray*)entry->GetObject();
+
+ return kTRUE;
+
+}
+//_____________________________________________________________________________
+
+Bool_t AliTOFcalib::ReadParOnlineNoiseFromCDB(Char_t *sel, Int_t nrun)
+{
+ //Read calibration parameters from noise from the CDB
+ AliCDBManager *man = AliCDBManager::Instance();
+ Char_t *sel1 = "Noise" ;
+ Char_t out[100];
+ sprintf(out,"%s/%s",sel,sel1);
+ if (!man->Get(out,nrun)) {
+ return kFALSE;
+ }
+ AliCDBEntry *entry = man->Get(out,nrun);
+ if(!entry->GetObject()){
+ return kFALSE;
+ }
+
+ fTOFCalOnlineNoise =(TObjArray*)entry->GetObject();
+
+ return kTRUE;
+
+}
+//_____________________________________________________________________________
+
+Bool_t AliTOFcalib::ReadParOnlineHWFromCDB(Char_t *sel, Int_t nrun)
+{
+ //Read calibration parameters from hardware from the CDB
+ AliCDBManager *man = AliCDBManager::Instance();
+ Char_t *sel1 = "HW" ;
+ Char_t out[100];
+ sprintf(out,"%s/%s",sel,sel1);
+ if (!man->Get(out,nrun)) {
+ return kFALSE;
+ }
+ AliCDBEntry *entry = man->Get(out,nrun);
+ if(!entry->GetObject()){
+ return kFALSE;
+ }
+
+ fTOFCalOnlineHW =(TObjArray*)entry->GetObject();
+
+ return kTRUE;
+
+}
+//_____________________________________________________________________________
+
Bool_t AliTOFcalib::ReadParOfflineFromCDB(Char_t *sel, Int_t nrun)
{
//Read calibration parameters from the CDB
virtual ~AliTOFcalib() ; // dtor
void CreateCalArrays();
TObjArray * GetTOFCalArrayOnline() const {return fTOFCalOnline;}
+ TObjArray * GetTOFCalArrayOnlinePulser() const {return fTOFCalOnlinePulser;}
+ TObjArray * GetTOFCalArrayOnlineNoise() const {return fTOFCalOnlineNoise;}
+ TObjArray * GetTOFCalArrayOnlineHW() const {return fTOFCalOnlineHW;}
TObjArray * GetTOFCalArrayOffline() const {return fTOFCalOffline;}
TH1F * GetTOFSimToT() const {return fTOFSimToT;}
TTree * GetTOFCalibTree() const {return fTree;}
// Methods to retrieve/write parameters from/on CDB
void WriteSimHistoOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun, TH1F *histo);
void WriteParOnlineOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun);
+ void WriteParOnlinePulserOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun);
+ void WriteParOnlineNoiseOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun);
+ void WriteParOnlineHWOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun);
void WriteParOfflineOnCDB(Char_t *sel, const Char_t *validity, Int_t minrun, Int_t maxrun);
void WriteParOnlineOnCDB(Char_t *sel);
+ void WriteParOnlinePulserOnCDB(Char_t *sel);
+ void WriteParOnlineNoiseOnCDB(Char_t *sel);
+ void WriteParOnlineHWOnCDB(Char_t *sel);
void WriteParOfflineOnCDB(Char_t *sel, const Char_t *validity);
Bool_t ReadSimHistoFromCDB(Char_t *sel, Int_t nrun);
Bool_t ReadParOnlineFromCDB(Char_t *sel, Int_t nrun);
+ Bool_t ReadParOnlinePulserFromCDB(Char_t *sel, Int_t nrun);
+ Bool_t ReadParOnlineNoiseFromCDB(Char_t *sel, Int_t nrun);
+ Bool_t ReadParOnlineHWFromCDB(Char_t *sel, Int_t nrun);
Bool_t ReadParOfflineFromCDB(Char_t *sel, Int_t nrun);
void WriteRecParOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun, AliTOFRecoParam *param);
AliTOFRecoParam * ReadRecParFromCDB(Char_t *sel, Int_t nrun);
private:
Int_t fNChannels; // number of TOF channels
TObjArray *fTOFCalOnline; // array of AliTOFChannels storing calib parameters
+ TObjArray *fTOFCalOnlinePulser; // array of AliTOFChannels storing calib status from pulser
+ TObjArray *fTOFCalOnlineNoise; // array of AliTOFChannels storing calib status from noise
+ TObjArray *fTOFCalOnlineHW; // array of AliTOFChannels storing calib status from hardware
TObjArray *fTOFCalOffline; // array of AliTOFChannels storing calib parameters
TH1F *fTOFSimToT; // histo with realistic ToT signal from TB Data
const char *fkValidity; // validity for offline calibration object
Int_t fFirstRun; // first run for calibration obj validity
Int_t fLastRun; // last run for calib obj validity
- ClassDef(AliTOFcalib,5);
+ ClassDef(AliTOFcalib,6);
};
#endif // AliTOFcalib_H
void CreateIdealOnlineCalibPars(){
- // Create TOF Dummy (delay=0) Offline Calibration Object for reconstruction
+ // Create TOF Dummy (delay=0, pulser/noise/HW status ok) Offline Calibration Object for reconstruction
// and write it on CDB
AliTOFcalib *tofcalib = new AliTOFcalib();
tofcalib->CreateCalArrays();
TObjArray *tofCalOnline = (TObjArray*) tofcalib->GetTOFCalArrayOnline();
+ TObjArray *tofCalOnlinePulser = (TObjArray*) tofcalib->GetTOFCalArrayOnlinePulser();
+ TObjArray *tofCalOnlineNoise = (TObjArray*) tofcalib->GetTOFCalArrayOnlineNoise();
+ TObjArray *tofCalOnlineHW = (TObjArray*) tofcalib->GetTOFCalArrayOnlineHW();
// Write the dummy offline calibration object on CDB
AliCDBManager *man = AliCDBManager::Instance();
Int_t nChannels = AliTOFGeometry::NSectors()*(2*(AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB())+AliTOFGeometry::NStripA())*AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX();
for (Int_t ipad = 0 ; ipad<nChannels; ipad++){
AliTOFChannelOnline *calChannelOnline = (AliTOFChannelOnline*)tofCalOnline->At(ipad);
+ AliTOFChannelOnlineStatus *calChannelOnlinePulser = (AliTOFChannelOnlineStatus*)tofCalOnlinePulser->At(ipad);
+ AliTOFChannelOnlineStatus *calChannelOnlineNoise = (AliTOFChannelOnlineStatus*)tofCalOnlineNoise->At(ipad);
+ AliTOFChannelOnlineStatus *calChannelOnlineHW = (AliTOFChannelOnlineStatus*)tofCalOnlineHW->At(ipad);
Float_t delay = 0.;
- calChannelOnline->SetDelay(delay);
- calChannelOnline->SetStatus(AliTOFChannelOnline::kTOFOnlineOk);
- }
+ calChannelOnline->SetDelay(delay);
+ calChannelOnlinePulser->SetStatus(AliTOFChannelOnlineStatus::kTOFPulserOk);
+ calChannelOnlineNoise->SetStatus(AliTOFChannelOnlineStatus::kTOFNoiseOk);
+ calChannelOnlineHW->SetStatus(AliTOFChannelOnlineStatus::kTOFHWOk);
+ }
tofcalib->WriteParOnlineOnCDB("TOF/Calib");
- return;
+ tofcalib->WriteParOnlinePulserOnCDB("TOF/Calib");
+ tofcalib->WriteParOnlineNoiseOnCDB("TOF/Calib");
+ tofcalib->WriteParOnlineHWOnCDB("TOF/Calib");
+ return;
}
// CreateInputFilesMap() creates a list of local files, that can be accessed by the shuttle
extern TBenchmark *gBenchmark;
-void TOFPreprocessor()
+void TOFPreprocessor(Char_t * RunType="PHYSICS")
{
gSystem->Load("$ALICE/SHUTTLE/TestShuttle/libTestShuttle.so");
- AliLog::SetClassDebugLevel("AliTOFPreprocessor",1);
+ //AliLog::SetClassDebugLevel("AliTOFPreprocessor",1);
// initialize location of CDB
AliTestShuttle::SetMainCDB("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestReference");
// create AliTestShuttle instance
AliTestShuttle* shuttle = new AliTestShuttle(0, 0, 1000);
+ //setting run type to physiscs
+ shuttle->SetInputRunType(RunType);
// Generation of "fake" input DCS data
TMap* dcsAliasMap = CreateDCSAliasMap();
shuttle->AddInputFile(AliTestShuttle::kDAQ, "TOF", "RUNLevel", "MON", "$ALICE_ROOT/TOF/ShuttleInput/Partial.root");
char filename[100];
char LDCname[5];
+
for (Int_t iLDC=0;iLDC<2;iLDC++){
sprintf(filename,"$ALICE_ROOT/TOF/ShuttleInput/TOFoutPulserLDC_%02i.root",iLDC*2);
sprintf(LDCname,"LDC%i",iLDC*2);
sigmaFEEthr=0.1, sigmaFEEtfeac=10, sigmaFEEttrm=4;
Float_t tent=0, sigma=0, thr=0;
- Int_t NAliases=10514, NHV=90, NLV=576, NLV33=72, NLV50=72, NLV48=72, NFEEthr=1152, NFEEtfeac=576, NFEEttrm=6840, NT=1, NP=1;
+ // to have all the aliases, deccoment the following line:
+ // Int_t NAliases=10944, NHV=90, NLV=792, NLV33=72, NLV50=72, NLV48=72, NFEEthr=1152, NFEEtfeac=576, NFEEttrm=6840;
+
+ // if not all the aliases are there, use this:
+ Int_t NAliases=4104, NHV=90, NLV=792, NLV33=72, NLV50=72, NLV48=72, NFEEthr=1152, NFEEtfeac=576;
for(int nAlias=0;nAlias<NAliases;nAlias++) {
sigma=sigmaFEEtfeac;
//thr=thrFEEthr;
}
+ /*
else if (nAlias<NHV*4+2*NLV+2*NLV33+2*NLV50+2*NLV48+NFEEthr+NFEEtfeac+NFEEttrm){
//cout << " nalias fee temp = " << nAlias << endl;
// aliasName = "FEEt";
sigma=sigmaFEEttrm;
//thr=thrFEEthr;
}
-
+ */
// gauss generation of values
for (int timeStamp=0;timeStamp<1000;timeStamp+=10){
Float_t gaussvalue = (Float_t) (random.Gaus(tent,sigma));
#pragma link C++ class AliTOFDecoder+;
#pragma link C++ class AliTOFChannelOffline+;
#pragma link C++ class AliTOFChannelOnline+;
+#pragma link C++ class AliTOFChannelOnlineStatus+;
#pragma link C++ class AliTOFcalib+;
#pragma link C++ class AliTOFAlignment+;
#pragma link C++ class AliTOFPreprocessor+;
Contact: Chiara.Zampolli@bo.infn.it
Link: www.bo.infn.it/~zampolli
-Run Type: CALIBRATION, PULSER - to be properly defined
+Run Type: NOISE
DA Type: LDC
Number of events needed: 10000
Input Files: TOF<nrun>.raw, where <nrun> is the run number
Contact: Chiara.Zampolli@bo.infn.it
Link: www.bo.infn.it/~zampolli
-Run Type: CALIBRATION, PULSER - to be properly defined
+Run Type: PULSER
DA Type: LDC
Number of events needed: 10000
Input Files: TOF<nrun>.raw, where <nrun> is the run number
AliTOFDecoder.cxx\
AliTOFChannelOffline.cxx \
AliTOFChannelOnline.cxx \
+ AliTOFChannelOnlineStatus.cxx \
AliTOFcalib.cxx \
AliTOFAlignment.cxx \
AliTOFPreprocessor.cxx \