X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TPC%2FAliTPCCalibPulser.cxx;h=c1893835f634f7ecd1463245ae99baa2a27eefd3;hb=306e591772fc9a7f8efc9dd32354d540f2671727;hp=1c88353712bc682cfb5a4e0690b112f87d87955e;hpb=3cd27a08a2f40f4fe808d1c5e47d2c9bdb85e54d;p=u%2Fmrichter%2FAliRoot.git diff --git a/TPC/AliTPCCalibPulser.cxx b/TPC/AliTPCCalibPulser.cxx index 1c88353712b..c1893835f63 100644 --- a/TPC/AliTPCCalibPulser.cxx +++ b/TPC/AliTPCCalibPulser.cxx @@ -181,6 +181,7 @@ #include "AliRawReaderRoot.h" #include "AliRawReaderDate.h" #include "AliTPCRawStream.h" +#include "AliTPCRawStreamFast.h" #include "AliTPCCalROC.h" #include "AliTPCCalPad.h" #include "AliTPCROC.h" @@ -188,6 +189,7 @@ #include "AliTPCCalibPulser.h" #include "AliTPCcalibDB.h" #include "AliMathBase.h" +#include "AliLog.h" #include "TTreeStream.h" //date @@ -214,9 +216,11 @@ AliTPCCalibPulser::AliTPCCalibPulser() : fLastSector(-1), fOldRCUformat(kTRUE), fROC(AliTPCROC::Instance()), + fMapping(NULL), fParam(new AliTPCParam), fPedestalTPC(0x0), fPadNoiseTPC(0x0), + fOutliers(0x0), fPedestalROC(0x0), fPadNoiseROC(0x0), fCalRocArrayT0(72), @@ -266,9 +270,11 @@ AliTPCCalibPulser::AliTPCCalibPulser(const AliTPCCalibPulser &sig) : fLastSector(-1), fOldRCUformat(kTRUE), fROC(AliTPCROC::Instance()), + fMapping(NULL), fParam(new AliTPCParam), fPedestalTPC(0x0), fPadNoiseTPC(0x0), + fOutliers(0x0), fPedestalROC(0x0), fPadNoiseROC(0x0), fCalRocArrayT0(72), @@ -351,6 +357,17 @@ AliTPCCalibPulser::~AliTPCCalibPulser() // destructor // + Reset(); + + if ( fDebugStreamer) delete fDebugStreamer; + delete fROC; + delete fParam; +} +void AliTPCCalibPulser::Reset() +{ + // + // Delete all information: Arrays, Histograms, CalRoc objects + // fCalRocArrayT0.Delete(); fCalRocArrayQ.Delete(); fCalRocArrayRMS.Delete(); @@ -364,10 +381,6 @@ AliTPCCalibPulser::~AliTPCCalibPulser() fPadQArrayEvent.Delete(); fPadRMSArrayEvent.Delete(); fPadPedestalArrayEvent.Delete(); - - if ( fDebugStreamer) delete fDebugStreamer; - delete fROC; - delete fParam; } //_____________________________________________________________________ Int_t AliTPCCalibPulser::Update(const Int_t icsector, @@ -381,8 +394,17 @@ Int_t AliTPCCalibPulser::Update(const Int_t icsector, // no extra analysis necessary. Assumes knowledge of the signal shape! // assumes that it is looped over consecutive time bins of one pad // + + if (icRow<0) return 0; + if (icPad<0) return 0; + if (icTimeBin<0) return 0; if ( (icTimeBin>fLastTimeBin) || (icTimeBinGetRowIndexes(icsector)[icRow]+icPad; // global pad position in sector //init first pad and sector in this event @@ -466,6 +488,7 @@ void AliTPCCalibPulser::FindPedestal(Float_t part) } // truncated mean // + // what if by chance histo[median] == 0 ?!? Float_t count=histo[median] ,mean=histo[median]*median, rms=histo[median]*median*median ; // for (Int_t idelta=1; idelta<10; ++idelta){ @@ -501,12 +524,18 @@ void AliTPCCalibPulser::FindPulserSignal(TVectorD ¶m, Float_t &qSum) Float_t ceQmax =0, ceQsum=0, ceTime=0, ceRMS=0; Int_t cemaxpos = fMaxTimeBin; - Float_t ceSumThreshold = 8.*fPadNoise; // threshold for the signal sum + Float_t ceSumThreshold = 10.*TMath::Max(fPadNoise,Float_t(1.)); // threshold for the signal sum + Float_t ceMaxThreshold = 5.*TMath::Max(fPadNoise,Float_t(1.)); // threshold for the signal max const Int_t kCemin = 2; // range for the analysis of the ce signal +- channels from the peak const Int_t kCemax = 7; + param[0] = ceQmax; + param[1] = ceTime; + param[2] = ceRMS; + qSum = ceQsum; - if (cemaxpos!=0){ - ceQmax = fPadSignal.GetMatrixArray()[cemaxpos]-fPadPedestal; + if (cemaxpos>0){ + ceQmax = fPadSignal.GetMatrixArray()[cemaxpos]-fPadPedestal; + if ( ceQmaxfFirstTimeBin) && (i0) ){ @@ -516,11 +545,19 @@ void AliTPCCalibPulser::FindPulserSignal(TVectorD ¶m, Float_t &qSum) } } } - if (ceQmax&&ceQsum>ceSumThreshold) { + if (ceQsum>ceSumThreshold) { ceTime/=ceQsum; ceRMS = TMath::Sqrt(TMath::Abs(ceRMS/ceQsum-ceTime*ceTime)); - fVTime0Offset.GetMatrixArray()[fCurrentSector]+=ceTime; // mean time for each sector - fVTime0OffsetCounter.GetMatrixArray()[fCurrentSector]++; + //only fill the Time0Offset if pad was not marked as an outlier! + if ( !fOutliers ){ + fVTime0Offset.GetMatrixArray()[fCurrentSector]+=ceTime; // mean time for each sector + fVTime0OffsetCounter.GetMatrixArray()[fCurrentSector]++; + } else { + if ( !(fOutliers->GetCalROC(fCurrentSector)->GetValue(fCurrentChannel)) ){ + fVTime0Offset.GetMatrixArray()[fCurrentSector]+=ceTime; // mean time for each sector + fVTime0OffsetCounter.GetMatrixArray()[fCurrentSector]++; + } + } //Normalise Q to the pad area Float_t norm = fParam->GetPadPitchWidth(fCurrentSector)*fParam->GetPadPitchLength(fCurrentSector,fCurrentRow); @@ -552,6 +589,7 @@ void AliTPCCalibPulser::ProcessPad() Double_t meanT = param[1]; Double_t sigmaT = param[2]; + //Fill Event T0 counter (*GetPadTimesEvent(fCurrentSector,kTRUE)).GetMatrixArray()[fCurrentChannel] = meanT; @@ -583,13 +621,13 @@ void AliTPCCalibPulser::EndEvent() //loop over all ROCs, fill Time0 histogram corrected for the mean Time0 of each ROC for ( Int_t iSec = 0; iSec<72; ++iSec ){ TVectorF *vTimes = GetPadTimesEvent(iSec); - if ( !vTimes ) continue; - + if ( !vTimes || fVTime0OffsetCounter[iSec]==0 ) continue; + Float_t time0 = fVTime0Offset[iSec]/fVTime0OffsetCounter[iSec]; for ( UInt_t iChannel=0; iChannelGetNChannels(iSec); ++iChannel ){ - Float_t time0 = fVTime0Offset[iSec]/fVTime0OffsetCounter[iSec]; Float_t time = (*vTimes).GetMatrixArray()[iChannel]; GetHistoT0(iSec,kTRUE)->Fill( time-time0,iChannel ); + //GetHistoT0(iSec,kTRUE)->Fill( time,iChannel ); //Debug start @@ -641,10 +679,51 @@ void AliTPCCalibPulser::EndEvent() delete h1; } //Debug end - } } +} +//_____________________________________________________________________ +Bool_t AliTPCCalibPulser::ProcessEventFast(AliTPCRawStreamFast *rawStreamFast) +{ + // + // Event Processing loop - AliTPCRawStream + // + ResetEvent(); + Bool_t withInput = kFALSE; + + 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; + } + } + } + } + if (withInput){ + EndEvent(); + } + return withInput; +} +//_____________________________________________________________________ +Bool_t AliTPCCalibPulser::ProcessEventFast(AliRawReader *rawReader) +{ + // + // Event processing loop - AliRawReader + // + AliTPCRawStreamFast *rawStreamFast = new AliTPCRawStreamFast(rawReader, (AliAltroMapping**)fMapping); + Bool_t res=ProcessEventFast(rawStreamFast); + delete rawStreamFast; + return res; } //_____________________________________________________________________ Bool_t AliTPCCalibPulser::ProcessEvent(AliTPCRawStream *rawStream) @@ -660,7 +739,6 @@ Bool_t AliTPCCalibPulser::ProcessEvent(AliTPCRawStream *rawStream) Bool_t withInput = kFALSE; while (rawStream->Next()) { - Int_t isector = rawStream->GetSector(); // current sector Int_t iRow = rawStream->GetRow(); // current row Int_t iPad = rawStream->GetPad(); // current pad @@ -670,11 +748,9 @@ Bool_t AliTPCCalibPulser::ProcessEvent(AliTPCRawStream *rawStream) Update(isector,iRow,iPad,iTimeBin,signal); withInput = kTRUE; } - if (withInput){ EndEvent(); } - return withInput; } //_____________________________________________________________________ @@ -685,7 +761,7 @@ Bool_t AliTPCCalibPulser::ProcessEvent(AliRawReader *rawReader) // - AliTPCRawStream rawStream(rawReader); + AliTPCRawStream rawStream(rawReader, (AliAltroMapping**)fMapping); rawReader->Select("TPC"); @@ -998,17 +1074,14 @@ void AliTPCCalibPulser::Analyse() for (UInt_t iChannel=0; iChannel ??) && (cogTime0??) ){ cogOut = 1; @@ -1062,9 +1133,7 @@ void AliTPCCalibPulser::Analyse() "\n"; } //! debug - } - } delete fDebugStreamer; fDebugStreamer = 0x0;