From 7442bcebece32d1f7283bf6ca8054c6890c1f71e Mon Sep 17 00:00:00 2001 From: marian Date: Fri, 5 Mar 2010 08:46:48 +0000 Subject: [PATCH] - Add merge functionality in raw data calibration classes and virtual interface - fix memory leak - Change loading of laser track values from local file to OCDB - Fix coding violations Jens --- TPC/AliTPCCalibCE.cxx | 240 ++++++++++++++++++++--------------- TPC/AliTPCCalibCE.h | 18 ++- TPC/AliTPCCalibPedestal.cxx | 45 +++++-- TPC/AliTPCCalibPedestal.h | 20 ++- TPC/AliTPCCalibPulser.cxx | 28 +++- TPC/AliTPCCalibPulser.h | 16 ++- TPC/AliTPCCalibQAChecker.cxx | 9 +- TPC/AliTPCCalibQAChecker.h | 18 ++- TPC/AliTPCCalibRaw.cxx | 50 +++++++- TPC/AliTPCCalibRaw.h | 11 +- TPC/AliTPCCalibRawBase.cxx | 14 +- TPC/AliTPCCalibRawBase.h | 25 ++-- TPC/AliTPCConfigDA.cxx | 2 +- TPC/AliTPCConfigDA.h | 9 +- TPC/AliTPCLaserTrack.cxx | 90 ++++++++----- TPC/AliTPCLaserTrack.h | 20 ++- 16 files changed, 405 insertions(+), 210 deletions(-) diff --git a/TPC/AliTPCCalibCE.cxx b/TPC/AliTPCCalibCE.cxx index 31a45bf9674..3b644b25150 100644 --- a/TPC/AliTPCCalibCE.cxx +++ b/TPC/AliTPCCalibCE.cxx @@ -273,6 +273,7 @@ END_HTML */ #include #include #include +#include //AliRoot includes #include "AliLog.h" @@ -922,7 +923,7 @@ void AliTPCCalibCE::ProcessPad() if ( (fNevents == 0) || (fOldRunNumber!=fRunNumber) ) return; // return because we don't have Time0 info for the CE yet UpdateCETimeRef(); // update the time refenrence for the current sector - if ( fCurrentCETimeRef==0 ) return; //return if we don't have time 0 info, eg if only one side has laser + if ( fCurrentCETimeRef<1e-30 ) return; //return if we don't have time 0 info, eg if only one side has laser TVectorD param(3); Float_t qSum; FindCESignal(param, qSum, maxima); @@ -1056,11 +1057,11 @@ void AliTPCCalibCE::EndEvent() //set values for temporary roc calibration class if ( iSec < 36 ) { calIroc->SetValue(iChannel, time); - if ( time == 0 ) calIrocOutliers.SetValue(iChannel,1); + if ( TMath::Abs(time) < 1e-30 ) calIrocOutliers.SetValue(iChannel,1); } else { calOroc->SetValue(iChannel, time); - if ( time == 0 ) calOrocOutliers.SetValue(iChannel,1); + if ( TMath::Abs(time) < 1e-30 ) calOrocOutliers.SetValue(iChannel,1); } if ( (fNevents>0) && (fOldRunNumber==fRunNumber) ) @@ -1503,117 +1504,150 @@ void AliTPCCalibCE::ResetPad() fPadNoise = -1; } //_____________________________________________________________________ -void AliTPCCalibCE::Merge(AliTPCCalibCE *ce) +void AliTPCCalibCE::Merge(AliTPCCalibCE * const ce) { - // - // Merge ce to the current AliTPCCalibCE - // - - //merge histograms - for (Int_t iSec=0; iSec<72; ++iSec){ - TH2S *hRefQmerge = ce->GetHistoQ(iSec); - TH2S *hRefT0merge = ce->GetHistoT0(iSec); - TH2S *hRefRMSmerge = ce->GetHistoRMS(iSec); - - - if ( hRefQmerge ){ - TDirectory *dir = hRefQmerge->GetDirectory(); hRefQmerge->SetDirectory(0); - TH2S *hRefQ = GetHistoQ(iSec); - if ( hRefQ ) hRefQ->Add(hRefQmerge); - else { - TH2S *hist = new TH2S(*hRefQmerge); - hist->SetDirectory(0); - fHistoQArray.AddAt(hist, iSec); - } - hRefQmerge->SetDirectory(dir); - } - if ( hRefT0merge ){ - TDirectory *dir = hRefT0merge->GetDirectory(); hRefT0merge->SetDirectory(0); - TH2S *hRefT0 = GetHistoT0(iSec); - if ( hRefT0 ) hRefT0->Add(hRefT0merge); - else { - TH2S *hist = new TH2S(*hRefT0merge); - hist->SetDirectory(0); - fHistoT0Array.AddAt(hist, iSec); - } - hRefT0merge->SetDirectory(dir); - } - if ( hRefRMSmerge ){ - TDirectory *dir = hRefRMSmerge->GetDirectory(); hRefRMSmerge->SetDirectory(0); - TH2S *hRefRMS = GetHistoRMS(iSec); - if ( hRefRMS ) hRefRMS->Add(hRefRMSmerge); - else { - TH2S *hist = new TH2S(*hRefRMSmerge); - hist->SetDirectory(0); - fHistoRMSArray.AddAt(hist, iSec); - } - hRefRMSmerge->SetDirectory(dir); - } - + // + // Merge ce to the current AliTPCCalibCE + // + + //merge histograms + for (Int_t iSec=0; iSec<72; ++iSec){ + TH2S *hRefQmerge = ce->GetHistoQ(iSec); + TH2S *hRefT0merge = ce->GetHistoT0(iSec); + TH2S *hRefRMSmerge = ce->GetHistoRMS(iSec); + + + if ( hRefQmerge ){ + TDirectory *dir = hRefQmerge->GetDirectory(); hRefQmerge->SetDirectory(0); + TH2S *hRefQ = GetHistoQ(iSec); + if ( hRefQ ) hRefQ->Add(hRefQmerge); + else { + TH2S *hist = new TH2S(*hRefQmerge); + hist->SetDirectory(0); + fHistoQArray.AddAt(hist, iSec); + } + hRefQmerge->SetDirectory(dir); } - + if ( hRefT0merge ){ + TDirectory *dir = hRefT0merge->GetDirectory(); hRefT0merge->SetDirectory(0); + TH2S *hRefT0 = GetHistoT0(iSec); + if ( hRefT0 ) hRefT0->Add(hRefT0merge); + else { + TH2S *hist = new TH2S(*hRefT0merge); + hist->SetDirectory(0); + fHistoT0Array.AddAt(hist, iSec); + } + hRefT0merge->SetDirectory(dir); + } + if ( hRefRMSmerge ){ + TDirectory *dir = hRefRMSmerge->GetDirectory(); hRefRMSmerge->SetDirectory(0); + TH2S *hRefRMS = GetHistoRMS(iSec); + if ( hRefRMS ) hRefRMS->Add(hRefRMSmerge); + else { + TH2S *hist = new TH2S(*hRefRMSmerge); + hist->SetDirectory(0); + fHistoRMSArray.AddAt(hist, iSec); + } + hRefRMSmerge->SetDirectory(dir); + } + + } + // merge time information - - - Int_t nCEevents = ce->GetNeventsProcessed(); - for (Int_t iSec=0; iSec<72; ++iSec){ - TObjArray *arrPol1CE = ce->GetParamArrayPol1(iSec); - TObjArray *arrPol2CE = ce->GetParamArrayPol2(iSec); - TVectorF *vMeanTimeCE = ce->GetTMeanEvents(iSec); - TVectorF *vMeanQCE = ce->GetQMeanEvents(iSec); - - TObjArray *arrPol1 = 0x0; - TObjArray *arrPol2 = 0x0; - TVectorF *vMeanTime = 0x0; - TVectorF *vMeanQ = 0x0; - - //resize arrays - if ( arrPol1CE && arrPol2CE ){ - arrPol1 = GetParamArrayPol1(iSec,kTRUE); - arrPol2 = GetParamArrayPol2(iSec,kTRUE); - arrPol1->Expand(fNevents+nCEevents); - arrPol2->Expand(fNevents+nCEevents); - } - if ( vMeanTimeCE && vMeanQCE ){ - vMeanTime = GetTMeanEvents(iSec,kTRUE); - vMeanQ = GetQMeanEvents(iSec,kTRUE); - vMeanTime->ResizeTo(fNevents+nCEevents); - vMeanQ->ResizeTo(fNevents+nCEevents); - } - - - for (Int_t iEvent=0; iEventUncheckedAt(iEvent)); - TVectorD *paramPol2 = (TVectorD*)(arrPol2CE->UncheckedAt(iEvent)); - if ( paramPol1 && paramPol2 ){ - GetParamArrayPol1(iSec,kTRUE)->AddAt(new TVectorD(*paramPol1), fNevents+iEvent); - GetParamArrayPol2(iSec,kTRUE)->AddAt(new TVectorD(*paramPol2), fNevents+iEvent); - } - } - if ( vMeanTimeCE && vMeanQCE ){ - vMeanTime->GetMatrixArray()[fNevents+iEvent]=vMeanTimeCE->GetMatrixArray()[iEvent]; - vMeanQ->GetMatrixArray()[fNevents+iEvent]=vMeanQCE->GetMatrixArray()[iEvent]; - } - } + + + Int_t nCEevents = ce->GetNeventsProcessed(); + for (Int_t iSec=0; iSec<72; ++iSec){ + TObjArray *arrPol1CE = ce->GetParamArrayPol1(iSec); + TObjArray *arrPol2CE = ce->GetParamArrayPol2(iSec); + TVectorF *vMeanTimeCE = ce->GetTMeanEvents(iSec); + TVectorF *vMeanQCE = ce->GetQMeanEvents(iSec); + + TObjArray *arrPol1 = 0x0; + TObjArray *arrPol2 = 0x0; + TVectorF *vMeanTime = 0x0; + TVectorF *vMeanQ = 0x0; + + //resize arrays + if ( arrPol1CE && arrPol2CE ){ + arrPol1 = GetParamArrayPol1(iSec,kTRUE); + arrPol2 = GetParamArrayPol2(iSec,kTRUE); + arrPol1->Expand(fNevents+nCEevents); + arrPol2->Expand(fNevents+nCEevents); + } + if ( vMeanTimeCE && vMeanQCE ){ + vMeanTime = GetTMeanEvents(iSec,kTRUE); + vMeanQ = GetQMeanEvents(iSec,kTRUE); + vMeanTime->ResizeTo(fNevents+nCEevents); + vMeanQ->ResizeTo(fNevents+nCEevents); + } + + + for (Int_t iEvent=0; iEventUncheckedAt(iEvent)); + TVectorD *paramPol2 = (TVectorD*)(arrPol2CE->UncheckedAt(iEvent)); + if ( paramPol1 && paramPol2 ){ + GetParamArrayPol1(iSec,kTRUE)->AddAt(new TVectorD(*paramPol1), fNevents+iEvent); + GetParamArrayPol2(iSec,kTRUE)->AddAt(new TVectorD(*paramPol2), fNevents+iEvent); + } + } + if ( vMeanTimeCE && vMeanQCE ){ + vMeanTime->GetMatrixArray()[fNevents+iEvent]=vMeanTimeCE->GetMatrixArray()[iEvent]; + vMeanQ->GetMatrixArray()[fNevents+iEvent]=vMeanQCE->GetMatrixArray()[iEvent]; + } } + } + + + + const TVectorD& eventTimes = ce->fVEventTime; + const TVectorD& eventIds = ce->fVEventNumber; + const TVectorF& time0SideA = ce->fVTime0SideA; + const TVectorF& time0SideC = ce->fVTime0SideC; + fVEventTime.ResizeTo(fNevents+nCEevents); + fVEventNumber.ResizeTo(fNevents+nCEevents); + fVTime0SideA.ResizeTo(fNevents+nCEevents); + fVTime0SideC.ResizeTo(fNevents+nCEevents); + + for (Int_t iEvent=0; iEventGetEventTimes(); - TVectorD* eventIds = ce->GetEventIds(); - fVEventTime.ResizeTo(fNevents+nCEevents); - fVEventNumber.ResizeTo(fNevents+nCEevents); + TIter next(list); + AliTPCCalibCE *ce=0; + TObject *o=0; - for (Int_t iEvent=0; iEventGetMatrixArray()[iEvent]; - Double_t evId = eventIds->GetMatrixArray()[iEvent]; - fVEventTime.GetMatrixArray()[fNevents+iEvent] = evTime; - fVEventNumber.GetMatrixArray()[fNevents+iEvent] = evId; + while ( (o=next()) ){ + ce=dynamic_cast(o); + if (ce){ + Merge(ce); + ++nmerged; } - fNevents+=nCEevents; //increase event counter + } + return nmerged; } + //_____________________________________________________________________ TGraph *AliTPCCalibCE::MakeGraphTimeCE(Int_t sector, Int_t xVariable, Int_t fitType, Int_t fitParameter) { diff --git a/TPC/AliTPCCalibCE.h b/TPC/AliTPCCalibCE.h index 83fdece1933..63038264981 100644 --- a/TPC/AliTPCCalibCE.h +++ b/TPC/AliTPCCalibCE.h @@ -24,6 +24,7 @@ class AliTPCRawStream; class AliTPCRawStreamFast; class TGraph; class TMap; +class TCollection; struct eventHeaderStruct; @@ -80,8 +81,8 @@ public: TVectorF* GetTMeanEvents(Int_t sector, Bool_t force=kFALSE); TVectorF* GetQMeanEvents(Int_t sector, Bool_t force=kFALSE); - TVectorD* GetEventTimes() { return &fVEventTime; } - TVectorD* GetEventIds() { return &fVEventNumber; } + const TVectorD* GetEventTimes() const { return &fVEventTime; } + const TVectorD* GetEventIds() const { return &fVEventNumber; } // void SetRangeRefQ (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsQ = nBins; fXminQ = xMin; fXmaxQ = xMax; } //Set range for Q reference histograms @@ -95,7 +96,7 @@ public: // void SetEventInfo(UInt_t runNumber,UInt_t timestamp, UInt_t eventId){ fRunNumber=runNumber; fTimeStamp=timestamp; fEventId=eventId;} // - void SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;} + void SetPedestalDatabase(AliTPCCalPad * const pedestalTPC, AliTPCCalPad * const padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;} void SetIsZeroSuppressed(Bool_t zs=kTRUE) { fIsZeroSuppressed=zs; } void SetSecRejectRatio(Float_t ratio) { fSecRejectRatio=ratio; } //Getters @@ -110,10 +111,15 @@ public: Float_t GetPeakIntegralPlus() const {return fPeakIntPlus;} - void Merge(AliTPCCalibCE *ce); + void Merge(AliTPCCalibCE * const ce); + virtual Long64_t Merge(TCollection * const list); TGraph *MakeGraphTimeCE(Int_t sector, Int_t xVariable=0, Int_t fitType=0, Int_t fitParameter=0); - + +protected: + virtual void EndEvent(); + virtual void ResetEvent(); + private: // reference histogram ranges Int_t fNbinsT0; // Number of bins for T0 reference histogram @@ -213,8 +219,6 @@ private: TObjArray* GetParamArray(Int_t sector, TObjArray *arr, Bool_t force=kFALSE) const; - virtual void EndEvent(); - virtual void ResetEvent(); void ResetPad(); void ProcessPad(); //debug diff --git a/TPC/AliTPCCalibPedestal.cxx b/TPC/AliTPCCalibPedestal.cxx index 74825e22e14..e287e979f4c 100644 --- a/TPC/AliTPCCalibPedestal.cxx +++ b/TPC/AliTPCCalibPedestal.cxx @@ -524,7 +524,7 @@ AliTPCCalROC* AliTPCCalibPedestal::GetCalRocRMS(Int_t sector, Bool_t force) //_____________________________________________________________________ -void AliTPCCalibPedestal::Merge(AliTPCCalibPedestal *ped) +void AliTPCCalibPedestal::Merge(AliTPCCalibPedestal * const ped) { // // Merge reference histograms of sig to the current AliTPCCalibSignal @@ -533,25 +533,48 @@ void AliTPCCalibPedestal::Merge(AliTPCCalibPedestal *ped) // merge histograms for (Int_t iSec=0; iSec<72; ++iSec){ TH2F *hRefPedMerge = ped->GetHistoPedestal(iSec); - + if ( hRefPedMerge ){ TDirectory *dir = hRefPedMerge->GetDirectory(); hRefPedMerge->SetDirectory(0); TH2F *hRefPed = GetHistoPedestal(iSec); if ( hRefPed ) hRefPed->Add(hRefPedMerge); else { - TH2F *hist = new TH2F(*hRefPedMerge); - hist->SetDirectory(0); - fHistoPedestalArray.AddAt(hist, iSec); + TH2F *hist = new TH2F(*hRefPedMerge); + hist->SetDirectory(0); + fHistoPedestalArray.AddAt(hist, iSec); } hRefPedMerge->SetDirectory(dir); } } - + // merge array // ... - + } +//_____________________________________________________________________ +Long64_t AliTPCCalibPedestal::Merge(TCollection * const list) +{ + // + // Merge all objects of this type in list + // + + Long64_t nmerged=1; + + TIter next(list); + AliTPCCalibPedestal *ce=0; + TObject *o=0; + + while ( (o=next()) ){ + ce=dynamic_cast(o); + if (ce){ + Merge(ce); + ++nmerged; + } + } + + return nmerged; +} //_____________________________________________________________________ void AliTPCCalibPedestal::Analyse() @@ -567,7 +590,7 @@ void AliTPCCalibPedestal::Analyse() TH1F *hChannel=new TH1F("hChannel","hChannel",nbinsAdc,fAdcMin,fAdcMax); - Float_t *array_hP=0; + Float_t *arrayhP=0; for (Int_t iSec=0; iSec<72; ++iSec){ TH2F *hP = GetHistoPedestal(iSec); @@ -578,14 +601,14 @@ void AliTPCCalibPedestal::Analyse() AliTPCCalROC *rocMean = GetCalRocMean(iSec,kTRUE); AliTPCCalROC *rocRMS = GetCalRocRMS(iSec,kTRUE); - array_hP = hP->GetArray(); + arrayhP = hP->GetArray(); UInt_t nChannels = fROC->GetNChannels(iSec); for (UInt_t iChannel=0; iChannelSetValue(iChannel,param[1]); rocSigma->SetValue(iChannel,param[2]); //calculate mean and RMS using a truncated means - hChannel->Set(nbinsAdc+2,array_hP+offset-1); + hChannel->Set(nbinsAdc+2,arrayhP+offset-1); hChannel->SetEntries(param[3]); param[1]=0; param[2]=0; diff --git a/TPC/AliTPCCalibPedestal.h b/TPC/AliTPCCalibPedestal.h index 29c18469b31..44170bd65b8 100644 --- a/TPC/AliTPCCalibPedestal.h +++ b/TPC/AliTPCCalibPedestal.h @@ -3,6 +3,12 @@ /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ +///////////////////////////////////////////////////////////////////////////////////////// +// // +// Implementation of the TPC pedestal calibration // +// // +///////////////////////////////////////////////////////////////////////////////////////// + #include #include "AliTPCCalibRawBase.h" @@ -34,13 +40,13 @@ public: // 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 - const TObjArray* GetCalPadSigma(){return &fCalRocArraySigma;} // get calibration object + const TObjArray* GetCalPadPedestal() const {return &fCalRocArrayPedestal;} // get calibration object + const TObjArray* GetCalPadSigma() const {return &fCalRocArraySigma;} // get calibration object AliTPCCalROC* GetCalRocMean (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector AliTPCCalROC* GetCalRocRMS(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector - const TObjArray* GetCalPadMean (){return &fCalRocArrayMean;} // get calibration object - const TObjArray* GetCalPadRMS(){return &fCalRocArrayRMS;} // get calibration object + const TObjArray* GetCalPadMean() const {return &fCalRocArrayMean;} // get calibration object + const TObjArray* GetCalPadRMS() const {return &fCalRocArrayRMS;} // get calibration object TH2F* GetHistoPedestal (Int_t sector, Bool_t force=kFALSE); // get refernce histogram // @@ -56,8 +62,9 @@ public: void SetRangeAdc (Int_t aMin, Int_t aMax){ fAdcMin=aMin; fAdcMax=aMax; } // Set adc range for the pedestal calibration void SetAnalysisTruncationRange(Float_t down, Float_t up) {fAnaMeanDown=down; fAnaMeanUp=up;} //Set range for truncated mean analysis of the channel information - void Merge(AliTPCCalibPedestal *ped); - + void Merge(AliTPCCalibPedestal * const ped); + virtual Long64_t Merge(TCollection * const list); + Bool_t TestEvent(); // Test the fast approach to fill histogram - used for test purposes private: @@ -85,7 +92,6 @@ private: AliTPCCalROC* GetCalRoc(Int_t sector, TObjArray* arr, Bool_t force); -public: ClassDef(AliTPCCalibPedestal, 7) // Implementation of the TPC pedestal and noise calibration }; diff --git a/TPC/AliTPCCalibPulser.cxx b/TPC/AliTPCCalibPulser.cxx index 79d9b88bb89..1356fc28c6a 100644 --- a/TPC/AliTPCCalibPulser.cxx +++ b/TPC/AliTPCCalibPulser.cxx @@ -1005,7 +1005,7 @@ Bool_t AliTPCCalibPulser::IsEdgePad(Int_t sector, Int_t row, Int_t pad) return kFALSE; } //_____________________________________________________________________ -void AliTPCCalibPulser::Merge(AliTPCCalibPulser *sig) +void AliTPCCalibPulser::Merge(AliTPCCalibPulser * const sig) { // // Merge reference histograms of sig to the current AliTPCCalibPulser @@ -1063,6 +1063,32 @@ void AliTPCCalibPulser::Merge(AliTPCCalibPulser *sig) sig->fHMeanTimeSector->SetDirectory(dir); } } + + +//_____________________________________________________________________ +Long64_t AliTPCCalibPulser::Merge(TCollection * const list) +{ + // + // Merge all objects of this type in list + // + + Long64_t nmerged=1; + + TIter next(list); + AliTPCCalibPulser *ce=0; + TObject *o=0; + + while ( (o=next()) ){ + ce=dynamic_cast(o); + if (ce){ + Merge(ce); + ++nmerged; + } + } + + return nmerged; +} + //_____________________________________________________________________ void AliTPCCalibPulser::Analyse() { diff --git a/TPC/AliTPCCalibPulser.h b/TPC/AliTPCCalibPulser.h index 69c5f199da8..365adcdb320 100644 --- a/TPC/AliTPCCalibPulser.h +++ b/TPC/AliTPCCalibPulser.h @@ -75,19 +75,25 @@ public: void SetIsZeroSuppressed(Bool_t zs=kTRUE){ fIsZeroSuppressed=zs;} - void SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;} - void SetOutliers(AliTPCCalPad *outliers) {fOutliers = outliers;} + void SetPedestalDatabase(AliTPCCalPad * const pedestalTPC, AliTPCCalPad * const padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;} + void SetOutliers(AliTPCCalPad * const outliers) {fOutliers = outliers;} Bool_t GetIsZeroSupperssed() const { return fIsZeroSuppressed; } Float_t GetPeakIntegralMinus() const {return fPeakIntMinus;} Float_t GetPeakIntegralPlus() const {return fPeakIntPlus;} - void Merge(AliTPCCalibPulser *sig); + void Merge(AliTPCCalibPulser * const sig); + virtual Long64_t Merge(TCollection * const list); + // // Test functions TObjArray* TestBinning(); +protected: + virtual void ResetEvent(); + virtual void EndEvent(); + private: // reference histogram ranges Int_t fNbinsT0; // Number of bins for T0 reference histogram @@ -169,10 +175,6 @@ private: TVectorF* GetPadRMSEvent(Int_t sector, Bool_t force=kFALSE); TVectorF* GetPadPedestalEvent(Int_t sector, Bool_t force=kFALSE); -protected: - virtual void ResetEvent(); - virtual void EndEvent(); - ClassDef(AliTPCCalibPulser,5) //Implementation of the TPC pulser calibration }; diff --git a/TPC/AliTPCCalibQAChecker.cxx b/TPC/AliTPCCalibQAChecker.cxx index 0ad209b8127..dff44ea547a 100644 --- a/TPC/AliTPCCalibQAChecker.cxx +++ b/TPC/AliTPCCalibQAChecker.cxx @@ -104,6 +104,7 @@ AliTPCCalibQAChecker::~AliTPCCalibQAChecker() if (fHistRep) delete fHistRep; if (fIterSubCheckers) delete fIterSubCheckers; if (fArrAlarmDescriptions) delete fArrAlarmDescriptions; + if (fArrSubCheckers) delete fArrSubCheckers; } //_________________________________________________________________________ void AliTPCCalibQAChecker::AddSubChecker(AliTPCCalibQAChecker *alarm) @@ -405,7 +406,7 @@ void AliTPCCalibQAChecker::Draw(Option_t *option) if (fHistRep) {DrawRepresentationHist(option); return;} } //_________________________________________________________________________ -void AliTPCCalibQAChecker::Print(Option_t *option) const +void AliTPCCalibQAChecker::Print(Option_t * const option) const { // // print the quality status. If we have sub checkers print recursively @@ -471,7 +472,7 @@ void AliTPCCalibQAChecker::SetQualityDescription(const char* text, const Quality const AliTPCCalibQAChecker* AliTPCCalibQAChecker::GetSubChecker(const char* name, Bool_t recursive) const { // - // + // Return subnode with 'name' // TString sname(name); if (sname==GetName()) return this; @@ -602,7 +603,7 @@ const char* AliTPCCalibQAChecker::QualityDescription(const QualityFlag_t quality Int_t AliTPCCalibQAChecker::DrawInPad(TVirtualPad *pad, Int_t sub) { // - // + // Draw recursively in 'pad' // if (fArrSubCheckers){ @@ -650,7 +651,7 @@ void AliTPCCalibQAChecker::DrawSubNodes(Option_t */*option*/) mother->Update(); } //_________________________________________________________________________ -void AliTPCCalibQAChecker::DrawRepresentationHist(Option_t *option) +void AliTPCCalibQAChecker::DrawRepresentationHist(const Option_t *option) { // // Draw the representation histogram diff --git a/TPC/AliTPCCalibQAChecker.h b/TPC/AliTPCCalibQAChecker.h index 28aa91f073c..bb71bf417b2 100644 --- a/TPC/AliTPCCalibQAChecker.h +++ b/TPC/AliTPCCalibQAChecker.h @@ -1,8 +1,14 @@ -#ifndef AliTPCCalibQAChecker_H -#define AliTPCCalibQAChecker_H +#ifndef ALITPCCALIBQACHECKER_H +#define ALITPCCALIBQACHECKER_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ +///////////////////////////////////////////////////////////////////////////////////////// +// // +// QA checking class // +// // +///////////////////////////////////////////////////////////////////////////////////////// + #include #include #include @@ -29,7 +35,7 @@ public: void SetTreeChecker(TTree* &tree) {fTreePtr=&tree;} void SetHistChecker(TH1* &hist) {fHistPtr=&hist;} void SetGraphChecker(TGraph* &graph) {fGraphPtr=&graph;} - void SetNumberChecker(Double_t &number) {fNumberPtr=&number;} + void SetNumberChecker(Double_t & number) {fNumberPtr=&number;} const AliTPCCalibQAChecker* GetSubChecker(const char* name, Bool_t recursive=kTRUE) const; AliTPCCalibQAChecker* NextSubChecker(); @@ -121,14 +127,14 @@ public: // Int_t DrawInPad(TVirtualPad *pad, Int_t sub=1); void DrawSubNodes(Option_t *option); - void DrawRepresentationHist(Option_t *option); + void DrawRepresentationHist(const Option_t *option); void AddQualityLines(TH1 *hist); // AliTPCCalibQAChecker(const AliTPCCalibQAChecker &cfg); AliTPCCalibQAChecker& operator = (const AliTPCCalibQAChecker &cfg); QualityFlag_t GetQuality(Double_t value) const; - QualityFlag_t GetQuality(Int_t n, Double_t *arr) const; + QualityFlag_t GetQuality(Int_t n, const Double_t *arr) const; ClassDef(AliTPCCalibQAChecker,1); }; @@ -153,7 +159,7 @@ inline AliTPCCalibQAChecker::QualityFlag_t AliTPCCalibQAChecker::GetQuality(Doub return quality; } //_________________________________________________________________________ -inline AliTPCCalibQAChecker::QualityFlag_t AliTPCCalibQAChecker::GetQuality(Int_t n, Double_t *arr) const +inline AliTPCCalibQAChecker::QualityFlag_t AliTPCCalibQAChecker::GetQuality(Int_t n, const Double_t *arr) const { // // check quality of an array diff --git a/TPC/AliTPCCalibRaw.cxx b/TPC/AliTPCCalibRaw.cxx index 57f1f4c5708..9ecbc6c8c6f 100644 --- a/TPC/AliTPCCalibRaw.cxx +++ b/TPC/AliTPCCalibRaw.cxx @@ -609,13 +609,13 @@ TGraph* AliTPCCalibRaw::MakeGraphOccupancy(const Int_t type, const Int_t xType) return gr; } //_____________________________________________________________________ -TGraph* AliTPCCalibRaw::MakeGraphNoiseEvents() -{ - // +// TGraph* AliTPCCalibRaw::MakeGraphNoiseEvents() +// { // + // Not implemented for the moment // - return 0; -} +// return 0; +// } //_____________________________________________________________________ TCanvas* AliTPCCalibRaw::MakeCanvasOccupancy(const Int_t xType, Bool_t sen) { @@ -652,3 +652,43 @@ TCanvas* AliTPCCalibRaw::MakeCanvasOccupancy(const Int_t xType, Bool_t sen) return c; } +//_____________________________________________________________________ +void AliTPCCalibRaw::Merge(AliTPCCalibRaw * const sig) +{ + // + // Merge sig with this instance + // + + if (!sig) return; + + //Add last time bin distribution histogram + fHnDrift->Add(sig->fHnDrift); + + //Add occupancy data + +} + +//_____________________________________________________________________ +Long64_t AliTPCCalibRaw::Merge(TCollection * const list) +{ + // + // Merge all objects of this type in list + // + + Long64_t nmerged=1; + + TIter next(list); + AliTPCCalibRaw *ce=0; + TObject *o=0; + + while ( (o=next()) ){ + ce=dynamic_cast(o); + if (ce){ + Merge(ce); + ++nmerged; + } + } + + return nmerged; +} + diff --git a/TPC/AliTPCCalibRaw.h b/TPC/AliTPCCalibRaw.h index f45a6b25271..004d1793c25 100644 --- a/TPC/AliTPCCalibRaw.h +++ b/TPC/AliTPCCalibRaw.h @@ -1,5 +1,5 @@ -#ifndef ALITPCCALIBALTROHEADERS_H -#define ALITPCCALIBALTROHEADERS_H +#ifndef ALITPCCALIBRAW_H +#define ALITPCCALIBRAW_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ @@ -66,13 +66,16 @@ public: TVectorF *MakeVectL1PhaseDist(); //Occupancy info TGraph* MakeGraphOccupancy(const Int_t type=0, const Int_t xType=0); - TGraph* MakeGraphNoiseEvents(); +// TGraph* MakeGraphNoiseEvents(); TCanvas* MakeCanvasOccupancy(const Int_t xType=1, Bool_t sen=kFALSE); const THnSparseI *GetHnDrift() const {return fHnDrift;} // AliTPCCalPad *CreateCalPadL1Mean(); // AliTPCCalPad *CreateCalPadL1RMS(); + void Merge(AliTPCCalibRaw * const sig); + virtual Long64_t Merge(TCollection * const list); + 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 @@ -120,7 +123,7 @@ private: Bool_t IsEdgePad(Int_t sector, Int_t row, Int_t pad) const; void CreateDVhist(); - AliTPCCalibRaw(AliTPCCalibRaw &calib); + AliTPCCalibRaw(const AliTPCCalibRaw &calib); AliTPCCalibRaw& operator = (const AliTPCCalibRaw &source); ClassDef(AliTPCCalibRaw,3) // Analysis of the Altro header information diff --git a/TPC/AliTPCCalibRawBase.cxx b/TPC/AliTPCCalibRawBase.cxx index f9ab451f48f..03219ffffd4 100644 --- a/TPC/AliTPCCalibRawBase.cxx +++ b/TPC/AliTPCCalibRawBase.cxx @@ -120,7 +120,7 @@ AliTPCCalibRawBase::~AliTPCCalibRawBase() return *this; } //_____________________________________________________________________ -Bool_t AliTPCCalibRawBase::ProcessEventFast(AliTPCRawStreamFast *rawStreamFast) +Bool_t AliTPCCalibRawBase::ProcessEventFast(AliTPCRawStreamFast * const rawStreamFast) { // // Event Processing loop - AliTPCRawStreamFast @@ -150,7 +150,7 @@ Bool_t AliTPCCalibRawBase::ProcessEventFast(AliTPCRawStreamFast *rawStreamFast) return withInput; } //_____________________________________________________________________ -Bool_t AliTPCCalibRawBase::ProcessEventFast(AliRawReader *rawReader) +Bool_t AliTPCCalibRawBase::ProcessEventFast(AliRawReader * const rawReader) { // // Event processing loop - AliRawReader @@ -167,7 +167,7 @@ Bool_t AliTPCCalibRawBase::ProcessEventFast(AliRawReader *rawReader) return res; } //_____________________________________________________________________ -Bool_t AliTPCCalibRawBase::ProcessEvent(AliTPCRawStreamV3 *rawStreamV3) +Bool_t AliTPCCalibRawBase::ProcessEvent(AliTPCRawStreamV3 * const rawStreamV3) { // // Event Processing loop - AliTPCRawStreamV3 @@ -216,7 +216,7 @@ Bool_t AliTPCCalibRawBase::ProcessEvent(AliTPCRawStreamV3 *rawStreamV3) return withInput; } //_____________________________________________________________________ -Bool_t AliTPCCalibRawBase::ProcessEvent(AliRawReader *rawReader) +Bool_t AliTPCCalibRawBase::ProcessEvent(AliRawReader * const rawReader) { // // Event processing loop - AliRawReader @@ -233,7 +233,7 @@ Bool_t AliTPCCalibRawBase::ProcessEvent(AliRawReader *rawReader) return res; } //_____________________________________________________________________ -Bool_t AliTPCCalibRawBase::ProcessEvent(AliTPCRawStream *rawStream) +Bool_t AliTPCCalibRawBase::ProcessEvent(AliTPCRawStream * const rawStream) { // // Event Processing loop - AliTPCRawStream @@ -270,7 +270,7 @@ Bool_t AliTPCCalibRawBase::ProcessEvent(AliTPCRawStream *rawStream) return withInput; } //_____________________________________________________________________ -Bool_t AliTPCCalibRawBase::ProcessEventOld(AliRawReader *rawReader) +Bool_t AliTPCCalibRawBase::ProcessEventOld(AliRawReader * const rawReader) { // // Event processing loop - AliRawReader @@ -287,7 +287,7 @@ Bool_t AliTPCCalibRawBase::ProcessEventOld(AliRawReader *rawReader) return ProcessEvent(&rawStream); } //_____________________________________________________________________ -Bool_t AliTPCCalibRawBase::ProcessEvent(eventHeaderStruct *event) +Bool_t AliTPCCalibRawBase::ProcessEvent(eventHeaderStruct * const event) { // // Event processing loop - date event diff --git a/TPC/AliTPCCalibRawBase.h b/TPC/AliTPCCalibRawBase.h index c355cccd005..7528cfe12c4 100644 --- a/TPC/AliTPCCalibRawBase.h +++ b/TPC/AliTPCCalibRawBase.h @@ -20,6 +20,7 @@ class AliTPCRawStreamV3; class AliTPCRawStream; class AliTPCROC; class TTreeSRedirector; +class TCollection; struct eventHeaderStruct; class AliTPCCalibRawBase : public TNamed { @@ -34,17 +35,17 @@ public: virtual ~AliTPCCalibRawBase(); - Bool_t ProcessEventFast(AliTPCRawStreamFast *rawStreamFast); - Bool_t ProcessEventFast(AliRawReader *rawReader); + Bool_t ProcessEventFast(AliTPCRawStreamFast * const rawStreamFast); + Bool_t ProcessEventFast(AliRawReader * const rawReader); //uses the new decoder which is compatible with the new altro format - Bool_t ProcessEvent(AliTPCRawStreamV3 *rawStreamV3); - Bool_t ProcessEvent(AliRawReader *rawReader); - Bool_t ProcessEvent(eventHeaderStruct *event); + Bool_t ProcessEvent(AliTPCRawStreamV3 * const rawStreamV3); + Bool_t ProcessEvent(AliRawReader * const rawReader); + Bool_t ProcessEvent(eventHeaderStruct * const event); //For using the old decoder use the following functions - Bool_t ProcessEvent(AliTPCRawStream *rawStream); - Bool_t ProcessEventOld(AliRawReader *rawReader); + Bool_t ProcessEvent(AliTPCRawStream * const rawStream); + Bool_t ProcessEventOld(AliRawReader * const rawReader); virtual Int_t Update(const Int_t /*isector*/, const Int_t /*iRow*/, const Int_t /*iPad*/, const Int_t /*iTimeBin*/, const Float_t /*signal*/) { return 0; } @@ -53,7 +54,9 @@ public: const Int_t /*length*/, const UInt_t /*startTimeBin*/, const UShort_t* /*signal*/) {return; } virtual void Analyse(){ return; } - //Setters + virtual Long64_t Merge(TCollection * /*list*/) {return 0;} + + //Setters void SetRangeTime (Int_t firstTimeBin, Int_t lastTimeBin) { fFirstTimeBin=firstTimeBin; fLastTimeBin=lastTimeBin; } //Set range in which the signal is expected void SetAltroMapping(AliTPCAltroMapping **mapp) { fMapping = mapp; } // @@ -76,8 +79,8 @@ public: UInt_t GetEventType() const {return fEventType;} // AliTPCAltroMapping **GetAltroMapping() { return fMapping; } - const AliAltroRawStream *GetAltroRawStream() {return fAltroRawStream;} - const AliTPCROC *GetTPCROC() {return fROC;} + const AliAltroRawStream *GetAltroRawStream() const {return fAltroRawStream;} + const AliTPCROC *GetTPCROC() const {return fROC;} // void IncrementNevents(){++fNevents;} // @@ -88,7 +91,7 @@ public: void SetDebugLevel(Int_t level) {fDebugLevel = level;} Int_t GetStreamLevel() const {return fStreamLevel;} Int_t GetDebugLevel() const {return fDebugLevel;} - + protected: Int_t fFirstTimeBin; // First Time bin used for analysis Int_t fLastTimeBin; // Last Time bin used for analysis diff --git a/TPC/AliTPCConfigDA.cxx b/TPC/AliTPCConfigDA.cxx index 05093467fcc..e86e9b308e7 100644 --- a/TPC/AliTPCConfigDA.cxx +++ b/TPC/AliTPCConfigDA.cxx @@ -134,7 +134,7 @@ Int_t AliTPCConfigDA::ParseConfigFileTxt(const char* cfgfile) return 0; } //_____________________________________________________________________ -Float_t AliTPCConfigDA::GetValue(const char *key) +Float_t AliTPCConfigDA::GetValue(const char *key) const { // //Get value for the speciefied key diff --git a/TPC/AliTPCConfigDA.h b/TPC/AliTPCConfigDA.h index f40652cf1bc..a1f1a5ca2aa 100644 --- a/TPC/AliTPCConfigDA.h +++ b/TPC/AliTPCConfigDA.h @@ -3,6 +3,11 @@ /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ #include +//////////////////////////////////////////////////////////////////////////// +// +// Simple configuration file parser +// +//////////////////////////////////////////////////////////////////////////// class TMap; @@ -17,13 +22,13 @@ public: virtual ~AliTPCConfigDA(); Int_t ParseConfigFileTxt(const char* cfgfile); - Float_t GetValue(const char* name); + Float_t GetValue(const char* name) const; const TMap* GetConfigurationMap() const {return fConfigMap;} void ResetMap(); private: - TMap *fConfigMap; + TMap *fConfigMap; // Configuration map ClassDef(AliTPCConfigDA, 1) // TPC DA configuration file parser }; diff --git a/TPC/AliTPCLaserTrack.cxx b/TPC/AliTPCLaserTrack.cxx index c21f3e9b528..7a69d959a34 100644 --- a/TPC/AliTPCLaserTrack.cxx +++ b/TPC/AliTPCLaserTrack.cxx @@ -13,6 +13,33 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ +//////////////////////////////////////////////////////////////////////////// +// // +// Surveyed Laser Track positions // +// the position and direction information are stored in // +// the AliExternalTrackParam base class // +// This class extends this information by identification parameters // +/* + +//Dump positions to a tree: +AliTPCLaserTrack::LoadTracks(); +TObjArray *arr=AliTPCLaserTrack::GetTracks(); +TTreeSRedirector *s=new TTreeSRedirector("LaserTracks.root"); +TIter next(arr); +TObject *o=0x0; +while ( (o=next()) ) (*s) << "tracks" << "l.=" << o << "\n"; +delete s; + +//draw something +TFile f("LaserTracks.root"); +TTree *tracks=(TTree*)f.Get("tracks"); +tracks->Draw("fVecGY.fElements:fVecGX.fElements"); + + tracks->Draw("fVecGY.fElements:fVecGX.fElements>>h(500,-250,250,500,-250,250)","fId<7") +*/ +// // +//////////////////////////////////////////////////////////////////////////// + #include #include @@ -20,6 +47,9 @@ #include #include "AliLog.h" +#include "AliCDBManager.h" +#include "AliCDBEntry.h" +#include "AliCDBPath.h" #include "AliTPCLaserTrack.h" #include "AliTPCROC.h" @@ -46,7 +76,7 @@ AliTPCLaserTrack::AliTPCLaserTrack() : fVecLZ(0) // points vectors - localZ { // - // Default constructor +// // Default constructor // } @@ -142,37 +172,35 @@ AliTPCLaserTrack::~AliTPCLaserTrack(){ void AliTPCLaserTrack::LoadTracks() { - // - // Load all design positions from file into the static array fgArrLaserTracks - // - - if ( fgArrLaserTracks ) return; - - TString dataFileName("$ALICE_ROOT/TPC/Calib/LaserTracks.root"); //Path to the Data File - - TFile *f=TFile::Open(gSystem->ExpandPathName(dataFileName.Data())); - if ( !f || !f->IsOpen() ){ -// AliWarning(Form("Could not open laser data file: '%s'",dataFileName.Data())); -// AliWarning("Could not open laser data file"); - return; - } - TObjArray *arrLaserTracks = (TObjArray*)f->Get("arrLaserTracks"); - if ( !arrLaserTracks ) { + // + // Load all design positions from file into the static array fgArrLaserTracks + // + + if ( fgArrLaserTracks ) return; + + AliCDBManager *man=AliCDBManager::Instance(); + if (!man->GetDefaultStorage()) man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); + if (man->GetRun()<0) man->SetRun(0); + AliCDBEntry *entry=man->Get(AliCDBPath("TPC/Calib/LaserTracks")); + TObjArray *arrLaserTracks = (TObjArray*)entry->GetObject(); + arrLaserTracks->SetOwner(); + entry->SetOwner(kTRUE); + + if ( !arrLaserTracks ) { // AliWarning(Form("Could not get laser position data from file: '%s'",fgkDataFileName)); - return; - } - - fgArrLaserTracks = new TObjArray(fgkNLaserTracks); - for (Int_t itrack=0; itrackAt(itrack); - if ( !ltr ){ + return; + } + + fgArrLaserTracks = new TObjArray(fgkNLaserTracks); + for (Int_t itrack=0; itrackAt(itrack); + if ( !ltr ){ // AliWarning(Form("No informatino found for Track %d!",itrack)); - continue; - } - ltr->UpdatePoints(); - fgArrLaserTracks->AddAt(new AliTPCLaserTrack(*ltr),itrack); + continue; } - delete f; + ltr->UpdatePoints(); + fgArrLaserTracks->AddAt(new AliTPCLaserTrack(*ltr),itrack); + } } @@ -180,7 +208,7 @@ void AliTPCLaserTrack::UpdatePoints(){ // // update track points // - const Double_t kMaxSnp=0.99; + const Double_t kMaxSnp=0.97; AliTPCROC* roc = AliTPCROC::Instance(); // // @@ -197,7 +225,7 @@ void AliTPCLaserTrack::UpdatePoints(){ } for (Int_t irow=158; irow>=0; irow--){ - (*fVecSec)[irow]= 0; // - + (*fVecSec)[irow]= -1; // - (*fVecP2)[irow] = 0; // - P2 -snp (*fVecPhi)[irow]= 0; // - global phi (*fVecGX)[irow] = 0; // points vectors - globalX diff --git a/TPC/AliTPCLaserTrack.h b/TPC/AliTPCLaserTrack.h index 12777d540ec..50e404ba669 100644 --- a/TPC/AliTPCLaserTrack.h +++ b/TPC/AliTPCLaserTrack.h @@ -1,7 +1,12 @@ -#ifndef ALITPCLASERTRACK -#define ALITPCLASERTRACK +#ifndef ALITPCLASERTRACK_H +#define ALITPCLASERTRACK_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ +//////////////////////////////////////////////////////////////////////////// +// +// Surveyed Laser Track positions +// +//////////////////////////////////////////////////////////////////////////// #include @@ -53,6 +58,15 @@ public: void SetBeam (Int_t beam) {fBeam = beam; } void SetRayLength (Float_t len) {fRayLength = len;} + const TVectorD* GetVecSec() const { return fVecSec; } + const TVectorD* GetVecP2() const { return fVecP2; } + const TVectorD* GetVecPhi() const { return fVecPhi; } + const TVectorD* GetVecGX() const { return fVecGX; } + const TVectorD* GetVecGY() const { return fVecGY; } + const TVectorD* GetVecGZ() const { return fVecGZ; } + const TVectorD* GetVecLX() const { return fVecLX; } + const TVectorD* GetVecLY() const { return fVecLY; } + const TVectorD* GetVecLZ() const { return fVecLZ; } private: Int_t fId; //Laser beam id (0-335) @@ -65,7 +79,7 @@ private: //(Splitter box on the A-Side at the bottom of the TPC) //to each mirror [cm](needed for an exact drift velocity estimation) public: - TVectorD *fVecSec; // - sector numbers + TVectorD *fVecSec; // - sector numbers TVectorD *fVecP2; // - P2 TVectorD *fVecPhi; // - global phi TVectorD *fVecGX; // points vectors - globalX -- 2.43.0