From ddeb9c4f216c4ee9bcf69b913a9f9a95e37ab78a Mon Sep 17 00:00:00 2001 From: marian Date: Wed, 1 Jul 2009 17:08:27 +0000 Subject: [PATCH] AliTPCCalibPedestal.h.diff code cleanup: Remove functions moved to the Base Class AliTPCCalibPulser.h.diff code cleanup: Remove functions moved to the Base Class AliTPCCalibRaw.cxx Calibration algorithm for drift velocity from last time bin, and L1 phase checking AliTPCCalibRaw.h Calibration algorithm for drift velocity from last time bin, and L1 phase checking TPCRAWda.cxx Detector algorithms for drift velocity from last time bin, and L1 phase checking libTPCbase.pkg.diff Adding class AliTPCCalibRaw TPCbaseLinkDef.h.diff Adding class AliTPCCalibRaw (Jens Wiechula) --- TPC/AliTPCCalibPedestal.h | 4 - TPC/AliTPCCalibPulser.h | 1 - TPC/AliTPCCalibRaw.cxx | 330 ++++++++++++++++++++++++++++++++++++++ TPC/AliTPCCalibRaw.h | 133 +++++++++++++++ TPC/TPCRAWda.cxx | 246 ++++++++++++++++++++++++++++ TPC/TPCbaseLinkDef.h | 1 + TPC/libTPCbase.pkg | 1 + 7 files changed, 711 insertions(+), 5 deletions(-) create mode 100644 TPC/AliTPCCalibRaw.cxx create mode 100644 TPC/AliTPCCalibRaw.h create mode 100644 TPC/TPCRAWda.cxx diff --git a/TPC/AliTPCCalibPedestal.h b/TPC/AliTPCCalibPedestal.h index e6bd0e1858c..29c18469b31 100644 --- a/TPC/AliTPCCalibPedestal.h +++ b/TPC/AliTPCCalibPedestal.h @@ -14,7 +14,6 @@ class AliTPCCalROC; class AliTPCRawStream; class AliTPCRawStreamFast; class AliRawReader; -class AliTPCAltroMapping; class TMap; struct eventHeaderStruct; @@ -33,9 +32,6 @@ public: const Int_t iTimeBin, const Float_t signal); virtual void Analyse(); // - AliTPCAltroMapping **GetAltroMapping() { return fMapping; }; - void SetAltroMapping(AliTPCAltroMapping **mapp) { fMapping = mapp; }; - // AliTPCCalROC* GetCalRocPedestal (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector AliTPCCalROC* GetCalRocSigma(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector const TObjArray* GetCalPadPedestal (){return &fCalRocArrayPedestal;} // get calibration object diff --git a/TPC/AliTPCCalibPulser.h b/TPC/AliTPCCalibPulser.h index c2d508ee347..69c5f199da8 100644 --- a/TPC/AliTPCCalibPulser.h +++ b/TPC/AliTPCCalibPulser.h @@ -22,7 +22,6 @@ class AliTPCParam; class AliRawReader; class AliTPCRawStream; class AliTPCRawStreamFast; -class AliTPCAltroMapping; class TMap; struct eventHeaderStruct; diff --git a/TPC/AliTPCCalibRaw.cxx b/TPC/AliTPCCalibRaw.cxx new file mode 100644 index 00000000000..22d61549410 --- /dev/null +++ b/TPC/AliTPCCalibRaw.cxx @@ -0,0 +1,330 @@ +/************************************************************************** + * 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. * + **************************************************************************/ + +/* $Id: $ */ + +//////////////////////////////////////////////////////////////////////////////////////// +// // +// Implementation of the TPC Raw drift velocity and Altro L1 Phase calibration // +// // +// Origin: Jens Wiechula, J.Wiechula@gsi.de // +// // +//////////////////////////////////////////////////////////////////////////////////////// +// +// +// ************************************************************************************* +// * Class Description * +// ************************************************************************************* +/* + +----example--- +TFile f("CalibAltro.root"); +AliTPCCalibRaw *al=(AliTPCCalibRaw*)f.Get(f.GetListOfKeys()->At(0)->GetName()) +{ +TCanvas *c1=(TCanvas*)gROOT->FindObject("c1"); +if (!c1) c1=new TCanvas("c1","c1"); +c1->Clear(); + +TH2F h2f("h2","h2;RCU;fail",216,0,216,al->GetNevents(),0,al->GetNevents()); +Bool_t first=kTRUE; +Int_t i,iev; +for (i=0;i<216;++i) { + TVectorF *v=al->GetALTROL1PhaseFailEventsRCU(i); + if (!v) continue; + for (iev=0;ievGetNevents();++iev) { + h2f->SetBinContent(i+1,iev+1,(*v)(iev)); + } +// TH1F h(*v); +// h.SetLineColor(i/216.*50+50); +// ((TH1F*)h.Clone(Form("h%d",i)))->Draw(first?"":"same"); +// c1->Modified(); +// c1->Update(); + first=kFALSE; +} +h2f->Draw("col"); +} + +*/ + + + +//Root includes +#include + +//AliRoot includes +#include "AliTPCCalROC.h" +#include "AliAltroRawStream.h" +#include "AliLog.h" + +//class header +#include "AliTPCCalibRaw.h" + +ClassImp(AliTPCCalibRaw) + +AliTPCCalibRaw::AliTPCCalibRaw() : + AliTPCCalibRawBase(), + fPeakDetMinus(1), + fPeakDetPlus(2), + fNFailL1Phase(0), + fFirstTimeStamp(0), + fNSecTime(600), //default 10 minutes + fNBinsTime(60), //default 60*10 minutes = 10 hours + fPadProcessed(kFALSE), + fCurrentChannel(-1), + fCurrentSector(-1), + fLastSector(-2), + fCurrentRow(-1), + fCurrentPad(-1), + fLastTimeBinProc(0), + fPeakTimeBin(0), + fLastSignal(0), + fNOkPlus(0), + fNOkMinus(0), + fArrCurrentPhaseDist(4), + fArrALTROL1Phase(1000), + fArrALTROL1PhaseEvent(216), + fArrALTROL1PhaseFailEvent(216), + fHnDrift(0x0) +{ + // + // Default ctor + // + SetNameTitle("AliTPCCalibRaw","AliTPCCalibRaw"); + CreateDVhist(); + fFirstTimeBin=850; + fLastTimeBin=1000; +} +//_____________________________________________________________________ +AliTPCCalibRaw::~AliTPCCalibRaw() +{ + // + // dtor + // + delete fHnDrift; +} +//_____________________________________________________________________ +// AliTPCCalibRaw& AliTPCCalibRaw::operator = (const AliTPCCalibRaw &source) +// { +// // +// // assignment operator +// // +// if (&source == this) return *this; +// new (this) AliTPCCalibRaw(source); +// +// return *this; +// } + +//_____________________________________________________________________ +Int_t AliTPCCalibRaw::Update(const Int_t isector, const Int_t iRow, const Int_t iPad, + const Int_t iTimeBin, const Float_t signal) +{ + // + // Data filling method + // + if (iRow<0) return 0; + if (iPad<0) return 0; + if (iTimeBin<0) return 0; + if (!fFirstTimeStamp) fFirstTimeStamp=GetTimeStamp(); + if (fCurrDDLNum!=fPrevDDLNum){ + TVectorF *arr=MakeArrL1PhaseRCU(fCurrDDLNum,kTRUE); + if (arr->GetNrows()<=fNevents) arr->ResizeTo(arr->GetNrows()+1000); + // phase as a position of a quarter time bin + Int_t phase=(Int_t)(GetL1PhaseTB()*4.); +// printf("DDL: %03d, phase: %d (%f))\n",fCurrDDLNum,phase,GetL1PhaseTB()); + //Fill pahse information of current rcu and event + (arr->GetMatrixArray())[fNevents]=phase; + //increase phase counter + ++((fArrCurrentPhaseDist.GetMatrixArray())[phase]); +// printf("RCUId: %03d (%03d), DDL: %03d, sector: %02d\n",fCurrRCUId, fPrevRCUId, fCurrDDLNum, isector); + } + + if ( (iTimeBin>fLastTimeBin) || (iTimeBinFill(x); + Int_t iChannel = fROC->GetRowIndexes(isector)[iRow]+iPad; // global pad position in sector + if (fCurrentChannel==iChannel){ + if (fPadProcessed) return 0; + } else { + fPadProcessed=kFALSE; + fNOkPlus=0; + fNOkMinus=0; + fPeakTimeBin=0; + fLastSignal=0; + } +// Double_t x2[kHnBinsDV]={2,isector,0}; +// fHnDrift->Fill(x2); + + + if (signal>fLastSignal) ++fNOkPlus; + else if(signal=fPeakDetPlus){ + ++fNOkMinus; + if (!fPeakTimeBin) fPeakTimeBin=fLastTimeBinProc; + if ( fNOkMinus>=fPeakDetMinus ) { + Double_t x[kHnBinsDV]={fPeakTimeBin,isector,(fTimeStamp-fFirstTimeStamp)/fNSecTime}; + fHnDrift->Fill(x); + } + } else { + fNOkPlus=0; + fNOkMinus=0; + fPeakTimeBin=0; + fLastSignal=0; + } + + fLastTimeBinProc=iTimeBin; + fLastSignal=TMath::Nint(signal); + fCurrentChannel = iChannel; + return 0; +} +//_____________________________________________________________________ +void AliTPCCalibRaw::ResetEvent() +{ + // + // Reset event counters + // + + fCurrentChannel=-1; + fArrCurrentPhaseDist.Zero(); +} +//_____________________________________________________________________ +void AliTPCCalibRaw::EndEvent() +{ + // + // End event analysis + // + + + //find phase of the current event + Int_t phaseMaxEntries=-1; + Int_t maxEntries=0; + for (Int_t i=0;iGetNrows()<=fNevents) arrF->ResizeTo(arrF->GetNrows()+1000); + if ((arr->GetMatrixArray())[fNevents]!=phaseMaxEntries){ + (arrF->GetMatrixArray())[fNevents]=1; + ++fNFailL1Phase; + } + } + IncrementNevents(); +} +//_____________________________________________________________________ +TH2C *AliTPCCalibRaw::MakeHistL1RCUEvents(Int_t type) +{ + // Create a 2D histo RCU:Events indicating the there was a deviation + // from the mean L1 phase of the event + // + //type: 0=Failures, 1=Phases + TH2C *h2 = new TH2C("hL1FailRCUEvents","L1 Failures;RCU;Event",216,0,216,GetNevents(),0,GetNevents()); + for (Int_t ircu=0;ircu<216;++ircu) { + const TVectorF *v=0; + if (type==0) v=GetALTROL1PhaseFailEventsRCU(ircu); + else if (type==1) v=GetALTROL1PhaseEventsRCU(ircu); + if (!v) continue; + for (Int_t iev=0;ievSetBinContent(ircu+1,iev+1,(*v)(iev)+1); + } + } + return h2; +} +//_____________________________________________________________________ +TH2C *AliTPCCalibRaw::MakeHistL1RCUEventsIROC(Int_t type) +{ + // + // Create a 2D histo RCU:Events indicating the there was a deviation + // from the mean L1 phase of the event + // + TH2C *h2 = new TH2C("hL1FailRCUEventsIROC","L1 Failures IROCs;RCU;Event",72,0,36,GetNevents(),0,GetNevents()); + for (Int_t ircu=0;ircu<72;++ircu) { + const TVectorF *v=0; + if (type==0) v=GetALTROL1PhaseFailEventsRCU(ircu); + else if (type==1) v=GetALTROL1PhaseEventsRCU(ircu); + if (!v) continue; + for (Int_t iev=0;ievSetBinContent(ircu+1,iev+1,(*v)(iev)+1); + } + } + return h2; +} +//_____________________________________________________________________ +TH2C *AliTPCCalibRaw::MakeHistL1RCUEventsOROC(Int_t type) +{ + // + // Create a 2D histo RCU:Events indicating the there was a deviation + // from the mean L1 phase of the event + // + TH2C *h2 = new TH2C("hL1FailRCUEventsOROC","L1 Failures OROCs;RCU;Event",144,0,36,GetNevents(),0,GetNevents()); + for (Int_t ircu=72;ircu<216;++ircu) { + const TVectorF *v=0; + if (type==0) v=GetALTROL1PhaseFailEventsRCU(ircu); + else if (type==1) v=GetALTROL1PhaseEventsRCU(ircu); + if (!v) continue; + for (Int_t iev=0;ievSetBinContent(ircu-72+1,iev+1,(*v)(iev)+1); + } + } + return h2; +} +//_____________________________________________________________________ +void AliTPCCalibRaw::CreateDVhist() +{ + // + // Setup the HnSparse for the drift velocity determination + // + if (fHnDrift) return; + //HnSparse bins + //time bin, roc, time + Int_t bins[kHnBinsDV] = {1000, 72, fNBinsTime}; + Double_t xmin[kHnBinsDV] = {0,0,0}; + Double_t xmax[kHnBinsDV] = {1000,72,fNBinsTime}; + fHnDrift=new THnSparseI("fHnDrift",Form("Drift velocity using last time bin;time bin[#times 100ns];ROC;Time bin [#times %us]",fNSecTime),kHnBinsDV, bins, xmin, xmax); + +} +//_____________________________________________________________________ +void AliTPCCalibRaw::Analyse() +{ + // + // Analyse Data + // + + //resize arrays + fArrALTROL1Phase.ResizeTo(GetNevents()); + for (Int_t ircu=0;ircu<216;++ircu){ + TVectorF *arr=MakeArrL1PhaseRCU(ircu);//MakeArrL1PhaseRCU(ircu); + if (!arr) continue; + TVectorF *arrF=MakeArrL1PhaseFailRCU(ircu); + arr->ResizeTo(GetNevents()); + arrF->ResizeTo(GetNevents()); + } + + //Analyse drift velocity + +} + diff --git a/TPC/AliTPCCalibRaw.h b/TPC/AliTPCCalibRaw.h new file mode 100644 index 00000000000..9b4cdeaa190 --- /dev/null +++ b/TPC/AliTPCCalibRaw.h @@ -0,0 +1,133 @@ +#ifndef ALITPCCALIBALTROHEADERS_H +#define ALITPCCALIBALTROHEADERS_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +//////////////////////////////////////////////////////////////////////////////////////// +// // +// TPC ALTRO Header analysis // +// // +//////////////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include + +#include "AliTPCCalibRawBase.h" +#include "AliTPCCalPad.h" +#include "AliTPCROC.h" + +class TH2C; + +class AliTPCCalibRaw : public AliTPCCalibRawBase { +public: + AliTPCCalibRaw(); + + virtual ~AliTPCCalibRaw(); + + + virtual Int_t Update(const Int_t isector, const Int_t iRow, const Int_t iPad, + const Int_t iTimeBin, const Float_t signal); + virtual void EndEvent(); + virtual void ResetEvent(); + virtual void Analyse(); + + UInt_t GetNFailL1Phase() const {return fNFailL1Phase;} + Int_t GetPeakDetectionMinus() const {return fPeakDetMinus;} + Int_t GetPeakDetectionPlus() const {return fPeakDetPlus;} + + const TVectorF* GetALTROL1PhaseEvents() const {return &fArrALTROL1Phase;} + + const TVectorF *GetALTROL1PhaseEventsRCU(Int_t rcu) const {return (TVectorF*)fArrALTROL1PhaseEvent.At(rcu);} + const TVectorF *GetALTROL1PhaseFailEventsRCU(Int_t rcu) const {return (TVectorF*)fArrALTROL1PhaseFailEvent.At(rcu);} + + void SetRangePeakDetection(Int_t minus, Int_t plus) { fPeakDetMinus=minus; fPeakDetPlus=plus;} + + TH2C *MakeHistL1RCUEvents(Int_t type=0); + TH2C *MakeHistL1RCUEventsIROC(Int_t type=0); + TH2C *MakeHistL1RCUEventsOROC(Int_t type=0); + + const THnSparseI *GetHnDrift() const {return fHnDrift;} +// AliTPCCalPad *CreateCalPadL1Mean(); +// AliTPCCalPad *CreateCalPadL1RMS(); + +private: + Int_t fPeakDetMinus; // Consecutive timebins on rising edge to be regarded as a signal + Int_t fPeakDetPlus; // Consecutive timebins on falling edge to be regarded as a signal + UInt_t fNFailL1Phase; //Number of failures in L1 phase + UInt_t fFirstTimeStamp; //Time Stamp from first event + //binning dv hist + UInt_t fNSecTime; //Number of seconds per bin in time + UInt_t fNBinsTime; //Number of bin in time + //processing information + Bool_t fPadProcessed; //! if last pead has already been filled for the current pad + Int_t fCurrentChannel; //! current channel processed + Int_t fCurrentSector; //! current sector processed + Int_t fLastSector; //! current sector processed + Int_t fCurrentRow; //! current row processed + Int_t fCurrentPad; //! current pad processed + Int_t fLastTimeBinProc; //! last time bin processed + Int_t fPeakTimeBin; //! time bin with local maximum + Int_t fLastSignal; //! last signal processed + Int_t fNOkPlus; //! number of processed time bins fullfilling peak criteria + Int_t fNOkMinus; //! number of processed time bins fullfilling peak criteria +// + //L1 phase stuff + TVectorF fArrCurrentPhaseDist; //!Phase distribution of the current event + TVectorF fArrALTROL1Phase; //Array of L1 phases on an event bases; + TObjArray fArrALTROL1PhaseEvent; //L1 phase for each RCU and event + TObjArray fArrALTROL1PhaseFailEvent; //L1 failure for each RCU and event + //drift velocity stuff + enum {kHnBinsDV=3}; + THnSparseI *fHnDrift; //Histogram last time bin vs. ROC, Time + + TVectorF *MakeArrL1PhaseRCU(Int_t rcu, Bool_t force=kFALSE); + TVectorF *MakeArrL1PhaseFailRCU(Int_t rcu, Bool_t force=kFALSE); + + Bool_t IsEdgePad(Int_t sector, Int_t row, Int_t pad) const; + void CreateDVhist(); + + AliTPCCalibRaw(AliTPCCalibRaw &calib); + AliTPCCalibRaw& operator = (const AliTPCCalibRaw &source); + + ClassDef(AliTPCCalibRaw,1) // Analysis of the Altro header information +}; + +//---------------------- +// Inline Functions +//---------------------- +inline TVectorF *AliTPCCalibRaw::MakeArrL1PhaseRCU(Int_t rcu, Bool_t force) +{ + TVectorF *arr=(TVectorF*)fArrALTROL1PhaseEvent.UncheckedAt(rcu); + if (!arr && force) { + arr=new TVectorF(1000); + fArrALTROL1PhaseEvent.AddAt(arr,rcu); + } + return arr; +} +// +inline TVectorF *AliTPCCalibRaw::MakeArrL1PhaseFailRCU(Int_t rcu, Bool_t force) +{ + TVectorF *arr=(TVectorF*)fArrALTROL1PhaseFailEvent.UncheckedAt(rcu); + if (!arr && force) { + arr=new TVectorF(1000); + fArrALTROL1PhaseFailEvent.AddAt(arr,rcu); + } + return arr; +} +//_____________________________________________________________________ +inline Bool_t AliTPCCalibRaw::IsEdgePad(Int_t sector, Int_t row, Int_t pad) const +{ + // + // return true if pad is on the edge of a row + // + Int_t edge1 = 0; + if ( pad == edge1 ) return kTRUE; + Int_t edge2 = fROC->GetNPads(sector,row)-1; + if ( pad == edge2 ) return kTRUE; + + return kFALSE; +} + + +#endif diff --git a/TPC/TPCRAWda.cxx b/TPC/TPCRAWda.cxx new file mode 100644 index 00000000000..2355ae66886 --- /dev/null +++ b/TPC/TPCRAWda.cxx @@ -0,0 +1,246 @@ +/* +TPC DA for online calibration + +Contact: Jens.Wiechula@cern.ch +Link: +Run Type: +DA Type: +Number of events needed: +Input Files: +Output Files: tpcCalibRaw.root, to be exported to the DAQ FXS +fileId: pulser +Trigger types used: + +*/ + +/* + +TPCRAWda.cxx - calibration algorithm for TPC pulser events + +30/09/2009 J.Wiechula@gsi.de: First implementation. + + +This process reads RAW data from the files provided as command line arguments +and save results in a file (named from RESULT_FILE define - see below). + +*/ + +#define RESULT_FILE "tpcCalibRaw.root" +#define FILE_ID "tpcCalibRaw" +#define MAPPING_FILE "tpcMapping.root" +#define CONFIG_FILE "TPCRAWda.conf" +#define AliDebugLevel() -1 + + +#include +#include "event.h" +#include "monitor.h" +#include +#include + +// +//Root includes +// +#include +#include "TROOT.h" +#include "TPluginManager.h" +#include "TString.h" +#include "TObjString.h" +#include "TDatime.h" +// +//AliRoot includes +// +#include "AliRawReader.h" +#include "AliRawReaderDate.h" +#include "AliTPCmapper.h" +#include "AliTPCROC.h" +#include "AliTPCCalROC.h" +#include "AliTPCCalPad.h" +#include "AliMathBase.h" +#include "TTreeStream.h" +#include "AliLog.h" +#include "TSystem.h" +// #include "AliTPCConfigDA.h" +// +//AMORE +// +#include +// +// TPC calibration algorithm includes +// +#include "AliTPCCalibRaw.h" + +/* Main routine + Arguments: list of DATE raw data files +*/ +int main(int argc, char **argv) { + /* log start of process */ + printf("TPC Pulser DA started - %s\n",__FILE__); + + if (argc<2) { + printf("Wrong number of arguments\n"); + return -1; + } + AliLog::SetClassDebugLevel("AliRawReaderDate",-5); + AliLog::SetClassDebugLevel("AliTPCAltroMapping",-5); + AliLog::SetModuleDebugLevel("RAW",-5); + + gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo", + "*", + "TStreamerInfo", + "RIO", + "TStreamerInfo()"); + + + /* declare monitoring program */ + int i,status; + status=monitorDeclareMp( __FILE__ ); + if (status!=0) { + printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status)); + return -1; + } + + // variables + AliTPCmapper *mapping = 0; // The TPC mapping + char localfile[255]; + unsigned long32 runNb=0; //run number + // configuration options + Bool_t fastDecoding = kFALSE; + // if test setup get parameters from $DAQDA_TEST_DIR + + if (!mapping){ + /* copy locally the mapping file from daq detector config db */ + sprintf(localfile,"./%s",MAPPING_FILE); + status = daqDA_DB_getFile(MAPPING_FILE,localfile); + if (status) { + printf("Failed to get mapping file (%s) from DAQdetDB, status=%d\n", MAPPING_FILE, status); + return -1; + } + + /* open the mapping file and retrieve mapping object */ + TFile *fileMapping = new TFile(MAPPING_FILE, "read"); + mapping = (AliTPCmapper*) fileMapping->Get("tpcMapping"); + delete fileMapping; + } + + if (mapping == 0) { + printf("Failed to get mapping object from %s. ...\n", MAPPING_FILE); + return -1; + } else { + printf("Got mapping object from %s\n", MAPPING_FILE); + } + + // + // DA configuration from configuration file + // + //retrieve configuration file +// sprintf(localfile,"./%s",CONFIG_FILE); +// status = daqDA_DB_getFile(CONFIG_FILE,localfile); +// if (status) { +// printf("Failed to get configuration file (%s) from DAQdetDB, status=%d\n", CONFIG_FILE, status); +// return -1; +// } +// AliTPCConfigDA config(CONFIG_FILE); + + // create calibration object +// AliTPCCalibRaw calibRaw(config.GetConfigurationMap()); // pulser calibration algorithm + AliTPCCalibRaw calibRaw; // pulser calibration algorithm + calibRaw.SetAltroMapping(mapping->GetAltroMapping()); // Use altro mapping we got from daqDetDb + + //===========================// + // loop over RAW data files // + //==========================// + int nevents=0; + for(i=1;ieventRunNb; + // Pulser calibration + AliRawReader *rawReader = new AliRawReaderDate((void*)event); + calibRaw.ProcessEvent(rawReader); + delete rawReader; + + /* free resources */ + free(event); + } + } + + // + // Analyse pulser data and write them to rootfile + // + calibRaw.Analyse(); + printf ("%d events processed\n",nevents); + + TFile * fileTPC = new TFile (RESULT_FILE,"recreate"); + calibRaw.Write("tpcCalibRaw"); + delete fileTPC; + printf("Wrote %s\n",RESULT_FILE); + + /* store the result file on FES */ + + status=daqDA_FES_storeFile(RESULT_FILE,FILE_ID); + if (status) { + status = -2; + } + // + //Send objects to the AMORE DB + // + printf ("AMORE part\n"); + const char *amoreDANameorig=gSystem->Getenv("AMORE_DA_NAME"); + //cheet a little -- temporary solution (hopefully) + // + //currently amoreDA uses the environment variable AMORE_DA_NAME to create the mysql + //table in which the calib objects are stored. This table is dropped each time AmoreDA + //is initialised. This of course makes a problem if we would like to store different + //calibration entries in the AMORE DB. Therefore in each DA which writes to the AMORE DB + //the AMORE_DA_NAME env variable is overwritten. + + gSystem->Setenv("AMORE_DA_NAME","TPC-RAW"); + // + // end cheet + TDatime time; + TObjString info(Form("Run: %u; Date: %s",runNb,time.AsString())); + + amore::da::AmoreDA amoreDA(amore::da::AmoreDA::kSender); + Int_t statusDA=0; + statusDA+=amoreDA.Send("CalibRaw",&calibRaw); + statusDA+=amoreDA.Send("Info",&info); + if ( statusDA!=0 ) + printf("Waring: Failed to write one of the calib objects to the AMORE database\n"); + // reset env var + if (amoreDANameorig) gSystem->Setenv("AMORE_DA_NAME",amoreDANameorig); + + return status; +} diff --git a/TPC/TPCbaseLinkDef.h b/TPC/TPCbaseLinkDef.h index 5e115c5f6c3..0a4610d1110 100644 --- a/TPC/TPCbaseLinkDef.h +++ b/TPC/TPCbaseLinkDef.h @@ -52,6 +52,7 @@ #pragma link C++ class AliTPCCalibPedestal+; #pragma link C++ class AliTPCCalibPulser+; #pragma link C++ class AliTPCCalibCE+; +#pragma link C++ class AliTPCCalibRaw+; #pragma link C++ class AliTPCPreprocessor+; #pragma link C++ class AliTPCPreprocessorOnline+; #pragma link C++ class AliTPCCalibViewer+; diff --git a/TPC/libTPCbase.pkg b/TPC/libTPCbase.pkg index 215f0d72837..d74a8160f79 100644 --- a/TPC/libTPCbase.pkg +++ b/TPC/libTPCbase.pkg @@ -12,6 +12,7 @@ SRCS:= AliSegmentID.cxx AliSegmentArray.cxx AliDigits.cxx AliH2F.cxx \ AliTPCAltroMapping.cxx AliTPCRawStream.cxx AliTPCRawStreamFast.cxx AliTPCRawStreamV3.cxx \ AliTPCLaserTracks.cxx AliTPCSensorTemp.cxx AliTPCSensorTempArray.cxx \ AliTPCCalibRawBase.cxx AliTPCCalibPedestal.cxx AliTPCCalibPulser.cxx AliTPCCalibCE.cxx \ + AliTPCCalibRaw.cxx \ AliTPCPreprocessor.cxx AliTPCPreprocessorOnline.cxx \ AliTPCCalibViewer.cxx AliTPCCalibViewerGUI.cxx \ AliTPCGenDBTemp.cxx AliTPCGenDBConf.cxx \ -- 2.39.3