#include "AliTPCCalibPulser.h"
#include "AliTPCcalibDB.h"
#include "AliMathBase.h"
+#include "AliLog.h"
#include "TTreeStream.h"
//date
fLastSector(-1),
fOldRCUformat(kTRUE),
fROC(AliTPCROC::Instance()),
+ fMapping(NULL),
fParam(new AliTPCParam),
fPedestalTPC(0x0),
fPadNoiseTPC(0x0),
+ fOutliers(0x0),
fPedestalROC(0x0),
fPadNoiseROC(0x0),
fCalRocArrayT0(72),
fLastSector(-1),
fOldRCUformat(kTRUE),
fROC(AliTPCROC::Instance()),
+ fMapping(NULL),
fParam(new AliTPCParam),
fPedestalTPC(0x0),
fPadNoiseTPC(0x0),
+ fOutliers(0x0),
fPedestalROC(0x0),
fPadNoiseROC(0x0),
fCalRocArrayT0(72),
// 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();
fPadQArrayEvent.Delete();
fPadRMSArrayEvent.Delete();
fPadPedestalArrayEvent.Delete();
-
- if ( fDebugStreamer) delete fDebugStreamer;
- delete fROC;
- delete fParam;
}
//_____________________________________________________________________
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) || (icTimeBin<fFirstTimeBin) ) return 0;
+ if ( icRow<0 || icPad<0 ){
+ AliWarning("Wrong Pad or Row number, skipping!");
+ return 0;
+ }
+
Int_t iChannel = fROC->GetRowIndexes(icsector)[icRow]+icPad; // global pad position in sector
//init first pad and sector in this event
}
// 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){
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 ( ceQmax<ceMaxThreshold ) return;
for (Int_t i=cemaxpos-kCemin; i<cemaxpos+kCemax; ++i){
Float_t signal = fPadSignal.GetMatrixArray()[i]-fPadPedestal;
if ( (i>fFirstTimeBin) && (i<fLastTimeBin) && (signal>0) ){
}
}
}
- 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);
Double_t meanT = param[1];
Double_t sigmaT = param[2];
+
//Fill Event T0 counter
(*GetPadTimesEvent(fCurrentSector,kTRUE)).GetMatrixArray()[fCurrentChannel] = meanT;
//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; iChannel<fROC->GetNChannels(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
//
// Event processing loop - AliRawReader
//
- AliTPCRawStreamFast *rawStreamFast = new AliTPCRawStreamFast(rawReader);
+ AliTPCRawStreamFast *rawStreamFast = new AliTPCRawStreamFast(rawReader, (AliAltroMapping**)fMapping);
Bool_t res=ProcessEventFast(rawStreamFast);
delete rawStreamFast;
return res;
//
- AliTPCRawStream rawStream(rawReader);
+ AliTPCRawStream rawStream(rawReader, (AliAltroMapping**)fMapping);
rawReader->Select("TPC");