From 266f8637a69e7cc36ee0de62875744a1f2b96842 Mon Sep 17 00:00:00 2001 From: marian Date: Tue, 11 Mar 2008 10:00:03 +0000 Subject: [PATCH] The charge at cluster maxima used in the dataQA (Peter Christiansen) --- TPC/AliTPCdataQA.cxx | 639 +++++++++++++++++++++++--------- TPC/AliTPCdataQA.h | 79 ++-- TPC/amoreTPC-QA/src/ui/UIQA.cxx | 110 +++--- TPC/macros/testDataQA.C | 123 +++--- 4 files changed, 616 insertions(+), 335 deletions(-) diff --git a/TPC/AliTPCdataQA.cxx b/TPC/AliTPCdataQA.cxx index 2e9ff87f41c..de7243e9817 100644 --- a/TPC/AliTPCdataQA.cxx +++ b/TPC/AliTPCdataQA.cxx @@ -16,6 +16,45 @@ /* $Id$ */ +/* + February 2008 + + The code has been heavily modified so that now the RAW data is + "expanded" for each sector and stored in a big signal array. Then a + simple version of the code in AliTPCclustererMI is used to identify + the local maxima and these are then used for QA. This gives a better + estimate of the charge (both max and total) and also limits the + effect of noise. + + Implementation: + + In Update the RAW signals >= 3 ADC channels are stored in the arrays. + + There are 3 arrays: + Float_t** fAllBins 2d array [row][bin(pad, time)] ADC signal + Int_t** fAllSigBins 2d array [row][signal#] bin(with signal) + Int_t* fAllNSigBins; 1d array [row] Nsignals + + This is done sector by sector. + + When data from a new sector is encountered, the method + FindLocalMaxima is called on the data from the previous sector, and + the calibration/data objects are updated with the "cluster" + info. Finally the arrays are cleared. + + The requirements for a local maxima is: + Charge in bin is >= 5 ADC channels. + Charge in bin is larger than all the 8 neighboring bins. + At least one of the two pad neighbors has a signal. + At least one of the two time neighbors has a signal. + + Before accessing the data it is expected that the Analyse method is + called. This normalizes some of the data objects to per event or per + cluster. + If more data is passed to the class after Analyse has been called + the normalization is reversed and Analyse has to be called again. +*/ + // stl includes #include @@ -31,6 +70,7 @@ using namespace std; #include #include #include +#include //AliRoot includes #include "AliRawReader.h" #include "AliRawReaderRoot.h" @@ -56,34 +96,34 @@ AliTPCdataQA::AliTPCdataQA() : /*FOLD00*/ TH1F("TPCRAW","TPCRAW",100,0,100), fFirstTimeBin(60), fLastTimeBin(1000), - fMaxTime(1100), fAdcMin(1), fAdcMax(100), fOldRCUformat(kTRUE), - fROC(AliTPCROC::Instance()), fMapping(NULL), fPedestal(0), fNoise(0), + fNLocalMaxima(0), fMaxCharge(0), fMeanCharge(0), fNoThreshold(0), - fOverThreshold0(0), - fOverThreshold5(0), fOverThreshold10(0), fOverThreshold20(0), fOverThreshold30(0), - fEventCounter(0) + fNTimeBins(0), + fNPads(0), + fTimePosition(0), + fEventCounter(0), + fIsAnalysed(kFALSE), + fAllBins(0), + fAllSigBins(0), + fAllNSigBins(0), + fRowsMax(0), + fPadsMax(0), + fTimeBinsMax(0) { // // default constructor // - - fSectorLast = -1; - fRowLast = 0; - fPadLast = 0; - fTimeBinLast = 0; - fSignalLast = 0; - fNAboveThreshold = 0; } @@ -92,17 +132,54 @@ AliTPCdataQA::AliTPCdataQA(const AliTPCdataQA &ped) : /*FOLD00*/ TH1F(ped), fFirstTimeBin(ped.GetFirstTimeBin()), fLastTimeBin(ped.GetLastTimeBin()), - fMaxTime(ped.fMaxTime), fAdcMin(ped.GetAdcMin()), fAdcMax(ped.GetAdcMax()), - fOldRCUformat(ped.fOldRCUformat), - fROC(AliTPCROC::Instance()), - fMapping(NULL) + fOldRCUformat(ped.GetOldRCUformat()), + fMapping(NULL), + fPedestal(0), + fNoise(0), + fNLocalMaxima(0), + fMaxCharge(0), + fMeanCharge(0), + fNoThreshold(0), + fOverThreshold10(0), + fOverThreshold20(0), + fOverThreshold30(0), + fNTimeBins(0), + fNPads(0), + fTimePosition(0), + fEventCounter(ped.GetEventCounter()), + fIsAnalysed(ped.GetIsAnalysed()), + fAllBins(0), + fAllSigBins(0), + fAllNSigBins(0), + fRowsMax(0), + fPadsMax(0), + fTimeBinsMax(0) { // // copy constructor // - + if(ped.GetNLocalMaxima()) + fNLocalMaxima = new AliTPCCalPad(*ped.GetNLocalMaxima()); + if(ped.GetMaxCharge()) + fMaxCharge = new AliTPCCalPad(*ped.GetMaxCharge()); + if(ped.GetMeanCharge()) + fMeanCharge = new AliTPCCalPad(*ped.GetMeanCharge()); + if(ped.GetNoThreshold()) + fNoThreshold = new AliTPCCalPad(*ped.GetNoThreshold()); + if(ped.GetNTimeBins()) + fNTimeBins = new AliTPCCalPad(*ped.GetNTimeBins()); + if(ped.GetNPads()) + fNPads = new AliTPCCalPad(*ped.GetNPads()); + if(ped.GetTimePosition()) + fTimePosition = new AliTPCCalPad(*ped.GetTimePosition()); + if(ped.GetOverThreshold10()) + fOverThreshold10 = new AliTPCCalPad(*ped.GetOverThreshold10()); + if(ped.GetOverThreshold20()) + fOverThreshold20 = new AliTPCCalPad(*ped.GetOverThreshold20()); + if(ped.GetOverThreshold30()) + fOverThreshold30 = new AliTPCCalPad(*ped.GetOverThreshold30()); } @@ -127,12 +204,29 @@ AliTPCdataQA::~AliTPCdataQA() /*FOLD00*/ // // do not delete fMapping, because we do not own it. - + // do not delete fMapping, because we do not own it. + // do not delete fNoise and fPedestal, because we do not own them. + + delete fNLocalMaxima; + delete fMaxCharge; + delete fMeanCharge; + delete fNoThreshold; + delete fNTimeBins; + delete fNPads; + delete fTimePosition; + delete fOverThreshold10; + delete fOverThreshold20; + delete fOverThreshold30; + + for (Int_t iRow = 0; iRow < fRowsMax; iRow++) { + delete [] fAllBins[iRow]; + delete [] fAllSigBins[iRow]; + } + delete [] fAllBins; + delete [] fAllSigBins; + delete [] fAllNSigBins; } - - - //_____________________________________________________________________ Bool_t AliTPCdataQA::ProcessEventFast(AliTPCRawStreamFast *rawStreamFast) { @@ -140,26 +234,39 @@ Bool_t AliTPCdataQA::ProcessEventFast(AliTPCRawStreamFast *rawStreamFast) // Event Processing loop - AliTPCRawStream // Bool_t withInput = kFALSE; + Int_t nSignals = 0; + Int_t lastSector = -1; while ( rawStreamFast->NextDDL() ){ while ( rawStreamFast->NextChannel() ){ - Int_t isector = rawStreamFast->GetSector(); // current sector - Int_t iRow = rawStreamFast->GetRow(); // current row - Int_t iPad = rawStreamFast->GetPad(); // current pad - - while ( rawStreamFast->NextBunch() ){ - Int_t startTbin = (Int_t)rawStreamFast->GetStartTimeBin(); - Int_t endTbin = (Int_t)rawStreamFast->GetEndTimeBin(); - - for (Int_t iTimeBin = startTbin; iTimeBin < endTbin; iTimeBin++){ - Float_t signal=(Float_t)rawStreamFast->GetSignals()[iTimeBin-startTbin]; - Update(isector,iRow,iPad,iTimeBin+1,signal); - withInput = kTRUE; - } + + Int_t iSector = rawStreamFast->GetSector(); // current sector + Int_t iRow = rawStreamFast->GetRow(); // current row + Int_t iPad = rawStreamFast->GetPad(); // current pad + // Call local maxima finder if the data is in a new sector + if(iSector != lastSector) { + + if(nSignals>0) + FindLocalMaxima(lastSector); + + CleanArrays(); + lastSector = iSector; + nSignals = 0; + } + + while ( rawStreamFast->NextBunch() ){ + Int_t startTbin = (Int_t)rawStreamFast->GetStartTimeBin(); + Int_t endTbin = (Int_t)rawStreamFast->GetEndTimeBin(); + + for (Int_t iTimeBin = startTbin; iTimeBin < endTbin; iTimeBin++){ + Float_t signal = rawStreamFast->GetSignals()[iTimeBin-startTbin]; + nSignals += Update(iSector,iRow,iPad,iTimeBin+1,signal); + withInput = kTRUE; } + } } } - + return withInput; } //_____________________________________________________________________ @@ -168,7 +275,6 @@ Bool_t AliTPCdataQA::ProcessEventFast(AliRawReader *rawReader) // // Event processing loop - AliRawReader // - fSectorLast = -1; AliTPCRawStreamFast *rawStreamFast = new AliTPCRawStreamFast(rawReader, (AliAltroMapping**)fMapping); Bool_t res=ProcessEventFast(rawStreamFast); if(res) @@ -189,6 +295,8 @@ Bool_t AliTPCdataQA::ProcessEvent(AliTPCRawStream *rawStream) rawStream->SetOldRCUFormat(fOldRCUformat); Bool_t withInput = kFALSE; + Int_t nSignals = 0; + Int_t lastSector = -1; while (rawStream->Next()) { @@ -197,9 +305,23 @@ Bool_t AliTPCdataQA::ProcessEvent(AliTPCRawStream *rawStream) Int_t iPad = rawStream->GetPad(); // current pad Int_t iTimeBin = rawStream->GetTime(); // current time bin Float_t signal = rawStream->GetSignal(); // current ADC signal + + // Call local maxima finder if the data is in a new sector + if(iSector != lastSector) { + + if(nSignals>0) + FindLocalMaxima(lastSector); + + CleanArrays(); + lastSector = iSector; + nSignals = 0; + } - Update(iSector,iRow,iPad,iTimeBin,signal); - withInput = kTRUE; + // Sometimes iRow==-1 if there is problems to read the data + if(iRow>=0) { + nSignals += Update(iSector,iRow,iPad,iTimeBin,signal); + withInput = kTRUE; + } } return withInput; @@ -214,7 +336,6 @@ Bool_t AliTPCdataQA::ProcessEvent(AliRawReader *rawReader) // // if fMapping is NULL the rawstream will crate its own mapping - fSectorLast = -1; AliTPCRawStream rawStream(rawReader, (AliAltroMapping**)fMapping); rawReader->Select("TPC"); Bool_t res = ProcessEvent(&rawStream); @@ -271,135 +392,234 @@ void AliTPCdataQA::DumpToFile(const Char_t *filename, const Char_t *dir, Bool_t //_____________________________________________________________________ -Int_t AliTPCdataQA::Update(const Int_t icsector, /*FOLD00*/ - const Int_t icRow, - const Int_t icPad, - const Int_t icTimeBin, - const Float_t csignal) +Int_t AliTPCdataQA::Update(const Int_t iSector, /*FOLD00*/ + const Int_t iRow, + const Int_t iPad, + const Int_t iTimeBin, + Float_t signal) { // // Signal filling method // - if (icTimeBinfLastTimeBin) return 0; - + + // + // Define the calibration objects the first time Update is called + // NB! This has to be done first even if the data is rejected by the time + // cut to make sure that the objects are available in Analyse + // + if (!fNLocalMaxima) fNLocalMaxima = new AliTPCCalPad("NLocalMaxima","NLocalMaxima"); if (!fMaxCharge) fMaxCharge = new AliTPCCalPad("MaxCharge","MaxCharge"); if (!fMeanCharge) fMeanCharge = new AliTPCCalPad("MeanCharge","MeanCharge"); if (!fNoThreshold) fNoThreshold = new AliTPCCalPad("NoThreshold","NoThreshold"); - if (!fOverThreshold0) fOverThreshold0 = new AliTPCCalPad("OverThreshold0","OverThreshold0"); - if (!fOverThreshold5) fOverThreshold5 = new AliTPCCalPad("OverThreshold5","OverThreshold5"); + if (!fNTimeBins) fNTimeBins = new AliTPCCalPad("NTimeBins","NTimeBins"); + if (!fNPads) fNPads = new AliTPCCalPad("NPads","NPads"); + if (!fTimePosition) fTimePosition = new AliTPCCalPad("TimePosition","TimePosition"); if (!fOverThreshold10) fOverThreshold10 = new AliTPCCalPad("OverThreshold10","OverThreshold10"); if (!fOverThreshold20) fOverThreshold20 = new AliTPCCalPad("OverThreshold20","OverThreshold20"); if (!fOverThreshold30) fOverThreshold30 = new AliTPCCalPad("OverThreshold30","OverThreshold30"); - // + // Make the arrays for expanding the data - Int_t signal = Int_t(csignal); + if (!fAllBins) + MakeArrays(); + + // + // If Analyse has been previously called we need now to denormalize the data + // as more data is coming + // + if(fIsAnalysed == kTRUE) { + + const Int_t nTimeBins = fLastTimeBin - fFirstTimeBin +1; + const Float_t denormalization = Float_t(fEventCounter * nTimeBins); + fNoThreshold->Multiply(denormalization); + + fMeanCharge->Multiply(fNLocalMaxima); + fMaxCharge->Multiply(fNLocalMaxima); + fNTimeBins->Multiply(fNLocalMaxima); + fNPads->Multiply(fNLocalMaxima); + fTimePosition->Multiply(fNLocalMaxima); + fIsAnalysed = kFALSE; + } + // + // TimeBin cut + // + if (iTimeBinfLastTimeBin) return 0; + // if pedestal calibrations are loaded subtract pedestals if(fPedestal) { - Int_t pedestal = Int_t(fPedestal->GetCalROC(icsector)->GetValue(icRow, icPad)); - if(pedestal<10 || pedestal>90) + Float_t ped = fPedestal->GetCalROC(iSector)->GetValue(iRow, iPad); + // Don't use data from pads where pedestals are abnormally small or large + if(ped<10 || ped>90) return 0; - signal -= pedestal; - } - - - if (signal >= 0) { - - Float_t count = fNoThreshold->GetCalROC(icsector)->GetValue(icRow, icPad); - fNoThreshold->GetCalROC(icsector)->SetValue(icRow, icPad,count+1); + signal -= ped; } - + + // In fNoThreshold we fill all data to estimate the ZS volume + Float_t count = fNoThreshold->GetCalROC(iSector)->GetValue(iRow, iPad); + fNoThreshold->GetCalROC(iSector)->SetValue(iRow, iPad,count+1); + // Require at least 3 ADC channels - if (signal < 3) + if (signal < 3.0) return 0; // if noise calibrations are loaded require at least 3*sigmaNoise if(fNoise) { - - Float_t noise = fNoise->GetCalROC(icsector)->GetValue(icRow, icPad); - - if(signalGetCalROC(iSector)->GetValue(iRow, iPad); + + if(signal < noise*3.0) return 0; } + // - // this signal is ok - now see if the previous signal was connected - // this is a bit ugly since the standard decoder goes down in time bins - // (10, 9, 8..) while the fast HLT decoder goes up in time bins (1, 2, 3..) + // This signal is ok and we store it in the cluster map // - if(fSectorLast==icsector && fRowLast==icRow && fPadLast==icPad && - fTimeBinLast==icTimeBin+1 || fTimeBinLast==icTimeBin-1) - fNAboveThreshold++; - else - fNAboveThreshold = 1; - - if(fNAboveThreshold==2) { - - // - // This is the only special case, because before we did not know if we - // should store the information - // - UpdateSignalHistograms(fSectorLast, fRowLast, fPadLast, fTimeBinLast, - fSignalLast); - } - - // keep the information for the next signal - fSectorLast = icsector; - fRowLast = icRow; - fPadLast = icPad; - fTimeBinLast = icTimeBin; - fSignalLast = signal; - - if(fNAboveThreshold==1) // we don't know if this information should be stored - return 1; - - UpdateSignalHistograms(fSectorLast, fRowLast, fPadLast, fTimeBinLast, - fSignalLast); - return 1; + SetExpandDigit(iRow, iPad, iTimeBin, signal); + + return 1; // signal was accepted } + //_____________________________________________________________________ -void AliTPCdataQA::UpdateSignalHistograms(const Int_t icsector, /*FOLD00*/ - const Int_t icRow, - const Int_t icPad, - const Int_t icTimeBin, - const Float_t signal) +void AliTPCdataQA::FindLocalMaxima(const Int_t iSector) { // - // Signal filling method + // This method is called after the data from each sector has been + // exapanded into an array + // Loop over the signals and identify local maxima and fill the + // calibration objects with the information // + + Int_t nLocalMaxima = 0; + const Int_t maxTimeBin = fTimeBinsMax+4; // Used to step between neighboring pads + // Because we have tha pad-time data in a + // 1d array + + for (Int_t iRow = 0; iRow < fRowsMax; iRow++) { + + Float_t* allBins = fAllBins[iRow]; + Int_t* sigBins = fAllSigBins[iRow]; + const Int_t nSigBins = fAllNSigBins[iRow]; + + for (Int_t iSig = 0; iSig < nSigBins; iSig++) { + + Int_t bin = sigBins[iSig]; + Float_t *b = &allBins[bin]; + + // + // Now we check if this is a local maximum + // + + Float_t qMax = b[0]; + + // First check that the charge is bigger than the threshold + if (qMax<5) + continue; + + // Require at least one neighboring pad with signal + if (b[-maxTimeBin]+b[maxTimeBin]<=0) continue; + + // Require at least one neighboring time bin with signal + if (b[-1]+b[1]<=0) continue; + + // + // Check that this is a local maximum + // Note that the checking is done so that if 2 charges has the same + // qMax then only 1 cluster is generated + // (that is why there is BOTH > and >=) + // + if (b[-maxTimeBin] >= qMax) continue; + if (b[-1 ] >= qMax) continue; + if (b[+maxTimeBin] > qMax) continue; + if (b[+1 ] > qMax) continue; + if (b[-maxTimeBin-1] >= qMax) continue; + if (b[+maxTimeBin-1] >= qMax) continue; + if (b[+maxTimeBin+1] > qMax) continue; + if (b[-maxTimeBin+1] >= qMax) continue; + + // + // Now we accept the local maximum and fill the calibration/data objects + // + nLocalMaxima++; + + Int_t iPad, iTimeBin; + GetPadAndTimeBin(bin, iPad, iTimeBin); + + Float_t count = fNLocalMaxima->GetCalROC(iSector)->GetValue(iRow, iPad); + fNLocalMaxima->GetCalROC(iSector)->SetValue(iRow, iPad, count+1); + + count = fTimePosition->GetCalROC(iSector)->GetValue(iRow, iPad); + fTimePosition->GetCalROC(iSector)->SetValue(iRow, iPad, count+iTimeBin); + + Float_t charge = fMaxCharge->GetCalROC(iSector)->GetValue(iRow, iPad); + fMaxCharge->GetCalROC(iSector)->SetValue(iRow, iPad, charge + qMax); + + if(qMax>=10) { + count = fOverThreshold10->GetCalROC(iSector)->GetValue(iRow, iPad); + fOverThreshold10->GetCalROC(iSector)->SetValue(iRow, iPad, count+1); + } + if(qMax>=20) { + count = fOverThreshold20->GetCalROC(iSector)->GetValue(iRow, iPad); + fOverThreshold20->GetCalROC(iSector)->SetValue(iRow, iPad, count+1); + } + if(qMax>=30) { + count = fOverThreshold30->GetCalROC(iSector)->GetValue(iRow, iPad); + fOverThreshold30->GetCalROC(iSector)->SetValue(iRow, iPad, count+1); + } + + // + // Calculate the total charge as the sum over the region: + // + // o o o o o + // o i i i o + // o i C i o + // o i i i o + // o o o o o + // + // with qmax at the center C. + // + // The inner charge (i) we always add, but we only add the outer + // charge (o) if the neighboring inner bin (i) has a signal. + // + Int_t minP = 0, maxP = 0, minT = 0, maxT = 0; + Float_t qTot = qMax; + for(Int_t i = -1; i<=1; i++) { + for(Int_t j = -1; j<=1; j++) { + + if(i==0 && j==0) + continue; + + Float_t charge = GetQ(b, i, j, maxTimeBin, minT, maxT, minP, maxP); + qTot += charge; + if(charge>0) { + // see if the next neighbor is also above threshold + if(i*j==0) { + qTot += GetQ(b, 2*i, 2*j, maxTimeBin, minT, maxT, minP, maxP); + } else { + // we are in a diagonal corner + qTot += GetQ(b, i, 2*j, maxTimeBin, minT, maxT, minP, maxP); + qTot += GetQ(b, 2*i, j, maxTimeBin, minT, maxT, minP, maxP); + qTot += GetQ(b, 2*i, 2*j, maxTimeBin, minT, maxT, minP, maxP); + } + } + } + } + + charge = fMeanCharge->GetCalROC(iSector)->GetValue(iRow, iPad); + fMeanCharge->GetCalROC(iSector)->SetValue(iRow, iPad, charge + qTot); + + count = fNTimeBins->GetCalROC(iSector)->GetValue(iRow, iPad); + fNTimeBins->GetCalROC(iSector)->SetValue(iRow, iPad, count + maxT-minT+1); + + count = fNPads->GetCalROC(iSector)->GetValue(iRow, iPad); + fNPads->GetCalROC(iSector)->SetValue(iRow, iPad, count + maxP-minP+1); + + } // end loop over signals + } // end loop over rows - { - Float_t charge = fMeanCharge->GetCalROC(icsector)->GetValue(icRow, icPad); - fMeanCharge->GetCalROC(icsector)->SetValue(icRow, icPad, charge + signal); - } - - if (signal>fMaxCharge->GetCalROC(icsector)->GetValue(icRow, icPad)){ - fMaxCharge->GetCalROC(icsector)->SetValue(icRow, icPad,signal); - } - - if (signal>0){ - Float_t count = fOverThreshold0->GetCalROC(icsector)->GetValue(icRow, icPad); - fOverThreshold0->GetCalROC(icsector)->SetValue(icRow, icPad,count+1); - }; - // - if (signal>5){ - Float_t count = fOverThreshold5->GetCalROC(icsector)->GetValue(icRow, icPad); - fOverThreshold5->GetCalROC(icsector)->SetValue(icRow, icPad,count+1); - }; - if (signal>10){ - Float_t count = fOverThreshold10->GetCalROC(icsector)->GetValue(icRow, icPad); - fOverThreshold10->GetCalROC(icsector)->SetValue(icRow, icPad,count+1); - }; - if (signal>20){ - Float_t count = fOverThreshold20->GetCalROC(icsector)->GetValue(icRow, icPad); - fOverThreshold20->GetCalROC(icsector)->SetValue(icRow, icPad,count+1); - }; - if (signal>30){ - Float_t count = fOverThreshold30->GetCalROC(icsector)->GetValue(icRow, icPad); - fOverThreshold30->GetCalROC(icsector)->SetValue(icRow, icPad,count+1); - }; + // cout << "Number of local maximas found: " << nLocalMaxima << endl; } //_____________________________________________________________________ @@ -411,93 +631,162 @@ void AliTPCdataQA::Analyse() cout << "Analyse called" << endl; - if(fEventCounter==0) { + if(fIsAnalysed == kTRUE) { + + cout << "No new data since Analyse was called last time" << endl; + return; + } + if(fEventCounter==0) { + cout << "EventCounter == 0, Cannot analyse" << endl; return; } - + Int_t nTimeBins = fLastTimeBin - fFirstTimeBin +1; cout << "EventCounter: " << fEventCounter << endl << "TimeBins: " << nTimeBins << endl; - if (fMeanCharge && fNoThreshold) fMeanCharge->Divide(fNoThreshold); - Float_t normalization = 1.0 / Float_t(fEventCounter * nTimeBins); - if (fNoThreshold) fNoThreshold->Multiply(normalization); - if (fOverThreshold0) fOverThreshold0->Multiply(normalization); - if (fOverThreshold5) fOverThreshold5->Multiply(normalization); - if (fOverThreshold10) fOverThreshold10->Multiply(normalization); - if (fOverThreshold20) fOverThreshold20->Multiply(normalization); - if (fOverThreshold30) fOverThreshold30->Multiply(normalization); + fNoThreshold->Multiply(normalization); + + fMeanCharge->Divide(fNLocalMaxima); + fMaxCharge->Divide(fNLocalMaxima); + fNTimeBins->Divide(fNLocalMaxima); + fNPads->Divide(fNLocalMaxima); + fTimePosition->Divide(fNLocalMaxima); + + fIsAnalysed = kTRUE; } +//_____________________________________________________________________ void AliTPCdataQA::MakeTree(const char *fname){ // // Export result to the tree -located in the file // This file can be analyzed using AliTPCCalibViewer // - AliTPCdataQA *ped = this; AliTPCPreprocessorOnline preprocesor; - if (ped->GetMaxCharge()) preprocesor.AddComponent(ped->GetMaxCharge()); - if (ped->GetMeanCharge()) preprocesor.AddComponent(ped->GetMeanCharge()); - if (ped->GetOverThreshold0()) preprocesor.AddComponent(ped->GetOverThreshold0()); - if (ped->GetOverThreshold5()) preprocesor.AddComponent(ped->GetOverThreshold5()); - if (ped->GetOverThreshold10()) preprocesor.AddComponent(ped->GetOverThreshold10()); - if (ped->GetOverThreshold20()) preprocesor.AddComponent(ped->GetOverThreshold20()); - if (ped->GetOverThreshold30()) preprocesor.AddComponent(ped->GetOverThreshold30()); + + if (fNLocalMaxima) preprocesor.AddComponent(fNLocalMaxima); + if (fMaxCharge) preprocesor.AddComponent(fMaxCharge); + if (fMeanCharge) preprocesor.AddComponent(fMeanCharge); + if (fNoThreshold) preprocesor.AddComponent(fNoThreshold); + if (fNTimeBins) preprocesor.AddComponent(fNTimeBins); + if (fNPads) preprocesor.AddComponent(fNPads); + if (fTimePosition) preprocesor.AddComponent(fTimePosition); + if (fOverThreshold10) preprocesor.AddComponent(fOverThreshold10); + if (fOverThreshold20) preprocesor.AddComponent(fOverThreshold20); + if (fOverThreshold30) preprocesor.AddComponent(fOverThreshold30); + preprocesor.DumpToFile(fname); } - +//_____________________________________________________________________ void AliTPCdataQA::MakeArrays(){ // - // + // The arrays for expanding the raw data are defined and + // som parameters are intialised // AliTPCROC * roc = AliTPCROC::Instance(); // - Int_t nRowsMax = roc->GetNRows(roc->GetNSector()-1); - Int_t nPadsMax = roc->GetNPads(roc->GetNSector()-1,nRowsMax-1); + // To make the array big enough for all sectors we take + // the dimensions from the outer row of an OROC (the last sector) + // + fRowsMax = roc->GetNRows(roc->GetNSector()-1); + fPadsMax = roc->GetNPads(roc->GetNSector()-1,fRowsMax-1); + fTimeBinsMax = fLastTimeBin - fFirstTimeBin +1; + + // + // Since we have added 2 pads (TimeBins) before and after the real pads (TimeBins) + // to make sure that we can always query the exanded table even when the + // max is on the edge + // + - fAllBins = new Float_t*[nRowsMax]; - fAllSigBins = new Int_t*[nRowsMax]; - fAllNSigBins = new Int_t[nRowsMax]; - for (Int_t iRow = 0; iRow < nRowsMax; iRow++) { + fAllBins = new Float_t*[fRowsMax]; + fAllSigBins = new Int_t*[fRowsMax]; + fAllNSigBins = new Int_t[fRowsMax]; + + for (Int_t iRow = 0; iRow < fRowsMax; iRow++) { // - Int_t maxBin = fMaxTime*(nPadsMax+6); // add 3 virtual pads before and 3 after + Int_t maxBin = (fTimeBinsMax+4)*(fPadsMax+4); fAllBins[iRow] = new Float_t[maxBin]; - memset(fAllBins[iRow],0,sizeof(Float_t)*maxBin); + memset(fAllBins[iRow],0,sizeof(Float_t)*maxBin); // set all values to 0 fAllSigBins[iRow] = new Int_t[maxBin]; - fAllNSigBins[iRow]=0; + fAllNSigBins[iRow] = 0; } } +//_____________________________________________________________________ void AliTPCdataQA::CleanArrays(){ // // // - AliTPCROC * roc = AliTPCROC::Instance(); - // - Int_t nRowsMax = roc->GetNRows(roc->GetNSector()-1); - Int_t nPadsMax = roc->GetNPads(roc->GetNSector()-1,nRowsMax-1); - for (Int_t iRow = 0; iRow < nRowsMax; iRow++) { + + for (Int_t iRow = 0; iRow < fRowsMax; iRow++) { // - Int_t maxBin = fMaxTime*(nPadsMax+6); // add 3 virtual pads before and 3 after + Int_t maxBin = (fTimeBinsMax+4)*(fPadsMax+4); memset(fAllBins[iRow],0,sizeof(Float_t)*maxBin); fAllNSigBins[iRow]=0; } } -Float_t* AliTPCdataQA::GetExpandDigit(Int_t row, Int_t pad, Int_t time){ +//_____________________________________________________________________ +void AliTPCdataQA::GetPadAndTimeBin(Int_t bin, Int_t& iPad, Int_t& iTimeBin){ + // + // Return pad and timebin for a given bin // + + // Int_t bin = iPad*(fTimeBinsMax+4)+iTimeBin; + iTimeBin = bin%(fTimeBinsMax+4); + iPad = (bin-iTimeBin)/(fTimeBinsMax+4); + + iPad -= 2; + iTimeBin -= 2; + iTimeBin += fFirstTimeBin; + + R__ASSERT(iPad>=0 && iPad<=fPadsMax); + R__ASSERT(iTimeBin>=fFirstTimeBin && iTimeBin<=fLastTimeBin); +} + +//_____________________________________________________________________ +void AliTPCdataQA::SetExpandDigit(const Int_t iRow, Int_t iPad, + Int_t iTimeBin, const Float_t signal) +{ // + // // - AliTPCROC * roc = AliTPCROC::Instance(); - Int_t nRowsMax = roc->GetNRows(roc->GetNSector()-1); - if (row<0 || row>nRowsMax) return 0; - Int_t nPadsMax = roc->GetNPads(roc->GetNSector()-1,nRowsMax-1); + R__ASSERT(iRow>=0 && iRow=0 && iPad<=fPadsMax); + R__ASSERT(iTimeBin>=fFirstTimeBin && iTimeBin<=fLastTimeBin); + + iTimeBin -= fFirstTimeBin; + iPad += 2; + iTimeBin += 2; + Int_t bin = iPad*(fTimeBinsMax+4)+iTimeBin; + fAllBins[iRow][bin] = signal; + fAllSigBins[iRow][fAllNSigBins[iRow]] = bin; + fAllNSigBins[iRow]++; +} + +Float_t AliTPCdataQA::GetQ(const Float_t* adcArray, const Int_t time, + const Int_t pad, const Int_t maxTimeBins, + Int_t& timeMin, Int_t& timeMax, + Int_t& padMin, Int_t& padMax) +{ + // + // This methods return the charge in the bin time+pad*maxTimeBins + // If the charge is above 0 it also updates the padMin, padMax, timeMin + // and timeMax if necessary + // + Float_t charge = adcArray[time + pad*maxTimeBins]; + if(charge > 0) { + timeMin = TMath::Min(time, timeMin); timeMax = TMath::Max(time, timeMax); + padMin = TMath::Min(pad, padMin); padMax = TMath::Max(pad, padMax); + } + return charge; } diff --git a/TPC/AliTPCdataQA.h b/TPC/AliTPCdataQA.h index 7f4b5f1162e..3c59e4b07c0 100644 --- a/TPC/AliTPCdataQA.h +++ b/TPC/AliTPCdataQA.h @@ -38,32 +38,35 @@ public: Bool_t ProcessEvent(AliRawReader *rawReader); Bool_t ProcessEvent(eventHeaderStruct *event); - Int_t Update(const Int_t isector, const Int_t iRow, const Int_t iPad, - const Int_t iTimeBin, const Float_t signal); void Analyse(); // // void SetPedestal(AliTPCCalPad *pedestalCal){ fPedestal = pedestalCal;} void SetNoise(AliTPCCalPad *noiseCal){ fNoise = noiseCal;} - AliTPCCalPad *GetMaxCharge(){ return fMaxCharge;} - AliTPCCalPad *GetMeanCharge(){ return fMeanCharge;} - AliTPCCalPad *GetNoThreshold(){ return fNoThreshold;} - AliTPCCalPad *GetOverThreshold0(){ return fOverThreshold0;} - AliTPCCalPad *GetOverThreshold5(){ return fOverThreshold5;} - AliTPCCalPad *GetOverThreshold10(){ return fOverThreshold10;} - AliTPCCalPad *GetOverThreshold20(){ return fOverThreshold20;} - AliTPCCalPad *GetOverThreshold30(){ return fOverThreshold30;} + AliTPCCalPad *GetNoThreshold() const { return fNoThreshold;} + AliTPCCalPad *GetMaxCharge() const { return fMaxCharge;} + AliTPCCalPad *GetMeanCharge() const { return fMeanCharge;} + AliTPCCalPad *GetNLocalMaxima() const { return fNLocalMaxima;} + AliTPCCalPad *GetOverThreshold10() const { return fOverThreshold10;} + AliTPCCalPad *GetOverThreshold20() const { return fOverThreshold20;} + AliTPCCalPad *GetOverThreshold30() const { return fOverThreshold30;} + AliTPCCalPad *GetNTimeBins() const { return fNTimeBins;} + AliTPCCalPad *GetNPads() const { return fNPads;} + AliTPCCalPad *GetTimePosition() const { return fTimePosition;} // AliTPCAltroMapping **GetAltroMapping() { return fMapping; }; void SetAltroMapping(AliTPCAltroMapping **mapp) { fMapping = mapp; }; // // - Int_t GetFirstTimeBin() const { return fFirstTimeBin; } - Int_t GetLastTimeBin() const { return fLastTimeBin; } - Int_t GetAdcMin() const { return fAdcMin; } - Int_t GetAdcMax() const { return fAdcMax; } + Int_t GetFirstTimeBin() const { return fFirstTimeBin; } + Int_t GetLastTimeBin() const { return fLastTimeBin; } + Int_t GetAdcMin() const { return fAdcMin; } + Int_t GetAdcMax() const { return fAdcMax; } + Int_t GetEventCounter() const { return fEventCounter; } + Bool_t GetOldRCUformat() const { return fOldRCUformat; } + Bool_t GetIsAnalysed() const { return fIsAnalysed; } void SetRangeTime(Int_t tMin, Int_t tMax){ fFirstTimeBin=tMin; fLastTimeBin=tMax;} // Set time bin range that is used for the pedestal calibration void SetRangeAdc (Int_t aMin, Int_t aMax){ fAdcMin=aMin; fAdcMax=aMax; } // Set adc range for the pedestal calibration @@ -71,54 +74,56 @@ public: private: - void UpdateSignalHistograms(const Int_t icsector, const Int_t icRow, - const Int_t icPad, const Int_t icTimeBin, - const Float_t signal); - - void MakeArrays(); // create arrays for random data acces - void CleanArrays(); // clean arrays for random data acces - Float_t* GetExpandDigit(Int_t row, Int_t pad, Int_t time); // get pointer to the digit - + Int_t Update(const Int_t iSector, const Int_t iRow, const Int_t iPad, + const Int_t iTimeBin, Float_t signal); + void FindLocalMaxima(const Int_t iSector); + + void MakeArrays(); // Create arrays for random data acces + void CleanArrays(); // Clean arrays for random data acces + void SetExpandDigit(const Int_t iRow, Int_t iPad, Int_t iTimeBin, + const Float_t signal); // Fill arrays with signals + void GetPadAndTimeBin(Int_t bin, Int_t& iPad, Int_t& iTimeBin); // Get pad and time bin corresponding to the 1d bin + Float_t GetQ(const Float_t* adcArray, const Int_t time, + const Int_t pad, const Int_t maxTimeBins, + Int_t& timeMin,Int_t& timeMax,Int_t& padMin,Int_t& padMax); + Int_t fFirstTimeBin; // First Time bin needed for analysis Int_t fLastTimeBin; // Last Time bin needed for analysis - Int_t fMaxTime; // Maximum number of time bins Int_t fAdcMin; // min adc channel of pedestal value Int_t fAdcMax; // max adc channel of pedestal value Bool_t fOldRCUformat; //! Should we use the old RCU format for data reading - - AliTPCROC *fROC; //! ROC information AliTPCAltroMapping **fMapping; //! Altro Mapping object // // AliTPCCalPad * fPedestal; //! option to set pedestal cal object AliTPCCalPad * fNoise; //! option to set noise cal object + AliTPCCalPad * fNLocalMaxima; // local maximas found AliTPCCalPad * fMaxCharge; // max charge AliTPCCalPad * fMeanCharge; // mean charge AliTPCCalPad * fNoThreshold; // number of digits - AliTPCCalPad * fOverThreshold0; // number of digits over threshold - AliTPCCalPad * fOverThreshold5; // number of digits over threshold - AliTPCCalPad * fOverThreshold10; // number of digits over threshold - AliTPCCalPad * fOverThreshold20; // number of digits over threshold - AliTPCCalPad * fOverThreshold30; //! number of digits over threshold + AliTPCCalPad * fNTimeBins; // timebins width of cluster + AliTPCCalPad * fNPads; // pads with of cluster + AliTPCCalPad * fTimePosition; // Time position of local maximum + AliTPCCalPad * fOverThreshold10; //! local maxima with qMax over threshold + AliTPCCalPad * fOverThreshold20; //! local maxima with qMax over threshold + AliTPCCalPad * fOverThreshold30; //! local maxima with qMax over threshold Int_t fEventCounter; // event Counter - Int_t fSectorLast; //! last sector with signal - Int_t fRowLast; //! last row with signal - Int_t fPadLast; //! last pad with signal - Int_t fTimeBinLast; //! last time bin with signal - Float_t fSignalLast; //! last signal value - Int_t fNAboveThreshold; //! number of signals above threshold + Bool_t fIsAnalysed; // Set to true after Analyse has been called // // Expand buffer // Float_t** fAllBins; //! array for digit using random access Int_t** fAllSigBins; //! array of pointers to the indexes over threshold Int_t* fAllNSigBins; //! + Int_t fRowsMax; //! Maximum number of time bins + Int_t fPadsMax; //! Maximum number of time bins + Int_t fTimeBinsMax; //! Maximum number of time bins public: - ClassDef(AliTPCdataQA, 1) // Implementation of the TPC pedestal and noise calibration + ClassDef(AliTPCdataQA, 2) // Implementation of the TPC pedestal and noise calibration }; diff --git a/TPC/amoreTPC-QA/src/ui/UIQA.cxx b/TPC/amoreTPC-QA/src/ui/UIQA.cxx index 7288daf66e4..6ad1a648212 100644 --- a/TPC/amoreTPC-QA/src/ui/UIQA.cxx +++ b/TPC/amoreTPC-QA/src/ui/UIQA.cxx @@ -55,18 +55,12 @@ UIQA::~UIQA() { } -void UIQA::Construct() { - - - // The custom GUI is constructed here. gRootFrame is the container of the custom widgets. - // - // Expert monitor - AliTPCCalibViewerGUI - fViewerGUI - // +void UIQA::Construct() { // The custom GUI is constructed here. gRootFrame is the container of the custom widgets. + fTab=new TGTab(amore::ui::gRootFrame); amore::ui::gRootFrame->AddFrame(fTab); // // - // TGCompositeFrame* tabCont1 =fTab->AddTab("Expert"); fViewerGUI = new AliTPCCalibViewerGUI(tabCont1, 1000, 600, 0); @@ -109,13 +103,14 @@ void UIQA::Construct() { gStyle->SetFrameFillColor(10); gStyle->SetFrameBorderSize(1); gStyle->SetFrameBorderMode(-1); - gStyle->SetFrameLineWidth(1.); + gStyle->SetFrameLineWidth(1); } void UIQA::SubscribeMonitorObjects() { // Before using any MonitorObject, a subscription should be made. //std::ostringstream stringStream; -// The agent name acting as a source could be concatenated with all the objects it contains + //amore::core::String_t sourceName="CEDA/", subscription; // The agent name acting as a source could be concatenated with all the objects it contains + //subscription=sourceName+"CE"; //Subscribe(subscription.c_str()); // Here you put a series of subscriptions where the string corresponds to the object name as published in the Publisher Module. As these names are internal to the QA framework, the recommended way of having consistency between AMORE and QA is to factor-out of QA the function that represents the histogram naming convention as a separate AliRoot class/function and use it from inside QA and AMORE. //... amore::core::String_t sourceName="TPCQA/", subscription; @@ -147,45 +142,38 @@ void UIQA::Update() { // This is executed after getting the updated contents of printf("Pointertpcqa - %p\n",tpcqa); tpcqa->Print(); } - // - if (!tpcqa) return; - // - // Expert monitor part - // - if (tpcqa) MakeTree(tpcqa); - // - // Simple histograms + if (!tpcqa) return; // // Over threshold // TCanvas *canvas = fEC[0]->GetCanvas(); - if (tpcqa->GetOverThreshold5()){ + if (tpcqa->GetNoThreshold()){ canvas->cd(1); - tpcqa->GetOverThreshold5()->MakeHisto1D()->Draw(); + tpcqa->GetNoThreshold()->MakeHisto1D()->Draw(); canvas->cd(2); - tpcqa->GetOverThreshold5()->MakeHisto2D(0)->Draw("colz"); + tpcqa->GetNoThreshold()->MakeHisto2D(0)->Draw("colz"); canvas->cd(3); - tpcqa->GetOverThreshold5()->MakeHisto2D(1)->Draw("colz"); + tpcqa->GetNoThreshold()->MakeHisto2D(1)->Draw("colz"); } // - if (tpcqa->GetOverThreshold10()){ + if (tpcqa->GetNTimeBins()){ canvas->cd(4); - tpcqa->GetOverThreshold10()->MakeHisto1D()->Draw(); + tpcqa->GetNTimeBins()->MakeHisto1D()->Draw(); canvas->cd(5); - tpcqa->GetOverThreshold10()->MakeHisto2D(0)->Draw("colz"); + tpcqa->GetNTimeBins()->MakeHisto2D(0)->Draw("colz"); canvas->cd(6); - tpcqa->GetOverThreshold10()->MakeHisto2D(1)->Draw("colz"); + tpcqa->GetNTimeBins()->MakeHisto2D(1)->Draw("colz"); } - if (tpcqa->GetOverThreshold20()){ + if (tpcqa->GetNPads()){ canvas->cd(7); - tpcqa->GetOverThreshold20()->MakeHisto1D()->Draw(); + tpcqa->GetNPads()->MakeHisto1D()->Draw(); canvas->cd(8); - tpcqa->GetOverThreshold20()->MakeHisto2D(0)->Draw("colz"); + tpcqa->GetNPads()->MakeHisto2D(0)->Draw("colz"); canvas->cd(9); - tpcqa->GetOverThreshold20()->MakeHisto2D(1)->Draw("colz"); + tpcqa->GetNPads()->MakeHisto2D(1)->Draw("colz"); } // @@ -208,8 +196,17 @@ void UIQA::Update() { // This is executed after getting the updated contents of canvas->cd(6); tpcqa->GetMaxCharge()->MakeHisto2D(1)->Draw("colz"); } + if (tpcqa) MakeTree(tpcqa); // End of access example + + //amore::da::AmoreDA amoreDA; + // hCalibCE->Dump(); + // TObject *temp=0; + //amoreDA.Receive("CEDA/CE",temp); + //temp->Dump(); + + } void UIQA::Process() { @@ -227,62 +224,45 @@ void UIQA::EndOfCycle() { void UIQA::MakeTree(AliTPCdataQA* ped){ // - // Prepare tree for expert monitor - // - // - // QA part - // - AliTPCPreprocessorOnline * preprocesor = new AliTPCPreprocessorOnline; - if (ped->GetMaxCharge()) preprocesor->AddComponent(new AliTPCCalPad(*(ped->GetMaxCharge()))); - if (ped->GetMeanCharge()) preprocesor->AddComponent(new AliTPCCalPad(*(ped->GetMeanCharge()))); - if (ped->GetOverThreshold0()) preprocesor->AddComponent(new AliTPCCalPad(*(ped->GetOverThreshold0()))); - if (ped->GetOverThreshold5()) preprocesor->AddComponent(new AliTPCCalPad(*(ped->GetOverThreshold5()))); - if (ped->GetOverThreshold10()) preprocesor->AddComponent(new AliTPCCalPad(*(ped->GetOverThreshold10()))); - if (ped->GetOverThreshold20()) preprocesor->AddComponent(new AliTPCCalPad(*(ped->GetOverThreshold20()))); - if (ped->GetOverThreshold30()) preprocesor->AddComponent(new AliTPCCalPad(*(ped->GetOverThreshold30()))); - - // - // DA part - // + if (ped->GetNLocalMaxima()) + preprocesor->AddComponent(new AliTPCCalPad(*(ped->GetNLocalMaxima()))); + if (ped->GetMaxCharge()) + preprocesor->AddComponent(new AliTPCCalPad(*(ped->GetMaxCharge()))); + if (ped->GetMeanCharge()) + preprocesor->AddComponent(new AliTPCCalPad(*(ped->GetMeanCharge()))); + if (ped->GetNoThreshold()) + preprocesor->AddComponent(new AliTPCCalPad(*(ped->GetNoThreshold()))); + if (ped->GetNTimeBins()) + preprocesor->AddComponent(new AliTPCCalPad(*(ped->GetNTimeBins()))); + if (ped->GetNPads()) + preprocesor->AddComponent(new AliTPCCalPad(*(ped->GetNPads()))); + if (ped->GetTimePosition()) + preprocesor->AddComponent(new AliTPCCalPad(*(ped->GetTimePosition()))); AliTPCCalPad * noise = GetNoise(); if (noise) preprocesor->AddComponent(new AliTPCCalPad(*noise)); AliTPCCalPad * pedestal = GetPedestal(); if (pedestal) preprocesor->AddComponent(new AliTPCCalPad(*pedestal)); - - // - // Make new tree - // char fname[10000]; sprintf(fname,"QAtree%d.root",fCycle); preprocesor->DumpToFile(fname); fCycle++; delete noise; delete pedestal; - - // - // Update viewer - // - // + // /*CalibTree AliTPCCalibViewer *viewer = fViewerGUI->GetViewer(); AliTPCCalibViewer *nviewer = new AliTPCCalibViewer(fname, "calPads"); - fViewerGUI->Initialize(nviewer); + fViewerGUI->Initialize(nviewer); + //*/ // // // delete preprocesor; } - AliTPCCalPad * UIQA::GetNoise(){ - // - // Get noise from DAs - // For the moment only get calibration param form local file - // file is exepected to be in $AMORE_SITE directory - // - // // GetNoise - if not in AmoreDB than from file // @@ -291,8 +271,6 @@ void UIQA::EndOfCycle() { //amoreDA.Receive("PEDESTAL/NOISE",temp); //temp->Dump(); // if (temp) return (AliTPCCalPad*) temp; - // - // TDirectory * dir = gDirectory; TFile *f = new TFile("$AMORE_SITE/PadNoise.root"); AliCDBEntry * entry = (AliCDBEntry*)f->Get("AliCDBEntry"); diff --git a/TPC/macros/testDataQA.C b/TPC/macros/testDataQA.C index 7c965988605..16a6634f567 100644 --- a/TPC/macros/testDataQA.C +++ b/TPC/macros/testDataQA.C @@ -10,80 +10,89 @@ void testDataQA(Char_t *fileName, Int_t maxevent=10) -{ - AliLog::SetClassDebugLevel("AliTPCRawStream",-5); - AliLog::SetClassDebugLevel("AliRawReaderDate",-5); - AliLog::SetClassDebugLevel("AliTPCAltroMapping",-5); - AliLog::SetModuleDebugLevel("RAW",-5); - AliLog::SetGlobalLogLevel(3); - +{ AliRawReaderRoot *rawReader = new AliRawReaderRoot(fileName); if ( !rawReader ) return; - AliTPCdataQA *calib = new AliTPCdataQA; - calib->SetRangeTime(200,800); - AliTPCCalibPulser *calibPulser = new AliTPCCalibPulser; - calibPulser->SetRangeTime(5,300); + AliTPCdataQA *calib = new AliTPCdataQA; + AliTPCdataQA *calibFast = new AliTPCdataQA; + calib->SetRangeTime(1,1000); + calibFast->SetRangeTime(1,1000); printf("Processing data\n"); Int_t event=0; while (rawReader->NextEvent()){ calib->ProcessEvent(rawReader); rawReader->Reset(); - calibPulser->ProcessEvent(rawReader); - printf("Processing event\t%d\n",event); + calibFast->ProcessEventFast(rawReader); event++; + // if you wann to check the handling of Analyse updates uncomment this +// if(gRandom->Rndm()<0.3) { +// calib->Analyse(); +// calibFast->Analyse(); +// } if (event>maxevent) break; } - calibPulser->Analyse(); - TFile f("dataQA.root","recreate"); - calibPulser->Write("Pulser"); + calib->Analyse(); + calibFast->Analyse(); + + TFile file1("dataQATestAnalyse.root","recreate"); calib->Write("AliTPCdataQA"); + calibFast->Write("AliTPCdataQAFast"); delete rawReader; - delete calib; - delete calibPulser; + // delete calib; + delete calibFast; - f.Close(); + file1.Close(); // - TFile f2("dataQA.root"); - AliTPCdataQA* ped = (AliTPCdataQA*)f2.Get("AliTPCdataQA"); - AliTPCCalibPulser* pedPulser = (AliTPCCalibPulser*)f2.Get("Pulser"); + TFile file2("dataQATestAnalyse.root"); + AliTPCdataQA* cal = (AliTPCdataQA*)file2.Get("AliTPCdataQA"); + AliTPCdataQA* calFast = (AliTPCdataQA*)file2.Get("AliTPCdataQAFast"); AliTPCPreprocessorOnline preprocesor; - preprocesor.AddComponent(ped->GetMaxCharge()); - preprocesor.AddComponent(ped->GetOverThreshold0()); - preprocesor.AddComponent(ped->GetOverThreshold5()); - preprocesor.AddComponent(ped->GetOverThreshold10()); - preprocesor.AddComponent(ped->GetOverThreshold20()); - preprocesor.AddComponent(ped->GetOverThreshold30()); + preprocesor.AddComponent(cal->GetNoThreshold()); + preprocesor.AddComponent(cal->GetOverThreshold10()); + preprocesor.AddComponent(cal->GetOverThreshold20()); + preprocesor.AddComponent(cal->GetOverThreshold30()); + preprocesor.AddComponent(cal->GetNLocalMaxima()); + preprocesor.AddComponent(cal->GetMeanCharge()); + preprocesor.AddComponent(cal->GetMaxCharge()); + preprocesor.AddComponent(cal->GetNTimeBins()); + preprocesor.AddComponent(cal->GetNPads()); + preprocesor.AddComponent(cal->GetTimePosition()); + + AliTPCCalPad* calPadNoThr= new AliTPCCalPad(*calFast->GetNoThreshold()); + AliTPCCalPad* calPadThr10= new AliTPCCalPad(*calFast->GetOverThreshold10()); + AliTPCCalPad* calPadThr20= new AliTPCCalPad(*calFast->GetOverThreshold20()); + AliTPCCalPad* calPadThr30= new AliTPCCalPad(*calFast->GetOverThreshold30()); + AliTPCCalPad* calNLocal = new AliTPCCalPad(*calFast->GetNLocalMaxima()); + AliTPCCalPad* calPadMean = new AliTPCCalPad(*calFast->GetMeanCharge()); + AliTPCCalPad* calPadMax = new AliTPCCalPad(*calFast->GetMaxCharge()); + AliTPCCalPad* calNTime = new AliTPCCalPad(*calFast->GetNTimeBins()); + AliTPCCalPad* calNPad = new AliTPCCalPad(*calFast->GetNPads()); + AliTPCCalPad* calTimePos = new AliTPCCalPad(*calFast->GetTimePosition()); // - AliTPCCalPad * pad0 = new AliTPCCalPad(pedPulser->GetCalPadT0()); - AliTPCCalPad * pad1 = new AliTPCCalPad(pedPulser->GetCalPadQ()); - AliTPCCalPad * pad2 = new AliTPCCalPad(pedPulser->GetCalPadRMS()); - pad0->SetName("PulserT0"); - pad1->SetName("PulserQ"); - pad2->SetName("PulserRMS"); - - preprocesor.AddComponent(pad0); - preprocesor.AddComponent(pad1); - preprocesor.AddComponent(pad2); + calPadNoThr ->SetName(Form("%sFast", calPadNoThr->GetName())); + calPadThr10 ->SetName(Form("%sFast", calPadThr10->GetName())); + calPadThr20 ->SetName(Form("%sFast", calPadThr20->GetName())); + calPadThr30 ->SetName(Form("%sFast", calPadThr30->GetName())); + calNLocal ->SetName(Form("%sFast", calNLocal ->GetName())); + calPadMean ->SetName(Form("%sFast", calPadMean ->GetName())); + calPadMax ->SetName(Form("%sFast", calPadMax ->GetName())); + calNTime ->SetName(Form("%sFast", calNTime ->GetName())); + calNPad ->SetName(Form("%sFast", calNPad ->GetName())); + calTimePos ->SetName(Form("%sFast", calTimePos ->GetName())); + + preprocesor.AddComponent(calPadNoThr ); + preprocesor.AddComponent(calPadThr10 ); + preprocesor.AddComponent(calPadThr20 ); + preprocesor.AddComponent(calPadThr30 ); + preprocesor.AddComponent(calNLocal ); + preprocesor.AddComponent(calPadMean ); + preprocesor.AddComponent(calPadMax ); + preprocesor.AddComponent(calNTime ); + preprocesor.AddComponent(calNPad ); + preprocesor.AddComponent(calTimePos ); - preprocesor.DumpToFile("CalibTree2.root"); - AliTPCCalibViewerGUI::ShowGUI("CalibTree2.root"); + preprocesor.DumpToFile("CalibTreeTestAnalyse.root"); + AliTPCCalibViewerGUI::ShowGUI("CalibTreeTestAnalyse.root"); } -AliTPCCalibViewerGUI * gui=0; - -void UpdateGUI(const char *fname="dataQA.root"){ - // - // - // - TFile f2(fname); - AliTPCdataQA* ped = (AliTPCdataQA*)f2.Get("AliTPCdataQA"); - ped->MakeTree("CalibTree.root"); - if (!gui){ - gui = (AliTPCCalibViewerGUI)AliTPCCalibViewerGUI::ShowGUI("CalibTree.root")->At(0); - }else{ - gui->GetViewer(); - AliTPCCalibViewer *nviewer = new AliTPCCalibViewer("CalibTree.root", "calPads"); - gui->Initialize(nviewer); - } -} -- 2.39.3